vite-node 5.1.0 → 5.2.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.
Files changed (43) hide show
  1. package/dist/cli.d.mts +21 -0
  2. package/dist/cli.mjs +145 -0
  3. package/dist/{client.js → client-CyS7w_FB.mjs} +54 -87
  4. package/dist/client.d.mts +2 -0
  5. package/dist/client.mjs +5 -0
  6. package/dist/{constants.js → constants-DRkacFwN.mjs} +3 -1
  7. package/dist/{constants.d.ts → constants.d.mts} +3 -2
  8. package/dist/constants.mjs +3 -0
  9. package/dist/dist-B2ebky9O.mjs +85 -0
  10. package/dist/{chunk-hmr.js → hmr-qEG3qSgW.mjs} +17 -29
  11. package/dist/hmr.d.mts +57 -0
  12. package/dist/hmr.mjs +5 -0
  13. package/dist/index.d.mts +2 -0
  14. package/dist/index.mjs +3 -0
  15. package/dist/{server.js → server-BWywEVuB.mjs} +52 -87
  16. package/dist/server.d.mts +60 -0
  17. package/dist/server.mjs +7 -0
  18. package/dist/source-map-DQLD3K8K.mjs +737 -0
  19. package/dist/{source-map.d.ts → source-map.d.mts} +9 -8
  20. package/dist/source-map.mjs +4 -0
  21. package/dist/types-55T_-8KG.mjs +1 -0
  22. package/dist/types-Dtew7m7O.d.mts +212 -0
  23. package/dist/types.d.mts +2 -0
  24. package/dist/types.mjs +3 -0
  25. package/dist/{utils.js → utils-ExLpYVUV.mjs} +10 -18
  26. package/dist/{utils.d.ts → utils.d.mts} +7 -7
  27. package/dist/utils.mjs +3 -0
  28. package/package.json +25 -32
  29. package/dist/chunk-index.js +0 -82
  30. package/dist/cli.d.ts +0 -21
  31. package/dist/cli.js +0 -162
  32. package/dist/client.d.ts +0 -2
  33. package/dist/hmr.d.ts +0 -55
  34. package/dist/hmr.js +0 -10
  35. package/dist/index.d-D6Pqey3g.d.ts +0 -367
  36. package/dist/index.d.ts +0 -2
  37. package/dist/index.js +0 -1
  38. package/dist/server.d.ts +0 -58
  39. package/dist/source-map.js +0 -919
  40. package/dist/trace-mapping.d-BWFx6tPc.d.ts +0 -62
  41. package/dist/types.d.ts +0 -2
  42. package/dist/types.js +0 -1
  43. package/vite-node.js +0 -2
@@ -1,15 +1,16 @@
1
- import { TransformResult } from 'vite';
2
- import { E as EncodedSourceMap } from './trace-mapping.d-BWFx6tPc.js';
1
+ import { s as EncodedSourceMap } from "./types-Dtew7m7O.mjs";
2
+ import { TransformResult } from "vite";
3
3
 
4
+ //#region src/source-map.d.ts
4
5
  interface InstallSourceMapSupportOptions {
5
- getSourceMap: (source: string) => EncodedSourceMap | null | undefined;
6
+ getSourceMap: (source: string) => EncodedSourceMap | null | undefined;
6
7
  }
7
8
  declare function withInlineSourcemap(result: TransformResult, options: {
8
- root: string;
9
- filepath: string;
10
- noFirstLineMapping?: boolean;
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,4 @@
1
+ import "./utils-ExLpYVUV.mjs";
2
+ import { n as installSourcemapsSupport, r as withInlineSourcemap, t as extractSourceMap } from "./source-map-DQLD3K8K.mjs";
3
+
4
+ export { extractSourceMap, installSourcemapsSupport, withInlineSourcemap };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,212 @@
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
+ * Starts calculating the module execution info such as the total duration and self time spent on executing the module.
83
+ * Returns a function to call once the module has finished executing.
84
+ */
85
+ protected startCalculateModuleExecutionInfo(filename: string, startOffset: number): () => ModuleExecutionInfoEntry;
86
+ prepareContext(context: Record<string, any>): Record<string, any>;
87
+ /**
88
+ * Define if a module should be interop-ed
89
+ * This function mostly for the ability to override by subclass
90
+ */
91
+ shouldInterop(path: string, mod: any): boolean;
92
+ protected importExternalModule(path: string): Promise<any>;
93
+ /**
94
+ * Import a module and interop it
95
+ */
96
+ interopedImport(path: string): Promise<any>;
97
+ }
98
+ //#endregion
99
+ //#region src/types.d.ts
100
+ type Nullable<T> = T | null | undefined;
101
+ type Arrayable<T> = T | Array<T>;
102
+ type Awaitable<T> = T | PromiseLike<T>;
103
+ interface DepsHandlingOptions {
104
+ external?: (string | RegExp)[];
105
+ inline?: (string | RegExp)[] | true;
106
+ inlineFiles?: string[];
107
+ /**
108
+ * A list of directories that are considered to hold Node.js modules
109
+ * Have to include "/" at the start and end of the path
110
+ *
111
+ * Vite-Node checks the whole absolute path of the import, so make sure you don't include
112
+ * unwanted files accidentally
113
+ * @default ['/node_modules/']
114
+ */
115
+ moduleDirectories?: string[];
116
+ cacheDir?: string;
117
+ /**
118
+ * Try to guess the CJS version of a package when it's invalid ESM
119
+ * @default false
120
+ */
121
+ fallbackCJS?: boolean;
122
+ }
123
+ interface StartOfSourceMap {
124
+ file?: string;
125
+ sourceRoot?: string;
126
+ }
127
+ interface RawSourceMap extends StartOfSourceMap {
128
+ version: number;
129
+ sources: string[];
130
+ names: string[];
131
+ sourcesContent?: (string | null)[];
132
+ mappings: string;
133
+ }
134
+ interface FetchResult {
135
+ code?: string;
136
+ externalize?: string;
137
+ map?: EncodedSourceMap | null;
138
+ }
139
+ type HotContext = Omit<ViteHotContext, "acceptDeps" | "decline">;
140
+ type FetchFunction = (id: string) => Promise<FetchResult>;
141
+ type ResolveIdFunction = (id: string, importer?: string) => Awaitable<ViteNodeResolveId | null | undefined | void>;
142
+ type CreateHotContextFunction = (runner: ViteNodeRunner, url: string) => HotContext;
143
+ interface ModuleCache {
144
+ promise?: Promise<any>;
145
+ exports?: any;
146
+ evaluated?: boolean;
147
+ resolving?: boolean;
148
+ code?: string;
149
+ map?: EncodedSourceMap;
150
+ /**
151
+ * Module ids that imports this module
152
+ */
153
+ importers?: Set<string>;
154
+ imports?: Set<string>;
155
+ }
156
+ interface ViteNodeRunnerOptions {
157
+ root: string;
158
+ fetchModule: FetchFunction;
159
+ resolveId?: ResolveIdFunction;
160
+ createHotContext?: CreateHotContextFunction;
161
+ base?: string;
162
+ moduleCache?: ModuleCacheMap;
163
+ moduleExecutionInfo?: ModuleExecutionInfo;
164
+ interopDefault?: boolean;
165
+ requestStubs?: Record<string, any>;
166
+ debug?: boolean;
167
+ }
168
+ interface ViteNodeResolveId {
169
+ external?: boolean | "absolute" | "relative";
170
+ id: string;
171
+ meta?: Record<string, any> | null;
172
+ moduleSideEffects?: boolean | "no-treeshake" | null;
173
+ syntheticNamedExports?: boolean | string | null;
174
+ }
175
+ interface ViteNodeResolveModule {
176
+ external: string | null;
177
+ id: string;
178
+ fsPath: string;
179
+ }
180
+ interface ViteNodeServerOptions {
181
+ /**
182
+ * Inject inline sourcemap to modules
183
+ * @default 'inline'
184
+ */
185
+ sourcemap?: "inline" | boolean;
186
+ /**
187
+ * Deps handling
188
+ */
189
+ deps?: DepsHandlingOptions;
190
+ /**
191
+ * Transform method for modules
192
+ */
193
+ transformMode?: {
194
+ ssr?: RegExp[];
195
+ web?: RegExp[];
196
+ };
197
+ debug?: DebuggerOptions;
198
+ }
199
+ interface DebuggerOptions {
200
+ /**
201
+ * Dump the transformed module to filesystem
202
+ * Passing a string will dump to the specified path
203
+ */
204
+ dumpModules?: boolean | string;
205
+ /**
206
+ * Read dumpped module from filesystem whenever exists.
207
+ * Useful for debugging by modifying the dump result from the filesystem.
208
+ */
209
+ loadDumppedModules?: boolean;
210
+ }
211
+ //#endregion
212
+ 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 };
@@ -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-Dtew7m7O.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
@@ -0,0 +1,3 @@
1
+ import "./types-55T_-8KG.mjs";
2
+
3
+ export { };
@@ -1,9 +1,10 @@
1
- import { existsSync, promises } from 'node:fs';
2
- import { builtinModules } from 'node:module';
3
- import process from 'node:process';
4
- import { fileURLToPath, pathToFileURL } from 'node:url';
5
- import { resolve, join, dirname } from 'pathe';
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
- // keep drive the same as in process cwd. ideally, this should be resolved on Vite side
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 ((_await$fsp$stat$catch = await promises.stat(pkgPath).catch(() => {})) === null || _await$fsp$stat$catch === void 0 ? void 0 : _await$fsp$stat$catch.isFile()) {
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
- export { VALID_ID_PREFIX, cleanUrl, createImportMetaEnvProxy, findNearestPackageData, getCachedData, isBareImport, isInternalRequest, isNodeBuiltin, isPrimitive, isWindows, normalizeModuleId, normalizeRequestId, setCacheData, slash, toArray, toFilePath, withTrailingSlash };
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 { N as Nullable, A as Arrayable } from './index.d-D6Pqey3g.js';
2
- import './trace-mapping.d-BWFx6tPc.js';
1
+ import { f as Nullable, t as Arrayable } from "./types-Dtew7m7O.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
- path: string;
15
- exists: boolean;
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
- type?: "module" | "commonjs";
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.1.0",
4
+ "version": "5.2.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.js",
20
- "./client": "./dist/client.js",
21
- "./server": "./dist/server.js",
22
- "./utils": "./dist/utils.js",
23
- "./hmr": "./dist/hmr.js",
24
- "./source-map": "./dist/source-map.js",
25
- "./constants": "./dist/constants.js",
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.js",
29
- "module": "./dist/index.js",
30
- "types": "./dist/index.d.ts",
30
+ "main": "./dist/index.mjs",
31
+ "module": "./dist/index.mjs",
32
+ "types": "./dist/index.d.mts",
31
33
  "bin": {
32
- "vite-node": "./vite-node.js"
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": "^18.0.0 || ^20.0.0 || >=22.0.0"
40
+ "node": "^20.19.0 || >=22.12.0"
40
41
  },
41
42
  "dependencies": {
42
43
  "cac": "^6.7.14",
43
- "debug": "^4.4.3",
44
44
  "es-module-lexer": "^1.7.0",
45
+ "obug": "^2.0.0",
45
46
  "pathe": "^2.0.3",
46
- "vite": "^7.2.0"
47
+ "vite": "^7.2.2"
47
48
  },
48
49
  "devDependencies": {
49
50
  "@antfu/eslint-config": "^6.2.0",
50
51
  "@jridgewell/trace-mapping": "^0.3.31",
51
- "@rollup/plugin-commonjs": "^29.0.0",
52
- "@rollup/plugin-json": "^6.1.0",
53
- "@rollup/plugin-node-resolve": "^16.0.3",
54
- "@types/debug": "^4.1.12",
55
- "@types/node": "^24.10.0",
52
+ "@types/node": "^24.10.1",
56
53
  "bumpp": "^10.3.1",
57
54
  "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",
55
+ "inquirer": "^13.0.1",
62
56
  "tinyexec": "^1.0.2",
63
57
  "tinyrainbow": "^3.0.3",
58
+ "tsdown": "^0.16.5",
64
59
  "typescript": "^5.9.3",
65
- "unplugin-isolated-decl": "^0.15.3",
66
- "unplugin-oxc": "^0.5.3",
67
- "vitest": "^4.0.7"
60
+ "vitest": "^4.0.10"
68
61
  },
69
62
  "scripts": {
70
63
  "lint": "eslint",
71
- "build": "rimraf dist && rollup -c",
72
- "dev": "rollup -c --watch --watch.include 'src/**' -m inline",
64
+ "build": "tsdown",
65
+ "dev": "tsdown -w",
73
66
  "typecheck": "tsc --noEmit",
74
67
  "test": "vitest",
75
68
  "release": "bumpp"
@@ -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 };