@voidzero-dev/vite-plus-core 1.0.0 → 1.2.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.
Files changed (68) hide show
  1. package/LICENSE +36 -177
  2. package/dist/rolldown/cli.mjs +33 -29
  3. package/dist/rolldown/config.d.mts +3 -3
  4. package/dist/rolldown/config.mjs +2 -2
  5. package/dist/rolldown/experimental-index.d.mts +29 -29
  6. package/dist/rolldown/experimental-index.mjs +8 -8
  7. package/dist/rolldown/experimental-runtime-types.d.ts +39 -7
  8. package/dist/rolldown/experimental-runtime.d.ts +39 -7
  9. package/dist/rolldown/experimental-runtime.mjs +284 -255
  10. package/dist/rolldown/filter-index.d.mts +1 -1
  11. package/dist/rolldown/index.d.mts +3 -3
  12. package/dist/rolldown/index.mjs +4 -4
  13. package/dist/rolldown/parallel-plugin-worker.mjs +2 -2
  14. package/dist/rolldown/parallel-plugin.d.mts +3 -3
  15. package/dist/rolldown/parse-ast-index.d.mts +6 -7
  16. package/dist/rolldown/parse-ast-index.mjs +1 -1
  17. package/dist/rolldown/plugins-index.d.mts +5 -5
  18. package/dist/rolldown/plugins-index.mjs +2 -2
  19. package/dist/rolldown/shared/{binding-BY0qR5iS.mjs → binding-DlR5d34p.mjs} +27 -28
  20. package/dist/rolldown/shared/{binding-BTa6BPQe.d.mts → binding-tzp6Hc_3.d.mts} +1 -1
  21. package/dist/rolldown/shared/{bindingify-input-options-B8JHmN6_.mjs → bindingify-input-options-DhjlrWZE.mjs} +203 -20
  22. package/dist/rolldown/shared/{constructors-xEvVj3lN.mjs → constructors-B2hkJoIA.mjs} +1 -1
  23. package/dist/rolldown/shared/{constructors-DuOq7MqW.d.mts → constructors-Dw9H1IvX.d.mts} +2 -2
  24. package/dist/rolldown/shared/{create-bundler-option-COco-7P6.mjs → create-bundler-option-1AEe_J0o.mjs} +36 -10
  25. package/dist/rolldown/shared/{define-config-C7HCoqY8.d.mts → define-config-CGhm2DU-.d.mts} +94 -5
  26. package/dist/rolldown/shared/{error-C7pxws0W.mjs → error-Dsqzw0Oa.mjs} +2 -1
  27. package/dist/rolldown/shared/{load-config-DkUBnDsI.mjs → load-config-bvw8z7Ft.mjs} +2 -2
  28. package/dist/rolldown/shared/{normalize-string-or-regex-F14uvr6D.mjs → normalize-string-or-regex-B7Gsiuz7.mjs} +1 -1
  29. package/dist/rolldown/shared/{parse-BWeE7Vr9.mjs → parse-BCSSrLHf.mjs} +2 -2
  30. package/dist/rolldown/shared/{resolve-tsconfig-DHwpIs5e.mjs → resolve-tsconfig-DyR2RUTm.mjs} +2 -2
  31. package/dist/rolldown/shared/{rolldown-Bue0gNT5.mjs → rolldown-C8QomUuX.mjs} +4 -4
  32. package/dist/rolldown/shared/{transform-DK_nCt9j.d.mts → transform-D4RDjIPI.d.mts} +1 -1
  33. package/dist/rolldown/shared/{watch-RXhXN1aG.mjs → watch-CPI70Lkn.mjs} +4 -4
  34. package/dist/rolldown/utils-index.d.mts +5 -5
  35. package/dist/rolldown/utils-index.mjs +5 -5
  36. package/dist/tsdown/{build-JVmLFaZt-DRlLhpV3.js → build-KEepWO_k-BOsPZ2cH.js} +26 -25
  37. package/dist/tsdown/{debug-CpC4hV25-C-OYr2iI.js → debug-DKTolR2K-BMJOFfj2.js} +4 -5
  38. package/dist/tsdown/{detect-Bg-d8iUV-Du8LljhG.js → detect-DHDepxVX-CpWW52Jd.js} +38 -34
  39. package/dist/tsdown/dist-BebyOHRu.js +6224 -0
  40. package/dist/tsdown/index-types.d.ts +216 -216
  41. package/dist/tsdown/index.js +4 -4
  42. package/dist/tsdown/{main-CyNcZUzu.js → main-Du9xCnhX.js} +105 -19
  43. package/dist/tsdown/npm_entry_picomatch.cjs +36 -25
  44. package/dist/tsdown/{resolver-DE0_sy8o-Bi3xbRxi.js → resolver-DE0_sy8o-DNoi-dFQ.js} +3 -2
  45. package/dist/tsdown/run.js +28 -26
  46. package/dist/tsdown/{src-pN7Bl6zo.js → src-CBWRkeF5.js} +4 -4
  47. package/dist/tsdown/{target-DgdLrXba-DpO9JXxB.js → target-HZbF5Cux-Cmv1LI5D.js} +175 -9
  48. package/dist/tsdown/{tsc-BLb4pSBY.js → tsc-YwU2b8yT.js} +4 -4
  49. package/dist/tsdown/tsdown-css.js +4 -4
  50. package/dist/tsdown/tsdown-exe.js +5 -43
  51. package/dist/vite/client/bundledDevClient.mjs +109 -345
  52. package/dist/vite/client/client.mjs +80 -28
  53. package/dist/vite/node/chunks/build.js +19 -19
  54. package/dist/vite/node/chunks/node.js +5210 -4942
  55. package/dist/vite/node/chunks/postcss-import.js +10 -10
  56. package/dist/vite/node/cli.js +24 -21
  57. package/dist/vite/node/index.d.ts +5 -2
  58. package/dist/vite/node/index.js +1 -2
  59. package/dist/vite/node/internal.js +1 -2
  60. package/dist/vite/node/module-runner.d.ts +1 -0
  61. package/dist/vite/node/module-runner.js +32 -27
  62. package/package.json +46 -30
  63. package/dist/rolldown/experimental-default-runtime.mjs +0 -116
  64. package/dist/rolldown/experimental-runtime-base.mjs +0 -95
  65. package/dist/tsdown/dist-VDcV1Qyy.js +0 -2952
  66. package/dist/tsdown/require-BbBF8Ii0-BDaWJgzA.js +0 -320
  67. package/dist/tsdown/style-DiMP8pYv-DIC5PXeH.js +0 -88
  68. package/dist/tsdown/version-CQ98ZBpL-D6GAHapk.js +0 -169
@@ -1,3 +1,4 @@
1
+ import { DevRuntime } from "rolldown/experimental/runtime";
1
2
  import "@vite/env";
2
3
  //#region ../../node_modules/.pnpm/nanoid@5.1.16/node_modules/nanoid/non-secure/index.js
3
4
  let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
@@ -8,40 +9,7 @@ let nanoid = (size = 21) => {
8
9
  return id;
9
10
  };
10
11
  //#endregion
11
- //#region ../../rolldown/packages/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.151.0/helpers/esm/typeof.js
12
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
45
13
  function _typeof(o) {
46
14
  "@babel/helpers - typeof";
47
15
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -51,7 +19,7 @@ function _typeof(o) {
51
19
  }, _typeof(o);
52
20
  }
53
21
  //#endregion
54
- //#region \0@oxc-project+runtime@0.151.0/helpers/esm/toPrimitive.js
22
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
55
23
  function toPrimitive(t, r) {
56
24
  if ("object" != _typeof(t) || !t) return t;
57
25
  var e = t[Symbol.toPrimitive];
@@ -63,13 +31,13 @@ function toPrimitive(t, r) {
63
31
  return ("string" === r ? String : Number)(t);
64
32
  }
65
33
  //#endregion
66
- //#region \0@oxc-project+runtime@0.151.0/helpers/esm/toPropertyKey.js
34
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
67
35
  function toPropertyKey(t) {
68
36
  var i = toPrimitive(t, "string");
69
37
  return "symbol" == _typeof(i) ? i : i + "";
70
38
  }
71
39
  //#endregion
72
- //#region \0@oxc-project+runtime@0.151.0/helpers/esm/defineProperty.js
40
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
73
41
  function _defineProperty(e, r, t) {
74
42
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
75
43
  value: t,
@@ -79,279 +47,6 @@ function _defineProperty(e, r, t) {
79
47
  }) : e[r] = t, e;
80
48
  }
81
49
  //#endregion
82
- //#region ../../rolldown/packages/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, (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 {(id: string) => void} fn
280
- */
281
- registerFactory(id, fn) {
282
- this.factories.set(id, fn);
283
- }
284
- /**
285
- * @param {string} id
286
- * @param {{ exports: any }} [exportsHolder]
287
- */
288
- registerModule(id, exportsHolder = { exports: {} }) {
289
- const module = new Module(id);
290
- module.exportsHolder = exportsHolder;
291
- this.moduleCache.set(id, module);
292
- }
293
- /**
294
- * @param {string} id
295
- * @returns {string[]}
296
- */
297
- getImporters(id) {
298
- const dynamic = this.dynamicImporters.get(id);
299
- if (!dynamic || dynamic.size === 0) return [...this.importers.get(id) ?? []];
300
- return [.../* @__PURE__ */ new Set([...this.importers.get(id) ?? [], ...dynamic])];
301
- }
302
- /**
303
- * @param {string} id
304
- */
305
- isExecuted(id) {
306
- return this.moduleCache.has(id);
307
- }
308
- /**
309
- * @param {string} id
310
- */
311
- hasFactory(id) {
312
- return this.factories.has(id);
313
- }
314
- /**
315
- * Module-cache delete only — static imports and factories persist. Removal is what
316
- * re-arms a cache-gated factory for `initModule`.
317
- * @param {string} id
318
- */
319
- removeModuleCache(id) {
320
- this.moduleCache.delete(id);
321
- this.hooks?.onModuleCacheRemoval(id);
322
- }
323
- /**
324
- * The one re-execution gate: registered → return the live exports; otherwise run the
325
- * mapped factory (which registers itself first, then runs the body).
326
- * @param {string} id
327
- */
328
- initModule(id) {
329
- if (this.moduleCache.has(id)) return this.loadExports(id);
330
- const factory = this.factories.get(id);
331
- if (!factory) throw new MissingFactoryError(id);
332
- factory(id);
333
- return this.loadExports(id);
334
- }
335
- /**
336
- * @param {string} id
337
- */
338
- loadExports(id) {
339
- const module = this.moduleCache.get(id);
340
- if (module) return module.exportsHolder.exports;
341
- else {
342
- console.warn(`Module ${id} not found`);
343
- return {};
344
- }
345
- }
346
- /**
347
- * @param {string} moduleId
348
- */
349
- createModuleHotContext(moduleId) {
350
- if (this.hooks) return this.hooks.createModuleHotContext(moduleId);
351
- throw new Error("createModuleHotContext requires installed hooks or an override");
352
- }
353
- };
354
- //#endregion
355
50
  //#region ../../vite/packages/vite/src/shared/hmr.ts
356
51
  var HMRContext = class {
357
52
  constructor(hmrClient, ownerPath) {
@@ -378,8 +73,8 @@ var HMRContext = class {
378
73
  else if (Array.isArray(deps)) this.acceptDeps(deps, callback);
379
74
  else throw new Error(`invalid hot.accept() usage.`);
380
75
  }
381
- acceptExports(_, callback) {
382
- this.acceptDeps([this.ownerPath], ([mod]) => callback?.(mod));
76
+ acceptExports(exportNames, callback) {
77
+ this.acceptDeps([this.ownerPath], ([mod]) => callback?.(mod), typeof exportNames === "string" ? [exportNames] : exportNames);
383
78
  }
384
79
  dispose(cb) {
385
80
  this.hmrClient.disposeMap.set(this.ownerPath, cb);
@@ -432,14 +127,15 @@ var HMRContext = class {
432
127
  data
433
128
  });
434
129
  }
435
- acceptDeps(deps, callback = () => {}) {
130
+ acceptDeps(deps, callback = () => {}, exports) {
436
131
  const mod = this.hmrClient.hotModulesMap.get(this.ownerPath) || {
437
132
  id: this.ownerPath,
438
133
  callbacks: []
439
134
  };
440
135
  mod.callbacks.push({
441
136
  deps,
442
- fn: callback
137
+ fn: callback,
138
+ exports
443
139
  });
444
140
  this.hmrClient.hotModulesMap.set(this.ownerPath, mod);
445
141
  }
@@ -552,10 +248,28 @@ var BundledDevHMRClient = class extends HMRClient {
552
248
  _defineProperty(this, "reloadPending", false);
553
249
  }
554
250
  isSelfAccepted(id) {
555
- return this.hotModulesMap.get(id)?.callbacks.some((c) => c.deps.includes(id)) ?? false;
251
+ return this.acceptsDep(id, id);
556
252
  }
557
253
  acceptsDep(parent, id) {
558
- return this.hotModulesMap.get(parent)?.callbacks.some((c) => c.deps.includes(id)) ?? false;
254
+ return this.hotModulesMap.get(parent)?.callbacks.some((c) => !c.exports && c.deps.includes(id)) ?? false;
255
+ }
256
+ getAcceptedExports(id) {
257
+ let accepted;
258
+ for (const c of this.hotModulesMap.get(id)?.callbacks ?? []) {
259
+ if (!c.exports) continue;
260
+ accepted ?? (accepted = /* @__PURE__ */ new Set());
261
+ for (const name of c.exports) accepted.add(name);
262
+ }
263
+ return accepted;
264
+ }
265
+ acceptsAllExports(id, accepted) {
266
+ const exports = this.runtime.loadExports(id);
267
+ if (typeof exports !== "object" || exports == null) return false;
268
+ return Object.keys(exports).every((name) => accepted.has(name));
269
+ }
270
+ importsOnlyAccepted(parent, id, accepted) {
271
+ if (!this.options.partialAccept) return false;
272
+ return this.runtime.getImportedBindings(parent, id)?.every((name) => accepted.has(name)) ?? false;
559
273
  }
560
274
  computeHmrUpdate(changedIds, opts) {
561
275
  const boundaries = [];
@@ -580,16 +294,18 @@ var BundledDevHMRClient = class extends HMRClient {
580
294
  type: "full-reload",
581
295
  reason: `update propagated back to ${firstInvalidatedBy}, which already called \`import.meta.hot.invalidate()\``
582
296
  };
583
- if (this.isSelfAccepted(id)) {
297
+ const acceptedExports = this.getAcceptedExports(id);
298
+ const selfAccepted = this.isSelfAccepted(id) || acceptedExports !== void 0 && this.acceptsAllExports(id, acceptedExports);
299
+ if (selfAccepted || acceptedExports) {
584
300
  boundaries.push({
585
301
  boundary: id,
586
302
  acceptedVia: id,
587
303
  isWithinCircularImport: this.isNodeWithinCircularImports(id, stack)
588
304
  });
589
- return;
305
+ if (selfAccepted) return;
590
306
  }
591
307
  const parents = this.runtime.getImporters(id).filter((p) => this.runtime.isExecuted(p));
592
- if (!parents.length) return {
308
+ if (!acceptedExports && !parents.length) return {
593
309
  type: "full-reload",
594
310
  reason: `no hmr boundary found for module \`${id}\``
595
311
  };
@@ -603,6 +319,7 @@ var BundledDevHMRClient = class extends HMRClient {
603
319
  });
604
320
  continue;
605
321
  }
322
+ if (acceptedExports && this.importsOnlyAccepted(parent, id, acceptedExports)) continue;
606
323
  if (!stack.includes(parent)) {
607
324
  const fullReload = this.bubble(parent, subChain, updateSet, boundaries, firstInvalidatedBy, traversedModules);
608
325
  if (fullReload) return fullReload;
@@ -1022,6 +739,64 @@ const createWebSocketModuleRunnerTransport = (options) => {
1022
739
  };
1023
740
  };
1024
741
  //#endregion
742
+ //#region ../../vite/packages/vite/src/shared/pretty-format.ts
743
+ const DEFAULT_OPTIONS = {
744
+ maxDepth: 3,
745
+ maxWidth: 100
746
+ };
747
+ const objectToString = Object.prototype.toString;
748
+ const errorToString = Error.prototype.toString;
749
+ const identifierRE = /^[a-z_$][\w$]*$/i;
750
+ function prettyFormat(value, options = {}) {
751
+ return printer(value, {
752
+ ...DEFAULT_OPTIONS,
753
+ ...options
754
+ }, 0, []);
755
+ }
756
+ function printer(value, config, depth, refs) {
757
+ return printBasicValue(value) ?? printComplexValue(value, config, depth, refs);
758
+ }
759
+ function printBasicValue(value) {
760
+ if (value == null) return String(value);
761
+ if (typeof value === "string") return JSON.stringify(value);
762
+ if (typeof value === "number") return Object.is(value, -0) ? "-0" : String(value);
763
+ if (typeof value === "bigint") return `${value}n`;
764
+ if (typeof value === "boolean" || typeof value === "symbol") return String(value);
765
+ if (typeof value === "function") return value.name ? `[Function: ${value.name}]` : "[Function]";
766
+ const type = objectToString.call(value);
767
+ if (type === "[object Date]") return Number.isNaN(+value) ? "Date { NaN }" : value.toISOString();
768
+ if (type === "[object Error]" || value instanceof Error) return `[${errorToString.call(value)}]`;
769
+ }
770
+ function printComplexValue(value, config, depth, refs) {
771
+ if (refs.includes(value)) return "[Circular]";
772
+ refs = [...refs, value];
773
+ const hitMaxDepth = ++depth > config.maxDepth;
774
+ if (Array.isArray(value)) return hitMaxDepth ? "[Array]" : `[${printListItems(value, config, depth, refs)}]`;
775
+ return hitMaxDepth ? "[Object]" : `{${printObjectProperties(value, config, depth, refs)}}`;
776
+ }
777
+ function printListItems(value, config, depth, refs) {
778
+ const width = Math.min(value.length, config.maxWidth);
779
+ const result = [];
780
+ for (let i = 0; i < width; i++) result.push(i in value ? printer(value[i], config, depth, refs) : "");
781
+ if (width < value.length) result.push(`…(${value.length - width})`);
782
+ return withSpacing(result);
783
+ }
784
+ function printObjectProperties(value, config, depth, refs) {
785
+ const keys = Object.keys(value);
786
+ const width = Math.min(keys.length, config.maxWidth);
787
+ const result = [];
788
+ for (let i = 0; i < width; i++) {
789
+ const key = keys[i];
790
+ const name = key !== "__proto__" && identifierRE.test(key) ? key : JSON.stringify(key);
791
+ result.push(`${name}: ${printer(value[key], config, depth, refs)}`);
792
+ }
793
+ if (width < keys.length) result.push(`…(${keys.length - width})`);
794
+ return withSpacing(result);
795
+ }
796
+ function withSpacing(values) {
797
+ return values.length === 0 ? "" : ` ${values.join(", ")} `;
798
+ }
799
+ //#endregion
1025
800
  //#region ../../vite/packages/vite/src/shared/forwardConsole.ts
1026
801
  function setupForwardConsoleHandler(transport, options, console = globalThis.console) {
1027
802
  if (!options.enabled) return;
@@ -1048,7 +823,7 @@ function setupForwardConsoleHandler(transport, options, console = globalThis.con
1048
823
  type: "log",
1049
824
  data: {
1050
825
  level,
1051
- message: formatConsoleArgs(args)
826
+ message: truncateConsoleMessage(formatConsoleArgs(args))
1052
827
  }
1053
828
  }
1054
829
  });
@@ -1125,30 +900,23 @@ function formatConsoleArgs(args) {
1125
900
  }
1126
901
  function stringifyConsoleArg(value) {
1127
902
  if (typeof value === "string") return value;
1128
- if (typeof value === "number" || typeof value === "boolean" || typeof value === "undefined") return String(value);
1129
- if (typeof value === "symbol") return value.toString();
1130
- if (typeof value === "function") return value.name ? `[Function: ${value.name}]` : "[Function]";
1131
903
  if (value instanceof Error) return value.stack || `${value.name}: ${value.message}`;
1132
- if (typeof value === "bigint") return `${value}n`;
1133
- const seen = /* @__PURE__ */ new WeakSet();
1134
904
  try {
1135
- return JSON.stringify(value, (_, nested) => {
1136
- if (typeof nested === "bigint") return `${nested}n`;
1137
- if (nested instanceof Error) return {
1138
- name: nested.name,
1139
- message: nested.message,
1140
- stack: nested.stack
1141
- };
1142
- if (nested && typeof nested === "object") {
1143
- if (seen.has(nested)) return "[Circular]";
1144
- seen.add(nested);
1145
- }
1146
- return nested;
1147
- }) ?? String(value);
905
+ return prettyFormat(value);
1148
906
  } catch {
1149
907
  return String(value);
1150
908
  }
1151
909
  }
910
+ const MAX_CONSOLE_MESSAGE_LENGTH = 1e4;
911
+ function truncateConsoleMessage(message) {
912
+ if (message.length <= MAX_CONSOLE_MESSAGE_LENGTH) return message;
913
+ let end = 9999;
914
+ if (isHighSurrogate(message[end - 1])) end--;
915
+ return `${message.slice(0, end)}…`;
916
+ }
917
+ function isHighSurrogate(value) {
918
+ return value >= "\ud800" && value <= "\udbff";
919
+ }
1152
920
  //#endregion
1153
921
  //#region ../../vite/packages/vite/src/shared/hmrHandler.ts
1154
922
  function createHMRHandler(handler) {
@@ -1791,7 +1559,7 @@ function updateStyle(id, content) {
1791
1559
  }, 0);
1792
1560
  } else lastInsertedStyle.insertAdjacentElement("afterend", style);
1793
1561
  lastInsertedStyle = style;
1794
- } else style.textContent = content;
1562
+ } else if (style.textContent !== content) style.textContent = content;
1795
1563
  sheetsMap.set(id, style);
1796
1564
  }
1797
1565
  function removeStyle(id) {
@@ -1830,12 +1598,7 @@ if (typeof DevRuntime !== "undefined") {
1830
1598
  });
1831
1599
  }
1832
1600
  createModuleHotContext(moduleId) {
1833
- const ctx = new BundledDevHMRContext(bundledDevHmrClient, moduleId);
1834
- ctx._internal = {
1835
- updateStyle,
1836
- removeStyle
1837
- };
1838
- return ctx;
1601
+ return new BundledDevHMRContext(bundledDevHmrClient, moduleId);
1839
1602
  }
1840
1603
  }
1841
1604
  const clientId = nanoid();
@@ -1850,6 +1613,7 @@ if (typeof DevRuntime !== "undefined") {
1850
1613
  debug: (...msg) => console.debug("[vite]", ...msg)
1851
1614
  }, transport, runtime, {
1852
1615
  base,
1616
+ partialAccept: __HMR_PARTIAL_ACCEPT__,
1853
1617
  beforeApply: clearOverlayOrReloadOnFirstUpdate
1854
1618
  });
1855
1619
  registerBundledDevClient(bundledDevHmrClient);