@absolutejs/absolute 0.19.0-beta.1095 → 0.19.0-beta.1097
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 +355 -306
- package/dist/angular/index.js.map +6 -5
- package/dist/angular/server.js +355 -306
- package/dist/angular/server.js.map +6 -5
- package/dist/build.js +542 -148
- package/dist/build.js.map +12 -10
- package/dist/cli/config/server.js +188 -3
- package/dist/index.js +555 -453
- package/dist/index.js.map +13 -12
- package/dist/react/index.js +345 -298
- package/dist/react/index.js.map +6 -5
- package/dist/react/server.js +343 -296
- package/dist/react/server.js.map +7 -6
- package/dist/src/utils/spaRouteManifest.d.ts +8 -0
- package/dist/svelte/index.js +343 -296
- package/dist/svelte/index.js.map +6 -5
- package/dist/svelte/server.js +343 -296
- package/dist/svelte/server.js.map +7 -6
- package/dist/vue/index.js +363 -314
- package/dist/vue/index.js.map +7 -6
- package/dist/vue/server.js +355 -306
- package/dist/vue/server.js.map +7 -6
- package/package.json +1 -1
|
@@ -28684,7 +28684,7 @@ Defaulting to 2020, but this will stop working in the future.`)), t3.ecmaVersion
|
|
|
28684
28684
|
}, pathe_M_eThtNZ_dirname = function(e3) {
|
|
28685
28685
|
const t3 = pathe_M_eThtNZ_normalizeWindowsPath(e3).replace(/\/$/, "").split("/").slice(0, -1);
|
|
28686
28686
|
return t3.length === 1 && ve.test(t3[0]) && (t3[0] += "/"), t3.join("/") || (isAbsolute(e3) ? "/" : ".");
|
|
28687
|
-
},
|
|
28687
|
+
}, basename2 = function(e3, t3) {
|
|
28688
28688
|
const i3 = pathe_M_eThtNZ_normalizeWindowsPath(e3).split("/");
|
|
28689
28689
|
let s2 = "";
|
|
28690
28690
|
for (let e4 = i3.length - 1;e4 >= 0; e4--) {
|
|
@@ -29497,7 +29497,7 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
|
|
|
29497
29497
|
return i3();
|
|
29498
29498
|
const s2 = ` /* v${zt}-${utils_hash(t3.source, 16)} */
|
|
29499
29499
|
`;
|
|
29500
|
-
let r2 = `${
|
|
29500
|
+
let r2 = `${basename2(pathe_M_eThtNZ_dirname(t3.filename))}-${function(e4) {
|
|
29501
29501
|
const t4 = e4.split(lt).pop();
|
|
29502
29502
|
if (!t4)
|
|
29503
29503
|
return;
|
|
@@ -29548,7 +29548,7 @@ Default "index" lookups for the main are deprecated for ES modules.`, "Deprecati
|
|
|
29548
29548
|
return i3.startsWith("#!") && (i3 = "// " + i3), i3;
|
|
29549
29549
|
}
|
|
29550
29550
|
function eval_evalModule(e3, t3, i3 = {}) {
|
|
29551
|
-
const s2 = i3.id || (i3.filename ?
|
|
29551
|
+
const s2 = i3.id || (i3.filename ? basename2(i3.filename) : `_jitiEval.${i3.ext || (i3.async ? "mjs" : "js")}`), r2 = i3.filename || jitiResolve(e3, s2, { async: i3.async }), n3 = i3.ext || extname(r2), a2 = i3.cache || e3.parentCache || {}, o2 = /\.[cm]?tsx?$/.test(n3), h2 = n3 === ".mjs" || n3 === ".js" && function(e4) {
|
|
29552
29552
|
for (;e4 && e4 !== "." && e4 !== "/"; ) {
|
|
29553
29553
|
e4 = pathe_M_eThtNZ_join(e4, "..");
|
|
29554
29554
|
try {
|
|
@@ -38417,6 +38417,7 @@ var resolveErrorConventionPath = (framework, pageName) => {
|
|
|
38417
38417
|
}
|
|
38418
38418
|
return conventions.defaults?.error;
|
|
38419
38419
|
};
|
|
38420
|
+
var resolveNotFoundConventionPath = (framework) => getMap()[framework]?.defaults?.notFound;
|
|
38420
38421
|
var isDev = () => true;
|
|
38421
38422
|
var buildErrorProps = (error) => {
|
|
38422
38423
|
if (error instanceof Error) {
|
|
@@ -38513,6 +38514,7 @@ var logConventionRenderError = (framework, label, renderError) => {
|
|
|
38513
38514
|
console.error(`[SSR] Failed to render ${framework} convention ${label} page:`, renderError);
|
|
38514
38515
|
};
|
|
38515
38516
|
var renderEmberError = async () => null;
|
|
38517
|
+
var renderEmberNotFound = async () => null;
|
|
38516
38518
|
var ERROR_RENDERERS = {
|
|
38517
38519
|
angular: renderAngularError,
|
|
38518
38520
|
ember: renderEmberError,
|
|
@@ -38557,6 +38559,186 @@ var renderConventionError = async (framework, pageName, error) => {
|
|
|
38557
38559
|
}
|
|
38558
38560
|
return null;
|
|
38559
38561
|
};
|
|
38562
|
+
var renderReactNotFound = async (conventionPath) => {
|
|
38563
|
+
const { createElement } = await Promise.resolve().then(() => __toESM(require_react(), 1));
|
|
38564
|
+
const { renderToReadableStream } = await Promise.resolve().then(() => (init_server_bun(), exports_server_bun));
|
|
38565
|
+
const mod = await import(conventionPath);
|
|
38566
|
+
const NotFoundComponent = mod.default;
|
|
38567
|
+
if (typeof NotFoundComponent !== "function")
|
|
38568
|
+
return null;
|
|
38569
|
+
const element = createElement(NotFoundComponent);
|
|
38570
|
+
const stream = await renderToReadableStream(element);
|
|
38571
|
+
return new Response(stream, {
|
|
38572
|
+
headers: { "Content-Type": "text/html" },
|
|
38573
|
+
status: 404
|
|
38574
|
+
});
|
|
38575
|
+
};
|
|
38576
|
+
var renderSvelteNotFound = async (conventionPath) => {
|
|
38577
|
+
const { render } = await import("svelte/server");
|
|
38578
|
+
const mod = await import(conventionPath);
|
|
38579
|
+
const NotFoundComponent = mod.default;
|
|
38580
|
+
if (!NotFoundComponent)
|
|
38581
|
+
return null;
|
|
38582
|
+
const { head, body } = render(NotFoundComponent);
|
|
38583
|
+
const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
|
|
38584
|
+
return new Response(html, {
|
|
38585
|
+
headers: { "Content-Type": "text/html" },
|
|
38586
|
+
status: 404
|
|
38587
|
+
});
|
|
38588
|
+
};
|
|
38589
|
+
var renderVueNotFound = async (conventionPath) => {
|
|
38590
|
+
const { createSSRApp, h } = await import("vue");
|
|
38591
|
+
const { renderToString } = await import("vue/server-renderer");
|
|
38592
|
+
const mod = await import(conventionPath);
|
|
38593
|
+
const NotFoundComponent = mod.default;
|
|
38594
|
+
if (!NotFoundComponent)
|
|
38595
|
+
return null;
|
|
38596
|
+
const app = createSSRApp({
|
|
38597
|
+
render: () => h(NotFoundComponent)
|
|
38598
|
+
});
|
|
38599
|
+
const rawBody = await renderToString(app);
|
|
38600
|
+
const { styles, body } = unescapeVueStyles(rawBody);
|
|
38601
|
+
const html = `<!DOCTYPE html><html><head>${styles}</head><body><div id="root">${body}</div></body></html>`;
|
|
38602
|
+
return new Response(html, {
|
|
38603
|
+
headers: { "Content-Type": "text/html" },
|
|
38604
|
+
status: 404
|
|
38605
|
+
});
|
|
38606
|
+
};
|
|
38607
|
+
var renderAngularNotFound = async (conventionPath) => {
|
|
38608
|
+
const mod = await import(conventionPath);
|
|
38609
|
+
const renderFn = mod.default;
|
|
38610
|
+
if (typeof renderFn !== "function")
|
|
38611
|
+
return null;
|
|
38612
|
+
const html = renderFn();
|
|
38613
|
+
return new Response(html, {
|
|
38614
|
+
headers: { "Content-Type": "text/html" },
|
|
38615
|
+
status: 404
|
|
38616
|
+
});
|
|
38617
|
+
};
|
|
38618
|
+
var renderHtmlNotFound = async (conventionPath) => {
|
|
38619
|
+
const html = await Bun.file(conventionPath).text();
|
|
38620
|
+
return new Response(html, {
|
|
38621
|
+
headers: { "Content-Type": "text/html" },
|
|
38622
|
+
status: 404
|
|
38623
|
+
});
|
|
38624
|
+
};
|
|
38625
|
+
var NOT_FOUND_RENDERERS = {
|
|
38626
|
+
angular: renderAngularNotFound,
|
|
38627
|
+
ember: renderEmberNotFound,
|
|
38628
|
+
html: renderHtmlNotFound,
|
|
38629
|
+
react: renderReactNotFound,
|
|
38630
|
+
svelte: renderSvelteNotFound,
|
|
38631
|
+
vue: renderVueNotFound
|
|
38632
|
+
};
|
|
38633
|
+
var renderConventionNotFound = async (framework) => {
|
|
38634
|
+
const conventionPath = resolveNotFoundConventionPath(framework);
|
|
38635
|
+
if (!conventionPath)
|
|
38636
|
+
return null;
|
|
38637
|
+
const renderer = NOT_FOUND_RENDERERS[framework];
|
|
38638
|
+
if (!renderer)
|
|
38639
|
+
return null;
|
|
38640
|
+
try {
|
|
38641
|
+
return await renderer(conventionPath);
|
|
38642
|
+
} catch (renderError) {
|
|
38643
|
+
logConventionRenderError(framework, "not-found", renderError);
|
|
38644
|
+
}
|
|
38645
|
+
return null;
|
|
38646
|
+
};
|
|
38647
|
+
var NOT_FOUND_PRIORITY = [
|
|
38648
|
+
"react",
|
|
38649
|
+
"svelte",
|
|
38650
|
+
"vue",
|
|
38651
|
+
"angular",
|
|
38652
|
+
"html"
|
|
38653
|
+
];
|
|
38654
|
+
var renderFirstNotFound = async () => {
|
|
38655
|
+
const renderNext = async (frameworks) => {
|
|
38656
|
+
const [framework, ...remaining] = frameworks;
|
|
38657
|
+
if (!framework) {
|
|
38658
|
+
return null;
|
|
38659
|
+
}
|
|
38660
|
+
if (!getMap()[framework]?.defaults?.notFound) {
|
|
38661
|
+
return renderNext(remaining);
|
|
38662
|
+
}
|
|
38663
|
+
const response = await renderConventionNotFound(framework);
|
|
38664
|
+
if (response) {
|
|
38665
|
+
return response;
|
|
38666
|
+
}
|
|
38667
|
+
return renderNext(remaining);
|
|
38668
|
+
};
|
|
38669
|
+
return renderNext(NOT_FOUND_PRIORITY);
|
|
38670
|
+
};
|
|
38671
|
+
|
|
38672
|
+
// src/utils/spaRouteManifest.ts
|
|
38673
|
+
import { basename } from "path";
|
|
38674
|
+
var SPA_ROUTES_KEY = "__absoluteSpaRoutes";
|
|
38675
|
+
var getSpaRouteManifest = () => {
|
|
38676
|
+
const value = Reflect.get(globalThis, SPA_ROUTES_KEY);
|
|
38677
|
+
return Array.isArray(value) ? value : [];
|
|
38678
|
+
};
|
|
38679
|
+
var normalizePath = (path) => {
|
|
38680
|
+
const withLeadingSlash = path.startsWith("/") ? path : `/${path}`;
|
|
38681
|
+
const trimmed = withLeadingSlash.replace(/\/+$/, "");
|
|
38682
|
+
return trimmed || "/";
|
|
38683
|
+
};
|
|
38684
|
+
var fullRoutePath = (baseHref, routePath) => {
|
|
38685
|
+
const base = normalizePath(baseHref);
|
|
38686
|
+
const route = normalizePath(routePath);
|
|
38687
|
+
if (base !== "/" && (route === base || route.startsWith(`${base}/`))) {
|
|
38688
|
+
return route;
|
|
38689
|
+
}
|
|
38690
|
+
if (base === "/")
|
|
38691
|
+
return route;
|
|
38692
|
+
return normalizePath(`${base}/${route.replace(/^\/+/, "")}`);
|
|
38693
|
+
};
|
|
38694
|
+
var routePattern = (path) => {
|
|
38695
|
+
const segments = normalizePath(path).split("/").filter(Boolean);
|
|
38696
|
+
let expression = "^";
|
|
38697
|
+
for (const segment of segments) {
|
|
38698
|
+
if (segment === "*" || segment === "**") {
|
|
38699
|
+
expression += "(?:/.*)?";
|
|
38700
|
+
continue;
|
|
38701
|
+
}
|
|
38702
|
+
const parameter = /^:[A-Za-z_$][A-Za-z0-9_$]*(?:\((.*)\))?(\?)?$/.exec(segment);
|
|
38703
|
+
if (parameter) {
|
|
38704
|
+
const valuePattern = parameter[1] || "[^/]+";
|
|
38705
|
+
expression += parameter[2] ? `(?:/${valuePattern})?` : `/${valuePattern}`;
|
|
38706
|
+
continue;
|
|
38707
|
+
}
|
|
38708
|
+
expression += `/${segment.replace(/[.+?^${}()|[\]\\]/g, "\\$&")}`;
|
|
38709
|
+
}
|
|
38710
|
+
return new RegExp(`${expression || "^/"}/?$`);
|
|
38711
|
+
};
|
|
38712
|
+
var sourcePageName = (sourceFile) => basename(sourceFile).replace(/\.[^.]+$/, "").toLowerCase();
|
|
38713
|
+
var isKnownSpaRoute = (framework, pageName, request) => {
|
|
38714
|
+
if (!request)
|
|
38715
|
+
return true;
|
|
38716
|
+
let pathname;
|
|
38717
|
+
try {
|
|
38718
|
+
pathname = normalizePath(new URL(request.url).pathname);
|
|
38719
|
+
} catch {
|
|
38720
|
+
return true;
|
|
38721
|
+
}
|
|
38722
|
+
const hosts = getSpaRouteManifest().filter((host) => {
|
|
38723
|
+
if (host.framework !== framework)
|
|
38724
|
+
return false;
|
|
38725
|
+
if (sourcePageName(host.sourceFile) !== pageName.toLowerCase())
|
|
38726
|
+
return false;
|
|
38727
|
+
const base = normalizePath(host.baseHref);
|
|
38728
|
+
return base === "/" || pathname === base || pathname.startsWith(`${base}/`);
|
|
38729
|
+
});
|
|
38730
|
+
if (hosts.length === 0)
|
|
38731
|
+
return true;
|
|
38732
|
+
return hosts.some((host) => host.routes.some((route) => routePattern(fullRoutePath(host.baseHref, route.path)).test(pathname)));
|
|
38733
|
+
};
|
|
38734
|
+
var renderSpaNotFound = async (framework, pageName, request) => {
|
|
38735
|
+
if (isKnownSpaRoute(framework, pageName, request))
|
|
38736
|
+
return null;
|
|
38737
|
+
return await renderFirstNotFound() ?? new Response("Not found", {
|
|
38738
|
+
headers: { "Content-Type": "text/plain" },
|
|
38739
|
+
status: 404
|
|
38740
|
+
});
|
|
38741
|
+
};
|
|
38560
38742
|
|
|
38561
38743
|
// src/react/pageHandler.ts
|
|
38562
38744
|
var resolveRequestPathname = (request) => {
|
|
@@ -38585,6 +38767,9 @@ var handleReactPageRequest = async (input) => {
|
|
|
38585
38767
|
} : userProps;
|
|
38586
38768
|
const pageName = Page.name || Page.displayName || "";
|
|
38587
38769
|
try {
|
|
38770
|
+
const spaNotFound = await renderSpaNotFound("react", pageName, input.request);
|
|
38771
|
+
if (spaNotFound)
|
|
38772
|
+
return withPageCacheHeaders(spaNotFound, input.request);
|
|
38588
38773
|
const handlerCallsite = options?.collectStreamingSlots === true ? undefined : getCurrentRouteRegistrationCallsite() ?? captureStreamingSlotWarningCallsite();
|
|
38589
38774
|
const renderPageResponse = async () => {
|
|
38590
38775
|
const { createElement } = await Promise.resolve().then(() => __toESM(require_react(), 1));
|