vite 7.1.9 → 7.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { __commonJS, __require, __toDynamicImportESM, __toESM } from "./dep-lCKrEJQm.js";
2
- import { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_INLINE_LIMIT, DEFAULT_ASSETS_RE, DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_EXTERNAL_CONDITIONS, DEFAULT_PREVIEW_PORT, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, DEP_VERSION_RE, DEV_PROD_CONDITION, ENV_ENTRY, ENV_PUBLIC_PATH, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, LogLevels, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, ROLLUP_HOOKS, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, createLogger, defaultAllowedOrigins, loopbackHosts, printServerUrls, require_picocolors, wildcardHosts } from "./dep-SmwnYDP9.js";
1
+ import { __commonJS, __require, __toDynamicImportESM, __toESM } from "./chunk.js";
2
+ import { CLIENT_DIR, CLIENT_ENTRY, CLIENT_PUBLIC_PATH, CSS_LANGS_RE, DEFAULT_ASSETS_INLINE_LIMIT, DEFAULT_ASSETS_RE, DEFAULT_CLIENT_CONDITIONS, DEFAULT_CLIENT_MAIN_FIELDS, DEFAULT_CONFIG_FILES, DEFAULT_DEV_PORT, DEFAULT_EXTERNAL_CONDITIONS, DEFAULT_PREVIEW_PORT, DEFAULT_SERVER_CONDITIONS, DEFAULT_SERVER_MAIN_FIELDS, DEP_VERSION_RE, DEV_PROD_CONDITION, ENV_ENTRY, ENV_PUBLIC_PATH, ERR_FILE_NOT_FOUND_IN_OPTIMIZED_DEP_DIR, ERR_OPTIMIZE_DEPS_PROCESSING_ERROR, ESBUILD_BASELINE_WIDELY_AVAILABLE_TARGET, FS_PREFIX, JS_TYPES_RE, KNOWN_ASSET_TYPES, LogLevels, METADATA_FILENAME, OPTIMIZABLE_ENTRY_RE, ROLLUP_HOOKS, SPECIAL_QUERY_RE, VERSION, VITE_PACKAGE_DIR, createLogger, defaultAllowedOrigins, loopbackHosts, printServerUrls, require_picocolors, wildcardHosts } from "./logger.js";
3
3
  import { builtinModules, createRequire } from "node:module";
4
4
  import { parseAst, parseAstAsync } from "rollup/parseAst";
5
5
  import * as fs$1 from "node:fs";
@@ -123,8 +123,7 @@ function decodeInteger(reader, relative$3) {
123
123
  let shift = 0;
124
124
  let integer = 0;
125
125
  do {
126
- const c = reader.next();
127
- integer = charToInt[c];
126
+ integer = charToInt[reader.next()];
128
127
  value$1 |= (integer & 31) << shift;
129
128
  shift += 5;
130
129
  } while (integer & 32);
@@ -745,10 +744,7 @@ function getIndex(arr, index) {
745
744
  }
746
745
  function getColumnIndex(line, genColumn) {
747
746
  let index = line.length;
748
- for (let i$1 = index - 1; i$1 >= 0; index = i$1--) {
749
- const current = line[i$1];
750
- if (genColumn >= current[COLUMN]) break;
751
- }
747
+ for (let i$1 = index - 1; i$1 >= 0; index = i$1--) if (genColumn >= line[i$1][COLUMN]) break;
752
748
  return index;
753
749
  }
754
750
  function insert(array, index, value$1) {
@@ -848,7 +844,7 @@ Did you specify these with the most recent transformation maps first?`);
848
844
  function build$2(map$1, loader$1, importer, importerDepth) {
849
845
  const { resolvedSources, sourcesContent, ignoreList } = map$1;
850
846
  const depth = importerDepth + 1;
851
- const children = resolvedSources.map((sourceFile, i$1) => {
847
+ return MapSource(map$1, resolvedSources.map((sourceFile, i$1) => {
852
848
  const ctx = {
853
849
  importer,
854
850
  depth,
@@ -859,11 +855,8 @@ function build$2(map$1, loader$1, importer, importerDepth) {
859
855
  const sourceMap = loader$1(ctx.source, ctx);
860
856
  const { source, content, ignore } = ctx;
861
857
  if (sourceMap) return build$2(new TraceMap(sourceMap, source), loader$1, source, depth);
862
- const sourceContent = content !== void 0 ? content : sourcesContent ? sourcesContent[i$1] : null;
863
- const ignored = ignore !== void 0 ? ignore : ignoreList ? ignoreList.includes(i$1) : false;
864
- return OriginalSource(source, sourceContent, ignored);
865
- });
866
- return MapSource(map$1, children);
858
+ return OriginalSource(source, content !== void 0 ? content : sourcesContent ? sourcesContent[i$1] : null, ignore !== void 0 ? ignore : ignoreList ? ignoreList.includes(i$1) : false);
859
+ }));
867
860
  }
868
861
  var SourceMap$1 = class {
869
862
  constructor(map$1, options$1) {
@@ -886,8 +879,7 @@ function remapping(input, loader$1, options$1) {
886
879
  excludeContent: !!options$1,
887
880
  decodedMappings: false
888
881
  };
889
- const tree = buildSourceMapTree(input, loader$1);
890
- return new SourceMap$1(traceMappings(tree), opts);
882
+ return new SourceMap$1(traceMappings(buildSourceMapTree(input, loader$1)), opts);
891
883
  }
892
884
 
893
885
  //#endregion
@@ -1684,8 +1676,7 @@ function getMatcherString$1(id, resolutionBase) {
1684
1676
  const createFilter$2 = function createFilter$3(include, exclude, options$1) {
1685
1677
  const resolutionBase = options$1 && options$1.resolve;
1686
1678
  const getMatcher = (id) => id instanceof RegExp ? id : { test: (what) => {
1687
- const pattern = getMatcherString$1(id, resolutionBase);
1688
- return picomatch(pattern, { dot: true })(what);
1679
+ return picomatch(getMatcherString$1(id, resolutionBase), { dot: true })(what);
1689
1680
  } };
1690
1681
  const includeMatchers = ensureArray(include).map(getMatcher);
1691
1682
  const excludeMatchers = ensureArray(exclude).map(getMatcher);
@@ -1836,8 +1827,7 @@ function resolvePackageData(pkgName, basedir, preserveSymlinks = false, packageC
1836
1827
  const pkg = path.join(basedir, "node_modules", pkgName, "package.json");
1837
1828
  try {
1838
1829
  if (fs.existsSync(pkg)) {
1839
- const pkgPath = preserveSymlinks ? pkg : safeRealpathSync(pkg);
1840
- const pkgData = loadPackageData(pkgPath);
1830
+ const pkgData = loadPackageData(preserveSymlinks ? pkg : safeRealpathSync(pkg));
1841
1831
  if (packageCache) setRpdCache(packageCache, pkgData, pkgName, basedir, originalBasedir, preserveSymlinks);
1842
1832
  return pkgData;
1843
1833
  }
@@ -1878,13 +1868,10 @@ function loadPackageData(pkgPath) {
1878
1868
  let hasSideEffects;
1879
1869
  if (typeof sideEffects === "boolean") hasSideEffects = () => sideEffects;
1880
1870
  else if (Array.isArray(sideEffects)) if (sideEffects.length <= 0) hasSideEffects = () => false;
1881
- else {
1882
- const finalPackageSideEffects = sideEffects.map((sideEffect) => {
1883
- if (sideEffect.includes("/")) return sideEffect;
1884
- return `**/${sideEffect}`;
1885
- });
1886
- hasSideEffects = createFilter(finalPackageSideEffects, null, { resolve: pkgDir });
1887
- }
1871
+ else hasSideEffects = createFilter(sideEffects.map((sideEffect) => {
1872
+ if (sideEffect.includes("/")) return sideEffect;
1873
+ return `**/${sideEffect}`;
1874
+ }), null, { resolve: pkgDir });
1888
1875
  else hasSideEffects = () => null;
1889
1876
  const resolvedCache = {};
1890
1877
  return {
@@ -2670,8 +2657,7 @@ function mergeWithDefaultsRecursively(defaults, values) {
2670
2657
  }
2671
2658
  const environmentPathRE = /^environments\.[^.]+$/;
2672
2659
  function mergeWithDefaults(defaults, values) {
2673
- const clonedDefaults = deepClone(defaults);
2674
- return mergeWithDefaultsRecursively(clonedDefaults, values);
2660
+ return mergeWithDefaultsRecursively(deepClone(defaults), values);
2675
2661
  }
2676
2662
  function mergeConfigRecursively(defaults, overrides, rootPath) {
2677
2663
  const merged = { ...defaults };
@@ -3196,10 +3182,9 @@ function getLocator(source) {
3196
3182
  else i$1 = m$2 + 1;
3197
3183
  }
3198
3184
  const line = i$1 - 1;
3199
- const column = index - lineOffsets[line];
3200
3185
  return {
3201
3186
  line,
3202
- column
3187
+ column: index - lineOffsets[line]
3203
3188
  };
3204
3189
  };
3205
3190
  }
@@ -3952,10 +3937,10 @@ var require_is_reference = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
3952
3937
  }) });
3953
3938
 
3954
3939
  //#endregion
3955
- //#region ../../node_modules/.pnpm/@rollup+plugin-commonjs@28.0.6_rollup@4.43.0/node_modules/@rollup/plugin-commonjs/dist/es/index.js
3940
+ //#region ../../node_modules/.pnpm/@rollup+plugin-commonjs@28.0.8_rollup@4.43.0/node_modules/@rollup/plugin-commonjs/dist/es/index.js
3956
3941
  var import_commondir = /* @__PURE__ */ __toESM(require_commondir(), 1);
3957
3942
  var import_is_reference = /* @__PURE__ */ __toESM(require_is_reference(), 1);
3958
- var version$1 = "28.0.6";
3943
+ var version$1 = "28.0.8";
3959
3944
  var peerDependencies = { rollup: "^2.68.0||^3.0.0||^4.0.0" };
3960
3945
  function tryParse(parse$17, code, id) {
3961
3946
  try {
@@ -4095,15 +4080,13 @@ function getDynamicModuleRegistry(isDynamicRequireModulesEnabled, dynamicRequire
4095
4080
  if (!isDynamicRequireModulesEnabled) return `export function ${COMMONJS_REQUIRE_EXPORT}(path) {
4096
4081
  ${FAILED_REQUIRE_ERROR}
4097
4082
  }`;
4098
- const dynamicModuleImports = [...dynamicRequireModules.values()].map((id, index) => `import ${id.endsWith(".json") ? `json${index}` : `{ __require as require${index} }`} from ${JSON.stringify(id)};`).join("\n");
4099
- const dynamicModuleProps = [...dynamicRequireModules.keys()].map((id, index) => `\t\t${JSON.stringify(getVirtualPathForDynamicRequirePath(id, commonDir))}: ${id.endsWith(".json") ? `function () { return json${index}; }` : `require${index}`}`).join(",\n");
4100
- return `${dynamicModuleImports}
4083
+ return `${[...dynamicRequireModules.values()].map((id, index) => `import ${id.endsWith(".json") ? `json${index}` : `{ __require as require${index} }`} from ${JSON.stringify(id)};`).join("\n")}
4101
4084
 
4102
4085
  var dynamicModules;
4103
4086
 
4104
4087
  function getDynamicModules() {
4105
4088
  return dynamicModules || (dynamicModules = {
4106
- ${dynamicModuleProps}
4089
+ ${[...dynamicRequireModules.keys()].map((id, index) => `\t\t${JSON.stringify(getVirtualPathForDynamicRequirePath(id, commonDir))}: ${id.endsWith(".json") ? `function () { return json${index}; }` : `require${index}`}`).join(",\n")}
4107
4090
  });
4108
4091
  }
4109
4092
 
@@ -4293,6 +4276,11 @@ function getEsImportProxy(id, defaultIsModuleExports, moduleSideEffects) {
4293
4276
  syntheticNamedExports: "__moduleExports"
4294
4277
  };
4295
4278
  }
4279
+ function getExternalBuiltinRequireProxy(id) {
4280
+ return `import { createRequire } from 'node:module';
4281
+ const require = createRequire(import.meta.url);
4282
+ export function __require() { return require(${JSON.stringify(id)}); }`;
4283
+ }
4296
4284
  function getCandidatesForExtension(resolved, extension$1) {
4297
4285
  return [resolved + extension$1, `${resolved}${sep$1}index${extension$1}`];
4298
4286
  }
@@ -4301,8 +4289,7 @@ function getCandidates(resolved, extensions$1) {
4301
4289
  }
4302
4290
  function resolveExtensions(importee, importer, extensions$1) {
4303
4291
  if (importee[0] !== "." || !importer) return void 0;
4304
- const resolved = resolve$1(dirname$1(importer), importee);
4305
- const candidates = getCandidates(resolved, extensions$1);
4292
+ const candidates = getCandidates(resolve$1(dirname$1(importer), importee), extensions$1);
4306
4293
  for (let i$1 = 0; i$1 < candidates.length; i$1 += 1) try {
4307
4294
  if (statSync(candidates[i$1]).isFile()) return { id: candidates[i$1] };
4308
4295
  } catch (err$2) {}
@@ -4455,11 +4442,19 @@ function getRequireResolver(extensions$1, detectCyclesAndConditional, currentlyR
4455
4442
  parentMeta.isCommonJS = getTypeForFullyAnalyzedModule(parentId);
4456
4443
  fullyAnalyzedModules[parentId] = true;
4457
4444
  return requireTargets.map(({ id: dependencyId, allowProxy }, index) => {
4458
- const isCommonJS = parentMeta.isRequiredCommonJS[dependencyId] = getTypeForFullyAnalyzedModule(dependencyId);
4445
+ let isCommonJS = parentMeta.isRequiredCommonJS[dependencyId] = getTypeForFullyAnalyzedModule(dependencyId);
4446
+ const isExternalWrapped = isWrappedId(dependencyId, EXTERNAL_SUFFIX);
4447
+ if (parentMeta.initialCommonJSType === IS_WRAPPED_COMMONJS && !allowProxy && isExternalWrapped) {
4448
+ if (unwrapId$1(dependencyId, EXTERNAL_SUFFIX).startsWith("node:")) {
4449
+ isCommonJS = IS_WRAPPED_COMMONJS;
4450
+ parentMeta.isRequiredCommonJS[dependencyId] = isCommonJS;
4451
+ }
4452
+ }
4459
4453
  const isWrappedCommonJS = isCommonJS === IS_WRAPPED_COMMONJS;
4460
4454
  fullyAnalyzedModules[dependencyId] = true;
4455
+ const moduleInfo = isWrappedCommonJS && !isExternalWrapped ? rollupContext.getModuleInfo(dependencyId) : null;
4461
4456
  return {
4462
- wrappedModuleSideEffects: isWrappedCommonJS && rollupContext.getModuleInfo(dependencyId).moduleSideEffects,
4457
+ wrappedModuleSideEffects: !isWrappedCommonJS ? false : moduleInfo?.moduleSideEffects ?? true,
4463
4458
  source: sources[index].source,
4464
4459
  id: allowProxy ? wrapId$1(dependencyId, isWrappedCommonJS ? WRAPPED_SUFFIX : PROXY_SUFFIX) : dependencyId,
4465
4460
  isCommonJS
@@ -4692,13 +4687,12 @@ function getRequireHandlers() {
4692
4687
  if (exportMode === "module") imports.push(`import { __module as ${moduleName} } from ${JSON.stringify(wrapId$1(id, MODULE_SUFFIX))}`, `var ${exportsName} = ${moduleName}.exports`);
4693
4688
  else if (exportMode === "exports") imports.push(`import { __exports as ${exportsName} } from ${JSON.stringify(wrapId$1(id, EXPORTS_SUFFIX))}`);
4694
4689
  const requiresBySource = collectSources(requireExpressions);
4695
- const requireTargets = await resolveRequireSourcesAndUpdateMeta(id, needsRequireWrapper ? IS_WRAPPED_COMMONJS : !isEsModule, commonjsMeta, Object.keys(requiresBySource).map((source) => {
4690
+ processRequireExpressions(imports, await resolveRequireSourcesAndUpdateMeta(id, needsRequireWrapper ? IS_WRAPPED_COMMONJS : !isEsModule, commonjsMeta, Object.keys(requiresBySource).map((source) => {
4696
4691
  return {
4697
4692
  source,
4698
4693
  isConditional: requiresBySource[source].every((require$1) => require$1.isInsideConditional)
4699
4694
  };
4700
- }));
4701
- processRequireExpressions(imports, requireTargets, requiresBySource, getIgnoreTryCatchRequireStatementMode, magicString);
4695
+ })), requiresBySource, getIgnoreTryCatchRequireStatementMode, magicString);
4702
4696
  return imports.length ? `${imports.join(";\n")};\n\n` : "";
4703
4697
  }
4704
4698
  return {
@@ -5144,6 +5138,7 @@ function commonjs(options$1 = {}) {
5144
5138
  }
5145
5139
  if (isWrappedId(id, EXTERNAL_SUFFIX)) {
5146
5140
  const actualId = unwrapId$1(id, EXTERNAL_SUFFIX);
5141
+ if (actualId.startsWith("node:")) return getExternalBuiltinRequireProxy(actualId);
5147
5142
  return getUnknownRequireProxy(actualId, isEsmExternal(actualId) ? getRequireReturnsDefault(actualId) : true);
5148
5143
  }
5149
5144
  if (id.endsWith(ENTRY_SUFFIX)) {
@@ -5502,8 +5497,7 @@ const resolve2posix = IS_POSIX ? (dir, filename) => dir ? path.resolve(dir, file
5502
5497
  function resolveReferencedTSConfigFiles(result, options$1) {
5503
5498
  const dir = path.dirname(result.tsconfigFile);
5504
5499
  return result.tsconfig.references.map((ref) => {
5505
- const refPath = ref.path.endsWith(".json") ? ref.path : path.join(ref.path, options$1?.configName ?? "tsconfig.json");
5506
- return resolve2posix(dir, refPath);
5500
+ return resolve2posix(dir, ref.path.endsWith(".json") ? ref.path : path.join(ref.path, options$1?.configName ?? "tsconfig.json"));
5507
5501
  });
5508
5502
  }
5509
5503
  /**
@@ -5946,10 +5940,7 @@ async function parseExtends(result, cache$1) {
5946
5940
  if (!Array.isArray(extending.tsconfig.extends)) resolvedExtends = [resolveExtends(extending.tsconfig.extends, extending.tsconfigFile)];
5947
5941
  else resolvedExtends = extending.tsconfig.extends.reverse().map((ex) => resolveExtends(ex, extending.tsconfigFile));
5948
5942
  const circularExtends = resolvedExtends.find((tsconfigFile) => extendsPath.includes(tsconfigFile));
5949
- if (circularExtends) {
5950
- const circle = extendsPath.concat([circularExtends]).join(" -> ");
5951
- throw new TSConfckParseError(`Circular dependency in "extends": ${circle}`, "EXTENDS_CIRCULAR", result.tsconfigFile);
5952
- }
5943
+ if (circularExtends) throw new TSConfckParseError(`Circular dependency in "extends": ${extendsPath.concat([circularExtends]).join(" -> ")}`, "EXTENDS_CIRCULAR", result.tsconfigFile);
5953
5944
  extended.splice(pos + 1, 0, ...await Promise.all(resolvedExtends.map((file) => parseFile$1(file, cache$1))));
5954
5945
  } else {
5955
5946
  extendsPath.splice(-currentBranchDepth);
@@ -6225,7 +6216,7 @@ var TSConfckCache = class {
6225
6216
  //#region src/node/plugins/esbuild.ts
6226
6217
  var import_picocolors$31 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
6227
6218
  const debug$17 = createDebugger("vite:esbuild");
6228
- const IIFE_BEGIN_RE = /(?:const|var)\s+\S+\s*=\s*function\([^()]*\)\s*\{\s*"use strict";/;
6219
+ const IIFE_BEGIN_RE = /(?:const|var)\s+\S+\s*=\s*\(?function\([^()]*\)\s*\{\s*"use strict";/;
6229
6220
  const validExtensionRE = /\.\w+$/;
6230
6221
  const jsxExtensionsRE = /\.(?:j|t)sx\b/;
6231
6222
  const defaultEsbuildSupported = {
@@ -7399,8 +7390,7 @@ function renderAssetUrlInJS(pluginContext, chunk, opts, code) {
7399
7390
  const [full, referenceId, postfix = ""] = match;
7400
7391
  const file = pluginContext.getFileName(referenceId);
7401
7392
  chunk.viteMetadata.importedAssets.add(cleanUrl(file));
7402
- const filename = file + postfix;
7403
- const replacement = toOutputFilePathInJS(environment, filename, "asset", chunk.fileName, "js", toRelativeRuntime);
7393
+ const replacement = toOutputFilePathInJS(environment, file + postfix, "asset", chunk.fileName, "js", toRelativeRuntime);
7404
7394
  const replacementString = typeof replacement === "string" ? JSON.stringify(encodeURIPath(replacement)).slice(1, -1) : `"+${replacement.runtime}+"`;
7405
7395
  s$2.update(match.index, match.index + full.length, replacementString);
7406
7396
  }
@@ -7409,8 +7399,7 @@ function renderAssetUrlInJS(pluginContext, chunk, opts, code) {
7409
7399
  while (match = publicAssetUrlRE.exec(code)) {
7410
7400
  s$2 ||= new MagicString(code);
7411
7401
  const [full, hash$1] = match;
7412
- const publicUrl = publicAssetUrlMap.get(hash$1).slice(1);
7413
- const replacement = toOutputFilePathInJS(environment, publicUrl, "public", chunk.fileName, "js", toRelativeRuntime);
7402
+ const replacement = toOutputFilePathInJS(environment, publicAssetUrlMap.get(hash$1).slice(1), "public", chunk.fileName, "js", toRelativeRuntime);
7414
7403
  const replacementString = typeof replacement === "string" ? JSON.stringify(encodeURIPath(replacement)).slice(1, -1) : `"+${replacement.runtime}+"`;
7415
7404
  s$2.update(match.index, match.index + full.length, replacementString);
7416
7405
  }
@@ -7496,8 +7485,7 @@ async function fileToDevUrl(environment, id, skipBase = false) {
7496
7485
  const publicFile = checkPublicFile(id, config$2);
7497
7486
  if (inlineRE$3.test(id)) {
7498
7487
  const file = publicFile || cleanUrl(id);
7499
- const content = await fsp.readFile(file);
7500
- return assetToDataURL(environment, file, content);
7488
+ return assetToDataURL(environment, file, await fsp.readFile(file));
7501
7489
  }
7502
7490
  const cleanedId = cleanUrl(id);
7503
7491
  if (cleanedId.endsWith(".svg")) {
@@ -7510,8 +7498,7 @@ async function fileToDevUrl(environment, id, skipBase = false) {
7510
7498
  else if (id.startsWith(withTrailingSlash(config$2.root))) rtn = "/" + path.posix.relative(config$2.root, id);
7511
7499
  else rtn = path.posix.join(FS_PREFIX, id);
7512
7500
  if (skipBase) return rtn;
7513
- const base = joinUrlSegments(config$2.server.origin ?? "", config$2.decodedBase);
7514
- return joinUrlSegments(base, removeLeadingSlash(rtn));
7501
+ return joinUrlSegments(joinUrlSegments(config$2.server.origin ?? "", config$2.decodedBase), removeLeadingSlash(rtn));
7515
7502
  }
7516
7503
  function getPublicAssetFilename(hash$1, config$2) {
7517
7504
  return publicAssetUrlCache.get(config$2)?.get(hash$1);
@@ -7570,8 +7557,7 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
7570
7557
  async function urlToBuiltUrl(pluginContext, url$3, importer, forceInline) {
7571
7558
  const topLevelConfig = pluginContext.environment.getTopLevelConfig();
7572
7559
  if (checkPublicFile(url$3, topLevelConfig)) return publicFileToBuiltUrl(url$3, topLevelConfig);
7573
- const file = url$3[0] === "/" ? path.join(topLevelConfig.root, url$3) : path.join(path.dirname(importer), url$3);
7574
- return fileToBuiltUrl(pluginContext, file, true, forceInline);
7560
+ return fileToBuiltUrl(pluginContext, normalizePath(url$3[0] === "/" ? path.join(topLevelConfig.root, url$3) : path.join(path.dirname(importer), url$3)), true, forceInline);
7575
7561
  }
7576
7562
  function shouldInline(environment, file, id, content, buildPluginContext, forceInline) {
7577
7563
  if (noInlineRE.test(id)) return false;
@@ -7685,8 +7671,7 @@ function manifestPlugin() {
7685
7671
  if (chunk.type === "chunk") manifest[getChunkName(chunk)] = createChunk(chunk);
7686
7672
  else if (chunk.type === "asset" && chunk.names.length > 0) {
7687
7673
  const src = chunk.originalFileNames.length > 0 ? chunk.originalFileNames[0] : `_${path.basename(chunk.fileName)}`;
7688
- const isEntry = entryCssAssetFileNames.has(chunk.fileName);
7689
- const asset = createAsset(chunk, src, isEntry);
7674
+ const asset = createAsset(chunk, src, entryCssAssetFileNames.has(chunk.fileName));
7690
7675
  const file$1 = manifest[src]?.file;
7691
7676
  if (!(file$1 && endsWithJSRE.test(file$1))) manifest[src] = asset;
7692
7677
  for (const originalFileName of chunk.originalFileNames.slice(1)) {
@@ -7973,7 +7958,7 @@ var require_convert_source_map = /* @__PURE__ */ __commonJS({ "../../node_module
7973
7958
  }) });
7974
7959
 
7975
7960
  //#endregion
7976
- //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.0-beta.41/node_modules/@rolldown/pluginutils/dist/index.mjs
7961
+ //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.0-beta.43/node_modules/@rolldown/pluginutils/dist/index.mjs
7977
7962
  /**
7978
7963
  * Constructs a RegExp that matches the exact string specified.
7979
7964
  *
@@ -8254,8 +8239,7 @@ var require_src$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/lilco
8254
8239
  const loaderKey = path$11.extname(searchPlace) || "noExt";
8255
8240
  const loader$1 = loaders[loaderKey];
8256
8241
  if (searchPlace === "package.json") {
8257
- const pkg = await loader$1(filepath, content);
8258
- const maybeConfig = getPackageProp(packageProp, pkg);
8242
+ const maybeConfig = getPackageProp(packageProp, await loader$1(filepath, content));
8259
8243
  if (maybeConfig != null) {
8260
8244
  result.config = maybeConfig;
8261
8245
  result.filepath = filepath;
@@ -8291,13 +8275,10 @@ var require_src$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/lilco
8291
8275
  const loader$1 = loaders[loaderKey];
8292
8276
  validateLoader(loader$1, loaderKey);
8293
8277
  const content = String(await fsReadFileAsync(absPath));
8294
- if (base === "package.json") {
8295
- const pkg = await loader$1(absPath, content);
8296
- return emplace(loadCache, absPath, transform$2({
8297
- config: getPackageProp(packageProp, pkg),
8298
- filepath: absPath
8299
- }));
8300
- }
8278
+ if (base === "package.json") return emplace(loadCache, absPath, transform$2({
8279
+ config: getPackageProp(packageProp, await loader$1(absPath, content)),
8280
+ filepath: absPath
8281
+ }));
8301
8282
  /** @type {import('./index').LilconfigResult} */
8302
8283
  const result = {
8303
8284
  config: null,
@@ -8366,8 +8347,7 @@ var require_src$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/lilco
8366
8347
  const loader$1 = loaders[loaderKey];
8367
8348
  const content = String(fs$11.readFileSync(filepath));
8368
8349
  if (searchPlace === "package.json") {
8369
- const pkg = loader$1(filepath, content);
8370
- const maybeConfig = getPackageProp(packageProp, pkg);
8350
+ const maybeConfig = getPackageProp(packageProp, loader$1(filepath, content));
8371
8351
  if (maybeConfig != null) {
8372
8352
  result.config = maybeConfig;
8373
8353
  result.filepath = filepath;
@@ -8403,13 +8383,10 @@ var require_src$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/lilco
8403
8383
  const loader$1 = loaders[loaderKey];
8404
8384
  validateLoader(loader$1, loaderKey);
8405
8385
  const content = String(fs$11.readFileSync(absPath));
8406
- if (base === "package.json") {
8407
- const pkg = loader$1(absPath, content);
8408
- return transform$2({
8409
- config: getPackageProp(packageProp, pkg),
8410
- filepath: absPath
8411
- });
8412
- }
8386
+ if (base === "package.json") return transform$2({
8387
+ config: getPackageProp(packageProp, loader$1(absPath, content)),
8388
+ filepath: absPath
8389
+ });
8413
8390
  const result = {
8414
8391
  config: null,
8415
8392
  filepath: absPath
@@ -8444,8 +8421,8 @@ var require_src$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/lilco
8444
8421
  }) });
8445
8422
 
8446
8423
  //#endregion
8447
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.5.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/req.js
8448
- var require_req = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.5.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/req.js": ((exports, module) => {
8424
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/req.js
8425
+ var require_req = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/req.js": ((exports, module) => {
8449
8426
  const { createRequire: createRequire$2 } = __require("node:module");
8450
8427
  const { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1 } = __require("node:url");
8451
8428
  const TS_EXT_RE = /\.[mc]?ts$/;
@@ -8487,8 +8464,8 @@ var require_req = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss
8487
8464
  }) });
8488
8465
 
8489
8466
  //#endregion
8490
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.5.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/options.js
8491
- var require_options = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.5.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/options.js": ((exports, module) => {
8467
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/options.js
8468
+ var require_options = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/options.js": ((exports, module) => {
8492
8469
  const req$2 = require_req();
8493
8470
  /**
8494
8471
  * Load Options
@@ -8522,8 +8499,8 @@ var require_options = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/pos
8522
8499
  }) });
8523
8500
 
8524
8501
  //#endregion
8525
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.5.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/plugins.js
8526
- var require_plugins = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.5.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/plugins.js": ((exports, module) => {
8502
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/plugins.js
8503
+ var require_plugins = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/plugins.js": ((exports, module) => {
8527
8504
  const req$1 = require_req();
8528
8505
  /**
8529
8506
  * Plugin Loader
@@ -8577,8 +8554,8 @@ var require_plugins = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/pos
8577
8554
  }) });
8578
8555
 
8579
8556
  //#endregion
8580
- //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.5.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/index.js
8581
- var require_src = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.5.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/index.js": ((exports, module) => {
8557
+ //#region ../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/index.js
8558
+ var require_src = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss-load-config@6.0.1_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_yaml@2.8.1/node_modules/postcss-load-config/src/index.js": ((exports, module) => {
8582
8559
  const { resolve: resolve$2 } = __require("node:path");
8583
8560
  const config$1 = require_src$1();
8584
8561
  const loadOptions = require_options();
@@ -8943,11 +8920,9 @@ function clearImports(imports) {
8943
8920
  }
8944
8921
  function getImportNames(cleanedImports) {
8945
8922
  const topLevelImports = cleanedImports.replace(/{[^}]*}/, "");
8946
- const namespacedImport = topLevelImports.match(/\* as \s*(\S*)/)?.[1];
8947
- const defaultImport = topLevelImports.split(",").find((index) => !/[*{}]/.test(index))?.trim() || void 0;
8948
8923
  return {
8949
- namespacedImport,
8950
- defaultImport
8924
+ namespacedImport: topLevelImports.match(/\* as \s*(\S*)/)?.[1],
8925
+ defaultImport: topLevelImports.split(",").find((index) => !/[*{}]/.test(index))?.trim() || void 0
8951
8926
  };
8952
8927
  }
8953
8928
  /**
@@ -9525,8 +9500,7 @@ var PartialEnvironment = class {
9525
9500
  return this._topLevelConfig[prop];
9526
9501
  } });
9527
9502
  const environment = import_picocolors$29.default.dim(`(${this.name})`);
9528
- const colorIndex = [...this.name].reduce((acc, c) => acc + c.charCodeAt(0), 0) % environmentColors.length;
9529
- const infoColor = environmentColors[colorIndex || 0];
9503
+ const infoColor = environmentColors[[...this.name].reduce((acc, c) => acc + c.charCodeAt(0), 0) % environmentColors.length || 0];
9530
9504
  this.logger = {
9531
9505
  get hasWarned() {
9532
9506
  return topLevelConfig.logger.hasWarned;
@@ -10124,8 +10098,7 @@ async function parseImportGlob(code, importer, root, resolveId, logger) {
10124
10098
  };
10125
10099
  const end = findCorrespondingCloseParenthesisPosition(cleanCode, start + match[0].length) + 1;
10126
10100
  if (end <= 0) throw err$2("Close parenthesis not found");
10127
- const statementCode = code.slice(start, end);
10128
- const rootAst = (await parseAstAsync(statementCode)).body[0];
10101
+ const rootAst = (await parseAstAsync(code.slice(start, end))).body[0];
10129
10102
  if (rootAst.type !== "ExpressionStatement") throw err$2(`Expect CallExpression, got ${rootAst.type}`);
10130
10103
  const ast = rootAst.expression;
10131
10104
  if (ast.type !== "CallExpression") throw err$2(`Expect CallExpression, got ${ast.type}`);
@@ -10201,10 +10174,9 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
10201
10174
  if (!matches$2.length) return null;
10202
10175
  const s$2 = new MagicString(code);
10203
10176
  const staticImports = (await Promise.all(matches$2.map(async ({ globsResolved, isRelative: isRelative$1, options: options$1, index, start, end, onlyKeys, onlyValues }) => {
10204
- const cwd = getCommonBase(globsResolved) ?? root;
10205
10177
  const files = (await glob(globsResolved, {
10206
10178
  absolute: true,
10207
- cwd,
10179
+ cwd: getCommonBase(globsResolved) ?? root,
10208
10180
  dot: !!options$1.exhaustive,
10209
10181
  expandDirectories: false,
10210
10182
  ignore: options$1.exhaustive ? [] : ["**/node_modules/**"]
@@ -10420,20 +10392,14 @@ function scanImports(environment) {
10420
10392
  ${entries.join("\n")}
10421
10393
 
10422
10394
  `);
10423
- if (e$1.errors) {
10424
- const msgs = await formatMessages(e$1.errors, {
10425
- kind: "error",
10426
- color: true
10427
- });
10428
- e$1.message = prependMessage + msgs.join("\n");
10429
- } else e$1.message = prependMessage + e$1.message;
10395
+ if (e$1.errors) e$1.message = prependMessage + (await formatMessages(e$1.errors, {
10396
+ kind: "error",
10397
+ color: true
10398
+ })).join("\n");
10399
+ else e$1.message = prependMessage + e$1.message;
10430
10400
  throw e$1;
10431
10401
  } finally {
10432
- if (debug$15) {
10433
- const duration = (performance$1.now() - start).toFixed(2);
10434
- const depsStr = Object.keys(orderedDependencies(deps)).sort().map((id) => `\n ${import_picocolors$27.default.cyan(id)} -> ${import_picocolors$27.default.dim(deps[id])}`).join("") || import_picocolors$27.default.dim("no dependencies found");
10435
- debug$15(`Scan completed in ${duration}ms: ${depsStr}`);
10436
- }
10402
+ if (debug$15) debug$15(`Scan completed in ${(performance$1.now() - start).toFixed(2)}ms: ${Object.keys(orderedDependencies(deps)).sort().map((id) => `\n ${import_picocolors$27.default.cyan(id)} -> ${import_picocolors$27.default.dim(deps[id])}`).join("") || import_picocolors$27.default.dim("no dependencies found")}`);
10437
10403
  }
10438
10404
  } finally {
10439
10405
  context?.dispose().catch((e$1) => {
@@ -10441,10 +10407,9 @@ function scanImports(environment) {
10441
10407
  });
10442
10408
  }
10443
10409
  }
10444
- const result = scan();
10445
10410
  return {
10446
10411
  cancel,
10447
- result: result.then((res) => res ?? {
10412
+ result: scan().then((res) => res ?? {
10448
10413
  deps: {},
10449
10414
  missing: {}
10450
10415
  })
@@ -10862,8 +10827,7 @@ async function optimizeDeps(config$2, force = config$2.optimizeDeps.force, asCom
10862
10827
  await addManuallyIncludedOptimizeDeps(environment, deps);
10863
10828
  const depsString = depsLogString(Object.keys(deps));
10864
10829
  log$4?.(import_picocolors$26.default.green(`Optimizing dependencies:\n ${depsString}`));
10865
- const depsInfo = toDiscoveredDependencies(environment, deps);
10866
- const result = await runOptimizeDeps(environment, depsInfo).result;
10830
+ const result = await runOptimizeDeps(environment, toDiscoveredDependencies(environment, deps)).result;
10867
10831
  await result.commit();
10868
10832
  return result.metadata;
10869
10833
  }
@@ -10872,8 +10836,7 @@ async function optimizeExplicitEnvironmentDeps(environment) {
10872
10836
  if (cachedMetadata) return cachedMetadata;
10873
10837
  const deps = {};
10874
10838
  await addManuallyIncludedOptimizeDeps(environment, deps);
10875
- const depsInfo = toDiscoveredDependencies(environment, deps);
10876
- const result = await runOptimizeDeps(environment, depsInfo).result;
10839
+ const result = await runOptimizeDeps(environment, toDiscoveredDependencies(environment, deps)).result;
10877
10840
  await result.commit();
10878
10841
  return result.metadata;
10879
10842
  }
@@ -11080,13 +11043,11 @@ function runOptimizeDeps(environment, depsInfo) {
11080
11043
  }).catch(async (e$1) => {
11081
11044
  if (e$1.errors && e$1.message.includes("The build was canceled")) return cancelledResult;
11082
11045
  const prependMessage = import_picocolors$26.default.red("Error during dependency optimization:\n\n");
11083
- if (e$1.errors) {
11084
- const msgs = await formatMessages(e$1.errors, {
11085
- kind: "error",
11086
- color: true
11087
- });
11088
- e$1.message = prependMessage + msgs.join("\n");
11089
- } else e$1.message = prependMessage + e$1.message;
11046
+ if (e$1.errors) e$1.message = prependMessage + (await formatMessages(e$1.errors, {
11047
+ kind: "error",
11048
+ color: true
11049
+ })).join("\n");
11050
+ else e$1.message = prependMessage + e$1.message;
11090
11051
  throw e$1;
11091
11052
  }).finally(() => {
11092
11053
  return disposeContext();
@@ -11291,13 +11252,12 @@ async function extractExportsData(environment, filePath) {
11291
11252
  const { optimizeDeps: optimizeDeps$1 } = environment.config;
11292
11253
  const esbuildOptions = optimizeDeps$1.esbuildOptions ?? {};
11293
11254
  if (optimizeDeps$1.extensions?.some((ext) => filePath.endsWith(ext))) {
11294
- const result = await build({
11255
+ const [, exports$2, , hasModuleSyntax$1] = parse((await build({
11295
11256
  ...esbuildOptions,
11296
11257
  entryPoints: [filePath],
11297
11258
  write: false,
11298
11259
  format: "esm"
11299
- });
11300
- const [, exports$2, , hasModuleSyntax$1] = parse(result.outputFiles[0].text);
11260
+ })).outputFiles[0].text);
11301
11261
  return {
11302
11262
  hasModuleSyntax: hasModuleSyntax$1,
11303
11263
  exports: exports$2.map((e$1) => e$1.n)
@@ -11311,8 +11271,7 @@ async function extractExportsData(environment, filePath) {
11311
11271
  } catch {
11312
11272
  const loader$1 = esbuildOptions.loader?.[path.extname(filePath)] || "jsx";
11313
11273
  debug$14?.(`Unable to parse: ${filePath}.\n Trying again with a ${loader$1} transform.`);
11314
- const transformed = await transformWithEsbuild(entryContent, filePath, { loader: loader$1 }, void 0, environment.config);
11315
- parseResult = parse(transformed.code);
11274
+ parseResult = parse((await transformWithEsbuild(entryContent, filePath, { loader: loader$1 }, void 0, environment.config)).code);
11316
11275
  usedJsxLoader = true;
11317
11276
  }
11318
11277
  const [, exports$1, , hasModuleSyntax] = parseResult;
@@ -11383,7 +11342,7 @@ const lockfilePaths = lockfileFormats.map((l) => l.path);
11383
11342
  function getConfigHash(environment) {
11384
11343
  const { config: config$2 } = environment;
11385
11344
  const { optimizeDeps: optimizeDeps$1 } = config$2;
11386
- const content = JSON.stringify({
11345
+ return getHash(JSON.stringify({
11387
11346
  define: !config$2.keepProcessEnv ? process.env.NODE_ENV || config$2.mode : null,
11388
11347
  root: config$2.root,
11389
11348
  resolve: config$2.resolve,
@@ -11400,8 +11359,7 @@ function getConfigHash(environment) {
11400
11359
  }, (_, value$1) => {
11401
11360
  if (typeof value$1 === "function" || value$1 instanceof RegExp) return value$1.toString();
11402
11361
  return value$1;
11403
- });
11404
- return getHash(content);
11362
+ }));
11405
11363
  }
11406
11364
  function getLockfileHash(environment) {
11407
11365
  const lockfilePath = lookupFile(environment.config.root, lockfilePaths);
@@ -11411,8 +11369,7 @@ function getLockfileHash(environment) {
11411
11369
  const lockfileFormat = lockfileFormats.find((f$1) => normalizedLockfilePath.endsWith(f$1.path));
11412
11370
  if (lockfileFormat.checkPatchesDir) {
11413
11371
  const baseDir = lockfilePath.slice(0, -lockfileFormat.path.length);
11414
- const fullPath = path.join(baseDir, lockfileFormat.checkPatchesDir);
11415
- const stat$4 = tryStatSync(fullPath);
11372
+ const stat$4 = tryStatSync(path.join(baseDir, lockfileFormat.checkPatchesDir));
11416
11373
  if (stat$4?.isDirectory()) content += stat$4.mtimeMs.toString();
11417
11374
  }
11418
11375
  }
@@ -11597,8 +11554,7 @@ function resolvePlugin(resolveOptions) {
11597
11554
  return ensureVersionQuery(res, id, options$1, depsOptimizer);
11598
11555
  }
11599
11556
  if (asSrc && id[0] === "/" && (rootInRoot || !id.startsWith(withTrailingSlash(root)))) {
11600
- const fsPath = path.resolve(root, id.slice(1));
11601
- if (res = tryFsResolve(fsPath, options$1)) {
11557
+ if (res = tryFsResolve(path.resolve(root, id.slice(1)), options$1)) {
11602
11558
  debug$12?.(`[url] ${import_picocolors$25.default.cyan(id)} -> ${import_picocolors$25.default.dim(res)}`);
11603
11559
  return ensureVersionQuery(res, id, options$1, depsOptimizer);
11604
11560
  }
@@ -11634,8 +11590,7 @@ function resolvePlugin(resolveOptions) {
11634
11590
  }
11635
11591
  if (isWindows && id[0] === "/") {
11636
11592
  const basedir = importer ? path.dirname(importer) : process.cwd();
11637
- const fsPath = path.resolve(basedir, id);
11638
- if (res = tryFsResolve(fsPath, options$1)) {
11593
+ if (res = tryFsResolve(path.resolve(basedir, id), options$1)) {
11639
11594
  debug$12?.(`[drive-relative] ${import_picocolors$25.default.cyan(id)} -> ${import_picocolors$25.default.dim(res)}`);
11640
11595
  return ensureVersionQuery(res, id, options$1, depsOptimizer);
11641
11596
  }
@@ -11777,8 +11732,7 @@ function tryCleanFsResolve(file, options$1, tryIndex = true, skipPackageJson = f
11777
11732
  try {
11778
11733
  if (fs.existsSync(pkgPath)) {
11779
11734
  if (!options$1.preserveSymlinks) pkgPath = safeRealpathSync(pkgPath);
11780
- const pkg = loadPackageData(pkgPath);
11781
- return resolvePackageEntry(dirPath, pkg, options$1);
11735
+ return resolvePackageEntry(dirPath, loadPackageData(pkgPath), options$1);
11782
11736
  }
11783
11737
  } catch (e$1) {
11784
11738
  if (e$1.code !== ERR_RESOLVE_PACKAGE_ENTRY_FAIL && e$1.code !== "ENOENT") throw e$1;
@@ -11815,9 +11769,7 @@ function tryNodeResolve(id, importer, options$1, depsOptimizer, externalize) {
11815
11769
  }
11816
11770
  return;
11817
11771
  }
11818
- const resolveId = deepMatch ? resolveDeepImport : resolvePackageEntry;
11819
- const unresolvedId = deepMatch ? "." + id.slice(pkgId.length) : id;
11820
- let resolved = resolveId(unresolvedId, pkg, options$1, externalize);
11772
+ let resolved = (deepMatch ? resolveDeepImport : resolvePackageEntry)(deepMatch ? "." + id.slice(pkgId.length) : id, pkg, options$1, externalize);
11821
11773
  if (!resolved) return;
11822
11774
  const processResult$1 = (resolved$1) => {
11823
11775
  if (!externalize) return resolved$1;
@@ -11904,8 +11856,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
11904
11856
  const { browser: browserField } = data;
11905
11857
  if (options$1.mainFields.includes("browser") && isObject(browserField)) entry = mapWithBrowserField(entry, browserField) || entry;
11906
11858
  }
11907
- const entryPointPath = path.join(dir, entry);
11908
- const resolvedEntryPoint = tryFsResolve(entryPointPath, options$1, true, skipPackageJson);
11859
+ const resolvedEntryPoint = tryFsResolve(path.join(dir, entry), options$1, true, skipPackageJson);
11909
11860
  if (resolvedEntryPoint) {
11910
11861
  debug$12?.(`[package entry] ${import_picocolors$25.default.cyan(idWithoutPostfix)} -> ${import_picocolors$25.default.dim(resolvedEntryPoint)}${postfix !== "" ? ` (postfix: ${postfix})` : ""}`);
11911
11862
  setResolvedCache(".", resolvedEntryPoint, options$1);
@@ -11970,8 +11921,7 @@ function tryResolveBrowserMapping(id, importer, options$1, isFilePath, externali
11970
11921
  let res;
11971
11922
  const pkg = importer && findNearestPackageData(path.dirname(importer), options$1.packageCache);
11972
11923
  if (pkg && isObject(pkg.data.browser)) {
11973
- const mapId = isFilePath ? "./" + slash(path.relative(pkg.dir, id)) : id;
11974
- const browserMappedPath = mapWithBrowserField(mapId, pkg.data.browser);
11924
+ const browserMappedPath = mapWithBrowserField(isFilePath ? "./" + slash(path.relative(pkg.dir, id)) : id, pkg.data.browser);
11975
11925
  if (browserMappedPath) {
11976
11926
  if (res = bareImportRE.test(browserMappedPath) ? tryNodeResolve(browserMappedPath, importer, options$1, void 0, void 0)?.id : tryFsResolve(path.join(pkg.dir, browserMappedPath), options$1)) {
11977
11927
  debug$12?.(`[browser mapped] ${import_picocolors$25.default.cyan(id)} -> ${import_picocolors$25.default.dim(res)}`);
@@ -11996,11 +11946,8 @@ function tryResolveBrowserEntry(dir, data, options$1) {
11996
11946
  const browserEntry = typeof data.browser === "string" ? data.browser : isObject(data.browser) && data.browser["."];
11997
11947
  if (browserEntry) if (!options$1.isRequire && options$1.mainFields.includes("module") && typeof data.module === "string" && data.module !== browserEntry) {
11998
11948
  const resolvedBrowserEntry = tryFsResolve(path.join(dir, browserEntry), options$1);
11999
- if (resolvedBrowserEntry) {
12000
- const content = fs.readFileSync(resolvedBrowserEntry, "utf-8");
12001
- if (hasESMSyntax(content)) return browserEntry;
12002
- else return data.module;
12003
- }
11949
+ if (resolvedBrowserEntry) if (hasESMSyntax(fs.readFileSync(resolvedBrowserEntry, "utf-8"))) return browserEntry;
11950
+ else return data.module;
12004
11951
  } else return browserEntry;
12005
11952
  }
12006
11953
  /**
@@ -12249,8 +12196,7 @@ var require_main$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/dote
12249
12196
  const length = keys.length;
12250
12197
  let decrypted;
12251
12198
  for (let i$1 = 0; i$1 < length; i$1++) try {
12252
- const key = keys[i$1].trim();
12253
- const attrs = _instructions(result, key);
12199
+ const attrs = _instructions(result, keys[i$1].trim());
12254
12200
  decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
12255
12201
  break;
12256
12202
  } catch (error$1) {
@@ -12535,10 +12481,9 @@ function loadEnv(mode, envDir, prefixes = "VITE_") {
12535
12481
  if (parsed.NODE_ENV && process.env.VITE_USER_NODE_ENV === void 0) process.env.VITE_USER_NODE_ENV = parsed.NODE_ENV;
12536
12482
  if (parsed.BROWSER && process.env.BROWSER === void 0) process.env.BROWSER = parsed.BROWSER;
12537
12483
  if (parsed.BROWSER_ARGS && process.env.BROWSER_ARGS === void 0) process.env.BROWSER_ARGS = parsed.BROWSER_ARGS;
12538
- const processEnv = { ...process.env };
12539
12484
  (0, import_main$1.expand)({
12540
12485
  parsed,
12541
- processEnv
12486
+ processEnv: { ...process.env }
12542
12487
  });
12543
12488
  for (const [key, value$1] of Object.entries(parsed)) if (prefixes.some((prefix) => key.startsWith(prefix))) env$1[key] = value$1;
12544
12489
  for (const key in process.env) if (prefixes.some((prefix) => key.startsWith(prefix))) env$1[key] = process.env[key];
@@ -14275,8 +14220,7 @@ var require_vary = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/vary@1
14275
14220
  function vary(res, field) {
14276
14221
  if (!res || !res.getHeader || !res.setHeader) throw new TypeError("res argument is required");
14277
14222
  var val = res.getHeader("Vary") || "";
14278
- var header = Array.isArray(val) ? val.join(", ") : String(val);
14279
- if (val = append$1(header, field)) res.setHeader("Vary", val);
14223
+ if (val = append$1(Array.isArray(val) ? val.join(", ") : String(val), field)) res.setHeader("Vary", val);
14280
14224
  }
14281
14225
  }) });
14282
14226
 
@@ -15754,7 +15698,7 @@ var require_parse$2 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/bra
15754
15698
  */
15755
15699
  if (value$1 === CHAR_LEFT_CURLY_BRACE) {
15756
15700
  depth++;
15757
- const brace = {
15701
+ block = push$1({
15758
15702
  type: "brace",
15759
15703
  open: true,
15760
15704
  close: false,
@@ -15763,8 +15707,7 @@ var require_parse$2 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/bra
15763
15707
  commas: 0,
15764
15708
  ranges: 0,
15765
15709
  nodes: []
15766
- };
15767
- block = push$1(brace);
15710
+ });
15768
15711
  stack.push(block);
15769
15712
  push$1({
15770
15713
  type: "open",
@@ -16475,8 +16418,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJS({ "../../node_modules/.p
16475
16418
  const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
16476
16419
  cont.watcherUnusable = true;
16477
16420
  if (isWindows$3 && error$1.code === "EPERM") try {
16478
- const fd$1 = await open$1(path$13, "r");
16479
- await close(fd$1);
16421
+ await close(await open$1(path$13, "r"));
16480
16422
  broadcastErr(error$1);
16481
16423
  } catch (err$2) {}
16482
16424
  else broadcastErr(error$1);
@@ -17665,8 +17607,7 @@ var require_chokidar = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ch
17665
17607
  }
17666
17608
  const now$1 = Number(/* @__PURE__ */ new Date());
17667
17609
  if (prevStat && curStat.size !== prevStat.size) this._pendingWrites.get(path$13).lastChange = now$1;
17668
- const pw = this._pendingWrites.get(path$13);
17669
- if (now$1 - pw.lastChange >= threshold) {
17610
+ if (now$1 - this._pendingWrites.get(path$13).lastChange >= threshold) {
17670
17611
  this._pendingWrites.delete(path$13);
17671
17612
  awfEmit(void 0, curStat);
17672
17613
  } else timeoutHandler = setTimeout(awaitWriteFinish, this.options.awaitWriteFinish.pollInterval, curStat);
@@ -17700,8 +17641,7 @@ var require_chokidar = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ch
17700
17641
  const ign = this.options.ignored;
17701
17642
  const ignored = ign && ign.map(normalizeIgnored(cwd));
17702
17643
  const paths = arrify(ignored).filter((path$14) => typeof path$14 === STRING_TYPE && !isGlob(path$14)).map((path$14) => path$14 + SLASH_GLOBSTAR);
17703
- const list = this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths);
17704
- this._userIgnored = anymatch(list, void 0, ANYMATCH_OPTS);
17644
+ this._userIgnored = anymatch(this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths), void 0, ANYMATCH_OPTS);
17705
17645
  }
17706
17646
  return this._userIgnored([path$13, stats]);
17707
17647
  }
@@ -17807,13 +17747,12 @@ var require_chokidar = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ch
17807
17747
  }
17808
17748
  _readdirp(root, opts) {
17809
17749
  if (this.closed) return;
17810
- const options$1 = {
17750
+ let stream$3 = readdirp(root, {
17811
17751
  type: EV_ALL,
17812
17752
  alwaysStat: true,
17813
17753
  lstat: true,
17814
17754
  ...opts
17815
- };
17816
- let stream$3 = readdirp(root, options$1);
17755
+ });
17817
17756
  this._streams.add(stream$3);
17818
17757
  stream$3.once(STR_CLOSE, () => {
17819
17758
  stream$3 = void 0;
@@ -17904,8 +17843,7 @@ var require_parse$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/she
17904
17843
  if (!opts) opts = {};
17905
17844
  var BS = opts.escape || "\\";
17906
17845
  var BAREWORD = "(\\" + BS + "['\"" + META + "]|[^\\s'\"" + META + "])+";
17907
- var chunker = new RegExp(["(" + CONTROL + ")", "(" + BAREWORD + "|" + SINGLE_QUOTE + "|" + DOUBLE_QUOTE + ")+"].join("|"), "g");
17908
- var matches$2 = matchAll(string, chunker);
17846
+ var matches$2 = matchAll(string, new RegExp(["(" + CONTROL + ")", "(" + BAREWORD + "|" + SINGLE_QUOTE + "|" + DOUBLE_QUOTE + ")+"].join("|"), "g"));
17909
17847
  if (matches$2.length === 0) return [];
17910
17848
  if (!env$1) env$1 = {};
17911
17849
  var commented = false;
@@ -18372,8 +18310,7 @@ var require_launch_editor_middleware = /* @__PURE__ */ __commonJS({ "../../node_
18372
18310
  res.statusCode = 500;
18373
18311
  res.end(`launch-editor-middleware: required query param "file" is missing.`);
18374
18312
  } else {
18375
- const resolved = file.startsWith("file://") ? file : path$5.resolve(srcRoot, file);
18376
- launch(resolved, specifiedEditor, onErrorCallback);
18313
+ launch(file.startsWith("file://") ? file : path$5.resolve(srcRoot, file), specifiedEditor, onErrorCallback);
18377
18314
  res.end();
18378
18315
  }
18379
18316
  };
@@ -18400,16 +18337,16 @@ async function resolveHttpServer({ proxy }, app, httpsOptions) {
18400
18337
  }, app);
18401
18338
  }
18402
18339
  }
18403
- async function resolveHttpsConfig(https$5) {
18404
- if (!https$5) return void 0;
18340
+ async function resolveHttpsConfig(https$4) {
18341
+ if (!https$4) return void 0;
18405
18342
  const [ca, cert, key, pfx] = await Promise.all([
18406
- readFileIfExists(https$5.ca),
18407
- readFileIfExists(https$5.cert),
18408
- readFileIfExists(https$5.key),
18409
- readFileIfExists(https$5.pfx)
18343
+ readFileIfExists(https$4.ca),
18344
+ readFileIfExists(https$4.cert),
18345
+ readFileIfExists(https$4.key),
18346
+ readFileIfExists(https$4.pfx)
18410
18347
  ]);
18411
18348
  return {
18412
- ...https$5,
18349
+ ...https$4,
18413
18350
  ca,
18414
18351
  cert,
18415
18352
  key,
@@ -18474,8 +18411,7 @@ function ssrRewriteStacktrace(stack, moduleGraph) {
18474
18411
  if (!id) return input;
18475
18412
  const rawSourceMap = moduleGraph.getModuleById(id)?.transformResult?.map;
18476
18413
  if (!rawSourceMap) return input;
18477
- const traced = new TraceMap(rawSourceMap);
18478
- const pos = originalPositionFor(traced, {
18414
+ const pos = originalPositionFor(new TraceMap(rawSourceMap), {
18479
18415
  line: Number(line$1) - offset,
18480
18416
  column: Number(column) - 1
18481
18417
  });
@@ -18501,8 +18437,7 @@ const rewroteStacktraces = /* @__PURE__ */ new WeakSet();
18501
18437
  function ssrFixStacktrace(e$1, moduleGraph) {
18502
18438
  if (!e$1.stack) return;
18503
18439
  if (rewroteStacktraces.has(e$1)) return;
18504
- const stacktrace = ssrRewriteStacktrace(e$1.stack, moduleGraph);
18505
- rebindErrorStacktrace(e$1, stacktrace);
18440
+ rebindErrorStacktrace(e$1, ssrRewriteStacktrace(e$1.stack, moduleGraph));
18506
18441
  rewroteStacktraces.add(e$1);
18507
18442
  }
18508
18443
 
@@ -18955,8 +18890,7 @@ async function ssrTransformScript(code, inMap, url$3, originalCode) {
18955
18890
  for (const spec of node.specifiers) {
18956
18891
  const local = spec.local.name;
18957
18892
  const binding = idToImportMap.get(local);
18958
- const exportedAs = getIdentifierNameOrLiteralValue$1(spec.exported);
18959
- defineExport(exportedAs, binding || local);
18893
+ defineExport(getIdentifierNameOrLiteralValue$1(spec.exported), binding || local);
18960
18894
  }
18961
18895
  }
18962
18896
  if (node.type === "ExportDefaultDeclaration") if ("id" in node.declaration && node.declaration.id && !["FunctionExpression", "ClassExpression"].includes(node.declaration.type)) {
@@ -18970,10 +18904,8 @@ async function ssrTransformScript(code, inMap, url$3, originalCode) {
18970
18904
  }
18971
18905
  if (node.type === "ExportAllDeclaration") {
18972
18906
  const importId = reExportImportIdMap.get(node);
18973
- if (node.exported) {
18974
- const exportedAs = getIdentifierNameOrLiteralValue$1(node.exported);
18975
- defineExport(exportedAs, `${importId}`);
18976
- } else s$2.appendLeft(node.end, `${ssrExportAllKey}(${importId});\n`);
18907
+ if (node.exported) defineExport(getIdentifierNameOrLiteralValue$1(node.exported), `${importId}`);
18908
+ else s$2.appendLeft(node.end, `${ssrExportAllKey}(${importId});\n`);
18977
18909
  }
18978
18910
  }
18979
18911
  walk$1(ast, {
@@ -19386,14 +19318,13 @@ Get the default browser name in Windows from WSL.
19386
19318
  async function getWindowsDefaultBrowserFromWsl() {
19387
19319
  const powershellPath = await powerShellPath();
19388
19320
  const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
19389
- const encodedCommand = Buffer$1.from(rawCommand, "utf16le").toString("base64");
19390
19321
  const { stdout } = await execFile$1(powershellPath, [
19391
19322
  "-NoProfile",
19392
19323
  "-NonInteractive",
19393
19324
  "-ExecutionPolicy",
19394
19325
  "Bypass",
19395
19326
  "-EncodedCommand",
19396
- encodedCommand
19327
+ Buffer$1.from(rawCommand, "utf16le").toString("base64")
19397
19328
  ], { encoding: "utf8" });
19398
19329
  const progId = stdout.trim();
19399
19330
  const browserMap = {
@@ -19716,8 +19647,7 @@ var require_which = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/which
19716
19647
  const ppRaw = pathEnv[i$1];
19717
19648
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
19718
19649
  const pCmd = path$4.join(pathPart, cmd);
19719
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
19720
- resolve$4(subStep(p, i$1, 0));
19650
+ resolve$4(subStep(!pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd, i$1, 0));
19721
19651
  });
19722
19652
  const subStep = (p, i$1, ii) => new Promise((resolve$4, reject) => {
19723
19653
  if (ii === pathExt.length) return resolve$4(step(i$1 + 1));
@@ -19996,10 +19926,7 @@ var import_picocolors$19 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
19996
19926
  function openBrowser(url$3, opt, logger) {
19997
19927
  const browser = typeof opt === "string" ? opt : process.env.BROWSER || "";
19998
19928
  if (browser.toLowerCase().endsWith(".js")) executeNodeScript(browser, url$3, logger);
19999
- else if (browser.toLowerCase() !== "none") {
20000
- const browserArgs = process.env.BROWSER_ARGS ? process.env.BROWSER_ARGS.split(" ") : [];
20001
- startBrowserProcess(browser, browserArgs, url$3, logger);
20002
- }
19929
+ else if (browser.toLowerCase() !== "none") startBrowserProcess(browser, process.env.BROWSER_ARGS ? process.env.BROWSER_ARGS.split(" ") : [], url$3, logger);
20003
19930
  }
20004
19931
  function executeNodeScript(scriptPath, url$3, logger) {
20005
19932
  const extraArgs = process.argv.slice(2);
@@ -21070,14 +20997,12 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
21070
20997
  }
21071
20998
  const buf = this.consume(2);
21072
20999
  if ((buf[0] & 48) !== 0) {
21073
- const error$1 = this.createError(RangeError, "RSV2 and RSV3 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_2_3");
21074
- cb(error$1);
21000
+ cb(this.createError(RangeError, "RSV2 and RSV3 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_2_3"));
21075
21001
  return;
21076
21002
  }
21077
21003
  const compressed = (buf[0] & 64) === 64;
21078
21004
  if (compressed && !this._extensions[PerMessageDeflate$3.extensionName]) {
21079
- const error$1 = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
21080
- cb(error$1);
21005
+ cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
21081
21006
  return;
21082
21007
  }
21083
21008
  this._fin = (buf[0] & 128) === 128;
@@ -21085,55 +21010,46 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
21085
21010
  this._payloadLength = buf[1] & 127;
21086
21011
  if (this._opcode === 0) {
21087
21012
  if (compressed) {
21088
- const error$1 = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
21089
- cb(error$1);
21013
+ cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
21090
21014
  return;
21091
21015
  }
21092
21016
  if (!this._fragmented) {
21093
- const error$1 = this.createError(RangeError, "invalid opcode 0", true, 1002, "WS_ERR_INVALID_OPCODE");
21094
- cb(error$1);
21017
+ cb(this.createError(RangeError, "invalid opcode 0", true, 1002, "WS_ERR_INVALID_OPCODE"));
21095
21018
  return;
21096
21019
  }
21097
21020
  this._opcode = this._fragmented;
21098
21021
  } else if (this._opcode === 1 || this._opcode === 2) {
21099
21022
  if (this._fragmented) {
21100
- const error$1 = this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE");
21101
- cb(error$1);
21023
+ cb(this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE"));
21102
21024
  return;
21103
21025
  }
21104
21026
  this._compressed = compressed;
21105
21027
  } else if (this._opcode > 7 && this._opcode < 11) {
21106
21028
  if (!this._fin) {
21107
- const error$1 = this.createError(RangeError, "FIN must be set", true, 1002, "WS_ERR_EXPECTED_FIN");
21108
- cb(error$1);
21029
+ cb(this.createError(RangeError, "FIN must be set", true, 1002, "WS_ERR_EXPECTED_FIN"));
21109
21030
  return;
21110
21031
  }
21111
21032
  if (compressed) {
21112
- const error$1 = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
21113
- cb(error$1);
21033
+ cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
21114
21034
  return;
21115
21035
  }
21116
21036
  if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
21117
- const error$1 = this.createError(RangeError, `invalid payload length ${this._payloadLength}`, true, 1002, "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");
21118
- cb(error$1);
21037
+ cb(this.createError(RangeError, `invalid payload length ${this._payloadLength}`, true, 1002, "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"));
21119
21038
  return;
21120
21039
  }
21121
21040
  } else {
21122
- const error$1 = this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE");
21123
- cb(error$1);
21041
+ cb(this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE"));
21124
21042
  return;
21125
21043
  }
21126
21044
  if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
21127
21045
  this._masked = (buf[1] & 128) === 128;
21128
21046
  if (this._isServer) {
21129
21047
  if (!this._masked) {
21130
- const error$1 = this.createError(RangeError, "MASK must be set", true, 1002, "WS_ERR_EXPECTED_MASK");
21131
- cb(error$1);
21048
+ cb(this.createError(RangeError, "MASK must be set", true, 1002, "WS_ERR_EXPECTED_MASK"));
21132
21049
  return;
21133
21050
  }
21134
21051
  } else if (this._masked) {
21135
- const error$1 = this.createError(RangeError, "MASK must be clear", true, 1002, "WS_ERR_UNEXPECTED_MASK");
21136
- cb(error$1);
21052
+ cb(this.createError(RangeError, "MASK must be clear", true, 1002, "WS_ERR_UNEXPECTED_MASK"));
21137
21053
  return;
21138
21054
  }
21139
21055
  if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
@@ -21168,8 +21084,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
21168
21084
  const buf = this.consume(8);
21169
21085
  const num = buf.readUInt32BE(0);
21170
21086
  if (num > Math.pow(2, 21) - 1) {
21171
- const error$1 = this.createError(RangeError, "Unsupported WebSocket frame: payload length > 2^53 - 1", false, 1009, "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");
21172
- cb(error$1);
21087
+ cb(this.createError(RangeError, "Unsupported WebSocket frame: payload length > 2^53 - 1", false, 1009, "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"));
21173
21088
  return;
21174
21089
  }
21175
21090
  this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
@@ -21185,8 +21100,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
21185
21100
  if (this._payloadLength && this._opcode < 8) {
21186
21101
  this._totalPayloadLength += this._payloadLength;
21187
21102
  if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
21188
- const error$1 = this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");
21189
- cb(error$1);
21103
+ cb(this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
21190
21104
  return;
21191
21105
  }
21192
21106
  }
@@ -21250,8 +21164,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
21250
21164
  if (buf.length) {
21251
21165
  this._messageLength += buf.length;
21252
21166
  if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
21253
- const error$1 = this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");
21254
- cb(error$1);
21167
+ cb(this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
21255
21168
  return;
21256
21169
  }
21257
21170
  this._fragments.push(buf);
@@ -21297,8 +21210,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
21297
21210
  } else {
21298
21211
  const buf = concat(fragments, messageLength);
21299
21212
  if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
21300
- const error$1 = this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8");
21301
- cb(error$1);
21213
+ cb(this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8"));
21302
21214
  return;
21303
21215
  }
21304
21216
  if (this._state === INFLATING || this._allowSynchronousEvents) {
@@ -21330,14 +21242,12 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
21330
21242
  } else {
21331
21243
  const code = data.readUInt16BE(0);
21332
21244
  if (!isValidStatusCode$1(code)) {
21333
- const error$1 = this.createError(RangeError, `invalid status code ${code}`, true, 1002, "WS_ERR_INVALID_CLOSE_CODE");
21334
- cb(error$1);
21245
+ cb(this.createError(RangeError, `invalid status code ${code}`, true, 1002, "WS_ERR_INVALID_CLOSE_CODE"));
21335
21246
  return;
21336
21247
  }
21337
21248
  const buf = new FastBuffer(data.buffer, data.byteOffset + 2, data.length - 2);
21338
21249
  if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
21339
- const error$1 = this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8");
21340
- cb(error$1);
21250
+ cb(this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8"));
21341
21251
  return;
21342
21252
  }
21343
21253
  this._loop = false;
@@ -22248,7 +22158,7 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
22248
22158
  //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js
22249
22159
  var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js": ((exports, module) => {
22250
22160
  const EventEmitter$2 = __require("events");
22251
- const https$4 = __require("https");
22161
+ const https$3 = __require("https");
22252
22162
  const http$5 = __require("http");
22253
22163
  const net$1 = __require("net");
22254
22164
  const tls = __require("tls");
@@ -22804,7 +22714,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
22804
22714
  }
22805
22715
  const defaultPort = isSecure ? 443 : 80;
22806
22716
  const key = randomBytes(16).toString("base64");
22807
- const request = isSecure ? https$4.request : http$5.request;
22717
+ const request = isSecure ? https$3.request : http$5.request;
22808
22718
  const protocolSet = /* @__PURE__ */ new Set();
22809
22719
  let perMessageDeflate;
22810
22720
  opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
@@ -22885,8 +22795,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
22885
22795
  try {
22886
22796
  addr = new URL$3(location$1, address);
22887
22797
  } catch (e$1) {
22888
- const err$2 = /* @__PURE__ */ new SyntaxError(`Invalid URL: ${location$1}`);
22889
- emitErrorAndClose(websocket, err$2);
22798
+ emitErrorAndClose(websocket, /* @__PURE__ */ new SyntaxError(`Invalid URL: ${location$1}`));
22890
22799
  return;
22891
22800
  }
22892
22801
  initAsClient(websocket, addr, protocols, options$1);
@@ -23748,7 +23657,7 @@ var import_websocket = /* @__PURE__ */ __toESM(require_websocket(), 1);
23748
23657
  var import_websocket_server = /* @__PURE__ */ __toESM(require_websocket_server(), 1);
23749
23658
 
23750
23659
  //#endregion
23751
- //#region ../../node_modules/.pnpm/host-validation-middleware@0.1.1/node_modules/host-validation-middleware/dist/index.js
23660
+ //#region ../../node_modules/.pnpm/host-validation-middleware@0.1.2/node_modules/host-validation-middleware/dist/index.js
23752
23661
  /**
23753
23662
  * This function assumes that the input is not malformed.
23754
23663
  * This is because we only care about browser requests.
@@ -23882,10 +23791,7 @@ function createWebSocketServer(server, config$2, httpsOptions) {
23882
23791
  if (req$4.headers["sec-websocket-protocol"] === "vite-ping") return true;
23883
23792
  if (allowedHosts !== true && !isHostAllowed(req$4.headers.host, allowedHosts)) return false;
23884
23793
  if (config$2.legacy?.skipWebSocketTokenCheck) return true;
23885
- if (req$4.headers.origin) {
23886
- const parsedUrl = new URL(`http://example.com${req$4.url}`);
23887
- return hasValidToken(config$2, parsedUrl);
23888
- }
23794
+ if (req$4.headers.origin) return hasValidToken(config$2, new URL(`http://example.com${req$4.url}`));
23889
23795
  return true;
23890
23796
  };
23891
23797
  const handleUpgrade = (req$4, socket, head, isPing) => {
@@ -24076,8 +23982,8 @@ function baseMiddleware(rawBase, middlewareMode) {
24076
23982
  }
24077
23983
 
24078
23984
  //#endregion
24079
- //#region ../../node_modules/.pnpm/http-proxy-3@1.21.1/node_modules/http-proxy-3/dist/lib/http-proxy/common.js
24080
- var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http-proxy-3@1.21.1/node_modules/http-proxy-3/dist/lib/http-proxy/common.js": ((exports) => {
23985
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/http-proxy/common.js
23986
+ var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/http-proxy/common.js": ((exports) => {
24081
23987
  Object.defineProperty(exports, "__esModule", { value: true });
24082
23988
  exports.isSSL = void 0;
24083
23989
  exports.setupOutgoing = setupOutgoing;
@@ -24091,6 +23997,12 @@ var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http
24091
23997
  const upgradeHeader = /(^|,)\s*upgrade\s*($|,)/i;
24092
23998
  exports.isSSL = /^https|wss/;
24093
23999
  const HEADER_BLACKLIST = "trailer";
24000
+ const HTTP2_HEADER_BLACKLIST = [
24001
+ ":method",
24002
+ ":path",
24003
+ ":scheme",
24004
+ ":authority"
24005
+ ];
24094
24006
  function setupOutgoing(outgoing, options$1, req$4, forward) {
24095
24007
  const target = options$1[forward || "target"];
24096
24008
  outgoing.port = +(target.port ?? (target.protocol !== void 0 && exports.isSSL.test(target.protocol) ? 443 : 80));
@@ -24116,6 +24028,7 @@ var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http
24116
24028
  delete outgoing.headers[header];
24117
24029
  break;
24118
24030
  }
24031
+ if (req$4.httpVersionMajor > 1) for (const header of HTTP2_HEADER_BLACKLIST) delete outgoing.headers[header];
24119
24032
  if (options$1.auth) {
24120
24033
  delete outgoing.headers.authorization;
24121
24034
  outgoing.auth = options$1.auth;
@@ -24196,8 +24109,8 @@ var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http
24196
24109
  else if (typeof url$3 === "object" && "href" in url$3 && typeof url$3.href === "string") url$3 = url$3.href;
24197
24110
  if (!url$3) url$3 = "";
24198
24111
  if (typeof url$3 != "string") url$3 = `${url$3}`;
24199
- if (url$3.startsWith("//")) url$3 = `http://dummy.org${url$3}`;
24200
- return new URL(url$3, "http://dummy.org");
24112
+ if (url$3.startsWith("//")) url$3 = `http://base.invalid${url$3}`;
24113
+ return new URL(url$3, "http://base.invalid");
24201
24114
  }
24202
24115
  function required(port, protocol) {
24203
24116
  protocol = protocol.split(":")[0];
@@ -24214,8 +24127,8 @@ var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http
24214
24127
  }) });
24215
24128
 
24216
24129
  //#endregion
24217
- //#region ../../node_modules/.pnpm/http-proxy-3@1.21.1/node_modules/http-proxy-3/dist/lib/http-proxy/passes/web-outgoing.js
24218
- var require_web_outgoing = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http-proxy-3@1.21.1/node_modules/http-proxy-3/dist/lib/http-proxy/passes/web-outgoing.js": ((exports) => {
24130
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/http-proxy/passes/web-outgoing.js
24131
+ var require_web_outgoing = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/http-proxy/passes/web-outgoing.js": ((exports) => {
24219
24132
  var __createBinding$3 = exports && exports.__createBinding || (Object.create ? (function(o$1, m$2, k, k2) {
24220
24133
  if (k2 === void 0) k2 = k;
24221
24134
  var desc = Object.getOwnPropertyDescriptor(m$2, k);
@@ -24305,16 +24218,15 @@ var require_web_outgoing = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
24305
24218
  }
24306
24219
  for (const key0 in proxyRes.headers) {
24307
24220
  let key = key0;
24221
+ if (_req.httpVersionMajor > 1 && key === "connection") continue;
24308
24222
  const header = proxyRes.headers[key];
24309
24223
  if (preserveHeaderKeyCase && rawHeaderKeyMap) key = rawHeaderKeyMap[key] ?? key;
24310
24224
  setHeader(key, header);
24311
24225
  }
24312
24226
  }
24313
24227
  function writeStatusCode(_req, res, proxyRes) {
24314
- if (proxyRes.statusMessage) {
24315
- res.statusCode = proxyRes.statusCode;
24316
- res.statusMessage = proxyRes.statusMessage;
24317
- } else res.statusCode = proxyRes.statusCode;
24228
+ res.statusCode = proxyRes.statusCode;
24229
+ if (proxyRes.statusMessage && _req.httpVersionMajor === 1) res.statusMessage = proxyRes.statusMessage;
24318
24230
  }
24319
24231
  exports.OUTGOING_PASSES = {
24320
24232
  removeChunked,
@@ -24346,7 +24258,7 @@ var require_follow_redirects = /* @__PURE__ */ __commonJS({ "../../node_modules/
24346
24258
  var url = __require("url");
24347
24259
  var URL$2 = url.URL;
24348
24260
  var http$3 = __require("http");
24349
- var https$3 = __require("https");
24261
+ var https$2 = __require("https");
24350
24262
  var Writable = __require("stream").Writable;
24351
24263
  var assert$1 = __require("assert");
24352
24264
  var debug$6 = require_debug();
@@ -24766,14 +24678,14 @@ var require_follow_redirects = /* @__PURE__ */ __commonJS({ "../../node_modules/
24766
24678
  }
24767
24679
  module.exports = wrap({
24768
24680
  http: http$3,
24769
- https: https$3
24681
+ https: https$2
24770
24682
  });
24771
24683
  module.exports.wrap = wrap;
24772
24684
  }) });
24773
24685
 
24774
24686
  //#endregion
24775
- //#region ../../node_modules/.pnpm/http-proxy-3@1.21.1/node_modules/http-proxy-3/dist/lib/http-proxy/passes/web-incoming.js
24776
- var require_web_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http-proxy-3@1.21.1/node_modules/http-proxy-3/dist/lib/http-proxy/passes/web-incoming.js": ((exports) => {
24687
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/http-proxy/passes/web-incoming.js
24688
+ var require_web_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/http-proxy/passes/web-incoming.js": ((exports) => {
24777
24689
  var __createBinding$2 = exports && exports.__createBinding || (Object.create ? (function(o$1, m$2, k, k2) {
24778
24690
  if (k2 === void 0) k2 = k;
24779
24691
  var desc = Object.getOwnPropertyDescriptor(m$2, k);
@@ -24821,14 +24733,14 @@ var require_web_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
24821
24733
  exports.XHeaders = XHeaders$1;
24822
24734
  exports.stream = stream$1;
24823
24735
  const http$2 = __importStar$2(__require("node:http"));
24824
- const https$2 = __importStar$2(__require("node:https"));
24736
+ const https$1 = __importStar$2(__require("node:https"));
24825
24737
  const web_outgoing_1$1 = require_web_outgoing();
24826
24738
  const common$1 = __importStar$2(require_common());
24827
24739
  const followRedirects = __importStar$2(require_follow_redirects());
24828
24740
  const web_o$1 = Object.values(web_outgoing_1$1.OUTGOING_PASSES);
24829
24741
  const nativeAgents = {
24830
24742
  http: http$2,
24831
- https: https$2
24743
+ https: https$1
24832
24744
  };
24833
24745
  function deleteLength(req$4) {
24834
24746
  if ((req$4.method === "DELETE" || req$4.method === "OPTIONS") && !req$4.headers["content-length"]) {
@@ -24858,9 +24770,9 @@ var require_web_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
24858
24770
  server.emit("start", req$4, res, options$1.target || options$1.forward);
24859
24771
  const agents = options$1.followRedirects ? followRedirects : nativeAgents;
24860
24772
  const http$7 = agents.http;
24861
- const https$5 = agents.https;
24773
+ const https$4 = agents.https;
24862
24774
  if (options$1.forward) {
24863
- const proto$2 = options$1.forward.protocol === "https:" ? https$5 : http$7;
24775
+ const proto$2 = options$1.forward.protocol === "https:" ? https$4 : http$7;
24864
24776
  const outgoingOptions$1 = common$1.setupOutgoing(options$1.ssl || {}, options$1, req$4, "forward");
24865
24777
  const forwardReq = proto$2.request(outgoingOptions$1);
24866
24778
  const forwardError = createErrorHandler(forwardReq, options$1.forward);
@@ -24869,7 +24781,7 @@ var require_web_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
24869
24781
  (options$1.buffer || req$4).pipe(forwardReq);
24870
24782
  if (!options$1.target) return res.end();
24871
24783
  }
24872
- const proto$1 = options$1.target.protocol === "https:" ? https$5 : http$7;
24784
+ const proto$1 = options$1.target.protocol === "https:" ? https$4 : http$7;
24873
24785
  const outgoingOptions = common$1.setupOutgoing(options$1.ssl || {}, options$1, req$4);
24874
24786
  const proxyReq = proto$1.request(outgoingOptions);
24875
24787
  proxyReq.on("socket", (socket) => {
@@ -24916,8 +24828,8 @@ var require_web_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
24916
24828
  }) });
24917
24829
 
24918
24830
  //#endregion
24919
- //#region ../../node_modules/.pnpm/http-proxy-3@1.21.1/node_modules/http-proxy-3/dist/lib/http-proxy/passes/ws-incoming.js
24920
- var require_ws_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http-proxy-3@1.21.1/node_modules/http-proxy-3/dist/lib/http-proxy/passes/ws-incoming.js": ((exports) => {
24831
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/http-proxy/passes/ws-incoming.js
24832
+ var require_ws_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/http-proxy/passes/ws-incoming.js": ((exports) => {
24921
24833
  var __createBinding$1 = exports && exports.__createBinding || (Object.create ? (function(o$1, m$2, k, k2) {
24922
24834
  if (k2 === void 0) k2 = k;
24923
24835
  var desc = Object.getOwnPropertyDescriptor(m$2, k);
@@ -24968,7 +24880,7 @@ var require_ws_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
24968
24880
  exports.XHeaders = XHeaders;
24969
24881
  exports.stream = stream;
24970
24882
  const http$1 = __importStar$1(__require("node:http"));
24971
- const https$1 = __importStar$1(__require("node:https"));
24883
+ const https = __importStar$1(__require("node:https"));
24972
24884
  const common = __importStar$1(require_common());
24973
24885
  const web_outgoing_1 = require_web_outgoing();
24974
24886
  const log$1 = (0, __importDefault$1(require_node$1()).default)("http-proxy-3:ws-incoming");
@@ -25054,7 +24966,7 @@ var require_ws_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
25054
24966
  };
25055
24967
  common.setupSocket(socket);
25056
24968
  if (head && head.length) socket.unshift(head);
25057
- const proto$1 = common.isSSL.test(options$1.target.protocol) ? https$1 : http$1;
24969
+ const proto$1 = common.isSSL.test(options$1.target.protocol) ? https : http$1;
25058
24970
  const outgoingOptions = common.setupOutgoing(options$1.ssl || {}, options$1, req$4);
25059
24971
  const proxyReq = proto$1.request(outgoingOptions);
25060
24972
  if (server) server.emit("proxyReqWs", proxyReq, req$4, socket, options$1, head);
@@ -25125,8 +25037,8 @@ var require_ws_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
25125
25037
  }) });
25126
25038
 
25127
25039
  //#endregion
25128
- //#region ../../node_modules/.pnpm/http-proxy-3@1.21.1/node_modules/http-proxy-3/dist/lib/http-proxy/index.js
25129
- var require_http_proxy = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http-proxy-3@1.21.1/node_modules/http-proxy-3/dist/lib/http-proxy/index.js": ((exports) => {
25040
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/http-proxy/index.js
25041
+ var require_http_proxy = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/http-proxy/index.js": ((exports) => {
25130
25042
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o$1, m$2, k, k2) {
25131
25043
  if (k2 === void 0) k2 = k;
25132
25044
  var desc = Object.getOwnPropertyDescriptor(m$2, k);
@@ -25173,7 +25085,7 @@ var require_http_proxy = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/
25173
25085
  };
25174
25086
  Object.defineProperty(exports, "__esModule", { value: true });
25175
25087
  const http = __importStar(__require("node:http"));
25176
- const https = __importStar(__require("node:https"));
25088
+ const http2 = __importStar(__require("node:http2"));
25177
25089
  const web_incoming_1 = require_web_incoming();
25178
25090
  const ws_incoming_1$1 = require_ws_incoming();
25179
25091
  const node_events_1 = __require("node:events");
@@ -25251,7 +25163,10 @@ var require_http_proxy = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/
25251
25163
  const requestListener = (req$4, res) => {
25252
25164
  this.web(req$4, res);
25253
25165
  };
25254
- this._server = this.options.ssl ? https.createServer(this.options.ssl, requestListener) : http.createServer(requestListener);
25166
+ this._server = this.options.ssl ? http2.createSecureServer({
25167
+ ...this.options.ssl,
25168
+ allowHTTP1: true
25169
+ }, requestListener) : http.createServer(requestListener);
25255
25170
  if (this.options.ws) this._server.on("upgrade", (req$4, socket, head) => {
25256
25171
  this.ws(req$4, socket, head);
25257
25172
  });
@@ -25332,8 +25247,8 @@ var require_http_proxy = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/
25332
25247
  }) });
25333
25248
 
25334
25249
  //#endregion
25335
- //#region ../../node_modules/.pnpm/http-proxy-3@1.21.1/node_modules/http-proxy-3/dist/lib/index.js
25336
- var require_lib = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http-proxy-3@1.21.1/node_modules/http-proxy-3/dist/lib/index.js": ((exports) => {
25250
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/index.js
25251
+ var require_lib = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/index.js": ((exports) => {
25337
25252
  Object.defineProperty(exports, "__esModule", { value: true });
25338
25253
  exports.numOpenSockets = exports.ProxyServer = void 0;
25339
25254
  exports.createProxyServer = createProxyServer;
@@ -25637,8 +25552,7 @@ function send(req$4, res, content, type, options$1) {
25637
25552
  if (import_convert_source_map$1.default.mapFileCommentRegex.test(code)) debug$3?.(`Skipped injecting fallback sourcemap for ${req$4.url}`);
25638
25553
  else {
25639
25554
  const urlWithoutTimestamp = removeTimestampQuery(req$4.url);
25640
- const ms = new MagicString(code);
25641
- content = getCodeWithSourcemap(type, code, ms.generateMap({
25555
+ content = getCodeWithSourcemap(type, code, new MagicString(code).generateMap({
25642
25556
  source: path.basename(urlWithoutTimestamp),
25643
25557
  hires: "boundary",
25644
25558
  includeContent: true
@@ -25961,8 +25875,7 @@ function isFileServingAllowed(configOrUrl, urlOrServer) {
25961
25875
  const config$2 = typeof urlOrServer === "string" ? configOrUrl : urlOrServer.config;
25962
25876
  const url$3 = typeof urlOrServer === "string" ? urlOrServer : configOrUrl;
25963
25877
  if (!config$2.server.fs.strict) return true;
25964
- const filePath = fsPathFromUrl(url$3);
25965
- return isFileLoadingAllowed(config$2, filePath);
25878
+ return isFileLoadingAllowed(config$2, fsPathFromUrl(url$3));
25966
25879
  }
25967
25880
  /**
25968
25881
  * Warning: parameters are not validated, only works with normalized absolute paths
@@ -25979,7 +25892,8 @@ function isFileInTargetPath(targetPath, filePath) {
25979
25892
  function isFileLoadingAllowed(config$2, filePath) {
25980
25893
  const { fs: fs$12 } = config$2.server;
25981
25894
  if (!fs$12.strict) return true;
25982
- if (config$2.fsDenyGlob(filePath)) return false;
25895
+ const filePathWithoutTrailingSlash = filePath.endsWith("/") ? filePath.slice(0, -1) : filePath;
25896
+ if (config$2.fsDenyGlob(filePathWithoutTrailingSlash)) return false;
25983
25897
  if (config$2.safeModulePaths.has(filePath)) return true;
25984
25898
  if (fs$12.allow.some((uri) => isFileInTargetPath(uri, filePath))) return true;
25985
25899
  return false;
@@ -26028,8 +25942,9 @@ const debugCache$1 = createDebugger("vite:cache");
26028
25942
  function transformRequest(environment, url$3, options$1 = {}) {
26029
25943
  if (environment._closing && environment.config.dev.recoverable) throwClosedServerError();
26030
25944
  const timestamp = monotonicDateNow();
25945
+ url$3 = removeTimestampQuery(url$3);
26031
25946
  const pending = environment._pendingRequests.get(url$3);
26032
- if (pending) return environment.moduleGraph.getModuleByUrl(removeTimestampQuery(url$3)).then((module$1) => {
25947
+ if (pending) return environment.moduleGraph.getModuleByUrl(url$3).then((module$1) => {
26033
25948
  if (!module$1 || pending.timestamp > module$1.lastInvalidationTimestamp) return pending.request;
26034
25949
  else {
26035
25950
  pending.abort();
@@ -26052,7 +25967,6 @@ function transformRequest(environment, url$3, options$1 = {}) {
26052
25967
  return request.finally(clearCache);
26053
25968
  }
26054
25969
  async function doTransform(environment, url$3, options$1, timestamp) {
26055
- url$3 = removeTimestampQuery(url$3);
26056
25970
  const { pluginContainer } = environment;
26057
25971
  let module$1 = await environment.moduleGraph.getModuleByUrl(url$3);
26058
25972
  if (module$1) {
@@ -26444,16 +26358,15 @@ function traverseNodes(node, visitor) {
26444
26358
  if (nodeIsElement(node) || node.nodeName === "#document" || node.nodeName === "#document-fragment") node.childNodes.forEach((childNode) => traverseNodes(childNode, visitor));
26445
26359
  }
26446
26360
  async function traverseHtml(html, filePath, warn, visitor) {
26447
- const { parse: parse$17 } = await import("./dep-CCSnTAeo.js");
26361
+ const { parse: parse$17 } = await import("./dist.js");
26448
26362
  const warnings = {};
26449
- const ast = parse$17(html, {
26363
+ traverseNodes(parse$17(html, {
26450
26364
  scriptingEnabled: false,
26451
26365
  sourceCodeLocationInfo: true,
26452
26366
  onParseError: (e$1) => {
26453
26367
  handleParseError(e$1, html, filePath, warnings);
26454
26368
  }
26455
- });
26456
- traverseNodes(ast, visitor);
26369
+ }), visitor);
26457
26370
  for (const message of Object.values(warnings)) warn(import_picocolors$13.default.yellow(`\n${message}`));
26458
26371
  }
26459
26372
  function getScriptInfo(node) {
@@ -26604,8 +26517,7 @@ function buildHtmlPlugin(config$2) {
26604
26517
  shouldRemove = true;
26605
26518
  } else if (node.childNodes.length) {
26606
26519
  const contents = node.childNodes.pop().value;
26607
- const filePath = id.replace(normalizePath(config$2.root), "");
26608
- addToHTMLProxyCache(config$2, filePath, inlineModuleIndex, { code: contents });
26520
+ addToHTMLProxyCache(config$2, id.replace(normalizePath(config$2.root), ""), inlineModuleIndex, { code: contents });
26609
26521
  js += `\nimport "${id}?html-proxy&index=${inlineModuleIndex}.js"`;
26610
26522
  shouldRemove = true;
26611
26523
  }
@@ -26658,8 +26570,7 @@ function buildHtmlPlugin(config$2) {
26658
26570
  if (inlineStyle) {
26659
26571
  inlineModuleIndex++;
26660
26572
  const code = inlineStyle.attr.value;
26661
- const filePath = id.replace(normalizePath(config$2.root), "");
26662
- addToHTMLProxyCache(config$2, filePath, inlineModuleIndex, { code });
26573
+ addToHTMLProxyCache(config$2, id.replace(normalizePath(config$2.root), ""), inlineModuleIndex, { code });
26663
26574
  js += `\nimport "${id}?html-proxy&inline-css&style-attr&index=${inlineModuleIndex}.css"`;
26664
26575
  const hash$1 = getHash(cleanUrl(id));
26665
26576
  overwriteAttrValue(s$2, inlineStyle.location, `__VITE_INLINE_CSS__${hash$1}_${inlineModuleIndex}__`);
@@ -27463,8 +27374,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
27463
27374
  ensureWatchedFile(watcher, mod.file, config$2.root);
27464
27375
  await server?.environments.client.pluginContainer.transform(code, mod.id);
27465
27376
  const hash$1 = getHash(cleanUrl(mod.id));
27466
- const result = htmlProxyResult.get(`${hash$1}_${index}`);
27467
- overwriteAttrValue(s$2, location$1, result ?? "");
27377
+ overwriteAttrValue(s$2, location$1, htmlProxyResult.get(`${hash$1}_${index}`) ?? "");
27468
27378
  })]);
27469
27379
  html = s$2.toString();
27470
27380
  return {
@@ -28414,8 +28324,7 @@ function resolveServerOptions(root, raw, logger) {
28414
28324
  if (process.versions.pnp) {
28415
28325
  const cwd = searchForPackageRoot(root);
28416
28326
  try {
28417
- const enableGlobalCache = execSync("yarn config get enableGlobalCache", { cwd }).toString().trim() === "true";
28418
- const yarnCacheDir = execSync(`yarn config get ${enableGlobalCache ? "globalFolder" : "cacheFolder"}`, { cwd }).toString().trim();
28327
+ const yarnCacheDir = execSync(`yarn config get ${execSync("yarn config get enableGlobalCache", { cwd }).toString().trim() === "true" ? "globalFolder" : "cacheFolder"}`, { cwd }).toString().trim();
28419
28328
  allowDirs.push(yarnCacheDir);
28420
28329
  } catch (e$1) {
28421
28330
  logger.warn(`Get yarn cache dir error: ${e$1.message}`, { timestamp: true });
@@ -29093,10 +29002,9 @@ function definePlugin(config$2) {
29093
29002
  const patternKeys = Object.keys(userDefine);
29094
29003
  if (!keepProcessEnv && Object.keys(processEnv).length) patternKeys.push("process.env");
29095
29004
  if (Object.keys(importMetaKeys).length) patternKeys.push("import.meta.env", "import.meta.hot");
29096
- const pattern = patternKeys.length ? new RegExp(patternKeys.map((key) => escapeRegex(key).replaceAll(escapedDotRE, "\\??\\.")).join("|")) : null;
29097
29005
  return [
29098
29006
  define$1,
29099
- pattern,
29007
+ patternKeys.length ? new RegExp(patternKeys.map((key) => escapeRegex(key).replaceAll(escapedDotRE, "\\??\\.")).join("|")) : null,
29100
29008
  importMetaEnvVal
29101
29009
  ];
29102
29010
  }
@@ -29226,8 +29134,7 @@ async function bundleWorkerEntry(config$2, id) {
29226
29134
  if (config$2.bundleChain.includes(input)) throw new Error(`Circular worker imports detected. Vite does not support it. Import chain: ${newBundleChain.map((id$1) => prettifyUrl(id$1, config$2.root)).join(" -> ")}`);
29227
29135
  const { rollup } = await import("rollup");
29228
29136
  const { plugins: plugins$1, rollupOptions, format: format$3 } = config$2.worker;
29229
- const workerConfig = await plugins$1(newBundleChain);
29230
- const workerEnvironment = new BuildEnvironment("client", workerConfig);
29137
+ const workerEnvironment = new BuildEnvironment("client", await plugins$1(newBundleChain));
29231
29138
  await workerEnvironment.init();
29232
29139
  const bundle = await rollup({
29233
29140
  ...rollupOptions,
@@ -29241,12 +29148,12 @@ async function bundleWorkerEntry(config$2, id) {
29241
29148
  let chunk;
29242
29149
  try {
29243
29150
  const workerOutputConfig = config$2.worker.rollupOptions.output;
29244
- const workerConfig$1 = workerOutputConfig ? Array.isArray(workerOutputConfig) ? workerOutputConfig[0] || {} : workerOutputConfig : {};
29151
+ const workerConfig = workerOutputConfig ? Array.isArray(workerOutputConfig) ? workerOutputConfig[0] || {} : workerOutputConfig : {};
29245
29152
  const { output: [outputChunk, ...outputChunks] } = await bundle.generate({
29246
29153
  entryFileNames: path.posix.join(config$2.build.assetsDir, "[name]-[hash].js"),
29247
29154
  chunkFileNames: path.posix.join(config$2.build.assetsDir, "[name]-[hash].js"),
29248
29155
  assetFileNames: path.posix.join(config$2.build.assetsDir, "[name]-[hash].[ext]"),
29249
- ...workerConfig$1,
29156
+ ...workerConfig,
29250
29157
  format: format$3,
29251
29158
  sourcemap: config$2.build.sourcemap
29252
29159
  });
@@ -29273,9 +29180,8 @@ function emitSourcemapForWorkerEntry(config$2, chunk) {
29273
29180
  if (sourcemap) {
29274
29181
  if (config$2.build.sourcemap === "hidden" || config$2.build.sourcemap === true) {
29275
29182
  const data = sourcemap.toString();
29276
- const mapFileName = chunk.fileName + ".map";
29277
29183
  saveEmitWorkerAsset(config$2, {
29278
- fileName: mapFileName,
29184
+ fileName: chunk.fileName + ".map",
29279
29185
  originalFileName: null,
29280
29186
  originalFileNames: [],
29281
29187
  source: data
@@ -29574,15 +29480,14 @@ function extractImportedBindings(id, source, importSpec, importedBindings) {
29574
29480
  ESM_STATIC_IMPORT_RE.lastIndex = 0;
29575
29481
  const match = ESM_STATIC_IMPORT_RE.exec(exp);
29576
29482
  if (!match) return;
29577
- const staticImport = {
29483
+ const parsed = parseStaticImport({
29578
29484
  type: "static",
29579
29485
  code: match[0],
29580
29486
  start: match.index,
29581
29487
  end: match.index + match[0].length,
29582
29488
  imports: match.groups.imports,
29583
29489
  specifier: match.groups.specifier
29584
- };
29585
- const parsed = parseStaticImport(staticImport);
29490
+ });
29586
29491
  if (parsed.namespacedImport) bindings.add("*");
29587
29492
  if (parsed.defaultImport) bindings.add("default");
29588
29493
  if (parsed.namedImports) for (const name of Object.keys(parsed.namedImports)) bindings.add(name);
@@ -29747,7 +29652,7 @@ function importAnalysisPlugin(config$2) {
29747
29652
  const isDynamicImport = dynamicIndex > -1;
29748
29653
  if (!isDynamicImport && attributeIndex > -1) str().remove(end + 1, expEnd);
29749
29654
  if (specifier !== void 0) {
29750
- if (isExternalUrl(specifier) && !specifier.startsWith("file://") || isDataUrl(specifier)) return;
29655
+ if ((isExternalUrl(specifier) && !specifier.startsWith("file://") || isDataUrl(specifier)) && !matchAlias(specifier)) return;
29751
29656
  if (ssr && !matchAlias(specifier)) {
29752
29657
  if (shouldExternalize(environment, specifier, importer)) return;
29753
29658
  if (isBuiltin(environment.config.resolve.builtins, specifier)) return;
@@ -29881,8 +29786,7 @@ function interopNamedImports(str, importSpecifier, rewrittenUrl, importIndex, im
29881
29786
  const exp = source.slice(expStart, expEnd);
29882
29787
  if (dynamicIndex > -1) str.overwrite(expStart, expEnd, `import('${rewrittenUrl}').then(m => (${interopHelperStr})(m.default))` + getLineBreaks(exp), { contentOnly: true });
29883
29788
  else {
29884
- const rawUrl = source.slice(start, end);
29885
- const rewritten = transformCjsImport(exp, rewrittenUrl, rawUrl, importIndex, importer, config$2);
29789
+ const rewritten = transformCjsImport(exp, rewrittenUrl, source.slice(start, end), importIndex, importer, config$2);
29886
29790
  if (rewritten) str.overwrite(expStart, expEnd, rewritten + getLineBreaks(exp), { contentOnly: true });
29887
29791
  else str.overwrite(start, end, rewrittenUrl + getLineBreaks(source.slice(start, end)), { contentOnly: true });
29888
29792
  }
@@ -30560,8 +30464,7 @@ function dynamicImportVarsPlugin(config$2) {
30560
30464
  //#region src/node/plugins/pluginFilter.ts
30561
30465
  function getMatcherString(glob$1, cwd) {
30562
30466
  if (glob$1.startsWith("**") || path.isAbsolute(glob$1)) return slash(glob$1);
30563
- const resolved = path.join(cwd, glob$1);
30564
- return slash(resolved);
30467
+ return slash(path.join(cwd, glob$1));
30565
30468
  }
30566
30469
  function patternToIdFilter(pattern, cwd) {
30567
30470
  if (pattern instanceof RegExp) return (id) => {
@@ -30570,11 +30473,9 @@ function patternToIdFilter(pattern, cwd) {
30570
30473
  pattern.lastIndex = 0;
30571
30474
  return result;
30572
30475
  };
30573
- const glob$1 = getMatcherString(pattern, cwd);
30574
- const matcher = picomatch(glob$1, { dot: true });
30476
+ const matcher = picomatch(getMatcherString(pattern, cwd), { dot: true });
30575
30477
  return (id) => {
30576
- const normalizedId = slash(id);
30577
- return matcher(normalizedId);
30478
+ return matcher(slash(id));
30578
30479
  };
30579
30480
  }
30580
30481
  function patternToCodeFilter(pattern) {
@@ -30633,7 +30534,7 @@ function createFilterForTransform(idFilter, codeFilter, cwd) {
30633
30534
  async function resolvePlugins(config$2, prePlugins, normalPlugins, postPlugins) {
30634
30535
  const isBuild = config$2.command === "build";
30635
30536
  const isWorker = config$2.isWorker;
30636
- const buildPlugins = isBuild ? await (await import("./dep-D6Kf1CgD.js")).resolveBuildPlugins(config$2) : {
30537
+ const buildPlugins = isBuild ? await (await import("./build.js")).resolveBuildPlugins(config$2) : {
30637
30538
  pre: [],
30638
30539
  post: []
30639
30540
  };
@@ -31258,8 +31159,7 @@ var PluginContext = class extends MinimalPluginContext {
31258
31159
  if (this instanceof TransformPluginContext && typeof err$2.loc?.line === "number" && typeof err$2.loc.column === "number") {
31259
31160
  const rawSourceMap = this._getCombinedSourcemap();
31260
31161
  if (rawSourceMap && "version" in rawSourceMap) {
31261
- const traced = new TraceMap(rawSourceMap);
31262
- const { source, line, column } = originalPositionFor(traced, {
31162
+ const { source, line, column } = originalPositionFor(new TraceMap(rawSourceMap), {
31263
31163
  line: Number(err$2.loc.line),
31264
31164
  column: Number(err$2.loc.column)
31265
31165
  });
@@ -31872,7 +31772,7 @@ function cssPostPlugin(config$2) {
31872
31772
  },
31873
31773
  async generateBundle(opts, bundle) {
31874
31774
  if (opts.__vite_skip_asset_emit__) return;
31875
- if (!this.environment.config.build.cssCodeSplit && !hasEmitted) {
31775
+ if ((config$2.command !== "build" || this.environment.config.build.emitAssets) && !this.environment.config.build.cssCodeSplit && !hasEmitted) {
31876
31776
  let extractedCss = "";
31877
31777
  const collected = /* @__PURE__ */ new Set();
31878
31778
  const dynamicImports = /* @__PURE__ */ new Set();
@@ -32209,8 +32109,7 @@ async function runPostCSS(id, code, plugins$1, options$1, deps, logger, enableSo
32209
32109
  code: postcssResult.css,
32210
32110
  map: { mappings: "" }
32211
32111
  };
32212
- const rawPostcssMap = postcssResult.map.toJSON();
32213
- const postcssMap = await formatPostcssSourceMap(rawPostcssMap, cleanUrl(id));
32112
+ const postcssMap = await formatPostcssSourceMap(postcssResult.map.toJSON(), cleanUrl(id));
32214
32113
  return {
32215
32114
  code: postcssResult.css,
32216
32115
  map: postcssMap
@@ -32226,8 +32125,8 @@ function createCachedImport(imp) {
32226
32125
  return cached;
32227
32126
  };
32228
32127
  }
32229
- const importPostcssImport = createCachedImport(() => import("./dep-CwrJo3zV.js").then(__toDynamicImportESM(1)));
32230
- const importPostcssModules = createCachedImport(() => import("./dep-DrqJEUj9.js").then(__toDynamicImportESM(1)));
32128
+ const importPostcssImport = createCachedImport(() => import("./postcss-import.js").then(__toDynamicImportESM(1)));
32129
+ const importPostcssModules = createCachedImport(() => import("./build2.js").then(__toDynamicImportESM(1)));
32231
32130
  const importPostcss = createCachedImport(() => import("postcss"));
32232
32131
  const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
32233
32132
  let alwaysFakeWorkerWorkerControllerCache;
@@ -32240,8 +32139,7 @@ async function preprocessCSS(code, filename, config$2) {
32240
32139
  alwaysFakeWorkerWorkerControllerCache ||= createPreprocessorWorkerController(0);
32241
32140
  workerController = alwaysFakeWorkerWorkerControllerCache;
32242
32141
  }
32243
- const environment = new PartialEnvironment("client", config$2);
32244
- return await compileCSS(environment, filename, code, workerController);
32142
+ return await compileCSS(new PartialEnvironment("client", config$2), filename, code, workerController);
32245
32143
  }
32246
32144
  async function formatPostcssSourceMap(rawMap, file) {
32247
32145
  const inputFileDir = path.dirname(file);
@@ -32285,8 +32183,7 @@ async function resolvePostcssConfig(config$2) {
32285
32183
  };
32286
32184
  } else {
32287
32185
  const searchPath = typeof inlineOptions === "string" ? inlineOptions : config$2.root;
32288
- const stopDir = searchForWorkspaceRoot(config$2.root);
32289
- result = (0, import_src.default)({}, searchPath, { stopDir }).catch((e$1) => {
32186
+ result = (0, import_src.default)({}, searchPath, { stopDir: searchForWorkspaceRoot(config$2.root) }).catch((e$1) => {
32290
32187
  if (!e$1.message.includes("No PostCSS Config found")) if (e$1 instanceof Error) {
32291
32188
  const { name, message, stack } = e$1;
32292
32189
  e$1.name = "Failed to load PostCSS config";
@@ -32653,8 +32550,7 @@ async function rebaseUrls(environment, file, rootFile, resolver$1, ignoreUrl) {
32653
32550
  if (ignoreUrl?.(unquotedUrl, rawUrl)) return false;
32654
32551
  if (unquotedUrl[0] === "/") return unquotedUrl;
32655
32552
  const absolute = await resolver$1(environment, unquotedUrl, file) || path.resolve(fileDir, unquotedUrl);
32656
- const relative$3 = path.relative(rootDir, absolute);
32657
- return normalizePath(relative$3);
32553
+ return normalizePath(path.relative(rootDir, absolute));
32658
32554
  };
32659
32555
  if (hasImportCss) rebased = await rewriteImportCss(content, rebaseFn);
32660
32556
  if (hasUrls) rebased = await rewriteCssUrls(rebased || content, rebaseFn);
@@ -32979,8 +32875,7 @@ async function compileLightningCSS(environment, id, src, deps, workerController,
32979
32875
  column: e$1.loc.column - 1
32980
32876
  };
32981
32877
  try {
32982
- const code = fs.readFileSync(e$1.fileName, "utf-8");
32983
- const friendlyMessage = getLightningCssErrorMessageForIeSyntaxes(code);
32878
+ const friendlyMessage = getLightningCssErrorMessageForIeSyntaxes(fs.readFileSync(e$1.fileName, "utf-8"));
32984
32879
  if (friendlyMessage) e$1.message += friendlyMessage;
32985
32880
  } catch {}
32986
32881
  }
@@ -33235,9 +33130,7 @@ function preload(baseModule, deps, importerUrl) {
33235
33130
  }
33236
33131
  function getPreloadCode(environment, renderBuiltUrlBoolean, isRelativeBase) {
33237
33132
  const { modulePreload } = environment.config.build;
33238
- const scriptRel$1 = modulePreload && modulePreload.polyfill ? `'modulepreload'` : `/* @__PURE__ */ (${detectScriptRel.toString()})()`;
33239
- const assetsURL$1 = renderBuiltUrlBoolean || isRelativeBase ? `function(dep, importerUrl) { return new URL(dep, importerUrl).href }` : `function(dep) { return ${JSON.stringify(environment.config.base)}+dep }`;
33240
- return `const scriptRel = ${scriptRel$1};const assetsURL = ${assetsURL$1};const seen = {};export const ${preloadMethod} = ${preload.toString()}`;
33133
+ return `const scriptRel = ${modulePreload && modulePreload.polyfill ? `'modulepreload'` : `/* @__PURE__ */ (${detectScriptRel.toString()})()`};const assetsURL = ${renderBuiltUrlBoolean || isRelativeBase ? `function(dep, importerUrl) { return new URL(dep, importerUrl).href }` : `function(dep) { return ${JSON.stringify(environment.config.base)}+dep }`};const seen = {};export const ${preloadMethod} = ${preload.toString()}`;
33241
33134
  }
33242
33135
  /**
33243
33136
  * Build only. During serve this is performed as part of ./importAnalysis.
@@ -33500,8 +33393,10 @@ function buildImportAnalysisPlugin(config$2) {
33500
33393
  source: chunk.fileName,
33501
33394
  hires: "boundary"
33502
33395
  });
33396
+ const originalFile = chunk.map.file;
33503
33397
  const map$1 = combineSourcemaps(chunk.fileName, [nextMap, chunk.map]);
33504
33398
  map$1.toUrl = () => genSourceMapUrl(map$1);
33399
+ if (originalFile) map$1.file = originalFile;
33505
33400
  const originalDebugId = chunk.map.debugId;
33506
33401
  chunk.map = map$1;
33507
33402
  if (buildSourcemap === "inline") {
@@ -33590,8 +33485,7 @@ function ssrManifestPlugin() {
33590
33485
  chunk$1.imports.forEach(addDeps);
33591
33486
  }
33592
33487
  };
33593
- const normalizedFile = normalizePath(join(dirname(chunk.fileName), url$3.slice(1, -1)));
33594
- addDeps(normalizedFile);
33488
+ addDeps(normalizePath(join(dirname(chunk.fileName), url$3.slice(1, -1))));
33595
33489
  ssrManifest[basename(name)] = deps;
33596
33490
  }
33597
33491
  }
@@ -33666,8 +33560,7 @@ function prepareOutDirPlugin() {
33666
33560
  if (config$2.build.write) {
33667
33561
  const { root, build: options$1 } = config$2;
33668
33562
  const resolvedOutDirs = getResolvedOutDirs(root, options$1.outDir, options$1.rollupOptions.output);
33669
- const emptyOutDir = resolveEmptyOutDir(options$1.emptyOutDir, root, resolvedOutDirs, this.environment.logger);
33670
- prepareOutDir(resolvedOutDirs, emptyOutDir, this.environment);
33563
+ prepareOutDir(resolvedOutDirs, resolveEmptyOutDir(options$1.emptyOutDir, root, resolvedOutDirs, this.environment.logger), this.environment);
33671
33564
  }
33672
33565
  }
33673
33566
  }
@@ -33677,14 +33570,11 @@ function prepareOutDir(outDirs, emptyOutDir, environment) {
33677
33570
  const { publicDir } = environment.config;
33678
33571
  const outDirsArray = [...outDirs];
33679
33572
  for (const outDir of outDirs) {
33680
- if (emptyOutDir !== false && fs.existsSync(outDir)) {
33681
- const skipDirs = outDirsArray.map((dir) => {
33682
- const relative$3 = path.relative(outDir, dir);
33683
- if (relative$3 && !relative$3.startsWith("..") && !path.isAbsolute(relative$3)) return relative$3;
33684
- return "";
33685
- }).filter(Boolean);
33686
- emptyDir(outDir, [...skipDirs, ".git"]);
33687
- }
33573
+ if (emptyOutDir !== false && fs.existsSync(outDir)) emptyDir(outDir, [...outDirsArray.map((dir) => {
33574
+ const relative$3 = path.relative(outDir, dir);
33575
+ if (relative$3 && !relative$3.startsWith("..") && !path.isAbsolute(relative$3)) return relative$3;
33576
+ return "";
33577
+ }).filter(Boolean), ".git"]);
33688
33578
  if (environment.config.build.copyPublicDir && publicDir && fs.existsSync(publicDir)) {
33689
33579
  if (!areSeparateFolders(outDir, publicDir)) environment.logger.warn(import_picocolors$5.default.yellow(`\n${import_picocolors$5.default.bold(`(!)`)} The public directory feature may not work correctly. outDir ${import_picocolors$5.default.white(import_picocolors$5.default.dim(outDir))} and publicDir ${import_picocolors$5.default.white(import_picocolors$5.default.dim(publicDir))} are not separate folders.\n`));
33690
33580
  copyDir(publicDir, outDir);
@@ -34013,10 +33903,8 @@ function onRollupLog(level, log$4, environment) {
34013
33903
  clearLine();
34014
33904
  const userOnLog = environment.config.build.rollupOptions?.onLog;
34015
33905
  const userOnWarn = environment.config.build.rollupOptions?.onwarn;
34016
- if (userOnLog) if (userOnWarn) {
34017
- const normalizedUserOnWarn = normalizeUserOnWarn(userOnWarn, viteLog);
34018
- userOnLog(level, log$4, normalizedUserOnWarn);
34019
- } else userOnLog(level, log$4, viteLog);
33906
+ if (userOnLog) if (userOnWarn) userOnLog(level, log$4, normalizeUserOnWarn(userOnWarn, viteLog));
33907
+ else userOnLog(level, log$4, viteLog);
34020
33908
  else if (userOnWarn) normalizeUserOnWarn(userOnWarn, viteLog)(level, log$4);
34021
33909
  else viteLog(level, log$4);
34022
33910
  }
@@ -34332,11 +34220,9 @@ async function fetchModule(environment, url$3, importer, options$1 = {}) {
34332
34220
  err$2.code = "ERR_MODULE_NOT_FOUND";
34333
34221
  throw err$2;
34334
34222
  }
34335
- const file = pathToFileURL(resolved.id).toString();
34336
- const type = isFilePathESM(resolved.id, environment.config.packageCache) ? "module" : "commonjs";
34337
34223
  return {
34338
- externalize: file,
34339
- type
34224
+ externalize: pathToFileURL(resolved.id).toString(),
34225
+ type: isFilePathESM(resolved.id, environment.config.packageCache) ? "module" : "commonjs"
34340
34226
  };
34341
34227
  }
34342
34228
  url$3 = unwrapId(url$3);
@@ -35221,8 +35107,7 @@ function invalidateModule(environment, m$2) {
35221
35107
  if (mod && mod.isSelfAccepting && mod.lastHMRTimestamp > 0 && !mod.lastHMRInvalidationReceived) {
35222
35108
  mod.lastHMRInvalidationReceived = true;
35223
35109
  environment.logger.info(import_picocolors$1.default.yellow(`hmr invalidate `) + import_picocolors$1.default.dim(m$2.path) + (m$2.message ? ` ${m$2.message}` : ""), { timestamp: true });
35224
- const file = getShortName(mod.file, environment.config.root);
35225
- updateModules(environment, file, [...mod.importers], mod.lastHMRTimestamp, m$2.firstInvalidatedBy);
35110
+ updateModules(environment, getShortName(mod.file, environment.config.root), [...mod.importers], mod.lastHMRTimestamp, m$2.firstInvalidatedBy);
35226
35111
  }
35227
35112
  }
35228
35113
  const callCrawlEndIfIdleAfterMs = 50;
@@ -35492,10 +35377,7 @@ async function preview(inlineConfig = {}) {
35492
35377
  server.resolvedUrls = resolveServerUrls(httpServer, config$2.preview, hostname, httpsOptions, config$2);
35493
35378
  if (options$1.open) {
35494
35379
  const url$3 = getServerUrlByHost(server.resolvedUrls, options$1.host);
35495
- if (url$3) {
35496
- const path$13 = typeof options$1.open === "string" ? new URL(options$1.open, url$3).href : url$3;
35497
- openBrowser(path$13, true, logger);
35498
- }
35380
+ if (url$3) openBrowser(typeof options$1.open === "string" ? new URL(options$1.open, url$3).href : url$3, true, logger);
35499
35381
  }
35500
35382
  return server;
35501
35383
  }
@@ -35507,8 +35389,7 @@ const ssrConfigDefaults = Object.freeze({
35507
35389
  optimizeDeps: {}
35508
35390
  });
35509
35391
  function resolveSSROptions(ssr, preserveSymlinks) {
35510
- const defaults = mergeWithDefaults(ssrConfigDefaults, { optimizeDeps: { esbuildOptions: { preserveSymlinks } } });
35511
- return mergeWithDefaults(defaults, ssr ?? {});
35392
+ return mergeWithDefaults(mergeWithDefaults(ssrConfigDefaults, { optimizeDeps: { esbuildOptions: { preserveSymlinks } } }), ssr ?? {});
35512
35393
  }
35513
35394
 
35514
35395
  //#endregion
@@ -35519,7 +35400,7 @@ function resolveSSROptions(ssr, preserveSymlinks) {
35519
35400
  */
35520
35401
  async function runnerImport(moduleId, inlineConfig) {
35521
35402
  const isModuleSyncConditionEnabled = (await import("#module-sync-enabled")).default;
35522
- const config$2 = await resolveConfig(mergeConfig(inlineConfig || {}, {
35403
+ const environment = createRunnableDevEnvironment("inline", await resolveConfig(mergeConfig(inlineConfig || {}, {
35523
35404
  configFile: false,
35524
35405
  envDir: false,
35525
35406
  cacheDir: process.cwd(),
@@ -35532,21 +35413,19 @@ async function runnerImport(moduleId, inlineConfig) {
35532
35413
  conditions: ["node", ...isModuleSyncConditionEnabled ? ["module-sync"] : []]
35533
35414
  }
35534
35415
  } }
35535
- }), "serve");
35536
- const environment = createRunnableDevEnvironment("inline", config$2, {
35416
+ }), "serve"), {
35537
35417
  runnerOptions: { hmr: { logger: false } },
35538
35418
  hot: false
35539
35419
  });
35540
35420
  await environment.init();
35541
35421
  try {
35542
35422
  const module$1 = await environment.runner.import(moduleId);
35543
- const dependencies = [...environment.runner.evaluatedModules.urlToIdModuleMap.values()].filter((m$2) => {
35544
- if (!m$2.meta || "externalize" in m$2.meta) return false;
35545
- return m$2.exports !== module$1;
35546
- }).map((m$2) => m$2.file);
35547
35423
  return {
35548
35424
  module: module$1,
35549
- dependencies
35425
+ dependencies: [...environment.runner.evaluatedModules.urlToIdModuleMap.values()].filter((m$2) => {
35426
+ if (!m$2.meta || "externalize" in m$2.meta) return false;
35427
+ return m$2.exports !== module$1;
35428
+ }).map((m$2) => m$2.file)
35550
35429
  };
35551
35430
  } finally {
35552
35431
  await environment.close();
@@ -35782,8 +35661,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
35782
35661
  }, configEnv);
35783
35662
  else return p.apply === command;
35784
35663
  };
35785
- const rawPlugins = (await asyncFlatten(config$2.plugins || [])).filter(filterPlugin);
35786
- const [prePlugins, normalPlugins, postPlugins] = sortUserPlugins(rawPlugins);
35664
+ const [prePlugins, normalPlugins, postPlugins] = sortUserPlugins((await asyncFlatten(config$2.plugins || [])).filter(filterPlugin));
35787
35665
  const isBuild = command === "build";
35788
35666
  const userPlugins = [
35789
35667
  ...prePlugins,
@@ -35862,7 +35740,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
35862
35740
  const backwardCompatibleOptimizeDeps = resolvedEnvironments.client.optimizeDeps;
35863
35741
  const resolvedDevEnvironmentOptions = resolveDevEnvironmentOptions(config$2.dev, void 0, void 0);
35864
35742
  const resolvedBuildOptions = resolveBuildEnvironmentOptions(config$2.build ?? {}, logger, void 0);
35865
- const patchedConfigSsr = {
35743
+ const ssr = resolveSSROptions({
35866
35744
  ...config$2.ssr,
35867
35745
  external: resolvedEnvironments.ssr?.resolve.external,
35868
35746
  noExternal: resolvedEnvironments.ssr?.resolve.noExternal,
@@ -35872,8 +35750,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
35872
35750
  conditions: resolvedEnvironments.ssr?.resolve.conditions,
35873
35751
  externalConditions: resolvedEnvironments.ssr?.resolve.externalConditions
35874
35752
  }
35875
- };
35876
- const ssr = resolveSSROptions(patchedConfigSsr, resolvedDefaultResolve.preserveSymlinks);
35753
+ }, resolvedDefaultResolve.preserveSymlinks);
35877
35754
  let envDir = config$2.envFile === false ? false : config$2.envDir;
35878
35755
  if (envDir !== false) envDir = config$2.envDir ? normalizePath(path.resolve(resolvedRoot, config$2.envDir)) : resolvedRoot;
35879
35756
  const userEnv = loadEnv(mode, envDir, resolveEnvPrefix(config$2));
@@ -36283,11 +36160,10 @@ async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
36283
36160
  }
36284
36161
  async function runConfigHook(config$2, plugins$1, configEnv) {
36285
36162
  let conf = config$2;
36286
- const tempLogger = createLogger(config$2.logLevel, {
36163
+ const context = new BasicMinimalPluginContext(basePluginContextMeta, createLogger(config$2.logLevel, {
36287
36164
  allowClearScreen: config$2.clearScreen,
36288
36165
  customLogger: config$2.customLogger
36289
- });
36290
- const context = new BasicMinimalPluginContext(basePluginContextMeta, tempLogger);
36166
+ }));
36291
36167
  for (const p of getSortedPluginsByHook("config", plugins$1)) {
36292
36168
  const hook = p.config;
36293
36169
  const res = await getHookHandler(hook).call(context, conf, configEnv);