vite 7.1.9 → 7.1.10

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.

Potentially problematic release.


This version of vite might be problematic. Click here for more details.

@@ -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
  }
@@ -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
 
@@ -4301,8 +4284,7 @@ function getCandidates(resolved, extensions$1) {
4301
4284
  }
4302
4285
  function resolveExtensions(importee, importer, extensions$1) {
4303
4286
  if (importee[0] !== "." || !importer) return void 0;
4304
- const resolved = resolve$1(dirname$1(importer), importee);
4305
- const candidates = getCandidates(resolved, extensions$1);
4287
+ const candidates = getCandidates(resolve$1(dirname$1(importer), importee), extensions$1);
4306
4288
  for (let i$1 = 0; i$1 < candidates.length; i$1 += 1) try {
4307
4289
  if (statSync(candidates[i$1]).isFile()) return { id: candidates[i$1] };
4308
4290
  } catch (err$2) {}
@@ -4692,13 +4674,12 @@ function getRequireHandlers() {
4692
4674
  if (exportMode === "module") imports.push(`import { __module as ${moduleName} } from ${JSON.stringify(wrapId$1(id, MODULE_SUFFIX))}`, `var ${exportsName} = ${moduleName}.exports`);
4693
4675
  else if (exportMode === "exports") imports.push(`import { __exports as ${exportsName} } from ${JSON.stringify(wrapId$1(id, EXPORTS_SUFFIX))}`);
4694
4676
  const requiresBySource = collectSources(requireExpressions);
4695
- const requireTargets = await resolveRequireSourcesAndUpdateMeta(id, needsRequireWrapper ? IS_WRAPPED_COMMONJS : !isEsModule, commonjsMeta, Object.keys(requiresBySource).map((source) => {
4677
+ processRequireExpressions(imports, await resolveRequireSourcesAndUpdateMeta(id, needsRequireWrapper ? IS_WRAPPED_COMMONJS : !isEsModule, commonjsMeta, Object.keys(requiresBySource).map((source) => {
4696
4678
  return {
4697
4679
  source,
4698
4680
  isConditional: requiresBySource[source].every((require$1) => require$1.isInsideConditional)
4699
4681
  };
4700
- }));
4701
- processRequireExpressions(imports, requireTargets, requiresBySource, getIgnoreTryCatchRequireStatementMode, magicString);
4682
+ })), requiresBySource, getIgnoreTryCatchRequireStatementMode, magicString);
4702
4683
  return imports.length ? `${imports.join(";\n")};\n\n` : "";
4703
4684
  }
4704
4685
  return {
@@ -5502,8 +5483,7 @@ const resolve2posix = IS_POSIX ? (dir, filename) => dir ? path.resolve(dir, file
5502
5483
  function resolveReferencedTSConfigFiles(result, options$1) {
5503
5484
  const dir = path.dirname(result.tsconfigFile);
5504
5485
  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);
5486
+ return resolve2posix(dir, ref.path.endsWith(".json") ? ref.path : path.join(ref.path, options$1?.configName ?? "tsconfig.json"));
5507
5487
  });
5508
5488
  }
5509
5489
  /**
@@ -5946,10 +5926,7 @@ async function parseExtends(result, cache$1) {
5946
5926
  if (!Array.isArray(extending.tsconfig.extends)) resolvedExtends = [resolveExtends(extending.tsconfig.extends, extending.tsconfigFile)];
5947
5927
  else resolvedExtends = extending.tsconfig.extends.reverse().map((ex) => resolveExtends(ex, extending.tsconfigFile));
5948
5928
  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
- }
5929
+ if (circularExtends) throw new TSConfckParseError(`Circular dependency in "extends": ${extendsPath.concat([circularExtends]).join(" -> ")}`, "EXTENDS_CIRCULAR", result.tsconfigFile);
5953
5930
  extended.splice(pos + 1, 0, ...await Promise.all(resolvedExtends.map((file) => parseFile$1(file, cache$1))));
5954
5931
  } else {
5955
5932
  extendsPath.splice(-currentBranchDepth);
@@ -6225,7 +6202,7 @@ var TSConfckCache = class {
6225
6202
  //#region src/node/plugins/esbuild.ts
6226
6203
  var import_picocolors$31 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
6227
6204
  const debug$17 = createDebugger("vite:esbuild");
6228
- const IIFE_BEGIN_RE = /(?:const|var)\s+\S+\s*=\s*function\([^()]*\)\s*\{\s*"use strict";/;
6205
+ const IIFE_BEGIN_RE = /(?:const|var)\s+\S+\s*=\s*\(?function\([^()]*\)\s*\{\s*"use strict";/;
6229
6206
  const validExtensionRE = /\.\w+$/;
6230
6207
  const jsxExtensionsRE = /\.(?:j|t)sx\b/;
6231
6208
  const defaultEsbuildSupported = {
@@ -7399,8 +7376,7 @@ function renderAssetUrlInJS(pluginContext, chunk, opts, code) {
7399
7376
  const [full, referenceId, postfix = ""] = match;
7400
7377
  const file = pluginContext.getFileName(referenceId);
7401
7378
  chunk.viteMetadata.importedAssets.add(cleanUrl(file));
7402
- const filename = file + postfix;
7403
- const replacement = toOutputFilePathInJS(environment, filename, "asset", chunk.fileName, "js", toRelativeRuntime);
7379
+ const replacement = toOutputFilePathInJS(environment, file + postfix, "asset", chunk.fileName, "js", toRelativeRuntime);
7404
7380
  const replacementString = typeof replacement === "string" ? JSON.stringify(encodeURIPath(replacement)).slice(1, -1) : `"+${replacement.runtime}+"`;
7405
7381
  s$2.update(match.index, match.index + full.length, replacementString);
7406
7382
  }
@@ -7409,8 +7385,7 @@ function renderAssetUrlInJS(pluginContext, chunk, opts, code) {
7409
7385
  while (match = publicAssetUrlRE.exec(code)) {
7410
7386
  s$2 ||= new MagicString(code);
7411
7387
  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);
7388
+ const replacement = toOutputFilePathInJS(environment, publicAssetUrlMap.get(hash$1).slice(1), "public", chunk.fileName, "js", toRelativeRuntime);
7414
7389
  const replacementString = typeof replacement === "string" ? JSON.stringify(encodeURIPath(replacement)).slice(1, -1) : `"+${replacement.runtime}+"`;
7415
7390
  s$2.update(match.index, match.index + full.length, replacementString);
7416
7391
  }
@@ -7496,8 +7471,7 @@ async function fileToDevUrl(environment, id, skipBase = false) {
7496
7471
  const publicFile = checkPublicFile(id, config$2);
7497
7472
  if (inlineRE$3.test(id)) {
7498
7473
  const file = publicFile || cleanUrl(id);
7499
- const content = await fsp.readFile(file);
7500
- return assetToDataURL(environment, file, content);
7474
+ return assetToDataURL(environment, file, await fsp.readFile(file));
7501
7475
  }
7502
7476
  const cleanedId = cleanUrl(id);
7503
7477
  if (cleanedId.endsWith(".svg")) {
@@ -7510,8 +7484,7 @@ async function fileToDevUrl(environment, id, skipBase = false) {
7510
7484
  else if (id.startsWith(withTrailingSlash(config$2.root))) rtn = "/" + path.posix.relative(config$2.root, id);
7511
7485
  else rtn = path.posix.join(FS_PREFIX, id);
7512
7486
  if (skipBase) return rtn;
7513
- const base = joinUrlSegments(config$2.server.origin ?? "", config$2.decodedBase);
7514
- return joinUrlSegments(base, removeLeadingSlash(rtn));
7487
+ return joinUrlSegments(joinUrlSegments(config$2.server.origin ?? "", config$2.decodedBase), removeLeadingSlash(rtn));
7515
7488
  }
7516
7489
  function getPublicAssetFilename(hash$1, config$2) {
7517
7490
  return publicAssetUrlCache.get(config$2)?.get(hash$1);
@@ -7570,8 +7543,7 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
7570
7543
  async function urlToBuiltUrl(pluginContext, url$3, importer, forceInline) {
7571
7544
  const topLevelConfig = pluginContext.environment.getTopLevelConfig();
7572
7545
  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);
7546
+ return fileToBuiltUrl(pluginContext, normalizePath(url$3[0] === "/" ? path.join(topLevelConfig.root, url$3) : path.join(path.dirname(importer), url$3)), true, forceInline);
7575
7547
  }
7576
7548
  function shouldInline(environment, file, id, content, buildPluginContext, forceInline) {
7577
7549
  if (noInlineRE.test(id)) return false;
@@ -7685,8 +7657,7 @@ function manifestPlugin() {
7685
7657
  if (chunk.type === "chunk") manifest[getChunkName(chunk)] = createChunk(chunk);
7686
7658
  else if (chunk.type === "asset" && chunk.names.length > 0) {
7687
7659
  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);
7660
+ const asset = createAsset(chunk, src, entryCssAssetFileNames.has(chunk.fileName));
7690
7661
  const file$1 = manifest[src]?.file;
7691
7662
  if (!(file$1 && endsWithJSRE.test(file$1))) manifest[src] = asset;
7692
7663
  for (const originalFileName of chunk.originalFileNames.slice(1)) {
@@ -7973,7 +7944,7 @@ var require_convert_source_map = /* @__PURE__ */ __commonJS({ "../../node_module
7973
7944
  }) });
7974
7945
 
7975
7946
  //#endregion
7976
- //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.0-beta.41/node_modules/@rolldown/pluginutils/dist/index.mjs
7947
+ //#region ../../node_modules/.pnpm/@rolldown+pluginutils@1.0.0-beta.43/node_modules/@rolldown/pluginutils/dist/index.mjs
7977
7948
  /**
7978
7949
  * Constructs a RegExp that matches the exact string specified.
7979
7950
  *
@@ -8254,8 +8225,7 @@ var require_src$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/lilco
8254
8225
  const loaderKey = path$11.extname(searchPlace) || "noExt";
8255
8226
  const loader$1 = loaders[loaderKey];
8256
8227
  if (searchPlace === "package.json") {
8257
- const pkg = await loader$1(filepath, content);
8258
- const maybeConfig = getPackageProp(packageProp, pkg);
8228
+ const maybeConfig = getPackageProp(packageProp, await loader$1(filepath, content));
8259
8229
  if (maybeConfig != null) {
8260
8230
  result.config = maybeConfig;
8261
8231
  result.filepath = filepath;
@@ -8291,13 +8261,10 @@ var require_src$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/lilco
8291
8261
  const loader$1 = loaders[loaderKey];
8292
8262
  validateLoader(loader$1, loaderKey);
8293
8263
  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
- }
8264
+ if (base === "package.json") return emplace(loadCache, absPath, transform$2({
8265
+ config: getPackageProp(packageProp, await loader$1(absPath, content)),
8266
+ filepath: absPath
8267
+ }));
8301
8268
  /** @type {import('./index').LilconfigResult} */
8302
8269
  const result = {
8303
8270
  config: null,
@@ -8366,8 +8333,7 @@ var require_src$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/lilco
8366
8333
  const loader$1 = loaders[loaderKey];
8367
8334
  const content = String(fs$11.readFileSync(filepath));
8368
8335
  if (searchPlace === "package.json") {
8369
- const pkg = loader$1(filepath, content);
8370
- const maybeConfig = getPackageProp(packageProp, pkg);
8336
+ const maybeConfig = getPackageProp(packageProp, loader$1(filepath, content));
8371
8337
  if (maybeConfig != null) {
8372
8338
  result.config = maybeConfig;
8373
8339
  result.filepath = filepath;
@@ -8403,13 +8369,10 @@ var require_src$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/lilco
8403
8369
  const loader$1 = loaders[loaderKey];
8404
8370
  validateLoader(loader$1, loaderKey);
8405
8371
  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
- }
8372
+ if (base === "package.json") return transform$2({
8373
+ config: getPackageProp(packageProp, loader$1(absPath, content)),
8374
+ filepath: absPath
8375
+ });
8413
8376
  const result = {
8414
8377
  config: null,
8415
8378
  filepath: absPath
@@ -8444,8 +8407,8 @@ var require_src$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/lilco
8444
8407
  }) });
8445
8408
 
8446
8409
  //#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) => {
8410
+ //#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
8411
+ 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
8412
  const { createRequire: createRequire$2 } = __require("node:module");
8450
8413
  const { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1 } = __require("node:url");
8451
8414
  const TS_EXT_RE = /\.[mc]?ts$/;
@@ -8487,8 +8450,8 @@ var require_req = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/postcss
8487
8450
  }) });
8488
8451
 
8489
8452
  //#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) => {
8453
+ //#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
8454
+ 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
8455
  const req$2 = require_req();
8493
8456
  /**
8494
8457
  * Load Options
@@ -8522,8 +8485,8 @@ var require_options = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/pos
8522
8485
  }) });
8523
8486
 
8524
8487
  //#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) => {
8488
+ //#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
8489
+ 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
8490
  const req$1 = require_req();
8528
8491
  /**
8529
8492
  * Plugin Loader
@@ -8577,8 +8540,8 @@ var require_plugins = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/pos
8577
8540
  }) });
8578
8541
 
8579
8542
  //#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) => {
8543
+ //#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
8544
+ 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
8545
  const { resolve: resolve$2 } = __require("node:path");
8583
8546
  const config$1 = require_src$1();
8584
8547
  const loadOptions = require_options();
@@ -8943,11 +8906,9 @@ function clearImports(imports) {
8943
8906
  }
8944
8907
  function getImportNames(cleanedImports) {
8945
8908
  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
8909
  return {
8949
- namespacedImport,
8950
- defaultImport
8910
+ namespacedImport: topLevelImports.match(/\* as \s*(\S*)/)?.[1],
8911
+ defaultImport: topLevelImports.split(",").find((index) => !/[*{}]/.test(index))?.trim() || void 0
8951
8912
  };
8952
8913
  }
8953
8914
  /**
@@ -9525,8 +9486,7 @@ var PartialEnvironment = class {
9525
9486
  return this._topLevelConfig[prop];
9526
9487
  } });
9527
9488
  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];
9489
+ const infoColor = environmentColors[[...this.name].reduce((acc, c) => acc + c.charCodeAt(0), 0) % environmentColors.length || 0];
9530
9490
  this.logger = {
9531
9491
  get hasWarned() {
9532
9492
  return topLevelConfig.logger.hasWarned;
@@ -10124,8 +10084,7 @@ async function parseImportGlob(code, importer, root, resolveId, logger) {
10124
10084
  };
10125
10085
  const end = findCorrespondingCloseParenthesisPosition(cleanCode, start + match[0].length) + 1;
10126
10086
  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];
10087
+ const rootAst = (await parseAstAsync(code.slice(start, end))).body[0];
10129
10088
  if (rootAst.type !== "ExpressionStatement") throw err$2(`Expect CallExpression, got ${rootAst.type}`);
10130
10089
  const ast = rootAst.expression;
10131
10090
  if (ast.type !== "CallExpression") throw err$2(`Expect CallExpression, got ${ast.type}`);
@@ -10201,10 +10160,9 @@ async function transformGlobImport(code, id, root, resolveId, restoreQueryExtens
10201
10160
  if (!matches$2.length) return null;
10202
10161
  const s$2 = new MagicString(code);
10203
10162
  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
10163
  const files = (await glob(globsResolved, {
10206
10164
  absolute: true,
10207
- cwd,
10165
+ cwd: getCommonBase(globsResolved) ?? root,
10208
10166
  dot: !!options$1.exhaustive,
10209
10167
  expandDirectories: false,
10210
10168
  ignore: options$1.exhaustive ? [] : ["**/node_modules/**"]
@@ -10420,20 +10378,14 @@ function scanImports(environment) {
10420
10378
  ${entries.join("\n")}
10421
10379
 
10422
10380
  `);
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;
10381
+ if (e$1.errors) e$1.message = prependMessage + (await formatMessages(e$1.errors, {
10382
+ kind: "error",
10383
+ color: true
10384
+ })).join("\n");
10385
+ else e$1.message = prependMessage + e$1.message;
10430
10386
  throw e$1;
10431
10387
  } 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
- }
10388
+ 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
10389
  }
10438
10390
  } finally {
10439
10391
  context?.dispose().catch((e$1) => {
@@ -10441,10 +10393,9 @@ function scanImports(environment) {
10441
10393
  });
10442
10394
  }
10443
10395
  }
10444
- const result = scan();
10445
10396
  return {
10446
10397
  cancel,
10447
- result: result.then((res) => res ?? {
10398
+ result: scan().then((res) => res ?? {
10448
10399
  deps: {},
10449
10400
  missing: {}
10450
10401
  })
@@ -10862,8 +10813,7 @@ async function optimizeDeps(config$2, force = config$2.optimizeDeps.force, asCom
10862
10813
  await addManuallyIncludedOptimizeDeps(environment, deps);
10863
10814
  const depsString = depsLogString(Object.keys(deps));
10864
10815
  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;
10816
+ const result = await runOptimizeDeps(environment, toDiscoveredDependencies(environment, deps)).result;
10867
10817
  await result.commit();
10868
10818
  return result.metadata;
10869
10819
  }
@@ -10872,8 +10822,7 @@ async function optimizeExplicitEnvironmentDeps(environment) {
10872
10822
  if (cachedMetadata) return cachedMetadata;
10873
10823
  const deps = {};
10874
10824
  await addManuallyIncludedOptimizeDeps(environment, deps);
10875
- const depsInfo = toDiscoveredDependencies(environment, deps);
10876
- const result = await runOptimizeDeps(environment, depsInfo).result;
10825
+ const result = await runOptimizeDeps(environment, toDiscoveredDependencies(environment, deps)).result;
10877
10826
  await result.commit();
10878
10827
  return result.metadata;
10879
10828
  }
@@ -11080,13 +11029,11 @@ function runOptimizeDeps(environment, depsInfo) {
11080
11029
  }).catch(async (e$1) => {
11081
11030
  if (e$1.errors && e$1.message.includes("The build was canceled")) return cancelledResult;
11082
11031
  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;
11032
+ if (e$1.errors) e$1.message = prependMessage + (await formatMessages(e$1.errors, {
11033
+ kind: "error",
11034
+ color: true
11035
+ })).join("\n");
11036
+ else e$1.message = prependMessage + e$1.message;
11090
11037
  throw e$1;
11091
11038
  }).finally(() => {
11092
11039
  return disposeContext();
@@ -11291,13 +11238,12 @@ async function extractExportsData(environment, filePath) {
11291
11238
  const { optimizeDeps: optimizeDeps$1 } = environment.config;
11292
11239
  const esbuildOptions = optimizeDeps$1.esbuildOptions ?? {};
11293
11240
  if (optimizeDeps$1.extensions?.some((ext) => filePath.endsWith(ext))) {
11294
- const result = await build({
11241
+ const [, exports$2, , hasModuleSyntax$1] = parse((await build({
11295
11242
  ...esbuildOptions,
11296
11243
  entryPoints: [filePath],
11297
11244
  write: false,
11298
11245
  format: "esm"
11299
- });
11300
- const [, exports$2, , hasModuleSyntax$1] = parse(result.outputFiles[0].text);
11246
+ })).outputFiles[0].text);
11301
11247
  return {
11302
11248
  hasModuleSyntax: hasModuleSyntax$1,
11303
11249
  exports: exports$2.map((e$1) => e$1.n)
@@ -11311,8 +11257,7 @@ async function extractExportsData(environment, filePath) {
11311
11257
  } catch {
11312
11258
  const loader$1 = esbuildOptions.loader?.[path.extname(filePath)] || "jsx";
11313
11259
  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);
11260
+ parseResult = parse((await transformWithEsbuild(entryContent, filePath, { loader: loader$1 }, void 0, environment.config)).code);
11316
11261
  usedJsxLoader = true;
11317
11262
  }
11318
11263
  const [, exports$1, , hasModuleSyntax] = parseResult;
@@ -11383,7 +11328,7 @@ const lockfilePaths = lockfileFormats.map((l) => l.path);
11383
11328
  function getConfigHash(environment) {
11384
11329
  const { config: config$2 } = environment;
11385
11330
  const { optimizeDeps: optimizeDeps$1 } = config$2;
11386
- const content = JSON.stringify({
11331
+ return getHash(JSON.stringify({
11387
11332
  define: !config$2.keepProcessEnv ? process.env.NODE_ENV || config$2.mode : null,
11388
11333
  root: config$2.root,
11389
11334
  resolve: config$2.resolve,
@@ -11400,8 +11345,7 @@ function getConfigHash(environment) {
11400
11345
  }, (_, value$1) => {
11401
11346
  if (typeof value$1 === "function" || value$1 instanceof RegExp) return value$1.toString();
11402
11347
  return value$1;
11403
- });
11404
- return getHash(content);
11348
+ }));
11405
11349
  }
11406
11350
  function getLockfileHash(environment) {
11407
11351
  const lockfilePath = lookupFile(environment.config.root, lockfilePaths);
@@ -11411,8 +11355,7 @@ function getLockfileHash(environment) {
11411
11355
  const lockfileFormat = lockfileFormats.find((f$1) => normalizedLockfilePath.endsWith(f$1.path));
11412
11356
  if (lockfileFormat.checkPatchesDir) {
11413
11357
  const baseDir = lockfilePath.slice(0, -lockfileFormat.path.length);
11414
- const fullPath = path.join(baseDir, lockfileFormat.checkPatchesDir);
11415
- const stat$4 = tryStatSync(fullPath);
11358
+ const stat$4 = tryStatSync(path.join(baseDir, lockfileFormat.checkPatchesDir));
11416
11359
  if (stat$4?.isDirectory()) content += stat$4.mtimeMs.toString();
11417
11360
  }
11418
11361
  }
@@ -11597,8 +11540,7 @@ function resolvePlugin(resolveOptions) {
11597
11540
  return ensureVersionQuery(res, id, options$1, depsOptimizer);
11598
11541
  }
11599
11542
  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)) {
11543
+ if (res = tryFsResolve(path.resolve(root, id.slice(1)), options$1)) {
11602
11544
  debug$12?.(`[url] ${import_picocolors$25.default.cyan(id)} -> ${import_picocolors$25.default.dim(res)}`);
11603
11545
  return ensureVersionQuery(res, id, options$1, depsOptimizer);
11604
11546
  }
@@ -11634,8 +11576,7 @@ function resolvePlugin(resolveOptions) {
11634
11576
  }
11635
11577
  if (isWindows && id[0] === "/") {
11636
11578
  const basedir = importer ? path.dirname(importer) : process.cwd();
11637
- const fsPath = path.resolve(basedir, id);
11638
- if (res = tryFsResolve(fsPath, options$1)) {
11579
+ if (res = tryFsResolve(path.resolve(basedir, id), options$1)) {
11639
11580
  debug$12?.(`[drive-relative] ${import_picocolors$25.default.cyan(id)} -> ${import_picocolors$25.default.dim(res)}`);
11640
11581
  return ensureVersionQuery(res, id, options$1, depsOptimizer);
11641
11582
  }
@@ -11777,8 +11718,7 @@ function tryCleanFsResolve(file, options$1, tryIndex = true, skipPackageJson = f
11777
11718
  try {
11778
11719
  if (fs.existsSync(pkgPath)) {
11779
11720
  if (!options$1.preserveSymlinks) pkgPath = safeRealpathSync(pkgPath);
11780
- const pkg = loadPackageData(pkgPath);
11781
- return resolvePackageEntry(dirPath, pkg, options$1);
11721
+ return resolvePackageEntry(dirPath, loadPackageData(pkgPath), options$1);
11782
11722
  }
11783
11723
  } catch (e$1) {
11784
11724
  if (e$1.code !== ERR_RESOLVE_PACKAGE_ENTRY_FAIL && e$1.code !== "ENOENT") throw e$1;
@@ -11815,9 +11755,7 @@ function tryNodeResolve(id, importer, options$1, depsOptimizer, externalize) {
11815
11755
  }
11816
11756
  return;
11817
11757
  }
11818
- const resolveId = deepMatch ? resolveDeepImport : resolvePackageEntry;
11819
- const unresolvedId = deepMatch ? "." + id.slice(pkgId.length) : id;
11820
- let resolved = resolveId(unresolvedId, pkg, options$1, externalize);
11758
+ let resolved = (deepMatch ? resolveDeepImport : resolvePackageEntry)(deepMatch ? "." + id.slice(pkgId.length) : id, pkg, options$1, externalize);
11821
11759
  if (!resolved) return;
11822
11760
  const processResult$1 = (resolved$1) => {
11823
11761
  if (!externalize) return resolved$1;
@@ -11904,8 +11842,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
11904
11842
  const { browser: browserField } = data;
11905
11843
  if (options$1.mainFields.includes("browser") && isObject(browserField)) entry = mapWithBrowserField(entry, browserField) || entry;
11906
11844
  }
11907
- const entryPointPath = path.join(dir, entry);
11908
- const resolvedEntryPoint = tryFsResolve(entryPointPath, options$1, true, skipPackageJson);
11845
+ const resolvedEntryPoint = tryFsResolve(path.join(dir, entry), options$1, true, skipPackageJson);
11909
11846
  if (resolvedEntryPoint) {
11910
11847
  debug$12?.(`[package entry] ${import_picocolors$25.default.cyan(idWithoutPostfix)} -> ${import_picocolors$25.default.dim(resolvedEntryPoint)}${postfix !== "" ? ` (postfix: ${postfix})` : ""}`);
11911
11848
  setResolvedCache(".", resolvedEntryPoint, options$1);
@@ -11970,8 +11907,7 @@ function tryResolveBrowserMapping(id, importer, options$1, isFilePath, externali
11970
11907
  let res;
11971
11908
  const pkg = importer && findNearestPackageData(path.dirname(importer), options$1.packageCache);
11972
11909
  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);
11910
+ const browserMappedPath = mapWithBrowserField(isFilePath ? "./" + slash(path.relative(pkg.dir, id)) : id, pkg.data.browser);
11975
11911
  if (browserMappedPath) {
11976
11912
  if (res = bareImportRE.test(browserMappedPath) ? tryNodeResolve(browserMappedPath, importer, options$1, void 0, void 0)?.id : tryFsResolve(path.join(pkg.dir, browserMappedPath), options$1)) {
11977
11913
  debug$12?.(`[browser mapped] ${import_picocolors$25.default.cyan(id)} -> ${import_picocolors$25.default.dim(res)}`);
@@ -11996,11 +11932,8 @@ function tryResolveBrowserEntry(dir, data, options$1) {
11996
11932
  const browserEntry = typeof data.browser === "string" ? data.browser : isObject(data.browser) && data.browser["."];
11997
11933
  if (browserEntry) if (!options$1.isRequire && options$1.mainFields.includes("module") && typeof data.module === "string" && data.module !== browserEntry) {
11998
11934
  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
- }
11935
+ if (resolvedBrowserEntry) if (hasESMSyntax(fs.readFileSync(resolvedBrowserEntry, "utf-8"))) return browserEntry;
11936
+ else return data.module;
12004
11937
  } else return browserEntry;
12005
11938
  }
12006
11939
  /**
@@ -12249,8 +12182,7 @@ var require_main$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/dote
12249
12182
  const length = keys.length;
12250
12183
  let decrypted;
12251
12184
  for (let i$1 = 0; i$1 < length; i$1++) try {
12252
- const key = keys[i$1].trim();
12253
- const attrs = _instructions(result, key);
12185
+ const attrs = _instructions(result, keys[i$1].trim());
12254
12186
  decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
12255
12187
  break;
12256
12188
  } catch (error$1) {
@@ -12535,10 +12467,9 @@ function loadEnv(mode, envDir, prefixes = "VITE_") {
12535
12467
  if (parsed.NODE_ENV && process.env.VITE_USER_NODE_ENV === void 0) process.env.VITE_USER_NODE_ENV = parsed.NODE_ENV;
12536
12468
  if (parsed.BROWSER && process.env.BROWSER === void 0) process.env.BROWSER = parsed.BROWSER;
12537
12469
  if (parsed.BROWSER_ARGS && process.env.BROWSER_ARGS === void 0) process.env.BROWSER_ARGS = parsed.BROWSER_ARGS;
12538
- const processEnv = { ...process.env };
12539
12470
  (0, import_main$1.expand)({
12540
12471
  parsed,
12541
- processEnv
12472
+ processEnv: { ...process.env }
12542
12473
  });
12543
12474
  for (const [key, value$1] of Object.entries(parsed)) if (prefixes.some((prefix) => key.startsWith(prefix))) env$1[key] = value$1;
12544
12475
  for (const key in process.env) if (prefixes.some((prefix) => key.startsWith(prefix))) env$1[key] = process.env[key];
@@ -14275,8 +14206,7 @@ var require_vary = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/vary@1
14275
14206
  function vary(res, field) {
14276
14207
  if (!res || !res.getHeader || !res.setHeader) throw new TypeError("res argument is required");
14277
14208
  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);
14209
+ if (val = append$1(Array.isArray(val) ? val.join(", ") : String(val), field)) res.setHeader("Vary", val);
14280
14210
  }
14281
14211
  }) });
14282
14212
 
@@ -15754,7 +15684,7 @@ var require_parse$2 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/bra
15754
15684
  */
15755
15685
  if (value$1 === CHAR_LEFT_CURLY_BRACE) {
15756
15686
  depth++;
15757
- const brace = {
15687
+ block = push$1({
15758
15688
  type: "brace",
15759
15689
  open: true,
15760
15690
  close: false,
@@ -15763,8 +15693,7 @@ var require_parse$2 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/bra
15763
15693
  commas: 0,
15764
15694
  ranges: 0,
15765
15695
  nodes: []
15766
- };
15767
- block = push$1(brace);
15696
+ });
15768
15697
  stack.push(block);
15769
15698
  push$1({
15770
15699
  type: "open",
@@ -16475,8 +16404,7 @@ var require_nodefs_handler = /* @__PURE__ */ __commonJS({ "../../node_modules/.p
16475
16404
  const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
16476
16405
  cont.watcherUnusable = true;
16477
16406
  if (isWindows$3 && error$1.code === "EPERM") try {
16478
- const fd$1 = await open$1(path$13, "r");
16479
- await close(fd$1);
16407
+ await close(await open$1(path$13, "r"));
16480
16408
  broadcastErr(error$1);
16481
16409
  } catch (err$2) {}
16482
16410
  else broadcastErr(error$1);
@@ -17665,8 +17593,7 @@ var require_chokidar = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ch
17665
17593
  }
17666
17594
  const now$1 = Number(/* @__PURE__ */ new Date());
17667
17595
  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) {
17596
+ if (now$1 - this._pendingWrites.get(path$13).lastChange >= threshold) {
17670
17597
  this._pendingWrites.delete(path$13);
17671
17598
  awfEmit(void 0, curStat);
17672
17599
  } else timeoutHandler = setTimeout(awaitWriteFinish, this.options.awaitWriteFinish.pollInterval, curStat);
@@ -17700,8 +17627,7 @@ var require_chokidar = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ch
17700
17627
  const ign = this.options.ignored;
17701
17628
  const ignored = ign && ign.map(normalizeIgnored(cwd));
17702
17629
  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);
17630
+ this._userIgnored = anymatch(this._getGlobIgnored().map(normalizeIgnored(cwd)).concat(ignored, paths), void 0, ANYMATCH_OPTS);
17705
17631
  }
17706
17632
  return this._userIgnored([path$13, stats]);
17707
17633
  }
@@ -17807,13 +17733,12 @@ var require_chokidar = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ch
17807
17733
  }
17808
17734
  _readdirp(root, opts) {
17809
17735
  if (this.closed) return;
17810
- const options$1 = {
17736
+ let stream$3 = readdirp(root, {
17811
17737
  type: EV_ALL,
17812
17738
  alwaysStat: true,
17813
17739
  lstat: true,
17814
17740
  ...opts
17815
- };
17816
- let stream$3 = readdirp(root, options$1);
17741
+ });
17817
17742
  this._streams.add(stream$3);
17818
17743
  stream$3.once(STR_CLOSE, () => {
17819
17744
  stream$3 = void 0;
@@ -17904,8 +17829,7 @@ var require_parse$1 = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/she
17904
17829
  if (!opts) opts = {};
17905
17830
  var BS = opts.escape || "\\";
17906
17831
  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);
17832
+ var matches$2 = matchAll(string, new RegExp(["(" + CONTROL + ")", "(" + BAREWORD + "|" + SINGLE_QUOTE + "|" + DOUBLE_QUOTE + ")+"].join("|"), "g"));
17909
17833
  if (matches$2.length === 0) return [];
17910
17834
  if (!env$1) env$1 = {};
17911
17835
  var commented = false;
@@ -18372,8 +18296,7 @@ var require_launch_editor_middleware = /* @__PURE__ */ __commonJS({ "../../node_
18372
18296
  res.statusCode = 500;
18373
18297
  res.end(`launch-editor-middleware: required query param "file" is missing.`);
18374
18298
  } else {
18375
- const resolved = file.startsWith("file://") ? file : path$5.resolve(srcRoot, file);
18376
- launch(resolved, specifiedEditor, onErrorCallback);
18299
+ launch(file.startsWith("file://") ? file : path$5.resolve(srcRoot, file), specifiedEditor, onErrorCallback);
18377
18300
  res.end();
18378
18301
  }
18379
18302
  };
@@ -18400,16 +18323,16 @@ async function resolveHttpServer({ proxy }, app, httpsOptions) {
18400
18323
  }, app);
18401
18324
  }
18402
18325
  }
18403
- async function resolveHttpsConfig(https$5) {
18404
- if (!https$5) return void 0;
18326
+ async function resolveHttpsConfig(https$4) {
18327
+ if (!https$4) return void 0;
18405
18328
  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)
18329
+ readFileIfExists(https$4.ca),
18330
+ readFileIfExists(https$4.cert),
18331
+ readFileIfExists(https$4.key),
18332
+ readFileIfExists(https$4.pfx)
18410
18333
  ]);
18411
18334
  return {
18412
- ...https$5,
18335
+ ...https$4,
18413
18336
  ca,
18414
18337
  cert,
18415
18338
  key,
@@ -18474,8 +18397,7 @@ function ssrRewriteStacktrace(stack, moduleGraph) {
18474
18397
  if (!id) return input;
18475
18398
  const rawSourceMap = moduleGraph.getModuleById(id)?.transformResult?.map;
18476
18399
  if (!rawSourceMap) return input;
18477
- const traced = new TraceMap(rawSourceMap);
18478
- const pos = originalPositionFor(traced, {
18400
+ const pos = originalPositionFor(new TraceMap(rawSourceMap), {
18479
18401
  line: Number(line$1) - offset,
18480
18402
  column: Number(column) - 1
18481
18403
  });
@@ -18501,8 +18423,7 @@ const rewroteStacktraces = /* @__PURE__ */ new WeakSet();
18501
18423
  function ssrFixStacktrace(e$1, moduleGraph) {
18502
18424
  if (!e$1.stack) return;
18503
18425
  if (rewroteStacktraces.has(e$1)) return;
18504
- const stacktrace = ssrRewriteStacktrace(e$1.stack, moduleGraph);
18505
- rebindErrorStacktrace(e$1, stacktrace);
18426
+ rebindErrorStacktrace(e$1, ssrRewriteStacktrace(e$1.stack, moduleGraph));
18506
18427
  rewroteStacktraces.add(e$1);
18507
18428
  }
18508
18429
 
@@ -18955,8 +18876,7 @@ async function ssrTransformScript(code, inMap, url$3, originalCode) {
18955
18876
  for (const spec of node.specifiers) {
18956
18877
  const local = spec.local.name;
18957
18878
  const binding = idToImportMap.get(local);
18958
- const exportedAs = getIdentifierNameOrLiteralValue$1(spec.exported);
18959
- defineExport(exportedAs, binding || local);
18879
+ defineExport(getIdentifierNameOrLiteralValue$1(spec.exported), binding || local);
18960
18880
  }
18961
18881
  }
18962
18882
  if (node.type === "ExportDefaultDeclaration") if ("id" in node.declaration && node.declaration.id && !["FunctionExpression", "ClassExpression"].includes(node.declaration.type)) {
@@ -18970,10 +18890,8 @@ async function ssrTransformScript(code, inMap, url$3, originalCode) {
18970
18890
  }
18971
18891
  if (node.type === "ExportAllDeclaration") {
18972
18892
  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`);
18893
+ if (node.exported) defineExport(getIdentifierNameOrLiteralValue$1(node.exported), `${importId}`);
18894
+ else s$2.appendLeft(node.end, `${ssrExportAllKey}(${importId});\n`);
18977
18895
  }
18978
18896
  }
18979
18897
  walk$1(ast, {
@@ -19386,14 +19304,13 @@ Get the default browser name in Windows from WSL.
19386
19304
  async function getWindowsDefaultBrowserFromWsl() {
19387
19305
  const powershellPath = await powerShellPath();
19388
19306
  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
19307
  const { stdout } = await execFile$1(powershellPath, [
19391
19308
  "-NoProfile",
19392
19309
  "-NonInteractive",
19393
19310
  "-ExecutionPolicy",
19394
19311
  "Bypass",
19395
19312
  "-EncodedCommand",
19396
- encodedCommand
19313
+ Buffer$1.from(rawCommand, "utf16le").toString("base64")
19397
19314
  ], { encoding: "utf8" });
19398
19315
  const progId = stdout.trim();
19399
19316
  const browserMap = {
@@ -19716,8 +19633,7 @@ var require_which = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/which
19716
19633
  const ppRaw = pathEnv[i$1];
19717
19634
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
19718
19635
  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));
19636
+ resolve$4(subStep(!pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd, i$1, 0));
19721
19637
  });
19722
19638
  const subStep = (p, i$1, ii) => new Promise((resolve$4, reject) => {
19723
19639
  if (ii === pathExt.length) return resolve$4(step(i$1 + 1));
@@ -19996,10 +19912,7 @@ var import_picocolors$19 = /* @__PURE__ */ __toESM(require_picocolors(), 1);
19996
19912
  function openBrowser(url$3, opt, logger) {
19997
19913
  const browser = typeof opt === "string" ? opt : process.env.BROWSER || "";
19998
19914
  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
- }
19915
+ else if (browser.toLowerCase() !== "none") startBrowserProcess(browser, process.env.BROWSER_ARGS ? process.env.BROWSER_ARGS.split(" ") : [], url$3, logger);
20003
19916
  }
20004
19917
  function executeNodeScript(scriptPath, url$3, logger) {
20005
19918
  const extraArgs = process.argv.slice(2);
@@ -21070,14 +20983,12 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
21070
20983
  }
21071
20984
  const buf = this.consume(2);
21072
20985
  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);
20986
+ cb(this.createError(RangeError, "RSV2 and RSV3 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_2_3"));
21075
20987
  return;
21076
20988
  }
21077
20989
  const compressed = (buf[0] & 64) === 64;
21078
20990
  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);
20991
+ cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
21081
20992
  return;
21082
20993
  }
21083
20994
  this._fin = (buf[0] & 128) === 128;
@@ -21085,55 +20996,46 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
21085
20996
  this._payloadLength = buf[1] & 127;
21086
20997
  if (this._opcode === 0) {
21087
20998
  if (compressed) {
21088
- const error$1 = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
21089
- cb(error$1);
20999
+ cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
21090
21000
  return;
21091
21001
  }
21092
21002
  if (!this._fragmented) {
21093
- const error$1 = this.createError(RangeError, "invalid opcode 0", true, 1002, "WS_ERR_INVALID_OPCODE");
21094
- cb(error$1);
21003
+ cb(this.createError(RangeError, "invalid opcode 0", true, 1002, "WS_ERR_INVALID_OPCODE"));
21095
21004
  return;
21096
21005
  }
21097
21006
  this._opcode = this._fragmented;
21098
21007
  } else if (this._opcode === 1 || this._opcode === 2) {
21099
21008
  if (this._fragmented) {
21100
- const error$1 = this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE");
21101
- cb(error$1);
21009
+ cb(this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE"));
21102
21010
  return;
21103
21011
  }
21104
21012
  this._compressed = compressed;
21105
21013
  } else if (this._opcode > 7 && this._opcode < 11) {
21106
21014
  if (!this._fin) {
21107
- const error$1 = this.createError(RangeError, "FIN must be set", true, 1002, "WS_ERR_EXPECTED_FIN");
21108
- cb(error$1);
21015
+ cb(this.createError(RangeError, "FIN must be set", true, 1002, "WS_ERR_EXPECTED_FIN"));
21109
21016
  return;
21110
21017
  }
21111
21018
  if (compressed) {
21112
- const error$1 = this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1");
21113
- cb(error$1);
21019
+ cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
21114
21020
  return;
21115
21021
  }
21116
21022
  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);
21023
+ cb(this.createError(RangeError, `invalid payload length ${this._payloadLength}`, true, 1002, "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"));
21119
21024
  return;
21120
21025
  }
21121
21026
  } else {
21122
- const error$1 = this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE");
21123
- cb(error$1);
21027
+ cb(this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE"));
21124
21028
  return;
21125
21029
  }
21126
21030
  if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
21127
21031
  this._masked = (buf[1] & 128) === 128;
21128
21032
  if (this._isServer) {
21129
21033
  if (!this._masked) {
21130
- const error$1 = this.createError(RangeError, "MASK must be set", true, 1002, "WS_ERR_EXPECTED_MASK");
21131
- cb(error$1);
21034
+ cb(this.createError(RangeError, "MASK must be set", true, 1002, "WS_ERR_EXPECTED_MASK"));
21132
21035
  return;
21133
21036
  }
21134
21037
  } 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);
21038
+ cb(this.createError(RangeError, "MASK must be clear", true, 1002, "WS_ERR_UNEXPECTED_MASK"));
21137
21039
  return;
21138
21040
  }
21139
21041
  if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
@@ -21168,8 +21070,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
21168
21070
  const buf = this.consume(8);
21169
21071
  const num = buf.readUInt32BE(0);
21170
21072
  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);
21073
+ cb(this.createError(RangeError, "Unsupported WebSocket frame: payload length > 2^53 - 1", false, 1009, "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"));
21173
21074
  return;
21174
21075
  }
21175
21076
  this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
@@ -21185,8 +21086,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
21185
21086
  if (this._payloadLength && this._opcode < 8) {
21186
21087
  this._totalPayloadLength += this._payloadLength;
21187
21088
  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);
21089
+ cb(this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
21190
21090
  return;
21191
21091
  }
21192
21092
  }
@@ -21250,8 +21150,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
21250
21150
  if (buf.length) {
21251
21151
  this._messageLength += buf.length;
21252
21152
  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);
21153
+ cb(this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
21255
21154
  return;
21256
21155
  }
21257
21156
  this._fragments.push(buf);
@@ -21297,8 +21196,7 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
21297
21196
  } else {
21298
21197
  const buf = concat(fragments, messageLength);
21299
21198
  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);
21199
+ cb(this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8"));
21302
21200
  return;
21303
21201
  }
21304
21202
  if (this._state === INFLATING || this._allowSynchronousEvents) {
@@ -21330,14 +21228,12 @@ var require_receiver = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws
21330
21228
  } else {
21331
21229
  const code = data.readUInt16BE(0);
21332
21230
  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);
21231
+ cb(this.createError(RangeError, `invalid status code ${code}`, true, 1002, "WS_ERR_INVALID_CLOSE_CODE"));
21335
21232
  return;
21336
21233
  }
21337
21234
  const buf = new FastBuffer(data.buffer, data.byteOffset + 2, data.length - 2);
21338
21235
  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);
21236
+ cb(this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8"));
21341
21237
  return;
21342
21238
  }
21343
21239
  this._loop = false;
@@ -22248,7 +22144,7 @@ var require_extension = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
22248
22144
  //#region ../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js
22249
22145
  var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/ws@8.18.3/node_modules/ws/lib/websocket.js": ((exports, module) => {
22250
22146
  const EventEmitter$2 = __require("events");
22251
- const https$4 = __require("https");
22147
+ const https$3 = __require("https");
22252
22148
  const http$5 = __require("http");
22253
22149
  const net$1 = __require("net");
22254
22150
  const tls = __require("tls");
@@ -22804,7 +22700,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
22804
22700
  }
22805
22701
  const defaultPort = isSecure ? 443 : 80;
22806
22702
  const key = randomBytes(16).toString("base64");
22807
- const request = isSecure ? https$4.request : http$5.request;
22703
+ const request = isSecure ? https$3.request : http$5.request;
22808
22704
  const protocolSet = /* @__PURE__ */ new Set();
22809
22705
  let perMessageDeflate;
22810
22706
  opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
@@ -22885,8 +22781,7 @@ var require_websocket = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/w
22885
22781
  try {
22886
22782
  addr = new URL$3(location$1, address);
22887
22783
  } catch (e$1) {
22888
- const err$2 = /* @__PURE__ */ new SyntaxError(`Invalid URL: ${location$1}`);
22889
- emitErrorAndClose(websocket, err$2);
22784
+ emitErrorAndClose(websocket, /* @__PURE__ */ new SyntaxError(`Invalid URL: ${location$1}`));
22890
22785
  return;
22891
22786
  }
22892
22787
  initAsClient(websocket, addr, protocols, options$1);
@@ -23748,7 +23643,7 @@ var import_websocket = /* @__PURE__ */ __toESM(require_websocket(), 1);
23748
23643
  var import_websocket_server = /* @__PURE__ */ __toESM(require_websocket_server(), 1);
23749
23644
 
23750
23645
  //#endregion
23751
- //#region ../../node_modules/.pnpm/host-validation-middleware@0.1.1/node_modules/host-validation-middleware/dist/index.js
23646
+ //#region ../../node_modules/.pnpm/host-validation-middleware@0.1.2/node_modules/host-validation-middleware/dist/index.js
23752
23647
  /**
23753
23648
  * This function assumes that the input is not malformed.
23754
23649
  * This is because we only care about browser requests.
@@ -23882,10 +23777,7 @@ function createWebSocketServer(server, config$2, httpsOptions) {
23882
23777
  if (req$4.headers["sec-websocket-protocol"] === "vite-ping") return true;
23883
23778
  if (allowedHosts !== true && !isHostAllowed(req$4.headers.host, allowedHosts)) return false;
23884
23779
  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
- }
23780
+ if (req$4.headers.origin) return hasValidToken(config$2, new URL(`http://example.com${req$4.url}`));
23889
23781
  return true;
23890
23782
  };
23891
23783
  const handleUpgrade = (req$4, socket, head, isPing) => {
@@ -24076,8 +23968,8 @@ function baseMiddleware(rawBase, middlewareMode) {
24076
23968
  }
24077
23969
 
24078
23970
  //#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) => {
23971
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/http-proxy/common.js
23972
+ 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
23973
  Object.defineProperty(exports, "__esModule", { value: true });
24082
23974
  exports.isSSL = void 0;
24083
23975
  exports.setupOutgoing = setupOutgoing;
@@ -24091,6 +23983,12 @@ var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http
24091
23983
  const upgradeHeader = /(^|,)\s*upgrade\s*($|,)/i;
24092
23984
  exports.isSSL = /^https|wss/;
24093
23985
  const HEADER_BLACKLIST = "trailer";
23986
+ const HTTP2_HEADER_BLACKLIST = [
23987
+ ":method",
23988
+ ":path",
23989
+ ":scheme",
23990
+ ":authority"
23991
+ ];
24094
23992
  function setupOutgoing(outgoing, options$1, req$4, forward) {
24095
23993
  const target = options$1[forward || "target"];
24096
23994
  outgoing.port = +(target.port ?? (target.protocol !== void 0 && exports.isSSL.test(target.protocol) ? 443 : 80));
@@ -24116,6 +24014,7 @@ var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http
24116
24014
  delete outgoing.headers[header];
24117
24015
  break;
24118
24016
  }
24017
+ if (req$4.httpVersionMajor > 1) for (const header of HTTP2_HEADER_BLACKLIST) delete outgoing.headers[header];
24119
24018
  if (options$1.auth) {
24120
24019
  delete outgoing.headers.authorization;
24121
24020
  outgoing.auth = options$1.auth;
@@ -24196,8 +24095,8 @@ var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http
24196
24095
  else if (typeof url$3 === "object" && "href" in url$3 && typeof url$3.href === "string") url$3 = url$3.href;
24197
24096
  if (!url$3) url$3 = "";
24198
24097
  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");
24098
+ if (url$3.startsWith("//")) url$3 = `http://base.invalid${url$3}`;
24099
+ return new URL(url$3, "http://base.invalid");
24201
24100
  }
24202
24101
  function required(port, protocol) {
24203
24102
  protocol = protocol.split(":")[0];
@@ -24214,8 +24113,8 @@ var require_common = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/http
24214
24113
  }) });
24215
24114
 
24216
24115
  //#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) => {
24116
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/http-proxy/passes/web-outgoing.js
24117
+ 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
24118
  var __createBinding$3 = exports && exports.__createBinding || (Object.create ? (function(o$1, m$2, k, k2) {
24220
24119
  if (k2 === void 0) k2 = k;
24221
24120
  var desc = Object.getOwnPropertyDescriptor(m$2, k);
@@ -24305,16 +24204,15 @@ var require_web_outgoing = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
24305
24204
  }
24306
24205
  for (const key0 in proxyRes.headers) {
24307
24206
  let key = key0;
24207
+ if (_req.httpVersionMajor > 1 && key === "connection") continue;
24308
24208
  const header = proxyRes.headers[key];
24309
24209
  if (preserveHeaderKeyCase && rawHeaderKeyMap) key = rawHeaderKeyMap[key] ?? key;
24310
24210
  setHeader(key, header);
24311
24211
  }
24312
24212
  }
24313
24213
  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;
24214
+ res.statusCode = proxyRes.statusCode;
24215
+ if (proxyRes.statusMessage && _req.httpVersionMajor === 1) res.statusMessage = proxyRes.statusMessage;
24318
24216
  }
24319
24217
  exports.OUTGOING_PASSES = {
24320
24218
  removeChunked,
@@ -24346,7 +24244,7 @@ var require_follow_redirects = /* @__PURE__ */ __commonJS({ "../../node_modules/
24346
24244
  var url = __require("url");
24347
24245
  var URL$2 = url.URL;
24348
24246
  var http$3 = __require("http");
24349
- var https$3 = __require("https");
24247
+ var https$2 = __require("https");
24350
24248
  var Writable = __require("stream").Writable;
24351
24249
  var assert$1 = __require("assert");
24352
24250
  var debug$6 = require_debug();
@@ -24766,14 +24664,14 @@ var require_follow_redirects = /* @__PURE__ */ __commonJS({ "../../node_modules/
24766
24664
  }
24767
24665
  module.exports = wrap({
24768
24666
  http: http$3,
24769
- https: https$3
24667
+ https: https$2
24770
24668
  });
24771
24669
  module.exports.wrap = wrap;
24772
24670
  }) });
24773
24671
 
24774
24672
  //#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) => {
24673
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/http-proxy/passes/web-incoming.js
24674
+ 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
24675
  var __createBinding$2 = exports && exports.__createBinding || (Object.create ? (function(o$1, m$2, k, k2) {
24778
24676
  if (k2 === void 0) k2 = k;
24779
24677
  var desc = Object.getOwnPropertyDescriptor(m$2, k);
@@ -24821,14 +24719,14 @@ var require_web_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
24821
24719
  exports.XHeaders = XHeaders$1;
24822
24720
  exports.stream = stream$1;
24823
24721
  const http$2 = __importStar$2(__require("node:http"));
24824
- const https$2 = __importStar$2(__require("node:https"));
24722
+ const https$1 = __importStar$2(__require("node:https"));
24825
24723
  const web_outgoing_1$1 = require_web_outgoing();
24826
24724
  const common$1 = __importStar$2(require_common());
24827
24725
  const followRedirects = __importStar$2(require_follow_redirects());
24828
24726
  const web_o$1 = Object.values(web_outgoing_1$1.OUTGOING_PASSES);
24829
24727
  const nativeAgents = {
24830
24728
  http: http$2,
24831
- https: https$2
24729
+ https: https$1
24832
24730
  };
24833
24731
  function deleteLength(req$4) {
24834
24732
  if ((req$4.method === "DELETE" || req$4.method === "OPTIONS") && !req$4.headers["content-length"]) {
@@ -24858,9 +24756,9 @@ var require_web_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
24858
24756
  server.emit("start", req$4, res, options$1.target || options$1.forward);
24859
24757
  const agents = options$1.followRedirects ? followRedirects : nativeAgents;
24860
24758
  const http$7 = agents.http;
24861
- const https$5 = agents.https;
24759
+ const https$4 = agents.https;
24862
24760
  if (options$1.forward) {
24863
- const proto$2 = options$1.forward.protocol === "https:" ? https$5 : http$7;
24761
+ const proto$2 = options$1.forward.protocol === "https:" ? https$4 : http$7;
24864
24762
  const outgoingOptions$1 = common$1.setupOutgoing(options$1.ssl || {}, options$1, req$4, "forward");
24865
24763
  const forwardReq = proto$2.request(outgoingOptions$1);
24866
24764
  const forwardError = createErrorHandler(forwardReq, options$1.forward);
@@ -24869,7 +24767,7 @@ var require_web_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
24869
24767
  (options$1.buffer || req$4).pipe(forwardReq);
24870
24768
  if (!options$1.target) return res.end();
24871
24769
  }
24872
- const proto$1 = options$1.target.protocol === "https:" ? https$5 : http$7;
24770
+ const proto$1 = options$1.target.protocol === "https:" ? https$4 : http$7;
24873
24771
  const outgoingOptions = common$1.setupOutgoing(options$1.ssl || {}, options$1, req$4);
24874
24772
  const proxyReq = proto$1.request(outgoingOptions);
24875
24773
  proxyReq.on("socket", (socket) => {
@@ -24916,8 +24814,8 @@ var require_web_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnp
24916
24814
  }) });
24917
24815
 
24918
24816
  //#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) => {
24817
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/http-proxy/passes/ws-incoming.js
24818
+ 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
24819
  var __createBinding$1 = exports && exports.__createBinding || (Object.create ? (function(o$1, m$2, k, k2) {
24922
24820
  if (k2 === void 0) k2 = k;
24923
24821
  var desc = Object.getOwnPropertyDescriptor(m$2, k);
@@ -24968,7 +24866,7 @@ var require_ws_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
24968
24866
  exports.XHeaders = XHeaders;
24969
24867
  exports.stream = stream;
24970
24868
  const http$1 = __importStar$1(__require("node:http"));
24971
- const https$1 = __importStar$1(__require("node:https"));
24869
+ const https = __importStar$1(__require("node:https"));
24972
24870
  const common = __importStar$1(require_common());
24973
24871
  const web_outgoing_1 = require_web_outgoing();
24974
24872
  const log$1 = (0, __importDefault$1(require_node$1()).default)("http-proxy-3:ws-incoming");
@@ -25054,7 +24952,7 @@ var require_ws_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
25054
24952
  };
25055
24953
  common.setupSocket(socket);
25056
24954
  if (head && head.length) socket.unshift(head);
25057
- const proto$1 = common.isSSL.test(options$1.target.protocol) ? https$1 : http$1;
24955
+ const proto$1 = common.isSSL.test(options$1.target.protocol) ? https : http$1;
25058
24956
  const outgoingOptions = common.setupOutgoing(options$1.ssl || {}, options$1, req$4);
25059
24957
  const proxyReq = proto$1.request(outgoingOptions);
25060
24958
  if (server) server.emit("proxyReqWs", proxyReq, req$4, socket, options$1, head);
@@ -25125,8 +25023,8 @@ var require_ws_incoming = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm
25125
25023
  }) });
25126
25024
 
25127
25025
  //#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) => {
25026
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/http-proxy/index.js
25027
+ 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
25028
  var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o$1, m$2, k, k2) {
25131
25029
  if (k2 === void 0) k2 = k;
25132
25030
  var desc = Object.getOwnPropertyDescriptor(m$2, k);
@@ -25173,7 +25071,7 @@ var require_http_proxy = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/
25173
25071
  };
25174
25072
  Object.defineProperty(exports, "__esModule", { value: true });
25175
25073
  const http = __importStar(__require("node:http"));
25176
- const https = __importStar(__require("node:https"));
25074
+ const http2 = __importStar(__require("node:http2"));
25177
25075
  const web_incoming_1 = require_web_incoming();
25178
25076
  const ws_incoming_1$1 = require_ws_incoming();
25179
25077
  const node_events_1 = __require("node:events");
@@ -25251,7 +25149,10 @@ var require_http_proxy = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/
25251
25149
  const requestListener = (req$4, res) => {
25252
25150
  this.web(req$4, res);
25253
25151
  };
25254
- this._server = this.options.ssl ? https.createServer(this.options.ssl, requestListener) : http.createServer(requestListener);
25152
+ this._server = this.options.ssl ? http2.createSecureServer({
25153
+ ...this.options.ssl,
25154
+ allowHTTP1: true
25155
+ }, requestListener) : http.createServer(requestListener);
25255
25156
  if (this.options.ws) this._server.on("upgrade", (req$4, socket, head) => {
25256
25157
  this.ws(req$4, socket, head);
25257
25158
  });
@@ -25332,8 +25233,8 @@ var require_http_proxy = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/
25332
25233
  }) });
25333
25234
 
25334
25235
  //#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) => {
25236
+ //#region ../../node_modules/.pnpm/http-proxy-3@1.22.0/node_modules/http-proxy-3/dist/lib/index.js
25237
+ 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
25238
  Object.defineProperty(exports, "__esModule", { value: true });
25338
25239
  exports.numOpenSockets = exports.ProxyServer = void 0;
25339
25240
  exports.createProxyServer = createProxyServer;
@@ -25637,8 +25538,7 @@ function send(req$4, res, content, type, options$1) {
25637
25538
  if (import_convert_source_map$1.default.mapFileCommentRegex.test(code)) debug$3?.(`Skipped injecting fallback sourcemap for ${req$4.url}`);
25638
25539
  else {
25639
25540
  const urlWithoutTimestamp = removeTimestampQuery(req$4.url);
25640
- const ms = new MagicString(code);
25641
- content = getCodeWithSourcemap(type, code, ms.generateMap({
25541
+ content = getCodeWithSourcemap(type, code, new MagicString(code).generateMap({
25642
25542
  source: path.basename(urlWithoutTimestamp),
25643
25543
  hires: "boundary",
25644
25544
  includeContent: true
@@ -25961,8 +25861,7 @@ function isFileServingAllowed(configOrUrl, urlOrServer) {
25961
25861
  const config$2 = typeof urlOrServer === "string" ? configOrUrl : urlOrServer.config;
25962
25862
  const url$3 = typeof urlOrServer === "string" ? urlOrServer : configOrUrl;
25963
25863
  if (!config$2.server.fs.strict) return true;
25964
- const filePath = fsPathFromUrl(url$3);
25965
- return isFileLoadingAllowed(config$2, filePath);
25864
+ return isFileLoadingAllowed(config$2, fsPathFromUrl(url$3));
25966
25865
  }
25967
25866
  /**
25968
25867
  * Warning: parameters are not validated, only works with normalized absolute paths
@@ -26028,8 +25927,9 @@ const debugCache$1 = createDebugger("vite:cache");
26028
25927
  function transformRequest(environment, url$3, options$1 = {}) {
26029
25928
  if (environment._closing && environment.config.dev.recoverable) throwClosedServerError();
26030
25929
  const timestamp = monotonicDateNow();
25930
+ url$3 = removeTimestampQuery(url$3);
26031
25931
  const pending = environment._pendingRequests.get(url$3);
26032
- if (pending) return environment.moduleGraph.getModuleByUrl(removeTimestampQuery(url$3)).then((module$1) => {
25932
+ if (pending) return environment.moduleGraph.getModuleByUrl(url$3).then((module$1) => {
26033
25933
  if (!module$1 || pending.timestamp > module$1.lastInvalidationTimestamp) return pending.request;
26034
25934
  else {
26035
25935
  pending.abort();
@@ -26052,7 +25952,6 @@ function transformRequest(environment, url$3, options$1 = {}) {
26052
25952
  return request.finally(clearCache);
26053
25953
  }
26054
25954
  async function doTransform(environment, url$3, options$1, timestamp) {
26055
- url$3 = removeTimestampQuery(url$3);
26056
25955
  const { pluginContainer } = environment;
26057
25956
  let module$1 = await environment.moduleGraph.getModuleByUrl(url$3);
26058
25957
  if (module$1) {
@@ -26444,16 +26343,15 @@ function traverseNodes(node, visitor) {
26444
26343
  if (nodeIsElement(node) || node.nodeName === "#document" || node.nodeName === "#document-fragment") node.childNodes.forEach((childNode) => traverseNodes(childNode, visitor));
26445
26344
  }
26446
26345
  async function traverseHtml(html, filePath, warn, visitor) {
26447
- const { parse: parse$17 } = await import("./dep-CCSnTAeo.js");
26346
+ const { parse: parse$17 } = await import("./dep-BRReGxEs.js");
26448
26347
  const warnings = {};
26449
- const ast = parse$17(html, {
26348
+ traverseNodes(parse$17(html, {
26450
26349
  scriptingEnabled: false,
26451
26350
  sourceCodeLocationInfo: true,
26452
26351
  onParseError: (e$1) => {
26453
26352
  handleParseError(e$1, html, filePath, warnings);
26454
26353
  }
26455
- });
26456
- traverseNodes(ast, visitor);
26354
+ }), visitor);
26457
26355
  for (const message of Object.values(warnings)) warn(import_picocolors$13.default.yellow(`\n${message}`));
26458
26356
  }
26459
26357
  function getScriptInfo(node) {
@@ -26604,8 +26502,7 @@ function buildHtmlPlugin(config$2) {
26604
26502
  shouldRemove = true;
26605
26503
  } else if (node.childNodes.length) {
26606
26504
  const contents = node.childNodes.pop().value;
26607
- const filePath = id.replace(normalizePath(config$2.root), "");
26608
- addToHTMLProxyCache(config$2, filePath, inlineModuleIndex, { code: contents });
26505
+ addToHTMLProxyCache(config$2, id.replace(normalizePath(config$2.root), ""), inlineModuleIndex, { code: contents });
26609
26506
  js += `\nimport "${id}?html-proxy&index=${inlineModuleIndex}.js"`;
26610
26507
  shouldRemove = true;
26611
26508
  }
@@ -26658,8 +26555,7 @@ function buildHtmlPlugin(config$2) {
26658
26555
  if (inlineStyle) {
26659
26556
  inlineModuleIndex++;
26660
26557
  const code = inlineStyle.attr.value;
26661
- const filePath = id.replace(normalizePath(config$2.root), "");
26662
- addToHTMLProxyCache(config$2, filePath, inlineModuleIndex, { code });
26558
+ addToHTMLProxyCache(config$2, id.replace(normalizePath(config$2.root), ""), inlineModuleIndex, { code });
26663
26559
  js += `\nimport "${id}?html-proxy&inline-css&style-attr&index=${inlineModuleIndex}.css"`;
26664
26560
  const hash$1 = getHash(cleanUrl(id));
26665
26561
  overwriteAttrValue(s$2, inlineStyle.location, `__VITE_INLINE_CSS__${hash$1}_${inlineModuleIndex}__`);
@@ -27463,8 +27359,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
27463
27359
  ensureWatchedFile(watcher, mod.file, config$2.root);
27464
27360
  await server?.environments.client.pluginContainer.transform(code, mod.id);
27465
27361
  const hash$1 = getHash(cleanUrl(mod.id));
27466
- const result = htmlProxyResult.get(`${hash$1}_${index}`);
27467
- overwriteAttrValue(s$2, location$1, result ?? "");
27362
+ overwriteAttrValue(s$2, location$1, htmlProxyResult.get(`${hash$1}_${index}`) ?? "");
27468
27363
  })]);
27469
27364
  html = s$2.toString();
27470
27365
  return {
@@ -28414,8 +28309,7 @@ function resolveServerOptions(root, raw, logger) {
28414
28309
  if (process.versions.pnp) {
28415
28310
  const cwd = searchForPackageRoot(root);
28416
28311
  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();
28312
+ const yarnCacheDir = execSync(`yarn config get ${execSync("yarn config get enableGlobalCache", { cwd }).toString().trim() === "true" ? "globalFolder" : "cacheFolder"}`, { cwd }).toString().trim();
28419
28313
  allowDirs.push(yarnCacheDir);
28420
28314
  } catch (e$1) {
28421
28315
  logger.warn(`Get yarn cache dir error: ${e$1.message}`, { timestamp: true });
@@ -29093,10 +28987,9 @@ function definePlugin(config$2) {
29093
28987
  const patternKeys = Object.keys(userDefine);
29094
28988
  if (!keepProcessEnv && Object.keys(processEnv).length) patternKeys.push("process.env");
29095
28989
  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
28990
  return [
29098
28991
  define$1,
29099
- pattern,
28992
+ patternKeys.length ? new RegExp(patternKeys.map((key) => escapeRegex(key).replaceAll(escapedDotRE, "\\??\\.")).join("|")) : null,
29100
28993
  importMetaEnvVal
29101
28994
  ];
29102
28995
  }
@@ -29226,8 +29119,7 @@ async function bundleWorkerEntry(config$2, id) {
29226
29119
  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
29120
  const { rollup } = await import("rollup");
29228
29121
  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);
29122
+ const workerEnvironment = new BuildEnvironment("client", await plugins$1(newBundleChain));
29231
29123
  await workerEnvironment.init();
29232
29124
  const bundle = await rollup({
29233
29125
  ...rollupOptions,
@@ -29241,12 +29133,12 @@ async function bundleWorkerEntry(config$2, id) {
29241
29133
  let chunk;
29242
29134
  try {
29243
29135
  const workerOutputConfig = config$2.worker.rollupOptions.output;
29244
- const workerConfig$1 = workerOutputConfig ? Array.isArray(workerOutputConfig) ? workerOutputConfig[0] || {} : workerOutputConfig : {};
29136
+ const workerConfig = workerOutputConfig ? Array.isArray(workerOutputConfig) ? workerOutputConfig[0] || {} : workerOutputConfig : {};
29245
29137
  const { output: [outputChunk, ...outputChunks] } = await bundle.generate({
29246
29138
  entryFileNames: path.posix.join(config$2.build.assetsDir, "[name]-[hash].js"),
29247
29139
  chunkFileNames: path.posix.join(config$2.build.assetsDir, "[name]-[hash].js"),
29248
29140
  assetFileNames: path.posix.join(config$2.build.assetsDir, "[name]-[hash].[ext]"),
29249
- ...workerConfig$1,
29141
+ ...workerConfig,
29250
29142
  format: format$3,
29251
29143
  sourcemap: config$2.build.sourcemap
29252
29144
  });
@@ -29273,9 +29165,8 @@ function emitSourcemapForWorkerEntry(config$2, chunk) {
29273
29165
  if (sourcemap) {
29274
29166
  if (config$2.build.sourcemap === "hidden" || config$2.build.sourcemap === true) {
29275
29167
  const data = sourcemap.toString();
29276
- const mapFileName = chunk.fileName + ".map";
29277
29168
  saveEmitWorkerAsset(config$2, {
29278
- fileName: mapFileName,
29169
+ fileName: chunk.fileName + ".map",
29279
29170
  originalFileName: null,
29280
29171
  originalFileNames: [],
29281
29172
  source: data
@@ -29574,15 +29465,14 @@ function extractImportedBindings(id, source, importSpec, importedBindings) {
29574
29465
  ESM_STATIC_IMPORT_RE.lastIndex = 0;
29575
29466
  const match = ESM_STATIC_IMPORT_RE.exec(exp);
29576
29467
  if (!match) return;
29577
- const staticImport = {
29468
+ const parsed = parseStaticImport({
29578
29469
  type: "static",
29579
29470
  code: match[0],
29580
29471
  start: match.index,
29581
29472
  end: match.index + match[0].length,
29582
29473
  imports: match.groups.imports,
29583
29474
  specifier: match.groups.specifier
29584
- };
29585
- const parsed = parseStaticImport(staticImport);
29475
+ });
29586
29476
  if (parsed.namespacedImport) bindings.add("*");
29587
29477
  if (parsed.defaultImport) bindings.add("default");
29588
29478
  if (parsed.namedImports) for (const name of Object.keys(parsed.namedImports)) bindings.add(name);
@@ -29747,7 +29637,7 @@ function importAnalysisPlugin(config$2) {
29747
29637
  const isDynamicImport = dynamicIndex > -1;
29748
29638
  if (!isDynamicImport && attributeIndex > -1) str().remove(end + 1, expEnd);
29749
29639
  if (specifier !== void 0) {
29750
- if (isExternalUrl(specifier) && !specifier.startsWith("file://") || isDataUrl(specifier)) return;
29640
+ if ((isExternalUrl(specifier) && !specifier.startsWith("file://") || isDataUrl(specifier)) && !matchAlias(specifier)) return;
29751
29641
  if (ssr && !matchAlias(specifier)) {
29752
29642
  if (shouldExternalize(environment, specifier, importer)) return;
29753
29643
  if (isBuiltin(environment.config.resolve.builtins, specifier)) return;
@@ -29881,8 +29771,7 @@ function interopNamedImports(str, importSpecifier, rewrittenUrl, importIndex, im
29881
29771
  const exp = source.slice(expStart, expEnd);
29882
29772
  if (dynamicIndex > -1) str.overwrite(expStart, expEnd, `import('${rewrittenUrl}').then(m => (${interopHelperStr})(m.default))` + getLineBreaks(exp), { contentOnly: true });
29883
29773
  else {
29884
- const rawUrl = source.slice(start, end);
29885
- const rewritten = transformCjsImport(exp, rewrittenUrl, rawUrl, importIndex, importer, config$2);
29774
+ const rewritten = transformCjsImport(exp, rewrittenUrl, source.slice(start, end), importIndex, importer, config$2);
29886
29775
  if (rewritten) str.overwrite(expStart, expEnd, rewritten + getLineBreaks(exp), { contentOnly: true });
29887
29776
  else str.overwrite(start, end, rewrittenUrl + getLineBreaks(source.slice(start, end)), { contentOnly: true });
29888
29777
  }
@@ -30560,8 +30449,7 @@ function dynamicImportVarsPlugin(config$2) {
30560
30449
  //#region src/node/plugins/pluginFilter.ts
30561
30450
  function getMatcherString(glob$1, cwd) {
30562
30451
  if (glob$1.startsWith("**") || path.isAbsolute(glob$1)) return slash(glob$1);
30563
- const resolved = path.join(cwd, glob$1);
30564
- return slash(resolved);
30452
+ return slash(path.join(cwd, glob$1));
30565
30453
  }
30566
30454
  function patternToIdFilter(pattern, cwd) {
30567
30455
  if (pattern instanceof RegExp) return (id) => {
@@ -30570,11 +30458,9 @@ function patternToIdFilter(pattern, cwd) {
30570
30458
  pattern.lastIndex = 0;
30571
30459
  return result;
30572
30460
  };
30573
- const glob$1 = getMatcherString(pattern, cwd);
30574
- const matcher = picomatch(glob$1, { dot: true });
30461
+ const matcher = picomatch(getMatcherString(pattern, cwd), { dot: true });
30575
30462
  return (id) => {
30576
- const normalizedId = slash(id);
30577
- return matcher(normalizedId);
30463
+ return matcher(slash(id));
30578
30464
  };
30579
30465
  }
30580
30466
  function patternToCodeFilter(pattern) {
@@ -30633,7 +30519,7 @@ function createFilterForTransform(idFilter, codeFilter, cwd) {
30633
30519
  async function resolvePlugins(config$2, prePlugins, normalPlugins, postPlugins) {
30634
30520
  const isBuild = config$2.command === "build";
30635
30521
  const isWorker = config$2.isWorker;
30636
- const buildPlugins = isBuild ? await (await import("./dep-D6Kf1CgD.js")).resolveBuildPlugins(config$2) : {
30522
+ const buildPlugins = isBuild ? await (await import("./dep-B6cO9KC8.js")).resolveBuildPlugins(config$2) : {
30637
30523
  pre: [],
30638
30524
  post: []
30639
30525
  };
@@ -31258,8 +31144,7 @@ var PluginContext = class extends MinimalPluginContext {
31258
31144
  if (this instanceof TransformPluginContext && typeof err$2.loc?.line === "number" && typeof err$2.loc.column === "number") {
31259
31145
  const rawSourceMap = this._getCombinedSourcemap();
31260
31146
  if (rawSourceMap && "version" in rawSourceMap) {
31261
- const traced = new TraceMap(rawSourceMap);
31262
- const { source, line, column } = originalPositionFor(traced, {
31147
+ const { source, line, column } = originalPositionFor(new TraceMap(rawSourceMap), {
31263
31148
  line: Number(err$2.loc.line),
31264
31149
  column: Number(err$2.loc.column)
31265
31150
  });
@@ -31872,7 +31757,7 @@ function cssPostPlugin(config$2) {
31872
31757
  },
31873
31758
  async generateBundle(opts, bundle) {
31874
31759
  if (opts.__vite_skip_asset_emit__) return;
31875
- if (!this.environment.config.build.cssCodeSplit && !hasEmitted) {
31760
+ if ((config$2.command !== "build" || this.environment.config.build.emitAssets) && !this.environment.config.build.cssCodeSplit && !hasEmitted) {
31876
31761
  let extractedCss = "";
31877
31762
  const collected = /* @__PURE__ */ new Set();
31878
31763
  const dynamicImports = /* @__PURE__ */ new Set();
@@ -32209,8 +32094,7 @@ async function runPostCSS(id, code, plugins$1, options$1, deps, logger, enableSo
32209
32094
  code: postcssResult.css,
32210
32095
  map: { mappings: "" }
32211
32096
  };
32212
- const rawPostcssMap = postcssResult.map.toJSON();
32213
- const postcssMap = await formatPostcssSourceMap(rawPostcssMap, cleanUrl(id));
32097
+ const postcssMap = await formatPostcssSourceMap(postcssResult.map.toJSON(), cleanUrl(id));
32214
32098
  return {
32215
32099
  code: postcssResult.css,
32216
32100
  map: postcssMap
@@ -32227,7 +32111,7 @@ function createCachedImport(imp) {
32227
32111
  };
32228
32112
  }
32229
32113
  const importPostcssImport = createCachedImport(() => import("./dep-CwrJo3zV.js").then(__toDynamicImportESM(1)));
32230
- const importPostcssModules = createCachedImport(() => import("./dep-DrqJEUj9.js").then(__toDynamicImportESM(1)));
32114
+ const importPostcssModules = createCachedImport(() => import("./dep-B0biTXWL.js").then(__toDynamicImportESM(1)));
32231
32115
  const importPostcss = createCachedImport(() => import("postcss"));
32232
32116
  const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
32233
32117
  let alwaysFakeWorkerWorkerControllerCache;
@@ -32240,8 +32124,7 @@ async function preprocessCSS(code, filename, config$2) {
32240
32124
  alwaysFakeWorkerWorkerControllerCache ||= createPreprocessorWorkerController(0);
32241
32125
  workerController = alwaysFakeWorkerWorkerControllerCache;
32242
32126
  }
32243
- const environment = new PartialEnvironment("client", config$2);
32244
- return await compileCSS(environment, filename, code, workerController);
32127
+ return await compileCSS(new PartialEnvironment("client", config$2), filename, code, workerController);
32245
32128
  }
32246
32129
  async function formatPostcssSourceMap(rawMap, file) {
32247
32130
  const inputFileDir = path.dirname(file);
@@ -32285,8 +32168,7 @@ async function resolvePostcssConfig(config$2) {
32285
32168
  };
32286
32169
  } else {
32287
32170
  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) => {
32171
+ result = (0, import_src.default)({}, searchPath, { stopDir: searchForWorkspaceRoot(config$2.root) }).catch((e$1) => {
32290
32172
  if (!e$1.message.includes("No PostCSS Config found")) if (e$1 instanceof Error) {
32291
32173
  const { name, message, stack } = e$1;
32292
32174
  e$1.name = "Failed to load PostCSS config";
@@ -32653,8 +32535,7 @@ async function rebaseUrls(environment, file, rootFile, resolver$1, ignoreUrl) {
32653
32535
  if (ignoreUrl?.(unquotedUrl, rawUrl)) return false;
32654
32536
  if (unquotedUrl[0] === "/") return unquotedUrl;
32655
32537
  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);
32538
+ return normalizePath(path.relative(rootDir, absolute));
32658
32539
  };
32659
32540
  if (hasImportCss) rebased = await rewriteImportCss(content, rebaseFn);
32660
32541
  if (hasUrls) rebased = await rewriteCssUrls(rebased || content, rebaseFn);
@@ -32979,8 +32860,7 @@ async function compileLightningCSS(environment, id, src, deps, workerController,
32979
32860
  column: e$1.loc.column - 1
32980
32861
  };
32981
32862
  try {
32982
- const code = fs.readFileSync(e$1.fileName, "utf-8");
32983
- const friendlyMessage = getLightningCssErrorMessageForIeSyntaxes(code);
32863
+ const friendlyMessage = getLightningCssErrorMessageForIeSyntaxes(fs.readFileSync(e$1.fileName, "utf-8"));
32984
32864
  if (friendlyMessage) e$1.message += friendlyMessage;
32985
32865
  } catch {}
32986
32866
  }
@@ -33235,9 +33115,7 @@ function preload(baseModule, deps, importerUrl) {
33235
33115
  }
33236
33116
  function getPreloadCode(environment, renderBuiltUrlBoolean, isRelativeBase) {
33237
33117
  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()}`;
33118
+ 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
33119
  }
33242
33120
  /**
33243
33121
  * Build only. During serve this is performed as part of ./importAnalysis.
@@ -33500,8 +33378,10 @@ function buildImportAnalysisPlugin(config$2) {
33500
33378
  source: chunk.fileName,
33501
33379
  hires: "boundary"
33502
33380
  });
33381
+ const originalFile = chunk.map.file;
33503
33382
  const map$1 = combineSourcemaps(chunk.fileName, [nextMap, chunk.map]);
33504
33383
  map$1.toUrl = () => genSourceMapUrl(map$1);
33384
+ if (originalFile) map$1.file = originalFile;
33505
33385
  const originalDebugId = chunk.map.debugId;
33506
33386
  chunk.map = map$1;
33507
33387
  if (buildSourcemap === "inline") {
@@ -33590,8 +33470,7 @@ function ssrManifestPlugin() {
33590
33470
  chunk$1.imports.forEach(addDeps);
33591
33471
  }
33592
33472
  };
33593
- const normalizedFile = normalizePath(join(dirname(chunk.fileName), url$3.slice(1, -1)));
33594
- addDeps(normalizedFile);
33473
+ addDeps(normalizePath(join(dirname(chunk.fileName), url$3.slice(1, -1))));
33595
33474
  ssrManifest[basename(name)] = deps;
33596
33475
  }
33597
33476
  }
@@ -33666,8 +33545,7 @@ function prepareOutDirPlugin() {
33666
33545
  if (config$2.build.write) {
33667
33546
  const { root, build: options$1 } = config$2;
33668
33547
  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);
33548
+ prepareOutDir(resolvedOutDirs, resolveEmptyOutDir(options$1.emptyOutDir, root, resolvedOutDirs, this.environment.logger), this.environment);
33671
33549
  }
33672
33550
  }
33673
33551
  }
@@ -33677,14 +33555,11 @@ function prepareOutDir(outDirs, emptyOutDir, environment) {
33677
33555
  const { publicDir } = environment.config;
33678
33556
  const outDirsArray = [...outDirs];
33679
33557
  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
- }
33558
+ if (emptyOutDir !== false && fs.existsSync(outDir)) emptyDir(outDir, [...outDirsArray.map((dir) => {
33559
+ const relative$3 = path.relative(outDir, dir);
33560
+ if (relative$3 && !relative$3.startsWith("..") && !path.isAbsolute(relative$3)) return relative$3;
33561
+ return "";
33562
+ }).filter(Boolean), ".git"]);
33688
33563
  if (environment.config.build.copyPublicDir && publicDir && fs.existsSync(publicDir)) {
33689
33564
  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
33565
  copyDir(publicDir, outDir);
@@ -34013,10 +33888,8 @@ function onRollupLog(level, log$4, environment) {
34013
33888
  clearLine();
34014
33889
  const userOnLog = environment.config.build.rollupOptions?.onLog;
34015
33890
  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);
33891
+ if (userOnLog) if (userOnWarn) userOnLog(level, log$4, normalizeUserOnWarn(userOnWarn, viteLog));
33892
+ else userOnLog(level, log$4, viteLog);
34020
33893
  else if (userOnWarn) normalizeUserOnWarn(userOnWarn, viteLog)(level, log$4);
34021
33894
  else viteLog(level, log$4);
34022
33895
  }
@@ -34332,11 +34205,9 @@ async function fetchModule(environment, url$3, importer, options$1 = {}) {
34332
34205
  err$2.code = "ERR_MODULE_NOT_FOUND";
34333
34206
  throw err$2;
34334
34207
  }
34335
- const file = pathToFileURL(resolved.id).toString();
34336
- const type = isFilePathESM(resolved.id, environment.config.packageCache) ? "module" : "commonjs";
34337
34208
  return {
34338
- externalize: file,
34339
- type
34209
+ externalize: pathToFileURL(resolved.id).toString(),
34210
+ type: isFilePathESM(resolved.id, environment.config.packageCache) ? "module" : "commonjs"
34340
34211
  };
34341
34212
  }
34342
34213
  url$3 = unwrapId(url$3);
@@ -35221,8 +35092,7 @@ function invalidateModule(environment, m$2) {
35221
35092
  if (mod && mod.isSelfAccepting && mod.lastHMRTimestamp > 0 && !mod.lastHMRInvalidationReceived) {
35222
35093
  mod.lastHMRInvalidationReceived = true;
35223
35094
  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);
35095
+ updateModules(environment, getShortName(mod.file, environment.config.root), [...mod.importers], mod.lastHMRTimestamp, m$2.firstInvalidatedBy);
35226
35096
  }
35227
35097
  }
35228
35098
  const callCrawlEndIfIdleAfterMs = 50;
@@ -35492,10 +35362,7 @@ async function preview(inlineConfig = {}) {
35492
35362
  server.resolvedUrls = resolveServerUrls(httpServer, config$2.preview, hostname, httpsOptions, config$2);
35493
35363
  if (options$1.open) {
35494
35364
  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
- }
35365
+ if (url$3) openBrowser(typeof options$1.open === "string" ? new URL(options$1.open, url$3).href : url$3, true, logger);
35499
35366
  }
35500
35367
  return server;
35501
35368
  }
@@ -35507,8 +35374,7 @@ const ssrConfigDefaults = Object.freeze({
35507
35374
  optimizeDeps: {}
35508
35375
  });
35509
35376
  function resolveSSROptions(ssr, preserveSymlinks) {
35510
- const defaults = mergeWithDefaults(ssrConfigDefaults, { optimizeDeps: { esbuildOptions: { preserveSymlinks } } });
35511
- return mergeWithDefaults(defaults, ssr ?? {});
35377
+ return mergeWithDefaults(mergeWithDefaults(ssrConfigDefaults, { optimizeDeps: { esbuildOptions: { preserveSymlinks } } }), ssr ?? {});
35512
35378
  }
35513
35379
 
35514
35380
  //#endregion
@@ -35519,7 +35385,7 @@ function resolveSSROptions(ssr, preserveSymlinks) {
35519
35385
  */
35520
35386
  async function runnerImport(moduleId, inlineConfig) {
35521
35387
  const isModuleSyncConditionEnabled = (await import("#module-sync-enabled")).default;
35522
- const config$2 = await resolveConfig(mergeConfig(inlineConfig || {}, {
35388
+ const environment = createRunnableDevEnvironment("inline", await resolveConfig(mergeConfig(inlineConfig || {}, {
35523
35389
  configFile: false,
35524
35390
  envDir: false,
35525
35391
  cacheDir: process.cwd(),
@@ -35532,21 +35398,19 @@ async function runnerImport(moduleId, inlineConfig) {
35532
35398
  conditions: ["node", ...isModuleSyncConditionEnabled ? ["module-sync"] : []]
35533
35399
  }
35534
35400
  } }
35535
- }), "serve");
35536
- const environment = createRunnableDevEnvironment("inline", config$2, {
35401
+ }), "serve"), {
35537
35402
  runnerOptions: { hmr: { logger: false } },
35538
35403
  hot: false
35539
35404
  });
35540
35405
  await environment.init();
35541
35406
  try {
35542
35407
  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
35408
  return {
35548
35409
  module: module$1,
35549
- dependencies
35410
+ dependencies: [...environment.runner.evaluatedModules.urlToIdModuleMap.values()].filter((m$2) => {
35411
+ if (!m$2.meta || "externalize" in m$2.meta) return false;
35412
+ return m$2.exports !== module$1;
35413
+ }).map((m$2) => m$2.file)
35550
35414
  };
35551
35415
  } finally {
35552
35416
  await environment.close();
@@ -35782,8 +35646,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
35782
35646
  }, configEnv);
35783
35647
  else return p.apply === command;
35784
35648
  };
35785
- const rawPlugins = (await asyncFlatten(config$2.plugins || [])).filter(filterPlugin);
35786
- const [prePlugins, normalPlugins, postPlugins] = sortUserPlugins(rawPlugins);
35649
+ const [prePlugins, normalPlugins, postPlugins] = sortUserPlugins((await asyncFlatten(config$2.plugins || [])).filter(filterPlugin));
35787
35650
  const isBuild = command === "build";
35788
35651
  const userPlugins = [
35789
35652
  ...prePlugins,
@@ -35862,7 +35725,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
35862
35725
  const backwardCompatibleOptimizeDeps = resolvedEnvironments.client.optimizeDeps;
35863
35726
  const resolvedDevEnvironmentOptions = resolveDevEnvironmentOptions(config$2.dev, void 0, void 0);
35864
35727
  const resolvedBuildOptions = resolveBuildEnvironmentOptions(config$2.build ?? {}, logger, void 0);
35865
- const patchedConfigSsr = {
35728
+ const ssr = resolveSSROptions({
35866
35729
  ...config$2.ssr,
35867
35730
  external: resolvedEnvironments.ssr?.resolve.external,
35868
35731
  noExternal: resolvedEnvironments.ssr?.resolve.noExternal,
@@ -35872,8 +35735,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
35872
35735
  conditions: resolvedEnvironments.ssr?.resolve.conditions,
35873
35736
  externalConditions: resolvedEnvironments.ssr?.resolve.externalConditions
35874
35737
  }
35875
- };
35876
- const ssr = resolveSSROptions(patchedConfigSsr, resolvedDefaultResolve.preserveSymlinks);
35738
+ }, resolvedDefaultResolve.preserveSymlinks);
35877
35739
  let envDir = config$2.envFile === false ? false : config$2.envDir;
35878
35740
  if (envDir !== false) envDir = config$2.envDir ? normalizePath(path.resolve(resolvedRoot, config$2.envDir)) : resolvedRoot;
35879
35741
  const userEnv = loadEnv(mode, envDir, resolveEnvPrefix(config$2));
@@ -36283,11 +36145,10 @@ async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
36283
36145
  }
36284
36146
  async function runConfigHook(config$2, plugins$1, configEnv) {
36285
36147
  let conf = config$2;
36286
- const tempLogger = createLogger(config$2.logLevel, {
36148
+ const context = new BasicMinimalPluginContext(basePluginContextMeta, createLogger(config$2.logLevel, {
36287
36149
  allowClearScreen: config$2.clearScreen,
36288
36150
  customLogger: config$2.customLogger
36289
- });
36290
- const context = new BasicMinimalPluginContext(basePluginContextMeta, tempLogger);
36151
+ }));
36291
36152
  for (const p of getSortedPluginsByHook("config", plugins$1)) {
36292
36153
  const hook = p.config;
36293
36154
  const res = await getHookHandler(hook).call(context, conf, configEnv);