@depup/vite 8.0.8-depup.0 → 8.2.0-depup.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.
@@ -1,3 +1,2 @@
1
- import { F as defaultAllowedOrigins, N as VERSION, _ as DEFAULT_SERVER_CONDITIONS, d as DEFAULT_CLIENT_MAIN_FIELDS, h as DEFAULT_EXTERNAL_CONDITIONS, n as createLogger, u as DEFAULT_CLIENT_CONDITIONS, v as DEFAULT_SERVER_MAIN_FIELDS } from "./chunks/logger.js";
2
- import { At as searchForWorkspaceRoot, Bt as transformWithEsbuild, Ct as DevEnvironment, Dt as fetchModule, E as BuildEnvironment, Et as isFileServingAllowed, Ft as createServerModuleRunnerTransport, Gt as mergeConfig, Ht as createFilter, It as buildErrorMessage, Jt as rollupVersion, Kt as normalizePath, Lt as loadEnv, M as createBuilder, Mt as perEnvironmentState, Nt as ssrTransform, O as build, Ot as formatPostcssSourceMap, Pt as createServerModuleRunner, Rt as resolveEnvPrefix, S as preview, T as isRunnableDevEnvironment, Tt as isFileLoadingAllowed, Ut as isCSSRequest, Vt as perEnvironmentPlugin, Wt as mergeAlias, Yt as withFilter, _ as resolveConfig, _t as createServer, a as minifySync, b as sortUserPlugins, c as parseAstAsync, ct as optimizeDeps, d as isFetchableDevEnvironment, f as defineConfig, h as loadConfigFromFile, ht as createServerHotChannel, i as minify, jt as createIdResolver, kt as preprocessCSS, l as parseSync, n as esbuildVersion, o as parse, qt as rolldownVersion, r as esmExternalRequirePlugin, s as parseAst, t as Visitor, u as createFetchableDevEnvironment, w as createRunnableDevEnvironment, wt as send, x as runnerImport, zt as transformWithOxc } from "./chunks/node.js";
1
+ import { $ as mergeConfig, A as createServer, B as ssrTransform, C as fetchModule, D as optimizeDeps, E as createBuilder, F as createIdResolver, G as resolveEnvPrefix, H as createServerModuleRunnerTransport, I as perEnvironmentState, J as createLogger, K as transformWithOxc, L as isFileLoadingAllowed, M as formatPostcssSourceMap, N as preprocessCSS, P as searchForWorkspaceRoot, Q as mergeAlias, R as isFileServingAllowed, S as DevEnvironment, T as build, U as buildErrorMessage, V as createServerModuleRunner, W as loadEnv, X as createFilter, Y as perEnvironmentPlugin, Z as isCSSRequest, _ as runnerImport, a as minifySync, at as DEFAULT_CLIENT_MAIN_FIELDS, b as createRunnableDevEnvironment, c as parseAstAsync, ct as DEFAULT_SERVER_MAIN_FIELDS, d as isFetchableDevEnvironment, et as normalizePath, g as sortUserPlugins, h as resolveConfig, i as minify, it as DEFAULT_CLIENT_CONDITIONS, k as createServerHotChannel, l as parseSync, lt as VERSION, m as loadConfigFromFile, n as esbuildVersion, nt as rollupVersion, o as parse, ot as DEFAULT_EXTERNAL_CONDITIONS, p as defineConfig, q as transformWithEsbuild, r as esmExternalRequirePlugin, rt as withFilter, s as parseAst, st as DEFAULT_SERVER_CONDITIONS, t as Visitor, tt as rolldownVersion, u as createFetchableDevEnvironment, ut as defaultAllowedOrigins, v as preview, w as BuildEnvironment, x as isRunnableDevEnvironment, z as send } from "./chunks/node.js";
3
2
  export { BuildEnvironment, DevEnvironment, Visitor, build, buildErrorMessage, createBuilder, createFetchableDevEnvironment, createFilter, createIdResolver, createLogger, createRunnableDevEnvironment, createServer, createServerHotChannel, createServerModuleRunner, createServerModuleRunnerTransport, defaultAllowedOrigins, DEFAULT_CLIENT_CONDITIONS as defaultClientConditions, DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields, DEFAULT_EXTERNAL_CONDITIONS as defaultExternalConditions, DEFAULT_SERVER_CONDITIONS as defaultServerConditions, DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields, defineConfig, esbuildVersion, esmExternalRequirePlugin, fetchModule, formatPostcssSourceMap, isCSSRequest, isFetchableDevEnvironment, isFileLoadingAllowed, isFileServingAllowed, isRunnableDevEnvironment, loadConfigFromFile, loadEnv, mergeAlias, mergeConfig, minify, minifySync, ssrTransform as moduleRunnerTransform, normalizePath, optimizeDeps, parse, parseAst, parseAstAsync, parseSync, perEnvironmentPlugin, perEnvironmentState, preprocessCSS, preview, resolveConfig, resolveEnvPrefix, rolldownVersion, rollupVersion, runnerImport, searchForWorkspaceRoot, send, sortUserPlugins, transformWithEsbuild, transformWithOxc, VERSION as version, withFilter };
@@ -2,7 +2,6 @@ import { a as ExternalFetchResult, c as ViteFetchResult, i as createWebSocketMod
2
2
  import { ModuleNamespace, ViteHotContext } from "#types/hot";
3
3
  import { HotPayload, Update } from "#types/hmrPayload";
4
4
  import { InferCustomEventPayload } from "#types/customEvent";
5
-
6
5
  //#region src/module-runner/sourcemap/decoder.d.ts
7
6
  interface SourceMapLike {
8
7
  version: number;
@@ -63,10 +62,10 @@ declare class HMRClient {
63
62
  private updateQueue;
64
63
  private pendingUpdateQueue;
65
64
  /**
66
- * buffer multiple hot updates triggered by the same src change
67
- * so that they are invoked in the same order they were sent.
68
- * (otherwise the order may be inconsistent because of the http request round trip)
69
- */
65
+ * buffer multiple hot updates triggered by the same src change
66
+ * so that they are invoked in the same order they were sent.
67
+ * (otherwise the order may be inconsistent because of the http request round trip)
68
+ */
70
69
  queueUpdate(payload: Update): Promise<void>;
71
70
  private fetchUpdate;
72
71
  }
@@ -74,14 +73,14 @@ declare class HMRClient {
74
73
  //#region src/shared/ssrTransform.d.ts
75
74
  interface DefineImportMetadata {
76
75
  /**
77
- * Imported names before being transformed to `ssrImportKey`
78
- *
79
- * import foo, { bar as baz, qux } from 'hello'
80
- * => ['default', 'bar', 'qux']
81
- *
82
- * import * as namespace from 'world
83
- * => undefined
84
- */
76
+ * Imported names before being transformed to `ssrImportKey`
77
+ *
78
+ * import foo, { bar as baz, qux } from 'hello'
79
+ * => ['default', 'bar', 'qux']
80
+ *
81
+ * import * as namespace from 'world
82
+ * => undefined
83
+ */
85
84
  importedNames?: string[];
86
85
  }
87
86
  interface SSRImportMetadata extends DefineImportMetadata {
@@ -114,25 +113,24 @@ declare class ModuleRunner {
114
113
  private closed;
115
114
  constructor(options: ModuleRunnerOptions, evaluator?: ModuleEvaluator, debug?: ModuleRunnerDebugger | undefined);
116
115
  /**
117
- * URL to execute. Accepts file path, server path or id relative to the root.
118
- */
116
+ * URL to execute. Accepts file path, server path or id relative to the root.
117
+ */
119
118
  import<T = any>(url: string): Promise<T>;
120
119
  /**
121
- * Clear all caches including HMR listeners.
122
- */
120
+ * Clear all caches including HMR listeners.
121
+ */
123
122
  clearCache(): void;
124
123
  /**
125
- * Clears all caches, removes all HMR listeners, and resets source map support.
126
- * This method doesn't stop the HMR connection.
127
- */
124
+ * Clears all caches, removes all HMR listeners, and resets source map support.
125
+ * This method doesn't stop the HMR connection.
126
+ */
128
127
  close(): Promise<void>;
129
128
  /**
130
- * Returns `true` if the runtime has been closed by calling `close()` method.
131
- */
129
+ * Returns `true` if the runtime has been closed by calling `close()` method.
130
+ */
132
131
  isClosed(): boolean;
133
132
  private processImport;
134
- private isCircularModule;
135
- private isCircularImport;
133
+ private isCircularRequest;
136
134
  private cachedRequest;
137
135
  private cachedModule;
138
136
  private ensureBuiltins;
@@ -176,20 +174,20 @@ interface ModuleRunnerContext {
176
174
  }
177
175
  interface ModuleEvaluator {
178
176
  /**
179
- * Number of prefixed lines in the transformed code.
180
- */
177
+ * Number of prefixed lines in the transformed code.
178
+ */
181
179
  startOffset?: number;
182
180
  /**
183
- * Run code that was transformed by Vite.
184
- * @param context Function context
185
- * @param code Transformed code
186
- * @param module The module node
187
- */
181
+ * Run code that was transformed by Vite.
182
+ * @param context Function context
183
+ * @param code Transformed code
184
+ * @param module The module node
185
+ */
188
186
  runInlinedModule(context: ModuleRunnerContext, code: string, module: Readonly<EvaluatedModuleNode>): Promise<any>;
189
187
  /**
190
- * Run externalized module.
191
- * @param file File URL to the external module
192
- */
188
+ * Run externalized module.
189
+ * @param file File URL to the external module
190
+ */
193
191
  runExternalModule(file: string): Promise<any>;
194
192
  }
195
193
  type ResolvedResult = (ExternalFetchResult | ViteFetchResult) & {
@@ -199,36 +197,36 @@ type ResolvedResult = (ExternalFetchResult | ViteFetchResult) & {
199
197
  type FetchFunction = (id: string, importer?: string, options?: FetchFunctionOptions) => Promise<FetchResult>;
200
198
  interface ModuleRunnerHmr {
201
199
  /**
202
- * Configure HMR logger.
203
- */
200
+ * Configure HMR logger.
201
+ */
204
202
  logger?: false | HMRLogger;
205
203
  }
206
204
  interface ModuleRunnerOptions {
207
205
  /**
208
- * A set of methods to communicate with the server.
209
- */
206
+ * A set of methods to communicate with the server.
207
+ */
210
208
  transport: ModuleRunnerTransport;
211
209
  /**
212
- * Configure how source maps are resolved. Prefers `node` if `process.setSourceMapsEnabled` is available.
213
- * Otherwise it will use `prepareStackTrace` by default which overrides `Error.prepareStackTrace` method.
214
- * You can provide an object to configure how file contents and source maps are resolved for files that were not processed by Vite.
215
- */
210
+ * Configure how source maps are resolved. Prefers `node` if `process.setSourceMapsEnabled` is available.
211
+ * Otherwise it will use `prepareStackTrace` by default which overrides `Error.prepareStackTrace` method.
212
+ * You can provide an object to configure how file contents and source maps are resolved for files that were not processed by Vite.
213
+ */
216
214
  sourcemapInterceptor?: false | "node" | "prepareStackTrace" | InterceptorOptions;
217
215
  /**
218
- * Disable HMR or configure HMR options.
219
- *
220
- * @default true
221
- */
216
+ * Disable HMR or configure HMR options.
217
+ *
218
+ * @default true
219
+ */
222
220
  hmr?: boolean | ModuleRunnerHmr;
223
221
  /**
224
- * Create import.meta object for the module.
225
- *
226
- * @default createDefaultImportMeta
227
- */
222
+ * Create import.meta object for the module.
223
+ *
224
+ * @default createDefaultImportMeta
225
+ */
228
226
  createImportMeta?: (modulePath: string) => ModuleRunnerImportMeta | Promise<ModuleRunnerImportMeta>;
229
227
  /**
230
- * Custom module cache. If not provided, creates a separate module cache for each ModuleRunner instance.
231
- */
228
+ * Custom module cache. If not provided, creates a separate module cache for each ModuleRunner instance.
229
+ */
232
230
  evaluatedModules?: EvaluatedModules;
233
231
  }
234
232
  interface ImportMetaEnv {
@@ -249,7 +247,7 @@ declare class EvaluatedModuleNode {
249
247
  evaluated: boolean;
250
248
  meta: ResolvedResult | undefined;
251
249
  promise: Promise<any> | undefined;
252
- exports: any | undefined;
250
+ exports: any;
253
251
  file: string;
254
252
  map: DecodedMap | undefined;
255
253
  constructor(id: string, url: string);
@@ -259,40 +257,40 @@ declare class EvaluatedModules {
259
257
  readonly fileToModulesMap: Map<string, Set<EvaluatedModuleNode>>;
260
258
  readonly urlToIdModuleMap: Map<string, EvaluatedModuleNode>;
261
259
  /**
262
- * Returns the module node by the resolved module ID. Usually, module ID is
263
- * the file system path with query and/or hash. It can also be a virtual module.
264
- *
265
- * Module runner graph will have 1 to 1 mapping with the server module graph.
266
- * @param id Resolved module ID
267
- */
260
+ * Returns the module node by the resolved module ID. Usually, module ID is
261
+ * the file system path with query and/or hash. It can also be a virtual module.
262
+ *
263
+ * Module runner graph will have 1 to 1 mapping with the server module graph.
264
+ * @param id Resolved module ID
265
+ */
268
266
  getModuleById(id: string): EvaluatedModuleNode | undefined;
269
267
  /**
270
- * Returns all modules related to the file system path. Different modules
271
- * might have different query parameters or hash, so it's possible to have
272
- * multiple modules for the same file.
273
- * @param file The file system path of the module
274
- */
268
+ * Returns all modules related to the file system path. Different modules
269
+ * might have different query parameters or hash, so it's possible to have
270
+ * multiple modules for the same file.
271
+ * @param file The file system path of the module
272
+ */
275
273
  getModulesByFile(file: string): Set<EvaluatedModuleNode> | undefined;
276
274
  /**
277
- * Returns the module node by the URL that was used in the import statement.
278
- * Unlike module graph on the server, the URL is not resolved and is used as is.
279
- * @param url Server URL that was used in the import statement
280
- */
275
+ * Returns the module node by the URL that was used in the import statement.
276
+ * Unlike module graph on the server, the URL is not resolved and is used as is.
277
+ * @param url Server URL that was used in the import statement
278
+ */
281
279
  getModuleByUrl(url: string): EvaluatedModuleNode | undefined;
282
280
  /**
283
- * Ensure that module is in the graph. If the module is already in the graph,
284
- * it will return the existing module node. Otherwise, it will create a new
285
- * module node and add it to the graph.
286
- * @param id Resolved module ID
287
- * @param url URL that was used in the import statement
288
- */
281
+ * Ensure that module is in the graph. If the module is already in the graph,
282
+ * it will return the existing module node. Otherwise, it will create a new
283
+ * module node and add it to the graph.
284
+ * @param id Resolved module ID
285
+ * @param url URL that was used in the import statement
286
+ */
289
287
  ensureModule(id: string, url: string): EvaluatedModuleNode;
290
288
  invalidateModule(node: EvaluatedModuleNode): void;
291
289
  /**
292
- * Extracts the inlined source map from the module code and returns the decoded
293
- * source map. If the source map is not inlined, it will return null.
294
- * @param id Resolved module ID
295
- */
290
+ * Extracts the inlined source map from the module code and returns the decoded
291
+ * source map. If the source map is not inlined, it will return null.
292
+ * @param id Resolved module ID
293
+ */
296
294
  getModuleSourceMapById(id: string): DecodedMap | null;
297
295
  clear(): void;
298
296
  }
@@ -308,8 +306,8 @@ declare class ESModulesEvaluator implements ModuleEvaluator {
308
306
  //#region src/module-runner/createImportMeta.d.ts
309
307
  declare function createDefaultImportMeta(modulePath: string): ModuleRunnerImportMeta;
310
308
  /**
311
- * Create import.meta object for Node.js.
312
- */
309
+ * Create import.meta object for Node.js.
310
+ */
313
311
  declare function createNodeImportMeta(modulePath: string): ModuleRunnerImportMeta;
314
312
  //#endregion
315
313
  export { ESModulesEvaluator, type EvaluatedModuleNode, EvaluatedModules, type FetchFunction, type FetchFunctionOptions, type FetchResult, type HMRLogger, type InterceptorOptions, type ModuleEvaluator, ModuleRunner, type ModuleRunnerContext, type ModuleRunnerHmr, type ModuleRunnerImportMeta, type ModuleRunnerOptions, type ModuleRunnerTransport, type ModuleRunnerTransportHandlers, type ResolvedResult, type SSRImportMetadata, createDefaultImportMeta, createNodeImportMeta, createWebSocketModuleRunnerTransport, normalizeModuleId, ssrDynamicImportKey, ssrExportAllKey, ssrExportNameKey, ssrImportKey, ssrImportMetaKey, ssrModuleExportsKey };
@@ -65,7 +65,7 @@ function normalizeString(path, allowAboveRoot) {
65
65
  else if (char === "/") break;
66
66
  else char = "/";
67
67
  if (char === "/") {
68
- if (!(lastSlash === index - 1 || dots === 1)) if (dots === 2) {
68
+ if (lastSlash !== index - 1 && dots !== 1) if (dots === 2) {
69
69
  if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
70
70
  if (res.length > 2) {
71
71
  let lastSlashIndex = res.lastIndexOf("/");
@@ -88,21 +88,24 @@ const isAbsolute = function(p) {
88
88
  }, dirname = function(p) {
89
89
  let segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
90
90
  return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute(p) ? "/" : ".");
91
- }, textDecoder = new TextDecoder(), decodeBase64 = typeof Buffer == "function" && typeof Buffer.from == "function" ? (base64) => Buffer.from(base64, "base64").toString("utf-8") : (base64) => textDecoder.decode(Uint8Array.from(atob(base64), (c) => c.charCodeAt(0))), percentRegEx = /%/g, backslashRegEx = /\\/g, newlineRegEx = /\n/g, carriageReturnRegEx = /\r/g, tabRegEx = /\t/g, questionRegex = /\?/g, hashRegex = /#/g;
91
+ }, textDecoder = new TextDecoder(), decodeBase64 = (() => {
92
+ let capturedBuffer = typeof Buffer == "function" ? Buffer : void 0;
93
+ return capturedBuffer && typeof capturedBuffer.from == "function" ? (base64) => capturedBuffer.from(base64, "base64").toString("utf-8") : (base64) => textDecoder.decode(Uint8Array.from(atob(base64), (c) => c.charCodeAt(0)));
94
+ })(), percentRegEx = /%/g, backslashRegEx = /\\/g, newlineRegEx = /\n/g, carriageReturnRegEx = /\r/g, tabRegEx = /\t/g, questionRegex = /\?/g, hashRegex = /#/g;
92
95
  function encodePathChars(filepath) {
93
- return filepath.indexOf("%") !== -1 && (filepath = filepath.replace(percentRegEx, "%25")), !isWindows && filepath.indexOf("\\") !== -1 && (filepath = filepath.replace(backslashRegEx, "%5C")), filepath.indexOf("\n") !== -1 && (filepath = filepath.replace(newlineRegEx, "%0A")), filepath.indexOf("\r") !== -1 && (filepath = filepath.replace(carriageReturnRegEx, "%0D")), filepath.indexOf(" ") !== -1 && (filepath = filepath.replace(tabRegEx, "%09")), filepath;
96
+ return filepath.includes("%") && (filepath = filepath.replace(percentRegEx, "%25")), !isWindows && filepath.includes("\\") && (filepath = filepath.replace(backslashRegEx, "%5C")), filepath.includes("\n") && (filepath = filepath.replace(newlineRegEx, "%0A")), filepath.includes("\r") && (filepath = filepath.replace(carriageReturnRegEx, "%0D")), filepath.includes(" ") && (filepath = filepath.replace(tabRegEx, "%09")), filepath;
94
97
  }
95
98
  const posixDirname = dirname, posixResolve = resolve;
96
99
  function posixPathToFileHref(posixPath) {
97
100
  let resolved = posixResolve(posixPath), filePathLast = posixPath.charCodeAt(posixPath.length - 1);
98
- return (filePathLast === 47 || isWindows && filePathLast === 92) && resolved[resolved.length - 1] !== "/" && (resolved += "/"), resolved = encodePathChars(resolved), resolved.indexOf("?") !== -1 && (resolved = resolved.replace(questionRegex, "%3F")), resolved.indexOf("#") !== -1 && (resolved = resolved.replace(hashRegex, "%23")), new URL(`file://${resolved}`).href;
101
+ return (filePathLast === 47 || isWindows && filePathLast === 92) && resolved[resolved.length - 1] !== "/" && (resolved += "/"), resolved = encodePathChars(resolved), resolved.includes("?") && (resolved = resolved.replace(questionRegex, "%3F")), resolved.includes("#") && (resolved = resolved.replace(hashRegex, "%23")), new URL(`file://${resolved}`).href;
99
102
  }
100
103
  function toWindowsPath(path) {
101
104
  return path.replace(/\//g, "\\");
102
105
  }
103
106
  //#endregion
104
107
  //#region ../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
105
- var comma = 44, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = new Uint8Array(64), charToInt = new Uint8Array(128);
108
+ var comma = 44, chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", intToChar = /* @__PURE__ */ new Uint8Array(64), charToInt = /* @__PURE__ */ new Uint8Array(128);
106
109
  for (let i = 0; i < chars.length; i++) {
107
110
  let c = chars.charCodeAt(i);
108
111
  intToChar[i] = c, charToInt[c] = i;
@@ -225,6 +228,7 @@ function traceSegmentInternal(segments, memo, line, column, bias) {
225
228
  //#endregion
226
229
  //#region src/module-runner/sourcemap/decoder.ts
227
230
  var DecodedMap = class {
231
+ map;
228
232
  _encoded;
229
233
  _decoded;
230
234
  _decodedMemo;
@@ -256,6 +260,8 @@ function getOriginalPosition(map, needle) {
256
260
  //#region src/module-runner/evaluatedModules.ts
257
261
  const MODULE_RUNNER_SOURCEMAPPING_REGEXP = RegExp(`//# ${SOURCEMAPPING_URL}=data:application/json;base64,(.+)`);
258
262
  var EvaluatedModuleNode = class {
263
+ id;
264
+ url;
259
265
  importers = /* @__PURE__ */ new Set();
260
266
  imports = /* @__PURE__ */ new Set();
261
267
  evaluated = !1;
@@ -337,7 +343,7 @@ var EvaluatedModuleNode = class {
337
343
  this.idToModuleMap.clear(), this.fileToModulesMap.clear(), this.urlToIdModuleMap.clear();
338
344
  }
339
345
  };
340
- const prefixedBuiltins = new Set([
346
+ const prefixedBuiltins = /* @__PURE__ */ new Set([
341
347
  "node:sea",
342
348
  "node:sqlite",
343
349
  "node:test",
@@ -349,6 +355,8 @@ function normalizeModuleId(file) {
349
355
  //#endregion
350
356
  //#region src/shared/hmr.ts
351
357
  var HMRContext = class {
358
+ hmrClient;
359
+ ownerPath;
352
360
  newListeners;
353
361
  constructor(hmrClient, ownerPath) {
354
362
  this.hmrClient = hmrClient, this.ownerPath = ownerPath, hmrClient.dataMap.has(ownerPath) || hmrClient.dataMap.set(ownerPath, {});
@@ -430,6 +438,9 @@ var HMRContext = class {
430
438
  }), this.hmrClient.hotModulesMap.set(this.ownerPath, mod);
431
439
  }
432
440
  }, HMRClient = class {
441
+ logger;
442
+ transport;
443
+ importUpdatedModule;
433
444
  hotModulesMap = /* @__PURE__ */ new Map();
434
445
  disposeMap = /* @__PURE__ */ new Map();
435
446
  pruneMap = /* @__PURE__ */ new Map();
@@ -453,13 +464,17 @@ var HMRContext = class {
453
464
  this.hotModulesMap.clear(), this.disposeMap.clear(), this.pruneMap.clear(), this.dataMap.clear(), this.customListenersMap.clear(), this.ctxToListenersMap.clear();
454
465
  }
455
466
  async prunePaths(paths) {
456
- await Promise.all(paths.map((path) => {
457
- let disposer = this.disposeMap.get(path);
458
- if (disposer) return disposer(this.dataMap.get(path));
459
- })), await Promise.all(paths.map((path) => {
460
- let fn = this.pruneMap.get(path);
461
- if (fn) return fn(this.dataMap.get(path));
462
- }));
467
+ try {
468
+ await Promise.all(paths.map((path) => {
469
+ let disposer = this.disposeMap.get(path);
470
+ if (disposer) return disposer(this.dataMap.get(path));
471
+ })), await Promise.all(paths.map((path) => {
472
+ let fn = this.pruneMap.get(path);
473
+ if (fn) return fn(this.dataMap.get(path));
474
+ }));
475
+ } finally {
476
+ paths.forEach((path) => this.dataMap.delete(path));
477
+ }
463
478
  }
464
479
  warnFailedUpdate(err, path) {
465
480
  (!(err instanceof Error) || !err.message.includes("fetch")) && this.logger.error(err), this.logger.error(`Failed to reload ${path}. This could be due to syntax errors or importing non-existent modules. (see errors above)`);
@@ -526,10 +541,10 @@ const {${missingBindings.join(", ")}} = pkg;
526
541
  }
527
542
  }
528
543
  //#endregion
529
- //#region ../../node_modules/.pnpm/nanoid@5.1.7/node_modules/nanoid/non-secure/index.js
544
+ //#region ../../node_modules/.pnpm/nanoid@5.1.16/node_modules/nanoid/non-secure/index.js
530
545
  let nanoid = (size = 21) => {
531
546
  let id = "", i = size | 0;
532
- for (; i--;) id += "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[Math.random() * 64 | 0];
547
+ for (; i-- > 0;) id += "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[Math.random() * 64 | 0];
533
548
  return id;
534
549
  };
535
550
  //#endregion
@@ -637,29 +652,35 @@ const createInvokeableTransport = (transport) => {
637
652
  async send(data) {
638
653
  if (invokeableTransport.send) {
639
654
  if (!isConnected) if (connectingPromise) await connectingPromise;
640
- else throw Error("send was called before connect");
655
+ else throw new SendBeforeConnectError("send was called before connect");
641
656
  await invokeableTransport.send(data);
642
657
  }
643
658
  },
644
659
  async invoke(name, data) {
645
660
  if (!isConnected) if (connectingPromise) await connectingPromise;
646
- else throw Error("invoke was called before connect");
661
+ else throw new SendBeforeConnectError("invoke was called before connect");
647
662
  return invokeableTransport.invoke(name, data);
648
663
  }
649
664
  };
650
- }, createWebSocketModuleRunnerTransport = (options) => {
665
+ };
666
+ var SendBeforeConnectError = class extends Error {
667
+ constructor(message) {
668
+ super(message), this.name = "SendBeforeConnectError";
669
+ }
670
+ };
671
+ const createWebSocketModuleRunnerTransport = (options) => {
651
672
  let pingInterval = options.pingInterval ?? 3e4, ws, pingIntervalId;
652
673
  return {
653
674
  async connect({ onMessage, onDisconnection }) {
654
675
  let socket = options.createConnection();
655
- socket.addEventListener("message", async ({ data }) => {
676
+ socket.addEventListener("message", ({ data }) => {
656
677
  onMessage(JSON.parse(data));
657
678
  });
658
679
  let isOpened = socket.readyState === socket.OPEN;
659
680
  isOpened || await new Promise((resolve, reject) => {
660
681
  socket.addEventListener("open", () => {
661
682
  isOpened = !0, resolve();
662
- }, { once: !0 }), socket.addEventListener("close", async () => {
683
+ }, { once: !0 }), socket.addEventListener("close", () => {
663
684
  if (!isOpened) {
664
685
  reject(/* @__PURE__ */ Error("WebSocket closed without opened."));
665
686
  return;
@@ -770,6 +791,7 @@ function createHMRHandlerForRunner(runner) {
770
791
  break;
771
792
  }
772
793
  case "ping": break;
794
+ case "bundled-dev-update": break;
773
795
  default: return payload;
774
796
  }
775
797
  });
@@ -849,11 +871,7 @@ function retrieveSourceMap(source) {
849
871
  let sourceMappingURL = retrieveSourceMapURL(source);
850
872
  if (!sourceMappingURL) return null;
851
873
  let sourceMapData;
852
- if (reSourceMap.test(sourceMappingURL)) {
853
- let rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(",") + 1);
854
- sourceMapData = Buffer.from(rawData, "base64").toString(), sourceMappingURL = source;
855
- } else sourceMappingURL = supportRelativeURL(source, sourceMappingURL), sourceMapData = retrieveFile(sourceMappingURL);
856
- return sourceMapData ? {
874
+ return reSourceMap.test(sourceMappingURL) ? (sourceMapData = decodeBase64(sourceMappingURL.slice(sourceMappingURL.indexOf(",") + 1)), sourceMappingURL = source) : (sourceMappingURL = supportRelativeURL(source, sourceMappingURL), sourceMapData = retrieveFile(sourceMappingURL)), sourceMapData ? {
857
875
  url: sourceMappingURL,
858
876
  map: sourceMapData
859
877
  } : null;
@@ -924,7 +942,7 @@ function CallSiteToString() {
924
942
  return addSuffix && (line += ` (${fileLocation})`), line;
925
943
  }
926
944
  function cloneCallSite(frame) {
927
- let object = {};
945
+ let object = Object.create(null);
928
946
  return Object.getOwnPropertyNames(Object.getPrototypeOf(frame)).forEach((name) => {
929
947
  let key = name;
930
948
  object[key] = /^(?:is|get)/.test(name) ? function() {
@@ -987,9 +1005,9 @@ function enableSourceMapSupport(runner) {
987
1005
  //#endregion
988
1006
  //#region src/module-runner/esmEvaluator.ts
989
1007
  var ESModulesEvaluator = class {
990
- startOffset = getAsyncFunctionDeclarationPaddingLineCount();
1008
+ startOffset = getAsyncFunctionDeclarationPaddingLineCount() + 1;
991
1009
  async runInlinedModule(context, code) {
992
- await new AsyncFunction(ssrModuleExportsKey, ssrImportMetaKey, ssrImportKey, ssrDynamicImportKey, ssrExportAllKey, ssrExportNameKey, "\"use strict\";" + code)(context[ssrModuleExportsKey], context[ssrImportMetaKey], context[ssrImportKey], context[ssrDynamicImportKey], context[ssrExportAllKey], context[ssrExportNameKey]), Object.seal(context[ssrModuleExportsKey]);
1010
+ await new AsyncFunction(ssrModuleExportsKey, ssrImportMetaKey, ssrImportKey, ssrDynamicImportKey, ssrExportAllKey, ssrExportNameKey, "\"use strict\";\n" + code)(context[ssrModuleExportsKey], context[ssrImportMetaKey], context[ssrImportKey], context[ssrDynamicImportKey], context[ssrExportAllKey], context[ssrExportNameKey]), Object.seal(context[ssrModuleExportsKey]);
993
1011
  }
994
1012
  runExternalModule(filepath) {
995
1013
  return import(filepath);
@@ -1043,7 +1061,6 @@ function createImportMetaResolver() {
1043
1061
  function importMetaResolveWithCustomHook(specifier, importer) {
1044
1062
  return import.meta.resolve(`${customizationHookNamespace}${JSON.stringify([specifier, importer])}`);
1045
1063
  }
1046
- `${customizationHookNamespace}`;
1047
1064
  //#endregion
1048
1065
  //#region src/module-runner/createImportMeta.ts
1049
1066
  const envProxy = new Proxy({}, { get(_, p) {
@@ -1080,6 +1097,9 @@ function createNodeImportMeta(modulePath) {
1080
1097
  //#endregion
1081
1098
  //#region src/module-runner/runner.ts
1082
1099
  var ModuleRunner = class {
1100
+ options;
1101
+ evaluator;
1102
+ debug;
1083
1103
  evaluatedModules;
1084
1104
  hmrClient;
1085
1105
  transport;
@@ -1090,8 +1110,8 @@ var ModuleRunner = class {
1090
1110
  closed = !1;
1091
1111
  constructor(options, evaluator = new ESModulesEvaluator(), debug) {
1092
1112
  if (this.options = options, this.evaluator = evaluator, this.debug = debug, this.evaluatedModules = options.evaluatedModules ?? new EvaluatedModules(), this.transport = normalizeModuleRunnerTransport(options.transport), options.hmr !== !1) {
1093
- let optionsHmr = options.hmr ?? !0;
1094
- if (this.hmrClient = new HMRClient(optionsHmr === !0 || optionsHmr.logger === void 0 ? hmrLogger : optionsHmr.logger === !1 ? silentConsole : optionsHmr.logger, this.transport, ({ acceptedPath }) => this.import(acceptedPath)), !this.transport.connect) throw Error("HMR is not supported by this runner transport, but `hmr` option was set to true");
1113
+ let optionsHmr = options.hmr ?? !0, resolvedHmrLogger = optionsHmr === !0 || optionsHmr.logger === void 0 ? hmrLogger : optionsHmr.logger === !1 ? silentConsole : optionsHmr.logger;
1114
+ if (this.hmrClient = new HMRClient(resolvedHmrLogger, this.transport, ({ acceptedPath }) => this.import(acceptedPath)), !this.transport.connect) throw Error("HMR is not supported by this runner transport, but `hmr` option was set to true");
1095
1115
  this.transport.connect(createHMRHandlerForRunner(this));
1096
1116
  } else this.transport.connect?.();
1097
1117
  options.sourcemapInterceptor !== !1 && (this.resetSourceMapSupport = enableSourceMapSupport(this));
@@ -1127,29 +1147,25 @@ var ModuleRunner = class {
1127
1147
  let { url, type } = fetchResult;
1128
1148
  return type !== "module" && type !== "commonjs" || analyzeImportedModDifference(exports, url, type, metadata), exports;
1129
1149
  }
1130
- isCircularModule(mod) {
1131
- for (let importedFile of mod.imports) if (mod.importers.has(importedFile)) return !0;
1132
- return !1;
1133
- }
1134
- isCircularImport(importers, moduleUrl, visited = /* @__PURE__ */ new Set()) {
1135
- for (let importer of importers) {
1136
- if (visited.has(importer)) continue;
1137
- if (visited.add(importer), importer === moduleUrl) return !0;
1138
- let mod = this.evaluatedModules.getModuleById(importer);
1139
- if (mod && mod.importers.size && this.isCircularImport(mod.importers, moduleUrl, visited)) return !0;
1150
+ isCircularRequest(mod, callstack, visited = /* @__PURE__ */ new Set()) {
1151
+ if (visited.has(mod.id)) return !1;
1152
+ visited.add(mod.id);
1153
+ for (let importedModuleId of mod.imports) {
1154
+ if (callstack.includes(importedModuleId)) return !0;
1155
+ let importedModule = this.evaluatedModules.getModuleById(importedModuleId);
1156
+ if (importedModule?.promise && !importedModule.evaluated && this.isCircularRequest(importedModule, callstack, visited)) return !0;
1140
1157
  }
1141
1158
  return !1;
1142
1159
  }
1143
1160
  async cachedRequest(url, mod, callstack = [], metadata) {
1144
- let meta = mod.meta, moduleId = meta.id, { importers } = mod, importee = callstack[callstack.length - 1];
1145
- if (importee && importers.add(importee), mod.evaluated && mod.promise) return this.processImport(await mod.promise, meta, metadata);
1146
- if ((callstack.includes(moduleId) || this.isCircularModule(mod) || this.isCircularImport(importers, moduleId)) && mod.exports) return this.processImport(mod.exports, meta, metadata);
1161
+ let meta = mod.meta, moduleId = meta.id, importee = callstack[callstack.length - 1];
1162
+ if (importee && mod.importers.add(importee), mod.evaluated && mod.promise) return this.processImport(await mod.promise, meta, metadata);
1163
+ if (mod.promise) return mod.exports && (callstack.includes(moduleId) || this.isCircularRequest(mod, callstack)) ? this.processImport(mod.exports, meta, metadata) : this.processImport(await mod.promise, meta, metadata);
1147
1164
  let debugTimer;
1148
1165
  this.debug && (debugTimer = setTimeout(() => {
1149
1166
  this.debug(`[module runner] module ${moduleId} takes over 2s to load.\n${`stack:\n${[...callstack, moduleId].reverse().map((p) => ` - ${p}`).join("\n")}`}`);
1150
1167
  }, 2e3));
1151
1168
  try {
1152
- if (mod.promise) return this.processImport(await mod.promise, meta, metadata);
1153
1169
  let promise = this.directRequest(url, mod, callstack);
1154
1170
  return mod.promise = promise, mod.evaluated = !1, this.processImport(await promise, meta, metadata);
1155
1171
  } finally {