vite-node 0.29.2 → 0.29.4

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.cjs CHANGED
@@ -24,7 +24,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
24
24
  var cac__default = /*#__PURE__*/_interopDefaultLegacy(cac);
25
25
  var c__default = /*#__PURE__*/_interopDefaultLegacy(c);
26
26
 
27
- var version = "0.29.2";
27
+ var version = "0.29.4";
28
28
 
29
29
  const cli = cac__default["default"]("vite-node");
30
30
  cli.version(version).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").help();
package/dist/cli.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { e as ViteNodeServerOptions } from './types-e288fc62.js';
1
+ import { e as ViteNodeServerOptions } from './types-e6d31da0.js';
2
2
  import './types.d-1e7e3fdf.js';
3
3
 
4
4
  interface CliOptions {
package/dist/cli.mjs CHANGED
@@ -17,7 +17,7 @@ import 'node:module';
17
17
  import 'node:vm';
18
18
  import 'node:events';
19
19
 
20
- var version = "0.29.2";
20
+ var version = "0.29.4";
21
21
 
22
22
  const cli = cac("vite-node");
23
23
  cli.version(version).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").help();
package/dist/client.cjs CHANGED
@@ -107,6 +107,13 @@ class ModuleCacheMap extends Map {
107
107
  delete(fsPath) {
108
108
  return this.deleteByModuleId(this.normalizePath(fsPath));
109
109
  }
110
+ invalidateModule(mod) {
111
+ delete mod.evaluated;
112
+ delete mod.resolving;
113
+ delete mod.promise;
114
+ delete mod.exports;
115
+ return true;
116
+ }
110
117
  invalidateDepTree(ids, invalidated = /* @__PURE__ */ new Set()) {
111
118
  for (const _id of ids) {
112
119
  const id = this.normalizePath(_id);
package/dist/client.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import './types.d-1e7e3fdf.js';
2
- export { j as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, h as ViteNodeRunner } from './types-e288fc62.js';
2
+ export { j as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, h as ViteNodeRunner } from './types-e6d31da0.js';
package/dist/client.mjs CHANGED
@@ -80,6 +80,13 @@ class ModuleCacheMap extends Map {
80
80
  delete(fsPath) {
81
81
  return this.deleteByModuleId(this.normalizePath(fsPath));
82
82
  }
83
+ invalidateModule(mod) {
84
+ delete mod.evaluated;
85
+ delete mod.resolving;
86
+ delete mod.promise;
87
+ delete mod.exports;
88
+ return true;
89
+ }
83
90
  invalidateDepTree(ids, invalidated = /* @__PURE__ */ new Set()) {
84
91
  for (const _id of ids) {
85
92
  const id = this.normalizePath(_id);
package/dist/hmr.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'node:events';
2
2
  import { HMRPayload, Plugin } from 'vite';
3
- import { g as CustomEventMap, h as ViteNodeRunner, i as HMRPayload$1, H as HotContext } from './types-e288fc62.js';
3
+ import { g as CustomEventMap, h as ViteNodeRunner, i as HMRPayload$1, H as HotContext } from './types-e6d31da0.js';
4
4
  import './types.d-1e7e3fdf.js';
5
5
 
6
6
  type EventType = string | symbol;
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-e288fc62.js';
1
+ export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-e6d31da0.js';
2
2
  export { D as DecodedSourceMap, E as EncodedSourceMap } from './types.d-1e7e3fdf.js';
package/dist/server.cjs CHANGED
@@ -341,6 +341,9 @@ class ViteNodeServer {
341
341
  });
342
342
  return result;
343
343
  }
344
+ async processTransformResult(result) {
345
+ return sourceMap.withInlineSourcemap(result);
346
+ }
344
347
  async _transformRequest(id, customTransformMode) {
345
348
  var _a, _b, _c, _d;
346
349
  debugRequest(id);
@@ -360,7 +363,7 @@ class ViteNodeServer {
360
363
  }
361
364
  const sourcemap = this.options.sourcemap ?? "inline";
362
365
  if (sourcemap === "inline" && result && !id.includes("node_modules"))
363
- sourceMap.withInlineSourcemap(result);
366
+ result = await this.processTransformResult(result);
364
367
  if ((_c = this.options.debug) == null ? void 0 : _c.dumpModules)
365
368
  await ((_d = this.debugger) == null ? void 0 : _d.dumpFile(id, result));
366
369
  return result;
package/dist/server.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { TransformResult, ViteDevServer } from 'vite';
2
2
  import { E as EncodedSourceMap } from './types.d-1e7e3fdf.js';
3
- import { f as DebuggerOptions, D as DepsHandlingOptions, e as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId } from './types-e288fc62.js';
3
+ import { f as DebuggerOptions, D as DepsHandlingOptions, e as ViteNodeServerOptions, F as FetchResult, d as ViteNodeResolveId } from './types-e6d31da0.js';
4
4
 
5
5
  declare class Debugger {
6
6
  options: DebuggerOptions;
@@ -41,6 +41,7 @@ declare class ViteNodeServer {
41
41
  transformRequest(id: string): Promise<TransformResult | null | undefined>;
42
42
  getTransformMode(id: string): "web" | "ssr";
43
43
  private _fetchModule;
44
+ protected processTransformResult(result: TransformResult): Promise<TransformResult>;
44
45
  private _transformRequest;
45
46
  }
46
47
 
package/dist/server.mjs CHANGED
@@ -332,6 +332,9 @@ class ViteNodeServer {
332
332
  });
333
333
  return result;
334
334
  }
335
+ async processTransformResult(result) {
336
+ return withInlineSourcemap(result);
337
+ }
335
338
  async _transformRequest(id, customTransformMode) {
336
339
  var _a, _b, _c, _d;
337
340
  debugRequest(id);
@@ -351,7 +354,7 @@ class ViteNodeServer {
351
354
  }
352
355
  const sourcemap = this.options.sourcemap ?? "inline";
353
356
  if (sourcemap === "inline" && result && !id.includes("node_modules"))
354
- withInlineSourcemap(result);
357
+ result = await this.processTransformResult(result);
355
358
  if ((_c = this.options.debug) == null ? void 0 : _c.dumpModules)
356
359
  await ((_d = this.debugger) == null ? void 0 : _d.dumpFile(id, result));
357
360
  return result;
@@ -864,7 +864,7 @@ SOURCEMAPPING_URL += "ppingURL";
864
864
  const VITE_NODE_SOURCEMAPPING_SOURCE = "//# sourceMappingSource=vite-node";
865
865
  const VITE_NODE_SOURCEMAPPING_URL = `${SOURCEMAPPING_URL}=data:application/json;charset=utf-8`;
866
866
  const VITE_NODE_SOURCEMAPPING_REGEXP = new RegExp(`//# ${VITE_NODE_SOURCEMAPPING_URL};base64,(.+)`);
867
- async function withInlineSourcemap(result) {
867
+ function withInlineSourcemap(result) {
868
868
  const map = result.map;
869
869
  let code = result.code;
870
870
  if (!map || code.includes(VITE_NODE_SOURCEMAPPING_SOURCE))
@@ -4,7 +4,7 @@ import { E as EncodedSourceMap } from './types.d-1e7e3fdf.js';
4
4
  interface InstallSourceMapSupportOptions {
5
5
  getSourceMap: (source: string) => EncodedSourceMap | null | undefined;
6
6
  }
7
- declare function withInlineSourcemap(result: TransformResult): Promise<TransformResult>;
7
+ declare function withInlineSourcemap(result: TransformResult): TransformResult;
8
8
  declare function extractSourceMap(code: string): EncodedSourceMap | null;
9
9
  declare function installSourcemapsSupport(options: InstallSourceMapSupportOptions): void;
10
10
 
@@ -855,7 +855,7 @@ SOURCEMAPPING_URL += "ppingURL";
855
855
  const VITE_NODE_SOURCEMAPPING_SOURCE = "//# sourceMappingSource=vite-node";
856
856
  const VITE_NODE_SOURCEMAPPING_URL = `${SOURCEMAPPING_URL}=data:application/json;charset=utf-8`;
857
857
  const VITE_NODE_SOURCEMAPPING_REGEXP = new RegExp(`//# ${VITE_NODE_SOURCEMAPPING_URL};base64,(.+)`);
858
- async function withInlineSourcemap(result) {
858
+ function withInlineSourcemap(result) {
859
859
  const map = result.map;
860
860
  let code = result.code;
861
861
  if (!map || code.includes(VITE_NODE_SOURCEMAPPING_SOURCE))
@@ -148,6 +148,7 @@ declare class ModuleCacheMap extends Map<string, ModuleCache> {
148
148
  get(fsPath: string): ModuleCache;
149
149
  deleteByModuleId(modulePath: string): boolean;
150
150
  delete(fsPath: string): boolean;
151
+ invalidateModule(mod: ModuleCache): boolean;
151
152
  /**
152
153
  * Invalidate modules that dependent on the given modules, up to the main entry
153
154
  */
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-e288fc62.js';
1
+ export { A as Arrayable, C as CreateHotContextFunction, f as DebuggerOptions, D as DepsHandlingOptions, a as FetchFunction, F as FetchResult, H as HotContext, c as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, b as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, V as ViteNodeRunnerOptions, e as ViteNodeServerOptions } from './types-e6d31da0.js';
2
2
  export { D as DecodedSourceMap, E as EncodedSourceMap } from './types.d-1e7e3fdf.js';
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { N as Nullable, A as Arrayable } from './types-e288fc62.js';
1
+ import { N as Nullable, A as Arrayable } from './types-e6d31da0.js';
2
2
  import './types.d-1e7e3fdf.js';
3
3
 
4
4
  declare const isWindows: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-node",
3
- "version": "0.29.2",
3
+ "version": "0.29.4",
4
4
  "description": "Vite as Node.js runtime",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",