@absolutejs/absolute 0.15.12 → 0.15.14
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/cli/index.js +391 -16
- package/dist/index.js +166 -137
- package/dist/index.js.map +4 -4
- package/dist/src/cli/interactive.d.ts +2 -0
- package/dist/src/cli/scripts/dev.d.ts +1 -0
- package/dist/src/cli/utils.d.ts +11 -0
- package/dist/types/cli.d.ts +17 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/types/cli.ts +20 -0
- package/types/index.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -1405,14 +1405,14 @@ var cleanup = async ({
|
|
|
1405
1405
|
vueDir,
|
|
1406
1406
|
reactIndexesPath
|
|
1407
1407
|
}) => {
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1408
|
+
await Promise.all([
|
|
1409
|
+
svelteDir ? rm2(join4(svelteDir, "compiled"), {
|
|
1410
|
+
force: true,
|
|
1411
|
+
recursive: true
|
|
1412
|
+
}) : undefined,
|
|
1413
|
+
vueDir ? rm2(join4(vueDir, "compiled"), { force: true, recursive: true }) : undefined,
|
|
1414
|
+
reactIndexesPath ? rm2(reactIndexesPath, { force: true, recursive: true }) : undefined
|
|
1415
|
+
]);
|
|
1416
1416
|
};
|
|
1417
1417
|
|
|
1418
1418
|
// src/utils/commonAncestor.ts
|
|
@@ -1662,18 +1662,30 @@ var build2 = async ({
|
|
|
1662
1662
|
recursive: true
|
|
1663
1663
|
});
|
|
1664
1664
|
}
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1665
|
+
const tailwindPromise = tailwind && (!isIncremental || normalizedIncrementalFiles?.some((f) => f.endsWith(".css"))) ? $`bunx @tailwindcss/cli -i ${tailwind.input} -o ${join5(buildPath, tailwind.output)}` : undefined;
|
|
1666
|
+
const [
|
|
1667
|
+
,
|
|
1668
|
+
allReactEntries,
|
|
1669
|
+
allHtmlEntries,
|
|
1670
|
+
allSvelteEntries,
|
|
1671
|
+
allVueEntries,
|
|
1672
|
+
allAngularEntries,
|
|
1673
|
+
allHtmlCssEntries,
|
|
1674
|
+
allHtmxCssEntries,
|
|
1675
|
+
allReactCssEntries,
|
|
1676
|
+
allSvelteCssEntries
|
|
1677
|
+
] = await Promise.all([
|
|
1678
|
+
tailwindPromise,
|
|
1679
|
+
reactIndexesPath ? scanEntryPoints(reactIndexesPath, "*.tsx") : [],
|
|
1680
|
+
htmlScriptsPath ? scanEntryPoints(htmlScriptsPath, "*.{js,ts}") : [],
|
|
1681
|
+
sveltePagesPath ? scanEntryPoints(sveltePagesPath, "*.svelte") : [],
|
|
1682
|
+
vuePagesPath ? scanEntryPoints(vuePagesPath, "*.vue") : [],
|
|
1683
|
+
angularPagesPath ? scanEntryPoints(angularPagesPath, "*.ts") : [],
|
|
1684
|
+
htmlDir ? scanEntryPoints(join5(htmlDir, "styles"), "*.css") : [],
|
|
1685
|
+
htmxDir ? scanEntryPoints(join5(htmxDir, "styles"), "*.css") : [],
|
|
1686
|
+
reactDir ? scanEntryPoints(join5(reactDir, "styles"), "*.css") : [],
|
|
1687
|
+
svelteDir ? scanEntryPoints(join5(svelteDir, "styles"), "*.css") : []
|
|
1688
|
+
]);
|
|
1677
1689
|
const shouldIncludeHtmlAssets = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || f.endsWith(".css")));
|
|
1678
1690
|
const shouldIncludeHtmxAssets = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/htmx/") && (f.endsWith(".html") || f.endsWith(".css")));
|
|
1679
1691
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
@@ -1691,17 +1703,23 @@ var build2 = async ({
|
|
|
1691
1703
|
const htmxCssEntries = isIncremental && !shouldIncludeHtmxAssets ? filterToIncrementalEntries(allHtmxCssEntries, (entry) => entry) : allHtmxCssEntries;
|
|
1692
1704
|
const reactCssEntries = isIncremental ? filterToIncrementalEntries(allReactCssEntries, (entry) => entry) : allReactCssEntries;
|
|
1693
1705
|
const svelteCssEntries = isIncremental ? filterToIncrementalEntries(allSvelteCssEntries, (entry) => entry) : allSvelteCssEntries;
|
|
1694
|
-
const
|
|
1695
|
-
|
|
1696
|
-
svelteIndexPaths
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1706
|
+
const hmrClientBundlePromise = hmr && (htmlDir || htmxDir) ? buildHMRClient() : undefined;
|
|
1707
|
+
const [
|
|
1708
|
+
{ svelteServerPaths, svelteIndexPaths, svelteClientPaths },
|
|
1709
|
+
{ vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths }
|
|
1710
|
+
] = await Promise.all([
|
|
1711
|
+
svelteDir ? compileSvelte(svelteEntries, svelteDir, new Map, hmr) : {
|
|
1712
|
+
svelteClientPaths: [],
|
|
1713
|
+
svelteIndexPaths: [],
|
|
1714
|
+
svelteServerPaths: []
|
|
1715
|
+
},
|
|
1716
|
+
vueDir ? compileVue(vueEntries, vueDir, hmr) : {
|
|
1717
|
+
vueClientPaths: [],
|
|
1718
|
+
vueCssPaths: [],
|
|
1719
|
+
vueIndexPaths: [],
|
|
1720
|
+
vueServerPaths: []
|
|
1721
|
+
}
|
|
1722
|
+
]);
|
|
1705
1723
|
const serverEntryPoints = [...svelteServerPaths, ...vueServerPaths];
|
|
1706
1724
|
const reactClientEntryPoints = [...reactEntries];
|
|
1707
1725
|
const nonReactClientEntryPoints = [
|
|
@@ -1722,32 +1740,6 @@ var build2 = async ({
|
|
|
1722
1740
|
logger.warn("No entry points found, manifest will be empty");
|
|
1723
1741
|
return {};
|
|
1724
1742
|
}
|
|
1725
|
-
let serverLogs = [];
|
|
1726
|
-
let serverOutputs = [];
|
|
1727
|
-
if (serverEntryPoints.length > 0) {
|
|
1728
|
-
const result = await bunBuild2({
|
|
1729
|
-
entrypoints: serverEntryPoints,
|
|
1730
|
-
format: "esm",
|
|
1731
|
-
naming: `[dir]/[name].[hash].[ext]`,
|
|
1732
|
-
outdir: serverOutDir,
|
|
1733
|
-
root: serverRoot,
|
|
1734
|
-
target: "bun",
|
|
1735
|
-
throw: false
|
|
1736
|
-
});
|
|
1737
|
-
serverLogs = result.logs;
|
|
1738
|
-
serverOutputs = result.outputs;
|
|
1739
|
-
if (!result.success && result.logs.length > 0) {
|
|
1740
|
-
const errLog = result.logs.find((l) => l.level === "error") ?? result.logs[0];
|
|
1741
|
-
const err = new Error(typeof errLog.message === "string" ? errLog.message : String(errLog.message));
|
|
1742
|
-
err.logs = result.logs;
|
|
1743
|
-
logger.error("Server build failed", err);
|
|
1744
|
-
if (throwOnError)
|
|
1745
|
-
throw err;
|
|
1746
|
-
exit(1);
|
|
1747
|
-
}
|
|
1748
|
-
}
|
|
1749
|
-
let reactClientLogs = [];
|
|
1750
|
-
let reactClientOutputs = [];
|
|
1751
1743
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
1752
1744
|
const refreshEntry = join5(reactIndexesPath, "_refresh.tsx");
|
|
1753
1745
|
if (!reactClientEntryPoints.includes(refreshEntry)) {
|
|
@@ -1755,8 +1747,9 @@ var build2 = async ({
|
|
|
1755
1747
|
}
|
|
1756
1748
|
}
|
|
1757
1749
|
const vendorPaths = getDevVendorPaths();
|
|
1758
|
-
|
|
1759
|
-
|
|
1750
|
+
const htmlScriptPlugin = hmr ? createHTMLScriptHMRPlugin(htmlDir, htmxDir) : undefined;
|
|
1751
|
+
const reactBuildConfig = reactClientEntryPoints.length > 0 ? (() => {
|
|
1752
|
+
const cfg = {
|
|
1760
1753
|
entrypoints: reactClientEntryPoints,
|
|
1761
1754
|
format: "esm",
|
|
1762
1755
|
minify: !isDev,
|
|
@@ -1768,12 +1761,63 @@ var build2 = async ({
|
|
|
1768
1761
|
throw: false
|
|
1769
1762
|
};
|
|
1770
1763
|
if (vendorPaths) {
|
|
1771
|
-
|
|
1764
|
+
cfg.external = Object.keys(vendorPaths);
|
|
1772
1765
|
}
|
|
1773
1766
|
if (hmr) {
|
|
1774
|
-
|
|
1767
|
+
cfg.reactFastRefresh = true;
|
|
1775
1768
|
}
|
|
1776
|
-
|
|
1769
|
+
return cfg;
|
|
1770
|
+
})() : undefined;
|
|
1771
|
+
const [serverResult, reactClientResult, nonReactClientResult, cssResult] = await Promise.all([
|
|
1772
|
+
serverEntryPoints.length > 0 ? bunBuild2({
|
|
1773
|
+
entrypoints: serverEntryPoints,
|
|
1774
|
+
format: "esm",
|
|
1775
|
+
naming: `[dir]/[name].[hash].[ext]`,
|
|
1776
|
+
outdir: serverOutDir,
|
|
1777
|
+
root: serverRoot,
|
|
1778
|
+
target: "bun",
|
|
1779
|
+
throw: false
|
|
1780
|
+
}) : undefined,
|
|
1781
|
+
reactBuildConfig ? bunBuild2(reactBuildConfig) : undefined,
|
|
1782
|
+
nonReactClientEntryPoints.length > 0 ? bunBuild2({
|
|
1783
|
+
define: vueDirectory ? vueFeatureFlags : undefined,
|
|
1784
|
+
entrypoints: nonReactClientEntryPoints,
|
|
1785
|
+
format: "esm",
|
|
1786
|
+
minify: !isDev,
|
|
1787
|
+
naming: `[dir]/[name].[hash].[ext]`,
|
|
1788
|
+
outdir: buildPath,
|
|
1789
|
+
plugins: htmlScriptPlugin ? [htmlScriptPlugin] : undefined,
|
|
1790
|
+
root: clientRoot,
|
|
1791
|
+
target: "browser",
|
|
1792
|
+
splitting: !isDev,
|
|
1793
|
+
throw: false
|
|
1794
|
+
}) : undefined,
|
|
1795
|
+
cssEntryPoints.length > 0 ? bunBuild2({
|
|
1796
|
+
entrypoints: cssEntryPoints,
|
|
1797
|
+
naming: `[name].[hash].[ext]`,
|
|
1798
|
+
outdir: join5(buildPath, assetsPath ? basename4(assetsPath) : "assets", "css"),
|
|
1799
|
+
target: "browser",
|
|
1800
|
+
throw: false
|
|
1801
|
+
}) : undefined
|
|
1802
|
+
]);
|
|
1803
|
+
let serverLogs = [];
|
|
1804
|
+
let serverOutputs = [];
|
|
1805
|
+
if (serverResult) {
|
|
1806
|
+
serverLogs = serverResult.logs;
|
|
1807
|
+
serverOutputs = serverResult.outputs;
|
|
1808
|
+
if (!serverResult.success && serverResult.logs.length > 0) {
|
|
1809
|
+
const errLog = serverResult.logs.find((l) => l.level === "error") ?? serverResult.logs[0];
|
|
1810
|
+
const err = new Error(typeof errLog.message === "string" ? errLog.message : String(errLog.message));
|
|
1811
|
+
err.logs = serverResult.logs;
|
|
1812
|
+
logger.error("Server build failed", err);
|
|
1813
|
+
if (throwOnError)
|
|
1814
|
+
throw err;
|
|
1815
|
+
exit(1);
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
let reactClientLogs = [];
|
|
1819
|
+
let reactClientOutputs = [];
|
|
1820
|
+
if (reactClientResult) {
|
|
1777
1821
|
reactClientLogs = reactClientResult.logs;
|
|
1778
1822
|
reactClientOutputs = reactClientResult.outputs;
|
|
1779
1823
|
if (!reactClientResult.success && reactClientResult.logs.length > 0) {
|
|
@@ -1791,21 +1835,7 @@ var build2 = async ({
|
|
|
1791
1835
|
}
|
|
1792
1836
|
let nonReactClientLogs = [];
|
|
1793
1837
|
let nonReactClientOutputs = [];
|
|
1794
|
-
if (
|
|
1795
|
-
const htmlScriptPlugin = hmr ? createHTMLScriptHMRPlugin(htmlDir, htmxDir) : undefined;
|
|
1796
|
-
const nonReactClientResult = await bunBuild2({
|
|
1797
|
-
define: vueDirectory ? vueFeatureFlags : undefined,
|
|
1798
|
-
entrypoints: nonReactClientEntryPoints,
|
|
1799
|
-
format: "esm",
|
|
1800
|
-
minify: !isDev,
|
|
1801
|
-
naming: `[dir]/[name].[hash].[ext]`,
|
|
1802
|
-
outdir: buildPath,
|
|
1803
|
-
plugins: htmlScriptPlugin ? [htmlScriptPlugin] : undefined,
|
|
1804
|
-
root: clientRoot,
|
|
1805
|
-
target: "browser",
|
|
1806
|
-
splitting: !isDev,
|
|
1807
|
-
throw: false
|
|
1808
|
-
});
|
|
1838
|
+
if (nonReactClientResult) {
|
|
1809
1839
|
nonReactClientLogs = nonReactClientResult.logs;
|
|
1810
1840
|
nonReactClientOutputs = nonReactClientResult.outputs;
|
|
1811
1841
|
if (!nonReactClientResult.success && nonReactClientResult.logs.length > 0) {
|
|
@@ -1820,14 +1850,7 @@ var build2 = async ({
|
|
|
1820
1850
|
}
|
|
1821
1851
|
let cssLogs = [];
|
|
1822
1852
|
let cssOutputs = [];
|
|
1823
|
-
if (
|
|
1824
|
-
const cssResult = await bunBuild2({
|
|
1825
|
-
entrypoints: cssEntryPoints,
|
|
1826
|
-
naming: `[name].[hash].[ext]`,
|
|
1827
|
-
outdir: join5(buildPath, assetsPath ? basename4(assetsPath) : "assets", "css"),
|
|
1828
|
-
target: "browser",
|
|
1829
|
-
throw: false
|
|
1830
|
-
});
|
|
1853
|
+
if (cssResult) {
|
|
1831
1854
|
cssLogs = cssResult.logs;
|
|
1832
1855
|
cssOutputs = cssResult.outputs;
|
|
1833
1856
|
if (!cssResult.success && cssResult.logs.length > 0) {
|
|
@@ -1866,7 +1889,7 @@ var build2 = async ({
|
|
|
1866
1889
|
const shouldCopyHtmx = htmxOrHtmxCssChanged;
|
|
1867
1890
|
const shouldUpdateHtmlAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/html/") && (f.endsWith(".html") || f.endsWith(".css")));
|
|
1868
1891
|
const shouldUpdateHtmxAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f) => f.includes("/htmx/") && (f.endsWith(".html") || f.endsWith(".css")));
|
|
1869
|
-
const hmrClientBundle =
|
|
1892
|
+
const hmrClientBundle = hmrClientBundlePromise ? await hmrClientBundlePromise : null;
|
|
1870
1893
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
1871
1894
|
if (!hmrClientBundle)
|
|
1872
1895
|
return;
|
|
@@ -1878,57 +1901,63 @@ var build2 = async ({
|
|
|
1878
1901
|
html = bodyClose ? html.slice(0, bodyClose.index) + tag + html.slice(bodyClose.index) : html + tag;
|
|
1879
1902
|
writeFileSync(filePath, html);
|
|
1880
1903
|
};
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
recursive: true
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
}
|
|
1893
|
-
const htmlPageFiles = await scanEntryPoints(outputHtmlPages, "*.html");
|
|
1894
|
-
for (const htmlFile of htmlPageFiles) {
|
|
1895
|
-
if (hmr)
|
|
1896
|
-
injectHMRIntoHTMLFile(htmlFile, "html");
|
|
1897
|
-
const fileName = basename4(htmlFile, ".html");
|
|
1898
|
-
manifest[fileName] = htmlFile;
|
|
1899
|
-
}
|
|
1900
|
-
}
|
|
1901
|
-
if (htmxDir && htmxPagesPath) {
|
|
1902
|
-
const outputHtmxPages = isSingle ? join5(buildPath, "pages") : join5(buildPath, basename4(htmxDir), "pages");
|
|
1903
|
-
if (shouldCopyHtmx) {
|
|
1904
|
-
mkdirSync(outputHtmxPages, { recursive: true });
|
|
1905
|
-
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
1906
|
-
force: true,
|
|
1907
|
-
recursive: true
|
|
1908
|
-
});
|
|
1909
|
-
}
|
|
1910
|
-
if (shouldCopyHtmx) {
|
|
1911
|
-
const htmxDestDir = isSingle ? buildPath : join5(buildPath, basename4(htmxDir));
|
|
1912
|
-
mkdirSync(htmxDestDir, { recursive: true });
|
|
1913
|
-
const glob = new Glob3("htmx*.min.js");
|
|
1914
|
-
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
1915
|
-
const src = join5(htmxDir, relPath);
|
|
1916
|
-
const dest = join5(htmxDestDir, "htmx.min.js");
|
|
1917
|
-
copyFileSync(src, dest);
|
|
1918
|
-
break;
|
|
1904
|
+
await Promise.all([
|
|
1905
|
+
(async () => {
|
|
1906
|
+
if (!(htmlDir && htmlPagesPath))
|
|
1907
|
+
return;
|
|
1908
|
+
const outputHtmlPages = isSingle ? join5(buildPath, "pages") : join5(buildPath, basename4(htmlDir), "pages");
|
|
1909
|
+
if (shouldCopyHtml) {
|
|
1910
|
+
mkdirSync(outputHtmlPages, { recursive: true });
|
|
1911
|
+
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
1912
|
+
force: true,
|
|
1913
|
+
recursive: true
|
|
1914
|
+
});
|
|
1919
1915
|
}
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
}
|
|
1931
|
-
|
|
1916
|
+
if (shouldUpdateHtmlAssetPaths) {
|
|
1917
|
+
await updateAssetPaths(manifest, outputHtmlPages);
|
|
1918
|
+
}
|
|
1919
|
+
const htmlPageFiles = await scanEntryPoints(outputHtmlPages, "*.html");
|
|
1920
|
+
for (const htmlFile of htmlPageFiles) {
|
|
1921
|
+
if (hmr)
|
|
1922
|
+
injectHMRIntoHTMLFile(htmlFile, "html");
|
|
1923
|
+
const fileName = basename4(htmlFile, ".html");
|
|
1924
|
+
manifest[fileName] = htmlFile;
|
|
1925
|
+
}
|
|
1926
|
+
})(),
|
|
1927
|
+
(async () => {
|
|
1928
|
+
if (!(htmxDir && htmxPagesPath))
|
|
1929
|
+
return;
|
|
1930
|
+
const outputHtmxPages = isSingle ? join5(buildPath, "pages") : join5(buildPath, basename4(htmxDir), "pages");
|
|
1931
|
+
if (shouldCopyHtmx) {
|
|
1932
|
+
mkdirSync(outputHtmxPages, { recursive: true });
|
|
1933
|
+
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
1934
|
+
force: true,
|
|
1935
|
+
recursive: true
|
|
1936
|
+
});
|
|
1937
|
+
}
|
|
1938
|
+
if (shouldCopyHtmx) {
|
|
1939
|
+
const htmxDestDir = isSingle ? buildPath : join5(buildPath, basename4(htmxDir));
|
|
1940
|
+
mkdirSync(htmxDestDir, { recursive: true });
|
|
1941
|
+
const glob = new Glob3("htmx*.min.js");
|
|
1942
|
+
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
1943
|
+
const src = join5(htmxDir, relPath);
|
|
1944
|
+
const dest = join5(htmxDestDir, "htmx.min.js");
|
|
1945
|
+
copyFileSync(src, dest);
|
|
1946
|
+
break;
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
if (shouldUpdateHtmxAssetPaths) {
|
|
1950
|
+
await updateAssetPaths(manifest, outputHtmxPages);
|
|
1951
|
+
}
|
|
1952
|
+
const htmxPageFiles = await scanEntryPoints(outputHtmxPages, "*.html");
|
|
1953
|
+
for (const htmxFile of htmxPageFiles) {
|
|
1954
|
+
if (hmr)
|
|
1955
|
+
injectHMRIntoHTMLFile(htmxFile, "htmx");
|
|
1956
|
+
const fileName = basename4(htmxFile, ".html");
|
|
1957
|
+
manifest[fileName] = htmxFile;
|
|
1958
|
+
}
|
|
1959
|
+
})()
|
|
1960
|
+
]);
|
|
1932
1961
|
if (!options?.preserveIntermediateFiles)
|
|
1933
1962
|
await cleanup({
|
|
1934
1963
|
reactIndexesPath,
|
|
@@ -3656,5 +3685,5 @@ export {
|
|
|
3656
3685
|
BUN_BUILD_WARNING_SUPPRESSION
|
|
3657
3686
|
};
|
|
3658
3687
|
|
|
3659
|
-
//# debugId=
|
|
3688
|
+
//# debugId=E1A49B192760519C64756E2164756E21
|
|
3660
3689
|
//# sourceMappingURL=index.js.map
|