@analogjs/router 3.0.0-beta.5 → 3.0.0-beta.51
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/fesm2022/analogjs-router-content.mjs +2 -2
- package/fesm2022/analogjs-router-content.mjs.map +1 -1
- package/fesm2022/analogjs-router-server-actions.mjs +18 -6
- package/fesm2022/analogjs-router-server-actions.mjs.map +1 -1
- package/fesm2022/analogjs-router-server.mjs +739 -39
- package/fesm2022/analogjs-router-server.mjs.map +1 -1
- package/fesm2022/analogjs-router-tanstack-query-server.mjs +24 -31
- package/fesm2022/analogjs-router-tanstack-query-server.mjs.map +1 -1
- package/fesm2022/analogjs-router-tanstack-query.mjs +14 -40
- package/fesm2022/analogjs-router-tanstack-query.mjs.map +1 -1
- package/fesm2022/analogjs-router.mjs +75 -21
- package/fesm2022/analogjs-router.mjs.map +1 -1
- package/fesm2022/debug.page.mjs +3 -3
- package/fesm2022/route-files.mjs +44 -16
- package/fesm2022/route-files.mjs.map +1 -1
- package/package.json +7 -6
- package/types/content/src/lib/markdown-helpers.d.ts +2 -1
- package/types/content/src/lib/routes.d.ts +2 -1
- package/types/server/actions/src/parse-request-data.d.ts +3 -0
- package/types/server/src/index.d.ts +2 -0
- package/types/server/src/node-handler.d.ts +8 -0
- package/types/server/src/request-handler.d.ts +30 -0
- package/types/server/src/server-fn/dispatch.d.ts +4 -2
- package/types/server/src/server-fn/event-handler.d.ts +3 -1
- package/types/server/src/server-fn/node-context.d.ts +14 -4
- package/types/server/src/server-fn/server-fn.d.ts +4 -4
- package/types/server/src/server-manifest.d.ts +26 -0
- package/types/server/src/utils/stream-request.d.ts +2 -0
- package/types/src/index.d.ts +1 -1
- package/types/src/lib/models.d.ts +14 -9
- package/types/src/lib/request-context.d.ts +5 -0
- package/types/src/lib/route-config.d.ts +1 -1
- package/types/src/lib/server-fn/inject-server-fn.d.ts +4 -4
- package/types/src/lib/server-fn/types.d.ts +1 -0
- package/types/src/lib/to-route.d.ts +53 -14
- package/types/tanstack-query/server/src/define-page-load-queries.d.ts +13 -10
- package/types/tanstack-query/server/src/index.d.ts +1 -2
- package/types/tanstack-query/src/index.d.ts +1 -1
- package/types/tanstack-query/src/provide-analog-query.d.ts +1 -3
- package/types/tanstack-query/src/server-query.d.ts +1 -1
- package/types/tanstack-query/server/src/provide-server-analog-query.d.ts +0 -2
- package/types/tanstack-query/src/provide-server-analog-query.d.ts +0 -2
package/fesm2022/route-files.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { injectAPIPrefix, injectBaseURL
|
|
1
|
+
import { injectAPIPrefix, injectBaseURL } from "./analogjs-router-tokens.mjs";
|
|
2
2
|
import { NavigationEnd, Router, UrlSegment } from "@angular/router";
|
|
3
3
|
import { DOCUMENT, InjectionToken, inject } from "@angular/core";
|
|
4
4
|
import { HttpClient } from "@angular/common/http";
|
|
@@ -71,15 +71,34 @@ var HTTP_EQUIV_SELECTOR_KEY = "http-equiv";
|
|
|
71
71
|
var NAME_KEY = "name";
|
|
72
72
|
var PROPERTY_KEY = "property";
|
|
73
73
|
var ITEMPROP_KEY = "itemprop";
|
|
74
|
+
var ROUTE_META_ATTR = "data-analog-route-meta";
|
|
74
75
|
function updateMetaTagsOnRouteChange(router = inject(Router), metaService = inject(Meta)) {
|
|
75
76
|
router.events.pipe(filter((event) => event instanceof NavigationEnd)).subscribe(() => {
|
|
76
77
|
const metaTagMap = getMetaTagMap(router.routerState.snapshot.root);
|
|
78
|
+
const metaTagSelectors = Object.keys(metaTagMap);
|
|
79
|
+
for (const ownedTag of metaService.getTags(ROUTE_META_ATTR)) if (!metaTagSelectors.some((selector) => ownedTag.matches(`meta[${selector}]`))) releaseMetaTag(ownedTag, metaService);
|
|
77
80
|
for (const metaTagSelector in metaTagMap) {
|
|
81
|
+
const existingTag = metaService.getTag(metaTagSelector);
|
|
82
|
+
const originalAttributes = existingTag?.getAttribute(ROUTE_META_ATTR) ?? serializeAttributes(existingTag);
|
|
78
83
|
const metaTag = metaTagMap[metaTagSelector];
|
|
79
|
-
metaService.updateTag(metaTag, metaTagSelector);
|
|
84
|
+
metaService.updateTag(metaTag, metaTagSelector)?.setAttribute(ROUTE_META_ATTR, originalAttributes);
|
|
80
85
|
}
|
|
81
86
|
});
|
|
82
87
|
}
|
|
88
|
+
function serializeAttributes(tag) {
|
|
89
|
+
if (!tag) return "";
|
|
90
|
+
return JSON.stringify(Object.fromEntries(tag.getAttributeNames().map((name) => [name, tag.getAttribute(name)])));
|
|
91
|
+
}
|
|
92
|
+
function releaseMetaTag(tag, metaService) {
|
|
93
|
+
const originalAttributes = tag.getAttribute(ROUTE_META_ATTR);
|
|
94
|
+
if (!originalAttributes) {
|
|
95
|
+
metaService.removeTagElement(tag);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
for (const name of tag.getAttributeNames()) tag.removeAttribute(name);
|
|
99
|
+
const attributes = JSON.parse(originalAttributes);
|
|
100
|
+
for (const [name, value] of Object.entries(attributes)) tag.setAttribute(name, value);
|
|
101
|
+
}
|
|
83
102
|
function getMetaTagMap(route) {
|
|
84
103
|
const metaTagMap = {};
|
|
85
104
|
let currentRoute = route;
|
|
@@ -114,7 +133,9 @@ function injectRouteEndpointURL(route) {
|
|
|
114
133
|
const segment = parent?.url.map((segment) => segment.path).join("/") || "";
|
|
115
134
|
const url = new URL("", baseUrl || (typeof window !== "undefined" && window.location.origin ? window.location.origin : ""));
|
|
116
135
|
url.pathname = `${url.pathname.endsWith("/") ? url.pathname : url.pathname + "/"}${apiPrefix}/_analog${routeConfig[ANALOG_META_KEY].endpoint}`;
|
|
117
|
-
|
|
136
|
+
const search = new URLSearchParams();
|
|
137
|
+
for (const [key, value] of Object.entries(queryParams)) for (const item of [value].flat()) search.append(key, String(item));
|
|
138
|
+
url.search = search.toString();
|
|
118
139
|
url.hash = hash ?? "";
|
|
119
140
|
Object.keys(params).forEach((param) => {
|
|
120
141
|
url.pathname = url.pathname.replace(`[${param}]`, params[param]);
|
|
@@ -124,6 +145,15 @@ function injectRouteEndpointURL(route) {
|
|
|
124
145
|
}
|
|
125
146
|
//#endregion
|
|
126
147
|
//#region packages/router/src/lib/route-config.ts
|
|
148
|
+
var loadRequests = /* @__PURE__ */ new WeakMap();
|
|
149
|
+
async function loadRouteData(route) {
|
|
150
|
+
if (ANALOG_PAGE_ENDPOINTS[route.routeConfig[ANALOG_META_KEY]?.endpointKey]) {
|
|
151
|
+
const http = inject(HttpClient);
|
|
152
|
+
const url = injectRouteEndpointURL(route);
|
|
153
|
+
return firstValueFrom(http.get(`${url.href}`));
|
|
154
|
+
}
|
|
155
|
+
return {};
|
|
156
|
+
}
|
|
127
157
|
function toRouteConfig(routeMeta) {
|
|
128
158
|
if (routeMeta && isRedirectRouteMeta(routeMeta)) return routeMeta;
|
|
129
159
|
const { meta, jsonLd, ...routeConfig } = routeMeta ?? {};
|
|
@@ -146,21 +176,19 @@ function toRouteConfig(routeMeta) {
|
|
|
146
176
|
routeConfig.runGuardsAndResolvers = routeConfig.runGuardsAndResolvers ?? "paramsOrQueryParamsChange";
|
|
147
177
|
routeConfig.resolve = {
|
|
148
178
|
...routeConfig.resolve,
|
|
149
|
-
load:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
if (internalFetch) return internalFetch(`${url.pathname}${url.search}`);
|
|
155
|
-
return firstValueFrom(http.get(`${url.href}`));
|
|
179
|
+
load: (route) => {
|
|
180
|
+
let request = loadRequests.get(route);
|
|
181
|
+
if (!request) {
|
|
182
|
+
request = loadRouteData(route);
|
|
183
|
+
loadRequests.set(route, request);
|
|
156
184
|
}
|
|
157
|
-
return
|
|
185
|
+
return request;
|
|
158
186
|
}
|
|
159
187
|
};
|
|
160
188
|
return routeConfig;
|
|
161
189
|
}
|
|
162
190
|
function isRedirectRouteMeta(routeMeta) {
|
|
163
|
-
return
|
|
191
|
+
return routeMeta.redirectTo != null;
|
|
164
192
|
}
|
|
165
193
|
//#endregion
|
|
166
194
|
//#region packages/router/src/lib/constants.ts
|
|
@@ -241,7 +269,7 @@ function getCollisionPriority(filename) {
|
|
|
241
269
|
* paths (e.g. `additionalPagesDirs`, `additionalContentDirs`).
|
|
242
270
|
*/
|
|
243
271
|
function toRawPath(filename) {
|
|
244
|
-
return filename.replace(/^(?:[a-zA-Z]:[\\/])?(.*?)[\\/](?:routes|pages|content)[\\/]|(?:[\\/](?:app[\\/]pages|src[\\/]content)[\\/])|(\.page\.(js|ts)$)|(\.(ts|md)$)/g, "").replace(/\[\[\.\.\.([^\]]+)\]\]/g, "(opt-$1)").replace(/\[\.{3}.+\]/, "**").replace(/\[([^\]]+)\]/g, ":$1");
|
|
272
|
+
return filename.replace(/^(?:[a-zA-Z]:[\\/])?(.*?)[\\/](?:routes|pages|content)[\\/]|(?:[\\/](?:app[\\/]pages|src[\\/]content)[\\/])|(\.page\.(js|ts|tsrx)$)|(\.(ts|md)$)/g, "").replace(/\[\[\.\.\.([^\]]+)\]\]/g, "(opt-$1)").replace(/\[\.{3}.+\]/, "**").replace(/\[([^\]]+)\]/g, ":$1");
|
|
245
273
|
}
|
|
246
274
|
function toSegment(rawSegment) {
|
|
247
275
|
return rawSegment.replace(/\(.*?\)/g, "").replace(/(^|[./])index(?=[./]|$)/g, "$1").replace(/\.|\/+/g, "/").replace(/^\/+|\/+$/g, "");
|
|
@@ -264,10 +292,10 @@ function toRoutes(rawRoutes, files, resolveModule, debug = false) {
|
|
|
264
292
|
let analogMeta;
|
|
265
293
|
if (rawRoute.filename) {
|
|
266
294
|
if (!debug) module = resolveModule(rawRoute.filename, files[rawRoute.filename]);
|
|
267
|
-
if (/\.page\.ts$/.test(rawRoute.filename)) {
|
|
268
|
-
const endpointKey = rawRoute.filename.replace(/\.page\.ts$/, ENDPOINT_EXTENSION);
|
|
295
|
+
if (/\.page\.(?:ts|tsrx)$/.test(rawRoute.filename)) {
|
|
296
|
+
const endpointKey = rawRoute.filename.replace(/\.page\.(?:ts|tsrx)$/, ENDPOINT_EXTENSION);
|
|
269
297
|
analogMeta = {
|
|
270
|
-
endpoint: (rawRoute.filename.replace(/\.page\.ts$/, "").replace(/\[\[\.\.\..+\]\]/, "**").replace(/\[\.{3}.+\]/, "**").replace(/^(.*?)\/pages/, "/pages") || "").replace(/\./g, "/").replace(/\/\(([^/]+)\)/g, "/-$1-"),
|
|
298
|
+
endpoint: (rawRoute.filename.replace(/\.page\.(?:ts|tsrx)$/, "").replace(/\[\[\.\.\..+\]\]/, "**").replace(/\[\.{3}.+\]/, "**").replace(/^(.*?)\/pages/, "/pages") || "").replace(/\./g, "/").replace(/\/\(([^/]+)\)/g, "/-$1-"),
|
|
271
299
|
endpointKey
|
|
272
300
|
};
|
|
273
301
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-files.mjs","names":[],"sources":["../../../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs","../../src/lib/json-ld.ts","../../src/lib/meta-tags.ts","../../src/lib/endpoints.ts","../../src/lib/inject-route-endpoint-url.ts","../../src/lib/route-config.ts","../../src/lib/constants.ts","../../src/lib/route-builder.ts","../../src/lib/route-files.ts"],"sourcesContent":["function isPlainObject(value) {\n if (!value || typeof value !== 'object') {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n const hasObjectPrototype = proto === null ||\n proto === Object.prototype ||\n Object.getPrototypeOf(proto) === null;\n if (!hasObjectPrototype) {\n return false;\n }\n return Object.prototype.toString.call(value) === '[object Object]';\n}\n\nexport { isPlainObject };\n","import { DOCUMENT, inject } from '@angular/core';\nimport type { ActivatedRouteSnapshot } from '@angular/router';\nimport { NavigationEnd, Router } from '@angular/router';\nimport { isPlainObject } from 'es-toolkit';\nimport { filter } from 'rxjs/operators';\n\nimport type { Graph, Thing, WithContext } from 'schema-dts';\n\nexport type JsonLdObject = Record<string, unknown>;\n\nexport function isJsonLdObject(value: unknown): value is JsonLdObject {\n return isPlainObject(value);\n}\n\nexport function normalizeJsonLd(value: unknown): JsonLdObject[] {\n if (Array.isArray(value)) {\n return value.filter(isJsonLdObject);\n }\n\n return isJsonLdObject(value) ? [value] : [];\n}\n\nexport type JsonLd = JsonLdObject | JsonLdObject[];\n\n/**\n * Typed JSON-LD document based on `schema-dts`.\n *\n * Accepts single Schema.org nodes (`WithContext<Thing>`),\n * `@graph`-based documents (`Graph`), or arrays of nodes.\n *\n * This is the canonical JSON-LD type for route authoring surfaces\n * (`routeMeta.jsonLd`, generated manifest).\n *\n * @example\n * ```ts\n * import type { WebPage, WithContext } from 'schema-dts';\n *\n * export const routeMeta = {\n * jsonLd: {\n * '@context': 'https://schema.org',\n * '@type': 'WebPage',\n * name: 'Products',\n * } satisfies WithContext<WebPage>,\n * };\n * ```\n */\nexport type AnalogJsonLdDocument =\n | WithContext<Thing>\n | Graph\n | WithContext<Thing>[];\n\nexport const ROUTE_JSON_LD_KEY: unique symbol = Symbol(\n '@analogjs/router Route JSON-LD Key',\n);\nconst JSON_LD_SCRIPT_SELECTOR = 'script[data-analog-json-ld]';\n\nexport function updateJsonLdOnRouteChange(\n router: Router = inject(Router),\n document: Document | null = inject(DOCUMENT, { optional: true }),\n): void {\n if (!document) {\n return;\n }\n\n router.events\n .pipe(filter((event) => event instanceof NavigationEnd))\n .subscribe(() => {\n const entries = getJsonLdEntries(router.routerState.snapshot.root);\n applyJsonLdToDocument(document, entries);\n });\n}\n\nexport function serializeJsonLd(entry: JsonLdObject): string | null {\n try {\n return JSON.stringify(entry)\n .replace(/</g, '\\\\u003c')\n .replace(/>/g, '\\\\u003e')\n .replace(/&/g, '\\\\u0026')\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029');\n } catch {\n return null;\n }\n}\n\nfunction getJsonLdEntries(route: ActivatedRouteSnapshot): JsonLdObject[] {\n const entries: JsonLdObject[] = [];\n let currentRoute: ActivatedRouteSnapshot | null = route;\n\n while (currentRoute) {\n entries.push(...normalizeJsonLd(currentRoute.data[ROUTE_JSON_LD_KEY]));\n currentRoute = currentRoute.firstChild;\n }\n\n return entries;\n}\n\nfunction applyJsonLdToDocument(\n document: Document,\n entries: JsonLdObject[],\n): void {\n document.querySelectorAll(JSON_LD_SCRIPT_SELECTOR).forEach((element) => {\n element.remove();\n });\n\n if (entries.length === 0) {\n return;\n }\n\n const head = document.head || document.getElementsByTagName('head')[0];\n if (!head) {\n return;\n }\n\n entries.forEach((entry, index) => {\n const serialized = serializeJsonLd(entry);\n if (!serialized) {\n return;\n }\n\n const script = document.createElement('script');\n script.type = 'application/ld+json';\n script.setAttribute('data-analog-json-ld', 'true');\n script.setAttribute('data-analog-json-ld-index', String(index));\n script.textContent = serialized;\n head.appendChild(script);\n });\n}\n","import { inject } from '@angular/core';\nimport { Meta, MetaDefinition as NgMetaTag } from '@angular/platform-browser';\nimport { ActivatedRouteSnapshot, NavigationEnd, Router } from '@angular/router';\nimport { filter } from 'rxjs/operators';\n\nexport const ROUTE_META_TAGS_KEY: unique symbol = Symbol(\n '@analogjs/router Route Meta Tags Key',\n);\n\nconst CHARSET_KEY = 'charset';\nconst HTTP_EQUIV_KEY = 'httpEquiv';\n// httpEquiv selector key needs to be in kebab case format\nconst HTTP_EQUIV_SELECTOR_KEY = 'http-equiv';\nconst NAME_KEY = 'name';\nconst PROPERTY_KEY = 'property';\nconst CONTENT_KEY = 'content';\nconst ITEMPROP_KEY = 'itemprop';\n\nexport type MetaTag =\n | (CharsetMetaTag & ExcludeRestMetaTagKeys<typeof CHARSET_KEY>)\n | (HttpEquivMetaTag & ExcludeRestMetaTagKeys<typeof HTTP_EQUIV_KEY>)\n | (NameMetaTag & ExcludeRestMetaTagKeys<typeof NAME_KEY>)\n | (PropertyMetaTag & ExcludeRestMetaTagKeys<typeof PROPERTY_KEY>)\n | (ItempropMetaTag & ExcludeRestMetaTagKeys<typeof ITEMPROP_KEY>);\n\ntype CharsetMetaTag = { [CHARSET_KEY]: string };\ntype HttpEquivMetaTag = { [HTTP_EQUIV_KEY]: string; [CONTENT_KEY]: string };\ntype NameMetaTag = { [NAME_KEY]: string; [CONTENT_KEY]: string };\ntype PropertyMetaTag = { [PROPERTY_KEY]: string; [CONTENT_KEY]: string };\ntype ItempropMetaTag = { [ITEMPROP_KEY]: string; [CONTENT_KEY]: string };\n\ntype MetaTagKey =\n | typeof CHARSET_KEY\n | typeof HTTP_EQUIV_KEY\n | typeof NAME_KEY\n | typeof PROPERTY_KEY\n | typeof ITEMPROP_KEY;\ntype ExcludeRestMetaTagKeys<Key extends MetaTagKey> = {\n [K in Exclude<MetaTagKey, Key>]?: never;\n};\n\ntype MetaTagSelector =\n | typeof CHARSET_KEY\n | `${\n | typeof HTTP_EQUIV_SELECTOR_KEY\n | typeof NAME_KEY\n | typeof PROPERTY_KEY\n | typeof ITEMPROP_KEY}=\"${string}\"`;\ntype MetaTagMap = Record<MetaTagSelector, MetaTag>;\n\nexport function updateMetaTagsOnRouteChange(\n router: Router = inject(Router),\n metaService: Meta = inject(Meta),\n): void {\n router.events\n .pipe(filter((event) => event instanceof NavigationEnd))\n .subscribe(() => {\n const metaTagMap = getMetaTagMap(router.routerState.snapshot.root);\n for (const metaTagSelector in metaTagMap) {\n const metaTag = metaTagMap[\n metaTagSelector as MetaTagSelector\n ] as NgMetaTag;\n metaService.updateTag(metaTag, metaTagSelector);\n }\n });\n}\n\nfunction getMetaTagMap(route: ActivatedRouteSnapshot): MetaTagMap {\n const metaTagMap = {} as MetaTagMap;\n let currentRoute: ActivatedRouteSnapshot | null = route;\n\n while (currentRoute) {\n const metaTags: MetaTag[] = currentRoute.data[ROUTE_META_TAGS_KEY] ?? [];\n for (const metaTag of metaTags) {\n metaTagMap[getMetaTagSelector(metaTag)] = metaTag;\n }\n\n currentRoute = currentRoute.firstChild;\n }\n\n return metaTagMap;\n}\n\nfunction getMetaTagSelector(metaTag: MetaTag): MetaTagSelector {\n if (metaTag.name) {\n return `${NAME_KEY}=\"${metaTag.name}\"`;\n }\n\n if (metaTag.property) {\n return `${PROPERTY_KEY}=\"${metaTag.property}\"`;\n }\n\n if (metaTag.httpEquiv) {\n return `${HTTP_EQUIV_SELECTOR_KEY}=\"${metaTag.httpEquiv}\"`;\n }\n\n if (metaTag.itemprop) {\n return `${ITEMPROP_KEY}=\"${metaTag.itemprop}\"`;\n }\n\n return CHARSET_KEY;\n}\n","export const ANALOG_META_KEY: unique symbol = Symbol(\n '@analogjs/router Analog Route Metadata Key',\n);\n\n/**\n * This variable reference is replaced with a glob of all route endpoints.\n */\nexport const ANALOG_PAGE_ENDPOINTS: Record<string, () => Promise<unknown>> = {};\n","import type { ActivatedRouteSnapshot, Route } from '@angular/router';\nimport { injectBaseURL, injectAPIPrefix } from '../../tokens/src/index.js';\n\nimport { ANALOG_META_KEY } from './endpoints';\n\nexport function injectRouteEndpointURL(route: ActivatedRouteSnapshot): URL {\n const routeConfig = route.routeConfig as Route & {\n [ANALOG_META_KEY]: { endpoint: string; endpointKey: string };\n };\n\n const apiPrefix = injectAPIPrefix();\n const baseUrl = injectBaseURL();\n const { queryParams, fragment: hash, params, parent } = route;\n const segment = parent?.url.map((segment) => segment.path).join('/') || '';\n const url = new URL(\n '',\n baseUrl ||\n (typeof window !== 'undefined' && window.location.origin\n ? window.location.origin\n : ''),\n );\n url.pathname = `${\n url.pathname.endsWith('/') ? url.pathname : url.pathname + '/'\n }${apiPrefix}/_analog${routeConfig[ANALOG_META_KEY].endpoint}`;\n url.search = `${new URLSearchParams(queryParams).toString()}`;\n url.hash = hash ?? '';\n\n Object.keys(params).forEach((param) => {\n url.pathname = url.pathname.replace(`[${param}]`, params[param]);\n });\n url.pathname = url.pathname.replace('**', segment);\n\n return url;\n}\n","import { inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport type { Route } from '@angular/router';\nimport { firstValueFrom } from 'rxjs';\nimport { injectInternalServerFetch } from '../../tokens/src/index.js';\n\nimport {\n DefaultRouteMeta,\n RedirectRouteMeta,\n RouteConfig,\n RouteMeta,\n} from './models';\nimport { ROUTE_JSON_LD_KEY, isJsonLdObject } from './json-ld';\nimport { ROUTE_META_TAGS_KEY } from './meta-tags';\nimport { ANALOG_PAGE_ENDPOINTS, ANALOG_META_KEY } from './endpoints';\nimport { injectRouteEndpointURL } from './inject-route-endpoint-url';\n\nexport function toRouteConfig(routeMeta: RouteMeta | undefined): RouteConfig {\n if (routeMeta && isRedirectRouteMeta(routeMeta)) {\n return routeMeta;\n }\n\n const defaultMeta: DefaultRouteMeta = (routeMeta ?? {}) as DefaultRouteMeta;\n const { meta, jsonLd, ...routeConfig } = defaultMeta;\n\n if (Array.isArray(meta)) {\n routeConfig.data = { ...routeConfig.data, [ROUTE_META_TAGS_KEY]: meta };\n } else if (typeof meta === 'function') {\n routeConfig.resolve = {\n ...routeConfig.resolve,\n [ROUTE_META_TAGS_KEY]: meta,\n };\n }\n\n if (Array.isArray(jsonLd) || isJsonLdObject(jsonLd)) {\n routeConfig.data = { ...routeConfig.data, [ROUTE_JSON_LD_KEY]: jsonLd };\n } else if (typeof jsonLd === 'function') {\n routeConfig.resolve = {\n ...routeConfig.resolve,\n [ROUTE_JSON_LD_KEY]: jsonLd,\n };\n }\n\n routeConfig.runGuardsAndResolvers =\n routeConfig.runGuardsAndResolvers ?? 'paramsOrQueryParamsChange';\n routeConfig.resolve = {\n ...routeConfig.resolve,\n load: async (route) => {\n const routeConfig = route.routeConfig as Route & {\n [ANALOG_META_KEY]: { endpoint: string; endpointKey: string };\n };\n\n // Content routes (from .md files in the pages directory) do not have\n // ANALOG_META_KEY — it is only set on page routes (.page.ts) in\n // route-builder.ts. The optional chain avoids a runtime crash when\n // the router resolves a content route during SSR / prerendering.\n if (ANALOG_PAGE_ENDPOINTS[routeConfig[ANALOG_META_KEY]?.endpointKey]) {\n const http = inject(HttpClient);\n const url = injectRouteEndpointURL(route);\n const internalFetch = injectInternalServerFetch();\n\n if (internalFetch) {\n return internalFetch(`${url.pathname}${url.search}`);\n }\n\n return firstValueFrom(http.get(`${url.href}`));\n }\n\n return {};\n },\n };\n\n return routeConfig;\n}\n\nfunction isRedirectRouteMeta(\n routeMeta: RouteMeta,\n): routeMeta is RedirectRouteMeta {\n return !!routeMeta.redirectTo;\n}\n","export const ENDPOINT_EXTENSION = '.server.ts';\nexport const APP_DIR = 'src/app';\n","import { UrlSegment } from '@angular/router';\nimport type { Route } from '@angular/router';\nimport type { UrlMatcher } from '@angular/router';\n\nimport type { RouteExport } from './models';\nimport { toRouteConfig } from './route-config';\nimport { ENDPOINT_EXTENSION } from './constants';\nimport { ANALOG_META_KEY } from './endpoints';\n\nexport type RouteModuleFactory = () => Promise<RouteExport>;\n\nexport type RouteModuleResolver<TFile> = (\n filename: string,\n fileLoader: () => Promise<TFile>,\n) => RouteModuleFactory;\n\ntype RawRoute = {\n filename: string | null;\n rawSegment: string;\n ancestorRawSegments: string[];\n segment: string;\n level: number;\n children: RawRoute[];\n};\n\ntype RawRouteMap = Record<string, RawRoute>;\ntype RawRouteByLevelMap = Record<number, RawRouteMap>;\n\nexport function createRoutes<TFile>(\n files: Record<string, () => Promise<TFile>>,\n resolveModule: RouteModuleResolver<TFile>,\n debug = false,\n): Route[] {\n const filenames = Object.keys(files).sort((a, b) => {\n const aPriority = getCollisionPriority(a);\n const bPriority = getCollisionPriority(b);\n\n return aPriority - bPriority;\n });\n\n if (filenames.length === 0) {\n return [];\n }\n\n const rawRoutesByLevelMap = filenames.reduce((acc, filename) => {\n const rawPath = toRawPath(filename);\n const rawSegments = rawPath.split('/');\n const level = rawSegments.length - 1;\n const rawSegment = rawSegments[level];\n const ancestorRawSegments = rawSegments.slice(0, level);\n\n const existing = acc[level]?.[rawPath];\n if (existing?.filename && existing.filename !== filename) {\n const existingPriority = getCollisionPriority(existing.filename);\n const nextPriority = getCollisionPriority(filename);\n const shouldKeepExisting = existingPriority < nextPriority;\n const chosenFilename = shouldKeepExisting ? existing.filename : filename;\n\n if (import.meta.env.DEV) {\n console.warn(\n `[Analog] Route files \"${existing.filename}\" and \"${filename}\" ` +\n `resolve to the same route path \"${rawPath}\". ` +\n `Only \"${chosenFilename}\" will be used.`,\n );\n }\n\n if (shouldKeepExisting) {\n return acc;\n }\n }\n\n return {\n ...acc,\n [level]: {\n ...acc[level],\n [rawPath]: {\n filename,\n rawSegment,\n ancestorRawSegments,\n segment: toSegment(rawSegment),\n level,\n children: [],\n },\n },\n };\n }, {} as RawRouteByLevelMap);\n\n const allLevels = Object.keys(rawRoutesByLevelMap).map(Number);\n const maxLevel = Math.max(...allLevels);\n\n for (let level = maxLevel; level > 0; level--) {\n const rawRoutesMap = rawRoutesByLevelMap[level];\n const rawPaths = Object.keys(rawRoutesMap);\n\n for (const rawPath of rawPaths) {\n const rawRoute = rawRoutesMap[rawPath];\n const parentRawPath = rawRoute.ancestorRawSegments.join('/');\n const parentRawSegmentIndex = rawRoute.ancestorRawSegments.length - 1;\n const parentRawSegment =\n rawRoute.ancestorRawSegments[parentRawSegmentIndex];\n\n rawRoutesByLevelMap[level - 1] ||= {};\n rawRoutesByLevelMap[level - 1][parentRawPath] ||= {\n filename: null,\n rawSegment: parentRawSegment,\n ancestorRawSegments: rawRoute.ancestorRawSegments.slice(\n 0,\n parentRawSegmentIndex,\n ),\n segment: toSegment(parentRawSegment),\n level: level - 1,\n children: [],\n };\n\n rawRoutesByLevelMap[level - 1][parentRawPath].children.push(rawRoute);\n }\n }\n\n const rootRawRoutesMap = rawRoutesByLevelMap[0];\n const rawRoutes = Object.keys(rootRawRoutesMap).map(\n (segment) => rootRawRoutesMap[segment],\n );\n sortRawRoutes(rawRoutes);\n\n return toRoutes(rawRoutes, files, resolveModule, debug);\n}\n\nfunction getCollisionPriority(filename: string): number {\n if (\n filename.includes('/src/app/pages/') ||\n filename.includes('/app/pages/') ||\n filename.includes('/src/content/')\n ) {\n return 0;\n }\n\n return 1;\n}\n\n/**\n * Strips directory prefixes and file extensions from a route filename to\n * produce the raw path used for route segment construction.\n *\n * The regex mirrors `filenameToRoutePath` in route-manifest.ts — changes\n * here must be kept in sync with that function. The first alternation\n * strips everything up to and including the first /routes/, /pages/, or\n * /content/ segment, which handles both app-local and additional directory\n * paths (e.g. `additionalPagesDirs`, `additionalContentDirs`).\n */\nfunction toRawPath(filename: string): string {\n return filename\n .replace(\n /^(?:[a-zA-Z]:[\\\\/])?(.*?)[\\\\/](?:routes|pages|content)[\\\\/]|(?:[\\\\/](?:app[\\\\/]pages|src[\\\\/]content)[\\\\/])|(\\.page\\.(js|ts)$)|(\\.(ts|md)$)/g,\n '',\n )\n .replace(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g, '(opt-$1)')\n .replace(/\\[\\.{3}.+\\]/, '**')\n .replace(/\\[([^\\]]+)\\]/g, ':$1');\n}\n\nfunction toSegment(rawSegment: string): string {\n return rawSegment\n .replace(/\\(.*?\\)/g, '')\n .replace(/(^|[./])index(?=[./]|$)/g, '$1')\n .replace(/\\.|\\/+/g, '/')\n .replace(/^\\/+|\\/+$/g, '');\n}\n\nfunction createOptionalCatchAllMatcher(paramName: string): UrlMatcher {\n return (segments) => {\n if (segments.length === 0) {\n return null;\n }\n const joined = segments.map((s) => s.path).join('/');\n return {\n consumed: segments,\n posParams: { [paramName]: new UrlSegment(joined, {}) },\n };\n };\n}\n\nfunction toRoutes<TFile>(\n rawRoutes: RawRoute[],\n files: Record<string, () => Promise<TFile>>,\n resolveModule: RouteModuleResolver<TFile>,\n debug = false,\n): Route[] {\n const routes: Route[] = [];\n\n for (const rawRoute of rawRoutes) {\n const children: Route[] | undefined =\n rawRoute.children.length > 0\n ? toRoutes(rawRoute.children, files, resolveModule, debug)\n : undefined;\n let module: RouteModuleFactory | undefined;\n let analogMeta: { endpoint: string; endpointKey: string } | undefined;\n\n if (rawRoute.filename) {\n if (!debug) {\n module = resolveModule(rawRoute.filename, files[rawRoute.filename]);\n }\n\n if (/\\.page\\.ts$/.test(rawRoute.filename)) {\n const endpointKey = rawRoute.filename.replace(\n /\\.page\\.ts$/,\n ENDPOINT_EXTENSION,\n );\n\n const rawEndpoint = rawRoute.filename\n .replace(/\\.page\\.ts$/, '')\n .replace(/\\[\\[\\.\\.\\..+\\]\\]/, '**')\n .replace(/\\[\\.{3}.+\\]/, '**')\n .replace(/^(.*?)\\/pages/, '/pages');\n\n // Strip the route group syntax from every segment, matching how the\n // page handlers are mounted. Anchoring this to the last segment left\n // the parens in place for a route like `(auth)/sign-up`, so the\n // request went to a path no handler answered and the load resolved\n // to an empty object.\n const endpoint = (rawEndpoint || '')\n .replace(/\\./g, '/')\n .replace(/\\/\\(([^/]+)\\)/g, '/-$1-');\n\n analogMeta = {\n endpoint,\n endpointKey,\n };\n }\n }\n\n const optCatchAllMatch = rawRoute.filename?.match(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/);\n const optCatchAllParam = optCatchAllMatch ? optCatchAllMatch[1] : null;\n\n type DebugRoute = Route & {\n filename?: string | null | undefined;\n isLayout?: boolean;\n };\n\n const route: Route & { meta?: typeof analogMeta } & DebugRoute = module\n ? {\n path: rawRoute.segment,\n loadChildren: () =>\n module!().then((m) => {\n if (import.meta.env.DEV) {\n const hasModuleDefault = !!m.default;\n const hasRedirect = !!m.routeMeta?.redirectTo;\n\n if (!hasModuleDefault && !hasRedirect) {\n console.warn(\n `[Analog] Missing default export at ${rawRoute.filename}`,\n );\n }\n }\n\n const routeConfig = toRouteConfig(m.routeMeta);\n const hasRedirect = 'redirectTo' in routeConfig;\n const baseChild = hasRedirect\n ? {\n path: '',\n ...routeConfig,\n }\n : {\n path: '',\n component: m.default,\n ...routeConfig,\n children,\n [ANALOG_META_KEY]: analogMeta,\n };\n\n return [\n {\n ...baseChild,\n },\n ...(optCatchAllParam\n ? [\n {\n matcher:\n createOptionalCatchAllMatcher(optCatchAllParam),\n ...(hasRedirect\n ? routeConfig\n : {\n component: m.default,\n ...routeConfig,\n [ANALOG_META_KEY]: analogMeta,\n }),\n },\n ]\n : []),\n ];\n }),\n }\n : {\n path: rawRoute.segment,\n ...(debug\n ? {\n filename: rawRoute.filename ? rawRoute.filename : undefined,\n isLayout: children && children.length > 0 ? true : false,\n }\n : {}),\n children,\n };\n\n routes.push(route);\n }\n\n return routes;\n}\n\nfunction sortRawRoutes(rawRoutes: RawRoute[]): void {\n rawRoutes.sort((a, b) => {\n let segmentA = deprioritizeSegment(a.segment);\n let segmentB = deprioritizeSegment(b.segment);\n\n if (a.children.length > b.children.length) {\n segmentA = `~${segmentA}`;\n } else if (a.children.length < b.children.length) {\n segmentB = `~${segmentB}`;\n }\n\n return segmentA > segmentB ? 1 : -1;\n });\n\n for (const rawRoute of rawRoutes) {\n sortRawRoutes(rawRoute.children);\n }\n}\n\nfunction deprioritizeSegment(segment: string): string {\n return segment.replaceAll(':', '~~').replaceAll('**', '~~~~');\n}\n","import { InjectionToken } from '@angular/core';\nimport type { RouteExport } from './models';\n\nexport type Files = Record<string, () => Promise<RouteExport>>;\n\n/**\n * This variable reference is replaced with a glob of all page routes.\n */\nexport const ANALOG_ROUTE_FILES = {};\n\nexport interface ExtraRouteFileSource {\n files: Record<string, () => Promise<unknown>>;\n resolveModule: (\n filename: string,\n fileLoader: () => Promise<unknown>,\n ) => () => Promise<RouteExport>;\n}\n\nexport const ANALOG_EXTRA_ROUTE_FILE_SOURCES: InjectionToken<\n ExtraRouteFileSource[]\n> = new InjectionToken('@analogjs/router extra route file sources');\n\n/**\n * Replaced at build time by the Vite router plugin with the number of\n * discovered content route files. Used in dev mode to warn when content\n * files exist but `withContentRoutes()` is not configured.\n */\nexport const ANALOG_CONTENT_FILE_COUNT = 0;\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AAAA,SAAS,cAAc,OAAO;CAC1B,IAAI,CAAC,SAAS,OAAO,UAAU,UAC3B,OAAO;CAEX,MAAM,QAAQ,OAAO,eAAe,KAAK;CAIzC,IAAI,EAHuB,UAAU,QACjC,UAAU,OAAO,aACjB,OAAO,eAAe,KAAK,MAAM,OAEjC,OAAO;CAEX,OAAO,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM;AACrD;;;ACFA,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../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs","../../src/lib/json-ld.ts","../../src/lib/meta-tags.ts","../../src/lib/endpoints.ts","../../src/lib/inject-route-endpoint-url.ts","../../src/lib/route-config.ts","../../src/lib/constants.ts","../../src/lib/route-builder.ts","../../src/lib/route-files.ts"],"sourcesContent":["function isPlainObject(value) {\n if (!value || typeof value !== 'object') {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n const hasObjectPrototype = proto === null ||\n proto === Object.prototype ||\n Object.getPrototypeOf(proto) === null;\n if (!hasObjectPrototype) {\n return false;\n }\n return Object.prototype.toString.call(value) === '[object Object]';\n}\n\nexport { isPlainObject };\n","import { DOCUMENT, inject } from '@angular/core';\nimport type { ActivatedRouteSnapshot } from '@angular/router';\nimport { NavigationEnd, Router } from '@angular/router';\nimport { isPlainObject } from 'es-toolkit';\nimport { filter } from 'rxjs/operators';\n\nimport type { Graph, Thing, WithContext } from 'schema-dts';\n\nexport type JsonLdObject = Record<string, unknown>;\n\nexport function isJsonLdObject(value: unknown): value is JsonLdObject {\n return isPlainObject(value);\n}\n\nexport function normalizeJsonLd(value: unknown): JsonLdObject[] {\n if (Array.isArray(value)) {\n return value.filter(isJsonLdObject);\n }\n\n return isJsonLdObject(value) ? [value] : [];\n}\n\nexport type JsonLd = JsonLdObject | JsonLdObject[];\n\n/**\n * Typed JSON-LD document based on `schema-dts`.\n *\n * Accepts single Schema.org nodes (`WithContext<Thing>`),\n * `@graph`-based documents (`Graph`), or arrays of nodes.\n *\n * This is the canonical JSON-LD type for route authoring surfaces\n * (`routeMeta.jsonLd`, generated manifest).\n *\n * @example\n * ```ts\n * import type { WebPage, WithContext } from 'schema-dts';\n *\n * export const routeMeta = {\n * jsonLd: {\n * '@context': 'https://schema.org',\n * '@type': 'WebPage',\n * name: 'Products',\n * } satisfies WithContext<WebPage>,\n * };\n * ```\n */\nexport type AnalogJsonLdDocument =\n | WithContext<Thing>\n | Graph\n | WithContext<Thing>[];\n\nexport const ROUTE_JSON_LD_KEY: unique symbol = Symbol(\n '@analogjs/router Route JSON-LD Key',\n);\nconst JSON_LD_SCRIPT_SELECTOR = 'script[data-analog-json-ld]';\n\nexport function updateJsonLdOnRouteChange(\n router: Router = inject(Router),\n document: Document | null = inject(DOCUMENT, { optional: true }),\n): void {\n if (!document) {\n return;\n }\n\n router.events\n .pipe(filter((event) => event instanceof NavigationEnd))\n .subscribe(() => {\n const entries = getJsonLdEntries(router.routerState.snapshot.root);\n applyJsonLdToDocument(document, entries);\n });\n}\n\nexport function serializeJsonLd(entry: JsonLdObject): string | null {\n try {\n return JSON.stringify(entry)\n .replace(/</g, '\\\\u003c')\n .replace(/>/g, '\\\\u003e')\n .replace(/&/g, '\\\\u0026')\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029');\n } catch {\n return null;\n }\n}\n\nfunction getJsonLdEntries(route: ActivatedRouteSnapshot): JsonLdObject[] {\n const entries: JsonLdObject[] = [];\n let currentRoute: ActivatedRouteSnapshot | null = route;\n\n while (currentRoute) {\n entries.push(...normalizeJsonLd(currentRoute.data[ROUTE_JSON_LD_KEY]));\n currentRoute = currentRoute.firstChild;\n }\n\n return entries;\n}\n\nfunction applyJsonLdToDocument(\n document: Document,\n entries: JsonLdObject[],\n): void {\n document.querySelectorAll(JSON_LD_SCRIPT_SELECTOR).forEach((element) => {\n element.remove();\n });\n\n if (entries.length === 0) {\n return;\n }\n\n const head = document.head || document.getElementsByTagName('head')[0];\n if (!head) {\n return;\n }\n\n entries.forEach((entry, index) => {\n const serialized = serializeJsonLd(entry);\n if (!serialized) {\n return;\n }\n\n const script = document.createElement('script');\n script.type = 'application/ld+json';\n script.setAttribute('data-analog-json-ld', 'true');\n script.setAttribute('data-analog-json-ld-index', String(index));\n script.textContent = serialized;\n head.appendChild(script);\n });\n}\n","import { inject } from '@angular/core';\nimport { Meta, MetaDefinition as NgMetaTag } from '@angular/platform-browser';\nimport { ActivatedRouteSnapshot, NavigationEnd, Router } from '@angular/router';\nimport { filter } from 'rxjs/operators';\n\nexport const ROUTE_META_TAGS_KEY: unique symbol = Symbol(\n '@analogjs/router Route Meta Tags Key',\n);\n\nconst CHARSET_KEY = 'charset';\nconst HTTP_EQUIV_KEY = 'httpEquiv';\n// httpEquiv selector key needs to be in kebab case format\nconst HTTP_EQUIV_SELECTOR_KEY = 'http-equiv';\nconst NAME_KEY = 'name';\nconst PROPERTY_KEY = 'property';\nconst CONTENT_KEY = 'content';\nconst ITEMPROP_KEY = 'itemprop';\nconst ROUTE_META_ATTR = 'data-analog-route-meta';\n\nexport type MetaTag =\n | (CharsetMetaTag & ExcludeRestMetaTagKeys<typeof CHARSET_KEY>)\n | (HttpEquivMetaTag & ExcludeRestMetaTagKeys<typeof HTTP_EQUIV_KEY>)\n | (NameMetaTag & ExcludeRestMetaTagKeys<typeof NAME_KEY>)\n | (PropertyMetaTag & ExcludeRestMetaTagKeys<typeof PROPERTY_KEY>)\n | (ItempropMetaTag & ExcludeRestMetaTagKeys<typeof ITEMPROP_KEY>);\n\ntype CharsetMetaTag = { [CHARSET_KEY]: string };\ntype HttpEquivMetaTag = { [HTTP_EQUIV_KEY]: string; [CONTENT_KEY]: string };\ntype NameMetaTag = { [NAME_KEY]: string; [CONTENT_KEY]: string };\ntype PropertyMetaTag = { [PROPERTY_KEY]: string; [CONTENT_KEY]: string };\ntype ItempropMetaTag = { [ITEMPROP_KEY]: string; [CONTENT_KEY]: string };\n\ntype MetaTagKey =\n | typeof CHARSET_KEY\n | typeof HTTP_EQUIV_KEY\n | typeof NAME_KEY\n | typeof PROPERTY_KEY\n | typeof ITEMPROP_KEY;\ntype ExcludeRestMetaTagKeys<Key extends MetaTagKey> = {\n [K in Exclude<MetaTagKey, Key>]?: never;\n};\n\ntype MetaTagSelector =\n | typeof CHARSET_KEY\n | `${\n | typeof HTTP_EQUIV_SELECTOR_KEY\n | typeof NAME_KEY\n | typeof PROPERTY_KEY\n | typeof ITEMPROP_KEY}=\"${string}\"`;\ntype MetaTagMap = Record<MetaTagSelector, MetaTag>;\n\nexport function updateMetaTagsOnRouteChange(\n router: Router = inject(Router),\n metaService: Meta = inject(Meta),\n): void {\n router.events\n .pipe(filter((event) => event instanceof NavigationEnd))\n .subscribe(() => {\n const metaTagMap = getMetaTagMap(router.routerState.snapshot.root);\n const metaTagSelectors = Object.keys(metaTagMap);\n\n for (const ownedTag of metaService.getTags(ROUTE_META_ATTR)) {\n if (\n !metaTagSelectors.some((selector) =>\n ownedTag.matches(`meta[${selector}]`),\n )\n ) {\n releaseMetaTag(ownedTag, metaService);\n }\n }\n\n for (const metaTagSelector in metaTagMap) {\n const existingTag = metaService.getTag(metaTagSelector);\n const originalAttributes =\n existingTag?.getAttribute(ROUTE_META_ATTR) ??\n serializeAttributes(existingTag);\n const metaTag = metaTagMap[\n metaTagSelector as MetaTagSelector\n ] as NgMetaTag;\n metaService\n .updateTag(metaTag, metaTagSelector)\n ?.setAttribute(ROUTE_META_ATTR, originalAttributes);\n }\n });\n}\n\nfunction serializeAttributes(tag: HTMLMetaElement | null): string {\n if (!tag) {\n return '';\n }\n\n return JSON.stringify(\n Object.fromEntries(\n tag.getAttributeNames().map((name) => [name, tag.getAttribute(name)]),\n ),\n );\n}\n\nfunction releaseMetaTag(tag: HTMLMetaElement, metaService: Meta): void {\n const originalAttributes = tag.getAttribute(ROUTE_META_ATTR);\n if (!originalAttributes) {\n metaService.removeTagElement(tag);\n return;\n }\n\n for (const name of tag.getAttributeNames()) {\n tag.removeAttribute(name);\n }\n const attributes: Record<string, string> = JSON.parse(originalAttributes);\n for (const [name, value] of Object.entries(attributes)) {\n tag.setAttribute(name, value);\n }\n}\n\nfunction getMetaTagMap(route: ActivatedRouteSnapshot): MetaTagMap {\n const metaTagMap = {} as MetaTagMap;\n let currentRoute: ActivatedRouteSnapshot | null = route;\n\n while (currentRoute) {\n const metaTags: MetaTag[] = currentRoute.data[ROUTE_META_TAGS_KEY] ?? [];\n for (const metaTag of metaTags) {\n metaTagMap[getMetaTagSelector(metaTag)] = metaTag;\n }\n\n currentRoute = currentRoute.firstChild;\n }\n\n return metaTagMap;\n}\n\nfunction getMetaTagSelector(metaTag: MetaTag): MetaTagSelector {\n if (metaTag.name) {\n return `${NAME_KEY}=\"${metaTag.name}\"`;\n }\n\n if (metaTag.property) {\n return `${PROPERTY_KEY}=\"${metaTag.property}\"`;\n }\n\n if (metaTag.httpEquiv) {\n return `${HTTP_EQUIV_SELECTOR_KEY}=\"${metaTag.httpEquiv}\"`;\n }\n\n if (metaTag.itemprop) {\n return `${ITEMPROP_KEY}=\"${metaTag.itemprop}\"`;\n }\n\n return CHARSET_KEY;\n}\n","export const ANALOG_META_KEY: unique symbol = Symbol(\n '@analogjs/router Analog Route Metadata Key',\n);\n\n/**\n * This variable reference is replaced with a glob of all route endpoints.\n */\nexport const ANALOG_PAGE_ENDPOINTS: Record<string, () => Promise<unknown>> = {};\n","import type { ActivatedRouteSnapshot, Route } from '@angular/router';\nimport { injectBaseURL, injectAPIPrefix } from '../../tokens/src/index.js';\n\nimport { ANALOG_META_KEY } from './endpoints';\n\nexport function injectRouteEndpointURL(route: ActivatedRouteSnapshot): URL {\n const routeConfig = route.routeConfig as Route & {\n [ANALOG_META_KEY]: { endpoint: string; endpointKey: string };\n };\n\n const apiPrefix = injectAPIPrefix();\n const baseUrl = injectBaseURL();\n const { queryParams, fragment: hash, params, parent } = route;\n const segment = parent?.url.map((segment) => segment.path).join('/') || '';\n const url = new URL(\n '',\n baseUrl ||\n (typeof window !== 'undefined' && window.location.origin\n ? window.location.origin\n : ''),\n );\n url.pathname = `${\n url.pathname.endsWith('/') ? url.pathname : url.pathname + '/'\n }${apiPrefix}/_analog${routeConfig[ANALOG_META_KEY].endpoint}`;\n const search = new URLSearchParams();\n for (const [key, value] of Object.entries(queryParams)) {\n for (const item of [value].flat()) {\n search.append(key, String(item));\n }\n }\n url.search = search.toString();\n url.hash = hash ?? '';\n\n Object.keys(params).forEach((param) => {\n url.pathname = url.pathname.replace(`[${param}]`, params[param]);\n });\n url.pathname = url.pathname.replace('**', segment);\n\n return url;\n}\n","import { inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport type { ActivatedRouteSnapshot, Route } from '@angular/router';\nimport { firstValueFrom } from 'rxjs';\n\nimport {\n DefaultRouteMeta,\n RedirectRouteMeta,\n RouteConfig,\n RouteMeta,\n} from './models';\nimport { ROUTE_JSON_LD_KEY, isJsonLdObject } from './json-ld';\nimport { ROUTE_META_TAGS_KEY } from './meta-tags';\nimport { ANALOG_PAGE_ENDPOINTS, ANALOG_META_KEY } from './endpoints';\nimport { injectRouteEndpointURL } from './inject-route-endpoint-url';\n\nconst loadRequests = new WeakMap<ActivatedRouteSnapshot, Promise<unknown>>();\n\nasync function loadRouteData(route: ActivatedRouteSnapshot): Promise<unknown> {\n const routeConfig = route.routeConfig as Route & {\n [ANALOG_META_KEY]: { endpoint: string; endpointKey: string };\n };\n\n // Content routes (from .md files in the pages directory) do not have\n // ANALOG_META_KEY — it is only set on page routes (.page.ts) in\n // route-builder.ts. The optional chain avoids a runtime crash when\n // the router resolves a content route during SSR / prerendering.\n if (ANALOG_PAGE_ENDPOINTS[routeConfig[ANALOG_META_KEY]?.endpointKey]) {\n const http = inject(HttpClient);\n const url = injectRouteEndpointURL(route);\n\n // On the server, requestContextInterceptor sends this through the\n // internal fetch when one is provided and records the response in\n // TransferState, so the client reuses it after hydration.\n return firstValueFrom(http.get(`${url.href}`));\n }\n\n return {};\n}\n\nexport function toRouteConfig(\n routeMeta: RouteMeta<never> | undefined,\n): RouteConfig {\n if (routeMeta && isRedirectRouteMeta(routeMeta)) {\n return routeMeta;\n }\n\n const defaultMeta: DefaultRouteMeta = (routeMeta ?? {}) as DefaultRouteMeta;\n const { meta, jsonLd, ...routeConfig } = defaultMeta;\n\n if (Array.isArray(meta)) {\n routeConfig.data = { ...routeConfig.data, [ROUTE_META_TAGS_KEY]: meta };\n } else if (typeof meta === 'function') {\n routeConfig.resolve = {\n ...routeConfig.resolve,\n [ROUTE_META_TAGS_KEY]: meta,\n };\n }\n\n if (Array.isArray(jsonLd) || isJsonLdObject(jsonLd)) {\n routeConfig.data = { ...routeConfig.data, [ROUTE_JSON_LD_KEY]: jsonLd };\n } else if (typeof jsonLd === 'function') {\n routeConfig.resolve = {\n ...routeConfig.resolve,\n [ROUTE_JSON_LD_KEY]: jsonLd,\n };\n }\n\n routeConfig.runGuardsAndResolvers =\n routeConfig.runGuardsAndResolvers ?? 'paramsOrQueryParamsChange';\n routeConfig.resolve = {\n ...routeConfig.resolve,\n load: (route) => {\n let request = loadRequests.get(route);\n\n if (!request) {\n request = loadRouteData(route);\n loadRequests.set(route, request);\n }\n\n return request;\n },\n };\n\n return routeConfig as RouteConfig;\n}\n\nfunction isRedirectRouteMeta(\n routeMeta: RouteMeta<never>,\n): routeMeta is RedirectRouteMeta {\n return routeMeta.redirectTo != null;\n}\n","export const ENDPOINT_EXTENSION = '.server.ts';\nexport const APP_DIR = 'src/app';\n","import { UrlSegment } from '@angular/router';\nimport type { Route } from '@angular/router';\nimport type { UrlMatcher } from '@angular/router';\n\nimport type { RouteExport } from './models';\nimport { toRouteConfig } from './route-config';\nimport { ENDPOINT_EXTENSION } from './constants';\nimport { ANALOG_META_KEY } from './endpoints';\n\nexport type RouteModuleFactory = () => Promise<RouteExport>;\n\nexport type RouteModuleResolver<TFile> = (\n filename: string,\n fileLoader: () => Promise<TFile>,\n) => RouteModuleFactory;\n\ntype RawRoute = {\n filename: string | null;\n rawSegment: string;\n ancestorRawSegments: string[];\n segment: string;\n level: number;\n children: RawRoute[];\n};\n\ntype RawRouteMap = Record<string, RawRoute>;\ntype RawRouteByLevelMap = Record<number, RawRouteMap>;\n\nexport function createRoutes<TFile>(\n files: Record<string, () => Promise<TFile>>,\n resolveModule: RouteModuleResolver<TFile>,\n debug = false,\n): Route[] {\n const filenames = Object.keys(files).sort((a, b) => {\n const aPriority = getCollisionPriority(a);\n const bPriority = getCollisionPriority(b);\n\n return aPriority - bPriority;\n });\n\n if (filenames.length === 0) {\n return [];\n }\n\n const rawRoutesByLevelMap = filenames.reduce((acc, filename) => {\n const rawPath = toRawPath(filename);\n const rawSegments = rawPath.split('/');\n const level = rawSegments.length - 1;\n const rawSegment = rawSegments[level];\n const ancestorRawSegments = rawSegments.slice(0, level);\n\n const existing = acc[level]?.[rawPath];\n if (existing?.filename && existing.filename !== filename) {\n const existingPriority = getCollisionPriority(existing.filename);\n const nextPriority = getCollisionPriority(filename);\n const shouldKeepExisting = existingPriority < nextPriority;\n const chosenFilename = shouldKeepExisting ? existing.filename : filename;\n\n if (import.meta.env.DEV) {\n console.warn(\n `[Analog] Route files \"${existing.filename}\" and \"${filename}\" ` +\n `resolve to the same route path \"${rawPath}\". ` +\n `Only \"${chosenFilename}\" will be used.`,\n );\n }\n\n if (shouldKeepExisting) {\n return acc;\n }\n }\n\n return {\n ...acc,\n [level]: {\n ...acc[level],\n [rawPath]: {\n filename,\n rawSegment,\n ancestorRawSegments,\n segment: toSegment(rawSegment),\n level,\n children: [],\n },\n },\n };\n }, {} as RawRouteByLevelMap);\n\n const allLevels = Object.keys(rawRoutesByLevelMap).map(Number);\n const maxLevel = Math.max(...allLevels);\n\n for (let level = maxLevel; level > 0; level--) {\n const rawRoutesMap = rawRoutesByLevelMap[level];\n const rawPaths = Object.keys(rawRoutesMap);\n\n for (const rawPath of rawPaths) {\n const rawRoute = rawRoutesMap[rawPath];\n const parentRawPath = rawRoute.ancestorRawSegments.join('/');\n const parentRawSegmentIndex = rawRoute.ancestorRawSegments.length - 1;\n const parentRawSegment =\n rawRoute.ancestorRawSegments[parentRawSegmentIndex];\n\n rawRoutesByLevelMap[level - 1] ||= {};\n rawRoutesByLevelMap[level - 1][parentRawPath] ||= {\n filename: null,\n rawSegment: parentRawSegment,\n ancestorRawSegments: rawRoute.ancestorRawSegments.slice(\n 0,\n parentRawSegmentIndex,\n ),\n segment: toSegment(parentRawSegment),\n level: level - 1,\n children: [],\n };\n\n rawRoutesByLevelMap[level - 1][parentRawPath].children.push(rawRoute);\n }\n }\n\n const rootRawRoutesMap = rawRoutesByLevelMap[0];\n const rawRoutes = Object.keys(rootRawRoutesMap).map(\n (segment) => rootRawRoutesMap[segment],\n );\n sortRawRoutes(rawRoutes);\n\n return toRoutes(rawRoutes, files, resolveModule, debug);\n}\n\nfunction getCollisionPriority(filename: string): number {\n if (\n filename.includes('/src/app/pages/') ||\n filename.includes('/app/pages/') ||\n filename.includes('/src/content/')\n ) {\n return 0;\n }\n\n return 1;\n}\n\n/**\n * Strips directory prefixes and file extensions from a route filename to\n * produce the raw path used for route segment construction.\n *\n * The regex mirrors `filenameToRoutePath` in route-manifest.ts — changes\n * here must be kept in sync with that function. The first alternation\n * strips everything up to and including the first /routes/, /pages/, or\n * /content/ segment, which handles both app-local and additional directory\n * paths (e.g. `additionalPagesDirs`, `additionalContentDirs`).\n */\nfunction toRawPath(filename: string): string {\n return filename\n .replace(\n /^(?:[a-zA-Z]:[\\\\/])?(.*?)[\\\\/](?:routes|pages|content)[\\\\/]|(?:[\\\\/](?:app[\\\\/]pages|src[\\\\/]content)[\\\\/])|(\\.page\\.(js|ts|tsrx)$)|(\\.(ts|md)$)/g,\n '',\n )\n .replace(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g, '(opt-$1)')\n .replace(/\\[\\.{3}.+\\]/, '**')\n .replace(/\\[([^\\]]+)\\]/g, ':$1');\n}\n\nfunction toSegment(rawSegment: string): string {\n return rawSegment\n .replace(/\\(.*?\\)/g, '')\n .replace(/(^|[./])index(?=[./]|$)/g, '$1')\n .replace(/\\.|\\/+/g, '/')\n .replace(/^\\/+|\\/+$/g, '');\n}\n\nfunction createOptionalCatchAllMatcher(paramName: string): UrlMatcher {\n return (segments) => {\n if (segments.length === 0) {\n return null;\n }\n const joined = segments.map((s) => s.path).join('/');\n return {\n consumed: segments,\n posParams: { [paramName]: new UrlSegment(joined, {}) },\n };\n };\n}\n\nfunction toRoutes<TFile>(\n rawRoutes: RawRoute[],\n files: Record<string, () => Promise<TFile>>,\n resolveModule: RouteModuleResolver<TFile>,\n debug = false,\n): Route[] {\n const routes: Route[] = [];\n\n for (const rawRoute of rawRoutes) {\n const children: Route[] | undefined =\n rawRoute.children.length > 0\n ? toRoutes(rawRoute.children, files, resolveModule, debug)\n : undefined;\n let module: RouteModuleFactory | undefined;\n let analogMeta: { endpoint: string; endpointKey: string } | undefined;\n\n if (rawRoute.filename) {\n if (!debug) {\n module = resolveModule(rawRoute.filename, files[rawRoute.filename]);\n }\n\n if (/\\.page\\.(?:ts|tsrx)$/.test(rawRoute.filename)) {\n const endpointKey = rawRoute.filename.replace(\n /\\.page\\.(?:ts|tsrx)$/,\n ENDPOINT_EXTENSION,\n );\n\n const rawEndpoint = rawRoute.filename\n .replace(/\\.page\\.(?:ts|tsrx)$/, '')\n .replace(/\\[\\[\\.\\.\\..+\\]\\]/, '**')\n .replace(/\\[\\.{3}.+\\]/, '**')\n .replace(/^(.*?)\\/pages/, '/pages');\n\n // Strip the route group syntax from every segment, matching how the\n // page handlers are mounted. Anchoring this to the last segment left\n // the parens in place for a route like `(auth)/sign-up`, so the\n // request went to a path no handler answered and the load resolved\n // to an empty object.\n const endpoint = (rawEndpoint || '')\n .replace(/\\./g, '/')\n .replace(/\\/\\(([^/]+)\\)/g, '/-$1-');\n\n analogMeta = {\n endpoint,\n endpointKey,\n };\n }\n }\n\n const optCatchAllMatch = rawRoute.filename?.match(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/);\n const optCatchAllParam = optCatchAllMatch ? optCatchAllMatch[1] : null;\n\n type DebugRoute = Route & {\n filename?: string | null | undefined;\n isLayout?: boolean;\n };\n\n const route: Route & { meta?: typeof analogMeta } & DebugRoute = module\n ? {\n path: rawRoute.segment,\n loadChildren: () =>\n module!().then((m) => {\n if (import.meta.env.DEV) {\n const hasModuleDefault = !!m.default;\n const hasRedirect = m.routeMeta?.redirectTo != null;\n\n if (!hasModuleDefault && !hasRedirect) {\n console.warn(\n `[Analog] Missing default export at ${rawRoute.filename}`,\n );\n }\n }\n\n const routeConfig = toRouteConfig(m.routeMeta);\n const hasRedirect = 'redirectTo' in routeConfig;\n const baseChild = hasRedirect\n ? {\n path: '',\n ...routeConfig,\n }\n : {\n path: '',\n component: m.default,\n ...routeConfig,\n children,\n [ANALOG_META_KEY]: analogMeta,\n };\n\n return [\n {\n ...baseChild,\n },\n ...(optCatchAllParam\n ? [\n {\n matcher:\n createOptionalCatchAllMatcher(optCatchAllParam),\n ...(hasRedirect\n ? routeConfig\n : {\n component: m.default,\n ...routeConfig,\n [ANALOG_META_KEY]: analogMeta,\n }),\n },\n ]\n : []),\n ];\n }),\n }\n : {\n path: rawRoute.segment,\n ...(debug\n ? {\n filename: rawRoute.filename ? rawRoute.filename : undefined,\n isLayout: children && children.length > 0 ? true : false,\n }\n : {}),\n children,\n };\n\n routes.push(route);\n }\n\n return routes;\n}\n\nfunction sortRawRoutes(rawRoutes: RawRoute[]): void {\n rawRoutes.sort((a, b) => {\n let segmentA = deprioritizeSegment(a.segment);\n let segmentB = deprioritizeSegment(b.segment);\n\n if (a.children.length > b.children.length) {\n segmentA = `~${segmentA}`;\n } else if (a.children.length < b.children.length) {\n segmentB = `~${segmentB}`;\n }\n\n return segmentA > segmentB ? 1 : -1;\n });\n\n for (const rawRoute of rawRoutes) {\n sortRawRoutes(rawRoute.children);\n }\n}\n\nfunction deprioritizeSegment(segment: string): string {\n return segment.replaceAll(':', '~~').replaceAll('**', '~~~~');\n}\n","import { InjectionToken } from '@angular/core';\nimport type { RouteExport } from './models';\n\nexport type Files = Record<string, () => Promise<RouteExport>>;\n\n/**\n * This variable reference is replaced with a glob of all page routes.\n */\nexport const ANALOG_ROUTE_FILES = {};\n\nexport interface ExtraRouteFileSource {\n files: Record<string, () => Promise<unknown>>;\n resolveModule: (\n filename: string,\n fileLoader: () => Promise<unknown>,\n ) => () => Promise<RouteExport>;\n}\n\nexport const ANALOG_EXTRA_ROUTE_FILE_SOURCES: InjectionToken<\n ExtraRouteFileSource[]\n> = new InjectionToken('@analogjs/router extra route file sources');\n\n/**\n * Replaced at build time by the Vite router plugin with the number of\n * discovered content route files. Used in dev mode to warn when content\n * files exist but `withContentRoutes()` is not configured.\n */\nexport const ANALOG_CONTENT_FILE_COUNT = 0;\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AAAA,SAAS,cAAc,OAAO;CAC1B,IAAI,CAAC,SAAS,OAAO,UAAU,UAC3B,OAAO;CAEX,MAAM,QAAQ,OAAO,eAAe,KAAK;CAIzC,IAAI,EAHuB,UAAU,QACjC,UAAU,OAAO,aACjB,OAAO,eAAe,KAAK,MAAM,OAEjC,OAAO;CAEX,OAAO,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM;AACrD;;;ACFA,SAAgB,eAAe,OAAc;CAC3C,OAAO,cAAc,KAAK;AAC5B;AAEA,SAAgB,gBAAgB,OAAc;CAC5C,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,OAAO,cAAc;CAGpC,OAAO,eAAe,KAAK,IAAI,CAAC,KAAK,IAAI,CAAA;AAC3C;AA+BA,IAAa,oBAAmC,OAC9C,oCAAoC;AAEtC,IAAM,0BAA0B;AAEhC,SAAgB,0BACd,SAAiB,OAAO,MAAM,GAC9B,WAA4B,OAAO,UAAU,EAAE,UAAU,KAAI,CAAE,GAAC;CAEhE,IAAI,CAAC,UACH;CAGF,OAAO,OACJ,KAAK,QAAQ,UAAU,iBAAiB,aAAa,CAAC,CAAC,CACvD,gBAAe;EAEd,sBAAsB,UADN,iBAAiB,OAAO,YAAY,SAAS,IAC7B,CAAO;CACzC,CAAC;AACL;AAEA,SAAgB,gBAAgB,OAAmB;CACjD,IAAI;EACF,OAAO,KAAK,UAAU,KAAK,CAAC,CACzB,QAAQ,MAAM,SAAS,CAAC,CACxB,QAAQ,MAAM,SAAS,CAAC,CACxB,QAAQ,MAAM,SAAS,CAAC,CACxB,QAAQ,WAAW,SAAS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OACV,IAAI,EAAE,SAAS,SAAS,EAAE,SAAS,QACxC,WAAW,IAAI;EAGjB,OAAO,WAAW,WAAW,IAAI;CACnC,CAAC;CAED,KAAK,MAAM,YAAY,WACrB,cAAc,SAAS,QAAQ;AAEnC;AAEA,SAAS,oBAAoB,SAAe;CAC1C,OAAO,QAAQ,WAAW,KAAK,IAAI,CAAC,CAAC,WAAW,MAAM,MAAM;AAC9D;;;;;;ACjUA,IAAa,qBAAqB,CAAA;AAUlC,IAAa,kCAET,IAAI,eAAe,2CAA2C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@analogjs/router",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.51",
|
|
4
4
|
"description": "Filesystem-based routing for Angular",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Brandon Roberts <robertsbt@gmail.com>",
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
"url": "https://github.com/sponsors/brandonroberts"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@analogjs/content": "3.0.0-beta.
|
|
72
|
+
"@analogjs/content": "3.0.0-beta.51",
|
|
73
73
|
"@angular/core": "^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
74
74
|
"@angular/platform-server": "^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
75
75
|
"@angular/router": "^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
76
76
|
"@standard-schema/spec": "^1.1.0",
|
|
77
|
-
"@tanstack/angular-query
|
|
77
|
+
"@tanstack/angular-query": "^5.108.0",
|
|
78
78
|
"h3": "^1.13.0 || ^2.0.0-rc.0",
|
|
79
79
|
"schema-dts": "^2.0.0"
|
|
80
80
|
},
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"@standard-schema/spec": {
|
|
89
89
|
"optional": true
|
|
90
90
|
},
|
|
91
|
-
"@tanstack/angular-query
|
|
91
|
+
"@tanstack/angular-query": {
|
|
92
92
|
"optional": true
|
|
93
93
|
},
|
|
94
94
|
"h3": {
|
|
@@ -102,11 +102,12 @@
|
|
|
102
102
|
"@standard-schema/spec": "^1.1.0",
|
|
103
103
|
"es-toolkit": "^1.45.1",
|
|
104
104
|
"ofetch": "2.0.0-alpha.3",
|
|
105
|
+
"radix3": "^1.1.2",
|
|
105
106
|
"tslib": "^2.3.0"
|
|
106
107
|
},
|
|
107
108
|
"devDependencies": {
|
|
108
|
-
"@analogjs/vite-plugin-angular": "3.0.0-beta.
|
|
109
|
-
"@analogjs/vitest-angular": "3.0.0-beta.
|
|
109
|
+
"@analogjs/vite-plugin-angular": "3.0.0-beta.51",
|
|
110
|
+
"@analogjs/vitest-angular": "3.0.0-beta.51"
|
|
110
111
|
},
|
|
111
112
|
"ng-update": {
|
|
112
113
|
"packageGroup": [
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { type ContentFileLoader } from '@analogjs/content';
|
|
1
2
|
import type { RouteExport } from '../../../src/lib/models';
|
|
2
|
-
export declare function toMarkdownModule(markdownFileFactory:
|
|
3
|
+
export declare function toMarkdownModule(markdownFileFactory: ContentFileLoader): () => Promise<RouteExport>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { Route } from '@angular/router';
|
|
2
|
+
import type { ContentFileModule } from '@analogjs/content';
|
|
2
3
|
import type { RouteExport } from '../../../src/lib/models';
|
|
3
4
|
/**
|
|
4
5
|
* This variable reference is replaced with a glob of all content routes.
|
|
5
6
|
*/
|
|
6
7
|
export declare const ANALOG_CONTENT_ROUTE_FILES: {};
|
|
7
|
-
export type Files = Record<string, () => Promise<RouteExport | string>>;
|
|
8
|
+
export type Files = Record<string, () => Promise<RouteExport | string | ContentFileModule>>;
|
|
8
9
|
export declare function createContentRoutes(files: Files, debug?: boolean): Route[];
|
|
@@ -4,5 +4,8 @@ type ParsedRequestValue = RequestEntryValue | RequestEntryValue[];
|
|
|
4
4
|
export declare function getRequestUrl(event: H3Event): string;
|
|
5
5
|
export declare function parseSearchParams(searchParams: URLSearchParams): Record<string, ParsedRequestValue>;
|
|
6
6
|
export declare function parseFormData(formData: FormData): Record<string, ParsedRequestValue>;
|
|
7
|
+
/**
|
|
8
|
+
* Resolves to a 400 `Response` when a JSON body is malformed.
|
|
9
|
+
*/
|
|
7
10
|
export declare function parseRequestData(event: H3Event): Promise<unknown>;
|
|
8
11
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { provideServerContext } from './provide-server-context';
|
|
2
2
|
export { render } from './render';
|
|
3
3
|
export { renderStream } from './render-stream';
|
|
4
|
+
export { createAnalogRequestHandler, type AnalogRequestContext, type AnalogRequestHandler, type AnalogRequestOptions, } from './request-handler';
|
|
5
|
+
export { createAnalogHandler, type AnalogNodeHandler } from './node-handler';
|
|
4
6
|
export { serverFn } from './server-fn/server-fn';
|
|
5
7
|
export { createServerFnAppInjector } from './server-fn/app-injector';
|
|
6
8
|
export { createServerFnEventHandler, handleServerFnRequest, } from './server-fn/event-handler';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
import { type AnalogRequestOptions } from './request-handler';
|
|
3
|
+
export type AnalogNodeHandler = (req: IncomingMessage, res: ServerResponse, next: (error?: unknown) => void) => void;
|
|
4
|
+
/**
|
|
5
|
+
* The Node adapter for `createAnalogRequestHandler()`: converts the request,
|
|
6
|
+
* writes Analog's `Response`, and calls `next` when Analog returns `null`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createAnalogHandler(options?: AnalogRequestOptions): AnalogNodeHandler;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
/**
|
|
3
|
+
* The Node request and response behind a `Request`, when the host has them.
|
|
4
|
+
* They become Analog's `REQUEST`/`RESPONSE` and the page endpoint `req`/`res`.
|
|
5
|
+
*/
|
|
6
|
+
export type AnalogRequestContext = {
|
|
7
|
+
req: IncomingMessage;
|
|
8
|
+
res: ServerResponse;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* A `Response` for Analog's requests, or `null` for anything else. Without a
|
|
12
|
+
* context (fetch-native hosts), a Node request/response pair is created from
|
|
13
|
+
* the `Request`, and what the app sets on that response is folded into the
|
|
14
|
+
* returned `Response`.
|
|
15
|
+
*/
|
|
16
|
+
export type AnalogRequestHandler = (request: Request, context?: AnalogRequestContext) => Promise<Response | null>;
|
|
17
|
+
export type AnalogRequestOptions = {
|
|
18
|
+
/**
|
|
19
|
+
* Serves server-side fetches that Analog doesn't handle, such as the host's
|
|
20
|
+
* own routes. Fetch-native hosts can pass their app's `fetch`.
|
|
21
|
+
*/
|
|
22
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Handles Analog's requests: server functions and page endpoints, then SSR
|
|
26
|
+
* for GET requests outside the API prefix. Static client files are the
|
|
27
|
+
* host's job; serve them first, without an index fallback, or SSR answers
|
|
28
|
+
* asset URLs.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createAnalogRequestHandler(options?: AnalogRequestOptions): AnalogRequestHandler;
|
|
@@ -40,7 +40,7 @@ export interface DispatchServerFnOptions {
|
|
|
40
40
|
* 2. look up the function by id
|
|
41
41
|
* 3. enforce the configured HTTP method (405 on mismatch)
|
|
42
42
|
* 4. require a JSON body on input-bearing calls (415 otherwise)
|
|
43
|
-
* 5. validate `input` against the Standard-Schema (
|
|
43
|
+
* 5. validate `input` against the Standard-Schema (422 on failure)
|
|
44
44
|
* 6. build a per-request injector (REQUEST/RESPONSE + app providers)
|
|
45
45
|
* 7. run the interceptor chain, then the handler, re-entering
|
|
46
46
|
* `runInInjectionContext` at every hop so `inject()` works even after an
|
|
@@ -53,4 +53,6 @@ export interface DispatchServerFnOptions {
|
|
|
53
53
|
* guard. Transports (the generated Nitro handler) always pass it; trusted
|
|
54
54
|
* in-process callers may omit it, which also exempts them from the origin guard.
|
|
55
55
|
*/
|
|
56
|
-
export declare function dispatchServerFn(id: string, rawInput: unknown, event: Pick<H3Event, 'node'
|
|
56
|
+
export declare function dispatchServerFn(id: string, rawInput: unknown, event: Pick<H3Event, 'node'> & {
|
|
57
|
+
req?: unknown;
|
|
58
|
+
}, options?: DispatchServerFnOptions): Promise<DispatchResult>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Injector } from '@angular/core';
|
|
2
2
|
import { type EventHandler, type H3Event } from 'h3';
|
|
3
|
+
import type { AnalogRequestContext } from '../request-handler';
|
|
3
4
|
/**
|
|
4
5
|
* The h3 request/response layer for the server-function dispatch route.
|
|
5
6
|
*
|
|
@@ -19,4 +20,5 @@ export declare function createServerFnEventHandler(appInjector: Injector | Promi
|
|
|
19
20
|
* h3 response. Same-origin, method, content-type, validation, and interceptors
|
|
20
21
|
* are enforced inside `dispatchServerFn`; this owns only the h3 I/O around it.
|
|
21
22
|
*/
|
|
22
|
-
export declare function handleServerFnRequest(event: H3Event, appInjector: Injector | Promise<Injector>): Promise<
|
|
23
|
+
export declare function handleServerFnRequest(event: H3Event, appInjector: Injector | Promise<Injector>): Promise<Response>;
|
|
24
|
+
export declare function callServerFn(id: string, request: Request, context: AnalogRequestContext, parent: Injector): Promise<Response>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
2
|
import type { H3Event } from 'h3';
|
|
3
|
+
import type { AnalogRequestContext } from '../request-handler';
|
|
3
4
|
type NodeContext = NonNullable<H3Event['node']>;
|
|
4
5
|
type NodeRuntimeContext = NodeContext & {
|
|
5
6
|
req: IncomingMessage;
|
|
@@ -7,9 +8,18 @@ type NodeRuntimeContext = NodeContext & {
|
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
9
10
|
* Dispatch provides the Node request and response through `REQUEST` and
|
|
10
|
-
* `RESPONSE`, which are typed as Node primitives
|
|
11
|
-
*
|
|
12
|
-
* in-process while rendering may have no response.
|
|
11
|
+
* `RESPONSE`, which are typed as Node primitives. h3 leaves `node` undefined on
|
|
12
|
+
* other runtimes, where `nodeContext` creates them from the `Request`. Calls
|
|
13
|
+
* made in-process while rendering may have no response.
|
|
13
14
|
*/
|
|
14
15
|
export declare function assertNodeContext(event: Pick<H3Event, 'node'>): NodeRuntimeContext;
|
|
16
|
+
/**
|
|
17
|
+
* A Node request/response pair for a bare `Request`, carrying what Analog
|
|
18
|
+
* reads: method, URL, headers and protocol, plus the `Request` and its abort
|
|
19
|
+
* `signal`. The same approach as h3's web adapter; it needs `node:http` (Node,
|
|
20
|
+
* Bun, Deno).
|
|
21
|
+
*/
|
|
22
|
+
export declare function nodeContext(request: Request, url: URL): AnalogRequestContext;
|
|
23
|
+
/** Headers the app set on the created response, under Analog's own. */
|
|
24
|
+
export declare function withResponseHeaders(response: Response, res: ServerResponse): Response;
|
|
15
25
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ServerFn, ServerFnConfig, ServerFnHandler, StandardSchemaV1 } from '@analogjs/router';
|
|
1
|
+
import type { ServerFn, ServerFnConfig, ServerFnHandler, ServerFnResult, StandardSchemaV1 } from '@analogjs/router';
|
|
2
2
|
/**
|
|
3
3
|
* Define a server function. Authored in a `*.server.ts` module.
|
|
4
4
|
*
|
|
@@ -16,6 +16,6 @@ import type { ServerFn, ServerFnConfig, ServerFnHandler, StandardSchemaV1 } from
|
|
|
16
16
|
* proxy that calls `/_analog/fn/<id>`; the reference still carries
|
|
17
17
|
* `id`/`url`/`method` so `injectServerFn`/`ServerFnClient` can dispatch.
|
|
18
18
|
*/
|
|
19
|
-
export declare function serverFn<Out>(handler: ServerFnHandler<void, Out>): ServerFn<void, Out
|
|
20
|
-
export declare function serverFn<In, Out>(input: StandardSchemaV1<In>, handler: ServerFnHandler<In, Out>): ServerFn<In, Out
|
|
21
|
-
export declare function serverFn<In, Out>(config: ServerFnConfig<In>, handler: ServerFnHandler<In, Out>): ServerFn<In, Out
|
|
19
|
+
export declare function serverFn<Out>(handler: ServerFnHandler<void, Out>): ServerFn<void, ServerFnResult<Out>>;
|
|
20
|
+
export declare function serverFn<In, Out>(input: StandardSchemaV1<In>, handler: ServerFnHandler<In, Out>): ServerFn<In, ServerFnResult<Out>>;
|
|
21
|
+
export declare function serverFn<In, Out>(config: ServerFnConfig<In>, handler: ServerFnHandler<In, Out>): ServerFn<In, ServerFnResult<Out>>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ApplicationConfig } from '@angular/core';
|
|
2
|
+
import type { ServerContext } from '@analogjs/router/tokens';
|
|
3
|
+
export type PageEndpointModule = {
|
|
4
|
+
load?: (ctx: unknown) => unknown;
|
|
5
|
+
action?: (ctx: unknown) => unknown;
|
|
6
|
+
};
|
|
7
|
+
export type ServerRender = (url: string, document: string, context: ServerContext) => Promise<string | ReadableStream<Uint8Array>>;
|
|
8
|
+
/** Everything the request handler needs from the app, as lazy imports. */
|
|
9
|
+
export type AnalogServerManifest = {
|
|
10
|
+
apiPrefix: string;
|
|
11
|
+
/** The HTML document to render around the app, for a request URL. */
|
|
12
|
+
template: (url: string) => Promise<string>;
|
|
13
|
+
/** The app's SSR entry (`main.server.ts` default export). */
|
|
14
|
+
render: () => Promise<ServerRender>;
|
|
15
|
+
/** The app's server config (`app.config.server.ts`). */
|
|
16
|
+
config: () => Promise<ApplicationConfig>;
|
|
17
|
+
/** Every `*.server.ts`, imported so server functions register. */
|
|
18
|
+
serverFnModules: (() => Promise<unknown>)[];
|
|
19
|
+
/** Page endpoint route → `*.server.ts` module. */
|
|
20
|
+
pageEndpoints: Record<string, () => Promise<PageEndpointModule>>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Filled in at build time by the platform's server build, the same way the
|
|
24
|
+
* router plugin fills in `ANALOG_ROUTE_FILES`. Empty without it.
|
|
25
|
+
*/
|
|
26
|
+
export declare const ANALOG_SERVER_MANIFEST: Partial<AnalogServerManifest>;
|
|
@@ -23,3 +23,5 @@ export declare function isLikelyBot(serverContext: ServerContext): boolean;
|
|
|
23
23
|
* response, the header is forwarded on the request instead.
|
|
24
24
|
*/
|
|
25
25
|
export declare function streamingDisabledByRoute(serverContext: ServerContext): boolean;
|
|
26
|
+
/** Marks the single-chunk stream of a buffered render, which is safe to cache. */
|
|
27
|
+
export declare const BUFFERED_STREAM: unique symbol;
|
package/types/src/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type { AnalogJsonLdDocument } from './lib/json-ld';
|
|
|
17
17
|
export { injectServerFn, injectServerFnMutation, provideServerFnClient, ServerFnClient, } from './lib/server-fn/inject-server-fn';
|
|
18
18
|
export { createServerFnRef, type ServerFnRefConfig, } from './lib/server-fn/server-fn-ref';
|
|
19
19
|
export { SERVER_FN_DISPATCHER, type ServerFnDispatcher, } from './lib/server-fn/dispatcher';
|
|
20
|
-
export type { ServerFn, ServerFnConfig, ServerFnContext, ServerFnDef, ServerFnHandler, ServerFnMethod, StandardSchemaV1, } from './lib/server-fn/types';
|
|
20
|
+
export type { ServerFn, ServerFnConfig, ServerFnContext, ServerFnDef, ServerFnHandler, ServerFnMethod, ServerFnResult, StandardSchemaV1, } from './lib/server-fn/types';
|
|
21
21
|
export { toRoute } from './lib/to-route';
|
|
22
22
|
export { LinkTo, type LinkToInput } from './lib/link-to.directive';
|
|
23
23
|
export type { AnalogRouteTable, AnalogRoutePath, RouteDataOutput, RouteLoadOutput, RoutePathOptions, RouteResourcesOutput, } from './lib/to-route';
|
|
@@ -1,30 +1,35 @@
|
|
|
1
1
|
import { Type } from '@angular/core';
|
|
2
|
-
import { CanActivateChildFn, CanActivateFn, CanDeactivateFn, CanMatchFn, DeprecatedGuard,
|
|
2
|
+
import { ActivatedRouteSnapshot, CanActivateChildFn, CanActivateFn, CanDeactivateFn, CanMatchFn, DeprecatedGuard, MaybeAsync, RedirectCommand, Route, RouterStateSnapshot } from '@angular/router';
|
|
3
3
|
import { AnalogJsonLdDocument } from './json-ld';
|
|
4
4
|
import { MetaTag } from './meta-tags';
|
|
5
|
+
import type { AnalogRoutePath, RouteActivatedRouteSnapshot, RouteResourceContext, RouteResourceResult } from './to-route';
|
|
5
6
|
type OmittedRouteProps = 'path' | 'matcher' | 'component' | 'loadComponent' | 'children' | 'loadChildren' | 'canLoad' | 'outlet';
|
|
6
7
|
export type RouteConfig = Omit<Route, OmittedRouteProps>;
|
|
7
|
-
|
|
8
|
+
type RouteContextFor<P> = [P] extends [never] ? never : [P] extends [AnalogRoutePath] ? RouteResourceContext<P> : RouteResourceContext;
|
|
9
|
+
type RouteSnapshotFor<P> = [P] extends [never] ? never : [P] extends [AnalogRoutePath] ? RouteActivatedRouteSnapshot<P> : ActivatedRouteSnapshot;
|
|
10
|
+
type RouteResolveFn<T, P extends AnalogRoutePath | undefined = undefined> = (route: RouteSnapshotFor<P>, state: RouterStateSnapshot) => MaybeAsync<T | RedirectCommand>;
|
|
11
|
+
export interface DefaultRouteMeta<P extends AnalogRoutePath | undefined = undefined> extends Omit<Route, OmittedRouteProps | keyof RedirectRouteMeta | 'resolve' | 'resources' | 'title'> {
|
|
8
12
|
canActivate?: CanActivateFn[] | DeprecatedGuard[];
|
|
9
13
|
canActivateChild?: CanActivateChildFn[];
|
|
10
14
|
canDeactivate?: CanDeactivateFn<unknown>[];
|
|
11
15
|
canMatch?: CanMatchFn[];
|
|
12
16
|
resolve?: {
|
|
13
|
-
[key: string | symbol]:
|
|
17
|
+
[key: string | symbol]: RouteResolveFn<unknown, P>;
|
|
14
18
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
resources?: (ctx: RouteContextFor<P>) => RouteResourceResult | Promise<RouteResourceResult>;
|
|
20
|
+
title?: string | RouteResolveFn<string, P>;
|
|
21
|
+
meta?: MetaTag[] | RouteResolveFn<MetaTag[], P>;
|
|
22
|
+
jsonLd?: AnalogJsonLdDocument | RouteResolveFn<AnalogJsonLdDocument | undefined, P>;
|
|
18
23
|
}
|
|
19
24
|
export interface RedirectRouteMeta {
|
|
20
|
-
redirectTo:
|
|
25
|
+
redirectTo: NonNullable<Route['redirectTo']>;
|
|
21
26
|
pathMatch?: Route['pathMatch'];
|
|
22
27
|
}
|
|
23
|
-
export type RouteMeta = (DefaultRouteMeta & {
|
|
28
|
+
export type RouteMeta<P extends AnalogRoutePath | undefined = undefined> = (DefaultRouteMeta<P> & {
|
|
24
29
|
redirectTo?: never;
|
|
25
30
|
}) | RedirectRouteMeta;
|
|
26
31
|
export type RouteExport = {
|
|
27
32
|
default: Type<unknown>;
|
|
28
|
-
routeMeta?: RouteMeta
|
|
33
|
+
routeMeta?: RouteMeta<never>;
|
|
29
34
|
};
|
|
30
35
|
export {};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { HttpEvent, HttpHandlerFn, HttpRequest } from '@angular/common/http';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
/**
|
|
4
|
+
* Stops restoring transferred responses once the app is first stable,
|
|
5
|
+
* matching Angular's HTTP transfer cache.
|
|
6
|
+
*/
|
|
7
|
+
export declare function deactivateTransferCacheWhenStable(): () => void;
|
|
3
8
|
/**
|
|
4
9
|
* Interceptor that is server-aware when making HttpClient requests.
|
|
5
10
|
* Server-side requests use the full URL
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { RouteConfig, RouteMeta } from './models';
|
|
2
|
-
export declare function toRouteConfig(routeMeta: RouteMeta | undefined): RouteConfig;
|
|
2
|
+
export declare function toRouteConfig(routeMeta: RouteMeta<never> | undefined): RouteConfig;
|
|
@@ -15,11 +15,11 @@ export declare class ServerFnClient {
|
|
|
15
15
|
private readonly dispatcher;
|
|
16
16
|
/** True while rendering on the server (the in-process dispatcher is provided). */
|
|
17
17
|
get isServer(): boolean;
|
|
18
|
-
call<In, Out>(fn: ServerFn<In, Out>, input: In): Promise<Out>;
|
|
18
|
+
call<In, Out>(fn: ServerFn<In, Out>, input: In, signal?: AbortSignal): Promise<Out>;
|
|
19
19
|
/** Key a read's value for TransferState hydration (fn id + input). */
|
|
20
|
-
stateKey<Out>(fn: ServerFn<
|
|
21
|
-
readSeed<Out>(fn: ServerFn<
|
|
22
|
-
writeSeed<Out>(fn: ServerFn<
|
|
20
|
+
stateKey<In, Out>(fn: ServerFn<In, Out>, input: In): StateKey<Out>;
|
|
21
|
+
readSeed<In, Out>(fn: ServerFn<In, Out>, input: In): Out | undefined;
|
|
22
|
+
writeSeed<In, Out>(fn: ServerFn<In, Out>, input: In, value: Out): void;
|
|
23
23
|
static ɵfac: i0.ɵɵFactoryDeclaration<ServerFnClient, never>;
|
|
24
24
|
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
25
25
|
}
|