vite-node 3.0.0 → 3.0.1
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/dist/chunk-browser.cjs +4 -4
- package/dist/chunk-browser.mjs +4 -4
- package/dist/chunk-hmr.cjs +3 -3
- package/dist/chunk-hmr.mjs +3 -3
- package/dist/cli.cjs +9 -9
- package/dist/cli.mjs +11 -11
- package/dist/client.cjs +10 -10
- package/dist/client.mjs +10 -10
- package/dist/server.cjs +25 -25
- package/dist/server.mjs +25 -25
- package/dist/source-map.cjs +8 -8
- package/dist/source-map.mjs +8 -8
- package/dist/utils.cjs +4 -4
- package/dist/utils.mjs +4 -4
- package/package.json +3 -3
package/dist/chunk-browser.cjs
CHANGED
|
@@ -49,11 +49,11 @@ function a(n) {
|
|
|
49
49
|
}
|
|
50
50
|
a.open = "";
|
|
51
51
|
a.close = "";
|
|
52
|
-
function C(n =
|
|
53
|
-
let e = typeof process != "undefined" ? process :
|
|
54
|
-
return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ?
|
|
52
|
+
function C(n = false) {
|
|
53
|
+
let e = typeof process != "undefined" ? process : undefined, i = (e == null ? undefined : e.env) || {}, g = (e == null ? undefined : e.argv) || [];
|
|
54
|
+
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;
|
|
55
55
|
}
|
|
56
|
-
function p(n =
|
|
56
|
+
function p(n = false) {
|
|
57
57
|
let e = C(n), i = (r, t, c, o) => {
|
|
58
58
|
let l = "", s = 0;
|
|
59
59
|
do
|
package/dist/chunk-browser.mjs
CHANGED
|
@@ -47,11 +47,11 @@ function a(n) {
|
|
|
47
47
|
}
|
|
48
48
|
a.open = "";
|
|
49
49
|
a.close = "";
|
|
50
|
-
function C(n =
|
|
51
|
-
let e = typeof process != "undefined" ? process :
|
|
52
|
-
return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ?
|
|
50
|
+
function C(n = false) {
|
|
51
|
+
let e = typeof process != "undefined" ? process : undefined, i = (e == null ? undefined : e.env) || {}, g = (e == null ? undefined : e.argv) || [];
|
|
52
|
+
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;
|
|
53
53
|
}
|
|
54
|
-
function p(n =
|
|
54
|
+
function p(n = false) {
|
|
55
55
|
let e = C(n), i = (r, t, c, o) => {
|
|
56
56
|
let l = "", s = 0;
|
|
57
57
|
do
|
package/dist/chunk-hmr.cjs
CHANGED
|
@@ -111,7 +111,7 @@ async function fetchUpdate(runner, { path, acceptedPath }) {
|
|
|
111
111
|
}
|
|
112
112
|
return () => {
|
|
113
113
|
for (const { deps, fn } of qualifiedCallbacks) {
|
|
114
|
-
fn(deps.map((dep) => dep === acceptedPath ? fetchedModule :
|
|
114
|
+
fn(deps.map((dep) => dep === acceptedPath ? fetchedModule : undefined));
|
|
115
115
|
}
|
|
116
116
|
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
|
|
117
117
|
console.log(`${browser.s.cyan("[vite-node]")} hot updated: ${loggedPath}`);
|
|
@@ -224,7 +224,7 @@ function createHotContext(runner, emitter, files, ownerPath) {
|
|
|
224
224
|
invalidate() {
|
|
225
225
|
notifyListeners(runner, "vite:invalidate", {
|
|
226
226
|
path: ownerPath,
|
|
227
|
-
message:
|
|
227
|
+
message: undefined
|
|
228
228
|
});
|
|
229
229
|
return reload(runner, files);
|
|
230
230
|
},
|
|
@@ -240,7 +240,7 @@ function createHotContext(runner, emitter, files, ownerPath) {
|
|
|
240
240
|
off(event, cb) {
|
|
241
241
|
const removeFromMap = (map) => {
|
|
242
242
|
const existing = map.get(event);
|
|
243
|
-
if (existing ===
|
|
243
|
+
if (existing === undefined) {
|
|
244
244
|
return;
|
|
245
245
|
}
|
|
246
246
|
const pruned = existing.filter((l) => l !== cb);
|
package/dist/chunk-hmr.mjs
CHANGED
|
@@ -109,7 +109,7 @@ async function fetchUpdate(runner, { path, acceptedPath }) {
|
|
|
109
109
|
}
|
|
110
110
|
return () => {
|
|
111
111
|
for (const { deps, fn } of qualifiedCallbacks) {
|
|
112
|
-
fn(deps.map((dep) => dep === acceptedPath ? fetchedModule :
|
|
112
|
+
fn(deps.map((dep) => dep === acceptedPath ? fetchedModule : undefined));
|
|
113
113
|
}
|
|
114
114
|
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
|
|
115
115
|
console.log(`${s.cyan("[vite-node]")} hot updated: ${loggedPath}`);
|
|
@@ -222,7 +222,7 @@ function createHotContext(runner, emitter, files, ownerPath) {
|
|
|
222
222
|
invalidate() {
|
|
223
223
|
notifyListeners(runner, "vite:invalidate", {
|
|
224
224
|
path: ownerPath,
|
|
225
|
-
message:
|
|
225
|
+
message: undefined
|
|
226
226
|
});
|
|
227
227
|
return reload(runner, files);
|
|
228
228
|
},
|
|
@@ -238,7 +238,7 @@ function createHotContext(runner, emitter, files, ownerPath) {
|
|
|
238
238
|
off(event, cb) {
|
|
239
239
|
const removeFromMap = (map) => {
|
|
240
240
|
const existing = map.get(event);
|
|
241
|
-
if (existing ===
|
|
241
|
+
if (existing === undefined) {
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
const pruned = existing.filter((l) => l !== cb);
|
package/dist/cli.cjs
CHANGED
|
@@ -21,7 +21,7 @@ require('es-module-lexer');
|
|
|
21
21
|
require('./constants.cjs');
|
|
22
22
|
require('node:events');
|
|
23
23
|
|
|
24
|
-
var version = "3.0.
|
|
24
|
+
var version = "3.0.1";
|
|
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");
|
|
@@ -70,7 +70,7 @@ async function run(files, options = {}) {
|
|
|
70
70
|
mode: options.mode,
|
|
71
71
|
server: {
|
|
72
72
|
hmr: !!options.watch,
|
|
73
|
-
watch: options.watch ?
|
|
73
|
+
watch: options.watch ? undefined : null
|
|
74
74
|
},
|
|
75
75
|
plugins: [options.watch && hmr.viteNodeHmrPlugin()]
|
|
76
76
|
});
|
|
@@ -103,7 +103,7 @@ async function run(files, options = {}) {
|
|
|
103
103
|
if (!options.watch) {
|
|
104
104
|
await server$1.close();
|
|
105
105
|
}
|
|
106
|
-
(_b = server$1.emitter) == null ?
|
|
106
|
+
(_b = server$1.emitter) == null ? undefined : _b.on("message", (payload) => {
|
|
107
107
|
hmr.handleMessage(runner, server$1.emitter, files, payload);
|
|
108
108
|
});
|
|
109
109
|
if (options.watch) {
|
|
@@ -114,26 +114,26 @@ async function run(files, options = {}) {
|
|
|
114
114
|
}
|
|
115
115
|
function parseServerOptions(serverOptions) {
|
|
116
116
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
117
|
-
const inlineOptions = ((_a = serverOptions.deps) == null ?
|
|
117
|
+
const inlineOptions = ((_a = serverOptions.deps) == null ? undefined : _a.inline) === true ? true : utils.toArray((_b = serverOptions.deps) == null ? undefined : _b.inline);
|
|
118
118
|
return {
|
|
119
119
|
...serverOptions,
|
|
120
120
|
deps: {
|
|
121
121
|
...serverOptions.deps,
|
|
122
|
-
inlineFiles: utils.toArray((_c = serverOptions.deps) == null ?
|
|
122
|
+
inlineFiles: utils.toArray((_c = serverOptions.deps) == null ? undefined : _c.inlineFiles),
|
|
123
123
|
inline: inlineOptions !== true ? inlineOptions.map((dep) => {
|
|
124
124
|
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
125
125
|
}) : true,
|
|
126
|
-
external: utils.toArray((_d = serverOptions.deps) == null ?
|
|
126
|
+
external: utils.toArray((_d = serverOptions.deps) == null ? undefined : _d.external).map((dep) => {
|
|
127
127
|
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
128
128
|
}),
|
|
129
|
-
moduleDirectories: ((_e = serverOptions.deps) == null ?
|
|
129
|
+
moduleDirectories: ((_e = serverOptions.deps) == null ? undefined : _e.moduleDirectories) ? utils.toArray((_f = serverOptions.deps) == null ? undefined : _f.moduleDirectories) : undefined
|
|
130
130
|
},
|
|
131
131
|
transformMode: {
|
|
132
132
|
...serverOptions.transformMode,
|
|
133
|
-
ssr: utils.toArray((_g = serverOptions.transformMode) == null ?
|
|
133
|
+
ssr: utils.toArray((_g = serverOptions.transformMode) == null ? undefined : _g.ssr).map(
|
|
134
134
|
(dep) => new RegExp(dep)
|
|
135
135
|
),
|
|
136
|
-
web: utils.toArray((_h = serverOptions.transformMode) == null ?
|
|
136
|
+
web: utils.toArray((_h = serverOptions.transformMode) == null ? undefined : _h.web).map(
|
|
137
137
|
(dep) => new RegExp(dep)
|
|
138
138
|
)
|
|
139
139
|
}
|
package/dist/cli.mjs
CHANGED
|
@@ -3,23 +3,23 @@ import cac from 'cac';
|
|
|
3
3
|
import { s } from './chunk-browser.mjs';
|
|
4
4
|
import { createServer, loadEnv } from 'vite';
|
|
5
5
|
import { ViteNodeRunner } from './client.mjs';
|
|
6
|
-
import { v as viteNodeHmrPlugin, a as createHotContext, h as handleMessage } from './chunk-hmr.mjs';
|
|
7
6
|
import { ViteNodeServer } from './server.mjs';
|
|
8
7
|
import { installSourcemapsSupport } from './source-map.mjs';
|
|
9
8
|
import { toArray } from './utils.mjs';
|
|
9
|
+
import { v as viteNodeHmrPlugin, a as createHotContext, h as handleMessage } from './chunk-hmr.mjs';
|
|
10
10
|
import 'node:module';
|
|
11
11
|
import 'node:url';
|
|
12
12
|
import 'node:vm';
|
|
13
13
|
import 'debug';
|
|
14
14
|
import 'pathe';
|
|
15
15
|
import 'node:fs';
|
|
16
|
-
import 'node:events';
|
|
17
16
|
import 'node:assert';
|
|
18
17
|
import 'node:perf_hooks';
|
|
19
18
|
import 'es-module-lexer';
|
|
20
19
|
import './constants.mjs';
|
|
20
|
+
import 'node:events';
|
|
21
21
|
|
|
22
|
-
var version = "3.0.
|
|
22
|
+
var version = "3.0.1";
|
|
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");
|
|
@@ -68,7 +68,7 @@ async function run(files, options = {}) {
|
|
|
68
68
|
mode: options.mode,
|
|
69
69
|
server: {
|
|
70
70
|
hmr: !!options.watch,
|
|
71
|
-
watch: options.watch ?
|
|
71
|
+
watch: options.watch ? undefined : null
|
|
72
72
|
},
|
|
73
73
|
plugins: [options.watch && viteNodeHmrPlugin()]
|
|
74
74
|
});
|
|
@@ -101,7 +101,7 @@ async function run(files, options = {}) {
|
|
|
101
101
|
if (!options.watch) {
|
|
102
102
|
await server.close();
|
|
103
103
|
}
|
|
104
|
-
(_b = server.emitter) == null ?
|
|
104
|
+
(_b = server.emitter) == null ? undefined : _b.on("message", (payload) => {
|
|
105
105
|
handleMessage(runner, server.emitter, files, payload);
|
|
106
106
|
});
|
|
107
107
|
if (options.watch) {
|
|
@@ -112,26 +112,26 @@ async function run(files, options = {}) {
|
|
|
112
112
|
}
|
|
113
113
|
function parseServerOptions(serverOptions) {
|
|
114
114
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
115
|
-
const inlineOptions = ((_a = serverOptions.deps) == null ?
|
|
115
|
+
const inlineOptions = ((_a = serverOptions.deps) == null ? undefined : _a.inline) === true ? true : toArray((_b = serverOptions.deps) == null ? undefined : _b.inline);
|
|
116
116
|
return {
|
|
117
117
|
...serverOptions,
|
|
118
118
|
deps: {
|
|
119
119
|
...serverOptions.deps,
|
|
120
|
-
inlineFiles: toArray((_c = serverOptions.deps) == null ?
|
|
120
|
+
inlineFiles: toArray((_c = serverOptions.deps) == null ? undefined : _c.inlineFiles),
|
|
121
121
|
inline: inlineOptions !== true ? inlineOptions.map((dep) => {
|
|
122
122
|
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
123
123
|
}) : true,
|
|
124
|
-
external: toArray((_d = serverOptions.deps) == null ?
|
|
124
|
+
external: toArray((_d = serverOptions.deps) == null ? undefined : _d.external).map((dep) => {
|
|
125
125
|
return dep.startsWith("/") && dep.endsWith("/") ? new RegExp(dep) : dep;
|
|
126
126
|
}),
|
|
127
|
-
moduleDirectories: ((_e = serverOptions.deps) == null ?
|
|
127
|
+
moduleDirectories: ((_e = serverOptions.deps) == null ? undefined : _e.moduleDirectories) ? toArray((_f = serverOptions.deps) == null ? undefined : _f.moduleDirectories) : undefined
|
|
128
128
|
},
|
|
129
129
|
transformMode: {
|
|
130
130
|
...serverOptions.transformMode,
|
|
131
|
-
ssr: toArray((_g = serverOptions.transformMode) == null ?
|
|
131
|
+
ssr: toArray((_g = serverOptions.transformMode) == null ? undefined : _g.ssr).map(
|
|
132
132
|
(dep) => new RegExp(dep)
|
|
133
133
|
),
|
|
134
|
-
web: toArray((_h = serverOptions.transformMode) == null ?
|
|
134
|
+
web: toArray((_h = serverOptions.transformMode) == null ? undefined : _h.web).map(
|
|
135
135
|
(dep) => new RegExp(dep)
|
|
136
136
|
)
|
|
137
137
|
}
|
package/dist/client.cjs
CHANGED
|
@@ -93,8 +93,8 @@ class ModuleCacheMap extends Map {
|
|
|
93
93
|
delete mod.resolving;
|
|
94
94
|
delete mod.promise;
|
|
95
95
|
delete mod.exports;
|
|
96
|
-
(_a = mod.importers) == null ?
|
|
97
|
-
(_b = mod.imports) == null ?
|
|
96
|
+
(_a = mod.importers) == null ? undefined : _a.clear();
|
|
97
|
+
(_b = mod.imports) == null ? undefined : _b.clear();
|
|
98
98
|
return true;
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
@@ -108,7 +108,7 @@ class ModuleCacheMap extends Map {
|
|
|
108
108
|
}
|
|
109
109
|
invalidated.add(id);
|
|
110
110
|
const mod = super.get(id);
|
|
111
|
-
if (mod == null ?
|
|
111
|
+
if (mod == null ? undefined : mod.importers) {
|
|
112
112
|
this.invalidateDepTree(mod.importers, invalidated);
|
|
113
113
|
}
|
|
114
114
|
super.delete(id);
|
|
@@ -127,7 +127,7 @@ class ModuleCacheMap extends Map {
|
|
|
127
127
|
invalidated.add(id);
|
|
128
128
|
const subIds = Array.from(super.entries()).filter(([, mod]) => {
|
|
129
129
|
var _a;
|
|
130
|
-
return (_a = mod.importers) == null ?
|
|
130
|
+
return (_a = mod.importers) == null ? undefined : _a.has(id);
|
|
131
131
|
}).map(([key]) => key);
|
|
132
132
|
if (subIds.length) {
|
|
133
133
|
this.invalidateSubDepTree(subIds, invalidated);
|
|
@@ -227,7 +227,7 @@ ${getStack()}`
|
|
|
227
227
|
return [dep, path];
|
|
228
228
|
}
|
|
229
229
|
const resolved = await this.options.resolveId(dep, importer);
|
|
230
|
-
if ((_b = (_a = resolved == null ?
|
|
230
|
+
if ((_b = (_a = resolved == null ? undefined : resolved.meta) == null ? undefined : _a["vite:alias"]) == null ? undefined : _b.noResolved) {
|
|
231
231
|
const error = new Error(
|
|
232
232
|
`Cannot find module '${id}'${importer ? ` imported from '${importer}'` : ""}.
|
|
233
233
|
|
|
@@ -325,7 +325,7 @@ ${getStack()}`
|
|
|
325
325
|
exports.default = {};
|
|
326
326
|
}
|
|
327
327
|
if (moduleExports !== SYMBOL_NOT_DEFINED && utils.isPrimitive(moduleExports)) {
|
|
328
|
-
defineExport(exports, p, () =>
|
|
328
|
+
defineExport(exports, p, () => undefined);
|
|
329
329
|
return true;
|
|
330
330
|
}
|
|
331
331
|
if (!utils.isPrimitive(exports.default)) {
|
|
@@ -354,7 +354,7 @@ ${getStack()}`
|
|
|
354
354
|
enumerable: true,
|
|
355
355
|
get: () => {
|
|
356
356
|
var _a, _b;
|
|
357
|
-
hotContext || (hotContext = (_b = (_a = this.options).createHotContext) == null ?
|
|
357
|
+
hotContext || (hotContext = (_b = (_a = this.options).createHotContext) == null ? undefined : _b.call(_a, this, moduleId));
|
|
358
358
|
return hotContext;
|
|
359
359
|
},
|
|
360
360
|
set: (value) => {
|
|
@@ -430,11 +430,11 @@ ${getStack()}`
|
|
|
430
430
|
if (prop === "default") {
|
|
431
431
|
return defaultExport;
|
|
432
432
|
}
|
|
433
|
-
return mod2[prop] ?? (defaultExport == null ?
|
|
433
|
+
return mod2[prop] ?? (defaultExport == null ? undefined : defaultExport[prop]);
|
|
434
434
|
},
|
|
435
435
|
has(mod2, prop) {
|
|
436
436
|
if (prop === "default") {
|
|
437
|
-
return defaultExport !==
|
|
437
|
+
return defaultExport !== undefined;
|
|
438
438
|
}
|
|
439
439
|
return prop in mod2 || defaultExport && prop in defaultExport;
|
|
440
440
|
},
|
|
@@ -443,7 +443,7 @@ ${getStack()}`
|
|
|
443
443
|
if (descriptor) {
|
|
444
444
|
return descriptor;
|
|
445
445
|
}
|
|
446
|
-
if (prop === "default" && defaultExport !==
|
|
446
|
+
if (prop === "default" && defaultExport !== undefined) {
|
|
447
447
|
return {
|
|
448
448
|
value: defaultExport,
|
|
449
449
|
enumerable: true,
|
package/dist/client.mjs
CHANGED
|
@@ -91,8 +91,8 @@ class ModuleCacheMap extends Map {
|
|
|
91
91
|
delete mod.resolving;
|
|
92
92
|
delete mod.promise;
|
|
93
93
|
delete mod.exports;
|
|
94
|
-
(_a = mod.importers) == null ?
|
|
95
|
-
(_b = mod.imports) == null ?
|
|
94
|
+
(_a = mod.importers) == null ? undefined : _a.clear();
|
|
95
|
+
(_b = mod.imports) == null ? undefined : _b.clear();
|
|
96
96
|
return true;
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
@@ -106,7 +106,7 @@ class ModuleCacheMap extends Map {
|
|
|
106
106
|
}
|
|
107
107
|
invalidated.add(id);
|
|
108
108
|
const mod = super.get(id);
|
|
109
|
-
if (mod == null ?
|
|
109
|
+
if (mod == null ? undefined : mod.importers) {
|
|
110
110
|
this.invalidateDepTree(mod.importers, invalidated);
|
|
111
111
|
}
|
|
112
112
|
super.delete(id);
|
|
@@ -125,7 +125,7 @@ class ModuleCacheMap extends Map {
|
|
|
125
125
|
invalidated.add(id);
|
|
126
126
|
const subIds = Array.from(super.entries()).filter(([, mod]) => {
|
|
127
127
|
var _a;
|
|
128
|
-
return (_a = mod.importers) == null ?
|
|
128
|
+
return (_a = mod.importers) == null ? undefined : _a.has(id);
|
|
129
129
|
}).map(([key]) => key);
|
|
130
130
|
if (subIds.length) {
|
|
131
131
|
this.invalidateSubDepTree(subIds, invalidated);
|
|
@@ -225,7 +225,7 @@ ${getStack()}`
|
|
|
225
225
|
return [dep, path];
|
|
226
226
|
}
|
|
227
227
|
const resolved = await this.options.resolveId(dep, importer);
|
|
228
|
-
if ((_b = (_a = resolved == null ?
|
|
228
|
+
if ((_b = (_a = resolved == null ? undefined : resolved.meta) == null ? undefined : _a["vite:alias"]) == null ? undefined : _b.noResolved) {
|
|
229
229
|
const error = new Error(
|
|
230
230
|
`Cannot find module '${id}'${importer ? ` imported from '${importer}'` : ""}.
|
|
231
231
|
|
|
@@ -323,7 +323,7 @@ ${getStack()}`
|
|
|
323
323
|
exports.default = {};
|
|
324
324
|
}
|
|
325
325
|
if (moduleExports !== SYMBOL_NOT_DEFINED && isPrimitive(moduleExports)) {
|
|
326
|
-
defineExport(exports, p, () =>
|
|
326
|
+
defineExport(exports, p, () => undefined);
|
|
327
327
|
return true;
|
|
328
328
|
}
|
|
329
329
|
if (!isPrimitive(exports.default)) {
|
|
@@ -352,7 +352,7 @@ ${getStack()}`
|
|
|
352
352
|
enumerable: true,
|
|
353
353
|
get: () => {
|
|
354
354
|
var _a, _b;
|
|
355
|
-
hotContext || (hotContext = (_b = (_a = this.options).createHotContext) == null ?
|
|
355
|
+
hotContext || (hotContext = (_b = (_a = this.options).createHotContext) == null ? undefined : _b.call(_a, this, moduleId));
|
|
356
356
|
return hotContext;
|
|
357
357
|
},
|
|
358
358
|
set: (value) => {
|
|
@@ -428,11 +428,11 @@ ${getStack()}`
|
|
|
428
428
|
if (prop === "default") {
|
|
429
429
|
return defaultExport;
|
|
430
430
|
}
|
|
431
|
-
return mod2[prop] ?? (defaultExport == null ?
|
|
431
|
+
return mod2[prop] ?? (defaultExport == null ? undefined : defaultExport[prop]);
|
|
432
432
|
},
|
|
433
433
|
has(mod2, prop) {
|
|
434
434
|
if (prop === "default") {
|
|
435
|
-
return defaultExport !==
|
|
435
|
+
return defaultExport !== undefined;
|
|
436
436
|
}
|
|
437
437
|
return prop in mod2 || defaultExport && prop in defaultExport;
|
|
438
438
|
},
|
|
@@ -441,7 +441,7 @@ ${getStack()}`
|
|
|
441
441
|
if (descriptor) {
|
|
442
442
|
return descriptor;
|
|
443
443
|
}
|
|
444
|
-
if (prop === "default" && defaultExport !==
|
|
444
|
+
if (prop === "default" && defaultExport !== undefined) {
|
|
445
445
|
return {
|
|
446
446
|
value: defaultExport,
|
|
447
447
|
enumerable: true,
|
package/dist/server.cjs
CHANGED
|
@@ -111,7 +111,7 @@ ${result.code}`,
|
|
|
111
111
|
const code = await fs.promises.readFile(path, "utf-8");
|
|
112
112
|
return {
|
|
113
113
|
code: code.replace(/^\/\/.*\n/, ""),
|
|
114
|
-
map:
|
|
114
|
+
map: undefined
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
117
|
async writeInfo() {
|
|
@@ -211,21 +211,21 @@ async function _shouldExternalize(id, options) {
|
|
|
211
211
|
return id;
|
|
212
212
|
}
|
|
213
213
|
id = patchWindowsImportPath(id);
|
|
214
|
-
const moduleDirectories = (options == null ?
|
|
215
|
-
if (matchExternalizePattern(id, moduleDirectories, options == null ?
|
|
214
|
+
const moduleDirectories = (options == null ? undefined : options.moduleDirectories) || ["/node_modules/"];
|
|
215
|
+
if (matchExternalizePattern(id, moduleDirectories, options == null ? undefined : options.inline)) {
|
|
216
216
|
return false;
|
|
217
217
|
}
|
|
218
|
-
if ((options == null ?
|
|
218
|
+
if ((options == null ? undefined : options.inlineFiles) && (options == null ? undefined : options.inlineFiles.includes(id))) {
|
|
219
219
|
return false;
|
|
220
220
|
}
|
|
221
|
-
if (matchExternalizePattern(id, moduleDirectories, options == null ?
|
|
221
|
+
if (matchExternalizePattern(id, moduleDirectories, options == null ? undefined : options.external)) {
|
|
222
222
|
return id;
|
|
223
223
|
}
|
|
224
|
-
if ((options == null ?
|
|
224
|
+
if ((options == null ? undefined : options.cacheDir) && id.includes(options.cacheDir)) {
|
|
225
225
|
return id;
|
|
226
226
|
}
|
|
227
227
|
const isLibraryModule = moduleDirectories.some((dir) => id.includes(dir));
|
|
228
|
-
const guessCJS = isLibraryModule && (options == null ?
|
|
228
|
+
const guessCJS = isLibraryModule && (options == null ? undefined : options.fallbackCJS);
|
|
229
229
|
id = guessCJS ? guessCJSversion(id) || id : id;
|
|
230
230
|
if (matchExternalizePattern(id, moduleDirectories, defaultInline)) {
|
|
231
231
|
return false;
|
|
@@ -316,7 +316,7 @@ class ViteNodeServer {
|
|
|
316
316
|
}
|
|
317
317
|
(_c = options.deps).moduleDirectories ?? (_c.moduleDirectories = []);
|
|
318
318
|
const envValue = process.env.VITE_NODE_DEPS_MODULE_DIRECTORIES || process.env.npm_config_VITE_NODE_DEPS_MODULE_DIRECTORIES;
|
|
319
|
-
const customModuleDirectories = envValue == null ?
|
|
319
|
+
const customModuleDirectories = envValue == null ? undefined : envValue.split(",");
|
|
320
320
|
if (customModuleDirectories) {
|
|
321
321
|
options.deps.moduleDirectories.push(...customModuleDirectories);
|
|
322
322
|
}
|
|
@@ -391,12 +391,12 @@ class ViteNodeServer {
|
|
|
391
391
|
getSourceMap(source) {
|
|
392
392
|
var _a, _b;
|
|
393
393
|
source = utils.normalizeModuleId(source);
|
|
394
|
-
const fetchResult = (_a = this.fetchCache.get(source)) == null ?
|
|
395
|
-
if (fetchResult == null ?
|
|
394
|
+
const fetchResult = (_a = this.fetchCache.get(source)) == null ? undefined : _a.result;
|
|
395
|
+
if (fetchResult == null ? undefined : fetchResult.map) {
|
|
396
396
|
return fetchResult.map;
|
|
397
397
|
}
|
|
398
|
-
const ssrTransformResult = (_b = this.server.moduleGraph.getModuleById(source)) == null ?
|
|
399
|
-
return (ssrTransformResult == null ?
|
|
398
|
+
const ssrTransformResult = (_b = this.server.moduleGraph.getModuleById(source)) == null ? undefined : _b.ssrTransformResult;
|
|
399
|
+
return (ssrTransformResult == null ? undefined : ssrTransformResult.map) || null;
|
|
400
400
|
}
|
|
401
401
|
assertMode(mode) {
|
|
402
402
|
assert(
|
|
@@ -407,7 +407,7 @@ class ViteNodeServer {
|
|
|
407
407
|
async fetchModule(id, transformMode) {
|
|
408
408
|
const mode = transformMode || this.getTransformMode(id);
|
|
409
409
|
return this.fetchResult(id, mode).then((r) => {
|
|
410
|
-
return this.options.sourcemap !== true ? { ...r, map:
|
|
410
|
+
return this.options.sourcemap !== true ? { ...r, map: undefined } : r;
|
|
411
411
|
});
|
|
412
412
|
}
|
|
413
413
|
async fetchResult(id, mode) {
|
|
@@ -446,18 +446,18 @@ class ViteNodeServer {
|
|
|
446
446
|
}
|
|
447
447
|
const normalizedId = utils.normalizeModuleId(id);
|
|
448
448
|
const mod = this.server.moduleGraph.getModuleById(normalizedId);
|
|
449
|
-
const result = (mod == null ?
|
|
449
|
+
const result = (mod == null ? undefined : mod.transformResult) || await this.server.transformRequest(normalizedId);
|
|
450
450
|
return {
|
|
451
|
-
code: result == null ?
|
|
451
|
+
code: result == null ? undefined : result.code
|
|
452
452
|
};
|
|
453
453
|
}
|
|
454
454
|
getTransformMode(id) {
|
|
455
455
|
var _a, _b, _c, _d;
|
|
456
456
|
const withoutQuery = id.split("?")[0];
|
|
457
|
-
if ((_b = (_a = this.options.transformMode) == null ?
|
|
457
|
+
if ((_b = (_a = this.options.transformMode) == null ? undefined : _a.web) == null ? undefined : _b.some((r) => withoutQuery.match(r))) {
|
|
458
458
|
return "web";
|
|
459
459
|
}
|
|
460
|
-
if ((_d = (_c = this.options.transformMode) == null ?
|
|
460
|
+
if ((_d = (_c = this.options.transformMode) == null ? undefined : _c.ssr) == null ? undefined : _d.some((r) => withoutQuery.match(r))) {
|
|
461
461
|
return "ssr";
|
|
462
462
|
}
|
|
463
463
|
if (withoutQuery.match(/\.([cm]?[jt]sx?|json)$/)) {
|
|
@@ -492,7 +492,7 @@ class ViteNodeServer {
|
|
|
492
492
|
async _fetchModule(id, transformMode) {
|
|
493
493
|
var _a, _b;
|
|
494
494
|
let result;
|
|
495
|
-
const cacheDir = (_a = this.options.deps) == null ?
|
|
495
|
+
const cacheDir = (_a = this.options.deps) == null ? undefined : _a.cacheDir;
|
|
496
496
|
if (cacheDir && id.includes(cacheDir)) {
|
|
497
497
|
if (!id.startsWith(utils.withTrailingSlash(this.server.config.root))) {
|
|
498
498
|
id = pathe.join(this.server.config.root, id);
|
|
@@ -520,12 +520,12 @@ class ViteNodeServer {
|
|
|
520
520
|
let duration;
|
|
521
521
|
if (externalize) {
|
|
522
522
|
result = { externalize };
|
|
523
|
-
(_b = this.debugger) == null ?
|
|
523
|
+
(_b = this.debugger) == null ? undefined : _b.recordExternalize(id, externalize);
|
|
524
524
|
} else {
|
|
525
525
|
const start = node_perf_hooks.performance.now();
|
|
526
526
|
const r = await this._transformRequest(id, filePath, transformMode);
|
|
527
527
|
duration = node_perf_hooks.performance.now() - start;
|
|
528
|
-
result = { code: r == null ?
|
|
528
|
+
result = { code: r == null ? undefined : r.code, map: r == null ? undefined : r.map };
|
|
529
529
|
}
|
|
530
530
|
const cacheEntry = {
|
|
531
531
|
duration,
|
|
@@ -541,7 +541,7 @@ class ViteNodeServer {
|
|
|
541
541
|
async processTransformResult(filepath, result) {
|
|
542
542
|
const mod = this.server.moduleGraph.getModuleById(filepath);
|
|
543
543
|
return sourceMap.withInlineSourcemap(result, {
|
|
544
|
-
filepath: (mod == null ?
|
|
544
|
+
filepath: (mod == null ? undefined : mod.file) || filepath,
|
|
545
545
|
root: this.server.config.root
|
|
546
546
|
});
|
|
547
547
|
}
|
|
@@ -549,8 +549,8 @@ class ViteNodeServer {
|
|
|
549
549
|
var _a, _b, _c, _d;
|
|
550
550
|
debugRequest(id);
|
|
551
551
|
let result = null;
|
|
552
|
-
if ((_a = this.options.debug) == null ?
|
|
553
|
-
result = await ((_b = this.debugger) == null ?
|
|
552
|
+
if ((_a = this.options.debug) == null ? undefined : _a.loadDumppedModules) {
|
|
553
|
+
result = await ((_b = this.debugger) == null ? undefined : _b.loadDump(id)) ?? null;
|
|
554
554
|
if (result) {
|
|
555
555
|
return result;
|
|
556
556
|
}
|
|
@@ -567,8 +567,8 @@ class ViteNodeServer {
|
|
|
567
567
|
if (sourcemap === "inline" && result && !id.includes("node_modules")) {
|
|
568
568
|
result = await this.processTransformResult(filepath, result);
|
|
569
569
|
}
|
|
570
|
-
if ((_c = this.options.debug) == null ?
|
|
571
|
-
await ((_d = this.debugger) == null ?
|
|
570
|
+
if ((_c = this.options.debug) == null ? undefined : _c.dumpModules) {
|
|
571
|
+
await ((_d = this.debugger) == null ? undefined : _d.dumpFile(id, result));
|
|
572
572
|
}
|
|
573
573
|
return result;
|
|
574
574
|
}
|
package/dist/server.mjs
CHANGED
|
@@ -90,7 +90,7 @@ ${result.code}`,
|
|
|
90
90
|
const code = await promises.readFile(path, "utf-8");
|
|
91
91
|
return {
|
|
92
92
|
code: code.replace(/^\/\/.*\n/, ""),
|
|
93
|
-
map:
|
|
93
|
+
map: undefined
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
96
|
async writeInfo() {
|
|
@@ -190,21 +190,21 @@ async function _shouldExternalize(id, options) {
|
|
|
190
190
|
return id;
|
|
191
191
|
}
|
|
192
192
|
id = patchWindowsImportPath(id);
|
|
193
|
-
const moduleDirectories = (options == null ?
|
|
194
|
-
if (matchExternalizePattern(id, moduleDirectories, options == null ?
|
|
193
|
+
const moduleDirectories = (options == null ? undefined : options.moduleDirectories) || ["/node_modules/"];
|
|
194
|
+
if (matchExternalizePattern(id, moduleDirectories, options == null ? undefined : options.inline)) {
|
|
195
195
|
return false;
|
|
196
196
|
}
|
|
197
|
-
if ((options == null ?
|
|
197
|
+
if ((options == null ? undefined : options.inlineFiles) && (options == null ? undefined : options.inlineFiles.includes(id))) {
|
|
198
198
|
return false;
|
|
199
199
|
}
|
|
200
|
-
if (matchExternalizePattern(id, moduleDirectories, options == null ?
|
|
200
|
+
if (matchExternalizePattern(id, moduleDirectories, options == null ? undefined : options.external)) {
|
|
201
201
|
return id;
|
|
202
202
|
}
|
|
203
|
-
if ((options == null ?
|
|
203
|
+
if ((options == null ? undefined : options.cacheDir) && id.includes(options.cacheDir)) {
|
|
204
204
|
return id;
|
|
205
205
|
}
|
|
206
206
|
const isLibraryModule = moduleDirectories.some((dir) => id.includes(dir));
|
|
207
|
-
const guessCJS = isLibraryModule && (options == null ?
|
|
207
|
+
const guessCJS = isLibraryModule && (options == null ? undefined : options.fallbackCJS);
|
|
208
208
|
id = guessCJS ? guessCJSversion(id) || id : id;
|
|
209
209
|
if (matchExternalizePattern(id, moduleDirectories, defaultInline)) {
|
|
210
210
|
return false;
|
|
@@ -295,7 +295,7 @@ class ViteNodeServer {
|
|
|
295
295
|
}
|
|
296
296
|
(_c = options.deps).moduleDirectories ?? (_c.moduleDirectories = []);
|
|
297
297
|
const envValue = process.env.VITE_NODE_DEPS_MODULE_DIRECTORIES || process.env.npm_config_VITE_NODE_DEPS_MODULE_DIRECTORIES;
|
|
298
|
-
const customModuleDirectories = envValue == null ?
|
|
298
|
+
const customModuleDirectories = envValue == null ? undefined : envValue.split(",");
|
|
299
299
|
if (customModuleDirectories) {
|
|
300
300
|
options.deps.moduleDirectories.push(...customModuleDirectories);
|
|
301
301
|
}
|
|
@@ -370,12 +370,12 @@ class ViteNodeServer {
|
|
|
370
370
|
getSourceMap(source) {
|
|
371
371
|
var _a, _b;
|
|
372
372
|
source = normalizeModuleId(source);
|
|
373
|
-
const fetchResult = (_a = this.fetchCache.get(source)) == null ?
|
|
374
|
-
if (fetchResult == null ?
|
|
373
|
+
const fetchResult = (_a = this.fetchCache.get(source)) == null ? undefined : _a.result;
|
|
374
|
+
if (fetchResult == null ? undefined : fetchResult.map) {
|
|
375
375
|
return fetchResult.map;
|
|
376
376
|
}
|
|
377
|
-
const ssrTransformResult = (_b = this.server.moduleGraph.getModuleById(source)) == null ?
|
|
378
|
-
return (ssrTransformResult == null ?
|
|
377
|
+
const ssrTransformResult = (_b = this.server.moduleGraph.getModuleById(source)) == null ? undefined : _b.ssrTransformResult;
|
|
378
|
+
return (ssrTransformResult == null ? undefined : ssrTransformResult.map) || null;
|
|
379
379
|
}
|
|
380
380
|
assertMode(mode) {
|
|
381
381
|
assert(
|
|
@@ -386,7 +386,7 @@ class ViteNodeServer {
|
|
|
386
386
|
async fetchModule(id, transformMode) {
|
|
387
387
|
const mode = transformMode || this.getTransformMode(id);
|
|
388
388
|
return this.fetchResult(id, mode).then((r) => {
|
|
389
|
-
return this.options.sourcemap !== true ? { ...r, map:
|
|
389
|
+
return this.options.sourcemap !== true ? { ...r, map: undefined } : r;
|
|
390
390
|
});
|
|
391
391
|
}
|
|
392
392
|
async fetchResult(id, mode) {
|
|
@@ -425,18 +425,18 @@ class ViteNodeServer {
|
|
|
425
425
|
}
|
|
426
426
|
const normalizedId = normalizeModuleId(id);
|
|
427
427
|
const mod = this.server.moduleGraph.getModuleById(normalizedId);
|
|
428
|
-
const result = (mod == null ?
|
|
428
|
+
const result = (mod == null ? undefined : mod.transformResult) || await this.server.transformRequest(normalizedId);
|
|
429
429
|
return {
|
|
430
|
-
code: result == null ?
|
|
430
|
+
code: result == null ? undefined : result.code
|
|
431
431
|
};
|
|
432
432
|
}
|
|
433
433
|
getTransformMode(id) {
|
|
434
434
|
var _a, _b, _c, _d;
|
|
435
435
|
const withoutQuery = id.split("?")[0];
|
|
436
|
-
if ((_b = (_a = this.options.transformMode) == null ?
|
|
436
|
+
if ((_b = (_a = this.options.transformMode) == null ? undefined : _a.web) == null ? undefined : _b.some((r) => withoutQuery.match(r))) {
|
|
437
437
|
return "web";
|
|
438
438
|
}
|
|
439
|
-
if ((_d = (_c = this.options.transformMode) == null ?
|
|
439
|
+
if ((_d = (_c = this.options.transformMode) == null ? undefined : _c.ssr) == null ? undefined : _d.some((r) => withoutQuery.match(r))) {
|
|
440
440
|
return "ssr";
|
|
441
441
|
}
|
|
442
442
|
if (withoutQuery.match(/\.([cm]?[jt]sx?|json)$/)) {
|
|
@@ -471,7 +471,7 @@ class ViteNodeServer {
|
|
|
471
471
|
async _fetchModule(id, transformMode) {
|
|
472
472
|
var _a, _b;
|
|
473
473
|
let result;
|
|
474
|
-
const cacheDir = (_a = this.options.deps) == null ?
|
|
474
|
+
const cacheDir = (_a = this.options.deps) == null ? undefined : _a.cacheDir;
|
|
475
475
|
if (cacheDir && id.includes(cacheDir)) {
|
|
476
476
|
if (!id.startsWith(withTrailingSlash(this.server.config.root))) {
|
|
477
477
|
id = join(this.server.config.root, id);
|
|
@@ -499,12 +499,12 @@ class ViteNodeServer {
|
|
|
499
499
|
let duration;
|
|
500
500
|
if (externalize) {
|
|
501
501
|
result = { externalize };
|
|
502
|
-
(_b = this.debugger) == null ?
|
|
502
|
+
(_b = this.debugger) == null ? undefined : _b.recordExternalize(id, externalize);
|
|
503
503
|
} else {
|
|
504
504
|
const start = performance.now();
|
|
505
505
|
const r = await this._transformRequest(id, filePath, transformMode);
|
|
506
506
|
duration = performance.now() - start;
|
|
507
|
-
result = { code: r == null ?
|
|
507
|
+
result = { code: r == null ? undefined : r.code, map: r == null ? undefined : r.map };
|
|
508
508
|
}
|
|
509
509
|
const cacheEntry = {
|
|
510
510
|
duration,
|
|
@@ -520,7 +520,7 @@ class ViteNodeServer {
|
|
|
520
520
|
async processTransformResult(filepath, result) {
|
|
521
521
|
const mod = this.server.moduleGraph.getModuleById(filepath);
|
|
522
522
|
return withInlineSourcemap(result, {
|
|
523
|
-
filepath: (mod == null ?
|
|
523
|
+
filepath: (mod == null ? undefined : mod.file) || filepath,
|
|
524
524
|
root: this.server.config.root
|
|
525
525
|
});
|
|
526
526
|
}
|
|
@@ -528,8 +528,8 @@ class ViteNodeServer {
|
|
|
528
528
|
var _a, _b, _c, _d;
|
|
529
529
|
debugRequest(id);
|
|
530
530
|
let result = null;
|
|
531
|
-
if ((_a = this.options.debug) == null ?
|
|
532
|
-
result = await ((_b = this.debugger) == null ?
|
|
531
|
+
if ((_a = this.options.debug) == null ? undefined : _a.loadDumppedModules) {
|
|
532
|
+
result = await ((_b = this.debugger) == null ? undefined : _b.loadDump(id)) ?? null;
|
|
533
533
|
if (result) {
|
|
534
534
|
return result;
|
|
535
535
|
}
|
|
@@ -546,8 +546,8 @@ class ViteNodeServer {
|
|
|
546
546
|
if (sourcemap === "inline" && result && !id.includes("node_modules")) {
|
|
547
547
|
result = await this.processTransformResult(filepath, result);
|
|
548
548
|
}
|
|
549
|
-
if ((_c = this.options.debug) == null ?
|
|
550
|
-
await ((_d = this.debugger) == null ?
|
|
549
|
+
if ((_c = this.options.debug) == null ? undefined : _c.dumpModules) {
|
|
550
|
+
await ((_d = this.debugger) == null ? undefined : _d.dumpFile(id, result));
|
|
551
551
|
}
|
|
552
552
|
return result;
|
|
553
553
|
}
|
package/dist/source-map.cjs
CHANGED
|
@@ -29,7 +29,7 @@ function decodeInteger(reader, relative) {
|
|
|
29
29
|
const shouldNegate = value & 1;
|
|
30
30
|
value >>>= 1;
|
|
31
31
|
if (shouldNegate) {
|
|
32
|
-
value = -
|
|
32
|
+
value = -2147483648 | -value;
|
|
33
33
|
}
|
|
34
34
|
return relative + value;
|
|
35
35
|
}
|
|
@@ -692,10 +692,10 @@ function mapSourcePosition(position) {
|
|
|
692
692
|
url: urlAndMap.url,
|
|
693
693
|
map: new TraceMap(urlAndMap.map)
|
|
694
694
|
};
|
|
695
|
-
if ((_a = sourceMap.map) == null ?
|
|
695
|
+
if ((_a = sourceMap.map) == null ? undefined : _a.sourcesContent) {
|
|
696
696
|
sourceMap.map.sources.forEach((source, i) => {
|
|
697
697
|
var _a2, _b;
|
|
698
|
-
const contents = (_b = (_a2 = sourceMap.map) == null ?
|
|
698
|
+
const contents = (_b = (_a2 = sourceMap.map) == null ? undefined : _a2.sourcesContent) == null ? undefined : _b[i];
|
|
699
699
|
if (contents && source && sourceMap.url) {
|
|
700
700
|
const url = supportRelativeURL(sourceMap.url, source);
|
|
701
701
|
fileContentsCache[url] = contents;
|
|
@@ -810,7 +810,7 @@ function cloneCallSite(frame) {
|
|
|
810
810
|
return object;
|
|
811
811
|
}
|
|
812
812
|
function wrapCallSite(frame, state) {
|
|
813
|
-
if (state ===
|
|
813
|
+
if (state === undefined) {
|
|
814
814
|
state = { nextPosition: null, curPosition: null };
|
|
815
815
|
}
|
|
816
816
|
if (frame.isNative()) {
|
|
@@ -842,7 +842,7 @@ function wrapCallSite(frame, state) {
|
|
|
842
842
|
return state.nextPosition.name || originalFunctionName();
|
|
843
843
|
};
|
|
844
844
|
frame.getFileName = function() {
|
|
845
|
-
return position.source ??
|
|
845
|
+
return position.source ?? undefined;
|
|
846
846
|
};
|
|
847
847
|
frame.getLineNumber = function() {
|
|
848
848
|
return position.line;
|
|
@@ -860,7 +860,7 @@ function wrapCallSite(frame, state) {
|
|
|
860
860
|
origin = mapEvalOrigin(origin);
|
|
861
861
|
frame = cloneCallSite(frame);
|
|
862
862
|
frame.getEvalOrigin = function() {
|
|
863
|
-
return origin ||
|
|
863
|
+
return origin || undefined;
|
|
864
864
|
};
|
|
865
865
|
return frame;
|
|
866
866
|
}
|
|
@@ -917,7 +917,7 @@ function withInlineSourcemap(result, options) {
|
|
|
917
917
|
return result;
|
|
918
918
|
}
|
|
919
919
|
if ("sources" in map) {
|
|
920
|
-
map.sources = (_a = map.sources) == null ?
|
|
920
|
+
map.sources = (_a = map.sources) == null ? undefined : _a.map((source) => {
|
|
921
921
|
if (!source) {
|
|
922
922
|
return source;
|
|
923
923
|
}
|
|
@@ -950,7 +950,7 @@ ${VITE_NODE_SOURCEMAPPING_SOURCE}
|
|
|
950
950
|
}
|
|
951
951
|
function extractSourceMap(code) {
|
|
952
952
|
var _a;
|
|
953
|
-
const mapString = (_a = code.match(VITE_NODE_SOURCEMAPPING_REGEXP)) == null ?
|
|
953
|
+
const mapString = (_a = code.match(VITE_NODE_SOURCEMAPPING_REGEXP)) == null ? undefined : _a[1];
|
|
954
954
|
if (mapString) {
|
|
955
955
|
return JSON.parse(Buffer.from(mapString, "base64").toString("utf-8"));
|
|
956
956
|
}
|
package/dist/source-map.mjs
CHANGED
|
@@ -27,7 +27,7 @@ function decodeInteger(reader, relative) {
|
|
|
27
27
|
const shouldNegate = value & 1;
|
|
28
28
|
value >>>= 1;
|
|
29
29
|
if (shouldNegate) {
|
|
30
|
-
value = -
|
|
30
|
+
value = -2147483648 | -value;
|
|
31
31
|
}
|
|
32
32
|
return relative + value;
|
|
33
33
|
}
|
|
@@ -690,10 +690,10 @@ function mapSourcePosition(position) {
|
|
|
690
690
|
url: urlAndMap.url,
|
|
691
691
|
map: new TraceMap(urlAndMap.map)
|
|
692
692
|
};
|
|
693
|
-
if ((_a = sourceMap.map) == null ?
|
|
693
|
+
if ((_a = sourceMap.map) == null ? undefined : _a.sourcesContent) {
|
|
694
694
|
sourceMap.map.sources.forEach((source, i) => {
|
|
695
695
|
var _a2, _b;
|
|
696
|
-
const contents = (_b = (_a2 = sourceMap.map) == null ?
|
|
696
|
+
const contents = (_b = (_a2 = sourceMap.map) == null ? undefined : _a2.sourcesContent) == null ? undefined : _b[i];
|
|
697
697
|
if (contents && source && sourceMap.url) {
|
|
698
698
|
const url = supportRelativeURL(sourceMap.url, source);
|
|
699
699
|
fileContentsCache[url] = contents;
|
|
@@ -808,7 +808,7 @@ function cloneCallSite(frame) {
|
|
|
808
808
|
return object;
|
|
809
809
|
}
|
|
810
810
|
function wrapCallSite(frame, state) {
|
|
811
|
-
if (state ===
|
|
811
|
+
if (state === undefined) {
|
|
812
812
|
state = { nextPosition: null, curPosition: null };
|
|
813
813
|
}
|
|
814
814
|
if (frame.isNative()) {
|
|
@@ -840,7 +840,7 @@ function wrapCallSite(frame, state) {
|
|
|
840
840
|
return state.nextPosition.name || originalFunctionName();
|
|
841
841
|
};
|
|
842
842
|
frame.getFileName = function() {
|
|
843
|
-
return position.source ??
|
|
843
|
+
return position.source ?? undefined;
|
|
844
844
|
};
|
|
845
845
|
frame.getLineNumber = function() {
|
|
846
846
|
return position.line;
|
|
@@ -858,7 +858,7 @@ function wrapCallSite(frame, state) {
|
|
|
858
858
|
origin = mapEvalOrigin(origin);
|
|
859
859
|
frame = cloneCallSite(frame);
|
|
860
860
|
frame.getEvalOrigin = function() {
|
|
861
|
-
return origin ||
|
|
861
|
+
return origin || undefined;
|
|
862
862
|
};
|
|
863
863
|
return frame;
|
|
864
864
|
}
|
|
@@ -915,7 +915,7 @@ function withInlineSourcemap(result, options) {
|
|
|
915
915
|
return result;
|
|
916
916
|
}
|
|
917
917
|
if ("sources" in map) {
|
|
918
|
-
map.sources = (_a = map.sources) == null ?
|
|
918
|
+
map.sources = (_a = map.sources) == null ? undefined : _a.map((source) => {
|
|
919
919
|
if (!source) {
|
|
920
920
|
return source;
|
|
921
921
|
}
|
|
@@ -948,7 +948,7 @@ ${VITE_NODE_SOURCEMAPPING_SOURCE}
|
|
|
948
948
|
}
|
|
949
949
|
function extractSourceMap(code) {
|
|
950
950
|
var _a;
|
|
951
|
-
const mapString = (_a = code.match(VITE_NODE_SOURCEMAPPING_REGEXP)) == null ?
|
|
951
|
+
const mapString = (_a = code.match(VITE_NODE_SOURCEMAPPING_REGEXP)) == null ? undefined : _a[1];
|
|
952
952
|
if (mapString) {
|
|
953
953
|
return JSON.parse(Buffer.from(mapString, "base64").toString("utf-8"));
|
|
954
954
|
}
|
package/dist/utils.cjs
CHANGED
|
@@ -18,7 +18,7 @@ function normalizeRequestId(id, base) {
|
|
|
18
18
|
if (base && id.startsWith(withTrailingSlash(base))) {
|
|
19
19
|
id = `/${id.slice(base.length)}`;
|
|
20
20
|
}
|
|
21
|
-
if (driveRegexp && !(driveRegexp == null ?
|
|
21
|
+
if (driveRegexp && !(driveRegexp == null ? undefined : driveRegexp.test(id)) && (driveOppositeRegext == null ? undefined : driveOppositeRegext.test(id))) {
|
|
22
22
|
id = id.replace(driveOppositeRegext, `${drive}$1`);
|
|
23
23
|
}
|
|
24
24
|
if (id.startsWith("file://")) {
|
|
@@ -104,7 +104,7 @@ function isNodeBuiltin(id) {
|
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
function toArray(array) {
|
|
107
|
-
if (array === null || array ===
|
|
107
|
+
if (array === null || array === undefined) {
|
|
108
108
|
array = [];
|
|
109
109
|
}
|
|
110
110
|
if (Array.isArray(array)) {
|
|
@@ -147,7 +147,7 @@ function createImportMetaEnvProxy() {
|
|
|
147
147
|
return new Proxy(process.env, {
|
|
148
148
|
get(_, key) {
|
|
149
149
|
if (typeof key !== "string") {
|
|
150
|
-
return
|
|
150
|
+
return undefined;
|
|
151
151
|
}
|
|
152
152
|
if (booleanKeys.includes(key)) {
|
|
153
153
|
return !!process.env[key];
|
|
@@ -178,7 +178,7 @@ async function findNearestPackageData(basedir) {
|
|
|
178
178
|
}
|
|
179
179
|
const pkgPath = pathe.join(basedir, "package.json");
|
|
180
180
|
if ((_a = await fs.promises.stat(pkgPath).catch(() => {
|
|
181
|
-
})) == null ?
|
|
181
|
+
})) == null ? undefined : _a.isFile()) {
|
|
182
182
|
const pkgData = JSON.parse(await fs.promises.readFile(pkgPath, "utf8"));
|
|
183
183
|
if (packageCache) {
|
|
184
184
|
setCacheData(packageCache, pkgData, basedir, originalBasedir);
|
package/dist/utils.mjs
CHANGED
|
@@ -16,7 +16,7 @@ function normalizeRequestId(id, base) {
|
|
|
16
16
|
if (base && id.startsWith(withTrailingSlash(base))) {
|
|
17
17
|
id = `/${id.slice(base.length)}`;
|
|
18
18
|
}
|
|
19
|
-
if (driveRegexp && !(driveRegexp == null ?
|
|
19
|
+
if (driveRegexp && !(driveRegexp == null ? undefined : driveRegexp.test(id)) && (driveOppositeRegext == null ? undefined : driveOppositeRegext.test(id))) {
|
|
20
20
|
id = id.replace(driveOppositeRegext, `${drive}$1`);
|
|
21
21
|
}
|
|
22
22
|
if (id.startsWith("file://")) {
|
|
@@ -102,7 +102,7 @@ function isNodeBuiltin(id) {
|
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
104
|
function toArray(array) {
|
|
105
|
-
if (array === null || array ===
|
|
105
|
+
if (array === null || array === undefined) {
|
|
106
106
|
array = [];
|
|
107
107
|
}
|
|
108
108
|
if (Array.isArray(array)) {
|
|
@@ -145,7 +145,7 @@ function createImportMetaEnvProxy() {
|
|
|
145
145
|
return new Proxy(process.env, {
|
|
146
146
|
get(_, key) {
|
|
147
147
|
if (typeof key !== "string") {
|
|
148
|
-
return
|
|
148
|
+
return undefined;
|
|
149
149
|
}
|
|
150
150
|
if (booleanKeys.includes(key)) {
|
|
151
151
|
return !!process.env[key];
|
|
@@ -176,7 +176,7 @@ async function findNearestPackageData(basedir) {
|
|
|
176
176
|
}
|
|
177
177
|
const pkgPath = join(basedir, "package.json");
|
|
178
178
|
if ((_a = await promises.stat(pkgPath).catch(() => {
|
|
179
|
-
})) == null ?
|
|
179
|
+
})) == null ? undefined : _a.isFile()) {
|
|
180
180
|
const pkgData = JSON.parse(await promises.readFile(pkgPath, "utf8"));
|
|
181
181
|
if (packageCache) {
|
|
182
182
|
setCacheData(packageCache, pkgData, basedir, originalBasedir);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-node",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.1",
|
|
5
5
|
"description": "Vite as Node.js runtime",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -79,8 +79,8 @@
|
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"cac": "^6.7.14",
|
|
81
81
|
"debug": "^4.4.0",
|
|
82
|
-
"es-module-lexer": "^1.
|
|
83
|
-
"pathe": "^2.0.
|
|
82
|
+
"es-module-lexer": "^1.6.0",
|
|
83
|
+
"pathe": "^2.0.1",
|
|
84
84
|
"vite": "^5.0.0 || ^6.0.0"
|
|
85
85
|
},
|
|
86
86
|
"devDependencies": {
|