vite 8.0.2 → 8.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import "@vite/env";
2
- //#region \0@oxc-project+runtime@0.121.0/helpers/typeof.js
2
+ //#region \0@oxc-project+runtime@0.122.0/helpers/typeof.js
3
3
  function _typeof(o) {
4
4
  "@babel/helpers - typeof";
5
5
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -9,7 +9,7 @@ function _typeof(o) {
9
9
  }, _typeof(o);
10
10
  }
11
11
  //#endregion
12
- //#region \0@oxc-project+runtime@0.121.0/helpers/toPrimitive.js
12
+ //#region \0@oxc-project+runtime@0.122.0/helpers/toPrimitive.js
13
13
  function toPrimitive(t, r) {
14
14
  if ("object" != _typeof(t) || !t) return t;
15
15
  var e = t[Symbol.toPrimitive];
@@ -21,13 +21,13 @@ function toPrimitive(t, r) {
21
21
  return ("string" === r ? String : Number)(t);
22
22
  }
23
23
  //#endregion
24
- //#region \0@oxc-project+runtime@0.121.0/helpers/toPropertyKey.js
24
+ //#region \0@oxc-project+runtime@0.122.0/helpers/toPropertyKey.js
25
25
  function toPropertyKey(t) {
26
26
  var i = toPrimitive(t, "string");
27
27
  return "symbol" == _typeof(i) ? i : i + "";
28
28
  }
29
29
  //#endregion
30
- //#region \0@oxc-project+runtime@0.121.0/helpers/defineProperty.js
30
+ //#region \0@oxc-project+runtime@0.122.0/helpers/defineProperty.js
31
31
  function _defineProperty(e, r, t) {
32
32
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
33
33
  value: t,
@@ -4555,6 +4555,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4555
4555
  return new _processor["default"](processor);
4556
4556
  };
4557
4557
  Object.assign(parser, selectors);
4558
+ delete parser.__esModule;
4558
4559
  exports["default"] = parser;
4559
4560
  module.exports = exports.default;
4560
4561
  }));
@@ -11328,6 +11328,7 @@ function isRefIdentifier(id, parent, parentStack) {
11328
11328
  if (isNodeInPattern(parent) && parent.value === id) return false;
11329
11329
  if (parent.type === "ArrayPattern" && !isInDestructuringAssignment(parent, parentStack)) return false;
11330
11330
  if (parent.type === "MemberExpression" && parent.property === id && !parent.computed) return false;
11331
+ if (parent.type === "MetaProperty") return false;
11331
11332
  if (parent.type === "ExportSpecifier" || parent.type === "ExportAllDeclaration") return false;
11332
11333
  if (id.name === "arguments") return false;
11333
11334
  return true;
@@ -22126,6 +22127,40 @@ function handleParseError(parserError, html, filePath, warnings) {
22126
22127
  warnings[parseError.code] ??= `Unable to parse HTML; ${parseError.message}\n at ${parseError.loc.file}:${parseError.loc.line}:${parseError.loc.column}\n` + parseError.frame;
22127
22128
  }
22128
22129
  /**
22130
+ * Collects CSS files for a chunk by traversing its imports depth-first,
22131
+ * using a cache to avoid re-analyzing chunks while still returning the
22132
+ * correct files when the same chunk is reached via different entry points.
22133
+ */
22134
+ function getCssFilesForChunk(chunk, bundle, analyzedImportedCssFiles, seenChunks = /* @__PURE__ */ new Set(), seenCss = /* @__PURE__ */ new Set()) {
22135
+ if (seenChunks.has(chunk.fileName)) return [];
22136
+ seenChunks.add(chunk.fileName);
22137
+ if (analyzedImportedCssFiles.has(chunk)) {
22138
+ const additionals = analyzedImportedCssFiles.get(chunk).filter((file) => !seenCss.has(file));
22139
+ additionals.forEach((file) => seenCss.add(file));
22140
+ return additionals;
22141
+ }
22142
+ const allFiles = [];
22143
+ const filteredFiles = [];
22144
+ chunk.imports.forEach((file) => {
22145
+ const importee = bundle[file];
22146
+ if (importee?.type === "chunk") {
22147
+ const importeeCss = getCssFilesForChunk(importee, bundle, analyzedImportedCssFiles, seenChunks, seenCss);
22148
+ filteredFiles.push(...importeeCss);
22149
+ if (analyzedImportedCssFiles.has(importee)) allFiles.push(...analyzedImportedCssFiles.get(importee));
22150
+ else allFiles.push(...importeeCss);
22151
+ }
22152
+ });
22153
+ chunk.viteMetadata.importedCss.forEach((file) => {
22154
+ allFiles.push(file);
22155
+ if (!seenCss.has(file)) {
22156
+ seenCss.add(file);
22157
+ filteredFiles.push(file);
22158
+ }
22159
+ });
22160
+ analyzedImportedCssFiles.set(chunk, unique(allFiles));
22161
+ return filteredFiles;
22162
+ }
22163
+ /**
22129
22164
  * Compiles index.html into an entry js module
22130
22165
  */
22131
22166
  function buildHtmlPlugin(config) {
@@ -22343,29 +22378,7 @@ function buildHtmlPlugin(config) {
22343
22378
  href: toOutputPath(file)
22344
22379
  }
22345
22380
  });
22346
- const getCssFilesForChunk = (chunk, seenChunks = /* @__PURE__ */ new Set(), seenCss = /* @__PURE__ */ new Set()) => {
22347
- if (seenChunks.has(chunk.fileName)) return [];
22348
- seenChunks.add(chunk.fileName);
22349
- if (analyzedImportedCssFiles.has(chunk)) {
22350
- const additionals = analyzedImportedCssFiles.get(chunk).filter((file) => !seenCss.has(file));
22351
- additionals.forEach((file) => seenCss.add(file));
22352
- return additionals;
22353
- }
22354
- const files = [];
22355
- chunk.imports.forEach((file) => {
22356
- const importee = bundle[file];
22357
- if (importee?.type === "chunk") files.push(...getCssFilesForChunk(importee, seenChunks, seenCss));
22358
- });
22359
- analyzedImportedCssFiles.set(chunk, files);
22360
- chunk.viteMetadata.importedCss.forEach((file) => {
22361
- if (!seenCss.has(file)) {
22362
- seenCss.add(file);
22363
- files.push(file);
22364
- }
22365
- });
22366
- return files;
22367
- };
22368
- const getCssTagsForChunk = (chunk, toOutputPath) => getCssFilesForChunk(chunk).map((file) => toStyleSheetLinkTag(file, toOutputPath));
22381
+ const getCssTagsForChunk = (chunk, toOutputPath) => getCssFilesForChunk(chunk, bundle, analyzedImportedCssFiles).map((file) => toStyleSheetLinkTag(file, toOutputPath));
22369
22382
  for (const [normalizedId, html] of processedHtml(this)) {
22370
22383
  const relativeUrlPath = normalizePath(path.relative(config.root, normalizedId));
22371
22384
  const assetsBase = getBaseInHTML(relativeUrlPath, config);
@@ -30621,13 +30634,20 @@ const svelteScriptModuleRE = /\bcontext\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+)
30621
30634
  const svelteModuleRE = /\smodule\b/i;
30622
30635
  function rolldownScanPlugin(environment, depImports, missing, entries) {
30623
30636
  const seen = /* @__PURE__ */ new Map();
30624
- async function resolveId(id, importer) {
30625
- return environment.pluginContainer.resolveId(id, importer && normalizePath(importer), { scan: true });
30637
+ async function resolveId(id, importer, options) {
30638
+ return environment.pluginContainer.resolveId(id, importer && normalizePath(importer), {
30639
+ scan: true,
30640
+ ...options
30641
+ });
30626
30642
  }
30627
- const resolve = async (id, importer) => {
30628
- const key = id + (importer && path.dirname(importer));
30643
+ const resolve = async (id, importer, options) => {
30644
+ const key = JSON.stringify([
30645
+ id,
30646
+ importer && path.dirname(importer),
30647
+ options
30648
+ ]);
30629
30649
  if (seen.has(key)) return seen.get(key);
30630
- const res = (await resolveId(id, importer))?.id;
30650
+ const res = (await resolveId(id, importer, options))?.id;
30631
30651
  seen.set(key, res);
30632
30652
  return res;
30633
30653
  };
@@ -88,7 +88,7 @@ const isAbsolute = function(p) {
88
88
  }, dirname = function(p) {
89
89
  let segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
90
90
  return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute(p) ? "/" : ".");
91
- }, decodeBase64 = typeof atob < "u" ? atob : (str) => Buffer.from(str, "base64").toString("utf-8"), percentRegEx = /%/g, backslashRegEx = /\\/g, newlineRegEx = /\n/g, carriageReturnRegEx = /\r/g, tabRegEx = /\t/g, questionRegex = /\?/g, hashRegex = /#/g;
91
+ }, textDecoder = new TextDecoder(), decodeBase64 = typeof Buffer == "function" && typeof Buffer.from == "function" ? (base64) => Buffer.from(base64, "base64").toString("utf-8") : (base64) => textDecoder.decode(Uint8Array.from(atob(base64), (c) => c.charCodeAt(0))), percentRegEx = /%/g, backslashRegEx = /\\/g, newlineRegEx = /\n/g, carriageReturnRegEx = /\r/g, tabRegEx = /\t/g, questionRegex = /\?/g, hashRegex = /#/g;
92
92
  function encodePathChars(filepath) {
93
93
  return filepath.indexOf("%") !== -1 && (filepath = filepath.replace(percentRegEx, "%25")), !isWindows && filepath.indexOf("\\") !== -1 && (filepath = filepath.replace(backslashRegEx, "%5C")), filepath.indexOf("\n") !== -1 && (filepath = filepath.replace(newlineRegEx, "%0A")), filepath.indexOf("\r") !== -1 && (filepath = filepath.replace(carriageReturnRegEx, "%0D")), filepath.indexOf(" ") !== -1 && (filepath = filepath.replace(tabRegEx, "%09")), filepath;
94
94
  }
@@ -749,10 +749,14 @@ function createHMRHandlerForRunner(runner) {
749
749
  let { triggeredBy } = payload, clearEntrypointUrls = triggeredBy ? getModulesEntrypoints(runner, getModulesByFile(runner, slash(triggeredBy))) : findAllEntrypoints(runner);
750
750
  if (!clearEntrypointUrls.size) break;
751
751
  hmrClient.logger.debug("program reload"), await hmrClient.notifyListeners("vite:beforeFullReload", payload), runner.evaluatedModules.clear();
752
- for (let url of clearEntrypointUrls) try {
753
- await runner.import(url);
754
- } catch (err) {
755
- err.code !== "ERR_OUTDATED_OPTIMIZED_DEP" && hmrClient.logger.error(`An error happened during full reload\n${err.message}\n${err.stack}`);
752
+ for (let url of clearEntrypointUrls) {
753
+ if (runner.isClosed()) break;
754
+ try {
755
+ await runner.import(url);
756
+ } catch (err) {
757
+ if (runner.isClosed()) break;
758
+ err.code !== "ERR_OUTDATED_OPTIMIZED_DEP" && hmrClient.logger.error(`An error happened during full reload\n${err.message}\n${err.stack}`);
759
+ }
756
760
  }
757
761
  break;
758
762
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite",
3
- "version": "8.0.2",
3
+ "version": "8.0.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "Evan You",
@@ -61,9 +61,9 @@
61
61
  "//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
62
62
  "dependencies": {
63
63
  "lightningcss": "^1.32.0",
64
- "picomatch": "^4.0.3",
64
+ "picomatch": "^4.0.4",
65
65
  "postcss": "^8.5.8",
66
- "rolldown": "1.0.0-rc.11",
66
+ "rolldown": "1.0.0-rc.12",
67
67
  "tinyglobby": "^0.2.15"
68
68
  },
69
69
  "optionalDependencies": {