|
import { E as EncodedSourceMap } from './trace-mapping.d-xyIfZtPm.js'; |
|
|
|
type HMRPayload = |
|
| ConnectedPayload |
|
| UpdatePayload |
|
| FullReloadPayload |
|
| CustomPayload |
|
| ErrorPayload |
|
| PrunePayload |
|
|
|
interface ConnectedPayload { |
|
type: 'connected' |
|
} |
|
|
|
interface UpdatePayload { |
|
type: 'update' |
|
updates: Update[] |
|
} |
|
|
|
interface Update { |
|
type: 'js-update' | 'css-update' |
|
path: string |
|
acceptedPath: string |
|
timestamp: number |
|
|
|
explicitImportRequired?: boolean |
|
|
|
isWithinCircularImport?: boolean |
|
|
|
ssrInvalidates?: string[] |
|
} |
|
|
|
interface PrunePayload { |
|
type: 'prune' |
|
paths: string[] |
|
} |
|
|
|
interface FullReloadPayload { |
|
type: 'full-reload' |
|
path?: string |
|
|
|
triggeredBy?: string |
|
} |
|
|
|
interface CustomPayload { |
|
type: 'custom' |
|
event: string |
|
data?: any |
|
} |
|
|
|
interface ErrorPayload { |
|
type: 'error' |
|
err: { |
|
[name: string]: any |
|
message: string |
|
stack: string |
|
id?: string |
|
frame?: string |
|
plugin?: string |
|
pluginCode?: string |
|
loc?: { |
|
file?: string |
|
line: number |
|
column: number |
|
} |
|
} |
|
} |
|
|
|
interface CustomEventMap { |
|
'vite:beforeUpdate': UpdatePayload |
|
'vite:afterUpdate': UpdatePayload |
|
'vite:beforePrune': PrunePayload |
|
'vite:beforeFullReload': FullReloadPayload |
|
'vite:error': ErrorPayload |
|
'vite:invalidate': InvalidatePayload |
|
'vite:ws:connect': WebSocketConnectionPayload |
|
'vite:ws:disconnect': WebSocketConnectionPayload |
|
} |
|
|
|
interface WebSocketConnectionPayload { |
|
|
|
|
|
|
|
|
|
|
|
|
|
webSocket: WebSocket |
|
} |
|
|
|
interface InvalidatePayload { |
|
path: string |
|
message: string | undefined |
|
} |
|
|
|
|
|
|
|
|
|
type InferCustomEventPayload<T extends string> = |
|
T extends keyof CustomEventMap ? CustomEventMap[T] : any |
|
|
|
type ModuleNamespace = Record<string, any> & { |
|
[Symbol.toStringTag]: 'Module' |
|
} |
|
|
|
interface ViteHotContext { |
|
readonly data: any |
|
|
|
accept(): void |
|
accept(cb: (mod: ModuleNamespace | undefined) => void): void |
|
accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void |
|
accept( |
|
deps: readonly string[], |
|
cb: (mods: Array<ModuleNamespace | undefined>) => void, |
|
): void |
|
|
|
acceptExports( |
|
exportNames: string | readonly string[], |
|
cb?: (mod: ModuleNamespace | undefined) => void, |
|
): void |
|
|
|
dispose(cb: (data: any) => void): void |
|
prune(cb: (data: any) => void): void |
|
invalidate(message?: string): void |
|
|
|
on<T extends string>( |
|
event: T, |
|
cb: (payload: InferCustomEventPayload<T>) => void, |
|
): void |
|
off<T extends string>( |
|
event: T, |
|
cb: (payload: InferCustomEventPayload<T>) => void, |
|
): void |
|
send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void |
|
} |
|
|
|
declare const DEFAULT_REQUEST_STUBS: Record<string, Record<string, unknown>>; |
|
declare class ModuleCacheMap extends Map<string, ModuleCache> { |
|
normalizePath(fsPath: string): string; |
|
|
|
|
|
|
|
update(fsPath: string, mod: ModuleCache): this; |
|
setByModuleId(modulePath: string, mod: ModuleCache): this; |
|
set(fsPath: string, mod: ModuleCache): this; |
|
getByModuleId(modulePath: string): ModuleCache & Required<Pick<ModuleCache, "imports" | "importers">>; |
|
get(fsPath: string): ModuleCache & Required<Pick<ModuleCache, "imports" | "importers">>; |
|
deleteByModuleId(modulePath: string): boolean; |
|
delete(fsPath: string): boolean; |
|
invalidateModule(mod: ModuleCache): boolean; |
|
|
|
|
|
|
|
invalidateDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>; |
|
|
|
|
|
|
|
invalidateSubDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>; |
|
|
|
|
|
|
|
getSourceMap(id: string): EncodedSourceMap | null; |
|
} |
|
declare class ViteNodeRunner { |
|
options: ViteNodeRunnerOptions; |
|
root: string; |
|
debug: boolean; |
|
|
|
|
|
|
|
|
|
moduleCache: ModuleCacheMap; |
|
constructor(options: ViteNodeRunnerOptions); |
|
executeFile(file: string): Promise<any>; |
|
executeId(rawId: string): Promise<any>; |
|
|
|
cachedRequest(id: string, fsPath: string, callstack: string[]): Promise<any>; |
|
shouldResolveId(id: string, _importee?: string): boolean; |
|
private _resolveUrl; |
|
resolveUrl(id: string, importee?: string): Promise<[url: string, fsPath: string]>; |
|
|
|
dependencyRequest(id: string, fsPath: string, callstack: string[]): Promise<any>; |
|
|
|
directRequest(id: string, fsPath: string, _callstack: string[]): Promise<any>; |
|
protected getContextPrimitives(): { |
|
Object: ObjectConstructor; |
|
Reflect: typeof Reflect; |
|
Symbol: SymbolConstructor; |
|
}; |
|
protected runModule(context: Record<string, any>, transformed: string): Promise<void>; |
|
prepareContext(context: Record<string, any>): Record<string, any>; |
|
|
|
|
|
|
|
|
|
shouldInterop(path: string, mod: any): boolean; |
|
protected importExternalModule(path: string): Promise<any>; |
|
|
|
|
|
|
|
interopedImport(path: string): Promise<any>; |
|
} |
|
|
|
type Nullable<T> = T | null | undefined; |
|
type Arrayable<T> = T | Array<T>; |
|
type Awaitable<T> = T | PromiseLike<T>; |
|
interface DepsHandlingOptions { |
|
external?: (string | RegExp)[]; |
|
inline?: (string | RegExp)[] | true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
moduleDirectories?: string[]; |
|
cacheDir?: string; |
|
|
|
|
|
|
|
|
|
fallbackCJS?: boolean; |
|
} |
|
interface StartOfSourceMap { |
|
file?: string; |
|
sourceRoot?: string; |
|
} |
|
|
|
interface RawSourceMap extends StartOfSourceMap { |
|
version: number; |
|
sources: string[]; |
|
names: string[]; |
|
sourcesContent?: (string | null)[]; |
|
mappings: string; |
|
} |
|
interface FetchResult { |
|
code?: string; |
|
externalize?: string; |
|
map?: EncodedSourceMap | null; |
|
} |
|
type HotContext = Omit<ViteHotContext, 'acceptDeps' | 'decline'>; |
|
type FetchFunction = (id: string) => Promise<FetchResult>; |
|
type ResolveIdFunction = (id: string, importer?: string) => Awaitable<ViteNodeResolveId | null | undefined | void>; |
|
type CreateHotContextFunction = (runner: ViteNodeRunner, url: string) => HotContext; |
|
interface ModuleCache { |
|
promise?: Promise<any>; |
|
exports?: any; |
|
evaluated?: boolean; |
|
resolving?: boolean; |
|
code?: string; |
|
map?: EncodedSourceMap; |
|
|
|
|
|
|
|
importers?: Set<string>; |
|
imports?: Set<string>; |
|
} |
|
interface ViteNodeRunnerOptions { |
|
root: string; |
|
fetchModule: FetchFunction; |
|
resolveId?: ResolveIdFunction; |
|
createHotContext?: CreateHotContextFunction; |
|
base?: string; |
|
moduleCache?: ModuleCacheMap; |
|
interopDefault?: boolean; |
|
requestStubs?: Record<string, any>; |
|
debug?: boolean; |
|
} |
|
interface ViteNodeResolveId { |
|
external?: boolean | 'absolute' | 'relative'; |
|
id: string; |
|
meta?: Record<string, any> | null; |
|
moduleSideEffects?: boolean | 'no-treeshake' | null; |
|
syntheticNamedExports?: boolean | string | null; |
|
} |
|
interface ViteNodeServerOptions { |
|
|
|
|
|
|
|
|
|
sourcemap?: 'inline' | boolean; |
|
|
|
|
|
|
|
deps?: DepsHandlingOptions; |
|
|
|
|
|
|
|
transformMode?: { |
|
ssr?: RegExp[]; |
|
web?: RegExp[]; |
|
}; |
|
debug?: DebuggerOptions; |
|
} |
|
interface DebuggerOptions { |
|
|
|
|
|
|
|
|
|
dumpModules?: boolean | string; |
|
|
|
|
|
|
|
|
|
loadDumppedModules?: boolean; |
|
} |
|
|
|
export { type Arrayable as A, type CustomEventMap as C, type DebuggerOptions as D, type FetchResult as F, type HMRPayload as H, ModuleCacheMap as M, type Nullable as N, type RawSourceMap as R, type StartOfSourceMap as S, type ViteNodeServerOptions as V, ViteNodeRunner as a, type HotContext as b, type DepsHandlingOptions as c, type ViteNodeResolveId as d, DEFAULT_REQUEST_STUBS as e, type Awaitable as f, type FetchFunction as g, type ResolveIdFunction as h, type CreateHotContextFunction as i, type ModuleCache as j, type ViteNodeRunnerOptions as k }; |
|
|