| import { ModuleNamespace, ViteHotContext } from '../../types/hot.js'; |
| import { Update, HotPayload } from '../../types/hmrPayload.js'; |
| import { InferCustomEventPayload } from '../../types/customEvent.js'; |
| import { N as NormalizedModuleRunnerTransport, E as ExternalFetchResult, V as ViteFetchResult, M as ModuleRunnerTransport, F as FetchFunctionOptions, a as FetchResult } from './moduleRunnerTransport.d-DJ_mE5sf.js'; |
| export { b as ModuleRunnerTransportHandlers, c as createWebSocketModuleRunnerTransport } from './moduleRunnerTransport.d-DJ_mE5sf.js'; |
|
|
| interface SourceMapLike { |
| version: number; |
| mappings?: string; |
| names?: string[]; |
| sources?: string[]; |
| sourcesContent?: string[]; |
| } |
| declare class DecodedMap { |
| map: SourceMapLike; |
| _encoded: string; |
| _decoded: undefined | number[][][]; |
| _decodedMemo: Stats; |
| url: string; |
| version: number; |
| names: string[]; |
| resolvedSources: string[]; |
| constructor(map: SourceMapLike, from: string); |
| } |
| interface Stats { |
| lastKey: number; |
| lastNeedle: number; |
| lastIndex: number; |
| } |
|
|
| type CustomListenersMap = Map<string, ((data: any) => void)[]>; |
| interface HotModule { |
| id: string; |
| callbacks: HotCallback[]; |
| } |
| interface HotCallback { |
| deps: string[]; |
| fn: (modules: Array<ModuleNamespace | undefined>) => void; |
| } |
| interface HMRLogger { |
| error(msg: string | Error): void; |
| debug(...msg: unknown[]): void; |
| } |
| declare class HMRClient { |
| logger: HMRLogger; |
| private transport; |
| private importUpdatedModule; |
| hotModulesMap: Map<string, HotModule>; |
| disposeMap: Map<string, (data: any) => void | Promise<void>>; |
| pruneMap: Map<string, (data: any) => void | Promise<void>>; |
| dataMap: Map<string, any>; |
| customListenersMap: CustomListenersMap; |
| ctxToListenersMap: Map<string, CustomListenersMap>; |
| currentFirstInvalidatedBy: string | undefined; |
| constructor(logger: HMRLogger, transport: NormalizedModuleRunnerTransport, importUpdatedModule: (update: Update) => Promise<ModuleNamespace>); |
| notifyListeners<T extends string>(event: T, data: InferCustomEventPayload<T>): Promise<void>; |
| send(payload: HotPayload): void; |
| clear(): void; |
| prunePaths(paths: string[]): Promise<void>; |
| protected warnFailedUpdate(err: Error, path: string | string[]): void; |
| private updateQueue; |
| private pendingUpdateQueue; |
| |
| |
| |
| |
| |
| queueUpdate(payload: Update): Promise<void>; |
| private fetchUpdate; |
| } |
|
|
| interface DefineImportMetadata { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| importedNames?: string[]; |
| } |
| interface SSRImportMetadata extends DefineImportMetadata { |
| isDynamicImport?: boolean; |
| } |
|
|
| declare const ssrModuleExportsKey = "__vite_ssr_exports__"; |
| declare const ssrImportKey = "__vite_ssr_import__"; |
| declare const ssrDynamicImportKey = "__vite_ssr_dynamic_import__"; |
| declare const ssrExportAllKey = "__vite_ssr_exportAll__"; |
| declare const ssrImportMetaKey = "__vite_ssr_import_meta__"; |
|
|
| interface ModuleRunnerDebugger { |
| (formatter: unknown, ...args: unknown[]): void; |
| } |
| declare class ModuleRunner { |
| options: ModuleRunnerOptions; |
| evaluator: ModuleEvaluator; |
| private debug?; |
| evaluatedModules: EvaluatedModules; |
| hmrClient?: HMRClient; |
| private readonly envProxy; |
| private readonly transport; |
| private readonly resetSourceMapSupport?; |
| private readonly concurrentModuleNodePromises; |
| private closed; |
| constructor(options: ModuleRunnerOptions, evaluator?: ModuleEvaluator, debug?: ModuleRunnerDebugger | undefined); |
| |
| |
| |
| import<T = any>(url: string): Promise<T>; |
| |
| |
| |
| clearCache(): void; |
| |
| |
| |
| |
| close(): Promise<void>; |
| |
| |
| |
| isClosed(): boolean; |
| private processImport; |
| private isCircularModule; |
| private isCircularImport; |
| private cachedRequest; |
| private cachedModule; |
| private getModuleInformation; |
| protected directRequest(url: string, mod: EvaluatedModuleNode, _callstack: string[]): Promise<any>; |
| } |
|
|
| interface RetrieveFileHandler { |
| (path: string): string | null | undefined | false; |
| } |
| interface RetrieveSourceMapHandler { |
| (path: string): null | { |
| url: string; |
| map: any; |
| }; |
| } |
| interface InterceptorOptions { |
| retrieveFile?: RetrieveFileHandler; |
| retrieveSourceMap?: RetrieveSourceMapHandler; |
| } |
|
|
| interface ModuleRunnerImportMeta extends ImportMeta { |
| url: string; |
| env: ImportMetaEnv; |
| hot?: ViteHotContext; |
| [key: string]: any; |
| } |
| interface ModuleRunnerContext { |
| [ssrModuleExportsKey]: Record<string, any>; |
| [ssrImportKey]: (id: string, metadata?: DefineImportMetadata) => Promise<any>; |
| [ssrDynamicImportKey]: (id: string, options?: ImportCallOptions) => Promise<any>; |
| [ssrExportAllKey]: (obj: any) => void; |
| [ssrImportMetaKey]: ModuleRunnerImportMeta; |
| } |
| interface ModuleEvaluator { |
| |
| |
| |
| startOffset?: number; |
| |
| |
| |
| |
| |
| |
| runInlinedModule(context: ModuleRunnerContext, code: string, module: Readonly<EvaluatedModuleNode>): Promise<any>; |
| |
| |
| |
| |
| runExternalModule(file: string): Promise<any>; |
| } |
| type ResolvedResult = (ExternalFetchResult | ViteFetchResult) & { |
| url: string; |
| id: string; |
| }; |
| type FetchFunction = (id: string, importer?: string, options?: FetchFunctionOptions) => Promise<FetchResult>; |
| interface ModuleRunnerHmr { |
| |
| |
| |
| logger?: false | HMRLogger; |
| } |
| interface ModuleRunnerOptions { |
| |
| |
| |
| |
| root?: string; |
| |
| |
| |
| transport: ModuleRunnerTransport; |
| |
| |
| |
| |
| |
| sourcemapInterceptor?: false | 'node' | 'prepareStackTrace' | InterceptorOptions; |
| |
| |
| |
| |
| |
| hmr?: boolean | ModuleRunnerHmr; |
| |
| |
| |
| evaluatedModules?: EvaluatedModules; |
| } |
| interface ImportMetaEnv { |
| [key: string]: any; |
| BASE_URL: string; |
| MODE: string; |
| DEV: boolean; |
| PROD: boolean; |
| SSR: boolean; |
| } |
|
|
| declare class EvaluatedModuleNode { |
| id: string; |
| url: string; |
| importers: Set<string>; |
| imports: Set<string>; |
| evaluated: boolean; |
| meta: ResolvedResult | undefined; |
| promise: Promise<any> | undefined; |
| exports: any | undefined; |
| file: string; |
| map: DecodedMap | undefined; |
| constructor(id: string, url: string); |
| } |
| declare class EvaluatedModules { |
| readonly idToModuleMap: Map<string, EvaluatedModuleNode>; |
| readonly fileToModulesMap: Map<string, Set<EvaluatedModuleNode>>; |
| readonly urlToIdModuleMap: Map<string, EvaluatedModuleNode>; |
| |
| |
| |
| |
| |
| |
| |
| getModuleById(id: string): EvaluatedModuleNode | undefined; |
| |
| |
| |
| |
| |
| |
| getModulesByFile(file: string): Set<EvaluatedModuleNode> | undefined; |
| |
| |
| |
| |
| |
| getModuleByUrl(url: string): EvaluatedModuleNode | undefined; |
| |
| |
| |
| |
| |
| |
| |
| ensureModule(id: string, url: string): EvaluatedModuleNode; |
| invalidateModule(node: EvaluatedModuleNode): void; |
| |
| |
| |
| |
| |
| getModuleSourceMapById(id: string): DecodedMap | null; |
| clear(): void; |
| } |
|
|
| declare class ESModulesEvaluator implements ModuleEvaluator { |
| readonly startOffset: number; |
| runInlinedModule(context: ModuleRunnerContext, code: string): Promise<any>; |
| runExternalModule(filepath: string): Promise<any>; |
| } |
|
|
| export { ESModulesEvaluator, EvaluatedModuleNode, EvaluatedModules, FetchFunctionOptions, FetchResult, ModuleRunner, ModuleRunnerTransport, ssrDynamicImportKey, ssrExportAllKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey }; |
| export type { FetchFunction, HMRLogger, InterceptorOptions, ModuleEvaluator, ModuleRunnerContext, ModuleRunnerHmr, ModuleRunnerImportMeta, ModuleRunnerOptions, ResolvedResult, SSRImportMetadata }; |
|
|