vite-node 2.0.0-beta.9 → 2.0.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/client.cjs CHANGED
@@ -52,10 +52,11 @@ class ModuleCacheMap extends Map {
52
52
  */
53
53
  update(fsPath, mod) {
54
54
  fsPath = this.normalizePath(fsPath);
55
- if (!super.has(fsPath))
55
+ if (!super.has(fsPath)) {
56
56
  this.setByModuleId(fsPath, mod);
57
- else
57
+ } else {
58
58
  Object.assign(super.get(fsPath), mod);
59
+ }
59
60
  return this;
60
61
  }
61
62
  setByModuleId(modulePath, mod) {
@@ -65,8 +66,9 @@ class ModuleCacheMap extends Map {
65
66
  return this.setByModuleId(this.normalizePath(fsPath), mod);
66
67
  }
67
68
  getByModuleId(modulePath) {
68
- if (!super.has(modulePath))
69
+ if (!super.has(modulePath)) {
69
70
  this.setByModuleId(modulePath, {});
71
+ }
70
72
  const mod = super.get(modulePath);
71
73
  if (!mod.imports) {
72
74
  Object.assign(mod, {
@@ -101,12 +103,14 @@ class ModuleCacheMap extends Map {
101
103
  invalidateDepTree(ids, invalidated = /* @__PURE__ */ new Set()) {
102
104
  for (const _id of ids) {
103
105
  const id = this.normalizePath(_id);
104
- if (invalidated.has(id))
106
+ if (invalidated.has(id)) {
105
107
  continue;
108
+ }
106
109
  invalidated.add(id);
107
110
  const mod = super.get(id);
108
- if (mod == null ? void 0 : mod.importers)
111
+ if (mod == null ? void 0 : mod.importers) {
109
112
  this.invalidateDepTree(mod.importers, invalidated);
113
+ }
110
114
  super.delete(id);
111
115
  }
112
116
  return invalidated;
@@ -117,8 +121,9 @@ class ModuleCacheMap extends Map {
117
121
  invalidateSubDepTree(ids, invalidated = /* @__PURE__ */ new Set()) {
118
122
  for (const _id of ids) {
119
123
  const id = this.normalizePath(_id);
120
- if (invalidated.has(id))
124
+ if (invalidated.has(id)) {
121
125
  continue;
126
+ }
122
127
  invalidated.add(id);
123
128
  const subIds = Array.from(super.entries()).filter(([, mod]) => {
124
129
  var _a;
@@ -134,8 +139,9 @@ class ModuleCacheMap extends Map {
134
139
  */
135
140
  getSourceMap(id) {
136
141
  const cache = this.get(id);
137
- if (cache.map)
142
+ if (cache.map) {
138
143
  return cache.map;
144
+ }
139
145
  const map = cache.code && sourceMap.extractSourceMap(cache.code);
140
146
  if (map) {
141
147
  cache.map = map;
@@ -171,28 +177,38 @@ class ViteNodeRunner {
171
177
  const importee = callstack[callstack.length - 1];
172
178
  const mod = this.moduleCache.get(fsPath);
173
179
  const { imports, importers } = mod;
174
- if (importee)
180
+ if (importee) {
175
181
  importers.add(importee);
182
+ }
176
183
  const getStack = () => `stack:
177
184
  ${[...callstack, fsPath].reverse().map((p) => ` - ${p}`).join("\n")}`;
178
185
  if (callstack.includes(fsPath) || Array.from(imports.values()).some((i) => importers.has(i))) {
179
- if (mod.exports)
186
+ if (mod.exports) {
180
187
  return mod.exports;
188
+ }
181
189
  }
182
190
  let debugTimer;
183
- if (this.debug)
184
- debugTimer = setTimeout(() => console.warn(`[vite-node] module ${fsPath} takes over 2s to load.
185
- ${getStack()}`), 2e3);
191
+ if (this.debug) {
192
+ debugTimer = setTimeout(
193
+ () => console.warn(
194
+ `[vite-node] module ${fsPath} takes over 2s to load.
195
+ ${getStack()}`
196
+ ),
197
+ 2e3
198
+ );
199
+ }
186
200
  try {
187
- if (mod.promise)
201
+ if (mod.promise) {
188
202
  return await mod.promise;
203
+ }
189
204
  const promise = this.directRequest(id, fsPath, callstack);
190
205
  Object.assign(mod, { promise, evaluated: false });
191
206
  return await promise;
192
207
  } finally {
193
208
  mod.evaluated = true;
194
- if (debugTimer)
209
+ if (debugTimer) {
195
210
  clearTimeout(debugTimer);
211
+ }
196
212
  }
197
213
  }
198
214
  shouldResolveId(id, _importee) {
@@ -201,11 +217,13 @@ ${getStack()}`), 2e3);
201
217
  async _resolveUrl(id, importer) {
202
218
  var _a, _b;
203
219
  const dep = utils.normalizeRequestId(id, this.options.base);
204
- if (!this.shouldResolveId(dep))
220
+ if (!this.shouldResolveId(dep)) {
205
221
  return [dep, dep];
222
+ }
206
223
  const { path, exists } = utils.toFilePath(dep, this.root);
207
- if (!this.options.resolveId || exists)
224
+ if (!this.options.resolveId || exists) {
208
225
  return [dep, path];
226
+ }
209
227
  const resolved = await this.options.resolveId(dep, importer);
210
228
  if ((_b = (_a = resolved == null ? void 0 : resolved.meta) == null ? void 0 : _a["vite:alias"]) == null ? void 0 : _b.noResolved) {
211
229
  const error = new Error(
@@ -214,8 +232,14 @@ ${getStack()}`), 2e3);
214
232
  - If you rely on tsconfig.json's "paths" to resolve modules, please install "vite-tsconfig-paths" plugin to handle module resolution.
215
233
  - Make sure you don't have relative aliases in your Vitest config. Use absolute paths instead. Read more: https://vitest.dev/guide/common-errors`
216
234
  );
217
- Object.defineProperty(error, "code", { value: "ERR_MODULE_NOT_FOUND", enumerable: true });
218
- Object.defineProperty(error, Symbol.for("vitest.error.not_found.data"), { value: { id: dep, importer }, enumerable: false });
235
+ Object.defineProperty(error, "code", {
236
+ value: "ERR_MODULE_NOT_FOUND",
237
+ enumerable: true
238
+ });
239
+ Object.defineProperty(error, Symbol.for("vitest.error.not_found.data"), {
240
+ value: { id: dep, importer },
241
+ enumerable: false
242
+ });
219
243
  throw error;
220
244
  }
221
245
  const resolvedId = resolved ? utils.normalizeRequestId(resolved.id, this.options.base) : dep;
@@ -247,8 +271,9 @@ ${getStack()}`), 2e3);
247
271
  return this.dependencyRequest(id2, depFsPath, callstack);
248
272
  };
249
273
  const requestStubs = this.options.requestStubs || DEFAULT_REQUEST_STUBS;
250
- if (id in requestStubs)
274
+ if (id in requestStubs) {
251
275
  return requestStubs[id];
276
+ }
252
277
  let { code: transformed, externalize } = await this.options.fetchModule(id);
253
278
  if (externalize) {
254
279
  debugNative(externalize);
@@ -256,8 +281,11 @@ ${getStack()}`), 2e3);
256
281
  mod.exports = exports2;
257
282
  return exports2;
258
283
  }
259
- if (transformed == null)
260
- throw new Error(`[vite-node] Failed to load "${id}" imported from ${callstack[callstack.length - 2]}`);
284
+ if (transformed == null) {
285
+ throw new Error(
286
+ `[vite-node] Failed to load "${id}" imported from ${callstack[callstack.length - 2]}`
287
+ );
288
+ }
261
289
  const { Object: Object2, Reflect: Reflect2, Symbol: Symbol2 } = this.getContextPrimitives();
262
290
  const modulePath = utils.cleanUrl(moduleId);
263
291
  const href = node_url.pathToFileURL(modulePath).href;
@@ -279,8 +307,9 @@ ${getStack()}`), 2e3);
279
307
  let moduleExports = SYMBOL_NOT_DEFINED;
280
308
  const cjsExports = new Proxy(exports, {
281
309
  get: (target, p, receiver) => {
282
- if (Reflect2.has(target, p))
310
+ if (Reflect2.has(target, p)) {
283
311
  return Reflect2.get(target, p, receiver);
312
+ }
284
313
  return Reflect2.get(Object2.prototype, p, receiver);
285
314
  },
286
315
  getPrototypeOf: () => Object2.prototype,
@@ -290,16 +319,19 @@ ${getStack()}`), 2e3);
290
319
  exports.default = value;
291
320
  return true;
292
321
  }
293
- if (!Reflect2.has(exports, "default"))
322
+ if (!Reflect2.has(exports, "default")) {
294
323
  exports.default = {};
324
+ }
295
325
  if (moduleExports !== SYMBOL_NOT_DEFINED && utils.isPrimitive(moduleExports)) {
296
326
  defineExport(exports, p, () => void 0);
297
327
  return true;
298
328
  }
299
- if (!utils.isPrimitive(exports.default))
329
+ if (!utils.isPrimitive(exports.default)) {
300
330
  exports.default[p] = value;
301
- if (p !== "default")
331
+ }
332
+ if (p !== "default") {
302
333
  defineExport(exports, p, () => value);
334
+ }
303
335
  return true;
304
336
  }
305
337
  });
@@ -343,8 +375,9 @@ ${getStack()}`), 2e3);
343
375
  __dirname
344
376
  });
345
377
  debugExecute(__filename);
346
- if (transformed[0] === "#")
378
+ if (transformed[0] === "#") {
347
379
  transformed = transformed.replace(/^#!.*/, (s) => " ".repeat(s.length));
380
+ }
348
381
  await this.runModule(context, transformed);
349
382
  return exports;
350
383
  }
@@ -352,7 +385,9 @@ ${getStack()}`), 2e3);
352
385
  return { Object, Reflect, Symbol };
353
386
  }
354
387
  async runModule(context, transformed) {
355
- const codeDefinition = `'use strict';async (${Object.keys(context).join(",")})=>{{`;
388
+ const codeDefinition = `'use strict';async (${Object.keys(context).join(
389
+ ","
390
+ )})=>{{`;
356
391
  const code = `${codeDefinition}${transformed}
357
392
  }}`;
358
393
  const options = {
@@ -371,8 +406,9 @@ ${getStack()}`), 2e3);
371
406
  * This function mostly for the ability to override by subclass
372
407
  */
373
408
  shouldInterop(path, mod) {
374
- if (this.options.interopDefault === false)
409
+ if (this.options.interopDefault === false) {
375
410
  return false;
411
+ }
376
412
  return !path.endsWith(".mjs") && "default" in mod;
377
413
  }
378
414
  importExternalModule(path) {
@@ -383,24 +419,28 @@ ${getStack()}`), 2e3);
383
419
  */
384
420
  async interopedImport(path) {
385
421
  const importedModule = await this.importExternalModule(path);
386
- if (!this.shouldInterop(path, importedModule))
422
+ if (!this.shouldInterop(path, importedModule)) {
387
423
  return importedModule;
424
+ }
388
425
  const { mod, defaultExport } = interopModule(importedModule);
389
426
  return new Proxy(mod, {
390
427
  get(mod2, prop) {
391
- if (prop === "default")
428
+ if (prop === "default") {
392
429
  return defaultExport;
430
+ }
393
431
  return mod2[prop] ?? (defaultExport == null ? void 0 : defaultExport[prop]);
394
432
  },
395
433
  has(mod2, prop) {
396
- if (prop === "default")
434
+ if (prop === "default") {
397
435
  return defaultExport !== void 0;
436
+ }
398
437
  return prop in mod2 || defaultExport && prop in defaultExport;
399
438
  },
400
439
  getOwnPropertyDescriptor(mod2, prop) {
401
440
  const descriptor = Reflect.getOwnPropertyDescriptor(mod2, prop);
402
- if (descriptor)
441
+ if (descriptor) {
403
442
  return descriptor;
443
+ }
404
444
  if (prop === "default" && defaultExport !== void 0) {
405
445
  return {
406
446
  value: defaultExport,
@@ -422,8 +462,9 @@ function interopModule(mod) {
422
462
  let defaultExport = "default" in mod ? mod.default : mod;
423
463
  if (!utils.isPrimitive(defaultExport) && "__esModule" in defaultExport) {
424
464
  mod = defaultExport;
425
- if ("default" in defaultExport)
465
+ if ("default" in defaultExport) {
426
466
  defaultExport = defaultExport.default;
467
+ }
427
468
  }
428
469
  return { mod, defaultExport };
429
470
  }
@@ -435,10 +476,12 @@ function defineExport(exports, key, value) {
435
476
  });
436
477
  }
437
478
  function exportAll(exports, sourceModule) {
438
- if (exports === sourceModule)
479
+ if (exports === sourceModule) {
439
480
  return;
440
- if (utils.isPrimitive(sourceModule) || Array.isArray(sourceModule) || sourceModule instanceof Promise)
481
+ }
482
+ if (utils.isPrimitive(sourceModule) || Array.isArray(sourceModule) || sourceModule instanceof Promise) {
441
483
  return;
484
+ }
442
485
  for (const key in sourceModule) {
443
486
  if (key !== "default") {
444
487
  try {
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-D1EszD4V.js';
1
+ export { e as DEFAULT_REQUEST_STUBS, M as ModuleCacheMap, a as ViteNodeRunner } from './index-CCsqCcr7.js';
2
2
  import './trace-mapping.d-DLVdEqOp.js';
package/dist/client.mjs CHANGED
@@ -50,10 +50,11 @@ class ModuleCacheMap extends Map {
50
50
  */
51
51
  update(fsPath, mod) {
52
52
  fsPath = this.normalizePath(fsPath);
53
- if (!super.has(fsPath))
53
+ if (!super.has(fsPath)) {
54
54
  this.setByModuleId(fsPath, mod);
55
- else
55
+ } else {
56
56
  Object.assign(super.get(fsPath), mod);
57
+ }
57
58
  return this;
58
59
  }
59
60
  setByModuleId(modulePath, mod) {
@@ -63,8 +64,9 @@ class ModuleCacheMap extends Map {
63
64
  return this.setByModuleId(this.normalizePath(fsPath), mod);
64
65
  }
65
66
  getByModuleId(modulePath) {
66
- if (!super.has(modulePath))
67
+ if (!super.has(modulePath)) {
67
68
  this.setByModuleId(modulePath, {});
69
+ }
68
70
  const mod = super.get(modulePath);
69
71
  if (!mod.imports) {
70
72
  Object.assign(mod, {
@@ -99,12 +101,14 @@ class ModuleCacheMap extends Map {
99
101
  invalidateDepTree(ids, invalidated = /* @__PURE__ */ new Set()) {
100
102
  for (const _id of ids) {
101
103
  const id = this.normalizePath(_id);
102
- if (invalidated.has(id))
104
+ if (invalidated.has(id)) {
103
105
  continue;
106
+ }
104
107
  invalidated.add(id);
105
108
  const mod = super.get(id);
106
- if (mod == null ? void 0 : mod.importers)
109
+ if (mod == null ? void 0 : mod.importers) {
107
110
  this.invalidateDepTree(mod.importers, invalidated);
111
+ }
108
112
  super.delete(id);
109
113
  }
110
114
  return invalidated;
@@ -115,8 +119,9 @@ class ModuleCacheMap extends Map {
115
119
  invalidateSubDepTree(ids, invalidated = /* @__PURE__ */ new Set()) {
116
120
  for (const _id of ids) {
117
121
  const id = this.normalizePath(_id);
118
- if (invalidated.has(id))
122
+ if (invalidated.has(id)) {
119
123
  continue;
124
+ }
120
125
  invalidated.add(id);
121
126
  const subIds = Array.from(super.entries()).filter(([, mod]) => {
122
127
  var _a;
@@ -132,8 +137,9 @@ class ModuleCacheMap extends Map {
132
137
  */
133
138
  getSourceMap(id) {
134
139
  const cache = this.get(id);
135
- if (cache.map)
140
+ if (cache.map) {
136
141
  return cache.map;
142
+ }
137
143
  const map = cache.code && extractSourceMap(cache.code);
138
144
  if (map) {
139
145
  cache.map = map;
@@ -169,28 +175,38 @@ class ViteNodeRunner {
169
175
  const importee = callstack[callstack.length - 1];
170
176
  const mod = this.moduleCache.get(fsPath);
171
177
  const { imports, importers } = mod;
172
- if (importee)
178
+ if (importee) {
173
179
  importers.add(importee);
180
+ }
174
181
  const getStack = () => `stack:
175
182
  ${[...callstack, fsPath].reverse().map((p) => ` - ${p}`).join("\n")}`;
176
183
  if (callstack.includes(fsPath) || Array.from(imports.values()).some((i) => importers.has(i))) {
177
- if (mod.exports)
184
+ if (mod.exports) {
178
185
  return mod.exports;
186
+ }
179
187
  }
180
188
  let debugTimer;
181
- if (this.debug)
182
- debugTimer = setTimeout(() => console.warn(`[vite-node] module ${fsPath} takes over 2s to load.
183
- ${getStack()}`), 2e3);
189
+ if (this.debug) {
190
+ debugTimer = setTimeout(
191
+ () => console.warn(
192
+ `[vite-node] module ${fsPath} takes over 2s to load.
193
+ ${getStack()}`
194
+ ),
195
+ 2e3
196
+ );
197
+ }
184
198
  try {
185
- if (mod.promise)
199
+ if (mod.promise) {
186
200
  return await mod.promise;
201
+ }
187
202
  const promise = this.directRequest(id, fsPath, callstack);
188
203
  Object.assign(mod, { promise, evaluated: false });
189
204
  return await promise;
190
205
  } finally {
191
206
  mod.evaluated = true;
192
- if (debugTimer)
207
+ if (debugTimer) {
193
208
  clearTimeout(debugTimer);
209
+ }
194
210
  }
195
211
  }
196
212
  shouldResolveId(id, _importee) {
@@ -199,11 +215,13 @@ ${getStack()}`), 2e3);
199
215
  async _resolveUrl(id, importer) {
200
216
  var _a, _b;
201
217
  const dep = normalizeRequestId(id, this.options.base);
202
- if (!this.shouldResolveId(dep))
218
+ if (!this.shouldResolveId(dep)) {
203
219
  return [dep, dep];
220
+ }
204
221
  const { path, exists } = toFilePath(dep, this.root);
205
- if (!this.options.resolveId || exists)
222
+ if (!this.options.resolveId || exists) {
206
223
  return [dep, path];
224
+ }
207
225
  const resolved = await this.options.resolveId(dep, importer);
208
226
  if ((_b = (_a = resolved == null ? void 0 : resolved.meta) == null ? void 0 : _a["vite:alias"]) == null ? void 0 : _b.noResolved) {
209
227
  const error = new Error(
@@ -212,8 +230,14 @@ ${getStack()}`), 2e3);
212
230
  - If you rely on tsconfig.json's "paths" to resolve modules, please install "vite-tsconfig-paths" plugin to handle module resolution.
213
231
  - Make sure you don't have relative aliases in your Vitest config. Use absolute paths instead. Read more: https://vitest.dev/guide/common-errors`
214
232
  );
215
- Object.defineProperty(error, "code", { value: "ERR_MODULE_NOT_FOUND", enumerable: true });
216
- Object.defineProperty(error, Symbol.for("vitest.error.not_found.data"), { value: { id: dep, importer }, enumerable: false });
233
+ Object.defineProperty(error, "code", {
234
+ value: "ERR_MODULE_NOT_FOUND",
235
+ enumerable: true
236
+ });
237
+ Object.defineProperty(error, Symbol.for("vitest.error.not_found.data"), {
238
+ value: { id: dep, importer },
239
+ enumerable: false
240
+ });
217
241
  throw error;
218
242
  }
219
243
  const resolvedId = resolved ? normalizeRequestId(resolved.id, this.options.base) : dep;
@@ -245,8 +269,9 @@ ${getStack()}`), 2e3);
245
269
  return this.dependencyRequest(id2, depFsPath, callstack);
246
270
  };
247
271
  const requestStubs = this.options.requestStubs || DEFAULT_REQUEST_STUBS;
248
- if (id in requestStubs)
272
+ if (id in requestStubs) {
249
273
  return requestStubs[id];
274
+ }
250
275
  let { code: transformed, externalize } = await this.options.fetchModule(id);
251
276
  if (externalize) {
252
277
  debugNative(externalize);
@@ -254,8 +279,11 @@ ${getStack()}`), 2e3);
254
279
  mod.exports = exports2;
255
280
  return exports2;
256
281
  }
257
- if (transformed == null)
258
- throw new Error(`[vite-node] Failed to load "${id}" imported from ${callstack[callstack.length - 2]}`);
282
+ if (transformed == null) {
283
+ throw new Error(
284
+ `[vite-node] Failed to load "${id}" imported from ${callstack[callstack.length - 2]}`
285
+ );
286
+ }
259
287
  const { Object: Object2, Reflect: Reflect2, Symbol: Symbol2 } = this.getContextPrimitives();
260
288
  const modulePath = cleanUrl(moduleId);
261
289
  const href = pathToFileURL(modulePath).href;
@@ -277,8 +305,9 @@ ${getStack()}`), 2e3);
277
305
  let moduleExports = SYMBOL_NOT_DEFINED;
278
306
  const cjsExports = new Proxy(exports, {
279
307
  get: (target, p, receiver) => {
280
- if (Reflect2.has(target, p))
308
+ if (Reflect2.has(target, p)) {
281
309
  return Reflect2.get(target, p, receiver);
310
+ }
282
311
  return Reflect2.get(Object2.prototype, p, receiver);
283
312
  },
284
313
  getPrototypeOf: () => Object2.prototype,
@@ -288,16 +317,19 @@ ${getStack()}`), 2e3);
288
317
  exports.default = value;
289
318
  return true;
290
319
  }
291
- if (!Reflect2.has(exports, "default"))
320
+ if (!Reflect2.has(exports, "default")) {
292
321
  exports.default = {};
322
+ }
293
323
  if (moduleExports !== SYMBOL_NOT_DEFINED && isPrimitive(moduleExports)) {
294
324
  defineExport(exports, p, () => void 0);
295
325
  return true;
296
326
  }
297
- if (!isPrimitive(exports.default))
327
+ if (!isPrimitive(exports.default)) {
298
328
  exports.default[p] = value;
299
- if (p !== "default")
329
+ }
330
+ if (p !== "default") {
300
331
  defineExport(exports, p, () => value);
332
+ }
301
333
  return true;
302
334
  }
303
335
  });
@@ -341,8 +373,9 @@ ${getStack()}`), 2e3);
341
373
  __dirname
342
374
  });
343
375
  debugExecute(__filename);
344
- if (transformed[0] === "#")
376
+ if (transformed[0] === "#") {
345
377
  transformed = transformed.replace(/^#!.*/, (s) => " ".repeat(s.length));
378
+ }
346
379
  await this.runModule(context, transformed);
347
380
  return exports;
348
381
  }
@@ -350,7 +383,9 @@ ${getStack()}`), 2e3);
350
383
  return { Object, Reflect, Symbol };
351
384
  }
352
385
  async runModule(context, transformed) {
353
- const codeDefinition = `'use strict';async (${Object.keys(context).join(",")})=>{{`;
386
+ const codeDefinition = `'use strict';async (${Object.keys(context).join(
387
+ ","
388
+ )})=>{{`;
354
389
  const code = `${codeDefinition}${transformed}
355
390
  }}`;
356
391
  const options = {
@@ -369,8 +404,9 @@ ${getStack()}`), 2e3);
369
404
  * This function mostly for the ability to override by subclass
370
405
  */
371
406
  shouldInterop(path, mod) {
372
- if (this.options.interopDefault === false)
407
+ if (this.options.interopDefault === false) {
373
408
  return false;
409
+ }
374
410
  return !path.endsWith(".mjs") && "default" in mod;
375
411
  }
376
412
  importExternalModule(path) {
@@ -381,24 +417,28 @@ ${getStack()}`), 2e3);
381
417
  */
382
418
  async interopedImport(path) {
383
419
  const importedModule = await this.importExternalModule(path);
384
- if (!this.shouldInterop(path, importedModule))
420
+ if (!this.shouldInterop(path, importedModule)) {
385
421
  return importedModule;
422
+ }
386
423
  const { mod, defaultExport } = interopModule(importedModule);
387
424
  return new Proxy(mod, {
388
425
  get(mod2, prop) {
389
- if (prop === "default")
426
+ if (prop === "default") {
390
427
  return defaultExport;
428
+ }
391
429
  return mod2[prop] ?? (defaultExport == null ? void 0 : defaultExport[prop]);
392
430
  },
393
431
  has(mod2, prop) {
394
- if (prop === "default")
432
+ if (prop === "default") {
395
433
  return defaultExport !== void 0;
434
+ }
396
435
  return prop in mod2 || defaultExport && prop in defaultExport;
397
436
  },
398
437
  getOwnPropertyDescriptor(mod2, prop) {
399
438
  const descriptor = Reflect.getOwnPropertyDescriptor(mod2, prop);
400
- if (descriptor)
439
+ if (descriptor) {
401
440
  return descriptor;
441
+ }
402
442
  if (prop === "default" && defaultExport !== void 0) {
403
443
  return {
404
444
  value: defaultExport,
@@ -420,8 +460,9 @@ function interopModule(mod) {
420
460
  let defaultExport = "default" in mod ? mod.default : mod;
421
461
  if (!isPrimitive(defaultExport) && "__esModule" in defaultExport) {
422
462
  mod = defaultExport;
423
- if ("default" in defaultExport)
463
+ if ("default" in defaultExport) {
424
464
  defaultExport = defaultExport.default;
465
+ }
425
466
  }
426
467
  return { mod, defaultExport };
427
468
  }
@@ -433,10 +474,12 @@ function defineExport(exports, key, value) {
433
474
  });
434
475
  }
435
476
  function exportAll(exports, sourceModule) {
436
- if (exports === sourceModule)
477
+ if (exports === sourceModule) {
437
478
  return;
438
- if (isPrimitive(sourceModule) || Array.isArray(sourceModule) || sourceModule instanceof Promise)
479
+ }
480
+ if (isPrimitive(sourceModule) || Array.isArray(sourceModule) || sourceModule instanceof Promise) {
439
481
  return;
482
+ }
440
483
  for (const key in sourceModule) {
441
484
  if (key !== "default") {
442
485
  try {
@@ -3,6 +3,7 @@
3
3
  const KNOWN_ASSET_TYPES = [
4
4
  // images
5
5
  "apng",
6
+ "bmp",
6
7
  "png",
7
8
  "jpe?g",
8
9
  "jfif",
@@ -31,7 +32,9 @@ const KNOWN_ASSET_TYPES = [
31
32
  "pdf",
32
33
  "txt"
33
34
  ];
34
- const KNOWN_ASSET_RE = new RegExp(`\\.(${KNOWN_ASSET_TYPES.join("|")})$`);
35
+ const KNOWN_ASSET_RE = new RegExp(
36
+ `\\.(${KNOWN_ASSET_TYPES.join("|")})$`
37
+ );
35
38
  const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
36
39
 
37
40
  exports.CSS_LANGS_RE = CSS_LANGS_RE;
@@ -1,6 +1,7 @@
1
1
  const KNOWN_ASSET_TYPES = [
2
2
  // images
3
3
  "apng",
4
+ "bmp",
4
5
  "png",
5
6
  "jpe?g",
6
7
  "jfif",
@@ -29,7 +30,9 @@ const KNOWN_ASSET_TYPES = [
29
30
  "pdf",
30
31
  "txt"
31
32
  ];
32
- const KNOWN_ASSET_RE = new RegExp(`\\.(${KNOWN_ASSET_TYPES.join("|")})$`);
33
+ const KNOWN_ASSET_RE = new RegExp(
34
+ `\\.(${KNOWN_ASSET_TYPES.join("|")})$`
35
+ );
33
36
  const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/;
34
37
 
35
38
  export { CSS_LANGS_RE, KNOWN_ASSET_RE, KNOWN_ASSET_TYPES };
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-D1EszD4V.js';
3
+ import { C as CustomEventMap, a as ViteNodeRunner, H as HMRPayload$1, b as HotContext } from './index-CCsqCcr7.js';
4
4
  import './trace-mapping.d-DLVdEqOp.js';
5
5
 
6
6
  type EventType = string | symbol;
@@ -84,6 +84,7 @@ interface WebSocketConnectionPayload {
84
84
  * This might be removed in the future if we didn't find reasonable use cases.
85
85
  * If you find this useful, please open an issue with details so we can discuss and make it stable API.
86
86
  */
87
+ // eslint-disable-next-line n/no-unsupported-features/node-builtins
87
88
  webSocket: WebSocket
88
89
  }
89
90
 
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, l as ViteNodeResolveModule, k as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-D1EszD4V.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, l as ViteNodeResolveModule, k as ViteNodeRunnerOptions, V as ViteNodeServerOptions } from './index-CCsqCcr7.js';
2
2
  export { D as DecodedSourceMap, E as EncodedSourceMap, S as SourceMapInput } from './trace-mapping.d-DLVdEqOp.js';