vite 7.2.0 → 7.2.2

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.
@@ -2406,6 +2406,16 @@ function emptyDir(dir, skip) {
2406
2406
  });
2407
2407
  }
2408
2408
  }
2409
+ function copyDir(srcDir, destDir) {
2410
+ fs.mkdirSync(destDir, { recursive: true });
2411
+ for (const file of fs.readdirSync(srcDir)) {
2412
+ const srcFile = path.resolve(srcDir, file);
2413
+ if (srcFile === destDir) continue;
2414
+ const destFile = path.resolve(destDir, file);
2415
+ if (fs.statSync(srcFile).isDirectory()) copyDir(srcFile, destFile);
2416
+ else fs.copyFileSync(srcFile, destFile);
2417
+ }
2418
+ }
2409
2419
  const ERR_SYMLINK_IN_RECURSIVE_READDIR = "ERR_SYMLINK_IN_RECURSIVE_READDIR";
2410
2420
  async function recursiveReaddir(dir) {
2411
2421
  if (!fs.existsSync(dir)) return [];
@@ -23898,9 +23908,9 @@ function toRelativePath(filename, importer) {
23898
23908
  const relPath = path.posix.relative(path.posix.dirname(importer), filename);
23899
23909
  return relPath[0] === "." ? relPath : `./${relPath}`;
23900
23910
  }
23901
- function indexOfMatchInSlice(str, reg, pos = 0) {
23902
- reg.lastIndex = pos;
23903
- return reg.exec(str)?.index ?? -1;
23911
+ function findPreloadMarker(str, pos = 0) {
23912
+ preloadMarkerRE.lastIndex = pos;
23913
+ return preloadMarkerRE.exec(str)?.index ?? -1;
23904
23914
  }
23905
23915
  /**
23906
23916
  * Helper for preloading CSS and direct imports of async chunks in parallel to
@@ -24186,8 +24196,8 @@ function buildImportAnalysisPlugin(config$2) {
24186
24196
  };
24187
24197
  addDeps(normalizedFile);
24188
24198
  }
24189
- let markerStartPos$1 = indexOfMatchInSlice(code, preloadMarkerRE, end);
24190
- if (markerStartPos$1 === -1 && imports.length === 1) markerStartPos$1 = indexOfMatchInSlice(code, preloadMarkerRE);
24199
+ let markerStartPos$1 = findPreloadMarker(code, end);
24200
+ if (markerStartPos$1 === -1 && imports.length === 1) markerStartPos$1 = findPreloadMarker(code);
24191
24201
  if (markerStartPos$1 > 0) {
24192
24202
  let depsArray = deps.size > 1 || hasRemovedPureCssChunk && deps.size > 0 ? modulePreload === false ? [...deps].filter((d$2) => d$2.endsWith(".css")) : [...deps] : [];
24193
24203
  const resolveDependencies = modulePreload ? modulePreload.resolveDependencies : void 0;
@@ -24216,10 +24226,10 @@ function buildImportAnalysisPlugin(config$2) {
24216
24226
  if (code.startsWith("#!")) s$2.prependLeft(code.indexOf("\n") + 1, mapDepsCode);
24217
24227
  else s$2.prepend(mapDepsCode);
24218
24228
  }
24219
- let markerStartPos = indexOfMatchInSlice(code, preloadMarkerRE);
24229
+ let markerStartPos = findPreloadMarker(code);
24220
24230
  while (markerStartPos >= 0) {
24221
24231
  if (!rewroteMarkerStartPos.has(markerStartPos)) s$2.update(markerStartPos, markerStartPos + preloadMarker.length, "void 0");
24222
- markerStartPos = indexOfMatchInSlice(code, preloadMarkerRE, markerStartPos + preloadMarker.length);
24232
+ markerStartPos = findPreloadMarker(code, markerStartPos + preloadMarker.length);
24223
24233
  }
24224
24234
  if (s$2.hasChanged()) {
24225
24235
  chunk.code = s$2.toString();
@@ -27488,7 +27498,7 @@ function webWorkerPlugin(config$2) {
27488
27498
  emittedAssets.add(asset.fileName);
27489
27499
  const duplicateAsset = bundle[asset.fileName];
27490
27500
  if (duplicateAsset) {
27491
- if (isSameContent(duplicateAsset.type === "asset" ? duplicateAsset.source : duplicateAsset.code, asset.source)) return;
27501
+ if (isSameContent(duplicateAsset.type === "asset" ? duplicateAsset.source : duplicateAsset.code, asset.source)) continue;
27492
27502
  }
27493
27503
  this.emitFile({
27494
27504
  type: "asset",
@@ -33938,10 +33948,7 @@ function prepareOutDir(outDirs, emptyOutDir, environment) {
33938
33948
  }).filter(Boolean), ".git"]);
33939
33949
  if (environment.config.build.copyPublicDir && publicDir && fs.existsSync(publicDir)) {
33940
33950
  if (!areSeparateFolders(outDir, publicDir)) environment.logger.warn(import_picocolors$5.default.yellow(`\n${import_picocolors$5.default.bold(`(!)`)} The public directory feature may not work correctly. outDir ${import_picocolors$5.default.white(import_picocolors$5.default.dim(outDir))} and publicDir ${import_picocolors$5.default.white(import_picocolors$5.default.dim(publicDir))} are not separate folders.\n`));
33941
- fs.cpSync(publicDir, outDir, {
33942
- recursive: true,
33943
- mode: fs.constants.COPYFILE_FICLONE
33944
- });
33951
+ copyDir(publicDir, outDir);
33945
33952
  }
33946
33953
  }
33947
33954
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "7.2.0",
3
+ "version": "7.2.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",