vite-node
Advanced tools
| import { E as EncodedSourceMap } from './trace-mapping.d-DLVdEqOp.js'; | ||
| /** @deprecated use HotPayload */ | ||
| type HMRPayload = HotPayload | ||
| type HotPayload = | ||
| | ConnectedPayload | ||
| | PingPayload | ||
| | UpdatePayload | ||
| | FullReloadPayload | ||
| | CustomPayload | ||
| | ErrorPayload | ||
| | PrunePayload | ||
| interface ConnectedPayload { | ||
| type: 'connected' | ||
| } | ||
| interface PingPayload { | ||
| type: 'ping' | ||
| } | ||
| interface UpdatePayload { | ||
| type: 'update' | ||
| updates: Update[] | ||
| } | ||
| interface Update { | ||
| type: 'js-update' | 'css-update' | ||
| path: string | ||
| acceptedPath: string | ||
| timestamp: number | ||
| /** @internal */ | ||
| explicitImportRequired?: boolean | ||
| /** @internal */ | ||
| isWithinCircularImport?: boolean | ||
| /** @internal */ | ||
| invalidates?: string[] | ||
| } | ||
| interface PrunePayload { | ||
| type: 'prune' | ||
| paths: string[] | ||
| } | ||
| interface FullReloadPayload { | ||
| type: 'full-reload' | ||
| path?: string | ||
| /** @internal */ | ||
| 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 { | ||
| /** | ||
| * @experimental | ||
| * We expose this instance experimentally to see potential usage. | ||
| * This might be removed in the future if we didn't find reasonable use cases. | ||
| * If you find this useful, please open an issue with details so we can discuss and make it stable API. | ||
| */ | ||
| // eslint-disable-next-line n/no-unsupported-features/node-builtins | ||
| webSocket: WebSocket | ||
| } | ||
| interface InvalidatePayload { | ||
| path: string | ||
| message: string | undefined | ||
| } | ||
| /** | ||
| * provides types for built-in Vite events | ||
| */ | ||
| 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; | ||
| /** | ||
| * Assign partial data to the map | ||
| */ | ||
| 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, 'importers' | 'imports'>>; | ||
| deleteByModuleId(modulePath: string): boolean; | ||
| delete(fsPath: string): boolean; | ||
| invalidateModule(mod: ModuleCache): boolean; | ||
| /** | ||
| * Invalidate modules that dependent on the given modules, up to the main entry | ||
| */ | ||
| invalidateDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>; | ||
| /** | ||
| * Invalidate dependency modules of the given modules, down to the bottom-level dependencies | ||
| */ | ||
| invalidateSubDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>; | ||
| /** | ||
| * Return parsed source map based on inlined source map of the module | ||
| */ | ||
| getSourceMap(id: string): EncodedSourceMap | null; | ||
| } | ||
| type ModuleExecutionInfo = Map<string, { | ||
| startOffset: number; | ||
| }>; | ||
| declare class ViteNodeRunner { | ||
| options: ViteNodeRunnerOptions; | ||
| root: string; | ||
| debug: boolean; | ||
| /** | ||
| * Holds the cache of modules | ||
| * Keys of the map are filepaths, or plain package names | ||
| */ | ||
| moduleCache: ModuleCacheMap; | ||
| constructor(options: ViteNodeRunnerOptions); | ||
| executeFile(file: string): Promise<any>; | ||
| executeId(rawId: string): Promise<any>; | ||
| shouldResolveId(id: string, _importee?: string): boolean; | ||
| private _resolveUrl; | ||
| resolveUrl(id: string, importee?: string): Promise<[url: string, fsPath: string]>; | ||
| 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>; | ||
| /** | ||
| * Define if a module should be interop-ed | ||
| * This function mostly for the ability to override by subclass | ||
| */ | ||
| shouldInterop(path: string, mod: any): boolean; | ||
| protected importExternalModule(path: string): Promise<any>; | ||
| /** | ||
| * Import a module and interop it | ||
| */ | ||
| 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; | ||
| inlineFiles?: string[]; | ||
| /** | ||
| * A list of directories that are considered to hold Node.js modules | ||
| * Have to include "/" at the start and end of the path | ||
| * | ||
| * Vite-Node checks the whole absolute path of the import, so make sure you don't include | ||
| * unwanted files accidentally | ||
| * @default ['/node_modules/'] | ||
| */ | ||
| moduleDirectories?: string[]; | ||
| cacheDir?: string; | ||
| /** | ||
| * Try to guess the CJS version of a package when it's invalid ESM | ||
| * @default false | ||
| */ | ||
| 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; | ||
| /** | ||
| * Module ids that imports this module | ||
| */ | ||
| importers?: Set<string>; | ||
| imports?: Set<string>; | ||
| } | ||
| interface ViteNodeRunnerOptions { | ||
| root: string; | ||
| fetchModule: FetchFunction; | ||
| resolveId?: ResolveIdFunction; | ||
| createHotContext?: CreateHotContextFunction; | ||
| base?: string; | ||
| moduleCache?: ModuleCacheMap; | ||
| moduleExecutionInfo?: ModuleExecutionInfo; | ||
| 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 ViteNodeResolveModule { | ||
| external: string | null; | ||
| id: string; | ||
| fsPath: string; | ||
| } | ||
| interface ViteNodeServerOptions { | ||
| /** | ||
| * Inject inline sourcemap to modules | ||
| * @default 'inline' | ||
| */ | ||
| sourcemap?: 'inline' | boolean; | ||
| /** | ||
| * Deps handling | ||
| */ | ||
| deps?: DepsHandlingOptions; | ||
| /** | ||
| * Transform method for modules | ||
| */ | ||
| transformMode?: { | ||
| ssr?: RegExp[]; | ||
| web?: RegExp[]; | ||
| }; | ||
| debug?: DebuggerOptions; | ||
| } | ||
| interface DebuggerOptions { | ||
| /** | ||
| * Dump the transformed module to filesystem | ||
| * Passing a string will dump to the specified path | ||
| */ | ||
| dumpModules?: boolean | string; | ||
| /** | ||
| * Read dumpped module from filesystem whenever exists. | ||
| * Useful for debugging by modifying the dump result from the filesystem. | ||
| */ | ||
| 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 ModuleExecutionInfo as f, type Awaitable as g, type FetchFunction as h, type ResolveIdFunction as i, type CreateHotContextFunction as j, type ModuleCache as k, type ViteNodeRunnerOptions as l, type ViteNodeResolveModule as m }; |
@@ -53,4 +53,4 @@ 'use strict'; | ||
| function C(n = false) { | ||
| let e = typeof process != "undefined" ? process : undefined, i = (e == null ? undefined : e.env) || {}, g = (e == null ? undefined : e.argv) || []; | ||
| return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ? undefined : e.platform) === "win32" || n && i.TERM !== "dumb" || "CI" in i) || typeof window != "undefined" && !!window.chrome; | ||
| let e = typeof process != "undefined" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || []; | ||
| return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || n && i.TERM !== "dumb" || "CI" in i) || typeof window != "undefined" && !!window.chrome; | ||
| } | ||
@@ -57,0 +57,0 @@ function p(n = false) { |
@@ -51,4 +51,4 @@ // src/index.ts | ||
| function C(n = false) { | ||
| let e = typeof process != "undefined" ? process : undefined, i = (e == null ? undefined : e.env) || {}, g = (e == null ? undefined : e.argv) || []; | ||
| return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ? undefined : e.platform) === "win32" || n && i.TERM !== "dumb" || "CI" in i) || typeof window != "undefined" && !!window.chrome; | ||
| let e = typeof process != "undefined" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || []; | ||
| return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || n && i.TERM !== "dumb" || "CI" in i) || typeof window != "undefined" && !!window.chrome; | ||
| } | ||
@@ -55,0 +55,0 @@ function p(n = false) { |
@@ -114,3 +114,3 @@ 'use strict'; | ||
| for (const { deps, fn } of qualifiedCallbacks) { | ||
| fn(deps.map((dep) => dep === acceptedPath ? fetchedModule : undefined)); | ||
| fn(deps.map((dep) => dep === acceptedPath ? fetchedModule : void 0)); | ||
| } | ||
@@ -228,3 +228,3 @@ const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`; | ||
| path: ownerPath, | ||
| message: undefined | ||
| message: void 0 | ||
| }); | ||
@@ -245,3 +245,3 @@ return reload(runner, files); | ||
| const existing = map.get(event); | ||
| if (existing === undefined) { | ||
| if (existing === void 0) { | ||
| return; | ||
@@ -248,0 +248,0 @@ } |
@@ -112,3 +112,3 @@ import { EventEmitter } from 'node:events'; | ||
| for (const { deps, fn } of qualifiedCallbacks) { | ||
| fn(deps.map((dep) => dep === acceptedPath ? fetchedModule : undefined)); | ||
| fn(deps.map((dep) => dep === acceptedPath ? fetchedModule : void 0)); | ||
| } | ||
@@ -226,3 +226,3 @@ const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`; | ||
| path: ownerPath, | ||
| message: undefined | ||
| message: void 0 | ||
| }); | ||
@@ -243,3 +243,3 @@ return reload(runner, files); | ||
| const existing = map.get(event); | ||
| if (existing === undefined) { | ||
| if (existing === void 0) { | ||
| return; | ||
@@ -246,0 +246,0 @@ } |
+9
-9
@@ -24,3 +24,3 @@ 'use strict'; | ||
| var version = "3.0.5"; | ||
| var version = "3.0.6"; | ||
@@ -74,3 +74,3 @@ const cli = cac("vite-node"); | ||
| hmr: !!options.watch, | ||
| watch: options.watch ? undefined : null | ||
| watch: options.watch ? void 0 : null | ||
| }, | ||
@@ -108,3 +108,3 @@ plugins: [options.watch && hmr.viteNodeHmrPlugin()] | ||
| } | ||
| (_b = server$1.emitter) == null ? undefined : _b.on("message", (payload) => { | ||
| (_b = server$1.emitter) == null ? void 0 : _b.on("message", (payload) => { | ||
| hmr.handleMessage(runner, server$1.emitter, files, payload); | ||
@@ -120,3 +120,3 @@ }); | ||
| var _a, _b, _c, _d, _e, _f, _g, _h; | ||
| const inlineOptions = ((_a = serverOptions.deps) == null ? undefined : _a.inline) === true ? true : utils.toArray((_b = serverOptions.deps) == null ? undefined : _b.inline); | ||
| const inlineOptions = ((_a = serverOptions.deps) == null ? void 0 : _a.inline) === true ? true : utils.toArray((_b = serverOptions.deps) == null ? void 0 : _b.inline); | ||
| return { | ||
@@ -126,17 +126,17 @@ ...serverOptions, | ||
| ...serverOptions.deps, | ||
| inlineFiles: utils.toArray((_c = serverOptions.deps) == null ? undefined : _c.inlineFiles), | ||
| inlineFiles: utils.toArray((_c = serverOptions.deps) == null ? void 0 : _c.inlineFiles), | ||
| inline: inlineOptions !== true ? inlineOptions.map((dep) => { | ||
| return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep; | ||
| }) : true, | ||
| external: utils.toArray((_d = serverOptions.deps) == null ? undefined : _d.external).map((dep) => { | ||
| external: utils.toArray((_d = serverOptions.deps) == null ? void 0 : _d.external).map((dep) => { | ||
| return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep; | ||
| }), | ||
| moduleDirectories: ((_e = serverOptions.deps) == null ? undefined : _e.moduleDirectories) ? utils.toArray((_f = serverOptions.deps) == null ? undefined : _f.moduleDirectories) : undefined | ||
| moduleDirectories: ((_e = serverOptions.deps) == null ? void 0 : _e.moduleDirectories) ? utils.toArray((_f = serverOptions.deps) == null ? void 0 : _f.moduleDirectories) : void 0 | ||
| }, | ||
| transformMode: { | ||
| ...serverOptions.transformMode, | ||
| ssr: utils.toArray((_g = serverOptions.transformMode) == null ? undefined : _g.ssr).map( | ||
| ssr: utils.toArray((_g = serverOptions.transformMode) == null ? void 0 : _g.ssr).map( | ||
| (dep) => new RegExp(dep) | ||
| ), | ||
| web: utils.toArray((_h = serverOptions.transformMode) == null ? undefined : _h.web).map( | ||
| web: utils.toArray((_h = serverOptions.transformMode) == null ? void 0 : _h.web).map( | ||
| (dep) => new RegExp(dep) | ||
@@ -143,0 +143,0 @@ ) |
+1
-1
@@ -1,2 +0,2 @@ | ||
| import { V as ViteNodeServerOptions } from './index-BmdeEDlf.js'; | ||
| import { V as ViteNodeServerOptions } from './index-LQxw79Gm.js'; | ||
| import './trace-mapping.d-DLVdEqOp.js'; | ||
@@ -3,0 +3,0 @@ |
+9
-9
@@ -22,3 +22,3 @@ import { resolve } from 'node:path'; | ||
| var version = "3.0.5"; | ||
| var version = "3.0.6"; | ||
@@ -72,3 +72,3 @@ const cli = cac("vite-node"); | ||
| hmr: !!options.watch, | ||
| watch: options.watch ? undefined : null | ||
| watch: options.watch ? void 0 : null | ||
| }, | ||
@@ -106,3 +106,3 @@ plugins: [options.watch && viteNodeHmrPlugin()] | ||
| } | ||
| (_b = server.emitter) == null ? undefined : _b.on("message", (payload) => { | ||
| (_b = server.emitter) == null ? void 0 : _b.on("message", (payload) => { | ||
| handleMessage(runner, server.emitter, files, payload); | ||
@@ -118,3 +118,3 @@ }); | ||
| var _a, _b, _c, _d, _e, _f, _g, _h; | ||
| const inlineOptions = ((_a = serverOptions.deps) == null ? undefined : _a.inline) === true ? true : toArray((_b = serverOptions.deps) == null ? undefined : _b.inline); | ||
| const inlineOptions = ((_a = serverOptions.deps) == null ? void 0 : _a.inline) === true ? true : toArray((_b = serverOptions.deps) == null ? void 0 : _b.inline); | ||
| return { | ||
@@ -124,17 +124,17 @@ ...serverOptions, | ||
| ...serverOptions.deps, | ||
| inlineFiles: toArray((_c = serverOptions.deps) == null ? undefined : _c.inlineFiles), | ||
| inlineFiles: toArray((_c = serverOptions.deps) == null ? void 0 : _c.inlineFiles), | ||
| inline: inlineOptions !== true ? inlineOptions.map((dep) => { | ||
| return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep; | ||
| }) : true, | ||
| external: toArray((_d = serverOptions.deps) == null ? undefined : _d.external).map((dep) => { | ||
| external: toArray((_d = serverOptions.deps) == null ? void 0 : _d.external).map((dep) => { | ||
| return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep; | ||
| }), | ||
| moduleDirectories: ((_e = serverOptions.deps) == null ? undefined : _e.moduleDirectories) ? toArray((_f = serverOptions.deps) == null ? undefined : _f.moduleDirectories) : undefined | ||
| moduleDirectories: ((_e = serverOptions.deps) == null ? void 0 : _e.moduleDirectories) ? toArray((_f = serverOptions.deps) == null ? void 0 : _f.moduleDirectories) : void 0 | ||
| }, | ||
| transformMode: { | ||
| ...serverOptions.transformMode, | ||
| ssr: toArray((_g = serverOptions.transformMode) == null ? undefined : _g.ssr).map( | ||
| ssr: toArray((_g = serverOptions.transformMode) == null ? void 0 : _g.ssr).map( | ||
| (dep) => new RegExp(dep) | ||
| ), | ||
| web: toArray((_h = serverOptions.transformMode) == null ? undefined : _h.web).map( | ||
| web: toArray((_h = serverOptions.transformMode) == null ? void 0 : _h.web).map( | ||
| (dep) => new RegExp(dep) | ||
@@ -141,0 +141,0 @@ ) |
+12
-10
@@ -96,4 +96,4 @@ 'use strict'; | ||
| delete mod.exports; | ||
| (_a = mod.importers) == null ? undefined : _a.clear(); | ||
| (_b = mod.imports) == null ? undefined : _b.clear(); | ||
| (_a = mod.importers) == null ? void 0 : _a.clear(); | ||
| (_b = mod.imports) == null ? void 0 : _b.clear(); | ||
| return true; | ||
@@ -112,3 +112,3 @@ } | ||
| const mod = super.get(id); | ||
| if (mod == null ? undefined : mod.importers) { | ||
| if (mod == null ? void 0 : mod.importers) { | ||
| this.invalidateDepTree(mod.importers, invalidated); | ||
@@ -132,3 +132,3 @@ } | ||
| var _a; | ||
| return (_a = mod.importers) == null ? undefined : _a.has(id); | ||
| return (_a = mod.importers) == null ? void 0 : _a.has(id); | ||
| }).map(([key]) => key); | ||
@@ -233,3 +233,3 @@ if (subIds.length) { | ||
| const resolved = await this.options.resolveId(dep, importer); | ||
| if ((_b = (_a = resolved == null ? undefined : resolved.meta) == null ? undefined : _a["vite:alias"]) == null ? undefined : _b.noResolved) { | ||
| if ((_b = (_a = resolved == null ? void 0 : resolved.meta) == null ? void 0 : _a["vite:alias"]) == null ? void 0 : _b.noResolved) { | ||
| const error = new Error( | ||
@@ -332,3 +332,3 @@ `Cannot find module '${id}'${importer ? ` imported from '${importer}'` : ""}. | ||
| if (moduleExports !== SYMBOL_NOT_DEFINED && utils.isPrimitive(moduleExports)) { | ||
| defineExport(exports, p, () => undefined); | ||
| defineExport(exports, p, () => void 0); | ||
| return true; | ||
@@ -362,3 +362,3 @@ } | ||
| var _a, _b; | ||
| hotContext || (hotContext = (_b = (_a = this.options).createHotContext) == null ? undefined : _b.call(_a, this, moduleId)); | ||
| hotContext || (hotContext = (_b = (_a = this.options).createHotContext) == null ? void 0 : _b.call(_a, this, moduleId)); | ||
| return hotContext; | ||
@@ -396,2 +396,3 @@ }, | ||
| async runModule(context, transformed) { | ||
| var _a; | ||
| const codeDefinition = `'use strict';async (${Object.keys(context).join( | ||
@@ -407,2 +408,3 @@ "," | ||
| }; | ||
| (_a = this.options.moduleExecutionInfo) == null ? void 0 : _a.set(options.filename, { startOffset: codeDefinition.length }); | ||
| const fn = vm.runInThisContext(code, options); | ||
@@ -441,7 +443,7 @@ await fn(...Object.values(context)); | ||
| } | ||
| return mod2[prop] ?? (defaultExport == null ? undefined : defaultExport[prop]); | ||
| return mod2[prop] ?? (defaultExport == null ? void 0 : defaultExport[prop]); | ||
| }, | ||
| has(mod2, prop) { | ||
| if (prop === "default") { | ||
| return defaultExport !== undefined; | ||
| return defaultExport !== void 0; | ||
| } | ||
@@ -455,3 +457,3 @@ return prop in mod2 || defaultExport && prop in defaultExport; | ||
| } | ||
| if (prop === "default" && defaultExport !== undefined) { | ||
| if (prop === "default" && defaultExport !== void 0) { | ||
| return { | ||
@@ -458,0 +460,0 @@ value: defaultExport, |
+1
-1
| import './trace-mapping.d-DLVdEqOp.js'; | ||
| export { e as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, a as ViteNodeRunner } from './index-BmdeEDlf.js'; | ||
| export { e as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, f as ModuleExecutionInfo, a as ViteNodeRunner } from './index-LQxw79Gm.js'; |
+13
-11
@@ -7,3 +7,3 @@ import { createRequire } from 'node:module'; | ||
| import { extractSourceMap } from './source-map.mjs'; | ||
| import { createImportMetaEnvProxy, normalizeModuleId, slash, isInternalRequest, isNodeBuiltin, normalizeRequestId, toFilePath, cleanUrl, isPrimitive } from './utils.mjs'; | ||
| import { createImportMetaEnvProxy, slash, isInternalRequest, isNodeBuiltin, normalizeRequestId, toFilePath, normalizeModuleId, cleanUrl, isPrimitive } from './utils.mjs'; | ||
| import 'pathe'; | ||
@@ -95,4 +95,4 @@ import 'node:fs'; | ||
| delete mod.exports; | ||
| (_a = mod.importers) == null ? undefined : _a.clear(); | ||
| (_b = mod.imports) == null ? undefined : _b.clear(); | ||
| (_a = mod.importers) == null ? void 0 : _a.clear(); | ||
| (_b = mod.imports) == null ? void 0 : _b.clear(); | ||
| return true; | ||
@@ -111,3 +111,3 @@ } | ||
| const mod = super.get(id); | ||
| if (mod == null ? undefined : mod.importers) { | ||
| if (mod == null ? void 0 : mod.importers) { | ||
| this.invalidateDepTree(mod.importers, invalidated); | ||
@@ -131,3 +131,3 @@ } | ||
| var _a; | ||
| return (_a = mod.importers) == null ? undefined : _a.has(id); | ||
| return (_a = mod.importers) == null ? void 0 : _a.has(id); | ||
| }).map(([key]) => key); | ||
@@ -232,3 +232,3 @@ if (subIds.length) { | ||
| const resolved = await this.options.resolveId(dep, importer); | ||
| if ((_b = (_a = resolved == null ? undefined : resolved.meta) == null ? undefined : _a["vite:alias"]) == null ? undefined : _b.noResolved) { | ||
| if ((_b = (_a = resolved == null ? void 0 : resolved.meta) == null ? void 0 : _a["vite:alias"]) == null ? void 0 : _b.noResolved) { | ||
| const error = new Error( | ||
@@ -331,3 +331,3 @@ `Cannot find module '${id}'${importer ? ` imported from '${importer}'` : ""}. | ||
| if (moduleExports !== SYMBOL_NOT_DEFINED && isPrimitive(moduleExports)) { | ||
| defineExport(exports, p, () => undefined); | ||
| defineExport(exports, p, () => void 0); | ||
| return true; | ||
@@ -361,3 +361,3 @@ } | ||
| var _a, _b; | ||
| hotContext || (hotContext = (_b = (_a = this.options).createHotContext) == null ? undefined : _b.call(_a, this, moduleId)); | ||
| hotContext || (hotContext = (_b = (_a = this.options).createHotContext) == null ? void 0 : _b.call(_a, this, moduleId)); | ||
| return hotContext; | ||
@@ -395,2 +395,3 @@ }, | ||
| async runModule(context, transformed) { | ||
| var _a; | ||
| const codeDefinition = `'use strict';async (${Object.keys(context).join( | ||
@@ -406,2 +407,3 @@ "," | ||
| }; | ||
| (_a = this.options.moduleExecutionInfo) == null ? void 0 : _a.set(options.filename, { startOffset: codeDefinition.length }); | ||
| const fn = vm.runInThisContext(code, options); | ||
@@ -440,7 +442,7 @@ await fn(...Object.values(context)); | ||
| } | ||
| return mod2[prop] ?? (defaultExport == null ? undefined : defaultExport[prop]); | ||
| return mod2[prop] ?? (defaultExport == null ? void 0 : defaultExport[prop]); | ||
| }, | ||
| has(mod2, prop) { | ||
| if (prop === "default") { | ||
| return defaultExport !== undefined; | ||
| return defaultExport !== void 0; | ||
| } | ||
@@ -454,3 +456,3 @@ return prop in mod2 || defaultExport && prop in defaultExport; | ||
| } | ||
| if (prop === "default" && defaultExport !== undefined) { | ||
| if (prop === "default" && defaultExport !== void 0) { | ||
| return { | ||
@@ -457,0 +459,0 @@ value: defaultExport, |
+1
-1
| import { HMRPayload, Plugin } from 'vite'; | ||
| import { EventEmitter } from 'node:events'; | ||
| import { C as CustomEventMap, a as ViteNodeRunner, H as HMRPayload$1, b as HotContext } from './index-BmdeEDlf.js'; | ||
| import { C as CustomEventMap, a as ViteNodeRunner, H as HMRPayload$1, b as HotContext } from './index-LQxw79Gm.js'; | ||
| import './trace-mapping.d-DLVdEqOp.js'; | ||
@@ -5,0 +5,0 @@ |
+1
-1
@@ -1,2 +0,2 @@ | ||
| export { A as Arrayable, f as Awaitable, i as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, g as FetchFunction, F as FetchResult, b as HotContext, j as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, h as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, l as ViteNodeResolveModule, k as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-BmdeEDlf.js'; | ||
| export { A as Arrayable, g as Awaitable, j as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, h as FetchFunction, F as FetchResult, b as HotContext, k as ModuleCache, M as ModuleCacheMap, f as ModuleExecutionInfo, N as Nullable, R as RawSourceMap, i as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, m as ViteNodeResolveModule, l as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-LQxw79Gm.js'; | ||
| export { D as DecodedSourceMap, E as EncodedSourceMap, S as SourceMapInput } from './trace-mapping.d-DLVdEqOp.js'; |
+28
-26
@@ -9,2 +9,3 @@ 'use strict'; | ||
| var pathe = require('pathe'); | ||
| var vite = require('vite'); | ||
| var browser = require('./chunk-browser.cjs'); | ||
@@ -115,3 +116,3 @@ var esModuleLexer = require('es-module-lexer'); | ||
| code: code.replace(/^\/\/.*\n/, ""), | ||
| map: undefined | ||
| map: void 0 | ||
| }; | ||
@@ -216,17 +217,17 @@ } | ||
| id = patchWindowsImportPath(id); | ||
| const moduleDirectories = (options == null ? undefined : options.moduleDirectories) || ["/node_modules/"]; | ||
| if (matchExternalizePattern(id, moduleDirectories, options == null ? undefined : options.inline)) { | ||
| const moduleDirectories = (options == null ? void 0 : options.moduleDirectories) || ["/node_modules/"]; | ||
| if (matchExternalizePattern(id, moduleDirectories, options == null ? void 0 : options.inline)) { | ||
| return false; | ||
| } | ||
| if ((options == null ? undefined : options.inlineFiles) && (options == null ? undefined : options.inlineFiles.includes(id))) { | ||
| if ((options == null ? void 0 : options.inlineFiles) && (options == null ? void 0 : options.inlineFiles.includes(id))) { | ||
| return false; | ||
| } | ||
| if (matchExternalizePattern(id, moduleDirectories, options == null ? undefined : options.external)) { | ||
| if (matchExternalizePattern(id, moduleDirectories, options == null ? void 0 : options.external)) { | ||
| return id; | ||
| } | ||
| if ((options == null ? undefined : options.cacheDir) && id.includes(options.cacheDir)) { | ||
| if ((options == null ? void 0 : options.cacheDir) && id.includes(options.cacheDir)) { | ||
| return id; | ||
| } | ||
| const isLibraryModule = moduleDirectories.some((dir) => id.includes(dir)); | ||
| const guessCJS = isLibraryModule && (options == null ? undefined : options.fallbackCJS); | ||
| const guessCJS = isLibraryModule && (options == null ? void 0 : options.fallbackCJS); | ||
| id = guessCJS ? guessCJSversion(id) || id : id; | ||
@@ -322,3 +323,3 @@ if (matchExternalizePattern(id, moduleDirectories, defaultInline)) { | ||
| const envValue = process.env.VITE_NODE_DEPS_MODULE_DIRECTORIES || process.env.npm_config_VITE_NODE_DEPS_MODULE_DIRECTORIES; | ||
| const customModuleDirectories = envValue == null ? undefined : envValue.split(","); | ||
| const customModuleDirectories = envValue == null ? void 0 : envValue.split(","); | ||
| if (customModuleDirectories) { | ||
@@ -398,8 +399,8 @@ options.deps.moduleDirectories.push(...customModuleDirectories); | ||
| source = utils.normalizeModuleId(source); | ||
| const fetchResult = (_a = this.fetchCache.get(source)) == null ? undefined : _a.result; | ||
| if (fetchResult == null ? undefined : fetchResult.map) { | ||
| const fetchResult = (_a = this.fetchCache.get(source)) == null ? void 0 : _a.result; | ||
| if (fetchResult == null ? void 0 : fetchResult.map) { | ||
| return fetchResult.map; | ||
| } | ||
| const ssrTransformResult = (_b = this.server.moduleGraph.getModuleById(source)) == null ? undefined : _b.ssrTransformResult; | ||
| return (ssrTransformResult == null ? undefined : ssrTransformResult.map) || null; | ||
| const ssrTransformResult = (_b = this.server.moduleGraph.getModuleById(source)) == null ? void 0 : _b.ssrTransformResult; | ||
| return (ssrTransformResult == null ? void 0 : ssrTransformResult.map) || null; | ||
| } | ||
@@ -415,3 +416,3 @@ assertMode(mode) { | ||
| return this.fetchResult(id, mode).then((r) => { | ||
| return this.options.sourcemap !== true ? { ...r, map: undefined } : r; | ||
| return this.options.sourcemap !== true ? { ...r, map: void 0 } : r; | ||
| }); | ||
@@ -455,5 +456,5 @@ } | ||
| const mod = this.server.moduleGraph.getModuleById(normalizedId); | ||
| const result = (mod == null ? undefined : mod.transformResult) || await this.server.transformRequest(normalizedId); | ||
| const result = (mod == null ? void 0 : mod.transformResult) || await this.server.transformRequest(normalizedId); | ||
| return { | ||
| code: result == null ? undefined : result.code | ||
| code: result == null ? void 0 : result.code | ||
| }; | ||
@@ -464,6 +465,6 @@ } | ||
| const withoutQuery = id.split("?")[0]; | ||
| if ((_b = (_a = this.options.transformMode) == null ? undefined : _a.web) == null ? undefined : _b.some((r) => withoutQuery.match(r))) { | ||
| if ((_b = (_a = this.options.transformMode) == null ? void 0 : _a.web) == null ? void 0 : _b.some((r) => withoutQuery.match(r))) { | ||
| return "web"; | ||
| } | ||
| if ((_d = (_c = this.options.transformMode) == null ? undefined : _c.ssr) == null ? undefined : _d.some((r) => withoutQuery.match(r))) { | ||
| if ((_d = (_c = this.options.transformMode) == null ? void 0 : _c.ssr) == null ? void 0 : _d.some((r) => withoutQuery.match(r))) { | ||
| return "ssr"; | ||
@@ -503,3 +504,3 @@ } | ||
| let result; | ||
| const cacheDir = (_a = this.options.deps) == null ? undefined : _a.cacheDir; | ||
| const cacheDir = (_a = this.options.deps) == null ? void 0 : _a.cacheDir; | ||
| if (cacheDir && id.includes(cacheDir)) { | ||
@@ -532,3 +533,3 @@ if (!id.startsWith(utils.withTrailingSlash(this.server.config.root))) { | ||
| result = { externalize }; | ||
| (_b = this.debugger) == null ? undefined : _b.recordExternalize(id, externalize); | ||
| (_b = this.debugger) == null ? void 0 : _b.recordExternalize(id, externalize); | ||
| } else { | ||
@@ -538,3 +539,3 @@ const start = node_perf_hooks.performance.now(); | ||
| duration = node_perf_hooks.performance.now() - start; | ||
| result = { code: r == null ? undefined : r.code, map: r == null ? undefined : r.map }; | ||
| result = { code: r == null ? void 0 : r.code, map: r == null ? void 0 : r.map }; | ||
| } | ||
@@ -555,4 +556,5 @@ const cacheEntry = { | ||
| return sourceMap.withInlineSourcemap(result, { | ||
| filepath: (mod == null ? undefined : mod.file) || filepath, | ||
| root: this.server.config.root | ||
| filepath: (mod == null ? void 0 : mod.file) || filepath, | ||
| root: this.server.config.root, | ||
| noFirstLineMapping: Number(vite.version.split(".")[0]) >= 6 | ||
| }); | ||
@@ -564,4 +566,4 @@ } | ||
| let result = null; | ||
| if ((_a = this.options.debug) == null ? undefined : _a.loadDumppedModules) { | ||
| result = await ((_b = this.debugger) == null ? undefined : _b.loadDump(id)) ?? null; | ||
| if ((_a = this.options.debug) == null ? void 0 : _a.loadDumppedModules) { | ||
| result = await ((_b = this.debugger) == null ? void 0 : _b.loadDump(id)) ?? null; | ||
| if (result) { | ||
@@ -583,4 +585,4 @@ return result; | ||
| } | ||
| if ((_c = this.options.debug) == null ? undefined : _c.dumpModules) { | ||
| await ((_d = this.debugger) == null ? undefined : _d.dumpFile(id, result)); | ||
| if ((_c = this.options.debug) == null ? void 0 : _c.dumpModules) { | ||
| await ((_d = this.debugger) == null ? void 0 : _d.dumpFile(id, result)); | ||
| } | ||
@@ -587,0 +589,0 @@ return result; |
+3
-6
| import { TransformResult, ViteDevServer } from 'vite'; | ||
| import { D as DebuggerOptions, c as DepsHandlingOptions, V as ViteNodeServerOptions, d as ViteNodeResolveId, F as FetchResult } from './index-BmdeEDlf.js'; | ||
| import { D as DebuggerOptions, c as DepsHandlingOptions, V as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId } from './index-LQxw79Gm.js'; | ||
| import { E as EncodedSourceMap } from './trace-mapping.d-DLVdEqOp.js'; | ||
@@ -34,6 +34,3 @@ | ||
| private existingOptimizedDeps; | ||
| fetchCaches: { | ||
| ssr: Map<string, FetchCache>; | ||
| web: Map<string, FetchCache>; | ||
| }; | ||
| fetchCaches: Record<'ssr' | 'web', Map<string, FetchCache>>; | ||
| fetchCache: Map<string, FetchCache>; | ||
@@ -55,3 +52,3 @@ externalizeCache: Map<string, Promise<string | false>>; | ||
| }>; | ||
| getTransformMode(id: string): "web" | "ssr"; | ||
| getTransformMode(id: string): 'ssr' | 'web'; | ||
| private getChangedModule; | ||
@@ -58,0 +55,0 @@ private _fetchModule; |
+28
-26
@@ -7,2 +7,3 @@ import assert from 'node:assert'; | ||
| import { resolve, join, extname, dirname, relative, normalize } from 'pathe'; | ||
| import { version } from 'vite'; | ||
| import { s } from './chunk-browser.mjs'; | ||
@@ -94,3 +95,3 @@ import * as esModuleLexer from 'es-module-lexer'; | ||
| code: code.replace(/^\/\/.*\n/, ""), | ||
| map: undefined | ||
| map: void 0 | ||
| }; | ||
@@ -195,17 +196,17 @@ } | ||
| id = patchWindowsImportPath(id); | ||
| const moduleDirectories = (options == null ? undefined : options.moduleDirectories) || ["/node_modules/"]; | ||
| if (matchExternalizePattern(id, moduleDirectories, options == null ? undefined : options.inline)) { | ||
| const moduleDirectories = (options == null ? void 0 : options.moduleDirectories) || ["/node_modules/"]; | ||
| if (matchExternalizePattern(id, moduleDirectories, options == null ? void 0 : options.inline)) { | ||
| return false; | ||
| } | ||
| if ((options == null ? undefined : options.inlineFiles) && (options == null ? undefined : options.inlineFiles.includes(id))) { | ||
| if ((options == null ? void 0 : options.inlineFiles) && (options == null ? void 0 : options.inlineFiles.includes(id))) { | ||
| return false; | ||
| } | ||
| if (matchExternalizePattern(id, moduleDirectories, options == null ? undefined : options.external)) { | ||
| if (matchExternalizePattern(id, moduleDirectories, options == null ? void 0 : options.external)) { | ||
| return id; | ||
| } | ||
| if ((options == null ? undefined : options.cacheDir) && id.includes(options.cacheDir)) { | ||
| if ((options == null ? void 0 : options.cacheDir) && id.includes(options.cacheDir)) { | ||
| return id; | ||
| } | ||
| const isLibraryModule = moduleDirectories.some((dir) => id.includes(dir)); | ||
| const guessCJS = isLibraryModule && (options == null ? undefined : options.fallbackCJS); | ||
| const guessCJS = isLibraryModule && (options == null ? void 0 : options.fallbackCJS); | ||
| id = guessCJS ? guessCJSversion(id) || id : id; | ||
@@ -301,3 +302,3 @@ if (matchExternalizePattern(id, moduleDirectories, defaultInline)) { | ||
| const envValue = process.env.VITE_NODE_DEPS_MODULE_DIRECTORIES || process.env.npm_config_VITE_NODE_DEPS_MODULE_DIRECTORIES; | ||
| const customModuleDirectories = envValue == null ? undefined : envValue.split(","); | ||
| const customModuleDirectories = envValue == null ? void 0 : envValue.split(","); | ||
| if (customModuleDirectories) { | ||
@@ -377,8 +378,8 @@ options.deps.moduleDirectories.push(...customModuleDirectories); | ||
| source = normalizeModuleId(source); | ||
| const fetchResult = (_a = this.fetchCache.get(source)) == null ? undefined : _a.result; | ||
| if (fetchResult == null ? undefined : fetchResult.map) { | ||
| const fetchResult = (_a = this.fetchCache.get(source)) == null ? void 0 : _a.result; | ||
| if (fetchResult == null ? void 0 : fetchResult.map) { | ||
| return fetchResult.map; | ||
| } | ||
| const ssrTransformResult = (_b = this.server.moduleGraph.getModuleById(source)) == null ? undefined : _b.ssrTransformResult; | ||
| return (ssrTransformResult == null ? undefined : ssrTransformResult.map) || null; | ||
| const ssrTransformResult = (_b = this.server.moduleGraph.getModuleById(source)) == null ? void 0 : _b.ssrTransformResult; | ||
| return (ssrTransformResult == null ? void 0 : ssrTransformResult.map) || null; | ||
| } | ||
@@ -394,3 +395,3 @@ assertMode(mode) { | ||
| return this.fetchResult(id, mode).then((r) => { | ||
| return this.options.sourcemap !== true ? { ...r, map: undefined } : r; | ||
| return this.options.sourcemap !== true ? { ...r, map: void 0 } : r; | ||
| }); | ||
@@ -434,5 +435,5 @@ } | ||
| const mod = this.server.moduleGraph.getModuleById(normalizedId); | ||
| const result = (mod == null ? undefined : mod.transformResult) || await this.server.transformRequest(normalizedId); | ||
| const result = (mod == null ? void 0 : mod.transformResult) || await this.server.transformRequest(normalizedId); | ||
| return { | ||
| code: result == null ? undefined : result.code | ||
| code: result == null ? void 0 : result.code | ||
| }; | ||
@@ -443,6 +444,6 @@ } | ||
| const withoutQuery = id.split("?")[0]; | ||
| if ((_b = (_a = this.options.transformMode) == null ? undefined : _a.web) == null ? undefined : _b.some((r) => withoutQuery.match(r))) { | ||
| if ((_b = (_a = this.options.transformMode) == null ? void 0 : _a.web) == null ? void 0 : _b.some((r) => withoutQuery.match(r))) { | ||
| return "web"; | ||
| } | ||
| if ((_d = (_c = this.options.transformMode) == null ? undefined : _c.ssr) == null ? undefined : _d.some((r) => withoutQuery.match(r))) { | ||
| if ((_d = (_c = this.options.transformMode) == null ? void 0 : _c.ssr) == null ? void 0 : _d.some((r) => withoutQuery.match(r))) { | ||
| return "ssr"; | ||
@@ -482,3 +483,3 @@ } | ||
| let result; | ||
| const cacheDir = (_a = this.options.deps) == null ? undefined : _a.cacheDir; | ||
| const cacheDir = (_a = this.options.deps) == null ? void 0 : _a.cacheDir; | ||
| if (cacheDir && id.includes(cacheDir)) { | ||
@@ -511,3 +512,3 @@ if (!id.startsWith(withTrailingSlash(this.server.config.root))) { | ||
| result = { externalize }; | ||
| (_b = this.debugger) == null ? undefined : _b.recordExternalize(id, externalize); | ||
| (_b = this.debugger) == null ? void 0 : _b.recordExternalize(id, externalize); | ||
| } else { | ||
@@ -517,3 +518,3 @@ const start = performance.now(); | ||
| duration = performance.now() - start; | ||
| result = { code: r == null ? undefined : r.code, map: r == null ? undefined : r.map }; | ||
| result = { code: r == null ? void 0 : r.code, map: r == null ? void 0 : r.map }; | ||
| } | ||
@@ -534,4 +535,5 @@ const cacheEntry = { | ||
| return withInlineSourcemap(result, { | ||
| filepath: (mod == null ? undefined : mod.file) || filepath, | ||
| root: this.server.config.root | ||
| filepath: (mod == null ? void 0 : mod.file) || filepath, | ||
| root: this.server.config.root, | ||
| noFirstLineMapping: Number(version.split(".")[0]) >= 6 | ||
| }); | ||
@@ -543,4 +545,4 @@ } | ||
| let result = null; | ||
| if ((_a = this.options.debug) == null ? undefined : _a.loadDumppedModules) { | ||
| result = await ((_b = this.debugger) == null ? undefined : _b.loadDump(id)) ?? null; | ||
| if ((_a = this.options.debug) == null ? void 0 : _a.loadDumppedModules) { | ||
| result = await ((_b = this.debugger) == null ? void 0 : _b.loadDump(id)) ?? null; | ||
| if (result) { | ||
@@ -562,4 +564,4 @@ return result; | ||
| } | ||
| if ((_c = this.options.debug) == null ? undefined : _c.dumpModules) { | ||
| await ((_d = this.debugger) == null ? undefined : _d.dumpFile(id, result)); | ||
| if ((_c = this.options.debug) == null ? void 0 : _c.dumpModules) { | ||
| await ((_d = this.debugger) == null ? void 0 : _d.dumpFile(id, result)); | ||
| } | ||
@@ -566,0 +568,0 @@ return result; |
@@ -695,6 +695,6 @@ 'use strict'; | ||
| }; | ||
| if ((_a = sourceMap.map) == null ? undefined : _a.sourcesContent) { | ||
| if ((_a = sourceMap.map) == null ? void 0 : _a.sourcesContent) { | ||
| sourceMap.map.sources.forEach((source, i) => { | ||
| var _a2, _b; | ||
| const contents = (_b = (_a2 = sourceMap.map) == null ? undefined : _a2.sourcesContent) == null ? undefined : _b[i]; | ||
| const contents = (_b = (_a2 = sourceMap.map) == null ? void 0 : _a2.sourcesContent) == null ? void 0 : _b[i]; | ||
| if (contents && source && sourceMap.url) { | ||
@@ -814,3 +814,3 @@ const url = supportRelativeURL(sourceMap.url, source); | ||
| function wrapCallSite(frame, state) { | ||
| if (state === undefined) { | ||
| if (state === void 0) { | ||
| state = { nextPosition: null, curPosition: null }; | ||
@@ -847,3 +847,3 @@ } | ||
| frame.getFileName = function() { | ||
| return position.source ?? undefined; | ||
| return position.source ?? void 0; | ||
| }; | ||
@@ -866,3 +866,3 @@ frame.getLineNumber = function() { | ||
| frame.getEvalOrigin = function() { | ||
| return origin || undefined; | ||
| return origin || void 0; | ||
| }; | ||
@@ -924,3 +924,3 @@ return frame; | ||
| if ("sources" in map) { | ||
| map.sources = (_a = map.sources) == null ? undefined : _a.map((source) => { | ||
| map.sources = (_a = map.sources) == null ? void 0 : _a.map((source) => { | ||
| if (!source) { | ||
@@ -943,3 +943,3 @@ return source; | ||
| } | ||
| if (map.mappings.startsWith(";")) { | ||
| if (!options.noFirstLineMapping && map.mappings.startsWith(";")) { | ||
| map.mappings = `AAAA,CAAA${map.mappings}`; | ||
@@ -959,3 +959,3 @@ } | ||
| var _a; | ||
| const mapString = (_a = code.match(VITE_NODE_SOURCEMAPPING_REGEXP)) == null ? undefined : _a[1]; | ||
| const mapString = (_a = code.match(VITE_NODE_SOURCEMAPPING_REGEXP)) == null ? void 0 : _a[1]; | ||
| if (mapString) { | ||
@@ -962,0 +962,0 @@ return JSON.parse(Buffer.from(mapString, "base64").toString("utf-8")); |
@@ -10,2 +10,3 @@ import { TransformResult } from 'vite'; | ||
| filepath: string; | ||
| noFirstLineMapping?: boolean; | ||
| }): TransformResult; | ||
@@ -12,0 +13,0 @@ declare function extractSourceMap(code: string): EncodedSourceMap | null; |
@@ -693,6 +693,6 @@ import { isAbsolute, resolve as resolve$2, relative, dirname } from 'pathe'; | ||
| }; | ||
| if ((_a = sourceMap.map) == null ? undefined : _a.sourcesContent) { | ||
| if ((_a = sourceMap.map) == null ? void 0 : _a.sourcesContent) { | ||
| sourceMap.map.sources.forEach((source, i) => { | ||
| var _a2, _b; | ||
| const contents = (_b = (_a2 = sourceMap.map) == null ? undefined : _a2.sourcesContent) == null ? undefined : _b[i]; | ||
| const contents = (_b = (_a2 = sourceMap.map) == null ? void 0 : _a2.sourcesContent) == null ? void 0 : _b[i]; | ||
| if (contents && source && sourceMap.url) { | ||
@@ -812,3 +812,3 @@ const url = supportRelativeURL(sourceMap.url, source); | ||
| function wrapCallSite(frame, state) { | ||
| if (state === undefined) { | ||
| if (state === void 0) { | ||
| state = { nextPosition: null, curPosition: null }; | ||
@@ -845,3 +845,3 @@ } | ||
| frame.getFileName = function() { | ||
| return position.source ?? undefined; | ||
| return position.source ?? void 0; | ||
| }; | ||
@@ -864,3 +864,3 @@ frame.getLineNumber = function() { | ||
| frame.getEvalOrigin = function() { | ||
| return origin || undefined; | ||
| return origin || void 0; | ||
| }; | ||
@@ -922,3 +922,3 @@ return frame; | ||
| if ("sources" in map) { | ||
| map.sources = (_a = map.sources) == null ? undefined : _a.map((source) => { | ||
| map.sources = (_a = map.sources) == null ? void 0 : _a.map((source) => { | ||
| if (!source) { | ||
@@ -941,3 +941,3 @@ return source; | ||
| } | ||
| if (map.mappings.startsWith(";")) { | ||
| if (!options.noFirstLineMapping && map.mappings.startsWith(";")) { | ||
| map.mappings = `AAAA,CAAA${map.mappings}`; | ||
@@ -957,3 +957,3 @@ } | ||
| var _a; | ||
| const mapString = (_a = code.match(VITE_NODE_SOURCEMAPPING_REGEXP)) == null ? undefined : _a[1]; | ||
| const mapString = (_a = code.match(VITE_NODE_SOURCEMAPPING_REGEXP)) == null ? void 0 : _a[1]; | ||
| if (mapString) { | ||
@@ -960,0 +960,0 @@ return JSON.parse(Buffer.from(mapString, "base64").toString("utf-8")); |
+1
-1
| export { D as DecodedSourceMap, E as EncodedSourceMap, S as SourceMapInput } from './trace-mapping.d-DLVdEqOp.js'; | ||
| export { A as Arrayable, f as Awaitable, i as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, g as FetchFunction, F as FetchResult, b as HotContext, j as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, h as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, l as ViteNodeResolveModule, k as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-BmdeEDlf.js'; | ||
| export { A as Arrayable, g as Awaitable, j as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, h as FetchFunction, F as FetchResult, b as HotContext, k as ModuleCache, M as ModuleCacheMap, f as ModuleExecutionInfo, N as Nullable, R as RawSourceMap, i as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, m as ViteNodeResolveModule, l as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-LQxw79Gm.js'; |
+4
-4
@@ -21,3 +21,3 @@ 'use strict'; | ||
| } | ||
| if (driveRegexp && !(driveRegexp == null ? undefined : driveRegexp.test(id)) && (driveOppositeRegext == null ? undefined : driveOppositeRegext.test(id))) { | ||
| if (driveRegexp && !(driveRegexp == null ? void 0 : driveRegexp.test(id)) && (driveOppositeRegext == null ? void 0 : driveOppositeRegext.test(id))) { | ||
| id = id.replace(driveOppositeRegext, `${drive}$1`); | ||
@@ -113,3 +113,3 @@ } | ||
| function toArray(array) { | ||
| if (array === null || array === undefined) { | ||
| if (array === null || array === void 0) { | ||
| array = []; | ||
@@ -157,3 +157,3 @@ } | ||
| if (typeof key !== "string") { | ||
| return undefined; | ||
| return void 0; | ||
| } | ||
@@ -189,3 +189,3 @@ if (booleanKeys.includes(key)) { | ||
| if ((_a = await fs.promises.stat(pkgPath).catch(() => { | ||
| })) == null ? undefined : _a.isFile()) { | ||
| })) == null ? void 0 : _a.isFile()) { | ||
| const pkgData = JSON.parse(await fs.promises.readFile(pkgPath, "utf8")); | ||
@@ -192,0 +192,0 @@ if (packageCache) { |
+1
-1
@@ -1,2 +0,2 @@ | ||
| import { N as Nullable, A as Arrayable } from './index-BmdeEDlf.js'; | ||
| import { N as Nullable, A as Arrayable } from './index-LQxw79Gm.js'; | ||
| import './trace-mapping.d-DLVdEqOp.js'; | ||
@@ -3,0 +3,0 @@ |
+5
-5
| import { existsSync, promises } from 'node:fs'; | ||
| import { builtinModules } from 'node:module'; | ||
| import { fileURLToPath, pathToFileURL } from 'node:url'; | ||
| import { resolve, dirname, join } from 'pathe'; | ||
| import { resolve, join, dirname } from 'pathe'; | ||
@@ -19,3 +19,3 @@ const isWindows = process.platform === "win32"; | ||
| } | ||
| if (driveRegexp && !(driveRegexp == null ? undefined : driveRegexp.test(id)) && (driveOppositeRegext == null ? undefined : driveOppositeRegext.test(id))) { | ||
| if (driveRegexp && !(driveRegexp == null ? void 0 : driveRegexp.test(id)) && (driveOppositeRegext == null ? void 0 : driveOppositeRegext.test(id))) { | ||
| id = id.replace(driveOppositeRegext, `${drive}$1`); | ||
@@ -111,3 +111,3 @@ } | ||
| function toArray(array) { | ||
| if (array === null || array === undefined) { | ||
| if (array === null || array === void 0) { | ||
| array = []; | ||
@@ -155,3 +155,3 @@ } | ||
| if (typeof key !== "string") { | ||
| return undefined; | ||
| return void 0; | ||
| } | ||
@@ -187,3 +187,3 @@ if (booleanKeys.includes(key)) { | ||
| if ((_a = await promises.stat(pkgPath).catch(() => { | ||
| })) == null ? undefined : _a.isFile()) { | ||
| })) == null ? void 0 : _a.isFile()) { | ||
| const pkgData = JSON.parse(await promises.readFile(pkgPath, "utf8")); | ||
@@ -190,0 +190,0 @@ if (packageCache) { |
+2
-2
| { | ||
| "name": "vite-node", | ||
| "type": "module", | ||
| "version": "3.0.5", | ||
| "version": "3.0.6", | ||
| "description": "Vite as Node.js runtime", | ||
@@ -83,3 +83,3 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>", | ||
| "es-module-lexer": "^1.6.0", | ||
| "pathe": "^2.0.2", | ||
| "pathe": "^2.0.3", | ||
| "vite": "^5.0.0 || ^6.0.0" | ||
@@ -86,0 +86,0 @@ }, |
| import { E as EncodedSourceMap } from './trace-mapping.d-DLVdEqOp.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 | ||
| /** @internal */ | ||
| explicitImportRequired?: boolean | ||
| /** @internal */ | ||
| isWithinCircularImport?: boolean | ||
| /** @internal */ | ||
| ssrInvalidates?: string[] | ||
| } | ||
| interface PrunePayload { | ||
| type: 'prune' | ||
| paths: string[] | ||
| } | ||
| interface FullReloadPayload { | ||
| type: 'full-reload' | ||
| path?: string | ||
| /** @internal */ | ||
| 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 { | ||
| /** | ||
| * @experimental | ||
| * We expose this instance experimentally to see potential usage. | ||
| * This might be removed in the future if we didn't find reasonable use cases. | ||
| * If you find this useful, please open an issue with details so we can discuss and make it stable API. | ||
| */ | ||
| // eslint-disable-next-line n/no-unsupported-features/node-builtins | ||
| webSocket: WebSocket | ||
| } | ||
| interface InvalidatePayload { | ||
| path: string | ||
| message: string | undefined | ||
| } | ||
| /** | ||
| * provides types for built-in Vite events | ||
| */ | ||
| 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; | ||
| /** | ||
| * Assign partial data to the map | ||
| */ | ||
| 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; | ||
| /** | ||
| * Invalidate modules that dependent on the given modules, up to the main entry | ||
| */ | ||
| invalidateDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>; | ||
| /** | ||
| * Invalidate dependency modules of the given modules, down to the bottom-level dependencies | ||
| */ | ||
| invalidateSubDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>; | ||
| /** | ||
| * Return parsed source map based on inlined source map of the module | ||
| */ | ||
| getSourceMap(id: string): EncodedSourceMap | null; | ||
| } | ||
| declare class ViteNodeRunner { | ||
| options: ViteNodeRunnerOptions; | ||
| root: string; | ||
| debug: boolean; | ||
| /** | ||
| * Holds the cache of modules | ||
| * Keys of the map are filepaths, or plain package names | ||
| */ | ||
| moduleCache: ModuleCacheMap; | ||
| constructor(options: ViteNodeRunnerOptions); | ||
| executeFile(file: string): Promise<any>; | ||
| executeId(rawId: string): Promise<any>; | ||
| shouldResolveId(id: string, _importee?: string): boolean; | ||
| private _resolveUrl; | ||
| resolveUrl(id: string, importee?: string): Promise<[url: string, fsPath: string]>; | ||
| 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>; | ||
| /** | ||
| * Define if a module should be interop-ed | ||
| * This function mostly for the ability to override by subclass | ||
| */ | ||
| shouldInterop(path: string, mod: any): boolean; | ||
| protected importExternalModule(path: string): Promise<any>; | ||
| /** | ||
| * Import a module and interop it | ||
| */ | ||
| 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; | ||
| inlineFiles?: string[]; | ||
| /** | ||
| * A list of directories that are considered to hold Node.js modules | ||
| * Have to include "/" at the start and end of the path | ||
| * | ||
| * Vite-Node checks the whole absolute path of the import, so make sure you don't include | ||
| * unwanted files accidentally | ||
| * @default ['/node_modules/'] | ||
| */ | ||
| moduleDirectories?: string[]; | ||
| cacheDir?: string; | ||
| /** | ||
| * Try to guess the CJS version of a package when it's invalid ESM | ||
| * @default false | ||
| */ | ||
| 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; | ||
| /** | ||
| * Module ids that imports this module | ||
| */ | ||
| 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 ViteNodeResolveModule { | ||
| external: string | null; | ||
| id: string; | ||
| fsPath: string; | ||
| } | ||
| interface ViteNodeServerOptions { | ||
| /** | ||
| * Inject inline sourcemap to modules | ||
| * @default 'inline' | ||
| */ | ||
| sourcemap?: 'inline' | boolean; | ||
| /** | ||
| * Deps handling | ||
| */ | ||
| deps?: DepsHandlingOptions; | ||
| /** | ||
| * Transform method for modules | ||
| */ | ||
| transformMode?: { | ||
| ssr?: RegExp[]; | ||
| web?: RegExp[]; | ||
| }; | ||
| debug?: DebuggerOptions; | ||
| } | ||
| interface DebuggerOptions { | ||
| /** | ||
| * Dump the transformed module to filesystem | ||
| * Passing a string will dump to the specified path | ||
| */ | ||
| dumpModules?: boolean | string; | ||
| /** | ||
| * Read dumpped module from filesystem whenever exists. | ||
| * Useful for debugging by modifying the dump result from the filesystem. | ||
| */ | ||
| 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, type ViteNodeResolveModule as l }; |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 5 instances in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
205231
0.22%6055
0.28%32
6.67%Updated