@absolutejs/absolute 0.19.0-beta.931 → 0.19.0-beta.932
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/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +285 -136
- package/dist/angular/index.js.map +6 -5
- package/dist/angular/server.js +267 -118
- package/dist/angular/server.js.map +6 -5
- package/dist/build.js +736 -584
- package/dist/build.js.map +17 -16
- package/dist/dev/client/handlers/angularHmrShim.ts +4 -1
- package/dist/dev/client/handlers/angularRemount.ts +2 -2
- package/dist/dev/client/handlers/angularRemountWiring.ts +1 -4
- package/dist/dev/client/vendor/lview/lViewOps.ts +8 -6
- package/dist/index.js +854 -651
- package/dist/index.js.map +21 -19
- package/dist/islands/index.js +105 -2
- package/dist/islands/index.js.map +5 -4
- package/dist/react/index.js +167 -18
- package/dist/react/index.js.map +6 -5
- package/dist/react/server.js +63 -17
- package/dist/react/server.js.map +3 -3
- package/dist/src/core/normalizeIslandProps.d.ts +15 -0
- package/dist/src/core/vueServerModule.d.ts +1 -0
- package/dist/src/utils/defineConvention.d.ts +3 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/vue/Island.browser.d.ts +36 -12
- package/dist/src/vue/Island.d.ts +35 -11
- package/dist/src/vue/pageHandler.d.ts +8 -0
- package/dist/svelte/index.js +167 -18
- package/dist/svelte/index.js.map +6 -5
- package/dist/svelte/server.js +63 -17
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/conventions.d.ts +5 -0
- package/dist/vue/browser.js +57 -4
- package/dist/vue/browser.js.map +5 -4
- package/dist/vue/index.js +234 -24
- package/dist/vue/index.js.map +9 -7
- package/dist/vue/server.js +73 -20
- package/dist/vue/server.js.map +4 -4
- package/package.json +1 -1
package/dist/vue/server.js
CHANGED
|
@@ -1551,16 +1551,22 @@ var setConventions = (map) => {
|
|
|
1551
1551
|
};
|
|
1552
1552
|
var isDev = () => true;
|
|
1553
1553
|
var buildErrorProps = (error) => {
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1554
|
+
if (error instanceof Error) {
|
|
1555
|
+
return {
|
|
1556
|
+
name: error.name,
|
|
1557
|
+
message: error.message,
|
|
1558
|
+
...isDev() && error.stack ? { stack: error.stack } : {}
|
|
1559
|
+
};
|
|
1560
|
+
}
|
|
1561
|
+
return { name: "Error", message: String(error) };
|
|
1557
1562
|
};
|
|
1558
1563
|
var renderReactError = async (conventionPath, errorProps) => {
|
|
1559
1564
|
const { createElement } = await import("react");
|
|
1560
1565
|
const { renderToReadableStream } = await import("react-dom/server");
|
|
1561
1566
|
const mod = await import(conventionPath);
|
|
1562
|
-
const
|
|
1563
|
-
|
|
1567
|
+
const ErrorComponent = mod.default;
|
|
1568
|
+
if (typeof ErrorComponent !== "function")
|
|
1569
|
+
return null;
|
|
1564
1570
|
const element = createElement(ErrorComponent, errorProps);
|
|
1565
1571
|
const stream = await renderToReadableStream(element);
|
|
1566
1572
|
return new Response(stream, {
|
|
@@ -1572,6 +1578,8 @@ var renderSvelteError = async (conventionPath, errorProps) => {
|
|
|
1572
1578
|
const { render } = await import("svelte/server");
|
|
1573
1579
|
const mod = await import(conventionPath);
|
|
1574
1580
|
const ErrorComponent = mod.default;
|
|
1581
|
+
if (!ErrorComponent)
|
|
1582
|
+
return null;
|
|
1575
1583
|
const { head, body } = render(ErrorComponent, {
|
|
1576
1584
|
props: errorProps
|
|
1577
1585
|
});
|
|
@@ -1594,6 +1602,8 @@ var renderVueError = async (conventionPath, errorProps) => {
|
|
|
1594
1602
|
const { renderToString } = await import("vue/server-renderer");
|
|
1595
1603
|
const mod = await import(conventionPath);
|
|
1596
1604
|
const ErrorComponent = mod.default;
|
|
1605
|
+
if (!ErrorComponent)
|
|
1606
|
+
return null;
|
|
1597
1607
|
const app = createSSRApp({
|
|
1598
1608
|
render: () => h(ErrorComponent, errorProps)
|
|
1599
1609
|
});
|
|
@@ -1607,10 +1617,20 @@ var renderVueError = async (conventionPath, errorProps) => {
|
|
|
1607
1617
|
};
|
|
1608
1618
|
var renderAngularError = async (conventionPath, errorProps) => {
|
|
1609
1619
|
const mod = await import(conventionPath);
|
|
1610
|
-
const
|
|
1611
|
-
if (typeof
|
|
1620
|
+
const renderFn = mod.default;
|
|
1621
|
+
if (typeof renderFn !== "function")
|
|
1612
1622
|
return null;
|
|
1613
|
-
const html =
|
|
1623
|
+
const html = renderFn(errorProps);
|
|
1624
|
+
return new Response(html, {
|
|
1625
|
+
headers: { "Content-Type": "text/html" },
|
|
1626
|
+
status: 500
|
|
1627
|
+
});
|
|
1628
|
+
};
|
|
1629
|
+
var escapeHtml = (value) => value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1630
|
+
var replaceErrorTokens = (template, errorProps) => template.replace(/\{\{\s*name\s*\}\}/g, escapeHtml(errorProps.name)).replace(/\{\{\s*message\s*\}\}/g, escapeHtml(errorProps.message)).replace(/\{\{\s*stack\s*\}\}/g, errorProps.stack ? escapeHtml(errorProps.stack) : "");
|
|
1631
|
+
var renderHtmlError = async (conventionPath, errorProps) => {
|
|
1632
|
+
const template = await Bun.file(conventionPath).text();
|
|
1633
|
+
const html = replaceErrorTokens(template, errorProps);
|
|
1614
1634
|
return new Response(html, {
|
|
1615
1635
|
headers: { "Content-Type": "text/html" },
|
|
1616
1636
|
status: 500
|
|
@@ -1629,11 +1649,12 @@ var renderEmberNotFound = async () => null;
|
|
|
1629
1649
|
var ERROR_RENDERERS = {
|
|
1630
1650
|
angular: renderAngularError,
|
|
1631
1651
|
ember: renderEmberError,
|
|
1652
|
+
html: renderHtmlError,
|
|
1632
1653
|
react: renderReactError,
|
|
1633
1654
|
svelte: renderSvelteError,
|
|
1634
1655
|
vue: renderVueError
|
|
1635
1656
|
};
|
|
1636
|
-
var
|
|
1657
|
+
var tryFrameworkErrorConvention = async (framework, pageName, errorProps, error) => {
|
|
1637
1658
|
let conventionPath = resolveErrorConventionPath(framework, pageName);
|
|
1638
1659
|
if (!conventionPath && error instanceof Error && error.stack) {
|
|
1639
1660
|
for (const match of error.stack.matchAll(/^\s*at\s+([A-Za-z_$][\w$]*)/gm)) {
|
|
@@ -1647,7 +1668,6 @@ var renderConventionError = async (framework, pageName, error) => {
|
|
|
1647
1668
|
}
|
|
1648
1669
|
if (!conventionPath)
|
|
1649
1670
|
return null;
|
|
1650
|
-
const errorProps = buildErrorProps(error);
|
|
1651
1671
|
const renderer = ERROR_RENDERERS[framework];
|
|
1652
1672
|
if (!renderer)
|
|
1653
1673
|
return null;
|
|
@@ -1658,12 +1678,25 @@ var renderConventionError = async (framework, pageName, error) => {
|
|
|
1658
1678
|
}
|
|
1659
1679
|
return null;
|
|
1660
1680
|
};
|
|
1681
|
+
var renderConventionError = async (framework, pageName, error) => {
|
|
1682
|
+
const errorProps = buildErrorProps(error);
|
|
1683
|
+
const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
|
|
1684
|
+
if (frameworkResponse)
|
|
1685
|
+
return frameworkResponse;
|
|
1686
|
+
if (framework !== "html") {
|
|
1687
|
+
const htmlResponse = await tryFrameworkErrorConvention("html", pageName, errorProps, error);
|
|
1688
|
+
if (htmlResponse)
|
|
1689
|
+
return htmlResponse;
|
|
1690
|
+
}
|
|
1691
|
+
return null;
|
|
1692
|
+
};
|
|
1661
1693
|
var renderReactNotFound = async (conventionPath) => {
|
|
1662
1694
|
const { createElement } = await import("react");
|
|
1663
1695
|
const { renderToReadableStream } = await import("react-dom/server");
|
|
1664
1696
|
const mod = await import(conventionPath);
|
|
1665
|
-
const
|
|
1666
|
-
|
|
1697
|
+
const NotFoundComponent = mod.default;
|
|
1698
|
+
if (typeof NotFoundComponent !== "function")
|
|
1699
|
+
return null;
|
|
1667
1700
|
const element = createElement(NotFoundComponent);
|
|
1668
1701
|
const stream = await renderToReadableStream(element);
|
|
1669
1702
|
return new Response(stream, {
|
|
@@ -1675,6 +1708,8 @@ var renderSvelteNotFound = async (conventionPath) => {
|
|
|
1675
1708
|
const { render } = await import("svelte/server");
|
|
1676
1709
|
const mod = await import(conventionPath);
|
|
1677
1710
|
const NotFoundComponent = mod.default;
|
|
1711
|
+
if (!NotFoundComponent)
|
|
1712
|
+
return null;
|
|
1678
1713
|
const { head, body } = render(NotFoundComponent);
|
|
1679
1714
|
const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
|
|
1680
1715
|
return new Response(html, {
|
|
@@ -1687,6 +1722,8 @@ var renderVueNotFound = async (conventionPath) => {
|
|
|
1687
1722
|
const { renderToString } = await import("vue/server-renderer");
|
|
1688
1723
|
const mod = await import(conventionPath);
|
|
1689
1724
|
const NotFoundComponent = mod.default;
|
|
1725
|
+
if (!NotFoundComponent)
|
|
1726
|
+
return null;
|
|
1690
1727
|
const app = createSSRApp({
|
|
1691
1728
|
render: () => h(NotFoundComponent)
|
|
1692
1729
|
});
|
|
@@ -1700,10 +1737,17 @@ var renderVueNotFound = async (conventionPath) => {
|
|
|
1700
1737
|
};
|
|
1701
1738
|
var renderAngularNotFound = async (conventionPath) => {
|
|
1702
1739
|
const mod = await import(conventionPath);
|
|
1703
|
-
const
|
|
1704
|
-
if (typeof
|
|
1740
|
+
const renderFn = mod.default;
|
|
1741
|
+
if (typeof renderFn !== "function")
|
|
1705
1742
|
return null;
|
|
1706
|
-
const html =
|
|
1743
|
+
const html = renderFn();
|
|
1744
|
+
return new Response(html, {
|
|
1745
|
+
headers: { "Content-Type": "text/html" },
|
|
1746
|
+
status: 404
|
|
1747
|
+
});
|
|
1748
|
+
};
|
|
1749
|
+
var renderHtmlNotFound = async (conventionPath) => {
|
|
1750
|
+
const html = await Bun.file(conventionPath).text();
|
|
1707
1751
|
return new Response(html, {
|
|
1708
1752
|
headers: { "Content-Type": "text/html" },
|
|
1709
1753
|
status: 404
|
|
@@ -1712,6 +1756,7 @@ var renderAngularNotFound = async (conventionPath) => {
|
|
|
1712
1756
|
var NOT_FOUND_RENDERERS = {
|
|
1713
1757
|
angular: renderAngularNotFound,
|
|
1714
1758
|
ember: renderEmberNotFound,
|
|
1759
|
+
html: renderHtmlNotFound,
|
|
1715
1760
|
react: renderReactNotFound,
|
|
1716
1761
|
svelte: renderSvelteNotFound,
|
|
1717
1762
|
vue: renderVueNotFound
|
|
@@ -1734,7 +1779,8 @@ var NOT_FOUND_PRIORITY = [
|
|
|
1734
1779
|
"react",
|
|
1735
1780
|
"svelte",
|
|
1736
1781
|
"vue",
|
|
1737
|
-
"angular"
|
|
1782
|
+
"angular",
|
|
1783
|
+
"html"
|
|
1738
1784
|
];
|
|
1739
1785
|
var renderFirstNotFound = async () => {
|
|
1740
1786
|
const renderNext = async (frameworks) => {
|
|
@@ -1786,7 +1832,13 @@ var resolveCurrentGeneratedVueModulePath = async (pagePath) => {
|
|
|
1786
1832
|
return pagePath;
|
|
1787
1833
|
}
|
|
1788
1834
|
};
|
|
1789
|
-
var buildDirtyResponse = (headTag, indexPath, maybeProps) => {
|
|
1835
|
+
var buildDirtyResponse = (headTag, indexPath, maybeProps, clientMode) => {
|
|
1836
|
+
if (clientMode === "none") {
|
|
1837
|
+
const html2 = `<!DOCTYPE html><html>${headTag}<body><div id="root"></div>` + `</body></html>`;
|
|
1838
|
+
return new Response(html2, {
|
|
1839
|
+
headers: { "Content-Type": "text/html" }
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1790
1842
|
const propsScript = `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps ?? {})};`;
|
|
1791
1843
|
const dirtyFlag = "window.__SSR_DIRTY__=true;";
|
|
1792
1844
|
const html = `<!DOCTYPE html><html>${headTag}<body><div id="root"></div>` + `<script>${propsScript}${dirtyFlag}</script>` + `<script type="module" src="${indexPath}"></script>` + `</body></html>`;
|
|
@@ -1816,8 +1868,9 @@ var handleVuePageRequest = async (input) => {
|
|
|
1816
1868
|
const resolvedOptions = input;
|
|
1817
1869
|
const resolvedPagePath = input.pagePath;
|
|
1818
1870
|
const maybeProps = input.props;
|
|
1871
|
+
const clientMode = input.client ?? "auto";
|
|
1819
1872
|
if (isSsrCacheDirty("vue")) {
|
|
1820
|
-
return buildDirtyResponse(resolvedHeadTag, resolvedIndexPath, maybeProps);
|
|
1873
|
+
return buildDirtyResponse(resolvedHeadTag, resolvedIndexPath, maybeProps, clientMode);
|
|
1821
1874
|
}
|
|
1822
1875
|
try {
|
|
1823
1876
|
const handlerCallsite = resolvedOptions?.collectStreamingSlots === true ? undefined : getCurrentRouteRegistrationCallsite() ?? captureStreamingSlotWarningCallsite();
|
|
@@ -1874,7 +1927,7 @@ var handleVuePageRequest = async (input) => {
|
|
|
1874
1927
|
const bodyStream = renderToWebStream(app);
|
|
1875
1928
|
const { firstChunk, reader } = await primeVueStream(bodyStream);
|
|
1876
1929
|
const head = `<!DOCTYPE html><html>${resolvedHeadTag}<body><div id="root">`;
|
|
1877
|
-
const tail = `</div><script>window.__INITIAL_PROPS__=${JSON.stringify(maybeProps ?? {})}</script><script type="module" src="${resolvedIndexPath}"></script></body></html>`;
|
|
1930
|
+
const tail = clientMode === "none" ? `</div></body></html>` : `</div><script>window.__INITIAL_PROPS__=${JSON.stringify(maybeProps ?? {})}</script><script type="module" src="${resolvedIndexPath}"></script></body></html>`;
|
|
1878
1931
|
const stream = new ReadableStream({
|
|
1879
1932
|
start(controller) {
|
|
1880
1933
|
controller.enqueue(head);
|
|
@@ -1934,5 +1987,5 @@ export {
|
|
|
1934
1987
|
applyVueRouterRedirect
|
|
1935
1988
|
};
|
|
1936
1989
|
|
|
1937
|
-
//# debugId=
|
|
1990
|
+
//# debugId=3CE3D644EA84850464756E2164756E21
|
|
1938
1991
|
//# sourceMappingURL=server.js.map
|