Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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