@voidzero-dev/vite-plus-core 0.1.15-alpha.1 → 0.1.15-alpha.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.
@@ -72,7 +72,7 @@ var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
72
72
  }));
73
73
  //#endregion
74
74
  //#region ../../vite/packages/vite/package.json
75
- var version = "8.0.2";
75
+ var version = "8.0.3";
76
76
  //#endregion
77
77
  //#region ../../vite/packages/vite/src/node/constants.ts
78
78
  const ROLLUP_HOOKS = [
@@ -16170,6 +16170,7 @@ function isRefIdentifier(id, parent, parentStack) {
16170
16170
  if (isNodeInPattern(parent) && parent.value === id) return false;
16171
16171
  if (parent.type === "ArrayPattern" && !isInDestructuringAssignment(parent, parentStack)) return false;
16172
16172
  if (parent.type === "MemberExpression" && parent.property === id && !parent.computed) return false;
16173
+ if (parent.type === "MetaProperty") return false;
16173
16174
  if (parent.type === "ExportSpecifier" || parent.type === "ExportAllDeclaration") return false;
16174
16175
  if (id.name === "arguments") return false;
16175
16176
  return true;
@@ -27695,6 +27696,40 @@ function handleParseError(parserError, html, filePath, warnings) {
27695
27696
  warnings[parseError.code] ??= `Unable to parse HTML; ${parseError.message}\n at ${parseError.loc.file}:${parseError.loc.line}:${parseError.loc.column}\n` + parseError.frame;
27696
27697
  }
27697
27698
  /**
27699
+ * Collects CSS files for a chunk by traversing its imports depth-first,
27700
+ * using a cache to avoid re-analyzing chunks while still returning the
27701
+ * correct files when the same chunk is reached via different entry points.
27702
+ */
27703
+ function getCssFilesForChunk(chunk, bundle, analyzedImportedCssFiles, seenChunks = /* @__PURE__ */ new Set(), seenCss = /* @__PURE__ */ new Set()) {
27704
+ if (seenChunks.has(chunk.fileName)) return [];
27705
+ seenChunks.add(chunk.fileName);
27706
+ if (analyzedImportedCssFiles.has(chunk)) {
27707
+ const additionals = analyzedImportedCssFiles.get(chunk).filter((file) => !seenCss.has(file));
27708
+ additionals.forEach((file) => seenCss.add(file));
27709
+ return additionals;
27710
+ }
27711
+ const allFiles = [];
27712
+ const filteredFiles = [];
27713
+ chunk.imports.forEach((file) => {
27714
+ const importee = bundle[file];
27715
+ if (importee?.type === "chunk") {
27716
+ const importeeCss = getCssFilesForChunk(importee, bundle, analyzedImportedCssFiles, seenChunks, seenCss);
27717
+ filteredFiles.push(...importeeCss);
27718
+ if (analyzedImportedCssFiles.has(importee)) allFiles.push(...analyzedImportedCssFiles.get(importee));
27719
+ else allFiles.push(...importeeCss);
27720
+ }
27721
+ });
27722
+ chunk.viteMetadata.importedCss.forEach((file) => {
27723
+ allFiles.push(file);
27724
+ if (!seenCss.has(file)) {
27725
+ seenCss.add(file);
27726
+ filteredFiles.push(file);
27727
+ }
27728
+ });
27729
+ analyzedImportedCssFiles.set(chunk, unique(allFiles));
27730
+ return filteredFiles;
27731
+ }
27732
+ /**
27698
27733
  * Compiles index.html into an entry js module
27699
27734
  */
27700
27735
  function buildHtmlPlugin(config) {
@@ -27912,29 +27947,7 @@ function buildHtmlPlugin(config) {
27912
27947
  href: toOutputPath(file)
27913
27948
  }
27914
27949
  });
27915
- const getCssFilesForChunk = (chunk, seenChunks = /* @__PURE__ */ new Set(), seenCss = /* @__PURE__ */ new Set()) => {
27916
- if (seenChunks.has(chunk.fileName)) return [];
27917
- seenChunks.add(chunk.fileName);
27918
- if (analyzedImportedCssFiles.has(chunk)) {
27919
- const additionals = analyzedImportedCssFiles.get(chunk).filter((file) => !seenCss.has(file));
27920
- additionals.forEach((file) => seenCss.add(file));
27921
- return additionals;
27922
- }
27923
- const files = [];
27924
- chunk.imports.forEach((file) => {
27925
- const importee = bundle[file];
27926
- if (importee?.type === "chunk") files.push(...getCssFilesForChunk(importee, seenChunks, seenCss));
27927
- });
27928
- analyzedImportedCssFiles.set(chunk, files);
27929
- chunk.viteMetadata.importedCss.forEach((file) => {
27930
- if (!seenCss.has(file)) {
27931
- seenCss.add(file);
27932
- files.push(file);
27933
- }
27934
- });
27935
- return files;
27936
- };
27937
- const getCssTagsForChunk = (chunk, toOutputPath) => getCssFilesForChunk(chunk).map((file) => toStyleSheetLinkTag(file, toOutputPath));
27950
+ const getCssTagsForChunk = (chunk, toOutputPath) => getCssFilesForChunk(chunk, bundle, analyzedImportedCssFiles).map((file) => toStyleSheetLinkTag(file, toOutputPath));
27938
27951
  for (const [normalizedId, html] of processedHtml(this)) {
27939
27952
  const relativeUrlPath = normalizePath$1(path.relative(config.root, normalizedId));
27940
27953
  const assetsBase = getBaseInHTML(relativeUrlPath, config);
@@ -36190,13 +36203,20 @@ const svelteScriptModuleRE = /\bcontext\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s'">]+)
36190
36203
  const svelteModuleRE = /\smodule\b/i;
36191
36204
  function rolldownScanPlugin(environment, depImports, missing, entries) {
36192
36205
  const seen = /* @__PURE__ */ new Map();
36193
- async function resolveId(id, importer) {
36194
- return environment.pluginContainer.resolveId(id, importer && normalizePath$1(importer), { scan: true });
36206
+ async function resolveId(id, importer, options) {
36207
+ return environment.pluginContainer.resolveId(id, importer && normalizePath$1(importer), {
36208
+ scan: true,
36209
+ ...options
36210
+ });
36195
36211
  }
36196
- const resolve = async (id, importer) => {
36197
- const key = id + (importer && path.dirname(importer));
36212
+ const resolve = async (id, importer, options) => {
36213
+ const key = JSON.stringify([
36214
+ id,
36215
+ importer && path.dirname(importer),
36216
+ options
36217
+ ]);
36198
36218
  if (seen.has(key)) return seen.get(key);
36199
- const res = (await resolveId(id, importer))?.id;
36219
+ const res = (await resolveId(id, importer, options))?.id;
36200
36220
  seen.set(key, res);
36201
36221
  return res;
36202
36222
  };
@@ -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": "@voidzero-dev/vite-plus-core",
3
- "version": "0.1.15-alpha.1",
3
+ "version": "0.1.15-alpha.3",
4
4
  "description": "The Unified Toolchain for the Web",
5
5
  "homepage": "https://viteplus.dev/guide",
6
6
  "bugs": {
@@ -129,7 +129,7 @@
129
129
  "tree-kill": "^1.2.2",
130
130
  "tsdown": "^0.21.5",
131
131
  "rolldown": "1.0.0-rc.12",
132
- "vite": "npm:@voidzero-dev/vite-plus-core@0.1.15-alpha.1"
132
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.1.15-alpha.3"
133
133
  },
134
134
  "peerDependencies": {
135
135
  "@arethetypeswrong/core": "^0.18.1",
@@ -214,7 +214,7 @@
214
214
  "node": "^20.19.0 || >=22.12.0"
215
215
  },
216
216
  "bundledVersions": {
217
- "vite": "8.0.2",
217
+ "vite": "8.0.3",
218
218
  "rolldown": "1.0.0-rc.12",
219
219
  "tsdown": "0.21.5"
220
220
  },