Skip to content

Commit

Permalink
fix(pre-fetch): support github driver (#1433)
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Aug 11, 2022
1 parent 774fde3 commit 58ba46f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 58ba46f

Please sign in to comment.