@nuxt/vite-builder-nightly 4.2.3-29426963.691e6887 → 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 +38 -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",
@@ -1638,6 +1648,11 @@ function SSRStylesPlugin(nuxt) {
1638
1648
  enforce: "pre",
1639
1649
  resolveId: {
1640
1650
  order: "pre",
1651
+ filter: {
1652
+ id: {
1653
+ include: [/^#build\/css$/, /\.vue$/, IS_CSS_RE]
1654
+ }
1655
+ },
1641
1656
  async handler(id, importer, _options) {
1642
1657
  if (options.shouldInline === false || typeof options.shouldInline === "function" && !options.shouldInline(importer)) {
1643
1658
  return;
@@ -1734,7 +1749,7 @@ function SSRStylesPlugin(nuxt) {
1734
1749
  }
1735
1750
  const relativePath = relativeToSrcDir(moduleId);
1736
1751
  if (relativePath in cssMap) {
1737
- cssMap[relativePath].inBundle = cssMap[relativePath].inBundle ?? (isVue(moduleId) && !!relativeToSrcDir(moduleId) || isEntry);
1752
+ cssMap[relativePath].inBundle = cssMap[relativePath].inBundle ?? (isVue(moduleId) && !!relativePath || isEntry);
1738
1753
  }
1739
1754
  }
1740
1755
  return null;
@@ -1771,14 +1786,14 @@ function SSRStylesPlugin(nuxt) {
1771
1786
  return;
1772
1787
  }
1773
1788
  const { pathname, search } = parseURL(decodeURIComponent(pathToFileURL(id).href));
1774
- if (!(id in clientCSSMap) && !islands.some((c) => c.filePath === pathname)) {
1789
+ if (!(id in clientCSSMap) && !islandPaths.has(pathname)) {
1775
1790
  return;
1776
1791
  }
1777
1792
  const query = parseQuery(search);
1778
1793
  if (query.macro || query.nuxt_component) {
1779
1794
  return;
1780
1795
  }
1781
- if (!islands.some((c) => c.filePath === pathname)) {
1796
+ if (!islandPaths.has(pathname)) {
1782
1797
  if (options.shouldInline === false || typeof options.shouldInline === "function" && !options.shouldInline(id)) {
1783
1798
  return;
1784
1799
  }
@@ -1786,11 +1801,16 @@ function SSRStylesPlugin(nuxt) {
1786
1801
  const relativeId = relativeToSrcDir(id);
1787
1802
  const idMap = cssMap[relativeId] ||= { files: [] };
1788
1803
  const emittedIds = /* @__PURE__ */ new Set();
1804
+ const idFilename = filename(id);
1789
1805
  let styleCtr = 0;
1790
1806
  const ids = clientCSSMap[id] || [];
1791
1807
  for (const file of ids) {
1808
+ if (emittedIds.has(file)) {
1809
+ continue;
1810
+ }
1811
+ const fileInline = file + "?inline&used";
1792
1812
  const resolved = await this.resolve(file) ?? await this.resolve(file, id);
1793
- 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);
1794
1814
  if (!resolved || !res) {
1795
1815
  if (!warnCache.has(file)) {
1796
1816
  warnCache.add(file);
@@ -1798,13 +1818,11 @@ function SSRStylesPlugin(nuxt) {
1798
1818
  }
1799
1819
  continue;
1800
1820
  }
1801
- if (emittedIds.has(file)) {
1802
- continue;
1803
- }
1821
+ emittedIds.add(file);
1804
1822
  const ref = this.emitFile({
1805
1823
  type: "chunk",
1806
- name: `${filename(id)}-styles-${++styleCtr}.mjs`,
1807
- id: file + "?inline&used"
1824
+ name: `${idFilename}-styles-${++styleCtr}.mjs`,
1825
+ id: fileInline
1808
1826
  });
1809
1827
  idRefMap[relativeToSrcDir(file)] = ref;
1810
1828
  idMap.files.push(ref);
@@ -1813,15 +1831,15 @@ function SSRStylesPlugin(nuxt) {
1813
1831
  return;
1814
1832
  }
1815
1833
  for (const i of findStaticImports(code)) {
1816
- const { type } = parseQuery(i.specifier);
1817
- if (type !== "style" && !i.specifier.endsWith(".css")) {
1834
+ if (!i.specifier.endsWith(".css") && parseQuery(i.specifier).type !== "style") {
1818
1835
  continue;
1819
1836
  }
1820
1837
  const resolved = await this.resolve(i.specifier, id);
1821
1838
  if (!resolved) {
1822
1839
  continue;
1823
1840
  }
1824
- if (!await this.resolve(resolved.id + "?inline&used")) {
1841
+ const resolvedIdInline = resolved.id + "?inline&used";
1842
+ if (!await this.resolve(resolvedIdInline)) {
1825
1843
  if (!warnCache.has(resolved.id)) {
1826
1844
  warnCache.add(resolved.id);
1827
1845
  this.warn(`[nuxt] Cannot extract styles for \`${i.specifier}\`. Its styles will not be inlined when server-rendering.`);
@@ -1833,8 +1851,8 @@ function SSRStylesPlugin(nuxt) {
1833
1851
  }
1834
1852
  const ref = this.emitFile({
1835
1853
  type: "chunk",
1836
- name: `${filename(id)}-styles-${++styleCtr}.mjs`,
1837
- id: resolved.id + "?inline&used"
1854
+ name: `${idFilename}-styles-${++styleCtr}.mjs`,
1855
+ id: resolvedIdInline
1838
1856
  });
1839
1857
  idRefMap[relativeToSrcDir(resolved.id)] = ref;
1840
1858
  idMap.files.push(ref);
@@ -1845,7 +1863,7 @@ function SSRStylesPlugin(nuxt) {
1845
1863
  };
1846
1864
  }
1847
1865
  function filename(name) {
1848
- return filename$1(name.replace(/\?.+$/, ""));
1866
+ return filename$1(name.replace(QUERY_RE, ""));
1849
1867
  }
1850
1868
 
1851
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-29426963.691e6887",
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-29426963.691e6887",
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-29426963.691e6887",
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-29426963.691e6887",
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
  },