@analogjs/router 3.0.0-alpha.24 → 3.0.0-alpha.26

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.
@@ -2,12 +2,12 @@ import { a as updateMetaTagsOnRouteChange, i as injectRouteEndpointURL, n as ANA
2
2
  import { n as createRoutes, r as routes, t as injectDebugRoutes } from "./routes.mjs";
3
3
  import { ActivatedRoute, ROUTES, Router, provideRouter } from "@angular/router";
4
4
  import * as i0 from "@angular/core";
5
- import { ChangeDetectionStrategy, Component, Directive, ENVIRONMENT_INITIALIZER, InjectionToken, Injector, PLATFORM_ID, TransferState, effect, inject, input, isDevMode, makeEnvironmentProviders, makeStateKey, output, signal } from "@angular/core";
5
+ import { ChangeDetectionStrategy, Component, Directive, InjectionToken, Injector, PLATFORM_ID, TransferState, effect, inject, input, isDevMode, makeEnvironmentProviders, makeStateKey, output, provideAppInitializer, signal } from "@angular/core";
6
6
  import { HttpClient, HttpHeaders, HttpRequest, HttpResponse, ɵHTTP_ROOT_INTERCEPTOR_FNS } from "@angular/common/http";
7
7
  import { catchError, from, map, of, take, throwError } from "rxjs";
8
8
  import { API_PREFIX, injectAPIPrefix, injectBaseURL, injectInternalServerFetch, injectRequest } from "@analogjs/router/tokens";
9
- import { isPlatformServer } from "@angular/common";
10
- import { DomSanitizer } from "@angular/platform-browser";
9
+ import { DOCUMENT, isPlatformServer } from "@angular/common";
10
+ import { DomSanitizer, Meta } from "@angular/platform-browser";
11
11
  import { toSignal } from "@angular/core/rxjs-interop";
12
12
  //#region packages/router/src/lib/define-route.ts
13
13
  /**
@@ -93,16 +93,13 @@ function provideFileRouterWithRoutes(...features) {
93
93
  });
94
94
  }
95
95
  },
96
- {
97
- provide: ENVIRONMENT_INITIALIZER,
98
- multi: true,
99
- useValue: () => updateMetaTagsOnRouteChange()
100
- },
101
- {
102
- provide: ENVIRONMENT_INITIALIZER,
103
- multi: true,
104
- useValue: () => updateJsonLdOnRouteChange()
105
- },
96
+ provideAppInitializer(() => {
97
+ const router = inject(Router);
98
+ const meta = inject(Meta);
99
+ const document = inject(DOCUMENT, { optional: true });
100
+ updateMetaTagsOnRouteChange(router, meta);
101
+ updateJsonLdOnRouteChange(router, document);
102
+ }),
106
103
  {
107
104
  provide: ɵHTTP_ROOT_INTERCEPTOR_FNS,
108
105
  multi: true,
@@ -1 +1 @@
1
- {"version":3,"file":"analogjs-router.mjs","names":[],"sources":["../../src/lib/define-route.ts","../../src/lib/cookie-interceptor.ts","../../src/lib/provide-file-router-base.ts","../../src/lib/provide-file-router.ts","../../src/lib/inject-load.ts","../../src/lib/get-load-resolver.ts","../../src/lib/cache-key.ts","../../src/lib/request-context.ts","../../src/lib/form-action.directive.ts","../../src/lib/debug/index.ts","../../src/lib/server.component.ts","../../src/lib/validation-errors.ts","../../src/lib/route-path.ts","../../src/lib/inject-navigate.ts","../../src/lib/experimental.ts","../../src/lib/inject-typed-params.ts","../../src/lib/inject-route-context.ts"],"sourcesContent":["import { inject } from '@angular/core';\nimport { Route as NgRoute, Router } from '@angular/router';\nimport { ActivatedRoute } from '@angular/router';\n\nimport { AnalogJsonLdDocument } from './json-ld';\nimport { MetaTag } from './meta-tags';\n\ntype RouteOmitted =\n | 'component'\n | 'loadComponent'\n | 'loadChildren'\n | 'path'\n | 'pathMatch';\n\ntype RestrictedRoute = Omit<NgRoute, RouteOmitted> & {\n meta?: MetaTag[];\n jsonLd?: AnalogJsonLdDocument;\n};\n\n/**\n * @deprecated Use `RouteMeta` type instead.\n * For more info see: https://github.com/analogjs/analog/issues/223\n *\n * Defines additional route config metadata. This\n * object is merged into the route config with\n * the predefined file-based route.\n *\n * @usageNotes\n *\n * ```\n * import { Component } from '@angular/core';\n * import { defineRouteMeta } from '@analogjs/router';\n *\n * export const routeMeta = defineRouteMeta({\n * title: 'Welcome'\n * });\n *\n * @Component({\n * template: `Home`,\n * standalone: true,\n * })\n * export default class HomeComponent {}\n * ```\n *\n * @param route\n * @returns\n */\nexport const defineRouteMeta = (route: RestrictedRoute): RestrictedRoute => {\n return route;\n};\n\n/**\n * Returns the instance of Angular Router\n *\n * @returns The router\n */\nexport const injectRouter = (): Router => {\n return inject(Router);\n};\n\n/**\n * Returns the instance of the Activate Route for the component\n *\n * @returns The activated route\n */\nexport const injectActivatedRoute = (): ActivatedRoute => {\n return inject(ActivatedRoute);\n};\n","import { isPlatformServer } from '@angular/common';\nimport {\n HttpHandlerFn,\n HttpHeaders,\n HttpRequest,\n HttpEvent,\n} from '@angular/common/http';\nimport { PLATFORM_ID, inject } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { injectRequest, ServerRequest } from '@analogjs/router/tokens';\n\nexport function cookieInterceptor(\n req: HttpRequest<unknown>,\n next: HttpHandlerFn,\n location: object = inject(PLATFORM_ID),\n serverRequest: ServerRequest | null = injectRequest(),\n): Observable<HttpEvent<unknown>> {\n if (isPlatformServer(location) && req.url.includes('/_analog/')) {\n let headers = new HttpHeaders();\n const cookies = serverRequest?.headers.cookie;\n headers = headers.set('cookie', cookies ?? '');\n\n const cookiedRequest = req.clone({\n headers,\n });\n\n return next(cookiedRequest);\n } else {\n return next(req);\n }\n}\n","import {\n ENVIRONMENT_INITIALIZER,\n EnvironmentProviders,\n inject,\n makeEnvironmentProviders,\n} from '@angular/core';\nimport { ɵHTTP_ROOT_INTERCEPTOR_FNS as HTTP_ROOT_INTERCEPTOR_FNS } from '@angular/common/http';\nimport { provideRouter, RouterFeatures, ROUTES, Routes } from '@angular/router';\nimport { API_PREFIX } from '@analogjs/router/tokens';\n\nimport { cookieInterceptor } from './cookie-interceptor';\nimport { updateJsonLdOnRouteChange } from './json-ld';\nimport { updateMetaTagsOnRouteChange } from './meta-tags';\nimport { createRoutes as createBaseRoutes } from './route-builder';\nimport {\n ANALOG_ROUTE_FILES,\n ANALOG_EXTRA_ROUTE_FILE_SOURCES,\n ANALOG_CONTENT_FILE_COUNT,\n type ExtraRouteFileSource,\n} from './route-files';\nimport type { RouteExport } from './models';\n\ndeclare const ANALOG_API_PREFIX: string;\n\nexport function provideFileRouterWithRoutes(\n ...features: RouterFeatures[]\n): EnvironmentProviders {\n const extraRoutesFeature = features.filter((feat) => feat.ɵkind >= 100);\n const routerFeatures = features.filter((feat) => feat.ɵkind < 100);\n\n // Automatically register the debug route viewer during development.\n // Navigating to /__analog/routes shows all registered page and content\n // routes. The import.meta.env.DEV guard ensures the debug page and its\n // component are tree-shaken from production builds.\n //\n // The debug route is passed directly to provideRouter() so it takes\n // priority over file-based catch-all routes like [...slug]. ROUTES\n // multi-providers are concatenated after provideRouter's initial routes,\n // so a catch-all in file routes would shadow an __analog/* ROUTES entry.\n const debugRoutes: Routes = import.meta.env.DEV\n ? [\n {\n path: '__analog/routes',\n loadComponent: () => import('./debug/debug.page'),\n },\n ]\n : [];\n\n return makeEnvironmentProviders([\n extraRoutesFeature.map((erf) => erf.ɵproviders),\n provideRouter(debugRoutes, ...routerFeatures),\n {\n provide: ROUTES,\n multi: true,\n useFactory: () => {\n const extraSources =\n inject(ANALOG_EXTRA_ROUTE_FILE_SOURCES, { optional: true }) ?? [];\n\n if (\n import.meta.env.DEV &&\n extraSources.length === 0 &&\n ANALOG_CONTENT_FILE_COUNT > 0\n ) {\n console.warn(\n `[Analog] ${ANALOG_CONTENT_FILE_COUNT} content route file(s) ` +\n `discovered but withContentRoutes() is not configured. ` +\n `Content routes will not be registered.\\n\\n` +\n ` import { withContentRoutes } from '@analogjs/router/content';\\n` +\n ` provideFileRouter(withContentRoutes())\\n`,\n );\n }\n\n if (extraSources.length === 0) {\n return createBaseRoutes(\n ANALOG_ROUTE_FILES as Record<string, () => Promise<RouteExport>>,\n (_filename, fileLoader) => fileLoader as () => Promise<RouteExport>,\n );\n }\n\n const allFiles: Record<string, () => Promise<unknown>> = {\n ...(ANALOG_ROUTE_FILES as Record<string, () => Promise<unknown>>),\n };\n const resolverMap = new Map<\n string,\n ExtraRouteFileSource['resolveModule']\n >();\n\n if (import.meta.env.DEV) {\n const pageKeys = new Set(Object.keys(ANALOG_ROUTE_FILES));\n for (const source of extraSources) {\n for (const key of Object.keys(source.files)) {\n if (pageKeys.has(key)) {\n console.warn(\n `[Analog] Route file \"${key}\" is registered by both page ` +\n `routes and content routes. The content route resolver ` +\n `will be used for this file.`,\n );\n }\n }\n }\n }\n\n for (const source of extraSources) {\n for (const [key, loader] of Object.entries(source.files)) {\n allFiles[key] = loader;\n resolverMap.set(key, source.resolveModule);\n }\n }\n\n return createBaseRoutes(allFiles, (filename, fileLoader) => {\n const resolver = resolverMap.get(filename);\n return resolver\n ? resolver(filename, fileLoader)\n : (fileLoader as () => Promise<RouteExport>);\n });\n },\n },\n {\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useValue: () => updateMetaTagsOnRouteChange(),\n },\n {\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useValue: () => updateJsonLdOnRouteChange(),\n },\n {\n provide: HTTP_ROOT_INTERCEPTOR_FNS,\n multi: true,\n useValue: cookieInterceptor,\n },\n {\n provide: API_PREFIX,\n useFactory() {\n return typeof ANALOG_API_PREFIX !== 'undefined'\n ? ANALOG_API_PREFIX\n : 'api';\n },\n },\n ]);\n}\n\nexport function withExtraRoutes(routes: Routes): RouterFeatures {\n return {\n ɵkind: 100 as number,\n ɵproviders: [{ provide: ROUTES, useValue: routes, multi: true }],\n };\n}\n","import { EnvironmentProviders } from '@angular/core';\nimport { RouterFeatures } from '@angular/router';\n\nimport { provideFileRouterWithRoutes } from './provide-file-router-base';\n\n/**\n * Sets up providers for the Angular router, and registers\n * file-based routes. Additional features can be provided\n * to further configure the behavior of the router.\n *\n * @param features\n * @returns Providers and features to configure the router with routes\n */\nexport function provideFileRouter(\n ...features: RouterFeatures[]\n): EnvironmentProviders {\n return provideFileRouterWithRoutes(...features);\n}\n\nexport { withExtraRoutes } from './provide-file-router-base';\n","import { Injector, inject } from '@angular/core';\nimport { ActivatedRoute, Data } from '@angular/router';\nimport { Observable, map } from 'rxjs';\n\nimport { LoadDataResult, PageServerLoad } from './route-types';\n\nfunction isResponse(value: unknown): value is Response {\n return typeof value === 'object' && value instanceof Response;\n}\n\nexport function injectLoad<\n T extends (pageServerLoad: PageServerLoad) => Promise<unknown>,\n>(options?: { injector?: Injector }): Observable<Awaited<ReturnType<T>>> {\n const injector = options?.injector ?? inject(Injector);\n const route = injector.get(ActivatedRoute);\n\n return route.data.pipe(\n map<Data, Awaited<ReturnType<T>>>((data) => data['load']),\n );\n}\n\nexport function injectLoadData<\n T extends (pageServerLoad: PageServerLoad) => Promise<unknown>,\n>(options?: { injector?: Injector }): Observable<LoadDataResult<T>> {\n return injectLoad<T>(options).pipe(\n map((result): LoadDataResult<T> => {\n if (isResponse(result)) {\n throw new Error('Expected page load data but received a response.');\n }\n\n return result as LoadDataResult<T>;\n }),\n );\n}\n","import { ActivatedRouteSnapshot } from '@angular/router';\n\n/**\n * Get server load resolver data for the route\n *\n * @param route Provides the route to get server load resolver\n * @returns Returns server load resolver data for the route\n */\nexport async function getLoadResolver<T>(\n route: ActivatedRouteSnapshot,\n): Promise<T> {\n return route.routeConfig?.resolve?.['load']?.(route);\n}\n","import { HttpParams, HttpRequest } from '@angular/common/http';\nimport { StateKey, makeStateKey } from '@angular/core';\n\nfunction sortAndConcatParams(params: HttpParams | URLSearchParams): string {\n return [...params.keys()]\n .sort()\n .map((k) => `${k}=${params.getAll(k)}`)\n .join('&');\n}\n\nexport function makeCacheKey(\n request: HttpRequest<unknown>,\n mappedRequestUrl: string,\n): StateKey<unknown> {\n // make the params encoded same as a url so it's easy to identify\n const { params, method, responseType } = request;\n const encodedParams = sortAndConcatParams(params);\n\n let serializedBody = request.serializeBody();\n if (serializedBody instanceof URLSearchParams) {\n serializedBody = sortAndConcatParams(serializedBody);\n } else if (typeof serializedBody !== 'string') {\n serializedBody = '';\n }\n\n const key = [\n method,\n responseType,\n mappedRequestUrl,\n serializedBody,\n encodedParams,\n ].join('|');\n\n const hash = generateHash(key);\n\n return makeStateKey(hash);\n}\n\nfunction generateHash(str: string) {\n let hash = 0;\n for (let i = 0, len = str.length; i < len; i++) {\n const chr = str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0; // Convert to 32bit integer\n }\n return `${hash}`;\n}\n","import { TransferState, inject, makeStateKey } from '@angular/core';\nimport {\n HttpEvent,\n HttpHandlerFn,\n HttpHeaders,\n HttpRequest,\n HttpResponse,\n} from '@angular/common/http';\n\nimport { from, Observable, of } from 'rxjs';\n\nimport type { HTTPMethod } from 'nitro/h3';\n\nimport {\n injectBaseURL,\n injectAPIPrefix,\n injectInternalServerFetch,\n type ServerInternalFetch,\n} from '@analogjs/router/tokens';\n\nimport { makeCacheKey } from './cache-key';\n\n/**\n * Interceptor that is server-aware when making HttpClient requests.\n * Server-side requests use the full URL\n * Prerendering uses the internal Nitro $fetch function, along with state transfer\n * Client-side requests use the window.location.origin\n *\n * @param req HttpRequest<unknown>\n * @param next HttpHandlerFn\n * @returns\n */\nexport function requestContextInterceptor(\n req: HttpRequest<unknown>,\n next: HttpHandlerFn,\n): Observable<HttpEvent<unknown>> {\n const apiPrefix = injectAPIPrefix();\n const baseUrl = injectBaseURL();\n const transferState = inject(TransferState);\n const nitroGlobal = globalThis as typeof globalThis & {\n $fetch?: ServerInternalFetch;\n };\n const internalFetch = injectInternalServerFetch();\n const serverFetch = internalFetch ?? nitroGlobal.$fetch;\n\n // during prerendering with Nitro\n if (\n serverFetch &&\n baseUrl &&\n (req.url.startsWith('/') ||\n req.url.startsWith(baseUrl) ||\n req.url.startsWith(`/${apiPrefix}`))\n ) {\n const requestUrl = new URL(req.url, baseUrl);\n const cacheKey = makeCacheKey(req, new URL(requestUrl).pathname);\n const storeKey = makeStateKey<unknown>(`analog_${cacheKey}`);\n const fetchUrl = requestUrl.pathname;\n\n const responseType =\n req.responseType === 'arraybuffer' ? 'arrayBuffer' : req.responseType;\n\n return from<Promise<HttpResponse<unknown>>>(\n serverFetch\n .raw(fetchUrl, {\n method: req.method as HTTPMethod,\n body: req.body ? req.body : undefined,\n params: requestUrl.searchParams,\n responseType,\n headers: req.headers\n .keys()\n .reduce((hdrs: Record<string, string>, current: string) => {\n const value = req.headers.get(current);\n return value != null ? { ...hdrs, [current]: value } : hdrs;\n }, {}),\n })\n .then((res) => {\n const cacheResponse = {\n body: res._data,\n headers: new HttpHeaders(res.headers),\n status: res.status ?? 200,\n statusText: res.statusText ?? 'OK',\n url: fetchUrl,\n };\n const transferResponse = new HttpResponse(cacheResponse);\n\n transferState.set(storeKey, cacheResponse);\n return transferResponse;\n }),\n );\n }\n\n // on the client\n if (\n !import.meta.env.SSR &&\n (req.url.startsWith('/') || req.url.includes('/_analog/'))\n ) {\n // /_analog/ requests are full URLs\n const requestUrl = req.url.includes('/_analog/')\n ? req.url\n : `${window.location.origin}${req.url}`;\n const cacheKey = makeCacheKey(req, new URL(requestUrl).pathname);\n const storeKey = makeStateKey<unknown>(`analog_${cacheKey}`);\n const cacheRestoreResponse = transferState.get(storeKey, null);\n\n if (cacheRestoreResponse) {\n transferState.remove(storeKey);\n return of(new HttpResponse(cacheRestoreResponse));\n }\n\n return next(\n req.clone({\n url: requestUrl,\n }),\n );\n }\n\n // on the server\n if (baseUrl && (req.url.startsWith('/') || req.url.startsWith(baseUrl))) {\n const requestUrl =\n req.url.startsWith(baseUrl) && !req.url.startsWith('/')\n ? req.url\n : `${baseUrl}${req.url}`;\n\n return next(\n req.clone({\n url: requestUrl,\n }),\n );\n }\n\n return next(req);\n}\n","import {\n Directive,\n inject,\n input,\n output,\n signal,\n type InputSignal,\n type OutputEmitterRef,\n type WritableSignal,\n} from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\n\nimport { injectRouteEndpointURL } from './inject-route-endpoint-url';\n\nexport type FormActionState =\n | 'submitting'\n | 'error'\n | 'redirect'\n | 'success'\n | 'navigate';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: 'form[action],form[method]',\n host: {\n '(submit)': `submitted($event)`,\n '[attr.data-state]': 'currentState()',\n '[attr.aria-busy]': 'currentState() === \"submitting\" ? \"true\" : null',\n },\n standalone: true,\n})\nexport class FormAction {\n action: InputSignal<string> = input<string>('');\n // eslint-disable-next-line @angular-eslint/no-output-on-prefix\n onSuccess: OutputEmitterRef<unknown> = output<unknown>();\n // eslint-disable-next-line @angular-eslint/no-output-on-prefix\n onError: OutputEmitterRef<unknown> = output<unknown>();\n state: OutputEmitterRef<FormActionState> = output<FormActionState>();\n private router = inject(Router);\n private route = inject(ActivatedRoute);\n protected currentState: WritableSignal<FormActionState | 'idle'> = signal<\n FormActionState | 'idle'\n >('idle');\n /** Cached during construction (injection context) so inject() works. */\n private _endpointUrl = this.route\n ? injectRouteEndpointURL(this.route.snapshot)\n : undefined;\n\n submitted($event: SubmitEvent): void {\n $event.preventDefault();\n\n const form = $event.target as HTMLFormElement;\n this._emitState('submitting');\n const body = new FormData(form);\n\n if (form.method.toUpperCase() === 'GET') {\n this._handleGet(body, this._getGetPath(form));\n } else {\n this._handlePost(body, this._getPostPath(form), form.method);\n }\n }\n\n private _handleGet(body: FormData, path: string) {\n const url = new URL(path, window.location.href);\n const params = new URLSearchParams(url.search);\n body.forEach((value, key) => {\n params.append(key, value instanceof File ? value.name : value);\n });\n url.search = params.toString();\n\n this._emitState('navigate');\n this._navigateTo(url);\n }\n\n private _handlePost(body: FormData, path: string, method: string) {\n fetch(path, {\n method,\n body,\n })\n .then((res) => {\n if (res.ok) {\n if (res.redirected) {\n this._emitState('redirect');\n this._navigateTo(new URL(res.url, window.location.href));\n } else if (this._isJSON(res.headers.get('Content-type'))) {\n res.json().then((result) => {\n this.onSuccess.emit(result);\n this._emitState('success');\n });\n } else {\n res.text().then((result) => {\n this.onSuccess.emit(result);\n this._emitState('success');\n });\n }\n } else {\n if (res.headers.get('X-Analog-Errors')) {\n res.json().then((errors: unknown) => {\n this.onError.emit(errors);\n this._emitState('error');\n });\n } else {\n this._emitState('error');\n }\n }\n })\n .catch((_) => {\n this._emitState('error');\n });\n }\n\n private _getExplicitAction(form: HTMLFormElement) {\n const explicitAction =\n this.action().trim() || form.getAttribute('action')?.trim();\n return explicitAction || undefined;\n }\n\n private _getGetPath(form: HTMLFormElement) {\n return this._getExplicitAction(form) ?? this.router.url;\n }\n\n private _getPostPath(form: HTMLFormElement) {\n const explicitAction = this._getExplicitAction(form);\n if (explicitAction) {\n return new URL(explicitAction, window.location.href).toString();\n }\n\n if (this._endpointUrl) {\n return this._endpointUrl.pathname;\n }\n\n return `/api/_analog/pages${window.location.pathname}`;\n }\n\n private _emitState(state: FormActionState) {\n this.currentState.set(state);\n this.state.emit(state);\n }\n\n private _navigateTo(url: URL) {\n if (url.origin === window.location.origin) {\n void this.router.navigateByUrl(\n `${url.pathname}${url.search}${url.hash}`,\n {\n onSameUrlNavigation: 'reload',\n },\n );\n return;\n }\n\n window.location.assign(url.toString());\n }\n\n private _isJSON(contentType: string | null): boolean {\n const mime = contentType ? contentType.split(';') : [];\n const essence = mime[0];\n\n return essence === 'application/json';\n }\n}\n","import { EnvironmentProviders, Provider } from '@angular/core';\nimport { ROUTES } from '@angular/router';\n\n/**\n * Provides routes that provide additional\n * pages for displaying and debugging\n * routes.\n */\nexport function withDebugRoutes(): {\n ɵkind: number;\n ɵproviders: (Provider | EnvironmentProviders)[];\n} {\n const routes = [\n {\n path: '__analog/routes',\n loadComponent: () => import('./debug.page'),\n },\n ];\n\n return {\n ɵkind: 101 as number,\n ɵproviders: [{ provide: ROUTES, useValue: routes, multi: true }],\n };\n}\n","import {\n HttpClient,\n HttpHeaders,\n HttpRequest,\n HttpResponse,\n} from '@angular/common/http';\nimport {\n ChangeDetectionStrategy,\n Component,\n effect,\n inject,\n input,\n InputSignal,\n makeStateKey,\n output,\n OutputEmitterRef,\n signal,\n TransferState,\n WritableSignal,\n} from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { ActivatedRoute } from '@angular/router';\nimport { injectBaseURL } from '@analogjs/router/tokens';\nimport { catchError, map, of, throwError } from 'rxjs';\n\nimport { makeCacheKey } from './cache-key';\n\ntype ServerProps = Record<string, any>;\ntype ServerOutputs = Record<string, any>;\n\n/**\n * @description\n * Component that defines the bridge between the client and server-only\n * components. The component passes the component ID and props to the server\n * and retrieves the rendered HTML and outputs from the server-only component.\n *\n * Status: experimental\n */\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'server-only,ServerOnly,Server',\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: ` <div [innerHTML]=\"content()\"></div> `,\n})\nexport class ServerOnly {\n component: InputSignal<string> = input.required<string>();\n props: InputSignal<ServerProps | undefined> = input<ServerProps>();\n outputs: OutputEmitterRef<ServerOutputs> = output<ServerOutputs>();\n private http: HttpClient = inject(HttpClient);\n private sanitizer: DomSanitizer = inject(DomSanitizer);\n protected content: WritableSignal<SafeHtml> = signal<SafeHtml>('');\n private route: ActivatedRoute | null = inject(ActivatedRoute, {\n optional: true,\n });\n private baseURL: string | null = injectBaseURL();\n private transferState = inject(TransferState);\n\n constructor() {\n effect(() => {\n const routeComponentId: string | undefined =\n this.route?.snapshot.data['component'];\n const props = this.props() || {};\n const componentId = routeComponentId || this.component();\n\n const headers = new HttpHeaders(\n new Headers({\n 'Content-type': 'application/json',\n 'X-Analog-Component': componentId,\n }),\n );\n\n const componentUrl = this.getComponentUrl(componentId);\n const httpRequest = new HttpRequest('POST', componentUrl, props, {\n headers,\n });\n const cacheKey = makeCacheKey(\n httpRequest,\n new URL(componentUrl).pathname,\n );\n const storeKey = makeStateKey<{ html: string; outputs: ServerOutputs }>(\n cacheKey,\n );\n const componentState = this.transferState.get<{\n html: string;\n outputs: ServerOutputs;\n } | null>(storeKey, null);\n\n if (componentState) {\n this.updateContent(componentState);\n this.transferState.remove(storeKey);\n } else {\n this.http\n .request(httpRequest)\n .pipe(\n map((response) => {\n if (response instanceof HttpResponse) {\n if (import.meta.env.SSR) {\n this.transferState.set(storeKey, response.body);\n }\n\n return response.body as {\n html: string;\n outputs: ServerOutputs;\n };\n }\n return throwError(\n () => ({}) as { html: string; outputs: ServerOutputs },\n );\n }),\n catchError((error: unknown) => {\n console.log(error);\n return of({\n html: '',\n outputs: {} as ServerOutputs,\n });\n }),\n )\n .subscribe((content) =>\n this.updateContent(\n content as { html: string; outputs: ServerOutputs },\n ),\n );\n }\n });\n }\n\n updateContent(content: { html: string; outputs: ServerOutputs }): void {\n this.content.set(this.sanitizer.bypassSecurityTrustHtml(content.html));\n this.outputs.emit(content.outputs);\n }\n\n getComponentUrl(componentId: string) {\n let baseURL = this.baseURL;\n\n if (!baseURL && typeof window !== 'undefined') {\n baseURL = window.location.origin;\n }\n\n return `${baseURL}/_analog/components/${componentId}`;\n }\n}\n","import type { StandardSchemaV1 } from '@standard-schema/spec';\n\nexport type ValidationFieldErrors = Record<string, string[]>;\n\nfunction getPathSegmentKey(\n segment: string | number | symbol | { key: string | number | symbol },\n) {\n return typeof segment === 'object' ? segment.key : segment;\n}\n\nexport function issuePathToFieldName(\n path: ReadonlyArray<\n string | number | symbol | { key: string | number | symbol }\n >,\n): string {\n return path.map((segment) => String(getPathSegmentKey(segment))).join('.');\n}\n\nexport function issuesToFieldErrors(\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n): ValidationFieldErrors {\n return issues.reduce<ValidationFieldErrors>((errors, issue) => {\n if (!issue.path?.length) {\n return errors;\n }\n\n const fieldName = issuePathToFieldName(issue.path);\n errors[fieldName] ??= [];\n errors[fieldName].push(issue.message);\n return errors;\n }, {});\n}\n\nexport function issuesToFormErrors(\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n): string[] {\n return issues\n .filter((issue) => !issue.path?.length)\n .map((issue) => issue.message);\n}\n","/**\n * Typed route path utilities for Analog.\n *\n * This module provides:\n * - The `AnalogRouteTable` base interface (augmented by generated code)\n * - The `AnalogRoutePath` union type\n * - The `routePath()` URL builder function\n *\n * No Angular dependencies — can be used in any context.\n */\n\n/**\n * Base interface for the typed route table.\n *\n * This interface is augmented by generated code in `src/routeTree.gen.ts`.\n * When no routes are generated, it is empty and `AnalogRoutePath` falls\n * back to `string`.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface, @typescript-eslint/no-empty-object-type\nexport interface AnalogRouteTable {}\n\n/**\n * Union of all valid route paths.\n *\n * When routes are generated, this is a string literal union.\n * When no routes are generated, this falls back to `string`.\n */\nexport type AnalogRoutePath = keyof AnalogRouteTable extends never\n ? string\n : Extract<keyof AnalogRouteTable, string>;\n\n/**\n * Options for building a route URL.\n */\nexport interface RoutePathOptionsBase {\n params?: Record<string, string | string[] | undefined>;\n query?: Record<string, string | string[] | undefined>;\n hash?: string;\n}\n\n/**\n * Extracts the validated output type for route params.\n *\n * When a route exports `routeParamsSchema`, this resolves to the schema's\n * output type (e.g., `{ id: number }` after coercion).\n * When no schema exists, this is the same as the navigation param type.\n */\nexport type RouteParamsOutput<P extends string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { paramsOutput: infer O }\n ? O\n : AnalogRouteTable[P] extends { params: infer Params }\n ? Params\n : Record<string, unknown>\n : Record<string, unknown>;\n\n/**\n * Extracts the validated output type for route query params.\n */\nexport type RouteQueryOutput<P extends string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { queryOutput: infer O }\n ? O\n : Record<string, string | string[] | undefined>\n : Record<string, string | string[] | undefined>;\n\ntype RequiredRouteParamKeys<Params> =\n Params extends Record<string, never>\n ? never\n : {\n [K in keyof Params]-?: Record<string, never> extends Pick<Params, K>\n ? never\n : K;\n }[keyof Params];\n\ntype HasRequiredRouteParams<Params> = [RequiredRouteParamKeys<Params>] extends [\n never,\n]\n ? false\n : true;\n\n/**\n * Typed options that infer params from the route table when available.\n */\nexport type RoutePathOptions<P extends string = string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { params: infer Params }\n ? Params extends Record<string, never>\n ? {\n query?: RouteQueryOutput<P>;\n hash?: string;\n }\n : HasRequiredRouteParams<Params> extends true\n ? {\n params: Params;\n query?: RouteQueryOutput<P>;\n hash?: string;\n }\n : {\n params?: Params;\n query?: RouteQueryOutput<P>;\n hash?: string;\n }\n : RoutePathOptionsBase\n : RoutePathOptionsBase;\n\n/**\n * Conditional args: require options when the route has params.\n */\nexport type RoutePathArgs<P extends string = string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { params: infer Params }\n ? Params extends Record<string, never>\n ? [options?: RoutePathOptions<P>]\n : HasRequiredRouteParams<Params> extends true\n ? [options: RoutePathOptions<P>]\n : [options?: RoutePathOptions<P>]\n : [options?: RoutePathOptionsBase]\n : [options?: RoutePathOptionsBase];\n\n/**\n * Result of `routePath()` — contains properties that map directly\n * to Angular's `[routerLink]`, `[queryParams]`, and `[fragment]` inputs.\n */\nexport interface RouteLinkResult {\n path: string;\n queryParams: Record<string, string | string[]> | null;\n fragment: string | undefined;\n}\n\n/**\n * Builds a typed route link object from a route path pattern and options.\n *\n * The returned object separates path, query params, and fragment for\n * direct use with Angular's routerLink directive inputs.\n *\n * @example\n * routePath('/about')\n * // → { path: '/about', queryParams: null, fragment: undefined }\n *\n * routePath('/users/[id]', { params: { id: '42' } })\n * // → { path: '/users/42', queryParams: null, fragment: undefined }\n *\n * routePath('/users/[id]', { params: { id: '42' }, query: { tab: 'settings' }, hash: 'bio' })\n * // → { path: '/users/42', queryParams: { tab: 'settings' }, fragment: 'bio' }\n *\n * @example Template usage\n * ```html\n * @let link = routePath('/users/[id]', { params: { id: userId } });\n * <a [routerLink]=\"link.path\" [queryParams]=\"link.queryParams\" [fragment]=\"link.fragment\">\n * ```\n */\nexport function routePath<P extends AnalogRoutePath>(\n path: P,\n ...args: RoutePathArgs<P>\n): RouteLinkResult {\n const options = args[0] as RoutePathOptionsBase | undefined;\n return buildRouteLink(path as string, options);\n}\n\n/**\n * Internal: builds a `RouteLinkResult` from path and options.\n * Exported for direct use in tests (avoids generic constraints).\n */\nexport function buildRouteLink(\n path: string,\n options?: RoutePathOptionsBase,\n): RouteLinkResult {\n const resolvedPath = buildPath(path, options?.params);\n\n let queryParams: Record<string, string | string[]> | null = null;\n if (options?.query) {\n const filtered: Record<string, string | string[]> = {};\n let hasEntries = false;\n for (const [key, value] of Object.entries(options.query)) {\n if (value !== undefined) {\n filtered[key] = value;\n hasEntries = true;\n }\n }\n if (hasEntries) {\n queryParams = filtered;\n }\n }\n\n return {\n path: resolvedPath,\n queryParams,\n fragment: options?.hash,\n };\n}\n\n/**\n * Resolves param placeholders and normalises slashes.\n * Returns only the path — no query string or hash.\n */\nfunction buildPath(\n path: string,\n params?: Record<string, string | string[] | undefined>,\n): string {\n let url = path;\n\n if (params) {\n // Replace [[...param]] — optional catch-all\n url = url.replace(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g, (_, name) => {\n const value = params[name];\n if (value == null) return '';\n if (Array.isArray(value)) {\n return value.map((v) => encodeURIComponent(v)).join('/');\n }\n return encodeURIComponent(String(value));\n });\n\n // Replace [...param] — required catch-all\n url = url.replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, (_, name) => {\n const value = params[name];\n if (value == null) {\n throw new Error(\n `Missing required catch-all param \"${name}\" for path \"${path}\"`,\n );\n }\n if (Array.isArray(value)) {\n if (value.length === 0) {\n throw new Error(\n `Missing required catch-all param \"${name}\" for path \"${path}\"`,\n );\n }\n return value.map((v) => encodeURIComponent(v)).join('/');\n }\n return encodeURIComponent(String(value));\n });\n\n // Replace [param] — dynamic param\n url = url.replace(/\\[([^\\]]+)\\]/g, (_, name) => {\n const value = params[name];\n if (value == null) {\n throw new Error(`Missing required param \"${name}\" for path \"${path}\"`);\n }\n return encodeURIComponent(String(value));\n });\n } else {\n // Strip bracket syntax when no params provided\n url = url.replace(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g, '');\n url = url.replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, '');\n url = url.replace(/\\[([^\\]]+)\\]/g, '');\n }\n\n // Clean up double/trailing slashes\n url = url.replace(/\\/+/g, '/');\n if (url.length > 1 && url.endsWith('/')) {\n url = url.slice(0, -1);\n }\n if (!url.startsWith('/')) {\n url = '/' + url;\n }\n\n return url;\n}\n\n/**\n * Internal URL builder. Separated from `routePath` so it can be\n * used without generic constraints (e.g., in `injectNavigate`).\n */\nexport function buildUrl(path: string, options?: RoutePathOptionsBase): string {\n let url = buildPath(path, options?.params);\n\n if (options?.query) {\n const parts: string[] = [];\n for (const [key, value] of Object.entries(options.query)) {\n if (value === undefined) continue;\n if (Array.isArray(value)) {\n for (const v of value) {\n parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(v)}`);\n }\n } else {\n parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);\n }\n }\n if (parts.length > 0) {\n url += '?' + parts.join('&');\n }\n }\n\n if (options?.hash) {\n url += '#' + options.hash;\n }\n\n return url;\n}\n","import { inject } from '@angular/core';\nimport { type NavigationBehaviorOptions, Router } from '@angular/router';\n\nimport type {\n AnalogRoutePath,\n RoutePathArgs,\n RoutePathOptionsBase,\n} from './route-path';\nimport { buildUrl } from './route-path';\n\ntype NavigateWithExtrasArgs<P extends AnalogRoutePath> =\n RoutePathArgs<P> extends [options?: infer Options]\n ?\n | [extras: NavigationBehaviorOptions]\n | [options: Options | undefined, extras: NavigationBehaviorOptions]\n : [options: RoutePathArgs<P>[0], extras: NavigationBehaviorOptions];\n\ntype TypedNavigate = {\n <P extends AnalogRoutePath>(\n path: P,\n ...args: RoutePathArgs<P>\n ): Promise<boolean>;\n <P extends AnalogRoutePath>(\n path: P,\n ...args: NavigateWithExtrasArgs<P>\n ): Promise<boolean>;\n};\n\nfunction isRoutePathOptionsBase(value: unknown): value is RoutePathOptionsBase {\n return (\n !!value &&\n typeof value === 'object' &&\n ('params' in value || 'query' in value || 'hash' in value)\n );\n}\n\n/**\n * Injects a typed navigate function.\n *\n * @example\n * ```ts\n * const navigate = injectNavigate();\n *\n * navigate('/users/[id]', { params: { id: '42' } }); // ✅\n * navigate('/users/[id]', { params: { id: 42 } }); // ❌ type error\n *\n * // With navigation extras\n * navigate('/users/[id]', { params: { id: '42' } }, { replaceUrl: true });\n * ```\n */\nexport function injectNavigate(): TypedNavigate {\n const router = inject(Router);\n\n const navigate = ((\n path: AnalogRoutePath,\n ...args: unknown[]\n ): Promise<boolean> => {\n let options: RoutePathOptionsBase | undefined;\n let extras: NavigationBehaviorOptions | undefined;\n\n if (args.length > 1) {\n options = args[0] as RoutePathOptionsBase | undefined;\n extras = args[1] as NavigationBehaviorOptions | undefined;\n } else if (args.length === 1) {\n if (isRoutePathOptionsBase(args[0])) {\n options = args[0];\n } else {\n extras = args[0] as NavigationBehaviorOptions;\n }\n }\n\n const url = buildUrl(path as string, options);\n return router.navigateByUrl(url, extras);\n }) as TypedNavigate;\n\n return navigate;\n}\n","import { InjectionToken } from '@angular/core';\nimport type { RouterFeatures } from '@angular/router';\n\n/**\n * Configuration for experimental typed router features.\n *\n * Inspired by TanStack Router's type-safe navigation system where\n * routes are registered globally and all navigation/hooks are typed\n * against the route tree.\n *\n * @experimental\n */\nexport interface TypedRouterOptions {\n /**\n * When true, logs warnings in development when navigating to\n * routes with params that don't match the generated route table.\n *\n * Similar to TanStack Router's strict mode where `useParams()`\n * without a `from` constraint returns a union of all possible params.\n *\n * @default false\n */\n strictRouteParams?: boolean;\n}\n\n/**\n * Configuration for experimental loader caching.\n *\n * Inspired by TanStack Router's built-in data caching where route\n * loaders automatically cache results and support stale-while-revalidate.\n *\n * @experimental\n */\nexport interface LoaderCacheOptions {\n /**\n * Time in milliseconds before loader data is considered stale.\n * While data is fresh, navigating back to the route uses cached\n * data without re-invoking the server load function.\n *\n * Mirrors TanStack Router's `defaultStaleTime` option on `createRouter()`.\n *\n * @default 0 (always re-fetch)\n */\n defaultStaleTime?: number;\n\n /**\n * Time in milliseconds to retain unused loader data in cache\n * after leaving a route. After this period the cached entry is\n * garbage-collected.\n *\n * Mirrors TanStack Router's `defaultGcTime` (default 30 min).\n *\n * @default 300_000 (5 minutes)\n */\n defaultGcTime?: number;\n\n /**\n * Delay in milliseconds before showing a pending/loading indicator\n * during route transitions. Prevents flash-of-loading-state for\n * fast navigations.\n *\n * Mirrors TanStack Router's `defaultPendingMs`.\n *\n * @default 0 (show immediately)\n */\n defaultPendingMs?: number;\n}\n\n// ---------------------------------------------------------------------------\n// DI tokens\n// ---------------------------------------------------------------------------\n\n/** @experimental */\nexport const EXPERIMENTAL_TYPED_ROUTER: InjectionToken<TypedRouterOptions> =\n new InjectionToken<TypedRouterOptions>('EXPERIMENTAL_TYPED_ROUTER');\n\n/** @experimental */\nexport const EXPERIMENTAL_ROUTE_CONTEXT: InjectionToken<\n Record<string, unknown>\n> = new InjectionToken<Record<string, unknown>>('EXPERIMENTAL_ROUTE_CONTEXT');\n\n/** @experimental */\nexport const EXPERIMENTAL_LOADER_CACHE: InjectionToken<LoaderCacheOptions> =\n new InjectionToken<LoaderCacheOptions>('EXPERIMENTAL_LOADER_CACHE');\n\n// ---------------------------------------------------------------------------\n// Provider feature functions (passed to provideFileRouter)\n// ---------------------------------------------------------------------------\n\n/**\n * Enables experimental typed router features.\n *\n * When active, `routePath()`, `injectNavigate()`, `injectParams()`,\n * and `injectQuery()` will enforce route table constraints and\n * optionally log warnings in strict mode.\n *\n * Inspired by TanStack Router's `Register` interface and strict type\n * checking across the entire navigation surface.\n *\n * @example\n * ```ts\n * provideFileRouter(\n * withTypedRouter({ strictRouteParams: true }),\n * )\n * ```\n *\n * @experimental\n */\nexport function withTypedRouter(options?: TypedRouterOptions): RouterFeatures {\n return {\n ɵkind: 102 as number,\n ɵproviders: [\n {\n provide: EXPERIMENTAL_TYPED_ROUTER,\n useValue: { strictRouteParams: false, ...options },\n },\n ],\n };\n}\n\n/**\n * Provides root-level route context available to all route loaders\n * and components via `injectRouteContext()`.\n *\n * Inspired by TanStack Router's `createRootRouteWithContext<T>()` where\n * a typed context object is required at router creation and automatically\n * available in every route's `beforeLoad` and `loader`.\n *\n * In Angular terms, this creates a DI token that server-side load\n * functions and components can inject to access shared services\n * without importing them individually.\n *\n * @example\n * ```ts\n * // app.config.ts\n * provideFileRouter(\n * withRouteContext({\n * auth: inject(AuthService),\n * db: inject(DatabaseService),\n * }),\n * )\n *\n * // In a component\n * const ctx = injectRouteContext<{ auth: AuthService; db: DatabaseService }>();\n * ```\n *\n * @experimental\n */\nexport function withRouteContext<T extends Record<string, unknown>>(\n context: T,\n): RouterFeatures {\n return {\n ɵkind: 103 as number,\n ɵproviders: [\n {\n provide: EXPERIMENTAL_ROUTE_CONTEXT,\n useValue: context,\n },\n ],\n };\n}\n\n/**\n * Configures experimental loader caching behavior for server-loaded\n * route data.\n *\n * Inspired by TanStack Router's built-in cache where `createRouter()`\n * accepts `defaultStaleTime` and `defaultGcTime` to control when\n * loaders re-execute and when cached data is discarded.\n *\n * @example\n * ```ts\n * provideFileRouter(\n * withLoaderCaching({\n * defaultStaleTime: 30_000, // 30s before re-fetch\n * defaultGcTime: 300_000, // 5min cache retention\n * defaultPendingMs: 200, // 200ms loading delay\n * }),\n * )\n * ```\n *\n * @experimental\n */\nexport function withLoaderCaching(\n options?: LoaderCacheOptions,\n): RouterFeatures {\n return {\n ɵkind: 104 as number,\n ɵproviders: [\n {\n provide: EXPERIMENTAL_LOADER_CACHE,\n useValue: {\n defaultStaleTime: 0,\n defaultGcTime: 300_000,\n defaultPendingMs: 0,\n ...options,\n },\n },\n ],\n };\n}\n","import { inject, Injector, isDevMode, Signal } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { map, take } from 'rxjs';\n\nimport type {\n AnalogRoutePath,\n RouteParamsOutput,\n RouteQueryOutput,\n} from './route-path';\nimport { EXPERIMENTAL_TYPED_ROUTER } from './experimental';\n\nfunction extractRouteParams(\n routePath: string,\n): { name: string; type: 'dynamic' | 'catchAll' | 'optionalCatchAll' }[] {\n const params: {\n name: string;\n type: 'dynamic' | 'catchAll' | 'optionalCatchAll';\n }[] = [];\n for (const match of routePath.matchAll(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g)) {\n params.push({ name: match[1], type: 'optionalCatchAll' });\n }\n for (const match of routePath.matchAll(/(?<!\\[)\\[\\.\\.\\.([^\\]]+)\\](?!\\])/g)) {\n params.push({ name: match[1], type: 'catchAll' });\n }\n for (const match of routePath.matchAll(/(?<!\\[)\\[(?!\\.)([^\\]]+)\\](?!\\])/g)) {\n params.push({ name: match[1], type: 'dynamic' });\n }\n return params;\n}\n\n/**\n * When `strictRouteParams` is enabled, warns if expected params from the\n * `_from` pattern are missing from the active `ActivatedRoute`.\n */\nfunction assertRouteMatch(\n from: string,\n route: ActivatedRoute,\n kind: 'injectParams' | 'injectQuery',\n): void {\n const expectedParams = extractRouteParams(from)\n .filter((param) => param.type === 'dynamic' || param.type === 'catchAll')\n .map((param) => param.name);\n\n if (expectedParams.length === 0) return;\n\n route.params.pipe(take(1)).subscribe((params) => {\n for (const name of expectedParams) {\n if (!(name in params)) {\n console.warn(\n `[Analog] ${kind}('${from}'): expected param \"${name}\" ` +\n `is not present in the active route's params. ` +\n `Ensure this hook is used inside a component rendered by '${from}'.`,\n );\n break;\n }\n }\n });\n}\n\n/**\n * Injects typed route params as a signal, constrained by the route table.\n *\n * Inspired by TanStack Router's `useParams({ from: '/users/$userId' })`\n * pattern where the `from` parameter narrows the return type to only\n * the params defined for that route.\n *\n * The `from` parameter is used purely for TypeScript type inference —\n * at runtime, params are read from the current `ActivatedRoute`. This\n * means it works correctly when used inside a component rendered by\n * the specified route.\n *\n * When `withTypedRouter({ strictRouteParams: true })` is configured,\n * a dev-mode assertion checks that the expected params from `from`\n * exist in the active route and warns on mismatch.\n *\n * @example\n * ```ts\n * // In a component rendered at /users/[id]\n * const params = injectParams('/users/[id]');\n * // params() → { id: string }\n *\n * // With schema validation output types\n * const params = injectParams('/products/[slug]');\n * // params() → validated output type from routeParamsSchema\n * ```\n *\n * @experimental\n */\nexport function injectParams<P extends AnalogRoutePath>(\n _from: P,\n options?: { injector?: Injector },\n): Signal<RouteParamsOutput<P>> {\n const injector = options?.injector;\n const route = injector\n ? injector.get(ActivatedRoute)\n : inject(ActivatedRoute);\n\n if (isDevMode()) {\n const config = injector\n ? injector.get(EXPERIMENTAL_TYPED_ROUTER, null)\n : inject(EXPERIMENTAL_TYPED_ROUTER, { optional: true });\n\n if (config?.strictRouteParams) {\n assertRouteMatch(_from, route, 'injectParams');\n }\n }\n\n return toSignal(\n route.params.pipe(map((params) => params as RouteParamsOutput<P>)),\n { requireSync: true },\n );\n}\n\n/**\n * Injects typed route query params as a signal, constrained by the\n * route table.\n *\n * Inspired by TanStack Router's `useSearch({ from: '/issues' })` pattern\n * where search params are validated and typed per-route via\n * `validateSearch` schemas.\n *\n * In Analog, the typing comes from `routeQuerySchema` exports that are\n * detected at build time and recorded in the generated route table.\n *\n * The `from` parameter is used purely for TypeScript type inference.\n * When `withTypedRouter({ strictRouteParams: true })` is configured,\n * a dev-mode assertion checks that the expected params from `from`\n * exist in the active route and warns on mismatch.\n *\n * @example\n * ```ts\n * // In a component rendered at /issues\n * // (where routeQuerySchema validates { page: number, status: string })\n * const query = injectQuery('/issues');\n * // query() → { page: number; status: string }\n * ```\n *\n * @experimental\n */\nexport function injectQuery<P extends AnalogRoutePath>(\n _from: P,\n options?: { injector?: Injector },\n): Signal<RouteQueryOutput<P>> {\n const injector = options?.injector;\n const route = injector\n ? injector.get(ActivatedRoute)\n : inject(ActivatedRoute);\n\n if (isDevMode()) {\n const config = injector\n ? injector.get(EXPERIMENTAL_TYPED_ROUTER, null)\n : inject(EXPERIMENTAL_TYPED_ROUTER, { optional: true });\n\n if (config?.strictRouteParams) {\n assertRouteMatch(_from, route, 'injectQuery');\n }\n }\n\n return toSignal(\n route.queryParams.pipe(map((params) => params as RouteQueryOutput<P>)),\n { requireSync: true },\n );\n}\n","import { inject } from '@angular/core';\n\nimport { EXPERIMENTAL_ROUTE_CONTEXT } from './experimental';\n\n/**\n * Injects the root route context provided via `withRouteContext()`.\n *\n * Inspired by TanStack Router's context inheritance where\n * `createRootRouteWithContext<T>()` makes a typed context available\n * to every route's `beforeLoad` and `loader` callbacks.\n *\n * In Angular, this uses DI under the hood — `withRouteContext(ctx)`\n * provides the value, and `injectRouteContext<T>()` retrieves it\n * with the expected type.\n *\n * @example\n * ```ts\n * // app.config.ts\n * provideFileRouter(\n * withRouteContext({\n * auth: inject(AuthService),\n * analytics: inject(AnalyticsService),\n * }),\n * )\n *\n * // any-page.page.ts\n * const ctx = injectRouteContext<{\n * auth: AuthService;\n * analytics: AnalyticsService;\n * }>();\n * ctx.analytics.trackPageView();\n * ```\n *\n * @experimental\n */\nexport function injectRouteContext<\n T extends Record<string, unknown> = Record<string, unknown>,\n>(): T {\n return inject(EXPERIMENTAL_ROUTE_CONTEXT) as T;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAa,mBAAmB,UAA4C;AAC1E,QAAO;;;;;;;AAQT,IAAa,qBAA6B;AACxC,QAAO,OAAO,OAAO;;;;;;;AAQvB,IAAa,6BAA6C;AACxD,QAAO,OAAO,eAAe;;;;ACvD/B,SAAgB,kBACd,KACA,MACA,WAAmB,OAAO,YAAY,EACtC,gBAAsC,eAAe,EACrB;AAChC,KAAI,iBAAiB,SAAS,IAAI,IAAI,IAAI,SAAS,YAAc,EAAA;EAC3D,IAAA,UAAc,IAAA,aAAa;EACzB,MAAA,UAAU,eAAe,QAAQ;AACvC,YAAU,QAAY,IAAA,UAAU,WAAc,GAAA;AAQ9C,SAAY,KANe,IAAM,MAC/B,EAGK,SACF,CAAA,CACW;;;;;ACJpB,SAAgB,4BACd,GAAG,UACmB;CACtB,MAAM,qBAAqB,SAAS,QAAQ,SAAS,KAAK,SAAS,IAAI;CACvE,MAAM,iBAAiB,SAAS,QAAQ,SAAS,KAAK,QAAQ,IAAI;;EAmD5D,mBACM,KAAA,QAAA,IAAA,WACL;EACD,cATE,EAAO,EAYN,GAAA,eAAA;EAEC;GACI,SAAA;GACD,OAAM;GACJ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ACX;AAGJ,KAAI,WAAQ;OACO,WAAA,SAAA,IAAA,2BAAA,KAAA,GAAA,OAAA,2BAAA,EAAA,UAAA,MAAA,CAAA,GAKnB,kBAAA,kBAAA,OAAA,OAAA,cAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC7HJ,SAAgB,qBAET;AACL,QAAO,OAAO,2BAA2B"}
1
+ {"version":3,"file":"analogjs-router.mjs","names":[],"sources":["../../src/lib/define-route.ts","../../src/lib/cookie-interceptor.ts","../../src/lib/provide-file-router-base.ts","../../src/lib/provide-file-router.ts","../../src/lib/inject-load.ts","../../src/lib/get-load-resolver.ts","../../src/lib/cache-key.ts","../../src/lib/request-context.ts","../../src/lib/form-action.directive.ts","../../src/lib/debug/index.ts","../../src/lib/server.component.ts","../../src/lib/validation-errors.ts","../../src/lib/route-path.ts","../../src/lib/inject-navigate.ts","../../src/lib/experimental.ts","../../src/lib/inject-typed-params.ts","../../src/lib/inject-route-context.ts"],"sourcesContent":["import { inject } from '@angular/core';\nimport { Route as NgRoute, Router } from '@angular/router';\nimport { ActivatedRoute } from '@angular/router';\n\nimport { AnalogJsonLdDocument } from './json-ld';\nimport { MetaTag } from './meta-tags';\n\ntype RouteOmitted =\n | 'component'\n | 'loadComponent'\n | 'loadChildren'\n | 'path'\n | 'pathMatch';\n\ntype RestrictedRoute = Omit<NgRoute, RouteOmitted> & {\n meta?: MetaTag[];\n jsonLd?: AnalogJsonLdDocument;\n};\n\n/**\n * @deprecated Use `RouteMeta` type instead.\n * For more info see: https://github.com/analogjs/analog/issues/223\n *\n * Defines additional route config metadata. This\n * object is merged into the route config with\n * the predefined file-based route.\n *\n * @usageNotes\n *\n * ```\n * import { Component } from '@angular/core';\n * import { defineRouteMeta } from '@analogjs/router';\n *\n * export const routeMeta = defineRouteMeta({\n * title: 'Welcome'\n * });\n *\n * @Component({\n * template: `Home`,\n * standalone: true,\n * })\n * export default class HomeComponent {}\n * ```\n *\n * @param route\n * @returns\n */\nexport const defineRouteMeta = (route: RestrictedRoute): RestrictedRoute => {\n return route;\n};\n\n/**\n * Returns the instance of Angular Router\n *\n * @returns The router\n */\nexport const injectRouter = (): Router => {\n return inject(Router);\n};\n\n/**\n * Returns the instance of the Activate Route for the component\n *\n * @returns The activated route\n */\nexport const injectActivatedRoute = (): ActivatedRoute => {\n return inject(ActivatedRoute);\n};\n","import { isPlatformServer } from '@angular/common';\nimport {\n HttpHandlerFn,\n HttpHeaders,\n HttpRequest,\n HttpEvent,\n} from '@angular/common/http';\nimport { PLATFORM_ID, inject } from '@angular/core';\nimport { Observable } from 'rxjs';\nimport { injectRequest, ServerRequest } from '@analogjs/router/tokens';\n\nexport function cookieInterceptor(\n req: HttpRequest<unknown>,\n next: HttpHandlerFn,\n location: object = inject(PLATFORM_ID),\n serverRequest: ServerRequest | null = injectRequest(),\n): Observable<HttpEvent<unknown>> {\n if (isPlatformServer(location) && req.url.includes('/_analog/')) {\n let headers = new HttpHeaders();\n const cookies = serverRequest?.headers.cookie;\n headers = headers.set('cookie', cookies ?? '');\n\n const cookiedRequest = req.clone({\n headers,\n });\n\n return next(cookiedRequest);\n } else {\n return next(req);\n }\n}\n","import {\n EnvironmentProviders,\n inject,\n makeEnvironmentProviders,\n provideAppInitializer,\n} from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport { ɵHTTP_ROOT_INTERCEPTOR_FNS as HTTP_ROOT_INTERCEPTOR_FNS } from '@angular/common/http';\nimport { Meta } from '@angular/platform-browser';\nimport { provideRouter, RouterFeatures, ROUTES, Routes } from '@angular/router';\nimport { Router } from '@angular/router';\nimport { API_PREFIX } from '@analogjs/router/tokens';\n\nimport { cookieInterceptor } from './cookie-interceptor';\nimport { updateJsonLdOnRouteChange } from './json-ld';\nimport { updateMetaTagsOnRouteChange } from './meta-tags';\nimport { createRoutes as createBaseRoutes } from './route-builder';\nimport {\n ANALOG_ROUTE_FILES,\n ANALOG_EXTRA_ROUTE_FILE_SOURCES,\n ANALOG_CONTENT_FILE_COUNT,\n type ExtraRouteFileSource,\n} from './route-files';\nimport type { RouteExport } from './models';\n\ndeclare const ANALOG_API_PREFIX: string;\n\nexport function provideFileRouterWithRoutes(\n ...features: RouterFeatures[]\n): EnvironmentProviders {\n const extraRoutesFeature = features.filter((feat) => feat.ɵkind >= 100);\n const routerFeatures = features.filter((feat) => feat.ɵkind < 100);\n\n // Automatically register the debug route viewer during development.\n // Navigating to /__analog/routes shows all registered page and content\n // routes. The import.meta.env.DEV guard ensures the debug page and its\n // component are tree-shaken from production builds.\n //\n // The debug route is passed directly to provideRouter() so it takes\n // priority over file-based catch-all routes like [...slug]. ROUTES\n // multi-providers are concatenated after provideRouter's initial routes,\n // so a catch-all in file routes would shadow an __analog/* ROUTES entry.\n const debugRoutes: Routes = import.meta.env.DEV\n ? [\n {\n path: '__analog/routes',\n loadComponent: () => import('./debug/debug.page'),\n },\n ]\n : [];\n\n return makeEnvironmentProviders([\n extraRoutesFeature.map((erf) => erf.ɵproviders),\n provideRouter(debugRoutes, ...routerFeatures),\n {\n provide: ROUTES,\n multi: true,\n useFactory: () => {\n const extraSources =\n inject(ANALOG_EXTRA_ROUTE_FILE_SOURCES, { optional: true }) ?? [];\n\n if (\n import.meta.env.DEV &&\n extraSources.length === 0 &&\n ANALOG_CONTENT_FILE_COUNT > 0\n ) {\n console.warn(\n `[Analog] ${ANALOG_CONTENT_FILE_COUNT} content route file(s) ` +\n `discovered but withContentRoutes() is not configured. ` +\n `Content routes will not be registered.\\n\\n` +\n ` import { withContentRoutes } from '@analogjs/router/content';\\n` +\n ` provideFileRouter(withContentRoutes())\\n`,\n );\n }\n\n if (extraSources.length === 0) {\n return createBaseRoutes(\n ANALOG_ROUTE_FILES as Record<string, () => Promise<RouteExport>>,\n (_filename, fileLoader) => fileLoader as () => Promise<RouteExport>,\n );\n }\n\n const allFiles: Record<string, () => Promise<unknown>> = {\n ...(ANALOG_ROUTE_FILES as Record<string, () => Promise<unknown>>),\n };\n const resolverMap = new Map<\n string,\n ExtraRouteFileSource['resolveModule']\n >();\n\n if (import.meta.env.DEV) {\n const pageKeys = new Set(Object.keys(ANALOG_ROUTE_FILES));\n for (const source of extraSources) {\n for (const key of Object.keys(source.files)) {\n if (pageKeys.has(key)) {\n console.warn(\n `[Analog] Route file \"${key}\" is registered by both page ` +\n `routes and content routes. The content route resolver ` +\n `will be used for this file.`,\n );\n }\n }\n }\n }\n\n for (const source of extraSources) {\n for (const [key, loader] of Object.entries(source.files)) {\n allFiles[key] = loader as () => Promise<unknown>;\n resolverMap.set(key, source.resolveModule);\n }\n }\n\n return createBaseRoutes(allFiles, (filename, fileLoader) => {\n const resolver = resolverMap.get(filename);\n return resolver\n ? resolver(filename, fileLoader)\n : (fileLoader as () => Promise<RouteExport>);\n });\n },\n },\n provideAppInitializer(() => {\n const router = inject(Router);\n const meta = inject(Meta);\n const document = inject(DOCUMENT, { optional: true });\n\n updateMetaTagsOnRouteChange(router, meta);\n updateJsonLdOnRouteChange(router, document);\n }),\n {\n provide: HTTP_ROOT_INTERCEPTOR_FNS,\n multi: true,\n useValue: cookieInterceptor,\n },\n {\n provide: API_PREFIX,\n useFactory() {\n return typeof ANALOG_API_PREFIX !== 'undefined'\n ? ANALOG_API_PREFIX\n : 'api';\n },\n },\n ]);\n}\n\nexport function withExtraRoutes(routes: Routes): RouterFeatures {\n return {\n ɵkind: 100 as number,\n ɵproviders: [{ provide: ROUTES, useValue: routes, multi: true }],\n };\n}\n","import { EnvironmentProviders } from '@angular/core';\nimport { RouterFeatures } from '@angular/router';\n\nimport { provideFileRouterWithRoutes } from './provide-file-router-base';\n\n/**\n * Sets up providers for the Angular router, and registers\n * file-based routes. Additional features can be provided\n * to further configure the behavior of the router.\n *\n * @param features\n * @returns Providers and features to configure the router with routes\n */\nexport function provideFileRouter(\n ...features: RouterFeatures[]\n): EnvironmentProviders {\n return provideFileRouterWithRoutes(...features);\n}\n\nexport { withExtraRoutes } from './provide-file-router-base';\n","import { Injector, inject } from '@angular/core';\nimport { ActivatedRoute, Data } from '@angular/router';\nimport { Observable, map } from 'rxjs';\n\nimport { LoadDataResult, PageServerLoad } from './route-types';\n\nfunction isResponse(value: unknown): value is Response {\n return typeof value === 'object' && value instanceof Response;\n}\n\nexport function injectLoad<\n T extends (pageServerLoad: PageServerLoad) => Promise<unknown>,\n>(options?: { injector?: Injector }): Observable<Awaited<ReturnType<T>>> {\n const injector = options?.injector ?? inject(Injector);\n const route = injector.get(ActivatedRoute);\n\n return route.data.pipe(\n map<Data, Awaited<ReturnType<T>>>((data) => data['load']),\n );\n}\n\nexport function injectLoadData<\n T extends (pageServerLoad: PageServerLoad) => Promise<unknown>,\n>(options?: { injector?: Injector }): Observable<LoadDataResult<T>> {\n return injectLoad<T>(options).pipe(\n map((result): LoadDataResult<T> => {\n if (isResponse(result)) {\n throw new Error('Expected page load data but received a response.');\n }\n\n return result as LoadDataResult<T>;\n }),\n );\n}\n","import { ActivatedRouteSnapshot } from '@angular/router';\n\n/**\n * Get server load resolver data for the route\n *\n * @param route Provides the route to get server load resolver\n * @returns Returns server load resolver data for the route\n */\nexport async function getLoadResolver<T>(\n route: ActivatedRouteSnapshot,\n): Promise<T> {\n return route.routeConfig?.resolve?.['load']?.(route);\n}\n","import { HttpParams, HttpRequest } from '@angular/common/http';\nimport { StateKey, makeStateKey } from '@angular/core';\n\nfunction sortAndConcatParams(params: HttpParams | URLSearchParams): string {\n return [...params.keys()]\n .sort()\n .map((k) => `${k}=${params.getAll(k)}`)\n .join('&');\n}\n\nexport function makeCacheKey(\n request: HttpRequest<unknown>,\n mappedRequestUrl: string,\n): StateKey<unknown> {\n // make the params encoded same as a url so it's easy to identify\n const { params, method, responseType } = request;\n const encodedParams = sortAndConcatParams(params);\n\n let serializedBody = request.serializeBody();\n if (serializedBody instanceof URLSearchParams) {\n serializedBody = sortAndConcatParams(serializedBody);\n } else if (typeof serializedBody !== 'string') {\n serializedBody = '';\n }\n\n const key = [\n method,\n responseType,\n mappedRequestUrl,\n serializedBody,\n encodedParams,\n ].join('|');\n\n const hash = generateHash(key);\n\n return makeStateKey(hash);\n}\n\nfunction generateHash(str: string) {\n let hash = 0;\n for (let i = 0, len = str.length; i < len; i++) {\n const chr = str.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0; // Convert to 32bit integer\n }\n return `${hash}`;\n}\n","import { TransferState, inject, makeStateKey } from '@angular/core';\nimport {\n HttpEvent,\n HttpHandlerFn,\n HttpHeaders,\n HttpRequest,\n HttpResponse,\n} from '@angular/common/http';\n\nimport { from, Observable, of } from 'rxjs';\n\nimport type { HTTPMethod } from 'nitro/h3';\n\nimport {\n injectBaseURL,\n injectAPIPrefix,\n injectInternalServerFetch,\n type ServerInternalFetch,\n} from '@analogjs/router/tokens';\n\nimport { makeCacheKey } from './cache-key';\n\n/**\n * Interceptor that is server-aware when making HttpClient requests.\n * Server-side requests use the full URL\n * Prerendering uses the internal Nitro $fetch function, along with state transfer\n * Client-side requests use the window.location.origin\n *\n * @param req HttpRequest<unknown>\n * @param next HttpHandlerFn\n * @returns\n */\nexport function requestContextInterceptor(\n req: HttpRequest<unknown>,\n next: HttpHandlerFn,\n): Observable<HttpEvent<unknown>> {\n const apiPrefix = injectAPIPrefix();\n const baseUrl = injectBaseURL();\n const transferState = inject(TransferState);\n const nitroGlobal = globalThis as typeof globalThis & {\n $fetch?: ServerInternalFetch;\n };\n const internalFetch = injectInternalServerFetch();\n const serverFetch = internalFetch ?? nitroGlobal.$fetch;\n\n // during prerendering with Nitro\n if (\n serverFetch &&\n baseUrl &&\n (req.url.startsWith('/') ||\n req.url.startsWith(baseUrl) ||\n req.url.startsWith(`/${apiPrefix}`))\n ) {\n const requestUrl = new URL(req.url, baseUrl);\n const cacheKey = makeCacheKey(req, new URL(requestUrl).pathname);\n const storeKey = makeStateKey<unknown>(`analog_${cacheKey}`);\n const fetchUrl = requestUrl.pathname;\n\n const responseType =\n req.responseType === 'arraybuffer' ? 'arrayBuffer' : req.responseType;\n\n return from<Promise<HttpResponse<unknown>>>(\n serverFetch\n .raw(fetchUrl, {\n method: req.method as HTTPMethod,\n body: req.body ? req.body : undefined,\n params: requestUrl.searchParams,\n responseType,\n headers: req.headers\n .keys()\n .reduce((hdrs: Record<string, string>, current: string) => {\n const value = req.headers.get(current);\n return value != null ? { ...hdrs, [current]: value } : hdrs;\n }, {}),\n })\n .then((res) => {\n const cacheResponse = {\n body: res._data,\n headers: new HttpHeaders(res.headers),\n status: res.status ?? 200,\n statusText: res.statusText ?? 'OK',\n url: fetchUrl,\n };\n const transferResponse = new HttpResponse(cacheResponse);\n\n transferState.set(storeKey, cacheResponse);\n return transferResponse;\n }),\n );\n }\n\n // on the client\n if (\n !import.meta.env.SSR &&\n (req.url.startsWith('/') || req.url.includes('/_analog/'))\n ) {\n // /_analog/ requests are full URLs\n const requestUrl = req.url.includes('/_analog/')\n ? req.url\n : `${window.location.origin}${req.url}`;\n const cacheKey = makeCacheKey(req, new URL(requestUrl).pathname);\n const storeKey = makeStateKey<unknown>(`analog_${cacheKey}`);\n const cacheRestoreResponse = transferState.get(storeKey, null);\n\n if (cacheRestoreResponse) {\n transferState.remove(storeKey);\n return of(new HttpResponse(cacheRestoreResponse));\n }\n\n return next(\n req.clone({\n url: requestUrl,\n }),\n );\n }\n\n // on the server\n if (baseUrl && (req.url.startsWith('/') || req.url.startsWith(baseUrl))) {\n const requestUrl =\n req.url.startsWith(baseUrl) && !req.url.startsWith('/')\n ? req.url\n : `${baseUrl}${req.url}`;\n\n return next(\n req.clone({\n url: requestUrl,\n }),\n );\n }\n\n return next(req);\n}\n","import {\n Directive,\n inject,\n input,\n output,\n signal,\n type InputSignal,\n type OutputEmitterRef,\n type WritableSignal,\n} from '@angular/core';\nimport { ActivatedRoute, Router } from '@angular/router';\n\nimport { injectRouteEndpointURL } from './inject-route-endpoint-url';\n\nexport type FormActionState =\n | 'submitting'\n | 'error'\n | 'redirect'\n | 'success'\n | 'navigate';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: 'form[action],form[method]',\n host: {\n '(submit)': `submitted($event)`,\n '[attr.data-state]': 'currentState()',\n '[attr.aria-busy]': 'currentState() === \"submitting\" ? \"true\" : null',\n },\n standalone: true,\n})\nexport class FormAction {\n action: InputSignal<string> = input<string>('');\n // eslint-disable-next-line @angular-eslint/no-output-on-prefix\n onSuccess: OutputEmitterRef<unknown> = output<unknown>();\n // eslint-disable-next-line @angular-eslint/no-output-on-prefix\n onError: OutputEmitterRef<unknown> = output<unknown>();\n state: OutputEmitterRef<FormActionState> = output<FormActionState>();\n private router = inject(Router);\n private route = inject(ActivatedRoute);\n protected currentState: WritableSignal<FormActionState | 'idle'> = signal<\n FormActionState | 'idle'\n >('idle');\n /** Cached during construction (injection context) so inject() works. */\n private _endpointUrl = this.route\n ? injectRouteEndpointURL(this.route.snapshot)\n : undefined;\n\n submitted($event: SubmitEvent): void {\n $event.preventDefault();\n\n const form = $event.target as HTMLFormElement;\n this._emitState('submitting');\n const body = new FormData(form);\n\n if (form.method.toUpperCase() === 'GET') {\n this._handleGet(body, this._getGetPath(form));\n } else {\n this._handlePost(body, this._getPostPath(form), form.method);\n }\n }\n\n private _handleGet(body: FormData, path: string) {\n const url = new URL(path, window.location.href);\n const params = new URLSearchParams(url.search);\n body.forEach((value, key) => {\n params.append(key, value instanceof File ? value.name : value);\n });\n url.search = params.toString();\n\n this._emitState('navigate');\n this._navigateTo(url);\n }\n\n private _handlePost(body: FormData, path: string, method: string) {\n fetch(path, {\n method,\n body,\n })\n .then((res) => {\n if (res.ok) {\n if (res.redirected) {\n this._emitState('redirect');\n this._navigateTo(new URL(res.url, window.location.href));\n } else if (this._isJSON(res.headers.get('Content-type'))) {\n res.json().then((result) => {\n this.onSuccess.emit(result);\n this._emitState('success');\n });\n } else {\n res.text().then((result) => {\n this.onSuccess.emit(result);\n this._emitState('success');\n });\n }\n } else {\n if (res.headers.get('X-Analog-Errors')) {\n res.json().then((errors: unknown) => {\n this.onError.emit(errors);\n this._emitState('error');\n });\n } else {\n this._emitState('error');\n }\n }\n })\n .catch((_) => {\n this._emitState('error');\n });\n }\n\n private _getExplicitAction(form: HTMLFormElement) {\n const explicitAction =\n this.action().trim() || form.getAttribute('action')?.trim();\n return explicitAction || undefined;\n }\n\n private _getGetPath(form: HTMLFormElement) {\n return this._getExplicitAction(form) ?? this.router.url;\n }\n\n private _getPostPath(form: HTMLFormElement) {\n const explicitAction = this._getExplicitAction(form);\n if (explicitAction) {\n return new URL(explicitAction, window.location.href).toString();\n }\n\n if (this._endpointUrl) {\n return this._endpointUrl.pathname;\n }\n\n return `/api/_analog/pages${window.location.pathname}`;\n }\n\n private _emitState(state: FormActionState) {\n this.currentState.set(state);\n this.state.emit(state);\n }\n\n private _navigateTo(url: URL) {\n if (url.origin === window.location.origin) {\n void this.router.navigateByUrl(\n `${url.pathname}${url.search}${url.hash}`,\n {\n onSameUrlNavigation: 'reload',\n },\n );\n return;\n }\n\n window.location.assign(url.toString());\n }\n\n private _isJSON(contentType: string | null): boolean {\n const mime = contentType ? contentType.split(';') : [];\n const essence = mime[0];\n\n return essence === 'application/json';\n }\n}\n","import { EnvironmentProviders, Provider } from '@angular/core';\nimport { ROUTES } from '@angular/router';\n\n/**\n * Provides routes that provide additional\n * pages for displaying and debugging\n * routes.\n */\nexport function withDebugRoutes(): {\n ɵkind: number;\n ɵproviders: (Provider | EnvironmentProviders)[];\n} {\n const routes = [\n {\n path: '__analog/routes',\n loadComponent: () => import('./debug.page'),\n },\n ];\n\n return {\n ɵkind: 101 as number,\n ɵproviders: [{ provide: ROUTES, useValue: routes, multi: true }],\n };\n}\n","import {\n HttpClient,\n HttpHeaders,\n HttpRequest,\n HttpResponse,\n} from '@angular/common/http';\nimport {\n ChangeDetectionStrategy,\n Component,\n effect,\n inject,\n input,\n InputSignal,\n makeStateKey,\n output,\n OutputEmitterRef,\n signal,\n TransferState,\n WritableSignal,\n} from '@angular/core';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { ActivatedRoute } from '@angular/router';\nimport { injectBaseURL } from '@analogjs/router/tokens';\nimport { catchError, map, of, throwError } from 'rxjs';\n\nimport { makeCacheKey } from './cache-key';\n\ntype ServerProps = Record<string, any>;\ntype ServerOutputs = Record<string, any>;\n\n/**\n * @description\n * Component that defines the bridge between the client and server-only\n * components. The component passes the component ID and props to the server\n * and retrieves the rendered HTML and outputs from the server-only component.\n *\n * Status: experimental\n */\n@Component({\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'server-only,ServerOnly,Server',\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: ` <div [innerHTML]=\"content()\"></div> `,\n})\nexport class ServerOnly {\n component: InputSignal<string> = input.required<string>();\n props: InputSignal<ServerProps | undefined> = input<ServerProps>();\n outputs: OutputEmitterRef<ServerOutputs> = output<ServerOutputs>();\n private http: HttpClient = inject(HttpClient);\n private sanitizer: DomSanitizer = inject(DomSanitizer);\n protected content: WritableSignal<SafeHtml> = signal<SafeHtml>('');\n private route: ActivatedRoute | null = inject(ActivatedRoute, {\n optional: true,\n });\n private baseURL: string | null = injectBaseURL();\n private transferState = inject(TransferState);\n\n constructor() {\n effect(() => {\n const routeComponentId: string | undefined =\n this.route?.snapshot.data['component'];\n const props = this.props() || {};\n const componentId = routeComponentId || this.component();\n\n const headers = new HttpHeaders(\n new Headers({\n 'Content-type': 'application/json',\n 'X-Analog-Component': componentId,\n }),\n );\n\n const componentUrl = this.getComponentUrl(componentId);\n const httpRequest = new HttpRequest('POST', componentUrl, props, {\n headers,\n });\n const cacheKey = makeCacheKey(\n httpRequest,\n new URL(componentUrl).pathname,\n );\n const storeKey = makeStateKey<{ html: string; outputs: ServerOutputs }>(\n cacheKey,\n );\n const componentState = this.transferState.get<{\n html: string;\n outputs: ServerOutputs;\n } | null>(storeKey, null);\n\n if (componentState) {\n this.updateContent(componentState);\n this.transferState.remove(storeKey);\n } else {\n this.http\n .request(httpRequest)\n .pipe(\n map((response) => {\n if (response instanceof HttpResponse) {\n if (import.meta.env.SSR) {\n this.transferState.set(storeKey, response.body);\n }\n\n return response.body as {\n html: string;\n outputs: ServerOutputs;\n };\n }\n return throwError(\n () => ({}) as { html: string; outputs: ServerOutputs },\n );\n }),\n catchError((error: unknown) => {\n console.log(error);\n return of({\n html: '',\n outputs: {} as ServerOutputs,\n });\n }),\n )\n .subscribe((content) =>\n this.updateContent(\n content as { html: string; outputs: ServerOutputs },\n ),\n );\n }\n });\n }\n\n updateContent(content: { html: string; outputs: ServerOutputs }): void {\n this.content.set(this.sanitizer.bypassSecurityTrustHtml(content.html));\n this.outputs.emit(content.outputs);\n }\n\n getComponentUrl(componentId: string) {\n let baseURL = this.baseURL;\n\n if (!baseURL && typeof window !== 'undefined') {\n baseURL = window.location.origin;\n }\n\n return `${baseURL}/_analog/components/${componentId}`;\n }\n}\n","import type { StandardSchemaV1 } from '@standard-schema/spec';\n\nexport type ValidationFieldErrors = Record<string, string[]>;\n\nfunction getPathSegmentKey(\n segment: string | number | symbol | { key: string | number | symbol },\n) {\n return typeof segment === 'object' ? segment.key : segment;\n}\n\nexport function issuePathToFieldName(\n path: ReadonlyArray<\n string | number | symbol | { key: string | number | symbol }\n >,\n): string {\n return path.map((segment) => String(getPathSegmentKey(segment))).join('.');\n}\n\nexport function issuesToFieldErrors(\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n): ValidationFieldErrors {\n return issues.reduce<ValidationFieldErrors>((errors, issue) => {\n if (!issue.path?.length) {\n return errors;\n }\n\n const fieldName = issuePathToFieldName(issue.path);\n errors[fieldName] ??= [];\n errors[fieldName].push(issue.message);\n return errors;\n }, {});\n}\n\nexport function issuesToFormErrors(\n issues: ReadonlyArray<StandardSchemaV1.Issue>,\n): string[] {\n return issues\n .filter((issue) => !issue.path?.length)\n .map((issue) => issue.message);\n}\n","/**\n * Typed route path utilities for Analog.\n *\n * This module provides:\n * - The `AnalogRouteTable` base interface (augmented by generated code)\n * - The `AnalogRoutePath` union type\n * - The `routePath()` URL builder function\n *\n * No Angular dependencies — can be used in any context.\n */\n\n/**\n * Base interface for the typed route table.\n *\n * This interface is augmented by generated code in `src/routeTree.gen.ts`.\n * When no routes are generated, it is empty and `AnalogRoutePath` falls\n * back to `string`.\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface, @typescript-eslint/no-empty-object-type\nexport interface AnalogRouteTable {}\n\n/**\n * Union of all valid route paths.\n *\n * When routes are generated, this is a string literal union.\n * When no routes are generated, this falls back to `string`.\n */\nexport type AnalogRoutePath = keyof AnalogRouteTable extends never\n ? string\n : Extract<keyof AnalogRouteTable, string>;\n\n/**\n * Options for building a route URL.\n */\nexport interface RoutePathOptionsBase {\n params?: Record<string, string | string[] | undefined>;\n query?: Record<string, string | string[] | undefined>;\n hash?: string;\n}\n\n/**\n * Extracts the validated output type for route params.\n *\n * When a route exports `routeParamsSchema`, this resolves to the schema's\n * output type (e.g., `{ id: number }` after coercion).\n * When no schema exists, this is the same as the navigation param type.\n */\nexport type RouteParamsOutput<P extends string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { paramsOutput: infer O }\n ? O\n : AnalogRouteTable[P] extends { params: infer Params }\n ? Params\n : Record<string, unknown>\n : Record<string, unknown>;\n\n/**\n * Extracts the validated output type for route query params.\n */\nexport type RouteQueryOutput<P extends string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { queryOutput: infer O }\n ? O\n : Record<string, string | string[] | undefined>\n : Record<string, string | string[] | undefined>;\n\ntype RequiredRouteParamKeys<Params> =\n Params extends Record<string, never>\n ? never\n : {\n [K in keyof Params]-?: Record<string, never> extends Pick<Params, K>\n ? never\n : K;\n }[keyof Params];\n\ntype HasRequiredRouteParams<Params> = [RequiredRouteParamKeys<Params>] extends [\n never,\n]\n ? false\n : true;\n\n/**\n * Typed options that infer params from the route table when available.\n */\nexport type RoutePathOptions<P extends string = string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { params: infer Params }\n ? Params extends Record<string, never>\n ? {\n query?: RouteQueryOutput<P>;\n hash?: string;\n }\n : HasRequiredRouteParams<Params> extends true\n ? {\n params: Params;\n query?: RouteQueryOutput<P>;\n hash?: string;\n }\n : {\n params?: Params;\n query?: RouteQueryOutput<P>;\n hash?: string;\n }\n : RoutePathOptionsBase\n : RoutePathOptionsBase;\n\n/**\n * Conditional args: require options when the route has params.\n */\nexport type RoutePathArgs<P extends string = string> =\n P extends keyof AnalogRouteTable\n ? AnalogRouteTable[P] extends { params: infer Params }\n ? Params extends Record<string, never>\n ? [options?: RoutePathOptions<P>]\n : HasRequiredRouteParams<Params> extends true\n ? [options: RoutePathOptions<P>]\n : [options?: RoutePathOptions<P>]\n : [options?: RoutePathOptionsBase]\n : [options?: RoutePathOptionsBase];\n\n/**\n * Result of `routePath()` — contains properties that map directly\n * to Angular's `[routerLink]`, `[queryParams]`, and `[fragment]` inputs.\n */\nexport interface RouteLinkResult {\n path: string;\n queryParams: Record<string, string | string[]> | null;\n fragment: string | undefined;\n}\n\n/**\n * Builds a typed route link object from a route path pattern and options.\n *\n * The returned object separates path, query params, and fragment for\n * direct use with Angular's routerLink directive inputs.\n *\n * @example\n * routePath('/about')\n * // → { path: '/about', queryParams: null, fragment: undefined }\n *\n * routePath('/users/[id]', { params: { id: '42' } })\n * // → { path: '/users/42', queryParams: null, fragment: undefined }\n *\n * routePath('/users/[id]', { params: { id: '42' }, query: { tab: 'settings' }, hash: 'bio' })\n * // → { path: '/users/42', queryParams: { tab: 'settings' }, fragment: 'bio' }\n *\n * @example Template usage\n * ```html\n * @let link = routePath('/users/[id]', { params: { id: userId } });\n * <a [routerLink]=\"link.path\" [queryParams]=\"link.queryParams\" [fragment]=\"link.fragment\">\n * ```\n */\nexport function routePath<P extends AnalogRoutePath>(\n path: P,\n ...args: RoutePathArgs<P>\n): RouteLinkResult {\n const options = args[0] as RoutePathOptionsBase | undefined;\n return buildRouteLink(path as string, options);\n}\n\n/**\n * Internal: builds a `RouteLinkResult` from path and options.\n * Exported for direct use in tests (avoids generic constraints).\n */\nexport function buildRouteLink(\n path: string,\n options?: RoutePathOptionsBase,\n): RouteLinkResult {\n const resolvedPath = buildPath(path, options?.params);\n\n let queryParams: Record<string, string | string[]> | null = null;\n if (options?.query) {\n const filtered: Record<string, string | string[]> = {};\n let hasEntries = false;\n for (const [key, value] of Object.entries(options.query)) {\n if (value !== undefined) {\n filtered[key] = value;\n hasEntries = true;\n }\n }\n if (hasEntries) {\n queryParams = filtered;\n }\n }\n\n return {\n path: resolvedPath,\n queryParams,\n fragment: options?.hash,\n };\n}\n\n/**\n * Resolves param placeholders and normalises slashes.\n * Returns only the path — no query string or hash.\n */\nfunction buildPath(\n path: string,\n params?: Record<string, string | string[] | undefined>,\n): string {\n let url = path;\n\n if (params) {\n // Replace [[...param]] — optional catch-all\n url = url.replace(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g, (_, name) => {\n const value = params[name];\n if (value == null) return '';\n if (Array.isArray(value)) {\n return value.map((v) => encodeURIComponent(v)).join('/');\n }\n return encodeURIComponent(String(value));\n });\n\n // Replace [...param] — required catch-all\n url = url.replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, (_, name) => {\n const value = params[name];\n if (value == null) {\n throw new Error(\n `Missing required catch-all param \"${name}\" for path \"${path}\"`,\n );\n }\n if (Array.isArray(value)) {\n if (value.length === 0) {\n throw new Error(\n `Missing required catch-all param \"${name}\" for path \"${path}\"`,\n );\n }\n return value.map((v) => encodeURIComponent(v)).join('/');\n }\n return encodeURIComponent(String(value));\n });\n\n // Replace [param] — dynamic param\n url = url.replace(/\\[([^\\]]+)\\]/g, (_, name) => {\n const value = params[name];\n if (value == null) {\n throw new Error(`Missing required param \"${name}\" for path \"${path}\"`);\n }\n return encodeURIComponent(String(value));\n });\n } else {\n // Strip bracket syntax when no params provided\n url = url.replace(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g, '');\n url = url.replace(/\\[\\.\\.\\.([^\\]]+)\\]/g, '');\n url = url.replace(/\\[([^\\]]+)\\]/g, '');\n }\n\n // Clean up double/trailing slashes\n url = url.replace(/\\/+/g, '/');\n if (url.length > 1 && url.endsWith('/')) {\n url = url.slice(0, -1);\n }\n if (!url.startsWith('/')) {\n url = '/' + url;\n }\n\n return url;\n}\n\n/**\n * Internal URL builder. Separated from `routePath` so it can be\n * used without generic constraints (e.g., in `injectNavigate`).\n */\nexport function buildUrl(path: string, options?: RoutePathOptionsBase): string {\n let url = buildPath(path, options?.params);\n\n if (options?.query) {\n const parts: string[] = [];\n for (const [key, value] of Object.entries(options.query)) {\n if (value === undefined) continue;\n if (Array.isArray(value)) {\n for (const v of value) {\n parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(v)}`);\n }\n } else {\n parts.push(`${encodeURIComponent(key)}=${encodeURIComponent(value)}`);\n }\n }\n if (parts.length > 0) {\n url += '?' + parts.join('&');\n }\n }\n\n if (options?.hash) {\n url += '#' + options.hash;\n }\n\n return url;\n}\n","import { inject } from '@angular/core';\nimport { type NavigationBehaviorOptions, Router } from '@angular/router';\n\nimport type {\n AnalogRoutePath,\n RoutePathArgs,\n RoutePathOptionsBase,\n} from './route-path';\nimport { buildUrl } from './route-path';\n\ntype NavigateWithExtrasArgs<P extends AnalogRoutePath> =\n RoutePathArgs<P> extends [options?: infer Options]\n ?\n | [extras: NavigationBehaviorOptions]\n | [options: Options | undefined, extras: NavigationBehaviorOptions]\n : [options: RoutePathArgs<P>[0], extras: NavigationBehaviorOptions];\n\ntype TypedNavigate = {\n <P extends AnalogRoutePath>(\n path: P,\n ...args: RoutePathArgs<P>\n ): Promise<boolean>;\n <P extends AnalogRoutePath>(\n path: P,\n ...args: NavigateWithExtrasArgs<P>\n ): Promise<boolean>;\n};\n\nfunction isRoutePathOptionsBase(value: unknown): value is RoutePathOptionsBase {\n return (\n !!value &&\n typeof value === 'object' &&\n ('params' in value || 'query' in value || 'hash' in value)\n );\n}\n\n/**\n * Injects a typed navigate function.\n *\n * @example\n * ```ts\n * const navigate = injectNavigate();\n *\n * navigate('/users/[id]', { params: { id: '42' } }); // ✅\n * navigate('/users/[id]', { params: { id: 42 } }); // ❌ type error\n *\n * // With navigation extras\n * navigate('/users/[id]', { params: { id: '42' } }, { replaceUrl: true });\n * ```\n */\nexport function injectNavigate(): TypedNavigate {\n const router = inject(Router);\n\n const navigate = ((\n path: AnalogRoutePath,\n ...args: unknown[]\n ): Promise<boolean> => {\n let options: RoutePathOptionsBase | undefined;\n let extras: NavigationBehaviorOptions | undefined;\n\n if (args.length > 1) {\n options = args[0] as RoutePathOptionsBase | undefined;\n extras = args[1] as NavigationBehaviorOptions | undefined;\n } else if (args.length === 1) {\n if (isRoutePathOptionsBase(args[0])) {\n options = args[0];\n } else {\n extras = args[0] as NavigationBehaviorOptions;\n }\n }\n\n const url = buildUrl(path as string, options);\n return router.navigateByUrl(url, extras);\n }) as TypedNavigate;\n\n return navigate;\n}\n","import { InjectionToken } from '@angular/core';\nimport type { RouterFeatures } from '@angular/router';\n\n/**\n * Configuration for experimental typed router features.\n *\n * Inspired by TanStack Router's type-safe navigation system where\n * routes are registered globally and all navigation/hooks are typed\n * against the route tree.\n *\n * @experimental\n */\nexport interface TypedRouterOptions {\n /**\n * When true, logs warnings in development when navigating to\n * routes with params that don't match the generated route table.\n *\n * Similar to TanStack Router's strict mode where `useParams()`\n * without a `from` constraint returns a union of all possible params.\n *\n * @default false\n */\n strictRouteParams?: boolean;\n}\n\n/**\n * Configuration for experimental loader caching.\n *\n * Inspired by TanStack Router's built-in data caching where route\n * loaders automatically cache results and support stale-while-revalidate.\n *\n * @experimental\n */\nexport interface LoaderCacheOptions {\n /**\n * Time in milliseconds before loader data is considered stale.\n * While data is fresh, navigating back to the route uses cached\n * data without re-invoking the server load function.\n *\n * Mirrors TanStack Router's `defaultStaleTime` option on `createRouter()`.\n *\n * @default 0 (always re-fetch)\n */\n defaultStaleTime?: number;\n\n /**\n * Time in milliseconds to retain unused loader data in cache\n * after leaving a route. After this period the cached entry is\n * garbage-collected.\n *\n * Mirrors TanStack Router's `defaultGcTime` (default 30 min).\n *\n * @default 300_000 (5 minutes)\n */\n defaultGcTime?: number;\n\n /**\n * Delay in milliseconds before showing a pending/loading indicator\n * during route transitions. Prevents flash-of-loading-state for\n * fast navigations.\n *\n * Mirrors TanStack Router's `defaultPendingMs`.\n *\n * @default 0 (show immediately)\n */\n defaultPendingMs?: number;\n}\n\n// ---------------------------------------------------------------------------\n// DI tokens\n// ---------------------------------------------------------------------------\n\n/** @experimental */\nexport const EXPERIMENTAL_TYPED_ROUTER: InjectionToken<TypedRouterOptions> =\n new InjectionToken<TypedRouterOptions>('EXPERIMENTAL_TYPED_ROUTER');\n\n/** @experimental */\nexport const EXPERIMENTAL_ROUTE_CONTEXT: InjectionToken<\n Record<string, unknown>\n> = new InjectionToken<Record<string, unknown>>('EXPERIMENTAL_ROUTE_CONTEXT');\n\n/** @experimental */\nexport const EXPERIMENTAL_LOADER_CACHE: InjectionToken<LoaderCacheOptions> =\n new InjectionToken<LoaderCacheOptions>('EXPERIMENTAL_LOADER_CACHE');\n\n// ---------------------------------------------------------------------------\n// Provider feature functions (passed to provideFileRouter)\n// ---------------------------------------------------------------------------\n\n/**\n * Enables experimental typed router features.\n *\n * When active, `routePath()`, `injectNavigate()`, `injectParams()`,\n * and `injectQuery()` will enforce route table constraints and\n * optionally log warnings in strict mode.\n *\n * Inspired by TanStack Router's `Register` interface and strict type\n * checking across the entire navigation surface.\n *\n * @example\n * ```ts\n * provideFileRouter(\n * withTypedRouter({ strictRouteParams: true }),\n * )\n * ```\n *\n * @experimental\n */\nexport function withTypedRouter(options?: TypedRouterOptions): RouterFeatures {\n return {\n ɵkind: 102 as number,\n ɵproviders: [\n {\n provide: EXPERIMENTAL_TYPED_ROUTER,\n useValue: { strictRouteParams: false, ...options },\n },\n ],\n };\n}\n\n/**\n * Provides root-level route context available to all route loaders\n * and components via `injectRouteContext()`.\n *\n * Inspired by TanStack Router's `createRootRouteWithContext<T>()` where\n * a typed context object is required at router creation and automatically\n * available in every route's `beforeLoad` and `loader`.\n *\n * In Angular terms, this creates a DI token that server-side load\n * functions and components can inject to access shared services\n * without importing them individually.\n *\n * @example\n * ```ts\n * // app.config.ts\n * provideFileRouter(\n * withRouteContext({\n * auth: inject(AuthService),\n * db: inject(DatabaseService),\n * }),\n * )\n *\n * // In a component\n * const ctx = injectRouteContext<{ auth: AuthService; db: DatabaseService }>();\n * ```\n *\n * @experimental\n */\nexport function withRouteContext<T extends Record<string, unknown>>(\n context: T,\n): RouterFeatures {\n return {\n ɵkind: 103 as number,\n ɵproviders: [\n {\n provide: EXPERIMENTAL_ROUTE_CONTEXT,\n useValue: context,\n },\n ],\n };\n}\n\n/**\n * Configures experimental loader caching behavior for server-loaded\n * route data.\n *\n * Inspired by TanStack Router's built-in cache where `createRouter()`\n * accepts `defaultStaleTime` and `defaultGcTime` to control when\n * loaders re-execute and when cached data is discarded.\n *\n * @example\n * ```ts\n * provideFileRouter(\n * withLoaderCaching({\n * defaultStaleTime: 30_000, // 30s before re-fetch\n * defaultGcTime: 300_000, // 5min cache retention\n * defaultPendingMs: 200, // 200ms loading delay\n * }),\n * )\n * ```\n *\n * @experimental\n */\nexport function withLoaderCaching(\n options?: LoaderCacheOptions,\n): RouterFeatures {\n return {\n ɵkind: 104 as number,\n ɵproviders: [\n {\n provide: EXPERIMENTAL_LOADER_CACHE,\n useValue: {\n defaultStaleTime: 0,\n defaultGcTime: 300_000,\n defaultPendingMs: 0,\n ...options,\n },\n },\n ],\n };\n}\n","import { inject, Injector, isDevMode, Signal } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { map, take } from 'rxjs';\n\nimport type {\n AnalogRoutePath,\n RouteParamsOutput,\n RouteQueryOutput,\n} from './route-path';\nimport { EXPERIMENTAL_TYPED_ROUTER } from './experimental';\n\nfunction extractRouteParams(\n routePath: string,\n): { name: string; type: 'dynamic' | 'catchAll' | 'optionalCatchAll' }[] {\n const params: {\n name: string;\n type: 'dynamic' | 'catchAll' | 'optionalCatchAll';\n }[] = [];\n for (const match of routePath.matchAll(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g)) {\n params.push({ name: match[1], type: 'optionalCatchAll' });\n }\n for (const match of routePath.matchAll(/(?<!\\[)\\[\\.\\.\\.([^\\]]+)\\](?!\\])/g)) {\n params.push({ name: match[1], type: 'catchAll' });\n }\n for (const match of routePath.matchAll(/(?<!\\[)\\[(?!\\.)([^\\]]+)\\](?!\\])/g)) {\n params.push({ name: match[1], type: 'dynamic' });\n }\n return params;\n}\n\n/**\n * When `strictRouteParams` is enabled, warns if expected params from the\n * `_from` pattern are missing from the active `ActivatedRoute`.\n */\nfunction assertRouteMatch(\n from: string,\n route: ActivatedRoute,\n kind: 'injectParams' | 'injectQuery',\n): void {\n const expectedParams = extractRouteParams(from)\n .filter((param) => param.type === 'dynamic' || param.type === 'catchAll')\n .map((param) => param.name);\n\n if (expectedParams.length === 0) return;\n\n route.params.pipe(take(1)).subscribe((params) => {\n for (const name of expectedParams) {\n if (!(name in params)) {\n console.warn(\n `[Analog] ${kind}('${from}'): expected param \"${name}\" ` +\n `is not present in the active route's params. ` +\n `Ensure this hook is used inside a component rendered by '${from}'.`,\n );\n break;\n }\n }\n });\n}\n\n/**\n * Injects typed route params as a signal, constrained by the route table.\n *\n * Inspired by TanStack Router's `useParams({ from: '/users/$userId' })`\n * pattern where the `from` parameter narrows the return type to only\n * the params defined for that route.\n *\n * The `from` parameter is used purely for TypeScript type inference —\n * at runtime, params are read from the current `ActivatedRoute`. This\n * means it works correctly when used inside a component rendered by\n * the specified route.\n *\n * When `withTypedRouter({ strictRouteParams: true })` is configured,\n * a dev-mode assertion checks that the expected params from `from`\n * exist in the active route and warns on mismatch.\n *\n * @example\n * ```ts\n * // In a component rendered at /users/[id]\n * const params = injectParams('/users/[id]');\n * // params() → { id: string }\n *\n * // With schema validation output types\n * const params = injectParams('/products/[slug]');\n * // params() → validated output type from routeParamsSchema\n * ```\n *\n * @experimental\n */\nexport function injectParams<P extends AnalogRoutePath>(\n _from: P,\n options?: { injector?: Injector },\n): Signal<RouteParamsOutput<P>> {\n const injector = options?.injector;\n const route = injector\n ? injector.get(ActivatedRoute)\n : inject(ActivatedRoute);\n\n if (isDevMode()) {\n const config = injector\n ? injector.get(EXPERIMENTAL_TYPED_ROUTER, null)\n : inject(EXPERIMENTAL_TYPED_ROUTER, { optional: true });\n\n if (config?.strictRouteParams) {\n assertRouteMatch(_from, route, 'injectParams');\n }\n }\n\n return toSignal(\n route.params.pipe(map((params) => params as RouteParamsOutput<P>)),\n { requireSync: true },\n );\n}\n\n/**\n * Injects typed route query params as a signal, constrained by the\n * route table.\n *\n * Inspired by TanStack Router's `useSearch({ from: '/issues' })` pattern\n * where search params are validated and typed per-route via\n * `validateSearch` schemas.\n *\n * In Analog, the typing comes from `routeQuerySchema` exports that are\n * detected at build time and recorded in the generated route table.\n *\n * The `from` parameter is used purely for TypeScript type inference.\n * When `withTypedRouter({ strictRouteParams: true })` is configured,\n * a dev-mode assertion checks that the expected params from `from`\n * exist in the active route and warns on mismatch.\n *\n * @example\n * ```ts\n * // In a component rendered at /issues\n * // (where routeQuerySchema validates { page: number, status: string })\n * const query = injectQuery('/issues');\n * // query() → { page: number; status: string }\n * ```\n *\n * @experimental\n */\nexport function injectQuery<P extends AnalogRoutePath>(\n _from: P,\n options?: { injector?: Injector },\n): Signal<RouteQueryOutput<P>> {\n const injector = options?.injector;\n const route = injector\n ? injector.get(ActivatedRoute)\n : inject(ActivatedRoute);\n\n if (isDevMode()) {\n const config = injector\n ? injector.get(EXPERIMENTAL_TYPED_ROUTER, null)\n : inject(EXPERIMENTAL_TYPED_ROUTER, { optional: true });\n\n if (config?.strictRouteParams) {\n assertRouteMatch(_from, route, 'injectQuery');\n }\n }\n\n return toSignal(\n route.queryParams.pipe(map((params) => params as RouteQueryOutput<P>)),\n { requireSync: true },\n );\n}\n","import { inject } from '@angular/core';\n\nimport { EXPERIMENTAL_ROUTE_CONTEXT } from './experimental';\n\n/**\n * Injects the root route context provided via `withRouteContext()`.\n *\n * Inspired by TanStack Router's context inheritance where\n * `createRootRouteWithContext<T>()` makes a typed context available\n * to every route's `beforeLoad` and `loader` callbacks.\n *\n * In Angular, this uses DI under the hood — `withRouteContext(ctx)`\n * provides the value, and `injectRouteContext<T>()` retrieves it\n * with the expected type.\n *\n * @example\n * ```ts\n * // app.config.ts\n * provideFileRouter(\n * withRouteContext({\n * auth: inject(AuthService),\n * analytics: inject(AnalyticsService),\n * }),\n * )\n *\n * // any-page.page.ts\n * const ctx = injectRouteContext<{\n * auth: AuthService;\n * analytics: AnalyticsService;\n * }>();\n * ctx.analytics.trackPageView();\n * ```\n *\n * @experimental\n */\nexport function injectRouteContext<\n T extends Record<string, unknown> = Record<string, unknown>,\n>(): T {\n return inject(EXPERIMENTAL_ROUTE_CONTEXT) as T;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CA,IAAa,mBAAmB,UAA4C;AAC1E,QAAO;;;;;;;AAQT,IAAa,qBAA6B;AACxC,QAAO,OAAO,OAAO;;;;;;;AAQvB,IAAa,6BAA6C;AACxD,QAAO,OAAO,eAAe;;;;ACvD/B,SAAgB,kBACd,KACA,MACA,WAAmB,OAAO,YAAY,EACtC,gBAAsC,eAAe,EACrB;AAChC,KAAI,iBAAiB,SAAS,IAAI,IAAI,IAAI,SAAS,YAAc,EAAA;EAC3D,IAAA,UAAc,IAAA,aAAa;EACzB,MAAA,UAAU,eAAe,QAAQ;AACvC,YAAU,QAAY,IAAA,UAAU,WAAc,GAAA;AAQ9C,SAAY,KANe,IAAM,MAC/B,EAGK,SACF,CAAA,CACW;;;;;ACDpB,SAAgB,4BACd,GAAG,UACmB;CACtB,MAAM,qBAAqB,SAAS,QAAQ,SAAS,KAAK,SAAS,IAAI;CACvE,MAAM,iBAAiB,SAAS,QAAQ,SAAS,KAAK,QAAQ,IAAI;;EAmD5D,mBACM,KAAA,QAAA,IAAA,WACL;EACD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A6BH,SAAgB,YACd,OACA,SAC6B;CAC7B,MAAM,WAAW,SAAS;CAC1B,MAAM,QAAQ,WAIV,SAAa,IAAA,eAAA,GACT,OAAS,eACX;AAGJ,KAAI,WAAQ;OACO,WAAA,SAAA,IAAA,2BAAA,KAAA,GAAA,OAAA,2BAAA,EAAA,UAAA,MAAA,CAAA,GAKnB,kBAAA,kBAAA,OAAA,OAAA,cAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC7HJ,SAAgB,qBAET;AACL,QAAO,OAAO,2BAA2B"}
@@ -71,7 +71,11 @@ var DebugRoutesComponent = class DebugRoutesComponent {
71
71
  {{ collectedRoute.isLayout ? 'Layout' : 'Page' }}
72
72
  </div>
73
73
  <div class="table-cell source-col">
74
- <span class="source-badge" [class]="collectedRoute.source">
74
+ <span
75
+ class="source-badge"
76
+ [class.page]="collectedRoute.source === 'page'"
77
+ [class.content]="collectedRoute.source === 'content'"
78
+ >
75
79
  {{ collectedRoute.source }}
76
80
  </span>
77
81
  </div>
@@ -116,7 +120,11 @@ i0.ɵɵngDeclareClassMetadata({
116
120
  {{ collectedRoute.isLayout ? 'Layout' : 'Page' }}
117
121
  </div>
118
122
  <div class="table-cell source-col">
119
- <span class="source-badge" [class]="collectedRoute.source">
123
+ <span
124
+ class="source-badge"
125
+ [class.page]="collectedRoute.source === 'page'"
126
+ [class.content]="collectedRoute.source === 'content'"
127
+ >
120
128
  {{ collectedRoute.source }}
121
129
  </span>
122
130
  </div>
@@ -1 +1 @@
1
- {"version":3,"file":"debug.page.mjs","names":[],"sources":["../../src/lib/debug/debug.page.ts"],"sourcesContent":["import { Component, OnInit, inject } from '@angular/core';\nimport { Route } from '@angular/router';\n\nimport { createRoutes as createBaseRoutes } from '../route-builder';\nimport {\n ANALOG_EXTRA_ROUTE_FILE_SOURCES,\n type ExtraRouteFileSource,\n} from '../route-files';\nimport { injectDebugRoutes, DebugRoute } from './routes';\n\ntype CollectedRoute = {\n path: string;\n filename: string;\n file: string;\n isLayout: boolean;\n source: 'page' | 'content';\n};\n\n@Component({\n selector: 'analogjs-debug-routes-page',\n standalone: true,\n template: `\n <h2>Routes</h2>\n\n <div class=\"table-container\">\n <div class=\"table-header\">\n <div class=\"header-cell path-col\">Route Path</div>\n <div class=\"header-cell file-col\">File</div>\n <div class=\"header-cell type-col\">Type</div>\n <div class=\"header-cell source-col\">Source</div>\n </div>\n <div class=\"table-body\">\n @for (collectedRoute of collectedRoutes; track $index) {\n <div class=\"table-row\">\n <div class=\"table-cell path-col\">{{ collectedRoute.path }}</div>\n <div class=\"table-cell file-col\" [title]=\"collectedRoute.filename\">\n {{ collectedRoute.file }}\n </div>\n <div class=\"table-cell type-col\">\n {{ collectedRoute.isLayout ? 'Layout' : 'Page' }}\n </div>\n <div class=\"table-cell source-col\">\n <span class=\"source-badge\" [class]=\"collectedRoute.source\">\n {{ collectedRoute.source }}\n </span>\n </div>\n </div>\n }\n </div>\n </div>\n `,\n styles: `\n :host {\n width: 100%;\n }\n\n .table-container {\n width: 100%;\n max-width: 1000px;\n margin: 0 auto;\n background: white;\n border-radius: 8px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n overflow: hidden;\n }\n\n .table-header {\n display: grid;\n grid-template-columns: 2fr 2fr 1fr 1fr;\n background: gray;\n border-bottom: 2px solid #e5e7eb;\n }\n\n .header-cell {\n padding: 16px 24px;\n font-weight: 600;\n text-transform: uppercase;\n font-size: 14px;\n letter-spacing: 0.05em;\n color: white;\n }\n\n .table-body {\n display: flex;\n flex-direction: column;\n }\n\n .table-row {\n display: grid;\n grid-template-columns: 2fr 2fr 1fr 1fr;\n border-bottom: 1px solid #e5e7eb;\n transition: background-color 0.2s ease;\n }\n\n .table-row:last-child {\n border-bottom: none;\n }\n\n .table-row:hover {\n background-color: #f9fafb;\n }\n\n .table-cell {\n padding: 16px 24px;\n font-size: 16px;\n color: #4b5563;\n }\n\n .source-badge {\n display: inline-block;\n padding: 2px 8px;\n border-radius: 4px;\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n }\n\n .source-badge.page {\n background: #dbeafe;\n color: #1e40af;\n }\n\n .source-badge.content {\n background: #dcfce7;\n color: #166534;\n }\n\n @media (max-width: 640px) {\n .table-container {\n border-radius: 0;\n margin: 0;\n }\n\n .header-cell,\n .table-cell {\n padding: 12px 16px;\n }\n }\n `,\n})\nexport default class DebugRoutesComponent implements OnInit {\n collectedRoutes: CollectedRoute[] = [];\n\n private debugRoutes: (Route & DebugRoute)[] = injectDebugRoutes();\n private extraSources: ExtraRouteFileSource[] =\n inject(ANALOG_EXTRA_ROUTE_FILE_SOURCES, { optional: true }) ?? [];\n\n ngOnInit(): void {\n this.traverseRoutes(this.debugRoutes, undefined, 'page');\n\n for (const source of this.extraSources) {\n const contentDebugRoutes = createBaseRoutes(\n source.files,\n source.resolveModule,\n true,\n ) as (Route & DebugRoute)[];\n this.traverseRoutes(contentDebugRoutes, undefined, 'content');\n }\n\n this.collectedRoutes.sort((a, b) => a.path.localeCompare(b.path));\n }\n\n traverseRoutes(\n routes: DebugRoute[],\n parent?: string,\n source: 'page' | 'content' = 'page',\n ): void {\n routes.forEach((route) => {\n this.collectedRoutes.push({\n path: route.isLayout\n ? `${parent ? `/${parent}` : ''}${route.path ? `/${route.path}` : ''}`\n : `${parent ? `/${parent}` : ''}${\n route.path ? `/${route.path}` : '/'\n }`,\n filename: route.filename,\n file: route.filename?.replace(/(^.*)(pages|content)\\//, '') || '',\n isLayout: route.isLayout,\n source,\n });\n\n if (route.children) {\n const parentSegments = [parent, route.path];\n const fullParentPath = parentSegments.filter((s) => !!s).join('/');\n this.traverseRoutes(route.children, fullParentPath, source);\n }\n });\n }\n}\n"],"mappings":";;;;;AA6Ie,IAAA,uBAAA,MAAA,qBAAM;;yBACmB,EAAA;qBAEQ,mBAAmB;sBAE/D,OAAO,iCAAmC,EAAA,UAAgB,MAAK,CAAE,IAAA,EAAA;;CAEnE,WAAiB;AACV,OAAA,eAAoB,KAAA,aAAa,KAAA,GAAW,OAAO;AAEnD,OAAM,MAAA,UAAe,KAAA,cAAc;GAChC,MAAA,qBAAqB,aAClB,OACP,OAAO,OAAA,eAER,KAAA;AACI,QAAA,eAAe,oBAAoB,KAAA,GAAW,UAAU;;AAG1D,OAAA,gBAAsB,MAAG,GAAM,MAAE,EAAK,KAAA,cAAgB,EAAM,KAAA,CAAA;;CAGnE,eACE,QACA,QACA,SAA6B,QACvB;AACN,SAAO,SAAS,UAAU;AACnB,QAAA,gBAAqB,KAAA;IACZ,MAAA,MACR,WAIY,GAAA,SAAA,IAAA,WAAA,KAAA,MAAA,OAAA,IAAA,MAAA,SAAA,OACJ,GAAA,SAAkB,IAAA,WAAA,KAAA,MAA0B,OAAO,IAAA,MAAA,SAAA;IACrD,UAAM,MAAA;IAChB,MAAA,MAAA,UAAA,QAAA,0BAAA,GAAA,IAAA;IACA,UAAA,MAAA;IAEQ;IACF,CAAA;AACA,OAAA,MAAA,UAAiB;2BACG,CAAU,QAAA,MAAA,KAAgB,CAAA,QAAA,MAAA,CAAA,CAAA,EAAA,CAAA,KAAA,IAAA;AAEtD,SAAA,eAAA,MAAA,UAAA,gBAAA,OAAA;;;;CAvKJ;AAAU,OAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAA,MAAA,EAAA;GAAA,QAAA,GAAA,gBAAA;GAAA,CAAA;;CACV;AAAY,OAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAAA,cAAA;GAAA,UAAA;GAAA,UAAA;GAAA,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BZ,yBAAQ;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAA,YAAA,CAAA"}
1
+ {"version":3,"file":"debug.page.mjs","names":[],"sources":["../../src/lib/debug/debug.page.ts"],"sourcesContent":["import { Component, OnInit, inject } from '@angular/core';\nimport { Route } from '@angular/router';\n\nimport { createRoutes as createBaseRoutes } from '../route-builder';\nimport {\n ANALOG_EXTRA_ROUTE_FILE_SOURCES,\n type ExtraRouteFileSource,\n} from '../route-files';\nimport { injectDebugRoutes, DebugRoute } from './routes';\n\ntype CollectedRoute = {\n path: string;\n filename: string;\n file: string;\n isLayout: boolean;\n source: 'page' | 'content';\n};\n\n@Component({\n selector: 'analogjs-debug-routes-page',\n standalone: true,\n template: `\n <h2>Routes</h2>\n\n <div class=\"table-container\">\n <div class=\"table-header\">\n <div class=\"header-cell path-col\">Route Path</div>\n <div class=\"header-cell file-col\">File</div>\n <div class=\"header-cell type-col\">Type</div>\n <div class=\"header-cell source-col\">Source</div>\n </div>\n <div class=\"table-body\">\n @for (collectedRoute of collectedRoutes; track $index) {\n <div class=\"table-row\">\n <div class=\"table-cell path-col\">{{ collectedRoute.path }}</div>\n <div class=\"table-cell file-col\" [title]=\"collectedRoute.filename\">\n {{ collectedRoute.file }}\n </div>\n <div class=\"table-cell type-col\">\n {{ collectedRoute.isLayout ? 'Layout' : 'Page' }}\n </div>\n <div class=\"table-cell source-col\">\n <span\n class=\"source-badge\"\n [class.page]=\"collectedRoute.source === 'page'\"\n [class.content]=\"collectedRoute.source === 'content'\"\n >\n {{ collectedRoute.source }}\n </span>\n </div>\n </div>\n }\n </div>\n </div>\n `,\n styles: `\n :host {\n width: 100%;\n }\n\n .table-container {\n width: 100%;\n max-width: 1000px;\n margin: 0 auto;\n background: white;\n border-radius: 8px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n overflow: hidden;\n }\n\n .table-header {\n display: grid;\n grid-template-columns: 2fr 2fr 1fr 1fr;\n background: gray;\n border-bottom: 2px solid #e5e7eb;\n }\n\n .header-cell {\n padding: 16px 24px;\n font-weight: 600;\n text-transform: uppercase;\n font-size: 14px;\n letter-spacing: 0.05em;\n color: white;\n }\n\n .table-body {\n display: flex;\n flex-direction: column;\n }\n\n .table-row {\n display: grid;\n grid-template-columns: 2fr 2fr 1fr 1fr;\n border-bottom: 1px solid #e5e7eb;\n transition: background-color 0.2s ease;\n }\n\n .table-row:last-child {\n border-bottom: none;\n }\n\n .table-row:hover {\n background-color: #f9fafb;\n }\n\n .table-cell {\n padding: 16px 24px;\n font-size: 16px;\n color: #4b5563;\n }\n\n .source-badge {\n display: inline-block;\n padding: 2px 8px;\n border-radius: 4px;\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n }\n\n .source-badge.page {\n background: #dbeafe;\n color: #1e40af;\n }\n\n .source-badge.content {\n background: #dcfce7;\n color: #166534;\n }\n\n @media (max-width: 640px) {\n .table-container {\n border-radius: 0;\n margin: 0;\n }\n\n .header-cell,\n .table-cell {\n padding: 12px 16px;\n }\n }\n `,\n})\nexport default class DebugRoutesComponent implements OnInit {\n collectedRoutes: CollectedRoute[] = [];\n\n private debugRoutes: (Route & DebugRoute)[] = injectDebugRoutes();\n private extraSources: ExtraRouteFileSource[] =\n inject(ANALOG_EXTRA_ROUTE_FILE_SOURCES, { optional: true }) ?? [];\n\n ngOnInit(): void {\n this.traverseRoutes(this.debugRoutes, undefined, 'page');\n\n for (const source of this.extraSources) {\n const contentDebugRoutes = createBaseRoutes(\n source.files,\n source.resolveModule,\n true,\n ) as (Route & DebugRoute)[];\n this.traverseRoutes(contentDebugRoutes, undefined, 'content');\n }\n\n this.collectedRoutes.sort((a, b) => a.path.localeCompare(b.path));\n }\n\n traverseRoutes(\n routes: DebugRoute[],\n parent?: string,\n source: 'page' | 'content' = 'page',\n ): void {\n routes.forEach((route) => {\n this.collectedRoutes.push({\n path: route.isLayout\n ? `${parent ? `/${parent}` : ''}${route.path ? `/${route.path}` : ''}`\n : `${parent ? `/${parent}` : ''}${\n route.path ? `/${route.path}` : '/'\n }`,\n filename: route.filename,\n file: route.filename?.replace(/(^.*)(pages|content)\\//, '') || '',\n isLayout: route.isLayout,\n source,\n });\n\n if (route.children) {\n const parentSegments = [parent, route.path];\n const fullParentPath = parentSegments.filter((s) => !!s).join('/');\n this.traverseRoutes(route.children, fullParentPath, source);\n }\n });\n }\n}\n"],"mappings":";;;;;AAiJe,IAAA,uBAAA,MAAA,qBAAM;;yBACmB,EAAA;qBAEQ,mBAAmB;sBAE/D,OAAO,iCAAmC,EAAA,UAAgB,MAAK,CAAE,IAAA,EAAA;;CAEnE,WAAiB;AACV,OAAA,eAAoB,KAAA,aAAa,KAAA,GAAW,OAAO;AAEnD,OAAM,MAAA,UAAe,KAAA,cAAc;GAChC,MAAA,qBAAqB,aAClB,OACP,OAAO,OAAA,eAER,KAAA;AACI,QAAA,eAAe,oBAAoB,KAAA,GAAW,UAAU;;AAG1D,OAAA,gBAAsB,MAAG,GAAM,MAAE,EAAK,KAAA,cAAgB,EAAM,KAAA,CAAA;;CAGnE,eACE,QACA,QACA,SAA6B,QACvB;AACN,SAAO,SAAS,UAAU;AACnB,QAAA,gBAAqB,KAAA;IACZ,MAAA,MACR,WAIY,GAAA,SAAA,IAAA,WAAA,KAAA,MAAA,OAAA,IAAA,MAAA,SAAA,OACJ,GAAA,SAAkB,IAAA,WAAA,KAAA,MAA0B,OAAO,IAAA,MAAA,SAAA;IACrD,UAAM,MAAA;IAChB,MAAA,MAAA,UAAA,QAAA,0BAAA,GAAA,IAAA;IACA,UAAA,MAAA;IAEQ;IACF,CAAA;AACA,OAAA,MAAA,UAAiB;2BACG,CAAU,QAAA,MAAA,KAAgB,CAAA,QAAA,MAAA,CAAA,CAAA,EAAA,CAAA,KAAA,IAAA;AAEtD,SAAA,eAAA,MAAA,UAAA,gBAAA,OAAA;;;;CA3KJ;AAAU,OAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAA,MAAA,EAAA;GAAA,QAAA,GAAA,gBAAA;GAAA,CAAA;;CACV;AAAY,OAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAAA,cAAA;GAAA,UAAA;GAAA,UAAA;GAAA,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCZ,yBAAQ;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAA,YAAA,CAAA"}
@@ -24,9 +24,8 @@ function normalizeJsonLd(value) {
24
24
  }
25
25
  var ROUTE_JSON_LD_KEY = Symbol("@analogjs/router Route JSON-LD Key");
26
26
  var JSON_LD_SCRIPT_SELECTOR = "script[data-analog-json-ld]";
27
- function updateJsonLdOnRouteChange() {
28
- const router = inject(Router);
29
- const document = inject(DOCUMENT);
27
+ function updateJsonLdOnRouteChange(router = inject(Router), document = inject(DOCUMENT, { optional: true })) {
28
+ if (!document) return;
30
29
  router.events.pipe(filter((event) => event instanceof NavigationEnd)).subscribe(() => {
31
30
  applyJsonLdToDocument(document, getJsonLdEntries(router.routerState.snapshot.root));
32
31
  });
@@ -73,9 +72,7 @@ var HTTP_EQUIV_SELECTOR_KEY = "http-equiv";
73
72
  var NAME_KEY = "name";
74
73
  var PROPERTY_KEY = "property";
75
74
  var ITEMPROP_KEY = "itemprop";
76
- function updateMetaTagsOnRouteChange() {
77
- const router = inject(Router);
78
- const metaService = inject(Meta);
75
+ function updateMetaTagsOnRouteChange(router = inject(Router), metaService = inject(Meta)) {
79
76
  router.events.pipe(filter((event) => event instanceof NavigationEnd)).subscribe(() => {
80
77
  const metaTagMap = getMetaTagMap(router.routerState.snapshot.root);
81
78
  for (const metaTagSelector in metaTagMap) {
@@ -186,7 +183,9 @@ var ENDPOINT_EXTENSION = ".server.ts";
186
183
  //#endregion
187
184
  //#region packages/router/src/lib/route-builder.ts
188
185
  function createRoutes(files, resolveModule, debug = false) {
189
- const filenames = Object.keys(files);
186
+ const filenames = Object.keys(files).sort((a, b) => {
187
+ return getCollisionPriority(a) - getCollisionPriority(b);
188
+ });
190
189
  if (filenames.length === 0) return [];
191
190
  const rawRoutesByLevelMap = filenames.reduce((acc, filename) => {
192
191
  const rawPath = toRawPath(filename);
@@ -194,6 +193,12 @@ function createRoutes(files, resolveModule, debug = false) {
194
193
  const level = rawSegments.length - 1;
195
194
  const rawSegment = rawSegments[level];
196
195
  const ancestorRawSegments = rawSegments.slice(0, level);
196
+ const existing = acc[level]?.[rawPath];
197
+ if (existing?.filename && existing.filename !== filename) {
198
+ const shouldKeepExisting = getCollisionPriority(existing.filename) < getCollisionPriority(filename);
199
+ shouldKeepExisting && existing.filename;
200
+ if (shouldKeepExisting) return acc;
201
+ }
197
202
  return {
198
203
  ...acc,
199
204
  [level]: {
@@ -236,6 +241,10 @@ function createRoutes(files, resolveModule, debug = false) {
236
241
  sortRawRoutes(rawRoutes);
237
242
  return toRoutes(rawRoutes, files, resolveModule, debug);
238
243
  }
244
+ function getCollisionPriority(filename) {
245
+ if (filename.includes("/src/app/pages/") || filename.includes("/src/app/routes/") || filename.includes("/app/pages/") || filename.includes("/app/routes/") || filename.includes("/src/content/")) return 0;
246
+ return 1;
247
+ }
239
248
  /**
240
249
  * Strips directory prefixes and file extensions from a route filename to
241
250
  * produce the raw path used for route segment construction.
@@ -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 } from '@angular/common';\nimport { 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`, `routeJsonLd`, 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(): void {\n const router = inject(Router);\n const document = inject(DOCUMENT);\n\n router.events\n .pipe(filter((event) => event instanceof NavigationEnd))\n .subscribe(() => {\n applyJsonLdToDocument(\n document,\n getJsonLdEntries(router.routerState.snapshot.root),\n );\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(): void {\n const router = inject(Router);\n const metaService = inject(Meta);\n\n router.events\n .pipe(filter((event) => event instanceof NavigationEnd))\n .subscribe(() => {\n const metaTagMap = getMetaTagMap(router.routerState.snapshot.root);\n\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 '@analogjs/router/tokens';\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 import.meta.env['VITE_ANALOG_PUBLIC_BASE_URL'] ||\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 {\n injectInternalServerFetch,\n type ServerInternalFetch,\n} from '@analogjs/router/tokens';\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 const globalFetch = (\n globalThis as unknown as { $fetch?: ServerInternalFetch }\n ).$fetch;\n if (!!import.meta.env['VITE_ANALOG_PUBLIC_BASE_URL'] && globalFetch) {\n return globalFetch(`${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 { DefaultRouteMeta, RouteExport, RouteMeta } 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);\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 if (import.meta.env.DEV) {\n const existing = acc[level]?.[rawPath];\n if (existing?.filename && existing.filename !== filename) {\n console.warn(\n `[Analog] Route files \"${existing.filename}\" and \"${filename}\" ` +\n `resolve to the same route path \"${rawPath}\". ` +\n `Only \"${filename}\" will be used.`,\n );\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\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[\\\\/](?:routes|pages)|src[\\\\/]content)[\\\\/])|(\\.page\\.(js|ts|analog|ag)$)|(\\.(ts|md|analog|ag)$)/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|analog|ag)$/.test(rawRoute.filename)) {\n const endpointKey = rawRoute.filename.replace(\n /\\.page\\.(ts|analog|ag)$/,\n ENDPOINT_EXTENSION,\n );\n\n const rawEndpoint = rawRoute.filename\n .replace(/\\.page\\.(ts|analog|ag)$/, '')\n .replace(/\\[\\[\\.\\.\\..+\\]\\]/, '**')\n .replace(/\\[\\.{3}.+\\]/, '**')\n .replace(/^(.*?)\\/pages/, '/pages');\n\n const endpoint = (rawEndpoint || '')\n .replace(/\\./g, '/')\n .replace(/\\/\\((.*?)\\)$/, '/-$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 routeMeta = mergeRouteJsonLdIntoRouteMeta(\n m.routeMeta as RouteMeta | undefined,\n m.routeJsonLd,\n );\n\n const routeConfig = toRouteConfig(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 mergeRouteJsonLdIntoRouteMeta(\n routeMeta: RouteMeta | undefined,\n routeJsonLd: RouteExport['routeJsonLd'],\n): RouteMeta | undefined {\n if (!routeJsonLd) {\n return routeMeta;\n }\n\n if (!routeMeta) {\n return { jsonLd: routeJsonLd };\n }\n\n if (isRedirectRouteMeta(routeMeta) || routeMeta.jsonLd) {\n return routeMeta;\n }\n\n return {\n ...routeMeta,\n jsonLd: routeJsonLd,\n };\n}\n\nfunction isRedirectRouteMeta(\n routeMeta: RouteMeta,\n): routeMeta is Exclude<RouteMeta, DefaultRouteMeta> {\n return 'redirectTo' in routeMeta && !!routeMeta.redirectTo;\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":";;;;;;;;;;;;;;;;;ACWA,SAAgB,eAAe,OAAuC;AACpE,QAAO,cAAc,MAAM;;AAG7B,SAAgB,gBAAgB,OAAgC;AAC9D,KAAI,MAAM,QAAQ,MAAQ,CACxB,QAAa,MAAA,OAAO,eAAe;AAGrC,QAAO,eAAe,MAAS,GAAC,CAAA,MAAS,GAAE,EAAA;;AAgC7C,IAAa,oBAAmC,OAC9C,qCACD;AACD,IAAM,0BAA0B;AAEhC,SAAgB,4BAAkC;CAChD,MAAM,SAAS,OAAO,OAAO;CAC7B,MAAM,WAAW,OAAO,SAAS;AAEjC,QAAO,OAGH,KAAA,QAAA,UACE,iBACA,cAAwB,CAAA,CAE1B,gBAAA;;GAGN;;AAEI,SAAY,gBACT,OAAQ;;AAMX,SAAO,KAAA,UAAA,MAAA,CAAA,QAAA,MAAA,UAAA,CAAA,QAAA,MAAA,UAAA,CAIF,QAAA,MAAiB,UAA+C,CACjE,QAA4B,WAAA,UAAA,CAC9B,QAA8C,WAAA,UAAA;SAGxC;AACR,SAAA;;;;CAMJ,MAAS,UAAA,EAAA;CAIP,IAAA,eAAS;AACP,QAAQ,cAAQ;AAChB,UAAA,KAAA,GAAA,gBAAA,aAAA,KAAA,mBAAA,CAAA;AAEE,iBAAQ,aAAc;;;;AAK1B,SAAK,sBAAM,UAAA,SAAA;AACT,UAAA,iBAAA,wBAAA,CAAA,SAAA,YAAA;;GAGF;AACE,KAAM,QAAA,WAAa,EACd;;AAIL,KAAM,CAAA,KACN;AAEA,SAAO,SAAA,OAAa,UAAA;EACpB,MAAO,aAAc,gBAAA,MAAA;AAChB,MAAA,CAAA,WACL;;;;;;;;;;;ACxHJ,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/C,GAAA,cAAA,cAGF;MACF,WAAA,EAAA;MACK,GAAA;OACT,kBAAA;;KAID,CAEuB,GAAA,EAAA,CAGhB;KACS;GACV,GACA;GAEE,MAAS,SAAW;GACb,GAAI,QACJ;IACI,UAAA,SAAA,WAAA,SAAA,WAAA,KAAA;;IAGC,GAClB,EAAA;GAES;GACT;;;AAIJ,QAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACjUT,IAAa,qBAAqB,EAAE;AAUpC,IAAa,kCAET,IAAI,eAAe,4CAA4C"}
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 } from '@angular/common';\nimport { 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`, `routeJsonLd`, 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 '@analogjs/router/tokens';\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 import.meta.env['VITE_ANALOG_PUBLIC_BASE_URL'] ||\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 {\n injectInternalServerFetch,\n type ServerInternalFetch,\n} from '@analogjs/router/tokens';\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 const globalFetch = (\n globalThis as unknown as { $fetch?: ServerInternalFetch }\n ).$fetch;\n if (!!import.meta.env['VITE_ANALOG_PUBLIC_BASE_URL'] && globalFetch) {\n return globalFetch(`${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 { DefaultRouteMeta, RouteExport, RouteMeta } 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('/src/app/routes/') ||\n filename.includes('/app/pages/') ||\n filename.includes('/app/routes/') ||\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[\\\\/](?:routes|pages)|src[\\\\/]content)[\\\\/])|(\\.page\\.(js|ts|analog|ag)$)|(\\.(ts|md|analog|ag)$)/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|analog|ag)$/.test(rawRoute.filename)) {\n const endpointKey = rawRoute.filename.replace(\n /\\.page\\.(ts|analog|ag)$/,\n ENDPOINT_EXTENSION,\n );\n\n const rawEndpoint = rawRoute.filename\n .replace(/\\.page\\.(ts|analog|ag)$/, '')\n .replace(/\\[\\[\\.\\.\\..+\\]\\]/, '**')\n .replace(/\\[\\.{3}.+\\]/, '**')\n .replace(/^(.*?)\\/pages/, '/pages');\n\n const endpoint = (rawEndpoint || '')\n .replace(/\\./g, '/')\n .replace(/\\/\\((.*?)\\)$/, '/-$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 routeMeta = mergeRouteJsonLdIntoRouteMeta(\n m.routeMeta as RouteMeta | undefined,\n m.routeJsonLd,\n );\n\n const routeConfig = toRouteConfig(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 mergeRouteJsonLdIntoRouteMeta(\n routeMeta: RouteMeta | undefined,\n routeJsonLd: RouteExport['routeJsonLd'],\n): RouteMeta | undefined {\n if (!routeJsonLd) {\n return routeMeta;\n }\n\n if (!routeMeta) {\n return { jsonLd: routeJsonLd };\n }\n\n if (isRedirectRouteMeta(routeMeta) || routeMeta.jsonLd) {\n return routeMeta;\n }\n\n return {\n ...routeMeta,\n jsonLd: routeJsonLd,\n };\n}\n\nfunction isRedirectRouteMeta(\n routeMeta: RouteMeta,\n): routeMeta is Exclude<RouteMeta, DefaultRouteMeta> {\n return 'redirectTo' in routeMeta && !!routeMeta.redirectTo;\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":";;;;;;;;;;;;;;;;;ACWA,SAAgB,eAAe,OAAuC;AACpE,QAAO,cAAc,MAAM;;AAG7B,SAAgB,gBAAgB,OAAgC;AAC9D,KAAI,MAAM,QAAQ,MAAQ,CACxB,QAAa,MAAA,OAAO,eAAe;AAGrC,QAAO,eAAe,MAAS,GAAC,CAAA,MAAS,GAAE,EAAA;;AAgC7C,IAAa,oBAAmC,OAC9C,qCACD;AACD,IAAM,0BAA0B;AAEhC,SAAgB,0BACd,SAAiB,OAAO,OAAO,EAC/B,WAA4B,OAAO,UAAU,EAAE,UAAU,MAAM,CAAC,EAC1D;AACN,KAAK,CAAA,SACH;AAGF,QAAO,OAGG,KAAA,QAAU,UAAA,iBAAwB,cAAqB,CAAA,CAC7D,gBAAsB;kCACtB,iBAAA,OAAA,YAAA,SAAA,KAAA,CAAA;GAGN;;AAEI,SAAY,gBACT,OAAQ;;AAMX,SAAO,KAAA,UAAA,MAAA,CAAA,QAAA,MAAA,UAAA,CAAA,QAAA,MAAA,UAAA,CAIF,QAAA,MAAiB,UAA+C,CACjE,QAA4B,WAAA,UAAA,CAC9B,QAA8C,WAAA,UAAA;SAGxC;AACR,SAAA;;;;CAMJ,MAAS,UAAA,EAAA;CAIP,IAAA,eAAS;AACP,QAAQ,cAAQ;AAChB,UAAA,KAAA,GAAA,gBAAA,aAAA,KAAA,mBAAA,CAAA;AAEE,iBAAQ,aAAc;;;;AAK1B,SAAK,sBAAM,UAAA,SAAA;AACT,UAAA,iBAAA,wBAAA,CAAA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,SAAA,EAAA;IACvB,MAAA,cAAkB,SAAW,SAAA,QAAA,2BAAA,mBAAA;AAkBzB,iBAAA;KACH,WAjBmB,SAAa,SAEnC,QAAA,2BAAA,GAAsC,CAAA,QAAA,oBAAA,KAAA,CAAA,QAAA,eAAA,KAAA,CAKtC,QAAY,iBAAA,SACd,IAIwC,IACtC,QAAc,OAAA,IAAgB,CAC9B,QAAY,gBACd,QAAA;KAIA;KACQ;;;EAGN,MAAA,mBAAA,SAAA,UAAA,MAAA,yBAAA;EACC,MAAA,mBAAkB,mBAAA,iBAAA,KAAA;EACpB,MAAA,QAAA,SAID;GAMQ,MAAA,SAAA;GACE,oBAEA,QAAA,CAAA,MAAA,MAAA;IAcd,MAAA,cAAA,cAFW,8BAAA,EAAA,WAAA,EAAA,YAAA,CAEX;IACY,MAAS,cAAW,gBAAoB;AAqBhD,WAAA,CACG,EAAA,GArB0B,cAE/B;KACN,MAAA;KACD,GAAA;KAEa,GAAA;KAGb,MAAA;;KAGA,GAAA;KAIW;MACT,kBAAA;OAOe,EACf,GAAA,mBAAA,CAGF;KACF,SAAA,8BAAA,iBAAA;KACK,GAAA,cACT,cAAA;MAKkD,WAAA,EAAA;MACb,GAAA;;MAGY;KACzB,CACR,GACA,EAAA,CAEA;KACE;GACN,GACE;;GAGN,GAAW,QAClB;IAEqB,UAAA,SAAW,WAAA,SAAA,WAAA,KAAA;IAClB,UAAkB,YAAA,SAAA,SAAA,IAAA,OAAA;;GAI3B;GACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC9VT,IAAa,qBAAqB,EAAE;AAUpC,IAAa,kCAET,IAAI,eAAe,4CAA4C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@analogjs/router",
3
- "version": "3.0.0-alpha.24",
3
+ "version": "3.0.0-alpha.26",
4
4
  "description": "Filesystem-based routing for Angular",
5
5
  "type": "module",
6
6
  "author": "Brandon Roberts <robertsbt@gmail.com>",
@@ -64,7 +64,7 @@
64
64
  "url": "https://github.com/sponsors/brandonroberts"
65
65
  },
66
66
  "peerDependencies": {
67
- "@analogjs/content": "3.0.0-alpha.24",
67
+ "@analogjs/content": "3.0.0-alpha.26",
68
68
  "@angular/core": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
69
69
  "@angular/platform-server": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
70
70
  "@angular/router": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
@@ -91,7 +91,7 @@
91
91
  "tslib": "^2.3.0"
92
92
  },
93
93
  "devDependencies": {
94
- "@analogjs/vite-plugin-angular": "3.0.0-alpha.24"
94
+ "@analogjs/vite-plugin-angular": "3.0.0-alpha.26"
95
95
  },
96
96
  "ng-update": {
97
97
  "packageGroup": [
@@ -1,3 +1,4 @@
1
+ import { Router } from '@angular/router';
1
2
  import type { Graph, Thing, WithContext } from 'schema-dts';
2
3
  export type JsonLdObject = Record<string, unknown>;
3
4
  export declare function isJsonLdObject(value: unknown): value is JsonLdObject;
@@ -27,5 +28,5 @@ export type JsonLd = JsonLdObject | JsonLdObject[];
27
28
  */
28
29
  export type AnalogJsonLdDocument = WithContext<Thing> | Graph | WithContext<Thing>[];
29
30
  export declare const ROUTE_JSON_LD_KEY: unique symbol;
30
- export declare function updateJsonLdOnRouteChange(): void;
31
+ export declare function updateJsonLdOnRouteChange(router?: Router, document?: Document | null): void;
31
32
  export declare function serializeJsonLd(entry: JsonLdObject): string | null;
@@ -1,3 +1,5 @@
1
+ import { Meta } from '@angular/platform-browser';
2
+ import { Router } from '@angular/router';
1
3
  export declare const ROUTE_META_TAGS_KEY: unique symbol;
2
4
  declare const CHARSET_KEY = "charset";
3
5
  declare const HTTP_EQUIV_KEY = "httpEquiv";
@@ -29,5 +31,5 @@ type MetaTagKey = typeof CHARSET_KEY | typeof HTTP_EQUIV_KEY | typeof NAME_KEY |
29
31
  type ExcludeRestMetaTagKeys<Key extends MetaTagKey> = {
30
32
  [K in Exclude<MetaTagKey, Key>]?: never;
31
33
  };
32
- export declare function updateMetaTagsOnRouteChange(): void;
34
+ export declare function updateMetaTagsOnRouteChange(router?: Router, metaService?: Meta): void;
33
35
  export {};