vite 6.4.3 → 6.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import * as fs$8 from 'node:fs';
2
2
  import fs__default, { promises as promises$1, existsSync as existsSync$1, readFileSync as readFileSync$1 } from 'node:fs';
3
- import path$b, { posix as posix$1, isAbsolute as isAbsolute$1, join as join$1, resolve as resolve$4, sep as sep$1, normalize, dirname as dirname$2, relative as relative$2, basename as basename$2, extname as extname$1 } from 'node:path';
3
+ import path$c, { posix as posix$1, isAbsolute as isAbsolute$1, join as join$1, resolve as resolve$4, sep as sep$1, normalize, dirname as dirname$2, relative as relative$2, basename as basename$2, extname as extname$1 } from 'node:path';
4
4
  import fsp, { constants as constants$3 } from 'node:fs/promises';
5
5
  import require$$1$1, { fileURLToPath as fileURLToPath$1, URL as URL$3, pathToFileURL as pathToFileURL$1 } from 'node:url';
6
6
  import { promisify as promisify$4, format as format$2, inspect, stripVTControlCharacters } from 'node:util';
@@ -721,12 +721,12 @@ const dataToEsm = function dataToEsm(data, options = {}) {
721
721
  return `${namedExportCode}${arbitraryExportCode}${defaultExportCode}`;
722
722
  };
723
723
 
724
- var path$a = require$$0$2;
724
+ var path$b = require$$0$2;
725
725
 
726
726
  var commondir = function (basedir, relfiles) {
727
727
  if (relfiles) {
728
728
  var files = relfiles.map(function (r) {
729
- return path$a.resolve(basedir, r);
729
+ return path$b.resolve(basedir, r);
730
730
  });
731
731
  }
732
732
  else {
@@ -6240,7 +6240,7 @@ if (process.versions.pnp) {
6240
6240
  }
6241
6241
  }
6242
6242
  function invalidatePackageData(packageCache, pkgPath) {
6243
- const pkgDir = normalizePath$3(path$b.dirname(pkgPath));
6243
+ const pkgDir = normalizePath$3(path$c.dirname(pkgPath));
6244
6244
  packageCache.forEach((pkg, cacheKey) => {
6245
6245
  if (pkg.dir === pkgDir) {
6246
6246
  packageCache.delete(cacheKey);
@@ -6256,7 +6256,7 @@ function resolvePackageData(pkgName, basedir, preserveSymlinks = false, packageC
6256
6256
  considerBuiltins: false
6257
6257
  });
6258
6258
  if (!pkg) return null;
6259
- const pkgData = loadPackageData(path$b.join(pkg, "package.json"));
6259
+ const pkgData = loadPackageData(path$c.join(pkg, "package.json"));
6260
6260
  packageCache?.set(cacheKey, pkgData);
6261
6261
  return pkgData;
6262
6262
  } catch {
@@ -6275,7 +6275,7 @@ function resolvePackageData(pkgName, basedir, preserveSymlinks = false, packageC
6275
6275
  );
6276
6276
  if (cached) return cached;
6277
6277
  }
6278
- const pkg = path$b.join(basedir, "node_modules", pkgName, "package.json");
6278
+ const pkg = path$c.join(basedir, "node_modules", pkgName, "package.json");
6279
6279
  try {
6280
6280
  if (fs__default.existsSync(pkg)) {
6281
6281
  const pkgPath = preserveSymlinks ? pkg : safeRealpathSync(pkg);
@@ -6294,7 +6294,7 @@ function resolvePackageData(pkgName, basedir, preserveSymlinks = false, packageC
6294
6294
  }
6295
6295
  } catch {
6296
6296
  }
6297
- const nextBasedir = path$b.dirname(basedir);
6297
+ const nextBasedir = path$c.dirname(basedir);
6298
6298
  if (nextBasedir === basedir) break;
6299
6299
  basedir = nextBasedir;
6300
6300
  }
@@ -6307,7 +6307,7 @@ function findNearestPackageData(basedir, packageCache) {
6307
6307
  const cached = getFnpdCache(packageCache, basedir, originalBasedir);
6308
6308
  if (cached) return cached;
6309
6309
  }
6310
- const pkgPath = path$b.join(basedir, "package.json");
6310
+ const pkgPath = path$c.join(basedir, "package.json");
6311
6311
  if (tryStatSync(pkgPath)?.isFile()) {
6312
6312
  try {
6313
6313
  const pkgData = loadPackageData(pkgPath);
@@ -6318,7 +6318,7 @@ function findNearestPackageData(basedir, packageCache) {
6318
6318
  } catch {
6319
6319
  }
6320
6320
  }
6321
- const nextBasedir = path$b.dirname(basedir);
6321
+ const nextBasedir = path$c.dirname(basedir);
6322
6322
  if (nextBasedir === basedir) break;
6323
6323
  basedir = nextBasedir;
6324
6324
  }
@@ -6327,13 +6327,13 @@ function findNearestPackageData(basedir, packageCache) {
6327
6327
  function findNearestMainPackageData(basedir, packageCache) {
6328
6328
  const nearestPackage = findNearestPackageData(basedir, packageCache);
6329
6329
  return nearestPackage && (nearestPackage.data.name ? nearestPackage : findNearestMainPackageData(
6330
- path$b.dirname(nearestPackage.dir),
6330
+ path$c.dirname(nearestPackage.dir),
6331
6331
  packageCache
6332
6332
  ));
6333
6333
  }
6334
6334
  function loadPackageData(pkgPath) {
6335
6335
  const data = JSON.parse(stripBomTag(fs__default.readFileSync(pkgPath, "utf-8")));
6336
- const pkgDir = normalizePath$3(path$b.dirname(pkgPath));
6336
+ const pkgDir = normalizePath$3(path$c.dirname(pkgPath));
6337
6337
  const { sideEffects } = data;
6338
6338
  let hasSideEffects;
6339
6339
  if (typeof sideEffects === "boolean") {
@@ -6380,11 +6380,11 @@ function getResolveCacheKey(key, options) {
6380
6380
  }
6381
6381
  function findNearestNodeModules(basedir) {
6382
6382
  while (basedir) {
6383
- const pkgPath = path$b.join(basedir, "node_modules");
6383
+ const pkgPath = path$c.join(basedir, "node_modules");
6384
6384
  if (tryStatSync(pkgPath)?.isDirectory()) {
6385
6385
  return pkgPath;
6386
6386
  }
6387
- const nextBasedir = path$b.dirname(basedir);
6387
+ const nextBasedir = path$c.dirname(basedir);
6388
6388
  if (nextBasedir === basedir) break;
6389
6389
  basedir = nextBasedir;
6390
6390
  }
@@ -6401,7 +6401,7 @@ function watchPackageDataPlugin(packageCache) {
6401
6401
  packageCache.set = (id, pkg) => {
6402
6402
  if (!isInNodeModules$1(pkg.dir) && !watchedDirs.has(pkg.dir)) {
6403
6403
  watchedDirs.add(pkg.dir);
6404
- watchFile(path$b.join(pkg.dir, "package.json"));
6404
+ watchFile(path$c.join(pkg.dir, "package.json"));
6405
6405
  }
6406
6406
  return setPackageData(id, pkg);
6407
6407
  };
@@ -6417,7 +6417,7 @@ function watchPackageDataPlugin(packageCache) {
6417
6417
  },
6418
6418
  watchChange(id) {
6419
6419
  if (id.endsWith("/package.json")) {
6420
- invalidatePackageData(packageCache, path$b.normalize(id));
6420
+ invalidatePackageData(packageCache, path$c.normalize(id));
6421
6421
  }
6422
6422
  }
6423
6423
  };
@@ -6463,7 +6463,7 @@ function getFnpdCacheKey(basedir) {
6463
6463
  function traverseBetweenDirs(longerDir, shorterDir, cb) {
6464
6464
  while (longerDir !== shorterDir) {
6465
6465
  cb(longerDir);
6466
- longerDir = path$b.dirname(longerDir);
6466
+ longerDir = path$c.dirname(longerDir);
6467
6467
  }
6468
6468
  }
6469
6469
 
@@ -6537,7 +6537,7 @@ function isOptimizable(id, optimizeDeps) {
6537
6537
  const bareImportRE = /^(?![a-zA-Z]:)[\w@](?!.*:\/\/)/;
6538
6538
  const deepImportRE = /^([^@][^/]*)\/|^(@[^/]+\/[^/]+)\//;
6539
6539
  const _require$1 = createRequire$1(import.meta.url);
6540
- const _dirname = path$b.dirname(fileURLToPath$1(import.meta.url));
6540
+ const _dirname = path$c.dirname(fileURLToPath$1(import.meta.url));
6541
6541
  const rollupVersion = resolvePackageData("rollup", _dirname, true)?.data.version ?? "";
6542
6542
  const filter = process.env.VITE_DEBUG_FILTER;
6543
6543
  const DEBUG = process.env.DEBUG;
@@ -6588,7 +6588,7 @@ const urlCanParse = (
6588
6588
  const isCaseInsensitiveFS = testCaseInsensitiveFS();
6589
6589
  const VOLUME_RE = /^[A-Z]:/i;
6590
6590
  function normalizePath$3(id) {
6591
- return path$b.posix.normalize(isWindows$3 ? slash$1(id) : id);
6591
+ return path$c.posix.normalize(isWindows$3 ? slash$1(id) : id);
6592
6592
  }
6593
6593
  function fsPathFromId(id) {
6594
6594
  const fsPath = normalizePath$3(
@@ -6618,7 +6618,7 @@ const isJSRequest = (url) => {
6618
6618
  if (knownJsSrcRE.test(url)) {
6619
6619
  return true;
6620
6620
  }
6621
- if (!path$b.extname(url) && url[url.length - 1] !== "/") {
6621
+ if (!path$c.extname(url) && url[url.length - 1] !== "/") {
6622
6622
  return true;
6623
6623
  }
6624
6624
  return false;
@@ -6685,7 +6685,7 @@ function prettifyUrl(url, root) {
6685
6685
  url = removeTimestampQuery(url);
6686
6686
  const isAbsoluteFile = url.startsWith(root);
6687
6687
  if (isAbsoluteFile || url.startsWith(FS_PREFIX)) {
6688
- const file = path$b.posix.relative(
6688
+ const file = path$c.posix.relative(
6689
6689
  root,
6690
6690
  isAbsoluteFile ? url : fsPathFromId(url)
6691
6691
  );
@@ -6709,10 +6709,10 @@ function tryStatSync(file) {
6709
6709
  function lookupFile(dir, fileNames) {
6710
6710
  while (dir) {
6711
6711
  for (const fileName of fileNames) {
6712
- const fullPath = path$b.join(dir, fileName);
6712
+ const fullPath = path$c.join(dir, fileName);
6713
6713
  if (tryStatSync(fullPath)?.isFile()) return fullPath;
6714
6714
  }
6715
- const parentDir = path$b.dirname(dir);
6715
+ const parentDir = path$c.dirname(dir);
6716
6716
  if (parentDir === dir) return;
6717
6717
  dir = parentDir;
6718
6718
  }
@@ -6724,7 +6724,7 @@ function isFilePathESM(filePath, packageCache) {
6724
6724
  return false;
6725
6725
  } else {
6726
6726
  try {
6727
- const pkg = findNearestPackageData(path$b.dirname(filePath), packageCache);
6727
+ const pkg = findNearestPackageData(path$c.dirname(filePath), packageCache);
6728
6728
  return pkg?.data.type === "module";
6729
6729
  } catch {
6730
6730
  return false;
@@ -6826,7 +6826,7 @@ function emptyDir(dir, skip) {
6826
6826
  let nested = null;
6827
6827
  if (skip?.length) {
6828
6828
  for (const file of skip) {
6829
- if (path$b.dirname(file) !== ".") {
6829
+ if (path$c.dirname(file) !== ".") {
6830
6830
  const matched = splitFirstDirRE.exec(file);
6831
6831
  if (matched) {
6832
6832
  nested ??= /* @__PURE__ */ new Map();
@@ -6850,20 +6850,20 @@ function emptyDir(dir, skip) {
6850
6850
  continue;
6851
6851
  }
6852
6852
  if (nested?.has(file)) {
6853
- emptyDir(path$b.resolve(dir, file), nested.get(file));
6853
+ emptyDir(path$c.resolve(dir, file), nested.get(file));
6854
6854
  } else {
6855
- fs__default.rmSync(path$b.resolve(dir, file), { recursive: true, force: true });
6855
+ fs__default.rmSync(path$c.resolve(dir, file), { recursive: true, force: true });
6856
6856
  }
6857
6857
  }
6858
6858
  }
6859
6859
  function copyDir(srcDir, destDir) {
6860
6860
  fs__default.mkdirSync(destDir, { recursive: true });
6861
6861
  for (const file of fs__default.readdirSync(srcDir)) {
6862
- const srcFile = path$b.resolve(srcDir, file);
6862
+ const srcFile = path$c.resolve(srcDir, file);
6863
6863
  if (srcFile === destDir) {
6864
6864
  continue;
6865
6865
  }
6866
- const destFile = path$b.resolve(destDir, file);
6866
+ const destFile = path$c.resolve(destDir, file);
6867
6867
  const stat = fs__default.statSync(srcFile);
6868
6868
  if (stat.isDirectory()) {
6869
6869
  copyDir(srcFile, destFile);
@@ -6895,7 +6895,7 @@ async function recursiveReaddir(dir) {
6895
6895
  }
6896
6896
  const files = await Promise.all(
6897
6897
  dirents.map((dirent) => {
6898
- const res = path$b.resolve(dir, dirent.name);
6898
+ const res = path$c.resolve(dir, dirent.name);
6899
6899
  return dirent.isDirectory() ? recursiveReaddir(res) : normalizePath$3(res);
6900
6900
  })
6901
6901
  );
@@ -6928,7 +6928,7 @@ function optimizeSafeRealPathSync() {
6928
6928
  return;
6929
6929
  }
6930
6930
  try {
6931
- fs__default.realpathSync.native(path$b.resolve("./"));
6931
+ fs__default.realpathSync.native(path$c.resolve("./"));
6932
6932
  } catch (error) {
6933
6933
  if (error.message.includes("EISDIR: illegal operation on a directory")) {
6934
6934
  safeRealpathSync = fs__default.realpathSync;
@@ -6953,7 +6953,7 @@ function ensureWatchedFile(watcher, file, root) {
6953
6953
  if (file && // only need to watch if out of root
6954
6954
  !file.startsWith(withTrailingSlash(root)) && // some rollup plugins use null bytes for private resolved Ids
6955
6955
  !file.includes("\0") && fs__default.existsSync(file)) {
6956
- watcher.add(path$b.resolve(file));
6956
+ watcher.add(path$c.resolve(file));
6957
6957
  }
6958
6958
  }
6959
6959
  function joinSrcset(ret) {
@@ -7362,8 +7362,8 @@ function shouldServeFile(filePath, root) {
7362
7362
  }
7363
7363
  function hasCorrectCase(file, assets) {
7364
7364
  if (file === assets) return true;
7365
- const parent = path$b.dirname(file);
7366
- if (fs__default.readdirSync(parent).includes(path$b.basename(file))) {
7365
+ const parent = path$c.dirname(file);
7366
+ if (fs__default.readdirSync(parent).includes(path$c.basename(file))) {
7367
7367
  return hasCorrectCase(parent, assets);
7368
7368
  }
7369
7369
  return false;
@@ -7675,7 +7675,7 @@ function buildReporterPlugin(config) {
7675
7675
  const logTransform = throttle((id) => {
7676
7676
  writeLine(
7677
7677
  `transforming (${transformedCount}) ${colors$1.dim(
7678
- path$b.relative(config.root, id)
7678
+ path$c.relative(config.root, id)
7679
7679
  )}`
7680
7680
  );
7681
7681
  });
@@ -7799,15 +7799,15 @@ function buildReporterPlugin(config) {
7799
7799
  const mapPad = displaySize(biggestMap).length;
7800
7800
  const compressPad = displaySize(biggestCompressSize).length;
7801
7801
  const relativeOutDir = normalizePath$3(
7802
- path$b.relative(
7802
+ path$c.relative(
7803
7803
  config.root,
7804
- path$b.resolve(
7804
+ path$c.resolve(
7805
7805
  config.root,
7806
7806
  outDir ?? environment.config.build.outDir
7807
7807
  )
7808
7808
  )
7809
7809
  );
7810
- const assetsDir = path$b.join(environment.config.build.assetsDir, "/");
7810
+ const assetsDir = path$c.join(environment.config.build.assetsDir, "/");
7811
7811
  for (const group of groups) {
7812
7812
  const filtered = entries.filter((e) => e.group === group.name);
7813
7813
  if (!filtered.length) continue;
@@ -7930,8 +7930,8 @@ function throttle(fn) {
7930
7930
  };
7931
7931
  }
7932
7932
 
7933
- const POSIX_SEP_RE = new RegExp('\\' + path$b.posix.sep, 'g');
7934
- const NATIVE_SEP_RE = new RegExp('\\' + path$b.sep, 'g');
7933
+ const POSIX_SEP_RE = new RegExp('\\' + path$c.posix.sep, 'g');
7934
+ const NATIVE_SEP_RE = new RegExp('\\' + path$c.sep, 'g');
7935
7935
  /** @type {Map<string,RegExp>}*/
7936
7936
  const PATTERN_REGEX_CACHE = new Map();
7937
7937
  const GLOB_ALL_PATTERN = `**/*`;
@@ -7942,7 +7942,7 @@ const TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext) => ext.substring
7942
7942
  const TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext) => ext.substring(1)).join(
7943
7943
  '|'
7944
7944
  )})`;
7945
- const IS_POSIX = path$b.posix.sep === path$b.sep;
7945
+ const IS_POSIX = path$c.posix.sep === path$c.sep;
7946
7946
 
7947
7947
  /**
7948
7948
  * @template T
@@ -7963,10 +7963,10 @@ function makePromise() {
7963
7963
  * @returns {Promise<string|void>}
7964
7964
  */
7965
7965
  async function resolveTSConfigJson(filename, cache) {
7966
- if (path$b.extname(filename) !== '.json') {
7966
+ if (path$c.extname(filename) !== '.json') {
7967
7967
  return; // ignore files that are not json
7968
7968
  }
7969
- const tsconfig = path$b.resolve(filename);
7969
+ const tsconfig = path$c.resolve(filename);
7970
7970
  if (cache && (cache.hasParseResult(tsconfig) || cache.hasParseResult(filename))) {
7971
7971
  return tsconfig;
7972
7972
  }
@@ -8000,7 +8000,7 @@ const isInNodeModules = IS_POSIX
8000
8000
  */
8001
8001
  const posix2native = IS_POSIX
8002
8002
  ? (filename) => filename
8003
- : (filename) => filename.replace(POSIX_SEP_RE, path$b.sep);
8003
+ : (filename) => filename.replace(POSIX_SEP_RE, path$c.sep);
8004
8004
 
8005
8005
  /**
8006
8006
  * convert native separator to posix separator
@@ -8014,7 +8014,7 @@ const posix2native = IS_POSIX
8014
8014
  */
8015
8015
  const native2posix = IS_POSIX
8016
8016
  ? (filename) => filename
8017
- : (filename) => filename.replace(NATIVE_SEP_RE, path$b.posix.sep);
8017
+ : (filename) => filename.replace(NATIVE_SEP_RE, path$c.posix.sep);
8018
8018
 
8019
8019
  /**
8020
8020
  * converts params to native separator, resolves path and converts native back to posix
@@ -8026,12 +8026,12 @@ const native2posix = IS_POSIX
8026
8026
  * @returns string
8027
8027
  */
8028
8028
  const resolve2posix = IS_POSIX
8029
- ? (dir, filename) => (dir ? path$b.resolve(dir, filename) : path$b.resolve(filename))
8029
+ ? (dir, filename) => (dir ? path$c.resolve(dir, filename) : path$c.resolve(filename))
8030
8030
  : (dir, filename) =>
8031
8031
  native2posix(
8032
8032
  dir
8033
- ? path$b.resolve(posix2native(dir), posix2native(filename))
8034
- : path$b.resolve(posix2native(filename))
8033
+ ? path$c.resolve(posix2native(dir), posix2native(filename))
8034
+ : path$c.resolve(posix2native(filename))
8035
8035
  );
8036
8036
 
8037
8037
  /**
@@ -8041,11 +8041,11 @@ const resolve2posix = IS_POSIX
8041
8041
  * @returns {string[]}
8042
8042
  */
8043
8043
  function resolveReferencedTSConfigFiles(result, options) {
8044
- const dir = path$b.dirname(result.tsconfigFile);
8044
+ const dir = path$c.dirname(result.tsconfigFile);
8045
8045
  return result.tsconfig.references.map((ref) => {
8046
8046
  const refPath = ref.path.endsWith('.json')
8047
8047
  ? ref.path
8048
- : path$b.join(ref.path, options?.configName ?? 'tsconfig.json');
8048
+ : path$c.join(ref.path, options?.configName ?? 'tsconfig.json');
8049
8049
  return resolve2posix(dir, refPath);
8050
8050
  });
8051
8051
  }
@@ -8080,7 +8080,7 @@ function resolveSolutionTSConfig(filename, result) {
8080
8080
  * @returns {boolean}
8081
8081
  */
8082
8082
  function isIncluded(filename, result) {
8083
- const dir = native2posix(path$b.dirname(result.tsconfigFile));
8083
+ const dir = native2posix(path$c.dirname(result.tsconfigFile));
8084
8084
  const files = (result.tsconfig.files || []).map((file) => resolve2posix(dir, file));
8085
8085
  const absoluteFilename = resolve2posix(null, filename);
8086
8086
  if (files.includes(filename)) {
@@ -8249,7 +8249,7 @@ function replaceTokens(result) {
8249
8249
  result.tsconfig = JSON.parse(
8250
8250
  JSON.stringify(result.tsconfig)
8251
8251
  // replace ${configDir}
8252
- .replaceAll(/"\${configDir}/g, `"${native2posix(path$b.dirname(result.tsconfigFile))}`)
8252
+ .replaceAll(/"\${configDir}/g, `"${native2posix(path$c.dirname(result.tsconfigFile))}`)
8253
8253
  );
8254
8254
  }
8255
8255
  }
@@ -8262,7 +8262,7 @@ function replaceTokens(result) {
8262
8262
  * @returns {Promise<string|null>} absolute path to closest tsconfig.json or null if not found
8263
8263
  */
8264
8264
  async function find(filename, options) {
8265
- let dir = path$b.dirname(path$b.resolve(filename));
8265
+ let dir = path$c.dirname(path$c.resolve(filename));
8266
8266
  if (isInNodeModules(dir)) {
8267
8267
  return null;
8268
8268
  }
@@ -8272,8 +8272,8 @@ async function find(filename, options) {
8272
8272
  return cache.getConfigPath(dir, configName);
8273
8273
  }
8274
8274
  const { /** @type {Promise<string|null>} */ promise, resolve, reject } = makePromise();
8275
- if (options?.root && !path$b.isAbsolute(options.root)) {
8276
- options.root = path$b.resolve(options.root);
8275
+ if (options?.root && !path$c.isAbsolute(options.root)) {
8276
+ options.root = path$c.resolve(options.root);
8277
8277
  }
8278
8278
  findUp(dir, { promise, resolve, reject }, options);
8279
8279
  return promise;
@@ -8305,7 +8305,7 @@ function findUp(dir, { resolve, reject, promise }, options) {
8305
8305
  cache.setConfigPath(dir, promise, configName);
8306
8306
  }
8307
8307
  }
8308
- const tsconfig = path$b.join(dir, options?.configName ?? 'tsconfig.json');
8308
+ const tsconfig = path$c.join(dir, options?.configName ?? 'tsconfig.json');
8309
8309
  fs__default.stat(tsconfig, (err, stats) => {
8310
8310
  if (stats && (stats.isFile() || stats.isFIFO())) {
8311
8311
  resolve(tsconfig);
@@ -8313,7 +8313,7 @@ function findUp(dir, { resolve, reject, promise }, options) {
8313
8313
  reject(err);
8314
8314
  } else {
8315
8315
  let parent;
8316
- if (root === dir || (parent = path$b.dirname(dir)) === dir) {
8316
+ if (root === dir || (parent = path$c.dirname(dir)) === dir) {
8317
8317
  resolve(null);
8318
8318
  } else {
8319
8319
  findUp(parent, { promise, resolve, reject }, options);
@@ -8527,7 +8527,7 @@ async function parse$e(filename, options) {
8527
8527
  if (filename !== tsconfigFile && cache?.hasParseResult(tsconfigFile)) {
8528
8528
  result = await getParsedDeep(tsconfigFile, cache, options);
8529
8529
  } else {
8530
- result = await parseFile$1(tsconfigFile, cache, filename === tsconfigFile);
8530
+ result = await parseFile$2(tsconfigFile, cache, filename === tsconfigFile);
8531
8531
  await Promise.all([parseExtends(result, cache), parseReferences(result, options)]);
8532
8532
  }
8533
8533
  replaceTokens(result);
@@ -8568,7 +8568,7 @@ async function getParsedDeep(filename, cache, options) {
8568
8568
  * @param {boolean} [skipCache] - skip cache
8569
8569
  * @returns {Promise<import('./public.d.ts').TSConfckParseResult>}
8570
8570
  */
8571
- async function parseFile$1(tsconfigFile, cache, skipCache) {
8571
+ async function parseFile$2(tsconfigFile, cache, skipCache) {
8572
8572
  if (
8573
8573
  !skipCache &&
8574
8574
  cache?.hasParseResult(tsconfigFile) &&
@@ -8584,7 +8584,7 @@ async function parseFile$1(tsconfigFile, cache, skipCache) {
8584
8584
  applyDefaults(parsed, tsconfigFile);
8585
8585
  return {
8586
8586
  tsconfigFile,
8587
- tsconfig: normalizeTSConfig(parsed, path$b.dirname(tsconfigFile))
8587
+ tsconfig: normalizeTSConfig(parsed, path$c.dirname(tsconfigFile))
8588
8588
  };
8589
8589
  })
8590
8590
  .catch((e) => {
@@ -8613,7 +8613,7 @@ async function parseFile$1(tsconfigFile, cache, skipCache) {
8613
8613
  function normalizeTSConfig(tsconfig, dir) {
8614
8614
  // set baseUrl to absolute path
8615
8615
  const baseUrl = tsconfig.compilerOptions?.baseUrl;
8616
- if (baseUrl && !baseUrl.startsWith('${') && !path$b.isAbsolute(baseUrl)) {
8616
+ if (baseUrl && !baseUrl.startsWith('${') && !path$c.isAbsolute(baseUrl)) {
8617
8617
  tsconfig.compilerOptions.baseUrl = resolve2posix(dir, baseUrl);
8618
8618
  }
8619
8619
  return tsconfig;
@@ -8631,7 +8631,7 @@ async function parseReferences(result, options) {
8631
8631
  }
8632
8632
  const referencedFiles = resolveReferencedTSConfigFiles(result, options);
8633
8633
  const referenced = await Promise.all(
8634
- referencedFiles.map((file) => parseFile$1(file, options?.cache))
8634
+ referencedFiles.map((file) => parseFile$2(file, options?.cache))
8635
8635
  );
8636
8636
  await Promise.all(referenced.map((ref) => parseExtends(ref, options?.cache)));
8637
8637
  referenced.forEach((ref) => {
@@ -8694,7 +8694,7 @@ async function parseExtends(result, cache) {
8694
8694
  extended.splice(
8695
8695
  pos + 1,
8696
8696
  0,
8697
- ...(await Promise.all(resolvedExtends.map((file) => parseFile$1(file, cache))))
8697
+ ...(await Promise.all(resolvedExtends.map((file) => parseFile$2(file, cache))))
8698
8698
  );
8699
8699
  } else {
8700
8700
  // reached a leaf, backtrack to the last branching point and continue
@@ -8728,7 +8728,7 @@ function resolveExtends(extended, from) {
8728
8728
  } catch (e) {
8729
8729
  error = e;
8730
8730
  }
8731
- if (extended[0] !== '.' && !path$b.isAbsolute(extended)) {
8731
+ if (extended[0] !== '.' && !path$c.isAbsolute(extended)) {
8732
8732
  try {
8733
8733
  return req.resolve(`${extended}/tsconfig.json`);
8734
8734
  } catch (e) {
@@ -8766,7 +8766,7 @@ function extendTSConfig(extending, extended) {
8766
8766
  const extendingConfig = extending.tsconfig;
8767
8767
  const extendedConfig = extended.tsconfig;
8768
8768
  const relativePath = native2posix(
8769
- path$b.relative(path$b.dirname(extending.tsconfigFile), path$b.dirname(extended.tsconfigFile))
8769
+ path$c.relative(path$c.dirname(extending.tsconfigFile), path$c.dirname(extended.tsconfigFile))
8770
8770
  );
8771
8771
  for (const key of Object.keys(extendedConfig).filter((key) => EXTENDABLE_KEYS.includes(key))) {
8772
8772
  if (key === 'compilerOptions') {
@@ -8845,11 +8845,11 @@ function rebaseRelative(key, value, prependPath) {
8845
8845
  * @returns {string}
8846
8846
  */
8847
8847
  function rebasePath(value, prependPath) {
8848
- if (path$b.isAbsolute(value) || value.startsWith('${configDir}')) {
8848
+ if (path$c.isAbsolute(value) || value.startsWith('${configDir}')) {
8849
8849
  return value;
8850
8850
  } else {
8851
8851
  // relative paths use posix syntax in tsconfig
8852
- return path$b.posix.normalize(path$b.posix.join(prependPath, value));
8852
+ return path$c.posix.normalize(path$c.posix.join(prependPath, value));
8853
8853
  }
8854
8854
  }
8855
8855
 
@@ -8914,7 +8914,7 @@ const DEFAULT_JSCONFIG_COMPILER_OPTIONS = {
8914
8914
  * @param {string} configFileName
8915
8915
  */
8916
8916
  function isJSConfig(configFileName) {
8917
- return path$b.basename(configFileName) === 'jsconfig.json';
8917
+ return path$c.basename(configFileName) === 'jsconfig.json';
8918
8918
  }
8919
8919
 
8920
8920
  /** @template T */
@@ -9058,7 +9058,7 @@ const defaultEsbuildSupported = {
9058
9058
  async function transformWithEsbuild(code, filename, options, inMap, config, watcher) {
9059
9059
  let loader = options?.loader;
9060
9060
  if (!loader) {
9061
- const ext = path$b.extname(validExtensionRE.test(filename) ? filename : cleanUrl(filename)).slice(1);
9061
+ const ext = path$c.extname(validExtensionRE.test(filename) ? filename : cleanUrl(filename)).slice(1);
9062
9062
  if (ext === "cjs" || ext === "mjs") {
9063
9063
  loader = "js";
9064
9064
  } else if (ext === "cts" || ext === "mts") {
@@ -10312,9 +10312,9 @@ function checkPublicFile(url, config) {
10312
10312
  const fileName = cleanUrl(url);
10313
10313
  const publicFiles = getPublicFiles(config);
10314
10314
  if (publicFiles) {
10315
- return publicFiles.has(fileName) ? normalizePath$3(path$b.join(publicDir, fileName)) : void 0;
10315
+ return publicFiles.has(fileName) ? normalizePath$3(path$c.join(publicDir, fileName)) : void 0;
10316
10316
  }
10317
- const publicFile = normalizePath$3(path$b.join(publicDir, fileName));
10317
+ const publicFile = normalizePath$3(path$c.join(publicDir, fileName));
10318
10318
  if (!publicFile.startsWith(withTrailingSlash(publicDir))) {
10319
10319
  return;
10320
10320
  }
@@ -10506,9 +10506,9 @@ async function fileToDevUrl(environment, id, skipBase = false) {
10506
10506
  if (publicFile) {
10507
10507
  rtn = id;
10508
10508
  } else if (id.startsWith(withTrailingSlash(config.root))) {
10509
- rtn = "/" + path$b.posix.relative(config.root, id);
10509
+ rtn = "/" + path$c.posix.relative(config.root, id);
10510
10510
  } else {
10511
- rtn = path$b.posix.join(FS_PREFIX, id);
10511
+ rtn = path$c.posix.join(FS_PREFIX, id);
10512
10512
  }
10513
10513
  if (skipBase) {
10514
10514
  return rtn;
@@ -10566,12 +10566,12 @@ async function fileToBuiltUrl(pluginContext, id, skipPublicCheck = false, forceI
10566
10566
  url = assetToDataURL(environment, file, content);
10567
10567
  } else {
10568
10568
  const originalFileName = normalizePath$3(
10569
- path$b.relative(environment.config.root, file)
10569
+ path$c.relative(environment.config.root, file)
10570
10570
  );
10571
10571
  const referenceId = pluginContext.emitFile({
10572
10572
  type: "asset",
10573
10573
  // Ignore directory structure for asset file names
10574
- name: path$b.basename(file),
10574
+ name: path$c.basename(file),
10575
10575
  originalFileName,
10576
10576
  source: content
10577
10577
  });
@@ -10588,7 +10588,7 @@ async function urlToBuiltUrl(pluginContext, url, importer, forceInline) {
10588
10588
  if (checkPublicFile(url, topLevelConfig)) {
10589
10589
  return publicFileToBuiltUrl(url, topLevelConfig);
10590
10590
  }
10591
- const file = url[0] === "/" ? path$b.join(topLevelConfig.root, url) : path$b.join(path$b.dirname(importer), url);
10591
+ const file = url[0] === "/" ? path$c.join(topLevelConfig.root, url) : path$c.join(path$c.dirname(importer), url);
10592
10592
  return fileToBuiltUrl(
10593
10593
  pluginContext,
10594
10594
  file,
@@ -10668,7 +10668,7 @@ function manifestPlugin() {
10668
10668
  const { root } = this.environment.config;
10669
10669
  const buildOptions = this.environment.config.build;
10670
10670
  function getChunkName(chunk) {
10671
- return getChunkOriginalFileName(chunk, root, format) ?? `_${path$b.basename(chunk.fileName)}`;
10671
+ return getChunkOriginalFileName(chunk, root, format) ?? `_${path$c.basename(chunk.fileName)}`;
10672
10672
  }
10673
10673
  function getInternalImports(imports) {
10674
10674
  const filteredImports = [];
@@ -10736,7 +10736,7 @@ function manifestPlugin() {
10736
10736
  if (chunk.type === "chunk") {
10737
10737
  manifest[getChunkName(chunk)] = createChunk(chunk);
10738
10738
  } else if (chunk.type === "asset" && chunk.names.length > 0) {
10739
- const src = chunk.originalFileNames.length > 0 ? chunk.originalFileNames[0] : `_${path$b.basename(chunk.fileName)}`;
10739
+ const src = chunk.originalFileNames.length > 0 ? chunk.originalFileNames[0] : `_${path$c.basename(chunk.fileName)}`;
10740
10740
  const isEntry = entryCssAssetFileNames.has(chunk.fileName);
10741
10741
  const asset = createAsset(chunk, src, isEntry);
10742
10742
  const file2 = manifest[src]?.file;
@@ -10766,9 +10766,9 @@ function manifestPlugin() {
10766
10766
  }
10767
10767
  function getChunkOriginalFileName(chunk, root, format) {
10768
10768
  if (chunk.facadeModuleId) {
10769
- let name = normalizePath$3(path$b.relative(root, chunk.facadeModuleId));
10769
+ let name = normalizePath$3(path$c.relative(root, chunk.facadeModuleId));
10770
10770
  if (format === "system" && !chunk.name.includes("-legacy")) {
10771
- const ext = path$b.extname(name);
10771
+ const ext = path$c.extname(name);
10772
10772
  const endPos = ext.length !== 0 ? -ext.length : void 0;
10773
10773
  name = `${name.slice(0, endPos)}-legacy${ext}`;
10774
10774
  }
@@ -11067,7 +11067,7 @@ async function computeSourceRoute(map, file) {
11067
11067
  let sourceRoot;
11068
11068
  try {
11069
11069
  sourceRoot = await fsp.realpath(
11070
- path$b.resolve(path$b.dirname(file), map.sourceRoot || "")
11070
+ path$c.resolve(path$c.dirname(file), map.sourceRoot || "")
11071
11071
  );
11072
11072
  } catch {
11073
11073
  }
@@ -11087,7 +11087,7 @@ async function injectSourcesContent(map, file, logger) {
11087
11087
  const sourceRoot = await sourceRootPromise;
11088
11088
  let resolvedSourcePath = cleanUrl(decodeURI(sourcePath));
11089
11089
  if (sourceRoot) {
11090
- resolvedSourcePath = path$b.resolve(sourceRoot, resolvedSourcePath);
11090
+ resolvedSourcePath = path$c.resolve(sourceRoot, resolvedSourcePath);
11091
11091
  }
11092
11092
  sourcesContent[index] = await fsp.readFile(resolvedSourcePath, "utf-8").catch(() => {
11093
11093
  missingSources.push(resolvedSourcePath);
@@ -11136,7 +11136,7 @@ function applySourcemapIgnoreList(map, sourcemapPath, sourcemapIgnoreList, logge
11136
11136
  const sourcePath = map.sources[sourcesIndex];
11137
11137
  if (!sourcePath) continue;
11138
11138
  const ignoreList = sourcemapIgnoreList(
11139
- path$b.isAbsolute(sourcePath) ? sourcePath : path$b.resolve(path$b.dirname(sourcemapPath), sourcePath),
11139
+ path$c.isAbsolute(sourcePath) ? sourcePath : path$c.resolve(path$c.dirname(sourcemapPath), sourcePath),
11140
11140
  sourcemapPath
11141
11141
  );
11142
11142
  if (logger && typeof ignoreList !== "boolean") {
@@ -11165,7 +11165,7 @@ async function extractSourcemapFromFile(code, filePath) {
11165
11165
  function createConvertSourceMapReadMap(originalFileName) {
11166
11166
  return (filename) => {
11167
11167
  return fsp.readFile(
11168
- path$b.resolve(path$b.dirname(originalFileName), filename),
11168
+ path$c.resolve(path$c.dirname(originalFileName), filename),
11169
11169
  "utf-8"
11170
11170
  );
11171
11171
  };
@@ -11174,7 +11174,7 @@ function createConvertSourceMapReadMap(originalFileName) {
11174
11174
  var src$1 = {};
11175
11175
 
11176
11176
  // @ts-check
11177
- const path$9 = require$$0$2;
11177
+ const path$a = require$$0$2;
11178
11178
  const fs$7 = require$$0$4;
11179
11179
  const os$2 = require$$2;
11180
11180
  const url$3 = require$$0$5;
@@ -11210,7 +11210,7 @@ function getDefaultSearchPlaces(name, sync) {
11210
11210
  * And on Windows, this will never happen. ('C:\build' -> 'C:')
11211
11211
  */
11212
11212
  function parentDir(p) {
11213
- return path$9.dirname(p) || path$9.sep;
11213
+ return path$a.dirname(p) || path$a.sep;
11214
11214
  }
11215
11215
 
11216
11216
  /** @type {import('./index').LoaderSync} */
@@ -11284,7 +11284,7 @@ function getOptions(name, options, sync) {
11284
11284
  },
11285
11285
  };
11286
11286
  conf.searchPlaces.forEach(place => {
11287
- const key = path$9.extname(place) || 'noExt';
11287
+ const key = path$a.extname(place) || 'noExt';
11288
11288
  const loader = conf.loaders[key];
11289
11289
  if (!loader) {
11290
11290
  throw new Error(`Missing loader for extension "${place}"`);
@@ -11365,14 +11365,14 @@ src$1.lilconfig = function lilconfig(name, options) {
11365
11365
  }
11366
11366
 
11367
11367
  for (const searchPlace of searchPlaces) {
11368
- const filepath = path$9.join(dir, searchPlace);
11368
+ const filepath = path$a.join(dir, searchPlace);
11369
11369
  try {
11370
11370
  await fs$7.promises.access(filepath);
11371
11371
  } catch {
11372
11372
  continue;
11373
11373
  }
11374
11374
  const content = String(await fsReadFileAsync(filepath));
11375
- const loaderKey = path$9.extname(searchPlace) || 'noExt';
11375
+ const loaderKey = path$a.extname(searchPlace) || 'noExt';
11376
11376
  const loader = loaders[loaderKey];
11377
11377
 
11378
11378
  // handle package.json
@@ -11420,11 +11420,11 @@ src$1.lilconfig = function lilconfig(name, options) {
11420
11420
  },
11421
11421
  async load(filepath) {
11422
11422
  validateFilePath(filepath);
11423
- const absPath = path$9.resolve(process.cwd(), filepath);
11423
+ const absPath = path$a.resolve(process.cwd(), filepath);
11424
11424
  if (cache && loadCache.has(absPath)) {
11425
11425
  return loadCache.get(absPath);
11426
11426
  }
11427
- const {base, ext} = path$9.parse(absPath);
11427
+ const {base, ext} = path$a.parse(absPath);
11428
11428
  const loaderKey = ext || 'noExt';
11429
11429
  const loader = loaders[loaderKey];
11430
11430
  validateLoader(loader, loaderKey);
@@ -11520,13 +11520,13 @@ src$1.lilconfigSync = function lilconfigSync(name, options) {
11520
11520
  }
11521
11521
 
11522
11522
  for (const searchPlace of searchPlaces) {
11523
- const filepath = path$9.join(dir, searchPlace);
11523
+ const filepath = path$a.join(dir, searchPlace);
11524
11524
  try {
11525
11525
  fs$7.accessSync(filepath);
11526
11526
  } catch {
11527
11527
  continue;
11528
11528
  }
11529
- const loaderKey = path$9.extname(searchPlace) || 'noExt';
11529
+ const loaderKey = path$a.extname(searchPlace) || 'noExt';
11530
11530
  const loader = loaders[loaderKey];
11531
11531
  const content = String(fs$7.readFileSync(filepath));
11532
11532
 
@@ -11575,11 +11575,11 @@ src$1.lilconfigSync = function lilconfigSync(name, options) {
11575
11575
  },
11576
11576
  load(filepath) {
11577
11577
  validateFilePath(filepath);
11578
- const absPath = path$9.resolve(process.cwd(), filepath);
11578
+ const absPath = path$a.resolve(process.cwd(), filepath);
11579
11579
  if (cache && loadCache.has(absPath)) {
11580
11580
  return loadCache.get(absPath);
11581
11581
  }
11582
- const {base, ext} = path$9.parse(absPath);
11582
+ const {base, ext} = path$a.parse(absPath);
11583
11583
  const loaderKey = ext || 'noExt';
11584
11584
  const loader = loaders[loaderKey];
11585
11585
  validateLoader(loader, loaderKey);
@@ -11837,7 +11837,7 @@ async function plugins(config, file) {
11837
11837
  var plugins_1 = plugins;
11838
11838
 
11839
11839
  // @ts-check
11840
- const { resolve } = path$b;
11840
+ const { resolve } = path$c;
11841
11841
 
11842
11842
  const config$1 = src$1;
11843
11843
 
@@ -12853,7 +12853,7 @@ function esbuildDepPlugin(environment, qualified, external) {
12853
12853
  };
12854
12854
  }
12855
12855
  return {
12856
- path: path$b.resolve(resolved)
12856
+ path: path$c.resolve(resolved)
12857
12857
  };
12858
12858
  };
12859
12859
  return {
@@ -14257,7 +14257,7 @@ async function prepareEsbuildScanner(environment, entries, deps, missing, scanCo
14257
14257
  let tsconfigRaw = esbuildOptions.tsconfigRaw;
14258
14258
  if (!tsconfigRaw && !esbuildOptions.tsconfig) {
14259
14259
  const { tsconfig } = await loadTsconfigJsonForFile(
14260
- path$b.join(environment.config.root, "_dummy.js")
14260
+ path$c.join(environment.config.root, "_dummy.js")
14261
14261
  );
14262
14262
  if (tsconfig.compilerOptions?.experimentalDecorators) {
14263
14263
  tsconfigRaw = { compilerOptions: { experimentalDecorators: true } };
@@ -14287,7 +14287,7 @@ function globEntries(pattern, environment) {
14287
14287
  const resolvedPatterns = arraify(pattern);
14288
14288
  if (resolvedPatterns.every((str) => !isDynamicPattern(str))) {
14289
14289
  return resolvedPatterns.map(
14290
- (p) => normalizePath$3(path$b.resolve(environment.config.root, p))
14290
+ (p) => normalizePath$3(path$c.resolve(environment.config.root, p))
14291
14291
  );
14292
14292
  }
14293
14293
  return glob(pattern, {
@@ -14318,7 +14318,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
14318
14318
  );
14319
14319
  }
14320
14320
  const resolve = async (id, importer) => {
14321
- const key = id + (importer && path$b.dirname(importer));
14321
+ const key = id + (importer && path$c.dirname(importer));
14322
14322
  if (seen.has(key)) {
14323
14323
  return seen.get(key);
14324
14324
  }
@@ -14423,7 +14423,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
14423
14423
  loader: "js",
14424
14424
  // since it is transpiled
14425
14425
  contents: await doTransformGlobImport(contents, p, loader),
14426
- resolveDir: normalizePath$3(path$b.dirname(p)),
14426
+ resolveDir: normalizePath$3(path$c.dirname(p)),
14427
14427
  pluginData: {
14428
14428
  htmlType: { loader }
14429
14429
  }
@@ -14432,7 +14432,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
14432
14432
  scripts[key] = {
14433
14433
  loader,
14434
14434
  contents,
14435
- resolveDir: normalizePath$3(path$b.dirname(p)),
14435
+ resolveDir: normalizePath$3(path$c.dirname(p)),
14436
14436
  pluginData: {
14437
14437
  htmlType: { loader }
14438
14438
  }
@@ -14500,7 +14500,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
14500
14500
  } else if (isScannable(resolved, optimizeDepsOptions.extensions)) {
14501
14501
  const namespace = htmlTypesRE.test(resolved) ? "html" : void 0;
14502
14502
  return {
14503
- path: path$b.resolve(resolved),
14503
+ path: path$c.resolve(resolved),
14504
14504
  namespace
14505
14505
  };
14506
14506
  } else {
@@ -14538,7 +14538,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
14538
14538
  }
14539
14539
  const namespace = htmlTypesRE.test(resolved) ? "html" : void 0;
14540
14540
  return {
14541
- path: path$b.resolve(cleanUrl(resolved)),
14541
+ path: path$c.resolve(cleanUrl(resolved)),
14542
14542
  namespace
14543
14543
  };
14544
14544
  } else {
@@ -14547,7 +14547,7 @@ function esbuildScanPlugin(environment, depImports, missing, entries) {
14547
14547
  }
14548
14548
  );
14549
14549
  build.onLoad({ filter: JS_TYPES_RE }, async ({ path: id }) => {
14550
- let ext = path$b.extname(id).slice(1);
14550
+ let ext = path$c.extname(id).slice(1);
14551
14551
  if (ext === "mjs") ext = "js";
14552
14552
  const esbuildConfig = environment.config.esbuild;
14553
14553
  let contents = await fsp.readFile(id, "utf-8");
@@ -14589,7 +14589,7 @@ import ${m[1]}`;
14589
14589
  return js;
14590
14590
  }
14591
14591
  function shouldExternalizeDep(resolvedId, rawId) {
14592
- if (!path$b.isAbsolute(resolvedId)) {
14592
+ if (!path$c.isAbsolute(resolvedId)) {
14593
14593
  return true;
14594
14594
  }
14595
14595
  if (resolvedId === rawId || resolvedId.includes("\0")) {
@@ -14598,7 +14598,7 @@ function shouldExternalizeDep(resolvedId, rawId) {
14598
14598
  return false;
14599
14599
  }
14600
14600
  function isScannable(id, extensions) {
14601
- return JS_TYPES_RE.test(id) || htmlTypesRE.test(id) || extensions?.includes(path$b.extname(id)) || false;
14601
+ return JS_TYPES_RE.test(id) || htmlTypesRE.test(id) || extensions?.includes(path$c.extname(id)) || false;
14602
14602
  }
14603
14603
 
14604
14604
  function createOptimizeDepsIncludeResolver(environment) {
@@ -14623,7 +14623,7 @@ function createOptimizeDepsIncludeResolver(environment) {
14623
14623
  return await resolve(
14624
14624
  environment,
14625
14625
  nestedPath,
14626
- path$b.resolve(basedir, "package.json")
14626
+ path$c.resolve(basedir, "package.json")
14627
14627
  );
14628
14628
  };
14629
14629
  }
@@ -14687,7 +14687,7 @@ function expandGlobIds(id, config) {
14687
14687
  }
14688
14688
  }
14689
14689
  const isMatch = picomatch$2(pattern);
14690
- const matched = possibleExportPaths.filter((p) => isMatch(p)).map((match) => path$b.posix.join(pkgName, match));
14690
+ const matched = possibleExportPaths.filter((p) => isMatch(p)).map((match) => path$c.posix.join(pkgName, match));
14691
14691
  matched.unshift(pkgName);
14692
14692
  return matched;
14693
14693
  } else {
@@ -14695,7 +14695,7 @@ function expandGlobIds(id, config) {
14695
14695
  cwd: pkgData.dir,
14696
14696
  expandDirectories: false,
14697
14697
  ignore: ["node_modules"]
14698
- }).map((match) => path$b.posix.join(pkgName, slash$1(match)));
14698
+ }).map((match) => path$c.posix.join(pkgName, slash$1(match)));
14699
14699
  matched.unshift(pkgName);
14700
14700
  return matched;
14701
14701
  }
@@ -14800,7 +14800,7 @@ async function loadCachedDepOptimizationMetadata(environment, force = environmen
14800
14800
  if (!force) {
14801
14801
  let cachedMetadata;
14802
14802
  try {
14803
- const cachedMetadataPath = path$b.join(depsCacheDir, METADATA_FILENAME);
14803
+ const cachedMetadataPath = path$c.join(depsCacheDir, METADATA_FILENAME);
14804
14804
  cachedMetadata = parseDepsOptimizerMetadata(
14805
14805
  await fsp.readFile(cachedMetadataPath, "utf-8"),
14806
14806
  depsCacheDir
@@ -14892,7 +14892,7 @@ function runOptimizeDeps(environment, depsInfo) {
14892
14892
  fs__default.mkdirSync(processingCacheDir, { recursive: true });
14893
14893
  debug$f?.(colors$1.green(`creating package.json in ${processingCacheDir}`));
14894
14894
  fs__default.writeFileSync(
14895
- path$b.resolve(processingCacheDir, "package.json"),
14895
+ path$c.resolve(processingCacheDir, "package.json"),
14896
14896
  `{
14897
14897
  "type": "module"
14898
14898
  }
@@ -14926,7 +14926,7 @@ function runOptimizeDeps(environment, depsInfo) {
14926
14926
  );
14927
14927
  }
14928
14928
  committed = true;
14929
- const dataPath = path$b.join(processingCacheDir, METADATA_FILENAME);
14929
+ const dataPath = path$c.join(processingCacheDir, METADATA_FILENAME);
14930
14930
  debug$f?.(
14931
14931
  colors$1.green(`creating ${METADATA_FILENAME} in ${processingCacheDir}`)
14932
14932
  );
@@ -14993,7 +14993,7 @@ function runOptimizeDeps(environment, depsInfo) {
14993
14993
  }
14994
14994
  return context.rebuild().then((result) => {
14995
14995
  const meta = result.metafile;
14996
- const processingCacheDirOutputPath = path$b.relative(
14996
+ const processingCacheDirOutputPath = path$c.relative(
14997
14997
  process.cwd(),
14998
14998
  processingCacheDir
14999
14999
  );
@@ -15024,7 +15024,7 @@ function runOptimizeDeps(environment, depsInfo) {
15024
15024
  }
15025
15025
  for (const o of Object.keys(meta.outputs)) {
15026
15026
  if (!jsMapExtensionRE.test(o)) {
15027
- const id = path$b.relative(processingCacheDirOutputPath, o).replace(jsExtensionRE, "");
15027
+ const id = path$c.relative(processingCacheDirOutputPath, o).replace(jsExtensionRE, "");
15028
15028
  const file = getOptimizedDepPath(environment, id);
15029
15029
  if (!findOptimizedDepInfoInRecord(
15030
15030
  metadata.optimized,
@@ -15040,7 +15040,7 @@ function runOptimizeDeps(environment, depsInfo) {
15040
15040
  } else {
15041
15041
  const output = meta.outputs[o];
15042
15042
  if (output.bytes === 93) {
15043
- const jsMapPath = path$b.resolve(o);
15043
+ const jsMapPath = path$c.resolve(o);
15044
15044
  const jsPath = jsMapPath.slice(0, -4);
15045
15045
  if (fs__default.existsSync(jsPath) && fs__default.existsSync(jsMapPath)) {
15046
15046
  const map = JSON.parse(fs__default.readFileSync(jsMapPath, "utf-8"));
@@ -15196,7 +15196,7 @@ function depsFromOptimizedDepInfo(depsInfo) {
15196
15196
  }
15197
15197
  function getOptimizedDepPath(environment, id) {
15198
15198
  return normalizePath$3(
15199
- path$b.resolve(getDepsCacheDir(environment), flattenId(id) + ".js")
15199
+ path$c.resolve(getDepsCacheDir(environment), flattenId(id) + ".js")
15200
15200
  );
15201
15201
  }
15202
15202
  function getDepsCacheSuffix(environment) {
@@ -15214,7 +15214,7 @@ function getTempSuffix() {
15214
15214
  );
15215
15215
  }
15216
15216
  function getDepsCacheDirPrefix(environment) {
15217
- return normalizePath$3(path$b.resolve(environment.config.cacheDir, "deps"));
15217
+ return normalizePath$3(path$c.resolve(environment.config.cacheDir, "deps"));
15218
15218
  }
15219
15219
  function createIsOptimizedDepFile(environment) {
15220
15220
  const depsCacheDirPrefix = getDepsCacheDirPrefix(environment);
@@ -15223,7 +15223,7 @@ function createIsOptimizedDepFile(environment) {
15223
15223
  function createIsOptimizedDepUrl(environment) {
15224
15224
  const { root } = environment.config;
15225
15225
  const depsCacheDir = getDepsCacheDirPrefix(environment);
15226
- const depsCacheDirRelative = normalizePath$3(path$b.relative(root, depsCacheDir));
15226
+ const depsCacheDirRelative = normalizePath$3(path$c.relative(root, depsCacheDir));
15227
15227
  const depsCacheDirPrefix = depsCacheDirRelative.startsWith("../") ? (
15228
15228
  // if the cache directory is outside root, the url prefix would be something
15229
15229
  // like '/@fs/absolute/path/to/node_modules/.vite'
@@ -15240,7 +15240,7 @@ function createIsOptimizedDepUrl(environment) {
15240
15240
  function parseDepsOptimizerMetadata(jsonMetadata, depsCacheDir) {
15241
15241
  const { hash, lockfileHash, configHash, browserHash, optimized, chunks } = JSON.parse(jsonMetadata, (key, value) => {
15242
15242
  if (key === "file" || key === "src") {
15243
- return normalizePath$3(path$b.resolve(depsCacheDir, value));
15243
+ return normalizePath$3(path$c.resolve(depsCacheDir, value));
15244
15244
  }
15245
15245
  return value;
15246
15246
  });
@@ -15301,7 +15301,7 @@ function stringifyDepsOptimizerMetadata(metadata, depsCacheDir) {
15301
15301
  },
15302
15302
  (key, value) => {
15303
15303
  if (key === "file" || key === "src") {
15304
- return normalizePath$3(path$b.relative(depsCacheDir, value));
15304
+ return normalizePath$3(path$c.relative(depsCacheDir, value));
15305
15305
  }
15306
15306
  return value;
15307
15307
  },
@@ -15312,14 +15312,14 @@ function esbuildOutputFromId(outputs, id, cacheDirOutputPath) {
15312
15312
  const cwd = process.cwd();
15313
15313
  const flatId = flattenId(id) + ".js";
15314
15314
  const normalizedOutputPath = normalizePath$3(
15315
- path$b.relative(cwd, path$b.join(cacheDirOutputPath, flatId))
15315
+ path$c.relative(cwd, path$c.join(cacheDirOutputPath, flatId))
15316
15316
  );
15317
15317
  const output = outputs[normalizedOutputPath];
15318
15318
  if (output) {
15319
15319
  return output;
15320
15320
  }
15321
15321
  for (const [key, value] of Object.entries(outputs)) {
15322
- if (normalizePath$3(path$b.relative(cwd, key)) === normalizedOutputPath) {
15322
+ if (normalizePath$3(path$c.relative(cwd, key)) === normalizedOutputPath) {
15323
15323
  return value;
15324
15324
  }
15325
15325
  }
@@ -15347,7 +15347,7 @@ async function extractExportsData(environment, filePath) {
15347
15347
  try {
15348
15348
  parseResult = parse$d(entryContent);
15349
15349
  } catch {
15350
- const loader = esbuildOptions.loader?.[path$b.extname(filePath)] || "jsx";
15350
+ const loader = esbuildOptions.loader?.[path$c.extname(filePath)] || "jsx";
15351
15351
  debug$f?.(
15352
15352
  `Unable to parse: ${filePath}.
15353
15353
  Trying again with a ${loader} transform.`
@@ -15477,7 +15477,7 @@ function getLockfileHash(environment) {
15477
15477
  );
15478
15478
  if (lockfileFormat.checkPatchesDir) {
15479
15479
  const baseDir = lockfilePath.slice(0, -lockfileFormat.path.length);
15480
- const fullPath = path$b.join(
15480
+ const fullPath = path$c.join(
15481
15481
  baseDir,
15482
15482
  lockfileFormat.checkPatchesDir
15483
15483
  );
@@ -15531,12 +15531,12 @@ async function optimizedDepNeedsInterop(environment, metadata, file) {
15531
15531
  const MAX_TEMP_DIR_AGE_MS = 24 * 60 * 60 * 1e3;
15532
15532
  async function cleanupDepsCacheStaleDirs(config) {
15533
15533
  try {
15534
- const cacheDir = path$b.resolve(config.cacheDir);
15534
+ const cacheDir = path$c.resolve(config.cacheDir);
15535
15535
  if (fs__default.existsSync(cacheDir)) {
15536
15536
  const dirents = await fsp.readdir(cacheDir, { withFileTypes: true });
15537
15537
  for (const dirent of dirents) {
15538
15538
  if (dirent.isDirectory() && dirent.name.includes("_temp_")) {
15539
- const tempDirPath = path$b.resolve(config.cacheDir, dirent.name);
15539
+ const tempDirPath = path$c.resolve(config.cacheDir, dirent.name);
15540
15540
  const stats = await fsp.stat(tempDirPath).catch(() => null);
15541
15541
  if (stats?.mtime && Date.now() - stats.mtime.getTime() > MAX_TEMP_DIR_AGE_MS) {
15542
15542
  debug$f?.(`removing stale cache temp dir ${tempDirPath}`);
@@ -15680,7 +15680,7 @@ function createIsExternal(environment) {
15680
15680
  return processedIds.get(id);
15681
15681
  }
15682
15682
  let isExternal = false;
15683
- if (id[0] !== "." && !path$b.isAbsolute(id)) {
15683
+ if (id[0] !== "." && !path$c.isAbsolute(id)) {
15684
15684
  isExternal = isBuiltin(environment.config.resolve.builtins, id) || isConfiguredAsExternal(id, importer);
15685
15685
  }
15686
15686
  processedIds.set(id, isExternal);
@@ -15688,7 +15688,7 @@ function createIsExternal(environment) {
15688
15688
  };
15689
15689
  }
15690
15690
  function canExternalizeFile(filePath) {
15691
- const ext = path$b.extname(filePath);
15691
+ const ext = path$c.extname(filePath);
15692
15692
  return !ext || ext === ".js" || ext === ".mjs" || ext === ".cjs";
15693
15693
  }
15694
15694
 
@@ -15704,7 +15704,7 @@ const debug$d = createDebugger("vite:resolve-details", {
15704
15704
  });
15705
15705
  function resolvePlugin(resolveOptions) {
15706
15706
  const { root, isProduction, asSrc, preferRelative = false } = resolveOptions;
15707
- const rootInRoot = tryStatSync(path$b.join(root, root))?.isDirectory() ?? false;
15707
+ const rootInRoot = tryStatSync(path$c.join(root, root))?.isDirectory() ?? false;
15708
15708
  return {
15709
15709
  name: "vite:resolve",
15710
15710
  async resolveId(id, importer, resolveOpts) {
@@ -15729,12 +15729,12 @@ function resolvePlugin(resolveOptions) {
15729
15729
  if (resolvedImports) {
15730
15730
  id = resolvedImports;
15731
15731
  if (resolveOpts.custom?.["vite:import-glob"]?.isSubImportsPattern) {
15732
- return normalizePath$3(path$b.join(root, id));
15732
+ return normalizePath$3(path$c.join(root, id));
15733
15733
  }
15734
15734
  }
15735
15735
  let res;
15736
15736
  if (asSrc && depsOptimizer?.isOptimizedDepUrl(id)) {
15737
- const optimizedPath = id.startsWith(FS_PREFIX) ? fsPathFromId(id) : normalizePath$3(path$b.resolve(root, id.slice(1)));
15737
+ const optimizedPath = id.startsWith(FS_PREFIX) ? fsPathFromId(id) : normalizePath$3(path$c.resolve(root, id.slice(1)));
15738
15738
  return optimizedPath;
15739
15739
  }
15740
15740
  if (asSrc && id.startsWith(FS_PREFIX)) {
@@ -15743,15 +15743,15 @@ function resolvePlugin(resolveOptions) {
15743
15743
  return ensureVersionQuery(res, id, options, depsOptimizer);
15744
15744
  }
15745
15745
  if (asSrc && id[0] === "/" && (rootInRoot || !id.startsWith(withTrailingSlash(root)))) {
15746
- const fsPath = path$b.resolve(root, id.slice(1));
15746
+ const fsPath = path$c.resolve(root, id.slice(1));
15747
15747
  if (res = tryFsResolve(fsPath, options)) {
15748
15748
  debug$d?.(`[url] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
15749
15749
  return ensureVersionQuery(res, id, options, depsOptimizer);
15750
15750
  }
15751
15751
  }
15752
15752
  if (id[0] === "." || (preferRelative || importer?.endsWith(".html")) && startsWithWordCharRE.test(id)) {
15753
- const basedir = importer ? path$b.dirname(importer) : process.cwd();
15754
- const fsPath = path$b.resolve(basedir, id);
15753
+ const basedir = importer ? path$c.dirname(importer) : process.cwd();
15754
+ const fsPath = path$c.resolve(basedir, id);
15755
15755
  const normalizedFsPath = normalizePath$3(fsPath);
15756
15756
  if (depsOptimizer?.isOptimizedDepFile(normalizedFsPath)) {
15757
15757
  if (!options.isBuild && !DEP_VERSION_RE.test(normalizedFsPath)) {
@@ -15773,7 +15773,7 @@ function resolvePlugin(resolveOptions) {
15773
15773
  debug$d?.(`[relative] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
15774
15774
  if (!options.idOnly && !options.scan && options.isBuild) {
15775
15775
  const resPkg = findNearestPackageData(
15776
- path$b.dirname(res),
15776
+ path$c.dirname(res),
15777
15777
  options.packageCache
15778
15778
  );
15779
15779
  if (resPkg) {
@@ -15791,8 +15791,8 @@ function resolvePlugin(resolveOptions) {
15791
15791
  id = fileURLToPath$1(file) + postfix;
15792
15792
  }
15793
15793
  if (isWindows$3 && id[0] === "/") {
15794
- const basedir = importer ? path$b.dirname(importer) : process.cwd();
15795
- const fsPath = path$b.resolve(basedir, id);
15794
+ const basedir = importer ? path$c.dirname(importer) : process.cwd();
15795
+ const fsPath = path$c.resolve(basedir, id);
15796
15796
  if (res = tryFsResolve(fsPath, options)) {
15797
15797
  debug$d?.(`[drive-relative] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
15798
15798
  return ensureVersionQuery(res, id, options, depsOptimizer);
@@ -15837,7 +15837,7 @@ function resolvePlugin(resolveOptions) {
15837
15837
  if (!(options.external === true || options.external.includes(id))) {
15838
15838
  let message = `Automatically externalized node built-in module "${id}"`;
15839
15839
  if (importer) {
15840
- message += ` imported from "${path$b.relative(
15840
+ message += ` imported from "${path$c.relative(
15841
15841
  process.cwd(),
15842
15842
  importer
15843
15843
  )}"`;
@@ -15852,7 +15852,7 @@ function resolvePlugin(resolveOptions) {
15852
15852
  (options.external === true || !options.external.includes(id))) {
15853
15853
  let message = `Cannot bundle built-in module "${id}"`;
15854
15854
  if (importer) {
15855
- message += ` imported from "${path$b.relative(
15855
+ message += ` imported from "${path$c.relative(
15856
15856
  process.cwd(),
15857
15857
  importer
15858
15858
  )}"`;
@@ -15902,7 +15902,7 @@ function resolvePlugin(resolveOptions) {
15902
15902
  }
15903
15903
  function resolveSubpathImports(id, importer, options) {
15904
15904
  if (!importer || !id.startsWith(subpathImportsPrefix)) return;
15905
- const basedir = path$b.dirname(importer);
15905
+ const basedir = path$c.dirname(importer);
15906
15906
  const pkgData = findNearestPackageData(basedir, options.packageCache);
15907
15907
  if (!pkgData) return;
15908
15908
  let { file: idWithoutPostfix, postfix } = splitFileAndPostfix(id.slice(1));
@@ -15914,7 +15914,7 @@ function resolveSubpathImports(id, importer, options) {
15914
15914
  "imports"
15915
15915
  );
15916
15916
  if (importsPath?.[0] === ".") {
15917
- importsPath = path$b.relative(basedir, path$b.join(pkgData.dir, importsPath));
15917
+ importsPath = path$c.relative(basedir, path$c.join(pkgData.dir, importsPath));
15918
15918
  if (importsPath[0] !== ".") {
15919
15919
  importsPath = `./${importsPath}`;
15920
15920
  }
@@ -15956,10 +15956,10 @@ function tryCleanFsResolve(file, options, tryIndex = true, skipPackageJson = fal
15956
15956
  let res;
15957
15957
  const possibleJsToTs = isPossibleTsOutput(file);
15958
15958
  if (possibleJsToTs || options.extensions.length || tryPrefix) {
15959
- const dirPath = path$b.dirname(file);
15959
+ const dirPath = path$c.dirname(file);
15960
15960
  if (isDirectory(dirPath)) {
15961
15961
  if (possibleJsToTs) {
15962
- const fileExt = path$b.extname(file);
15962
+ const fileExt = path$c.extname(file);
15963
15963
  const fileName = file.slice(0, -fileExt.length);
15964
15964
  if (res = tryResolveRealFile(
15965
15965
  fileName + fileExt.replace("js", "ts"),
@@ -15976,7 +15976,7 @@ function tryCleanFsResolve(file, options, tryIndex = true, skipPackageJson = fal
15976
15976
  ))
15977
15977
  return res;
15978
15978
  if (tryPrefix) {
15979
- const prefixed = `${dirPath}/${options.tryPrefix}${path$b.basename(file)}`;
15979
+ const prefixed = `${dirPath}/${options.tryPrefix}${path$c.basename(file)}`;
15980
15980
  if (res = tryResolveRealFile(prefixed, preserveSymlinks)) return res;
15981
15981
  if (res = tryResolveRealFileWithExtensions(
15982
15982
  prefixed,
@@ -16027,9 +16027,9 @@ function tryNodeResolve(id, importer, options, depsOptimizer, externalize) {
16027
16027
  let basedir;
16028
16028
  if (dedupe.includes(pkgId)) {
16029
16029
  basedir = root;
16030
- } else if (importer && path$b.isAbsolute(importer) && // css processing appends `*` for importer
16030
+ } else if (importer && path$c.isAbsolute(importer) && // css processing appends `*` for importer
16031
16031
  (importer.endsWith("*") || fs__default.existsSync(cleanUrl(importer)))) {
16032
- basedir = path$b.dirname(importer);
16032
+ basedir = path$c.dirname(importer);
16033
16033
  } else {
16034
16034
  basedir = root;
16035
16035
  }
@@ -16069,7 +16069,7 @@ function tryNodeResolve(id, importer, options, depsOptimizer, externalize) {
16069
16069
  return resolved2;
16070
16070
  }
16071
16071
  let resolvedId = id;
16072
- if (deepMatch && !pkg.data.exports && path$b.extname(id) !== path$b.extname(resolved2.id)) {
16072
+ if (deepMatch && !pkg.data.exports && path$c.extname(id) !== path$c.extname(resolved2.id)) {
16073
16073
  const index = resolved2.id.indexOf(id);
16074
16074
  if (index > -1) {
16075
16075
  resolvedId = resolved2.id.slice(index);
@@ -16163,7 +16163,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
16163
16163
  const entryPoints = entryPoint ? [entryPoint] : ["index.js", "index.json", "index.node"];
16164
16164
  for (let entry of entryPoints) {
16165
16165
  let skipPackageJson = false;
16166
- if (options.mainFields[0] === "sass" && !options.extensions.includes(path$b.extname(entry))) {
16166
+ if (options.mainFields[0] === "sass" && !options.extensions.includes(path$c.extname(entry))) {
16167
16167
  entry = "";
16168
16168
  skipPackageJson = true;
16169
16169
  } else {
@@ -16172,7 +16172,7 @@ function resolvePackageEntry(id, { dir, data, setResolvedCache, getResolvedCache
16172
16172
  entry = mapWithBrowserField(entry, browserField) || entry;
16173
16173
  }
16174
16174
  }
16175
- const entryPointPath = path$b.join(dir, entry);
16175
+ const entryPointPath = path$c.join(dir, entry);
16176
16176
  const resolvedEntryPoint = tryFsResolve(
16177
16177
  entryPointPath,
16178
16178
  options,
@@ -16238,7 +16238,7 @@ function resolveDeepImport(id, { setResolvedCache, getResolvedCache, dir, data }
16238
16238
  }
16239
16239
  if (!relativeId) {
16240
16240
  throw new Error(
16241
- `Package subpath '${relativeId}' is not defined by "exports" in ${path$b.join(dir, "package.json")}.`
16241
+ `Package subpath '${relativeId}' is not defined by "exports" in ${path$c.join(dir, "package.json")}.`
16242
16242
  );
16243
16243
  }
16244
16244
  } else if (options.mainFields.includes("browser") && isObject$1(browserField)) {
@@ -16253,7 +16253,7 @@ function resolveDeepImport(id, { setResolvedCache, getResolvedCache, dir, data }
16253
16253
  }
16254
16254
  if (relativeId) {
16255
16255
  const resolved = tryFsResolve(
16256
- path$b.join(dir, relativeId),
16256
+ path$c.join(dir, relativeId),
16257
16257
  options,
16258
16258
  !exportsField
16259
16259
  // try index only if no exports field
@@ -16269,9 +16269,9 @@ function resolveDeepImport(id, { setResolvedCache, getResolvedCache, dir, data }
16269
16269
  }
16270
16270
  function tryResolveBrowserMapping(id, importer, options, isFilePath, externalize) {
16271
16271
  let res;
16272
- const pkg = importer && findNearestPackageData(path$b.dirname(importer), options.packageCache);
16272
+ const pkg = importer && findNearestPackageData(path$c.dirname(importer), options.packageCache);
16273
16273
  if (pkg && isObject$1(pkg.data.browser)) {
16274
- const mapId = isFilePath ? "./" + slash$1(path$b.relative(pkg.dir, id)) : id;
16274
+ const mapId = isFilePath ? "./" + slash$1(path$c.relative(pkg.dir, id)) : id;
16275
16275
  const browserMappedPath = mapWithBrowserField(mapId, pkg.data.browser);
16276
16276
  if (browserMappedPath) {
16277
16277
  if (res = bareImportRE.test(browserMappedPath) ? tryNodeResolve(
@@ -16280,7 +16280,7 @@ function tryResolveBrowserMapping(id, importer, options, isFilePath, externalize
16280
16280
  options,
16281
16281
  void 0,
16282
16282
  void 0
16283
- )?.id : tryFsResolve(path$b.join(pkg.dir, browserMappedPath), options)) {
16283
+ )?.id : tryFsResolve(path$c.join(pkg.dir, browserMappedPath), options)) {
16284
16284
  debug$d?.(`[browser mapped] ${colors$1.cyan(id)} -> ${colors$1.dim(res)}`);
16285
16285
  let result = { id: res };
16286
16286
  if (options.idOnly) {
@@ -16288,7 +16288,7 @@ function tryResolveBrowserMapping(id, importer, options, isFilePath, externalize
16288
16288
  }
16289
16289
  if (!options.scan && options.isBuild) {
16290
16290
  const resPkg = findNearestPackageData(
16291
- path$b.dirname(res),
16291
+ path$c.dirname(res),
16292
16292
  options.packageCache
16293
16293
  );
16294
16294
  if (resPkg) {
@@ -16310,7 +16310,7 @@ function tryResolveBrowserEntry(dir, data, options) {
16310
16310
  if (browserEntry) {
16311
16311
  if (!options.isRequire && options.mainFields.includes("module") && typeof data.module === "string" && data.module !== browserEntry) {
16312
16312
  const resolvedBrowserEntry = tryFsResolve(
16313
- path$b.join(dir, browserEntry),
16313
+ path$c.join(dir, browserEntry),
16314
16314
  options
16315
16315
  );
16316
16316
  if (resolvedBrowserEntry) {
@@ -16327,9 +16327,9 @@ function tryResolveBrowserEntry(dir, data, options) {
16327
16327
  }
16328
16328
  }
16329
16329
  function mapWithBrowserField(relativePathInPkgDir, map) {
16330
- const normalizedPath = path$b.posix.normalize(relativePathInPkgDir);
16330
+ const normalizedPath = path$c.posix.normalize(relativePathInPkgDir);
16331
16331
  for (const key in map) {
16332
- const normalizedKey = path$b.posix.normalize(key);
16332
+ const normalizedKey = path$c.posix.normalize(key);
16333
16333
  if (normalizedPath === normalizedKey || equalWithoutSuffix(normalizedPath, normalizedKey, ".js") || equalWithoutSuffix(normalizedPath, normalizedKey, "/index.js")) {
16334
16334
  return map[key];
16335
16335
  }
@@ -16454,7 +16454,7 @@ var require$$4 = {
16454
16454
  version: version$1};
16455
16455
 
16456
16456
  const fs$6 = require$$0$4;
16457
- const path$8 = require$$0$2;
16457
+ const path$9 = require$$0$2;
16458
16458
  const os$1 = require$$2;
16459
16459
  const crypto$1 = require$$3;
16460
16460
  const packageJson = require$$4;
@@ -16624,7 +16624,7 @@ function _vaultPath (options) {
16624
16624
  possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`;
16625
16625
  }
16626
16626
  } else {
16627
- possibleVaultPath = path$8.resolve(process.cwd(), '.env.vault');
16627
+ possibleVaultPath = path$9.resolve(process.cwd(), '.env.vault');
16628
16628
  }
16629
16629
 
16630
16630
  if (fs$6.existsSync(possibleVaultPath)) {
@@ -16635,7 +16635,7 @@ function _vaultPath (options) {
16635
16635
  }
16636
16636
 
16637
16637
  function _resolveHome (envPath) {
16638
- return envPath[0] === '~' ? path$8.join(os$1.homedir(), envPath.slice(1)) : envPath
16638
+ return envPath[0] === '~' ? path$9.join(os$1.homedir(), envPath.slice(1)) : envPath
16639
16639
  }
16640
16640
 
16641
16641
  function _configVault (options) {
@@ -16657,7 +16657,7 @@ function _configVault (options) {
16657
16657
  }
16658
16658
 
16659
16659
  function configDotenv (options) {
16660
- const dotenvPath = path$8.resolve(process.cwd(), '.env');
16660
+ const dotenvPath = path$9.resolve(process.cwd(), '.env');
16661
16661
  let encoding = 'utf8';
16662
16662
  const debug = Boolean(options && options.debug);
16663
16663
 
@@ -16925,7 +16925,7 @@ function getEnvFilesForMode(mode, envDir) {
16925
16925
  `.env.${mode}`,
16926
16926
  /** mode local file */
16927
16927
  `.env.${mode}.local`
16928
- ].map((file) => normalizePath$3(path$b.join(envDir, file)));
16928
+ ].map((file) => normalizePath$3(path$c.join(envDir, file)));
16929
16929
  }
16930
16930
  return [];
16931
16931
  }
@@ -17091,7 +17091,7 @@ function errorMiddleware(server, allowNext = false) {
17091
17091
  "\\u003c"
17092
17092
  )}
17093
17093
  try {
17094
- const { ErrorOverlay } = await import(${JSON.stringify(path$b.posix.join(server.config.base, CLIENT_PUBLIC_PATH))})
17094
+ const { ErrorOverlay } = await import(${JSON.stringify(path$c.posix.join(server.config.base, CLIENT_PUBLIC_PATH))})
17095
17095
  document.body.appendChild(new ErrorOverlay(error))
17096
17096
  } catch {
17097
17097
  const h = (tag, text) => {
@@ -21999,12 +21999,12 @@ var require$$0 = [
21999
21999
 
22000
22000
  var binaryExtensions$1 = require$$0;
22001
22001
 
22002
- const path$7 = require$$0$2;
22002
+ const path$8 = require$$0$2;
22003
22003
  const binaryExtensions = binaryExtensions$1;
22004
22004
 
22005
22005
  const extensions = new Set(binaryExtensions);
22006
22006
 
22007
- var isBinaryPath$1 = filePath => extensions.has(path$7.extname(filePath).slice(1).toLowerCase());
22007
+ var isBinaryPath$1 = filePath => extensions.has(path$8.extname(filePath).slice(1).toLowerCase());
22008
22008
 
22009
22009
  var constants$1 = {};
22010
22010
 
@@ -24225,16 +24225,28 @@ var guess = {exports: {}};
24225
24225
 
24226
24226
  var shellQuote$1 = {};
24227
24227
 
24228
- var OPS = [
24228
+ /** @import { ControlOperator } from './parse' */
24229
+
24230
+ /** @type {ControlOperator['op'][]} */
24231
+ var OPS = /** @type {const} */ ([
24229
24232
  '||',
24230
24233
  '&&',
24234
+ ';;&',
24231
24235
  ';;',
24236
+ ';&',
24232
24237
  '|&',
24233
24238
  '<(',
24239
+ '>(',
24234
24240
  '<<<',
24241
+ '<<-',
24242
+ '<<',
24235
24243
  '>>',
24236
24244
  '>&',
24245
+ '>|',
24246
+ '&>>',
24247
+ '&>',
24237
24248
  '<&',
24249
+ '<>',
24238
24250
  '&',
24239
24251
  ';',
24240
24252
  '(',
@@ -24242,80 +24254,111 @@ var OPS = [
24242
24254
  '|',
24243
24255
  '<',
24244
24256
  '>'
24245
- ];
24257
+ ]);
24246
24258
  var LINE_TERMINATORS = /[\n\r\u2028\u2029]/;
24247
- var GLOB_SHELL_SPECIAL = /[\s#!"$&'():;<=>@\\^`|]/g;
24259
+ var GLOB_SHELL_SPECIAL = /[\s#!"$&'():;<=>@\\^`|~]/g;
24248
24260
 
24261
+ /** @type {typeof import('./quote')} */
24249
24262
  var quote = function quote(xs) {
24263
+ var sawComment = false;
24250
24264
  return xs.map(function (s) {
24265
+ if (sawComment && typeof s === 'string' && LINE_TERMINATORS.test(s)) {
24266
+ throw new TypeError('a token after a `comment` must not contain line terminators');
24267
+ }
24251
24268
  if (s === '') {
24252
- return '\'\'';
24269
+ return /** @type {const} */ ('\'\'');
24253
24270
  }
24254
24271
  if (s && typeof s === 'object') {
24255
- if (s.op === 'glob') {
24272
+ if ('op' in s && s.op === 'glob') {
24256
24273
  if (typeof s.pattern !== 'string') {
24257
24274
  throw new TypeError('glob token requires a string `pattern`');
24258
24275
  }
24259
24276
  if (LINE_TERMINATORS.test(s.pattern)) {
24260
24277
  throw new TypeError('glob `pattern` must not contain line terminators');
24261
24278
  }
24279
+ if (s.pattern === '') {
24280
+ return /** @type {const} */ ('\'\'');
24281
+ }
24262
24282
  return s.pattern.replace(GLOB_SHELL_SPECIAL, '\\$&');
24263
24283
  }
24264
- if (typeof s.op === 'string') {
24284
+ if ('op' in s && typeof s.op === 'string') {
24265
24285
  if (OPS.indexOf(s.op) < 0) {
24266
24286
  throw new TypeError('invalid `op` value: ' + JSON.stringify(s.op));
24267
24287
  }
24268
24288
  return s.op.replace(/[\s\S]/g, '\\$&');
24269
24289
  }
24270
- if (typeof s.comment === 'string') {
24290
+ if ('comment' in s && typeof s.comment === 'string') {
24271
24291
  if (LINE_TERMINATORS.test(s.comment)) {
24272
24292
  throw new TypeError('`comment` must not contain line terminators');
24273
24293
  }
24294
+ sawComment = true;
24274
24295
  return '#' + s.comment;
24275
24296
  }
24276
24297
  throw new TypeError('unrecognized object token shape');
24277
24298
  }
24299
+ if ((/'/).test(s) && (/!/).test(s)) {
24300
+ return "'" + s.replace(/'/g, "'\"'\"'") + "'";
24301
+ }
24278
24302
  if ((/["\s\\]/).test(s) && !(/'/).test(s)) {
24279
- return "'" + s.replace(/(['])/g, '\\$1') + "'";
24303
+ return "'" + s + "'";
24280
24304
  }
24281
24305
  if ((/["'\s]/).test(s)) {
24282
- return '"' + s.replace(/(["\\$`!])/g, '\\$1') + '"';
24306
+ return '"' + s.replace(/(["\\$`])/g, '\\$1') + '"';
24283
24307
  }
24284
- return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, '$1\\$2');
24308
+ return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g, '$1\\$2');
24285
24309
  }).join(' ');
24286
24310
  };
24287
24311
 
24288
- // '<(' is process substitution operator and
24312
+ /**
24313
+ * @import {
24314
+ * ControlOperator,
24315
+ * Env,
24316
+ * GlobPattern,
24317
+ * ParseEntry,
24318
+ * } from './parse' */
24319
+
24320
+ // '<(' and '>(' are process substitution operators and
24289
24321
  // can be parsed the same as control operator
24290
- var CONTROL = '(?:' + [
24322
+ var CONTROL = /** @type {const} */ ('(?:') + /** @type {const} */ ([
24291
24323
  '\\|\\|',
24292
- '\\&\\&',
24293
- ';;',
24294
- '\\|\\&',
24324
+ '\\&(?:\\&|>>?)', // `&&`, `&>`, and `&>>`
24325
+ ';;\\&?', // `;;` and `;;&`
24326
+ '[;|]\\&', // `;&` and `|&`
24295
24327
  '\\<\\(',
24296
24328
  '\\<\\<\\<',
24329
+ '\\<\\<-',
24330
+ '\\<\\<(?!\\()', // `<<(` stays `<` and `<(`, as zsh reads it; other shells reject it
24297
24331
  '>>',
24298
- '>\\&',
24299
- '<\\&',
24332
+ '>[&|(]', // `>&`, `>|`, and `>(`
24333
+ '<[&>]', // `<&` and `<>`
24300
24334
  '[&;()|<>]'
24301
- ].join('|') + ')';
24335
+ ]).join(/** @type {const} */ ('|')) + /** @type {const} */ (')');
24302
24336
  var controlRE = new RegExp('^' + CONTROL + '$');
24303
- var META = '|&;()<> \\t';
24304
- var SINGLE_QUOTE = '"((\\\\"|[^"])*?)"';
24305
- var DOUBLE_QUOTE = '\'((\\\\\'|[^\'])*?)\'';
24337
+ var META = /** @type {const} */ ('|&;()<> \\t');
24338
+ var SINGLE_QUOTE = /** @type {const} */ ('\'([^\']*?)\'');
24339
+ // bash ANSI-C quoting, `$'...'`: a backslash escapes the next character, including `'`
24340
+ var ANSI_C_BODY = '(?:\\\\[\\s\\S]|[^\\\\\'])*?';
24341
+ var ANSI_C_QUOTE = '\\$\'' + ANSI_C_BODY + '\'';
24342
+ var ansiCAt = new RegExp('\\$\'' + ANSI_C_BODY + '(?:(\')|\\\\?$)', 'g');
24343
+ var ANSI_C_LETTERS = 'abeEfnrtv';
24344
+ var ANSI_C_CHARS = '\x07\b\x1B\x1B\f\n\r\t\v';
24306
24345
  var hash = /^#$/;
24307
24346
 
24308
- var SQ = "'";
24309
- var DQ = '"';
24310
- var DS = '$';
24347
+ var SQ = /** @type {const} */ ("'");
24348
+ var DQ = /** @type {const} */ ('"');
24349
+ var DS = /** @type {const} */ ('$');
24311
24350
 
24312
24351
  var TOKEN = '';
24313
- var mult = 0x100000000; // Math.pow(16, 8);
24352
+ var mult = /** @type {const} */ (0x100000000); // Math.pow(16, 8);
24314
24353
  for (var i = 0; i < 4; i++) {
24315
24354
  TOKEN += (mult * Math.random()).toString(16);
24316
24355
  }
24317
24356
  var startsWithToken = new RegExp('^' + TOKEN);
24318
24357
 
24358
+ /**
24359
+ * @param {string} s
24360
+ * @param {RegExp} r
24361
+ */
24319
24362
  function matchAll(s, r) {
24320
24363
  var origIndex = r.lastIndex;
24321
24364
 
@@ -24323,7 +24366,7 @@ function matchAll(s, r) {
24323
24366
  var matchObj;
24324
24367
 
24325
24368
  while ((matchObj = r.exec(s))) {
24326
- matches.push(matchObj);
24369
+ matches[matches.length] = matchObj;
24327
24370
  if (r.lastIndex === matchObj.index) {
24328
24371
  r.lastIndex += 1;
24329
24372
  }
@@ -24334,6 +24377,11 @@ function matchAll(s, r) {
24334
24377
  return matches;
24335
24378
  }
24336
24379
 
24380
+ /**
24381
+ * @param {Env} env
24382
+ * @param {string} pre
24383
+ * @param {string} key
24384
+ */
24337
24385
  function getVar(env, pre, key) {
24338
24386
  var r = typeof env === 'function' ? env(key) : env[key];
24339
24387
  if (typeof r === 'undefined' && key != '') {
@@ -24348,16 +24396,64 @@ function getVar(env, pre, key) {
24348
24396
  return pre + r;
24349
24397
  }
24350
24398
 
24399
+ var ansiCEscape = /\\([0-7]{1,3}|x[\dA-Fa-f]{1,2}|u[\dA-Fa-f]{1,4}|U[\dA-Fa-f]{1,8}|c(?:\\\\|[\s\S])|[abeEfnrtv\\'"?])/g;
24400
+
24401
+ /**
24402
+ * @param {string} m
24403
+ * @param {string} escape
24404
+ */
24405
+ function expandAnsiCEscape(m, escape) {
24406
+ var kind = escape.charAt(0);
24407
+ if (kind === 'c') {
24408
+ var ctrl = escape.charAt(1);
24409
+ return ctrl === '?' ? '\x7F' : String.fromCharCode(ctrl.charCodeAt(0) & 0x1F);
24410
+ }
24411
+ if (kind === 'x' || kind === 'u' || kind === 'U') {
24412
+ var cp = parseInt(escape.slice(1), 16);
24413
+ if (cp > 0x10FFFF) {
24414
+ return m;
24415
+ }
24416
+ return String.fromCharCode.apply(null, cp > 0xFFFF ? [0xD7C0 + (cp >> 10), 0xDC00 + (cp & 0x3FF)] : [cp]);
24417
+ }
24418
+ if (kind >= '0' && kind <= '7') {
24419
+ return String.fromCharCode(parseInt(escape, 8) & 0xFF);
24420
+ }
24421
+ var letter = ANSI_C_LETTERS.indexOf(escape);
24422
+ return letter < 0 ? escape : ANSI_C_CHARS.charAt(letter);
24423
+ }
24424
+
24425
+ /** @param {string} body */
24426
+ function expandAnsiC(body) {
24427
+ return body.replace(ansiCEscape, expandAnsiCEscape).split('\0')[0]; // like bash, a NUL ends the string
24428
+ }
24429
+
24430
+ /**
24431
+ * @param {string} s
24432
+ * @param {number} i
24433
+ */
24434
+ function closesAnsiC(s, i) {
24435
+ ansiCAt.lastIndex = i;
24436
+ return !!(/** @type {RegExpExecArray} */ (ansiCAt.exec(s)))[1];
24437
+ }
24438
+
24439
+ /**
24440
+ * @param {string} string
24441
+ * @param {Env} [env]
24442
+ * @param {{ escape?: string, splitUnquoted?: boolean | string }} [opts]
24443
+ * @returns {ParseEntry[]}
24444
+ */
24351
24445
  function parseInternal(string, env, opts) {
24352
24446
  if (!opts) {
24353
24447
  opts = {};
24354
24448
  }
24355
24449
  var BS = opts.escape || '\\';
24356
- var BAREWORD = '(\\' + BS + '[\'"' + META + ']|[^\\s\'"' + META + '])+';
24450
+ var ifs = opts.splitUnquoted === true ? ' \t\n' : (typeof opts.splitUnquoted === 'string' ? opts.splitUnquoted : '');
24451
+ var BAREWORD = '(\\' + BS + '[\'"$\\' + BS + META + ']|\\$\\$|\\$(?!' + ANSI_C_QUOTE.slice(2) + ')|[^\\s\'"$' + META + '])+';
24452
+ var DOUBLE_QUOTE = '"(?:\\' + BS + '[\\s\\S]|[^"\\' + BS + '])*"';
24357
24453
 
24358
24454
  var chunker = new RegExp([
24359
24455
  '(' + CONTROL + ')', // control chars
24360
- '(' + BAREWORD + '|' + SINGLE_QUOTE + '|' + DOUBLE_QUOTE + ')+'
24456
+ '(' + ANSI_C_QUOTE + '|' + BAREWORD + '|' + DOUBLE_QUOTE + '|' + SINGLE_QUOTE + ')+'
24361
24457
  ].join('|'), 'g');
24362
24458
 
24363
24459
  var matches = matchAll(string, chunker);
@@ -24377,7 +24473,7 @@ function parseInternal(string, env, opts) {
24377
24473
  return void 0;
24378
24474
  }
24379
24475
  if (controlRE.test(s)) {
24380
- return { op: s };
24476
+ return /** @type {ControlOperator} */ ({ op: s });
24381
24477
  }
24382
24478
 
24383
24479
  // Hand-written scanner/parser for Bash quoting rules:
@@ -24391,15 +24487,24 @@ function parseInternal(string, env, opts) {
24391
24487
  // 4. quote context can switch mid-token if there is no whitespace
24392
24488
  // between the two quote contexts (e.g. all'one'"token" parses as
24393
24489
  // "allonetoken")
24490
+ /** @type {string | boolean} */
24394
24491
  var quote = false;
24395
24492
  var esc = false;
24396
24493
  var out = '';
24494
+ /** @type {string[]} */
24495
+ var words = [];
24496
+ var sawQuote = false;
24497
+ /** @type {number | null} */
24498
+ var pendingNw = null;
24397
24499
  var isGlob = false;
24500
+ /** @type {number} */
24398
24501
  var i;
24399
24502
 
24400
24503
  function parseEnvVar() {
24401
24504
  i += 1;
24505
+ /** @type {number | RegExpMatchArray | null} */
24402
24506
  var varend;
24507
+ /** @type {string} */
24403
24508
  var varname;
24404
24509
  var char = s.charAt(i);
24405
24510
 
@@ -24408,15 +24513,25 @@ function parseInternal(string, env, opts) {
24408
24513
  if (s.charAt(i) === '}') {
24409
24514
  throw new Error('Bad substitution: ' + s.slice(i - 2, i + 1));
24410
24515
  }
24411
- varend = s.indexOf('}', i);
24412
- if (varend < 0) {
24516
+ // match braces by depth so a nested `${` keeps its inner `}` from ending the outer substitution
24517
+ var depth = 1;
24518
+ varend = i;
24519
+ while (depth > 0 && varend < s.length) {
24520
+ if (s.charAt(varend) === '{' && s.charAt(varend - 1) === '$') {
24521
+ depth += 1;
24522
+ } else if (s.charAt(varend) === '}') {
24523
+ depth -= 1;
24524
+ }
24525
+ varend += 1;
24526
+ }
24527
+ if (depth !== 0) {
24413
24528
  throw new Error('Bad substitution: ' + s.slice(i));
24414
24529
  }
24530
+ varend -= 1;
24415
24531
  varname = s.slice(i, varend);
24416
24532
  i = varend;
24417
- } else if ((/[*@#?$!_-]/).test(char)) {
24533
+ } else if ((/[*@#?$!-]/).test(char)) {
24418
24534
  varname = char;
24419
- i += 1;
24420
24535
  } else {
24421
24536
  var slicedFromI = s.slice(i);
24422
24537
  varend = slicedFromI.match(/[^\w\d_]/);
@@ -24425,14 +24540,36 @@ function parseInternal(string, env, opts) {
24425
24540
  i = s.length;
24426
24541
  } else {
24427
24542
  varname = slicedFromI.slice(0, varend.index);
24428
- i += varend.index - 1;
24543
+ i += /** @type {number} */ (varend.index) - 1;
24544
+ }
24545
+ }
24546
+ return getVar(/** @type {NonNullable<typeof env>} */ (env), '', varname);
24547
+ }
24548
+
24549
+ function flushRun() {
24550
+ if (pendingNw === null) {
24551
+ return;
24552
+ }
24553
+ if (pendingNw === 0) {
24554
+ if (out !== '') {
24555
+ words[words.length] = out;
24556
+ out = '';
24557
+ }
24558
+ } else {
24559
+ words[words.length] = out;
24560
+ out = '';
24561
+ for (var fe = 1; fe < pendingNw; fe += 1) {
24562
+ words[words.length] = '';
24429
24563
  }
24430
24564
  }
24431
- return getVar(env, '', varname);
24565
+ pendingNw = null;
24432
24566
  }
24433
24567
 
24434
24568
  for (i = 0; i < s.length; i++) {
24435
24569
  var c = s.charAt(i);
24570
+ if (ifs && c !== DS) {
24571
+ flushRun();
24572
+ }
24436
24573
  isGlob = isGlob || (!quote && (c === '*' || c === '?'));
24437
24574
  if (esc) {
24438
24575
  out += c;
@@ -24459,35 +24596,76 @@ function parseInternal(string, env, opts) {
24459
24596
  }
24460
24597
  } else if (c === DQ || c === SQ) {
24461
24598
  quote = c;
24599
+ sawQuote = true;
24462
24600
  } else if (controlRE.test(c)) {
24463
- return { op: s };
24601
+ return /** @type {ControlOperator} */ ({ op: s });
24464
24602
  } else if (hash.test(c)) {
24465
24603
  commented = true;
24466
24604
  var commentObj = { comment: string.slice(match.index + i + 1) };
24467
24605
  if (out.length) {
24468
- return [out, commentObj];
24606
+ return /** @type {const} */ ([out, commentObj]);
24469
24607
  }
24470
- return [commentObj];
24608
+ return /** @type {const} */ ([commentObj]);
24471
24609
  } else if (c === BS) {
24472
24610
  esc = true;
24611
+ } else if (c === DS && s.charAt(i + 1) === SQ && closesAnsiC(s, i)) {
24612
+ flushRun();
24613
+ sawQuote = true;
24614
+ out += expandAnsiC(s.slice(i + 2, ansiCAt.lastIndex - 1));
24615
+ i = ansiCAt.lastIndex - 1;
24473
24616
  } else if (c === DS) {
24474
- out += parseEnvVar();
24617
+ var value = parseEnvVar();
24618
+ if (!ifs) {
24619
+ out += value;
24620
+ } else {
24621
+ for (var vi = 0; vi < value.length; vi += 1) {
24622
+ var vc = value.charAt(vi);
24623
+ if (ifs.indexOf(vc) < 0) {
24624
+ flushRun();
24625
+ out += vc;
24626
+ } else if (pendingNw === null) {
24627
+ pendingNw = vc === ' ' || vc === '\t' || vc === '\n' ? 0 : 1;
24628
+ } else if (vc !== ' ' && vc !== '\t' && vc !== '\n') {
24629
+ pendingNw += 1;
24630
+ }
24631
+ }
24632
+ }
24475
24633
  } else {
24476
24634
  out += c;
24477
24635
  }
24478
24636
  }
24479
24637
 
24480
24638
  if (isGlob) {
24481
- return { op: 'glob', pattern: out };
24639
+ return /** @type {GlobPattern} */ ({ op: 'glob', pattern: out });
24640
+ }
24641
+
24642
+ if (ifs) {
24643
+ if (pendingNw !== null && pendingNw > 0) {
24644
+ words[words.length] = out;
24645
+ out = '';
24646
+ for (var te = 1; te < pendingNw; te += 1) {
24647
+ words[words.length] = '';
24648
+ }
24649
+ }
24650
+ if (out !== '' || (sawQuote && words.length === 0)) {
24651
+ words[words.length] = out;
24652
+ }
24653
+ return words;
24482
24654
  }
24483
24655
 
24484
24656
  return out;
24485
24657
  }).reduce(function (prev, arg) { // finalize parsed arguments
24486
- // TODO: replace this whole reduce with a concat
24487
- return typeof arg === 'undefined' ? prev : prev.concat(arg);
24488
- }, []);
24658
+ if (typeof arg === 'undefined') {
24659
+ return prev;
24660
+ }
24661
+ /** @type {ParseEntry[]} */ ([]).concat(arg).forEach(function (entry) {
24662
+ prev[prev.length] = entry;
24663
+ });
24664
+ return prev;
24665
+ }, /** @type {ParseEntry[]} */ ([]));
24489
24666
  }
24490
24667
 
24668
+ /** @type {typeof import('./parse')} */
24491
24669
  var parse$6 = function parse(s, env, opts) {
24492
24670
  var mapped = parseInternal(s, env, opts);
24493
24671
  if (typeof env !== 'function') {
@@ -24495,19 +24673,21 @@ var parse$6 = function parse(s, env, opts) {
24495
24673
  }
24496
24674
  return mapped.reduce(function (acc, s) {
24497
24675
  if (typeof s === 'object') {
24498
- return acc.concat(s);
24676
+ acc[acc.length] = s;
24677
+ return acc;
24499
24678
  }
24500
24679
  var xs = s.split(RegExp('(' + TOKEN + '.*?' + TOKEN + ')', 'g'));
24501
24680
  if (xs.length === 1) {
24502
- return acc.concat(xs[0]);
24681
+ acc[acc.length] = xs[0];
24682
+ return acc;
24503
24683
  }
24504
- return acc.concat(xs.filter(Boolean).map(function (x) {
24505
- if (startsWithToken.test(x)) {
24506
- return JSON.parse(x.split(TOKEN)[1]);
24507
- }
24508
- return x;
24509
- }));
24510
- }, []);
24684
+ xs.filter(Boolean).forEach(function (x) {
24685
+ acc[acc.length] = startsWithToken.test(x)
24686
+ ? JSON.parse(x.split(TOKEN)[1])
24687
+ : x;
24688
+ });
24689
+ return acc;
24690
+ }, /** @type {ParseEntry[]} */ ([]));
24511
24691
  };
24512
24692
 
24513
24693
  shellQuote$1.quote = quote;
@@ -24621,7 +24801,7 @@ var windows$1 = [
24621
24801
  'Antigravity.exe',
24622
24802
  ];
24623
24803
 
24624
- const path$6 = require$$0$2;
24804
+ const path$7 = require$$0$2;
24625
24805
  const shellQuote = shellQuote$1;
24626
24806
  const childProcess$1 = require$$2$1;
24627
24807
 
@@ -24665,7 +24845,7 @@ function getEditorFromWindowsProcesses(output) {
24665
24845
  const runningProcesses = output.split('\r\n');
24666
24846
  for (let i = 0; i < runningProcesses.length; i++) {
24667
24847
  const fullProcessPath = runningProcesses[i].trim();
24668
- const shortProcessName = path$6.win32.basename(fullProcessPath);
24848
+ const shortProcessName = path$7.win32.basename(fullProcessPath);
24669
24849
 
24670
24850
  if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) {
24671
24851
  return fullProcessPath
@@ -24763,11 +24943,32 @@ guess.exports.getEditorFromLinuxProcesses = getEditorFromLinuxProcesses;
24763
24943
 
24764
24944
  var guessExports = guess.exports;
24765
24945
 
24766
- const path$5 = require$$0$2;
24946
+ const os = require$$2;
24947
+ const path$6 = require$$0$2;
24948
+
24949
+ // normalize a file and optional line/column numbers into command line args for specific editors
24950
+ var getArgs = function getArgumentsForFile(editor, fileName, lineNumber, columnNumber = 1) {
24951
+ fileName = path$6.resolve(fileName);
24767
24952
 
24768
- // normalize file/line numbers into command line args for specific editors
24769
- var getArgs = function getArgumentsForPosition(editor, fileName, lineNumber, columnNumber = 1) {
24770
- const editorBasename = path$5.basename(editor).replace(/\.(exe|cmd|bat)$/i, '');
24953
+ if (
24954
+ process.platform === 'linux' &&
24955
+ fileName.startsWith('/mnt/') &&
24956
+ /Microsoft/i.test(os.release())
24957
+ ) {
24958
+ // Assume WSL / "Bash on Ubuntu on Windows" is being used, and
24959
+ // that the file exists on the Windows file system.
24960
+ // `os.release()` is "4.4.0-43-Microsoft" in the current release
24961
+ // build of WSL, see: https://github.com/Microsoft/BashOnWindows/issues/423#issuecomment-221627364
24962
+ // When a Windows editor is specified, interop functionality can
24963
+ // handle the path translation, but only if a relative path is used.
24964
+ fileName = `./${path$6.relative('', fileName)}`;
24965
+ }
24966
+
24967
+ if (!lineNumber) {
24968
+ return [fileName]
24969
+ }
24970
+
24971
+ const editorBasename = path$6.basename(editor).replace(/\.(exe|cmd|bat)$/i, '');
24771
24972
  switch (editorBasename) {
24772
24973
  case 'atom':
24773
24974
  case 'Atom':
@@ -24835,6 +25036,92 @@ var getArgs = function getArgumentsForPosition(editor, fileName, lineNumber, col
24835
25036
  return [fileName]
24836
25037
  };
24837
25038
 
25039
+ // On Windows, we need to use `exec` with the `shell: true` option,
25040
+ // and some more sanitization is required.
25041
+
25042
+ // However, CMD.exe on Windows is vulnerable to RCE attacks given a file name of the
25043
+ // form "C:\Users\myusername\Downloads\& curl 172.21.93.52".
25044
+ // `create-react-app` used a safe file name pattern to validate user-provided file names:
25045
+ // - https://github.com/facebook/create-react-app/pull/4866
25046
+ // - https://github.com/facebook/create-react-app/pull/5431
25047
+ // But that's not a viable solution for this package because
25048
+ // it's depended on by so many meta frameworks that heavily rely on
25049
+ // special characters in file names for filesystem-based routing.
25050
+ // We need to at least:
25051
+ // - Support `+` because it's used in SvelteKit and Vike
25052
+ // - Support `$` because it's used in Remix
25053
+ // - Support `(` and `)` because they are used in Analog, SolidStart, and Vike
25054
+ // - Support `@` because it's used in Vike
25055
+ // - Support `[` and `]` because they are widely used for [slug]
25056
+ // So here we choose to use `^` to escape special characters instead.
25057
+
25058
+ // According to https://ss64.com/nt/syntax-esc.html,
25059
+ // we can use `^` to escape `&`, `<`, `>`, `|`, `%`, and `^`
25060
+ //
25061
+ // `"` cannot appear in Windows paths, so it is outside the untrusted path input
25062
+ // this sanitization protects.
25063
+ function escapeCmdArgs(cmdArgs) {
25064
+ return cmdArgs.replace(/([&|<>,;=^])/g, '^$1')
25065
+ }
25066
+
25067
+ // Need to double quote the editor path in case it contains spaces;
25068
+ // If the fileName contains spaces, we also need to double quote it in the arguments
25069
+ // However, there's a case that it's concatenated with line number and column number
25070
+ // which is separated by `:`. We need to double quote the whole string in this case.
25071
+ // Also, if the string contains the escape character `^`, it needs to be quoted, too.
25072
+ function doubleQuoteIfNeeded(str) {
25073
+ if (str.includes('^')) {
25074
+ // If a string includes an escaped character, not only does it need to be quoted,
25075
+ // but the quotes need to be escaped too.
25076
+ return `^"${str}^"`
25077
+ } else if (str.includes(' ')) {
25078
+ return `"${str}"`
25079
+ }
25080
+ return str
25081
+ }
25082
+
25083
+ function constructWindowsLaunchCommand$1(editor, args) {
25084
+ // CMD treats line breaks as command separators. They cannot appear in regular Windows
25085
+ // file names, but NTFS alternate data stream names may contain control characters.
25086
+ if (args.some((arg) => /[\r\n]/.test(arg))) {
25087
+ throw new Error('Cannot launch an editor with an argument containing a line break')
25088
+ }
25089
+
25090
+ // CMD expands expressions such as `%VAR:old=new%` before consuming caret escapes, so
25091
+ // percent signs in arguments cannot be preserved safely and are rejected.
25092
+ if (args.some((arg) => arg.includes('%'))) {
25093
+ throw new Error('Cannot launch an editor with an argument containing "%"')
25094
+ }
25095
+
25096
+ return [editor, ...args.map(escapeCmdArgs)].map(doubleQuoteIfNeeded).join(' ')
25097
+ }
25098
+
25099
+ var constructWindowsLaunchCommand_1 = constructWindowsLaunchCommand$1;
25100
+
25101
+ const path$5 = require$$0$2;
25102
+
25103
+ const positionRE = /:(\d+)(:(\d+))?$/;
25104
+
25105
+ var parseFile$1 = function parseFile(file) {
25106
+ // support `file://` protocol
25107
+ if (file.startsWith('file://')) {
25108
+ file = require$$0$5.fileURLToPath(file);
25109
+ }
25110
+
25111
+ const unresolvedFileName = file.replace(positionRE, '');
25112
+ const fileName = unresolvedFileName ? path$5.resolve(unresolvedFileName) : '';
25113
+
25114
+ const match = file.match(positionRE);
25115
+ const lineNumber = match && match[1];
25116
+ const columnNumber = match && match[3];
25117
+
25118
+ return {
25119
+ fileName,
25120
+ lineNumber,
25121
+ columnNumber,
25122
+ }
25123
+ };
25124
+
24838
25125
  /**
24839
25126
  * Copyright (c) 2015-present, Facebook, Inc.
24840
25127
  *
@@ -24846,13 +25133,14 @@ var getArgs = function getArgumentsForPosition(editor, fileName, lineNumber, col
24846
25133
  */
24847
25134
 
24848
25135
  const fs$1 = require$$0$4;
24849
- const os = require$$2;
24850
25136
  const path$4 = require$$0$2;
24851
25137
  const colors = picocolorsExports;
24852
25138
  const childProcess = require$$2$1;
24853
25139
 
24854
25140
  const guessEditor = guessExports;
24855
- const getArgumentsForPosition = getArgs;
25141
+ const getArgumentsForFile = getArgs;
25142
+ const constructWindowsLaunchCommand = constructWindowsLaunchCommand_1;
25143
+ const parseFile = parseFile$1;
24856
25144
 
24857
25145
  function wrapErrorCallback(cb) {
24858
25146
  return (fileName, errorMessage) => {
@@ -24879,32 +25167,19 @@ function isTerminalEditor(editor) {
24879
25167
  return false
24880
25168
  }
24881
25169
 
24882
- const positionRE = /:(\d+)(:(\d+))?$/;
24883
- function parseFile(file) {
24884
- // support `file://` protocol
24885
- if (file.startsWith('file://')) {
24886
- file = require$$0$5.fileURLToPath(file);
24887
- }
24888
-
24889
- const fileName = file.replace(positionRE, '');
24890
- const match = file.match(positionRE);
24891
- const lineNumber = match && match[1];
24892
- const columnNumber = match && match[3];
24893
- return {
24894
- fileName,
24895
- lineNumber,
24896
- columnNumber,
24897
- }
24898
- }
24899
-
24900
25170
  let currentChildProcess = null;
24901
25171
 
24902
25172
  function launchEditor(file, specifiedEditor, onErrorCallback) {
24903
- const parsed = parseFile(file);
24904
- let { fileName } = parsed;
24905
- const { lineNumber, columnNumber } = parsed;
25173
+ const { fileName, lineNumber, columnNumber } = parseFile(file);
24906
25174
 
24907
- if (process.platform === 'win32' && path$4.resolve(fileName).startsWith('\\\\')) {
25175
+ if (typeof specifiedEditor === 'function') {
25176
+ onErrorCallback = specifiedEditor;
25177
+ specifiedEditor = undefined;
25178
+ }
25179
+
25180
+ onErrorCallback = wrapErrorCallback(onErrorCallback);
25181
+
25182
+ if (process.platform === 'win32' && fileName.startsWith('\\\\')) {
24908
25183
  return onErrorCallback(
24909
25184
  fileName,
24910
25185
  'UNC paths are not supported on Windows to avoid security issues. ' +
@@ -24916,38 +25191,23 @@ function launchEditor(file, specifiedEditor, onErrorCallback) {
24916
25191
  return
24917
25192
  }
24918
25193
 
24919
- if (typeof specifiedEditor === 'function') {
24920
- onErrorCallback = specifiedEditor;
24921
- specifiedEditor = undefined;
24922
- }
24923
-
24924
- onErrorCallback = wrapErrorCallback(onErrorCallback);
24925
-
24926
25194
  const [editor, ...args] = guessEditor(specifiedEditor);
24927
25195
  if (!editor) {
24928
25196
  onErrorCallback(fileName, null);
24929
25197
  return
24930
25198
  }
24931
25199
 
24932
- if (
24933
- process.platform === 'linux' &&
24934
- fileName.startsWith('/mnt/') &&
24935
- /Microsoft/i.test(os.release())
24936
- ) {
24937
- // Assume WSL / "Bash on Ubuntu on Windows" is being used, and
24938
- // that the file exists on the Windows file system.
24939
- // `os.release()` is "4.4.0-43-Microsoft" in the current release
24940
- // build of WSL, see: https://github.com/Microsoft/BashOnWindows/issues/423#issuecomment-221627364
24941
- // When a Windows editor is specified, interop functionality can
24942
- // handle the path translation, but only if a relative path is used.
24943
- fileName = path$4.relative('', fileName);
24944
- }
25200
+ const extraArgs = getArgumentsForFile(editor, fileName, lineNumber, columnNumber);
25201
+ args.push.apply(args, extraArgs);
24945
25202
 
24946
- if (lineNumber) {
24947
- const extraArgs = getArgumentsForPosition(editor, fileName, lineNumber, columnNumber);
24948
- args.push.apply(args, extraArgs);
24949
- } else {
24950
- args.push(fileName);
25203
+ let launchCommand;
25204
+ if (process.platform === 'win32') {
25205
+ try {
25206
+ launchCommand = constructWindowsLaunchCommand(editor, args);
25207
+ } catch (error) {
25208
+ onErrorCallback(fileName, error.message);
25209
+ return
25210
+ }
24951
25211
  }
24952
25212
 
24953
25213
  if (currentChildProcess && isTerminalEditor(editor)) {
@@ -24958,49 +25218,6 @@ function launchEditor(file, specifiedEditor, onErrorCallback) {
24958
25218
  }
24959
25219
 
24960
25220
  if (process.platform === 'win32') {
24961
- // On Windows, we need to use `exec` with the `shell: true` option,
24962
- // and some more sanitization is required.
24963
-
24964
- // However, CMD.exe on Windows is vulnerable to RCE attacks given a file name of the
24965
- // form "C:\Users\myusername\Downloads\& curl 172.21.93.52".
24966
- // `create-react-app` used a safe file name pattern to validate user-provided file names:
24967
- // - https://github.com/facebook/create-react-app/pull/4866
24968
- // - https://github.com/facebook/create-react-app/pull/5431
24969
- // But that's not a viable solution for this package because
24970
- // it's depended on by so many meta frameworks that heavily rely on
24971
- // special characters in file names for filesystem-based routing.
24972
- // We need to at least:
24973
- // - Support `+` because it's used in SvelteKit and Vike
24974
- // - Support `$` because it's used in Remix
24975
- // - Support `(` and `)` because they are used in Analog, SolidStart, and Vike
24976
- // - Support `@` because it's used in Vike
24977
- // - Support `[` and `]` because they are widely used for [slug]
24978
- // So here we choose to use `^` to escape special characters instead.
24979
-
24980
- // According to https://ss64.com/nt/syntax-esc.html,
24981
- // we can use `^` to escape `&`, `<`, `>`, `|`, `%`, and `^`
24982
- // I'm not sure if we have to escape all of these, but let's do it anyway
24983
- function escapeCmdArgs(cmdArgs) {
24984
- return cmdArgs.replace(/([&|<>,;=^])/g, '^$1')
24985
- }
24986
-
24987
- // Need to double quote the editor path in case it contains spaces;
24988
- // If the fileName contains spaces, we also need to double quote it in the arguments
24989
- // However, there's a case that it's concatenated with line number and column number
24990
- // which is separated by `:`. We need to double quote the whole string in this case.
24991
- // Also, if the string contains the escape character `^`, it needs to be quoted, too.
24992
- function doubleQuoteIfNeeded(str) {
24993
- if (str.includes('^')) {
24994
- // If a string includes an escaped character, not only does it need to be quoted,
24995
- // but the quotes need to be escaped too.
24996
- return `^"${str}^"`
24997
- } else if (str.includes(' ')) {
24998
- return `"${str}"`
24999
- }
25000
- return str
25001
- }
25002
- const launchCommand = [editor, ...args.map(escapeCmdArgs)].map(doubleQuoteIfNeeded).join(' ');
25003
-
25004
25221
  currentChildProcess = childProcess.exec(launchCommand, {
25005
25222
  stdio: 'inherit',
25006
25223
  shell: true,
@@ -25105,7 +25322,7 @@ async function resolveHttpsConfig(https) {
25105
25322
  }
25106
25323
  async function readFileIfExists(value) {
25107
25324
  if (typeof value === "string") {
25108
- return fsp.readFile(path$b.resolve(value)).catch(() => value);
25325
+ return fsp.readFile(path$c.resolve(value)).catch(() => value);
25109
25326
  }
25110
25327
  return value;
25111
25328
  }
@@ -25187,7 +25404,7 @@ function ssrRewriteStacktrace(stack, moduleGraph) {
25187
25404
  return input;
25188
25405
  }
25189
25406
  const trimmedVarName = varName?.trim();
25190
- const sourceFile = path$b.resolve(path$b.dirname(id), pos.source);
25407
+ const sourceFile = path$c.resolve(path$c.dirname(id), pos.source);
25191
25408
  const source = `${sourceFile}:${pos.line}:${pos.column + 1}`;
25192
25409
  if (!trimmedVarName || trimmedVarName === "eval") {
25193
25410
  return ` at ${source}`;
@@ -25941,7 +26158,7 @@ async function ssrTransformScript(code, inMap, url, originalCode) {
25941
26158
  map = inMap;
25942
26159
  } else {
25943
26160
  map = s.generateMap({ hires: "boundary" });
25944
- map.sources = [path$b.basename(url)];
26161
+ map.sources = [path$c.basename(url)];
25945
26162
  map.sourcesContent = [originalCode];
25946
26163
  if (inMap && inMap.mappings && "sources" in inMap && inMap.sources.length > 0) {
25947
26164
  map = combineSourcemaps(url, [
@@ -26342,8 +26559,8 @@ async function defaultBrowser() {
26342
26559
  }
26343
26560
 
26344
26561
  // Path to included `xdg-open`.
26345
- const __dirname = path$b.dirname(fileURLToPath$1(import.meta.url));
26346
- const localXdgOpenPath = path$b.join(__dirname, 'xdg-open');
26562
+ const __dirname = path$c.dirname(fileURLToPath$1(import.meta.url));
26563
+ const localXdgOpenPath = path$c.join(__dirname, 'xdg-open');
26347
26564
 
26348
26565
  const {platform, arch} = process$1;
26349
26566
 
@@ -27507,11 +27724,11 @@ const BASE_PREVIEW_SHORTCUTS = [
27507
27724
  ];
27508
27725
 
27509
27726
  function getResolvedOutDirs(root, outDir, outputOptions) {
27510
- const resolvedOutDir = path$b.resolve(root, outDir);
27727
+ const resolvedOutDir = path$c.resolve(root, outDir);
27511
27728
  if (!outputOptions) return /* @__PURE__ */ new Set([resolvedOutDir]);
27512
27729
  return new Set(
27513
27730
  arraify(outputOptions).map(
27514
- ({ dir }) => dir ? path$b.resolve(root, dir) : resolvedOutDir
27731
+ ({ dir }) => dir ? path$c.resolve(root, dir) : resolvedOutDir
27515
27732
  )
27516
27733
  );
27517
27734
  }
@@ -32433,7 +32650,7 @@ function createWebSocketServer(server, config, httpsOptions) {
32433
32650
  let hmrBase = config.base;
32434
32651
  const hmrPath = hmr ? hmr.path : void 0;
32435
32652
  if (hmrPath) {
32436
- hmrBase = path$b.posix.join(hmrBase, hmrPath);
32653
+ hmrBase = path$c.posix.join(hmrBase, hmrPath);
32437
32654
  }
32438
32655
  hmrServerWsListener = (req, socket, head) => {
32439
32656
  const protocol = req.headers["sec-websocket-protocol"];
@@ -34979,14 +35196,14 @@ function htmlFallbackMiddleware(root, spaFallback) {
34979
35196
  const url = cleanUrl(req.url);
34980
35197
  const pathname = decodeURIComponent(url);
34981
35198
  if (pathname.endsWith(".html")) {
34982
- const filePath = path$b.join(root, pathname);
35199
+ const filePath = path$c.join(root, pathname);
34983
35200
  if (fs__default.existsSync(filePath)) {
34984
35201
  debug$4?.(`Rewriting ${req.method} ${req.url} to ${url}`);
34985
35202
  req.url = url;
34986
35203
  return next();
34987
35204
  }
34988
35205
  } else if (pathname.endsWith("/")) {
34989
- const filePath = path$b.join(root, pathname, "index.html");
35206
+ const filePath = path$c.join(root, pathname, "index.html");
34990
35207
  if (fs__default.existsSync(filePath)) {
34991
35208
  const newUrl = url + "index.html";
34992
35209
  debug$4?.(`Rewriting ${req.method} ${req.url} to ${newUrl}`);
@@ -34994,7 +35211,7 @@ function htmlFallbackMiddleware(root, spaFallback) {
34994
35211
  return next();
34995
35212
  }
34996
35213
  } else {
34997
- const filePath = path$b.join(root, pathname + ".html");
35214
+ const filePath = path$c.join(root, pathname + ".html");
34998
35215
  if (fs__default.existsSync(filePath)) {
34999
35216
  const newUrl = url + ".html";
35000
35217
  debug$4?.(`Rewriting ${req.method} ${req.url} to ${newUrl}`);
@@ -35189,7 +35406,7 @@ function send$1(req, res, content, type, options) {
35189
35406
  type,
35190
35407
  code,
35191
35408
  ms.generateMap({
35192
- source: path$b.basename(urlWithoutTimestamp),
35409
+ source: path$c.basename(urlWithoutTimestamp),
35193
35410
  hires: "boundary",
35194
35411
  includeContent: true
35195
35412
  })
@@ -35522,7 +35739,7 @@ function serveStaticMiddleware(server) {
35522
35739
  );
35523
35740
  return function viteServeStaticMiddleware(req, res, next) {
35524
35741
  const cleanedUrl = cleanUrl(req.url);
35525
- if (cleanedUrl.endsWith("/") || path$b.extname(cleanedUrl) === ".html" || isInternalRequest(req.url) || // skip url starting with // as these will be interpreted as
35742
+ if (cleanedUrl.endsWith("/") || path$c.extname(cleanedUrl) === ".html" || isInternalRequest(req.url) || // skip url starting with // as these will be interpreted as
35526
35743
  // scheme relative URLs by new URL() and will not be a valid file path
35527
35744
  req.url?.startsWith("//")) {
35528
35745
  return next();
@@ -35543,7 +35760,7 @@ function serveStaticMiddleware(server) {
35543
35760
  }
35544
35761
  }
35545
35762
  const resolvedPathname = redirectedPathname || pathname;
35546
- let fileUrl = path$b.resolve(dir, removeLeadingSlash(resolvedPathname));
35763
+ let fileUrl = path$c.resolve(dir, removeLeadingSlash(resolvedPathname));
35547
35764
  if (resolvedPathname.endsWith("/") && fileUrl[fileUrl.length - 1] !== "/") {
35548
35765
  fileUrl = withTrailingSlash(fileUrl);
35549
35766
  }
@@ -35629,15 +35846,6 @@ function checkLoadingAccess(config, path2) {
35629
35846
  }
35630
35847
  return "fallback";
35631
35848
  }
35632
- function checkServingAccess(url, server) {
35633
- if (isFileServingAllowed(url, server)) {
35634
- return "allowed";
35635
- }
35636
- if (isFileReadable(cleanUrl(url))) {
35637
- return "denied";
35638
- }
35639
- return "fallback";
35640
- }
35641
35849
  function respondWithAccessDenied(url, server, res) {
35642
35850
  const urlMessage = `The request url "${url}" is outside of Vite serving allow list.`;
35643
35851
  const hintMessage = `
@@ -35827,7 +36035,7 @@ ${e}`, {
35827
36035
  }
35828
36036
  if (code == null) {
35829
36037
  const isPublicFile = checkPublicFile(url, environment.getTopLevelConfig());
35830
- let publicDirName = path$b.relative(config.root, config.publicDir);
36038
+ let publicDirName = path$c.relative(config.root, config.publicDir);
35831
36039
  if (publicDirName[0] !== ".") publicDirName = "/" + publicDirName;
35832
36040
  const msg = isPublicFile ? `This file is in ${publicDirName} and will be copied as-is during build without going through the plugin transforms, and therefore should not be imported from source code. It can only be referenced via HTML tags.` : `Does the file exist?`;
35833
36041
  const importerMod = moduleGraph.idToModuleMap.get(id)?.importers.values().next().value;
@@ -35874,14 +36082,14 @@ ${e}`, {
35874
36082
  config.server.sourcemapIgnoreList,
35875
36083
  logger
35876
36084
  );
35877
- if (path$b.isAbsolute(mod.file)) {
36085
+ if (path$c.isAbsolute(mod.file)) {
35878
36086
  let modDirname;
35879
36087
  for (let sourcesIndex = 0; sourcesIndex < normalizedMap.sources.length; ++sourcesIndex) {
35880
36088
  const sourcePath = normalizedMap.sources[sourcesIndex];
35881
36089
  if (sourcePath) {
35882
- if (path$b.isAbsolute(sourcePath)) {
35883
- modDirname ??= path$b.dirname(mod.file);
35884
- normalizedMap.sources[sourcesIndex] = path$b.relative(
36090
+ if (path$c.isAbsolute(sourcePath)) {
36091
+ modDirname ??= path$c.dirname(mod.file);
36092
+ normalizedMap.sources[sourcesIndex] = path$c.relative(
35885
36093
  modDirname,
35886
36094
  sourcePath
35887
36095
  );
@@ -36330,7 +36538,7 @@ function buildHtmlPlugin(config) {
36330
36538
  async handler(html, id) {
36331
36539
  if (id.endsWith(".html")) {
36332
36540
  id = normalizePath$3(id);
36333
- const relativeUrlPath = normalizePath$3(path$b.relative(config.root, id));
36541
+ const relativeUrlPath = normalizePath$3(path$c.relative(config.root, id));
36334
36542
  const publicPath = `/${relativeUrlPath}`;
36335
36543
  const publicBase = getBaseInHTML(relativeUrlPath, config);
36336
36544
  const publicToRelative = (filename) => publicBase + filename;
@@ -36701,7 +36909,7 @@ ${js}`;
36701
36909
  );
36702
36910
  for (const [normalizedId, html] of processedHtml(this)) {
36703
36911
  const relativeUrlPath = normalizePath$3(
36704
- path$b.relative(config.root, normalizedId)
36912
+ path$c.relative(config.root, normalizedId)
36705
36913
  );
36706
36914
  const assetsBase = getBaseInHTML(relativeUrlPath, config);
36707
36915
  const toOutputFilePath = (filename, type) => {
@@ -36815,7 +37023,7 @@ ${js}`;
36815
37023
  inlineEntryChunk.add(chunk.fileName);
36816
37024
  }
36817
37025
  const shortEmitName = normalizePath$3(
36818
- path$b.relative(config.root, normalizedId)
37026
+ path$c.relative(config.root, normalizedId)
36819
37027
  );
36820
37028
  this.emitFile({
36821
37029
  type: "asset",
@@ -36868,7 +37076,7 @@ function preImportMapHook(config) {
36868
37076
  if (importMapAppendIndex < 0) return;
36869
37077
  if (importMapAppendIndex < importMapIndex) {
36870
37078
  const relativeHtml = normalizePath$3(
36871
- path$b.relative(config.root, ctx.filename)
37079
+ path$c.relative(config.root, ctx.filename)
36872
37080
  );
36873
37081
  config.logger.warnOnce(
36874
37082
  colors$1.yellow(
@@ -36938,7 +37146,7 @@ function htmlEnvHook(config) {
36938
37146
  } else {
36939
37147
  if (envPrefix.some((prefix) => key.startsWith(prefix))) {
36940
37148
  const relativeHtml = normalizePath$3(
36941
- path$b.relative(config.root, ctx.filename)
37149
+ path$c.relative(config.root, ctx.filename)
36942
37150
  );
36943
37151
  config.logger.warn(
36944
37152
  colors$1.yellow(
@@ -37094,8 +37302,8 @@ function isEntirelyImport(code) {
37094
37302
  return !code.replace(importRE, "").replace(commentRE, "").trim().length;
37095
37303
  }
37096
37304
  function getBaseInHTML(urlRelativePath, config) {
37097
- return config.base === "./" || config.base === "" ? path$b.posix.join(
37098
- path$b.posix.relative(urlRelativePath, "").slice(0, -2),
37305
+ return config.base === "./" || config.base === "" ? path$c.posix.join(
37306
+ path$c.posix.relative(urlRelativePath, "").slice(0, -2),
37099
37307
  "./"
37100
37308
  ) : config.base;
37101
37309
  }
@@ -37221,25 +37429,10 @@ function decodeURIIfPossible(input) {
37221
37429
 
37222
37430
  const debugCache = createDebugger("vite:cache");
37223
37431
  const knownIgnoreList = /* @__PURE__ */ new Set(["/", "/favicon.ico"]);
37224
- const trailingQuerySeparatorsRE = /[?&]+$/;
37225
37432
  const urlRE = /[?&]url\b/;
37226
37433
  const rawRE = /[?&]raw\b/;
37227
37434
  const inlineRE$2 = /[?&]inline\b/;
37228
37435
  const svgRE = /\.svg\b/;
37229
- function deniedServingAccessForTransform(url, server, res, next) {
37230
- if (rawRE.test(url) || urlRE.test(url) || inlineRE$2.test(url) || svgRE.test(url)) {
37231
- const servingAccessResult = checkServingAccess(url, server);
37232
- if (servingAccessResult === "denied") {
37233
- respondWithAccessDenied(url, server, res);
37234
- return true;
37235
- }
37236
- if (servingAccessResult === "fallback") {
37237
- next();
37238
- return true;
37239
- }
37240
- }
37241
- return false;
37242
- }
37243
37436
  function isServerAccessDeniedForTransform(config, id) {
37244
37437
  if (rawRE.test(id) || urlRE.test(id) || inlineRE$2.test(id) || svgRE.test(id)) {
37245
37438
  return checkLoadingAccess(config, id) !== "allowed";
@@ -37294,7 +37487,7 @@ function transformMiddleware(server) {
37294
37487
  if (isSourceMap) {
37295
37488
  const depsOptimizer = environment.depsOptimizer;
37296
37489
  if (depsOptimizer?.isOptimizedDepUrl(url)) {
37297
- const sourcemapPath = url.startsWith(FS_PREFIX) ? fsPathFromId(url) : normalizePath$3(path$b.resolve(server.config.root, url.slice(1)));
37490
+ const sourcemapPath = url.startsWith(FS_PREFIX) ? fsPathFromId(url) : normalizePath$3(path$c.resolve(server.config.root, url.slice(1)));
37298
37491
  if (!depsOptimizer.isOptimizedDepFile(sourcemapPath)) {
37299
37492
  return next();
37300
37493
  }
@@ -37340,18 +37533,6 @@ function transformMiddleware(server) {
37340
37533
  if (publicDirInRoot && url.startsWith(publicPath)) {
37341
37534
  warnAboutExplicitPublicPathInUrl(url);
37342
37535
  }
37343
- const urlWithoutTrailingQuerySeparators = url.replace(
37344
- trailingQuerySeparatorsRE,
37345
- ""
37346
- );
37347
- if (deniedServingAccessForTransform(
37348
- urlWithoutTrailingQuerySeparators,
37349
- server,
37350
- res,
37351
- next
37352
- )) {
37353
- return;
37354
- }
37355
37536
  if (req.headers["sec-fetch-dest"] === "script" || isJSRequest(url) || isImportRequest(url) || isCSSRequest(url) || isHTMLProxy(url)) {
37356
37537
  url = removeImportQuery(url);
37357
37538
  url = unwrapId$1(url);
@@ -37497,11 +37678,12 @@ function createDevHtmlTransformFn(config) {
37497
37678
  };
37498
37679
  }
37499
37680
  function getHtmlFilename(url, server) {
37500
- if (url.startsWith(FS_PREFIX)) {
37501
- return decodeURIComponent(fsPathFromId(url));
37681
+ const urlPath = cleanUrl(url);
37682
+ if (urlPath.startsWith(FS_PREFIX)) {
37683
+ return decodeURIComponent(fsPathFromId(urlPath));
37502
37684
  } else {
37503
37685
  return decodeURIComponent(
37504
- normalizePath$3(path$b.join(server.config.root, url.slice(1)))
37686
+ normalizePath$3(path$c.join(server.config.root, urlPath.slice(1)))
37505
37687
  );
37506
37688
  }
37507
37689
  }
@@ -37512,6 +37694,7 @@ const wordCharRE = /\w/;
37512
37694
  function isBareRelative(url) {
37513
37695
  return wordCharRE.test(url[0]) && !url.includes(":");
37514
37696
  }
37697
+ const multipleLeadingSlashesRE = /^\/{2,}/g;
37515
37698
  const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, server, isClassicScriptLink) => {
37516
37699
  const replacer = (url2) => {
37517
37700
  if (url2[0] === "/" && url2[1] !== "/" || // #3230 if some request url (localhost:3000/a/b) return to fallback html, the relative assets
@@ -37523,16 +37706,16 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
37523
37706
  // rewrite `../index.js` -> `localhost:5173/index.js`.
37524
37707
  // rewrite `relative/index.js` -> `localhost:5173/a/relative/index.js`.
37525
37708
  (url2[0] === "." || isBareRelative(url2)) && originalUrl && originalUrl !== "/" && htmlPath === "/index.html") {
37526
- url2 = path$b.posix.join(config.base, url2);
37709
+ url2 = path$c.posix.join(config.base, url2);
37527
37710
  }
37528
37711
  let preTransformUrl;
37529
37712
  if (!isClassicScriptLink && shouldPreTransform(url2, config)) {
37530
37713
  if (url2[0] === "/" && url2[1] !== "/") {
37531
37714
  preTransformUrl = url2;
37532
37715
  } else if (url2[0] === "." || isBareRelative(url2)) {
37533
- preTransformUrl = path$b.posix.join(
37716
+ preTransformUrl = path$c.posix.join(
37534
37717
  config.base,
37535
- path$b.posix.dirname(htmlPath),
37718
+ path$c.posix.dirname(htmlPath),
37536
37719
  url2
37537
37720
  );
37538
37721
  }
@@ -37559,6 +37742,9 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
37559
37742
  return processedUrl;
37560
37743
  };
37561
37744
  const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl }) => {
37745
+ if (htmlPath.startsWith("//")) {
37746
+ htmlPath = htmlPath.replace(multipleLeadingSlashesRE, "/");
37747
+ }
37562
37748
  const { config, watcher } = server;
37563
37749
  const base = config.base || "/";
37564
37750
  const decodedBase = config.decodedBase || "/";
@@ -37740,7 +37926,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
37740
37926
  tag: "script",
37741
37927
  attrs: {
37742
37928
  type: "module",
37743
- src: path$b.posix.join(base, CLIENT_PUBLIC_PATH)
37929
+ src: path$c.posix.join(base, CLIENT_PUBLIC_PATH)
37744
37930
  },
37745
37931
  injectTo: "head-prepend"
37746
37932
  }
@@ -37760,7 +37946,7 @@ function indexHtmlMiddleware(root, server) {
37760
37946
  filePath = decodeURIComponent(fsPathFromId(url));
37761
37947
  } else {
37762
37948
  filePath = normalizePath$3(
37763
- path$b.resolve(path$b.join(root, decodeURIComponent(url)))
37949
+ path$c.resolve(path$c.join(root, decodeURIComponent(url)))
37764
37950
  );
37765
37951
  }
37766
37952
  if (isDev) {
@@ -38940,7 +39126,7 @@ function createServerCloseFn(server) {
38940
39126
  });
38941
39127
  }
38942
39128
  function resolvedAllowDir(root, dir) {
38943
- return normalizePath$3(path$b.resolve(root, dir));
39129
+ return normalizePath$3(path$c.resolve(root, dir));
38944
39130
  }
38945
39131
  const serverConfigDefaults = Object.freeze({
38946
39132
  port: DEFAULT_DEV_PORT,
@@ -39107,7 +39293,7 @@ const debugHmr = createDebugger("vite:hmr");
39107
39293
  const whitespaceRE = /\s/;
39108
39294
  const normalizedClientDir = normalizePath$3(CLIENT_DIR);
39109
39295
  function getShortName(file, root) {
39110
- return file.startsWith(withTrailingSlash(root)) ? path$b.posix.relative(root, file) : file;
39296
+ return file.startsWith(withTrailingSlash(root)) ? path$c.posix.relative(root, file) : file;
39111
39297
  }
39112
39298
  const normalizeHotChannel = (channel, enableHmr, normalizeClient = true) => {
39113
39299
  const normalizedListenerMap = /* @__PURE__ */ new WeakMap();
@@ -39278,7 +39464,7 @@ async function handleHMRUpdate(type, file, server) {
39278
39464
  config.logger.info(
39279
39465
  colors$1.green(
39280
39466
  `${normalizePath$3(
39281
- path$b.relative(process.cwd(), file)
39467
+ path$c.relative(process.cwd(), file)
39282
39468
  )} changed, restarting server...`
39283
39469
  ),
39284
39470
  { clear: true, timestamp: true }
@@ -39296,7 +39482,7 @@ async function handleHMRUpdate(type, file, server) {
39296
39482
  ({ hot }) => hot.send({
39297
39483
  type: "full-reload",
39298
39484
  path: "*",
39299
- triggeredBy: path$b.resolve(config.root, file)
39485
+ triggeredBy: path$c.resolve(config.root, file)
39300
39486
  })
39301
39487
  );
39302
39488
  return;
@@ -39438,7 +39624,7 @@ async function handleHMRUpdate(type, file, server) {
39438
39624
  );
39439
39625
  environment.hot.send({
39440
39626
  type: "full-reload",
39441
- path: config.server.middlewareMode ? "*" : "/" + normalizePath$3(path$b.relative(config.root, file))
39627
+ path: config.server.middlewareMode ? "*" : "/" + normalizePath$3(path$c.relative(config.root, file))
39442
39628
  });
39443
39629
  } else {
39444
39630
  debugHmr?.(
@@ -39514,7 +39700,7 @@ function updateModules(environment, file, modules, timestamp, firstInvalidatedBy
39514
39700
  );
39515
39701
  hot.send({
39516
39702
  type: "full-reload",
39517
- triggeredBy: path$b.resolve(environment.config.root, file)
39703
+ triggeredBy: path$c.resolve(environment.config.root, file)
39518
39704
  });
39519
39705
  return;
39520
39706
  }
@@ -40072,15 +40258,15 @@ async function bundleWorkerEntry(config, id) {
40072
40258
  const {
40073
40259
  output: [outputChunk, ...outputChunks]
40074
40260
  } = await bundle.generate({
40075
- entryFileNames: path$b.posix.join(
40261
+ entryFileNames: path$c.posix.join(
40076
40262
  config.build.assetsDir,
40077
40263
  "[name]-[hash].js"
40078
40264
  ),
40079
- chunkFileNames: path$b.posix.join(
40265
+ chunkFileNames: path$c.posix.join(
40080
40266
  config.build.assetsDir,
40081
40267
  "[name]-[hash].js"
40082
40268
  ),
40083
- assetFileNames: path$b.posix.join(
40269
+ assetFileNames: path$c.posix.join(
40084
40270
  config.build.assetsDir,
40085
40271
  "[name]-[hash].[ext]"
40086
40272
  ),
@@ -40204,7 +40390,7 @@ function webWorkerPlugin(config) {
40204
40390
  const workerType2 = workerFileMatch[1];
40205
40391
  let injectEnv = "";
40206
40392
  const scriptPath = JSON.stringify(
40207
- path$b.posix.join(config.base, ENV_PUBLIC_PATH)
40393
+ path$c.posix.join(config.base, ENV_PUBLIC_PATH)
40208
40394
  );
40209
40395
  if (workerType2 === "classic") {
40210
40396
  injectEnv = `importScripts(${scriptPath})
@@ -40418,7 +40604,7 @@ function preAliasPlugin(config) {
40418
40604
  const optimizeDeps = depsOptimizer.options;
40419
40605
  const resolvedId = cleanUrl(resolved.id);
40420
40606
  const isVirtual = resolvedId === id || resolvedId.includes("\0");
40421
- if (!isVirtual && fs__default.existsSync(resolvedId) && !moduleListContains(optimizeDeps.exclude, id) && path$b.isAbsolute(resolvedId) && (isInNodeModules$1(resolvedId) || optimizeDeps.include?.includes(id)) && isOptimizable(resolvedId, optimizeDeps) && (!ssr || optimizeAliasReplacementForSSR(resolvedId, optimizeDeps))) {
40607
+ if (!isVirtual && fs__default.existsSync(resolvedId) && !moduleListContains(optimizeDeps.exclude, id) && path$c.isAbsolute(resolvedId) && (isInNodeModules$1(resolvedId) || optimizeDeps.include?.includes(id)) && isOptimizable(resolvedId, optimizeDeps) && (!ssr || optimizeAliasReplacementForSSR(resolvedId, optimizeDeps))) {
40422
40608
  const optimizedInfo = depsOptimizer.registerMissingImport(
40423
40609
  id,
40424
40610
  resolvedId
@@ -40481,8 +40667,8 @@ function normalizeResolvedIdToUrl(environment, url, resolved) {
40481
40667
  } else if (depsOptimizer?.isOptimizedDepFile(resolved.id) || // vite-plugin-react isn't following the leading \0 virtual module convention.
40482
40668
  // This is a temporary hack to avoid expensive fs checks for React apps.
40483
40669
  // We'll remove this as soon we're able to fix the react plugins.
40484
- resolved.id !== "/@react-refresh" && path$b.isAbsolute(resolved.id) && fs__default.existsSync(cleanUrl(resolved.id))) {
40485
- url = path$b.posix.join(FS_PREFIX, resolved.id);
40670
+ resolved.id !== "/@react-refresh" && path$c.isAbsolute(resolved.id) && fs__default.existsSync(cleanUrl(resolved.id))) {
40671
+ url = path$c.posix.join(FS_PREFIX, resolved.id);
40486
40672
  } else {
40487
40673
  url = resolved.id;
40488
40674
  }
@@ -40532,7 +40718,7 @@ function extractImportedBindings(id, source, importSpec, importedBindings) {
40532
40718
  }
40533
40719
  function importAnalysisPlugin(config) {
40534
40720
  const { root, base } = config;
40535
- const clientPublicPath = path$b.posix.join(base, CLIENT_PUBLIC_PATH);
40721
+ const clientPublicPath = path$c.posix.join(base, CLIENT_PUBLIC_PATH);
40536
40722
  const enablePartialAccept = config.experimental.hmrPartialAccept;
40537
40723
  const matchAlias = getAliasPatternMatcher(config.resolve.alias);
40538
40724
  let _env;
@@ -40606,7 +40792,7 @@ function importAnalysisPlugin(config) {
40606
40792
  const str = () => s || (s = new MagicString(source));
40607
40793
  let isPartiallySelfAccepting = false;
40608
40794
  const importedBindings = enablePartialAccept ? /* @__PURE__ */ new Map() : null;
40609
- const toAbsoluteUrl = (url) => path$b.posix.resolve(path$b.posix.dirname(importerModule.url), url);
40795
+ const toAbsoluteUrl = (url) => path$c.posix.resolve(path$c.posix.dirname(importerModule.url), url);
40610
40796
  const normalizeUrl = async (url, pos, forceSkipImportAnalysis = false) => {
40611
40797
  url = stripBase(url, base);
40612
40798
  let importerFile = importer;
@@ -40633,7 +40819,7 @@ function importAnalysisPlugin(config) {
40633
40819
  moduleGraph._hasResolveFailedErrorModules.add(importerModule);
40634
40820
  return this.error(
40635
40821
  `Failed to resolve import "${url}" from "${normalizePath$3(
40636
- path$b.relative(process.cwd(), importerFile)
40822
+ path$c.relative(process.cwd(), importerFile)
40637
40823
  )}". Does the file exist?`,
40638
40824
  pos
40639
40825
  );
@@ -40751,8 +40937,10 @@ function importAnalysisPlugin(config) {
40751
40937
  );
40752
40938
  }
40753
40939
  let [url, resolvedId] = await normalizeUrl(specifier, start);
40940
+ if (resolvedId) {
40941
+ config.safeModulePaths.add(cleanUrl(resolvedId));
40942
+ }
40754
40943
  resolvedId = resolvedId || url;
40755
- config.safeModulePaths.add(fsPathFromUrl(stripBase(url, base)));
40756
40944
  if (url !== specifier) {
40757
40945
  let rewriteDone = false;
40758
40946
  if (depsOptimizer?.isOptimizedDepFile(resolvedId) && !optimizedDepChunkRE.test(resolvedId)) {
@@ -40977,9 +41165,9 @@ function createParseErrorInfo(importer, source) {
40977
41165
  const probablyBinary = source.includes(
40978
41166
  "\uFFFD"
40979
41167
  );
40980
- const msg = isVue ? `Install @vitejs/plugin-vue to handle .vue files.` : maybeJSX ? isJsx ? `If you use tsconfig.json, make sure to not set jsx to preserve.` : `If you are using JSX, make sure to name the file with the .jsx or .tsx extension.` : `You may need to install appropriate plugins to handle the ${path$b.extname(
41168
+ const msg = isVue ? `Install @vitejs/plugin-vue to handle .vue files.` : maybeJSX ? isJsx ? `If you use tsconfig.json, make sure to not set jsx to preserve.` : `If you are using JSX, make sure to name the file with the .jsx or .tsx extension.` : `You may need to install appropriate plugins to handle the ${path$c.extname(
40981
41169
  importer
40982
- )} file format, or if it's an asset, add "**/*${path$b.extname(
41170
+ )} file format, or if it's an asset, add "**/*${path$c.extname(
40983
41171
  importer
40984
41172
  )}" to \`assetsInclude\` in your configuration.`;
40985
41173
  return {
@@ -41152,7 +41340,7 @@ function clientInjectionsPlugin(config) {
41152
41340
  const timeout = hmrConfig?.timeout || 3e4;
41153
41341
  const overlay = hmrConfig?.overlay !== false;
41154
41342
  const isHmrServerSpecified = !!hmrConfig?.server;
41155
- const hmrConfigName = path$b.basename(config.configFile || "vite.config.js");
41343
+ const hmrConfigName = path$c.basename(config.configFile || "vite.config.js");
41156
41344
  let port = hmrConfig?.clientPort || hmrConfig?.port || null;
41157
41345
  if (config.server.middlewareMode && !isHmrServerSpecified) {
41158
41346
  port ||= 24678;
@@ -41162,7 +41350,7 @@ function clientInjectionsPlugin(config) {
41162
41350
  directTarget += devBase;
41163
41351
  let hmrBase = devBase;
41164
41352
  if (hmrConfig?.path) {
41165
- hmrBase = path$b.posix.join(hmrBase, hmrConfig.path);
41353
+ hmrBase = path$c.posix.join(hmrBase, hmrConfig.path);
41166
41354
  }
41167
41355
  const modeReplacement = escapeReplacement(config.mode);
41168
41356
  const baseReplacement = escapeReplacement(devBase);
@@ -41432,7 +41620,7 @@ function workerImportMetaUrlPlugin(config) {
41432
41620
  const url = rawUrl.slice(1, -1);
41433
41621
  let file;
41434
41622
  if (url[0] === ".") {
41435
- file = path$b.resolve(path$b.dirname(id), url);
41623
+ file = path$c.resolve(path$c.dirname(id), url);
41436
41624
  file = slash$1(tryFsResolve(file, fsResolveOptions) ?? file);
41437
41625
  } else {
41438
41626
  workerResolver ??= createBackCompatIdResolver(config, {
@@ -41441,7 +41629,7 @@ function workerImportMetaUrlPlugin(config) {
41441
41629
  preferRelative: true
41442
41630
  });
41443
41631
  file = await workerResolver(this.environment, url, id);
41444
- file ??= url[0] === "/" ? slash$1(path$b.join(config.publicDir, url)) : slash$1(path$b.resolve(path$b.dirname(id), url));
41632
+ file ??= url[0] === "/" ? slash$1(path$c.join(config.publicDir, url)) : slash$1(path$c.resolve(path$c.dirname(id), url));
41445
41633
  }
41446
41634
  if (isBuild && config.isWorker && config.bundleChain.at(-1) === cleanUrl(file)) {
41447
41635
  s.update(expStart, expEnd, "self.location.href");
@@ -41537,7 +41725,7 @@ function assetImportMetaUrlPlugin(config) {
41537
41725
  }
41538
41726
  let file;
41539
41727
  if (url[0] === ".") {
41540
- file = slash$1(path$b.resolve(path$b.dirname(id), url));
41728
+ file = slash$1(path$c.resolve(path$c.dirname(id), url));
41541
41729
  file = tryFsResolve(file, fsResolveOptions) ?? file;
41542
41730
  } else {
41543
41731
  assetResolver ??= createBackCompatIdResolver(config, {
@@ -41547,13 +41735,13 @@ function assetImportMetaUrlPlugin(config) {
41547
41735
  preferRelative: true
41548
41736
  });
41549
41737
  file = await assetResolver(this.environment, url, id);
41550
- file ??= url[0] === "/" ? slash$1(path$b.join(publicDir, url)) : slash$1(path$b.resolve(path$b.dirname(id), url));
41738
+ file ??= url[0] === "/" ? slash$1(path$c.join(publicDir, url)) : slash$1(path$c.resolve(path$c.dirname(id), url));
41551
41739
  }
41552
41740
  let builtUrl;
41553
41741
  if (file) {
41554
41742
  try {
41555
41743
  if (publicDir && isParentDirectory(publicDir, file)) {
41556
- const publicPath = "/" + path$b.posix.relative(publicDir, file);
41744
+ const publicPath = "/" + path$c.posix.relative(publicDir, file);
41557
41745
  builtUrl = await fileToUrl$1(this, publicPath);
41558
41746
  } else {
41559
41747
  builtUrl = await fileToUrl$1(this, file);
@@ -41935,10 +42123,10 @@ function dynamicImportVarsPlugin(config) {
41935
42123
  }
41936
42124
 
41937
42125
  function getMatcherString(glob, cwd) {
41938
- if (glob.startsWith("**") || path$b.isAbsolute(glob)) {
42126
+ if (glob.startsWith("**") || path$c.isAbsolute(glob)) {
41939
42127
  return slash$1(glob);
41940
42128
  }
41941
- const resolved = path$b.join(cwd, glob);
42129
+ const resolved = path$c.join(cwd, glob);
41942
42130
  return slash$1(resolved);
41943
42131
  }
41944
42132
  function patternToIdFilter(pattern, cwd) {
@@ -43156,13 +43344,13 @@ function cssPostPlugin(config) {
43156
43344
  const rollupOptionsOutput = config.build.rollupOptions.output;
43157
43345
  const assetFileNames = (Array.isArray(rollupOptionsOutput) ? rollupOptionsOutput[0] : rollupOptionsOutput)?.assetFileNames;
43158
43346
  const getCssAssetDirname = (cssAssetName) => {
43159
- const cssAssetNameDir = path$b.dirname(cssAssetName);
43347
+ const cssAssetNameDir = path$c.dirname(cssAssetName);
43160
43348
  if (!assetFileNames) {
43161
- return path$b.join(config.build.assetsDir, cssAssetNameDir);
43349
+ return path$c.join(config.build.assetsDir, cssAssetNameDir);
43162
43350
  } else if (typeof assetFileNames === "string") {
43163
- return path$b.join(path$b.dirname(assetFileNames), cssAssetNameDir);
43351
+ return path$c.join(path$c.dirname(assetFileNames), cssAssetNameDir);
43164
43352
  } else {
43165
- return path$b.dirname(
43353
+ return path$c.dirname(
43166
43354
  assetFileNames({
43167
43355
  type: "asset",
43168
43356
  name: cssAssetName,
@@ -43245,7 +43433,7 @@ function cssPostPlugin(config) {
43245
43433
  const cssContent = await getContentWithSourcemap(css);
43246
43434
  const code2 = [
43247
43435
  `import { updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle } from ${JSON.stringify(
43248
- path$b.posix.join(config.base, CLIENT_PUBLIC_PATH)
43436
+ path$c.posix.join(config.base, CLIENT_PUBLIC_PATH)
43249
43437
  )}`,
43250
43438
  `const __vite__id = ${JSON.stringify(id)}`,
43251
43439
  `const __vite__css = ${JSON.stringify(cssContent)}`,
@@ -43323,7 +43511,7 @@ function cssPostPlugin(config) {
43323
43511
  const cssAssetDirname = encodedPublicUrls || relative ? slash$1(getCssAssetDirname(cssAssetName)) : void 0;
43324
43512
  const toRelative = (filename) => {
43325
43513
  const relativePath = normalizePath$3(
43326
- path$b.relative(cssAssetDirname, filename)
43514
+ path$c.relative(cssAssetDirname, filename)
43327
43515
  );
43328
43516
  return relativePath[0] === "." ? relativePath : "./" + relativePath;
43329
43517
  };
@@ -43343,7 +43531,7 @@ function cssPostPlugin(config) {
43343
43531
  });
43344
43532
  if (encodedPublicUrls) {
43345
43533
  const relativePathToPublicFromCSS = normalizePath$3(
43346
- path$b.relative(cssAssetDirname, "")
43534
+ path$c.relative(cssAssetDirname, "")
43347
43535
  );
43348
43536
  chunkCSS2 = chunkCSS2.replace(publicAssetUrlRE, (_, hash) => {
43349
43537
  const publicUrl = publicAssetUrlMap.get(hash).slice(1);
@@ -43363,7 +43551,7 @@ function cssPostPlugin(config) {
43363
43551
  };
43364
43552
  function ensureFileExt(name, ext) {
43365
43553
  return normalizePath$3(
43366
- path$b.format({ ...path$b.parse(name), base: void 0, ext })
43554
+ path$c.format({ ...path$c.parse(name), base: void 0, ext })
43367
43555
  );
43368
43556
  }
43369
43557
  let s;
@@ -43376,7 +43564,7 @@ function cssPostPlugin(config) {
43376
43564
  const id = Buffer.from(idHex, "hex").toString();
43377
43565
  const originalFileName = cleanUrl(id);
43378
43566
  const cssAssetName = ensureFileExt(
43379
- path$b.basename(originalFileName),
43567
+ path$c.basename(originalFileName),
43380
43568
  ".css"
43381
43569
  );
43382
43570
  if (!styles.has(id)) {
@@ -43443,7 +43631,7 @@ function cssPostPlugin(config) {
43443
43631
  if (opts.format === "es" || opts.format === "cjs") {
43444
43632
  const isEntry = chunk.isEntry && isPureCssChunk;
43445
43633
  const cssFullAssetName = ensureFileExt(chunk.name, ".css");
43446
- const cssAssetName = chunk.isEntry && (!chunk.facadeModuleId || !isCSSRequest(chunk.facadeModuleId)) ? path$b.basename(cssFullAssetName) : cssFullAssetName;
43634
+ const cssAssetName = chunk.isEntry && (!chunk.facadeModuleId || !isCSSRequest(chunk.facadeModuleId)) ? path$c.basename(cssFullAssetName) : cssFullAssetName;
43447
43635
  const originalFileName = getChunkOriginalFileName(
43448
43636
  chunk,
43449
43637
  config.root,
@@ -43660,7 +43848,7 @@ function isCssScopeToRendered(cssScopeTo, renderedModules) {
43660
43848
  return importer && (exp === void 0 || importer.renderedExports.includes(exp));
43661
43849
  }
43662
43850
  function getEmptyChunkReplacer(pureCssChunkNames, outputFormat) {
43663
- const emptyChunkFiles = pureCssChunkNames.map((file) => escapeRegex(path$b.basename(file))).join("|");
43851
+ const emptyChunkFiles = pureCssChunkNames.map((file) => escapeRegex(path$c.basename(file))).join("|");
43664
43852
  const emptyChunkRE = new RegExp(
43665
43853
  outputFormat === "es" ? `\\bimport\\s*["'][^"']*(?:${emptyChunkFiles})["'];` : `(\\b|,\\s*)require\\(\\s*["'][^"']*(?:${emptyChunkFiles})["']\\)(;|,)`,
43666
43854
  "g"
@@ -43868,12 +44056,12 @@ async function compilePostCSS(environment, id, code, deps, lang, workerControlle
43868
44056
  const resolved = await atImportResolvers.css(
43869
44057
  environment,
43870
44058
  id2,
43871
- path$b.join(basedir, "*")
44059
+ path$c.join(basedir, "*")
43872
44060
  );
43873
44061
  if (resolved) {
43874
- return path$b.resolve(resolved);
44062
+ return path$c.resolve(resolved);
43875
44063
  }
43876
- if (!path$b.isAbsolute(id2)) {
44064
+ if (!path$c.isAbsolute(id2)) {
43877
44065
  environment.logger.error(
43878
44066
  colors$1.red(
43879
44067
  `Unable to resolve \`@import "${id2}"\` from ${basedir}`
@@ -43937,7 +44125,7 @@ async function compilePostCSS(environment, id, code, deps, lang, workerControlle
43937
44125
  importer
43938
44126
  );
43939
44127
  if (resolved) {
43940
- return path$b.resolve(resolved);
44128
+ return path$c.resolve(resolved);
43941
44129
  }
43942
44130
  }
43943
44131
  return id2;
@@ -44003,7 +44191,7 @@ async function runPostCSS(id, code, plugins, options, deps, logger, enableSource
44003
44191
  const { dir, glob: globPattern = "**" } = message;
44004
44192
  const files = globSync(globPattern, {
44005
44193
  absolute: true,
44006
- cwd: path$b.resolve(path$b.dirname(id), dir),
44194
+ cwd: path$c.resolve(path$c.dirname(id), dir),
44007
44195
  expandDirectories: false,
44008
44196
  ignore: ["**/node_modules/**"]
44009
44197
  });
@@ -44071,8 +44259,8 @@ function createCachedImport(imp) {
44071
44259
  return cached;
44072
44260
  };
44073
44261
  }
44074
- const importPostcssImport = createCachedImport(() => import('./dep-CV-fz3CQ.js').then(function (n) { return n.i; }));
44075
- const importPostcssModules = createCachedImport(() => import('./dep-DDtvSN7_.js').then(function (n) { return n.i; }));
44262
+ const importPostcssImport = createCachedImport(() => import('./dep-D2Nv_XqQ.js').then(function (n) { return n.i; }));
44263
+ const importPostcssModules = createCachedImport(() => import('./dep-nQZNP8DK.js').then(function (n) { return n.i; }));
44076
44264
  const importPostcss = createCachedImport(() => import('postcss'));
44077
44265
  const preprocessorWorkerControllerCache = /* @__PURE__ */ new WeakMap();
44078
44266
  let alwaysFakeWorkerWorkerControllerCache;
@@ -44089,13 +44277,13 @@ async function preprocessCSS(code, filename, config) {
44089
44277
  return await compileCSS(environment, filename, code, workerController);
44090
44278
  }
44091
44279
  async function formatPostcssSourceMap(rawMap, file) {
44092
- const inputFileDir = path$b.dirname(file);
44280
+ const inputFileDir = path$c.dirname(file);
44093
44281
  const sources = rawMap.sources.map((source) => {
44094
44282
  const cleanSource = cleanUrl(decodeURIComponent(source));
44095
44283
  if (cleanSource[0] === "<" && cleanSource.endsWith(">")) {
44096
44284
  return `\0${cleanSource}`;
44097
44285
  }
44098
- return normalizePath$3(path$b.resolve(inputFileDir, cleanSource));
44286
+ return normalizePath$3(path$c.resolve(inputFileDir, cleanSource));
44099
44287
  });
44100
44288
  return {
44101
44289
  file,
@@ -44661,7 +44849,7 @@ const makeModernCompilerScssWorker = (environment, resolvers, alias, _maxWorkers
44661
44849
  return null;
44662
44850
  },
44663
44851
  async load(canonicalUrl) {
44664
- const ext = path$b.extname(canonicalUrl.pathname);
44852
+ const ext = path$c.extname(canonicalUrl.pathname);
44665
44853
  let syntax = "scss";
44666
44854
  if (ext === ".sass") {
44667
44855
  syntax = "indented";
@@ -44777,9 +44965,9 @@ const scssProcessor = (maxWorkers) => {
44777
44965
  };
44778
44966
  };
44779
44967
  async function rebaseUrls(environment, file, rootFile, alias, variablePrefix, resolver) {
44780
- file = path$b.resolve(file);
44781
- const fileDir = path$b.dirname(file);
44782
- const rootDir = path$b.dirname(rootFile);
44968
+ file = path$c.resolve(file);
44969
+ const fileDir = path$c.dirname(file);
44970
+ const rootDir = path$c.dirname(rootFile);
44783
44971
  if (fileDir === rootDir) {
44784
44972
  return { file };
44785
44973
  }
@@ -44800,8 +44988,8 @@ async function rebaseUrls(environment, file, rootFile, alias, variablePrefix, re
44800
44988
  return url;
44801
44989
  }
44802
44990
  }
44803
- const absolute = await resolver(environment, url, file) || path$b.resolve(fileDir, url);
44804
- const relative = path$b.relative(rootDir, absolute);
44991
+ const absolute = await resolver(environment, url, file) || path$c.resolve(fileDir, url);
44992
+ const relative = path$c.relative(rootDir, absolute);
44805
44993
  return normalizePath$3(relative);
44806
44994
  };
44807
44995
  if (hasImportCss) {
@@ -44823,11 +45011,11 @@ const makeLessWorker = (environment, resolvers, alias, maxWorkers) => {
44823
45011
  const resolved = await resolvers.less(
44824
45012
  environment,
44825
45013
  filename,
44826
- path$b.join(dir, "*")
45014
+ path$c.join(dir, "*")
44827
45015
  );
44828
45016
  if (!resolved) return void 0;
44829
45017
  if (mime === "application/javascript") {
44830
- const file = path$b.resolve(resolved);
45018
+ const file = path$c.resolve(resolved);
44831
45019
  return { resolved: file };
44832
45020
  }
44833
45021
  const result = await rebaseUrls(
@@ -45037,7 +45225,7 @@ const stylProcessor = (maxWorkers) => {
45037
45225
  "\n"
45038
45226
  );
45039
45227
  const importsDeps = (options.imports ?? []).map(
45040
- (dep) => path$b.resolve(dep)
45228
+ (dep) => path$c.resolve(dep)
45041
45229
  );
45042
45230
  const optionsWithoutAdditionalData = {
45043
45231
  ...options,
@@ -45069,7 +45257,7 @@ const stylProcessor = (maxWorkers) => {
45069
45257
  function formatStylusSourceMap(mapBefore, root) {
45070
45258
  if (!mapBefore) return void 0;
45071
45259
  const map2 = { ...mapBefore };
45072
- const resolveFromRoot = (p) => normalizePath$3(path$b.resolve(root, p));
45260
+ const resolveFromRoot = (p) => normalizePath$3(path$c.resolve(root, p));
45073
45261
  if (map2.file) {
45074
45262
  map2.file = resolveFromRoot(map2.file);
45075
45263
  }
@@ -45408,7 +45596,7 @@ const preloadMarkerRE = new RegExp(preloadMarker, "g");
45408
45596
  const dynamicImportPrefixRE = /import\s*\(/;
45409
45597
  const dynamicImportTreeshakenRE = /((?:\bconst\s+|\blet\s+|\bvar\s+|,\s*)(\{[^{}.=]+\})\s*=\s*await\s+import\([^)]+\))|(\(\s*await\s+import\([^)]+\)\s*\)(\??\.[\w$]+))|\bimport\([^)]+\)(\s*\.then\(\s*(?:function\s*)?\(\s*\{([^{}.=]+)\}\))/g;
45410
45598
  function toRelativePath(filename, importer) {
45411
- const relPath = path$b.posix.relative(path$b.posix.dirname(importer), filename);
45599
+ const relPath = path$c.posix.relative(path$c.posix.dirname(importer), filename);
45412
45600
  return relPath[0] === "." ? relPath : `./${relPath}`;
45413
45601
  }
45414
45602
  function indexOfMatchInSlice(str, reg, pos = 0) {
@@ -45675,8 +45863,8 @@ function buildImportAnalysisPlugin(config) {
45675
45863
  url = rawUrl.slice(1, -1);
45676
45864
  }
45677
45865
  if (!url) continue;
45678
- const normalizedFile = path$b.posix.join(
45679
- path$b.posix.dirname(chunk.fileName),
45866
+ const normalizedFile = path$c.posix.join(
45867
+ path$c.posix.dirname(chunk.fileName),
45680
45868
  url
45681
45869
  );
45682
45870
  if (removedPureCssFiles.has(normalizedFile)) {
@@ -45739,8 +45927,8 @@ function buildImportAnalysisPlugin(config) {
45739
45927
  let hasRemovedPureCssChunk = false;
45740
45928
  let normalizedFile = void 0;
45741
45929
  if (url) {
45742
- normalizedFile = path$b.posix.join(
45743
- path$b.posix.dirname(chunk.fileName),
45930
+ normalizedFile = path$c.posix.join(
45931
+ path$c.posix.dirname(chunk.fileName),
45744
45932
  url
45745
45933
  );
45746
45934
  const ownerFilename = chunk.fileName;
@@ -46166,7 +46354,7 @@ async function buildEnvironment(environment) {
46166
46354
  )}`
46167
46355
  )
46168
46356
  );
46169
- const resolve = (p) => path$b.resolve(root, p);
46357
+ const resolve = (p) => path$c.resolve(root, p);
46170
46358
  const input = libOptions ? options.rollupOptions.input || (typeof libOptions.entry === "string" ? resolve(libOptions.entry) : Array.isArray(libOptions.entry) ? libOptions.entry.map(resolve) : Object.fromEntries(
46171
46359
  Object.entries(libOptions.entry).map(([alias, file]) => [
46172
46360
  alias,
@@ -46295,9 +46483,9 @@ ${stackOnly}`;
46295
46483
  root,
46296
46484
  jsExt,
46297
46485
  packageCache
46298
- ) : path$b.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
46299
- chunkFileNames: libOptions ? `[name]-[hash].${jsExt}` : path$b.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
46300
- assetFileNames: libOptions ? `[name].[ext]` : path$b.posix.join(options.assetsDir, `[name]-[hash].[ext]`),
46486
+ ) : path$c.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
46487
+ chunkFileNames: libOptions ? `[name]-[hash].${jsExt}` : path$c.posix.join(options.assetsDir, `[name]-[hash].${jsExt}`),
46488
+ assetFileNames: libOptions ? `[name].[ext]` : path$c.posix.join(options.assetsDir, `[name]-[hash].[ext]`),
46301
46489
  inlineDynamicImports: output.format === "umd" || output.format === "iife" || isSsrTargetWebworkerEnvironment && (typeof input === "string" || Object.keys(input).length === 1),
46302
46490
  ...output
46303
46491
  };
@@ -46394,8 +46582,8 @@ function prepareOutDir(outDirs, emptyOutDir, environment) {
46394
46582
  for (const outDir of outDirs) {
46395
46583
  if (emptyOutDir !== false && fs__default.existsSync(outDir)) {
46396
46584
  const skipDirs = outDirsArray.map((dir) => {
46397
- const relative = path$b.relative(outDir, dir);
46398
- if (relative && !relative.startsWith("..") && !path$b.isAbsolute(relative)) {
46585
+ const relative = path$c.relative(outDir, dir);
46586
+ if (relative && !relative.startsWith("..") && !path$c.isAbsolute(relative)) {
46399
46587
  return relative;
46400
46588
  }
46401
46589
  return "";
@@ -46778,7 +46966,7 @@ function createToImportMetaURLBasedRelativeRuntime(format, isWorker) {
46778
46966
  const toRelativePath = customRelativeUrlMechanisms[formatLong];
46779
46967
  return (filename, importer) => ({
46780
46968
  runtime: toRelativePath(
46781
- path$b.posix.relative(path$b.dirname(importer), filename)
46969
+ path$c.posix.relative(path$c.dirname(importer), filename)
46782
46970
  )
46783
46971
  });
46784
46972
  }
@@ -47917,14 +48105,14 @@ async function warmupFile(server, environment, file) {
47917
48105
  }
47918
48106
  }
47919
48107
  function htmlFileToUrl(file, root) {
47920
- const url = path$b.relative(root, file);
48108
+ const url = path$c.relative(root, file);
47921
48109
  if (url[0] === ".") return;
47922
48110
  return "/" + normalizePath$3(url);
47923
48111
  }
47924
48112
  function fileToUrl(file, root) {
47925
- const url = path$b.relative(root, file);
48113
+ const url = path$c.relative(root, file);
47926
48114
  if (url[0] === ".") {
47927
- return path$b.posix.join(FS_PREFIX, normalizePath$3(file));
48115
+ return path$c.posix.join(FS_PREFIX, normalizePath$3(file));
47928
48116
  }
47929
48117
  return "/" + normalizePath$3(url);
47930
48118
  }
@@ -47936,10 +48124,10 @@ async function mapFiles(files, root) {
47936
48124
  if (isDynamicPattern(file)) {
47937
48125
  globs.push(file);
47938
48126
  } else {
47939
- if (path$b.isAbsolute(file)) {
48127
+ if (path$c.isAbsolute(file)) {
47940
48128
  result.push(file);
47941
48129
  } else {
47942
- result.push(path$b.resolve(root, file));
48130
+ result.push(path$c.resolve(root, file));
47943
48131
  }
47944
48132
  }
47945
48133
  }
@@ -48376,11 +48564,11 @@ async function preview(inlineConfig = {}) {
48376
48564
  true
48377
48565
  );
48378
48566
  const clientOutDir = config.environments.client.build.outDir;
48379
- const distDir = path$b.resolve(config.root, clientOutDir);
48567
+ const distDir = path$c.resolve(config.root, clientOutDir);
48380
48568
  if (!fs__default.existsSync(distDir) && // error if no plugins implement `configurePreviewServer`
48381
48569
  config.plugins.every((plugin) => !plugin.configurePreviewServer) && // error if called in CLI only. programmatic usage could access `httpServer`
48382
48570
  // and affect file serving
48383
- process.argv[1]?.endsWith(path$b.normalize("bin/vite.js")) && process.argv[2] === "preview") {
48571
+ process.argv[1]?.endsWith(path$c.normalize("bin/vite.js")) && process.argv[2] === "preview") {
48384
48572
  throw new Error(
48385
48573
  `The directory "${clientOutDir}" does not exist. Did you build your project?`
48386
48574
  );
@@ -48802,11 +48990,11 @@ function checkBadCharactersInPath(name, path2, logger) {
48802
48990
  const clientAlias = [
48803
48991
  {
48804
48992
  find: /^\/?@vite\/env/,
48805
- replacement: path$b.posix.join(FS_PREFIX, normalizePath$3(ENV_ENTRY))
48993
+ replacement: path$c.posix.join(FS_PREFIX, normalizePath$3(ENV_ENTRY))
48806
48994
  },
48807
48995
  {
48808
48996
  find: /^\/?@vite\/client/,
48809
- replacement: path$b.posix.join(FS_PREFIX, normalizePath$3(CLIENT_ENTRY))
48997
+ replacement: path$c.posix.join(FS_PREFIX, normalizePath$3(CLIENT_ENTRY))
48810
48998
  }
48811
48999
  ];
48812
49000
  function resolveEnvironmentResolveOptions(resolve, alias, preserveSymlinks, logger, consumer, isSsrTargetWebworkerEnvironment) {
@@ -48934,7 +49122,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
48934
49122
  customLogger: config.customLogger
48935
49123
  });
48936
49124
  const resolvedRoot = normalizePath$3(
48937
- config.root ? path$b.resolve(config.root) : process.cwd()
49125
+ config.root ? path$c.resolve(config.root) : process.cwd()
48938
49126
  );
48939
49127
  checkBadCharactersInPath("The project root", resolvedRoot, logger);
48940
49128
  const configEnvironmentsClient = config.environments.client;
@@ -49054,7 +49242,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
49054
49242
  );
49055
49243
  let envDir = config.envFile === false ? false : config.envDir;
49056
49244
  if (envDir !== false) {
49057
- envDir = config.envDir ? normalizePath$3(path$b.resolve(resolvedRoot, config.envDir)) : resolvedRoot;
49245
+ envDir = config.envDir ? normalizePath$3(path$c.resolve(resolvedRoot, config.envDir)) : resolvedRoot;
49058
49246
  }
49059
49247
  const userEnv = loadEnv(mode, envDir, resolveEnvPrefix(config));
49060
49248
  const userNodeEnv = process.env.VITE_USER_NODE_ENV;
@@ -49072,12 +49260,12 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
49072
49260
  const resolvedBase = relativeBaseShortcut ? !isBuild || config.build?.ssr ? "/" : "./" : resolveBaseUrl(config.base, isBuild, logger);
49073
49261
  const pkgDir = findNearestPackageData(resolvedRoot, packageCache)?.dir;
49074
49262
  const cacheDir = normalizePath$3(
49075
- config.cacheDir ? path$b.resolve(resolvedRoot, config.cacheDir) : pkgDir ? path$b.join(pkgDir, `node_modules/.vite`) : path$b.join(resolvedRoot, `.vite`)
49263
+ config.cacheDir ? path$c.resolve(resolvedRoot, config.cacheDir) : pkgDir ? path$c.join(pkgDir, `node_modules/.vite`) : path$c.join(resolvedRoot, `.vite`)
49076
49264
  );
49077
49265
  const assetsFilter = config.assetsInclude && (!Array.isArray(config.assetsInclude) || config.assetsInclude.length) ? createFilter$1(config.assetsInclude) : () => false;
49078
49266
  const { publicDir } = config;
49079
49267
  const resolvedPublicDir = publicDir !== false && publicDir !== "" ? normalizePath$3(
49080
- path$b.resolve(
49268
+ path$c.resolve(
49081
49269
  resolvedRoot,
49082
49270
  typeof publicDir === "string" ? publicDir : configDefaults.publicDir
49083
49271
  )
@@ -49141,7 +49329,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = "development",
49141
49329
  resolved = {
49142
49330
  configFile: configFile ? normalizePath$3(configFile) : void 0,
49143
49331
  configFileDependencies: configFileDependencies.map(
49144
- (name) => normalizePath$3(path$b.resolve(name))
49332
+ (name) => normalizePath$3(path$c.resolve(name))
49145
49333
  ),
49146
49334
  inlineConfig,
49147
49335
  root: resolvedRoot,
@@ -49308,7 +49496,7 @@ assetFileNames isn't equal for every build.rollupOptions.output. A single patter
49308
49496
  );
49309
49497
  }
49310
49498
  const resolvedBuildOutDir = normalizePath$3(
49311
- path$b.resolve(resolved.root, resolved.build.outDir)
49499
+ path$c.resolve(resolved.root, resolved.build.outDir)
49312
49500
  );
49313
49501
  if (isParentDirectory(resolvedBuildOutDir, resolved.root) || resolvedBuildOutDir === resolved.root) {
49314
49502
  resolved.logger.warn(
@@ -49378,10 +49566,10 @@ async function loadConfigFromFile(configEnv, configFile, configRoot = process.cw
49378
49566
  const getTime = () => `${(performance$1.now() - start).toFixed(2)}ms`;
49379
49567
  let resolvedPath;
49380
49568
  if (configFile) {
49381
- resolvedPath = path$b.resolve(configFile);
49569
+ resolvedPath = path$c.resolve(configFile);
49382
49570
  } else {
49383
49571
  for (const filename of DEFAULT_CONFIG_FILES) {
49384
- const filePath = path$b.resolve(configRoot, filename);
49572
+ const filePath = path$c.resolve(configRoot, filename);
49385
49573
  if (!fs__default.existsSync(filePath)) continue;
49386
49574
  resolvedPath = filePath;
49387
49575
  break;
@@ -49456,7 +49644,7 @@ async function bundleConfigFile(fileName, isESM) {
49456
49644
  mainFields: ["main"],
49457
49645
  sourcemap: "inline",
49458
49646
  // the last slash is needed to make the path correct
49459
- sourceRoot: path$b.dirname(fileName) + path$b.sep,
49647
+ sourceRoot: path$c.dirname(fileName) + path$c.sep,
49460
49648
  metafile: true,
49461
49649
  define: {
49462
49650
  __dirname: dirnameVarName,
@@ -49472,7 +49660,7 @@ async function bundleConfigFile(fileName, isESM) {
49472
49660
  const packageCache = /* @__PURE__ */ new Map();
49473
49661
  const resolveByViteResolver = (id, importer, isRequire) => {
49474
49662
  return tryNodeResolve(id, importer, {
49475
- root: path$b.dirname(fileName),
49663
+ root: path$c.dirname(fileName),
49476
49664
  isBuild: true,
49477
49665
  isProduction: true,
49478
49666
  preferRelative: false,
@@ -49496,7 +49684,7 @@ async function bundleConfigFile(fileName, isESM) {
49496
49684
  build2.onResolve(
49497
49685
  { filter: /^[^.#].*/ },
49498
49686
  async ({ path: id, importer, kind }) => {
49499
- if (kind === "entry-point" || path$b.isAbsolute(id) || isNodeBuiltin(id)) {
49687
+ if (kind === "entry-point" || path$c.isAbsolute(id) || isNodeBuiltin(id)) {
49500
49688
  return;
49501
49689
  }
49502
49690
  if (isNodeLikeBuiltin(id)) {
@@ -49544,7 +49732,7 @@ async function bundleConfigFile(fileName, isESM) {
49544
49732
  build2.onLoad({ filter: /\.[cm]?[jt]s$/ }, async (args) => {
49545
49733
  const contents = await fsp.readFile(args.path, "utf-8");
49546
49734
  const injectValues = `const ${dirnameVarName} = ${JSON.stringify(
49547
- path$b.dirname(args.path)
49735
+ path$c.dirname(args.path)
49548
49736
  )};const ${filenameVarName} = ${JSON.stringify(args.path)};const ${importMetaUrlVarName} = ${JSON.stringify(
49549
49737
  pathToFileURL$1(args.path).href
49550
49738
  )};`;
@@ -49566,10 +49754,10 @@ async function bundleConfigFile(fileName, isESM) {
49566
49754
  const _require = createRequire$1(import.meta.url);
49567
49755
  async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
49568
49756
  if (isESM) {
49569
- let nodeModulesDir = typeof process.versions.deno === "string" ? void 0 : findNearestNodeModules(path$b.dirname(fileName));
49757
+ let nodeModulesDir = typeof process.versions.deno === "string" ? void 0 : findNearestNodeModules(path$c.dirname(fileName));
49570
49758
  if (nodeModulesDir) {
49571
49759
  try {
49572
- await fsp.mkdir(path$b.resolve(nodeModulesDir, ".vite-temp/"), {
49760
+ await fsp.mkdir(path$c.resolve(nodeModulesDir, ".vite-temp/"), {
49573
49761
  recursive: true
49574
49762
  });
49575
49763
  } catch (e) {
@@ -49581,9 +49769,9 @@ async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
49581
49769
  }
49582
49770
  }
49583
49771
  const hash = `timestamp-${Date.now()}-${Math.random().toString(16).slice(2)}`;
49584
- const tempFileName = nodeModulesDir ? path$b.resolve(
49772
+ const tempFileName = nodeModulesDir ? path$c.resolve(
49585
49773
  nodeModulesDir,
49586
- `.vite-temp/${path$b.basename(fileName)}.${hash}.mjs`
49774
+ `.vite-temp/${path$c.basename(fileName)}.${hash}.mjs`
49587
49775
  ) : `${fileName}.${hash}.mjs`;
49588
49776
  await fsp.writeFile(tempFileName, bundledCode);
49589
49777
  try {
@@ -49593,7 +49781,7 @@ async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
49593
49781
  });
49594
49782
  }
49595
49783
  } else {
49596
- const extension = path$b.extname(fileName);
49784
+ const extension = path$c.extname(fileName);
49597
49785
  const realFileName = await promisifiedRealpath(fileName);
49598
49786
  const loaderExt = extension in _require.extensions ? extension : ".js";
49599
49787
  const defaultLoader = _require.extensions[loaderExt];