vite-node 3.0.0-beta.2 → 3.0.0-beta.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/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  vite-node
7
7
  </h1>
8
8
  <p align="center">
9
- Vite as Node runtime.<br>The engine that powers <a href="https://github.com/vitest-dev/vitest">Vitest</a> and <a href="https://github.com/nuxt/framework">Nuxt 3 Dev SSR</a>.
9
+ Vite as Node runtime.<br>The engine that powers <a href="https://github.com/vitest-dev/vitest">Vitest</a> and <a href="https://github.com/nuxt/nuxt">Nuxt 3 Dev SSR</a>.
10
10
  <p>
11
11
  <p align="center">
12
12
  <a href="https://www.npmjs.com/package/vitest"><img src="https://img.shields.io/npm/v/vite-node?color=FCC72B&label="></a>
@@ -14,16 +14,7 @@ function viteNodeHmrPlugin() {
14
14
  return {
15
15
  name: "vite-node:hmr",
16
16
  config() {
17
- if (process.platform === "darwin" && false) {
18
- return {
19
- server: {
20
- watch: {
21
- useFsEvents: false,
22
- usePolling: false
23
- }
24
- }
25
- };
26
- }
17
+ if (process.platform === "darwin" && false) ;
27
18
  },
28
19
  configureServer(server) {
29
20
  const _send = server.ws.send;
@@ -12,16 +12,7 @@ function viteNodeHmrPlugin() {
12
12
  return {
13
13
  name: "vite-node:hmr",
14
14
  config() {
15
- if (process.platform === "darwin" && false) {
16
- return {
17
- server: {
18
- watch: {
19
- useFsEvents: false,
20
- usePolling: false
21
- }
22
- }
23
- };
24
- }
15
+ if (process.platform === "darwin" && false) ;
25
16
  },
26
17
  configureServer(server) {
27
18
  const _send = server.ws.send;
package/dist/cli.cjs CHANGED
@@ -21,7 +21,7 @@ require('es-module-lexer');
21
21
  require('./constants.cjs');
22
22
  require('node:events');
23
23
 
24
- var version = "3.0.0-beta.2";
24
+ var version = "3.0.0-beta.4";
25
25
 
26
26
  const cli = cac("vite-node");
27
27
  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.mjs CHANGED
@@ -3,23 +3,23 @@ import cac from 'cac';
3
3
  import { f } from './chunk-browser.mjs';
4
4
  import { createServer, loadEnv } from 'vite';
5
5
  import { ViteNodeRunner } from './client.mjs';
6
+ import { v as viteNodeHmrPlugin, a as createHotContext, h as handleMessage } from './chunk-hmr.mjs';
6
7
  import { ViteNodeServer } from './server.mjs';
7
8
  import { installSourcemapsSupport } from './source-map.mjs';
8
9
  import { toArray } from './utils.mjs';
9
- import { v as viteNodeHmrPlugin, a as createHotContext, h as handleMessage } from './chunk-hmr.mjs';
10
10
  import 'node:module';
11
11
  import 'node:url';
12
12
  import 'node:vm';
13
13
  import 'debug';
14
14
  import 'pathe';
15
15
  import 'node:fs';
16
+ import 'node:events';
16
17
  import 'node:assert';
17
18
  import 'node:perf_hooks';
18
19
  import 'es-module-lexer';
19
20
  import './constants.mjs';
20
- import 'node:events';
21
21
 
22
- var version = "3.0.0-beta.2";
22
+ var version = "3.0.0-beta.4";
23
23
 
24
24
  const cli = cac("vite-node");
25
25
  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/utils.cjs CHANGED
@@ -21,7 +21,10 @@ function normalizeRequestId(id, base) {
21
21
  if (driveRegexp && !(driveRegexp == null ? void 0 : driveRegexp.test(id)) && (driveOppositeRegext == null ? void 0 : driveOppositeRegext.test(id))) {
22
22
  id = id.replace(driveOppositeRegext, `${drive}$1`);
23
23
  }
24
- return id.replace(/^\/@id\/__x00__/, "\0").replace(/^\/@id\//, "").replace(/^__vite-browser-external:/, "").replace(/^file:(\/+)/, isWindows ? "" : "/").replace(/\?v=\w+/, "?").replace(/&v=\w+/, "").replace(/\?t=\w+/, "?").replace(/&t=\w+/, "").replace(/\?import/, "?").replace(/&import/, "").replace(/\?&/, "?").replace(/\?+$/, "");
24
+ if (id.startsWith("file://")) {
25
+ return node_url.fileURLToPath(id);
26
+ }
27
+ return id.replace(/^\/@id\/__x00__/, "\0").replace(/^\/@id\//, "").replace(/^__vite-browser-external:/, "").replace(/\?v=\w+/, "?").replace(/&v=\w+/, "").replace(/\?t=\w+/, "?").replace(/&t=\w+/, "").replace(/\?import/, "?").replace(/&import/, "").replace(/\?&/, "?").replace(/\?+$/, "");
25
28
  }
26
29
  const postfixRE = /[?#].*$/;
27
30
  function cleanUrl(url) {
@@ -34,7 +37,12 @@ const internalRequestRegexp = new RegExp(
34
37
  function isInternalRequest(id) {
35
38
  return internalRequestRegexp.test(id);
36
39
  }
37
- const prefixedBuiltins = /* @__PURE__ */ new Set(["node:test"]);
40
+ const prefixedBuiltins = /* @__PURE__ */ new Set([
41
+ "node:sea",
42
+ "node:sqlite",
43
+ "node:test",
44
+ "node:test/reporters"
45
+ ]);
38
46
  const builtins = /* @__PURE__ */ new Set([
39
47
  ...node_module.builtinModules,
40
48
  "assert/strict",
@@ -55,7 +63,10 @@ function normalizeModuleId(id) {
55
63
  if (prefixedBuiltins.has(id)) {
56
64
  return id;
57
65
  }
58
- return id.replace(/\\/g, "/").replace(/^\/@fs\//, isWindows ? "" : "/").replace(/^file:\//, "/").replace(/^node:/, "").replace(/^\/+/, "/");
66
+ if (id.startsWith("file://")) {
67
+ return node_url.fileURLToPath(id);
68
+ }
69
+ return id.replace(/\\/g, "/").replace(/^\/@fs\//, isWindows ? "" : "/").replace(/^node:/, "").replace(/^\/+/, "/");
59
70
  }
60
71
  function isPrimitive(v) {
61
72
  return v !== Object(v);
package/dist/utils.mjs CHANGED
@@ -19,7 +19,10 @@ function normalizeRequestId(id, base) {
19
19
  if (driveRegexp && !(driveRegexp == null ? void 0 : driveRegexp.test(id)) && (driveOppositeRegext == null ? void 0 : driveOppositeRegext.test(id))) {
20
20
  id = id.replace(driveOppositeRegext, `${drive}$1`);
21
21
  }
22
- return id.replace(/^\/@id\/__x00__/, "\0").replace(/^\/@id\//, "").replace(/^__vite-browser-external:/, "").replace(/^file:(\/+)/, isWindows ? "" : "/").replace(/\?v=\w+/, "?").replace(/&v=\w+/, "").replace(/\?t=\w+/, "?").replace(/&t=\w+/, "").replace(/\?import/, "?").replace(/&import/, "").replace(/\?&/, "?").replace(/\?+$/, "");
22
+ if (id.startsWith("file://")) {
23
+ return fileURLToPath(id);
24
+ }
25
+ return id.replace(/^\/@id\/__x00__/, "\0").replace(/^\/@id\//, "").replace(/^__vite-browser-external:/, "").replace(/\?v=\w+/, "?").replace(/&v=\w+/, "").replace(/\?t=\w+/, "?").replace(/&t=\w+/, "").replace(/\?import/, "?").replace(/&import/, "").replace(/\?&/, "?").replace(/\?+$/, "");
23
26
  }
24
27
  const postfixRE = /[?#].*$/;
25
28
  function cleanUrl(url) {
@@ -32,7 +35,12 @@ const internalRequestRegexp = new RegExp(
32
35
  function isInternalRequest(id) {
33
36
  return internalRequestRegexp.test(id);
34
37
  }
35
- const prefixedBuiltins = /* @__PURE__ */ new Set(["node:test"]);
38
+ const prefixedBuiltins = /* @__PURE__ */ new Set([
39
+ "node:sea",
40
+ "node:sqlite",
41
+ "node:test",
42
+ "node:test/reporters"
43
+ ]);
36
44
  const builtins = /* @__PURE__ */ new Set([
37
45
  ...builtinModules,
38
46
  "assert/strict",
@@ -53,7 +61,10 @@ function normalizeModuleId(id) {
53
61
  if (prefixedBuiltins.has(id)) {
54
62
  return id;
55
63
  }
56
- return id.replace(/\\/g, "/").replace(/^\/@fs\//, isWindows ? "" : "/").replace(/^file:\//, "/").replace(/^node:/, "").replace(/^\/+/, "/");
64
+ if (id.startsWith("file://")) {
65
+ return fileURLToPath(id);
66
+ }
67
+ return id.replace(/\\/g, "/").replace(/^\/@fs\//, isWindows ? "" : "/").replace(/^node:/, "").replace(/^\/+/, "/");
57
68
  }
58
69
  function isPrimitive(v) {
59
70
  return v !== Object(v);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-node",
3
3
  "type": "module",
4
- "version": "3.0.0-beta.2",
4
+ "version": "3.0.0-beta.4",
5
5
  "description": "Vite as Node.js runtime",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -80,7 +80,7 @@
80
80
  "cac": "^6.7.14",
81
81
  "debug": "^4.4.0",
82
82
  "es-module-lexer": "^1.5.4",
83
- "pathe": "^1.1.2",
83
+ "pathe": "^2.0.0",
84
84
  "vite": "^5.0.0 || ^6.0.0"
85
85
  },
86
86
  "devDependencies": {