vite-node 0.32.4 → 0.33.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.cjs CHANGED
@@ -6,8 +6,8 @@ var vite = require('vite');
6
6
  var server = require('./server.cjs');
7
7
  var client = require('./client.cjs');
8
8
  var utils = require('./utils.cjs');
9
- var hmr = require('./chunk-hmr.cjs');
10
9
  var sourceMap = require('./source-map.cjs');
10
+ var hmr = require('./chunk-hmr.cjs');
11
11
  require('perf_hooks');
12
12
  require('fs');
13
13
  require('pathe');
@@ -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.32.4";
27
+ var version = "0.33.0";
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.mjs CHANGED
@@ -17,7 +17,7 @@ import 'node:path';
17
17
  import 'node:vm';
18
18
  import 'node:events';
19
19
 
20
- var version = "0.32.4";
20
+ var version = "0.33.0";
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
@@ -439,7 +439,7 @@ function defineExport(exports, key, value) {
439
439
  function exportAll(exports, sourceModule) {
440
440
  if (exports === sourceModule)
441
441
  return;
442
- if (utils.isPrimitive(sourceModule) || Array.isArray(sourceModule))
442
+ if (utils.isPrimitive(sourceModule) || Array.isArray(sourceModule) || sourceModule instanceof Promise)
443
443
  return;
444
444
  for (const key in sourceModule) {
445
445
  if (key !== "default") {
package/dist/client.mjs CHANGED
@@ -412,7 +412,7 @@ function defineExport(exports, key, value) {
412
412
  function exportAll(exports, sourceModule) {
413
413
  if (exports === sourceModule)
414
414
  return;
415
- if (isPrimitive(sourceModule) || Array.isArray(sourceModule))
415
+ if (isPrimitive(sourceModule) || Array.isArray(sourceModule) || sourceModule instanceof Promise)
416
416
  return;
417
417
  for (const key in sourceModule) {
418
418
  if (key !== "default") {
package/dist/server.cjs CHANGED
@@ -95,7 +95,7 @@ async function shouldExternalize(id, options, cache = _defaultExternalizeCache)
95
95
  return cache.get(id);
96
96
  }
97
97
  async function _shouldExternalize(id, options) {
98
- if (mlly.isNodeBuiltin(id))
98
+ if (utils.isNodeBuiltin(id))
99
99
  return id;
100
100
  if (id.startsWith("data:"))
101
101
  return id;
package/dist/server.mjs CHANGED
@@ -2,8 +2,8 @@ import { performance } from 'node:perf_hooks';
2
2
  import { existsSync, promises } from 'node:fs';
3
3
  import { join, resolve, relative } from 'pathe';
4
4
  import createDebug from 'debug';
5
- import { isNodeBuiltin, isValidNodeImport } from 'mlly';
6
- import { slash, toArray, normalizeModuleId, toFilePath } from './utils.mjs';
5
+ import { isValidNodeImport } from 'mlly';
6
+ import { isNodeBuiltin, slash, toArray, normalizeModuleId, toFilePath } from './utils.mjs';
7
7
  import c from 'picocolors';
8
8
  import { withInlineSourcemap } from './source-map.mjs';
9
9
  import 'node:url';
package/dist/utils.cjs CHANGED
@@ -30,7 +30,28 @@ const internalRequestRegexp = new RegExp(`^/?(${internalRequests.join("|")})$`);
30
30
  function isInternalRequest(id) {
31
31
  return internalRequestRegexp.test(id);
32
32
  }
33
+ const prefixedBuiltins = /* @__PURE__ */ new Set([
34
+ "node:test"
35
+ ]);
36
+ const builtins = /* @__PURE__ */ new Set([
37
+ ...module$1.builtinModules,
38
+ "assert/strict",
39
+ "diagnostics_channel",
40
+ "dns/promises",
41
+ "fs/promises",
42
+ "path/posix",
43
+ "path/win32",
44
+ "readline/promises",
45
+ "stream/consumers",
46
+ "stream/promises",
47
+ "stream/web",
48
+ "timers/promises",
49
+ "util/types",
50
+ "wasi"
51
+ ]);
33
52
  function normalizeModuleId(id) {
53
+ if (prefixedBuiltins.has(id))
54
+ return id;
34
55
  return id.replace(/\\/g, "/").replace(/^\/@fs\//, isWindows ? "" : "/").replace(/^file:\//, "/").replace(/^node:/, "").replace(/^\/+/, "/");
35
56
  }
36
57
  function isPrimitive(v) {
@@ -56,24 +77,10 @@ function toFilePath(id, root) {
56
77
  exists
57
78
  };
58
79
  }
59
- const builtins = /* @__PURE__ */ new Set([
60
- ...module$1.builtinModules,
61
- "assert/strict",
62
- "diagnostics_channel",
63
- "dns/promises",
64
- "fs/promises",
65
- "path/posix",
66
- "path/win32",
67
- "readline/promises",
68
- "stream/consumers",
69
- "stream/promises",
70
- "stream/web",
71
- "timers/promises",
72
- "util/types",
73
- "wasi"
74
- ]);
75
80
  const NODE_BUILTIN_NAMESPACE = "node:";
76
81
  function isNodeBuiltin(id) {
82
+ if (prefixedBuiltins.has(id))
83
+ return true;
77
84
  return builtins.has(
78
85
  id.startsWith(NODE_BUILTIN_NAMESPACE) ? id.slice(NODE_BUILTIN_NAMESPACE.length) : id
79
86
  );
package/dist/utils.mjs CHANGED
@@ -26,7 +26,28 @@ const internalRequestRegexp = new RegExp(`^/?(${internalRequests.join("|")})$`);
26
26
  function isInternalRequest(id) {
27
27
  return internalRequestRegexp.test(id);
28
28
  }
29
+ const prefixedBuiltins = /* @__PURE__ */ new Set([
30
+ "node:test"
31
+ ]);
32
+ const builtins = /* @__PURE__ */ new Set([
33
+ ...builtinModules,
34
+ "assert/strict",
35
+ "diagnostics_channel",
36
+ "dns/promises",
37
+ "fs/promises",
38
+ "path/posix",
39
+ "path/win32",
40
+ "readline/promises",
41
+ "stream/consumers",
42
+ "stream/promises",
43
+ "stream/web",
44
+ "timers/promises",
45
+ "util/types",
46
+ "wasi"
47
+ ]);
29
48
  function normalizeModuleId(id) {
49
+ if (prefixedBuiltins.has(id))
50
+ return id;
30
51
  return id.replace(/\\/g, "/").replace(/^\/@fs\//, isWindows ? "" : "/").replace(/^file:\//, "/").replace(/^node:/, "").replace(/^\/+/, "/");
31
52
  }
32
53
  function isPrimitive(v) {
@@ -52,24 +73,10 @@ function toFilePath(id, root) {
52
73
  exists
53
74
  };
54
75
  }
55
- const builtins = /* @__PURE__ */ new Set([
56
- ...builtinModules,
57
- "assert/strict",
58
- "diagnostics_channel",
59
- "dns/promises",
60
- "fs/promises",
61
- "path/posix",
62
- "path/win32",
63
- "readline/promises",
64
- "stream/consumers",
65
- "stream/promises",
66
- "stream/web",
67
- "timers/promises",
68
- "util/types",
69
- "wasi"
70
- ]);
71
76
  const NODE_BUILTIN_NAMESPACE = "node:";
72
77
  function isNodeBuiltin(id) {
78
+ if (prefixedBuiltins.has(id))
79
+ return true;
73
80
  return builtins.has(
74
81
  id.startsWith(NODE_BUILTIN_NAMESPACE) ? id.slice(NODE_BUILTIN_NAMESPACE.length) : id
75
82
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-node",
3
- "version": "0.32.4",
3
+ "version": "0.33.0",
4
4
  "description": "Vite as Node.js runtime",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",