@nuxt/vite-builder-nightly 4.2.3-29426977.7b835385 → 4.2.3-29427013.01d459e0

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.
Files changed (2) hide show
  1. package/dist/index.mjs +33 -20
  2. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -142,7 +142,7 @@ function resolveServerEntry(config) {
142
142
  throw new Error("No entry found in rollupOptions.input");
143
143
  }
144
144
 
145
- const QUERY_RE$1 = /\?.+$/;
145
+ const QUERY_RE$2 = /\?.+$/;
146
146
  function TypeCheckPlugin(nuxt) {
147
147
  let entry;
148
148
  let sourcemap;
@@ -161,7 +161,7 @@ function TypeCheckPlugin(nuxt) {
161
161
  }
162
162
  },
163
163
  transform(code, id) {
164
- if (id.replace(QUERY_RE$1, "") !== entry) {
164
+ if (id.replace(QUERY_RE$2, "") !== entry) {
165
165
  return;
166
166
  }
167
167
  const s = new MagicString(code);
@@ -174,7 +174,7 @@ function TypeCheckPlugin(nuxt) {
174
174
  };
175
175
  }
176
176
 
177
- const QUERY_RE = /\?.+$/;
177
+ const QUERY_RE$1 = /\?.+$/;
178
178
  function ModulePreloadPolyfillPlugin() {
179
179
  let isDisabled = false;
180
180
  let entry;
@@ -192,7 +192,7 @@ function ModulePreloadPolyfillPlugin() {
192
192
  }
193
193
  },
194
194
  transform(code, id) {
195
- if (isDisabled || id.replace(QUERY_RE, "") !== entry) {
195
+ if (isDisabled || id.replace(QUERY_RE$1, "") !== entry) {
196
196
  return;
197
197
  }
198
198
  const s = new MagicString(code);
@@ -1587,6 +1587,7 @@ async function resolveCSSOptions(nuxt) {
1587
1587
  }
1588
1588
 
1589
1589
  const SUPPORTED_FILES_RE = /\.(?:vue|(?:[cm]?j|t)sx?)$/;
1590
+ const QUERY_RE = /\?.+$/;
1590
1591
  function SSRStylesPlugin(nuxt) {
1591
1592
  if (nuxt.options.dev) {
1592
1593
  return;
@@ -1617,13 +1618,22 @@ function SSRStylesPlugin(nuxt) {
1617
1618
  shouldInline: nuxt.options.features.inlineStyles,
1618
1619
  globalCSS: nuxt.options.css
1619
1620
  };
1620
- const relativeToSrcDir = (path) => relative(nuxt.options.srcDir, path);
1621
+ const relativeCache = /* @__PURE__ */ new Map();
1622
+ const relativeToSrcDir = (path) => {
1623
+ let cached = relativeCache.get(path);
1624
+ if (cached === void 0) {
1625
+ cached = relative(nuxt.options.srcDir, path);
1626
+ relativeCache.set(path, cached);
1627
+ }
1628
+ return cached;
1629
+ };
1621
1630
  const warnCache = /* @__PURE__ */ new Set();
1622
1631
  const components = nuxt.apps.default.components || [];
1623
1632
  const islands = components.filter(
1624
1633
  (component) => component.island || // .server components without a corresponding .client component will need to be rendered as an island
1625
1634
  component.mode === "server" && !components.some((c) => c.pascalName === component.pascalName && c.mode === "client")
1626
1635
  );
1636
+ const islandPaths = new Set(islands.map((c) => c.filePath));
1627
1637
  let entry;
1628
1638
  return {
1629
1639
  name: "ssr-styles",
@@ -1739,7 +1749,7 @@ function SSRStylesPlugin(nuxt) {
1739
1749
  }
1740
1750
  const relativePath = relativeToSrcDir(moduleId);
1741
1751
  if (relativePath in cssMap) {
1742
- cssMap[relativePath].inBundle = cssMap[relativePath].inBundle ?? (isVue(moduleId) && !!relativeToSrcDir(moduleId) || isEntry);
1752
+ cssMap[relativePath].inBundle = cssMap[relativePath].inBundle ?? (isVue(moduleId) && !!relativePath || isEntry);
1743
1753
  }
1744
1754
  }
1745
1755
  return null;
@@ -1776,14 +1786,14 @@ function SSRStylesPlugin(nuxt) {
1776
1786
  return;
1777
1787
  }
1778
1788
  const { pathname, search } = parseURL(decodeURIComponent(pathToFileURL(id).href));
1779
- if (!(id in clientCSSMap) && !islands.some((c) => c.filePath === pathname)) {
1789
+ if (!(id in clientCSSMap) && !islandPaths.has(pathname)) {
1780
1790
  return;
1781
1791
  }
1782
1792
  const query = parseQuery(search);
1783
1793
  if (query.macro || query.nuxt_component) {
1784
1794
  return;
1785
1795
  }
1786
- if (!islands.some((c) => c.filePath === pathname)) {
1796
+ if (!islandPaths.has(pathname)) {
1787
1797
  if (options.shouldInline === false || typeof options.shouldInline === "function" && !options.shouldInline(id)) {
1788
1798
  return;
1789
1799
  }
@@ -1791,11 +1801,16 @@ function SSRStylesPlugin(nuxt) {
1791
1801
  const relativeId = relativeToSrcDir(id);
1792
1802
  const idMap = cssMap[relativeId] ||= { files: [] };
1793
1803
  const emittedIds = /* @__PURE__ */ new Set();
1804
+ const idFilename = filename(id);
1794
1805
  let styleCtr = 0;
1795
1806
  const ids = clientCSSMap[id] || [];
1796
1807
  for (const file of ids) {
1808
+ if (emittedIds.has(file)) {
1809
+ continue;
1810
+ }
1811
+ const fileInline = file + "?inline&used";
1797
1812
  const resolved = await this.resolve(file) ?? await this.resolve(file, id);
1798
- const res = await this.resolve(file + "?inline&used") ?? await this.resolve(file + "?inline&used", id);
1813
+ const res = await this.resolve(fileInline) ?? await this.resolve(fileInline, id);
1799
1814
  if (!resolved || !res) {
1800
1815
  if (!warnCache.has(file)) {
1801
1816
  warnCache.add(file);
@@ -1803,13 +1818,11 @@ function SSRStylesPlugin(nuxt) {
1803
1818
  }
1804
1819
  continue;
1805
1820
  }
1806
- if (emittedIds.has(file)) {
1807
- continue;
1808
- }
1821
+ emittedIds.add(file);
1809
1822
  const ref = this.emitFile({
1810
1823
  type: "chunk",
1811
- name: `${filename(id)}-styles-${++styleCtr}.mjs`,
1812
- id: file + "?inline&used"
1824
+ name: `${idFilename}-styles-${++styleCtr}.mjs`,
1825
+ id: fileInline
1813
1826
  });
1814
1827
  idRefMap[relativeToSrcDir(file)] = ref;
1815
1828
  idMap.files.push(ref);
@@ -1818,15 +1831,15 @@ function SSRStylesPlugin(nuxt) {
1818
1831
  return;
1819
1832
  }
1820
1833
  for (const i of findStaticImports(code)) {
1821
- const { type } = parseQuery(i.specifier);
1822
- if (type !== "style" && !i.specifier.endsWith(".css")) {
1834
+ if (!i.specifier.endsWith(".css") && parseQuery(i.specifier).type !== "style") {
1823
1835
  continue;
1824
1836
  }
1825
1837
  const resolved = await this.resolve(i.specifier, id);
1826
1838
  if (!resolved) {
1827
1839
  continue;
1828
1840
  }
1829
- if (!await this.resolve(resolved.id + "?inline&used")) {
1841
+ const resolvedIdInline = resolved.id + "?inline&used";
1842
+ if (!await this.resolve(resolvedIdInline)) {
1830
1843
  if (!warnCache.has(resolved.id)) {
1831
1844
  warnCache.add(resolved.id);
1832
1845
  this.warn(`[nuxt] Cannot extract styles for \`${i.specifier}\`. Its styles will not be inlined when server-rendering.`);
@@ -1838,8 +1851,8 @@ function SSRStylesPlugin(nuxt) {
1838
1851
  }
1839
1852
  const ref = this.emitFile({
1840
1853
  type: "chunk",
1841
- name: `${filename(id)}-styles-${++styleCtr}.mjs`,
1842
- id: resolved.id + "?inline&used"
1854
+ name: `${idFilename}-styles-${++styleCtr}.mjs`,
1855
+ id: resolvedIdInline
1843
1856
  });
1844
1857
  idRefMap[relativeToSrcDir(resolved.id)] = ref;
1845
1858
  idMap.files.push(ref);
@@ -1850,7 +1863,7 @@ function SSRStylesPlugin(nuxt) {
1850
1863
  };
1851
1864
  }
1852
1865
  function filename(name) {
1853
- return filename$1(name.replace(/\?.+$/, ""));
1866
+ return filename$1(name.replace(QUERY_RE, ""));
1854
1867
  }
1855
1868
 
1856
1869
  function ReplacePlugin() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuxt/vite-builder-nightly",
3
- "version": "4.2.3-29426977.7b835385",
3
+ "version": "4.2.3-29427013.01d459e0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/nuxt/nuxt.git",
@@ -21,7 +21,7 @@
21
21
  "dist"
22
22
  ],
23
23
  "devDependencies": {
24
- "@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.3-29426977.7b835385",
24
+ "@nuxt/schema": "npm:@nuxt/schema-nightly@4.2.3-29427013.01d459e0",
25
25
  "nitropack": "2.12.9",
26
26
  "rolldown": "1.0.0-beta.53",
27
27
  "rollup": "4.53.3",
@@ -29,7 +29,7 @@
29
29
  "vue": "3.5.25"
30
30
  },
31
31
  "dependencies": {
32
- "@nuxt/kit": "npm:@nuxt/kit-nightly@4.2.3-29426977.7b835385",
32
+ "@nuxt/kit": "npm:@nuxt/kit-nightly@4.2.3-29427013.01d459e0",
33
33
  "@rollup/plugin-replace": "^6.0.3",
34
34
  "@vitejs/plugin-vue": "^6.0.2",
35
35
  "@vitejs/plugin-vue-jsx": "^5.1.2",
@@ -61,7 +61,7 @@
61
61
  "vue-bundle-renderer": "^2.2.0"
62
62
  },
63
63
  "peerDependencies": {
64
- "nuxt": "npm:nuxt-nightly@4.2.3-29426977.7b835385",
64
+ "nuxt": "npm:nuxt-nightly@4.2.3-29427013.01d459e0",
65
65
  "rolldown": "^1.0.0-beta.38",
66
66
  "vue": "^3.3.4"
67
67
  },