vite 8.3.1 → 8.3.3

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
@@ -674,35 +674,6 @@ Repository: https://github.com/expressjs/cors
674
674
 
675
675
  ---------------------------------------
676
676
 
677
- ## cross-spawn
678
- License: MIT
679
- By: André Cruz
680
- Repository: https://github.com/moxystudio/node-cross-spawn
681
-
682
- > The MIT License (MIT)
683
- >
684
- > Copyright (c) 2018 Made With MOXY Lda <hello@moxy.studio>
685
- >
686
- > Permission is hereby granted, free of charge, to any person obtaining a copy
687
- > of this software and associated documentation files (the "Software"), to deal
688
- > in the Software without restriction, including without limitation the rights
689
- > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
690
- > copies of the Software, and to permit persons to whom the Software is
691
- > furnished to do so, subject to the following conditions:
692
- >
693
- > The above copyright notice and this permission notice shall be included in
694
- > all copies or substantial portions of the Software.
695
- >
696
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
697
- > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
698
- > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
699
- > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
700
- > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
701
- > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
702
- > THE SOFTWARE.
703
-
704
- ---------------------------------------
705
-
706
677
  ## cssesc
707
678
  License: MIT
708
679
  By: Mathias Bynens
@@ -1226,29 +1197,6 @@ Repository: https://github.com/Rich-Harris/is-reference
1226
1197
 
1227
1198
  ---------------------------------------
1228
1199
 
1229
- ## isexe, which
1230
- License: ISC
1231
- By: Isaac Z. Schlueter
1232
- Repositories: https://github.com/isaacs/isexe, https://github.com/isaacs/node-which
1233
-
1234
- > The ISC License
1235
- >
1236
- > Copyright (c) Isaac Z. Schlueter and Contributors
1237
- >
1238
- > Permission to use, copy, modify, and/or distribute this software for any
1239
- > purpose with or without fee is hereby granted, provided that the above
1240
- > copyright notice and this permission notice appear in all copies.
1241
- >
1242
- > THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1243
- > WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1244
- > MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1245
- > ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1246
- > WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1247
- > ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
1248
- > IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1249
-
1250
- ---------------------------------------
1251
-
1252
1200
  ## js-tokens
1253
1201
  License: MIT
1254
1202
  By: Simon Lydell
@@ -1669,23 +1617,6 @@ Repository: https://github.com/pillarjs/parseurl
1669
1617
 
1670
1618
  ---------------------------------------
1671
1619
 
1672
- ## path-key, shebang-regex
1673
- License: MIT
1674
- By: Sindre Sorhus
1675
- Repositories: https://github.com/sindresorhus/path-key, https://github.com/sindresorhus/shebang-regex
1676
-
1677
- > MIT License
1678
- >
1679
- > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
1680
- >
1681
- > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1682
- >
1683
- > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1684
- >
1685
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1686
-
1687
- ---------------------------------------
1688
-
1689
1620
  ## periscopic
1690
1621
  License: MIT
1691
1622
  Repository: https://github.com/Rich-Harris/periscopic
@@ -1996,23 +1927,6 @@ Repositories: https://github.com/lukeed/resolve.exports, https://github.com/luke
1996
1927
 
1997
1928
  ---------------------------------------
1998
1929
 
1999
- ## shebang-command
2000
- License: MIT
2001
- By: Kevin Mårtensson
2002
- Repository: https://github.com/kevva/shebang-command
2003
-
2004
- > MIT License
2005
- >
2006
- > Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com> (github.com/kevva)
2007
- >
2008
- > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2009
- >
2010
- > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
2011
- >
2012
- > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2013
-
2014
- ---------------------------------------
2015
-
2016
1930
  ## shell-quote
2017
1931
  License: MIT
2018
1932
  By: James Halliday
@@ -2118,6 +2032,35 @@ Repository: https://github.com/antfu/strip-literal
2118
2032
 
2119
2033
  ---------------------------------------
2120
2034
 
2035
+ ## tinyexec
2036
+ License: MIT
2037
+ By: James Garbutt
2038
+ Repository: https://github.com/tinylibs/tinyexec
2039
+
2040
+ > MIT License
2041
+ >
2042
+ > Copyright (c) 2024 Tinylibs
2043
+ >
2044
+ > Permission is hereby granted, free of charge, to any person obtaining a copy
2045
+ > of this software and associated documentation files (the "Software"), to deal
2046
+ > in the Software without restriction, including without limitation the rights
2047
+ > to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2048
+ > copies of the Software, and to permit persons to whom the Software is
2049
+ > furnished to do so, subject to the following conditions:
2050
+ >
2051
+ > The above copyright notice and this permission notice shall be included in all
2052
+ > copies or substantial portions of the Software.
2053
+ >
2054
+ > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2055
+ > IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2056
+ > FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2057
+ > AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2058
+ > LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2059
+ > OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2060
+ > SOFTWARE.
2061
+
2062
+ ---------------------------------------
2063
+
2121
2064
  ## to-regex-range
2122
2065
  License: MIT
2123
2066
  By: Jon Schlinkert, Rouven Weßling
@@ -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 ../../node_modules/.pnpm/rolldown@1.2.9/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.150.0/helpers/esm/typeof.js
12
+ //#region \0@oxc-project+runtime@0.151.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.150.0/helpers/esm/toPrimitive.js
22
+ //#region \0@oxc-project+runtime@0.151.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.150.0/helpers/esm/toPropertyKey.js
34
+ //#region \0@oxc-project+runtime@0.151.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.150.0/helpers/esm/defineProperty.js
40
+ //#region \0@oxc-project+runtime@0.151.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,313 +47,6 @@ function _defineProperty(e, r, t) {
79
47
  }) : e[r] = t, e;
80
48
  }
81
49
  //#endregion
82
- //#region ../../node_modules/.pnpm/rolldown@1.2.9/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
- /** @type {Map<string, Promise<any>>} */
214
- "lazyRequests",
215
- /* @__PURE__ */ new Map()
216
- );
217
- _defineProperty(
218
- this,
219
- /** @internal */
220
- "__toESM",
221
- __toESM
222
- );
223
- _defineProperty(
224
- this,
225
- /** @internal */
226
- "__toCommonJS",
227
- __toCommonJS
228
- );
229
- _defineProperty(
230
- this,
231
- /** @internal */
232
- "__exportAll",
233
- __exportAll
234
- );
235
- _defineProperty(
236
- this,
237
- /**
238
- * @param {boolean} [isNodeMode]
239
- * @returns {(mod: any) => any}
240
- * @internal
241
- */
242
- "__toDynamicImportESM",
243
- (isNodeMode) => (mod) => __toESM(mod.default, isNodeMode)
244
- );
245
- _defineProperty(
246
- this,
247
- /** @internal */
248
- "__reExport",
249
- __reExport
250
- );
251
- this.clientId = clientId;
252
- }
253
- /**
254
- * @param {ModuleGraphDelta} delta
255
- */
256
- registerGraph(delta) {
257
- for (let i = 0; i < delta.localCount; i++) {
258
- const id = delta.ids[i];
259
- const edges = delta.edges[i].map((j) => delta.ids[j]);
260
- for (const target of this.staticImports.get(id)?.edges ?? []) this.importers.get(target)?.delete(id);
261
- for (const target of edges) {
262
- let importerSet = this.importers.get(target);
263
- if (!importerSet) {
264
- importerSet = /* @__PURE__ */ new Set();
265
- this.importers.set(target, importerSet);
266
- }
267
- importerSet.add(id);
268
- }
269
- this.staticImports.set(id, { edges });
270
- const dynamicEdges = (delta.dynamicEdges?.[i] ?? []).map((j) => delta.ids[j]);
271
- for (const target of this.dynamicImports.get(id)?.edges ?? []) this.dynamicImporters.get(target)?.delete(id);
272
- for (const target of dynamicEdges) {
273
- let importerSet = this.dynamicImporters.get(target);
274
- if (!importerSet) {
275
- importerSet = /* @__PURE__ */ new Set();
276
- this.dynamicImporters.set(target, importerSet);
277
- }
278
- importerSet.add(id);
279
- }
280
- this.dynamicImports.set(id, { edges: dynamicEdges });
281
- }
282
- }
283
- /**
284
- * @param {string} id
285
- * @param {'esm' | 'cjs'} kind
286
- * @param {(id: string) => void} fn
287
- */
288
- registerFactory(id, kind, fn) {
289
- this.factories.set(id, {
290
- kind,
291
- fn
292
- });
293
- }
294
- /**
295
- * @param {string} id
296
- * @param {{ exports: any }} [exportsHolder]
297
- */
298
- registerModule(id, exportsHolder = { exports: {} }) {
299
- const module = new Module(id);
300
- module.exportsHolder = exportsHolder;
301
- this.moduleCache.set(id, module);
302
- }
303
- /**
304
- * @param {string} id
305
- * @returns {string[]}
306
- */
307
- getImporters(id) {
308
- const dynamic = this.dynamicImporters.get(id);
309
- if (!dynamic || dynamic.size === 0) return [...this.importers.get(id) ?? []];
310
- return [.../* @__PURE__ */ new Set([...this.importers.get(id) ?? [], ...dynamic])];
311
- }
312
- /**
313
- * @param {string} id
314
- */
315
- isExecuted(id) {
316
- return this.moduleCache.has(id);
317
- }
318
- /**
319
- * @param {string} id
320
- */
321
- hasFactory(id) {
322
- return this.factories.has(id);
323
- }
324
- /**
325
- * Module-cache delete only — static imports and factories persist. Removal is what
326
- * re-arms a cache-gated factory for `initModule`.
327
- * @param {string} id
328
- */
329
- removeModuleCache(id) {
330
- this.moduleCache.delete(id);
331
- this.lazyRequests.delete(id);
332
- this.hooks?.onModuleCacheRemoval(id);
333
- }
334
- /**
335
- * The one re-execution gate: registered → return the live exports; otherwise run the
336
- * mapped factory (which registers itself first, then runs the body).
337
- * @param {string} id
338
- */
339
- initModule(id) {
340
- if (this.moduleCache.has(id)) return this.loadExports(id);
341
- const factory = this.factories.get(id);
342
- if (!factory) throw new MissingFactoryError(id);
343
- factory.fn(id);
344
- return this.loadExports(id);
345
- }
346
- /**
347
- * @param {string} id
348
- */
349
- loadExports(id) {
350
- const module = this.moduleCache.get(id);
351
- if (module) return module.exportsHolder.exports;
352
- else {
353
- console.warn(`Module ${id} not found`);
354
- return {};
355
- }
356
- }
357
- /**
358
- * The entry point for a lazy `import()`. `id` is the module the boundary stands for; the
359
- * boundary's own id appears only inside `fetchChunk`'s URL.
360
- *
361
- * Nothing is registered under the boundary id, deliberately. A cache entry with no factory
362
- * behind it reads as "executed" to the HMR boundary walk, and `applyUpdate` turns an
363
- * updated-but-factory-less module into a full page reload.
364
- *
365
- * A rejection is memoized like any other outcome, matching `import()` of a module that
366
- * threw. Retrying could not work anyway: a factory registers its module before running its
367
- * body, so re-running `initModule` would return half-initialized exports as success.
368
- *
369
- * @param {string} id
370
- * @param {() => Promise<unknown>} fetchChunk
371
- * @returns {Promise<any>}
372
- */
373
- requestLazy(id, fetchChunk) {
374
- const pending = this.lazyRequests.get(id);
375
- if (pending) return pending;
376
- const promise = this.moduleCache.has(id) || this.factories.has(id) ? Promise.resolve().then(() => this.initModule(id)) : Promise.resolve().then(fetchChunk).then(() => this.initModule(id));
377
- this.lazyRequests.set(id, promise);
378
- return promise;
379
- }
380
- /**
381
- * @param {string} moduleId
382
- */
383
- createModuleHotContext(moduleId) {
384
- if (this.hooks) return this.hooks.createModuleHotContext(moduleId);
385
- throw new Error("createModuleHotContext requires installed hooks or an override");
386
- }
387
- };
388
- //#endregion
389
50
  //#region src/shared/hmr.ts
390
51
  var HMRContext = class {
391
52
  constructor(hmrClient, ownerPath) {
@@ -1056,6 +717,64 @@ const createWebSocketModuleRunnerTransport = (options) => {
1056
717
  };
1057
718
  };
1058
719
  //#endregion
720
+ //#region src/shared/pretty-format.ts
721
+ const DEFAULT_OPTIONS = {
722
+ maxDepth: 3,
723
+ maxWidth: 100
724
+ };
725
+ const objectToString = Object.prototype.toString;
726
+ const errorToString = Error.prototype.toString;
727
+ const identifierRE = /^[a-z_$][\w$]*$/i;
728
+ function prettyFormat(value, options = {}) {
729
+ return printer(value, {
730
+ ...DEFAULT_OPTIONS,
731
+ ...options
732
+ }, 0, []);
733
+ }
734
+ function printer(value, config, depth, refs) {
735
+ return printBasicValue(value) ?? printComplexValue(value, config, depth, refs);
736
+ }
737
+ function printBasicValue(value) {
738
+ if (value == null) return String(value);
739
+ if (typeof value === "string") return JSON.stringify(value);
740
+ if (typeof value === "number") return Object.is(value, -0) ? "-0" : String(value);
741
+ if (typeof value === "bigint") return `${value}n`;
742
+ if (typeof value === "boolean" || typeof value === "symbol") return String(value);
743
+ if (typeof value === "function") return value.name ? `[Function: ${value.name}]` : "[Function]";
744
+ const type = objectToString.call(value);
745
+ if (type === "[object Date]") return Number.isNaN(+value) ? "Date { NaN }" : value.toISOString();
746
+ if (type === "[object Error]" || value instanceof Error) return `[${errorToString.call(value)}]`;
747
+ }
748
+ function printComplexValue(value, config, depth, refs) {
749
+ if (refs.includes(value)) return "[Circular]";
750
+ refs = [...refs, value];
751
+ const hitMaxDepth = ++depth > config.maxDepth;
752
+ if (Array.isArray(value)) return hitMaxDepth ? "[Array]" : `[${printListItems(value, config, depth, refs)}]`;
753
+ return hitMaxDepth ? "[Object]" : `{${printObjectProperties(value, config, depth, refs)}}`;
754
+ }
755
+ function printListItems(value, config, depth, refs) {
756
+ const width = Math.min(value.length, config.maxWidth);
757
+ const result = [];
758
+ for (let i = 0; i < width; i++) result.push(i in value ? printer(value[i], config, depth, refs) : "");
759
+ if (width < value.length) result.push(`…(${value.length - width})`);
760
+ return withSpacing(result);
761
+ }
762
+ function printObjectProperties(value, config, depth, refs) {
763
+ const keys = Object.keys(value);
764
+ const width = Math.min(keys.length, config.maxWidth);
765
+ const result = [];
766
+ for (let i = 0; i < width; i++) {
767
+ const key = keys[i];
768
+ const name = key !== "__proto__" && identifierRE.test(key) ? key : JSON.stringify(key);
769
+ result.push(`${name}: ${printer(value[key], config, depth, refs)}`);
770
+ }
771
+ if (width < keys.length) result.push(`…(${keys.length - width})`);
772
+ return withSpacing(result);
773
+ }
774
+ function withSpacing(values) {
775
+ return values.length === 0 ? "" : ` ${values.join(", ")} `;
776
+ }
777
+ //#endregion
1059
778
  //#region src/shared/forwardConsole.ts
1060
779
  function setupForwardConsoleHandler(transport, options, console = globalThis.console) {
1061
780
  if (!options.enabled) return;
@@ -1082,7 +801,7 @@ function setupForwardConsoleHandler(transport, options, console = globalThis.con
1082
801
  type: "log",
1083
802
  data: {
1084
803
  level,
1085
- message: formatConsoleArgs(args)
804
+ message: truncateConsoleMessage(formatConsoleArgs(args))
1086
805
  }
1087
806
  }
1088
807
  });
@@ -1159,30 +878,23 @@ function formatConsoleArgs(args) {
1159
878
  }
1160
879
  function stringifyConsoleArg(value) {
1161
880
  if (typeof value === "string") return value;
1162
- if (typeof value === "number" || typeof value === "boolean" || typeof value === "undefined") return String(value);
1163
- if (typeof value === "symbol") return value.toString();
1164
- if (typeof value === "function") return value.name ? `[Function: ${value.name}]` : "[Function]";
1165
881
  if (value instanceof Error) return value.stack || `${value.name}: ${value.message}`;
1166
- if (typeof value === "bigint") return `${value}n`;
1167
- const seen = /* @__PURE__ */ new WeakSet();
1168
882
  try {
1169
- return JSON.stringify(value, (_, nested) => {
1170
- if (typeof nested === "bigint") return `${nested}n`;
1171
- if (nested instanceof Error) return {
1172
- name: nested.name,
1173
- message: nested.message,
1174
- stack: nested.stack
1175
- };
1176
- if (nested && typeof nested === "object") {
1177
- if (seen.has(nested)) return "[Circular]";
1178
- seen.add(nested);
1179
- }
1180
- return nested;
1181
- }) ?? String(value);
883
+ return prettyFormat(value);
1182
884
  } catch {
1183
885
  return String(value);
1184
886
  }
1185
887
  }
888
+ const MAX_CONSOLE_MESSAGE_LENGTH = 1e4;
889
+ function truncateConsoleMessage(message) {
890
+ if (message.length <= MAX_CONSOLE_MESSAGE_LENGTH) return message;
891
+ let end = 9999;
892
+ if (isHighSurrogate(message[end - 1])) end--;
893
+ return `${message.slice(0, end)}…`;
894
+ }
895
+ function isHighSurrogate(value) {
896
+ return value >= "\ud800" && value <= "\udbff";
897
+ }
1186
898
  //#endregion
1187
899
  //#region src/shared/hmrHandler.ts
1188
900
  function createHMRHandler(handler) {