nitro-nightly 3.0.1-20251217-223946-1ee0b5b8 → 3.0.1-20251217-233031-5973b3df
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/_build/shared3.mjs
CHANGED
|
@@ -115,14 +115,14 @@ function resolveAliases(_aliases) {
|
|
|
115
115
|
|
|
116
116
|
//#endregion
|
|
117
117
|
//#region src/build/chunks.ts
|
|
118
|
-
const virtualRe =
|
|
118
|
+
const virtualRe = /^(?:\0|#|virtual:)/;
|
|
119
119
|
const NODE_MODULES_RE$1 = /node_modules[/\\][^.]/;
|
|
120
120
|
function libChunkName(id) {
|
|
121
121
|
return `_libs/${id.match(/.*(?:[/\\])node_modules(?:[/\\])(?<package>@[^/\\]+[/\\][^/\\]+|[^/\\.][^/\\]*)/)?.groups?.package || "common"}`;
|
|
122
122
|
}
|
|
123
123
|
function getChunkName(chunk, nitro) {
|
|
124
124
|
if (chunk.name.startsWith("_libs/")) return `${chunk.name}.mjs`;
|
|
125
|
-
if (chunk.name === "rolldown-runtime") return "
|
|
125
|
+
if (chunk.name === "rolldown-runtime") return "_rolldown.mjs";
|
|
126
126
|
if (chunk.moduleIds.length === 0) return `_chunks/${chunk.name}.mjs`;
|
|
127
127
|
const ids = chunk.moduleIds.filter((id) => !virtualRe.test(id));
|
|
128
128
|
if (ids.length === 0) {
|
|
@@ -132,7 +132,7 @@ function getChunkName(chunk, nitro) {
|
|
|
132
132
|
if (ids.every((id) => id.endsWith(".wasm"))) return `_wasm/[name].mjs`;
|
|
133
133
|
if (ids.every((id) => id.includes("vite/services"))) return `_ssr/[name].mjs`;
|
|
134
134
|
if (ids.every((id) => id.startsWith(nitro.options.buildDir))) return `_build/[name].mjs`;
|
|
135
|
-
if (ids.every((id) => id.startsWith(runtimeDir) || id.startsWith(presetsDir))) return `
|
|
135
|
+
if (ids.every((id) => id.startsWith(runtimeDir) || id.startsWith(presetsDir))) return `_nitro/[name].mjs`;
|
|
136
136
|
const mainId = ids.at(-1);
|
|
137
137
|
if (mainId) {
|
|
138
138
|
const routeHandler = nitro.routing.routes.routes.flatMap((h) => h.data).find((h) => h.handler === mainId);
|
|
@@ -1536,7 +1536,7 @@ function stripLiteral(code, options) {
|
|
|
1536
1536
|
}
|
|
1537
1537
|
|
|
1538
1538
|
//#endregion
|
|
1539
|
-
//#region node_modules/.pnpm/@hiogawa+vite-plugin-fullstack@0.0.
|
|
1539
|
+
//#region node_modules/.pnpm/@hiogawa+vite-plugin-fullstack@0.0.8_patch_hash=aef5693ec569067da78c3402c9b2884429e322a_ccdea5f53e47d0c803c48383e7777859/node_modules/@hiogawa/vite-plugin-fullstack/dist/index.js
|
|
1540
1540
|
function parseIdQuery(id) {
|
|
1541
1541
|
if (!id.includes("?")) return {
|
|
1542
1542
|
filename: id,
|
|
@@ -1554,16 +1554,25 @@ function toAssetsVirtual(options) {
|
|
|
1554
1554
|
function parseAssetsVirtual(id) {
|
|
1555
1555
|
if (id.startsWith("\0virtual:fullstack/assets?")) return parseIdQuery(id).query;
|
|
1556
1556
|
}
|
|
1557
|
+
function escapeRegExp(string) {
|
|
1558
|
+
return string.replace(/[-\\^$*+?.()|[\]{}]/g, String.raw`\$&`);
|
|
1559
|
+
}
|
|
1557
1560
|
function createVirtualPlugin(name, load) {
|
|
1558
1561
|
name = "virtual:" + name;
|
|
1559
1562
|
return {
|
|
1560
1563
|
name: `rsc:virtual-${name}`,
|
|
1561
|
-
resolveId: {
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
}
|
|
1564
|
+
resolveId: {
|
|
1565
|
+
filter: { id: /* @__PURE__ */ new RegExp("^" + escapeRegExp(name) + "$") },
|
|
1566
|
+
handler(source, _importer, _options) {
|
|
1567
|
+
return source === name ? "\0" + name : void 0;
|
|
1568
|
+
}
|
|
1569
|
+
},
|
|
1570
|
+
load: {
|
|
1571
|
+
filter: { id: /* @__PURE__ */ new RegExp("^\\0" + escapeRegExp(name) + "$") },
|
|
1572
|
+
handler(id, options) {
|
|
1573
|
+
if (id === "\0" + name) return load.apply(this, [id, options]);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1567
1576
|
};
|
|
1568
1577
|
}
|
|
1569
1578
|
function normalizeRelativePath(s) {
|
|
@@ -1719,71 +1728,78 @@ function assetsPlugin(pluginOpts) {
|
|
|
1719
1728
|
configEnvironment(name) {
|
|
1720
1729
|
if ((pluginOpts?.serverEnvironments ?? ["ssr"]).includes(name)) return { build: { emitAssets: true } };
|
|
1721
1730
|
},
|
|
1722
|
-
transform: {
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
const
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
const
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1731
|
+
transform: {
|
|
1732
|
+
filter: { code: /import\.meta\.vite\.assets\(/ },
|
|
1733
|
+
async handler(code, id, _options) {
|
|
1734
|
+
const output = new MagicString(code);
|
|
1735
|
+
const strippedCode = stripLiteral(code);
|
|
1736
|
+
const newImports = /* @__PURE__ */ new Set();
|
|
1737
|
+
for (const match of code.matchAll(/import\.meta\.vite\.assets\(([\s\S]*?)\)/dg)) {
|
|
1738
|
+
const [start, end] = match.indices[0];
|
|
1739
|
+
if (!strippedCode.slice(start, end).includes("import.meta.vite.assets")) continue;
|
|
1740
|
+
if (this.environment.name === "client") {
|
|
1741
|
+
const replacement$1 = `(${JSON.stringify(EMPTY_ASSETS)})`;
|
|
1742
|
+
output.update(start, end, replacement$1);
|
|
1743
|
+
continue;
|
|
1744
|
+
}
|
|
1745
|
+
const argCode = match[1].trim();
|
|
1746
|
+
const options = {
|
|
1747
|
+
import: id,
|
|
1748
|
+
environment: void 0,
|
|
1749
|
+
asEntry: false
|
|
1750
|
+
};
|
|
1751
|
+
if (argCode) {
|
|
1752
|
+
const argValue = evalValue(argCode);
|
|
1753
|
+
Object.assign(options, argValue);
|
|
1754
|
+
}
|
|
1755
|
+
const environments = options.environment ? [options.environment] : ["client", this.environment.name];
|
|
1756
|
+
const importedNames = [];
|
|
1757
|
+
for (const environment of environments) {
|
|
1758
|
+
const importSource = toAssetsVirtual({
|
|
1759
|
+
import: options.import,
|
|
1760
|
+
importer: id,
|
|
1761
|
+
environment,
|
|
1762
|
+
entry: options.asEntry ? "1" : ""
|
|
1763
|
+
});
|
|
1764
|
+
const importedName = `__assets_${hashString(importSource)}`;
|
|
1765
|
+
newImports.add(`;import ${importedName} from ${JSON.stringify(importSource)};\n`);
|
|
1766
|
+
importedNames.push(importedName);
|
|
1767
|
+
}
|
|
1768
|
+
let replacement = importedNames[0];
|
|
1769
|
+
if (importedNames.length > 1) {
|
|
1770
|
+
newImports.add(`;import * as __assets_runtime from "virtual:fullstack/runtime";\n`);
|
|
1771
|
+
replacement = `__assets_runtime.mergeAssets(${importedNames.join(", ")})`;
|
|
1772
|
+
}
|
|
1773
|
+
output.update(start, end, `(${replacement})`);
|
|
1757
1774
|
}
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1775
|
+
if (output.hasChanged()) {
|
|
1776
|
+
for (const newImport of newImports) output.append(newImport);
|
|
1777
|
+
return {
|
|
1778
|
+
code: output.toString(),
|
|
1779
|
+
map: output.generateMap({ hires: "boundary" })
|
|
1780
|
+
};
|
|
1762
1781
|
}
|
|
1763
|
-
output.update(start, end, `(${replacement})`);
|
|
1764
|
-
}
|
|
1765
|
-
if (output.hasChanged()) {
|
|
1766
|
-
for (const newImport of newImports) output.append(newImport);
|
|
1767
|
-
return {
|
|
1768
|
-
code: output.toString(),
|
|
1769
|
-
map: output.generateMap({ hires: "boundary" })
|
|
1770
|
-
};
|
|
1771
1782
|
}
|
|
1772
|
-
}
|
|
1773
|
-
resolveId: {
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
+
},
|
|
1784
|
+
resolveId: {
|
|
1785
|
+
filter: { id: /^virtual:fullstack\// },
|
|
1786
|
+
handler(source) {
|
|
1787
|
+
if (source === "virtual:fullstack/runtime") return "\0" + source;
|
|
1788
|
+
if (source.startsWith("virtual:fullstack/assets?")) return "\0" + source;
|
|
1789
|
+
if (source === "virtual:fullstack/assets-manifest") {
|
|
1790
|
+
assert$1.notEqual(this.environment.name, "client");
|
|
1791
|
+
assert$1.equal(this.environment.mode, "build");
|
|
1792
|
+
return {
|
|
1793
|
+
id: source,
|
|
1794
|
+
external: true
|
|
1795
|
+
};
|
|
1796
|
+
}
|
|
1783
1797
|
}
|
|
1784
|
-
}
|
|
1785
|
-
load: {
|
|
1786
|
-
|
|
1798
|
+
},
|
|
1799
|
+
load: {
|
|
1800
|
+
filter: { id: /^\0virtual:fullstack\// },
|
|
1801
|
+
async handler(id) {
|
|
1802
|
+
if (id === "\0virtual:fullstack/runtime") return `//#region src/runtime.ts
|
|
1787
1803
|
function mergeAssets(...args) {
|
|
1788
1804
|
const js = uniqBy(args.flatMap((h) => h.js), (a) => a.href);
|
|
1789
1805
|
const css = uniqBy(args.flatMap((h) => h.css), (a) => a.href);
|
|
@@ -1810,20 +1826,21 @@ function uniqBy(array, key) {
|
|
|
1810
1826
|
|
|
1811
1827
|
//#endregion
|
|
1812
1828
|
export { mergeAssets };`;
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1829
|
+
const parsed = parseAssetsVirtual(id);
|
|
1830
|
+
if (!parsed) return;
|
|
1831
|
+
assert$1.notEqual(this.environment.name, "client");
|
|
1832
|
+
const resolved = await this.resolve(parsed.import, parsed.importer);
|
|
1833
|
+
assert$1(resolved, `Failed to resolve: ${parsed.import}`);
|
|
1834
|
+
const s = new MagicString("");
|
|
1835
|
+
const code = await processAssetsImport(this, resolved.id, {
|
|
1836
|
+
environment: parsed.environment,
|
|
1837
|
+
isEntry: !!parsed.entry
|
|
1838
|
+
});
|
|
1839
|
+
s.append(`export default ${code};\n`);
|
|
1840
|
+
if (this.environment.mode === "build") s.prepend(`import __assets_manifest from "virtual:fullstack/assets-manifest";\n`);
|
|
1841
|
+
return s.toString();
|
|
1842
|
+
}
|
|
1843
|
+
},
|
|
1827
1844
|
renderChunk(code, chunk) {
|
|
1828
1845
|
if (code.includes("virtual:fullstack/assets-manifest")) {
|
|
1829
1846
|
const replacement = normalizeRelativePath(path.relative(path.join(chunk.fileName, ".."), BUILD_ASSETS_MANIFEST_NAME));
|
|
@@ -1868,6 +1885,7 @@ export { mergeAssets };`;
|
|
|
1868
1885
|
sharedDuringBuild: true,
|
|
1869
1886
|
resolveId: {
|
|
1870
1887
|
order: "pre",
|
|
1888
|
+
filter: { id: /[?&]assets/ },
|
|
1871
1889
|
handler(source) {
|
|
1872
1890
|
const { query } = parseIdQuery(source);
|
|
1873
1891
|
if (typeof query["assets"] !== "undefined") {
|
|
@@ -1875,41 +1893,44 @@ export { mergeAssets };`;
|
|
|
1875
1893
|
}
|
|
1876
1894
|
}
|
|
1877
1895
|
},
|
|
1878
|
-
load: {
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
const
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
const
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1896
|
+
load: {
|
|
1897
|
+
filter: { id: [/^\0virtual:fullstack\/empty-assets$/, /[?&]assets/] },
|
|
1898
|
+
async handler(id) {
|
|
1899
|
+
if (id === "\0virtual:fullstack/empty-assets") return `export default ${JSON.stringify(EMPTY_ASSETS)}`;
|
|
1900
|
+
const { filename, query } = parseIdQuery(id);
|
|
1901
|
+
const value = query["assets"];
|
|
1902
|
+
if (typeof value !== "undefined") {
|
|
1903
|
+
const s = new MagicString("");
|
|
1904
|
+
const codes = [];
|
|
1905
|
+
if (value) {
|
|
1906
|
+
const code = await processAssetsImport(this, filename, {
|
|
1907
|
+
environment: value,
|
|
1908
|
+
isEntry: value === "client"
|
|
1909
|
+
});
|
|
1910
|
+
codes.push(code);
|
|
1911
|
+
} else {
|
|
1912
|
+
const code1 = await processAssetsImport(this, filename, {
|
|
1913
|
+
environment: "client",
|
|
1914
|
+
isEntry: false
|
|
1915
|
+
});
|
|
1916
|
+
const code2 = await processAssetsImport(this, filename, {
|
|
1917
|
+
environment: this.environment.name,
|
|
1918
|
+
isEntry: false
|
|
1919
|
+
});
|
|
1920
|
+
codes.push(code1, code2);
|
|
1921
|
+
}
|
|
1922
|
+
s.append(`
|
|
1903
1923
|
import * as __assets_runtime from "virtual:fullstack/runtime";\n
|
|
1904
1924
|
export default __assets_runtime.mergeAssets(${codes.join(", ")});
|
|
1905
1925
|
`);
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1926
|
+
if (this.environment.mode === "build") s.prepend(`import __assets_manifest from "virtual:fullstack/assets-manifest";\n`);
|
|
1927
|
+
return {
|
|
1928
|
+
code: s.toString(),
|
|
1929
|
+
moduleSideEffects: false
|
|
1930
|
+
};
|
|
1931
|
+
}
|
|
1911
1932
|
}
|
|
1912
|
-
}
|
|
1933
|
+
},
|
|
1913
1934
|
hotUpdate(ctx) {
|
|
1914
1935
|
if (this.environment.name === "rsc") {
|
|
1915
1936
|
const mods = collectModuleDependents(ctx.modules);
|
|
@@ -2029,11 +2050,13 @@ function patchViteClientPlugin() {
|
|
|
2029
2050
|
}
|
|
2030
2051
|
return {
|
|
2031
2052
|
name: "fullstack:patch-vite-client",
|
|
2032
|
-
transform: {
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2053
|
+
transform: {
|
|
2054
|
+
filter: { id: /* @__PURE__ */ new RegExp("^" + escapeRegExp(viteClientPath) + "$") },
|
|
2055
|
+
handler(code, id) {
|
|
2056
|
+
if (id === viteClientPath) {
|
|
2057
|
+
if (code.includes("linkSheetsMap")) return;
|
|
2058
|
+
const s = new MagicString(code);
|
|
2059
|
+
s.prependLeft(code.indexOf("const sheetsMap"), `\
|
|
2037
2060
|
const linkSheetsMap = new Map();
|
|
2038
2061
|
document
|
|
2039
2062
|
.querySelectorAll('link[rel="stylesheet"][data-vite-dev-id]')
|
|
@@ -2041,8 +2064,8 @@ document
|
|
|
2041
2064
|
linkSheetsMap.set(el.getAttribute('data-vite-dev-id'), el)
|
|
2042
2065
|
});
|
|
2043
2066
|
`);
|
|
2044
|
-
|
|
2045
|
-
|
|
2067
|
+
s.appendLeft(endIndexOf(code, `function updateStyle(id, content) {`), `if (linkSheetsMap.has(id)) { return }`);
|
|
2068
|
+
s.appendLeft(endIndexOf(code, `function removeStyle(id) {`), `
|
|
2046
2069
|
const link = linkSheetsMap.get(id);
|
|
2047
2070
|
if (link) {
|
|
2048
2071
|
document
|
|
@@ -2057,9 +2080,10 @@ if (link) {
|
|
|
2057
2080
|
linkSheetsMap.delete(id)
|
|
2058
2081
|
}
|
|
2059
2082
|
`);
|
|
2060
|
-
|
|
2083
|
+
return s.toString();
|
|
2084
|
+
}
|
|
2061
2085
|
}
|
|
2062
|
-
}
|
|
2086
|
+
}
|
|
2063
2087
|
};
|
|
2064
2088
|
}
|
|
2065
2089
|
function patchVueScopeCssHmr() {
|
package/lib/vite.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Based on https://github.com/hi-ogawa/vite-plugins/blob/main/packages/fullstack/types/query.d.ts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type ImportAssetsResult = ImportAssetsResultRaw & {
|
|
4
4
|
merge(...args: ImportAssetsResultRaw[]): ImportAssetsResult;
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
type ImportAssetsResultRaw = {
|
|
8
8
|
entry?: string;
|
|
9
9
|
js: { href: string }[];
|
|
10
10
|
css: { href: string; "data-vite-dev-id"?: string }[];
|
package/package.json
CHANGED