@nuxt/vite-builder-nightly 4.3.0-29436247.ecea7a86 → 4.3.0-29436330.9aa80014
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.
- package/dist/index.mjs +131 -116
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1260,27 +1260,32 @@ const SourcemapPreserverPlugin = (nuxt) => {
|
|
|
1260
1260
|
if (!nuxt.options.sourcemap.server || nuxt.options.dev) {
|
|
1261
1261
|
return [];
|
|
1262
1262
|
}
|
|
1263
|
-
const nitroPlugin = {
|
|
1263
|
+
const nitroPlugin = () => ({
|
|
1264
1264
|
name: "nuxt:sourcemap-import",
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1265
|
+
load: {
|
|
1266
|
+
filter: {
|
|
1267
|
+
id: new RegExp("^(\\w:)?" + escapeStringRegexp(outputDir.replace(/\/?$/, "/")).replace(/\//g, "[\\\\/]"))
|
|
1268
|
+
},
|
|
1269
|
+
async handler(id) {
|
|
1270
|
+
id = resolve(id);
|
|
1271
|
+
if (!ids.has(id)) {
|
|
1272
|
+
return;
|
|
1273
|
+
}
|
|
1274
|
+
const [code, map] = await Promise.all([
|
|
1275
|
+
readFile(id, "utf-8").catch(() => void 0),
|
|
1276
|
+
readFile(id + ".map.json", "utf-8").catch(() => void 0)
|
|
1277
|
+
]);
|
|
1278
|
+
if (!code) {
|
|
1279
|
+
this.warn("Failed loading file");
|
|
1280
|
+
return null;
|
|
1281
|
+
}
|
|
1282
|
+
return {
|
|
1283
|
+
code,
|
|
1284
|
+
map
|
|
1285
|
+
};
|
|
1277
1286
|
}
|
|
1278
|
-
return {
|
|
1279
|
-
code,
|
|
1280
|
-
map
|
|
1281
|
-
};
|
|
1282
1287
|
}
|
|
1283
|
-
};
|
|
1288
|
+
});
|
|
1284
1289
|
nuxt.hook("nitro:build:before", (nitro) => {
|
|
1285
1290
|
nitro.options.rollupConfig = defu(nitro.options.rollupConfig, {
|
|
1286
1291
|
plugins: [nitroPlugin]
|
|
@@ -1753,108 +1758,116 @@ function SSRStylesPlugin(nuxt) {
|
|
|
1753
1758
|
}
|
|
1754
1759
|
return null;
|
|
1755
1760
|
},
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
const
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1761
|
+
transform: {
|
|
1762
|
+
filter: {
|
|
1763
|
+
id: {
|
|
1764
|
+
include: environment.name === "client" ? new RegExp("^" + escapeStringRegexp(entry) + "$") : void 0,
|
|
1765
|
+
exclude: environment.name === "client" ? [] : [/\?.*macro=/, /\?.*nuxt_component=/]
|
|
1766
|
+
}
|
|
1767
|
+
},
|
|
1768
|
+
async handler(code, id) {
|
|
1769
|
+
if (environment.name === "client") {
|
|
1770
|
+
if (id === entry && (options.shouldInline === true || typeof options.shouldInline === "function" && options.shouldInline(id))) {
|
|
1771
|
+
const s = new MagicString(code);
|
|
1772
|
+
const idClientCSSMap = clientCSSMap[id] ||= /* @__PURE__ */ new Set();
|
|
1773
|
+
if (!options.globalCSS.length) {
|
|
1774
|
+
return;
|
|
1775
|
+
}
|
|
1776
|
+
for (const file of options.globalCSS) {
|
|
1777
|
+
const resolved = await this.resolve(file) ?? await this.resolve(file, id);
|
|
1778
|
+
const res = await this.resolve(file + "?inline&used") ?? await this.resolve(file + "?inline&used", id);
|
|
1779
|
+
if (!resolved || !res) {
|
|
1780
|
+
if (!warnCache.has(file)) {
|
|
1781
|
+
warnCache.add(file);
|
|
1782
|
+
this.warn(`[nuxt] Cannot extract styles for \`${file}\`. Its styles will not be inlined when server-rendering.`);
|
|
1783
|
+
}
|
|
1784
|
+
s.prepend(`${genImport(file)}
|
|
1773
1785
|
`);
|
|
1774
|
-
|
|
1786
|
+
continue;
|
|
1787
|
+
}
|
|
1788
|
+
idClientCSSMap.add(resolved.id);
|
|
1789
|
+
}
|
|
1790
|
+
if (s.hasChanged()) {
|
|
1791
|
+
return {
|
|
1792
|
+
code: s.toString(),
|
|
1793
|
+
map: s.generateMap({ hires: true })
|
|
1794
|
+
};
|
|
1775
1795
|
}
|
|
1776
|
-
idClientCSSMap.add(resolved.id);
|
|
1777
|
-
}
|
|
1778
|
-
if (s.hasChanged()) {
|
|
1779
|
-
return {
|
|
1780
|
-
code: s.toString(),
|
|
1781
|
-
map: s.generateMap({ hires: true })
|
|
1782
|
-
};
|
|
1783
1796
|
}
|
|
1797
|
+
return;
|
|
1784
1798
|
}
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
const { pathname, search } = parseURL(decodeURIComponent(pathToFileURL(id).href));
|
|
1788
|
-
if (!(id in clientCSSMap) && !islandPaths.has(pathname)) {
|
|
1789
|
-
return;
|
|
1790
|
-
}
|
|
1791
|
-
const query = parseQuery(search);
|
|
1792
|
-
if (query.macro || query.nuxt_component) {
|
|
1793
|
-
return;
|
|
1794
|
-
}
|
|
1795
|
-
if (!islandPaths.has(pathname)) {
|
|
1796
|
-
if (options.shouldInline === false || typeof options.shouldInline === "function" && !options.shouldInline(id)) {
|
|
1799
|
+
const { pathname, search } = parseURL(decodeURIComponent(pathToFileURL(id).href));
|
|
1800
|
+
if (!(id in clientCSSMap) && !islandPaths.has(pathname)) {
|
|
1797
1801
|
return;
|
|
1798
1802
|
}
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
const emittedIds = /* @__PURE__ */ new Set();
|
|
1803
|
-
const idFilename = filename(id);
|
|
1804
|
-
let styleCtr = 0;
|
|
1805
|
-
const ids = clientCSSMap[id] || [];
|
|
1806
|
-
for (const file of ids) {
|
|
1807
|
-
if (emittedIds.has(file)) {
|
|
1808
|
-
continue;
|
|
1803
|
+
const query = parseQuery(search);
|
|
1804
|
+
if (query.macro || query.nuxt_component) {
|
|
1805
|
+
return;
|
|
1809
1806
|
}
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
if (!resolved || !res) {
|
|
1814
|
-
if (!warnCache.has(file)) {
|
|
1815
|
-
warnCache.add(file);
|
|
1816
|
-
this.warn(`[nuxt] Cannot extract styles for \`${file}\`. Its styles will not be inlined when server-rendering.`);
|
|
1807
|
+
if (!islandPaths.has(pathname)) {
|
|
1808
|
+
if (options.shouldInline === false || typeof options.shouldInline === "function" && !options.shouldInline(id)) {
|
|
1809
|
+
return;
|
|
1817
1810
|
}
|
|
1818
|
-
continue;
|
|
1819
1811
|
}
|
|
1820
|
-
|
|
1821
|
-
const
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1812
|
+
const relativeId = relativeToSrcDir(id);
|
|
1813
|
+
const idMap = cssMap[relativeId] ||= { files: [] };
|
|
1814
|
+
const emittedIds = /* @__PURE__ */ new Set();
|
|
1815
|
+
const idFilename = filename(id);
|
|
1816
|
+
let styleCtr = 0;
|
|
1817
|
+
const ids = clientCSSMap[id] || [];
|
|
1818
|
+
for (const file of ids) {
|
|
1819
|
+
if (emittedIds.has(file)) {
|
|
1820
|
+
continue;
|
|
1821
|
+
}
|
|
1822
|
+
const fileInline = file + "?inline&used";
|
|
1823
|
+
const resolved = await this.resolve(file) ?? await this.resolve(file, id);
|
|
1824
|
+
const res = await this.resolve(fileInline) ?? await this.resolve(fileInline, id);
|
|
1825
|
+
if (!resolved || !res) {
|
|
1826
|
+
if (!warnCache.has(file)) {
|
|
1827
|
+
warnCache.add(file);
|
|
1828
|
+
this.warn(`[nuxt] Cannot extract styles for \`${file}\`. Its styles will not be inlined when server-rendering.`);
|
|
1829
|
+
}
|
|
1830
|
+
continue;
|
|
1831
|
+
}
|
|
1832
|
+
emittedIds.add(file);
|
|
1833
|
+
const ref = this.emitFile({
|
|
1834
|
+
type: "chunk",
|
|
1835
|
+
name: `${idFilename}-styles-${++styleCtr}.mjs`,
|
|
1836
|
+
id: fileInline
|
|
1837
|
+
});
|
|
1838
|
+
idRefMap[relativeToSrcDir(file)] = ref;
|
|
1839
|
+
idMap.files.push(ref);
|
|
1835
1840
|
}
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
continue;
|
|
1841
|
+
if (!SUPPORTED_FILES_RE.test(pathname)) {
|
|
1842
|
+
return;
|
|
1839
1843
|
}
|
|
1840
|
-
const
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
warnCache.add(resolved.id);
|
|
1844
|
-
this.warn(`[nuxt] Cannot extract styles for \`${i.specifier}\`. Its styles will not be inlined when server-rendering.`);
|
|
1844
|
+
for (const i of findStaticImports(code)) {
|
|
1845
|
+
if (!i.specifier.endsWith(".css") && parseQuery(i.specifier).type !== "style") {
|
|
1846
|
+
continue;
|
|
1845
1847
|
}
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1848
|
+
const resolved = await this.resolve(i.specifier, id);
|
|
1849
|
+
if (!resolved) {
|
|
1850
|
+
continue;
|
|
1851
|
+
}
|
|
1852
|
+
const resolvedIdInline = resolved.id + "?inline&used";
|
|
1853
|
+
if (!await this.resolve(resolvedIdInline)) {
|
|
1854
|
+
if (!warnCache.has(resolved.id)) {
|
|
1855
|
+
warnCache.add(resolved.id);
|
|
1856
|
+
this.warn(`[nuxt] Cannot extract styles for \`${i.specifier}\`. Its styles will not be inlined when server-rendering.`);
|
|
1857
|
+
}
|
|
1858
|
+
continue;
|
|
1859
|
+
}
|
|
1860
|
+
if (emittedIds.has(resolved.id)) {
|
|
1861
|
+
continue;
|
|
1862
|
+
}
|
|
1863
|
+
const ref = this.emitFile({
|
|
1864
|
+
type: "chunk",
|
|
1865
|
+
name: `${idFilename}-styles-${++styleCtr}.mjs`,
|
|
1866
|
+
id: resolvedIdInline
|
|
1867
|
+
});
|
|
1868
|
+
idRefMap[relativeToSrcDir(resolved.id)] = ref;
|
|
1869
|
+
idMap.files.push(ref);
|
|
1850
1870
|
}
|
|
1851
|
-
const ref = this.emitFile({
|
|
1852
|
-
type: "chunk",
|
|
1853
|
-
name: `${idFilename}-styles-${++styleCtr}.mjs`,
|
|
1854
|
-
id: resolvedIdInline
|
|
1855
|
-
});
|
|
1856
|
-
idRefMap[relativeToSrcDir(resolved.id)] = ref;
|
|
1857
|
-
idMap.files.push(ref);
|
|
1858
1871
|
}
|
|
1859
1872
|
}
|
|
1860
1873
|
};
|
|
@@ -1906,15 +1919,17 @@ function LayerDepOptimizePlugin(nuxt) {
|
|
|
1906
1919
|
return {
|
|
1907
1920
|
name: "nuxt:optimize-layer-deps",
|
|
1908
1921
|
enforce: "pre",
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1922
|
+
resolveId: {
|
|
1923
|
+
async handler(source, _importer) {
|
|
1924
|
+
if (!_importer) {
|
|
1925
|
+
return;
|
|
1926
|
+
}
|
|
1927
|
+
const importer = normalize(_importer);
|
|
1928
|
+
const layerIndex = dirs.findIndex((dir) => importer.startsWith(dir));
|
|
1929
|
+
if (layerIndex !== -1) {
|
|
1930
|
+
dirs.splice(layerIndex, 1);
|
|
1931
|
+
await this.resolve(source, join(nuxt.options.srcDir, "index.html"), { skipSelf: true }).catch(() => null);
|
|
1932
|
+
}
|
|
1918
1933
|
}
|
|
1919
1934
|
}
|
|
1920
1935
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/vite-builder-nightly",
|
|
3
|
-
"version": "4.3.0-
|
|
3
|
+
"version": "4.3.0-29436330.9aa80014",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/nuxt/nuxt.git",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-
|
|
28
|
+
"@nuxt/schema": "npm:@nuxt/schema-nightly@4.3.0-29436330.9aa80014",
|
|
29
29
|
"nitropack": "2.12.9",
|
|
30
30
|
"rolldown": "1.0.0-beta.54",
|
|
31
31
|
"rollup": "4.53.4",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"vue": "3.5.25"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.3.0-
|
|
36
|
+
"@nuxt/kit": "npm:@nuxt/kit-nightly@4.3.0-29436330.9aa80014",
|
|
37
37
|
"@rollup/plugin-replace": "^6.0.3",
|
|
38
38
|
"@vitejs/plugin-vue": "^6.0.3",
|
|
39
39
|
"@vitejs/plugin-vue-jsx": "^5.1.2",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"vue-bundle-renderer": "^2.2.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"nuxt": "npm:nuxt-nightly@4.3.0-
|
|
68
|
+
"nuxt": "npm:nuxt-nightly@4.3.0-29436330.9aa80014",
|
|
69
69
|
"rolldown": "^1.0.0-beta.38",
|
|
70
70
|
"vue": "^3.3.4"
|
|
71
71
|
},
|