vite 8.0.0-beta.2 → 8.0.0-beta.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.
@@ -313,7 +313,7 @@ function sort(line) {
313
313
  function sortComparator$1(a, b) {
314
314
  return a[0] - b[0];
315
315
  }
316
- function encode(decoded) {
316
+ function encode$1(decoded) {
317
317
  const writer = new StringWriter();
318
318
  let sourcesIndex = 0;
319
319
  let sourceLine = 0;
@@ -639,7 +639,7 @@ function traceSegment(map$1, line, column) {
639
639
  const index = traceSegmentInternal(segments, cast$1(map$1)._decodedMemo, line, column, GREATEST_LOWER_BOUND);
640
640
  return index === -1 ? null : segments[index];
641
641
  }
642
- function originalPositionFor(map$1, needle) {
642
+ function originalPositionFor$1(map$1, needle) {
643
643
  let { line, column, bias } = needle;
644
644
  line--;
645
645
  if (line < 0) throw new Error(LINE_GTR_ZERO);
@@ -753,7 +753,7 @@ function toDecodedMap(map$1) {
753
753
  }
754
754
  function toEncodedMap(map$1) {
755
755
  const decoded = toDecodedMap(map$1);
756
- return Object.assign({}, decoded, { mappings: encode(decoded.mappings) });
756
+ return Object.assign({}, decoded, { mappings: encode$1(decoded.mappings) });
757
757
  }
758
758
  function addSegmentInternal(skipable, map$1, genLine, genColumn, source, sourceLine, sourceColumn, name, content) {
759
759
  const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names } = cast2(map$1);
@@ -855,7 +855,7 @@ function traceMappings(tree) {
855
855
  let traced = SOURCELESS_MAPPING;
856
856
  if (segment.length !== 1) {
857
857
  const source2 = rootSources[segment[1]];
858
- traced = originalPositionFor$1(source2, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : "");
858
+ traced = originalPositionFor(source2, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : "");
859
859
  if (traced == null) continue;
860
860
  }
861
861
  const { column, line, name, content, source, ignore } = traced;
@@ -866,12 +866,12 @@ function traceMappings(tree) {
866
866
  }
867
867
  return gen;
868
868
  }
869
- function originalPositionFor$1(source, line, column, name) {
869
+ function originalPositionFor(source, line, column, name) {
870
870
  if (!source.map) return SegmentObject(source.source, line, column, name, source.content, source.ignore);
871
871
  const segment = traceSegment(source.map, line, column);
872
872
  if (segment == null) return null;
873
873
  if (segment.length === 1) return SOURCELESS_MAPPING;
874
- return originalPositionFor$1(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name);
874
+ return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name);
875
875
  }
876
876
  function asArray(value$1) {
877
877
  if (Array.isArray(value$1)) return value$1;
@@ -1442,7 +1442,7 @@ function loadPackageData(pkgPath) {
1442
1442
  let hasSideEffects;
1443
1443
  if (typeof sideEffects === "boolean") hasSideEffects = () => sideEffects;
1444
1444
  else if (Array.isArray(sideEffects)) if (sideEffects.length <= 0) hasSideEffects = () => false;
1445
- else hasSideEffects = createFilter(sideEffects.map((sideEffect) => {
1445
+ else hasSideEffects = createFilter$1(sideEffects.map((sideEffect) => {
1446
1446
  if (sideEffect.includes("/")) return sideEffect;
1447
1447
  return `**/${sideEffect}`;
1448
1448
  }), null, { resolve: pkgDir });
@@ -1488,7 +1488,7 @@ function watchPackageDataPlugin(packageCache) {
1488
1488
  let watchFile = watchFileStub;
1489
1489
  const setPackageData = packageCache.set.bind(packageCache);
1490
1490
  packageCache.set = (id, pkg) => {
1491
- if (!isInNodeModules(pkg.dir) && !watchedDirs.has(pkg.dir)) {
1491
+ if (!isInNodeModules$1(pkg.dir) && !watchedDirs.has(pkg.dir)) {
1492
1492
  watchedDirs.add(pkg.dir);
1493
1493
  watchFile(path.join(pkg.dir, "package.json"));
1494
1494
  }
@@ -1575,9 +1575,9 @@ function traverseBetweenDirs(longerDir, shorterDir, cb) {
1575
1575
 
1576
1576
  //#endregion
1577
1577
  //#region src/node/utils.ts
1578
- var import_picocolors$35 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
1578
+ var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
1579
1579
  init_node();
1580
- const createFilter = createFilter$2;
1580
+ const createFilter$1 = createFilter$2;
1581
1581
  const replaceSlashOrColonRE = /[/:]/g;
1582
1582
  const replaceDotRE = /\./g;
1583
1583
  const replaceNestedIdRE = /\s*>\s*/g;
@@ -1616,7 +1616,7 @@ function isNodeBuiltin(id) {
1616
1616
  if (id.startsWith(NODE_BUILTIN_NAMESPACE)) return true;
1617
1617
  return nodeBuiltins.includes(id);
1618
1618
  }
1619
- function isInNodeModules(id) {
1619
+ function isInNodeModules$1(id) {
1620
1620
  return id.includes("node_modules");
1621
1621
  }
1622
1622
  function moduleListContains(moduleList, id) {
@@ -1719,10 +1719,10 @@ function removeImportQuery(url$4) {
1719
1719
  function removeDirectQuery(url$4) {
1720
1720
  return url$4.replace(directRequestRE$1, "$1").replace(trailingSeparatorRE, "");
1721
1721
  }
1722
- const urlRE = /(\?|&)url(?:&|$)/;
1723
- const rawRE = /(\?|&)raw(?:&|$)/;
1722
+ const urlRE$1 = /(\?|&)url(?:&|$)/;
1723
+ const rawRE$1 = /(\?|&)raw(?:&|$)/;
1724
1724
  function removeUrlQuery(url$4) {
1725
- return url$4.replace(urlRE, "$1").replace(trailingSeparatorRE, "");
1725
+ return url$4.replace(urlRE$1, "$1").replace(trailingSeparatorRE, "");
1726
1726
  }
1727
1727
  function injectQuery(url$4, queryToInject) {
1728
1728
  const { file, postfix } = splitFileAndPostfix(url$4);
@@ -1747,9 +1747,9 @@ async function asyncReplace(input, re, replacer) {
1747
1747
  function timeFrom(start, subtract = 0) {
1748
1748
  const time = performance$1.now() - start - subtract;
1749
1749
  const timeString = (time.toFixed(2) + `ms`).padEnd(5, " ");
1750
- if (time < 10) return import_picocolors$35.default.green(timeString);
1751
- else if (time < 50) return import_picocolors$35.default.yellow(timeString);
1752
- else return import_picocolors$35.default.red(timeString);
1750
+ if (time < 10) return import_picocolors.default.green(timeString);
1751
+ else if (time < 50) return import_picocolors.default.yellow(timeString);
1752
+ else return import_picocolors.default.red(timeString);
1753
1753
  }
1754
1754
  /**
1755
1755
  * pretty url for logging.
@@ -1759,10 +1759,10 @@ function prettifyUrl(url$4, root) {
1759
1759
  const isAbsoluteFile = url$4.startsWith(root);
1760
1760
  if (isAbsoluteFile || url$4.startsWith(FS_PREFIX)) {
1761
1761
  const file = path.posix.relative(root, isAbsoluteFile ? url$4 : fsPathFromId(url$4));
1762
- return import_picocolors$35.default.dim(file);
1763
- } else return import_picocolors$35.default.dim(url$4);
1762
+ return import_picocolors.default.dim(file);
1763
+ } else return import_picocolors.default.dim(url$4);
1764
1764
  }
1765
- function isObject(value$1) {
1765
+ function isObject$1(value$1) {
1766
1766
  return Object.prototype.toString.call(value$1) === "[object Object]";
1767
1767
  }
1768
1768
  function isDefined(value$1) {
@@ -2194,7 +2194,7 @@ function backwardCompatibleWorkerPlugins(plugins) {
2194
2194
  }
2195
2195
  function deepClone(value$1) {
2196
2196
  if (Array.isArray(value$1)) return value$1.map((v) => deepClone(v));
2197
- if (isObject(value$1)) {
2197
+ if (isObject$1(value$1)) {
2198
2198
  const cloned = {};
2199
2199
  for (const key in value$1) cloned[key] = deepClone(value$1[key]);
2200
2200
  return cloned;
@@ -2214,7 +2214,7 @@ function mergeWithDefaultsRecursively(defaults, values) {
2214
2214
  merged[key] = value$1;
2215
2215
  continue;
2216
2216
  }
2217
- if (isObject(existing) && isObject(value$1)) {
2217
+ if (isObject$1(existing) && isObject$1(value$1)) {
2218
2218
  merged[key] = mergeWithDefaultsRecursively(existing, value$1);
2219
2219
  continue;
2220
2220
  }
@@ -2298,7 +2298,7 @@ function mergeConfigRecursively(defaults, overrides, rootPath) {
2298
2298
  merged[key] = [...arraify(existing), ...arraify(value$1)];
2299
2299
  continue;
2300
2300
  }
2301
- if (isObject(existing) && isObject(value$1)) {
2301
+ if (isObject$1(existing) && isObject$1(value$1)) {
2302
2302
  merged[key] = mergeConfigRecursively(existing, value$1, rootPath && !environmentPathRE.test(rootPath) ? `${rootPath}.${key}` : key);
2303
2303
  continue;
2304
2304
  }
@@ -2313,7 +2313,7 @@ function mergeConfig(defaults, overrides, isRoot = true) {
2313
2313
  function mergeAlias(a, b) {
2314
2314
  if (!a) return b;
2315
2315
  if (!b) return a;
2316
- if (isObject(a) && isObject(b)) return {
2316
+ if (isObject$1(a) && isObject$1(b)) return {
2317
2317
  ...a,
2318
2318
  ...b
2319
2319
  };
@@ -2424,7 +2424,7 @@ function getPkgName(name) {
2424
2424
  return name[0] === "@" ? name.split("/")[1] : name;
2425
2425
  }
2426
2426
  const escapeRegexRE$1 = /[-/\\^$*+?.()|[\]{}]/g;
2427
- function escapeRegex(str) {
2427
+ function escapeRegex$1(str) {
2428
2428
  return str.replace(escapeRegexRE$1, "\\$&");
2429
2429
  }
2430
2430
  function getPackageManagerCommand(type = "install") {
@@ -2585,19 +2585,18 @@ function perEnvironmentState(initial) {
2585
2585
 
2586
2586
  //#endregion
2587
2587
  //#region src/node/plugins/reporter.ts
2588
- var import_picocolors$34 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
2589
2588
  const groups = [
2590
2589
  {
2591
2590
  name: "Assets",
2592
- color: import_picocolors$34.default.green
2591
+ color: import_picocolors.default.green
2593
2592
  },
2594
2593
  {
2595
2594
  name: "CSS",
2596
- color: import_picocolors$34.default.magenta
2595
+ color: import_picocolors.default.magenta
2597
2596
  },
2598
2597
  {
2599
2598
  name: "JS",
2600
- color: import_picocolors$34.default.cyan
2599
+ color: import_picocolors.default.cyan
2601
2600
  }
2602
2601
  ];
2603
2602
  const COMPRESSIBLE_ASSETS_RE = /\.(?:html|json|svg|txt|xml|xhtml|wasm)$/;
@@ -2631,7 +2630,7 @@ function buildReporterPlugin(config) {
2631
2630
  let hasTransformed = false;
2632
2631
  let transformedCount = 0;
2633
2632
  const logTransform = throttle((id) => {
2634
- writeLine(`transforming (${transformedCount}) ${import_picocolors$34.default.dim(path.relative(config.root, id))}`);
2633
+ writeLine(`transforming (${transformedCount}) ${import_picocolors.default.dim(path.relative(config.root, id))}`);
2635
2634
  });
2636
2635
  return {
2637
2636
  reset() {
@@ -2649,7 +2648,7 @@ function buildReporterPlugin(config) {
2649
2648
  },
2650
2649
  log() {
2651
2650
  if (tty) clearLine$1();
2652
- environment.logger.info(`${import_picocolors$34.default.green(`✓`)} ${transformedCount} modules transformed.`);
2651
+ environment.logger.info(`${import_picocolors.default.green(`✓`)} ${transformedCount} modules transformed.`);
2653
2652
  }
2654
2653
  };
2655
2654
  }) : void 0;
@@ -2731,19 +2730,19 @@ function buildReporterPlugin(config) {
2731
2730
  for (const entry of filtered.sort((a, z) => a.size - z.size)) {
2732
2731
  const isLarge = group.name === "JS" && entry.size / 1e3 > chunkLimit;
2733
2732
  if (isLarge) hasLargeChunks = true;
2734
- const sizeColor = isLarge ? import_picocolors$34.default.yellow : import_picocolors$34.default.dim;
2735
- let log$1 = import_picocolors$34.default.dim(withTrailingSlash(relativeOutDir));
2736
- log$1 += !config.build.lib && entry.name.startsWith(withTrailingSlash(assetsDir)) ? import_picocolors$34.default.dim(assetsDir) + group.color(entry.name.slice(assetsDir.length).padEnd(longest + 2 - assetsDir.length)) : group.color(entry.name.padEnd(longest + 2));
2737
- log$1 += import_picocolors$34.default.bold(sizeColor(displaySize(entry.size).padStart(sizePad)));
2738
- if (entry.compressedSize) log$1 += import_picocolors$34.default.dim(` │ gzip: ${displaySize(entry.compressedSize).padStart(compressPad)}`);
2739
- if (entry.mapSize) log$1 += import_picocolors$34.default.dim(` │ map: ${displaySize(entry.mapSize).padStart(mapPad)}`);
2733
+ const sizeColor = isLarge ? import_picocolors.default.yellow : import_picocolors.default.dim;
2734
+ let log$1 = import_picocolors.default.dim(withTrailingSlash(relativeOutDir));
2735
+ log$1 += !config.build.lib && entry.name.startsWith(withTrailingSlash(assetsDir)) ? import_picocolors.default.dim(assetsDir) + group.color(entry.name.slice(assetsDir.length).padEnd(longest + 2 - assetsDir.length)) : group.color(entry.name.padEnd(longest + 2));
2736
+ log$1 += import_picocolors.default.bold(sizeColor(displaySize(entry.size).padStart(sizePad)));
2737
+ if (entry.compressedSize) log$1 += import_picocolors.default.dim(` │ gzip: ${displaySize(entry.compressedSize).padStart(compressPad)}`);
2738
+ if (entry.mapSize) log$1 += import_picocolors.default.dim(` │ map: ${displaySize(entry.mapSize).padStart(mapPad)}`);
2740
2739
  config.logger.info(log$1);
2741
2740
  }
2742
2741
  }
2743
2742
  } else hasLargeChunks = Object.values(output).some((chunk) => {
2744
2743
  return chunk.type === "chunk" && chunk.code.length / 1e3 > chunkLimit;
2745
2744
  });
2746
- if (hasLargeChunks && environment.config.build.minify && !config.build.lib && environment.config.consumer === "client") environment.logger.warn(import_picocolors$34.default.yellow(`\n(!) Some chunks are larger than ${chunkLimit} kB after minification. Consider:\n- Using dynamic import() to code-split the application\n- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks\n- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.`));
2745
+ if (hasLargeChunks && environment.config.build.minify && !config.build.lib && environment.config.consumer === "client") environment.logger.warn(import_picocolors.default.yellow(`\n(!) Some chunks are larger than ${chunkLimit} kB after minification. Consider:\n- Using dynamic import() to code-split the application\n- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks\n- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.`));
2747
2746
  }
2748
2747
  };
2749
2748
  });
@@ -2770,7 +2769,7 @@ function buildReporterPlugin(config) {
2770
2769
  const module$1 = this.getModuleInfo(id);
2771
2770
  if (!module$1) continue;
2772
2771
  if (module$1.importers.length && module$1.dynamicImporters.length) {
2773
- if (module$1.dynamicImporters.some((id$1) => !isInNodeModules(id$1) && chunk.moduleIds.includes(id$1))) this.warn(`\n(!) ${module$1.id} is dynamically imported by ${module$1.dynamicImporters.join(", ")} but also statically imported by ${module$1.importers.join(", ")}, dynamic import will not move module into another chunk.\n`);
2772
+ if (module$1.dynamicImporters.some((id$1) => !isInNodeModules$1(id$1) && chunk.moduleIds.includes(id$1))) this.warn(`\n(!) ${module$1.id} is dynamically imported by ${module$1.dynamicImporters.join(", ")} but also statically imported by ${module$1.importers.join(", ")}, dynamic import will not move module into another chunk.\n`);
2774
2773
  }
2775
2774
  }
2776
2775
  chunksReporter(this).register();
@@ -2859,7 +2858,7 @@ async function resolveTSConfigJson(filename, cache$1) {
2859
2858
  * @param {string} dir an absolute directory path
2860
2859
  * @returns {boolean} if dir path includes a node_modules segment
2861
2860
  */
2862
- const isInNodeModules$1 = IS_POSIX ? (dir) => dir.includes("/node_modules/") : (dir) => dir.match(/[/\\]node_modules[/\\]/);
2861
+ const isInNodeModules = IS_POSIX ? (dir) => dir.includes("/node_modules/") : (dir) => dir.match(/[/\\]node_modules[/\\]/);
2863
2862
  /**
2864
2863
  * convert posix separator to native separator
2865
2864
  *
@@ -3037,7 +3036,7 @@ function replaceTokens(result) {
3037
3036
  */
3038
3037
  async function find(filename, options) {
3039
3038
  let dir = path.dirname(path.resolve(filename));
3040
- if (options?.ignoreNodeModules && isInNodeModules$1(dir)) return null;
3039
+ if (options?.ignoreNodeModules && isInNodeModules(dir)) return null;
3041
3040
  const cache$1 = options?.cache;
3042
3041
  const configName = options?.configName ?? "tsconfig.json";
3043
3042
  if (cache$1?.hasConfigPath(dir, configName)) return cache$1.getConfigPath(dir, configName);
@@ -3618,7 +3617,6 @@ var TSConfckCache = class {
3618
3617
 
3619
3618
  //#endregion
3620
3619
  //#region src/node/plugins/esbuild.ts
3621
- var import_picocolors$33 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
3622
3620
  const debug$14 = createDebugger("vite:esbuild");
3623
3621
  const IIFE_BEGIN_RE$1 = /(?:const|var)\s+\S+\s*=\s*\(?function\([^()]*\)\s*\{\s*"use strict";/;
3624
3622
  const validExtensionRE$1 = /\.\w+$/;
@@ -3635,7 +3633,7 @@ let warnedTransformWithEsbuild = false;
3635
3633
  const warnTransformWithEsbuildUsageOnce = () => {
3636
3634
  if (warnedTransformWithEsbuild) return;
3637
3635
  warnedTransformWithEsbuild = true;
3638
- console.warn(import_picocolors$33.default.yellow("`transformWithEsbuild` is deprecated and will be removed in the future. Please migrate to `transformWithOxc`."));
3636
+ console.warn(import_picocolors.default.yellow("`transformWithEsbuild` is deprecated and will be removed in the future. Please migrate to `transformWithOxc`."));
3639
3637
  };
3640
3638
  async function transformWithEsbuild(code, filename, options, inMap, config, watcher, ignoreEsbuildWarning = false) {
3641
3639
  let loader = options?.loader;
@@ -3815,7 +3813,7 @@ function resolveEsbuildTranspileOptions(config, format$1) {
3815
3813
  };
3816
3814
  }
3817
3815
  function prettifyMessage(m, code) {
3818
- let res = import_picocolors$33.default.yellow(m.text);
3816
+ let res = import_picocolors.default.yellow(m.text);
3819
3817
  if (m.location) res += `\n` + generateCodeFrame(code, m.location);
3820
3818
  return res + `\n`;
3821
3819
  }
@@ -4254,11 +4252,11 @@ const ENC_CARET_RE = /%5e/gi;
4254
4252
  const ENC_BACKTICK_RE = /%60/gi;
4255
4253
  const ENC_PIPE_RE = /%7c/gi;
4256
4254
  const ENC_SPACE_RE = /%20/gi;
4257
- function encode$1(text) {
4255
+ function encode(text) {
4258
4256
  return encodeURI("" + text).replace(ENC_PIPE_RE, "|");
4259
4257
  }
4260
4258
  function encodeQueryValue(input) {
4261
- return encode$1(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^").replace(SLASH_RE, "%2F");
4259
+ return encode(typeof input === "string" ? input : JSON.stringify(input)).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CARET_RE, "^").replace(SLASH_RE, "%2F");
4262
4260
  }
4263
4261
  function encodeQueryKey(text) {
4264
4262
  return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
@@ -4646,7 +4644,7 @@ function hasESMSyntax(code, opts = {}) {
4646
4644
  }
4647
4645
 
4648
4646
  //#endregion
4649
- //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.0-beta.54/node_modules/@rolldown/pluginutils/dist/simple-filters.js
4647
+ //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.0-beta.55/node_modules/@rolldown/pluginutils/dist/simple-filters.js
4650
4648
  /**
4651
4649
  * Constructs a RegExp that matches the exact string specified.
4652
4650
  *
@@ -4668,7 +4666,7 @@ function hasESMSyntax(code, opts = {}) {
4668
4666
  * ```
4669
4667
  */
4670
4668
  function exactRegex(str, flags) {
4671
- return new RegExp(`^${escapeRegex$1(str)}$`, flags);
4669
+ return new RegExp(`^${escapeRegex(str)}$`, flags);
4672
4670
  }
4673
4671
  /**
4674
4672
  * Constructs a RegExp that matches a value that has the specified prefix.
@@ -4691,10 +4689,10 @@ function exactRegex(str, flags) {
4691
4689
  * ```
4692
4690
  */
4693
4691
  function prefixRegex(str, flags) {
4694
- return new RegExp(`^${escapeRegex$1(str)}`, flags);
4692
+ return new RegExp(`^${escapeRegex(str)}`, flags);
4695
4693
  }
4696
4694
  const escapeRegexRE = /[-/\\^$*+?.()|[\]{}]/g;
4697
- function escapeRegex$1(str) {
4695
+ function escapeRegex(str) {
4698
4696
  return str.replace(escapeRegexRE, "\\$&");
4699
4697
  }
4700
4698
  function makeIdFiltersToMatchWithQuery(input) {
@@ -4716,8 +4714,8 @@ var ImportType;
4716
4714
  A$1[A$1.Static = 1] = "Static", A$1[A$1.Dynamic = 2] = "Dynamic", A$1[A$1.ImportMeta = 3] = "ImportMeta", A$1[A$1.StaticSourcePhase = 4] = "StaticSourcePhase", A$1[A$1.DynamicSourcePhase = 5] = "DynamicSourcePhase", A$1[A$1.StaticDeferPhase = 6] = "StaticDeferPhase", A$1[A$1.DynamicDeferPhase = 7] = "DynamicDeferPhase";
4717
4715
  })(ImportType || (ImportType = {}));
4718
4716
  const A = 1 === new Uint8Array(new Uint16Array([1]).buffer)[0];
4719
- function parse$1(E$1, g = "@") {
4720
- if (!C) return init.then((() => parse$1(E$1)));
4717
+ function parse$3(E$1, g = "@") {
4718
+ if (!C) return init.then((() => parse$3(E$1)));
4721
4719
  const I = E$1.length + 1, w = (C.__heap_base.value || C.__heap_base) + 4 * I - C.memory.buffer.byteLength;
4722
4720
  w > 0 && C.memory.grow(Math.ceil(w / 65536));
4723
4721
  const K = C.sa(I - 1);
@@ -4784,7 +4782,6 @@ const init = WebAssembly.compile(E()).then(WebAssembly.instantiate).then((({ exp
4784
4782
 
4785
4783
  //#endregion
4786
4784
  //#region src/node/plugins/oxc.ts
4787
- var import_picocolors$32 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
4788
4785
  const IIFE_BEGIN_RE = /(?:(?:const|var)\s+\S+\s*=\s*|^|\n)\(?function\([^()]*\)\s*\{(?:\s*"use strict";)?/;
4789
4786
  const UMD_BEGIN_RE = /\}\)\((?:this,\s*)?function\([^()]*\)\s*\{(?:\s*"use strict";)?/;
4790
4787
  const jsxExtensionsRE = /\.(?:j|t)sx\b/;
@@ -4955,8 +4952,8 @@ function oxcPlugin(config) {
4955
4952
  });
4956
4953
  });
4957
4954
  const { jsxInject, include, exclude, jsxRefreshInclude, jsxRefreshExclude, ...oxcTransformOptions } = config.oxc;
4958
- const filter$1 = createFilter(include || /\.(m?ts|[jt]sx)$/, exclude || /\.js$/);
4959
- const jsxRefreshFilter = jsxRefreshInclude || jsxRefreshExclude ? createFilter(jsxRefreshInclude, jsxRefreshExclude) : void 0;
4955
+ const filter$1 = createFilter$1(include || /\.(m?ts|[jt]sx)$/, exclude || /\.js$/);
4956
+ const jsxRefreshFilter = jsxRefreshInclude || jsxRefreshExclude ? createFilter$1(jsxRefreshInclude, jsxRefreshExclude) : void 0;
4960
4957
  const jsxImportSource = typeof oxcTransformOptions.jsx === "object" && oxcTransformOptions.jsx.importSource || "react";
4961
4958
  const jsxImportRuntime = `${jsxImportSource}/jsx-runtime`;
4962
4959
  const jsxImportDevRuntime = `${jsxImportSource}/jsx-dev-runtime`;
@@ -5137,7 +5134,7 @@ function convertEsbuildConfigToOxcConfig(esbuildConfig, logger) {
5137
5134
  return oxcOptions;
5138
5135
  }
5139
5136
  function warnDeprecatedShouldBeConvertedToPluginOptions(logger, name) {
5140
- logger.warn(import_picocolors$32.default.yellow(`\`esbuild.${name}\` option was specified. But this option is deprecated and will be removed in future versions. This option can be achieved by using a plugin with transform hook, please use that instead.`));
5137
+ logger.warn(import_picocolors.default.yellow(`\`esbuild.${name}\` option was specified. But this option is deprecated and will be removed in future versions. This option can be achieved by using a plugin with transform hook, please use that instead.`));
5141
5138
  }
5142
5139
 
5143
5140
  //#endregion
@@ -5294,7 +5291,7 @@ var SourceMap = class {
5294
5291
  this.sources = properties.sources;
5295
5292
  this.sourcesContent = properties.sourcesContent;
5296
5293
  this.names = properties.names;
5297
- this.mappings = encode(properties.mappings);
5294
+ this.mappings = encode$1(properties.mappings);
5298
5295
  if (typeof properties.x_google_ignoreList !== "undefined") this.x_google_ignoreList = properties.x_google_ignoreList;
5299
5296
  if (typeof properties.debugId !== "undefined") this.debugId = properties.debugId;
5300
5297
  }
@@ -5332,7 +5329,7 @@ function getRelativePath(from, to) {
5332
5329
  return fromParts.concat(toParts).join("/");
5333
5330
  }
5334
5331
  const toString = Object.prototype.toString;
5335
- function isObject$1(thing) {
5332
+ function isObject(thing) {
5336
5333
  return toString.call(thing) === "[object Object]";
5337
5334
  }
5338
5335
  function getLocator(source) {
@@ -5621,7 +5618,7 @@ var MagicString = class MagicString {
5621
5618
  }
5622
5619
  indent(indentStr, options) {
5623
5620
  const pattern = /^[^\r\n]/gm;
5624
- if (isObject$1(indentStr)) {
5621
+ if (isObject(indentStr)) {
5625
5622
  options = indentStr;
5626
5623
  indentStr = void 0;
5627
5624
  }
@@ -6112,7 +6109,7 @@ function resolveCustomResolver(customResolver) {
6112
6109
  if (customResolver) return getHookFunction(customResolver.resolveId);
6113
6110
  return null;
6114
6111
  }
6115
- function alias(options = {}) {
6112
+ function alias$1(options = {}) {
6116
6113
  const entries = getEntries(options);
6117
6114
  if (entries.length === 0) return {
6118
6115
  name: "alias",
@@ -6619,7 +6616,6 @@ function checkPublicFile(url$4, config) {
6619
6616
 
6620
6617
  //#endregion
6621
6618
  //#region src/node/plugins/asset.ts
6622
- var import_picocolors$31 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
6623
6619
  const assetUrlRE = /__VITE_ASSET__([\w$]+)__(?:\$_(.*?)__)?/g;
6624
6620
  const jsSourceMapRE = /\.[cm]?js\.map$/;
6625
6621
  const noInlineRE = /[?&]no-inline\b/;
@@ -6673,27 +6669,27 @@ function assetPlugin(config) {
6673
6669
  },
6674
6670
  resolveId: {
6675
6671
  filter: { id: [
6676
- urlRE,
6672
+ urlRE$1,
6677
6673
  DEFAULT_ASSETS_RE,
6678
6674
  ...makeIdFiltersToMatchWithQuery(config.rawAssetsInclude).map((v) => typeof v === "string" ? picomatch.makeRe(v, { dot: true }) : v)
6679
6675
  ] },
6680
6676
  handler(id) {
6681
- if (!config.assetsInclude(cleanUrl(id)) && !urlRE.test(id)) return;
6677
+ if (!config.assetsInclude(cleanUrl(id)) && !urlRE$1.test(id)) return;
6682
6678
  if (checkPublicFile(id, config)) return id;
6683
6679
  }
6684
6680
  },
6685
6681
  load: {
6686
6682
  filter: { id: {
6687
6683
  include: [
6688
- rawRE,
6689
- urlRE,
6684
+ rawRE$1,
6685
+ urlRE$1,
6690
6686
  DEFAULT_ASSETS_RE,
6691
6687
  ...makeIdFiltersToMatchWithQuery(config.rawAssetsInclude)
6692
6688
  ],
6693
6689
  exclude: /^\0/
6694
6690
  } },
6695
6691
  async handler(id) {
6696
- if (rawRE.test(id)) {
6692
+ if (rawRE$1.test(id)) {
6697
6693
  const file = checkPublicFile(id, config) || cleanUrl(id);
6698
6694
  this.addWatchFile(file);
6699
6695
  return {
@@ -6701,9 +6697,9 @@ function assetPlugin(config) {
6701
6697
  moduleType: "js"
6702
6698
  };
6703
6699
  }
6704
- if (!urlRE.test(id) && !config.assetsInclude(cleanUrl(id))) return;
6700
+ if (!urlRE$1.test(id) && !config.assetsInclude(cleanUrl(id))) return;
6705
6701
  id = removeUrlQuery(id);
6706
- let url$4 = await fileToUrl(this, id);
6702
+ let url$4 = await fileToUrl$1(this, id);
6707
6703
  if (!url$4.startsWith("data:") && this.environment.mode === "dev") {
6708
6704
  const mod = this.environment.moduleGraph.getModuleById(id);
6709
6705
  if (mod && mod.lastHMRTimestamp > 0) url$4 = injectQuery(url$4, `t=${mod.lastHMRTimestamp}`);
@@ -6751,7 +6747,7 @@ function assetPlugin(config) {
6751
6747
  }
6752
6748
  };
6753
6749
  }
6754
- async function fileToUrl(pluginContext, id) {
6750
+ async function fileToUrl$1(pluginContext, id) {
6755
6751
  const { environment } = pluginContext;
6756
6752
  if (!environment.config.isBundled) return fileToDevUrl(environment, id);
6757
6753
  else return fileToBuiltUrl(pluginContext, id);
@@ -6825,7 +6821,7 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
6825
6821
  source: content
6826
6822
  });
6827
6823
  if (environment.config.command === "build" && noInlineRE.test(postfix)) postfix = postfix.replace(noInlineRE, "").replace(/^&/, "?");
6828
- if (environment.config.experimental.bundledDev) {
6824
+ if (environment.config.command === "serve" && environment.config.experimental.bundledDev) {
6829
6825
  const outputUrl = toOutputFilePathInJS(environment, pluginContext.getFileName(referenceId), "asset", "assets/dummy.js", "js", () => {
6830
6826
  throw new Error("unreachable");
6831
6827
  });
@@ -6861,7 +6857,7 @@ function shouldInline(environment, file, id, content, buildPluginContext, forceI
6861
6857
  return content.length < limit && !isGitLfsPlaceholder(content);
6862
6858
  }
6863
6859
  function assetToDataURL(environment, file, content) {
6864
- if (environment.config.build.lib && isGitLfsPlaceholder(content)) environment.logger.warn(import_picocolors$31.default.yellow(`Inlined file ${file} was not downloaded via Git LFS`));
6860
+ if (environment.config.build.lib && isGitLfsPlaceholder(content)) environment.logger.warn(import_picocolors.default.yellow(`Inlined file ${file} was not downloaded via Git LFS`));
6865
6861
  if (file.endsWith(".svg")) return svgToDataURL(content);
6866
6862
  else return `data:${lookup(file) ?? "application/octet-stream"};base64,${content.toString("base64")}`;
6867
6863
  }
@@ -6961,7 +6957,6 @@ function extractJsonErrorPosition(errorMessage, inputLength) {
6961
6957
 
6962
6958
  //#endregion
6963
6959
  //#region src/node/plugins/optimizedDeps.ts
6964
- var import_picocolors$30 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
6965
6960
  const debug$13 = createDebugger("vite:optimize-deps");
6966
6961
  function optimizedDepsPlugin() {
6967
6962
  return {
@@ -6993,7 +6988,7 @@ function optimizedDepsPlugin() {
6993
6988
  if (info.browserHash !== currentInfo?.browserHash) throwOutdatedRequest(id);
6994
6989
  }
6995
6990
  }
6996
- debug$13?.(`load ${import_picocolors$30.default.cyan(file)}`);
6991
+ debug$13?.(`load ${import_picocolors.default.cyan(file)}`);
6997
6992
  try {
6998
6993
  return await fsp.readFile(file, "utf-8");
6999
6994
  } catch {
@@ -7464,7 +7459,6 @@ function resolveEnvPrefix({ envPrefix = "VITE_" }) {
7464
7459
 
7465
7460
  //#endregion
7466
7461
  //#region src/node/deprecations.ts
7467
- var import_picocolors$29 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
7468
7462
  const docsURL = "https://vite.dev";
7469
7463
  const deprecationCode = {
7470
7464
  removePluginHookSsrArgument: "changes/this-environment-in-hooks",
@@ -7499,16 +7493,16 @@ function warnFutureDeprecation(config, type, extraMessage, stacktrace = true) {
7499
7493
  if (_ignoreDeprecationWarnings || !config.future || config.future[type] !== "warn") return;
7500
7494
  let msg = `[vite future] ${deprecationMessages[type]}`;
7501
7495
  if (extraMessage) msg += ` ${extraMessage}`;
7502
- msg = import_picocolors$29.default.yellow(msg);
7496
+ msg = import_picocolors.default.yellow(msg);
7503
7497
  const docs = `${docsURL}/changes/${deprecationCode[type].toLowerCase()}`;
7504
- msg += import_picocolors$29.default.gray(`\n ${stacktrace ? "├" : "└"}─── `) + import_picocolors$29.default.underline(docs) + "\n";
7498
+ msg += import_picocolors.default.gray(`\n ${stacktrace ? "├" : "└"}─── `) + import_picocolors.default.underline(docs) + "\n";
7505
7499
  if (stacktrace) {
7506
7500
  const stack = (/* @__PURE__ */ new Error()).stack;
7507
7501
  if (stack) {
7508
7502
  let stacks = stack.split("\n").slice(3).filter((i) => !i.includes("/node_modules/vite/dist/"));
7509
7503
  if (stacks.length === 0) stacks.push("No stack trace found.");
7510
7504
  stacks = stacks.map((i, idx) => ` ${idx === stacks.length - 1 ? "└" : "│"} ${i.trim()}`);
7511
- msg += import_picocolors$29.default.dim(stacks.join("\n")) + "\n";
7505
+ msg += import_picocolors.default.dim(stacks.join("\n")) + "\n";
7512
7506
  }
7513
7507
  }
7514
7508
  config.logger.warnOnce(msg);
@@ -7523,7 +7517,6 @@ function ignoreDeprecationWarnings(fn) {
7523
7517
 
7524
7518
  //#endregion
7525
7519
  //#region src/node/server/middlewares/error.ts
7526
- var import_picocolors$28 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
7527
7520
  function prepareError(err$2) {
7528
7521
  return {
7529
7522
  message: stripVTControlCharacters(err$2.message),
@@ -7536,10 +7529,10 @@ function prepareError(err$2) {
7536
7529
  };
7537
7530
  }
7538
7531
  function buildErrorMessage(err$2, args = [], includeStack = true) {
7539
- if (err$2.plugin) args.push(` Plugin: ${import_picocolors$28.default.magenta(err$2.plugin)}`);
7532
+ if (err$2.plugin) args.push(` Plugin: ${import_picocolors.default.magenta(err$2.plugin)}`);
7540
7533
  const loc = err$2.loc ? `:${err$2.loc.line}:${err$2.loc.column}` : "";
7541
- if (err$2.id) args.push(` File: ${import_picocolors$28.default.cyan(err$2.id)}${loc}`);
7542
- if (err$2.frame) args.push(import_picocolors$28.default.yellow(pad(err$2.frame)));
7534
+ if (err$2.id) args.push(` File: ${import_picocolors.default.cyan(err$2.id)}${loc}`);
7535
+ if (err$2.frame) args.push(import_picocolors.default.yellow(pad(err$2.frame)));
7543
7536
  if (includeStack && err$2.stack) args.push(pad(cleanStack(err$2.stack)));
7544
7537
  return args.join("\n");
7545
7538
  }
@@ -7547,7 +7540,7 @@ function cleanStack(stack) {
7547
7540
  return stack.split(/\n/).filter((l) => /^\s*at/.test(l)).join("\n");
7548
7541
  }
7549
7542
  function logError(server, err$2) {
7550
- const msg = buildErrorMessage(err$2, [import_picocolors$28.default.red(`Internal server error: ${err$2.message}`)]);
7543
+ const msg = buildErrorMessage(err$2, [import_picocolors.default.red(`Internal server error: ${err$2.message}`)]);
7551
7544
  server.config.logger.error(msg, {
7552
7545
  clear: true,
7553
7546
  timestamp: true,
@@ -12944,7 +12937,6 @@ var require_launch_editor_middleware = /* @__PURE__ */ __commonJSMin(((exports,
12944
12937
 
12945
12938
  //#endregion
12946
12939
  //#region src/node/http.ts
12947
- var import_picocolors$27 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
12948
12940
  async function resolveHttpServer(app, httpsOptions) {
12949
12941
  if (!httpsOptions) {
12950
12942
  const { createServer: createServer$3 } = await import("node:http");
@@ -13007,7 +12999,7 @@ function setClientErrorHandler(server, logger) {
13007
12999
  let msg = "400 Bad Request";
13008
13000
  if (err$2.code === "HPE_HEADER_OVERFLOW") {
13009
13001
  msg = "431 Request Header Fields Too Large";
13010
- logger.warn(import_picocolors$27.default.yellow("Server responded with status code 431. See https://vite.dev/guide/troubleshooting.html#_431-request-header-fields-too-large."));
13002
+ logger.warn(import_picocolors.default.yellow("Server responded with status code 431. See https://vite.dev/guide/troubleshooting.html#_431-request-header-fields-too-large."));
13011
13003
  }
13012
13004
  if (err$2.code === "ECONNRESET" || !socket.writable) return;
13013
13005
  socket.end(`HTTP/1.1 ${msg}\r\n\r\n`);
@@ -13028,22 +13020,33 @@ function calculateOffsetOnce() {
13028
13020
  }
13029
13021
  function ssrRewriteStacktrace(stack, moduleGraph) {
13030
13022
  calculateOffsetOnce();
13031
- return stack.split("\n").map((line) => {
13032
- return line.replace(/^ {4}at (?:(\S.*?)\s\()?(.+?):(\d+)(?::(\d+))?\)?/, (input, varName, id, line$1, column) => {
13033
- if (!id) return input;
13034
- const rawSourceMap = moduleGraph.getModuleById(id)?.transformResult?.map;
13035
- if (!rawSourceMap) return input;
13036
- const pos = originalPositionFor(new TraceMap(rawSourceMap), {
13037
- line: Number(line$1) - offset,
13038
- column: Number(column) - 1
13023
+ let alreadyRewritten = false;
13024
+ return {
13025
+ result: stack.split("\n").map((line) => {
13026
+ return line.replace(/^ {4}at (?:(\S.*?)\s\()?(.+?):(\d+)(?::(\d+))?\)?/, (input, varName, id, originalLine, originalColumn) => {
13027
+ if (!id) return input;
13028
+ const rawSourceMap = moduleGraph.getModuleById(id)?.transformResult?.map;
13029
+ if (!rawSourceMap) return input;
13030
+ const traced = new TraceMap(rawSourceMap);
13031
+ const line$1 = Number(originalLine) - offset;
13032
+ const column = Number(originalColumn) - 1;
13033
+ if (line$1 <= 0 || column < 0) {
13034
+ alreadyRewritten = true;
13035
+ return input;
13036
+ }
13037
+ const pos = originalPositionFor$1(traced, {
13038
+ line: line$1,
13039
+ column
13040
+ });
13041
+ if (!pos.source) return input;
13042
+ const trimmedVarName = varName?.trim();
13043
+ const source = `${path.resolve(path.dirname(id), pos.source)}:${pos.line}:${pos.column + 1}`;
13044
+ if (!trimmedVarName || trimmedVarName === "eval") return ` at ${source}`;
13045
+ else return ` at ${trimmedVarName} (${source})`;
13039
13046
  });
13040
- if (!pos.source) return input;
13041
- const trimmedVarName = varName?.trim();
13042
- const source = `${path.resolve(path.dirname(id), pos.source)}:${pos.line}:${pos.column + 1}`;
13043
- if (!trimmedVarName || trimmedVarName === "eval") return ` at ${source}`;
13044
- else return ` at ${trimmedVarName} (${source})`;
13045
- });
13046
- }).join("\n");
13047
+ }).join("\n"),
13048
+ alreadyRewritten
13049
+ };
13047
13050
  }
13048
13051
  function rebindErrorStacktrace(e$1, stacktrace) {
13049
13052
  const { configurable, writable } = Object.getOwnPropertyDescriptor(e$1, "stack");
@@ -13059,7 +13062,9 @@ const rewroteStacktraces = /* @__PURE__ */ new WeakSet();
13059
13062
  function ssrFixStacktrace(e$1, moduleGraph) {
13060
13063
  if (!e$1.stack) return;
13061
13064
  if (rewroteStacktraces.has(e$1)) return;
13062
- rebindErrorStacktrace(e$1, ssrRewriteStacktrace(e$1.stack, moduleGraph));
13065
+ const { result: stacktrace, alreadyRewritten } = ssrRewriteStacktrace(e$1.stack, moduleGraph);
13066
+ rebindErrorStacktrace(e$1, stacktrace);
13067
+ if (alreadyRewritten) e$1.message += " (The stacktrace appears to be already rewritten by something else, but was passed to vite.ssrFixStacktrace. This may cause incorrect stacktraces.)";
13063
13068
  rewroteStacktraces.add(e$1);
13064
13069
  }
13065
13070
 
@@ -13125,7 +13130,6 @@ function createServerModuleRunner(environment, options = {}) {
13125
13130
 
13126
13131
  //#endregion
13127
13132
  //#region src/node/ssr/ssrModuleLoader.ts
13128
- var import_picocolors$26 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
13129
13133
  async function ssrLoadModule(url$4, server, fixStacktrace) {
13130
13134
  const environment = server.environments.ssr;
13131
13135
  server._ssrCompatModuleRunner ||= new SSRCompatModuleRunner(environment);
@@ -13139,7 +13143,7 @@ async function instantiateModule(url$4, runner, environment, fixStacktrace) {
13139
13143
  return await runner.import(url$4);
13140
13144
  } catch (e$1) {
13141
13145
  if (e$1.stack && fixStacktrace) ssrFixStacktrace(e$1, environment.moduleGraph);
13142
- environment.logger.error(buildErrorMessage(e$1, [import_picocolors$26.default.red(`Error when evaluating SSR module ${url$4}: ${e$1.message}`)]), {
13146
+ environment.logger.error(buildErrorMessage(e$1, [import_picocolors.default.red(`Error when evaluating SSR module ${url$4}: ${e$1.message}`)]), {
13143
13147
  timestamp: true,
13144
13148
  clear: environment.config.clearScreen,
13145
13149
  error: e$1
@@ -13396,7 +13400,7 @@ function isNode(value$1) {
13396
13400
  * }} walker
13397
13401
  * @returns {Node | null}
13398
13402
  */
13399
- function walk(ast, { enter, leave }) {
13403
+ function walk$1(ast, { enter, leave }) {
13400
13404
  return new SyncWalker(enter, leave).visit(ast, null);
13401
13405
  }
13402
13406
 
@@ -13532,7 +13536,7 @@ async function ssrTransformScript(code, inMap, url$4, originalCode) {
13532
13536
  else s.appendLeft(node.end, `${ssrExportAllKey}(${importId});\n`);
13533
13537
  }
13534
13538
  }
13535
- walk$1(ast, {
13539
+ walk(ast, {
13536
13540
  onStatements(statements) {
13537
13541
  for (let i = 0; i < statements.length - 1; i++) {
13538
13542
  const stmt = statements[i];
@@ -13591,7 +13595,7 @@ const isNodeInPattern = (node) => isNodeInPatternWeakSet.has(node);
13591
13595
  * Same logic from \@vue/compiler-core & \@vue/compiler-sfc
13592
13596
  * Except this is using acorn AST
13593
13597
  */
13594
- function walk$1(root, { onIdentifier, onImportMeta, onDynamicImport, onStatements }) {
13598
+ function walk(root, { onIdentifier, onImportMeta, onDynamicImport, onStatements }) {
13595
13599
  const parentStack = [];
13596
13600
  const varKindStack = [];
13597
13601
  const scopeMap = /* @__PURE__ */ new WeakMap();
@@ -13621,7 +13625,7 @@ function walk$1(root, { onIdentifier, onImportMeta, onDynamicImport, onStatement
13621
13625
  else if (p.type === "AssignmentPattern") handlePattern(p.left, parentScope);
13622
13626
  else setScope(parentScope, p.name);
13623
13627
  }
13624
- walk(root, {
13628
+ walk$1(root, {
13625
13629
  enter(node, parent) {
13626
13630
  if (node.type === "ImportDeclaration") return this.skip();
13627
13631
  if (node.type === "Program" || node.type === "BlockStatement" || node.type === "StaticBlock") onStatements(node.body);
@@ -13643,7 +13647,7 @@ function walk$1(root, { onIdentifier, onImportMeta, onDynamicImport, onStatement
13643
13647
  handlePattern(p, node);
13644
13648
  return;
13645
13649
  }
13646
- walk(p.type === "AssignmentPattern" ? p.left : p, { enter(child, parent$1) {
13650
+ walk$1(p.type === "AssignmentPattern" ? p.left : p, { enter(child, parent$1) {
13647
13651
  if (parent$1?.type === "AssignmentPattern" && parent$1.right === child) return this.skip();
13648
13652
  if (child.type !== "Identifier") return;
13649
13653
  if (isStaticPropertyKey(child, parent$1)) return;
@@ -14552,7 +14556,6 @@ var require_cross_spawn = /* @__PURE__ */ __commonJSMin(((exports, module) => {
14552
14556
  *
14553
14557
  */
14554
14558
  var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
14555
- var import_picocolors$25 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
14556
14559
  /**
14557
14560
  * Reads the BROWSER environment variable and decides what to do with it.
14558
14561
  */
@@ -14568,7 +14571,7 @@ function executeNodeScript(scriptPath, url$4, logger) {
14568
14571
  ...extraArgs,
14569
14572
  url$4
14570
14573
  ], { stdio: "inherit" }).on("close", (code) => {
14571
- if (code !== 0) logger.error(import_picocolors$25.default.red(`\nThe script specified as BROWSER environment variable failed.\n\n${import_picocolors$25.default.cyan(scriptPath)} exited with code ${code}.`), { error: null });
14574
+ if (code !== 0) logger.error(import_picocolors.default.red(`\nThe script specified as BROWSER environment variable failed.\n\n${import_picocolors.default.cyan(scriptPath)} exited with code ${code}.`), { error: null });
14572
14575
  });
14573
14576
  }
14574
14577
  const supportedChromiumBrowsers = [
@@ -14620,7 +14623,6 @@ function execAsync(command, options) {
14620
14623
 
14621
14624
  //#endregion
14622
14625
  //#region src/node/shortcuts.ts
14623
- var import_picocolors$24 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
14624
14626
  function bindCLIShortcuts(server, opts, enabled = process.stdin.isTTY && !process.env.CI) {
14625
14627
  if (!server.httpServer || !enabled) return;
14626
14628
  const isDev = isDevServer(server);
@@ -14632,7 +14634,7 @@ function bindCLIShortcuts(server, opts, enabled = process.stdin.isTTY && !proces
14632
14634
  ...opts,
14633
14635
  customShortcuts
14634
14636
  };
14635
- if (opts?.print) server.config.logger.info(import_picocolors$24.default.dim(import_picocolors$24.default.green(" ➜")) + import_picocolors$24.default.dim(" press ") + import_picocolors$24.default.bold("h + enter") + import_picocolors$24.default.dim(" to show help"));
14637
+ if (opts?.print) server.config.logger.info(import_picocolors.default.dim(import_picocolors.default.green(" ➜")) + import_picocolors.default.dim(" press ") + import_picocolors.default.bold("h + enter") + import_picocolors.default.dim(" to show help"));
14636
14638
  const shortcuts = customShortcuts.concat(isDev ? BASE_DEV_SHORTCUTS : BASE_PREVIEW_SHORTCUTS);
14637
14639
  let actionRunning = false;
14638
14640
  const onInput = async (input) => {
@@ -14644,7 +14646,7 @@ function bindCLIShortcuts(server, opts, enabled = process.stdin.isTTY && !proces
14644
14646
  if (loggedKeys.has(shortcut$1.key)) continue;
14645
14647
  loggedKeys.add(shortcut$1.key);
14646
14648
  if (shortcut$1.action == null) continue;
14647
- server.config.logger.info(import_picocolors$24.default.dim(" press ") + import_picocolors$24.default.bold(`${shortcut$1.key} + enter`) + import_picocolors$24.default.dim(` to ${shortcut$1.description}`));
14649
+ server.config.logger.info(import_picocolors.default.dim(" press ") + import_picocolors.default.bold(`${shortcut$1.key} + enter`) + import_picocolors.default.dim(` to ${shortcut$1.description}`));
14648
14650
  }
14649
14651
  return;
14650
14652
  }
@@ -14732,7 +14734,6 @@ const BASE_PREVIEW_SHORTCUTS = [{
14732
14734
 
14733
14735
  //#endregion
14734
14736
  //#region src/node/watch.ts
14735
- var import_picocolors$23 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
14736
14737
  function getResolvedOutDirs(root, outDir, outputOptions) {
14737
14738
  const resolvedOutDir = path.resolve(root, outDir);
14738
14739
  if (!outputOptions) return new Set([resolvedOutDir]);
@@ -14741,7 +14742,7 @@ function getResolvedOutDirs(root, outDir, outputOptions) {
14741
14742
  function resolveEmptyOutDir(emptyOutDir, root, outDirs, logger) {
14742
14743
  if (emptyOutDir != null) return emptyOutDir;
14743
14744
  for (const outDir of outDirs) if (!normalizePath(outDir).startsWith(withTrailingSlash(root))) {
14744
- logger?.warn(import_picocolors$23.default.yellow(`\n${import_picocolors$23.default.bold(`(!)`)} outDir ${import_picocolors$23.default.white(import_picocolors$23.default.dim(outDir))} is not inside project root and will not be emptied.\nUse --emptyOutDir to override.\n`));
14745
+ logger?.warn(import_picocolors.default.yellow(`\n${import_picocolors.default.bold(`(!)`)} outDir ${import_picocolors.default.white(import_picocolors.default.dim(outDir))} is not inside project root and will not be emptied.\nUse --emptyOutDir to override.\n`));
14745
14746
  return false;
14746
14747
  }
14747
14748
  return true;
@@ -18392,7 +18393,6 @@ function generateDefaultErrorMessage(hostname) {
18392
18393
 
18393
18394
  //#endregion
18394
18395
  //#region src/node/server/ws.ts
18395
- var import_picocolors$22 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
18396
18396
  const WebSocketServerRaw = process.versions.bun ? import.meta.require("ws").WebSocketServer : import_websocket_server.default;
18397
18397
  const HMR_HEADER = "vite-hmr";
18398
18398
  const isWebSocketServer = Symbol("isWebSocketServer");
@@ -18431,7 +18431,7 @@ function createWebSocketServer(server, config, httpsOptions) {
18431
18431
  send: noop$1
18432
18432
  };
18433
18433
  let wsHttpServer = void 0;
18434
- const hmr = isObject(config.server.hmr) && config.server.hmr;
18434
+ const hmr = isObject$1(config.server.hmr) && config.server.hmr;
18435
18435
  const hmrServer = hmr && hmr.server;
18436
18436
  const hmrPort = hmr && hmr.port;
18437
18437
  const wsServer = hmrServer || (!hmrPort || hmrPort === config.server.port) && server;
@@ -18491,8 +18491,8 @@ function createWebSocketServer(server, config, httpsOptions) {
18491
18491
  handleUpgrade(req$1, socket, head, protocol === "vite-ping");
18492
18492
  });
18493
18493
  wsHttpServer.on("error", (e$1) => {
18494
- if (e$1.code === "EADDRINUSE") config.logger.error(import_picocolors$22.default.red(`WebSocket server error: Port ${e$1.port} is already in use`), { error: e$1 });
18495
- else config.logger.error(import_picocolors$22.default.red(`WebSocket server error:\n${e$1.stack || e$1.message}`), { error: e$1 });
18494
+ if (e$1.code === "EADDRINUSE") config.logger.error(import_picocolors.default.red(`WebSocket server error: Port ${e$1.port} is already in use`), { error: e$1 });
18495
+ else config.logger.error(import_picocolors.default.red(`WebSocket server error:\n${e$1.stack || e$1.message}`), { error: e$1 });
18496
18496
  });
18497
18497
  }
18498
18498
  const emitCustomEvent = (event, data, socket) => {
@@ -18512,7 +18512,7 @@ function createWebSocketServer(server, config, httpsOptions) {
18512
18512
  emitCustomEvent(parsed.event, parsed.data, socket);
18513
18513
  });
18514
18514
  socket.on("error", (err$2) => {
18515
- config.logger.error(`${import_picocolors$22.default.red(`ws error:`)}\n${err$2.stack}`, {
18515
+ config.logger.error(`${import_picocolors.default.red(`ws error:`)}\n${err$2.stack}`, {
18516
18516
  timestamp: true,
18517
18517
  error: err$2
18518
18518
  });
@@ -18528,8 +18528,8 @@ function createWebSocketServer(server, config, httpsOptions) {
18528
18528
  }
18529
18529
  });
18530
18530
  wss.on("error", (e$1) => {
18531
- if (e$1.code === "EADDRINUSE") config.logger.error(import_picocolors$22.default.red(`WebSocket server error: Port ${e$1.port} is already in use`), { error: e$1 });
18532
- else config.logger.error(import_picocolors$22.default.red(`WebSocket server error:\n${e$1.stack || e$1.message}`), { error: e$1 });
18531
+ if (e$1.code === "EADDRINUSE") config.logger.error(import_picocolors.default.red(`WebSocket server error: Port ${e$1.port} is already in use`), { error: e$1 });
18532
+ else config.logger.error(import_picocolors.default.red(`WebSocket server error:\n${e$1.stack || e$1.message}`), { error: e$1 });
18533
18533
  });
18534
18534
  function getSocketClient(socket) {
18535
18535
  if (!clientsMap.has(socket)) clientsMap.set(socket, {
@@ -20069,14 +20069,13 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports) => {
20069
20069
 
20070
20070
  //#endregion
20071
20071
  //#region src/node/server/middlewares/proxy.ts
20072
- var import_lib$2 = /* @__PURE__ */ __toESM(require_lib(), 1);
20073
- var import_picocolors$21 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
20072
+ var import_lib$1 = /* @__PURE__ */ __toESM(require_lib(), 1);
20074
20073
  const debug$11 = createDebugger("vite:proxy");
20075
20074
  const rewriteOriginHeader = (proxyReq, options, config) => {
20076
20075
  if (options.rewriteWsOrigin) {
20077
20076
  const { target } = options;
20078
20077
  if (proxyReq.headersSent) {
20079
- config.logger.warn(import_picocolors$21.default.yellow(`Unable to rewrite Origin header as headers are already sent.`));
20078
+ config.logger.warn(import_picocolors.default.yellow(`Unable to rewrite Origin header as headers are already sent.`));
20080
20079
  return;
20081
20080
  }
20082
20081
  if (proxyReq.getHeader("origin") && target) {
@@ -20094,17 +20093,17 @@ function proxyMiddleware(httpServer, options, config) {
20094
20093
  target: opts,
20095
20094
  changeOrigin: true
20096
20095
  };
20097
- const proxy = import_lib$2.createProxyServer(opts);
20096
+ const proxy = import_lib$1.createProxyServer(opts);
20098
20097
  if (opts.configure) opts.configure(proxy, opts);
20099
20098
  proxy.on("error", (err$2, _req, res) => {
20100
20099
  if ("req" in res) {
20101
- config.logger.error(`${import_picocolors$21.default.red(`http proxy error: ${res.req.url}`)}\n${err$2.stack}`, {
20100
+ config.logger.error(`${import_picocolors.default.red(`http proxy error: ${res.req.url}`)}\n${err$2.stack}`, {
20102
20101
  timestamp: true,
20103
20102
  error: err$2
20104
20103
  });
20105
20104
  if (!res.headersSent && !res.writableEnded) res.writeHead(500, { "Content-Type": "text/plain" }).end();
20106
20105
  } else {
20107
- config.logger.error(`${import_picocolors$21.default.red(`ws proxy error:`)}\n${err$2.stack}`, {
20106
+ config.logger.error(`${import_picocolors.default.red(`ws proxy error:`)}\n${err$2.stack}`, {
20108
20107
  timestamp: true,
20109
20108
  error: err$2
20110
20109
  });
@@ -20114,7 +20113,7 @@ function proxyMiddleware(httpServer, options, config) {
20114
20113
  proxy.on("proxyReqWs", (proxyReq, _req, socket, options$1) => {
20115
20114
  rewriteOriginHeader(proxyReq, options$1, config);
20116
20115
  socket.on("error", (err$2) => {
20117
- config.logger.error(`${import_picocolors$21.default.red(`ws proxy socket error:`)}\n${err$2.stack}`, {
20116
+ config.logger.error(`${import_picocolors.default.red(`ws proxy socket error:`)}\n${err$2.stack}`, {
20118
20117
  timestamp: true,
20119
20118
  error: err$2
20120
20119
  });
@@ -20140,7 +20139,7 @@ function proxyMiddleware(httpServer, options, config) {
20140
20139
  return;
20141
20140
  }
20142
20141
  } catch (err$2) {
20143
- config.logger.error(`${import_picocolors$21.default.red(`ws proxy bypass error:`)}\n${err$2.stack}`, {
20142
+ config.logger.error(`${import_picocolors.default.red(`ws proxy bypass error:`)}\n${err$2.stack}`, {
20144
20143
  timestamp: true,
20145
20144
  error: err$2
20146
20145
  });
@@ -21545,7 +21544,7 @@ var require_convert_source_map = /* @__PURE__ */ __commonJSMin(((exports) => {
21545
21544
 
21546
21545
  //#endregion
21547
21546
  //#region src/node/server/sourcemap.ts
21548
- var import_convert_source_map$2 = /* @__PURE__ */ __toESM(require_convert_source_map(), 1);
21547
+ var import_convert_source_map = /* @__PURE__ */ __toESM(require_convert_source_map(), 1);
21549
21548
  const debug$10 = createDebugger("vite:sourcemap", { onlyWhenFocused: true });
21550
21549
  const virtualSourceRE = /^(?:dep:|browser-external:|virtual:)|\0/;
21551
21550
  async function computeSourceRoute(map$1, file) {
@@ -21607,9 +21606,9 @@ function applySourcemapIgnoreList(map$1, sourcemapPath, sourcemapIgnoreList, log
21607
21606
  }
21608
21607
  }
21609
21608
  async function extractSourcemapFromFile(code, filePath) {
21610
- const map$1 = (import_convert_source_map$2.fromSource(code) || await import_convert_source_map$2.fromMapFileSource(code, createConvertSourceMapReadMap(filePath)))?.toObject();
21609
+ const map$1 = (import_convert_source_map.fromSource(code) || await import_convert_source_map.fromMapFileSource(code, createConvertSourceMapReadMap(filePath)))?.toObject();
21611
21610
  if (map$1) return {
21612
- code: code.replace(import_convert_source_map$2.default.mapFileCommentRegex, blankReplacer),
21611
+ code: code.replace(import_convert_source_map.default.mapFileCommentRegex, blankReplacer),
21613
21612
  map: map$1
21614
21613
  };
21615
21614
  }
@@ -21645,7 +21644,7 @@ function createIdResolver(config, options) {
21645
21644
  async function resolve$4(environment, id, importer) {
21646
21645
  let pluginContainer = pluginContainerMap.get(environment);
21647
21646
  if (!pluginContainer) {
21648
- pluginContainer = await createEnvironmentPluginContainer(environment, [alias({ entries: environment.config.resolve.alias }), ...config.experimental.enableNativePlugin ? oxcResolvePlugin({
21647
+ pluginContainer = await createEnvironmentPluginContainer(environment, [alias$1({ entries: environment.config.resolve.alias }), ...config.experimental.enableNativePlugin ? oxcResolvePlugin({
21649
21648
  root: config.root,
21650
21649
  isProduction: config.isProduction,
21651
21650
  isBuild: config.command === "build",
@@ -21672,7 +21671,7 @@ function createIdResolver(config, options) {
21672
21671
  async function resolveAlias(environment, id, importer) {
21673
21672
  let pluginContainer = aliasOnlyPluginContainerMap.get(environment);
21674
21673
  if (!pluginContainer) {
21675
- pluginContainer = await createEnvironmentPluginContainer(environment, [alias({ entries: environment.config.resolve.alias })], void 0, false);
21674
+ pluginContainer = await createEnvironmentPluginContainer(environment, [alias$1({ entries: environment.config.resolve.alias })], void 0, false);
21676
21675
  aliasOnlyPluginContainerMap.set(environment, pluginContainer);
21677
21676
  }
21678
21677
  return await pluginContainer.resolveId(id, importer, { scan: scan$1 });
@@ -21684,12 +21683,11 @@ function createIdResolver(config, options) {
21684
21683
 
21685
21684
  //#endregion
21686
21685
  //#region src/node/baseEnvironment.ts
21687
- var import_picocolors$20 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
21688
21686
  const environmentColors = [
21689
- import_picocolors$20.default.blue,
21690
- import_picocolors$20.default.magenta,
21691
- import_picocolors$20.default.green,
21692
- import_picocolors$20.default.gray
21687
+ import_picocolors.default.blue,
21688
+ import_picocolors.default.magenta,
21689
+ import_picocolors.default.green,
21690
+ import_picocolors.default.gray
21693
21691
  ];
21694
21692
  var PartialEnvironment = class {
21695
21693
  name;
@@ -21716,7 +21714,7 @@ var PartialEnvironment = class {
21716
21714
  if (prop in target) return this._options[prop];
21717
21715
  return this._topLevelConfig[prop];
21718
21716
  } });
21719
- const environment = import_picocolors$20.default.dim(`(${this.name})`);
21717
+ const environment = import_picocolors.default.dim(`(${this.name})`);
21720
21718
  const infoColor = environmentColors[[...this.name].reduce((acc, c) => acc + c.charCodeAt(0), 0) % environmentColors.length || 0];
21721
21719
  this.logger = {
21722
21720
  get hasWarned() {
@@ -21731,19 +21729,19 @@ var PartialEnvironment = class {
21731
21729
  warn(msg, opts) {
21732
21730
  return topLevelConfig.logger.warn(msg, {
21733
21731
  ...opts,
21734
- environment: import_picocolors$20.default.yellow(environment)
21732
+ environment: import_picocolors.default.yellow(environment)
21735
21733
  });
21736
21734
  },
21737
21735
  warnOnce(msg, opts) {
21738
21736
  return topLevelConfig.logger.warnOnce(msg, {
21739
21737
  ...opts,
21740
- environment: import_picocolors$20.default.yellow(environment)
21738
+ environment: import_picocolors.default.yellow(environment)
21741
21739
  });
21742
21740
  },
21743
21741
  error(msg, opts) {
21744
21742
  return topLevelConfig.logger.error(msg, {
21745
21743
  ...opts,
21746
- environment: import_picocolors$20.default.red(environment)
21744
+ environment: import_picocolors.default.red(environment)
21747
21745
  });
21748
21746
  },
21749
21747
  clearScreen(type) {
@@ -21983,7 +21981,6 @@ function getChunkOriginalFileName(chunk, root, isLegacy) {
21983
21981
  //#endregion
21984
21982
  //#region src/node/plugins/css.ts
21985
21983
  var import_src = /* @__PURE__ */ __toESM(require_src(), 1);
21986
- var import_picocolors$19 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
21987
21984
  const decoder = new TextDecoder();
21988
21985
  const _cssConfigDefaults = Object.freeze({
21989
21986
  transformer: "postcss",
@@ -22062,7 +22059,7 @@ function cssPlugin(config) {
22062
22059
  load: {
22063
22060
  filter: { id: CSS_LANGS_RE },
22064
22061
  async handler(id) {
22065
- if (urlRE.test(id)) {
22062
+ if (urlRE$1.test(id)) {
22066
22063
  if (isModuleCSSRequest(id)) throw new Error(`?url is not supported with CSS modules. (tried to import ${JSON.stringify(id)})`);
22067
22064
  if (isBuild) {
22068
22065
  id = injectQuery(removeUrlQuery(id), "transform-only");
@@ -22087,7 +22084,7 @@ function cssPlugin(config) {
22087
22084
  let resolved = await resolveUrl(id$1, importer);
22088
22085
  if (resolved) {
22089
22086
  if (fragment) resolved += "#" + fragment;
22090
- let url$5 = await fileToUrl(this, resolved);
22087
+ let url$5 = await fileToUrl$1(this, resolved);
22091
22088
  if (!url$5.startsWith("data:") && this.environment.mode === "dev") {
22092
22089
  const mod = [...this.environment.moduleGraph.getModulesByFile(resolved) ?? []].find((mod$1) => mod$1.type === "asset");
22093
22090
  if (mod?.lastHMRTimestamp) url$5 = injectQuery(url$5, `t=${mod.lastHMRTimestamp}`);
@@ -22462,7 +22459,7 @@ function isCssScopeToRendered(cssScopeTo, renderedModules) {
22462
22459
  * @param outputFormat The module output format to decide whether to replace `import` or `require`
22463
22460
  */
22464
22461
  function getEmptyChunkReplacer(pureCssChunkNames, outputFormat) {
22465
- const emptyChunkFiles = pureCssChunkNames.map((file) => escapeRegex(path.basename(file))).join("|");
22462
+ const emptyChunkFiles = pureCssChunkNames.map((file) => escapeRegex$1(path.basename(file))).join("|");
22466
22463
  const emptyChunkRE = new RegExp(outputFormat === "es" ? `\\bimport\\s*["'][^"']*(?:${emptyChunkFiles})["'];` : `(\\b|,\\s*)require\\(\\s*["'\`][^"'\`]*(?:${emptyChunkFiles})["'\`]\\)(;|,)`, "g");
22467
22464
  return (code) => code.replace(emptyChunkRE, (m, p1, p2) => {
22468
22465
  if (outputFormat === "es") return `/* empty css ${"".padEnd(m.length - 15)}*/`;
@@ -22604,7 +22601,7 @@ async function compilePostCSS(environment, id, code, deps, lang, workerControlle
22604
22601
  if (publicFile) return publicFile;
22605
22602
  const resolved = await atImportResolvers.css(environment, id$1, path.join(basedir, "*"));
22606
22603
  if (resolved) return path.resolve(resolved);
22607
- if (!path.isAbsolute(id$1)) environment.logger.error(import_picocolors$19.default.red(`Unable to resolve \`@import "${id$1}"\` from ${basedir}`));
22604
+ if (!path.isAbsolute(id$1)) environment.logger.error(import_picocolors.default.red(`Unable to resolve \`@import "${id$1}"\` from ${basedir}`));
22608
22605
  return id$1;
22609
22606
  },
22610
22607
  async load(id$1) {
@@ -22692,7 +22689,7 @@ async function runPostCSS(id, code, plugins, options, deps, logger, enableSource
22692
22689
  line: warning.endLine,
22693
22690
  column: warning.endColumn - 1
22694
22691
  } : void 0)}`;
22695
- logger.warn(import_picocolors$19.default.yellow(msg));
22692
+ logger.warn(import_picocolors.default.yellow(msg));
22696
22693
  }
22697
22694
  } catch (e$1) {
22698
22695
  e$1.message = `[postcss] ${e$1.message}`;
@@ -22773,7 +22770,7 @@ async function resolvePostcssConfig(config) {
22773
22770
  let result = postcssConfigCache.get(config);
22774
22771
  if (result !== void 0) return await result;
22775
22772
  const inlineOptions = config.css.postcss;
22776
- if (isObject(inlineOptions)) {
22773
+ if (isObject$1(inlineOptions)) {
22777
22774
  const options = { ...inlineOptions };
22778
22775
  delete options.plugins;
22779
22776
  result = {
@@ -22906,7 +22903,7 @@ async function minifyCSS(css, config, inlined) {
22906
22903
  });
22907
22904
  if (warnings.length) {
22908
22905
  const msgs = await formatMessages(warnings, { kind: "warning" });
22909
- config.logger.warn(import_picocolors$19.default.yellow(`[esbuild css minify]\n${msgs.join("\n")}`));
22906
+ config.logger.warn(import_picocolors.default.yellow(`[esbuild css minify]\n${msgs.join("\n")}`));
22910
22907
  }
22911
22908
  return inlined ? code.trimEnd() : code;
22912
22909
  } catch (e$1) {
@@ -22933,7 +22930,7 @@ async function minifyCSS(css, config, inlined) {
22933
22930
  line: warning.loc.line,
22934
22931
  column: warning.loc.column - 1
22935
22932
  })}`;
22936
- config.logger.warn(import_picocolors$19.default.yellow(msg));
22933
+ config.logger.warn(import_picocolors.default.yellow(msg));
22937
22934
  }
22938
22935
  return decoder.decode(code) + (inlined ? "" : "\n");
22939
22936
  } catch (e$1) {
@@ -23227,6 +23224,7 @@ const makeLessWorker = (environment, resolvers, maxWorkers) => {
23227
23224
  plugins: [viteResolverPlugin, ...options.plugins || []],
23228
23225
  ...options.enableSourcemap ? { sourceMap: {
23229
23226
  outputSourceFiles: true,
23227
+ disableSourcemapAnnotation: true,
23230
23228
  sourceMapFileInline: false
23231
23229
  } } : {}
23232
23230
  });
@@ -23495,7 +23493,7 @@ async function compileLightningCSS(environment, id, src, deps, workerController,
23495
23493
  line: warning.loc.line,
23496
23494
  column: warning.loc.column - 1
23497
23495
  })}`;
23498
- environment.logger.warn(import_picocolors$19.default.yellow(msg));
23496
+ environment.logger.warn(import_picocolors.default.yellow(msg));
23499
23497
  }
23500
23498
  let css = decoder.decode(res.code);
23501
23499
  for (const dep of res.dependencies) switch (dep.type) {
@@ -23654,7 +23652,6 @@ function resolveLibCssFilename(libOptions, root, packageCache) {
23654
23652
 
23655
23653
  //#endregion
23656
23654
  //#region src/node/plugins/importAnalysisBuild.ts
23657
- var import_convert_source_map$1 = /* @__PURE__ */ __toESM(require_convert_source_map(), 1);
23658
23655
  /**
23659
23656
  * A flag for injected helpers. This flag will be set to `false` if the output
23660
23657
  * target is not native es - so that injected helper logic can be conditionally
@@ -23770,7 +23767,7 @@ function buildImportAnalysisPlugin(config) {
23770
23767
  await init;
23771
23768
  let imports = [];
23772
23769
  try {
23773
- imports = parse$1(source)[0];
23770
+ imports = parse$3(source)[0];
23774
23771
  } catch (_e) {
23775
23772
  const e$1 = _e;
23776
23773
  const { message, showCodeFrame } = createParseErrorInfo(importer, source);
@@ -23851,7 +23848,7 @@ function buildImportAnalysisPlugin(config) {
23851
23848
  const code = chunk.code;
23852
23849
  let imports;
23853
23850
  try {
23854
- imports = parse$1(code)[0].filter((i) => i.d > -1);
23851
+ imports = parse$3(code)[0].filter((i) => i.d > -1);
23855
23852
  } catch (e$1) {
23856
23853
  const loc = numberToPos(code, e$1.idx);
23857
23854
  this.error({
@@ -23890,7 +23887,7 @@ function buildImportAnalysisPlugin(config) {
23890
23887
  const code = chunk.code;
23891
23888
  let imports;
23892
23889
  try {
23893
- imports = parse$1(code)[0].filter((i) => i.d > -1);
23890
+ imports = parse$3(code)[0].filter((i) => i.d > -1);
23894
23891
  } catch (e$1) {
23895
23892
  const loc = numberToPos(code, e$1.idx);
23896
23893
  this.error({
@@ -24008,7 +24005,7 @@ function buildImportAnalysisPlugin(config) {
24008
24005
  const originalDebugId = chunk.map.debugId;
24009
24006
  chunk.map = map$1;
24010
24007
  if (buildSourcemap === "inline") {
24011
- chunk.code = chunk.code.replace(import_convert_source_map$1.default.mapFileCommentRegex, "");
24008
+ chunk.code = chunk.code.replace(import_convert_source_map.default.mapFileCommentRegex, "");
24012
24009
  chunk.code += `\n//# sourceMappingURL=${genSourceMapUrl(map$1)}`;
24013
24010
  } else {
24014
24011
  if (originalDebugId) map$1.debugId = originalDebugId;
@@ -24100,8 +24097,7 @@ function polyfill() {
24100
24097
 
24101
24098
  //#endregion
24102
24099
  //#region src/node/plugins/html.ts
24103
- var import_picocolors$18 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
24104
- var import_escape_html$1 = /* @__PURE__ */ __toESM(require_escape_html(), 1);
24100
+ var import_escape_html = /* @__PURE__ */ __toESM(require_escape_html(), 1);
24105
24101
  const htmlProxyRE = /[?&]html-proxy=?(?:&inline-css)?(?:&style-attr)?&index=(\d+)\.(?:js|css)$/;
24106
24102
  const isHtmlProxyRE = /[?&]html-proxy\b/;
24107
24103
  const inlineCSSRE = /__VITE_INLINE_CSS__([a-z\d]{8}_\d+)__/g;
@@ -24175,7 +24171,7 @@ async function traverseHtml(html, filePath, warn, visitor) {
24175
24171
  handleParseError(e$1, html, filePath, warnings);
24176
24172
  }
24177
24173
  }), visitor);
24178
- for (const message of Object.values(warnings)) warn(import_picocolors$18.default.yellow(`\n${message}`));
24174
+ for (const message of Object.values(warnings)) warn(import_picocolors.default.yellow(`\n${message}`));
24179
24175
  }
24180
24176
  function getScriptInfo(node) {
24181
24177
  let src;
@@ -24605,7 +24601,7 @@ function preImportMapHook(config) {
24605
24601
  if (importMapAppendIndex < 0) return;
24606
24602
  if (importMapAppendIndex < importMapIndex) {
24607
24603
  const relativeHtml = normalizePath(path.relative(config.root, ctx.filename));
24608
- config.logger.warnOnce(import_picocolors$18.default.yellow(import_picocolors$18.default.bold(`(!) <script type="importmap"> should come before <script type="module"> and <link rel="modulepreload"> in /${relativeHtml}`)));
24604
+ config.logger.warnOnce(import_picocolors.default.yellow(import_picocolors.default.bold(`(!) <script type="importmap"> should come before <script type="module"> and <link rel="modulepreload"> in /${relativeHtml}`)));
24609
24605
  }
24610
24606
  };
24611
24607
  }
@@ -24660,7 +24656,7 @@ function htmlEnvHook(config) {
24660
24656
  else {
24661
24657
  if (envPrefix.some((prefix) => key.startsWith(prefix))) {
24662
24658
  const relativeHtml = normalizePath(path.relative(config.root, ctx.filename));
24663
- config.logger.warn(import_picocolors$18.default.yellow(import_picocolors$18.default.bold(`(!) ${text} is not defined in env variables found in /${relativeHtml}. Is the variable mistyped?`)));
24659
+ config.logger.warn(import_picocolors.default.yellow(import_picocolors.default.bold(`(!) ${text} is not defined in env variables found in /${relativeHtml}. Is the variable mistyped?`)));
24664
24660
  }
24665
24661
  return text;
24666
24662
  }
@@ -24727,7 +24723,7 @@ function headTagInsertCheck(tags, ctx) {
24727
24723
  const disallowedTags = tags.filter((tagDescriptor) => !elementsAllowedInHead.has(tagDescriptor.tag));
24728
24724
  if (disallowedTags.length) {
24729
24725
  const dedupedTags = unique(disallowedTags.map((tagDescriptor) => `<${tagDescriptor.tag}>`));
24730
- logger?.warn(import_picocolors$18.default.yellow(import_picocolors$18.default.bold(`[${dedupedTags.join(",")}] can not be used inside the <head> Element, please check the 'injectTo' value`)));
24726
+ logger?.warn(import_picocolors.default.yellow(import_picocolors.default.bold(`[${dedupedTags.join(",")}] can not be used inside the <head> Element, please check the 'injectTo' value`)));
24731
24727
  }
24732
24728
  }
24733
24729
  async function applyHtmlTransforms(html, hooks, pluginContext, ctx) {
@@ -24825,7 +24821,7 @@ function serializeTags(tags, indent = "") {
24825
24821
  function serializeAttrs(attrs) {
24826
24822
  let res = "";
24827
24823
  for (const key in attrs) if (typeof attrs[key] === "boolean") res += attrs[key] ? ` ${key}` : ``;
24828
- else res += ` ${key}="${(0, import_escape_html$1.default)(attrs[key])}"`;
24824
+ else res += ` ${key}="${(0, import_escape_html.default)(attrs[key])}"`;
24829
24825
  return res;
24830
24826
  }
24831
24827
  function incrementIndent(indent = "") {
@@ -24895,7 +24891,7 @@ function definePlugin(config) {
24895
24891
  if (Object.keys(importMetaKeys).length) patternKeys.push("import.meta.env", "import.meta.hot");
24896
24892
  return [
24897
24893
  define,
24898
- patternKeys.length ? new RegExp(patternKeys.map((key) => escapeRegex(key).replaceAll(escapedDotRE, "\\??\\.")).join("|")) : null,
24894
+ patternKeys.length ? new RegExp(patternKeys.map((key) => escapeRegex$1(key).replaceAll(escapedDotRE, "\\??\\.")).join("|")) : null,
24899
24895
  importMetaEnvVal
24900
24896
  ];
24901
24897
  }
@@ -25044,7 +25040,7 @@ async function createClientConfigValueReplacer(config) {
25044
25040
  const devBase = config.base;
25045
25041
  const serverHost = `${resolvedServerHostname}:${resolvedServerPort}${devBase}`;
25046
25042
  let hmrConfig = config.server.hmr;
25047
- hmrConfig = isObject(hmrConfig) ? hmrConfig : void 0;
25043
+ hmrConfig = isObject$1(hmrConfig) ? hmrConfig : void 0;
25048
25044
  const host = hmrConfig?.host || null;
25049
25045
  const protocol = hmrConfig?.protocol || null;
25050
25046
  const timeout = hmrConfig?.timeout || 3e4;
@@ -25157,7 +25153,6 @@ function inlineSourceMap(mod, result, startOffset) {
25157
25153
 
25158
25154
  //#endregion
25159
25155
  //#region src/node/optimizer/optimizer.ts
25160
- var import_picocolors$17 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
25161
25156
  const debug$9 = createDebugger("vite:deps");
25162
25157
  /**
25163
25158
  * The amount to wait for requests to register newly found dependencies before triggering
@@ -25188,14 +25183,14 @@ function createDepsOptimizer(environment) {
25188
25183
  let newDepsToLogHandle;
25189
25184
  const logNewlyDiscoveredDeps = () => {
25190
25185
  if (newDepsToLog.length) {
25191
- logger.info(import_picocolors$17.default.green(`✨ new dependencies optimized: ${depsLogString(newDepsToLog)}`), { timestamp: true });
25186
+ logger.info(import_picocolors.default.green(`✨ new dependencies optimized: ${depsLogString(newDepsToLog)}`), { timestamp: true });
25192
25187
  newDepsToLog = [];
25193
25188
  }
25194
25189
  };
25195
25190
  let discoveredDepsWhileScanning = [];
25196
25191
  const logDiscoveredDepsWhileScanning = () => {
25197
25192
  if (discoveredDepsWhileScanning.length) {
25198
- logger.info(import_picocolors$17.default.green(`✨ discovered while scanning: ${depsLogString(discoveredDepsWhileScanning)}`), { timestamp: true });
25193
+ logger.info(import_picocolors.default.green(`✨ discovered while scanning: ${depsLogString(discoveredDepsWhileScanning)}`), { timestamp: true });
25199
25194
  discoveredDepsWhileScanning = [];
25200
25195
  }
25201
25196
  };
@@ -25245,14 +25240,14 @@ function createDepsOptimizer(environment) {
25245
25240
  else depsOptimizer.scanProcessing = new Promise((resolve$4) => {
25246
25241
  (async () => {
25247
25242
  try {
25248
- debug$9?.(import_picocolors$17.default.green(`scanning for dependencies...`));
25243
+ debug$9?.(import_picocolors.default.green(`scanning for dependencies...`));
25249
25244
  let deps;
25250
25245
  try {
25251
25246
  discover = discoverProjectDependencies(devToScanEnvironment(environment));
25252
25247
  deps = await discover.result;
25253
25248
  discover = void 0;
25254
25249
  } catch (e$1) {
25255
- environment.logger.error(import_picocolors$17.default.red("(!) Failed to run dependency scan. Skipping dependency pre-bundling. " + e$1.stack));
25250
+ environment.logger.error(import_picocolors.default.red("(!) Failed to run dependency scan. Skipping dependency pre-bundling. " + e$1.stack));
25256
25251
  return;
25257
25252
  }
25258
25253
  const manuallyIncluded = Object.keys(manuallyIncludedDepsInfo);
@@ -25355,14 +25350,14 @@ function createDepsOptimizer(environment) {
25355
25350
  logNewlyDiscoveredDeps();
25356
25351
  if (warnAboutMissedDependencies) {
25357
25352
  logDiscoveredDepsWhileScanning();
25358
- logger.info(import_picocolors$17.default.magenta(`❗ add these dependencies to optimizeDeps.include to speed up cold start`), { timestamp: true });
25353
+ logger.info(import_picocolors.default.magenta(`❗ add these dependencies to optimizeDeps.include to speed up cold start`), { timestamp: true });
25359
25354
  warnAboutMissedDependencies = false;
25360
25355
  }
25361
25356
  }, 2 * debounceMs);
25362
- } else debug$9(import_picocolors$17.default.green(`✨ ${!isRerun ? `dependencies optimized` : `optimized dependencies unchanged`}`));
25357
+ } else debug$9(import_picocolors.default.green(`✨ ${!isRerun ? `dependencies optimized` : `optimized dependencies unchanged`}`));
25363
25358
  } else if (newDepsDiscovered) {
25364
25359
  processingResult.cancel();
25365
- debug$9?.(import_picocolors$17.default.green(`✨ delaying reload as new dependencies have been found...`));
25360
+ debug$9?.(import_picocolors.default.green(`✨ delaying reload as new dependencies have been found...`));
25366
25361
  } else {
25367
25362
  await commitProcessing();
25368
25363
  if (!debug$9) {
@@ -25371,16 +25366,16 @@ function createDepsOptimizer(environment) {
25371
25366
  logNewlyDiscoveredDeps();
25372
25367
  if (warnAboutMissedDependencies) {
25373
25368
  logDiscoveredDepsWhileScanning();
25374
- logger.info(import_picocolors$17.default.magenta(`❗ add these dependencies to optimizeDeps.include to avoid a full page reload during cold start`), { timestamp: true });
25369
+ logger.info(import_picocolors.default.magenta(`❗ add these dependencies to optimizeDeps.include to avoid a full page reload during cold start`), { timestamp: true });
25375
25370
  warnAboutMissedDependencies = false;
25376
25371
  }
25377
25372
  }
25378
- logger.info(import_picocolors$17.default.green(`✨ optimized dependencies changed. reloading`), { timestamp: true });
25379
- if (needsInteropMismatch.length > 0) logger.warn(`Mixed ESM and CJS detected in ${import_picocolors$17.default.yellow(needsInteropMismatch.join(", "))}, add ${needsInteropMismatch.length === 1 ? "it" : "them"} to optimizeDeps.needsInterop to speed up cold start`, { timestamp: true });
25373
+ logger.info(import_picocolors.default.green(`✨ optimized dependencies changed. reloading`), { timestamp: true });
25374
+ if (needsInteropMismatch.length > 0) logger.warn(`Mixed ESM and CJS detected in ${import_picocolors.default.yellow(needsInteropMismatch.join(", "))}, add ${needsInteropMismatch.length === 1 ? "it" : "them"} to optimizeDeps.needsInterop to speed up cold start`, { timestamp: true });
25380
25375
  fullReload();
25381
25376
  }
25382
25377
  } catch (e$1) {
25383
- logger.error(import_picocolors$17.default.red(`error while updating dependencies:\n${e$1.stack}`), {
25378
+ logger.error(import_picocolors.default.red(`error while updating dependencies:\n${e$1.stack}`), {
25384
25379
  timestamp: true,
25385
25380
  error: e$1
25386
25381
  });
@@ -25399,7 +25394,7 @@ function createDepsOptimizer(environment) {
25399
25394
  }
25400
25395
  async function rerun() {
25401
25396
  const depsString = depsLogString(Object.keys(metadata.discovered));
25402
- debug$9?.(import_picocolors$17.default.green(`new dependencies found: ${depsString}`));
25397
+ debug$9?.(import_picocolors.default.green(`new dependencies found: ${depsString}`));
25403
25398
  runOptimizer();
25404
25399
  }
25405
25400
  function getDiscoveredBrowserHash(hash, deps, missing) {
@@ -25440,7 +25435,7 @@ function createDepsOptimizer(environment) {
25440
25435
  }
25441
25436
  async function onCrawlEnd() {
25442
25437
  waitingForCrawlEnd = false;
25443
- debug$9?.(import_picocolors$17.default.green(`✨ static imports crawl ended`));
25438
+ debug$9?.(import_picocolors.default.green(`✨ static imports crawl ended`));
25444
25439
  if (closed) return;
25445
25440
  await depsOptimizer.scanProcessing;
25446
25441
  if (optimizationResult && !options.noDiscovery) {
@@ -25451,7 +25446,7 @@ function createDepsOptimizer(environment) {
25451
25446
  const crawlDeps = Object.keys(metadata.discovered);
25452
25447
  const scanDeps = Object.keys(result.metadata.optimized);
25453
25448
  if (scanDeps.length === 0 && crawlDeps.length === 0) {
25454
- debug$9?.(import_picocolors$17.default.green(`✨ no dependencies found by the scanner or crawling static imports`));
25449
+ debug$9?.(import_picocolors.default.green(`✨ no dependencies found by the scanner or crawling static imports`));
25455
25450
  startNextDiscoveredBatch();
25456
25451
  runOptimizer(result);
25457
25452
  return;
@@ -25461,17 +25456,17 @@ function createDepsOptimizer(environment) {
25461
25456
  if (needsInteropMismatch.length > 0 || scannerMissedDeps) {
25462
25457
  result.cancel();
25463
25458
  for (const dep of scanDeps) if (!crawlDeps.includes(dep)) addMissingDep(dep, result.metadata.optimized[dep].src);
25464
- if (scannerMissedDeps) debug$9?.(import_picocolors$17.default.yellow(`✨ new dependencies were found while crawling that weren't detected by the scanner`));
25465
- debug$9?.(import_picocolors$17.default.green(`✨ re-running optimizer`));
25459
+ if (scannerMissedDeps) debug$9?.(import_picocolors.default.yellow(`✨ new dependencies were found while crawling that weren't detected by the scanner`));
25460
+ debug$9?.(import_picocolors.default.green(`✨ re-running optimizer`));
25466
25461
  debouncedProcessing(0);
25467
25462
  } else {
25468
- debug$9?.(import_picocolors$17.default.green(`✨ using post-scan optimizer result, the scanner found every used dependency`));
25463
+ debug$9?.(import_picocolors.default.green(`✨ using post-scan optimizer result, the scanner found every used dependency`));
25469
25464
  startNextDiscoveredBatch();
25470
25465
  runOptimizer(result);
25471
25466
  }
25472
25467
  } else if (!holdUntilCrawlEnd) {
25473
25468
  if (newDepsDiscovered) {
25474
- debug$9?.(import_picocolors$17.default.green(`✨ new dependencies were found while crawling static imports, re-running optimizer`));
25469
+ debug$9?.(import_picocolors.default.green(`✨ new dependencies were found while crawling static imports, re-running optimizer`));
25475
25470
  warnAboutMissedDependencies = true;
25476
25471
  debouncedProcessing(0);
25477
25472
  }
@@ -25479,7 +25474,7 @@ function createDepsOptimizer(environment) {
25479
25474
  const crawlDeps = Object.keys(metadata.discovered);
25480
25475
  currentlyProcessing = false;
25481
25476
  if (crawlDeps.length === 0) {
25482
- debug$9?.(import_picocolors$17.default.green(`✨ no dependencies found while crawling the static imports`));
25477
+ debug$9?.(import_picocolors.default.green(`✨ no dependencies found while crawling the static imports`));
25483
25478
  firstRunCalled = true;
25484
25479
  }
25485
25480
  debouncedProcessing(0);
@@ -25518,7 +25513,7 @@ function findInteropMismatches(discovered, optimized) {
25518
25513
  if (!depInfo) continue;
25519
25514
  if (depInfo.needsInterop !== discoveredDepInfo.needsInterop) {
25520
25515
  needsInteropMismatch.push(dep);
25521
- debug$9?.(import_picocolors$17.default.cyan(`✨ needsInterop mismatch detected for ${dep}`));
25516
+ debug$9?.(import_picocolors.default.cyan(`✨ needsInterop mismatch detected for ${dep}`));
25522
25517
  }
25523
25518
  }
25524
25519
  return needsInteropMismatch;
@@ -25847,7 +25842,7 @@ function totalist(dir, callback, pre = "") {
25847
25842
  * @param {Request} req
25848
25843
  * @returns {ParsedURL|void}
25849
25844
  */
25850
- function parse$2(req$1) {
25845
+ function parse$1(req$1) {
25851
25846
  let raw = req$1.url;
25852
25847
  if (raw == null) return;
25853
25848
  let prev = req$1._parsedUrl;
@@ -25955,7 +25950,7 @@ function toHeaders(name, stats, isEtag) {
25955
25950
  if (isEtag) headers["ETag"] = `W/"${stats.size}-${stats.mtime.getTime()}"`;
25956
25951
  return headers;
25957
25952
  }
25958
- function build_default(dir, opts = {}) {
25953
+ function build_default$1(dir, opts = {}) {
25959
25954
  dir = resolve(dir || ".");
25960
25955
  let isNotFound = opts.onNoMatch || is404;
25961
25956
  let setHeaders = opts.setHeaders || noop;
@@ -25995,7 +25990,7 @@ function build_default(dir, opts = {}) {
25995
25990
  let lookup$1 = opts.dev ? viaLocal.bind(0, dir.endsWith(sep) ? dir : dir + sep, isEtag) : viaCache.bind(0, FILES);
25996
25991
  return function(req$1, res, next) {
25997
25992
  let extns = [""];
25998
- let pathname = parse$2(req$1).pathname;
25993
+ let pathname = parse$1(req$1).pathname;
25999
25994
  let val = req$1.headers["accept-encoding"] || "";
26000
25995
  if (gzips && val.includes("gzip")) extns.unshift(...gzips);
26001
25996
  if (brots && /(br|brotli)/i.test(val)) extns.unshift(...brots);
@@ -26017,7 +26012,6 @@ function build_default(dir, opts = {}) {
26017
26012
 
26018
26013
  //#endregion
26019
26014
  //#region src/node/server/middlewares/static.ts
26020
- var import_escape_html = /* @__PURE__ */ __toESM(require_escape_html(), 1);
26021
26015
  const knownJavascriptExtensionRE = /\.(?:[tj]sx?|[cm][tj]s)$/;
26022
26016
  const ERR_DENIED_FILE = "ERR_DENIED_FILE";
26023
26017
  const sirvOptions = ({ config, getHeaders, disableFsServeCheck }) => {
@@ -26045,7 +26039,7 @@ const sirvOptions = ({ config, getHeaders, disableFsServeCheck }) => {
26045
26039
  };
26046
26040
  function servePublicMiddleware(server, publicFiles) {
26047
26041
  const dir = server.config.publicDir;
26048
- const serve = build_default(dir, sirvOptions({
26042
+ const serve = build_default$1(dir, sirvOptions({
26049
26043
  config: server.config,
26050
26044
  getHeaders: () => server.config.server.headers,
26051
26045
  disableFsServeCheck: true
@@ -26058,13 +26052,13 @@ function servePublicMiddleware(server, publicFiles) {
26058
26052
  return normalizePath(filePath);
26059
26053
  };
26060
26054
  return function viteServePublicMiddleware(req$1, res, next) {
26061
- if (publicFiles && !publicFiles.has(toFilePath(req$1.url)) || isImportRequest(req$1.url) || isInternalRequest(req$1.url) || urlRE.test(req$1.url)) return next();
26055
+ if (publicFiles && !publicFiles.has(toFilePath(req$1.url)) || isImportRequest(req$1.url) || isInternalRequest(req$1.url) || urlRE$1.test(req$1.url)) return next();
26062
26056
  serve(req$1, res, next);
26063
26057
  };
26064
26058
  }
26065
26059
  function serveStaticMiddleware(server) {
26066
26060
  const dir = server.config.root;
26067
- const serve = build_default(dir, sirvOptions({
26061
+ const serve = build_default$1(dir, sirvOptions({
26068
26062
  config: server.config,
26069
26063
  getHeaders: () => server.config.server.headers
26070
26064
  }));
@@ -26101,7 +26095,7 @@ function serveStaticMiddleware(server) {
26101
26095
  };
26102
26096
  }
26103
26097
  function serveRawFsMiddleware(server) {
26104
- const serveFromRoot = build_default("/", sirvOptions({
26098
+ const serveFromRoot = build_default$1("/", sirvOptions({
26105
26099
  config: server.config,
26106
26100
  getHeaders: () => server.config.server.headers
26107
26101
  }));
@@ -26186,8 +26180,7 @@ function renderRestrictedErrorHTML(msg) {
26186
26180
 
26187
26181
  //#endregion
26188
26182
  //#region src/node/server/transformRequest.ts
26189
- var import_etag$2 = /* @__PURE__ */ __toESM(require_etag(), 1);
26190
- var import_picocolors$16 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
26183
+ var import_etag = /* @__PURE__ */ __toESM(require_etag(), 1);
26191
26184
  const ERR_LOAD_URL = "ERR_LOAD_URL";
26192
26185
  const ERR_LOAD_PUBLIC_URL = "ERR_LOAD_PUBLIC_URL";
26193
26186
  const ERR_DENIED_ID = "ERR_DENIED_ID";
@@ -26291,7 +26284,7 @@ async function loadAndTransform(environment, id, url$4, options, timestamp, mod,
26291
26284
  }
26292
26285
  } else {
26293
26286
  debugLoad?.(`${timeFrom(loadStart)} [plugin] ${prettyUrl}`);
26294
- if (isObject(loadResult)) {
26287
+ if (isObject$1(loadResult)) {
26295
26288
  code = loadResult.code;
26296
26289
  map$1 = loadResult.map;
26297
26290
  moduleType = loadResult.moduleType;
@@ -26320,7 +26313,7 @@ async function loadAndTransform(environment, id, url$4, options, timestamp, mod,
26320
26313
  moduleType
26321
26314
  });
26322
26315
  const originalCode = code;
26323
- if (transformResult.code === originalCode) debugTransform?.(timeFrom(transformStart) + import_picocolors$16.default.dim(` [skipped] ${prettyUrl}`));
26316
+ if (transformResult.code === originalCode) debugTransform?.(timeFrom(transformStart) + import_picocolors.default.dim(` [skipped] ${prettyUrl}`));
26324
26317
  else {
26325
26318
  debugTransform?.(`${timeFrom(transformStart)} ${prettyUrl}`);
26326
26319
  code = transformResult.code;
@@ -26352,7 +26345,7 @@ async function loadAndTransform(environment, id, url$4, options, timestamp, mod,
26352
26345
  const result = environment.config.dev.moduleRunnerTransform ? await ssrTransform(code, normalizedMap, url$4, originalCode, { json: { stringify: topLevelConfig.json.stringify === true && topLevelConfig.json.namedExports !== true } }) : {
26353
26346
  code,
26354
26347
  map: normalizedMap,
26355
- etag: (0, import_etag$2.default)(code, { weak: true })
26348
+ etag: (0, import_etag.default)(code, { weak: true })
26356
26349
  };
26357
26350
  if (timestamp > mod.lastInvalidationTimestamp) moduleGraph.updateModuleTransformResult(mod, result);
26358
26351
  return result;
@@ -26375,7 +26368,7 @@ async function handleModuleSoftInvalidation(environment, mod, timestamp) {
26375
26368
  await init;
26376
26369
  const source = transformResult.code;
26377
26370
  const s = new MagicString(source);
26378
- const [imports] = parse$1(source, mod.id || void 0);
26371
+ const [imports] = parse$3(source, mod.id || void 0);
26379
26372
  for (const imp of imports) {
26380
26373
  let rawUrl = source.slice(imp.s, imp.e);
26381
26374
  if (rawUrl === "import.meta") continue;
@@ -26399,7 +26392,7 @@ async function handleModuleSoftInvalidation(environment, mod, timestamp) {
26399
26392
  result = {
26400
26393
  ...transformResult,
26401
26394
  code,
26402
- etag: (0, import_etag$2.default)(code, { weak: true })
26395
+ etag: (0, import_etag.default)(code, { weak: true })
26403
26396
  };
26404
26397
  }
26405
26398
  if (timestamp > mod.lastInvalidationTimestamp) environment.moduleGraph.updateModuleTransformResult(mod, result);
@@ -26428,7 +26421,6 @@ function getModuleTypeFromId(id) {
26428
26421
 
26429
26422
  //#endregion
26430
26423
  //#region src/node/server/warmup.ts
26431
- var import_picocolors$15 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
26432
26424
  function warmupFiles(server, environment) {
26433
26425
  const { root } = server.config;
26434
26426
  mapFiles(environment.config.dev.warmup, root).then((files) => {
@@ -26442,13 +26434,13 @@ async function warmupFile(server, environment, file) {
26442
26434
  const html = await fsp.readFile(file, "utf-8");
26443
26435
  await server.transformIndexHtml(url$4, html);
26444
26436
  } catch (e$1) {
26445
- environment.logger.error(`Pre-transform error (${import_picocolors$15.default.cyan(file)}): ${e$1.message}`, {
26437
+ environment.logger.error(`Pre-transform error (${import_picocolors.default.cyan(file)}): ${e$1.message}`, {
26446
26438
  error: e$1,
26447
26439
  timestamp: true
26448
26440
  });
26449
26441
  }
26450
26442
  } else {
26451
- const url$4 = fileToUrl$1(file, server.config.root);
26443
+ const url$4 = fileToUrl(file, server.config.root);
26452
26444
  await environment.warmupRequest(url$4);
26453
26445
  }
26454
26446
  }
@@ -26457,7 +26449,7 @@ function htmlFileToUrl(file, root) {
26457
26449
  if (url$4[0] === ".") return;
26458
26450
  return "/" + normalizePath(url$4);
26459
26451
  }
26460
- function fileToUrl$1(file, root) {
26452
+ function fileToUrl(file, root) {
26461
26453
  const url$4 = path.relative(root, file);
26462
26454
  if (url$4[0] === ".") return path.posix.join(FS_PREFIX, normalizePath(file));
26463
26455
  return "/" + normalizePath(url$4);
@@ -26480,7 +26472,6 @@ async function mapFiles(files, root) {
26480
26472
 
26481
26473
  //#endregion
26482
26474
  //#region src/node/server/environment.ts
26483
- var import_picocolors$14 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
26484
26475
  var DevEnvironment = class extends BaseEnvironment {
26485
26476
  mode = "dev";
26486
26477
  moduleGraph;
@@ -26599,7 +26590,7 @@ var DevEnvironment = class extends BaseEnvironment {
26599
26590
  const mod = this.moduleGraph.urlToModuleMap.get(m.path);
26600
26591
  if (mod && mod.isSelfAccepting && mod.lastHMRTimestamp > 0 && !mod.lastHMRInvalidationReceived) {
26601
26592
  mod.lastHMRInvalidationReceived = true;
26602
- this.logger.info(import_picocolors$14.default.yellow(`hmr invalidate `) + import_picocolors$14.default.dim(m.path) + (m.message ? ` ${m.message}` : ""), { timestamp: true });
26593
+ this.logger.info(import_picocolors.default.yellow(`hmr invalidate `) + import_picocolors.default.dim(m.path) + (m.message ? ` ${m.message}` : ""), { timestamp: true });
26603
26594
  const file = getShortName(mod.file, this.config.root);
26604
26595
  updateModules(this, file, [...mod.importers].filter((imp) => imp !== mod), mod.lastHMRTimestamp, m.firstInvalidatedBy);
26605
26596
  }
@@ -26680,8 +26671,6 @@ function setupOnCrawlEnd() {
26680
26671
 
26681
26672
  //#endregion
26682
26673
  //#region src/node/server/environments/fullBundleEnvironment.ts
26683
- var import_picocolors$13 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
26684
- var import_etag$1 = /* @__PURE__ */ __toESM(require_etag(), 1);
26685
26674
  const debug$8 = createDebugger("vite:full-bundle-mode");
26686
26675
  var MemoryFiles = class {
26687
26676
  files = /* @__PURE__ */ new Map();
@@ -26717,7 +26706,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
26717
26706
  type: "full-reload",
26718
26707
  path: "*"
26719
26708
  });
26720
- this.logger.info(import_picocolors$13.default.green(`page reload`), { timestamp: true });
26709
+ this.logger.info(import_picocolors.default.green(`page reload`), { timestamp: true });
26721
26710
  });
26722
26711
  memoryFiles = new MemoryFiles();
26723
26712
  constructor(name, config, context) {
@@ -26766,7 +26755,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
26766
26755
  },
26767
26756
  onOutput: (result) => {
26768
26757
  if (result instanceof Error) {
26769
- this.logger.error(import_picocolors$13.default.red(`✘ Build error: ${result.message}`), { error: result });
26758
+ this.logger.error(import_picocolors.default.red(`✘ Build error: ${result.message}`), { error: result });
26770
26759
  this.hot.send({
26771
26760
  type: "error",
26772
26761
  err: prepareError(result)
@@ -26777,7 +26766,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
26777
26766
  const source = outputFile.type === "chunk" ? outputFile.code : outputFile.source;
26778
26767
  return {
26779
26768
  source,
26780
- etag: (0, import_etag$1.default)(Buffer.from(source), { weak: true })
26769
+ etag: (0, import_etag.default)(Buffer.from(source), { weak: true })
26781
26770
  };
26782
26771
  });
26783
26772
  },
@@ -26826,7 +26815,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
26826
26815
  return;
26827
26816
  }
26828
26817
  if (!update) return;
26829
- if (update.type === "Patch") this.logger.info(import_picocolors$13.default.yellow(`hmr invalidate `) + import_picocolors$13.default.dim(m.path) + (m.message ? ` ${m.message}` : ""), { timestamp: true });
26818
+ if (update.type === "Patch") this.logger.info(import_picocolors.default.yellow(`hmr invalidate `) + import_picocolors.default.dim(m.path) + (m.message ? ` ${m.message}` : ""), { timestamp: true });
26830
26819
  this.handleHmrOutput(client, [m.path], update, { firstInvalidatedBy: m.firstInvalidatedBy });
26831
26820
  })();
26832
26821
  }
@@ -26849,7 +26838,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
26849
26838
  const chunkMetadataMap = new ChunkMetadataMap();
26850
26839
  const rolldownOptions = resolveRolldownOptions(this, chunkMetadataMap);
26851
26840
  rolldownOptions.experimental ??= {};
26852
- rolldownOptions.experimental.hmr = { implement: await getHmrImplementation(this.getTopLevelConfig()) };
26841
+ rolldownOptions.experimental.devMode = { implement: await getHmrImplementation(this.getTopLevelConfig()) };
26853
26842
  if (rolldownOptions.optimization) rolldownOptions.optimization.inlineConst = false;
26854
26843
  if (Array.isArray(rolldownOptions.output)) for (const output of rolldownOptions.output) {
26855
26844
  output.entryFileNames = "assets/[name].js";
@@ -26872,8 +26861,8 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
26872
26861
  if (hmrOutput.type === "Noop") return;
26873
26862
  const shortFile = files.map((file) => getShortName(file, this.config.root)).join(", ");
26874
26863
  if (hmrOutput.type === "FullReload") {
26875
- const reason = hmrOutput.reason ? import_picocolors$13.default.dim(` (${hmrOutput.reason})`) : "";
26876
- this.logger.info(import_picocolors$13.default.green(`trigger page reload `) + import_picocolors$13.default.dim(shortFile) + reason, {
26864
+ const reason = hmrOutput.reason ? import_picocolors.default.dim(` (${hmrOutput.reason})`) : "";
26865
+ this.logger.info(import_picocolors.default.green(`trigger page reload `) + import_picocolors.default.dim(shortFile) + reason, {
26877
26866
  clear: !invalidateInformation,
26878
26867
  timestamp: true
26879
26868
  });
@@ -26902,7 +26891,7 @@ var FullBundleDevEnvironment = class extends DevEnvironment {
26902
26891
  type: "update",
26903
26892
  updates
26904
26893
  });
26905
- this.logger.info(import_picocolors$13.default.green(`hmr update `) + import_picocolors$13.default.dim([...new Set(updates.map((u) => u.path))].join(", ")), {
26894
+ this.logger.info(import_picocolors.default.green(`hmr update `) + import_picocolors.default.dim([...new Set(updates.map((u) => u.path))].join(", ")), {
26906
26895
  clear: !invalidateInformation,
26907
26896
  timestamp: true
26908
26897
  });
@@ -26991,10 +26980,8 @@ function htmlFallbackMiddleware(root, spaFallback, clientEnvironment) {
26991
26980
 
26992
26981
  //#endregion
26993
26982
  //#region src/node/server/send.ts
26994
- var import_convert_source_map = /* @__PURE__ */ __toESM(require_convert_source_map(), 1);
26995
- var import_etag = /* @__PURE__ */ __toESM(require_etag(), 1);
26996
26983
  const debug$6 = createDebugger("vite:send", { onlyWhenFocused: true });
26997
- const alias$1 = {
26984
+ const alias = {
26998
26985
  js: "text/javascript",
26999
26986
  css: "text/css",
27000
26987
  html: "text/html",
@@ -27008,7 +26995,7 @@ function send(req$1, res, content, type, options) {
27008
26995
  res.end();
27009
26996
  return;
27010
26997
  }
27011
- res.setHeader("Content-Type", alias$1[type] || type);
26998
+ res.setHeader("Content-Type", alias[type] || type);
27012
26999
  res.setHeader("Cache-Control", cacheControl);
27013
27000
  res.setHeader("Etag", etag);
27014
27001
  if (headers) for (const name in headers) res.setHeader(name, headers[name]);
@@ -27033,7 +27020,6 @@ function send(req$1, res, content, type, options) {
27033
27020
 
27034
27021
  //#endregion
27035
27022
  //#region src/node/server/middlewares/transform.ts
27036
- var import_picocolors$12 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
27037
27023
  const debugCache = createDebugger("vite:cache");
27038
27024
  const knownIgnoreList = new Set(["/", "/favicon.ico"]);
27039
27025
  const documentFetchDests = new Set([
@@ -27046,12 +27032,12 @@ function isDocumentFetchDest(req$1) {
27046
27032
  const fetchDest = req$1.headers["sec-fetch-dest"];
27047
27033
  return fetchDest !== void 0 && documentFetchDests.has(fetchDest);
27048
27034
  }
27049
- const urlRE$1 = /[?&]url\b/;
27050
- const rawRE$1 = /[?&]raw\b/;
27035
+ const urlRE = /[?&]url\b/;
27036
+ const rawRE = /[?&]raw\b/;
27051
27037
  const inlineRE$1 = /[?&]inline\b/;
27052
27038
  const svgRE = /\.svg\b/;
27053
27039
  function isServerAccessDeniedForTransform(config, id) {
27054
- if (rawRE$1.test(id) || urlRE$1.test(id) || inlineRE$1.test(id) || svgRE.test(id)) return checkLoadingAccess(config, id) !== "allowed";
27040
+ if (rawRE.test(id) || urlRE.test(id) || inlineRE$1.test(id) || svgRE.test(id)) return checkLoadingAccess(config, id) !== "allowed";
27055
27041
  return false;
27056
27042
  }
27057
27043
  /**
@@ -27090,7 +27076,7 @@ function transformMiddleware(server) {
27090
27076
  url$4 = decodeURI(removeTimestampQuery(req$1.url)).replace(NULL_BYTE_PLACEHOLDER, "\0");
27091
27077
  } catch (e$1) {
27092
27078
  if (e$1 instanceof URIError) {
27093
- server.config.logger.warn(import_picocolors$12.default.yellow(`Malformed URI sequence in request URL: ${removeTimestampQuery(req$1.url)}`));
27079
+ server.config.logger.warn(import_picocolors.default.yellow(`Malformed URI sequence in request URL: ${removeTimestampQuery(req$1.url)}`));
27094
27080
  return next();
27095
27081
  }
27096
27082
  return next(e$1);
@@ -27182,7 +27168,7 @@ function transformMiddleware(server) {
27182
27168
  res.statusCode = 404;
27183
27169
  res.end();
27184
27170
  }
27185
- server.config.logger.warn(import_picocolors$12.default.yellow(e$1.message));
27171
+ server.config.logger.warn(import_picocolors.default.yellow(e$1.message));
27186
27172
  return;
27187
27173
  }
27188
27174
  if (e$1?.code === ERR_LOAD_URL) return next();
@@ -27207,11 +27193,11 @@ function transformMiddleware(server) {
27207
27193
  let warning;
27208
27194
  if (isImportRequest(url$4)) {
27209
27195
  const rawUrl = removeImportQuery(url$4);
27210
- if (urlRE$1.test(url$4)) warning = `Assets in the public directory are served at the root path.\nInstead of ${import_picocolors$12.default.cyan(rawUrl)}, use ${import_picocolors$12.default.cyan(rawUrl.replace(publicPath, "/"))}.`;
27196
+ if (urlRE.test(url$4)) warning = `Assets in the public directory are served at the root path.\nInstead of ${import_picocolors.default.cyan(rawUrl)}, use ${import_picocolors.default.cyan(rawUrl.replace(publicPath, "/"))}.`;
27211
27197
  else warning = `Assets in public directory cannot be imported from JavaScript.
27212
- If you intend to import that asset, put the file in the src directory, and use ${import_picocolors$12.default.cyan(rawUrl.replace(publicPath, "/src/"))} instead of ${import_picocolors$12.default.cyan(rawUrl)}.\nIf you intend to use the URL of that asset, use ${import_picocolors$12.default.cyan(injectQuery(rawUrl.replace(publicPath, "/"), "url"))}.`;
27213
- } else warning = `Files in the public directory are served at the root path.\nInstead of ${import_picocolors$12.default.cyan(url$4)}, use ${import_picocolors$12.default.cyan(url$4.replace(publicPath, "/"))}.`;
27214
- server.config.logger.warn(import_picocolors$12.default.yellow(warning));
27198
+ If you intend to import that asset, put the file in the src directory, and use ${import_picocolors.default.cyan(rawUrl.replace(publicPath, "/src/"))} instead of ${import_picocolors.default.cyan(rawUrl)}.\nIf you intend to use the URL of that asset, use ${import_picocolors.default.cyan(injectQuery(rawUrl.replace(publicPath, "/"), "url"))}.`;
27199
+ } else warning = `Files in the public directory are served at the root path.\nInstead of ${import_picocolors.default.cyan(url$4)}, use ${import_picocolors.default.cyan(url$4.replace(publicPath, "/"))}.`;
27200
+ server.config.logger.warn(import_picocolors.default.yellow(warning));
27215
27201
  }
27216
27202
  }
27217
27203
 
@@ -28035,9 +28021,9 @@ function memoryFilesMiddleware(server) {
28035
28021
  */
28036
28022
  function rejectNoCorsRequestMiddleware() {
28037
28023
  return function viteRejectNoCorsRequestMiddleware(req$1, res, next) {
28038
- if (req$1.headers["sec-fetch-mode"] === "no-cors" && req$1.headers["sec-fetch-site"] !== "same-origin") {
28024
+ if (req$1.headers["sec-fetch-mode"] === "no-cors" && req$1.headers["sec-fetch-site"] !== "same-origin" && req$1.headers["sec-fetch-dest"] === "script") {
28039
28025
  res.statusCode = 403;
28040
- res.end("Cross-origin requests must be made with CORS mode enabled.");
28026
+ res.end("Cross-origin requests for classic scripts must be made with CORS mode enabled. Make sure to set the \"crossorigin\" attribute on your <script> tag.");
28041
28027
  return;
28042
28028
  }
28043
28029
  return next();
@@ -28046,9 +28032,8 @@ function rejectNoCorsRequestMiddleware() {
28046
28032
 
28047
28033
  //#endregion
28048
28034
  //#region src/node/server/index.ts
28049
- var import_connect$1 = /* @__PURE__ */ __toESM(require_connect(), 1);
28050
- var import_lib$1 = /* @__PURE__ */ __toESM(require_lib$1(), 1);
28051
- var import_picocolors$11 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
28035
+ var import_connect = /* @__PURE__ */ __toESM(require_connect(), 1);
28036
+ var import_lib = /* @__PURE__ */ __toESM(require_lib$1(), 1);
28052
28037
  var import_chokidar = /* @__PURE__ */ __toESM(require_chokidar(), 1);
28053
28038
  var import_launch_editor_middleware = /* @__PURE__ */ __toESM(require_launch_editor_middleware(), 1);
28054
28039
  const usedConfigs = /* @__PURE__ */ new WeakSet();
@@ -28070,7 +28055,7 @@ async function _createServer(inlineConfig = {}, options) {
28070
28055
  disableGlobbing: true,
28071
28056
  ...serverConfig.watch
28072
28057
  }, resolvedOutDirs, emptyOutDir, config.cacheDir);
28073
- const middlewares = (0, import_connect$1.default)();
28058
+ const middlewares = (0, import_connect.default)();
28074
28059
  const httpServer = middlewareMode ? null : await resolveHttpServer(middlewares, httpsOptions);
28075
28060
  const ws = createWebSocketServer(httpServer, config, httpsOptions);
28076
28061
  const publicFiles = await initPublicFilesPromise;
@@ -28166,7 +28151,7 @@ async function _createServer(inlineConfig = {}, options) {
28166
28151
  },
28167
28152
  ssrRewriteStacktrace(stack) {
28168
28153
  warnFutureDeprecation(config, "removeSsrLoadModule", "ssrRewriteStacktrace doesn't need to be used for Environment Module Runners.");
28169
- return ssrRewriteStacktrace(stack, server.environments.ssr.moduleGraph);
28154
+ return ssrRewriteStacktrace(stack, server.environments.ssr.moduleGraph).result;
28170
28155
  },
28171
28156
  async reloadModule(module$1) {
28172
28157
  warnFutureDeprecation(config, "removeServerReloadModule");
@@ -28290,7 +28275,7 @@ async function _createServer(inlineConfig = {}, options) {
28290
28275
  middlewares.use(rejectInvalidRequestMiddleware());
28291
28276
  middlewares.use(rejectNoCorsRequestMiddleware());
28292
28277
  const { cors } = serverConfig;
28293
- if (cors !== false) middlewares.use((0, import_lib$1.default)(typeof cors === "boolean" ? {} : cors));
28278
+ if (cors !== false) middlewares.use((0, import_lib.default)(typeof cors === "boolean" ? {} : cors));
28294
28279
  const { allowedHosts } = serverConfig;
28295
28280
  if (allowedHosts !== true && !serverConfig.https) middlewares.use(hostValidationMiddleware(allowedHosts, false));
28296
28281
  const configureServerContext = new BasicMinimalPluginContext({
@@ -28302,7 +28287,7 @@ async function _createServer(inlineConfig = {}, options) {
28302
28287
  if (!config.experimental.bundledDev) middlewares.use(cachedTransformMiddleware(server));
28303
28288
  const { proxy } = serverConfig;
28304
28289
  if (proxy) {
28305
- const middlewareServer = (isObject(middlewareMode) ? middlewareMode.server : null) || httpServer;
28290
+ const middlewareServer = (isObject$1(middlewareMode) ? middlewareMode.server : null) || httpServer;
28306
28291
  middlewares.use(proxyMiddleware(middlewareServer, proxy, config));
28307
28292
  }
28308
28293
  if (config.base !== "/") middlewares.use(baseMiddleware(config.rawBase, !!middlewareMode));
@@ -28424,7 +28409,7 @@ function resolveServerOptions(root, raw, logger) {
28424
28409
  const _server = mergeWithDefaults({
28425
28410
  ..._serverConfigDefaults,
28426
28411
  host: void 0,
28427
- sourcemapIgnoreList: isInNodeModules
28412
+ sourcemapIgnoreList: isInNodeModules$1
28428
28413
  }, raw ?? {});
28429
28414
  const server = {
28430
28415
  ..._server,
@@ -28450,7 +28435,7 @@ function resolveServerOptions(root, raw, logger) {
28450
28435
  server.fs.allow = allowDirs;
28451
28436
  if (server.origin?.endsWith("/")) {
28452
28437
  server.origin = server.origin.slice(0, -1);
28453
- logger.warn(import_picocolors$11.default.yellow(`${import_picocolors$11.default.bold("(!)")} server.origin should not end with "/". Using "${server.origin}" instead.`));
28438
+ logger.warn(import_picocolors.default.yellow(`${import_picocolors.default.bold("(!)")} server.origin should not end with "/". Using "${server.origin}" instead.`));
28454
28439
  }
28455
28440
  if (process.env.__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS && Array.isArray(server.allowedHosts)) {
28456
28441
  const additionalHost = process.env.__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS;
@@ -28511,7 +28496,6 @@ async function restartServerWithUrls(server) {
28511
28496
 
28512
28497
  //#endregion
28513
28498
  //#region src/node/server/hmr.ts
28514
- var import_picocolors$10 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
28515
28499
  const debugHmr = createDebugger("vite:hmr");
28516
28500
  const whitespaceRE = /\s/;
28517
28501
  const normalizedClientDir = normalizePath(CLIENT_DIR);
@@ -28655,19 +28639,19 @@ async function handleHMRUpdate(type, file, server) {
28655
28639
  const isConfigDependency = config.configFileDependencies.some((name) => file === name);
28656
28640
  const isEnv = config.envDir !== false && getEnvFilesForMode(config.mode, config.envDir).includes(file);
28657
28641
  if (isConfig || isConfigDependency || isEnv) {
28658
- debugHmr?.(`[config change] ${import_picocolors$10.default.dim(shortFile)}`);
28659
- config.logger.info(import_picocolors$10.default.green(`${normalizePath(path.relative(process.cwd(), file))} changed, restarting server...`), {
28642
+ debugHmr?.(`[config change] ${import_picocolors.default.dim(shortFile)}`);
28643
+ config.logger.info(import_picocolors.default.green(`${normalizePath(path.relative(process.cwd(), file))} changed, restarting server...`), {
28660
28644
  clear: true,
28661
28645
  timestamp: true
28662
28646
  });
28663
28647
  try {
28664
28648
  await restartServerWithUrls(server);
28665
28649
  } catch (e$1) {
28666
- config.logger.error(import_picocolors$10.default.red(e$1));
28650
+ config.logger.error(import_picocolors.default.red(e$1));
28667
28651
  }
28668
28652
  return;
28669
28653
  }
28670
- debugHmr?.(`[file change] ${import_picocolors$10.default.dim(shortFile)}`);
28654
+ debugHmr?.(`[file change] ${import_picocolors.default.dim(shortFile)}`);
28671
28655
  if (file.startsWith(withTrailingSlash(normalizedClientDir))) {
28672
28656
  environments.forEach(({ hot }) => hot.send({
28673
28657
  type: "full-reload",
@@ -28752,7 +28736,7 @@ async function handleHMRUpdate(type, file, server) {
28752
28736
  if (error$1) throw error$1;
28753
28737
  if (!options.modules.length) {
28754
28738
  if (file.endsWith(".html") && environment.name === "client") {
28755
- environment.logger.info(import_picocolors$10.default.green(`page reload `) + import_picocolors$10.default.dim(shortFile), {
28739
+ environment.logger.info(import_picocolors.default.green(`page reload `) + import_picocolors.default.dim(shortFile), {
28756
28740
  clear: true,
28757
28741
  timestamp: true
28758
28742
  });
@@ -28760,7 +28744,7 @@ async function handleHMRUpdate(type, file, server) {
28760
28744
  type: "full-reload",
28761
28745
  path: config.server.middlewareMode ? "*" : "/" + normalizePath(path.relative(config.root, file))
28762
28746
  });
28763
- } else debugHmr?.(`(${environment.name}) [no modules matched] ${import_picocolors$10.default.dim(shortFile)}`);
28747
+ } else debugHmr?.(`(${environment.name}) [no modules matched] ${import_picocolors.default.dim(shortFile)}`);
28764
28748
  return;
28765
28749
  }
28766
28750
  updateModules(environment, shortFile, options.modules, timestamp);
@@ -28806,8 +28790,8 @@ function updateModules(environment, file, modules, timestamp, firstInvalidatedBy
28806
28790
  }
28807
28791
  const isClientHtmlChange = file.endsWith(".html") && environment.name === "client" && modules.every((mod) => mod.type !== "js");
28808
28792
  if (needFullReload || isClientHtmlChange) {
28809
- const reason = typeof needFullReload === "string" ? import_picocolors$10.default.dim(` (${needFullReload})`) : "";
28810
- environment.logger.info(import_picocolors$10.default.green(`page reload `) + import_picocolors$10.default.dim(file) + reason, {
28793
+ const reason = typeof needFullReload === "string" ? import_picocolors.default.dim(` (${needFullReload})`) : "";
28794
+ environment.logger.info(import_picocolors.default.green(`page reload `) + import_picocolors.default.dim(file) + reason, {
28811
28795
  clear: !firstInvalidatedBy,
28812
28796
  timestamp: true
28813
28797
  });
@@ -28819,10 +28803,10 @@ function updateModules(environment, file, modules, timestamp, firstInvalidatedBy
28819
28803
  return;
28820
28804
  }
28821
28805
  if (updates.length === 0) {
28822
- debugHmr?.(import_picocolors$10.default.yellow(`no update happened `) + import_picocolors$10.default.dim(file));
28806
+ debugHmr?.(import_picocolors.default.yellow(`no update happened `) + import_picocolors.default.dim(file));
28823
28807
  return;
28824
28808
  }
28825
- environment.logger.info(import_picocolors$10.default.green(`hmr update `) + import_picocolors$10.default.dim([...new Set(updates.map((u) => u.path))].join(", ")), {
28809
+ environment.logger.info(import_picocolors.default.green(`hmr update `) + import_picocolors.default.dim([...new Set(updates.map((u) => u.path))].join(", ")), {
28826
28810
  clear: !firstInvalidatedBy,
28827
28811
  timestamp: true
28828
28812
  });
@@ -28839,7 +28823,7 @@ function propagateUpdate(node, traversedModules, boundaries, currentChain = [nod
28839
28823
  if (traversedModules.has(node)) return false;
28840
28824
  traversedModules.add(node);
28841
28825
  if (node.id && node.isSelfAccepting === void 0) {
28842
- debugHmr?.(`[propagate update] stop propagation because not analyzed: ${import_picocolors$10.default.dim(node.id)}`);
28826
+ debugHmr?.(`[propagate update] stop propagation because not analyzed: ${import_picocolors.default.dim(node.id)}`);
28843
28827
  return false;
28844
28828
  }
28845
28829
  if (node.isSelfAccepting) {
@@ -28900,7 +28884,7 @@ function isNodeWithinCircularImports(node, nodeChain, currentChain = [node], tra
28900
28884
  ...[...currentChain].reverse(),
28901
28885
  ...nodeChain.slice(importerIndex, -1).reverse()
28902
28886
  ];
28903
- debugHmr(import_picocolors$10.default.yellow(`circular imports detected: `) + importChain.map((m) => import_picocolors$10.default.dim(m.url)).join(" -> "));
28887
+ debugHmr(import_picocolors.default.yellow(`circular imports detected: `) + importChain.map((m) => import_picocolors.default.dim(m.url)).join(" -> "));
28904
28888
  }
28905
28889
  return true;
28906
28890
  }
@@ -28916,7 +28900,7 @@ function handlePrunedModules(mods, { hot }) {
28916
28900
  mods.forEach((mod) => {
28917
28901
  mod.lastHMRTimestamp = t$1;
28918
28902
  mod.lastHMRInvalidationReceived = false;
28919
- debugHmr?.(`[dispose] ${import_picocolors$10.default.dim(mod.file)}`);
28903
+ debugHmr?.(`[dispose] ${import_picocolors.default.dim(mod.file)}`);
28920
28904
  });
28921
28905
  hot.send({
28922
28906
  type: "prune",
@@ -29067,7 +29051,7 @@ function createIsConfiguredAsExternal(environment) {
29067
29051
  const { config } = environment;
29068
29052
  const { root, resolve: resolve$4 } = config;
29069
29053
  const { external, noExternal } = resolve$4;
29070
- const noExternalFilter = typeof noExternal !== "boolean" && !(Array.isArray(noExternal) && noExternal.length === 0) && createFilter(void 0, noExternal, { resolve: false });
29054
+ const noExternalFilter = typeof noExternal !== "boolean" && !(Array.isArray(noExternal) && noExternal.length === 0) && createFilter$1(void 0, noExternal, { resolve: false });
29071
29055
  const targetConditions = resolve$4.externalConditions;
29072
29056
  const resolveOptions = {
29073
29057
  ...resolve$4,
@@ -29081,7 +29065,7 @@ function createIsConfiguredAsExternal(environment) {
29081
29065
  try {
29082
29066
  const resolved = tryNodeResolve(id, config.command === "build" ? void 0 : importer, resolveOptions, void 0, false);
29083
29067
  if (!resolved) return false;
29084
- if (!configuredAsExternal && !isInNodeModules(resolved.id)) return false;
29068
+ if (!configuredAsExternal && !isInNodeModules$1(resolved.id)) return false;
29085
29069
  return canExternalizeFile(resolved.id);
29086
29070
  } catch {
29087
29071
  debug$5?.(`Failed to node resolve "${id}". Skipping externalizing it by default.`);
@@ -29116,7 +29100,6 @@ function canExternalizeFile(filePath) {
29116
29100
 
29117
29101
  //#endregion
29118
29102
  //#region src/node/plugins/worker.ts
29119
- var import_picocolors$9 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
29120
29103
  var WorkerOutputCache = class {
29121
29104
  /**
29122
29105
  * worker bundle information for each input id
@@ -29142,7 +29125,7 @@ var WorkerOutputCache = class {
29142
29125
  saveAsset(asset, logger) {
29143
29126
  const duplicateAsset = this.assets.get(asset.fileName);
29144
29127
  if (duplicateAsset) {
29145
- if (!isSameContent(duplicateAsset.source, asset.source)) logger.warn(`\n` + import_picocolors$9.default.yellow(`The emitted file ${JSON.stringify(asset.fileName)} overwrites a previously emitted file of the same name.`));
29128
+ if (!isSameContent(duplicateAsset.source, asset.source)) logger.warn(`\n` + import_picocolors.default.yellow(`The emitted file ${JSON.stringify(asset.fileName)} overwrites a previously emitted file of the same name.`));
29146
29129
  }
29147
29130
  this.assets.set(asset.fileName, asset);
29148
29131
  }
@@ -29272,7 +29255,7 @@ function webWorkerPostPlugin(config) {
29272
29255
  await init;
29273
29256
  let imports;
29274
29257
  try {
29275
- imports = parse$1(code)[0];
29258
+ imports = parse$3(code)[0];
29276
29259
  } catch {
29277
29260
  return;
29278
29261
  }
@@ -29366,11 +29349,11 @@ function webWorkerPlugin(config) {
29366
29349
  for (const file of result.watchedFiles) this.addWatchFile(file);
29367
29350
  }
29368
29351
  else {
29369
- let url$4 = await fileToUrl(this, cleanUrl(id));
29352
+ let url$4 = await fileToUrl$1(this, cleanUrl(id));
29370
29353
  url$4 = injectQuery(url$4, `${WORKER_FILE_ID}&type=${workerType}`);
29371
29354
  urlCode = JSON.stringify(url$4);
29372
29355
  }
29373
- if (urlRE.test(id)) return {
29356
+ if (urlRE$1.test(id)) return {
29374
29357
  code: `export default ${urlCode}`,
29375
29358
  map: { mappings: "" }
29376
29359
  };
@@ -29494,7 +29477,7 @@ function preAliasPlugin(config) {
29494
29477
  if (resolved && !depsOptimizer.isOptimizedDepFile(resolved.id)) {
29495
29478
  const optimizeDeps$1 = depsOptimizer.options;
29496
29479
  const resolvedId = cleanUrl(resolved.id);
29497
- if (!(resolvedId === id || resolvedId.includes("\0")) && fs.existsSync(resolvedId) && !moduleListContains(optimizeDeps$1.exclude, id) && path.isAbsolute(resolvedId) && (isInNodeModules(resolvedId) || optimizeDeps$1.include?.includes(id)) && isOptimizable(resolvedId, optimizeDeps$1) && (!ssr || optimizeAliasReplacementForSSR(resolvedId, optimizeDeps$1))) {
29480
+ if (!(resolvedId === id || resolvedId.includes("\0")) && fs.existsSync(resolvedId) && !moduleListContains(optimizeDeps$1.exclude, id) && path.isAbsolute(resolvedId) && (isInNodeModules$1(resolvedId) || optimizeDeps$1.include?.includes(id)) && isOptimizable(resolvedId, optimizeDeps$1) && (!ssr || optimizeAliasReplacementForSSR(resolvedId, optimizeDeps$1))) {
29498
29481
  const optimizedInfo = depsOptimizer.registerMissingImport(id, resolvedId);
29499
29482
  return { id: depsOptimizer.getOptimizedDepId(optimizedInfo) };
29500
29483
  }
@@ -29526,7 +29509,6 @@ function getAliasPatternMatcher(entries) {
29526
29509
 
29527
29510
  //#endregion
29528
29511
  //#region src/node/plugins/importAnalysis.ts
29529
- var import_picocolors$8 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
29530
29512
  const debug$4 = createDebugger("vite:import-analysis");
29531
29513
  const clientDir = normalizePath(CLIENT_DIR);
29532
29514
  const skipRE = /\.(?:map|json)(?:$|\?)/;
@@ -29632,7 +29614,7 @@ function importAnalysisPlugin(config) {
29632
29614
  const ssr = environment.config.consumer === "server";
29633
29615
  const moduleGraph = environment.moduleGraph;
29634
29616
  if (canSkipImportAnalysis(importer)) {
29635
- debug$4?.(import_picocolors$8.default.dim(`[skipped] ${prettifyUrl(importer, root)}`));
29617
+ debug$4?.(import_picocolors.default.dim(`[skipped] ${prettifyUrl(importer, root)}`));
29636
29618
  return null;
29637
29619
  }
29638
29620
  const msAtStart = debug$4 ? performance$1.now() : 0;
@@ -29641,7 +29623,7 @@ function importAnalysisPlugin(config) {
29641
29623
  let exports$1;
29642
29624
  source = stripBomTag(source);
29643
29625
  try {
29644
- [imports, exports$1] = parse$1(source);
29626
+ [imports, exports$1] = parse$3(source);
29645
29627
  } catch (_e) {
29646
29628
  const e$1 = _e;
29647
29629
  const { message, showCodeFrame } = createParseErrorInfo(importer, source);
@@ -29652,7 +29634,7 @@ function importAnalysisPlugin(config) {
29652
29634
  if (!importerModule) throwOutdatedRequest(importer);
29653
29635
  if (!imports.length && !this._addedImports) {
29654
29636
  importerModule.isSelfAccepting = false;
29655
- debug$4?.(`${timeFrom(msAtStart)} ${import_picocolors$8.default.dim(`[no imports] ${prettifyUrl(importer, root)}`)}`);
29637
+ debug$4?.(`${timeFrom(msAtStart)} ${import_picocolors.default.dim(`[no imports] ${prettifyUrl(importer, root)}`)}`);
29656
29638
  return source;
29657
29639
  }
29658
29640
  let hasHMR = false;
@@ -29743,7 +29725,7 @@ function importAnalysisPlugin(config) {
29743
29725
  if (isBuiltin(environment.config.resolve.builtins, specifier)) return;
29744
29726
  }
29745
29727
  if (specifier === clientPublicPath) return;
29746
- if (specifier[0] === "/" && !(config.assetsInclude(cleanUrl(specifier)) || urlRE.test(specifier)) && checkPublicFile(specifier, config)) throw new Error(`Cannot import non-asset file ${specifier} which is inside /public. JS/CSS files inside /public are copied as-is on build and can only be referenced via <script src> or <link href> in html. If you want to get the URL of that file, use ${injectQuery(specifier, "url")} instead.`);
29728
+ if (specifier[0] === "/" && !(config.assetsInclude(cleanUrl(specifier)) || urlRE$1.test(specifier)) && checkPublicFile(specifier, config)) throw new Error(`Cannot import non-asset file ${specifier} which is inside /public. JS/CSS files inside /public are copied as-is on build and can only be referenced via <script src> or <link href> in html. If you want to get the URL of that file, use ${injectQuery(specifier, "url")} instead.`);
29747
29729
  let [url$4, resolvedId] = await normalizeUrl(specifier, start);
29748
29730
  resolvedId = resolvedId || url$4;
29749
29731
  config.safeModulePaths.add(fsPathFromUrl(stripBase(url$4, base)));
@@ -29754,7 +29736,7 @@ function importAnalysisPlugin(config) {
29754
29736
  const depInfo = optimizedDepInfoFromFile(depsOptimizer.metadata, file);
29755
29737
  const needsInterop$1 = await optimizedDepNeedsInterop(environment, depsOptimizer.metadata, file);
29756
29738
  if (needsInterop$1 === void 0) {
29757
- if (depInfo?.isDynamicEntry) config.logger.error(import_picocolors$8.default.red(`Vite Error, ${url$4} optimized info should be defined`));
29739
+ if (depInfo?.isDynamicEntry) config.logger.error(import_picocolors.default.red(`Vite Error, ${url$4} optimized info should be defined`));
29758
29740
  } else if (needsInterop$1) {
29759
29741
  debug$4?.(`${url$4} needs interop`);
29760
29742
  interopNamedImports(str(), importSpecifier, url$4, index, importer, isNodeMode(), config);
@@ -29780,8 +29762,8 @@ function importAnalysisPlugin(config) {
29780
29762
  environment.warmupRequest(url$5);
29781
29763
  }
29782
29764
  } else if (!importer.startsWith(withTrailingSlash(clientDir))) {
29783
- if (!isInNodeModules(importer)) {
29784
- if (!hasViteIgnoreRE.test(source.slice(dynamicIndex + 1, end))) this.warn(`\n` + import_picocolors$8.default.cyan(importerModule.file) + `\n` + import_picocolors$8.default.reset(generateCodeFrame(source, start, end)) + import_picocolors$8.default.yellow(`\nThe above dynamic import cannot be analyzed by Vite.\nSee ${import_picocolors$8.default.blue(`https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations`)} for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import() call to suppress this warning.\n`));
29765
+ if (!isInNodeModules$1(importer)) {
29766
+ if (!hasViteIgnoreRE.test(source.slice(dynamicIndex + 1, end))) this.warn(`\n` + import_picocolors.default.cyan(importerModule.file) + `\n` + import_picocolors.default.reset(generateCodeFrame(source, start, end)) + import_picocolors.default.yellow(`\nThe above dynamic import cannot be analyzed by Vite.\nSee ${import_picocolors.default.blue(`https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations`)} for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import() call to suppress this warning.\n`));
29785
29767
  }
29786
29768
  if (!ssr) {
29787
29769
  if (!urlIsStringRE.test(rawUrl) || isExplicitImportRequired(rawUrl.slice(1, -1))) {
@@ -29837,7 +29819,7 @@ function importAnalysisPlugin(config) {
29837
29819
  const prunedImports = await moduleGraph.updateModuleInfo(importerModule, importedUrls, importedBindings, normalizedAcceptedUrls, isPartiallySelfAccepting ? acceptedExports : null, isSelfAccepting, staticImportedUrls);
29838
29820
  if (prunedImports) handlePrunedModules(prunedImports, environment);
29839
29821
  }
29840
- debug$4?.(`${timeFrom(msAtStart)} ${import_picocolors$8.default.dim(`[${importedUrls.size} imports rewritten] ${prettifyUrl(importer, root)}`)}`);
29822
+ debug$4?.(`${timeFrom(msAtStart)} ${import_picocolors.default.dim(`[${importedUrls.size} imports rewritten] ${prettifyUrl(importer, root)}`)}`);
29841
29823
  if (s) return transformStableResult(s, importer, config);
29842
29824
  else return source;
29843
29825
  }
@@ -29895,7 +29877,7 @@ function getLineBreaks(str) {
29895
29877
  */
29896
29878
  function transformCjsImport(importExp, url$4, rawUrl, importIndex, importer, isNodeMode, config) {
29897
29879
  const node = parseAst(importExp).body[0];
29898
- if (config.command === "serve" && node.type === "ExportAllDeclaration" && !node.exported) config.logger.warn(import_picocolors$8.default.yellow(`\nUnable to interop \`${importExp}\` in ${importer}, this may lose module exports. Please export "${rawUrl}" as ESM or use named exports instead, e.g. \`export { A, B } from "${rawUrl}"\``));
29880
+ if (config.command === "serve" && node.type === "ExportAllDeclaration" && !node.exported) config.logger.warn(import_picocolors.default.yellow(`\nUnable to interop \`${importExp}\` in ${importer}, this may lose module exports. Please export "${rawUrl}" as ESM or use named exports instead, e.g. \`export { A, B } from "${rawUrl}"\``));
29899
29881
  else if (node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration") {
29900
29882
  if (!node.specifiers.length) return `import "${url$4}"`;
29901
29883
  const importNames = [];
@@ -29998,7 +29980,7 @@ const wasmHelperPlugin = (config) => {
29998
29980
  filter: { id: [exactRegex(wasmHelperId), wasmInitRE] },
29999
29981
  async handler(id) {
30000
29982
  if (id === wasmHelperId) return `export default ${wasmHelperCode}`;
30001
- const url$4 = await fileToUrl(this, id);
29983
+ const url$4 = await fileToUrl$1(this, id);
30002
29984
  return `
30003
29985
  import initWasm from "${wasmHelperId}"
30004
29986
  export default opts => initWasm(opts, ${JSON.stringify(url$4)})
@@ -30138,7 +30120,7 @@ function workerImportMetaUrlPlugin(config) {
30138
30120
  builtUrl = result.entryUrlPlaceholder;
30139
30121
  for (const file$1 of result.watchedFiles) this.addWatchFile(file$1);
30140
30122
  } else {
30141
- builtUrl = await fileToUrl(this, cleanUrl(file));
30123
+ builtUrl = await fileToUrl$1(this, cleanUrl(file));
30142
30124
  builtUrl = injectQuery(builtUrl, `${WORKER_FILE_ID}&type=${workerType}`);
30143
30125
  }
30144
30126
  s.update(expStart, expEnd, `new URL(/* @vite-ignore */ ${JSON.stringify(builtUrl)}, '' + import.meta.url)`);
@@ -30232,9 +30214,9 @@ function assetImportMetaUrlPlugin(config) {
30232
30214
  if (file) try {
30233
30215
  if (publicDir && isParentDirectory(publicDir, file)) {
30234
30216
  const publicPath = "/" + path.posix.relative(publicDir, file);
30235
- builtUrl = await fileToUrl(this, publicPath);
30217
+ builtUrl = await fileToUrl$1(this, publicPath);
30236
30218
  } else {
30237
- builtUrl = await fileToUrl(this, file);
30219
+ builtUrl = await fileToUrl$1(this, file);
30238
30220
  if (tryStatSync(file)?.isFile()) this.addWatchFile(file);
30239
30221
  }
30240
30222
  } catch {}
@@ -30355,7 +30337,7 @@ function parseDynamicImportPattern(strings) {
30355
30337
  let globParams = null;
30356
30338
  if (search) {
30357
30339
  search = "?" + search;
30358
- if (workerOrSharedWorkerRE.test(search) || urlRE.test(search) || rawRE.test(search)) globParams = {
30340
+ if (workerOrSharedWorkerRE.test(search) || urlRE$1.test(search) || rawRE$1.test(search)) globParams = {
30359
30341
  query: search,
30360
30342
  import: "*"
30361
30343
  };
@@ -30402,12 +30384,13 @@ function dynamicImportVarsPlugin(config) {
30402
30384
  exclude,
30403
30385
  resolver(id, importer) {
30404
30386
  return resolve$4(environment, id, importer);
30405
- }
30387
+ },
30388
+ isV2: config.nativePluginEnabledLevel >= 2 ? { sourcemap: !!environment.config.build.sourcemap } : void 0
30406
30389
  });
30407
30390
  });
30408
30391
  const getFilter = perEnvironmentState((environment) => {
30409
30392
  const { include, exclude } = environment.config.build.dynamicImportVarsOptions;
30410
- return createFilter(include, exclude);
30393
+ return createFilter$1(include, exclude);
30411
30394
  });
30412
30395
  return {
30413
30396
  name: "vite:dynamic-import-vars",
@@ -30434,7 +30417,7 @@ function dynamicImportVarsPlugin(config) {
30434
30417
  await init;
30435
30418
  let imports = [];
30436
30419
  try {
30437
- imports = parse$1(source)[0];
30420
+ imports = parse$3(source)[0];
30438
30421
  } catch {
30439
30422
  return null;
30440
30423
  }
@@ -30469,11 +30452,11 @@ function dynamicImportVarsPlugin(config) {
30469
30452
 
30470
30453
  //#endregion
30471
30454
  //#region src/node/plugins/importMetaGlob.ts
30472
- var import_picocolors$7 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
30473
30455
  function importGlobPlugin(config) {
30474
30456
  if (config.isBundled && config.nativePluginEnabledLevel >= 1) return viteImportGlobPlugin({
30475
30457
  root: config.root,
30476
- restoreQueryExtension: config.experimental.importGlobRestoreExtension
30458
+ restoreQueryExtension: config.experimental.importGlobRestoreExtension,
30459
+ isV2: config.nativePluginEnabledLevel >= 2 ? { sourcemap: !!config.build.sourcemap } : void 0
30477
30460
  });
30478
30461
  const importGlobMaps = /* @__PURE__ */ new Map();
30479
30462
  return {
@@ -30565,7 +30548,7 @@ function parseGlobOptions(rawOpts, optsStartIndex, logger) {
30565
30548
  }
30566
30549
  if (opts.as && logger) {
30567
30550
  const importSuggestion = forceDefaultAs.includes(opts.as) ? `, import: 'default'` : "";
30568
- logger.warn(import_picocolors$7.default.yellow(`The glob option "as" has been deprecated in favour of "query". Please update \`as: '${opts.as}'\` to \`query: '?${opts.as}'${importSuggestion}\`.`));
30551
+ logger.warn(import_picocolors.default.yellow(`The glob option "as" has been deprecated in favour of "query". Please update \`as: '${opts.as}'\` to \`query: '?${opts.as}'${importSuggestion}\`.`));
30569
30552
  }
30570
30553
  if (opts.as && forceDefaultAs.includes(opts.as)) {
30571
30554
  if (opts.import && opts.import !== "default" && opts.import !== "*") throw err(`Option "import" can only be "default" or "*" when "as" is "${opts.as}", but got "${opts.import}"`, optsStartIndex);
@@ -30830,7 +30813,7 @@ function patternToCodeFilter(pattern) {
30830
30813
  };
30831
30814
  return (code) => code.includes(pattern);
30832
30815
  }
30833
- function createFilter$1(exclude, include) {
30816
+ function createFilter(exclude, include) {
30834
30817
  if (!exclude && !include) return;
30835
30818
  return (input) => {
30836
30819
  if (exclude?.some((filter$1) => filter$1(input))) return false;
@@ -30851,14 +30834,14 @@ function createIdFilter(filter$1, cwd = process.cwd()) {
30851
30834
  const { exclude, include } = normalizeFilter(filter$1);
30852
30835
  const excludeFilter = exclude?.map((p) => patternToIdFilter(p, cwd));
30853
30836
  const includeFilter = include?.map((p) => patternToIdFilter(p, cwd));
30854
- return createFilter$1(excludeFilter, includeFilter);
30837
+ return createFilter(excludeFilter, includeFilter);
30855
30838
  }
30856
30839
  function createCodeFilter(filter$1) {
30857
30840
  if (!filter$1) return;
30858
30841
  const { exclude, include } = normalizeFilter(filter$1);
30859
30842
  const excludeFilter = exclude?.map(patternToCodeFilter);
30860
30843
  const includeFilter = include?.map(patternToCodeFilter);
30861
- return createFilter$1(excludeFilter, includeFilter);
30844
+ return createFilter(excludeFilter, includeFilter);
30862
30845
  }
30863
30846
  function createModuleTypeFilter(filter$1) {
30864
30847
  if (!filter$1) return;
@@ -30893,7 +30876,7 @@ function esbuildBannerFooterCompatPlugin(config) {
30893
30876
  if (!options) return;
30894
30877
  const { include, exclude, banner, footer } = options;
30895
30878
  if (!banner && !footer) return;
30896
- const filter$1 = createFilter(include || /\.(m?ts|[jt]sx)$/, exclude || /\.js$/);
30879
+ const filter$1 = createFilter$1(include || /\.(m?ts|[jt]sx)$/, exclude || /\.js$/);
30897
30880
  return {
30898
30881
  name: "vite:esbuild-banner-footer-compat",
30899
30882
  transform(code, id) {
@@ -30938,7 +30921,7 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
30938
30921
  find: item.find,
30939
30922
  replacement: item.replacement
30940
30923
  };
30941
- }) }) : alias({
30924
+ }) }) : alias$1({
30942
30925
  entries: config.resolve.alias,
30943
30926
  customResolver: viteAliasCustomResolver
30944
30927
  }),
@@ -31105,7 +31088,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31105
31088
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31106
31089
  SOFTWARE.
31107
31090
  */
31108
- var import_picocolors$6 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
31109
31091
  const EMPTY_OBJECT = Object.freeze({});
31110
31092
  const debugSourcemapCombineFilter = process.env.DEBUG_VITE_SOURCEMAP_COMBINE_FILTER;
31111
31093
  const debugSourcemapCombine = createDebugger("vite:sourcemap-combine", { onlyWhenFocused: true });
@@ -31288,7 +31270,7 @@ var EnvironmentPluginContainer = class {
31288
31270
  const key = rawId + id;
31289
31271
  if (!this._seenResolves[key]) {
31290
31272
  this._seenResolves[key] = true;
31291
- debugResolve(`${timeFrom(resolveStart)} ${import_picocolors$6.default.cyan(rawId)} -> ${import_picocolors$6.default.dim(id)}`);
31273
+ debugResolve(`${timeFrom(resolveStart)} ${import_picocolors.default.cyan(rawId)} -> ${import_picocolors.default.dim(id)}`);
31292
31274
  }
31293
31275
  }
31294
31276
  if (id) {
@@ -31318,7 +31300,7 @@ var EnvironmentPluginContainer = class {
31318
31300
  const handler = getHookHandler(plugin.load);
31319
31301
  const result = await this.handleHookPromise(handler.call(ctx, id, options));
31320
31302
  if (result != null) {
31321
- if (isObject(result)) ctx._updateModuleInfo(id, result);
31303
+ if (isObject$1(result)) ctx._updateModuleInfo(id, result);
31322
31304
  this._updateModuleLoadAddedImports(id, ctx._addedImports);
31323
31305
  return result;
31324
31306
  }
@@ -31364,7 +31346,7 @@ var EnvironmentPluginContainer = class {
31364
31346
  }
31365
31347
  if (!result) continue;
31366
31348
  debugPluginTransform?.(timeFrom(start), plugin.name, prettifyUrl(id, this.environment.config.root));
31367
- if (isObject(result)) {
31349
+ if (isObject$1(result)) {
31368
31350
  if (result.code !== void 0) {
31369
31351
  code = result.code;
31370
31352
  if (result.map) {
@@ -31423,7 +31405,7 @@ var BasicMinimalPluginContext = class {
31423
31405
  }
31424
31406
  warn(rawLog) {
31425
31407
  const log$1 = this._normalizeRawLog(rawLog);
31426
- const msg = buildErrorMessage(log$1, [import_picocolors$6.default.yellow(`warning: ${log$1.message}`)], false);
31408
+ const msg = buildErrorMessage(log$1, [import_picocolors.default.yellow(`warning: ${log$1.message}`)], false);
31427
31409
  this._logger.warn(msg, {
31428
31410
  clear: true,
31429
31411
  timestamp: true
@@ -31581,7 +31563,7 @@ var PluginContext = class extends MinimalPluginContext {
31581
31563
  try {
31582
31564
  errLocation = numberToPos(this._activeCode, pos);
31583
31565
  } catch (err2) {
31584
- this.environment.logger.error(import_picocolors$6.default.red(`Error in error handler:\n${err2.stack || err2.message}\n`), { error: err2 });
31566
+ this.environment.logger.error(import_picocolors.default.red(`Error in error handler:\n${err2.stack || err2.message}\n`), { error: err2 });
31585
31567
  throw err$2;
31586
31568
  }
31587
31569
  err$2.loc = err$2.loc || {
@@ -31611,7 +31593,7 @@ var PluginContext = class extends MinimalPluginContext {
31611
31593
  if (this instanceof TransformPluginContext && typeof err$2.loc?.line === "number" && typeof err$2.loc.column === "number") {
31612
31594
  const rawSourceMap = this._getCombinedSourcemap();
31613
31595
  if (rawSourceMap && "version" in rawSourceMap) {
31614
- const { source, line, column } = originalPositionFor(new TraceMap(rawSourceMap), {
31596
+ const { source, line, column } = originalPositionFor$1(new TraceMap(rawSourceMap), {
31615
31597
  line: Number(err$2.loc.line),
31616
31598
  column: Number(err$2.loc.column)
31617
31599
  });
@@ -31638,7 +31620,7 @@ var PluginContext = class extends MinimalPluginContext {
31638
31620
  return err$2;
31639
31621
  }
31640
31622
  _warnIncompatibleMethod(method) {
31641
- this.environment.logger.warn(import_picocolors$6.default.cyan(`[plugin:${this._plugin.name}] `) + import_picocolors$6.default.yellow(`context method ${import_picocolors$6.default.bold(`${method}()`)} is not supported in serve mode. This plugin is likely not vite-compatible.`));
31623
+ this.environment.logger.warn(import_picocolors.default.cyan(`[plugin:${this._plugin.name}] `) + import_picocolors.default.yellow(`context method ${import_picocolors.default.bold(`${method}()`)} is not supported in serve mode. This plugin is likely not vite-compatible.`));
31642
31624
  }
31643
31625
  };
31644
31626
  var ResolveIdContext = class extends PluginContext {
@@ -31792,7 +31774,6 @@ function createPluginContainer(environments) {
31792
31774
 
31793
31775
  //#endregion
31794
31776
  //#region src/node/optimizer/scan.ts
31795
- var import_picocolors$5 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
31796
31777
  var ScanEnvironment = class extends BaseEnvironment {
31797
31778
  mode = "scan";
31798
31779
  get pluginContainer() {
@@ -31845,11 +31826,11 @@ function scanImports(environment) {
31845
31826
  async function scan$1() {
31846
31827
  const entries = await computeEntries(environment);
31847
31828
  if (!entries.length) {
31848
- if (!config.optimizeDeps.entries && !config.optimizeDeps.include) environment.logger.warn(import_picocolors$5.default.yellow("(!) Could not auto-determine entry point from rollupOptions or html files and there are no explicit optimizeDeps.include patterns. Skipping dependency pre-bundling."));
31829
+ if (!config.optimizeDeps.entries && !config.optimizeDeps.include) environment.logger.warn(import_picocolors.default.yellow("(!) Could not auto-determine entry point from rollupOptions or html files and there are no explicit optimizeDeps.include patterns. Skipping dependency pre-bundling."));
31849
31830
  return;
31850
31831
  }
31851
31832
  if (scanContext.cancelled) return;
31852
- debug$3?.(`Crawling dependencies using entries: ${entries.map((entry) => `\n ${import_picocolors$5.default.dim(entry)}`).join("")}`);
31833
+ debug$3?.(`Crawling dependencies using entries: ${entries.map((entry) => `\n ${import_picocolors.default.dim(entry)}`).join("")}`);
31853
31834
  const deps = {};
31854
31835
  const missing = {};
31855
31836
  const context = await prepareRolldownScanner(environment, entries, deps, missing);
@@ -31861,14 +31842,14 @@ function scanImports(environment) {
31861
31842
  missing
31862
31843
  };
31863
31844
  } catch (e$1) {
31864
- e$1.message = import_picocolors$5.default.red(`\
31845
+ e$1.message = import_picocolors.default.red(`\
31865
31846
  Failed to scan for dependencies from entries:
31866
31847
  ${entries.join("\n")}
31867
31848
 
31868
31849
  `) + e$1.message;
31869
31850
  throw e$1;
31870
31851
  } finally {
31871
- if (debug$3) debug$3(`Scan completed in ${(performance$1.now() - start).toFixed(2)}ms: ${Object.keys(orderedDependencies(deps)).sort().map((id) => `\n ${import_picocolors$5.default.cyan(id)} -> ${import_picocolors$5.default.dim(deps[id])}`).join("") || import_picocolors$5.default.dim("no dependencies found")}`);
31852
+ if (debug$3) debug$3(`Scan completed in ${(performance$1.now() - start).toFixed(2)}ms: ${Object.keys(orderedDependencies(deps)).sort().map((id) => `\n ${import_picocolors.default.cyan(id)} -> ${import_picocolors.default.dim(deps[id])}`).join("") || import_picocolors.default.dim("no dependencies found")}`);
31872
31853
  }
31873
31854
  }
31874
31855
  return {
@@ -31895,7 +31876,7 @@ async function computeEntries(environment) {
31895
31876
  };
31896
31877
  if (typeof buildInput === "string") entries = [await resolvePath(buildInput)];
31897
31878
  else if (Array.isArray(buildInput)) entries = await Promise.all(buildInput.map(resolvePath));
31898
- else if (isObject(buildInput)) entries = await Promise.all(Object.values(buildInput).map(resolvePath));
31879
+ else if (isObject$1(buildInput)) entries = await Promise.all(Object.values(buildInput).map(resolvePath));
31899
31880
  else throw new Error("invalid rollupOptions.input value.");
31900
31881
  } else entries = await globEntries("**/*.html", environment);
31901
31882
  entries = entries.filter((entry) => isScannable(entry, environment.config.optimizeDeps.extensions) && fs.existsSync(entry));
@@ -32077,7 +32058,7 @@ function rolldownScanPlugin(environment, depImports, missing, entries) {
32077
32058
  if (htmlTypesRE.test(id)) {
32078
32059
  const resolved$1 = await resolve$4(id, importer);
32079
32060
  if (!resolved$1) return;
32080
- if (isInNodeModules(resolved$1) && isOptimizable(resolved$1, optimizeDepsOptions)) return;
32061
+ if (isInNodeModules$1(resolved$1) && isOptimizable(resolved$1, optimizeDepsOptions)) return;
32081
32062
  if (shouldExternalizeDep(resolved$1, id)) return externalUnlessEntry({ path: id });
32082
32063
  return resolved$1;
32083
32064
  }
@@ -32087,7 +32068,7 @@ function rolldownScanPlugin(environment, depImports, missing, entries) {
32087
32068
  const resolved$1 = await resolve$4(id, importer);
32088
32069
  if (resolved$1) {
32089
32070
  if (shouldExternalizeDep(resolved$1, id)) return externalUnlessEntry({ path: id });
32090
- if (isInNodeModules(resolved$1) || include?.includes(id)) {
32071
+ if (isInNodeModules$1(resolved$1) || include?.includes(id)) {
32091
32072
  if (isOptimizable(resolved$1, optimizeDepsOptions)) depImports[id] = resolved$1;
32092
32073
  return externalUnlessEntry({ path: id });
32093
32074
  } else if (isScannable(resolved$1, optimizeDepsOptions.extensions)) return path.resolve(resolved$1);
@@ -32209,7 +32190,7 @@ function expandGlobIds(id, config) {
32209
32190
  const exportsValue = getFirstExportStringValue(exports$1[key]);
32210
32191
  if (!exportsValue) continue;
32211
32192
  const exportValuePattern = exportsValue.replace(/\*/g, "**/*");
32212
- const exportsValueGlobRe = new RegExp(exportsValue.split("*").map(escapeRegex).join("(.*)"));
32193
+ const exportsValueGlobRe = new RegExp(exportsValue.split("*").map(escapeRegex$1).join("(.*)"));
32213
32194
  possibleExportPaths.push(...globSync(exportValuePattern, {
32214
32195
  cwd: pkgData.dir,
32215
32196
  expandDirectories: false,
@@ -32408,7 +32389,7 @@ function rolldownDepPlugin(environment, qualified, external) {
32408
32389
  }
32409
32390
  }];
32410
32391
  }
32411
- const matchesEntireLine = (text) => `^${escapeRegex(text)}$`;
32392
+ const matchesEntireLine = (text) => `^${escapeRegex$1(text)}$`;
32412
32393
  function rolldownCjsExternalPlugin(externals, platform$1) {
32413
32394
  const filter$1 = new RegExp(externals.map(matchesEntireLine).join("|"));
32414
32395
  return {
@@ -32446,7 +32427,6 @@ module.exports = ${isNodeBuiltin(idWithoutNamespace) ? "m.default" : "{ ...m }"}
32446
32427
 
32447
32428
  //#endregion
32448
32429
  //#region src/node/optimizer/index.ts
32449
- var import_picocolors$4 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
32450
32430
  const debug$2 = createDebugger("vite:deps");
32451
32431
  const jsExtensionRE = /\.js$/i;
32452
32432
  function isDepOptimizationDisabled(optimizeDeps$1) {
@@ -32460,7 +32440,7 @@ function isDepOptimizationDisabled(optimizeDeps$1) {
32460
32440
  */
32461
32441
  async function optimizeDeps(config, force = config.optimizeDeps.force, asCommand = false) {
32462
32442
  const log$1 = asCommand ? config.logger.info : debug$2;
32463
- config.logger.warn(import_picocolors$4.default.yellow("manually calling optimizeDeps is deprecated. This is done automatically and does not need to be called manually."));
32443
+ config.logger.warn(import_picocolors.default.yellow("manually calling optimizeDeps is deprecated. This is done automatically and does not need to be called manually."));
32464
32444
  const environment = new ScanEnvironment("client", config);
32465
32445
  await environment.init();
32466
32446
  const cachedMetadata = await loadCachedDepOptimizationMetadata(environment, force, asCommand);
@@ -32468,7 +32448,7 @@ async function optimizeDeps(config, force = config.optimizeDeps.force, asCommand
32468
32448
  const deps = await discoverProjectDependencies(environment).result;
32469
32449
  await addManuallyIncludedOptimizeDeps(environment, deps);
32470
32450
  const depsString = depsLogString(Object.keys(deps));
32471
- log$1?.(import_picocolors$4.default.green(`Optimizing dependencies:\n ${depsString}`));
32451
+ log$1?.(import_picocolors.default.green(`Optimizing dependencies:\n ${depsString}`));
32472
32452
  const result = await runOptimizeDeps(environment, toDiscoveredDependencies(environment, deps)).result;
32473
32453
  await result.commit();
32474
32454
  return result.metadata;
@@ -32525,7 +32505,7 @@ async function loadCachedDepOptimizationMetadata(environment, force = environmen
32525
32505
  return cachedMetadata;
32526
32506
  }
32527
32507
  } else environment.logger.info("Forced re-optimization of dependencies", { timestamp: true });
32528
- debug$2?.(`(${environment.name}) ${import_picocolors$4.default.green(`removing old cache dir ${depsCacheDir}`)}`);
32508
+ debug$2?.(`(${environment.name}) ${import_picocolors.default.green(`removing old cache dir ${depsCacheDir}`)}`);
32529
32509
  await fsp.rm(depsCacheDir, {
32530
32510
  recursive: true,
32531
32511
  force: true
@@ -32541,7 +32521,7 @@ function discoverProjectDependencies(environment) {
32541
32521
  cancel,
32542
32522
  result: result.then(({ deps, missing }) => {
32543
32523
  const missingIds = Object.keys(missing);
32544
- if (missingIds.length) throw new Error(`The following dependencies are imported but could not be resolved:\n\n ${missingIds.map((id) => `${import_picocolors$4.default.cyan(id)} ${import_picocolors$4.default.white(import_picocolors$4.default.dim(`(imported by ${missing[id]})`))}`).join(`\n `)}\n\nAre they installed?`);
32524
+ if (missingIds.length) throw new Error(`The following dependencies are imported but could not be resolved:\n\n ${missingIds.map((id) => `${import_picocolors.default.cyan(id)} ${import_picocolors.default.white(import_picocolors.default.dim(`(imported by ${missing[id]})`))}`).join(`\n `)}\n\nAre they installed?`);
32545
32525
  return deps;
32546
32526
  })
32547
32527
  };
@@ -32562,7 +32542,7 @@ function toDiscoveredDependencies(environment, deps, timestamp) {
32562
32542
  return discovered;
32563
32543
  }
32564
32544
  function depsLogString(qualifiedIds) {
32565
- return import_picocolors$4.default.yellow(qualifiedIds.join(`, `));
32545
+ return import_picocolors.default.yellow(qualifiedIds.join(`, `));
32566
32546
  }
32567
32547
  /**
32568
32548
  * Internally, Vite uses this function to prepare a optimizeDeps run. When Vite starts, we can get
@@ -32573,7 +32553,7 @@ function runOptimizeDeps(environment, depsInfo) {
32573
32553
  const depsCacheDir = getDepsCacheDir(environment);
32574
32554
  const processingCacheDir = getProcessingDepsCacheDir(environment);
32575
32555
  fs.mkdirSync(processingCacheDir, { recursive: true });
32576
- debug$2?.(import_picocolors$4.default.green(`creating package.json in ${processingCacheDir}`));
32556
+ debug$2?.(import_picocolors.default.green(`creating package.json in ${processingCacheDir}`));
32577
32557
  fs.writeFileSync(path.resolve(processingCacheDir, "package.json"), `{\n "type": "module"\n}\n`);
32578
32558
  const metadata = initDepsOptimizerMetadata(environment);
32579
32559
  metadata.browserHash = getOptimizedBrowserHash(metadata.hash, depsFromOptimizedDepInfo(depsInfo));
@@ -32583,7 +32563,7 @@ function runOptimizeDeps(environment, depsInfo) {
32583
32563
  const cleanUp = () => {
32584
32564
  if (!cleaned && !committed) {
32585
32565
  cleaned = true;
32586
- debug$2?.(import_picocolors$4.default.green(`removing cache dir ${processingCacheDir}`));
32566
+ debug$2?.(import_picocolors.default.green(`removing cache dir ${processingCacheDir}`));
32587
32567
  try {
32588
32568
  fs.rmSync(processingCacheDir, {
32589
32569
  recursive: true,
@@ -32599,27 +32579,27 @@ function runOptimizeDeps(environment, depsInfo) {
32599
32579
  if (cleaned) throw new Error("Can not commit a Deps Optimization run as it was cancelled");
32600
32580
  committed = true;
32601
32581
  const dataPath = path.join(processingCacheDir, METADATA_FILENAME);
32602
- debug$2?.(import_picocolors$4.default.green(`creating ${METADATA_FILENAME} in ${processingCacheDir}`));
32582
+ debug$2?.(import_picocolors.default.green(`creating ${METADATA_FILENAME} in ${processingCacheDir}`));
32603
32583
  fs.writeFileSync(dataPath, stringifyDepsOptimizerMetadata(metadata, depsCacheDir));
32604
32584
  const temporaryPath = depsCacheDir + getTempSuffix();
32605
32585
  const depsCacheDirPresent = fs.existsSync(depsCacheDir);
32606
32586
  if (isWindows) {
32607
32587
  if (depsCacheDirPresent) {
32608
- debug$2?.(import_picocolors$4.default.green(`renaming ${depsCacheDir} to ${temporaryPath}`));
32588
+ debug$2?.(import_picocolors.default.green(`renaming ${depsCacheDir} to ${temporaryPath}`));
32609
32589
  await safeRename(depsCacheDir, temporaryPath);
32610
32590
  }
32611
- debug$2?.(import_picocolors$4.default.green(`renaming ${processingCacheDir} to ${depsCacheDir}`));
32591
+ debug$2?.(import_picocolors.default.green(`renaming ${processingCacheDir} to ${depsCacheDir}`));
32612
32592
  await safeRename(processingCacheDir, depsCacheDir);
32613
32593
  } else {
32614
32594
  if (depsCacheDirPresent) {
32615
- debug$2?.(import_picocolors$4.default.green(`renaming ${depsCacheDir} to ${temporaryPath}`));
32595
+ debug$2?.(import_picocolors.default.green(`renaming ${depsCacheDir} to ${temporaryPath}`));
32616
32596
  fs.renameSync(depsCacheDir, temporaryPath);
32617
32597
  }
32618
- debug$2?.(import_picocolors$4.default.green(`renaming ${processingCacheDir} to ${depsCacheDir}`));
32598
+ debug$2?.(import_picocolors.default.green(`renaming ${processingCacheDir} to ${depsCacheDir}`));
32619
32599
  fs.renameSync(processingCacheDir, depsCacheDir);
32620
32600
  }
32621
32601
  if (depsCacheDirPresent) {
32622
- debug$2?.(import_picocolors$4.default.green(`removing cache temp dir ${temporaryPath}`));
32602
+ debug$2?.(import_picocolors.default.green(`removing cache temp dir ${temporaryPath}`));
32623
32603
  fsp.rm(temporaryPath, {
32624
32604
  recursive: true,
32625
32605
  force: true
@@ -32674,7 +32654,7 @@ function runOptimizeDeps(environment, depsInfo) {
32674
32654
  return successfulResult;
32675
32655
  }).catch((e$1) => {
32676
32656
  if (e$1.errors && e$1.message.includes("The build was canceled")) return cancelledResult;
32677
- e$1.message = import_picocolors$4.default.red("Error during dependency optimization:\n\n") + e$1.message;
32657
+ e$1.message = import_picocolors.default.red("Error during dependency optimization:\n\n") + e$1.message;
32678
32658
  throw e$1;
32679
32659
  });
32680
32660
  });
@@ -32780,7 +32760,7 @@ async function addManuallyIncludedOptimizeDeps(environment, deps) {
32780
32760
  const optimizeDepsInclude = optimizeDeps$1.include ?? [];
32781
32761
  if (optimizeDepsInclude.length) {
32782
32762
  const unableToOptimize = (id, msg) => {
32783
- if (optimizeDepsInclude.includes(id)) logger.warn(`${msg}: ${import_picocolors$4.default.cyan(id)}, present in ${environment.name} 'optimizeDeps.include'`);
32763
+ if (optimizeDepsInclude.includes(id)) logger.warn(`${msg}: ${import_picocolors.default.cyan(id)}, present in ${environment.name} 'optimizeDeps.include'`);
32784
32764
  };
32785
32765
  const includes = [...optimizeDepsInclude];
32786
32766
  for (let i = 0; i < includes.length; i++) {
@@ -32913,7 +32893,7 @@ async function extractExportsData(environment, filePath) {
32913
32893
  };
32914
32894
  }
32915
32895
  });
32916
- const [, exports$2, , hasModuleSyntax$1] = parse$1((await (await rolldown({
32896
+ const [, exports$2, , hasModuleSyntax$1] = parse$3((await (await rolldown({
32917
32897
  ...remainingRolldownOptions,
32918
32898
  plugins,
32919
32899
  input: [filePath],
@@ -32935,12 +32915,12 @@ async function extractExportsData(environment, filePath) {
32935
32915
  let usedJsxLoader = false;
32936
32916
  const entryContent = fs.readFileSync(filePath, "utf-8");
32937
32917
  try {
32938
- parseResult = parse$1(entryContent);
32918
+ parseResult = parse$3(entryContent);
32939
32919
  } catch {
32940
32920
  const lang = rolldownOptions.moduleTypes?.[path.extname(filePath)] || "jsx";
32941
32921
  debug$2?.(`Unable to parse: ${filePath}.\n Trying again with a ${lang} transform.`);
32942
32922
  if (lang !== "jsx" && lang !== "tsx" && lang !== "ts") throw new Error(`Unable to parse : ${filePath}.`);
32943
- parseResult = parse$1((await transformWithOxc(entryContent, filePath, { lang }, void 0, environment.config)).code);
32923
+ parseResult = parse$3((await transformWithOxc(entryContent, filePath, { lang }, void 0, environment.config)).code);
32944
32924
  usedJsxLoader = true;
32945
32925
  }
32946
32926
  const [, exports$1, , hasModuleSyntax] = parseResult;
@@ -33132,7 +33112,6 @@ const safeRename = promisify(function gracefulRename(from, to, cb) {
33132
33112
 
33133
33113
  //#endregion
33134
33114
  //#region src/node/plugins/resolve.ts
33135
- var import_picocolors$3 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
33136
33115
  const normalizedClientEntry = normalizePath(CLIENT_ENTRY);
33137
33116
  const normalizedEnvEntry = normalizePath(ENV_ENTRY);
33138
33117
  const ERR_RESOLVE_PACKAGE_ENTRY_FAIL = "ERR_RESOLVE_PACKAGE_ENTRY_FAIL";
@@ -33209,7 +33188,7 @@ function oxcResolvePlugin(resolveOptions, overrideEnvConfig) {
33209
33188
  const exclude = depsOptimizer?.options.exclude;
33210
33189
  const deepMatch = deepImportRE.exec(rawId);
33211
33190
  const pkgId = deepMatch ? deepMatch[1] || deepMatch[2] : cleanUrl(rawId);
33212
- const skipOptimization = depsOptimizer.options.noDiscovery || !isJsType || importer && isInNodeModules(importer) || exclude?.includes(pkgId) || exclude?.includes(rawId) || SPECIAL_QUERY_RE.test(resolvedId);
33191
+ const skipOptimization = depsOptimizer.options.noDiscovery || !isJsType || importer && isInNodeModules$1(importer) || exclude?.includes(pkgId) || exclude?.includes(rawId) || SPECIAL_QUERY_RE.test(resolvedId);
33213
33192
  let newId = resolvedId;
33214
33193
  if (skipOptimization) {
33215
33194
  const versionHash = depsOptimizer.metadata.browserHash;
@@ -33318,7 +33297,7 @@ function resolvePlugin(resolveOptions) {
33318
33297
  if (asSrc && depsOptimizer?.isOptimizedDepUrl(id)) return id.startsWith(FS_PREFIX) ? fsPathFromId(id) : normalizePath(path.resolve(root, id.slice(1)));
33319
33298
  if (asSrc && id.startsWith(FS_PREFIX)) {
33320
33299
  res = fsPathFromId(id);
33321
- debug$1?.(`[@fs] ${import_picocolors$3.default.cyan(id)} -> ${import_picocolors$3.default.dim(res)}`);
33300
+ debug$1?.(`[@fs] ${import_picocolors.default.cyan(id)} -> ${import_picocolors.default.dim(res)}`);
33322
33301
  return {
33323
33302
  id: ensureVersionQuery(res, id, options, depsOptimizer),
33324
33303
  packageJsonPath: findNearestPackagePath(res, options.legacyInconsistentCjsInterop, options.packageCache, isBuild)
@@ -33326,7 +33305,7 @@ function resolvePlugin(resolveOptions) {
33326
33305
  }
33327
33306
  if (asSrc && id[0] === "/" && (rootInRoot || !id.startsWith(withTrailingSlash(root)))) {
33328
33307
  if (res = tryFsResolve(path.resolve(root, id.slice(1)), options)) {
33329
- debug$1?.(`[url] ${import_picocolors$3.default.cyan(id)} -> ${import_picocolors$3.default.dim(res)}`);
33308
+ debug$1?.(`[url] ${import_picocolors.default.cyan(id)} -> ${import_picocolors.default.dim(res)}`);
33330
33309
  return {
33331
33310
  id: ensureVersionQuery(res, id, options, depsOptimizer),
33332
33311
  packageJsonPath: findNearestPackagePath(res, options.legacyInconsistentCjsInterop, options.packageCache, isBuild)
@@ -33347,7 +33326,7 @@ function resolvePlugin(resolveOptions) {
33347
33326
  if (options.mainFields.includes("browser") && (res = tryResolveBrowserMapping(fsPath, importer, options, true))) return res;
33348
33327
  if (res = tryFsResolve(fsPath, options)) {
33349
33328
  res = ensureVersionQuery(res, id, options, depsOptimizer);
33350
- debug$1?.(`[relative] ${import_picocolors$3.default.cyan(id)} -> ${import_picocolors$3.default.dim(res)}`);
33329
+ debug$1?.(`[relative] ${import_picocolors.default.cyan(id)} -> ${import_picocolors.default.dim(res)}`);
33351
33330
  if (!options.idOnly && !options.scan && options.isBuild) {
33352
33331
  const resPkg = findNearestPackageData(path.dirname(res), options.packageCache);
33353
33332
  if (resPkg) return {
@@ -33366,7 +33345,7 @@ function resolvePlugin(resolveOptions) {
33366
33345
  if (isWindows && id[0] === "/") {
33367
33346
  const basedir = importer ? path.dirname(importer) : process.cwd();
33368
33347
  if (res = tryFsResolve(path.resolve(basedir, id), options)) {
33369
- debug$1?.(`[drive-relative] ${import_picocolors$3.default.cyan(id)} -> ${import_picocolors$3.default.dim(res)}`);
33348
+ debug$1?.(`[drive-relative] ${import_picocolors.default.cyan(id)} -> ${import_picocolors.default.dim(res)}`);
33370
33349
  return {
33371
33350
  id: ensureVersionQuery(res, id, options, depsOptimizer),
33372
33351
  packageJsonPath: findNearestPackagePath(res, options.legacyInconsistentCjsInterop, options.packageCache, isBuild)
@@ -33374,7 +33353,7 @@ function resolvePlugin(resolveOptions) {
33374
33353
  }
33375
33354
  }
33376
33355
  if (isNonDriveRelativeAbsolutePath(id) && (res = tryFsResolve(id, options))) {
33377
- debug$1?.(`[fs] ${import_picocolors$3.default.cyan(id)} -> ${import_picocolors$3.default.dim(res)}`);
33356
+ debug$1?.(`[fs] ${import_picocolors.default.cyan(id)} -> ${import_picocolors.default.dim(res)}`);
33378
33357
  return {
33379
33358
  id: ensureVersionQuery(res, id, options, depsOptimizer),
33380
33359
  packageJsonPath: findNearestPackagePath(res, options.legacyInconsistentCjsInterop, options.packageCache, isBuild)
@@ -33414,12 +33393,12 @@ function resolvePlugin(resolveOptions) {
33414
33393
  message += `. Consider disabling environments.${this.environment.name}.noExternal or remove the built-in dependency.`;
33415
33394
  this.error(message);
33416
33395
  }
33417
- if (!asSrc) debug$1?.(`externalized node built-in "${id}" to empty module. (imported by: ${import_picocolors$3.default.white(import_picocolors$3.default.dim(importer))})`);
33396
+ if (!asSrc) debug$1?.(`externalized node built-in "${id}" to empty module. (imported by: ${import_picocolors.default.white(import_picocolors.default.dim(importer))})`);
33418
33397
  else if (isProduction) this.warn(`Module "${id}" has been externalized for browser compatibility, imported by "${importer}". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`);
33419
33398
  return isProduction ? browserExternalId : `${browserExternalId}:${id}`;
33420
33399
  }
33421
33400
  }
33422
- debug$1?.(`[fallthrough] ${import_picocolors$3.default.dim(id)}`);
33401
+ debug$1?.(`[fallthrough] ${import_picocolors.default.dim(id)}`);
33423
33402
  }
33424
33403
  },
33425
33404
  load: {
@@ -33476,7 +33455,7 @@ function resolveSubpathImports(id, importer, options) {
33476
33455
  }
33477
33456
  function ensureVersionQuery(resolved, id, options, depsOptimizer) {
33478
33457
  if (!options.isBuild && !options.scan && depsOptimizer && !(resolved === normalizedClientEntry || resolved === normalizedEnvEntry)) {
33479
- if ((isInNodeModules(id) || isInNodeModules(resolved)) && !DEP_VERSION_RE.test(resolved)) {
33458
+ if ((isInNodeModules$1(id) || isInNodeModules$1(resolved)) && !DEP_VERSION_RE.test(resolved)) {
33480
33459
  const versionHash = depsOptimizer.metadata.browserHash;
33481
33460
  if (versionHash && isOptimizable(resolved, depsOptimizer.options)) resolved = injectQuery(resolved, `v=${versionHash}`);
33482
33461
  }
@@ -33485,7 +33464,7 @@ function ensureVersionQuery(resolved, id, options, depsOptimizer) {
33485
33464
  }
33486
33465
  function tryFsResolve(fsPath, options, tryIndex = true, skipPackageJson = false) {
33487
33466
  const hashIndex = fsPath.indexOf("#");
33488
- if (hashIndex >= 0 && isInNodeModules(fsPath)) {
33467
+ if (hashIndex >= 0 && isInNodeModules$1(fsPath)) {
33489
33468
  const queryIndex = fsPath.indexOf("?");
33490
33469
  if (queryIndex < 0 || queryIndex > hashIndex) {
33491
33470
  const file$1 = queryIndex > hashIndex ? fsPath.slice(0, queryIndex) : fsPath;
@@ -33576,7 +33555,7 @@ function tryNodeResolve(id, importer, options, depsOptimizer, externalize) {
33576
33555
  const index = resolved$1.id.indexOf(id);
33577
33556
  if (index > -1) {
33578
33557
  resolvedId = resolved$1.id.slice(index);
33579
- debug$1?.(`[processResult] ${import_picocolors$3.default.cyan(id)} -> ${import_picocolors$3.default.dim(resolvedId)}`);
33558
+ debug$1?.(`[processResult] ${import_picocolors.default.cyan(id)} -> ${import_picocolors.default.dim(resolvedId)}`);
33580
33559
  }
33581
33560
  }
33582
33561
  return {
@@ -33590,10 +33569,10 @@ function tryNodeResolve(id, importer, options, depsOptimizer, externalize) {
33590
33569
  moduleSideEffects: pkg.hasSideEffects(resolved),
33591
33570
  packageJsonPath: findNearestPackagePath(resolved, options.legacyInconsistentCjsInterop, options.packageCache, isBuild)
33592
33571
  });
33593
- if (!isInNodeModules(resolved) || !depsOptimizer || options.scan) return { id: resolved };
33572
+ if (!isInNodeModules$1(resolved) || !depsOptimizer || options.scan) return { id: resolved };
33594
33573
  const isJsType = isOptimizable(resolved, depsOptimizer.options);
33595
33574
  const exclude = depsOptimizer.options.exclude;
33596
- if (depsOptimizer.options.noDiscovery || !isJsType || importer && isInNodeModules(importer) || exclude?.includes(pkgId) || exclude?.includes(id) || SPECIAL_QUERY_RE.test(resolved)) {
33575
+ if (depsOptimizer.options.noDiscovery || !isJsType || importer && isInNodeModules$1(importer) || exclude?.includes(pkgId) || exclude?.includes(id) || SPECIAL_QUERY_RE.test(resolved)) {
33597
33576
  const versionHash = depsOptimizer.metadata.browserHash;
33598
33577
  if (versionHash && isJsType) resolved = injectQuery(resolved, `v=${versionHash}`);
33599
33578
  } else {
@@ -33652,11 +33631,11 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
33652
33631
  skipPackageJson = true;
33653
33632
  } else {
33654
33633
  const { browser: browserField } = data;
33655
- if (options.mainFields.includes("browser") && isObject(browserField)) entry = mapWithBrowserField(entry, browserField) || entry;
33634
+ if (options.mainFields.includes("browser") && isObject$1(browserField)) entry = mapWithBrowserField(entry, browserField) || entry;
33656
33635
  }
33657
33636
  const resolvedEntryPoint = tryFsResolve(path.join(dir, entry), options, true, skipPackageJson);
33658
33637
  if (resolvedEntryPoint) {
33659
- debug$1?.(`[package entry] ${import_picocolors$3.default.cyan(idWithoutPostfix)} -> ${import_picocolors$3.default.dim(resolvedEntryPoint)}${postfix !== "" ? ` (postfix: ${postfix})` : ""}`);
33638
+ debug$1?.(`[package entry] ${import_picocolors.default.cyan(idWithoutPostfix)} -> ${import_picocolors.default.dim(resolvedEntryPoint)}${postfix !== "" ? ` (postfix: ${postfix})` : ""}`);
33660
33639
  setResolvedCache(".", resolvedEntryPoint, options);
33661
33640
  return resolvedEntryPoint + postfix;
33662
33641
  }
@@ -33694,14 +33673,14 @@ function resolveDeepImport(id, { setResolvedCache, getResolvedCache, dir, data }
33694
33673
  let relativeId = id;
33695
33674
  const { exports: exportsField, browser: browserField } = data;
33696
33675
  if (exportsField) {
33697
- if (isObject(exportsField) && !Array.isArray(exportsField)) {
33676
+ if (isObject$1(exportsField) && !Array.isArray(exportsField)) {
33698
33677
  const { file, postfix } = splitFileAndPostfix(relativeId);
33699
33678
  const exportsId = resolveExportsOrImports(data, file, options, "exports", externalize);
33700
33679
  if (exportsId !== void 0) relativeId = exportsId + postfix;
33701
33680
  else relativeId = void 0;
33702
33681
  } else relativeId = void 0;
33703
33682
  if (!relativeId) throw new Error(`Package subpath '${relativeId}' is not defined by "exports" in ${path.join(dir, "package.json")}.`);
33704
- } else if (options.mainFields.includes("browser") && isObject(browserField)) {
33683
+ } else if (options.mainFields.includes("browser") && isObject$1(browserField)) {
33705
33684
  const { file, postfix } = splitFileAndPostfix(relativeId);
33706
33685
  const mapped = mapWithBrowserField(file, browserField);
33707
33686
  if (mapped) relativeId = mapped + postfix;
@@ -33713,7 +33692,7 @@ function resolveDeepImport(id, { setResolvedCache, getResolvedCache, dir, data }
33713
33692
  if (relativeId) {
33714
33693
  const resolved = tryFsResolve(path.join(dir, relativeId), options, !exportsField);
33715
33694
  if (resolved) {
33716
- debug$1?.(`[node/deep-import] ${import_picocolors$3.default.cyan(id)} -> ${import_picocolors$3.default.dim(resolved)}`);
33695
+ debug$1?.(`[node/deep-import] ${import_picocolors.default.cyan(id)} -> ${import_picocolors.default.dim(resolved)}`);
33717
33696
  setResolvedCache(id, resolved, options);
33718
33697
  return resolved;
33719
33698
  }
@@ -33722,11 +33701,11 @@ function resolveDeepImport(id, { setResolvedCache, getResolvedCache, dir, data }
33722
33701
  function tryResolveBrowserMapping(id, importer, options, isFilePath, externalize) {
33723
33702
  let res;
33724
33703
  const pkg = importer && findNearestPackageData(path.dirname(importer), options.packageCache);
33725
- if (pkg && isObject(pkg.data.browser)) {
33704
+ if (pkg && isObject$1(pkg.data.browser)) {
33726
33705
  const browserMappedPath = mapWithBrowserField(isFilePath ? "./" + slash(path.relative(pkg.dir, id)) : id, pkg.data.browser);
33727
33706
  if (browserMappedPath) {
33728
33707
  if (res = bareImportRE.test(browserMappedPath) ? tryNodeResolve(browserMappedPath, importer, options, void 0, void 0)?.id : tryFsResolve(path.join(pkg.dir, browserMappedPath), options)) {
33729
- debug$1?.(`[browser mapped] ${import_picocolors$3.default.cyan(id)} -> ${import_picocolors$3.default.dim(res)}`);
33708
+ debug$1?.(`[browser mapped] ${import_picocolors.default.cyan(id)} -> ${import_picocolors.default.dim(res)}`);
33730
33709
  let result = { id: res };
33731
33710
  if (options.idOnly) return result;
33732
33711
  if (!options.scan && options.isBuild) {
@@ -33746,7 +33725,7 @@ function tryResolveBrowserMapping(id, importer, options, isFilePath, externalize
33746
33725
  }
33747
33726
  }
33748
33727
  function tryResolveBrowserEntry(dir, data, options) {
33749
- const browserEntry = typeof data.browser === "string" ? data.browser : isObject(data.browser) && data.browser["."];
33728
+ const browserEntry = typeof data.browser === "string" ? data.browser : isObject$1(data.browser) && data.browser["."];
33750
33729
  if (browserEntry) if (!options.isRequire && options.mainFields.includes("module") && typeof data.module === "string" && data.module !== browserEntry) {
33751
33730
  const resolvedBrowserEntry = tryFsResolve(path.join(dir, browserEntry), options);
33752
33731
  if (resolvedBrowserEntry) if (hasESMSyntax(fs.readFileSync(resolvedBrowserEntry, "utf-8"))) return browserEntry;
@@ -33933,7 +33912,7 @@ function ssrManifestPlugin() {
33933
33912
  const code = chunk.code;
33934
33913
  let imports = [];
33935
33914
  try {
33936
- imports = parse$1(code)[0].filter((i) => i.n && i.d > -1);
33915
+ imports = parse$3(code)[0].filter((i) => i.n && i.d > -1);
33937
33916
  } catch (_e) {
33938
33917
  const e$1 = _e;
33939
33918
  const loc = numberToPos(code, e$1.idx);
@@ -34003,7 +33982,7 @@ function licensePlugin() {
34003
33982
  const chunk = bundle[file];
34004
33983
  if (chunk.type === "asset") continue;
34005
33984
  for (const moduleId of chunk.moduleIds) {
34006
- if (moduleId.startsWith("\0") || !isInNodeModules(moduleId)) continue;
33985
+ if (moduleId.startsWith("\0") || !isInNodeModules$1(moduleId)) continue;
34007
33986
  const pkgData = findNearestMainPackageData(path.dirname(moduleId), packageCache);
34008
33987
  if (!pkgData) continue;
34009
33988
  const { name, version = "0.0.0", license } = pkgData.data;
@@ -34064,7 +34043,6 @@ function findLicenseFile(pkgDir) {
34064
34043
 
34065
34044
  //#endregion
34066
34045
  //#region src/node/plugins/prepareOutDir.ts
34067
- var import_picocolors$2 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
34068
34046
  function prepareOutDirPlugin() {
34069
34047
  const rendered = /* @__PURE__ */ new Set();
34070
34048
  return {
@@ -34097,7 +34075,7 @@ function prepareOutDir(outDirs, emptyOutDir, environment) {
34097
34075
  return "";
34098
34076
  }).filter(Boolean), ".git"]);
34099
34077
  if (environment.config.build.copyPublicDir && publicDir && fs.existsSync(publicDir)) {
34100
- if (!areSeparateFolders(outDir, publicDir)) environment.logger.warn(import_picocolors$2.default.yellow(`\n${import_picocolors$2.default.bold(`(!)`)} The public directory feature may not work correctly. outDir ${import_picocolors$2.default.white(import_picocolors$2.default.dim(outDir))} and publicDir ${import_picocolors$2.default.white(import_picocolors$2.default.dim(publicDir))} are not separate folders.\n`));
34078
+ if (!areSeparateFolders(outDir, publicDir)) environment.logger.warn(import_picocolors.default.yellow(`\n${import_picocolors.default.bold(`(!)`)} The public directory feature may not work correctly. outDir ${import_picocolors.default.white(import_picocolors.default.dim(outDir))} and publicDir ${import_picocolors.default.white(import_picocolors.default.dim(publicDir))} are not separate folders.\n`));
34101
34079
  copyDir(publicDir, outDir);
34102
34080
  }
34103
34081
  }
@@ -34110,7 +34088,6 @@ function areSeparateFolders(a, b) {
34110
34088
 
34111
34089
  //#endregion
34112
34090
  //#region src/node/build.ts
34113
- var import_picocolors$1 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
34114
34091
  const _buildEnvironmentOptionsDefaults = Object.freeze({
34115
34092
  target: "baseline-widely-available",
34116
34093
  polyfillModulePreload: true,
@@ -34265,7 +34242,7 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
34265
34242
  const buildOutputOptions = (output = {}) => {
34266
34243
  if (output.output) logger.warn("You've set \"rollupOptions.output.output\" in your config. This is deprecated and will override all Vite.js default output options. Please use \"rollupOptions.output\" instead.");
34267
34244
  if (output.file) throw new Error("Vite does not support \"rollupOptions.output.file\". Please use \"rollupOptions.output.dir\" and \"rollupOptions.output.entryFileNames\" instead.");
34268
- if (output.sourcemap) logger.warnOnce(import_picocolors$1.default.yellow("Vite does not support \"rollupOptions.output.sourcemap\". Please use \"build.sourcemap\" instead."));
34245
+ if (output.sourcemap) logger.warnOnce(import_picocolors.default.yellow("Vite does not support \"rollupOptions.output.sourcemap\". Please use \"build.sourcemap\" instead."));
34269
34246
  const format$1 = output.format || "es";
34270
34247
  const jsExt = ssr && !isSsrTargetWebworkerEnvironment || libOptions ? resolveOutputJsExtension(format$1, findNearestPackageData(root, packageCache)?.data.type) : "js";
34271
34248
  return {
@@ -34300,14 +34277,14 @@ function resolveRolldownOptions(environment, chunkMetadataMap) {
34300
34277
  async function buildEnvironment(environment) {
34301
34278
  const { logger, config } = environment;
34302
34279
  const { root, build: options } = config;
34303
- logger.info(import_picocolors$1.default.cyan(`vite v${VERSION} ${import_picocolors$1.default.green(`building ${environment.name} environment for ${environment.config.mode}...`)}`));
34280
+ logger.info(import_picocolors.default.cyan(`vite v${VERSION} ${import_picocolors.default.green(`building ${environment.name} environment for ${environment.config.mode}...`)}`));
34304
34281
  let bundle;
34305
34282
  let startTime;
34306
34283
  try {
34307
34284
  const chunkMetadataMap = new ChunkMetadataMap();
34308
34285
  const rollupOptions = resolveRolldownOptions(environment, chunkMetadataMap);
34309
34286
  if (options.watch) {
34310
- logger.info(import_picocolors$1.default.cyan(`\nwatching for file changes...`));
34287
+ logger.info(import_picocolors.default.cyan(`\nwatching for file changes...`));
34311
34288
  const resolvedOutDirs = getResolvedOutDirs(root, options.outDir, options.rollupOptions.output);
34312
34289
  const emptyOutDir = resolveEmptyOutDir(options.emptyOutDir, root, resolvedOutDirs, logger);
34313
34290
  const resolvedChokidarOptions = resolveChokidarOptions({
@@ -34325,11 +34302,11 @@ async function buildEnvironment(environment) {
34325
34302
  });
34326
34303
  watcher.on("event", (event) => {
34327
34304
  if (event.code === "BUNDLE_START") {
34328
- logger.info(import_picocolors$1.default.cyan(`\nbuild started...`));
34305
+ logger.info(import_picocolors.default.cyan(`\nbuild started...`));
34329
34306
  chunkMetadataMap.clearResetChunks();
34330
34307
  } else if (event.code === "BUNDLE_END") {
34331
34308
  event.result.close();
34332
- logger.info(import_picocolors$1.default.cyan(`built in ${event.duration}ms.`));
34309
+ logger.info(import_picocolors.default.cyan(`built in ${event.duration}ms.`));
34333
34310
  } else if (event.code === "ERROR") {
34334
34311
  const e$1 = event.error;
34335
34312
  enhanceRollupError(e$1);
@@ -34345,13 +34322,13 @@ async function buildEnvironment(environment) {
34345
34322
  const res = [];
34346
34323
  for (const output of arraify(rollupOptions.output)) res.push(await bundle[options.write ? "write" : "generate"](output));
34347
34324
  for (const output of res) for (const chunk of output.output) if (chunk.type === "chunk") injectChunkMetadata(chunkMetadataMap, chunk);
34348
- logger.info(`${import_picocolors$1.default.green(`✓ built in ${displayTime(Date.now() - startTime)}`)}`);
34325
+ logger.info(`${import_picocolors.default.green(`✓ built in ${displayTime(Date.now() - startTime)}`)}`);
34349
34326
  return Array.isArray(rollupOptions.output) ? res : res[0];
34350
34327
  } catch (e$1) {
34351
34328
  enhanceRollupError(e$1);
34352
34329
  clearLine();
34353
34330
  if (startTime) {
34354
- logger.error(`${import_picocolors$1.default.red("✗")} Build failed in ${displayTime(Date.now() - startTime)}`);
34331
+ logger.error(`${import_picocolors.default.red("✗")} Build failed in ${displayTime(Date.now() - startTime)}`);
34355
34332
  startTime = void 0;
34356
34333
  }
34357
34334
  throw e$1;
@@ -34361,10 +34338,10 @@ async function buildEnvironment(environment) {
34361
34338
  }
34362
34339
  function enhanceRollupError(e$1) {
34363
34340
  const stackOnly = extractStack(e$1);
34364
- let msg = import_picocolors$1.default.red((e$1.plugin ? `[${e$1.plugin}] ` : "") + e$1.message);
34365
- if (e$1.loc && e$1.loc.file && e$1.loc.file !== e$1.id) msg += `\nfile: ${import_picocolors$1.default.cyan(`${e$1.loc.file}:${e$1.loc.line}:${e$1.loc.column}` + (e$1.id ? ` (${e$1.id})` : ""))}`;
34366
- else if (e$1.id) msg += `\nfile: ${import_picocolors$1.default.cyan(e$1.id + (e$1.loc ? `:${e$1.loc.line}:${e$1.loc.column}` : ""))}`;
34367
- if (e$1.frame) msg += `\n` + import_picocolors$1.default.yellow(normalizeCodeFrame(e$1.frame));
34341
+ let msg = import_picocolors.default.red((e$1.plugin ? `[${e$1.plugin}] ` : "") + e$1.message);
34342
+ if (e$1.loc && e$1.loc.file && e$1.loc.file !== e$1.id) msg += `\nfile: ${import_picocolors.default.cyan(`${e$1.loc.file}:${e$1.loc.line}:${e$1.loc.column}` + (e$1.id ? ` (${e$1.id})` : ""))}`;
34343
+ else if (e$1.id) msg += `\nfile: ${import_picocolors.default.cyan(e$1.id + (e$1.loc ? `:${e$1.loc.line}:${e$1.loc.column}` : ""))}`;
34344
+ if (e$1.frame) msg += `\n` + import_picocolors.default.yellow(normalizeCodeFrame(e$1.frame));
34368
34345
  e$1.message = msg;
34369
34346
  if (stackOnly !== void 0) e$1.stack = `${e$1.message}\n${stackOnly}`;
34370
34347
  }
@@ -34414,7 +34391,7 @@ function resolveBuildOutputs(outputs, libOptions, logger) {
34414
34391
  format: format$1
34415
34392
  }));
34416
34393
  }
34417
- if (libOptions.formats) logger.warn(import_picocolors$1.default.yellow("\"build.lib.formats\" will be ignored because \"build.rollupOptions.output\" is already an array format."));
34394
+ if (libOptions.formats) logger.warn(import_picocolors.default.yellow("\"build.lib.formats\" will be ignored because \"build.rollupOptions.output\" is already an array format."));
34418
34395
  outputs.forEach((output) => {
34419
34396
  if ((output.format === "umd" || output.format === "iife") && !output.name) throw new Error("Entries in \"build.rollupOptions.output\" must specify \"name\" when the format is \"umd\" or \"iife\".");
34420
34397
  });
@@ -34449,10 +34426,10 @@ function onRollupLog(level, log$1, environment) {
34449
34426
  environment.logger.info(message);
34450
34427
  return;
34451
34428
  case "warn":
34452
- environment.logger.warn(import_picocolors$1.default.yellow(message));
34429
+ environment.logger.warn(import_picocolors.default.yellow(message));
34453
34430
  return;
34454
34431
  case "error":
34455
- environment.logger.error(import_picocolors$1.default.red(message));
34432
+ environment.logger.error(import_picocolors.default.red(message));
34456
34433
  return;
34457
34434
  case "debug":
34458
34435
  debugLogger?.(message);
@@ -34833,7 +34810,7 @@ function getChunkSize(chunk, enc) {
34833
34810
  * @param {import('./index.d.mts').Options} [options]
34834
34811
  * @returns {import('./index.d.mts').Middleware}
34835
34812
  */
34836
- function build_default$1({ threshold = 1024, level = -1, brotli = false, gzip: gzip$1 = true, mimes: mimes$1 = MIMES } = {}) {
34813
+ function build_default({ threshold = 1024, level = -1, brotli = false, gzip: gzip$1 = true, mimes: mimes$1 = MIMES } = {}) {
34837
34814
  const brotliOpts = typeof brotli === "object" && brotli || {};
34838
34815
  const gzipOpts = typeof gzip$1 === "object" && gzip$1 || {};
34839
34816
  if (!zlib.createBrotliCompress) brotli = false;
@@ -34903,8 +34880,6 @@ function build_default$1({ threshold = 1024, level = -1, brotli = false, gzip: g
34903
34880
 
34904
34881
  //#endregion
34905
34882
  //#region src/node/preview.ts
34906
- var import_connect = /* @__PURE__ */ __toESM(require_connect(), 1);
34907
- var import_lib = /* @__PURE__ */ __toESM(require_lib$1(), 1);
34908
34883
  function resolvePreviewOptions(preview$1, server) {
34909
34884
  return {
34910
34885
  port: preview$1?.port ?? DEFAULT_PREVIEW_PORT,
@@ -34977,10 +34952,10 @@ async function preview(inlineConfig = {}) {
34977
34952
  for (const hook of config.getSortedPluginHooks("configurePreviewServer")) postHooks.push(await hook.call(configurePreviewServerContext, server));
34978
34953
  const { proxy } = config.preview;
34979
34954
  if (proxy) app.use(proxyMiddleware(httpServer, proxy, config));
34980
- app.use(build_default$1());
34955
+ app.use(build_default());
34981
34956
  if (config.base !== "/") app.use(baseMiddleware(config.rawBase, false));
34982
34957
  const headers = config.preview.headers;
34983
- const viteAssetMiddleware = (...args) => build_default(distDir, {
34958
+ const viteAssetMiddleware = (...args) => build_default$1(distDir, {
34984
34959
  etag: true,
34985
34960
  dev: true,
34986
34961
  extensions: [],
@@ -35220,7 +35195,6 @@ function idToPathAndNamespace(id) {
35220
35195
 
35221
35196
  //#endregion
35222
35197
  //#region src/node/config.ts
35223
- var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
35224
35198
  const debug = createDebugger("vite:config", { depth: 10 });
35225
35199
  const promisifiedRealpath = promisify(fs.realpath);
35226
35200
  const SYMBOL_RESOLVED_CONFIG = Symbol("vite:resolved-config");
@@ -35275,7 +35249,7 @@ const configDefaults = Object.freeze({
35275
35249
  importGlobRestoreExtension: false,
35276
35250
  renderBuiltUrl: void 0,
35277
35251
  hmrPartialAccept: false,
35278
- enableNativePlugin: process.env._VITE_TEST_JS_PLUGIN ? false : "v1",
35252
+ enableNativePlugin: process.env._VITE_TEST_JS_PLUGIN ? false : "v2",
35279
35253
  bundledDev: false
35280
35254
  },
35281
35255
  future: {
@@ -35314,7 +35288,7 @@ const configDefaults = Object.freeze({
35314
35288
  function resolveDevEnvironmentOptions(dev$1, environmentName, consumer, preTransformRequest$1) {
35315
35289
  const resolved = mergeWithDefaults({
35316
35290
  ...configDefaults.dev,
35317
- sourcemapIgnoreList: isInNodeModules,
35291
+ sourcemapIgnoreList: isInNodeModules$1,
35318
35292
  preTransformRequests: preTransformRequest$1 ?? consumer === "client",
35319
35293
  createEnvironment: environmentName === "client" ? defaultCreateClientDevEnvironment : defaultCreateDevEnvironment,
35320
35294
  recoverable: consumer === "client",
@@ -35606,7 +35580,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
35606
35580
  const resolvedBase = config.base === "" || config.base === "./" ? !isBuild || config.build?.ssr ? "/" : "./" : resolveBaseUrl(config.base, isBuild, logger);
35607
35581
  const pkgDir = findNearestPackageData(resolvedRoot, packageCache)?.dir;
35608
35582
  const cacheDir = normalizePath(config.cacheDir ? path.resolve(resolvedRoot, config.cacheDir) : pkgDir ? path.join(pkgDir, `node_modules/.vite`) : path.join(resolvedRoot, `.vite`));
35609
- const assetsFilter = config.assetsInclude && (!Array.isArray(config.assetsInclude) || config.assetsInclude.length) ? createFilter(config.assetsInclude) : () => false;
35583
+ const assetsFilter = config.assetsInclude && (!Array.isArray(config.assetsInclude) || config.assetsInclude.length) ? createFilter$1(config.assetsInclude) : () => false;
35610
35584
  const { publicDir } = config;
35611
35585
  const resolvedPublicDir = publicDir !== false && publicDir !== "" ? normalizePath(path.resolve(resolvedRoot, typeof publicDir === "string" ? publicDir : configDefaults.publicDir)) : "";
35612
35586
  const server = resolveServerOptions(resolvedRoot, config.server, logger);
@@ -35809,8 +35783,9 @@ assetFileNames isn't equal for every build.rollupOptions.output. A single patter
35809
35783
  function resolveNativePluginEnabledLevel(enableNativePlugin) {
35810
35784
  switch (enableNativePlugin) {
35811
35785
  case "resolver": return 0;
35812
- case "v1":
35813
- case true: return 1;
35786
+ case "v1": return 1;
35787
+ case "v2":
35788
+ case true: return 2;
35814
35789
  case false: return -1;
35815
35790
  default: return -1;
35816
35791
  }
@@ -35874,7 +35849,7 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
35874
35849
  const { configExport, dependencies } = await (configLoader === "bundle" ? bundleAndLoadConfigFile : configLoader === "runner" ? runnerImportConfigFile : nativeImportConfigFile)(resolvedPath);
35875
35850
  debug?.(`config file loaded in ${getTime()}`);
35876
35851
  const config = await (typeof configExport === "function" ? configExport(configEnv) : configExport);
35877
- if (!isObject(config)) throw new Error(`config must export or return an object.`);
35852
+ if (!isObject$1(config)) throw new Error(`config must export or return an object.`);
35878
35853
  return {
35879
35854
  path: normalizePath(resolvedPath),
35880
35855
  config,
@@ -36147,4 +36122,4 @@ const parseAstAsync$1 = parseAstAsync;
36147
36122
  const esbuildVersion = "0.25.0";
36148
36123
 
36149
36124
  //#endregion
36150
- export { discoverProjectDependencies as $, createBuilder as A, createServerModuleRunner as At, resolveRolldownOptions as B, isCSSRequest as Bt, isRunnableDevEnvironment as C, isFileServingAllowed as Ct, buildEnvironmentOptionsDefaults as D, searchForWorkspaceRoot as Dt, build as E, preprocessCSS as Et, resolveBuildEnvironmentOptions as F, transformWithOxc as Ft, toOutputFilePathWithoutRuntime as G, rollupVersion as Gt, toOutputFilePathInCss as H, mergeConfig as Ht, resolveBuildOutputs as I, transformWithEsbuild as It, cleanupDepsCacheStaleDirs as J, addManuallyIncludedOptimizeDeps as K, withFilter as Kt, resolveBuildPlugins as L, perEnvironmentState as Lt, enhanceRollupError as M, buildErrorMessage as Mt, injectEnvironmentToHooks as N, loadEnv as Nt, builderOptionsDefaults as O, createIdResolver as Ot, onRollupLog as P, resolveEnvPrefix as Pt, depsLogString as Q, resolveBuilderOptions as R, perEnvironmentPlugin as Rt, createRunnableDevEnvironment as S, isFileLoadingAllowed as St, ChunkMetadataMap as T, formatPostcssSourceMap as Tt, toOutputFilePathInHtml as U, normalizePath as Ut, resolveUserExternal as V, mergeAlias as Vt, toOutputFilePathInJS as W, rolldownVersion as Wt, createIsOptimizedDepUrl as X, createIsOptimizedDepFile as Y, depsFromOptimizedDepInfo as Z, resolveDevEnvironmentOptions as _, resolveServerOptions as _t, parse as a, loadCachedDepOptimizationMetadata as at, preview as b, send as bt, parseSync as c, optimizedDepInfoFromFile as ct, defineConfig as d, runOptimizeDeps as dt, extractExportsData as et, getDefaultEnvironmentOptions as f, toDiscoveredDependencies as ft, resolveConfig as g, createServerCloseFn as gt, resolveBaseUrl as h, createServer$2 as ht, minifySync as i, isDepOptimizationDisabled as it, createToImportMetaURLBasedRelativeRuntime as j, createServerModuleRunnerTransport as jt, clearLine as k, ssrTransform as kt, createFetchableDevEnvironment as l, optimizedDepInfoFromId as lt, loadConfigFromFile as m, _createServer as mt, esmExternalRequirePlugin as n, getOptimizedDepPath as nt, parseAst$1 as o, optimizeDeps as ot, isResolvedConfig as p, createServerHotChannel as pt, addOptimizedDepInfo as q, minify as r, initDepsOptimizerMetadata as rt, parseAstAsync$1 as s, optimizeExplicitEnvironmentDeps as st, esbuildVersion as t, getDepsCacheDir as tt, isFetchableDevEnvironment as u, optimizedDepNeedsInterop as ut, sortUserPlugins as v, restartServerWithUrls as vt, BuildEnvironment as w, fetchModule as wt, resolvePreviewOptions as x, DevEnvironment as xt, runnerImport as y, serverConfigDefaults as yt, resolveLibFilename as z, createFilter as zt };
36125
+ export { discoverProjectDependencies as $, createBuilder as A, createServerModuleRunner as At, resolveRolldownOptions as B, isCSSRequest as Bt, isRunnableDevEnvironment as C, isFileServingAllowed as Ct, buildEnvironmentOptionsDefaults as D, searchForWorkspaceRoot as Dt, build as E, preprocessCSS as Et, resolveBuildEnvironmentOptions as F, transformWithOxc as Ft, toOutputFilePathWithoutRuntime as G, rollupVersion as Gt, toOutputFilePathInCss as H, mergeConfig as Ht, resolveBuildOutputs as I, transformWithEsbuild as It, cleanupDepsCacheStaleDirs as J, addManuallyIncludedOptimizeDeps as K, withFilter as Kt, resolveBuildPlugins as L, perEnvironmentState as Lt, enhanceRollupError as M, buildErrorMessage as Mt, injectEnvironmentToHooks as N, loadEnv as Nt, builderOptionsDefaults as O, createIdResolver as Ot, onRollupLog as P, resolveEnvPrefix as Pt, depsLogString as Q, resolveBuilderOptions as R, perEnvironmentPlugin as Rt, createRunnableDevEnvironment as S, isFileLoadingAllowed as St, ChunkMetadataMap as T, formatPostcssSourceMap as Tt, toOutputFilePathInHtml as U, normalizePath as Ut, resolveUserExternal as V, mergeAlias as Vt, toOutputFilePathInJS as W, rolldownVersion as Wt, createIsOptimizedDepUrl as X, createIsOptimizedDepFile as Y, depsFromOptimizedDepInfo as Z, resolveDevEnvironmentOptions as _, resolveServerOptions as _t, parse as a, loadCachedDepOptimizationMetadata as at, preview as b, send as bt, parseSync as c, optimizedDepInfoFromFile as ct, defineConfig as d, runOptimizeDeps as dt, extractExportsData as et, getDefaultEnvironmentOptions as f, toDiscoveredDependencies as ft, resolveConfig as g, createServerCloseFn as gt, resolveBaseUrl as h, createServer$2 as ht, minifySync as i, isDepOptimizationDisabled as it, createToImportMetaURLBasedRelativeRuntime as j, createServerModuleRunnerTransport as jt, clearLine as k, ssrTransform as kt, createFetchableDevEnvironment as l, optimizedDepInfoFromId as lt, loadConfigFromFile as m, _createServer as mt, esmExternalRequirePlugin as n, getOptimizedDepPath as nt, parseAst$1 as o, optimizeDeps as ot, isResolvedConfig as p, createServerHotChannel as pt, addOptimizedDepInfo as q, minify as r, initDepsOptimizerMetadata as rt, parseAstAsync$1 as s, optimizeExplicitEnvironmentDeps as st, esbuildVersion as t, getDepsCacheDir as tt, isFetchableDevEnvironment as u, optimizedDepNeedsInterop as ut, sortUserPlugins as v, restartServerWithUrls as vt, BuildEnvironment as w, fetchModule as wt, resolvePreviewOptions as x, DevEnvironment as xt, runnerImport as y, serverConfigDefaults as yt, resolveLibFilename as z, createFilter$1 as zt };