vite 8.2.0 → 8.2.2

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/LICENSE.md CHANGED
@@ -1256,7 +1256,7 @@ Repository: https://github.com/lydell/js-tokens
1256
1256
 
1257
1257
  > The MIT License (MIT)
1258
1258
  >
1259
- > Copyright (c) 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 Simon Lydell
1259
+ > Copyright (c) 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025 Simon Lydell
1260
1260
  >
1261
1261
  > Permission is hereby granted, free of charge, to any person obtaining a copy
1262
1262
  > of this software and associated documentation files (the "Software"), to deal
@@ -8,7 +8,40 @@ let nanoid = (size = 21) => {
8
8
  return id;
9
9
  };
10
10
  //#endregion
11
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
11
+ //#region ../../node_modules/.pnpm/rolldown@1.2.4/node_modules/rolldown/dist/experimental-runtime-base.mjs
12
+ var __create = Object.create;
13
+ var __defProp = Object.defineProperty;
14
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15
+ var __getOwnPropNames = Object.getOwnPropertyNames;
16
+ var __getProtoOf = Object.getPrototypeOf;
17
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
18
+ var __exportAll = (all, no_symbols) => {
19
+ let target = {};
20
+ for (var name in all) __defProp(target, name, {
21
+ get: all[name],
22
+ enumerable: true
23
+ });
24
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
25
+ return target;
26
+ };
27
+ var __copyProps = (to, from, except, desc) => {
28
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
29
+ key = keys[i];
30
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
31
+ get: ((k) => from[k]).bind(null, key),
32
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
33
+ });
34
+ }
35
+ return to;
36
+ };
37
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
38
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
39
+ value: mod,
40
+ enumerable: true
41
+ }) : target, mod));
42
+ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
43
+ //#endregion
44
+ //#region \0@oxc-project+runtime@0.144.0/helpers/esm/typeof.js
12
45
  function _typeof(o) {
13
46
  "@babel/helpers - typeof";
14
47
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -18,7 +51,7 @@ function _typeof(o) {
18
51
  }, _typeof(o);
19
52
  }
20
53
  //#endregion
21
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
54
+ //#region \0@oxc-project+runtime@0.144.0/helpers/esm/toPrimitive.js
22
55
  function toPrimitive(t, r) {
23
56
  if ("object" != _typeof(t) || !t) return t;
24
57
  var e = t[Symbol.toPrimitive];
@@ -30,13 +63,13 @@ function toPrimitive(t, r) {
30
63
  return ("string" === r ? String : Number)(t);
31
64
  }
32
65
  //#endregion
33
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
66
+ //#region \0@oxc-project+runtime@0.144.0/helpers/esm/toPropertyKey.js
34
67
  function toPropertyKey(t) {
35
68
  var i = toPrimitive(t, "string");
36
69
  return "symbol" == _typeof(i) ? i : i + "";
37
70
  }
38
71
  //#endregion
39
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
72
+ //#region \0@oxc-project+runtime@0.144.0/helpers/esm/defineProperty.js
40
73
  function _defineProperty(e, r, t) {
41
74
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
42
75
  value: t,
@@ -46,6 +79,283 @@ function _defineProperty(e, r, t) {
46
79
  }) : e[r] = t, e;
47
80
  }
48
81
  //#endregion
82
+ //#region ../../node_modules/.pnpm/rolldown@1.2.4/node_modules/rolldown/dist/experimental-runtime.mjs
83
+ var Module = class {
84
+ /**
85
+ * @param {string} id
86
+ */
87
+ constructor(id) {
88
+ _defineProperty(
89
+ this,
90
+ /**
91
+ * @type {{ exports: any }}
92
+ */
93
+ "exportsHolder",
94
+ { exports: null }
95
+ );
96
+ _defineProperty(
97
+ this,
98
+ /**
99
+ * @type {string}
100
+ */
101
+ "id",
102
+ void 0
103
+ );
104
+ this.id = id;
105
+ }
106
+ get exports() {
107
+ return this.exportsHolder.exports;
108
+ }
109
+ };
110
+ /**
111
+ * Compiler-emitted module-graph delta — pure topology (static + dynamic edges).
112
+ * `ids[0, localCount)` are the modules this payload carries; `ids[localCount, …)` are foreign edge targets.
113
+ * `edges[i]` / `dynamicEdges[i]` are the static / dynamic-`import()` out-edges of `ids[i]`.
114
+ * @typedef {{ ids: string[], localCount: number, edges: number[][], dynamicEdges?: number[][] }} ModuleGraphDelta
115
+ * @typedef {{ createModuleHotContext(moduleId: string): any, onModuleCacheRemoval(moduleId: string): void }} DevRuntimeHooks
116
+ */
117
+ var MissingFactoryError = class extends Error {
118
+ /**
119
+ * @param {string} id
120
+ */
121
+ constructor(id) {
122
+ super(`No factory registered for module ${id}`);
123
+ this.id = id;
124
+ }
125
+ };
126
+ var DevRuntime = class {
127
+ /**
128
+ * @param {string} clientId
129
+ */
130
+ constructor(clientId) {
131
+ _defineProperty(
132
+ this,
133
+ /**
134
+ * Client ID generated at runtime initialization, used for lazy compilation requests.
135
+ * @type {string}
136
+ */
137
+ "clientId",
138
+ void 0
139
+ );
140
+ _defineProperty(
141
+ this,
142
+ /**
143
+ * Static import edges from `registerGraph` — entries persist across `removeModuleCache`
144
+ * and change only by replacement from a newer payload (last write wins).
145
+ * @type {Map<string, { edges: string[] }>}
146
+ */
147
+ "staticImports",
148
+ /* @__PURE__ */ new Map()
149
+ );
150
+ _defineProperty(
151
+ this,
152
+ /**
153
+ * Reverse index over the static imports.
154
+ * @type {Map<string, Set<string>>}
155
+ */
156
+ "importers",
157
+ /* @__PURE__ */ new Map()
158
+ );
159
+ _defineProperty(
160
+ this,
161
+ /**
162
+ * Dynamic `import()` edges from `registerGraph`, keyed by importer — mirror of
163
+ * `staticImports` for the dynamic reverse index.
164
+ * @type {Map<string, { edges: string[] }>}
165
+ */
166
+ "dynamicImports",
167
+ /* @__PURE__ */ new Map()
168
+ );
169
+ _defineProperty(
170
+ this,
171
+ /**
172
+ * Reverse index over the dynamic imports.
173
+ * @type {Map<string, Set<string>>}
174
+ */
175
+ "dynamicImporters",
176
+ /* @__PURE__ */ new Map()
177
+ );
178
+ _defineProperty(
179
+ this,
180
+ /**
181
+ * The module cache. Membership means "this module's side effects ran in this tab" —
182
+ * registration is emitted ahead of every module body, and nothing un-registers on
183
+ * unwind, so a factory that throws mid-body stays registered. A `Map` rather than a
184
+ * plain object: HMR eviction deletes entries, and a `delete` on an object drops V8
185
+ * into dictionary mode, taxing every later lookup on the hottest read path.
186
+ * @type {Map<string, Module>}
187
+ */
188
+ "moduleCache",
189
+ /* @__PURE__ */ new Map()
190
+ );
191
+ _defineProperty(
192
+ this,
193
+ /**
194
+ * Re-runnable factories from HMR patches and lazy chunks. The initial bundle stays
195
+ * scope-hoisted and contributes none.
196
+ * @type {Map<string, { kind: 'esm' | 'cjs', fn: (id: string) => void }>}
197
+ */
198
+ "factories",
199
+ /* @__PURE__ */ new Map()
200
+ );
201
+ _defineProperty(
202
+ this,
203
+ /**
204
+ * Installed by the dev client at boot. The runtime is a store + executor and makes
205
+ * no HMR decisions; accepting, disposing, and reloading live behind these hooks.
206
+ * @type {DevRuntimeHooks | null}
207
+ */
208
+ "hooks",
209
+ null
210
+ );
211
+ _defineProperty(
212
+ this,
213
+ /** @internal */
214
+ "__toESM",
215
+ __toESM
216
+ );
217
+ _defineProperty(
218
+ this,
219
+ /** @internal */
220
+ "__toCommonJS",
221
+ __toCommonJS
222
+ );
223
+ _defineProperty(
224
+ this,
225
+ /** @internal */
226
+ "__exportAll",
227
+ __exportAll
228
+ );
229
+ _defineProperty(
230
+ this,
231
+ /**
232
+ * @param {boolean} [isNodeMode]
233
+ * @returns {(mod: any) => any}
234
+ * @internal
235
+ */
236
+ "__toDynamicImportESM",
237
+ (isNodeMode) => (mod) => __toESM(mod.default, isNodeMode)
238
+ );
239
+ _defineProperty(
240
+ this,
241
+ /** @internal */
242
+ "__reExport",
243
+ __reExport
244
+ );
245
+ this.clientId = clientId;
246
+ }
247
+ /**
248
+ * @param {ModuleGraphDelta} delta
249
+ */
250
+ registerGraph(delta) {
251
+ for (let i = 0; i < delta.localCount; i++) {
252
+ const id = delta.ids[i];
253
+ const edges = delta.edges[i].map((j) => delta.ids[j]);
254
+ for (const target of this.staticImports.get(id)?.edges ?? []) this.importers.get(target)?.delete(id);
255
+ for (const target of edges) {
256
+ let importerSet = this.importers.get(target);
257
+ if (!importerSet) {
258
+ importerSet = /* @__PURE__ */ new Set();
259
+ this.importers.set(target, importerSet);
260
+ }
261
+ importerSet.add(id);
262
+ }
263
+ this.staticImports.set(id, { edges });
264
+ const dynamicEdges = (delta.dynamicEdges?.[i] ?? []).map((j) => delta.ids[j]);
265
+ for (const target of this.dynamicImports.get(id)?.edges ?? []) this.dynamicImporters.get(target)?.delete(id);
266
+ for (const target of dynamicEdges) {
267
+ let importerSet = this.dynamicImporters.get(target);
268
+ if (!importerSet) {
269
+ importerSet = /* @__PURE__ */ new Set();
270
+ this.dynamicImporters.set(target, importerSet);
271
+ }
272
+ importerSet.add(id);
273
+ }
274
+ this.dynamicImports.set(id, { edges: dynamicEdges });
275
+ }
276
+ }
277
+ /**
278
+ * @param {string} id
279
+ * @param {'esm' | 'cjs'} kind
280
+ * @param {(id: string) => void} fn
281
+ */
282
+ registerFactory(id, kind, fn) {
283
+ this.factories.set(id, {
284
+ kind,
285
+ fn
286
+ });
287
+ }
288
+ /**
289
+ * @param {string} id
290
+ * @param {{ exports: any }} exportsHolder
291
+ */
292
+ registerModule(id, exportsHolder) {
293
+ const module = new Module(id);
294
+ module.exportsHolder = exportsHolder;
295
+ this.moduleCache.set(id, module);
296
+ }
297
+ /**
298
+ * @param {string} id
299
+ * @returns {string[]}
300
+ */
301
+ getImporters(id) {
302
+ const dynamic = this.dynamicImporters.get(id);
303
+ if (!dynamic || dynamic.size === 0) return [...this.importers.get(id) ?? []];
304
+ return [.../* @__PURE__ */ new Set([...this.importers.get(id) ?? [], ...dynamic])];
305
+ }
306
+ /**
307
+ * @param {string} id
308
+ */
309
+ isExecuted(id) {
310
+ return this.moduleCache.has(id);
311
+ }
312
+ /**
313
+ * @param {string} id
314
+ */
315
+ hasFactory(id) {
316
+ return this.factories.has(id);
317
+ }
318
+ /**
319
+ * Module-cache delete only — static imports and factories persist. Removal is what
320
+ * re-arms a cache-gated factory for `initModule`.
321
+ * @param {string} id
322
+ */
323
+ removeModuleCache(id) {
324
+ this.moduleCache.delete(id);
325
+ this.hooks?.onModuleCacheRemoval(id);
326
+ }
327
+ /**
328
+ * The one re-execution gate: registered → return the live exports; otherwise run the
329
+ * mapped factory (which registers itself first, then runs the body).
330
+ * @param {string} id
331
+ */
332
+ initModule(id) {
333
+ if (this.moduleCache.has(id)) return this.loadExports(id);
334
+ const factory = this.factories.get(id);
335
+ if (!factory) throw new MissingFactoryError(id);
336
+ factory.fn(id);
337
+ return this.loadExports(id);
338
+ }
339
+ /**
340
+ * @param {string} id
341
+ */
342
+ loadExports(id) {
343
+ const module = this.moduleCache.get(id);
344
+ if (module) return module.exportsHolder.exports;
345
+ else {
346
+ console.warn(`Module ${id} not found`);
347
+ return {};
348
+ }
349
+ }
350
+ /**
351
+ * @param {string} moduleId
352
+ */
353
+ createModuleHotContext(moduleId) {
354
+ if (this.hooks) return this.hooks.createModuleHotContext(moduleId);
355
+ throw new Error("createModuleHotContext requires installed hooks or an override");
356
+ }
357
+ };
358
+ //#endregion
49
359
  //#region src/shared/hmr.ts
50
360
  var HMRContext = class {
51
361
  constructor(hmrClient, ownerPath) {
@@ -275,7 +585,11 @@ var BundledDevHMRClient = class extends HMRClient {
275
585
  reason: `update propagated back to ${firstInvalidatedBy}, which already called \`import.meta.hot.invalidate()\``
276
586
  };
277
587
  if (this.isSelfAccepted(id)) {
278
- boundaries.push([id, id]);
588
+ boundaries.push({
589
+ boundary: id,
590
+ acceptedVia: id,
591
+ isWithinCircularImport: this.isNodeWithinCircularImports(id, stack)
592
+ });
279
593
  return;
280
594
  }
281
595
  const parents = this.runtime.getImporters(id).filter((p) => this.runtime.isExecuted(p));
@@ -284,17 +598,52 @@ var BundledDevHMRClient = class extends HMRClient {
284
598
  reason: `no hmr boundary found for module \`${id}\``
285
599
  };
286
600
  for (const parent of parents) {
601
+ const subChain = [...stack, parent];
287
602
  if (this.acceptsDep(parent, id)) {
288
- boundaries.push([parent, id]);
603
+ boundaries.push({
604
+ boundary: parent,
605
+ acceptedVia: id,
606
+ isWithinCircularImport: this.isNodeWithinCircularImports(parent, subChain)
607
+ });
289
608
  continue;
290
609
  }
291
- if (stack.includes(parent)) return {
292
- type: "full-reload",
293
- reason: `circular import chain between \`${id}\` and \`${parent}\``
294
- };
295
- const fullReload = this.bubble(parent, [...stack, parent], updateSet, boundaries, firstInvalidatedBy, traversedModules);
296
- if (fullReload) return fullReload;
610
+ if (!stack.includes(parent)) {
611
+ const fullReload = this.bubble(parent, subChain, updateSet, boundaries, firstInvalidatedBy, traversedModules);
612
+ if (fullReload) return fullReload;
613
+ }
614
+ }
615
+ }
616
+ /**
617
+ * Check importers recursively if it's an import loop. An accepted module within
618
+ * an import loop cannot recover its execution order and should be reloaded.
619
+ *
620
+ * @param node The node that accepts HMR and is a boundary
621
+ * @param nodeChain The chain of nodes/imports that lead to the node.
622
+ * (The last node in the chain imports the `node` parameter)
623
+ * @param currentChain The current chain tracked from the `node` parameter
624
+ * @param traversedModules The set of modules that have traversed
625
+ */
626
+ isNodeWithinCircularImports(node, nodeChain, currentChain = [node], traversedModules = /* @__PURE__ */ new Set()) {
627
+ if (traversedModules.has(node)) return false;
628
+ traversedModules.add(node);
629
+ for (const importer of this.runtime.getImporters(node)) {
630
+ if (importer === node) continue;
631
+ const importerIndex = nodeChain.indexOf(importer);
632
+ if (importerIndex > -1) {
633
+ const importChain = [
634
+ importer,
635
+ ...[...currentChain].reverse(),
636
+ ...nodeChain.slice(importerIndex, -1).reverse()
637
+ ];
638
+ this.logger.debug(`circular imports detected: ${importChain.join(" -> ")}`);
639
+ return true;
640
+ }
641
+ if (!currentChain.includes(importer)) {
642
+ const result = this.isNodeWithinCircularImports(importer, nodeChain, currentChain.concat(importer), traversedModules);
643
+ if (result) return result;
644
+ }
297
645
  }
646
+ return false;
298
647
  }
299
648
  handlePush(payload) {
300
649
  this.applyQueue = this.applyQueue.then(() => this.applyPush(payload)).catch((err) => {
@@ -364,15 +713,25 @@ var BundledDevHMRClient = class extends HMRClient {
364
713
  this.requestFullReload(`no factory for module \`${id}\``);
365
714
  return;
366
715
  }
367
- const applies = update.boundaries.map(([boundary, acceptedVia]) => ({
716
+ const applies = update.boundaries.map(({ boundary, acceptedVia, isWithinCircularImport }) => ({
368
717
  boundary,
369
718
  acceptedVia,
719
+ isWithinCircularImport,
370
720
  callbacks: this.hotModulesMap.get(boundary)?.callbacks.filter((c) => c.deps.includes(acceptedVia)) ?? []
371
721
  }));
372
722
  for (const id of update.updateSet) this.runtime.removeModuleCache(id);
373
- for (const { boundary, acceptedVia, callbacks } of applies) {
374
- this.runtime.initModule(acceptedVia);
375
- const fresh = this.runtime.loadExports(acceptedVia);
723
+ for (const { boundary, acceptedVia, isWithinCircularImport, callbacks } of applies) {
724
+ let fresh;
725
+ try {
726
+ this.runtime.initModule(acceptedVia);
727
+ fresh = this.runtime.loadExports(acceptedVia);
728
+ } catch (err) {
729
+ if (isWithinCircularImport) {
730
+ this.requestFullReload(`${acceptedVia} failed to apply HMR as it's within a circular import. Reloading page to reset the execution order.`);
731
+ return;
732
+ }
733
+ throw err;
734
+ }
376
735
  try {
377
736
  this.currentFirstInvalidatedBy = firstInvalidatedBy;
378
737
  for (const { deps, fn } of callbacks) fn(deps.map((dep) => dep === acceptedVia ? fresh : void 0));
@@ -385,11 +744,12 @@ var BundledDevHMRClient = class extends HMRClient {
385
744
  toUpdatePayload(boundaries, firstInvalidatedBy) {
386
745
  return {
387
746
  type: "update",
388
- updates: boundaries.map(([boundary, acceptedVia]) => ({
747
+ updates: boundaries.map(({ boundary, acceptedVia, isWithinCircularImport }) => ({
389
748
  type: "js-update",
390
749
  path: boundary,
391
750
  acceptedPath: acceptedVia,
392
751
  timestamp: Date.now(),
752
+ isWithinCircularImport,
393
753
  firstInvalidatedBy
394
754
  }))
395
755
  };
@@ -572,13 +932,17 @@ const normalizeModuleRunnerTransport = (transport) => {
572
932
  } } : {},
573
933
  async send(data) {
574
934
  if (!invokeableTransport.send) return;
575
- if (!isConnected) if (connectingPromise) await connectingPromise;
576
- else throw new SendBeforeConnectError("send was called before connect");
935
+ if (!isConnected) {
936
+ if (connectingPromise) await connectingPromise;
937
+ else throw new SendBeforeConnectError("send was called before connect");
938
+ }
577
939
  await invokeableTransport.send(data);
578
940
  },
579
941
  async invoke(name, data) {
580
- if (!isConnected) if (connectingPromise) await connectingPromise;
581
- else throw new SendBeforeConnectError("invoke was called before connect");
942
+ if (!isConnected) {
943
+ if (connectingPromise) await connectingPromise;
944
+ else throw new SendBeforeConnectError("invoke was called before connect");
945
+ }
582
946
  return invokeableTransport.invoke(name, data);
583
947
  }
584
948
  };
@@ -1199,12 +1563,14 @@ async function handleMessage(payload) {
1199
1563
  case "full-reload":
1200
1564
  if (payload.ifFallback && !globalThis.__vite_is_fallback_page__) break;
1201
1565
  await activeHmrClient.notifyListeners("vite:beforeFullReload", payload);
1202
- if (hasDocument) if (payload.path && payload.path.endsWith(".html")) {
1203
- const pagePath = decodeURI(location.pathname);
1204
- const payloadPath = base + payload.path.slice(1);
1205
- if (pagePath === payloadPath || payload.path === "/index.html" || pagePath.endsWith("/") && pagePath + "index.html" === payloadPath) pageReload();
1206
- return;
1207
- } else pageReload();
1566
+ if (hasDocument) {
1567
+ if (payload.path && payload.path.endsWith(".html")) {
1568
+ const pagePath = decodeURI(location.pathname);
1569
+ const payloadPath = base + payload.path.slice(1);
1570
+ if (pagePath === payloadPath || payload.path === "/index.html" || pagePath.endsWith("/") && pagePath + "index.html" === payloadPath) pageReload();
1571
+ return;
1572
+ } else pageReload();
1573
+ }
1208
1574
  break;
1209
1575
  case "prune":
1210
1576
  await activeHmrClient.notifyListeners("vite:beforePrune", payload);
@@ -1,5 +1,5 @@
1
1
  import "@vite/env";
2
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/typeof.js
2
+ //#region \0@oxc-project+runtime@0.144.0/helpers/esm/typeof.js
3
3
  function _typeof(o) {
4
4
  "@babel/helpers - typeof";
5
5
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -9,7 +9,7 @@ function _typeof(o) {
9
9
  }, _typeof(o);
10
10
  }
11
11
  //#endregion
12
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPrimitive.js
12
+ //#region \0@oxc-project+runtime@0.144.0/helpers/esm/toPrimitive.js
13
13
  function toPrimitive(t, r) {
14
14
  if ("object" != _typeof(t) || !t) return t;
15
15
  var e = t[Symbol.toPrimitive];
@@ -21,13 +21,13 @@ function toPrimitive(t, r) {
21
21
  return ("string" === r ? String : Number)(t);
22
22
  }
23
23
  //#endregion
24
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/toPropertyKey.js
24
+ //#region \0@oxc-project+runtime@0.144.0/helpers/esm/toPropertyKey.js
25
25
  function toPropertyKey(t) {
26
26
  var i = toPrimitive(t, "string");
27
27
  return "symbol" == _typeof(i) ? i : i + "";
28
28
  }
29
29
  //#endregion
30
- //#region \0@oxc-project+runtime@0.140.0/helpers/esm/defineProperty.js
30
+ //#region \0@oxc-project+runtime@0.144.0/helpers/esm/defineProperty.js
31
31
  function _defineProperty(e, r, t) {
32
32
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
33
33
  value: t,
@@ -384,13 +384,17 @@ const normalizeModuleRunnerTransport = (transport) => {
384
384
  } } : {},
385
385
  async send(data) {
386
386
  if (!invokeableTransport.send) return;
387
- if (!isConnected) if (connectingPromise) await connectingPromise;
388
- else throw new SendBeforeConnectError("send was called before connect");
387
+ if (!isConnected) {
388
+ if (connectingPromise) await connectingPromise;
389
+ else throw new SendBeforeConnectError("send was called before connect");
390
+ }
389
391
  await invokeableTransport.send(data);
390
392
  },
391
393
  async invoke(name, data) {
392
- if (!isConnected) if (connectingPromise) await connectingPromise;
393
- else throw new SendBeforeConnectError("invoke was called before connect");
394
+ if (!isConnected) {
395
+ if (connectingPromise) await connectingPromise;
396
+ else throw new SendBeforeConnectError("invoke was called before connect");
397
+ }
394
398
  return invokeableTransport.invoke(name, data);
395
399
  }
396
400
  };
@@ -1008,12 +1012,14 @@ async function handleMessage(payload) {
1008
1012
  case "full-reload":
1009
1013
  if (payload.ifFallback && !globalThis.__vite_is_fallback_page__) break;
1010
1014
  await activeHmrClient.notifyListeners("vite:beforeFullReload", payload);
1011
- if (hasDocument) if (payload.path && payload.path.endsWith(".html")) {
1012
- const pagePath = decodeURI(location.pathname);
1013
- const payloadPath = base + payload.path.slice(1);
1014
- if (pagePath === payloadPath || payload.path === "/index.html" || pagePath.endsWith("/") && pagePath + "index.html" === payloadPath) pageReload();
1015
- return;
1016
- } else pageReload();
1015
+ if (hasDocument) {
1016
+ if (payload.path && payload.path.endsWith(".html")) {
1017
+ const pagePath = decodeURI(location.pathname);
1018
+ const payloadPath = base + payload.path.slice(1);
1019
+ if (pagePath === payloadPath || payload.path === "/index.html" || pagePath.endsWith("/") && pagePath + "index.html" === payloadPath) pageReload();
1020
+ return;
1021
+ } else pageReload();
1022
+ }
1017
1023
  break;
1018
1024
  case "prune":
1019
1025
  await activeHmrClient.notifyListeners("vite:beforePrune", payload);