@absolutejs/absolute 0.19.0-beta.951 → 0.19.0-beta.953
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 +11953 -5023
- package/dist/angular/index.js.map +20 -10
- package/dist/angular/server.js +18383 -2517
- package/dist/angular/server.js.map +239 -6
- package/dist/build.js +26 -4
- package/dist/build.js.map +5 -4
- package/dist/index.js +158 -48
- package/dist/index.js.map +9 -7
- package/dist/react/index.js +29 -9
- package/dist/react/index.js.map +3 -3
- package/dist/react/server.js +29 -9
- package/dist/react/server.js.map +3 -3
- package/dist/src/angular/enumerateSpaRoutes.d.ts +6 -0
- package/dist/src/angular/index.d.ts +1 -0
- package/dist/src/angular/internal/captureProvideRouter.d.ts +11 -0
- package/dist/src/build/rewriteProvideRouter.d.ts +5 -0
- package/dist/src/core/devRouteRegistrationCallsite.d.ts +1 -0
- package/dist/src/utils/generateSitemap.d.ts +8 -2
- package/dist/src/utils/spaRouteEnumeration.d.ts +23 -0
- package/dist/svelte/index.js +29 -9
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +29 -9
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/angular.d.ts +9 -0
- package/dist/vue/index.js +29 -9
- package/dist/vue/index.js.map +3 -3
- package/dist/vue/server.js +29 -9
- package/dist/vue/server.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8686,11 +8686,22 @@ var init_startupTimings = __esm(() => {
|
|
|
8686
8686
|
var exports_devRouteRegistrationCallsite = {};
|
|
8687
8687
|
__export(exports_devRouteRegistrationCallsite, {
|
|
8688
8688
|
patchElysiaRouteRegistrationCallsites: () => patchElysiaRouteRegistrationCallsites,
|
|
8689
|
+
isPageHandler: () => isPageHandler,
|
|
8689
8690
|
getCurrentRouteRegistrationCallsite: () => getCurrentRouteRegistrationCallsite
|
|
8690
8691
|
});
|
|
8691
8692
|
import { AsyncLocalStorage } from "async_hooks";
|
|
8692
8693
|
import { Elysia } from "elysia";
|
|
8693
|
-
var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES,
|
|
8694
|
+
var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES, PAGE_HANDLER_NAMES, pageHandlerWrappers, handlerSourceMentionsPageHelper = (handler) => {
|
|
8695
|
+
const source = handler.toString();
|
|
8696
|
+
return PAGE_HANDLER_NAMES.some((name) => source.includes(name));
|
|
8697
|
+
}, isPageHandler = (handler) => {
|
|
8698
|
+
if (typeof handler !== "function")
|
|
8699
|
+
return false;
|
|
8700
|
+
const fn2 = handler;
|
|
8701
|
+
if (pageHandlerWrappers.has(fn2))
|
|
8702
|
+
return true;
|
|
8703
|
+
return handlerSourceMentionsPageHelper(fn2);
|
|
8704
|
+
}, isObjectRecord3 = (value) => Boolean(value) && typeof value === "object", isAsyncLocalStorage2 = (value) => isObjectRecord3(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function", isRouteMethod = (value) => typeof value === "function", getRouteCallsiteStorage = () => {
|
|
8694
8705
|
const value = Reflect.get(globalThis, ROUTE_CALLSITE_STORAGE_KEY);
|
|
8695
8706
|
if (value === null || typeof value === "undefined") {
|
|
8696
8707
|
return;
|
|
@@ -8723,13 +8734,13 @@ var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES,
|
|
|
8723
8734
|
return function wrappedRouteHandler(...args) {
|
|
8724
8735
|
return storage.run({ callsite }, () => Reflect.apply(routeHandler, this, args));
|
|
8725
8736
|
};
|
|
8726
|
-
}, createPatchedRouteMethod = (originalMethod) => function patchedRouteMethod(path, handler, ...rest) {
|
|
8737
|
+
}, createPatchedRouteMethod = (originalMethod, methodName) => function patchedRouteMethod(path, handler, ...rest) {
|
|
8727
8738
|
const callsite = captureRouteRegistrationCallsite();
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8731
|
-
|
|
8732
|
-
]);
|
|
8739
|
+
const wrapped = wrapRouteHandlerWithCallsite(handler, callsite);
|
|
8740
|
+
if (methodName === "get" && typeof handler === "function" && typeof wrapped === "function" && handlerSourceMentionsPageHelper(handler)) {
|
|
8741
|
+
pageHandlerWrappers.add(wrapped);
|
|
8742
|
+
}
|
|
8743
|
+
return Reflect.apply(originalMethod, this, [path, wrapped, ...rest]);
|
|
8733
8744
|
}, getCurrentRouteRegistrationCallsite = () => getRouteCallsiteStorage()?.getStore()?.callsite, patchElysiaRouteRegistrationCallsites = () => {
|
|
8734
8745
|
if (false) {}
|
|
8735
8746
|
if (Reflect.get(globalThis, ROUTE_CALLSITE_PATCHED_KEY) === true) {
|
|
@@ -8740,7 +8751,7 @@ var ROUTE_CALLSITE_STORAGE_KEY, ROUTE_CALLSITE_PATCHED_KEY, ROUTE_METHOD_NAMES,
|
|
|
8740
8751
|
const originalMethod = Reflect.get(prototype, methodName);
|
|
8741
8752
|
if (!isRouteMethod(originalMethod))
|
|
8742
8753
|
return;
|
|
8743
|
-
Reflect.set(prototype, methodName, createPatchedRouteMethod(originalMethod));
|
|
8754
|
+
Reflect.set(prototype, methodName, createPatchedRouteMethod(originalMethod, methodName));
|
|
8744
8755
|
});
|
|
8745
8756
|
Reflect.set(globalThis, ROUTE_CALLSITE_PATCHED_KEY, true);
|
|
8746
8757
|
};
|
|
@@ -8757,6 +8768,15 @@ var init_devRouteRegistrationCallsite = __esm(() => {
|
|
|
8757
8768
|
"post",
|
|
8758
8769
|
"put"
|
|
8759
8770
|
];
|
|
8771
|
+
PAGE_HANDLER_NAMES = [
|
|
8772
|
+
"handleReactPageRequest",
|
|
8773
|
+
"handleSveltePageRequest",
|
|
8774
|
+
"handleVuePageRequest",
|
|
8775
|
+
"handleAngularPageRequest",
|
|
8776
|
+
"handleHTMLPageRequest",
|
|
8777
|
+
"handleHTMXPageRequest"
|
|
8778
|
+
];
|
|
8779
|
+
pageHandlerWrappers = new WeakSet;
|
|
8760
8780
|
});
|
|
8761
8781
|
|
|
8762
8782
|
// src/utils/startupBanner.ts
|
|
@@ -11976,6 +11996,24 @@ var init_compileVue = __esm(() => {
|
|
|
11976
11996
|
vueHmrMetadata = new Map;
|
|
11977
11997
|
});
|
|
11978
11998
|
|
|
11999
|
+
// src/build/rewriteProvideRouter.ts
|
|
12000
|
+
var ROUTER_IMPORT_PATTERN, PROVIDE_ROUTER_CALL_PATTERN, CAPTURE_IMPORT_STATEMENT = `import { __abs_provideRouter } from '@absolutejs/absolute/angular';
|
|
12001
|
+
`, SHIM_MARKER = "__abs_provideRouter", rewriteAngularProvideRouter = (source) => {
|
|
12002
|
+
if (source.includes(SHIM_MARKER))
|
|
12003
|
+
return source;
|
|
12004
|
+
if (!ROUTER_IMPORT_PATTERN.test(source))
|
|
12005
|
+
return source;
|
|
12006
|
+
if (!PROVIDE_ROUTER_CALL_PATTERN.test(source))
|
|
12007
|
+
return source;
|
|
12008
|
+
PROVIDE_ROUTER_CALL_PATTERN.lastIndex = 0;
|
|
12009
|
+
const rewritten = source.replace(PROVIDE_ROUTER_CALL_PATTERN, "__abs_provideRouter(");
|
|
12010
|
+
return `${CAPTURE_IMPORT_STATEMENT}${rewritten}`;
|
|
12011
|
+
};
|
|
12012
|
+
var init_rewriteProvideRouter = __esm(() => {
|
|
12013
|
+
ROUTER_IMPORT_PATTERN = /import\s*(?:type\s+)?\{[^}]*\bprovideRouter\b[^}]*\}\s*from\s*['"]@angular\/router['"]/;
|
|
12014
|
+
PROVIDE_ROUTER_CALL_PATTERN = /\bprovideRouter\s*\(/g;
|
|
12015
|
+
});
|
|
12016
|
+
|
|
11979
12017
|
// src/angular/lowerDeferSyntax.ts
|
|
11980
12018
|
var isInterpolatedExpressionStart = (value, index) => value[index] === "{" && value[index + 1] === "{", skipInterpolatedExpression = (value, start) => {
|
|
11981
12019
|
const cursor = start + 2;
|
|
@@ -12671,9 +12709,11 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
12671
12709
|
return candidates.map((candidate) => resolve24(candidate)).find((candidate) => existsSync18(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
12672
12710
|
}, readFileForAotTransform = async (fileName, readFile6) => {
|
|
12673
12711
|
const hostSource = readFile6?.(fileName);
|
|
12674
|
-
if (typeof hostSource === "string")
|
|
12675
|
-
return hostSource;
|
|
12676
|
-
|
|
12712
|
+
if (typeof hostSource === "string") {
|
|
12713
|
+
return rewriteAngularProvideRouter(hostSource);
|
|
12714
|
+
}
|
|
12715
|
+
const raw = await fs.readFile(fileName, "utf-8");
|
|
12716
|
+
return rewriteAngularProvideRouter(raw);
|
|
12677
12717
|
}, safeStableStringify = (value) => {
|
|
12678
12718
|
const seen = new WeakSet;
|
|
12679
12719
|
return JSON.stringify(value, (_key, entry) => {
|
|
@@ -13267,6 +13307,7 @@ ${fields}
|
|
|
13267
13307
|
if (!existsSync18(actualPath))
|
|
13268
13308
|
return;
|
|
13269
13309
|
let sourceCode = await fs.readFile(actualPath, "utf-8");
|
|
13310
|
+
sourceCode = rewriteAngularProvideRouter(sourceCode);
|
|
13270
13311
|
const inlined = await inlineResources(sourceCode, dirname15(actualPath), stylePreprocessors);
|
|
13271
13312
|
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname15(actualPath)).source;
|
|
13272
13313
|
const inputDir = dirname15(actualPath);
|
|
@@ -13640,6 +13681,7 @@ if (pageHasRawStreamingSlots) {
|
|
|
13640
13681
|
};
|
|
13641
13682
|
};
|
|
13642
13683
|
var init_compileAngular = __esm(() => {
|
|
13684
|
+
init_rewriteProvideRouter();
|
|
13643
13685
|
init_constants();
|
|
13644
13686
|
init_sourceMetadata();
|
|
13645
13687
|
init_lowerDeferSyntax();
|
|
@@ -25578,6 +25620,29 @@ var init_imageOptimizer = __esm(() => {
|
|
|
25578
25620
|
avifInProgress = new Set;
|
|
25579
25621
|
});
|
|
25580
25622
|
|
|
25623
|
+
// src/utils/spaRouteEnumeration.ts
|
|
25624
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "async_hooks";
|
|
25625
|
+
var STORAGE_KEY, isObjectRecord4 = (value) => Boolean(value) && typeof value === "object", isStorage = (value) => isObjectRecord4(value) && typeof value.getStore === "function" && typeof value.run === "function", getStorage = () => {
|
|
25626
|
+
const existing = Reflect.get(globalThis, STORAGE_KEY);
|
|
25627
|
+
if (isStorage(existing))
|
|
25628
|
+
return existing;
|
|
25629
|
+
const fresh = new AsyncLocalStorage2;
|
|
25630
|
+
Reflect.set(globalThis, STORAGE_KEY, fresh);
|
|
25631
|
+
return fresh;
|
|
25632
|
+
}, isCollectingSpaRoutes = () => getStorage().getStore() !== undefined, recordSpaRoutes = (entries) => {
|
|
25633
|
+
const store = getStorage().getStore();
|
|
25634
|
+
if (!store)
|
|
25635
|
+
return;
|
|
25636
|
+
store.entries.push(...entries);
|
|
25637
|
+
}, collectSpaRoutes = async (task) => {
|
|
25638
|
+
const store = { entries: [] };
|
|
25639
|
+
await getStorage().run(store, task);
|
|
25640
|
+
return store.entries;
|
|
25641
|
+
};
|
|
25642
|
+
var init_spaRouteEnumeration = __esm(() => {
|
|
25643
|
+
STORAGE_KEY = Symbol.for("absolutejs.spaRouteEnumerationStorage");
|
|
25644
|
+
});
|
|
25645
|
+
|
|
25581
25646
|
// src/utils/generateSitemap.ts
|
|
25582
25647
|
var exports_generateSitemap = {};
|
|
25583
25648
|
__export(exports_generateSitemap, {
|
|
@@ -25592,11 +25657,6 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
|
|
|
25592
25657
|
return true;
|
|
25593
25658
|
}
|
|
25594
25659
|
return false;
|
|
25595
|
-
}, PAGE_HANDLER_NAMES, isPageHandler = (handler) => {
|
|
25596
|
-
if (typeof handler !== "function")
|
|
25597
|
-
return false;
|
|
25598
|
-
const source = handler.toString();
|
|
25599
|
-
return PAGE_HANDLER_NAMES.some((name) => source.includes(name));
|
|
25600
25660
|
}, discoverPageRoutes = (routes, exclude) => {
|
|
25601
25661
|
const seen = new Set;
|
|
25602
25662
|
return routes.filter((route) => {
|
|
@@ -25612,55 +25672,105 @@ var DEFAULT_PRIORITY = 0.8, escapeXml = (str) => str.replace(/&/g, "&").repl
|
|
|
25612
25672
|
return false;
|
|
25613
25673
|
seen.add(route.path);
|
|
25614
25674
|
return true;
|
|
25615
|
-
})
|
|
25616
|
-
},
|
|
25675
|
+
});
|
|
25676
|
+
}, joinMountAndSubPath = (mount, sub) => {
|
|
25677
|
+
const trimmedMount = mount.replace(/\/+$/, "");
|
|
25678
|
+
const trimmedSub = sub.replace(/^\/+/, "");
|
|
25679
|
+
if (!trimmedSub)
|
|
25680
|
+
return trimmedMount || "/";
|
|
25681
|
+
if (!trimmedMount)
|
|
25682
|
+
return `/${trimmedSub}`;
|
|
25683
|
+
return `${trimmedMount}/${trimmedSub}`;
|
|
25684
|
+
}, buildSitemapXml = (entries, baseUrl, config) => {
|
|
25617
25685
|
const normalizedBase = baseUrl.replace(/\/$/, "");
|
|
25618
|
-
const
|
|
25619
|
-
for (const
|
|
25620
|
-
const override = config.overrides?.[path];
|
|
25621
|
-
const changefreq = override?.changefreq ?? config.defaultChangefreq ?? "weekly";
|
|
25622
|
-
const priority = override?.priority ?? config.defaultPriority ?? DEFAULT_PRIORITY;
|
|
25623
|
-
const lastmod = override?.lastmod;
|
|
25624
|
-
const url = escapeXml(`${normalizedBase}${path}`);
|
|
25625
|
-
let
|
|
25686
|
+
const xml = [];
|
|
25687
|
+
for (const entry of entries) {
|
|
25688
|
+
const override = config.overrides?.[entry.path];
|
|
25689
|
+
const changefreq = override?.changefreq ?? entry.changefreq ?? config.defaultChangefreq ?? "weekly";
|
|
25690
|
+
const priority = override?.priority ?? entry.priority ?? config.defaultPriority ?? DEFAULT_PRIORITY;
|
|
25691
|
+
const lastmod = override?.lastmod ?? entry.lastmod;
|
|
25692
|
+
const url = escapeXml(`${normalizedBase}${entry.path}`);
|
|
25693
|
+
let urlBlock = ` <url>
|
|
25626
25694
|
<loc>${url}</loc>`;
|
|
25627
25695
|
if (lastmod)
|
|
25628
|
-
|
|
25696
|
+
urlBlock += `
|
|
25629
25697
|
<lastmod>${lastmod}</lastmod>`;
|
|
25630
|
-
|
|
25698
|
+
urlBlock += `
|
|
25631
25699
|
<changefreq>${changefreq}</changefreq>`;
|
|
25632
|
-
|
|
25700
|
+
urlBlock += `
|
|
25633
25701
|
<priority>${priority}</priority>`;
|
|
25634
|
-
|
|
25702
|
+
urlBlock += `
|
|
25635
25703
|
</url>`;
|
|
25636
|
-
|
|
25704
|
+
xml.push(urlBlock);
|
|
25637
25705
|
}
|
|
25638
25706
|
return [
|
|
25639
25707
|
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
25640
25708
|
'<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">',
|
|
25641
|
-
...
|
|
25709
|
+
...xml,
|
|
25642
25710
|
"</urlset>"
|
|
25643
25711
|
].join(`
|
|
25644
25712
|
`);
|
|
25645
|
-
},
|
|
25713
|
+
}, resolveSpaEntryMetadata = (entry) => {
|
|
25714
|
+
if (!entry.sitemap || typeof entry.sitemap !== "object")
|
|
25715
|
+
return {};
|
|
25716
|
+
return {
|
|
25717
|
+
changefreq: entry.sitemap.changefreq,
|
|
25718
|
+
lastmod: entry.sitemap.lastmod,
|
|
25719
|
+
priority: entry.sitemap.priority
|
|
25720
|
+
};
|
|
25721
|
+
}, collectPageSubRoutes = async (app, route, serverUrl) => {
|
|
25722
|
+
const request = new Request(`${serverUrl}${route.path}`, {
|
|
25723
|
+
headers: { "x-absolutejs-enumeration": "1" },
|
|
25724
|
+
method: "GET"
|
|
25725
|
+
});
|
|
25726
|
+
return collectSpaRoutes(async () => {
|
|
25727
|
+
try {
|
|
25728
|
+
await app.handle(request);
|
|
25729
|
+
} catch (err) {
|
|
25730
|
+
console.warn(`[sitemap] enumeration request failed for ${route.path}:`, err);
|
|
25731
|
+
}
|
|
25732
|
+
});
|
|
25733
|
+
}, generateSitemap = async (app, serverUrl, outDir, config = {}) => {
|
|
25646
25734
|
const exclude = config.exclude ?? [];
|
|
25647
|
-
const
|
|
25648
|
-
const
|
|
25649
|
-
const
|
|
25650
|
-
const
|
|
25735
|
+
const pageRoutes = discoverPageRoutes(app.routes, exclude);
|
|
25736
|
+
const entries = [];
|
|
25737
|
+
const seenPaths = new Set;
|
|
25738
|
+
for (const route of pageRoutes) {
|
|
25739
|
+
if (!seenPaths.has(route.path)) {
|
|
25740
|
+
entries.push({ path: route.path });
|
|
25741
|
+
seenPaths.add(route.path);
|
|
25742
|
+
}
|
|
25743
|
+
const subRoutes = await collectPageSubRoutes(app, route, serverUrl);
|
|
25744
|
+
for (const sub of subRoutes) {
|
|
25745
|
+
if (sub.dynamic)
|
|
25746
|
+
continue;
|
|
25747
|
+
if (sub.sitemap === "exclude")
|
|
25748
|
+
continue;
|
|
25749
|
+
const fullPath = joinMountAndSubPath(route.path, sub.path);
|
|
25750
|
+
if (seenPaths.has(fullPath))
|
|
25751
|
+
continue;
|
|
25752
|
+
if (isExcluded(fullPath, exclude))
|
|
25753
|
+
continue;
|
|
25754
|
+
entries.push({ path: fullPath, ...resolveSpaEntryMetadata(sub) });
|
|
25755
|
+
seenPaths.add(fullPath);
|
|
25756
|
+
}
|
|
25757
|
+
}
|
|
25758
|
+
const dynamicConfigRoutes = config.routes ? await config.routes() : [];
|
|
25759
|
+
for (const path of dynamicConfigRoutes) {
|
|
25760
|
+
if (seenPaths.has(path))
|
|
25761
|
+
continue;
|
|
25762
|
+
if (isExcluded(path, exclude))
|
|
25763
|
+
continue;
|
|
25764
|
+
entries.push({ path });
|
|
25765
|
+
seenPaths.add(path);
|
|
25766
|
+
}
|
|
25651
25767
|
const baseUrl = config.baseUrl ?? serverUrl;
|
|
25652
|
-
const xml = buildSitemapXml(
|
|
25768
|
+
const xml = buildSitemapXml(entries, baseUrl, config);
|
|
25653
25769
|
await write4(`${outDir}/sitemap.xml`, xml);
|
|
25654
25770
|
};
|
|
25655
25771
|
var init_generateSitemap = __esm(() => {
|
|
25656
|
-
|
|
25657
|
-
|
|
25658
|
-
"handleSveltePageRequest",
|
|
25659
|
-
"handleVuePageRequest",
|
|
25660
|
-
"handleAngularPageRequest",
|
|
25661
|
-
"handleHTMLPageRequest",
|
|
25662
|
-
"handleHTMXPageRequest"
|
|
25663
|
-
];
|
|
25772
|
+
init_devRouteRegistrationCallsite();
|
|
25773
|
+
init_spaRouteEnumeration();
|
|
25664
25774
|
});
|
|
25665
25775
|
|
|
25666
25776
|
// src/core/prerender.ts
|
|
@@ -27061,7 +27171,7 @@ var createSitemapPlugin = (buildDir, sitemapConfig) => new Elysia5({ name: "abso
|
|
|
27061
27171
|
const { server } = started;
|
|
27062
27172
|
if (!server)
|
|
27063
27173
|
return;
|
|
27064
|
-
Promise.resolve().then(() => (init_generateSitemap(), exports_generateSitemap)).then(({ generateSitemap: generateSitemap2 }) => generateSitemap2(started
|
|
27174
|
+
Promise.resolve().then(() => (init_generateSitemap(), exports_generateSitemap)).then(({ generateSitemap: generateSitemap2 }) => generateSitemap2(started, server.url.origin, buildDir, sitemapConfig)).catch((err) => console.error("[sitemap] Generation failed:", err));
|
|
27065
27175
|
});
|
|
27066
27176
|
var createNotFoundPlugin = () => new Elysia5({ name: "absolutejs-not-found" }).onError({ as: "global" }, async ({ code }) => {
|
|
27067
27177
|
if (code !== "NOT_FOUND")
|
|
@@ -33865,5 +33975,5 @@ export {
|
|
|
33865
33975
|
ANGULAR_INIT_TIMEOUT_MS
|
|
33866
33976
|
};
|
|
33867
33977
|
|
|
33868
|
-
//# debugId=
|
|
33978
|
+
//# debugId=27DB5119E1E545AE64756E2164756E21
|
|
33869
33979
|
//# sourceMappingURL=index.js.map
|