vite 8.2.2 → 8.3.0-beta.1

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.
@@ -1,229 +1,4 @@
1
1
  import "@vite/env";
2
- //#region \0@oxc-project+runtime@0.144.0/helpers/esm/typeof.js
3
- function _typeof(o) {
4
- "@babel/helpers - typeof";
5
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
6
- return typeof o;
7
- } : function(o) {
8
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
9
- }, _typeof(o);
10
- }
11
- //#endregion
12
- //#region \0@oxc-project+runtime@0.144.0/helpers/esm/toPrimitive.js
13
- function toPrimitive(t, r) {
14
- if ("object" != _typeof(t) || !t) return t;
15
- var e = t[Symbol.toPrimitive];
16
- if (void 0 !== e) {
17
- var i = e.call(t, r || "default");
18
- if ("object" != _typeof(i)) return i;
19
- throw new TypeError("@@toPrimitive must return a primitive value.");
20
- }
21
- return ("string" === r ? String : Number)(t);
22
- }
23
- //#endregion
24
- //#region \0@oxc-project+runtime@0.144.0/helpers/esm/toPropertyKey.js
25
- function toPropertyKey(t) {
26
- var i = toPrimitive(t, "string");
27
- return "symbol" == _typeof(i) ? i : i + "";
28
- }
29
- //#endregion
30
- //#region \0@oxc-project+runtime@0.144.0/helpers/esm/defineProperty.js
31
- function _defineProperty(e, r, t) {
32
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
33
- value: t,
34
- enumerable: !0,
35
- configurable: !0,
36
- writable: !0
37
- }) : e[r] = t, e;
38
- }
39
- //#endregion
40
- //#region src/shared/hmr.ts
41
- var HMRContext = class {
42
- constructor(hmrClient, ownerPath) {
43
- this.hmrClient = hmrClient;
44
- this.ownerPath = ownerPath;
45
- _defineProperty(this, "newListeners", void 0);
46
- if (!hmrClient.dataMap.has(ownerPath)) hmrClient.dataMap.set(ownerPath, {});
47
- const mod = hmrClient.hotModulesMap.get(ownerPath);
48
- if (mod) mod.callbacks = [];
49
- const staleListeners = hmrClient.ctxToListenersMap.get(ownerPath);
50
- if (staleListeners) for (const [event, staleFns] of staleListeners) {
51
- const listeners = hmrClient.customListenersMap.get(event);
52
- if (listeners) hmrClient.customListenersMap.set(event, listeners.filter((l) => !staleFns.includes(l)));
53
- }
54
- this.newListeners = /* @__PURE__ */ new Map();
55
- hmrClient.ctxToListenersMap.set(ownerPath, this.newListeners);
56
- }
57
- get data() {
58
- return this.hmrClient.dataMap.get(this.ownerPath);
59
- }
60
- accept(deps, callback) {
61
- if (typeof deps === "function" || !deps) this.acceptDeps([this.ownerPath], ([mod]) => deps?.(mod));
62
- else if (typeof deps === "string") this.acceptDeps([deps], ([mod]) => callback?.(mod));
63
- else if (Array.isArray(deps)) this.acceptDeps(deps, callback);
64
- else throw new Error(`invalid hot.accept() usage.`);
65
- }
66
- acceptExports(_, callback) {
67
- this.acceptDeps([this.ownerPath], ([mod]) => callback?.(mod));
68
- }
69
- dispose(cb) {
70
- this.hmrClient.disposeMap.set(this.ownerPath, cb);
71
- }
72
- prune(cb) {
73
- this.hmrClient.pruneMap.set(this.ownerPath, cb);
74
- }
75
- decline() {}
76
- invalidate(message) {
77
- const firstInvalidatedBy = this.hmrClient.currentFirstInvalidatedBy ?? this.ownerPath;
78
- this.hmrClient.notifyListeners("vite:invalidate", {
79
- path: this.ownerPath,
80
- message,
81
- firstInvalidatedBy
82
- });
83
- this.send("vite:invalidate", {
84
- path: this.ownerPath,
85
- message,
86
- firstInvalidatedBy
87
- });
88
- this.hmrClient.logger.debug(`invalidate ${this.ownerPath}${message ? `: ${message}` : ""}`);
89
- }
90
- on(event, cb) {
91
- const addToMap = (map) => {
92
- const existing = map.get(event) || [];
93
- existing.push(cb);
94
- map.set(event, existing);
95
- };
96
- addToMap(this.hmrClient.customListenersMap);
97
- addToMap(this.newListeners);
98
- }
99
- off(event, cb) {
100
- const removeFromMap = (map) => {
101
- const existing = map.get(event);
102
- if (existing === void 0) return;
103
- const pruned = existing.filter((l) => l !== cb);
104
- if (pruned.length === 0) {
105
- map.delete(event);
106
- return;
107
- }
108
- map.set(event, pruned);
109
- };
110
- removeFromMap(this.hmrClient.customListenersMap);
111
- removeFromMap(this.newListeners);
112
- }
113
- send(event, data) {
114
- this.hmrClient.send({
115
- type: "custom",
116
- event,
117
- data
118
- });
119
- }
120
- acceptDeps(deps, callback = () => {}) {
121
- const mod = this.hmrClient.hotModulesMap.get(this.ownerPath) || {
122
- id: this.ownerPath,
123
- callbacks: []
124
- };
125
- mod.callbacks.push({
126
- deps,
127
- fn: callback
128
- });
129
- this.hmrClient.hotModulesMap.set(this.ownerPath, mod);
130
- }
131
- };
132
- var HMRClient = class {
133
- constructor(logger, transport, importUpdatedModule) {
134
- this.logger = logger;
135
- this.transport = transport;
136
- this.importUpdatedModule = importUpdatedModule;
137
- _defineProperty(this, "hotModulesMap", /* @__PURE__ */ new Map());
138
- _defineProperty(this, "disposeMap", /* @__PURE__ */ new Map());
139
- _defineProperty(this, "pruneMap", /* @__PURE__ */ new Map());
140
- _defineProperty(this, "dataMap", /* @__PURE__ */ new Map());
141
- _defineProperty(this, "customListenersMap", /* @__PURE__ */ new Map());
142
- _defineProperty(this, "ctxToListenersMap", /* @__PURE__ */ new Map());
143
- _defineProperty(this, "currentFirstInvalidatedBy", void 0);
144
- _defineProperty(this, "updateQueue", []);
145
- _defineProperty(this, "pendingUpdateQueue", false);
146
- }
147
- async notifyListeners(event, data) {
148
- const cbs = this.customListenersMap.get(event);
149
- if (cbs) await Promise.allSettled(cbs.map((cb) => cb(data)));
150
- }
151
- send(payload) {
152
- this.transport.send(payload).catch((err) => {
153
- this.logger.error(err);
154
- });
155
- }
156
- clear() {
157
- this.hotModulesMap.clear();
158
- this.disposeMap.clear();
159
- this.pruneMap.clear();
160
- this.dataMap.clear();
161
- this.customListenersMap.clear();
162
- this.ctxToListenersMap.clear();
163
- }
164
- async prunePaths(paths) {
165
- try {
166
- await Promise.all(paths.map((path) => {
167
- const disposer = this.disposeMap.get(path);
168
- if (disposer) return disposer(this.dataMap.get(path));
169
- }));
170
- await Promise.all(paths.map((path) => {
171
- const fn = this.pruneMap.get(path);
172
- if (fn) return fn(this.dataMap.get(path));
173
- }));
174
- } finally {
175
- paths.forEach((path) => this.dataMap.delete(path));
176
- }
177
- }
178
- warnFailedUpdate(err, path) {
179
- if (!(err instanceof Error) || !err.message.includes("fetch")) this.logger.error(err);
180
- this.logger.error(`Failed to reload ${path}. This could be due to syntax errors or importing non-existent modules. (see errors above)`);
181
- }
182
- /**
183
- * buffer multiple hot updates triggered by the same src change
184
- * so that they are invoked in the same order they were sent.
185
- * (otherwise the order may be inconsistent because of the http request round trip)
186
- */
187
- async queueUpdate(payload) {
188
- this.updateQueue.push(this.fetchUpdate(payload));
189
- if (!this.pendingUpdateQueue) {
190
- this.pendingUpdateQueue = true;
191
- await Promise.resolve();
192
- this.pendingUpdateQueue = false;
193
- const loading = [...this.updateQueue];
194
- this.updateQueue = [];
195
- (await Promise.all(loading)).forEach((fn) => fn && fn());
196
- }
197
- }
198
- async fetchUpdate(update) {
199
- const { path, acceptedPath, firstInvalidatedBy } = update;
200
- const mod = this.hotModulesMap.get(path);
201
- if (!mod) return;
202
- let fetchedModule;
203
- const isSelfUpdate = path === acceptedPath;
204
- const qualifiedCallbacks = mod.callbacks.filter(({ deps }) => deps.includes(acceptedPath));
205
- if (isSelfUpdate || qualifiedCallbacks.length > 0) {
206
- const disposer = this.disposeMap.get(acceptedPath);
207
- if (disposer) await disposer(this.dataMap.get(acceptedPath));
208
- try {
209
- fetchedModule = await this.importUpdatedModule(update);
210
- } catch (e) {
211
- this.warnFailedUpdate(e, acceptedPath);
212
- }
213
- }
214
- return () => {
215
- try {
216
- this.currentFirstInvalidatedBy = firstInvalidatedBy;
217
- for (const { deps, fn } of qualifiedCallbacks) fn(deps.map((dep) => dep === acceptedPath ? fetchedModule : void 0));
218
- const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
219
- this.logger.debug(`hot updated: ${loggedPath}`);
220
- } finally {
221
- this.currentFirstInvalidatedBy = void 0;
222
- }
223
- };
224
- }
225
- };
226
- //#endregion
227
2
  //#region ../../node_modules/.pnpm/nanoid@5.1.16/node_modules/nanoid/non-secure/index.js
228
3
  let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
229
4
  let nanoid = (size = 21) => {
@@ -234,9 +9,33 @@ let nanoid = (size = 21) => {
234
9
  };
235
10
  //#endregion
236
11
  //#region src/shared/constants.ts
12
+ /**
13
+ * Prefix for resolved Ids that are not valid browser import specifiers
14
+ */
15
+ const VALID_ID_PREFIX = `/@id/`;
16
+ /**
17
+ * Plugins that use 'virtual modules' (e.g. for helper functions), prefix the
18
+ * module ID with `\0`, a convention from the rollup ecosystem.
19
+ * This prevents other plugins from trying to process the id (like node resolution),
20
+ * and core features like sourcemaps can use this info to differentiate between
21
+ * virtual modules and regular files.
22
+ * `\0` is not a permitted char in import URLs so we have to replace them during
23
+ * import analysis. The id will be decoded back before entering the plugins pipeline.
24
+ * These encoded virtual ids are also prefixed by the VALID_ID_PREFIX, so virtual
25
+ * modules in the browser end up encoded as `/@id/__x00__{id}`
26
+ */
27
+ const NULL_BYTE_PLACEHOLDER = `__x00__`;
237
28
  let SOURCEMAPPING_URL = "sourceMa";
238
29
  SOURCEMAPPING_URL += "ppingURL";
239
30
  typeof process !== "undefined" && process.platform;
31
+ /**
32
+ * Prepend `/@id/` and replace null byte so the id is URL-safe.
33
+ * This is prepended to resolved ids that are not valid browser
34
+ * import specifiers by the importAnalysis plugin.
35
+ */
36
+ function wrapId(id) {
37
+ return id.startsWith(VALID_ID_PREFIX) ? id : VALID_ID_PREFIX + id.replace("\0", NULL_BYTE_PLACEHOLDER);
38
+ }
240
39
  (async function() {}).constructor;
241
40
  function promiseWithResolvers() {
242
41
  let resolve;
@@ -451,40 +250,7 @@ const createWebSocketModuleRunnerTransport = (options) => {
451
250
  send(data) {
452
251
  ws.send(JSON.stringify(data));
453
252
  }
454
- };
455
- };
456
- //#endregion
457
- //#region src/shared/hmrHandler.ts
458
- function createHMRHandler(handler) {
459
- const queue = new Queue();
460
- return (payload) => queue.enqueue(() => handler(payload));
461
- }
462
- var Queue = class {
463
- constructor() {
464
- _defineProperty(this, "queue", []);
465
- _defineProperty(this, "pending", false);
466
- }
467
- enqueue(promise) {
468
- return new Promise((resolve, reject) => {
469
- this.queue.push({
470
- promise,
471
- resolve,
472
- reject
473
- });
474
- this.dequeue();
475
- });
476
- }
477
- dequeue() {
478
- if (this.pending) return false;
479
- const item = this.queue.shift();
480
- if (!item) return false;
481
- this.pending = true;
482
- item.promise().then(item.resolve).catch(item.reject).finally(() => {
483
- this.pending = false;
484
- this.dequeue();
485
- });
486
- return true;
487
- }
253
+ };
488
254
  };
489
255
  //#endregion
490
256
  //#region src/shared/forwardConsole.ts
@@ -615,6 +381,264 @@ function stringifyConsoleArg(value) {
615
381
  }
616
382
  }
617
383
  //#endregion
384
+ //#region \0@oxc-project+runtime@0.147.0/helpers/esm/typeof.js
385
+ function _typeof(o) {
386
+ "@babel/helpers - typeof";
387
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
388
+ return typeof o;
389
+ } : function(o) {
390
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
391
+ }, _typeof(o);
392
+ }
393
+ //#endregion
394
+ //#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPrimitive.js
395
+ function toPrimitive(t, r) {
396
+ if ("object" != _typeof(t) || !t) return t;
397
+ var e = t[Symbol.toPrimitive];
398
+ if (void 0 !== e) {
399
+ var i = e.call(t, r || "default");
400
+ if ("object" != _typeof(i)) return i;
401
+ throw new TypeError("@@toPrimitive must return a primitive value.");
402
+ }
403
+ return ("string" === r ? String : Number)(t);
404
+ }
405
+ //#endregion
406
+ //#region \0@oxc-project+runtime@0.147.0/helpers/esm/toPropertyKey.js
407
+ function toPropertyKey(t) {
408
+ var i = toPrimitive(t, "string");
409
+ return "symbol" == _typeof(i) ? i : i + "";
410
+ }
411
+ //#endregion
412
+ //#region \0@oxc-project+runtime@0.147.0/helpers/esm/defineProperty.js
413
+ function _defineProperty(e, r, t) {
414
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
415
+ value: t,
416
+ enumerable: !0,
417
+ configurable: !0,
418
+ writable: !0
419
+ }) : e[r] = t, e;
420
+ }
421
+ //#endregion
422
+ //#region src/shared/hmr.ts
423
+ var HMRContext = class {
424
+ constructor(hmrClient, ownerPath) {
425
+ this.hmrClient = hmrClient;
426
+ this.ownerPath = ownerPath;
427
+ _defineProperty(this, "newListeners", void 0);
428
+ if (!hmrClient.dataMap.has(ownerPath)) hmrClient.dataMap.set(ownerPath, {});
429
+ const mod = hmrClient.hotModulesMap.get(ownerPath);
430
+ if (mod) mod.callbacks = [];
431
+ const staleListeners = hmrClient.ctxToListenersMap.get(ownerPath);
432
+ if (staleListeners) for (const [event, staleFns] of staleListeners) {
433
+ const listeners = hmrClient.customListenersMap.get(event);
434
+ if (listeners) hmrClient.customListenersMap.set(event, listeners.filter((l) => !staleFns.includes(l)));
435
+ }
436
+ this.newListeners = /* @__PURE__ */ new Map();
437
+ hmrClient.ctxToListenersMap.set(ownerPath, this.newListeners);
438
+ }
439
+ get data() {
440
+ return this.hmrClient.dataMap.get(this.ownerPath);
441
+ }
442
+ accept(deps, callback) {
443
+ if (typeof deps === "function" || !deps) this.acceptDeps([this.ownerPath], ([mod]) => deps?.(mod));
444
+ else if (typeof deps === "string") this.acceptDeps([deps], ([mod]) => callback?.(mod));
445
+ else if (Array.isArray(deps)) this.acceptDeps(deps, callback);
446
+ else throw new Error(`invalid hot.accept() usage.`);
447
+ }
448
+ acceptExports(_, callback) {
449
+ this.acceptDeps([this.ownerPath], ([mod]) => callback?.(mod));
450
+ }
451
+ dispose(cb) {
452
+ this.hmrClient.disposeMap.set(this.ownerPath, cb);
453
+ }
454
+ prune(cb) {
455
+ this.hmrClient.pruneMap.set(this.ownerPath, cb);
456
+ }
457
+ decline() {}
458
+ invalidate(message) {
459
+ const firstInvalidatedBy = this.hmrClient.currentFirstInvalidatedBy ?? this.ownerPath;
460
+ this.hmrClient.notifyListeners("vite:invalidate", {
461
+ path: this.ownerPath,
462
+ message,
463
+ firstInvalidatedBy
464
+ });
465
+ this.send("vite:invalidate", {
466
+ path: this.ownerPath,
467
+ message,
468
+ firstInvalidatedBy
469
+ });
470
+ this.hmrClient.logger.debug(`invalidate ${this.ownerPath}${message ? `: ${message}` : ""}`);
471
+ }
472
+ on(event, cb) {
473
+ const addToMap = (map) => {
474
+ const existing = map.get(event) || [];
475
+ existing.push(cb);
476
+ map.set(event, existing);
477
+ };
478
+ addToMap(this.hmrClient.customListenersMap);
479
+ addToMap(this.newListeners);
480
+ }
481
+ off(event, cb) {
482
+ const removeFromMap = (map) => {
483
+ const existing = map.get(event);
484
+ if (existing === void 0) return;
485
+ const pruned = existing.filter((l) => l !== cb);
486
+ if (pruned.length === 0) {
487
+ map.delete(event);
488
+ return;
489
+ }
490
+ map.set(event, pruned);
491
+ };
492
+ removeFromMap(this.hmrClient.customListenersMap);
493
+ removeFromMap(this.newListeners);
494
+ }
495
+ send(event, data) {
496
+ this.hmrClient.send({
497
+ type: "custom",
498
+ event,
499
+ data
500
+ });
501
+ }
502
+ acceptDeps(deps, callback = () => {}) {
503
+ const mod = this.hmrClient.hotModulesMap.get(this.ownerPath) || {
504
+ id: this.ownerPath,
505
+ callbacks: []
506
+ };
507
+ mod.callbacks.push({
508
+ deps,
509
+ fn: callback
510
+ });
511
+ this.hmrClient.hotModulesMap.set(this.ownerPath, mod);
512
+ }
513
+ };
514
+ var HMRClient = class {
515
+ constructor(logger, transport, importUpdatedModule) {
516
+ this.logger = logger;
517
+ this.transport = transport;
518
+ this.importUpdatedModule = importUpdatedModule;
519
+ _defineProperty(this, "hotModulesMap", /* @__PURE__ */ new Map());
520
+ _defineProperty(this, "disposeMap", /* @__PURE__ */ new Map());
521
+ _defineProperty(this, "pruneMap", /* @__PURE__ */ new Map());
522
+ _defineProperty(this, "dataMap", /* @__PURE__ */ new Map());
523
+ _defineProperty(this, "customListenersMap", /* @__PURE__ */ new Map());
524
+ _defineProperty(this, "ctxToListenersMap", /* @__PURE__ */ new Map());
525
+ _defineProperty(this, "currentFirstInvalidatedBy", void 0);
526
+ _defineProperty(this, "updateQueue", []);
527
+ _defineProperty(this, "pendingUpdateQueue", false);
528
+ }
529
+ async notifyListeners(event, data) {
530
+ const cbs = this.customListenersMap.get(event);
531
+ if (cbs) await Promise.allSettled(cbs.map((cb) => cb(data)));
532
+ }
533
+ send(payload) {
534
+ this.transport.send(payload).catch((err) => {
535
+ this.logger.error(err);
536
+ });
537
+ }
538
+ clear() {
539
+ this.hotModulesMap.clear();
540
+ this.disposeMap.clear();
541
+ this.pruneMap.clear();
542
+ this.dataMap.clear();
543
+ this.customListenersMap.clear();
544
+ this.ctxToListenersMap.clear();
545
+ }
546
+ async prunePaths(paths) {
547
+ try {
548
+ await Promise.all(paths.map((path) => {
549
+ const disposer = this.disposeMap.get(path);
550
+ if (disposer) return disposer(this.dataMap.get(path));
551
+ }));
552
+ await Promise.all(paths.map((path) => {
553
+ const fn = this.pruneMap.get(path);
554
+ if (fn) return fn(this.dataMap.get(path));
555
+ }));
556
+ } finally {
557
+ paths.forEach((path) => this.dataMap.delete(path));
558
+ }
559
+ }
560
+ warnFailedUpdate(err, path) {
561
+ if (!(err instanceof Error) || !err.message.includes("fetch")) this.logger.error(err);
562
+ this.logger.error(`Failed to reload ${path}. This could be due to syntax errors or importing non-existent modules. (see errors above)`);
563
+ }
564
+ /**
565
+ * buffer multiple hot updates triggered by the same src change
566
+ * so that they are invoked in the same order they were sent.
567
+ * (otherwise the order may be inconsistent because of the http request round trip)
568
+ */
569
+ async queueUpdate(payload) {
570
+ this.updateQueue.push(this.fetchUpdate(payload));
571
+ if (!this.pendingUpdateQueue) {
572
+ this.pendingUpdateQueue = true;
573
+ await Promise.resolve();
574
+ this.pendingUpdateQueue = false;
575
+ const loading = [...this.updateQueue];
576
+ this.updateQueue = [];
577
+ (await Promise.all(loading)).forEach((fn) => fn && fn());
578
+ }
579
+ }
580
+ async fetchUpdate(update) {
581
+ const { path, acceptedPath, firstInvalidatedBy } = update;
582
+ const mod = this.hotModulesMap.get(path);
583
+ if (!mod) return;
584
+ let fetchedModule;
585
+ const isSelfUpdate = path === acceptedPath;
586
+ const qualifiedCallbacks = mod.callbacks.filter(({ deps }) => deps.includes(acceptedPath));
587
+ if (isSelfUpdate || qualifiedCallbacks.length > 0) {
588
+ const disposer = this.disposeMap.get(acceptedPath);
589
+ if (disposer) await disposer(this.dataMap.get(acceptedPath));
590
+ try {
591
+ fetchedModule = await this.importUpdatedModule(update);
592
+ } catch (e) {
593
+ this.warnFailedUpdate(e, acceptedPath);
594
+ }
595
+ }
596
+ return () => {
597
+ try {
598
+ this.currentFirstInvalidatedBy = firstInvalidatedBy;
599
+ for (const { deps, fn } of qualifiedCallbacks) fn(deps.map((dep) => dep === acceptedPath ? fetchedModule : void 0));
600
+ const loggedPath = isSelfUpdate ? path : `${acceptedPath} via ${path}`;
601
+ this.logger.debug(`hot updated: ${loggedPath}`);
602
+ } finally {
603
+ this.currentFirstInvalidatedBy = void 0;
604
+ }
605
+ };
606
+ }
607
+ };
608
+ //#endregion
609
+ //#region src/shared/hmrHandler.ts
610
+ function createHMRHandler(handler) {
611
+ const queue = new Queue();
612
+ return (payload) => queue.enqueue(() => handler(payload));
613
+ }
614
+ var Queue = class {
615
+ constructor() {
616
+ _defineProperty(this, "queue", []);
617
+ _defineProperty(this, "pending", false);
618
+ }
619
+ enqueue(promise) {
620
+ return new Promise((resolve, reject) => {
621
+ this.queue.push({
622
+ promise,
623
+ resolve,
624
+ reject
625
+ });
626
+ this.dequeue();
627
+ });
628
+ }
629
+ dequeue() {
630
+ if (this.pending) return false;
631
+ const item = this.queue.shift();
632
+ if (!item) return false;
633
+ this.pending = true;
634
+ item.promise().then(item.resolve).catch(item.reject).finally(() => {
635
+ this.pending = false;
636
+ this.dequeue();
637
+ });
638
+ return true;
639
+ }
640
+ };
641
+ //#endregion
618
642
  //#region src/client/overlay.ts
619
643
  const hmrConfigName = __HMR_CONFIG_NAME__;
620
644
  const base$1 = __BASE__ || "/";
@@ -932,14 +956,18 @@ const debounceReload = (time) => {
932
956
  };
933
957
  };
934
958
  const pageReload = debounceReload(20);
959
+ function wrapIdIfNeeded(id) {
960
+ return id[0] === "." || id[0] === "/" ? id : wrapId(id);
961
+ }
935
962
  const hmrClient = new HMRClient({
936
963
  error: (err) => console.error("[vite]", err),
937
964
  debug: (...msg) => console.debug("[vite]", ...msg)
938
965
  }, transport, async function importUpdatedModule({ acceptedPath, timestamp, explicitImportRequired, isWithinCircularImport }) {
939
966
  const [acceptedPathWithoutQuery, query] = acceptedPath.split(`?`);
967
+ const browserPath = wrapIdIfNeeded(acceptedPathWithoutQuery);
940
968
  const importPromise = import(
941
969
  /* @vite-ignore */
942
- base + acceptedPathWithoutQuery.slice(1) + `?${explicitImportRequired ? "import&" : ""}t=${timestamp}${query ? `&${query}` : ""}`
970
+ base + browserPath.slice(1) + `?${explicitImportRequired ? "import&" : ""}t=${timestamp}${query ? `&${query}` : ""}`
943
971
  );
944
972
  if (isWithinCircularImport) importPromise.catch(() => {
945
973
  console.info(`[hmr] ${acceptedPath} failed to apply HMR as it's within a circular import. Reloading page to reset the execution order. To debug and break the circular import, you can run \`vite --debug hmr\` to log the circular dependency path if a file change triggered it.`);