vite-node 0.12.6 → 0.12.9

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
@@ -3,13 +3,13 @@
3
3
  var events = require('events');
4
4
  var kolorist = require('kolorist');
5
5
  var vite = require('vite');
6
- var server = require('./server-c98deede.js');
7
- var client = require('./client-d42a1094.js');
6
+ var server = require('./server-f6511dc4.js');
7
+ var client = require('./client-f221b9b5.js');
8
8
  require('pathe');
9
9
  require('debug');
10
10
  require('fs');
11
11
  require('mlly');
12
- require('./utils-5d86aff6.js');
12
+ require('./utils-c2e3d5fd.js');
13
13
  require('url');
14
14
  require('module');
15
15
  require('vm');
@@ -627,7 +627,7 @@ class CAC extends events.EventEmitter {
627
627
 
628
628
  const cac = (name = "") => new CAC(name);
629
629
 
630
- var version = "0.12.6";
630
+ var version = "0.12.9";
631
631
 
632
632
  const cli = cac("vite-node");
633
633
  cli.version(version).option("-r, --root <path>", "Use specified root directory").option("-c, --config <path>", "Use specified config file").option("-w, --watch", 'Restart on file changes, similar to "nodemon"').help();
@@ -662,8 +662,8 @@ async function run(files, options = {}) {
662
662
  await runner.executeFile(file);
663
663
  if (!options.watch)
664
664
  await server$1.close();
665
- server$1.watcher.on("change", async (eventName, path) => {
666
- console.log(kolorist.dim(`[${eventName}] ${path}`));
665
+ server$1.watcher.on("change", async (path) => {
666
+ console.log(`${kolorist.cyan("[vite-node]")} File change detected. ${kolorist.dim(path)}`);
667
667
  Array.from(runner.moduleCache.keys()).forEach((i) => {
668
668
  if (!i.includes("node_modules"))
669
669
  runner.moduleCache.delete(i);
package/dist/cli.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { EventEmitter } from 'events';
2
- import { red, dim } from 'kolorist';
2
+ import { red, cyan, dim } from 'kolorist';
3
3
  import { createServer } from 'vite';
4
- import { V as ViteNodeServer } from './server-e4d25388.js';
5
- import { V as ViteNodeRunner } from './client-aa28334b.js';
4
+ import { V as ViteNodeServer } from './server-013a4491.js';
5
+ import { V as ViteNodeRunner } from './client-3270fd45.js';
6
6
  import 'pathe';
7
7
  import 'debug';
8
8
  import 'fs';
9
9
  import 'mlly';
10
- import './utils-0290448b.js';
10
+ import './utils-b4f03380.js';
11
11
  import 'url';
12
12
  import 'module';
13
13
  import 'vm';
@@ -625,7 +625,7 @@ class CAC extends EventEmitter {
625
625
 
626
626
  const cac = (name = "") => new CAC(name);
627
627
 
628
- var version = "0.12.6";
628
+ var version = "0.12.9";
629
629
 
630
630
  const cli = cac("vite-node");
631
631
  cli.version(version).option("-r, --root <path>", "Use specified root directory").option("-c, --config <path>", "Use specified config file").option("-w, --watch", 'Restart on file changes, similar to "nodemon"').help();
@@ -660,8 +660,8 @@ async function run(files, options = {}) {
660
660
  await runner.executeFile(file);
661
661
  if (!options.watch)
662
662
  await server.close();
663
- server.watcher.on("change", async (eventName, path) => {
664
- console.log(dim(`[${eventName}] ${path}`));
663
+ server.watcher.on("change", async (path) => {
664
+ console.log(`${cyan("[vite-node]")} File change detected. ${dim(path)}`);
665
665
  Array.from(runner.moduleCache.keys()).forEach((i) => {
666
666
  if (!i.includes("node_modules"))
667
667
  runner.moduleCache.delete(i);
@@ -4,7 +4,7 @@ import vm from 'vm';
4
4
  import { resolve, dirname, isAbsolute, extname } from 'pathe';
5
5
  import { isNodeBuiltin } from 'mlly';
6
6
  import createDebug from 'debug';
7
- import { n as normalizeModuleId, s as slash, a as normalizeRequestId, t as toFilePath, i as isPrimitive } from './utils-0290448b.js';
7
+ import { n as normalizeModuleId, s as slash, a as normalizeRequestId, t as toFilePath, i as isPrimitive, m as mergeSlashes } from './utils-b4f03380.js';
8
8
 
9
9
  const debugExecute = createDebug("vite-node:client:execute");
10
10
  const debugNative = createDebug("vite-node:client:native");
@@ -109,7 +109,7 @@ ${getStack()}`), 2e3);
109
109
  if (importer && importer.startsWith("mock:"))
110
110
  importer = importer.slice(5);
111
111
  const { id: id2 } = await this.options.resolveId(dep, importer) || {};
112
- dep = id2 && isAbsolute(id2) ? `/@fs/${id2}` : id2 || dep;
112
+ dep = id2 && isAbsolute(id2) ? mergeSlashes(`/@fs/${id2}`) : id2 || dep;
113
113
  }
114
114
  return dep;
115
115
  };
@@ -6,7 +6,7 @@ var vm = require('vm');
6
6
  var pathe = require('pathe');
7
7
  var mlly = require('mlly');
8
8
  var createDebug = require('debug');
9
- var utils = require('./utils-5d86aff6.js');
9
+ var utils = require('./utils-c2e3d5fd.js');
10
10
 
11
11
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
12
 
@@ -134,7 +134,7 @@ ${getStack()}`), 2e3);
134
134
  if (importer && importer.startsWith("mock:"))
135
135
  importer = importer.slice(5);
136
136
  const { id: id2 } = await this.options.resolveId(dep, importer) || {};
137
- dep = id2 && pathe.isAbsolute(id2) ? `/@fs/${id2}` : id2 || dep;
137
+ dep = id2 && pathe.isAbsolute(id2) ? utils.mergeSlashes(`/@fs/${id2}`) : id2 || dep;
138
138
  }
139
139
  return dep;
140
140
  };
package/dist/client.cjs CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var client = require('./client-d42a1094.js');
5
+ var client = require('./client-f221b9b5.js');
6
6
  require('module');
7
7
  require('url');
8
8
  require('vm');
9
9
  require('pathe');
10
10
  require('mlly');
11
11
  require('debug');
12
- require('./utils-5d86aff6.js');
12
+ require('./utils-c2e3d5fd.js');
13
13
 
14
14
 
15
15
 
package/dist/client.js CHANGED
@@ -1,8 +1,8 @@
1
- export { D as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, V as ViteNodeRunner } from './client-aa28334b.js';
1
+ export { D as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, V as ViteNodeRunner } from './client-3270fd45.js';
2
2
  import 'module';
3
3
  import 'url';
4
4
  import 'vm';
5
5
  import 'pathe';
6
6
  import 'mlly';
7
7
  import 'debug';
8
- import './utils-0290448b.js';
8
+ import './utils-b4f03380.js';
@@ -2,7 +2,7 @@ import { join } from 'pathe';
2
2
  import createDebug from 'debug';
3
3
  import { existsSync } from 'fs';
4
4
  import { isNodeBuiltin, isValidNodeImport } from 'mlly';
5
- import { s as slash, t as toFilePath, w as withInlineSourcemap } from './utils-0290448b.js';
5
+ import { s as slash, t as toFilePath, w as withInlineSourcemap } from './utils-b4f03380.js';
6
6
 
7
7
  const ESM_EXT_RE = /\.(es|esm|esm-browser|esm-bundler|es6|module)\.js$/;
8
8
  const ESM_FOLDER_RE = /\/esm\/(.*\.js)$/;
@@ -4,7 +4,7 @@ var pathe = require('pathe');
4
4
  var createDebug = require('debug');
5
5
  var fs = require('fs');
6
6
  var mlly = require('mlly');
7
- var utils = require('./utils-5d86aff6.js');
7
+ var utils = require('./utils-c2e3d5fd.js');
8
8
 
9
9
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
10
 
package/dist/server.cjs CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var server = require('./server-c98deede.js');
5
+ var server = require('./server-f6511dc4.js');
6
6
  require('pathe');
7
7
  require('debug');
8
8
  require('fs');
9
9
  require('mlly');
10
- require('./utils-5d86aff6.js');
10
+ require('./utils-c2e3d5fd.js');
11
11
  require('url');
12
12
 
13
13
 
package/dist/server.js CHANGED
@@ -1,7 +1,7 @@
1
- export { V as ViteNodeServer, g as guessCJSversion, s as shouldExternalize } from './server-e4d25388.js';
1
+ export { V as ViteNodeServer, g as guessCJSversion, s as shouldExternalize } from './server-013a4491.js';
2
2
  import 'pathe';
3
3
  import 'debug';
4
4
  import 'fs';
5
5
  import 'mlly';
6
- import './utils-0290448b.js';
6
+ import './utils-b4f03380.js';
7
7
  import 'url';
@@ -5,6 +5,9 @@ const isWindows = process.platform === "win32";
5
5
  function slash(str) {
6
6
  return str.replace(/\\/g, "/");
7
7
  }
8
+ function mergeSlashes(str) {
9
+ return str.replace(/\/\//g, "/");
10
+ }
8
11
  function normalizeRequestId(id, base) {
9
12
  if (base && id.startsWith(base))
10
13
  id = `/${id.slice(base.length)}`;
@@ -36,4 +39,4 @@ async function withInlineSourcemap(result) {
36
39
  return result;
37
40
  }
38
41
 
39
- export { normalizeRequestId as a, isWindows as b, isPrimitive as i, normalizeModuleId as n, slash as s, toFilePath as t, withInlineSourcemap as w };
42
+ export { normalizeRequestId as a, isWindows as b, isPrimitive as i, mergeSlashes as m, normalizeModuleId as n, slash as s, toFilePath as t, withInlineSourcemap as w };
@@ -7,6 +7,9 @@ const isWindows = process.platform === "win32";
7
7
  function slash(str) {
8
8
  return str.replace(/\\/g, "/");
9
9
  }
10
+ function mergeSlashes(str) {
11
+ return str.replace(/\/\//g, "/");
12
+ }
10
13
  function normalizeRequestId(id, base) {
11
14
  if (base && id.startsWith(base))
12
15
  id = `/${id.slice(base.length)}`;
@@ -40,6 +43,7 @@ async function withInlineSourcemap(result) {
40
43
 
41
44
  exports.isPrimitive = isPrimitive;
42
45
  exports.isWindows = isWindows;
46
+ exports.mergeSlashes = mergeSlashes;
43
47
  exports.normalizeModuleId = normalizeModuleId;
44
48
  exports.normalizeRequestId = normalizeRequestId;
45
49
  exports.slash = slash;
package/dist/utils.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var utils = require('./utils-5d86aff6.js');
5
+ var utils = require('./utils-c2e3d5fd.js');
6
6
  require('url');
7
7
  require('pathe');
8
8
 
@@ -10,6 +10,7 @@ require('pathe');
10
10
 
11
11
  exports.isPrimitive = utils.isPrimitive;
12
12
  exports.isWindows = utils.isWindows;
13
+ exports.mergeSlashes = utils.mergeSlashes;
13
14
  exports.normalizeModuleId = utils.normalizeModuleId;
14
15
  exports.normalizeRequestId = utils.normalizeRequestId;
15
16
  exports.slash = utils.slash;
package/dist/utils.d.ts CHANGED
@@ -2,10 +2,11 @@ import { TransformResult } from 'vite';
2
2
 
3
3
  declare const isWindows: boolean;
4
4
  declare function slash(str: string): string;
5
+ declare function mergeSlashes(str: string): string;
5
6
  declare function normalizeRequestId(id: string, base?: string): string;
6
7
  declare function normalizeModuleId(id: string): string;
7
8
  declare function isPrimitive(v: any): boolean;
8
9
  declare function toFilePath(id: string, root: string): string;
9
10
  declare function withInlineSourcemap(result: TransformResult): Promise<TransformResult>;
10
11
 
11
- export { isPrimitive, isWindows, normalizeModuleId, normalizeRequestId, slash, toFilePath, withInlineSourcemap };
12
+ export { isPrimitive, isWindows, mergeSlashes, normalizeModuleId, normalizeRequestId, slash, toFilePath, withInlineSourcemap };
package/dist/utils.js CHANGED
@@ -1,3 +1,3 @@
1
- export { i as isPrimitive, b as isWindows, n as normalizeModuleId, a as normalizeRequestId, s as slash, t as toFilePath, w as withInlineSourcemap } from './utils-0290448b.js';
1
+ export { i as isPrimitive, b as isWindows, m as mergeSlashes, n as normalizeModuleId, a as normalizeRequestId, s as slash, t as toFilePath, w as withInlineSourcemap } from './utils-b4f03380.js';
2
2
  import 'url';
3
3
  import 'pathe';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-node",
3
3
  "type": "module",
4
- "version": "0.12.6",
4
+ "version": "0.12.9",
5
5
  "description": "Vite as Node.js runtime",
6
6
  "homepage": "https://github.com/vitest-dev/vitest/blob/main/packages/vite-node#readme",
7
7
  "bugs": {
@@ -66,7 +66,7 @@
66
66
  "devDependencies": {
67
67
  "@types/debug": "^4.1.7",
68
68
  "cac": "^6.7.12",
69
- "rollup": "^2.72.1"
69
+ "rollup": "^2.73.0"
70
70
  },
71
71
  "engines": {
72
72
  "node": ">=v14.16.0"