vite-node 5.2.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 CHANGED
@@ -1,4 +1,4 @@
1
- import { b as ViteNodeServerOptions } from "./types-Dtew7m7O.mjs";
1
+ import { b as ViteNodeServerOptions } from "./types-EZz9rsDw.mjs";
2
2
 
3
3
  //#region src/cli.d.ts
4
4
  interface CliOptions {
package/dist/cli.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { t as C } from "./dist-B2ebky9O.mjs";
3
- import { t as ViteNodeServer } from "./server-BWywEVuB.mjs";
3
+ import { t as ViteNodeServer } from "./server-Bk_vRgMj.mjs";
4
4
  import "./constants-DRkacFwN.mjs";
5
5
  import { h as toArray } from "./utils-ExLpYVUV.mjs";
6
- import { n as installSourcemapsSupport } from "./source-map-DQLD3K8K.mjs";
7
- import { r as ViteNodeRunner } from "./client-CyS7w_FB.mjs";
6
+ import { n as installSourcemapsSupport } from "./source-map-CysB5F9m.mjs";
7
+ import { r as ViteNodeRunner } from "./client-C7yCjfvf.mjs";
8
8
  import { r as handleMessage, s as viteNodeHmrPlugin, t as createHotContext } from "./hmr-qEG3qSgW.mjs";
9
9
  import process from "node:process";
10
10
  import { createServer, loadEnv, version } from "vite";
@@ -12,7 +12,7 @@ import { resolve } from "node:path";
12
12
  import cac from "cac";
13
13
 
14
14
  //#region package.json
15
- var version$1 = "5.2.0";
15
+ var version$1 = "5.3.0";
16
16
 
17
17
  //#endregion
18
18
  //#region src/cli.ts
@@ -1,5 +1,5 @@
1
1
  import { c as isNodeBuiltin, d as normalizeModuleId, f as normalizeRequestId, g as toFilePath, l as isPrimitive, m as slash, n as cleanUrl, o as isBareImport, r as createImportMetaEnvProxy, s as isInternalRequest } from "./utils-ExLpYVUV.mjs";
2
- import { t as extractSourceMap } from "./source-map-DQLD3K8K.mjs";
2
+ import { a as originalPositionFor, i as TraceMap, t as extractSourceMap } from "./source-map-CysB5F9m.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import process from "node:process";
5
5
  import { fileURLToPath, pathToFileURL } from "node:url";
@@ -372,6 +372,37 @@ var ViteNodeRunner = class {
372
372
  }
373
373
  }
374
374
  /**
375
+ * mutate the given error to have fixed stacktraces based on source maps
376
+ * Does the same thing as Vite's ssrFixStacktrace
377
+ */
378
+ async ssrFixStacktrace(error) {
379
+ const stack = (error.stack || "").split("\n");
380
+ const rewrittenStack = [];
381
+ for (const line of stack) {
382
+ const match = line.match(/\((.*):(\d+):(\d+)\)$/);
383
+ if (match) {
384
+ const [, file, lineStr, columnStr] = match;
385
+ const lineNum = Number(lineStr);
386
+ const columnNum = Number(columnStr);
387
+ const sourceMap = this.moduleCache.getSourceMap(file);
388
+ if (sourceMap) {
389
+ const originalPos = originalPositionFor(new TraceMap(sourceMap), {
390
+ line: lineNum,
391
+ column: columnNum
392
+ });
393
+ if (originalPos.source) {
394
+ const rewrittenLine = line.replace(/\(.*:\d+:\d+\)$/, `(${file}:${originalPos.line || lineNum}:${originalPos.column || columnNum})`);
395
+ rewrittenStack.push(rewrittenLine);
396
+ continue;
397
+ }
398
+ }
399
+ }
400
+ rewrittenStack.push(line);
401
+ }
402
+ error.stack = rewrittenStack.join("\n") || error.stack;
403
+ return error;
404
+ }
405
+ /**
375
406
  * Starts calculating the module execution info such as the total duration and self time spent on executing the module.
376
407
  * Returns a function to call once the module has finished executing.
377
408
  */
package/dist/client.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { C as ModuleExecutionInfo, S as ModuleCacheMap, T as ViteNodeRunner, w as ModuleExecutionInfoEntry, x as DEFAULT_REQUEST_STUBS } from "./types-Dtew7m7O.mjs";
1
+ import { C as ModuleExecutionInfo, S as ModuleCacheMap, T as ViteNodeRunner, w as ModuleExecutionInfoEntry, x as DEFAULT_REQUEST_STUBS } from "./types-EZz9rsDw.mjs";
2
2
  export { DEFAULT_REQUEST_STUBS, ModuleCacheMap, ModuleExecutionInfo, ModuleExecutionInfoEntry, ViteNodeRunner };
package/dist/client.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./utils-ExLpYVUV.mjs";
2
- import "./source-map-DQLD3K8K.mjs";
3
- import { n as ModuleCacheMap, r as ViteNodeRunner, t as DEFAULT_REQUEST_STUBS } from "./client-CyS7w_FB.mjs";
2
+ import "./source-map-CysB5F9m.mjs";
3
+ import { n as ModuleCacheMap, r as ViteNodeRunner, t as DEFAULT_REQUEST_STUBS } from "./client-C7yCjfvf.mjs";
4
4
 
5
5
  export { DEFAULT_REQUEST_STUBS, ModuleCacheMap, ViteNodeRunner };
package/dist/hmr.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { T as ViteNodeRunner, u as HotContext } from "./types-Dtew7m7O.mjs";
1
+ import { T as ViteNodeRunner, u as HotContext } from "./types-EZz9rsDw.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/index.d.mts CHANGED
@@ -1,2 +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";
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
2
  export { Arrayable, Awaitable, CreateHotContextFunction, DebuggerOptions, DecodedSourceMap, DepsHandlingOptions, EncodedSourceMap, FetchFunction, FetchResult, HotContext, ModuleCache, ModuleCacheMap, ModuleExecutionInfo, Nullable, RawSourceMap, ResolveIdFunction, SourceMapInput, StartOfSourceMap, ViteNodeResolveId, ViteNodeResolveModule, ViteNodeRunnerOptions, ViteNodeServerOptions };
@@ -1,7 +1,7 @@
1
1
  import { t as C } from "./dist-B2ebky9O.mjs";
2
2
  import { n as KNOWN_ASSET_RE } from "./constants-DRkacFwN.mjs";
3
3
  import { _ as withTrailingSlash, c as isNodeBuiltin, d as normalizeModuleId, g as toFilePath, h as toArray, i as findNearestPackageData, m as slash } from "./utils-ExLpYVUV.mjs";
4
- import { r as withInlineSourcemap } from "./source-map-DQLD3K8K.mjs";
4
+ import { r as withInlineSourcemap } from "./source-map-CysB5F9m.mjs";
5
5
  import assert from "node:assert";
6
6
  import { existsSync, promises } from "node:fs";
7
7
  import { performance } from "node:perf_hooks";
package/dist/server.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as ViteNodeResolveId, b as ViteNodeServerOptions, i as DebuggerOptions, l as FetchResult, o as DepsHandlingOptions, s as EncodedSourceMap } from "./types-Dtew7m7O.mjs";
1
+ import { _ as ViteNodeResolveId, b as ViteNodeServerOptions, i as DebuggerOptions, l as FetchResult, o as DepsHandlingOptions, s as EncodedSourceMap } from "./types-EZz9rsDw.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,7 @@
1
1
  import "./dist-B2ebky9O.mjs";
2
- import { n as guessCJSversion, r as shouldExternalize, t as ViteNodeServer } from "./server-BWywEVuB.mjs";
2
+ import { n as guessCJSversion, r as shouldExternalize, t as ViteNodeServer } from "./server-Bk_vRgMj.mjs";
3
3
  import "./constants-DRkacFwN.mjs";
4
4
  import "./utils-ExLpYVUV.mjs";
5
- import "./source-map-DQLD3K8K.mjs";
5
+ import "./source-map-CysB5F9m.mjs";
6
6
 
7
7
  export { ViteNodeServer, guessCJSversion, shouldExternalize };
@@ -734,4 +734,4 @@ function installSourcemapsSupport(options) {
734
734
  }
735
735
 
736
736
  //#endregion
737
- export { installSourcemapsSupport as n, withInlineSourcemap as r, extractSourceMap as t };
737
+ export { originalPositionFor as a, TraceMap as i, installSourcemapsSupport as n, withInlineSourcemap as r, extractSourceMap as t };
@@ -1,4 +1,4 @@
1
- import { s as EncodedSourceMap } from "./types-Dtew7m7O.mjs";
1
+ import { s as EncodedSourceMap } from "./types-EZz9rsDw.mjs";
2
2
  import { TransformResult } from "vite";
3
3
 
4
4
  //#region src/source-map.d.ts
@@ -1,4 +1,4 @@
1
1
  import "./utils-ExLpYVUV.mjs";
2
- import { n as installSourcemapsSupport, r as withInlineSourcemap, t as extractSourceMap } from "./source-map-DQLD3K8K.mjs";
2
+ import { n as installSourcemapsSupport, r as withInlineSourcemap, t as extractSourceMap } from "./source-map-CysB5F9m.mjs";
3
3
 
4
4
  export { extractSourceMap, installSourcemapsSupport, withInlineSourcemap };
@@ -79,6 +79,11 @@ declare class ViteNodeRunner {
79
79
  };
80
80
  protected runModule(context: Record<string, any>, transformed: string): Promise<void>;
81
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
+ /**
82
87
  * Starts calculating the module execution info such as the total duration and self time spent on executing the module.
83
88
  * Returns a function to call once the module has finished executing.
84
89
  */
package/dist/types.d.mts CHANGED
@@ -1,2 +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";
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
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/utils.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { f as Nullable, t as Arrayable } from "./types-Dtew7m7O.mjs";
1
+ import { f as Nullable, t as Arrayable } from "./types-EZz9rsDw.mjs";
2
2
 
3
3
  //#region src/utils.d.ts
4
4
  declare const isWindows: boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-node",
3
3
  "type": "module",
4
- "version": "5.2.0",
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",
@@ -41,23 +41,23 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "cac": "^6.7.14",
44
- "es-module-lexer": "^1.7.0",
45
- "obug": "^2.0.0",
44
+ "es-module-lexer": "^2.0.0",
45
+ "obug": "^2.1.1",
46
46
  "pathe": "^2.0.3",
47
- "vite": "^7.2.2"
47
+ "vite": "^7.3.1"
48
48
  },
49
49
  "devDependencies": {
50
- "@antfu/eslint-config": "^6.2.0",
50
+ "@antfu/eslint-config": "^7.0.1",
51
51
  "@jridgewell/trace-mapping": "^0.3.31",
52
- "@types/node": "^24.10.1",
53
- "bumpp": "^10.3.1",
54
- "eslint": "^9.39.1",
55
- "inquirer": "^13.0.1",
52
+ "@types/node": "^25.0.9",
53
+ "bumpp": "^10.4.0",
54
+ "eslint": "^9.39.2",
55
+ "inquirer": "^13.2.0",
56
56
  "tinyexec": "^1.0.2",
57
57
  "tinyrainbow": "^3.0.3",
58
- "tsdown": "^0.16.5",
58
+ "tsdown": "^0.16.8",
59
59
  "typescript": "^5.9.3",
60
- "vitest": "^4.0.10"
60
+ "vitest": "^4.0.17"
61
61
  },
62
62
  "scripts": {
63
63
  "lint": "eslint",