vite-node 1.4.0 → 1.5.1

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.
@@ -14,7 +14,7 @@ function viteNodeHmrPlugin() {
14
14
  return {
15
15
  name: "vite-node:hmr",
16
16
  config() {
17
- if (process.platform === "darwin" && process.env.VITE_TEST_WATCHER_DEBUG) {
17
+ if (process.platform === "darwin" && false) {
18
18
  return {
19
19
  server: {
20
20
  watch: {
@@ -32,11 +32,6 @@ function viteNodeHmrPlugin() {
32
32
  _send(payload);
33
33
  emitter.emit("message", payload);
34
34
  };
35
- if (process.env.VITE_TEST_WATCHER_DEBUG) {
36
- server.watcher.on("ready", () => {
37
- console.log("[debug] watcher is ready");
38
- });
39
- }
40
35
  }
41
36
  };
42
37
  }
@@ -12,7 +12,7 @@ function viteNodeHmrPlugin() {
12
12
  return {
13
13
  name: "vite-node:hmr",
14
14
  config() {
15
- if (process.platform === "darwin" && process.env.VITE_TEST_WATCHER_DEBUG) {
15
+ if (process.platform === "darwin" && false) {
16
16
  return {
17
17
  server: {
18
18
  watch: {
@@ -30,11 +30,6 @@ function viteNodeHmrPlugin() {
30
30
  _send(payload);
31
31
  emitter.emit("message", payload);
32
32
  };
33
- if (process.env.VITE_TEST_WATCHER_DEBUG) {
34
- server.watcher.on("ready", () => {
35
- console.log("[debug] watcher is ready");
36
- });
37
- }
38
33
  }
39
34
  };
40
35
  }
package/dist/cli.cjs CHANGED
@@ -20,7 +20,7 @@ require('node:url');
20
20
  require('node:vm');
21
21
  require('node:events');
22
22
 
23
- var version = "1.4.0";
23
+ var version = "1.5.1";
24
24
 
25
25
  const cli = cac("vite-node");
26
26
  cli.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").option("-v, --version", "Output the version number").option("-h, --help", "Display help for command");
package/dist/cli.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { V as ViteNodeServerOptions } from './index-WT31LSgS.js';
1
+ import { V as ViteNodeServerOptions } from './index-O2IrwHKf.js';
2
2
  import './trace-mapping.d-xyIfZtPm.js';
3
3
 
4
4
  interface CliOptions {
package/dist/cli.mjs CHANGED
@@ -18,7 +18,7 @@ import 'node:url';
18
18
  import 'node:vm';
19
19
  import 'node:events';
20
20
 
21
- var version = "1.4.0";
21
+ var version = "1.5.1";
22
22
 
23
23
  const cli = cac("vite-node");
24
24
  cli.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").option("-v, --version", "Output the version number").option("-h, --help", "Display help for command");
package/dist/client.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { e as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, a as ViteNodeRunner } from './index-WT31LSgS.js';
1
+ export { e as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, a as ViteNodeRunner } from './index-O2IrwHKf.js';
2
2
  import './trace-mapping.d-xyIfZtPm.js';
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 { C as CustomEventMap, a as ViteNodeRunner, H as HMRPayload$1, b as HotContext } from './index-WT31LSgS.js';
3
+ import { C as CustomEventMap, a as ViteNodeRunner, H as HMRPayload$1, b as HotContext } from './index-O2IrwHKf.js';
4
4
  import './trace-mapping.d-xyIfZtPm.js';
5
5
 
6
6
  type EventType = string | symbol;
@@ -22,10 +22,12 @@ interface Update {
22
22
  path: string
23
23
  acceptedPath: string
24
24
  timestamp: number
25
- /**
26
- * @experimental internal
27
- */
28
- explicitImportRequired?: boolean | undefined
25
+ /** @internal */
26
+ explicitImportRequired?: boolean
27
+ /** @internal */
28
+ isWithinCircularImport?: boolean
29
+ /** @internal */
30
+ ssrInvalidates?: string[]
29
31
  }
30
32
 
31
33
  interface PrunePayload {
@@ -36,6 +38,8 @@ interface PrunePayload {
36
38
  interface FullReloadPayload {
37
39
  type: 'full-reload'
38
40
  path?: string
41
+ /** @internal */
42
+ triggeredBy?: string
39
43
  }
40
44
 
41
45
  interface CustomPayload {
@@ -88,6 +92,9 @@ interface InvalidatePayload {
88
92
  message: string | undefined
89
93
  }
90
94
 
95
+ /**
96
+ * provides types for built-in Vite events
97
+ */
91
98
  type InferCustomEventPayload<T extends string> =
92
99
  T extends keyof CustomEventMap ? CustomEventMap[T] : any
93
100
 
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { A as Arrayable, f as Awaitable, i as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, g as FetchFunction, F as FetchResult, b as HotContext, j as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, h as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, k as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-WT31LSgS.js';
1
+ export { A as Arrayable, f as Awaitable, i as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, g as FetchFunction, F as FetchResult, b as HotContext, j as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, h as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, k as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-O2IrwHKf.js';
2
2
  export { D as DecodedSourceMap, E as EncodedSourceMap, S as SourceMapInput } from './trace-mapping.d-xyIfZtPm.js';
package/dist/server.cjs CHANGED
@@ -59,12 +59,12 @@ async function isValidNodeImport(id) {
59
59
  return true;
60
60
  if (extension !== ".js")
61
61
  return false;
62
- if (/\.(\w+-)?esm?(-\w+)?\.js$|\/(esm?)\//.test(id))
63
- return false;
64
62
  id = id.replace("file:///", "");
65
63
  const package_ = await utils.findNearestPackageData(pathe.dirname(id));
66
64
  if (package_.type === "module")
67
65
  return true;
66
+ if (/\.(\w+-)?esm?(-\w+)?\.js$|\/(esm?)\//.test(id))
67
+ return false;
68
68
  const code = await fs.promises.readFile(id, "utf8").catch(() => "");
69
69
  return !ESM_SYNTAX_RE.test(code);
70
70
  }
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TransformResult, ViteDevServer } from 'vite';
2
- import { D as DebuggerOptions, c as DepsHandlingOptions, V as ViteNodeServerOptions, d as ViteNodeResolveId, F as FetchResult } from './index-WT31LSgS.js';
2
+ import { D as DebuggerOptions, c as DepsHandlingOptions, V as ViteNodeServerOptions, d as ViteNodeResolveId, F as FetchResult } from './index-O2IrwHKf.js';
3
3
  import { E as EncodedSourceMap } from './trace-mapping.d-xyIfZtPm.js';
4
4
 
5
5
  declare class Debugger {
package/dist/server.mjs CHANGED
@@ -57,12 +57,12 @@ async function isValidNodeImport(id) {
57
57
  return true;
58
58
  if (extension !== ".js")
59
59
  return false;
60
- if (/\.(\w+-)?esm?(-\w+)?\.js$|\/(esm?)\//.test(id))
61
- return false;
62
60
  id = id.replace("file:///", "");
63
61
  const package_ = await findNearestPackageData(dirname(id));
64
62
  if (package_.type === "module")
65
63
  return true;
64
+ if (/\.(\w+-)?esm?(-\w+)?\.js$|\/(esm?)\//.test(id))
65
+ return false;
66
66
  const code = await promises.readFile(id, "utf8").catch(() => "");
67
67
  return !ESM_SYNTAX_RE.test(code);
68
68
  }
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { A as Arrayable, f as Awaitable, i as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, g as FetchFunction, F as FetchResult, b as HotContext, j as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, h as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, k as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-WT31LSgS.js';
1
+ export { A as Arrayable, f as Awaitable, i as CreateHotContextFunction, D as DebuggerOptions, c as DepsHandlingOptions, g as FetchFunction, F as FetchResult, b as HotContext, j as ModuleCache, M as ModuleCacheMap, N as Nullable, R as RawSourceMap, h as ResolveIdFunction, S as StartOfSourceMap, d as ViteNodeResolveId, k as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-O2IrwHKf.js';
2
2
  export { D as DecodedSourceMap, E as EncodedSourceMap, S as SourceMapInput } from './trace-mapping.d-xyIfZtPm.js';
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { N as Nullable, A as Arrayable } from './index-WT31LSgS.js';
1
+ import { N as Nullable, A as Arrayable } from './index-O2IrwHKf.js';
2
2
  import './trace-mapping.d-xyIfZtPm.js';
3
3
 
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": "1.4.0",
4
+ "version": "1.5.1",
5
5
  "description": "Vite as Node.js runtime",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",