vite-node 5.1.0 → 5.3.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/dist/cli.d.mts +21 -0
- package/dist/cli.mjs +145 -0
- package/dist/{client.js → client-C7yCjfvf.mjs} +85 -87
- package/dist/client.d.mts +2 -0
- package/dist/client.mjs +5 -0
- package/dist/{constants.js → constants-DRkacFwN.mjs} +3 -1
- package/dist/{constants.d.ts → constants.d.mts} +3 -2
- package/dist/constants.mjs +3 -0
- package/dist/dist-B2ebky9O.mjs +85 -0
- package/dist/{chunk-hmr.js → hmr-qEG3qSgW.mjs} +17 -29
- package/dist/hmr.d.mts +57 -0
- package/dist/hmr.mjs +5 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +3 -0
- package/dist/{server.js → server-Bk_vRgMj.mjs} +52 -87
- package/dist/server.d.mts +60 -0
- package/dist/server.mjs +7 -0
- package/dist/source-map-CysB5F9m.mjs +737 -0
- package/dist/{source-map.d.ts → source-map.d.mts} +9 -8
- package/dist/source-map.mjs +4 -0
- package/dist/types-55T_-8KG.mjs +1 -0
- package/dist/types-EZz9rsDw.d.mts +217 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.mjs +3 -0
- package/dist/{utils.js → utils-ExLpYVUV.mjs} +10 -18
- package/dist/{utils.d.ts → utils.d.mts} +7 -7
- package/dist/utils.mjs +3 -0
- package/package.json +29 -36
- package/dist/chunk-index.js +0 -82
- package/dist/cli.d.ts +0 -21
- package/dist/cli.js +0 -162
- package/dist/client.d.ts +0 -2
- package/dist/hmr.d.ts +0 -55
- package/dist/hmr.js +0 -10
- package/dist/index.d-D6Pqey3g.d.ts +0 -367
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -1
- package/dist/server.d.ts +0 -58
- package/dist/source-map.js +0 -919
- package/dist/trace-mapping.d-BWFx6tPc.d.ts +0 -62
- package/dist/types.d.ts +0 -2
- package/dist/types.js +0 -1
- package/vite-node.js +0 -2
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { s as EncodedSourceMap } from "./types-EZz9rsDw.mjs";
|
|
2
|
+
import { TransformResult } from "vite";
|
|
3
3
|
|
|
4
|
+
//#region src/source-map.d.ts
|
|
4
5
|
interface InstallSourceMapSupportOptions {
|
|
5
|
-
|
|
6
|
+
getSourceMap: (source: string) => EncodedSourceMap | null | undefined;
|
|
6
7
|
}
|
|
7
8
|
declare function withInlineSourcemap(result: TransformResult, options: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
root: string;
|
|
10
|
+
filepath: string;
|
|
11
|
+
noFirstLineMapping?: boolean;
|
|
11
12
|
}): TransformResult;
|
|
12
13
|
declare function extractSourceMap(code: string): EncodedSourceMap | null;
|
|
13
14
|
declare function installSourcemapsSupport(options: InstallSourceMapSupportOptions): void;
|
|
14
|
-
|
|
15
|
-
export { extractSourceMap, installSourcemapsSupport, withInlineSourcemap };
|
|
15
|
+
//#endregion
|
|
16
|
+
export { extractSourceMap, installSourcemapsSupport, withInlineSourcemap };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import * as _jridgewell_trace_mapping0 from "@jridgewell/trace-mapping";
|
|
2
|
+
import { DecodedSourceMap, EncodedSourceMap, EncodedSourceMap as EncodedSourceMap$1, SourceMapInput } from "@jridgewell/trace-mapping";
|
|
3
|
+
import { ViteHotContext } from "vite/types/hot.js";
|
|
4
|
+
|
|
5
|
+
//#region src/client.d.ts
|
|
6
|
+
declare const DEFAULT_REQUEST_STUBS: Record<string, Record<string, unknown>>;
|
|
7
|
+
declare class ModuleCacheMap extends Map<string, ModuleCache> {
|
|
8
|
+
normalizePath(fsPath: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Assign partial data to the map
|
|
11
|
+
*/
|
|
12
|
+
update(fsPath: string, mod: ModuleCache): this;
|
|
13
|
+
setByModuleId(modulePath: string, mod: ModuleCache): this;
|
|
14
|
+
set(fsPath: string, mod: ModuleCache): this;
|
|
15
|
+
getByModuleId(modulePath: string): ModuleCache & Required<Pick<ModuleCache, "imports" | "importers">>;
|
|
16
|
+
get(fsPath: string): ModuleCache & Required<Pick<ModuleCache, "importers" | "imports">>;
|
|
17
|
+
deleteByModuleId(modulePath: string): boolean;
|
|
18
|
+
delete(fsPath: string): boolean;
|
|
19
|
+
invalidateModule(mod: ModuleCache): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Invalidate modules that dependent on the given modules, up to the main entry
|
|
22
|
+
*/
|
|
23
|
+
invalidateDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Invalidate dependency modules of the given modules, down to the bottom-level dependencies
|
|
26
|
+
*/
|
|
27
|
+
invalidateSubDepTree(ids: string[] | Set<string>, invalidated?: Set<string>): Set<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Return parsed source map based on inlined source map of the module
|
|
30
|
+
*/
|
|
31
|
+
getSourceMap(id: string): _jridgewell_trace_mapping0.EncodedSourceMap | null;
|
|
32
|
+
}
|
|
33
|
+
type ModuleExecutionInfo = Map<string, ModuleExecutionInfoEntry>;
|
|
34
|
+
interface ModuleExecutionInfoEntry {
|
|
35
|
+
startOffset: number;
|
|
36
|
+
/** The duration that was spent executing the module. */
|
|
37
|
+
duration: number;
|
|
38
|
+
/** The time that was spent executing the module itself and externalized imports. */
|
|
39
|
+
selfTime: number;
|
|
40
|
+
}
|
|
41
|
+
declare class ViteNodeRunner {
|
|
42
|
+
options: ViteNodeRunnerOptions;
|
|
43
|
+
root: string;
|
|
44
|
+
debug: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Holds the cache of modules
|
|
47
|
+
* Keys of the map are filepaths, or plain package names
|
|
48
|
+
*/
|
|
49
|
+
moduleCache: ModuleCacheMap;
|
|
50
|
+
/**
|
|
51
|
+
* Tracks the stack of modules being executed for the purpose of calculating import self-time.
|
|
52
|
+
*
|
|
53
|
+
* Note that while in most cases, imports are a linear stack of modules,
|
|
54
|
+
* this is occasionally not the case, for example when you have parallel top-level dynamic imports like so:
|
|
55
|
+
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* await Promise.all([
|
|
58
|
+
* import('./module1'),
|
|
59
|
+
* import('./module2'),
|
|
60
|
+
* ]);
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* In this case, the self time will be reported incorrectly for one of the modules (could go negative).
|
|
64
|
+
* As top-level awaits with dynamic imports like this are uncommon, we don't handle this case specifically.
|
|
65
|
+
*/
|
|
66
|
+
private executionStack;
|
|
67
|
+
private performanceNow;
|
|
68
|
+
constructor(options: ViteNodeRunnerOptions);
|
|
69
|
+
executeFile(file: string): Promise<any>;
|
|
70
|
+
executeId(rawId: string): Promise<any>;
|
|
71
|
+
shouldResolveId(id: string, _importee?: string): boolean;
|
|
72
|
+
private _resolveUrl;
|
|
73
|
+
resolveUrl(id: string, importee?: string): Promise<[url: string, fsPath: string]>;
|
|
74
|
+
private _fetchModule;
|
|
75
|
+
protected getContextPrimitives(): {
|
|
76
|
+
Object: ObjectConstructor;
|
|
77
|
+
Reflect: typeof Reflect;
|
|
78
|
+
Symbol: SymbolConstructor;
|
|
79
|
+
};
|
|
80
|
+
protected runModule(context: Record<string, any>, transformed: string): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* mutate the given error to have fixed stacktraces based on source maps
|
|
83
|
+
* Does the same thing as Vite's ssrFixStacktrace
|
|
84
|
+
*/
|
|
85
|
+
ssrFixStacktrace(error: Error): Promise<Error>;
|
|
86
|
+
/**
|
|
87
|
+
* Starts calculating the module execution info such as the total duration and self time spent on executing the module.
|
|
88
|
+
* Returns a function to call once the module has finished executing.
|
|
89
|
+
*/
|
|
90
|
+
protected startCalculateModuleExecutionInfo(filename: string, startOffset: number): () => ModuleExecutionInfoEntry;
|
|
91
|
+
prepareContext(context: Record<string, any>): Record<string, any>;
|
|
92
|
+
/**
|
|
93
|
+
* Define if a module should be interop-ed
|
|
94
|
+
* This function mostly for the ability to override by subclass
|
|
95
|
+
*/
|
|
96
|
+
shouldInterop(path: string, mod: any): boolean;
|
|
97
|
+
protected importExternalModule(path: string): Promise<any>;
|
|
98
|
+
/**
|
|
99
|
+
* Import a module and interop it
|
|
100
|
+
*/
|
|
101
|
+
interopedImport(path: string): Promise<any>;
|
|
102
|
+
}
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/types.d.ts
|
|
105
|
+
type Nullable<T> = T | null | undefined;
|
|
106
|
+
type Arrayable<T> = T | Array<T>;
|
|
107
|
+
type Awaitable<T> = T | PromiseLike<T>;
|
|
108
|
+
interface DepsHandlingOptions {
|
|
109
|
+
external?: (string | RegExp)[];
|
|
110
|
+
inline?: (string | RegExp)[] | true;
|
|
111
|
+
inlineFiles?: string[];
|
|
112
|
+
/**
|
|
113
|
+
* A list of directories that are considered to hold Node.js modules
|
|
114
|
+
* Have to include "/" at the start and end of the path
|
|
115
|
+
*
|
|
116
|
+
* Vite-Node checks the whole absolute path of the import, so make sure you don't include
|
|
117
|
+
* unwanted files accidentally
|
|
118
|
+
* @default ['/node_modules/']
|
|
119
|
+
*/
|
|
120
|
+
moduleDirectories?: string[];
|
|
121
|
+
cacheDir?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Try to guess the CJS version of a package when it's invalid ESM
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
126
|
+
fallbackCJS?: boolean;
|
|
127
|
+
}
|
|
128
|
+
interface StartOfSourceMap {
|
|
129
|
+
file?: string;
|
|
130
|
+
sourceRoot?: string;
|
|
131
|
+
}
|
|
132
|
+
interface RawSourceMap extends StartOfSourceMap {
|
|
133
|
+
version: number;
|
|
134
|
+
sources: string[];
|
|
135
|
+
names: string[];
|
|
136
|
+
sourcesContent?: (string | null)[];
|
|
137
|
+
mappings: string;
|
|
138
|
+
}
|
|
139
|
+
interface FetchResult {
|
|
140
|
+
code?: string;
|
|
141
|
+
externalize?: string;
|
|
142
|
+
map?: EncodedSourceMap | null;
|
|
143
|
+
}
|
|
144
|
+
type HotContext = Omit<ViteHotContext, "acceptDeps" | "decline">;
|
|
145
|
+
type FetchFunction = (id: string) => Promise<FetchResult>;
|
|
146
|
+
type ResolveIdFunction = (id: string, importer?: string) => Awaitable<ViteNodeResolveId | null | undefined | void>;
|
|
147
|
+
type CreateHotContextFunction = (runner: ViteNodeRunner, url: string) => HotContext;
|
|
148
|
+
interface ModuleCache {
|
|
149
|
+
promise?: Promise<any>;
|
|
150
|
+
exports?: any;
|
|
151
|
+
evaluated?: boolean;
|
|
152
|
+
resolving?: boolean;
|
|
153
|
+
code?: string;
|
|
154
|
+
map?: EncodedSourceMap;
|
|
155
|
+
/**
|
|
156
|
+
* Module ids that imports this module
|
|
157
|
+
*/
|
|
158
|
+
importers?: Set<string>;
|
|
159
|
+
imports?: Set<string>;
|
|
160
|
+
}
|
|
161
|
+
interface ViteNodeRunnerOptions {
|
|
162
|
+
root: string;
|
|
163
|
+
fetchModule: FetchFunction;
|
|
164
|
+
resolveId?: ResolveIdFunction;
|
|
165
|
+
createHotContext?: CreateHotContextFunction;
|
|
166
|
+
base?: string;
|
|
167
|
+
moduleCache?: ModuleCacheMap;
|
|
168
|
+
moduleExecutionInfo?: ModuleExecutionInfo;
|
|
169
|
+
interopDefault?: boolean;
|
|
170
|
+
requestStubs?: Record<string, any>;
|
|
171
|
+
debug?: boolean;
|
|
172
|
+
}
|
|
173
|
+
interface ViteNodeResolveId {
|
|
174
|
+
external?: boolean | "absolute" | "relative";
|
|
175
|
+
id: string;
|
|
176
|
+
meta?: Record<string, any> | null;
|
|
177
|
+
moduleSideEffects?: boolean | "no-treeshake" | null;
|
|
178
|
+
syntheticNamedExports?: boolean | string | null;
|
|
179
|
+
}
|
|
180
|
+
interface ViteNodeResolveModule {
|
|
181
|
+
external: string | null;
|
|
182
|
+
id: string;
|
|
183
|
+
fsPath: string;
|
|
184
|
+
}
|
|
185
|
+
interface ViteNodeServerOptions {
|
|
186
|
+
/**
|
|
187
|
+
* Inject inline sourcemap to modules
|
|
188
|
+
* @default 'inline'
|
|
189
|
+
*/
|
|
190
|
+
sourcemap?: "inline" | boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Deps handling
|
|
193
|
+
*/
|
|
194
|
+
deps?: DepsHandlingOptions;
|
|
195
|
+
/**
|
|
196
|
+
* Transform method for modules
|
|
197
|
+
*/
|
|
198
|
+
transformMode?: {
|
|
199
|
+
ssr?: RegExp[];
|
|
200
|
+
web?: RegExp[];
|
|
201
|
+
};
|
|
202
|
+
debug?: DebuggerOptions;
|
|
203
|
+
}
|
|
204
|
+
interface DebuggerOptions {
|
|
205
|
+
/**
|
|
206
|
+
* Dump the transformed module to filesystem
|
|
207
|
+
* Passing a string will dump to the specified path
|
|
208
|
+
*/
|
|
209
|
+
dumpModules?: boolean | string;
|
|
210
|
+
/**
|
|
211
|
+
* Read dumpped module from filesystem whenever exists.
|
|
212
|
+
* Useful for debugging by modifying the dump result from the filesystem.
|
|
213
|
+
*/
|
|
214
|
+
loadDumppedModules?: boolean;
|
|
215
|
+
}
|
|
216
|
+
//#endregion
|
|
217
|
+
export { ModuleExecutionInfo as C, ModuleCacheMap as S, ViteNodeRunner as T, ViteNodeResolveId as _, DecodedSourceMap as a, ViteNodeServerOptions as b, FetchFunction as c, ModuleCache as d, Nullable as f, StartOfSourceMap as g, SourceMapInput as h, DebuggerOptions as i, FetchResult as l, ResolveIdFunction as m, Awaitable as n, DepsHandlingOptions as o, RawSourceMap as p, CreateHotContextFunction as r, EncodedSourceMap$1 as s, Arrayable as t, HotContext as u, ViteNodeResolveModule as v, ModuleExecutionInfoEntry as w, DEFAULT_REQUEST_STUBS as x, ViteNodeRunnerOptions as y };
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { C as ModuleExecutionInfo, S as ModuleCacheMap, _ as ViteNodeResolveId, a as DecodedSourceMap, b as ViteNodeServerOptions, c as FetchFunction, d as ModuleCache, f as Nullable, g as StartOfSourceMap, h as SourceMapInput, i as DebuggerOptions, l as FetchResult, m as ResolveIdFunction, n as Awaitable, o as DepsHandlingOptions, p as RawSourceMap, r as CreateHotContextFunction, s as EncodedSourceMap, t as Arrayable, u as HotContext, v as ViteNodeResolveModule, y as ViteNodeRunnerOptions } from "./types-EZz9rsDw.mjs";
|
|
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/types.mjs
ADDED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import process from
|
|
4
|
-
import { fileURLToPath, pathToFileURL } from
|
|
5
|
-
import {
|
|
1
|
+
import { builtinModules } from "node:module";
|
|
2
|
+
import { existsSync, promises } from "node:fs";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
+
import { dirname, join, resolve } from "pathe";
|
|
6
6
|
|
|
7
|
+
//#region src/utils.ts
|
|
7
8
|
const isWindows = process.platform === "win32";
|
|
8
9
|
const drive = isWindows ? process.cwd()[0] : null;
|
|
9
10
|
const driveOpposite = drive ? drive === drive.toUpperCase() ? drive.toLowerCase() : drive.toUpperCase() : null;
|
|
@@ -19,12 +20,8 @@ function isBareImport(id) {
|
|
|
19
20
|
const VALID_ID_PREFIX = "/@id/";
|
|
20
21
|
function normalizeRequestId(id, base) {
|
|
21
22
|
if (base && id.startsWith(withTrailingSlash(base))) id = `/${id.slice(base.length)}`;
|
|
22
|
-
|
|
23
|
-
// Vite always resolves drive letters to the upper case because of the use of `realpathSync`
|
|
24
|
-
// https://github.com/vitejs/vite/blob/0ab20a3ee26eacf302415b3087732497d0a2f358/packages/vite/src/node/utils.ts#L635
|
|
25
|
-
if (driveRegexp && !(driveRegexp === null || driveRegexp === void 0 ? void 0 : driveRegexp.test(id)) && (driveOppositeRegext === null || driveOppositeRegext === void 0 ? void 0 : driveOppositeRegext.test(id))) id = id.replace(driveOppositeRegext, `${drive}$1`);
|
|
23
|
+
if (driveRegexp && !driveRegexp?.test(id) && driveOppositeRegext?.test(id)) id = id.replace(driveOppositeRegext, `${drive}$1`);
|
|
26
24
|
if (id.startsWith("file://")) {
|
|
27
|
-
// preserve hash/query
|
|
28
25
|
const { file, postfix } = splitFileAndPostfix(id);
|
|
29
26
|
return fileURLToPath(file) + postfix;
|
|
30
27
|
}
|
|
@@ -45,7 +42,6 @@ const internalRequestRegexp = /* @__PURE__ */ new RegExp(`^/?(?:${["@vite/client
|
|
|
45
42
|
function isInternalRequest(id) {
|
|
46
43
|
return internalRequestRegexp.test(id);
|
|
47
44
|
}
|
|
48
|
-
// https://nodejs.org/api/modules.html#built-in-modules-with-mandatory-node-prefix
|
|
49
45
|
const prefixedBuiltins = new Set([
|
|
50
46
|
"node:sea",
|
|
51
47
|
"node:sqlite",
|
|
@@ -69,7 +65,6 @@ const builtins = new Set([
|
|
|
69
65
|
"wasi"
|
|
70
66
|
]);
|
|
71
67
|
function normalizeModuleId(id) {
|
|
72
|
-
// unique id that is not available as "test"
|
|
73
68
|
if (prefixedBuiltins.has(id)) return id;
|
|
74
69
|
if (id.startsWith("file://")) return fileURLToPath(id);
|
|
75
70
|
return id.replace(/\\/g, "/").replace(/^\/@fs\//, isWindows ? "" : "/").replace(/^node:/, "").replace(/^\/+/, "/");
|
|
@@ -83,7 +78,6 @@ function toFilePath(id, root) {
|
|
|
83
78
|
absolute: id.slice(4),
|
|
84
79
|
exists: true
|
|
85
80
|
};
|
|
86
|
-
// check if /src/module.js -> <root>/src/module.js
|
|
87
81
|
if (!id.startsWith(withTrailingSlash(root)) && id.startsWith("/")) {
|
|
88
82
|
const resolved = resolve(root, id.slice(1));
|
|
89
83
|
if (existsSync(cleanUrl(resolved))) return {
|
|
@@ -100,7 +94,6 @@ function toFilePath(id, root) {
|
|
|
100
94
|
};
|
|
101
95
|
})();
|
|
102
96
|
if (absolute.startsWith("//")) absolute = absolute.slice(1);
|
|
103
|
-
// disambiguate the `<UNIT>:/` on windows: see nodejs/node#31710
|
|
104
97
|
return {
|
|
105
98
|
path: isWindows && absolute.startsWith("/") ? slash(fileURLToPath(pathToFileURL(absolute.slice(1)).href)) : absolute,
|
|
106
99
|
exists
|
|
@@ -155,7 +148,6 @@ function withTrailingSlash(path) {
|
|
|
155
148
|
return path;
|
|
156
149
|
}
|
|
157
150
|
function createImportMetaEnvProxy() {
|
|
158
|
-
// packages/vitest/src/node/plugins/index.ts:146
|
|
159
151
|
const booleanKeys = [
|
|
160
152
|
"DEV",
|
|
161
153
|
"PROD",
|
|
@@ -179,11 +171,10 @@ const packageCache = /* @__PURE__ */ new Map();
|
|
|
179
171
|
async function findNearestPackageData(basedir) {
|
|
180
172
|
const originalBasedir = basedir;
|
|
181
173
|
while (basedir) {
|
|
182
|
-
var _await$fsp$stat$catch;
|
|
183
174
|
const cached = getCachedData(packageCache, basedir, originalBasedir);
|
|
184
175
|
if (cached) return cached;
|
|
185
176
|
const pkgPath = join(basedir, "package.json");
|
|
186
|
-
if ((
|
|
177
|
+
if ((await promises.stat(pkgPath).catch(() => {}))?.isFile()) {
|
|
187
178
|
const pkgData = JSON.parse(await promises.readFile(pkgPath, "utf8"));
|
|
188
179
|
if (packageCache) setCacheData(packageCache, pkgData, basedir, originalBasedir);
|
|
189
180
|
return pkgData;
|
|
@@ -195,4 +186,5 @@ async function findNearestPackageData(basedir) {
|
|
|
195
186
|
return {};
|
|
196
187
|
}
|
|
197
188
|
|
|
198
|
-
|
|
189
|
+
//#endregion
|
|
190
|
+
export { withTrailingSlash as _, getCachedData as a, isNodeBuiltin as c, normalizeModuleId as d, normalizeRequestId as f, toFilePath as g, toArray as h, findNearestPackageData as i, isPrimitive as l, slash as m, cleanUrl as n, isBareImport as o, setCacheData as p, createImportMetaEnvProxy as r, isInternalRequest as s, VALID_ID_PREFIX as t, isWindows as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import './trace-mapping.d-BWFx6tPc.js';
|
|
1
|
+
import { f as Nullable, t as Arrayable } from "./types-EZz9rsDw.mjs";
|
|
3
2
|
|
|
3
|
+
//#region src/utils.d.ts
|
|
4
4
|
declare const isWindows: boolean;
|
|
5
5
|
declare function slash(str: string): string;
|
|
6
6
|
declare function isBareImport(id: string): boolean;
|
|
@@ -11,8 +11,8 @@ declare function isInternalRequest(id: string): boolean;
|
|
|
11
11
|
declare function normalizeModuleId(id: string): string;
|
|
12
12
|
declare function isPrimitive(v: any): boolean;
|
|
13
13
|
declare function toFilePath(id: string, root: string): {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
path: string;
|
|
15
|
+
exists: boolean;
|
|
16
16
|
};
|
|
17
17
|
declare function isNodeBuiltin(id: string): boolean;
|
|
18
18
|
/**
|
|
@@ -26,7 +26,7 @@ declare function setCacheData<T>(cache: Map<string, T>, data: T, basedir: string
|
|
|
26
26
|
declare function withTrailingSlash(path: string): string;
|
|
27
27
|
declare function createImportMetaEnvProxy(): NodeJS.ProcessEnv;
|
|
28
28
|
declare function findNearestPackageData(basedir: string): Promise<{
|
|
29
|
-
|
|
29
|
+
type?: "module" | "commonjs";
|
|
30
30
|
}>;
|
|
31
|
-
|
|
32
|
-
export { VALID_ID_PREFIX, cleanUrl, createImportMetaEnvProxy, findNearestPackageData, getCachedData, isBareImport, isInternalRequest, isNodeBuiltin, isPrimitive, isWindows, normalizeModuleId, normalizeRequestId, setCacheData, slash, toArray, toFilePath, withTrailingSlash };
|
|
31
|
+
//#endregion
|
|
32
|
+
export { VALID_ID_PREFIX, cleanUrl, createImportMetaEnvProxy, findNearestPackageData, getCachedData, isBareImport, isInternalRequest, isNodeBuiltin, isPrimitive, isWindows, normalizeModuleId, normalizeRequestId, setCacheData, slash, toArray, toFilePath, withTrailingSlash };
|
package/dist/utils.mjs
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { _ as withTrailingSlash, a as getCachedData, c as isNodeBuiltin, d as normalizeModuleId, f as normalizeRequestId, g as toFilePath, h as toArray, i as findNearestPackageData, l as isPrimitive, m as slash, n as cleanUrl, o as isBareImport, p as setCacheData, r as createImportMetaEnvProxy, s as isInternalRequest, t as VALID_ID_PREFIX, u as isWindows } from "./utils-ExLpYVUV.mjs";
|
|
2
|
+
|
|
3
|
+
export { VALID_ID_PREFIX, cleanUrl, createImportMetaEnvProxy, findNearestPackageData, getCachedData, isBareImport, isInternalRequest, isNodeBuiltin, isPrimitive, isWindows, normalizeModuleId, normalizeRequestId, setCacheData, slash, toArray, toFilePath, withTrailingSlash };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-node",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.3.0",
|
|
5
5
|
"description": "Vite as Node.js runtime",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -16,60 +16,53 @@
|
|
|
16
16
|
},
|
|
17
17
|
"sideEffects": false,
|
|
18
18
|
"exports": {
|
|
19
|
-
".": "./dist/index.
|
|
20
|
-
"./
|
|
21
|
-
"./
|
|
22
|
-
"./
|
|
23
|
-
"./hmr": "./dist/hmr.
|
|
24
|
-
"./
|
|
25
|
-
"./
|
|
26
|
-
"
|
|
19
|
+
".": "./dist/index.mjs",
|
|
20
|
+
"./cli": "./dist/cli.mjs",
|
|
21
|
+
"./client": "./dist/client.mjs",
|
|
22
|
+
"./constants": "./dist/constants.mjs",
|
|
23
|
+
"./hmr": "./dist/hmr.mjs",
|
|
24
|
+
"./server": "./dist/server.mjs",
|
|
25
|
+
"./source-map": "./dist/source-map.mjs",
|
|
26
|
+
"./types": "./dist/types.mjs",
|
|
27
|
+
"./utils": "./dist/utils.mjs",
|
|
28
|
+
"./package.json": "./package.json"
|
|
27
29
|
},
|
|
28
|
-
"main": "./dist/index.
|
|
29
|
-
"module": "./dist/index.
|
|
30
|
-
"types": "./dist/index.d.
|
|
30
|
+
"main": "./dist/index.mjs",
|
|
31
|
+
"module": "./dist/index.mjs",
|
|
32
|
+
"types": "./dist/index.d.mts",
|
|
31
33
|
"bin": {
|
|
32
|
-
"vite-node": "./
|
|
34
|
+
"vite-node": "./dist/cli.mjs"
|
|
33
35
|
},
|
|
34
36
|
"files": [
|
|
35
|
-
"dist"
|
|
36
|
-
"vite-node.js"
|
|
37
|
+
"dist"
|
|
37
38
|
],
|
|
38
39
|
"engines": {
|
|
39
|
-
"node": "^
|
|
40
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
40
41
|
},
|
|
41
42
|
"dependencies": {
|
|
42
43
|
"cac": "^6.7.14",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
44
|
+
"es-module-lexer": "^2.0.0",
|
|
45
|
+
"obug": "^2.1.1",
|
|
45
46
|
"pathe": "^2.0.3",
|
|
46
|
-
"vite": "^7.
|
|
47
|
+
"vite": "^7.3.1"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
|
-
"@antfu/eslint-config": "^
|
|
50
|
+
"@antfu/eslint-config": "^7.0.1",
|
|
50
51
|
"@jridgewell/trace-mapping": "^0.3.31",
|
|
51
|
-
"@
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"@types/node": "^24.10.0",
|
|
56
|
-
"bumpp": "^10.3.1",
|
|
57
|
-
"eslint": "^9.39.1",
|
|
58
|
-
"inquirer": "^12.10.0",
|
|
59
|
-
"rimraf": "^6.1.0",
|
|
60
|
-
"rollup": "^4.52.5",
|
|
61
|
-
"rollup-plugin-dts": "^6.2.3",
|
|
52
|
+
"@types/node": "^25.0.9",
|
|
53
|
+
"bumpp": "^10.4.0",
|
|
54
|
+
"eslint": "^9.39.2",
|
|
55
|
+
"inquirer": "^13.2.0",
|
|
62
56
|
"tinyexec": "^1.0.2",
|
|
63
57
|
"tinyrainbow": "^3.0.3",
|
|
58
|
+
"tsdown": "^0.16.8",
|
|
64
59
|
"typescript": "^5.9.3",
|
|
65
|
-
"
|
|
66
|
-
"unplugin-oxc": "^0.5.3",
|
|
67
|
-
"vitest": "^4.0.7"
|
|
60
|
+
"vitest": "^4.0.17"
|
|
68
61
|
},
|
|
69
62
|
"scripts": {
|
|
70
63
|
"lint": "eslint",
|
|
71
|
-
"build": "
|
|
72
|
-
"dev": "
|
|
64
|
+
"build": "tsdown",
|
|
65
|
+
"dev": "tsdown -w",
|
|
73
66
|
"typecheck": "tsc --noEmit",
|
|
74
67
|
"test": "vitest",
|
|
75
68
|
"release": "bumpp"
|
package/dist/chunk-index.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// src/index.ts
|
|
2
|
-
var d = {
|
|
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
|
-
};
|
|
45
|
-
function g(e) {
|
|
46
|
-
return String(e);
|
|
47
|
-
}
|
|
48
|
-
g.open = "";
|
|
49
|
-
g.close = "";
|
|
50
|
-
function h() {
|
|
51
|
-
let e = typeof process != "undefined" ? process : void 0, n = (e == null ? void 0 : e.env) || {}, a = n.FORCE_TTY !== "false", i = (e == null ? void 0 : e.argv) || [];
|
|
52
|
-
return !("NO_COLOR" in n || i.includes("--no-color")) && ("FORCE_COLOR" in n || i.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || a && n.TERM !== "dumb" || "CI" in n) || typeof window != "undefined" && !!window.chrome;
|
|
53
|
-
}
|
|
54
|
-
function f() {
|
|
55
|
-
let e = h(), n = (r, t, u, o) => {
|
|
56
|
-
let l = "", s = 0;
|
|
57
|
-
do
|
|
58
|
-
l += r.substring(s, o) + u, s = o + t.length, o = r.indexOf(t, s);
|
|
59
|
-
while (~o);
|
|
60
|
-
return l + r.substring(s);
|
|
61
|
-
}, a = (r, t, u = r) => {
|
|
62
|
-
let o = (l) => {
|
|
63
|
-
let s = String(l), b = s.indexOf(t, r.length);
|
|
64
|
-
return ~b ? r + n(s, t, u, b) + t : r + s + t;
|
|
65
|
-
};
|
|
66
|
-
return o.open = r, o.close = t, o;
|
|
67
|
-
}, i = {
|
|
68
|
-
isColorSupported: e
|
|
69
|
-
}, c = (r) => `\x1B[${r}m`;
|
|
70
|
-
for (let r in d) {
|
|
71
|
-
let t = d[r];
|
|
72
|
-
i[r] = e ? a(
|
|
73
|
-
c(t[0]),
|
|
74
|
-
c(t[1]),
|
|
75
|
-
t[2]
|
|
76
|
-
) : g;
|
|
77
|
-
}
|
|
78
|
-
return i;
|
|
79
|
-
}
|
|
80
|
-
var C = f();
|
|
81
|
-
|
|
82
|
-
export { C };
|
package/dist/cli.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { V as ViteNodeServerOptions } from './index.d-D6Pqey3g.js';
|
|
2
|
-
import './trace-mapping.d-BWFx6tPc.js';
|
|
3
|
-
|
|
4
|
-
interface CliOptions {
|
|
5
|
-
"root"?: string;
|
|
6
|
-
"script"?: boolean;
|
|
7
|
-
"config"?: string;
|
|
8
|
-
"mode"?: string;
|
|
9
|
-
"watch"?: boolean;
|
|
10
|
-
"inspect"?: boolean;
|
|
11
|
-
"inspectAddr"?: string;
|
|
12
|
-
"options"?: ViteNodeServerOptionsCLI;
|
|
13
|
-
"version"?: boolean;
|
|
14
|
-
"help"?: boolean;
|
|
15
|
-
"--"?: string[];
|
|
16
|
-
}
|
|
17
|
-
type Optional<T> = T | undefined;
|
|
18
|
-
type ComputeViteNodeServerOptionsCLI<T extends Record<string, any>> = { [K in keyof T] : T[K] extends Optional<RegExp[]> ? string | string[] : T[K] extends Optional<(string | RegExp)[]> ? string | string[] : T[K] extends Optional<(string | RegExp)[] | true> ? string | string[] | true : T[K] extends Optional<Record<string, any>> ? ComputeViteNodeServerOptionsCLI<T[K]> : T[K] };
|
|
19
|
-
type ViteNodeServerOptionsCLI = ComputeViteNodeServerOptionsCLI<ViteNodeServerOptions>;
|
|
20
|
-
|
|
21
|
-
export type { CliOptions, ViteNodeServerOptionsCLI };
|