vite-node 3.0.7 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -82,7 +82,7 @@ Note that when using the `--script` option, Vite Node forwards every argument an
82
82
  In Vite Node, the server and runner (client) are separated, so you can integrate them in different contexts (workers, cross-process, or remote) if needed. The demo below shows a simple example of having both (server and runner) running in the same context
83
83
 
84
84
  ```ts
85
- import { createServer } from 'vite'
85
+ import { createServer, version as viteVersion } from 'vite'
86
86
  import { ViteNodeRunner } from 'vite-node/client'
87
87
  import { ViteNodeServer } from 'vite-node/server'
88
88
  import { installSourcemapsSupport } from 'vite-node/source-map'
@@ -94,8 +94,10 @@ const server = await createServer({
94
94
  disabled: true,
95
95
  },
96
96
  })
97
- // this is need to initialize the plugins
98
- await server.pluginContainer.buildStart({})
97
+ // For old Vite, this is need to initialize the plugins.
98
+ if (Number(viteVersion.split('.')[0]) < 6) {
99
+ await server.pluginContainer.buildStart({})
100
+ }
99
101
 
100
102
  // create vite-node server
101
103
  const node = new ViteNodeServer(server)
package/dist/cli.cjs CHANGED
@@ -5,23 +5,23 @@ var cac = require('cac');
5
5
  var browser = require('./chunk-browser.cjs');
6
6
  var vite = require('vite');
7
7
  var client = require('./client.cjs');
8
- var hmr = require('./chunk-hmr.cjs');
9
8
  var server = require('./server.cjs');
10
9
  var sourceMap = require('./source-map.cjs');
11
10
  var utils = require('./utils.cjs');
11
+ var hmr = require('./chunk-hmr.cjs');
12
12
  require('node:module');
13
13
  require('node:url');
14
14
  require('node:vm');
15
15
  require('debug');
16
16
  require('pathe');
17
17
  require('node:fs');
18
- require('node:events');
19
18
  require('node:assert');
20
19
  require('node:perf_hooks');
21
20
  require('es-module-lexer');
22
21
  require('./constants.cjs');
22
+ require('node:events');
23
23
 
24
- var version = "3.0.7";
24
+ var version = "3.0.9";
25
25
 
26
26
  const cli = cac("vite-node");
27
27
  cli.option("-r, --root <path>", "Use specified root directory").option("-c, --config <path>", "Use specified config file").option("-m, --mode <mode>", "Set env mode").option("-w, --watch", 'Restart on file changes, similar to "nodemon"').option("--script", "Use vite-node as a script runner").option("--options <options>", "Use specified Vite server options").option("-v, --version", "Output the version number").option("-h, --help", "Display help for command");
@@ -74,7 +74,11 @@ async function run(files, options = {}) {
74
74
  },
75
75
  plugins: [options.watch && hmr.viteNodeHmrPlugin()]
76
76
  });
77
- await server$1.pluginContainer.buildStart({});
77
+ if (Number(vite.version.split(".")[0]) < 6) {
78
+ await server$1.pluginContainer.buildStart({});
79
+ } else {
80
+ await server$1.environments.client.pluginContainer.buildStart({});
81
+ }
78
82
  const env = vite.loadEnv(server$1.config.mode, server$1.config.envDir, "");
79
83
  for (const key in env) {
80
84
  (_a = process.env)[key] ?? (_a[key] = env[key]);
package/dist/cli.d.ts CHANGED
@@ -1,21 +1,19 @@
1
- import { V as ViteNodeServerOptions } from './index-LQxw79Gm.js';
1
+ import { V as ViteNodeServerOptions } from './index.d-CvjHzhRV.js';
2
2
  import './trace-mapping.d-DLVdEqOp.js';
3
3
 
4
4
  interface CliOptions {
5
- 'root'?: string;
6
- 'script'?: boolean;
7
- 'config'?: string;
8
- 'mode'?: string;
9
- 'watch'?: boolean;
10
- 'options'?: ViteNodeServerOptionsCLI;
11
- 'version'?: boolean;
12
- 'help'?: boolean;
13
- '--'?: string[];
5
+ "root"?: string;
6
+ "script"?: boolean;
7
+ "config"?: string;
8
+ "mode"?: string;
9
+ "watch"?: boolean;
10
+ "options"?: ViteNodeServerOptionsCLI;
11
+ "version"?: boolean;
12
+ "help"?: boolean;
13
+ "--"?: string[];
14
14
  }
15
15
  type Optional<T> = T | undefined;
16
- type ComputeViteNodeServerOptionsCLI<T extends Record<string, any>> = {
17
- [K in keyof T]: T[K] extends Optional<RegExp[]> ? string | string[] : T[K] extends Optional<(string | RegExp)[]> ? string | string[] : T[K] extends Optional<(string | RegExp)[] | true> ? string | string[] | true : T[K] extends Optional<Record<string, any>> ? ComputeViteNodeServerOptionsCLI<T[K]> : T[K];
18
- };
16
+ type ComputeViteNodeServerOptionsCLI<T extends Record<string, any>> = { [K in keyof T] : T[K] extends Optional<RegExp[]> ? string | string[] : T[K] extends Optional<(string | RegExp)[]> ? string | string[] : T[K] extends Optional<(string | RegExp)[] | true> ? string | string[] | true : T[K] extends Optional<Record<string, any>> ? ComputeViteNodeServerOptionsCLI<T[K]> : T[K] };
19
17
  type ViteNodeServerOptionsCLI = ComputeViteNodeServerOptionsCLI<ViteNodeServerOptions>;
20
18
 
21
19
  export type { CliOptions, ViteNodeServerOptionsCLI };
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { resolve } from 'node:path';
2
2
  import cac from 'cac';
3
3
  import { s } from './chunk-browser.mjs';
4
- import { createServer, loadEnv } from 'vite';
4
+ import { createServer, version as version$1, loadEnv } from 'vite';
5
5
  import { ViteNodeRunner } from './client.mjs';
6
6
  import { ViteNodeServer } from './server.mjs';
7
7
  import { installSourcemapsSupport } from './source-map.mjs';
@@ -19,7 +19,7 @@ import 'es-module-lexer';
19
19
  import './constants.mjs';
20
20
  import 'node:events';
21
21
 
22
- var version = "3.0.7";
22
+ var version = "3.0.9";
23
23
 
24
24
  const cli = cac("vite-node");
25
25
  cli.option("-r, --root <path>", "Use specified root directory").option("-c, --config <path>", "Use specified config file").option("-m, --mode <mode>", "Set env mode").option("-w, --watch", 'Restart on file changes, similar to "nodemon"').option("--script", "Use vite-node as a script runner").option("--options <options>", "Use specified Vite server options").option("-v, --version", "Output the version number").option("-h, --help", "Display help for command");
@@ -72,7 +72,11 @@ async function run(files, options = {}) {
72
72
  },
73
73
  plugins: [options.watch && viteNodeHmrPlugin()]
74
74
  });
75
- await server.pluginContainer.buildStart({});
75
+ if (Number(version$1.split(".")[0]) < 6) {
76
+ await server.pluginContainer.buildStart({});
77
+ } else {
78
+ await server.environments.client.pluginContainer.buildStart({});
79
+ }
76
80
  const env = loadEnv(server.config.mode, server.config.envDir, "");
77
81
  for (const key in env) {
78
82
  (_a = process.env)[key] ?? (_a[key] = env[key]);
package/dist/client.cjs CHANGED
@@ -416,7 +416,10 @@ ${getStack()}`
416
416
  return !path.endsWith(".mjs") && "default" in mod;
417
417
  }
418
418
  importExternalModule(path) {
419
- return import(path);
419
+ return import(
420
+ /* @vite-ignore */
421
+ path
422
+ );
420
423
  }
421
424
  /**
422
425
  * Import a module and interop it
package/dist/client.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import './trace-mapping.d-DLVdEqOp.js';
2
- export { e as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, f as ModuleExecutionInfo, a as ViteNodeRunner } from './index-LQxw79Gm.js';
2
+ export { e as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, f as ModuleExecutionInfo, a as ViteNodeRunner } from './index.d-CvjHzhRV.js';
package/dist/client.mjs CHANGED
@@ -414,7 +414,10 @@ ${getStack()}`
414
414
  return !path.endsWith(".mjs") && "default" in mod;
415
415
  }
416
416
  importExternalModule(path) {
417
- return import(path);
417
+ return import(
418
+ /* @vite-ignore */
419
+ path
420
+ );
418
421
  }
419
422
  /**
420
423
  * Import a module and interop it
package/dist/hmr.d.ts CHANGED
@@ -1,49 +1,49 @@
1
1
  import { HMRPayload, Plugin } from 'vite';
2
2
  import { EventEmitter } from 'node:events';
3
- import { C as CustomEventMap, a as ViteNodeRunner, H as HMRPayload$1, b as HotContext } from './index-LQxw79Gm.js';
3
+ import { C as CustomEventMap, a as ViteNodeRunner, H as HMRPayload$1, b as HotContext } from './index.d-CvjHzhRV.js';
4
4
  import './trace-mapping.d-DLVdEqOp.js';
5
5
 
6
6
  type EventType = string | symbol;
7
7
  type Handler<T = unknown> = (event: T) => void;
8
8
  interface Emitter<Events extends Record<EventType, unknown>> {
9
- on: <Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>) => void;
10
- off: <Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>) => void;
11
- emit: (<Key extends keyof Events>(type: Key, event: Events[Key]) => void) & (<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never) => void);
9
+ on: <Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>) => void;
10
+ off: <Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>) => void;
11
+ emit: (<Key extends keyof Events>(type: Key, event: Events[Key]) => void) & (<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never) => void);
12
12
  }
13
13
  type HMREmitter = Emitter<{
14
- message: HMRPayload;
14
+ message: HMRPayload
15
15
  }> & EventEmitter;
16
- declare module 'vite' {
17
- interface ViteDevServer {
18
- emitter: HMREmitter;
19
- }
16
+ declare module "vite" {
17
+ interface ViteDevServer {
18
+ emitter: HMREmitter;
19
+ }
20
20
  }
21
21
  declare function createHmrEmitter(): HMREmitter;
22
22
  declare function viteNodeHmrPlugin(): Plugin;
23
23
 
24
24
  type ModuleNamespace = Record<string, any> & {
25
- [Symbol.toStringTag]: 'Module';
25
+ [Symbol.toStringTag]: "Module"
26
26
  };
27
27
  type InferCustomEventPayload<T extends string> = T extends keyof CustomEventMap ? CustomEventMap[T] : any;
28
28
  interface HotModule {
29
- id: string;
30
- callbacks: HotCallback[];
29
+ id: string;
30
+ callbacks: HotCallback[];
31
31
  }
32
32
  interface HotCallback {
33
- deps: string[];
34
- fn: (modules: (ModuleNamespace | undefined)[]) => void;
33
+ deps: string[];
34
+ fn: (modules: (ModuleNamespace | undefined)[]) => void;
35
35
  }
36
36
  interface CacheData {
37
- hotModulesMap: Map<string, HotModule>;
38
- dataMap: Map<string, any>;
39
- disposeMap: Map<string, (data: any) => void | Promise<void>>;
40
- pruneMap: Map<string, (data: any) => void | Promise<void>>;
41
- customListenersMap: Map<string, ((data: any) => void)[]>;
42
- ctxToListenersMap: Map<string, Map<string, ((data: any) => void)[]>>;
43
- messageBuffer: string[];
44
- isFirstUpdate: boolean;
45
- pending: boolean;
46
- queued: Promise<(() => void) | undefined>[];
37
+ hotModulesMap: Map<string, HotModule>;
38
+ dataMap: Map<string, any>;
39
+ disposeMap: Map<string, (data: any) => void | Promise<void>>;
40
+ pruneMap: Map<string, (data: any) => void | Promise<void>>;
41
+ customListenersMap: Map<string, ((data: any) => void)[]>;
42
+ ctxToListenersMap: Map<string, Map<string, ((data: any) => void)[]>>;
43
+ messageBuffer: string[];
44
+ isFirstUpdate: boolean;
45
+ pending: boolean;
46
+ queued: Promise<(() => void) | undefined>[];
47
47
  }
48
48
  declare function getCache(runner: ViteNodeRunner): CacheData;
49
49
  declare function sendMessageBuffer(runner: ViteNodeRunner, emitter: HMREmitter): void;
@@ -0,0 +1,321 @@
1
+ import { E as EncodedSourceMap } from './trace-mapping.d-DLVdEqOp.js';
2
+
3
+ /** @deprecated use HotPayload */
4
+ type HMRPayload = HotPayload
5
+ type HotPayload =
6
+ | ConnectedPayload
7
+ | PingPayload
8
+ | UpdatePayload
9
+ | FullReloadPayload
10
+ | CustomPayload
11
+ | ErrorPayload
12
+ | PrunePayload
13
+
14
+ interface ConnectedPayload {
15
+ type: 'connected'
16
+ }
17
+
18
+ interface PingPayload {
19
+ type: 'ping'
20
+ }
21
+
22
+ interface UpdatePayload {
23
+ type: 'update'
24
+ updates: Update[]
25
+ }
26
+
27
+ interface Update {
28
+ type: 'js-update' | 'css-update'
29
+ path: string
30
+ acceptedPath: string
31
+ timestamp: number
32
+ /** @internal */
33
+ explicitImportRequired?: boolean
34
+ /** @internal */
35
+ isWithinCircularImport?: boolean
36
+ /** @internal */
37
+ invalidates?: string[]
38
+ }
39
+
40
+ interface PrunePayload {
41
+ type: 'prune'
42
+ paths: string[]
43
+ }
44
+
45
+ interface FullReloadPayload {
46
+ type: 'full-reload'
47
+ path?: string
48
+ /** @internal */
49
+ triggeredBy?: string
50
+ }
51
+
52
+ interface CustomPayload {
53
+ type: 'custom'
54
+ event: string
55
+ data?: any
56
+ }
57
+
58
+ interface ErrorPayload {
59
+ type: 'error'
60
+ err: {
61
+ [name: string]: any
62
+ message: string
63
+ stack: string
64
+ id?: string
65
+ frame?: string
66
+ plugin?: string
67
+ pluginCode?: string
68
+ loc?: {
69
+ file?: string
70
+ line: number
71
+ column: number
72
+ }
73
+ }
74
+ }
75
+
76
+ interface CustomEventMap {
77
+ 'vite:beforeUpdate': UpdatePayload
78
+ 'vite:afterUpdate': UpdatePayload
79
+ 'vite:beforePrune': PrunePayload
80
+ 'vite:beforeFullReload': FullReloadPayload
81
+ 'vite:error': ErrorPayload
82
+ 'vite:invalidate': InvalidatePayload
83
+ 'vite:ws:connect': WebSocketConnectionPayload
84
+ 'vite:ws:disconnect': WebSocketConnectionPayload
85
+ }
86
+
87
+ interface WebSocketConnectionPayload {
88
+ /**
89
+ * @experimental
90
+ * We expose this instance experimentally to see potential usage.
91
+ * This might be removed in the future if we didn't find reasonable use cases.
92
+ * If you find this useful, please open an issue with details so we can discuss and make it stable API.
93
+ */
94
+ // eslint-disable-next-line n/no-unsupported-features/node-builtins
95
+ webSocket: WebSocket
96
+ }
97
+
98
+ interface InvalidatePayload {
99
+ path: string
100
+ message: string | undefined
101
+ }
102
+
103
+ /**
104
+ * provides types for built-in Vite events
105
+ */
106
+ type InferCustomEventPayload<T extends string> =
107
+ T extends keyof CustomEventMap ? CustomEventMap[T] : any
108
+
109
+ type ModuleNamespace = Record<string, any> & {
110
+ [Symbol.toStringTag]: 'Module'
111
+ }
112
+
113
+ interface ViteHotContext {
114
+ readonly data: any
115
+
116
+ accept(): void
117
+ accept(cb: (mod: ModuleNamespace | undefined) => void): void
118
+ accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
119
+ accept(
120
+ deps: readonly string[],
121
+ cb: (mods: Array<ModuleNamespace | undefined>) => void,
122
+ ): void
123
+
124
+ acceptExports(
125
+ exportNames: string | readonly string[],
126
+ cb?: (mod: ModuleNamespace | undefined) => void,
127
+ ): void
128
+
129
+ dispose(cb: (data: any) => void): void
130
+ prune(cb: (data: any) => void): void
131
+ invalidate(message?: string): void
132
+
133
+ on<T extends string>(
134
+ event: T,
135
+ cb: (payload: InferCustomEventPayload<T>) => void,
136
+ ): void
137
+ off<T extends string>(
138
+ event: T,
139
+ cb: (payload: InferCustomEventPayload<T>) => void,
140
+ ): void
141
+ send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void
142
+ }
143
+
144
+ declare const DEFAULT_REQUEST_STUBS: Record<string, Record<string, unknown>>;
145
+ declare class ModuleCacheMap extends Map<string, ModuleCache> {
146
+ normalizePath(fsPath: string): string;
147
+ /**
148
+ * Assign partial data to the map
149
+ */
150
+ update(fsPath: string, mod: ModuleCache): this;
151
+ setByModuleId(modulePath: string, mod: ModuleCache): this;
152
+ set(fsPath: string, mod: ModuleCache): this;
153
+ getByModuleId(modulePath: string): ModuleCache & Required<Pick<ModuleCache, "imports" | "importers">>;
154
+ get(fsPath: string): ModuleCache & Required<Pick<ModuleCache, "importers" | "imports">>;
155
+ deleteByModuleId(modulePath: string): boolean;
156
+ delete(fsPath: string): boolean;
157
+ invalidateModule(mod: ModuleCache): boolean;
158
+ /**
159
+ * Invalidate modules that dependent on the given modules, up to the main entry
160
+ */
161
+ invalidateDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>;
162
+ /**
163
+ * Invalidate dependency modules of the given modules, down to the bottom-level dependencies
164
+ */
165
+ invalidateSubDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>;
166
+ /**
167
+ * Return parsed source map based on inlined source map of the module
168
+ */
169
+ getSourceMap(id: string): EncodedSourceMap | null;
170
+ }
171
+ type ModuleExecutionInfo = Map<string, {
172
+ startOffset: number
173
+ }>;
174
+ declare class ViteNodeRunner {
175
+ options: ViteNodeRunnerOptions;
176
+ root: string;
177
+ debug: boolean;
178
+ /**
179
+ * Holds the cache of modules
180
+ * Keys of the map are filepaths, or plain package names
181
+ */
182
+ moduleCache: ModuleCacheMap;
183
+ constructor(options: ViteNodeRunnerOptions);
184
+ executeFile(file: string): Promise<any>;
185
+ executeId(rawId: string): Promise<any>;
186
+ shouldResolveId(id: string, _importee?: string): boolean;
187
+ private _resolveUrl;
188
+ resolveUrl(id: string, importee?: string): Promise<[url: string, fsPath: string]>;
189
+ protected getContextPrimitives(): {
190
+ Object: ObjectConstructor
191
+ Reflect: typeof Reflect
192
+ Symbol: SymbolConstructor
193
+ };
194
+ protected runModule(context: Record<string, any>, transformed: string): Promise<void>;
195
+ prepareContext(context: Record<string, any>): Record<string, any>;
196
+ /**
197
+ * Define if a module should be interop-ed
198
+ * This function mostly for the ability to override by subclass
199
+ */
200
+ shouldInterop(path: string, mod: any): boolean;
201
+ protected importExternalModule(path: string): Promise<any>;
202
+ /**
203
+ * Import a module and interop it
204
+ */
205
+ interopedImport(path: string): Promise<any>;
206
+ }
207
+
208
+ type Nullable<T> = T | null | undefined;
209
+ type Arrayable<T> = T | Array<T>;
210
+ type Awaitable<T> = T | PromiseLike<T>;
211
+ interface DepsHandlingOptions {
212
+ external?: (string | RegExp)[];
213
+ inline?: (string | RegExp)[] | true;
214
+ inlineFiles?: string[];
215
+ /**
216
+ * A list of directories that are considered to hold Node.js modules
217
+ * Have to include "/" at the start and end of the path
218
+ *
219
+ * Vite-Node checks the whole absolute path of the import, so make sure you don't include
220
+ * unwanted files accidentally
221
+ * @default ['/node_modules/']
222
+ */
223
+ moduleDirectories?: string[];
224
+ cacheDir?: string;
225
+ /**
226
+ * Try to guess the CJS version of a package when it's invalid ESM
227
+ * @default false
228
+ */
229
+ fallbackCJS?: boolean;
230
+ }
231
+ interface StartOfSourceMap {
232
+ file?: string;
233
+ sourceRoot?: string;
234
+ }
235
+
236
+ interface RawSourceMap extends StartOfSourceMap {
237
+ version: number;
238
+ sources: string[];
239
+ names: string[];
240
+ sourcesContent?: (string | null)[];
241
+ mappings: string;
242
+ }
243
+ interface FetchResult {
244
+ code?: string;
245
+ externalize?: string;
246
+ map?: EncodedSourceMap | null;
247
+ }
248
+ type HotContext = Omit<ViteHotContext, "acceptDeps" | "decline">;
249
+ type FetchFunction = (id: string) => Promise<FetchResult>;
250
+ type ResolveIdFunction = (id: string, importer?: string) => Awaitable<ViteNodeResolveId | null | undefined | void>;
251
+ type CreateHotContextFunction = (runner: ViteNodeRunner, url: string) => HotContext;
252
+ interface ModuleCache {
253
+ promise?: Promise<any>;
254
+ exports?: any;
255
+ evaluated?: boolean;
256
+ resolving?: boolean;
257
+ code?: string;
258
+ map?: EncodedSourceMap;
259
+ /**
260
+ * Module ids that imports this module
261
+ */
262
+ importers?: Set<string>;
263
+ imports?: Set<string>;
264
+ }
265
+ interface ViteNodeRunnerOptions {
266
+ root: string;
267
+ fetchModule: FetchFunction;
268
+ resolveId?: ResolveIdFunction;
269
+ createHotContext?: CreateHotContextFunction;
270
+ base?: string;
271
+ moduleCache?: ModuleCacheMap;
272
+ moduleExecutionInfo?: ModuleExecutionInfo;
273
+ interopDefault?: boolean;
274
+ requestStubs?: Record<string, any>;
275
+ debug?: boolean;
276
+ }
277
+ interface ViteNodeResolveId {
278
+ external?: boolean | "absolute" | "relative";
279
+ id: string;
280
+ meta?: Record<string, any> | null;
281
+ moduleSideEffects?: boolean | "no-treeshake" | null;
282
+ syntheticNamedExports?: boolean | string | null;
283
+ }
284
+ interface ViteNodeResolveModule {
285
+ external: string | null;
286
+ id: string;
287
+ fsPath: string;
288
+ }
289
+ interface ViteNodeServerOptions {
290
+ /**
291
+ * Inject inline sourcemap to modules
292
+ * @default 'inline'
293
+ */
294
+ sourcemap?: "inline" | boolean;
295
+ /**
296
+ * Deps handling
297
+ */
298
+ deps?: DepsHandlingOptions;
299
+ /**
300
+ * Transform method for modules
301
+ */
302
+ transformMode?: {
303
+ ssr?: RegExp[]
304
+ web?: RegExp[]
305
+ };
306
+ debug?: DebuggerOptions;
307
+ }
308
+ interface DebuggerOptions {
309
+ /**
310
+ * Dump the transformed module to filesystem
311
+ * Passing a string will dump to the specified path
312
+ */
313
+ dumpModules?: boolean | string;
314
+ /**
315
+ * Read dumpped module from filesystem whenever exists.
316
+ * Useful for debugging by modifying the dump result from the filesystem.
317
+ */
318
+ loadDumppedModules?: boolean;
319
+ }
320
+
321
+ 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 };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- 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';
1
+ 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.d-CvjHzhRV.js';
2
2
  export { D as DecodedSourceMap, E as EncodedSourceMap, S as SourceMapInput } from './trace-mapping.d-DLVdEqOp.js';
package/dist/server.cjs CHANGED
@@ -566,7 +566,7 @@ class ViteNodeServer {
566
566
  result = await this.server.transformRequest(id, { ssr: true });
567
567
  }
568
568
  const sourcemap = this.options.sourcemap ?? "inline";
569
- if (sourcemap === "inline" && result && !id.includes("node_modules")) {
569
+ if (sourcemap === "inline" && result) {
570
570
  result = await this.processTransformResult(filepath, result);
571
571
  }
572
572
  if ((_c = this.options.debug) == null ? void 0 : _c.dumpModules) {
package/dist/server.d.ts CHANGED
@@ -1,58 +1,58 @@
1
1
  import { TransformResult, ViteDevServer } from 'vite';
2
- import { D as DebuggerOptions, c as DepsHandlingOptions, V as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId } from './index-LQxw79Gm.js';
2
+ import { D as DebuggerOptions, c as DepsHandlingOptions, V as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId } from './index.d-CvjHzhRV.js';
3
3
  import { E as EncodedSourceMap } from './trace-mapping.d-DLVdEqOp.js';
4
4
 
5
5
  declare class Debugger {
6
- options: DebuggerOptions;
7
- dumpDir: string | undefined;
8
- initPromise: Promise<void> | undefined;
9
- externalizeMap: Map<string, string>;
10
- constructor(root: string, options: DebuggerOptions);
11
- clearDump(): Promise<void>;
12
- encodeId(id: string): string;
13
- recordExternalize(id: string, path: string): Promise<void>;
14
- dumpFile(id: string, result: TransformResult | null): Promise<void>;
15
- loadDump(id: string): Promise<TransformResult | null>;
16
- writeInfo(): Promise<void>;
6
+ options: DebuggerOptions;
7
+ dumpDir: string | undefined;
8
+ initPromise: Promise<void> | undefined;
9
+ externalizeMap: Map<string, string>;
10
+ constructor(root: string, options: DebuggerOptions);
11
+ clearDump(): Promise<void>;
12
+ encodeId(id: string): string;
13
+ recordExternalize(id: string, path: string): Promise<void>;
14
+ dumpFile(id: string, result: TransformResult | null): Promise<void>;
15
+ loadDump(id: string): Promise<TransformResult | null>;
16
+ writeInfo(): Promise<void>;
17
17
  }
18
18
 
19
19
  declare function guessCJSversion(id: string): string | undefined;
20
20
  declare function shouldExternalize(id: string, options?: DepsHandlingOptions, cache?: Map<string, Promise<string | false>>): Promise<string | false>;
21
21
 
22
22
  interface FetchCache {
23
- duration?: number;
24
- timestamp: number;
25
- result: FetchResult;
23
+ duration?: number;
24
+ timestamp: number;
25
+ result: FetchResult;
26
26
  }
27
27
  declare class ViteNodeServer {
28
- server: ViteDevServer;
29
- options: ViteNodeServerOptions;
30
- private fetchPromiseMap;
31
- private transformPromiseMap;
32
- private durations;
33
- private existingOptimizedDeps;
34
- fetchCaches: Record<'ssr' | 'web', Map<string, FetchCache>>;
35
- fetchCache: Map<string, FetchCache>;
36
- externalizeCache: Map<string, Promise<string | false>>;
37
- debugger?: Debugger;
38
- constructor(server: ViteDevServer, options?: ViteNodeServerOptions);
39
- shouldExternalize(id: string): Promise<string | false>;
40
- getTotalDuration(): number;
41
- private ensureExists;
42
- resolveId(id: string, importer?: string, transformMode?: 'web' | 'ssr'): Promise<ViteNodeResolveId | null>;
43
- getSourceMap(source: string): EncodedSourceMap | null;
44
- private assertMode;
45
- fetchModule(id: string, transformMode?: 'web' | 'ssr'): Promise<FetchResult>;
46
- fetchResult(id: string, mode: 'web' | 'ssr'): Promise<FetchResult>;
47
- transformRequest(id: string, filepath?: string, transformMode?: 'web' | 'ssr'): Promise<TransformResult | null | undefined>;
48
- transformModule(id: string, transformMode?: 'web' | 'ssr'): Promise<{
49
- code: string | undefined;
50
- }>;
51
- getTransformMode(id: string): 'ssr' | 'web';
52
- private getChangedModule;
53
- private _fetchModule;
54
- protected processTransformResult(filepath: string, result: TransformResult): Promise<TransformResult>;
55
- private _transformRequest;
28
+ server: ViteDevServer;
29
+ options: ViteNodeServerOptions;
30
+ private fetchPromiseMap;
31
+ private transformPromiseMap;
32
+ private durations;
33
+ private existingOptimizedDeps;
34
+ fetchCaches: Record<"ssr" | "web", Map<string, FetchCache>>;
35
+ fetchCache: Map<string, FetchCache>;
36
+ externalizeCache: Map<string, Promise<string | false>>;
37
+ debugger?: Debugger;
38
+ constructor(server: ViteDevServer, options?: ViteNodeServerOptions);
39
+ shouldExternalize(id: string): Promise<string | false>;
40
+ getTotalDuration(): number;
41
+ private ensureExists;
42
+ resolveId(id: string, importer?: string, transformMode?: "web" | "ssr"): Promise<ViteNodeResolveId | null>;
43
+ getSourceMap(source: string): EncodedSourceMap | null;
44
+ private assertMode;
45
+ fetchModule(id: string, transformMode?: "web" | "ssr"): Promise<FetchResult>;
46
+ fetchResult(id: string, mode: "web" | "ssr"): Promise<FetchResult>;
47
+ transformRequest(id: string, filepath?: string, transformMode?: "web" | "ssr"): Promise<TransformResult | null | undefined>;
48
+ transformModule(id: string, transformMode?: "web" | "ssr"): Promise<{
49
+ code: string | undefined
50
+ }>;
51
+ getTransformMode(id: string): "ssr" | "web";
52
+ private getChangedModule;
53
+ private _fetchModule;
54
+ protected processTransformResult(filepath: string, result: TransformResult): Promise<TransformResult>;
55
+ private _transformRequest;
56
56
  }
57
57
 
58
58
  export { ViteNodeServer, guessCJSversion, shouldExternalize };
package/dist/server.mjs CHANGED
@@ -545,7 +545,7 @@ class ViteNodeServer {
545
545
  result = await this.server.transformRequest(id, { ssr: true });
546
546
  }
547
547
  const sourcemap = this.options.sourcemap ?? "inline";
548
- if (sourcemap === "inline" && result && !id.includes("node_modules")) {
548
+ if (sourcemap === "inline" && result) {
549
549
  result = await this.processTransformResult(filepath, result);
550
550
  }
551
551
  if ((_c = this.options.debug) == null ? void 0 : _c.dumpModules) {
@@ -882,7 +882,7 @@ function prepareStackTrace(error, stack) {
882
882
  }
883
883
  retrieveFileHandlers.slice(0);
884
884
  retrieveMapHandlers.slice(0);
885
- const install = function(options) {
885
+ function install(options) {
886
886
  options = options || {};
887
887
  if (options.retrieveFile) {
888
888
  if (options.overrideRetrieveFile) {
@@ -900,7 +900,7 @@ const install = function(options) {
900
900
  errorFormatterInstalled = true;
901
901
  Error.prepareStackTrace = prepareStackTrace;
902
902
  }
903
- };
903
+ }
904
904
 
905
905
  let SOURCEMAPPING_URL = "sourceMa";
906
906
  SOURCEMAPPING_URL += "ppingURL";
@@ -2,12 +2,12 @@ import { TransformResult } from 'vite';
2
2
  import { E as EncodedSourceMap } from './trace-mapping.d-DLVdEqOp.js';
3
3
 
4
4
  interface InstallSourceMapSupportOptions {
5
- getSourceMap: (source: string) => EncodedSourceMap | null | undefined;
5
+ getSourceMap: (source: string) => EncodedSourceMap | null | undefined;
6
6
  }
7
7
  declare function withInlineSourcemap(result: TransformResult, options: {
8
- root: string;
9
- filepath: string;
10
- noFirstLineMapping?: boolean;
8
+ root: string
9
+ filepath: string
10
+ noFirstLineMapping?: boolean
11
11
  }): TransformResult;
12
12
  declare function extractSourceMap(code: string): EncodedSourceMap | null;
13
13
  declare function installSourcemapsSupport(options: InstallSourceMapSupportOptions): void;
@@ -880,7 +880,7 @@ function prepareStackTrace(error, stack) {
880
880
  }
881
881
  retrieveFileHandlers.slice(0);
882
882
  retrieveMapHandlers.slice(0);
883
- const install = function(options) {
883
+ function install(options) {
884
884
  options = options || {};
885
885
  if (options.retrieveFile) {
886
886
  if (options.overrideRetrieveFile) {
@@ -898,7 +898,7 @@ const install = function(options) {
898
898
  errorFormatterInstalled = true;
899
899
  Error.prepareStackTrace = prepareStackTrace;
900
900
  }
901
- };
901
+ }
902
902
 
903
903
  let SOURCEMAPPING_URL = "sourceMa";
904
904
  SOURCEMAPPING_URL += "ppingURL";
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { D as DecodedSourceMap, E as EncodedSourceMap, S as SourceMapInput } from './trace-mapping.d-DLVdEqOp.js';
2
- 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';
2
+ 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.d-CvjHzhRV.js';
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { N as Nullable, A as Arrayable } from './index-LQxw79Gm.js';
1
+ import { N as Nullable, A as Arrayable } from './index.d-CvjHzhRV.js';
2
2
  import './trace-mapping.d-DLVdEqOp.js';
3
3
 
4
4
  declare const isWindows: boolean;
@@ -10,22 +10,22 @@ declare function isInternalRequest(id: string): boolean;
10
10
  declare function normalizeModuleId(id: string): string;
11
11
  declare function isPrimitive(v: any): boolean;
12
12
  declare function toFilePath(id: string, root: string): {
13
- path: string;
14
- exists: boolean;
13
+ path: string
14
+ exists: boolean
15
15
  };
16
16
  declare function isNodeBuiltin(id: string): boolean;
17
17
  /**
18
- * Convert `Arrayable<T>` to `Array<T>`
19
- *
20
- * @category Array
21
- */
18
+ * Convert `Arrayable<T>` to `Array<T>`
19
+ *
20
+ * @category Array
21
+ */
22
22
  declare function toArray<T>(array?: Nullable<Arrayable<T>>): Array<T>;
23
23
  declare function getCachedData<T>(cache: Map<string, T>, basedir: string, originalBasedir: string): NonNullable<T> | undefined;
24
24
  declare function setCacheData<T>(cache: Map<string, T>, data: T, basedir: string, originalBasedir: string): void;
25
25
  declare function withTrailingSlash(path: string): string;
26
26
  declare function createImportMetaEnvProxy(): NodeJS.ProcessEnv;
27
27
  declare function findNearestPackageData(basedir: string): Promise<{
28
- type?: 'module' | 'commonjs';
28
+ type?: "module" | "commonjs"
29
29
  }>;
30
30
 
31
31
  export { VALID_ID_PREFIX, cleanUrl, createImportMetaEnvProxy, findNearestPackageData, getCachedData, isInternalRequest, isNodeBuiltin, isPrimitive, isWindows, normalizeModuleId, normalizeRequestId, setCacheData, slash, toArray, toFilePath, withTrailingSlash };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-node",
3
3
  "type": "module",
4
- "version": "3.0.7",
4
+ "version": "3.0.9",
5
5
  "description": "Vite as Node.js runtime",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -1,321 +0,0 @@
1
- import { E as EncodedSourceMap } from './trace-mapping.d-DLVdEqOp.js';
2
-
3
- /** @deprecated use HotPayload */
4
- type HMRPayload = HotPayload
5
- type HotPayload =
6
- | ConnectedPayload
7
- | PingPayload
8
- | UpdatePayload
9
- | FullReloadPayload
10
- | CustomPayload
11
- | ErrorPayload
12
- | PrunePayload
13
-
14
- interface ConnectedPayload {
15
- type: 'connected'
16
- }
17
-
18
- interface PingPayload {
19
- type: 'ping'
20
- }
21
-
22
- interface UpdatePayload {
23
- type: 'update'
24
- updates: Update[]
25
- }
26
-
27
- interface Update {
28
- type: 'js-update' | 'css-update'
29
- path: string
30
- acceptedPath: string
31
- timestamp: number
32
- /** @internal */
33
- explicitImportRequired?: boolean
34
- /** @internal */
35
- isWithinCircularImport?: boolean
36
- /** @internal */
37
- invalidates?: string[]
38
- }
39
-
40
- interface PrunePayload {
41
- type: 'prune'
42
- paths: string[]
43
- }
44
-
45
- interface FullReloadPayload {
46
- type: 'full-reload'
47
- path?: string
48
- /** @internal */
49
- triggeredBy?: string
50
- }
51
-
52
- interface CustomPayload {
53
- type: 'custom'
54
- event: string
55
- data?: any
56
- }
57
-
58
- interface ErrorPayload {
59
- type: 'error'
60
- err: {
61
- [name: string]: any
62
- message: string
63
- stack: string
64
- id?: string
65
- frame?: string
66
- plugin?: string
67
- pluginCode?: string
68
- loc?: {
69
- file?: string
70
- line: number
71
- column: number
72
- }
73
- }
74
- }
75
-
76
- interface CustomEventMap {
77
- 'vite:beforeUpdate': UpdatePayload
78
- 'vite:afterUpdate': UpdatePayload
79
- 'vite:beforePrune': PrunePayload
80
- 'vite:beforeFullReload': FullReloadPayload
81
- 'vite:error': ErrorPayload
82
- 'vite:invalidate': InvalidatePayload
83
- 'vite:ws:connect': WebSocketConnectionPayload
84
- 'vite:ws:disconnect': WebSocketConnectionPayload
85
- }
86
-
87
- interface WebSocketConnectionPayload {
88
- /**
89
- * @experimental
90
- * We expose this instance experimentally to see potential usage.
91
- * This might be removed in the future if we didn't find reasonable use cases.
92
- * If you find this useful, please open an issue with details so we can discuss and make it stable API.
93
- */
94
- // eslint-disable-next-line n/no-unsupported-features/node-builtins
95
- webSocket: WebSocket
96
- }
97
-
98
- interface InvalidatePayload {
99
- path: string
100
- message: string | undefined
101
- }
102
-
103
- /**
104
- * provides types for built-in Vite events
105
- */
106
- type InferCustomEventPayload<T extends string> =
107
- T extends keyof CustomEventMap ? CustomEventMap[T] : any
108
-
109
- type ModuleNamespace = Record<string, any> & {
110
- [Symbol.toStringTag]: 'Module'
111
- }
112
-
113
- interface ViteHotContext {
114
- readonly data: any
115
-
116
- accept(): void
117
- accept(cb: (mod: ModuleNamespace | undefined) => void): void
118
- accept(dep: string, cb: (mod: ModuleNamespace | undefined) => void): void
119
- accept(
120
- deps: readonly string[],
121
- cb: (mods: Array<ModuleNamespace | undefined>) => void,
122
- ): void
123
-
124
- acceptExports(
125
- exportNames: string | readonly string[],
126
- cb?: (mod: ModuleNamespace | undefined) => void,
127
- ): void
128
-
129
- dispose(cb: (data: any) => void): void
130
- prune(cb: (data: any) => void): void
131
- invalidate(message?: string): void
132
-
133
- on<T extends string>(
134
- event: T,
135
- cb: (payload: InferCustomEventPayload<T>) => void,
136
- ): void
137
- off<T extends string>(
138
- event: T,
139
- cb: (payload: InferCustomEventPayload<T>) => void,
140
- ): void
141
- send<T extends string>(event: T, data?: InferCustomEventPayload<T>): void
142
- }
143
-
144
- declare const DEFAULT_REQUEST_STUBS: Record<string, Record<string, unknown>>;
145
- declare class ModuleCacheMap extends Map<string, ModuleCache> {
146
- normalizePath(fsPath: string): string;
147
- /**
148
- * Assign partial data to the map
149
- */
150
- update(fsPath: string, mod: ModuleCache): this;
151
- setByModuleId(modulePath: string, mod: ModuleCache): this;
152
- set(fsPath: string, mod: ModuleCache): this;
153
- getByModuleId(modulePath: string): ModuleCache & Required<Pick<ModuleCache, "imports" | "importers">>;
154
- get(fsPath: string): ModuleCache & Required<Pick<ModuleCache, 'importers' | 'imports'>>;
155
- deleteByModuleId(modulePath: string): boolean;
156
- delete(fsPath: string): boolean;
157
- invalidateModule(mod: ModuleCache): boolean;
158
- /**
159
- * Invalidate modules that dependent on the given modules, up to the main entry
160
- */
161
- invalidateDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>;
162
- /**
163
- * Invalidate dependency modules of the given modules, down to the bottom-level dependencies
164
- */
165
- invalidateSubDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>;
166
- /**
167
- * Return parsed source map based on inlined source map of the module
168
- */
169
- getSourceMap(id: string): EncodedSourceMap | null;
170
- }
171
- type ModuleExecutionInfo = Map<string, {
172
- startOffset: number;
173
- }>;
174
- declare class ViteNodeRunner {
175
- options: ViteNodeRunnerOptions;
176
- root: string;
177
- debug: boolean;
178
- /**
179
- * Holds the cache of modules
180
- * Keys of the map are filepaths, or plain package names
181
- */
182
- moduleCache: ModuleCacheMap;
183
- constructor(options: ViteNodeRunnerOptions);
184
- executeFile(file: string): Promise<any>;
185
- executeId(rawId: string): Promise<any>;
186
- shouldResolveId(id: string, _importee?: string): boolean;
187
- private _resolveUrl;
188
- resolveUrl(id: string, importee?: string): Promise<[url: string, fsPath: string]>;
189
- protected getContextPrimitives(): {
190
- Object: ObjectConstructor;
191
- Reflect: typeof Reflect;
192
- Symbol: SymbolConstructor;
193
- };
194
- protected runModule(context: Record<string, any>, transformed: string): Promise<void>;
195
- prepareContext(context: Record<string, any>): Record<string, any>;
196
- /**
197
- * Define if a module should be interop-ed
198
- * This function mostly for the ability to override by subclass
199
- */
200
- shouldInterop(path: string, mod: any): boolean;
201
- protected importExternalModule(path: string): Promise<any>;
202
- /**
203
- * Import a module and interop it
204
- */
205
- interopedImport(path: string): Promise<any>;
206
- }
207
-
208
- type Nullable<T> = T | null | undefined;
209
- type Arrayable<T> = T | Array<T>;
210
- type Awaitable<T> = T | PromiseLike<T>;
211
- interface DepsHandlingOptions {
212
- external?: (string | RegExp)[];
213
- inline?: (string | RegExp)[] | true;
214
- inlineFiles?: string[];
215
- /**
216
- * A list of directories that are considered to hold Node.js modules
217
- * Have to include "/" at the start and end of the path
218
- *
219
- * Vite-Node checks the whole absolute path of the import, so make sure you don't include
220
- * unwanted files accidentally
221
- * @default ['/node_modules/']
222
- */
223
- moduleDirectories?: string[];
224
- cacheDir?: string;
225
- /**
226
- * Try to guess the CJS version of a package when it's invalid ESM
227
- * @default false
228
- */
229
- fallbackCJS?: boolean;
230
- }
231
- interface StartOfSourceMap {
232
- file?: string;
233
- sourceRoot?: string;
234
- }
235
-
236
- interface RawSourceMap extends StartOfSourceMap {
237
- version: number;
238
- sources: string[];
239
- names: string[];
240
- sourcesContent?: (string | null)[];
241
- mappings: string;
242
- }
243
- interface FetchResult {
244
- code?: string;
245
- externalize?: string;
246
- map?: EncodedSourceMap | null;
247
- }
248
- type HotContext = Omit<ViteHotContext, 'acceptDeps' | 'decline'>;
249
- type FetchFunction = (id: string) => Promise<FetchResult>;
250
- type ResolveIdFunction = (id: string, importer?: string) => Awaitable<ViteNodeResolveId | null | undefined | void>;
251
- type CreateHotContextFunction = (runner: ViteNodeRunner, url: string) => HotContext;
252
- interface ModuleCache {
253
- promise?: Promise<any>;
254
- exports?: any;
255
- evaluated?: boolean;
256
- resolving?: boolean;
257
- code?: string;
258
- map?: EncodedSourceMap;
259
- /**
260
- * Module ids that imports this module
261
- */
262
- importers?: Set<string>;
263
- imports?: Set<string>;
264
- }
265
- interface ViteNodeRunnerOptions {
266
- root: string;
267
- fetchModule: FetchFunction;
268
- resolveId?: ResolveIdFunction;
269
- createHotContext?: CreateHotContextFunction;
270
- base?: string;
271
- moduleCache?: ModuleCacheMap;
272
- moduleExecutionInfo?: ModuleExecutionInfo;
273
- interopDefault?: boolean;
274
- requestStubs?: Record<string, any>;
275
- debug?: boolean;
276
- }
277
- interface ViteNodeResolveId {
278
- external?: boolean | 'absolute' | 'relative';
279
- id: string;
280
- meta?: Record<string, any> | null;
281
- moduleSideEffects?: boolean | 'no-treeshake' | null;
282
- syntheticNamedExports?: boolean | string | null;
283
- }
284
- interface ViteNodeResolveModule {
285
- external: string | null;
286
- id: string;
287
- fsPath: string;
288
- }
289
- interface ViteNodeServerOptions {
290
- /**
291
- * Inject inline sourcemap to modules
292
- * @default 'inline'
293
- */
294
- sourcemap?: 'inline' | boolean;
295
- /**
296
- * Deps handling
297
- */
298
- deps?: DepsHandlingOptions;
299
- /**
300
- * Transform method for modules
301
- */
302
- transformMode?: {
303
- ssr?: RegExp[];
304
- web?: RegExp[];
305
- };
306
- debug?: DebuggerOptions;
307
- }
308
- interface DebuggerOptions {
309
- /**
310
- * Dump the transformed module to filesystem
311
- * Passing a string will dump to the specified path
312
- */
313
- dumpModules?: boolean | string;
314
- /**
315
- * Read dumpped module from filesystem whenever exists.
316
- * Useful for debugging by modifying the dump result from the filesystem.
317
- */
318
- loadDumppedModules?: boolean;
319
- }
320
-
321
- 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 };