vite-node 5.2.0 → 6.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/README.md +3 -3
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +14 -18
- package/dist/client.d.mts +1 -1
- package/dist/client.mjs +502 -4
- package/dist/constants.mjs +33 -3
- package/dist/{dist-B2ebky9O.mjs → dist-2eHC7DTD.mjs} +26 -27
- package/dist/hmr.d.mts +1 -1
- package/dist/hmr.mjs +227 -5
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -3
- package/dist/{server-BWywEVuB.mjs → server-Bdy4M7lM.mjs} +14 -18
- package/dist/server.d.mts +1 -1
- package/dist/server.mjs +4 -7
- package/dist/{source-map-DQLD3K8K.mjs → source-map-BFKsz_pY.mjs} +47 -56
- package/dist/source-map.d.mts +1 -1
- package/dist/source-map.mjs +2 -4
- package/dist/{types-Dtew7m7O.d.mts → types-Bl6mw_Ii.d.mts} +69 -4
- package/dist/types.d.mts +1 -1
- package/dist/types.mjs +1 -3
- package/dist/utils.d.mts +1 -1
- package/dist/utils.mjs +188 -3
- package/package.json +19 -16
- package/dist/client-CyS7w_FB.mjs +0 -474
- package/dist/constants-DRkacFwN.mjs +0 -34
- package/dist/hmr-qEG3qSgW.mjs +0 -230
- package/dist/types-55T_-8KG.mjs +0 -1
- package/dist/utils-ExLpYVUV.mjs +0 -190
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
//#region node_modules/.pnpm/tinyrainbow@3.0
|
|
2
|
-
var
|
|
1
|
+
//#region node_modules/.pnpm/tinyrainbow@3.1.0/node_modules/tinyrainbow/dist/index.js
|
|
2
|
+
var b = {
|
|
3
3
|
reset: [0, 0],
|
|
4
4
|
bold: [
|
|
5
5
|
1,
|
|
@@ -50,36 +50,35 @@ var d = {
|
|
|
50
50
|
bgCyanBright: [106, 49],
|
|
51
51
|
bgWhiteBright: [107, 49]
|
|
52
52
|
};
|
|
53
|
-
function
|
|
53
|
+
function i(e) {
|
|
54
54
|
return String(e);
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
function
|
|
59
|
-
let e = typeof process != "undefined" ? process : void 0,
|
|
60
|
-
return !("NO_COLOR" in
|
|
56
|
+
i.open = "";
|
|
57
|
+
i.close = "";
|
|
58
|
+
function B() {
|
|
59
|
+
let e = typeof process != "undefined" ? process : void 0, r = (e == null ? void 0 : e.env) || {}, a = r.FORCE_TTY !== "false", l = (e == null ? void 0 : e.argv) || [];
|
|
60
|
+
return !("NO_COLOR" in r || l.includes("--no-color")) && ("FORCE_COLOR" in r || l.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || a && r.TERM !== "dumb" || "CI" in r) || typeof window != "undefined" && !!window.chrome;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
let
|
|
64
|
-
let
|
|
62
|
+
function C({ force: e } = {}) {
|
|
63
|
+
let r = e || B(), a = (t, o, u, n) => {
|
|
64
|
+
let g = "", s = 0;
|
|
65
65
|
do
|
|
66
|
-
|
|
67
|
-
while (~
|
|
68
|
-
return
|
|
69
|
-
},
|
|
70
|
-
let
|
|
71
|
-
let s = String(
|
|
72
|
-
return ~
|
|
66
|
+
g += t.substring(s, n) + u, s = n + o.length, n = t.indexOf(o, s);
|
|
67
|
+
while (~n);
|
|
68
|
+
return g + t.substring(s);
|
|
69
|
+
}, l = (t, o, u = t) => {
|
|
70
|
+
let n = (g) => {
|
|
71
|
+
let s = String(g), h = s.indexOf(o, t.length);
|
|
72
|
+
return ~h ? t + a(s, o, u, h) + o : t + s + o;
|
|
73
73
|
};
|
|
74
|
-
return
|
|
75
|
-
},
|
|
76
|
-
for (let
|
|
77
|
-
let
|
|
78
|
-
|
|
74
|
+
return n.open = t, n.close = o, n;
|
|
75
|
+
}, c = { isColorSupported: r }, f = (t) => `\x1B[${t}m`;
|
|
76
|
+
for (let t in b) {
|
|
77
|
+
let o = b[t];
|
|
78
|
+
c[t] = r ? l(f(o[0]), f(o[1]), o[2]) : i;
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return c;
|
|
81
81
|
}
|
|
82
|
-
var
|
|
83
|
-
|
|
82
|
+
var y = C();
|
|
84
83
|
//#endregion
|
|
85
|
-
export {
|
|
84
|
+
export { y as t };
|
package/dist/hmr.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as ViteNodeRunner, c as HotContext } from "./types-Bl6mw_Ii.mjs";
|
|
2
2
|
import { HMRPayload, Plugin } from "vite";
|
|
3
3
|
import { EventEmitter } from "node:events";
|
|
4
4
|
import { CustomEventMap } from "vite/types/customEvent.js";
|
package/dist/hmr.mjs
CHANGED
|
@@ -1,5 +1,227 @@
|
|
|
1
|
-
import "./dist-
|
|
2
|
-
import "./utils
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { t as y } from "./dist-2eHC7DTD.mjs";
|
|
2
|
+
import { normalizeRequestId } from "./utils.mjs";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
import { createDebug } from "obug";
|
|
5
|
+
import { EventEmitter } from "node:events";
|
|
6
|
+
//#region src/hmr/emitter.ts
|
|
7
|
+
function createHmrEmitter() {
|
|
8
|
+
return new EventEmitter();
|
|
9
|
+
}
|
|
10
|
+
function viteNodeHmrPlugin() {
|
|
11
|
+
const emitter = createHmrEmitter();
|
|
12
|
+
return {
|
|
13
|
+
name: "vite-node:hmr",
|
|
14
|
+
config() {
|
|
15
|
+
if (process.platform === "darwin" && process.env.VITE_TEST_WATCHER_DEBUG) return { server: { watch: {
|
|
16
|
+
useFsEvents: false,
|
|
17
|
+
usePolling: false
|
|
18
|
+
} } };
|
|
19
|
+
},
|
|
20
|
+
configureServer(server) {
|
|
21
|
+
const _send = server.ws.send;
|
|
22
|
+
server.emitter = emitter;
|
|
23
|
+
server.ws.send = function(payload) {
|
|
24
|
+
_send(payload);
|
|
25
|
+
emitter.emit("message", payload);
|
|
26
|
+
};
|
|
27
|
+
const environments = server.environments;
|
|
28
|
+
if (environments) environments.ssr.hot.send = function(payload) {
|
|
29
|
+
_send(payload);
|
|
30
|
+
emitter.emit("message", payload);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/hmr/hmr.ts
|
|
37
|
+
const debugHmr = createDebug("vite-node:hmr");
|
|
38
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
39
|
+
function getCache(runner) {
|
|
40
|
+
if (!cache.has(runner)) cache.set(runner, {
|
|
41
|
+
hotModulesMap: /* @__PURE__ */ new Map(),
|
|
42
|
+
dataMap: /* @__PURE__ */ new Map(),
|
|
43
|
+
disposeMap: /* @__PURE__ */ new Map(),
|
|
44
|
+
pruneMap: /* @__PURE__ */ new Map(),
|
|
45
|
+
customListenersMap: /* @__PURE__ */ new Map(),
|
|
46
|
+
ctxToListenersMap: /* @__PURE__ */ new Map(),
|
|
47
|
+
messageBuffer: [],
|
|
48
|
+
isFirstUpdate: false,
|
|
49
|
+
pending: false,
|
|
50
|
+
queued: []
|
|
51
|
+
});
|
|
52
|
+
return cache.get(runner);
|
|
53
|
+
}
|
|
54
|
+
function sendMessageBuffer(runner, emitter) {
|
|
55
|
+
const maps = getCache(runner);
|
|
56
|
+
maps.messageBuffer.forEach((msg) => emitter.emit("custom", msg));
|
|
57
|
+
maps.messageBuffer.length = 0;
|
|
58
|
+
}
|
|
59
|
+
async function reload(runner, files) {
|
|
60
|
+
[...runner.moduleCache.keys()].forEach((fsPath) => {
|
|
61
|
+
if (!fsPath.includes("node_modules")) runner.moduleCache.delete(fsPath);
|
|
62
|
+
});
|
|
63
|
+
return Promise.all(files.map((file) => runner.executeId(file)));
|
|
64
|
+
}
|
|
65
|
+
async function notifyListeners(runner, event, data) {
|
|
66
|
+
const cbs = getCache(runner).customListenersMap.get(event);
|
|
67
|
+
if (cbs) await Promise.all(cbs.map((cb) => cb(data)));
|
|
68
|
+
}
|
|
69
|
+
async function queueUpdate(runner, p) {
|
|
70
|
+
const maps = getCache(runner);
|
|
71
|
+
maps.queued.push(p);
|
|
72
|
+
if (!maps.pending) {
|
|
73
|
+
maps.pending = true;
|
|
74
|
+
await Promise.resolve();
|
|
75
|
+
maps.pending = false;
|
|
76
|
+
const loading = [...maps.queued];
|
|
77
|
+
maps.queued = [];
|
|
78
|
+
(await Promise.all(loading)).forEach((fn) => fn && fn());
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async function fetchUpdate(runner, { path, acceptedPath }) {
|
|
82
|
+
path = normalizeRequestId(path);
|
|
83
|
+
acceptedPath = normalizeRequestId(acceptedPath);
|
|
84
|
+
const maps = getCache(runner);
|
|
85
|
+
const mod = maps.hotModulesMap.get(path);
|
|
86
|
+
if (!mod) return;
|
|
87
|
+
const isSelfUpdate = path === acceptedPath;
|
|
88
|
+
let fetchedModule;
|
|
89
|
+
const qualifiedCallbacks = mod.callbacks.filter(({ deps }) => deps.includes(acceptedPath));
|
|
90
|
+
if (isSelfUpdate || qualifiedCallbacks.length > 0) {
|
|
91
|
+
const disposer = maps.disposeMap.get(acceptedPath);
|
|
92
|
+
if (disposer) await disposer(maps.dataMap.get(acceptedPath));
|
|
93
|
+
try {
|
|
94
|
+
[fetchedModule] = await reload(runner, [acceptedPath]);
|
|
95
|
+
} catch (e) {
|
|
96
|
+
warnFailedFetch(e, acceptedPath);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return () => {
|
|
100
|
+
for (const { deps, fn } of qualifiedCallbacks) fn(deps.map((dep) => dep === acceptedPath ? fetchedModule : void 0));
|
|
101
|
+
const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
|
|
102
|
+
console.log(`${y.cyan("[vite-node]")} hot updated: ${loggedPath}`);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function warnFailedFetch(err, path) {
|
|
106
|
+
if (!(err instanceof Error) || !err.message.match("fetch")) console.error(err);
|
|
107
|
+
console.error(`[hmr] Failed to reload ${path}. This could be due to syntax errors or importing non-existent modules. (see errors above)`);
|
|
108
|
+
}
|
|
109
|
+
async function handleMessage(runner, emitter, files, payload) {
|
|
110
|
+
const maps = getCache(runner);
|
|
111
|
+
switch (payload.type) {
|
|
112
|
+
case "connected":
|
|
113
|
+
sendMessageBuffer(runner, emitter);
|
|
114
|
+
break;
|
|
115
|
+
case "update":
|
|
116
|
+
await notifyListeners(runner, "vite:beforeUpdate", payload);
|
|
117
|
+
await Promise.all(payload.updates.map((update) => {
|
|
118
|
+
if (update.type === "js-update") return queueUpdate(runner, fetchUpdate(runner, update));
|
|
119
|
+
console.error(`${y.cyan("[vite-node]")} no support css hmr.}`);
|
|
120
|
+
return null;
|
|
121
|
+
}));
|
|
122
|
+
await notifyListeners(runner, "vite:afterUpdate", payload);
|
|
123
|
+
break;
|
|
124
|
+
case "full-reload":
|
|
125
|
+
await notifyListeners(runner, "vite:beforeFullReload", payload);
|
|
126
|
+
maps.customListenersMap.delete("vite:beforeFullReload");
|
|
127
|
+
await reload(runner, files);
|
|
128
|
+
break;
|
|
129
|
+
case "custom":
|
|
130
|
+
await notifyListeners(runner, payload.event, payload.data);
|
|
131
|
+
break;
|
|
132
|
+
case "prune":
|
|
133
|
+
await notifyListeners(runner, "vite:beforePrune", payload);
|
|
134
|
+
payload.paths.forEach((path) => {
|
|
135
|
+
const fn = maps.pruneMap.get(path);
|
|
136
|
+
if (fn) fn(maps.dataMap.get(path));
|
|
137
|
+
});
|
|
138
|
+
break;
|
|
139
|
+
case "error": {
|
|
140
|
+
await notifyListeners(runner, "vite:error", payload);
|
|
141
|
+
const err = payload.err;
|
|
142
|
+
console.error(`${y.cyan("[vite-node]")} Internal Server Error\n${err.message}\n${err.stack}`);
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function createHotContext(runner, emitter, files, ownerPath) {
|
|
148
|
+
debugHmr("createHotContext", ownerPath);
|
|
149
|
+
const maps = getCache(runner);
|
|
150
|
+
if (!maps.dataMap.has(ownerPath)) maps.dataMap.set(ownerPath, {});
|
|
151
|
+
const mod = maps.hotModulesMap.get(ownerPath);
|
|
152
|
+
if (mod) mod.callbacks = [];
|
|
153
|
+
const newListeners = /* @__PURE__ */ new Map();
|
|
154
|
+
maps.ctxToListenersMap.set(ownerPath, newListeners);
|
|
155
|
+
function acceptDeps(deps, callback = () => {}) {
|
|
156
|
+
const mod = maps.hotModulesMap.get(ownerPath) || {
|
|
157
|
+
id: ownerPath,
|
|
158
|
+
callbacks: []
|
|
159
|
+
};
|
|
160
|
+
mod.callbacks.push({
|
|
161
|
+
deps,
|
|
162
|
+
fn: callback
|
|
163
|
+
});
|
|
164
|
+
maps.hotModulesMap.set(ownerPath, mod);
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
get data() {
|
|
168
|
+
return maps.dataMap.get(ownerPath);
|
|
169
|
+
},
|
|
170
|
+
acceptExports(_, callback) {
|
|
171
|
+
acceptDeps([ownerPath], callback && (([mod]) => callback(mod)));
|
|
172
|
+
},
|
|
173
|
+
accept(deps, callback) {
|
|
174
|
+
if (typeof deps === "function" || !deps) acceptDeps([ownerPath], ([mod]) => deps && deps(mod));
|
|
175
|
+
else if (typeof deps === "string") acceptDeps([deps], ([mod]) => callback && callback(mod));
|
|
176
|
+
else if (Array.isArray(deps)) acceptDeps(deps, callback);
|
|
177
|
+
else throw new TypeError("invalid hot.accept() usage.");
|
|
178
|
+
},
|
|
179
|
+
dispose(cb) {
|
|
180
|
+
maps.disposeMap.set(ownerPath, cb);
|
|
181
|
+
},
|
|
182
|
+
prune(cb) {
|
|
183
|
+
maps.pruneMap.set(ownerPath, cb);
|
|
184
|
+
},
|
|
185
|
+
invalidate() {
|
|
186
|
+
notifyListeners(runner, "vite:invalidate", {
|
|
187
|
+
path: ownerPath,
|
|
188
|
+
message: void 0,
|
|
189
|
+
firstInvalidatedBy: ownerPath
|
|
190
|
+
});
|
|
191
|
+
return reload(runner, files);
|
|
192
|
+
},
|
|
193
|
+
on(event, cb) {
|
|
194
|
+
const addToMap = (map) => {
|
|
195
|
+
const existing = map.get(event) || [];
|
|
196
|
+
existing.push(cb);
|
|
197
|
+
map.set(event, existing);
|
|
198
|
+
};
|
|
199
|
+
addToMap(maps.customListenersMap);
|
|
200
|
+
addToMap(newListeners);
|
|
201
|
+
},
|
|
202
|
+
off(event, cb) {
|
|
203
|
+
const removeFromMap = (map) => {
|
|
204
|
+
const existing = map.get(event);
|
|
205
|
+
if (existing === void 0) return;
|
|
206
|
+
const pruned = existing.filter((l) => l !== cb);
|
|
207
|
+
if (pruned.length === 0) {
|
|
208
|
+
map.delete(event);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
map.set(event, pruned);
|
|
212
|
+
};
|
|
213
|
+
removeFromMap(maps.customListenersMap);
|
|
214
|
+
removeFromMap(newListeners);
|
|
215
|
+
},
|
|
216
|
+
send(event, data) {
|
|
217
|
+
maps.messageBuffer.push(JSON.stringify({
|
|
218
|
+
type: "custom",
|
|
219
|
+
event,
|
|
220
|
+
data
|
|
221
|
+
}));
|
|
222
|
+
sendMessageBuffer(runner, emitter);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
//#endregion
|
|
227
|
+
export { createHmrEmitter, createHotContext, getCache, handleMessage, reload, sendMessageBuffer, viteNodeHmrPlugin };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as DecodedSourceMap, T as SourceMapInput, _ as ViteNodeServerOptions, a as DepsHandlingOptions, b as ModuleExecutionInfo, c as HotContext, d as RawSourceMap, f as ResolveIdFunction, g as ViteNodeRunnerOptions, h as ViteNodeResolveModule, i as DebuggerOptions, l as ModuleCache, m as ViteNodeResolveId, n as Awaitable, o as FetchFunction, p as StartOfSourceMap, r as CreateHotContextFunction, s as FetchResult, t as Arrayable, u as Nullable, w as EncodedSourceMap, y as ModuleCacheMap } from "./types-Bl6mw_Ii.mjs";
|
|
2
2
|
export { Arrayable, Awaitable, CreateHotContextFunction, DebuggerOptions, DecodedSourceMap, DepsHandlingOptions, EncodedSourceMap, FetchFunction, FetchResult, HotContext, ModuleCache, ModuleCacheMap, ModuleExecutionInfo, Nullable, RawSourceMap, ResolveIdFunction, SourceMapInput, StartOfSourceMap, ViteNodeResolveId, ViteNodeResolveModule, ViteNodeRunnerOptions, ViteNodeServerOptions };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import "./types
|
|
2
|
-
|
|
3
|
-
export { };
|
|
1
|
+
import "./types.mjs";
|
|
2
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { r as withInlineSourcemap } from "./source-map-
|
|
1
|
+
import { t as y } from "./dist-2eHC7DTD.mjs";
|
|
2
|
+
import { KNOWN_ASSET_RE } from "./constants.mjs";
|
|
3
|
+
import { findNearestPackageData, isNodeBuiltin, normalizeModuleId, slash, toArray, toFilePath, withTrailingSlash } from "./utils.mjs";
|
|
4
|
+
import { r as withInlineSourcemap } from "./source-map-BFKsz_pY.mjs";
|
|
5
5
|
import assert from "node:assert";
|
|
6
6
|
import { existsSync, promises } from "node:fs";
|
|
7
7
|
import { performance } from "node:perf_hooks";
|
|
@@ -11,7 +11,6 @@ import { createDebug } from "obug";
|
|
|
11
11
|
import { dirname, extname, join, normalize, relative, resolve } from "pathe";
|
|
12
12
|
import { version } from "vite";
|
|
13
13
|
import * as esModuleLexer from "es-module-lexer";
|
|
14
|
-
|
|
15
14
|
//#region src/debug.ts
|
|
16
15
|
function hashCode(s) {
|
|
17
16
|
return s.split("").reduce((a, b) => {
|
|
@@ -26,8 +25,8 @@ var Debugger = class {
|
|
|
26
25
|
constructor(root, options) {
|
|
27
26
|
this.options = options;
|
|
28
27
|
if (options.dumpModules) this.dumpDir = resolve(root, options.dumpModules === true ? ".vite-node/dump" : options.dumpModules);
|
|
29
|
-
if (this.dumpDir) if (options.loadDumppedModules) console.info(
|
|
30
|
-
else console.info(
|
|
28
|
+
if (this.dumpDir) if (options.loadDumppedModules) console.info(y.gray(`[vite-node] [debug] load modules from ${this.dumpDir}`));
|
|
29
|
+
else console.info(y.gray(`[vite-node] [debug] dump modules to ${this.dumpDir}`));
|
|
31
30
|
this.initPromise = this.clearDump();
|
|
32
31
|
}
|
|
33
32
|
async clearDump() {
|
|
@@ -72,7 +71,6 @@ var Debugger = class {
|
|
|
72
71
|
return promises.writeFile(join(this.dumpDir, "info.json"), info, "utf-8");
|
|
73
72
|
}
|
|
74
73
|
};
|
|
75
|
-
|
|
76
74
|
//#endregion
|
|
77
75
|
//#region src/externalize.ts
|
|
78
76
|
const BUILTIN_EXTENSIONS = new Set([
|
|
@@ -91,7 +89,7 @@ const defaultInline = [
|
|
|
91
89
|
];
|
|
92
90
|
const depsExternal = [/\/node_modules\/.*\.cjs\.js$/, /\/node_modules\/.*\.mjs$/];
|
|
93
91
|
function guessCJSversion(id) {
|
|
94
|
-
if (
|
|
92
|
+
if (ESM_EXT_RE.test(id)) {
|
|
95
93
|
for (const i of [
|
|
96
94
|
id.replace(ESM_EXT_RE, ".mjs"),
|
|
97
95
|
id.replace(ESM_EXT_RE, ".umd.js"),
|
|
@@ -99,7 +97,7 @@ function guessCJSversion(id) {
|
|
|
99
97
|
id.replace(ESM_EXT_RE, ".js")
|
|
100
98
|
]) if (existsSync(i)) return i;
|
|
101
99
|
}
|
|
102
|
-
if (
|
|
100
|
+
if (ESM_FOLDER_RE.test(id)) {
|
|
103
101
|
for (const i of [
|
|
104
102
|
id.replace(ESM_FOLDER_RE, "/umd/$1"),
|
|
105
103
|
id.replace(ESM_FOLDER_RE, "/cjs/$1"),
|
|
@@ -154,11 +152,10 @@ function matchExternalizePattern(id, moduleDirectories, patterns) {
|
|
|
154
152
|
return false;
|
|
155
153
|
}
|
|
156
154
|
function patchWindowsImportPath(path) {
|
|
157
|
-
if (
|
|
158
|
-
else if (
|
|
155
|
+
if (/^\w:\\/.test(path)) return `file:///${slash(path)}`;
|
|
156
|
+
else if (/^\w:\//.test(path)) return `file:///${path}`;
|
|
159
157
|
else return path;
|
|
160
158
|
}
|
|
161
|
-
|
|
162
159
|
//#endregion
|
|
163
160
|
//#region src/server.ts
|
|
164
161
|
const debugRequest = createDebug("vite-node:server:request");
|
|
@@ -231,10 +228,10 @@ var ViteNodeServer = class {
|
|
|
231
228
|
this.existingOptimizedDeps.add(id);
|
|
232
229
|
return true;
|
|
233
230
|
}
|
|
234
|
-
return new Promise((resolve
|
|
231
|
+
return new Promise((resolve) => {
|
|
235
232
|
setTimeout(() => {
|
|
236
233
|
this.ensureExists(id).then(() => {
|
|
237
|
-
resolve
|
|
234
|
+
resolve(true);
|
|
238
235
|
});
|
|
239
236
|
});
|
|
240
237
|
});
|
|
@@ -289,7 +286,7 @@ var ViteNodeServer = class {
|
|
|
289
286
|
const withoutQuery = id.split("?")[0];
|
|
290
287
|
if (this.options.transformMode?.web?.some((r) => withoutQuery.match(r))) return "web";
|
|
291
288
|
if (this.options.transformMode?.ssr?.some((r) => withoutQuery.match(r))) return "ssr";
|
|
292
|
-
if (
|
|
289
|
+
if (/\.(?:[cm]?[jt]sx?|json)$/.test(withoutQuery)) return "ssr";
|
|
293
290
|
return "web";
|
|
294
291
|
}
|
|
295
292
|
getChangedModule(id, file) {
|
|
@@ -373,6 +370,5 @@ var ViteNodeServer = class {
|
|
|
373
370
|
return result;
|
|
374
371
|
}
|
|
375
372
|
};
|
|
376
|
-
|
|
377
373
|
//#endregion
|
|
378
|
-
export { guessCJSversion as n, shouldExternalize as r, ViteNodeServer as t };
|
|
374
|
+
export { guessCJSversion as n, shouldExternalize as r, ViteNodeServer as t };
|
package/dist/server.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as ViteNodeServerOptions, a as DepsHandlingOptions, i as DebuggerOptions, m as ViteNodeResolveId, s as FetchResult, w as EncodedSourceMap } from "./types-Bl6mw_Ii.mjs";
|
|
2
2
|
import { TransformResult, ViteDevServer } from "vite";
|
|
3
3
|
|
|
4
4
|
//#region src/debug.d.ts
|
package/dist/server.mjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import "./dist-
|
|
2
|
-
import { n as guessCJSversion, r as shouldExternalize, t as ViteNodeServer } from "./server-
|
|
3
|
-
import "./
|
|
4
|
-
|
|
5
|
-
import "./source-map-DQLD3K8K.mjs";
|
|
6
|
-
|
|
7
|
-
export { ViteNodeServer, guessCJSversion, shouldExternalize };
|
|
1
|
+
import "./dist-2eHC7DTD.mjs";
|
|
2
|
+
import { n as guessCJSversion, r as shouldExternalize, t as ViteNodeServer } from "./server-Bdy4M7lM.mjs";
|
|
3
|
+
import "./source-map-BFKsz_pY.mjs";
|
|
4
|
+
export { ViteNodeServer, guessCJSversion, shouldExternalize };
|