vite-node 2.1.3 → 2.1.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
@@ -83,8 +83,8 @@ In Vite Node, the server and runner (client) are separated, so you can integrate
83
83
 
84
84
  ```ts
85
85
  import { createServer } from 'vite'
86
- import { ViteNodeServer } from 'vite-node/server'
87
86
  import { ViteNodeRunner } from 'vite-node/client'
87
+ import { ViteNodeServer } from 'vite-node/server'
88
88
  import { installSourcemapsSupport } from 'vite-node/source-map'
89
89
 
90
90
  // create vite server
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var node_events = require('node:events');
4
- var browser = require('./chunk-browser.cjs');
5
4
  var createDebug = require('debug');
5
+ var browser = require('./chunk-browser.cjs');
6
6
  var utils = require('./utils.cjs');
7
7
 
8
8
  function createHmrEmitter() {
@@ -1,6 +1,6 @@
1
1
  import { EventEmitter } from 'node:events';
2
- import { f } from './chunk-browser.mjs';
3
2
  import createDebug from 'debug';
3
+ import { f } from './chunk-browser.mjs';
4
4
  import { normalizeRequestId } from './utils.mjs';
5
5
 
6
6
  function createHmrEmitter() {
package/dist/cli.cjs CHANGED
@@ -4,23 +4,23 @@ var path = require('node:path');
4
4
  var cac = require('cac');
5
5
  var browser = require('./chunk-browser.cjs');
6
6
  var vite = require('vite');
7
- var server = require('./server.cjs');
8
7
  var client = require('./client.cjs');
9
- var utils = require('./utils.cjs');
8
+ var server = require('./server.cjs');
10
9
  var sourceMap = require('./source-map.cjs');
10
+ var utils = require('./utils.cjs');
11
11
  var hmr = require('./chunk-hmr.cjs');
12
- require('node:perf_hooks');
13
- require('node:fs');
14
- require('node:assert');
12
+ require('node:module');
15
13
  require('node:url');
16
- require('pathe');
14
+ require('node:vm');
17
15
  require('debug');
16
+ require('pathe');
17
+ require('node:fs');
18
+ require('node:assert');
19
+ require('node:perf_hooks');
18
20
  require('./constants.cjs');
19
- require('node:module');
20
- require('node:vm');
21
21
  require('node:events');
22
22
 
23
- var version = "2.1.3";
23
+ var version = "2.1.4";
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.mjs CHANGED
@@ -2,23 +2,23 @@ import { resolve } from 'node:path';
2
2
  import cac from 'cac';
3
3
  import { f } from './chunk-browser.mjs';
4
4
  import { createServer, loadEnv } from 'vite';
5
- import { ViteNodeServer } from './server.mjs';
6
5
  import { ViteNodeRunner } from './client.mjs';
7
- import { toArray } from './utils.mjs';
6
+ import { ViteNodeServer } from './server.mjs';
8
7
  import { installSourcemapsSupport } from './source-map.mjs';
8
+ import { toArray } from './utils.mjs';
9
9
  import { v as viteNodeHmrPlugin, a as createHotContext, h as handleMessage } from './chunk-hmr.mjs';
10
- import 'node:perf_hooks';
11
- import 'node:fs';
12
- import 'node:assert';
10
+ import 'node:module';
13
11
  import 'node:url';
14
- import 'pathe';
12
+ import 'node:vm';
15
13
  import 'debug';
14
+ import 'pathe';
15
+ import 'node:fs';
16
+ import 'node:assert';
17
+ import 'node:perf_hooks';
16
18
  import './constants.mjs';
17
- import 'node:module';
18
- import 'node:vm';
19
19
  import 'node:events';
20
20
 
21
- var version = "2.1.3";
21
+ var version = "2.1.4";
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.cjs CHANGED
@@ -4,10 +4,10 @@ var node_module = require('node:module');
4
4
  var path = require('node:path');
5
5
  var node_url = require('node:url');
6
6
  var vm = require('node:vm');
7
- var pathe = require('pathe');
8
7
  var createDebug = require('debug');
9
- var utils = require('./utils.cjs');
10
8
  var sourceMap = require('./source-map.cjs');
9
+ var utils = require('./utils.cjs');
10
+ require('pathe');
11
11
  require('node:fs');
12
12
 
13
13
  const { setTimeout, clearTimeout } = globalThis;
@@ -167,7 +167,7 @@ class ViteNodeRunner {
167
167
  */
168
168
  moduleCache;
169
169
  async executeFile(file) {
170
- const url = `/@fs/${utils.slash(pathe.resolve(file))}`;
170
+ const url = `/@fs/${utils.slash(path.resolve(file))}`;
171
171
  return await this.cachedRequest(url, url, []);
172
172
  }
173
173
  async executeId(rawId) {
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-z0R8hVRu.js';
2
1
  import './trace-mapping.d-DLVdEqOp.js';
2
+ export { e as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, a as ViteNodeRunner } from './index-z0R8hVRu.js';
package/dist/client.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  import { createRequire } from 'node:module';
2
- import { dirname } from 'node:path';
2
+ import { resolve, dirname } from 'node:path';
3
3
  import { pathToFileURL, fileURLToPath } from 'node:url';
4
4
  import vm from 'node:vm';
5
- import { resolve } from 'pathe';
6
5
  import createDebug from 'debug';
7
- import { createImportMetaEnvProxy, normalizeModuleId, slash, isInternalRequest, isNodeBuiltin, normalizeRequestId, toFilePath, cleanUrl, isPrimitive } from './utils.mjs';
8
6
  import { extractSourceMap } from './source-map.mjs';
7
+ import { createImportMetaEnvProxy, normalizeModuleId, slash, isInternalRequest, isNodeBuiltin, normalizeRequestId, toFilePath, cleanUrl, isPrimitive } from './utils.mjs';
8
+ import 'pathe';
9
9
  import 'node:fs';
10
10
 
11
11
  const { setTimeout, clearTimeout } = globalThis;
package/dist/hmr.cjs CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  var hmr = require('./chunk-hmr.cjs');
4
4
  require('node:events');
5
- require('./chunk-browser.cjs');
6
5
  require('debug');
6
+ require('./chunk-browser.cjs');
7
7
  require('./utils.cjs');
8
- require('node:url');
9
- require('node:module');
10
8
  require('node:fs');
9
+ require('node:module');
10
+ require('node:url');
11
11
  require('pathe');
12
12
 
13
13
 
package/dist/hmr.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { EventEmitter } from 'node:events';
2
1
  import { HMRPayload, Plugin } from 'vite';
2
+ import { EventEmitter } from 'node:events';
3
3
  import { C as CustomEventMap, a as ViteNodeRunner, H as HMRPayload$1, b as HotContext } from './index-z0R8hVRu.js';
4
4
  import './trace-mapping.d-DLVdEqOp.js';
5
5
 
package/dist/hmr.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  export { c as createHmrEmitter, a as createHotContext, g as getCache, h as handleMessage, r as reload, s as sendMessageBuffer, v as viteNodeHmrPlugin } from './chunk-hmr.mjs';
2
2
  import 'node:events';
3
- import './chunk-browser.mjs';
4
3
  import 'debug';
4
+ import './chunk-browser.mjs';
5
5
  import './utils.mjs';
6
- import 'node:url';
7
- import 'node:module';
8
6
  import 'node:fs';
7
+ import 'node:module';
8
+ import 'node:url';
9
9
  import 'pathe';
package/dist/server.cjs CHANGED
@@ -1,18 +1,115 @@
1
1
  'use strict';
2
2
 
3
- var node_perf_hooks = require('node:perf_hooks');
4
- var fs = require('node:fs');
5
3
  var assert = require('node:assert');
4
+ var fs = require('node:fs');
5
+ var node_perf_hooks = require('node:perf_hooks');
6
6
  var node_url = require('node:url');
7
- var pathe = require('pathe');
8
7
  var createDebug = require('debug');
9
- var utils = require('./utils.cjs');
10
- var constants = require('./constants.cjs');
8
+ var pathe = require('pathe');
11
9
  var browser = require('./chunk-browser.cjs');
10
+ var constants = require('./constants.cjs');
11
+ var utils = require('./utils.cjs');
12
12
  var sourceMap = require('./source-map.cjs');
13
13
  require('node:module');
14
14
  require('node:path');
15
15
 
16
+ function hashCode(s) {
17
+ return s.split("").reduce((a, b) => {
18
+ a = (a << 5) - a + b.charCodeAt(0);
19
+ return a & a;
20
+ }, 0);
21
+ }
22
+ class Debugger {
23
+ constructor(root, options) {
24
+ this.options = options;
25
+ if (options.dumpModules) {
26
+ this.dumpDir = pathe.resolve(
27
+ root,
28
+ options.dumpModules === true ? ".vite-node/dump" : options.dumpModules
29
+ );
30
+ }
31
+ if (this.dumpDir) {
32
+ if (options.loadDumppedModules) {
33
+ console.info(
34
+ browser.f.gray(`[vite-node] [debug] load modules from ${this.dumpDir}`)
35
+ );
36
+ } else {
37
+ console.info(
38
+ browser.f.gray(`[vite-node] [debug] dump modules to ${this.dumpDir}`)
39
+ );
40
+ }
41
+ }
42
+ this.initPromise = this.clearDump();
43
+ }
44
+ dumpDir;
45
+ initPromise;
46
+ externalizeMap = /* @__PURE__ */ new Map();
47
+ async clearDump() {
48
+ if (!this.dumpDir) {
49
+ return;
50
+ }
51
+ if (!this.options.loadDumppedModules && fs.existsSync(this.dumpDir)) {
52
+ await fs.promises.rm(this.dumpDir, { recursive: true, force: true });
53
+ }
54
+ await fs.promises.mkdir(this.dumpDir, { recursive: true });
55
+ }
56
+ encodeId(id) {
57
+ return `${id.replace(/[^\w@\-]/g, "_").replace(/_+/g, "_")}-${hashCode(
58
+ id
59
+ )}.js`;
60
+ }
61
+ async recordExternalize(id, path) {
62
+ if (!this.dumpDir) {
63
+ return;
64
+ }
65
+ this.externalizeMap.set(id, path);
66
+ await this.writeInfo();
67
+ }
68
+ async dumpFile(id, result) {
69
+ if (!result || !this.dumpDir) {
70
+ return;
71
+ }
72
+ await this.initPromise;
73
+ const name = this.encodeId(id);
74
+ return await fs.promises.writeFile(
75
+ pathe.join(this.dumpDir, name),
76
+ `// ${id.replace(/\0/g, "\\0")}
77
+ ${result.code}`,
78
+ "utf-8"
79
+ );
80
+ }
81
+ async loadDump(id) {
82
+ if (!this.dumpDir) {
83
+ return null;
84
+ }
85
+ await this.initPromise;
86
+ const name = this.encodeId(id);
87
+ const path = pathe.join(this.dumpDir, name);
88
+ if (!fs.existsSync(path)) {
89
+ return null;
90
+ }
91
+ const code = await fs.promises.readFile(path, "utf-8");
92
+ return {
93
+ code: code.replace(/^\/\/.*\n/, ""),
94
+ map: void 0
95
+ };
96
+ }
97
+ async writeInfo() {
98
+ if (!this.dumpDir) {
99
+ return;
100
+ }
101
+ const info = JSON.stringify(
102
+ {
103
+ time: (/* @__PURE__ */ new Date()).toLocaleString(),
104
+ externalize: Object.fromEntries(this.externalizeMap.entries())
105
+ },
106
+ null,
107
+ 2
108
+ );
109
+ return fs.promises.writeFile(pathe.join(this.dumpDir, "info.json"), info, "utf-8");
110
+ }
111
+ }
112
+
16
113
  const BUILTIN_EXTENSIONS = /* @__PURE__ */ new Set([".mjs", ".cjs", ".node", ".wasm"]);
17
114
  const ESM_SYNTAX_RE = /(?:[\s;]|^)(?:import[\s\w*,{}]*from|import\s*["'*{]|export\b\s*(?:[*{]|default|class|type|function|const|var|let|async function)|import\.meta\b)/m;
18
115
  const ESM_EXT_RE = /\.(es|esm|esm-browser|esm-bundler|es6|module)\.js$/;
@@ -147,103 +244,6 @@ function patchWindowsImportPath(path) {
147
244
  }
148
245
  }
149
246
 
150
- function hashCode(s) {
151
- return s.split("").reduce((a, b) => {
152
- a = (a << 5) - a + b.charCodeAt(0);
153
- return a & a;
154
- }, 0);
155
- }
156
- class Debugger {
157
- constructor(root, options) {
158
- this.options = options;
159
- if (options.dumpModules) {
160
- this.dumpDir = pathe.resolve(
161
- root,
162
- options.dumpModules === true ? ".vite-node/dump" : options.dumpModules
163
- );
164
- }
165
- if (this.dumpDir) {
166
- if (options.loadDumppedModules) {
167
- console.info(
168
- browser.f.gray(`[vite-node] [debug] load modules from ${this.dumpDir}`)
169
- );
170
- } else {
171
- console.info(
172
- browser.f.gray(`[vite-node] [debug] dump modules to ${this.dumpDir}`)
173
- );
174
- }
175
- }
176
- this.initPromise = this.clearDump();
177
- }
178
- dumpDir;
179
- initPromise;
180
- externalizeMap = /* @__PURE__ */ new Map();
181
- async clearDump() {
182
- if (!this.dumpDir) {
183
- return;
184
- }
185
- if (!this.options.loadDumppedModules && fs.existsSync(this.dumpDir)) {
186
- await fs.promises.rm(this.dumpDir, { recursive: true, force: true });
187
- }
188
- await fs.promises.mkdir(this.dumpDir, { recursive: true });
189
- }
190
- encodeId(id) {
191
- return `${id.replace(/[^\w@\-]/g, "_").replace(/_+/g, "_")}-${hashCode(
192
- id
193
- )}.js`;
194
- }
195
- async recordExternalize(id, path) {
196
- if (!this.dumpDir) {
197
- return;
198
- }
199
- this.externalizeMap.set(id, path);
200
- await this.writeInfo();
201
- }
202
- async dumpFile(id, result) {
203
- if (!result || !this.dumpDir) {
204
- return;
205
- }
206
- await this.initPromise;
207
- const name = this.encodeId(id);
208
- return await fs.promises.writeFile(
209
- pathe.join(this.dumpDir, name),
210
- `// ${id.replace(/\0/g, "\\0")}
211
- ${result.code}`,
212
- "utf-8"
213
- );
214
- }
215
- async loadDump(id) {
216
- if (!this.dumpDir) {
217
- return null;
218
- }
219
- await this.initPromise;
220
- const name = this.encodeId(id);
221
- const path = pathe.join(this.dumpDir, name);
222
- if (!fs.existsSync(path)) {
223
- return null;
224
- }
225
- const code = await fs.promises.readFile(path, "utf-8");
226
- return {
227
- code: code.replace(/^\/\/.*\n/, ""),
228
- map: void 0
229
- };
230
- }
231
- async writeInfo() {
232
- if (!this.dumpDir) {
233
- return;
234
- }
235
- const info = JSON.stringify(
236
- {
237
- time: (/* @__PURE__ */ new Date()).toLocaleString(),
238
- externalize: Object.fromEntries(this.externalizeMap.entries())
239
- },
240
- null,
241
- 2
242
- );
243
- return fs.promises.writeFile(pathe.join(this.dumpDir, "info.json"), info, "utf-8");
244
- }
245
- }
246
-
247
247
  const debugRequest = createDebug("vite-node:server:request");
248
248
  class ViteNodeServer {
249
249
  constructor(server, options = {}) {
package/dist/server.mjs CHANGED
@@ -1,16 +1,113 @@
1
- import { performance } from 'node:perf_hooks';
2
- import { existsSync, promises } from 'node:fs';
3
1
  import assert from 'node:assert';
2
+ import { existsSync, promises } from 'node:fs';
3
+ import { performance } from 'node:perf_hooks';
4
4
  import { pathToFileURL } from 'node:url';
5
- import { join, extname, dirname, resolve, relative, normalize } from 'pathe';
6
5
  import createDebug from 'debug';
7
- import { isNodeBuiltin, slash, findNearestPackageData, toArray, withTrailingSlash, normalizeModuleId, toFilePath } from './utils.mjs';
8
- import { KNOWN_ASSET_RE } from './constants.mjs';
6
+ import { resolve, join, extname, dirname, relative, normalize } from 'pathe';
9
7
  import { f } from './chunk-browser.mjs';
8
+ import { KNOWN_ASSET_RE } from './constants.mjs';
9
+ import { isNodeBuiltin, slash, findNearestPackageData, toArray, withTrailingSlash, normalizeModuleId, toFilePath } from './utils.mjs';
10
10
  import { withInlineSourcemap } from './source-map.mjs';
11
11
  import 'node:module';
12
12
  import 'node:path';
13
13
 
14
+ function hashCode(s) {
15
+ return s.split("").reduce((a, b) => {
16
+ a = (a << 5) - a + b.charCodeAt(0);
17
+ return a & a;
18
+ }, 0);
19
+ }
20
+ class Debugger {
21
+ constructor(root, options) {
22
+ this.options = options;
23
+ if (options.dumpModules) {
24
+ this.dumpDir = resolve(
25
+ root,
26
+ options.dumpModules === true ? ".vite-node/dump" : options.dumpModules
27
+ );
28
+ }
29
+ if (this.dumpDir) {
30
+ if (options.loadDumppedModules) {
31
+ console.info(
32
+ f.gray(`[vite-node] [debug] load modules from ${this.dumpDir}`)
33
+ );
34
+ } else {
35
+ console.info(
36
+ f.gray(`[vite-node] [debug] dump modules to ${this.dumpDir}`)
37
+ );
38
+ }
39
+ }
40
+ this.initPromise = this.clearDump();
41
+ }
42
+ dumpDir;
43
+ initPromise;
44
+ externalizeMap = /* @__PURE__ */ new Map();
45
+ async clearDump() {
46
+ if (!this.dumpDir) {
47
+ return;
48
+ }
49
+ if (!this.options.loadDumppedModules && existsSync(this.dumpDir)) {
50
+ await promises.rm(this.dumpDir, { recursive: true, force: true });
51
+ }
52
+ await promises.mkdir(this.dumpDir, { recursive: true });
53
+ }
54
+ encodeId(id) {
55
+ return `${id.replace(/[^\w@\-]/g, "_").replace(/_+/g, "_")}-${hashCode(
56
+ id
57
+ )}.js`;
58
+ }
59
+ async recordExternalize(id, path) {
60
+ if (!this.dumpDir) {
61
+ return;
62
+ }
63
+ this.externalizeMap.set(id, path);
64
+ await this.writeInfo();
65
+ }
66
+ async dumpFile(id, result) {
67
+ if (!result || !this.dumpDir) {
68
+ return;
69
+ }
70
+ await this.initPromise;
71
+ const name = this.encodeId(id);
72
+ return await promises.writeFile(
73
+ join(this.dumpDir, name),
74
+ `// ${id.replace(/\0/g, "\\0")}
75
+ ${result.code}`,
76
+ "utf-8"
77
+ );
78
+ }
79
+ async loadDump(id) {
80
+ if (!this.dumpDir) {
81
+ return null;
82
+ }
83
+ await this.initPromise;
84
+ const name = this.encodeId(id);
85
+ const path = join(this.dumpDir, name);
86
+ if (!existsSync(path)) {
87
+ return null;
88
+ }
89
+ const code = await promises.readFile(path, "utf-8");
90
+ return {
91
+ code: code.replace(/^\/\/.*\n/, ""),
92
+ map: void 0
93
+ };
94
+ }
95
+ async writeInfo() {
96
+ if (!this.dumpDir) {
97
+ return;
98
+ }
99
+ const info = JSON.stringify(
100
+ {
101
+ time: (/* @__PURE__ */ new Date()).toLocaleString(),
102
+ externalize: Object.fromEntries(this.externalizeMap.entries())
103
+ },
104
+ null,
105
+ 2
106
+ );
107
+ return promises.writeFile(join(this.dumpDir, "info.json"), info, "utf-8");
108
+ }
109
+ }
110
+
14
111
  const BUILTIN_EXTENSIONS = /* @__PURE__ */ new Set([".mjs", ".cjs", ".node", ".wasm"]);
15
112
  const ESM_SYNTAX_RE = /(?:[\s;]|^)(?:import[\s\w*,{}]*from|import\s*["'*{]|export\b\s*(?:[*{]|default|class|type|function|const|var|let|async function)|import\.meta\b)/m;
16
113
  const ESM_EXT_RE = /\.(es|esm|esm-browser|esm-bundler|es6|module)\.js$/;
@@ -145,103 +242,6 @@ function patchWindowsImportPath(path) {
145
242
  }
146
243
  }
147
244
 
148
- function hashCode(s) {
149
- return s.split("").reduce((a, b) => {
150
- a = (a << 5) - a + b.charCodeAt(0);
151
- return a & a;
152
- }, 0);
153
- }
154
- class Debugger {
155
- constructor(root, options) {
156
- this.options = options;
157
- if (options.dumpModules) {
158
- this.dumpDir = resolve(
159
- root,
160
- options.dumpModules === true ? ".vite-node/dump" : options.dumpModules
161
- );
162
- }
163
- if (this.dumpDir) {
164
- if (options.loadDumppedModules) {
165
- console.info(
166
- f.gray(`[vite-node] [debug] load modules from ${this.dumpDir}`)
167
- );
168
- } else {
169
- console.info(
170
- f.gray(`[vite-node] [debug] dump modules to ${this.dumpDir}`)
171
- );
172
- }
173
- }
174
- this.initPromise = this.clearDump();
175
- }
176
- dumpDir;
177
- initPromise;
178
- externalizeMap = /* @__PURE__ */ new Map();
179
- async clearDump() {
180
- if (!this.dumpDir) {
181
- return;
182
- }
183
- if (!this.options.loadDumppedModules && existsSync(this.dumpDir)) {
184
- await promises.rm(this.dumpDir, { recursive: true, force: true });
185
- }
186
- await promises.mkdir(this.dumpDir, { recursive: true });
187
- }
188
- encodeId(id) {
189
- return `${id.replace(/[^\w@\-]/g, "_").replace(/_+/g, "_")}-${hashCode(
190
- id
191
- )}.js`;
192
- }
193
- async recordExternalize(id, path) {
194
- if (!this.dumpDir) {
195
- return;
196
- }
197
- this.externalizeMap.set(id, path);
198
- await this.writeInfo();
199
- }
200
- async dumpFile(id, result) {
201
- if (!result || !this.dumpDir) {
202
- return;
203
- }
204
- await this.initPromise;
205
- const name = this.encodeId(id);
206
- return await promises.writeFile(
207
- join(this.dumpDir, name),
208
- `// ${id.replace(/\0/g, "\\0")}
209
- ${result.code}`,
210
- "utf-8"
211
- );
212
- }
213
- async loadDump(id) {
214
- if (!this.dumpDir) {
215
- return null;
216
- }
217
- await this.initPromise;
218
- const name = this.encodeId(id);
219
- const path = join(this.dumpDir, name);
220
- if (!existsSync(path)) {
221
- return null;
222
- }
223
- const code = await promises.readFile(path, "utf-8");
224
- return {
225
- code: code.replace(/^\/\/.*\n/, ""),
226
- map: void 0
227
- };
228
- }
229
- async writeInfo() {
230
- if (!this.dumpDir) {
231
- return;
232
- }
233
- const info = JSON.stringify(
234
- {
235
- time: (/* @__PURE__ */ new Date()).toLocaleString(),
236
- externalize: Object.fromEntries(this.externalizeMap.entries())
237
- },
238
- null,
239
- 2
240
- );
241
- return promises.writeFile(join(this.dumpDir, "info.json"), info, "utf-8");
242
- }
243
- }
244
-
245
245
  const debugRequest = createDebug("vite-node:server:request");
246
246
  class ViteNodeServer {
247
247
  constructor(server, options = {}) {
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
3
  var pathe = require('pathe');
4
- var utils = require('./utils.cjs');
5
- var path = require('node:path');
6
4
  var fs = require('node:fs');
7
- require('node:url');
5
+ var path = require('node:path');
6
+ var utils = require('./utils.cjs');
8
7
  require('node:module');
8
+ require('node:url');
9
9
 
10
10
  const comma = ','.charCodeAt(0);
11
11
  const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
@@ -1,9 +1,9 @@
1
1
  import { isAbsolute, resolve as resolve$2, relative, dirname } from 'pathe';
2
- import { withTrailingSlash } from './utils.mjs';
3
- import path from 'node:path';
4
2
  import fs from 'node:fs';
5
- import 'node:url';
3
+ import path from 'node:path';
4
+ import { withTrailingSlash } from './utils.mjs';
6
5
  import 'node:module';
6
+ import 'node:url';
7
7
 
8
8
  const comma = ','.charCodeAt(0);
9
9
  const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
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, l as ViteNodeResolveModule, k as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-z0R8hVRu.js';
2
1
  export { D as DecodedSourceMap, E as EncodedSourceMap, S as SourceMapInput } from './trace-mapping.d-DLVdEqOp.js';
2
+ 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, l as ViteNodeResolveModule, k as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-z0R8hVRu.js';
package/dist/utils.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var node_url = require('node:url');
4
- var node_module = require('node:module');
5
3
  var fs = require('node:fs');
4
+ var node_module = require('node:module');
5
+ var node_url = require('node:url');
6
6
  var pathe = require('pathe');
7
7
 
8
8
  const isWindows = process.platform === "win32";
package/dist/utils.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { fileURLToPath, pathToFileURL } from 'node:url';
2
- import { builtinModules } from 'node:module';
3
1
  import { existsSync, promises } from 'node:fs';
2
+ import { builtinModules } from 'node:module';
3
+ import { fileURLToPath, pathToFileURL } from 'node:url';
4
4
  import { resolve, dirname, join } from 'pathe';
5
5
 
6
6
  const isWindows = process.platform === "win32";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-node",
3
3
  "type": "module",
4
- "version": "2.1.3",
4
+ "version": "2.1.4",
5
5
  "description": "Vite as Node.js runtime",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -78,7 +78,7 @@
78
78
  },
79
79
  "dependencies": {
80
80
  "cac": "^6.7.14",
81
- "debug": "^4.3.6",
81
+ "debug": "^4.3.7",
82
82
  "pathe": "^1.1.2",
83
83
  "vite": "^5.0.0"
84
84
  },