vite-node 2.1.0-beta.5 → 2.1.0-beta.7
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 +84 -0
- package/dist/chunk-browser.mjs +82 -0
- package/dist/chunk-hmr.cjs +11 -4
- package/dist/chunk-hmr.mjs +11 -4
- package/dist/cli.cjs +4 -4
- package/dist/cli.mjs +4 -4
- package/dist/hmr.cjs +1 -1
- package/dist/hmr.mjs +1 -1
- package/dist/server.cjs +6 -6
- package/dist/server.mjs +6 -6
- package/dist/source-map.cjs +65 -47
- package/dist/source-map.mjs +65 -47
- package/package.json +3 -3
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
var f$1 = {
|
|
5
|
+
reset: [0, 0],
|
|
6
|
+
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
|
7
|
+
dim: [2, 22, "\x1B[22m\x1B[2m"],
|
|
8
|
+
italic: [3, 23],
|
|
9
|
+
underline: [4, 24],
|
|
10
|
+
inverse: [7, 27],
|
|
11
|
+
hidden: [8, 28],
|
|
12
|
+
strikethrough: [9, 29],
|
|
13
|
+
black: [30, 39],
|
|
14
|
+
red: [31, 39],
|
|
15
|
+
green: [32, 39],
|
|
16
|
+
yellow: [33, 39],
|
|
17
|
+
blue: [34, 39],
|
|
18
|
+
magenta: [35, 39],
|
|
19
|
+
cyan: [36, 39],
|
|
20
|
+
white: [37, 39],
|
|
21
|
+
gray: [90, 39],
|
|
22
|
+
bgBlack: [40, 49],
|
|
23
|
+
bgRed: [41, 49],
|
|
24
|
+
bgGreen: [42, 49],
|
|
25
|
+
bgYellow: [43, 49],
|
|
26
|
+
bgBlue: [44, 49],
|
|
27
|
+
bgMagenta: [45, 49],
|
|
28
|
+
bgCyan: [46, 49],
|
|
29
|
+
bgWhite: [47, 49],
|
|
30
|
+
blackBright: [90, 39],
|
|
31
|
+
redBright: [91, 39],
|
|
32
|
+
greenBright: [92, 39],
|
|
33
|
+
yellowBright: [93, 39],
|
|
34
|
+
blueBright: [94, 39],
|
|
35
|
+
magentaBright: [95, 39],
|
|
36
|
+
cyanBright: [96, 39],
|
|
37
|
+
whiteBright: [97, 39],
|
|
38
|
+
bgBlackBright: [100, 49],
|
|
39
|
+
bgRedBright: [101, 49],
|
|
40
|
+
bgGreenBright: [102, 49],
|
|
41
|
+
bgYellowBright: [103, 49],
|
|
42
|
+
bgBlueBright: [104, 49],
|
|
43
|
+
bgMagentaBright: [105, 49],
|
|
44
|
+
bgCyanBright: [106, 49],
|
|
45
|
+
bgWhiteBright: [107, 49]
|
|
46
|
+
}, h = Object.entries(f$1);
|
|
47
|
+
function a(n) {
|
|
48
|
+
return String(n);
|
|
49
|
+
}
|
|
50
|
+
a.open = "";
|
|
51
|
+
a.close = "";
|
|
52
|
+
function C(n = !1) {
|
|
53
|
+
let e = typeof process != "undefined" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];
|
|
54
|
+
return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || n && i.TERM !== "dumb" || "CI" in i) || typeof window != "undefined" && !!window.chrome;
|
|
55
|
+
}
|
|
56
|
+
function p(n = !1) {
|
|
57
|
+
let e = C(n), i = (r, t, c, o) => {
|
|
58
|
+
let l = "", s = 0;
|
|
59
|
+
do
|
|
60
|
+
l += r.substring(s, o) + c, s = o + t.length, o = r.indexOf(t, s);
|
|
61
|
+
while (~o);
|
|
62
|
+
return l + r.substring(s);
|
|
63
|
+
}, g = (r, t, c = r) => {
|
|
64
|
+
let o = (l) => {
|
|
65
|
+
let s = String(l), b = s.indexOf(t, r.length);
|
|
66
|
+
return ~b ? r + i(s, t, c, b) + t : r + s + t;
|
|
67
|
+
};
|
|
68
|
+
return o.open = r, o.close = t, o;
|
|
69
|
+
}, u = {
|
|
70
|
+
isColorSupported: e
|
|
71
|
+
}, d = (r) => `\x1B[${r}m`;
|
|
72
|
+
for (let [r, t] of h)
|
|
73
|
+
u[r] = e ? g(
|
|
74
|
+
d(t[0]),
|
|
75
|
+
d(t[1]),
|
|
76
|
+
t[2]
|
|
77
|
+
) : a;
|
|
78
|
+
return u;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/browser.ts
|
|
82
|
+
var f = p(!1);
|
|
83
|
+
|
|
84
|
+
exports.f = f;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
var f$1 = {
|
|
3
|
+
reset: [0, 0],
|
|
4
|
+
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
|
5
|
+
dim: [2, 22, "\x1B[22m\x1B[2m"],
|
|
6
|
+
italic: [3, 23],
|
|
7
|
+
underline: [4, 24],
|
|
8
|
+
inverse: [7, 27],
|
|
9
|
+
hidden: [8, 28],
|
|
10
|
+
strikethrough: [9, 29],
|
|
11
|
+
black: [30, 39],
|
|
12
|
+
red: [31, 39],
|
|
13
|
+
green: [32, 39],
|
|
14
|
+
yellow: [33, 39],
|
|
15
|
+
blue: [34, 39],
|
|
16
|
+
magenta: [35, 39],
|
|
17
|
+
cyan: [36, 39],
|
|
18
|
+
white: [37, 39],
|
|
19
|
+
gray: [90, 39],
|
|
20
|
+
bgBlack: [40, 49],
|
|
21
|
+
bgRed: [41, 49],
|
|
22
|
+
bgGreen: [42, 49],
|
|
23
|
+
bgYellow: [43, 49],
|
|
24
|
+
bgBlue: [44, 49],
|
|
25
|
+
bgMagenta: [45, 49],
|
|
26
|
+
bgCyan: [46, 49],
|
|
27
|
+
bgWhite: [47, 49],
|
|
28
|
+
blackBright: [90, 39],
|
|
29
|
+
redBright: [91, 39],
|
|
30
|
+
greenBright: [92, 39],
|
|
31
|
+
yellowBright: [93, 39],
|
|
32
|
+
blueBright: [94, 39],
|
|
33
|
+
magentaBright: [95, 39],
|
|
34
|
+
cyanBright: [96, 39],
|
|
35
|
+
whiteBright: [97, 39],
|
|
36
|
+
bgBlackBright: [100, 49],
|
|
37
|
+
bgRedBright: [101, 49],
|
|
38
|
+
bgGreenBright: [102, 49],
|
|
39
|
+
bgYellowBright: [103, 49],
|
|
40
|
+
bgBlueBright: [104, 49],
|
|
41
|
+
bgMagentaBright: [105, 49],
|
|
42
|
+
bgCyanBright: [106, 49],
|
|
43
|
+
bgWhiteBright: [107, 49]
|
|
44
|
+
}, h = Object.entries(f$1);
|
|
45
|
+
function a(n) {
|
|
46
|
+
return String(n);
|
|
47
|
+
}
|
|
48
|
+
a.open = "";
|
|
49
|
+
a.close = "";
|
|
50
|
+
function C(n = !1) {
|
|
51
|
+
let e = typeof process != "undefined" ? process : void 0, i = (e == null ? void 0 : e.env) || {}, g = (e == null ? void 0 : e.argv) || [];
|
|
52
|
+
return !("NO_COLOR" in i || g.includes("--no-color")) && ("FORCE_COLOR" in i || g.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || n && i.TERM !== "dumb" || "CI" in i) || typeof window != "undefined" && !!window.chrome;
|
|
53
|
+
}
|
|
54
|
+
function p(n = !1) {
|
|
55
|
+
let e = C(n), i = (r, t, c, o) => {
|
|
56
|
+
let l = "", s = 0;
|
|
57
|
+
do
|
|
58
|
+
l += r.substring(s, o) + c, s = o + t.length, o = r.indexOf(t, s);
|
|
59
|
+
while (~o);
|
|
60
|
+
return l + r.substring(s);
|
|
61
|
+
}, g = (r, t, c = r) => {
|
|
62
|
+
let o = (l) => {
|
|
63
|
+
let s = String(l), b = s.indexOf(t, r.length);
|
|
64
|
+
return ~b ? r + i(s, t, c, b) + t : r + s + t;
|
|
65
|
+
};
|
|
66
|
+
return o.open = r, o.close = t, o;
|
|
67
|
+
}, u = {
|
|
68
|
+
isColorSupported: e
|
|
69
|
+
}, d = (r) => `\x1B[${r}m`;
|
|
70
|
+
for (let [r, t] of h)
|
|
71
|
+
u[r] = e ? g(
|
|
72
|
+
d(t[0]),
|
|
73
|
+
d(t[1]),
|
|
74
|
+
t[2]
|
|
75
|
+
) : a;
|
|
76
|
+
return u;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// src/browser.ts
|
|
80
|
+
var f = p(!1);
|
|
81
|
+
|
|
82
|
+
export { f };
|
package/dist/chunk-hmr.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var node_events = require('node:events');
|
|
4
|
-
var
|
|
4
|
+
var browser = require('./chunk-browser.cjs');
|
|
5
5
|
var createDebug = require('debug');
|
|
6
6
|
var utils = require('./utils.cjs');
|
|
7
7
|
|
|
@@ -32,6 +32,13 @@ function viteNodeHmrPlugin() {
|
|
|
32
32
|
_send(payload);
|
|
33
33
|
emitter.emit("message", payload);
|
|
34
34
|
};
|
|
35
|
+
const environments = server.environments;
|
|
36
|
+
if (environments) {
|
|
37
|
+
environments.ssr.hot.send = function(payload) {
|
|
38
|
+
_send(payload);
|
|
39
|
+
emitter.emit("message", payload);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
35
42
|
}
|
|
36
43
|
};
|
|
37
44
|
}
|
|
@@ -116,7 +123,7 @@ async function fetchUpdate(runner, { path, acceptedPath }) {
|
|
|
116
123
|
fn(deps.map((dep) => dep === acceptedPath ? fetchedModule : void 0));
|
|
117
124
|
}
|
|
118
125
|
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
|
|
119
|
-
console.log(`${
|
|
126
|
+
console.log(`${browser.f.cyan("[vite-node]")} hot updated: ${loggedPath}`);
|
|
120
127
|
};
|
|
121
128
|
}
|
|
122
129
|
function warnFailedFetch(err, path) {
|
|
@@ -140,7 +147,7 @@ async function handleMessage(runner, emitter, files, payload) {
|
|
|
140
147
|
if (update.type === "js-update") {
|
|
141
148
|
return queueUpdate(runner, fetchUpdate(runner, update));
|
|
142
149
|
}
|
|
143
|
-
console.error(`${
|
|
150
|
+
console.error(`${browser.f.cyan("[vite-node]")} no support css hmr.}`);
|
|
144
151
|
return null;
|
|
145
152
|
})
|
|
146
153
|
);
|
|
@@ -167,7 +174,7 @@ async function handleMessage(runner, emitter, files, payload) {
|
|
|
167
174
|
await notifyListeners(runner, "vite:error", payload);
|
|
168
175
|
const err = payload.err;
|
|
169
176
|
console.error(
|
|
170
|
-
`${
|
|
177
|
+
`${browser.f.cyan("[vite-node]")} Internal Server Error
|
|
171
178
|
${err.message}
|
|
172
179
|
${err.stack}`
|
|
173
180
|
);
|
package/dist/chunk-hmr.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'node:events';
|
|
2
|
-
import
|
|
2
|
+
import { f } from './chunk-browser.mjs';
|
|
3
3
|
import createDebug from 'debug';
|
|
4
4
|
import { normalizeRequestId } from './utils.mjs';
|
|
5
5
|
|
|
@@ -30,6 +30,13 @@ function viteNodeHmrPlugin() {
|
|
|
30
30
|
_send(payload);
|
|
31
31
|
emitter.emit("message", payload);
|
|
32
32
|
};
|
|
33
|
+
const environments = server.environments;
|
|
34
|
+
if (environments) {
|
|
35
|
+
environments.ssr.hot.send = function(payload) {
|
|
36
|
+
_send(payload);
|
|
37
|
+
emitter.emit("message", payload);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
33
40
|
}
|
|
34
41
|
};
|
|
35
42
|
}
|
|
@@ -114,7 +121,7 @@ async function fetchUpdate(runner, { path, acceptedPath }) {
|
|
|
114
121
|
fn(deps.map((dep) => dep === acceptedPath ? fetchedModule : void 0));
|
|
115
122
|
}
|
|
116
123
|
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
|
|
117
|
-
console.log(`${
|
|
124
|
+
console.log(`${f.cyan("[vite-node]")} hot updated: ${loggedPath}`);
|
|
118
125
|
};
|
|
119
126
|
}
|
|
120
127
|
function warnFailedFetch(err, path) {
|
|
@@ -138,7 +145,7 @@ async function handleMessage(runner, emitter, files, payload) {
|
|
|
138
145
|
if (update.type === "js-update") {
|
|
139
146
|
return queueUpdate(runner, fetchUpdate(runner, update));
|
|
140
147
|
}
|
|
141
|
-
console.error(`${
|
|
148
|
+
console.error(`${f.cyan("[vite-node]")} no support css hmr.}`);
|
|
142
149
|
return null;
|
|
143
150
|
})
|
|
144
151
|
);
|
|
@@ -165,7 +172,7 @@ async function handleMessage(runner, emitter, files, payload) {
|
|
|
165
172
|
await notifyListeners(runner, "vite:error", payload);
|
|
166
173
|
const err = payload.err;
|
|
167
174
|
console.error(
|
|
168
|
-
`${
|
|
175
|
+
`${f.cyan("[vite-node]")} Internal Server Error
|
|
169
176
|
${err.message}
|
|
170
177
|
${err.stack}`
|
|
171
178
|
);
|
package/dist/cli.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var path = require('node:path');
|
|
4
4
|
var cac = require('cac');
|
|
5
|
-
var
|
|
5
|
+
var browser = require('./chunk-browser.cjs');
|
|
6
6
|
var vite = require('vite');
|
|
7
7
|
var server = require('./server.cjs');
|
|
8
8
|
var client = require('./client.cjs');
|
|
@@ -20,7 +20,7 @@ require('node:url');
|
|
|
20
20
|
require('node:vm');
|
|
21
21
|
require('node:events');
|
|
22
22
|
|
|
23
|
-
var version = "2.1.0-beta.
|
|
23
|
+
var version = "2.1.0-beta.7";
|
|
24
24
|
|
|
25
25
|
const cli = cac("vite-node");
|
|
26
26
|
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");
|
|
@@ -57,7 +57,7 @@ async function run(files, options = {}) {
|
|
|
57
57
|
process.exit(0);
|
|
58
58
|
}
|
|
59
59
|
if (!files.length) {
|
|
60
|
-
console.error(
|
|
60
|
+
console.error(browser.f.red("No files specified."));
|
|
61
61
|
cli.version(version).outputHelp();
|
|
62
62
|
process.exit(1);
|
|
63
63
|
}
|
|
@@ -107,7 +107,7 @@ async function run(files, options = {}) {
|
|
|
107
107
|
});
|
|
108
108
|
if (options.watch) {
|
|
109
109
|
process.on("uncaughtException", (err) => {
|
|
110
|
-
console.error(
|
|
110
|
+
console.error(browser.f.red("[vite-node] Failed to execute file: \n"), err);
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
2
|
import cac from 'cac';
|
|
3
|
-
import
|
|
3
|
+
import { f } from './chunk-browser.mjs';
|
|
4
4
|
import { createServer, loadEnv } from 'vite';
|
|
5
5
|
import { ViteNodeServer } from './server.mjs';
|
|
6
6
|
import { ViteNodeRunner } from './client.mjs';
|
|
@@ -18,7 +18,7 @@ import 'node:url';
|
|
|
18
18
|
import 'node:vm';
|
|
19
19
|
import 'node:events';
|
|
20
20
|
|
|
21
|
-
var version = "2.1.0-beta.
|
|
21
|
+
var version = "2.1.0-beta.7";
|
|
22
22
|
|
|
23
23
|
const cli = cac("vite-node");
|
|
24
24
|
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");
|
|
@@ -55,7 +55,7 @@ async function run(files, options = {}) {
|
|
|
55
55
|
process.exit(0);
|
|
56
56
|
}
|
|
57
57
|
if (!files.length) {
|
|
58
|
-
console.error(
|
|
58
|
+
console.error(f.red("No files specified."));
|
|
59
59
|
cli.version(version).outputHelp();
|
|
60
60
|
process.exit(1);
|
|
61
61
|
}
|
|
@@ -105,7 +105,7 @@ async function run(files, options = {}) {
|
|
|
105
105
|
});
|
|
106
106
|
if (options.watch) {
|
|
107
107
|
process.on("uncaughtException", (err) => {
|
|
108
|
-
console.error(
|
|
108
|
+
console.error(f.red("[vite-node] Failed to execute file: \n"), err);
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
}
|
package/dist/hmr.cjs
CHANGED
package/dist/hmr.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
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.mjs';
|
|
2
2
|
import 'node:events';
|
|
3
|
-
import '
|
|
3
|
+
import './chunk-browser.mjs';
|
|
4
4
|
import 'debug';
|
|
5
5
|
import './utils.mjs';
|
|
6
6
|
import 'node:url';
|
package/dist/server.cjs
CHANGED
|
@@ -7,7 +7,7 @@ var pathe = require('pathe');
|
|
|
7
7
|
var createDebug = require('debug');
|
|
8
8
|
var utils = require('./utils.cjs');
|
|
9
9
|
var constants = require('./constants.cjs');
|
|
10
|
-
var
|
|
10
|
+
var browser = require('./chunk-browser.cjs');
|
|
11
11
|
var sourceMap = require('./source-map.cjs');
|
|
12
12
|
require('node:url');
|
|
13
13
|
require('node:module');
|
|
@@ -89,9 +89,6 @@ async function _shouldExternalize(id, options) {
|
|
|
89
89
|
return id;
|
|
90
90
|
}
|
|
91
91
|
id = patchWindowsImportPath(id);
|
|
92
|
-
if ((options == null ? void 0 : options.cacheDir) && id.includes(options.cacheDir)) {
|
|
93
|
-
return id;
|
|
94
|
-
}
|
|
95
92
|
const moduleDirectories = (options == null ? void 0 : options.moduleDirectories) || ["/node_modules/"];
|
|
96
93
|
if (matchExternalizePattern(id, moduleDirectories, options == null ? void 0 : options.inline)) {
|
|
97
94
|
return false;
|
|
@@ -99,6 +96,9 @@ async function _shouldExternalize(id, options) {
|
|
|
99
96
|
if (matchExternalizePattern(id, moduleDirectories, options == null ? void 0 : options.external)) {
|
|
100
97
|
return id;
|
|
101
98
|
}
|
|
99
|
+
if ((options == null ? void 0 : options.cacheDir) && id.includes(options.cacheDir)) {
|
|
100
|
+
return id;
|
|
101
|
+
}
|
|
102
102
|
const isLibraryModule = moduleDirectories.some((dir) => id.includes(dir));
|
|
103
103
|
const guessCJS = isLibraryModule && (options == null ? void 0 : options.fallbackCJS);
|
|
104
104
|
id = guessCJS ? guessCJSversion(id) || id : id;
|
|
@@ -161,11 +161,11 @@ class Debugger {
|
|
|
161
161
|
if (this.dumpDir) {
|
|
162
162
|
if (options.loadDumppedModules) {
|
|
163
163
|
console.info(
|
|
164
|
-
|
|
164
|
+
browser.f.gray(`[vite-node] [debug] load modules from ${this.dumpDir}`)
|
|
165
165
|
);
|
|
166
166
|
} else {
|
|
167
167
|
console.info(
|
|
168
|
-
|
|
168
|
+
browser.f.gray(`[vite-node] [debug] dump modules to ${this.dumpDir}`)
|
|
169
169
|
);
|
|
170
170
|
}
|
|
171
171
|
}
|
package/dist/server.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { join, extname, dirname, resolve, relative, normalize } from 'pathe';
|
|
|
5
5
|
import createDebug from 'debug';
|
|
6
6
|
import { isNodeBuiltin, slash, findNearestPackageData, toArray, withTrailingSlash, normalizeModuleId, toFilePath } from './utils.mjs';
|
|
7
7
|
import { KNOWN_ASSET_RE } from './constants.mjs';
|
|
8
|
-
import
|
|
8
|
+
import { f } from './chunk-browser.mjs';
|
|
9
9
|
import { withInlineSourcemap } from './source-map.mjs';
|
|
10
10
|
import 'node:url';
|
|
11
11
|
import 'node:module';
|
|
@@ -87,9 +87,6 @@ async function _shouldExternalize(id, options) {
|
|
|
87
87
|
return id;
|
|
88
88
|
}
|
|
89
89
|
id = patchWindowsImportPath(id);
|
|
90
|
-
if ((options == null ? void 0 : options.cacheDir) && id.includes(options.cacheDir)) {
|
|
91
|
-
return id;
|
|
92
|
-
}
|
|
93
90
|
const moduleDirectories = (options == null ? void 0 : options.moduleDirectories) || ["/node_modules/"];
|
|
94
91
|
if (matchExternalizePattern(id, moduleDirectories, options == null ? void 0 : options.inline)) {
|
|
95
92
|
return false;
|
|
@@ -97,6 +94,9 @@ async function _shouldExternalize(id, options) {
|
|
|
97
94
|
if (matchExternalizePattern(id, moduleDirectories, options == null ? void 0 : options.external)) {
|
|
98
95
|
return id;
|
|
99
96
|
}
|
|
97
|
+
if ((options == null ? void 0 : options.cacheDir) && id.includes(options.cacheDir)) {
|
|
98
|
+
return id;
|
|
99
|
+
}
|
|
100
100
|
const isLibraryModule = moduleDirectories.some((dir) => id.includes(dir));
|
|
101
101
|
const guessCJS = isLibraryModule && (options == null ? void 0 : options.fallbackCJS);
|
|
102
102
|
id = guessCJS ? guessCJSversion(id) || id : id;
|
|
@@ -159,11 +159,11 @@ class Debugger {
|
|
|
159
159
|
if (this.dumpDir) {
|
|
160
160
|
if (options.loadDumppedModules) {
|
|
161
161
|
console.info(
|
|
162
|
-
|
|
162
|
+
f.gray(`[vite-node] [debug] load modules from ${this.dumpDir}`)
|
|
163
163
|
);
|
|
164
164
|
} else {
|
|
165
165
|
console.info(
|
|
166
|
-
|
|
166
|
+
f.gray(`[vite-node] [debug] dump modules to ${this.dumpDir}`)
|
|
167
167
|
);
|
|
168
168
|
}
|
|
169
169
|
}
|
package/dist/source-map.cjs
CHANGED
|
@@ -16,74 +16,92 @@ for (let i = 0; i < chars.length; i++) {
|
|
|
16
16
|
intToChar[i] = c;
|
|
17
17
|
charToInt[c] = i;
|
|
18
18
|
}
|
|
19
|
+
function decodeInteger(reader, relative) {
|
|
20
|
+
let value = 0;
|
|
21
|
+
let shift = 0;
|
|
22
|
+
let integer = 0;
|
|
23
|
+
do {
|
|
24
|
+
const c = reader.next();
|
|
25
|
+
integer = charToInt[c];
|
|
26
|
+
value |= (integer & 31) << shift;
|
|
27
|
+
shift += 5;
|
|
28
|
+
} while (integer & 32);
|
|
29
|
+
const shouldNegate = value & 1;
|
|
30
|
+
value >>>= 1;
|
|
31
|
+
if (shouldNegate) {
|
|
32
|
+
value = -0x80000000 | -value;
|
|
33
|
+
}
|
|
34
|
+
return relative + value;
|
|
35
|
+
}
|
|
36
|
+
function hasMoreVlq(reader, max) {
|
|
37
|
+
if (reader.pos >= max)
|
|
38
|
+
return false;
|
|
39
|
+
return reader.peek() !== comma;
|
|
40
|
+
}
|
|
41
|
+
class StringReader {
|
|
42
|
+
constructor(buffer) {
|
|
43
|
+
this.pos = 0;
|
|
44
|
+
this.buffer = buffer;
|
|
45
|
+
}
|
|
46
|
+
next() {
|
|
47
|
+
return this.buffer.charCodeAt(this.pos++);
|
|
48
|
+
}
|
|
49
|
+
peek() {
|
|
50
|
+
return this.buffer.charCodeAt(this.pos);
|
|
51
|
+
}
|
|
52
|
+
indexOf(char) {
|
|
53
|
+
const { buffer, pos } = this;
|
|
54
|
+
const idx = buffer.indexOf(char, pos);
|
|
55
|
+
return idx === -1 ? buffer.length : idx;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
19
59
|
function decode(mappings) {
|
|
20
|
-
const
|
|
60
|
+
const { length } = mappings;
|
|
61
|
+
const reader = new StringReader(mappings);
|
|
21
62
|
const decoded = [];
|
|
22
|
-
let
|
|
63
|
+
let genColumn = 0;
|
|
64
|
+
let sourcesIndex = 0;
|
|
65
|
+
let sourceLine = 0;
|
|
66
|
+
let sourceColumn = 0;
|
|
67
|
+
let namesIndex = 0;
|
|
23
68
|
do {
|
|
24
|
-
const semi = indexOf(
|
|
69
|
+
const semi = reader.indexOf(';');
|
|
25
70
|
const line = [];
|
|
26
71
|
let sorted = true;
|
|
27
72
|
let lastCol = 0;
|
|
28
|
-
|
|
29
|
-
|
|
73
|
+
genColumn = 0;
|
|
74
|
+
while (reader.pos < semi) {
|
|
30
75
|
let seg;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (col < lastCol)
|
|
76
|
+
genColumn = decodeInteger(reader, genColumn);
|
|
77
|
+
if (genColumn < lastCol)
|
|
34
78
|
sorted = false;
|
|
35
|
-
lastCol =
|
|
36
|
-
if (hasMoreVlq(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (hasMoreVlq(
|
|
41
|
-
|
|
42
|
-
seg = [
|
|
79
|
+
lastCol = genColumn;
|
|
80
|
+
if (hasMoreVlq(reader, semi)) {
|
|
81
|
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
|
82
|
+
sourceLine = decodeInteger(reader, sourceLine);
|
|
83
|
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
|
84
|
+
if (hasMoreVlq(reader, semi)) {
|
|
85
|
+
namesIndex = decodeInteger(reader, namesIndex);
|
|
86
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
|
|
43
87
|
}
|
|
44
88
|
else {
|
|
45
|
-
seg = [
|
|
89
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
|
46
90
|
}
|
|
47
91
|
}
|
|
48
92
|
else {
|
|
49
|
-
seg = [
|
|
93
|
+
seg = [genColumn];
|
|
50
94
|
}
|
|
51
95
|
line.push(seg);
|
|
96
|
+
reader.pos++;
|
|
52
97
|
}
|
|
53
98
|
if (!sorted)
|
|
54
99
|
sort(line);
|
|
55
100
|
decoded.push(line);
|
|
56
|
-
|
|
57
|
-
} while (
|
|
101
|
+
reader.pos = semi + 1;
|
|
102
|
+
} while (reader.pos <= length);
|
|
58
103
|
return decoded;
|
|
59
104
|
}
|
|
60
|
-
function indexOf(mappings, index) {
|
|
61
|
-
const idx = mappings.indexOf(';', index);
|
|
62
|
-
return idx === -1 ? mappings.length : idx;
|
|
63
|
-
}
|
|
64
|
-
function decodeInteger(mappings, pos, state, j) {
|
|
65
|
-
let value = 0;
|
|
66
|
-
let shift = 0;
|
|
67
|
-
let integer = 0;
|
|
68
|
-
do {
|
|
69
|
-
const c = mappings.charCodeAt(pos++);
|
|
70
|
-
integer = charToInt[c];
|
|
71
|
-
value |= (integer & 31) << shift;
|
|
72
|
-
shift += 5;
|
|
73
|
-
} while (integer & 32);
|
|
74
|
-
const shouldNegate = value & 1;
|
|
75
|
-
value >>>= 1;
|
|
76
|
-
if (shouldNegate) {
|
|
77
|
-
value = -0x80000000 | -value;
|
|
78
|
-
}
|
|
79
|
-
state[j] += value;
|
|
80
|
-
return pos;
|
|
81
|
-
}
|
|
82
|
-
function hasMoreVlq(mappings, i, length) {
|
|
83
|
-
if (i >= length)
|
|
84
|
-
return false;
|
|
85
|
-
return mappings.charCodeAt(i) !== comma;
|
|
86
|
-
}
|
|
87
105
|
function sort(line) {
|
|
88
106
|
line.sort(sortComparator$1);
|
|
89
107
|
}
|
package/dist/source-map.mjs
CHANGED
|
@@ -14,74 +14,92 @@ for (let i = 0; i < chars.length; i++) {
|
|
|
14
14
|
intToChar[i] = c;
|
|
15
15
|
charToInt[c] = i;
|
|
16
16
|
}
|
|
17
|
+
function decodeInteger(reader, relative) {
|
|
18
|
+
let value = 0;
|
|
19
|
+
let shift = 0;
|
|
20
|
+
let integer = 0;
|
|
21
|
+
do {
|
|
22
|
+
const c = reader.next();
|
|
23
|
+
integer = charToInt[c];
|
|
24
|
+
value |= (integer & 31) << shift;
|
|
25
|
+
shift += 5;
|
|
26
|
+
} while (integer & 32);
|
|
27
|
+
const shouldNegate = value & 1;
|
|
28
|
+
value >>>= 1;
|
|
29
|
+
if (shouldNegate) {
|
|
30
|
+
value = -0x80000000 | -value;
|
|
31
|
+
}
|
|
32
|
+
return relative + value;
|
|
33
|
+
}
|
|
34
|
+
function hasMoreVlq(reader, max) {
|
|
35
|
+
if (reader.pos >= max)
|
|
36
|
+
return false;
|
|
37
|
+
return reader.peek() !== comma;
|
|
38
|
+
}
|
|
39
|
+
class StringReader {
|
|
40
|
+
constructor(buffer) {
|
|
41
|
+
this.pos = 0;
|
|
42
|
+
this.buffer = buffer;
|
|
43
|
+
}
|
|
44
|
+
next() {
|
|
45
|
+
return this.buffer.charCodeAt(this.pos++);
|
|
46
|
+
}
|
|
47
|
+
peek() {
|
|
48
|
+
return this.buffer.charCodeAt(this.pos);
|
|
49
|
+
}
|
|
50
|
+
indexOf(char) {
|
|
51
|
+
const { buffer, pos } = this;
|
|
52
|
+
const idx = buffer.indexOf(char, pos);
|
|
53
|
+
return idx === -1 ? buffer.length : idx;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
17
57
|
function decode(mappings) {
|
|
18
|
-
const
|
|
58
|
+
const { length } = mappings;
|
|
59
|
+
const reader = new StringReader(mappings);
|
|
19
60
|
const decoded = [];
|
|
20
|
-
let
|
|
61
|
+
let genColumn = 0;
|
|
62
|
+
let sourcesIndex = 0;
|
|
63
|
+
let sourceLine = 0;
|
|
64
|
+
let sourceColumn = 0;
|
|
65
|
+
let namesIndex = 0;
|
|
21
66
|
do {
|
|
22
|
-
const semi = indexOf(
|
|
67
|
+
const semi = reader.indexOf(';');
|
|
23
68
|
const line = [];
|
|
24
69
|
let sorted = true;
|
|
25
70
|
let lastCol = 0;
|
|
26
|
-
|
|
27
|
-
|
|
71
|
+
genColumn = 0;
|
|
72
|
+
while (reader.pos < semi) {
|
|
28
73
|
let seg;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (col < lastCol)
|
|
74
|
+
genColumn = decodeInteger(reader, genColumn);
|
|
75
|
+
if (genColumn < lastCol)
|
|
32
76
|
sorted = false;
|
|
33
|
-
lastCol =
|
|
34
|
-
if (hasMoreVlq(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (hasMoreVlq(
|
|
39
|
-
|
|
40
|
-
seg = [
|
|
77
|
+
lastCol = genColumn;
|
|
78
|
+
if (hasMoreVlq(reader, semi)) {
|
|
79
|
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
|
80
|
+
sourceLine = decodeInteger(reader, sourceLine);
|
|
81
|
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
|
82
|
+
if (hasMoreVlq(reader, semi)) {
|
|
83
|
+
namesIndex = decodeInteger(reader, namesIndex);
|
|
84
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
|
|
41
85
|
}
|
|
42
86
|
else {
|
|
43
|
-
seg = [
|
|
87
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
|
44
88
|
}
|
|
45
89
|
}
|
|
46
90
|
else {
|
|
47
|
-
seg = [
|
|
91
|
+
seg = [genColumn];
|
|
48
92
|
}
|
|
49
93
|
line.push(seg);
|
|
94
|
+
reader.pos++;
|
|
50
95
|
}
|
|
51
96
|
if (!sorted)
|
|
52
97
|
sort(line);
|
|
53
98
|
decoded.push(line);
|
|
54
|
-
|
|
55
|
-
} while (
|
|
99
|
+
reader.pos = semi + 1;
|
|
100
|
+
} while (reader.pos <= length);
|
|
56
101
|
return decoded;
|
|
57
102
|
}
|
|
58
|
-
function indexOf(mappings, index) {
|
|
59
|
-
const idx = mappings.indexOf(';', index);
|
|
60
|
-
return idx === -1 ? mappings.length : idx;
|
|
61
|
-
}
|
|
62
|
-
function decodeInteger(mappings, pos, state, j) {
|
|
63
|
-
let value = 0;
|
|
64
|
-
let shift = 0;
|
|
65
|
-
let integer = 0;
|
|
66
|
-
do {
|
|
67
|
-
const c = mappings.charCodeAt(pos++);
|
|
68
|
-
integer = charToInt[c];
|
|
69
|
-
value |= (integer & 31) << shift;
|
|
70
|
-
shift += 5;
|
|
71
|
-
} while (integer & 32);
|
|
72
|
-
const shouldNegate = value & 1;
|
|
73
|
-
value >>>= 1;
|
|
74
|
-
if (shouldNegate) {
|
|
75
|
-
value = -0x80000000 | -value;
|
|
76
|
-
}
|
|
77
|
-
state[j] += value;
|
|
78
|
-
return pos;
|
|
79
|
-
}
|
|
80
|
-
function hasMoreVlq(mappings, i, length) {
|
|
81
|
-
if (i >= length)
|
|
82
|
-
return false;
|
|
83
|
-
return mappings.charCodeAt(i) !== comma;
|
|
84
|
-
}
|
|
85
103
|
function sort(line) {
|
|
86
104
|
line.sort(sortComparator$1);
|
|
87
105
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-node",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.1.0-beta.
|
|
4
|
+
"version": "2.1.0-beta.7",
|
|
5
5
|
"description": "Vite as Node.js runtime",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -80,12 +80,12 @@
|
|
|
80
80
|
"cac": "^6.7.14",
|
|
81
81
|
"debug": "^4.3.6",
|
|
82
82
|
"pathe": "^1.1.2",
|
|
83
|
-
"tinyrainbow": "^1.2.0",
|
|
84
83
|
"vite": "^5.0.0"
|
|
85
84
|
},
|
|
86
85
|
"devDependencies": {
|
|
87
86
|
"@jridgewell/trace-mapping": "^0.3.25",
|
|
88
|
-
"@types/debug": "^4.1.12"
|
|
87
|
+
"@types/debug": "^4.1.12",
|
|
88
|
+
"tinyrainbow": "^1.2.0"
|
|
89
89
|
},
|
|
90
90
|
"scripts": {
|
|
91
91
|
"build": "rimraf dist && rollup -c",
|