vite 5.0.7 → 5.0.8

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,4 +1,4 @@
1
- import { z as commonjsGlobal, y as getDefaultExportFromCjs } from './dep-wTaJK0Jt.js';
1
+ import { z as commonjsGlobal, y as getDefaultExportFromCjs } from './dep-uAHLeuC6.js';
2
2
  import require$$0__default from 'fs';
3
3
  import require$$0 from 'postcss';
4
4
  import require$$0$1 from 'path';
@@ -1,4 +1,4 @@
1
- import { y as getDefaultExportFromCjs } from './dep-wTaJK0Jt.js';
1
+ import { y as getDefaultExportFromCjs } from './dep-uAHLeuC6.js';
2
2
  import require$$0 from 'path';
3
3
  import require$$0__default from 'fs';
4
4
  import { l as lib } from './dep-8a-6Quh6.js';
@@ -7709,7 +7709,7 @@ function getPackageEntryPoint(dirPath) {
7709
7709
  return entryPoint;
7710
7710
  }
7711
7711
 
7712
- function isDirectory(path) {
7712
+ function isDirectory$1(path) {
7713
7713
  try {
7714
7714
  if (statSync$1(path).isDirectory()) return true;
7715
7715
  } catch (ignored) {
@@ -7730,7 +7730,7 @@ function getDynamicRequireModules(patterns, dynamicRequireRoot) {
7730
7730
  for (const path of glob$1.sync(isNegated ? pattern.substr(1) : pattern)) {
7731
7731
  const resolvedPath = resolve$3(path);
7732
7732
  const requirePath = normalizePathSlashes(resolvedPath);
7733
- if (isDirectory(resolvedPath)) {
7733
+ if (isDirectory$1(resolvedPath)) {
7734
7734
  dirNames.add(resolvedPath);
7735
7735
  const modulePath = resolve$3(join$1(resolvedPath, getPackageEntryPoint(path)));
7736
7736
  modifyMap(requirePath, modulePath);
@@ -28480,6 +28480,324 @@ function hasESMSyntax(code) {
28480
28480
  return ESM_RE.test(code);
28481
28481
  }
28482
28482
 
28483
+ // An implementation of fsUtils without caching
28484
+ const commonFsUtils = {
28485
+ existsSync: fs$l.existsSync,
28486
+ isDirectory,
28487
+ tryResolveRealFile,
28488
+ tryResolveRealFileWithExtensions,
28489
+ tryResolveRealFileOrType,
28490
+ };
28491
+ const cachedFsUtilsMap = new WeakMap();
28492
+ function getFsUtils(config) {
28493
+ let fsUtils = cachedFsUtilsMap.get(config);
28494
+ if (!fsUtils) {
28495
+ if (config.command !== 'serve' || !config.server.fs.cachedChecks) {
28496
+ // cached fsUtils is only used in the dev server for now, and only when the watcher isn't configured
28497
+ // we can support custom ignored patterns later
28498
+ fsUtils = commonFsUtils;
28499
+ } /* TODO: Enabling for testing, we need to review if this guard is needed
28500
+ else if (config.server.watch === null || config.server.watch?.ignored) {
28501
+ config.logger.warn(
28502
+ colors.yellow(
28503
+ `${colors.bold(
28504
+ `(!)`,
28505
+ )} server.fs.cachedChecks isn't supported if server.watch is null or a custom server.watch.ignored is configured\n`,
28506
+ ),
28507
+ )
28508
+ fsUtils = commonFsUtils
28509
+ } */
28510
+ else if (!config.resolve.preserveSymlinks &&
28511
+ config.root !== getRealPath(config.root)) {
28512
+ config.logger.warn(colors$1.yellow(`${colors$1.bold(`(!)`)} server.fs.cachedChecks isn't supported when resolve.preserveSymlinks is false and root is symlinked\n`));
28513
+ fsUtils = commonFsUtils;
28514
+ }
28515
+ else {
28516
+ fsUtils = createCachedFsUtils(config);
28517
+ }
28518
+ cachedFsUtilsMap.set(config, fsUtils);
28519
+ }
28520
+ return fsUtils;
28521
+ }
28522
+ function readDirCacheSync(file) {
28523
+ let dirents;
28524
+ try {
28525
+ dirents = fs$l.readdirSync(file, { withFileTypes: true });
28526
+ }
28527
+ catch {
28528
+ return;
28529
+ }
28530
+ return direntsToDirentMap(dirents);
28531
+ }
28532
+ function direntsToDirentMap(fsDirents) {
28533
+ const dirents = new Map();
28534
+ for (const dirent of fsDirents) {
28535
+ // We ignore non directory, file, and symlink entries
28536
+ const type = dirent.isDirectory()
28537
+ ? 'directory'
28538
+ : dirent.isSymbolicLink()
28539
+ ? 'symlink'
28540
+ : dirent.isFile()
28541
+ ? 'file'
28542
+ : undefined;
28543
+ if (type) {
28544
+ dirents.set(dirent.name, { type });
28545
+ }
28546
+ }
28547
+ return dirents;
28548
+ }
28549
+ function ensureFileMaybeSymlinkIsResolved(direntCache, filePath) {
28550
+ if (direntCache.type !== 'file_maybe_symlink')
28551
+ return;
28552
+ const isSymlink = fs$l
28553
+ .lstatSync(filePath, { throwIfNoEntry: false })
28554
+ ?.isSymbolicLink();
28555
+ direntCache.type =
28556
+ isSymlink === undefined ? 'error' : isSymlink ? 'symlink' : 'file';
28557
+ }
28558
+ function pathUntilPart(root, parts, i) {
28559
+ let p = root;
28560
+ for (let k = 0; k < i; k++)
28561
+ p += '/' + parts[k];
28562
+ return p;
28563
+ }
28564
+ function createCachedFsUtils(config) {
28565
+ const root = config.root; // root is resolved and normalized, so it doesn't have a trailing slash
28566
+ const rootDirPath = `${root}/`;
28567
+ const rootCache = { type: 'directory' }; // dirents will be computed lazily
28568
+ const getDirentCacheSync = (parts) => {
28569
+ let direntCache = rootCache;
28570
+ for (let i = 0; i < parts.length; i++) {
28571
+ if (direntCache.type === 'directory') {
28572
+ let dirPath;
28573
+ if (!direntCache.dirents) {
28574
+ dirPath = pathUntilPart(root, parts, i);
28575
+ const dirents = readDirCacheSync(dirPath);
28576
+ if (!dirents) {
28577
+ direntCache.type = 'error';
28578
+ return;
28579
+ }
28580
+ direntCache.dirents = dirents;
28581
+ }
28582
+ const nextDirentCache = direntCache.dirents.get(parts[i]);
28583
+ if (!nextDirentCache) {
28584
+ return;
28585
+ }
28586
+ if (nextDirentCache.type === 'directory_maybe_symlink') {
28587
+ dirPath ??= pathUntilPart(root, parts, i);
28588
+ const isSymlink = fs$l
28589
+ .lstatSync(dirPath, { throwIfNoEntry: false })
28590
+ ?.isSymbolicLink();
28591
+ direntCache.type = isSymlink ? 'symlink' : 'directory';
28592
+ }
28593
+ direntCache = nextDirentCache;
28594
+ }
28595
+ else if (direntCache.type === 'symlink') {
28596
+ // early return if we encounter a symlink
28597
+ return direntCache;
28598
+ }
28599
+ else if (direntCache.type === 'error') {
28600
+ return direntCache;
28601
+ }
28602
+ else {
28603
+ if (i !== parts.length - 1) {
28604
+ return;
28605
+ }
28606
+ if (direntCache.type === 'file_maybe_symlink') {
28607
+ ensureFileMaybeSymlinkIsResolved(direntCache, pathUntilPart(root, parts, i));
28608
+ return direntCache;
28609
+ }
28610
+ else if (direntCache.type === 'file') {
28611
+ return direntCache;
28612
+ }
28613
+ else {
28614
+ return;
28615
+ }
28616
+ }
28617
+ }
28618
+ return direntCache;
28619
+ };
28620
+ function getDirentCacheFromPath(normalizedFile) {
28621
+ if (normalizedFile === root) {
28622
+ return rootCache;
28623
+ }
28624
+ if (!normalizedFile.startsWith(rootDirPath)) {
28625
+ return undefined;
28626
+ }
28627
+ const pathFromRoot = normalizedFile.slice(rootDirPath.length);
28628
+ const parts = pathFromRoot.split('/');
28629
+ const direntCache = getDirentCacheSync(parts);
28630
+ if (!direntCache || direntCache.type === 'error') {
28631
+ return false;
28632
+ }
28633
+ return direntCache;
28634
+ }
28635
+ function onPathAdd(file, type) {
28636
+ const direntCache = getDirentCacheFromPath(path$o.dirname(file));
28637
+ if (direntCache &&
28638
+ direntCache.type === 'directory' &&
28639
+ direntCache.dirents) {
28640
+ direntCache.dirents.set(path$o.basename(file), { type });
28641
+ }
28642
+ }
28643
+ function onPathUnlink(file) {
28644
+ const direntCache = getDirentCacheFromPath(path$o.dirname(file));
28645
+ if (direntCache &&
28646
+ direntCache.type === 'directory' &&
28647
+ direntCache.dirents) {
28648
+ direntCache.dirents.delete(path$o.basename(file));
28649
+ }
28650
+ }
28651
+ return {
28652
+ existsSync(file) {
28653
+ if (isInNodeModules$1(file)) {
28654
+ return fs$l.existsSync(file);
28655
+ }
28656
+ const normalizedFile = normalizePath$3(file);
28657
+ const direntCache = getDirentCacheFromPath(normalizedFile);
28658
+ if (direntCache === undefined ||
28659
+ (direntCache && direntCache.type === 'symlink')) {
28660
+ // fallback to built-in fs for out-of-root and symlinked files
28661
+ return fs$l.existsSync(file);
28662
+ }
28663
+ return !!direntCache;
28664
+ },
28665
+ tryResolveRealFile(file, preserveSymlinks) {
28666
+ if (isInNodeModules$1(file)) {
28667
+ return tryResolveRealFile(file, preserveSymlinks);
28668
+ }
28669
+ const normalizedFile = normalizePath$3(file);
28670
+ const direntCache = getDirentCacheFromPath(normalizedFile);
28671
+ if (direntCache === undefined ||
28672
+ (direntCache && direntCache.type === 'symlink')) {
28673
+ // fallback to built-in fs for out-of-root and symlinked files
28674
+ return tryResolveRealFile(file, preserveSymlinks);
28675
+ }
28676
+ if (!direntCache || direntCache.type === 'directory') {
28677
+ return;
28678
+ }
28679
+ // We can avoid getRealPath even if preserveSymlinks is false because we know it's
28680
+ // a file without symlinks in its path
28681
+ return normalizedFile;
28682
+ },
28683
+ tryResolveRealFileWithExtensions(file, extensions, preserveSymlinks) {
28684
+ if (isInNodeModules$1(file)) {
28685
+ return tryResolveRealFileWithExtensions(file, extensions, preserveSymlinks);
28686
+ }
28687
+ const normalizedFile = normalizePath$3(file);
28688
+ const dirPath = path$o.posix.dirname(normalizedFile);
28689
+ const direntCache = getDirentCacheFromPath(dirPath);
28690
+ if (direntCache === undefined ||
28691
+ (direntCache && direntCache.type === 'symlink')) {
28692
+ // fallback to built-in fs for out-of-root and symlinked files
28693
+ return tryResolveRealFileWithExtensions(file, extensions, preserveSymlinks);
28694
+ }
28695
+ if (!direntCache || direntCache.type !== 'directory') {
28696
+ return;
28697
+ }
28698
+ if (!direntCache.dirents) {
28699
+ const dirents = readDirCacheSync(dirPath);
28700
+ if (!dirents) {
28701
+ direntCache.type = 'error';
28702
+ return;
28703
+ }
28704
+ direntCache.dirents = dirents;
28705
+ }
28706
+ const base = path$o.posix.basename(normalizedFile);
28707
+ for (const ext of extensions) {
28708
+ const fileName = base + ext;
28709
+ const fileDirentCache = direntCache.dirents.get(fileName);
28710
+ if (fileDirentCache) {
28711
+ const filePath = dirPath + '/' + fileName;
28712
+ ensureFileMaybeSymlinkIsResolved(fileDirentCache, filePath);
28713
+ if (fileDirentCache.type === 'symlink') {
28714
+ // fallback to built-in fs for symlinked files
28715
+ return tryResolveRealFile(filePath, preserveSymlinks);
28716
+ }
28717
+ if (fileDirentCache.type === 'file') {
28718
+ return filePath;
28719
+ }
28720
+ }
28721
+ }
28722
+ },
28723
+ tryResolveRealFileOrType(file, preserveSymlinks) {
28724
+ if (isInNodeModules$1(file)) {
28725
+ return tryResolveRealFileOrType(file, preserveSymlinks);
28726
+ }
28727
+ const normalizedFile = normalizePath$3(file);
28728
+ const direntCache = getDirentCacheFromPath(normalizedFile);
28729
+ if (direntCache === undefined ||
28730
+ (direntCache && direntCache.type === 'symlink')) {
28731
+ // fallback to built-in fs for out-of-root and symlinked files
28732
+ return tryResolveRealFileOrType(file, preserveSymlinks);
28733
+ }
28734
+ if (!direntCache) {
28735
+ return;
28736
+ }
28737
+ if (direntCache.type === 'directory') {
28738
+ return { type: 'directory' };
28739
+ }
28740
+ // We can avoid getRealPath even if preserveSymlinks is false because we know it's
28741
+ // a file without symlinks in its path
28742
+ return { path: normalizedFile, type: 'file' };
28743
+ },
28744
+ isDirectory(dirPath) {
28745
+ if (isInNodeModules$1(dirPath)) {
28746
+ return isDirectory(dirPath);
28747
+ }
28748
+ const direntCache = getDirentCacheFromPath(normalizePath$3(dirPath));
28749
+ if (direntCache === undefined ||
28750
+ (direntCache && direntCache.type === 'symlink')) {
28751
+ // fallback to built-in fs for out-of-root and symlinked files
28752
+ return isDirectory(dirPath);
28753
+ }
28754
+ return direntCache && direntCache.type === 'directory';
28755
+ },
28756
+ initWatcher(watcher) {
28757
+ watcher.on('add', (file) => {
28758
+ onPathAdd(file, 'file_maybe_symlink');
28759
+ });
28760
+ watcher.on('addDir', (dir) => {
28761
+ onPathAdd(dir, 'directory_maybe_symlink');
28762
+ });
28763
+ watcher.on('unlink', onPathUnlink);
28764
+ watcher.on('unlinkDir', onPathUnlink);
28765
+ },
28766
+ };
28767
+ }
28768
+ function tryResolveRealFile(file, preserveSymlinks) {
28769
+ const stat = tryStatSync(file);
28770
+ if (stat?.isFile())
28771
+ return getRealPath(file, preserveSymlinks);
28772
+ }
28773
+ function tryResolveRealFileWithExtensions(filePath, extensions, preserveSymlinks) {
28774
+ for (const ext of extensions) {
28775
+ const res = tryResolveRealFile(filePath + ext, preserveSymlinks);
28776
+ if (res)
28777
+ return res;
28778
+ }
28779
+ }
28780
+ function tryResolveRealFileOrType(file, preserveSymlinks) {
28781
+ const fileStat = tryStatSync(file);
28782
+ if (fileStat?.isFile()) {
28783
+ return { path: getRealPath(file, preserveSymlinks), type: 'file' };
28784
+ }
28785
+ if (fileStat?.isDirectory()) {
28786
+ return { type: 'directory' };
28787
+ }
28788
+ return;
28789
+ }
28790
+ function getRealPath(resolved, preserveSymlinks) {
28791
+ if (!preserveSymlinks) {
28792
+ resolved = safeRealpathSync(resolved);
28793
+ }
28794
+ return normalizePath$3(resolved);
28795
+ }
28796
+ function isDirectory(path) {
28797
+ const stat = tryStatSync(path);
28798
+ return stat?.isDirectory() ?? false;
28799
+ }
28800
+
28483
28801
  const normalizedClientEntry$1 = normalizePath$3(CLIENT_ENTRY);
28484
28802
  const normalizedEnvEntry$1 = normalizePath$3(ENV_ENTRY);
28485
28803
  const ERR_RESOLVE_PACKAGE_ENTRY_FAIL = 'ERR_RESOLVE_PACKAGE_ENTRY_FAIL';
@@ -28786,46 +29104,46 @@ const knownTsOutputRE = /\.(?:js|mjs|cjs|jsx)$/;
28786
29104
  const isPossibleTsOutput = (url) => knownTsOutputRE.test(url);
28787
29105
  function tryCleanFsResolve(file, options, tryIndex = true, targetWeb = true, skipPackageJson = false) {
28788
29106
  const { tryPrefix, extensions, preserveSymlinks } = options;
28789
- const fileStat = tryStatSync(file);
28790
- // Try direct match first
28791
- if (fileStat?.isFile())
28792
- return getRealPath(file, options.preserveSymlinks);
29107
+ const fsUtils = options.fsUtils ?? commonFsUtils;
29108
+ // Optimization to get the real type or file type (directory, file, other)
29109
+ const fileResult = fsUtils.tryResolveRealFileOrType(file, options.preserveSymlinks);
29110
+ if (fileResult?.path)
29111
+ return fileResult.path;
28793
29112
  let res;
28794
29113
  // If path.dirname is a valid directory, try extensions and ts resolution logic
28795
29114
  const possibleJsToTs = options.isFromTsImporter && isPossibleTsOutput(file);
28796
- if (possibleJsToTs || extensions.length || tryPrefix) {
29115
+ if (possibleJsToTs || options.extensions.length || tryPrefix) {
28797
29116
  const dirPath = path$o.dirname(file);
28798
- const dirStat = tryStatSync(dirPath);
28799
- if (dirStat?.isDirectory()) {
29117
+ if (fsUtils.isDirectory(dirPath)) {
28800
29118
  if (possibleJsToTs) {
28801
29119
  // try resolve .js, .mjs, .cjs or .jsx import to typescript file
28802
29120
  const fileExt = path$o.extname(file);
28803
29121
  const fileName = file.slice(0, -fileExt.length);
28804
- if ((res = tryResolveRealFile(fileName + fileExt.replace('js', 'ts'), preserveSymlinks)))
29122
+ if ((res = fsUtils.tryResolveRealFile(fileName + fileExt.replace('js', 'ts'), preserveSymlinks)))
28805
29123
  return res;
28806
29124
  // for .js, also try .tsx
28807
29125
  if (fileExt === '.js' &&
28808
- (res = tryResolveRealFile(fileName + '.tsx', preserveSymlinks)))
29126
+ (res = fsUtils.tryResolveRealFile(fileName + '.tsx', preserveSymlinks)))
28809
29127
  return res;
28810
29128
  }
28811
- if ((res = tryResolveRealFileWithExtensions(file, extensions, preserveSymlinks)))
29129
+ if ((res = fsUtils.tryResolveRealFileWithExtensions(file, extensions, preserveSymlinks)))
28812
29130
  return res;
28813
29131
  if (tryPrefix) {
28814
29132
  const prefixed = `${dirPath}/${options.tryPrefix}${path$o.basename(file)}`;
28815
- if ((res = tryResolveRealFile(prefixed, preserveSymlinks)))
29133
+ if ((res = fsUtils.tryResolveRealFile(prefixed, preserveSymlinks)))
28816
29134
  return res;
28817
- if ((res = tryResolveRealFileWithExtensions(prefixed, extensions, preserveSymlinks)))
29135
+ if ((res = fsUtils.tryResolveRealFileWithExtensions(prefixed, extensions, preserveSymlinks)))
28818
29136
  return res;
28819
29137
  }
28820
29138
  }
28821
29139
  }
28822
- if (tryIndex && fileStat) {
29140
+ if (tryIndex && fileResult?.type === 'directory') {
28823
29141
  // Path points to a directory, check for package.json and entry and /index file
28824
29142
  const dirPath = file;
28825
29143
  if (!skipPackageJson) {
28826
29144
  let pkgPath = `${dirPath}/package.json`;
28827
29145
  try {
28828
- if (fs$l.existsSync(pkgPath)) {
29146
+ if (fsUtils.existsSync(pkgPath)) {
28829
29147
  if (!options.preserveSymlinks) {
28830
29148
  pkgPath = safeRealpathSync(pkgPath);
28831
29149
  }
@@ -28840,26 +29158,14 @@ function tryCleanFsResolve(file, options, tryIndex = true, targetWeb = true, ski
28840
29158
  throw e;
28841
29159
  }
28842
29160
  }
28843
- if ((res = tryResolveRealFileWithExtensions(`${dirPath}/index`, extensions, preserveSymlinks)))
29161
+ if ((res = fsUtils.tryResolveRealFileWithExtensions(`${dirPath}/index`, extensions, preserveSymlinks)))
28844
29162
  return res;
28845
29163
  if (tryPrefix) {
28846
- if ((res = tryResolveRealFileWithExtensions(`${dirPath}/${options.tryPrefix}index`, extensions, preserveSymlinks)))
29164
+ if ((res = fsUtils.tryResolveRealFileWithExtensions(`${dirPath}/${options.tryPrefix}index`, extensions, preserveSymlinks)))
28847
29165
  return res;
28848
29166
  }
28849
29167
  }
28850
29168
  }
28851
- function tryResolveRealFile(file, preserveSymlinks) {
28852
- const stat = tryStatSync(file);
28853
- if (stat?.isFile())
28854
- return getRealPath(file, preserveSymlinks);
28855
- }
28856
- function tryResolveRealFileWithExtensions(filePath, extensions, preserveSymlinks) {
28857
- for (const ext of extensions) {
28858
- const res = tryResolveRealFile(filePath + ext, preserveSymlinks);
28859
- if (res)
28860
- return res;
28861
- }
28862
- }
28863
29169
  function tryNodeResolve(id, importer, options, targetWeb, depsOptimizer, ssr = false, externalize, allowLinkedExternal = true) {
28864
29170
  const { root, dedupe, isBuild, preserveSymlinks, packageCache } = options;
28865
29171
  // check for deep import, e.g. "my-lib/foo"
@@ -29313,12 +29619,6 @@ function mapWithBrowserField(relativePathInPkgDir, map) {
29313
29619
  function equalWithoutSuffix(path, key, suffix) {
29314
29620
  return key.endsWith(suffix) && key.slice(0, -suffix.length) === path;
29315
29621
  }
29316
- function getRealPath(resolved, preserveSymlinks) {
29317
- if (!preserveSymlinks) {
29318
- resolved = safeRealpathSync(resolved);
29319
- }
29320
- return normalizePath$3(resolved);
29321
- }
29322
29622
 
29323
29623
  var dist = {};
29324
29624
 
@@ -39025,26 +39325,27 @@ function cssPlugin(config) {
39025
39325
  }
39026
39326
  const ssr = options?.ssr === true;
39027
39327
  const urlReplacer = async (url, importer) => {
39028
- if (checkPublicFile(url, config)) {
39328
+ const decodedUrl = decodeURI(url);
39329
+ if (checkPublicFile(decodedUrl, config)) {
39029
39330
  if (encodePublicUrlsInCSS(config)) {
39030
- return publicFileToBuiltUrl(url, config);
39331
+ return publicFileToBuiltUrl(decodedUrl, config);
39031
39332
  }
39032
39333
  else {
39033
- return joinUrlSegments(config.base, url);
39334
+ return joinUrlSegments(config.base, decodedUrl);
39034
39335
  }
39035
39336
  }
39036
- const resolved = await resolveUrl(url, importer);
39337
+ const resolved = await resolveUrl(decodedUrl, importer);
39037
39338
  if (resolved) {
39038
39339
  return fileToUrl$1(resolved, config, this);
39039
39340
  }
39040
39341
  if (config.command === 'build') {
39041
39342
  const isExternal = config.build.rollupOptions.external
39042
- ? resolveUserExternal(config.build.rollupOptions.external, url, // use URL as id since id could not be resolved
39343
+ ? resolveUserExternal(config.build.rollupOptions.external, decodedUrl, // use URL as id since id could not be resolved
39043
39344
  id, false)
39044
39345
  : false;
39045
39346
  if (!isExternal) {
39046
39347
  // #9800 If we cannot resolve the css url, leave a warning.
39047
- config.logger.warnOnce(`\n${url} referenced in ${id} didn't resolve at build time, it will remain unchanged to be resolved at runtime`);
39348
+ config.logger.warnOnce(`\n${decodedUrl} referenced in ${id} didn't resolve at build time, it will remain unchanged to be resolved at runtime`);
39048
39349
  }
39049
39350
  }
39050
39351
  return url;
@@ -39775,8 +40076,8 @@ function createCachedImport(imp) {
39775
40076
  return cached;
39776
40077
  };
39777
40078
  }
39778
- const importPostcssImport = createCachedImport(() => import('./dep-tttr_ygS.js').then(function (n) { return n.i; }));
39779
- const importPostcssModules = createCachedImport(() => import('./dep-iw_F17O-.js').then(function (n) { return n.i; }));
40079
+ const importPostcssImport = createCachedImport(() => import('./dep-Y5q53UKR.js').then(function (n) { return n.i; }));
40080
+ const importPostcssModules = createCachedImport(() => import('./dep-WV5u8Hxr.js').then(function (n) { return n.i; }));
39780
40081
  const importPostcss = createCachedImport(() => import('postcss'));
39781
40082
  /**
39782
40083
  * @experimental
@@ -41163,7 +41464,7 @@ function throwOutdatedRequest(id) {
41163
41464
  throw err;
41164
41465
  }
41165
41466
 
41166
- // AST walker module for Mozilla Parser API compatible trees
41467
+ // AST walker module for ESTree compatible trees
41167
41468
 
41168
41469
 
41169
41470
  function makeTest(test) {
@@ -50224,8 +50525,8 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
50224
50525
  // In node@12+ we can use dynamic import to load CJS and ESM
50225
50526
  async function nodeImport(id, importer, resolveOptions, metadata) {
50226
50527
  let url;
50227
- const isRuntimeHandled = id.startsWith('data:') || isBuiltin(id);
50228
- if (isRuntimeHandled) {
50528
+ let filePath;
50529
+ if (id.startsWith('data:') || isBuiltin(id)) {
50229
50530
  url = id;
50230
50531
  }
50231
50532
  else {
@@ -50235,18 +50536,19 @@ async function nodeImport(id, importer, resolveOptions, metadata) {
50235
50536
  err.code = 'ERR_MODULE_NOT_FOUND';
50236
50537
  throw err;
50237
50538
  }
50539
+ filePath = resolved.id;
50238
50540
  url = pathToFileURL(resolved.id).toString();
50239
50541
  }
50240
50542
  const mod = await import(url);
50241
50543
  if (resolveOptions.legacyProxySsrExternalModules) {
50242
50544
  return proxyESM(mod);
50243
50545
  }
50244
- else if (isRuntimeHandled) {
50245
- return mod;
50546
+ else if (filePath) {
50547
+ analyzeImportedModDifference(mod, filePath, id, metadata, resolveOptions.packageCache);
50548
+ return proxyGuardOnlyEsm(mod, id);
50246
50549
  }
50247
50550
  else {
50248
- analyzeImportedModDifference(mod, url, id, metadata, resolveOptions.packageCache);
50249
- return proxyGuardOnlyEsm(mod, id);
50551
+ return mod;
50250
50552
  }
50251
50553
  }
50252
50554
  // rollup-style default import interop for cjs
@@ -52517,6 +52819,9 @@ let Receiver$1 = class Receiver extends Writable$1 {
52517
52819
  * Creates a Receiver instance.
52518
52820
  *
52519
52821
  * @param {Object} [options] Options object
52822
+ * @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies
52823
+ * whether or not to process more than one of the `'message'`, `'ping'`,
52824
+ * and `'pong'` events per microtask
52520
52825
  * @param {String} [options.binaryType=nodebuffer] The type for binary data
52521
52826
  * @param {Object} [options.extensions] An object containing the negotiated
52522
52827
  * extensions
@@ -52529,6 +52834,8 @@ let Receiver$1 = class Receiver extends Writable$1 {
52529
52834
  constructor(options = {}) {
52530
52835
  super();
52531
52836
 
52837
+ this._allowMultipleEventsPerMicrotask =
52838
+ !!options.allowMultipleEventsPerMicrotask;
52532
52839
  this._binaryType = options.binaryType || BINARY_TYPES$1[0];
52533
52840
  this._extensions = options.extensions || {};
52534
52841
  this._isServer = !!options.isServer;
@@ -53039,7 +53346,9 @@ let Receiver$1 = class Receiver extends Writable$1 {
53039
53346
  }
53040
53347
  }
53041
53348
 
53042
- this._state = WAIT_MICROTASK;
53349
+ this._state = this._allowMultipleEventsPerMicrotask
53350
+ ? GET_INFO
53351
+ : WAIT_MICROTASK;
53043
53352
  }
53044
53353
 
53045
53354
  /**
@@ -53056,8 +53365,6 @@ let Receiver$1 = class Receiver extends Writable$1 {
53056
53365
  if (data.length === 0) {
53057
53366
  this.emit('conclude', 1005, EMPTY_BUFFER$2);
53058
53367
  this.end();
53059
-
53060
- this._state = GET_INFO;
53061
53368
  } else {
53062
53369
  const code = data.readUInt16BE(0);
53063
53370
 
@@ -53089,16 +53396,16 @@ let Receiver$1 = class Receiver extends Writable$1 {
53089
53396
 
53090
53397
  this.emit('conclude', code, buf);
53091
53398
  this.end();
53092
-
53093
- this._state = GET_INFO;
53094
53399
  }
53095
- } else if (this._opcode === 0x09) {
53096
- this.emit('ping', data);
53097
- this._state = WAIT_MICROTASK;
53098
- } else {
53099
- this.emit('pong', data);
53100
- this._state = WAIT_MICROTASK;
53400
+
53401
+ this._state = GET_INFO;
53402
+ return;
53101
53403
  }
53404
+
53405
+ this.emit(this._opcode === 0x09 ? 'ping' : 'pong', data);
53406
+ this._state = this._allowMultipleEventsPerMicrotask
53407
+ ? GET_INFO
53408
+ : WAIT_MICROTASK;
53102
53409
  }
53103
53410
  };
53104
53411
 
@@ -54314,6 +54621,9 @@ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
54314
54621
  * @param {Duplex} socket The network socket between the server and client
54315
54622
  * @param {Buffer} head The first packet of the upgraded stream
54316
54623
  * @param {Object} options Options object
54624
+ * @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies
54625
+ * whether or not to process more than one of the `'message'`, `'ping'`,
54626
+ * and `'pong'` events per microtask
54317
54627
  * @param {Function} [options.generateMask] The function used to generate the
54318
54628
  * masking key
54319
54629
  * @param {Number} [options.maxPayload=0] The maximum allowed message size
@@ -54323,6 +54633,7 @@ let WebSocket$1 = class WebSocket extends EventEmitter$1 {
54323
54633
  */
54324
54634
  setSocket(socket, head, options) {
54325
54635
  const receiver = new Receiver({
54636
+ allowMultipleEventsPerMicrotask: options.allowMultipleEventsPerMicrotask,
54326
54637
  binaryType: this.binaryType,
54327
54638
  extensions: this._extensions,
54328
54639
  isServer: this._isServer,
@@ -54740,6 +55051,11 @@ var websocket = WebSocket$1;
54740
55051
  * @param {(String|URL)} address The URL to which to connect
54741
55052
  * @param {Array} protocols The subprotocols
54742
55053
  * @param {Object} [options] Connection options
55054
+ * @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies
55055
+ * whether or not to process more than one of the `'message'`, `'ping'`,
55056
+ * and `'pong'` events per microtask
55057
+ * @param {Function} [options.finishRequest] A function which can be used to
55058
+ * customize the headers of each http request before it is sent
54743
55059
  * @param {Boolean} [options.followRedirects=false] Whether or not to follow
54744
55060
  * redirects
54745
55061
  * @param {Function} [options.generateMask] The function used to generate the
@@ -54762,6 +55078,7 @@ var websocket = WebSocket$1;
54762
55078
  */
54763
55079
  function initAsClient(websocket, address, protocols, options) {
54764
55080
  const opts = {
55081
+ allowMultipleEventsPerMicrotask: false,
54765
55082
  protocolVersion: protocolVersions[1],
54766
55083
  maxPayload: 100 * 1024 * 1024,
54767
55084
  skipUTF8Validation: false,
@@ -54928,8 +55245,8 @@ function initAsClient(websocket, address, protocols, options) {
54928
55245
  ? opts.socketPath === websocket._originalHostOrSocketPath
54929
55246
  : false
54930
55247
  : websocket._originalIpc
54931
- ? false
54932
- : parsedUrl.host === websocket._originalHostOrSocketPath;
55248
+ ? false
55249
+ : parsedUrl.host === websocket._originalHostOrSocketPath;
54933
55250
 
54934
55251
  if (!isSameHost || (websocket._originalSecure && !isSecure)) {
54935
55252
  //
@@ -55113,6 +55430,7 @@ function initAsClient(websocket, address, protocols, options) {
55113
55430
  }
55114
55431
 
55115
55432
  websocket.setSocket(socket, head, {
55433
+ allowMultipleEventsPerMicrotask: opts.allowMultipleEventsPerMicrotask,
55116
55434
  generateMask: opts.generateMask,
55117
55435
  maxPayload: opts.maxPayload,
55118
55436
  skipUTF8Validation: opts.skipUTF8Validation
@@ -55529,6 +55847,9 @@ class WebSocketServer extends EventEmitter {
55529
55847
  * Create a `WebSocketServer` instance.
55530
55848
  *
55531
55849
  * @param {Object} options Configuration options
55850
+ * @param {Boolean} [options.allowMultipleEventsPerMicrotask=false] Specifies
55851
+ * whether or not to process more than one of the `'message'`, `'ping'`,
55852
+ * and `'pong'` events per microtask
55532
55853
  * @param {Number} [options.backlog=511] The maximum length of the queue of
55533
55854
  * pending connections
55534
55855
  * @param {Boolean} [options.clientTracking=true] Specifies whether or not to
@@ -55555,6 +55876,7 @@ class WebSocketServer extends EventEmitter {
55555
55876
  super();
55556
55877
 
55557
55878
  options = {
55879
+ allowMultipleEventsPerMicrotask: false,
55558
55880
  maxPayload: 100 * 1024 * 1024,
55559
55881
  skipUTF8Validation: false,
55560
55882
  perMessageDeflate: false,
@@ -55909,6 +56231,8 @@ class WebSocketServer extends EventEmitter {
55909
56231
  socket.removeListener('error', socketOnError);
55910
56232
 
55911
56233
  ws.setSocket(socket, head, {
56234
+ allowMultipleEventsPerMicrotask:
56235
+ this.options.allowMultipleEventsPerMicrotask,
55912
56236
  maxPayload: this.options.maxPayload,
55913
56237
  skipUTF8Validation: this.options.skipUTF8Validation
55914
56238
  });
@@ -58448,7 +58772,7 @@ function doesProxyContextMatchUrl(context, url) {
58448
58772
  }
58449
58773
 
58450
58774
  const debug$6 = createDebugger('vite:html-fallback');
58451
- function htmlFallbackMiddleware(root, spaFallback) {
58775
+ function htmlFallbackMiddleware(root, spaFallback, fsUtils = commonFsUtils) {
58452
58776
  // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
58453
58777
  return function viteHtmlFallbackMiddleware(req, res, next) {
58454
58778
  if (
@@ -58467,7 +58791,7 @@ function htmlFallbackMiddleware(root, spaFallback) {
58467
58791
  // so we need to check if the file exists
58468
58792
  if (pathname.endsWith('.html')) {
58469
58793
  const filePath = path$o.join(root, pathname);
58470
- if (fs$l.existsSync(filePath)) {
58794
+ if (fsUtils.existsSync(filePath)) {
58471
58795
  debug$6?.(`Rewriting ${req.method} ${req.url} to ${url}`);
58472
58796
  req.url = url;
58473
58797
  return next();
@@ -58476,7 +58800,7 @@ function htmlFallbackMiddleware(root, spaFallback) {
58476
58800
  // trailing slash should check for fallback index.html
58477
58801
  else if (pathname[pathname.length - 1] === '/') {
58478
58802
  const filePath = path$o.join(root, pathname, 'index.html');
58479
- if (fs$l.existsSync(filePath)) {
58803
+ if (fsUtils.existsSync(filePath)) {
58480
58804
  const newUrl = url + 'index.html';
58481
58805
  debug$6?.(`Rewriting ${req.method} ${req.url} to ${newUrl}`);
58482
58806
  req.url = newUrl;
@@ -58486,7 +58810,7 @@ function htmlFallbackMiddleware(root, spaFallback) {
58486
58810
  // non-trailing slash should check for fallback .html
58487
58811
  else {
58488
58812
  const filePath = path$o.join(root, pathname + '.html');
58489
- if (fs$l.existsSync(filePath)) {
58813
+ if (fsUtils.existsSync(filePath)) {
58490
58814
  const newUrl = url + '.html';
58491
58815
  debug$6?.(`Rewriting ${req.method} ${req.url} to ${newUrl}`);
58492
58816
  req.url = newUrl;
@@ -58778,6 +59102,9 @@ function shouldPreTransform(url, config) {
58778
59102
  return (!checkPublicFile(url, config) && (isJSRequest(url) || isCSSRequest(url)));
58779
59103
  }
58780
59104
  const wordCharRE = /\w/;
59105
+ function isBareRelative(url) {
59106
+ return wordCharRE.test(url[0]) && !url.includes(':');
59107
+ }
58781
59108
  const isSrcSet = (attr) => attr.name === 'srcset' && attr.prefix === undefined;
58782
59109
  const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, server) => {
58783
59110
  // prefix with base (dev only, base is never relative)
@@ -58797,20 +59124,25 @@ const processNodeUrl = (url, useSrcSetReplacer, config, htmlPath, originalUrl, s
58797
59124
  // rewrite `./index.js` -> `localhost:5173/a/index.js`.
58798
59125
  // rewrite `../index.js` -> `localhost:5173/index.js`.
58799
59126
  // rewrite `relative/index.js` -> `localhost:5173/a/relative/index.js`.
58800
- ((url[0] === '.' || (wordCharRE.test(url[0]) && !url.includes(':'))) &&
59127
+ ((url[0] === '.' || isBareRelative(url)) &&
58801
59128
  originalUrl &&
58802
59129
  originalUrl !== '/' &&
58803
59130
  htmlPath === '/index.html')) {
58804
- const devBase = config.base;
58805
- const fullUrl = path$o.posix.join(devBase, url);
58806
- if (server && shouldPreTransform(url, config)) {
58807
- preTransformRequest(server, fullUrl, devBase);
58808
- }
58809
- return fullUrl;
59131
+ url = path$o.posix.join(config.base, url);
58810
59132
  }
58811
- else {
58812
- return url;
59133
+ if (server && shouldPreTransform(url, config)) {
59134
+ let preTransformUrl;
59135
+ if (url[0] === '/') {
59136
+ preTransformUrl = url;
59137
+ }
59138
+ else if (url[0] === '.' || isBareRelative(url)) {
59139
+ preTransformUrl = path$o.posix.join(config.base, path$o.posix.dirname(htmlPath), url);
59140
+ }
59141
+ if (preTransformUrl) {
59142
+ preTransformRequest(server, preTransformUrl, config.base);
59143
+ }
58813
59144
  }
59145
+ return url;
58814
59146
  };
58815
59147
  const processedUrl = useSrcSetReplacer
58816
59148
  ? processSrcSetSync(url, ({ url }) => replacer(url))
@@ -58823,7 +59155,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
58823
59155
  let proxyModulePath;
58824
59156
  let proxyModuleUrl;
58825
59157
  const trailingSlash = htmlPath.endsWith('/');
58826
- if (!trailingSlash && fs$l.existsSync(filename)) {
59158
+ if (!trailingSlash && getFsUtils(config).existsSync(filename)) {
58827
59159
  proxyModulePath = htmlPath;
58828
59160
  proxyModuleUrl = joinUrlSegments(base, htmlPath);
58829
59161
  }
@@ -58974,6 +59306,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
58974
59306
  };
58975
59307
  function indexHtmlMiddleware(root, server) {
58976
59308
  const isDev = isDevServer(server);
59309
+ const fsUtils = getFsUtils(server.config);
58977
59310
  // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
58978
59311
  return async function viteIndexHtmlMiddleware(req, res, next) {
58979
59312
  if (res.writableEnded) {
@@ -58989,7 +59322,7 @@ function indexHtmlMiddleware(root, server) {
58989
59322
  else {
58990
59323
  filePath = path$o.join(root, decodeURIComponent(url));
58991
59324
  }
58992
- if (fs$l.existsSync(filePath)) {
59325
+ if (fsUtils.existsSync(filePath)) {
58993
59326
  const headers = isDev
58994
59327
  ? server.config.server.headers
58995
59328
  : server.config.preview.headers;
@@ -59845,11 +60178,14 @@ async function _createServer(inlineConfig = {}, options) {
59845
60178
  }
59846
60179
  }
59847
60180
  };
60181
+ const normalizedPublicDir = normalizePath$3(config.publicDir);
59848
60182
  const onFileAddUnlink = async (file, isUnlink) => {
59849
60183
  file = normalizePath$3(file);
59850
60184
  await container.watchChange(file, { event: isUnlink ? 'delete' : 'create' });
59851
- if (publicFiles && config.publicDir && file.startsWith(config.publicDir)) {
59852
- publicFiles[isUnlink ? 'delete' : 'add'](file.slice(config.publicDir.length));
60185
+ if (config.publicDir && publicFiles) {
60186
+ if (file.startsWith(normalizedPublicDir)) {
60187
+ publicFiles[isUnlink ? 'delete' : 'add'](file.slice(normalizedPublicDir.length));
60188
+ }
59853
60189
  }
59854
60190
  await handleFileAddUnlink(file, server, isUnlink);
59855
60191
  await onHMRUpdate(file, true);
@@ -59861,8 +60197,13 @@ async function _createServer(inlineConfig = {}, options) {
59861
60197
  moduleGraph.onFileChange(file);
59862
60198
  await onHMRUpdate(file, false);
59863
60199
  });
59864
- watcher.on('add', (file) => onFileAddUnlink(file, false));
59865
- watcher.on('unlink', (file) => onFileAddUnlink(file, true));
60200
+ getFsUtils(config).initWatcher?.(watcher);
60201
+ watcher.on('add', (file) => {
60202
+ onFileAddUnlink(file, false);
60203
+ });
60204
+ watcher.on('unlink', (file) => {
60205
+ onFileAddUnlink(file, true);
60206
+ });
59866
60207
  ws.on('vite:invalidate', async ({ path, message }) => {
59867
60208
  const mod = moduleGraph.urlToModuleMap.get(path);
59868
60209
  if (mod && mod.isSelfAccepting && mod.lastHMRTimestamp > 0) {
@@ -59931,7 +60272,7 @@ async function _createServer(inlineConfig = {}, options) {
59931
60272
  middlewares.use(serveStaticMiddleware(server));
59932
60273
  // html fallback
59933
60274
  if (config.appType === 'spa' || config.appType === 'mpa') {
59934
- middlewares.use(htmlFallbackMiddleware(root, config.appType === 'spa'));
60275
+ middlewares.use(htmlFallbackMiddleware(root, config.appType === 'spa', getFsUtils(config)));
59935
60276
  }
59936
60277
  // run post config hooks
59937
60278
  // This is applied before the html middleware so that user middleware can
@@ -60073,6 +60414,7 @@ function resolveServerOptions(root, raw, logger) {
60073
60414
  strict: server.fs?.strict ?? true,
60074
60415
  allow: allowDirs,
60075
60416
  deny,
60417
+ cachedChecks: server.fs?.cachedChecks ?? !!process.env.VITE_SERVER_FS_CACHED_CHECKS,
60076
60418
  };
60077
60419
  if (server.origin?.endsWith('/')) {
60078
60420
  server.origin = server.origin.slice(0, -1);
@@ -61204,6 +61546,7 @@ function extractImportedBindings(id, source, importSpec, importedBindings) {
61204
61546
  */
61205
61547
  function importAnalysisPlugin(config) {
61206
61548
  const { root, base } = config;
61549
+ const fsUtils = getFsUtils(config);
61207
61550
  const clientPublicPath = path$o.posix.join(base, CLIENT_PUBLIC_PATH);
61208
61551
  const enablePartialAccept = config.experimental?.hmrPartialAccept;
61209
61552
  let server;
@@ -61332,7 +61675,7 @@ function importAnalysisPlugin(config) {
61332
61675
  }
61333
61676
  else if (depsOptimizer?.isOptimizedDepFile(resolved.id) ||
61334
61677
  (path$o.isAbsolute(cleanUrl(resolved.id)) &&
61335
- fs$l.existsSync(cleanUrl(resolved.id)))) {
61678
+ fsUtils.existsSync(cleanUrl(resolved.id)))) {
61336
61679
  // an optimized deps may not yet exists in the filesystem, or
61337
61680
  // a regular file exists but is out of root: rewrite to absolute /@fs/ paths
61338
61681
  url = path$o.posix.join(FS_PREFIX, resolved.id);
@@ -61986,6 +62329,7 @@ function preAliasPlugin(config) {
61986
62329
  const findPatterns = getAliasPatterns(config.resolve.alias);
61987
62330
  const isConfiguredAsExternal = createIsConfiguredAsSsrExternal(config);
61988
62331
  const isBuild = config.command === 'build';
62332
+ const fsUtils = getFsUtils(config);
61989
62333
  return {
61990
62334
  name: 'vite:pre-alias',
61991
62335
  async resolveId(id, importer, options) {
@@ -62014,7 +62358,7 @@ function preAliasPlugin(config) {
62014
62358
  const resolvedId = cleanUrl(resolved.id);
62015
62359
  const isVirtual = resolvedId === id || resolvedId.includes('\0');
62016
62360
  if (!isVirtual &&
62017
- fs$l.existsSync(resolvedId) &&
62361
+ fsUtils.existsSync(resolvedId) &&
62018
62362
  !moduleListContains(optimizeDeps.exclude, id) &&
62019
62363
  path$o.isAbsolute(resolvedId) &&
62020
62364
  (isInNodeModules$1(resolvedId) ||
@@ -62712,6 +63056,7 @@ async function resolvePlugins(config, prePlugins, normalPlugins, postPlugins) {
62712
63056
  packageCache: config.packageCache,
62713
63057
  ssrConfig: config.ssr,
62714
63058
  asSrc: true,
63059
+ fsUtils: getFsUtils(config),
62715
63060
  getDepsOptimizer: (ssr) => getDepsOptimizer(config, ssr),
62716
63061
  shouldExternalize: isBuild && config.build.ssr
62717
63062
  ? (id, importer) => shouldExternalizeForSSR(id, importer, config)
@@ -67235,6 +67580,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development',
67235
67580
  tryIndex: true,
67236
67581
  ...options,
67237
67582
  idOnly: true,
67583
+ fsUtils: getFsUtils(resolved),
67238
67584
  }),
67239
67585
  ],
67240
67586
  }));
package/dist/node/cli.js CHANGED
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import fs from 'node:fs';
3
3
  import { performance } from 'node:perf_hooks';
4
4
  import { EventEmitter } from 'events';
5
- import { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-wTaJK0Jt.js';
5
+ import { x as colors, k as createLogger, r as resolveConfig } from './chunks/dep-uAHLeuC6.js';
6
6
  import { VERSION } from './constants.js';
7
7
  import 'node:fs/promises';
8
8
  import 'node:url';
@@ -759,7 +759,7 @@ cli
759
759
  filterDuplicateOptions(options);
760
760
  // output structure is preserved even after bundling so require()
761
761
  // is ok here
762
- const { createServer } = await import('./chunks/dep-wTaJK0Jt.js').then(function (n) { return n.A; });
762
+ const { createServer } = await import('./chunks/dep-uAHLeuC6.js').then(function (n) { return n.A; });
763
763
  try {
764
764
  const server = await createServer({
765
765
  root,
@@ -839,7 +839,7 @@ cli
839
839
  .option('-w, --watch', `[boolean] rebuilds when modules have changed on disk`)
840
840
  .action(async (root, options) => {
841
841
  filterDuplicateOptions(options);
842
- const { build } = await import('./chunks/dep-wTaJK0Jt.js').then(function (n) { return n.C; });
842
+ const { build } = await import('./chunks/dep-uAHLeuC6.js').then(function (n) { return n.C; });
843
843
  const buildOptions = cleanOptions(options);
844
844
  try {
845
845
  await build({
@@ -867,7 +867,7 @@ cli
867
867
  .option('--force', `[boolean] force the optimizer to ignore the cache and re-bundle`)
868
868
  .action(async (root, options) => {
869
869
  filterDuplicateOptions(options);
870
- const { optimizeDeps } = await import('./chunks/dep-wTaJK0Jt.js').then(function (n) { return n.B; });
870
+ const { optimizeDeps } = await import('./chunks/dep-uAHLeuC6.js').then(function (n) { return n.B; });
871
871
  try {
872
872
  const config = await resolveConfig({
873
873
  root,
@@ -893,7 +893,7 @@ cli
893
893
  .option('--outDir <dir>', `[string] output directory (default: dist)`)
894
894
  .action(async (root, options) => {
895
895
  filterDuplicateOptions(options);
896
- const { preview } = await import('./chunks/dep-wTaJK0Jt.js').then(function (n) { return n.D; });
896
+ const { preview } = await import('./chunks/dep-uAHLeuC6.js').then(function (n) { return n.D; });
897
897
  try {
898
898
  const server = await preview({
899
899
  root,
@@ -1572,6 +1572,13 @@ interface FileSystemServeOptions {
1572
1572
  * @default ['.env', '.env.*', '*.crt', '*.pem']
1573
1573
  */
1574
1574
  deny?: string[];
1575
+ /**
1576
+ * Enable caching of fs calls.
1577
+ *
1578
+ * @experimental
1579
+ * @default false
1580
+ */
1581
+ cachedChecks?: boolean;
1575
1582
  }
1576
1583
  type ServerHook = (this: void, server: ViteDevServer) => (() => void) | void | Promise<(() => void) | void>;
1577
1584
  type HttpServer = http.Server | Http2SecureServer;
@@ -2634,6 +2641,18 @@ interface ResolvedSSROptions extends SSROptions {
2634
2641
  optimizeDeps: SsrDepOptimizationOptions;
2635
2642
  }
2636
2643
 
2644
+ interface FsUtils {
2645
+ existsSync: (path: string) => boolean;
2646
+ isDirectory: (path: string) => boolean;
2647
+ tryResolveRealFile: (path: string, preserveSymlinks?: boolean) => string | undefined;
2648
+ tryResolveRealFileWithExtensions: (path: string, extensions: string[], preserveSymlinks?: boolean) => string | undefined;
2649
+ tryResolveRealFileOrType: (path: string, preserveSymlinks?: boolean) => {
2650
+ path?: string;
2651
+ type: 'directory' | 'file';
2652
+ } | undefined;
2653
+ initWatcher?: (watcher: FSWatcher) => void;
2654
+ }
2655
+
2637
2656
  interface ResolveOptions {
2638
2657
  /**
2639
2658
  * @default ['browser', 'module', 'jsnext:main', 'jsnext']
@@ -2656,6 +2675,7 @@ interface InternalResolveOptions extends Required<ResolveOptions> {
2656
2675
  isProduction: boolean;
2657
2676
  ssrConfig?: SSROptions;
2658
2677
  packageCache?: PackageCache;
2678
+ fsUtils?: FsUtils;
2659
2679
  /**
2660
2680
  * src code mode also attempts the following:
2661
2681
  * - resolving /xxx as URLs
@@ -1,6 +1,6 @@
1
1
  export { parseAst, parseAstAsync } from 'rollup/parseAst';
2
- import { i as isInNodeModules } from './chunks/dep-wTaJK0Jt.js';
3
- export { b as build, e as buildErrorMessage, h as createFilter, k as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, u as isFileServingAllowed, l as loadConfigFromFile, v as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, r as resolveConfig, w as resolveEnvPrefix, q as searchForWorkspaceRoot, j as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-wTaJK0Jt.js';
2
+ import { i as isInNodeModules } from './chunks/dep-uAHLeuC6.js';
3
+ export { b as build, e as buildErrorMessage, h as createFilter, k as createLogger, c as createServer, d as defineConfig, f as formatPostcssSourceMap, u as isFileServingAllowed, l as loadConfigFromFile, v as loadEnv, g as mergeAlias, m as mergeConfig, n as normalizePath, o as optimizeDeps, a as preprocessCSS, p as preview, r as resolveConfig, w as resolveEnvPrefix, q as searchForWorkspaceRoot, j as send, s as sortUserPlugins, t as transformWithEsbuild } from './chunks/dep-uAHLeuC6.js';
4
4
  export { VERSION as version } from './constants.js';
5
5
  export { version as esbuildVersion } from 'esbuild';
6
6
  export { VERSION as rollupVersion } from 'rollup';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "5.0.7",
3
+ "version": "5.0.8",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -70,7 +70,7 @@
70
70
  },
71
71
  "devDependencies": {
72
72
  "@ampproject/remapping": "^2.2.1",
73
- "@babel/parser": "^7.23.5",
73
+ "@babel/parser": "^7.23.6",
74
74
  "@jridgewell/trace-mapping": "^0.3.20",
75
75
  "@rollup/plugin-alias": "^5.1.0",
76
76
  "@rollup/plugin-commonjs": "^25.0.7",
@@ -82,7 +82,7 @@
82
82
  "@types/escape-html": "^1.0.4",
83
83
  "@types/pnpapi": "^0.0.5",
84
84
  "acorn": "^8.11.2",
85
- "acorn-walk": "^8.3.0",
85
+ "acorn-walk": "^8.3.1",
86
86
  "cac": "^6.7.14",
87
87
  "chokidar": "^3.5.3",
88
88
  "connect": "^3.7.0",
@@ -126,7 +126,7 @@
126
126
  "tslib": "^2.6.2",
127
127
  "types": "link:./types",
128
128
  "ufo": "^1.3.2",
129
- "ws": "^8.14.2"
129
+ "ws": "^8.15.0"
130
130
  },
131
131
  "peerDependencies": {
132
132
  "@types/node": "^18.0.0 || >=20.0.0",