-
-
Notifications
You must be signed in to change notification settings - Fork 83
Expand file tree
/
Copy pathcontext.ts
More file actions
19 lines (16 loc) · 810 Bytes
/
Copy pathcontext.ts
File metadata and controls
19 lines (16 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import type { ViteDevToolsNodeContext } from '@vitejs/devtools-kit'
import type { KitPluginFileExplorerResolvedOptions } from '../types'
const fileExplorerOptions = new WeakMap<ViteDevToolsNodeContext, KitPluginFileExplorerResolvedOptions>()
export function setFileExplorerOptions(
context: ViteDevToolsNodeContext,
options: KitPluginFileExplorerResolvedOptions,
): void {
fileExplorerOptions.set(context, options)
}
export function getFileExplorerOptions(context: ViteDevToolsNodeContext): KitPluginFileExplorerResolvedOptions {
const options = fileExplorerOptions.get(context)
if (!options) {
throw new Error('[kit-plugin-file-explorer] Missing plugin options in context. Ensure setup calls setFileExplorerOptions(context, options) before registering RPC functions.')
}
return options
}