vite-node 4.0.0-beta.9 → 5.0.0
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/LICENSE +1 -1
- package/README.md +8 -4
- package/dist/{chunk-hmr.mjs → chunk-hmr.js} +63 -34
- package/dist/{chunk-browser.mjs → chunk-index.js} +26 -25
- package/dist/cli.d.ts +1 -1
- package/dist/{cli.mjs → cli.js} +67 -23
- package/dist/client.d.ts +1 -1
- package/dist/{client.mjs → client.js} +110 -46
- package/dist/hmr.d.ts +1 -4
- package/dist/{hmr.mjs → hmr.js} +4 -3
- package/dist/{index.d-CvIJUDRh.d.ts → index.d-D6Pqey3g.d.ts} +5 -1
- package/dist/index.d.ts +1 -1
- package/dist/server.d.ts +2 -2
- package/dist/{server.mjs → server.js} +110 -56
- package/dist/{source-map.mjs → source-map.js} +229 -173
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/{utils.mjs → utils.js} +33 -13
- package/package.json +41 -60
- package/vite-node.js +2 -0
- package/dist/chunk-browser.cjs +0 -83
- package/dist/chunk-hmr.cjs +0 -221
- package/dist/cli.cjs +0 -114
- package/dist/client.cjs +0 -447
- package/dist/constants.cjs +0 -36
- package/dist/hmr.cjs +0 -21
- package/dist/index.cjs +0 -2
- package/dist/server.cjs +0 -382
- package/dist/source-map.cjs +0 -867
- package/dist/types.cjs +0 -2
- package/dist/utils.cjs +0 -196
- package/vite-node.mjs +0 -2
- /package/dist/{constants.mjs → constants.js} +0 -0
- /package/dist/{index.mjs → index.js} +0 -0
- /package/dist/{types.mjs → types.js} +0 -0
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
2
|
import { resolve, dirname } from 'node:path';
|
|
3
|
+
import process from 'node:process';
|
|
3
4
|
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
4
5
|
import vm from 'node:vm';
|
|
5
6
|
import createDebug from 'debug';
|
|
6
|
-
import { extractSourceMap } from './source-map.
|
|
7
|
-
import { createImportMetaEnvProxy, slash, isInternalRequest, isNodeBuiltin, normalizeRequestId, toFilePath, normalizeModuleId, cleanUrl, isPrimitive, isBareImport } from './utils.
|
|
7
|
+
import { extractSourceMap } from './source-map.js';
|
|
8
|
+
import { createImportMetaEnvProxy, slash, isInternalRequest, isNodeBuiltin, normalizeRequestId, toFilePath, normalizeModuleId, cleanUrl, isPrimitive, isBareImport } from './utils.js';
|
|
9
|
+
import 'node:buffer';
|
|
8
10
|
import 'pathe';
|
|
9
11
|
import 'node:fs';
|
|
10
12
|
|
|
11
|
-
const { setTimeout, clearTimeout } = globalThis
|
|
13
|
+
const { setTimeout, clearTimeout } = globalThis;
|
|
14
|
+
const debugExecute = createDebug("vite-node:client:execute");
|
|
15
|
+
const debugNative = createDebug("vite-node:client:native");
|
|
16
|
+
const clientStub = {
|
|
12
17
|
injectQuery: (id) => id,
|
|
13
18
|
createHotContext: () => {
|
|
14
19
|
return {
|
|
@@ -23,7 +28,8 @@ const { setTimeout, clearTimeout } = globalThis, debugExecute = createDebug("vit
|
|
|
23
28
|
},
|
|
24
29
|
updateStyle: () => {},
|
|
25
30
|
removeStyle: () => {}
|
|
26
|
-
}
|
|
31
|
+
};
|
|
32
|
+
const env = createImportMetaEnvProxy();
|
|
27
33
|
const DEFAULT_REQUEST_STUBS = {
|
|
28
34
|
"/@vite/client": clientStub,
|
|
29
35
|
"@vite/client": clientStub
|
|
@@ -36,7 +42,8 @@ class ModuleCacheMap extends Map {
|
|
|
36
42
|
* Assign partial data to the map
|
|
37
43
|
*/
|
|
38
44
|
update(fsPath, mod) {
|
|
39
|
-
|
|
45
|
+
fsPath = this.normalizePath(fsPath);
|
|
46
|
+
if (!super.has(fsPath)) this.setByModuleId(fsPath, mod);
|
|
40
47
|
else Object.assign(super.get(fsPath), mod);
|
|
41
48
|
return this;
|
|
42
49
|
}
|
|
@@ -66,7 +73,13 @@ class ModuleCacheMap extends Map {
|
|
|
66
73
|
}
|
|
67
74
|
invalidateModule(mod) {
|
|
68
75
|
var _mod$importers, _mod$imports;
|
|
69
|
-
|
|
76
|
+
delete mod.evaluated;
|
|
77
|
+
delete mod.resolving;
|
|
78
|
+
delete mod.promise;
|
|
79
|
+
delete mod.exports;
|
|
80
|
+
(_mod$importers = mod.importers) === null || _mod$importers === void 0 || _mod$importers.clear();
|
|
81
|
+
(_mod$imports = mod.imports) === null || _mod$imports === void 0 || _mod$imports.clear();
|
|
82
|
+
return true;
|
|
70
83
|
}
|
|
71
84
|
/**
|
|
72
85
|
* Invalidate modules that dependent on the given modules, up to the main entry
|
|
@@ -106,7 +119,11 @@ class ModuleCacheMap extends Map {
|
|
|
106
119
|
const cache = this.get(id);
|
|
107
120
|
if (cache.map) return cache.map;
|
|
108
121
|
const map = cache.code && extractSourceMap(cache.code);
|
|
109
|
-
|
|
122
|
+
if (map) {
|
|
123
|
+
cache.map = map;
|
|
124
|
+
return map;
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
110
127
|
}
|
|
111
128
|
}
|
|
112
129
|
class ViteNodeRunner {
|
|
@@ -137,7 +154,10 @@ class ViteNodeRunner {
|
|
|
137
154
|
// `performance` can be mocked, so make sure we're using the original function
|
|
138
155
|
performanceNow = performance.now.bind(performance);
|
|
139
156
|
constructor(options) {
|
|
140
|
-
this.options = options
|
|
157
|
+
this.options = options;
|
|
158
|
+
this.root = options.root ?? process.cwd();
|
|
159
|
+
this.moduleCache = options.moduleCache ?? new ModuleCacheMap();
|
|
160
|
+
this.debug = options.debug ?? (typeof process !== "undefined" ? !!process.env.VITE_NODE_DEBUG_RUNNER : false);
|
|
141
161
|
}
|
|
142
162
|
async executeFile(file) {
|
|
143
163
|
const url = `/@fs/${slash(resolve(file))}`;
|
|
@@ -149,7 +169,9 @@ class ViteNodeRunner {
|
|
|
149
169
|
}
|
|
150
170
|
/** @internal */
|
|
151
171
|
async cachedRequest(id, fsPath, callstack) {
|
|
152
|
-
const importee = callstack[callstack.length - 1]
|
|
172
|
+
const importee = callstack[callstack.length - 1];
|
|
173
|
+
const mod = this.moduleCache.get(fsPath);
|
|
174
|
+
const { imports, importers } = mod;
|
|
153
175
|
if (importee) importers.add(importee);
|
|
154
176
|
const getStack = () => `stack:\n${[...callstack, fsPath].reverse().map((p) => ` - ${p}`).join("\n")}`;
|
|
155
177
|
// check circular dependency
|
|
@@ -162,12 +184,14 @@ class ViteNodeRunner {
|
|
|
162
184
|
// cached module
|
|
163
185
|
if (mod.promise) return await mod.promise;
|
|
164
186
|
const promise = this.directRequest(id, fsPath, callstack);
|
|
165
|
-
|
|
187
|
+
Object.assign(mod, {
|
|
166
188
|
promise,
|
|
167
189
|
evaluated: false
|
|
168
|
-
})
|
|
190
|
+
});
|
|
191
|
+
return await promise;
|
|
169
192
|
} finally {
|
|
170
|
-
|
|
193
|
+
mod.evaluated = true;
|
|
194
|
+
if (debugTimer) clearTimeout(debugTimer);
|
|
171
195
|
}
|
|
172
196
|
}
|
|
173
197
|
shouldResolveId(id, _importee) {
|
|
@@ -186,16 +210,18 @@ class ViteNodeRunner {
|
|
|
186
210
|
|
|
187
211
|
- If you rely on tsconfig.json's "paths" to resolve modules, please install "vite-tsconfig-paths" plugin to handle module resolution.
|
|
188
212
|
- Make sure you don't have relative aliases in your Vitest config. Use absolute paths instead. Read more: https://vitest.dev/guide/common-errors`);
|
|
189
|
-
|
|
213
|
+
Object.defineProperty(error, "code", {
|
|
190
214
|
value: "ERR_MODULE_NOT_FOUND",
|
|
191
215
|
enumerable: true
|
|
192
|
-
})
|
|
216
|
+
});
|
|
217
|
+
Object.defineProperty(error, Symbol.for("vitest.error.not_found.data"), {
|
|
193
218
|
value: {
|
|
194
219
|
id: dep,
|
|
195
220
|
importer
|
|
196
221
|
},
|
|
197
222
|
enumerable: false
|
|
198
|
-
})
|
|
223
|
+
});
|
|
224
|
+
throw error;
|
|
199
225
|
}
|
|
200
226
|
const resolvedId = resolved ? normalizeRequestId(resolved.id, this.options.base) : dep;
|
|
201
227
|
return [resolvedId, resolvedId];
|
|
@@ -221,31 +247,46 @@ class ViteNodeRunner {
|
|
|
221
247
|
// rethrow vite error if it cannot load the module because it's not resolved
|
|
222
248
|
if (typeof cause === "object" && cause.code === "ERR_LOAD_URL" || typeof (cause === null || cause === void 0 ? void 0 : cause.message) === "string" && cause.message.includes("Failed to load url")) {
|
|
223
249
|
const error = new Error(`Cannot find ${isBareImport(id) ? "package" : "module"} '${id}'${importer ? ` imported from '${importer}'` : ""}`, { cause });
|
|
224
|
-
|
|
250
|
+
error.code = "ERR_MODULE_NOT_FOUND";
|
|
251
|
+
throw error;
|
|
225
252
|
}
|
|
226
253
|
throw cause;
|
|
227
254
|
}
|
|
228
255
|
}
|
|
229
256
|
/** @internal */
|
|
230
257
|
async directRequest(id, fsPath, _callstack) {
|
|
231
|
-
const moduleId = normalizeModuleId(fsPath)
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
258
|
+
const moduleId = normalizeModuleId(fsPath);
|
|
259
|
+
const callstack = [..._callstack, moduleId];
|
|
260
|
+
const mod = this.moduleCache.getByModuleId(moduleId);
|
|
261
|
+
const request = async (dep) => {
|
|
262
|
+
const [id, depFsPath] = await this.resolveUrl(String(dep), fsPath);
|
|
263
|
+
this.moduleCache.getByModuleId(depFsPath).importers.add(moduleId);
|
|
264
|
+
mod.imports.add(depFsPath);
|
|
265
|
+
return this.dependencyRequest(id, depFsPath, callstack);
|
|
266
|
+
};
|
|
267
|
+
const requestStubs = this.options.requestStubs || DEFAULT_REQUEST_STUBS;
|
|
235
268
|
if (id in requestStubs) return requestStubs[id];
|
|
236
269
|
let { code: transformed, externalize } = await this._fetchModule(id, callstack[callstack.length - 2]);
|
|
237
270
|
if (externalize) {
|
|
238
271
|
debugNative(externalize);
|
|
239
272
|
const exports = await this.interopedImport(externalize);
|
|
240
|
-
|
|
273
|
+
mod.exports = exports;
|
|
274
|
+
return exports;
|
|
241
275
|
}
|
|
242
276
|
if (transformed == null) throw new Error(`[vite-node] Failed to load "${id}" imported from ${callstack[callstack.length - 2]}`);
|
|
243
|
-
const { Object, Reflect, Symbol } = this.getContextPrimitives()
|
|
277
|
+
const { Object, Reflect, Symbol } = this.getContextPrimitives();
|
|
278
|
+
const modulePath = cleanUrl(moduleId);
|
|
279
|
+
// disambiguate the `<UNIT>:/` on windows: see nodejs/node#31710
|
|
280
|
+
const href = pathToFileURL(modulePath).href;
|
|
281
|
+
const __filename = fileURLToPath(href);
|
|
282
|
+
const __dirname = dirname(__filename);
|
|
283
|
+
const meta = {
|
|
244
284
|
url: href,
|
|
245
285
|
env,
|
|
246
286
|
filename: __filename,
|
|
247
287
|
dirname: __dirname
|
|
248
|
-
}
|
|
288
|
+
};
|
|
289
|
+
const exports = Object.create(null);
|
|
249
290
|
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
250
291
|
value: "Module",
|
|
251
292
|
enumerable: false,
|
|
@@ -257,17 +298,25 @@ class ViteNodeRunner {
|
|
|
257
298
|
// inside the module itself. imported module is always "exports"
|
|
258
299
|
const cjsExports = new Proxy(exports, {
|
|
259
300
|
get: (target, p, receiver) => {
|
|
260
|
-
|
|
301
|
+
if (Reflect.has(target, p)) return Reflect.get(target, p, receiver);
|
|
302
|
+
return Reflect.get(Object.prototype, p, receiver);
|
|
261
303
|
},
|
|
262
304
|
getPrototypeOf: () => Object.prototype,
|
|
263
305
|
set: (_, p, value) => {
|
|
264
306
|
// treat "module.exports =" the same as "exports.default =" to not have nested "default.default",
|
|
265
307
|
// so "exports.default" becomes the actual module
|
|
266
|
-
if (p === "default" && this.shouldInterop(modulePath, { default: value }) && cjsExports !== value)
|
|
308
|
+
if (p === "default" && this.shouldInterop(modulePath, { default: value }) && cjsExports !== value) {
|
|
309
|
+
exportAll(cjsExports, value);
|
|
310
|
+
exports.default = value;
|
|
311
|
+
return true;
|
|
312
|
+
}
|
|
267
313
|
if (!Reflect.has(exports, "default")) exports.default = {};
|
|
268
314
|
// returns undefined, when accessing named exports, if default is not an object
|
|
269
315
|
// but is still present inside hasOwnKeys, this is Node behaviour for CJS
|
|
270
|
-
if (moduleExports !== SYMBOL_NOT_DEFINED && isPrimitive(moduleExports))
|
|
316
|
+
if (moduleExports !== SYMBOL_NOT_DEFINED && isPrimitive(moduleExports)) {
|
|
317
|
+
defineExport(exports, p, () => void 0);
|
|
318
|
+
return true;
|
|
319
|
+
}
|
|
271
320
|
if (!isPrimitive(exports.default)) exports.default[p] = value;
|
|
272
321
|
if (p !== "default") defineExport(exports, p, () => value);
|
|
273
322
|
return true;
|
|
@@ -279,7 +328,9 @@ class ViteNodeRunner {
|
|
|
279
328
|
});
|
|
280
329
|
const moduleProxy = {
|
|
281
330
|
set exports(value) {
|
|
282
|
-
exportAll(cjsExports, value)
|
|
331
|
+
exportAll(cjsExports, value);
|
|
332
|
+
exports.default = value;
|
|
333
|
+
moduleExports = value;
|
|
283
334
|
},
|
|
284
335
|
get exports() {
|
|
285
336
|
return cjsExports;
|
|
@@ -291,7 +342,8 @@ class ViteNodeRunner {
|
|
|
291
342
|
enumerable: true,
|
|
292
343
|
get: () => {
|
|
293
344
|
var _this$options$createH, _this$options;
|
|
294
|
-
|
|
345
|
+
hotContext || (hotContext = (_this$options$createH = (_this$options = this.options).createHotContext) === null || _this$options$createH === void 0 ? void 0 : _this$options$createH.call(_this$options, this, moduleId));
|
|
346
|
+
return hotContext;
|
|
295
347
|
},
|
|
296
348
|
set: (value) => {
|
|
297
349
|
hotContext = value;
|
|
@@ -318,9 +370,11 @@ class ViteNodeRunner {
|
|
|
318
370
|
__filename,
|
|
319
371
|
__dirname
|
|
320
372
|
});
|
|
373
|
+
debugExecute(__filename);
|
|
321
374
|
// remove shebang
|
|
322
|
-
if (
|
|
323
|
-
|
|
375
|
+
if (transformed[0] === "#") transformed = transformed.replace(/^#!.*/, (s) => " ".repeat(s.length));
|
|
376
|
+
await this.runModule(context, transformed);
|
|
377
|
+
return exports;
|
|
324
378
|
}
|
|
325
379
|
getContextPrimitives() {
|
|
326
380
|
return {
|
|
@@ -331,14 +385,16 @@ class ViteNodeRunner {
|
|
|
331
385
|
}
|
|
332
386
|
async runModule(context, transformed) {
|
|
333
387
|
// add 'use strict' since ESM enables it by default
|
|
334
|
-
const codeDefinition = `'use strict';async (${Object.keys(context).join(",")})=>{{
|
|
388
|
+
const codeDefinition = `'use strict';async (${Object.keys(context).join(",")})=>{{`;
|
|
389
|
+
const code = `${codeDefinition}${transformed}\n}}`;
|
|
390
|
+
const options = {
|
|
335
391
|
filename: context.__filename,
|
|
336
392
|
lineOffset: 0,
|
|
337
393
|
columnOffset: -codeDefinition.length
|
|
338
|
-
}
|
|
394
|
+
};
|
|
395
|
+
const finishModuleExecutionInfo = this.startCalculateModuleExecutionInfo(options.filename, codeDefinition.length);
|
|
339
396
|
try {
|
|
340
|
-
|
|
341
|
-
await fn(...Object.values(context));
|
|
397
|
+
await vm.runInThisContext(code, options)(...Object.values(context));
|
|
342
398
|
} finally {
|
|
343
399
|
var _this$options$moduleE;
|
|
344
400
|
(_this$options$moduleE = this.options.moduleExecutionInfo) === null || _this$options$moduleE === void 0 || _this$options$moduleE.set(options.filename, finishModuleExecutionInfo());
|
|
@@ -350,12 +406,14 @@ class ViteNodeRunner {
|
|
|
350
406
|
*/
|
|
351
407
|
startCalculateModuleExecutionInfo(filename, startOffset) {
|
|
352
408
|
const startTime = this.performanceNow();
|
|
353
|
-
|
|
409
|
+
this.executionStack.push({
|
|
354
410
|
filename,
|
|
355
411
|
startTime,
|
|
356
412
|
subImportTime: 0
|
|
357
|
-
})
|
|
358
|
-
|
|
413
|
+
});
|
|
414
|
+
return () => {
|
|
415
|
+
const duration = this.performanceNow() - startTime;
|
|
416
|
+
const currentExecution = this.executionStack.pop();
|
|
359
417
|
if (currentExecution == null) throw new Error("Execution stack is empty, this should never happen");
|
|
360
418
|
const selfTime = duration - currentExecution.subImportTime;
|
|
361
419
|
if (this.executionStack.length > 0) this.executionStack.at(-1).subImportTime += duration;
|
|
@@ -374,9 +432,10 @@ class ViteNodeRunner {
|
|
|
374
432
|
* This function mostly for the ability to override by subclass
|
|
375
433
|
*/
|
|
376
434
|
shouldInterop(path, mod) {
|
|
435
|
+
if (this.options.interopDefault === false) return false;
|
|
377
436
|
// never interop ESM modules
|
|
378
437
|
// TODO: should also skip for `.js` with `type="module"`
|
|
379
|
-
return
|
|
438
|
+
return !path.endsWith(".mjs") && "default" in mod;
|
|
380
439
|
}
|
|
381
440
|
importExternalModule(path) {
|
|
382
441
|
return import(
|
|
@@ -393,10 +452,12 @@ class ViteNodeRunner {
|
|
|
393
452
|
const { mod, defaultExport } = interopModule(importedModule);
|
|
394
453
|
return new Proxy(mod, {
|
|
395
454
|
get(mod, prop) {
|
|
396
|
-
|
|
455
|
+
if (prop === "default") return defaultExport;
|
|
456
|
+
return mod[prop] ?? (defaultExport === null || defaultExport === void 0 ? void 0 : defaultExport[prop]);
|
|
397
457
|
},
|
|
398
458
|
has(mod, prop) {
|
|
399
|
-
|
|
459
|
+
if (prop === "default") return defaultExport !== void 0;
|
|
460
|
+
return prop in mod || defaultExport && prop in defaultExport;
|
|
400
461
|
},
|
|
401
462
|
getOwnPropertyDescriptor(mod, prop) {
|
|
402
463
|
const descriptor = Reflect.getOwnPropertyDescriptor(mod, prop);
|
|
@@ -417,7 +478,8 @@ function interopModule(mod) {
|
|
|
417
478
|
};
|
|
418
479
|
let defaultExport = "default" in mod ? mod.default : mod;
|
|
419
480
|
if (!isPrimitive(defaultExport) && "__esModule" in defaultExport) {
|
|
420
|
-
|
|
481
|
+
mod = defaultExport;
|
|
482
|
+
if ("default" in defaultExport) defaultExport = defaultExport.default;
|
|
421
483
|
}
|
|
422
484
|
return {
|
|
423
485
|
mod,
|
|
@@ -433,11 +495,13 @@ function defineExport(exports, key, value) {
|
|
|
433
495
|
});
|
|
434
496
|
}
|
|
435
497
|
function exportAll(exports, sourceModule) {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
498
|
+
// #1120 when a module exports itself it causes
|
|
499
|
+
// call stack error
|
|
500
|
+
if (exports === sourceModule) return;
|
|
501
|
+
if (isPrimitive(sourceModule) || Array.isArray(sourceModule) || sourceModule instanceof Promise) return;
|
|
502
|
+
for (const key in sourceModule) if (key !== "default" && !(key in exports)) try {
|
|
503
|
+
defineExport(exports, key, () => sourceModule[key]);
|
|
504
|
+
} catch {}
|
|
441
505
|
}
|
|
442
506
|
|
|
443
507
|
export { DEFAULT_REQUEST_STUBS, ModuleCacheMap, ViteNodeRunner };
|
package/dist/hmr.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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.d-
|
|
3
|
+
import { C as CustomEventMap, a as ViteNodeRunner, H as HMRPayload$1, b as HotContext } from './index.d-D6Pqey3g.js';
|
|
4
4
|
import './trace-mapping.d-BWFx6tPc.js';
|
|
5
5
|
|
|
6
6
|
type EventType = string | symbol;
|
|
@@ -21,8 +21,6 @@ declare module "vite" {
|
|
|
21
21
|
declare function createHmrEmitter(): HMREmitter;
|
|
22
22
|
declare function viteNodeHmrPlugin(): Plugin;
|
|
23
23
|
|
|
24
|
-
/* eslint-disable no-console */
|
|
25
|
-
|
|
26
24
|
type ModuleNamespace = Record<string, any> & {
|
|
27
25
|
[Symbol.toStringTag]: "Module";
|
|
28
26
|
};
|
|
@@ -32,7 +30,6 @@ interface HotModule {
|
|
|
32
30
|
callbacks: HotCallback[];
|
|
33
31
|
}
|
|
34
32
|
interface HotCallback {
|
|
35
|
-
// the dependencies must be fetchable paths
|
|
36
33
|
deps: string[];
|
|
37
34
|
fn: (modules: (ModuleNamespace | undefined)[]) => void;
|
|
38
35
|
}
|
package/dist/{hmr.mjs → hmr.js}
RENAMED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { c as createHmrEmitter, a as createHotContext, g as getCache, h as handleMessage, r as reload, s as sendMessageBuffer, v as viteNodeHmrPlugin } from './chunk-hmr.
|
|
1
|
+
export { c as createHmrEmitter, a as createHotContext, g as getCache, h as handleMessage, r as reload, s as sendMessageBuffer, v as viteNodeHmrPlugin } from './chunk-hmr.js';
|
|
2
2
|
import 'node:events';
|
|
3
|
+
import 'node:process';
|
|
3
4
|
import 'debug';
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './utils.
|
|
5
|
+
import './chunk-index.js';
|
|
6
|
+
import './utils.js';
|
|
6
7
|
import 'node:fs';
|
|
7
8
|
import 'node:module';
|
|
8
9
|
import 'node:url';
|
|
@@ -76,6 +76,7 @@ interface ErrorPayload {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
interface CustomEventMap {
|
|
79
|
+
// client events
|
|
79
80
|
'vite:beforeUpdate': UpdatePayload
|
|
80
81
|
'vite:afterUpdate': UpdatePayload
|
|
81
82
|
'vite:beforePrune': PrunePayload
|
|
@@ -84,6 +85,10 @@ interface CustomEventMap {
|
|
|
84
85
|
'vite:invalidate': InvalidatePayload
|
|
85
86
|
'vite:ws:connect': WebSocketConnectionPayload
|
|
86
87
|
'vite:ws:disconnect': WebSocketConnectionPayload
|
|
88
|
+
|
|
89
|
+
// server events
|
|
90
|
+
'vite:client:connect': undefined
|
|
91
|
+
'vite:client:disconnect': undefined
|
|
87
92
|
}
|
|
88
93
|
|
|
89
94
|
interface WebSocketConnectionPayload {
|
|
@@ -213,7 +218,6 @@ declare class ViteNodeRunner {
|
|
|
213
218
|
* As top-level awaits with dynamic imports like this are uncommon, we don't handle this case specifically.
|
|
214
219
|
*/
|
|
215
220
|
private executionStack;
|
|
216
|
-
// `performance` can be mocked, so make sure we're using the original function
|
|
217
221
|
private performanceNow;
|
|
218
222
|
constructor(options: ViteNodeRunnerOptions);
|
|
219
223
|
executeFile(file: string): Promise<any>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as Arrayable, h as Awaitable, k as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, i as FetchFunction, F as FetchResult, b as HotContext, l as ModuleCache, M as ModuleCacheMap, f as ModuleExecutionInfo, N as Nullable, R as RawSourceMap, j as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, n as ViteNodeResolveModule, m as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index.d-
|
|
1
|
+
export { A as Arrayable, h as Awaitable, k as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, i as FetchFunction, F as FetchResult, b as HotContext, l as ModuleCache, M as ModuleCacheMap, f as ModuleExecutionInfo, N as Nullable, R as RawSourceMap, j as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, n as ViteNodeResolveModule, m as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index.d-D6Pqey3g.js';
|
|
2
2
|
export { D as DecodedSourceMap, E as EncodedSourceMap, S as SourceMapInput } from './trace-mapping.d-BWFx6tPc.js';
|
package/dist/server.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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.d-
|
|
2
|
+
import { D as DebuggerOptions, c as DepsHandlingOptions, V as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId } from './index.d-D6Pqey3g.js';
|
|
3
3
|
import { E as EncodedSourceMap } from './trace-mapping.d-BWFx6tPc.js';
|
|
4
4
|
|
|
5
5
|
declare class Debugger {
|
|
6
|
-
options:
|
|
6
|
+
options: DebuggerOptions;
|
|
7
7
|
dumpDir: string | undefined;
|
|
8
8
|
initPromise: Promise<void> | undefined;
|
|
9
9
|
externalizeMap: Map<string, string>;
|