From 62d5b76fe88460debfdb54669bfafcfa4240eabd Mon Sep 17 00:00:00 2001 From: Ahad Birang Date: Thu, 11 Aug 2022 15:19:01 +0430 Subject: [PATCH] fix(pre-fetch): support github driver --- src/utils.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 6e832485c..f2ff80a76 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -3,6 +3,7 @@ import { resolve } from 'pathe' import type { Nuxt } from '@nuxt/schema' import fsDriver from 'unstorage/drivers/fs' import httpDriver from 'unstorage/drivers/http' +import githubDriver from 'unstorage/drivers/github' import { WebSocketServer } from 'ws' import { useLogger } from '@nuxt/kit' import type { ModuleOptions, MountOptions } from './module' @@ -45,16 +46,17 @@ export const PROSE_TAGS = [ 'tr' ] +const unstorageDrivers = { + fs: fsDriver, + http: httpDriver, + github: githubDriver +} /** * Resolve driver of a mount. */ export function getMountDriver (mount: MountOptions) { - if (mount.driver === 'fs') { - return fsDriver(mount as any) - } - - if (mount.driver === 'http') { - return httpDriver(mount as any) + if (unstorageDrivers[mount.driver]) { + return unstorageDrivers[mount.driver](mount as any) } try {