@analogjs/router 2.7.0-beta.8 → 2.7.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analogjs-router-server.mjs","sources":["../../../../packages/router/server/src/server-fn/registry.ts","../../../../packages/router/server/src/server-fn/interceptors.ts","../../../../packages/router/server/src/server-fn/same-origin.ts","../../../../packages/router/server/src/server-fn/dispatch.ts","../../../../packages/router/server/src/server-fn/ssr-dispatcher.ts","../../../../packages/router/server/src/provide-server-context.ts","../../../../packages/router/server/src/utils/reset-component-def-tviews.ts","../../../../packages/router/server/src/render.ts","../../../../packages/router/server/src/utils/stream-html.ts","../../../../packages/router/server/src/utils/stream-request.ts","../../../../packages/router/server/src/defer-reconcile-runtime.ts","../../../../packages/router/server/src/render-stream.ts","../../../../packages/router/server/src/server-fn/server-fn.ts","../../../../packages/router/server/src/server-fn/app-injector.ts","../../../../packages/router/server/src/server-fn/event-handler.ts","../../../../packages/router/server/src/analogjs-router-server.ts"],"sourcesContent":["import type { ServerFnDef } from '@analogjs/router';\n\n/**\n * Server-side registry of server functions, keyed by id. A `.server.ts` module\n * populates it as a side effect of `serverFn(...)` running at import time; the\n * Nitro dispatch route imports those modules to fill it, then looks up by id.\n */\nexport const serverFnRegistry = new Map<string, ServerFnDef>();\n","import { InjectionToken, type Provider } from '@angular/core';\n\nimport type { ServerFnContext } from '@analogjs/router';\n\n/** Context threaded through the interceptor chain and handed to the handler. */\nexport interface ServerFnInterceptorContext {\n readonly input: unknown;\n readonly context: ServerFnContext;\n /** Return a new context with additional typed fields merged in. */\n with(\n patch: Partial<ServerFnContext> & Record<string, unknown>,\n ): ServerFnInterceptorContext;\n}\n\nexport type ServerFnNext = (\n ctx: ServerFnInterceptorContext,\n) => Promise<unknown>;\n\n/** Functional interceptor, modeled on `HttpInterceptorFn`. */\nexport type ServerFnInterceptorFn = (\n ctx: ServerFnInterceptorContext,\n next: ServerFnNext,\n) => Promise<unknown> | unknown;\n\nexport const SERVER_FN_INTERCEPTORS = new InjectionToken<\n ServerFnInterceptorFn[]\n>('SERVER_FN_INTERCEPTORS');\n\nexport interface ServerFnsFeature {\n providers: Provider[];\n}\n\n/** `withServerFnInterceptors([...])` — registers the chain (DI, ordered). */\nexport function withServerFnInterceptors(\n interceptors: ServerFnInterceptorFn[],\n): ServerFnsFeature {\n return {\n providers: interceptors.map((fn) => ({\n provide: SERVER_FN_INTERCEPTORS,\n useValue: fn,\n multi: true,\n })),\n };\n}\n\n/** `provideServerFns(withServerFnInterceptors(...))` — mirrors provideHttpClient. */\nexport function provideServerFns(...features: ServerFnsFeature[]): Provider[] {\n return features.flatMap((f) => f.providers);\n}\n\nfunction makeCtx(\n input: unknown,\n context: ServerFnContext,\n): ServerFnInterceptorContext {\n return {\n input,\n context,\n with(patch) {\n return makeCtx(input, { ...context, ...patch } as ServerFnContext);\n },\n };\n}\n\n/**\n * Run the interceptor chain, then the handler, threading the context.\n *\n * `runInCtx` re-establishes the DI injection context around each interceptor\n * and the handler individually. This is what keeps `inject()` working in a\n * handler even when an upstream interceptor `await`s before calling `next`\n * (which would otherwise resume outside Angular's synchronous injection\n * context). It defaults to a pass-through for non-DI callers/tests.\n */\nexport async function runInterceptors(\n interceptors: ServerFnInterceptorFn[],\n input: unknown,\n handler: (\n input: unknown,\n context: ServerFnContext,\n ) => Promise<unknown> | unknown,\n runInCtx: <T>(fn: () => T) => T = (fn) => fn(),\n): Promise<unknown> {\n let i = -1;\n const dispatch: ServerFnNext = async (ctx) => {\n i += 1;\n if (i < interceptors.length) {\n return runInCtx(() => interceptors[i](ctx, dispatch));\n }\n return runInCtx(() => handler(ctx.input, ctx.context));\n };\n return dispatch(makeCtx(input, {} as ServerFnContext));\n}\n","/**\n * Same-origin enforcement for the server-function HTTP transport.\n *\n * Server functions are same-origin RPC: a client proxy only ever calls the\n * relative `/_analog/fn/:id` URL of its own app. A cross-origin page must not be\n * able to invoke them against a logged-in user (a CSRF-shaped attack), so the\n * transport rejects browser requests whose origin is not the app's own — out of\n * the box, with no per-app configuration.\n *\n * The signals used (`Sec-Fetch-Site`, `Origin`) are added by the browser and\n * cannot be forged by a cross-origin page's `fetch`. Non-browser callers (curl,\n * server-to-server, SSR in-process) send neither, so they are unaffected: the\n * guard blocks the cross-origin browser attack it is meant to, and nothing else.\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { ServerFnsFeature } from './interceptors';\n\n/** Node/h3 header bag shape (`IncomingHttpHeaders`). */\nexport type HeaderBag = Record<string, string | string[] | undefined>;\n\n/**\n * Origins permitted beyond the app's own, registered through DI:\n * `provideServerFns(withAllowedOrigins([...]))`. Empty by default — the\n * transport is same-origin unless an app opts out explicitly.\n */\nexport const SERVER_FN_ALLOWED_ORIGINS = new InjectionToken<string[]>(\n 'SERVER_FN_ALLOWED_ORIGINS',\n);\n\n/**\n * `withAllowedOrigins([...])` — permit cross-origin browser calls from the\n * listed origins, or pass `'*'` to disable the same-origin guard entirely.\n * Server functions are frequently cookie-authenticated, so this is an explicit\n * opt-out of CSRF protection: allow-list the exact origins you control.\n */\nexport function withAllowedOrigins(origins: string[]): ServerFnsFeature {\n return {\n providers: origins.map((origin) => ({\n provide: SERVER_FN_ALLOWED_ORIGINS,\n useValue: origin,\n multi: true,\n })),\n };\n}\n\nfunction firstHeader(value: string | string[] | undefined): string | undefined {\n return Array.isArray(value) ? value[0] : value;\n}\n\n/**\n * Whether an HTTP request to a server function may proceed.\n *\n * Allowed when the request is same-origin, carries no browser-origin signal at\n * all (a non-browser client, or a same-origin GET that omits `Origin`), or its\n * `Origin` is listed in `allowedOrigins`. Passing `'*'` in `allowedOrigins`\n * disables the check — the explicit opt-in to cross-origin access.\n *\n * `Sec-Fetch-Site` is the authoritative signal when present: `same-origin` and\n * `none` (a direct navigation, not a cross-site fetch) pass; `same-site` and\n * `cross-site` require an explicit `allowedOrigins` entry. When the header is\n * absent (older browsers, some proxies) the `Origin` host is compared to the\n * request host as a fallback.\n */\nexport function isServerFnOriginAllowed(\n headers: HeaderBag,\n allowedOrigins: readonly string[] = [],\n): boolean {\n if (allowedOrigins.includes('*')) {\n return true;\n }\n\n const origin = firstHeader(headers['origin']);\n const originAllowlisted =\n origin !== undefined && allowedOrigins.includes(origin);\n\n const site = firstHeader(headers['sec-fetch-site']);\n if (site) {\n if (site === 'same-origin' || site === 'none') {\n return true;\n }\n // same-site / cross-site: only when the origin is explicitly permitted.\n return originAllowlisted;\n }\n\n // No `Sec-Fetch-Site`: fall back to comparing the `Origin` host to the host.\n if (!origin) {\n // Non-browser client, or a same-origin GET with no `Origin` — not the\n // cross-origin browser request this guard exists to reject.\n return true;\n }\n if (originAllowlisted) {\n return true;\n }\n\n const host =\n firstHeader(headers['x-forwarded-host']) ?? firstHeader(headers['host']);\n if (!host) {\n return false;\n }\n try {\n return new URL(origin).host === host;\n } catch {\n return false;\n }\n}\n","import {\n Injector,\n runInInjectionContext,\n type StaticProvider,\n} from '@angular/core';\nimport { BASE_URL, LOCALE, REQUEST, RESPONSE } from '@analogjs/router/tokens';\nimport type { H3Event } from 'h3';\n\nimport { detectLocale, getBaseUrl } from '../provide-server-context';\nimport { serverFnRegistry } from './registry';\nimport { SERVER_FN_INTERCEPTORS, runInterceptors } from './interceptors';\nimport {\n SERVER_FN_ALLOWED_ORIGINS,\n isServerFnOriginAllowed,\n type HeaderBag,\n} from './same-origin';\n\nexport interface DispatchResult {\n status: number;\n body: unknown;\n /**\n * Headers from a returned `Response` (`fail`/`redirect`): Location, … The\n * value is an array when the header legitimately repeats, which is why\n * `Set-Cookie` is read separately below — collapsing several cookies into one\n * comma-joined value corrupts them.\n */\n headers?: Record<string, string | string[]>;\n}\n\nexport interface DispatchServerFnOptions {\n /**\n * The app's environment injector. The per-request injector is created as its\n * child, so handlers resolve app services (and `providedIn: 'root'` services,\n * when this is the app's bootstrapped injector) and registered interceptors\n * without re-listing them per request.\n */\n parent?: Injector;\n /** Extra per-request providers, for direct callers without an app injector. */\n providers?: StaticProvider[];\n /** Request HTTP method; enforced against the function's configured method. */\n method?: string;\n /**\n * Origins permitted beyond same-origin, merged with any registered through DI\n * (`provideServerFns(withAllowedOrigins([...]))`). The transport is\n * same-origin by default (cross-origin browser calls are rejected with 403);\n * `'*'` disables the check entirely. Only consulted for HTTP-transport calls\n * (those that pass `method`).\n */\n allowedOrigins?: string[];\n}\n\n/**\n * Server-side dispatch for a server function call.\n *\n * 1. reject cross-origin browser calls (403), unless allow-listed — HTTP\n * transport only (in-process callers omit `method` and are exempt)\n * 2. look up the function by id\n * 3. enforce the configured HTTP method (405 on mismatch)\n * 4. require a JSON body on input-bearing calls (415 otherwise)\n * 5. validate `input` against the Standard-Schema (4xx on failure)\n * 6. build a per-request injector (REQUEST/RESPONSE + app providers)\n * 7. run the interceptor chain, then the handler, re-entering\n * `runInInjectionContext` at every hop so `inject()` works even after an\n * interceptor `await`s before calling `next`\n * 8. a `Response` returned by an interceptor/handler (`fail`/`redirect`)\n * short-circuits with its status AND headers\n *\n * `options.method` is the request's HTTP method; when provided it is enforced\n * against the function's configured method AND it turns on the same-origin\n * guard. Transports (the generated Nitro handler) always pass it; trusted\n * in-process callers may omit it, which also exempts them from the origin guard.\n */\nexport async function dispatchServerFn(\n id: string,\n rawInput: unknown,\n event: Pick<H3Event, 'node'>,\n options: DispatchServerFnOptions = {},\n): Promise<DispatchResult> {\n const { parent, providers = [], method, allowedOrigins = [] } = options;\n const headers = (event.node.req.headers ?? {}) as HeaderBag;\n\n // Same-origin guard runs first — before we even confirm the function exists —\n // so a cross-origin page cannot probe which ids are registered. Gated on\n // `method` so only HTTP-transport calls are checked; in-process callers omit\n // it. The signals (`Origin`/`Sec-Fetch-Site`) are browser-set and unforgeable.\n if (method) {\n const allowed = [\n ...allowedOrigins,\n ...(parent?.get(SERVER_FN_ALLOWED_ORIGINS, []) ?? []),\n ];\n if (!isServerFnOriginAllowed(headers, allowed)) {\n return {\n status: 403,\n body: { message: 'Cross-origin server function call rejected' },\n };\n }\n }\n\n const def = serverFnRegistry.get(id);\n if (!def) {\n return { status: 404, body: { message: `Unknown server function: ${id}` } };\n }\n\n // Enforce the transport method: a GET-only read must not be POSTable, and an\n // input-bearing POST must not be reachable via GET.\n if (method && method.toUpperCase() !== def.method) {\n return {\n status: 405,\n body: { message: `Method ${method} not allowed for ${id}` },\n headers: { Allow: def.method },\n };\n }\n\n // Input travels as a JSON body. Reject anything else before decoding, so a\n // form post from a cross-origin page (which cannot set a JSON content type\n // without a CORS preflight) never reaches a handler. HTTP transport only.\n if (method && def.method === 'POST' && !isJsonContentType(headers)) {\n return {\n status: 415,\n body: { message: 'Server functions accept an application/json body' },\n };\n }\n\n let input = rawInput;\n if (def.config.input) {\n const result = await def.config.input['~standard'].validate(rawInput);\n if ('issues' in result && result.issues) {\n return { status: 400, body: { errors: result.issues } };\n }\n input = (result as { value: unknown }).value;\n }\n\n // Child of the app injector: only the request tokens are per-request; app\n // services + interceptors resolve up the parent chain. All four are provided\n // here so a handler resolves them the same way it would inside a component\n // during SSR, whether it was reached over HTTP or in-process.\n const req = event.node.req as Parameters<typeof getBaseUrl>[0];\n const locale = detectLocale(req);\n const injector = Injector.create({\n parent,\n providers: [\n { provide: REQUEST, useValue: event.node.req },\n { provide: RESPONSE, useValue: event.node.res },\n { provide: BASE_URL, useValue: getBaseUrl(req) },\n ...(locale ? [{ provide: LOCALE, useValue: locale }] : []),\n ...providers,\n ],\n });\n\n // Re-enter the injection context at each hop rather than wrapping the whole\n // chain once: an interceptor that awaits before `next` would otherwise run the\n // handler outside the context and break `inject()`.\n const runInCtx = <T>(fn: () => T): T => runInInjectionContext(injector, fn);\n const interceptors = injector.get(SERVER_FN_INTERCEPTORS, []);\n const outcome = await runInterceptors(\n interceptors,\n input,\n def.handler,\n runInCtx,\n );\n\n if (outcome instanceof Response) {\n const text = await outcome.text();\n const body = text ? safeJson(text) : null;\n const headers: Record<string, string | string[]> = {};\n outcome.headers.forEach((value, key) => {\n if (key.toLowerCase() !== 'set-cookie') {\n headers[key] = value;\n }\n });\n // `Headers.forEach` yields cookies comma-joined into a single value, which\n // is not a valid way to send more than one; `getSetCookie` keeps them apart.\n const setCookie = outcome.headers.getSetCookie?.() ?? [];\n if (setCookie.length) {\n headers['set-cookie'] = setCookie;\n }\n return {\n status: outcome.status,\n body,\n headers: Object.keys(headers).length ? headers : undefined,\n };\n }\n\n return { status: 200, body: outcome };\n}\n\nfunction isJsonContentType(headers: HeaderBag): boolean {\n const contentType = headers['content-type'];\n const value = Array.isArray(contentType) ? contentType[0] : contentType;\n if (!value) {\n return false;\n }\n const mediaType = value.split(';')[0].trim().toLowerCase();\n return mediaType === 'application/json' || mediaType.endsWith('+json');\n}\n\nfunction safeJson(text: string): unknown {\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n}\n","import { Injector } from '@angular/core';\nimport { HttpErrorResponse } from '@angular/common/http';\nimport type { ServerRequest, ServerResponse } from '@analogjs/router/tokens';\nimport type { ServerFn, ServerFnDispatcher } from '@analogjs/router';\nimport type { H3Event } from 'h3';\n\nimport { dispatchServerFn } from './dispatch';\n\n/**\n * The in-process transport used during SSR. `ServerFnClient` picks this up from\n * DI and calls the handler directly instead of issuing an HTTP request back\n * into the app — the render and the handler already share a process and a\n * request, so the round-trip only adds latency (and would need an absolute URL).\n *\n * `method` is deliberately not passed to `dispatchServerFn`: this is a trusted\n * in-process caller, so the HTTP-transport-only checks (same-origin, method\n * enforcement, content type) do not apply. Validation and the interceptor chain\n * still run, so an SSR call behaves like a browser call in every other respect.\n *\n * A non-2xx result is thrown as an `HttpErrorResponse` so the failure surfaces\n * on `resource.error()` exactly as it does in the browser.\n */\nexport function createServerFnDispatcher(\n req: ServerRequest,\n res: ServerResponse,\n): ServerFnDispatcher {\n const event = { node: { req, res } } as unknown as Pick<H3Event, 'node'>;\n\n return async <In, Out>(\n fn: ServerFn<In, Out>,\n input: In,\n injector: Injector,\n ): Promise<Out> => {\n const { status, body } = await dispatchServerFn(fn.id, input, event, {\n parent: injector,\n });\n\n if (status < 200 || status > 299) {\n throw new HttpErrorResponse({ status, error: body, url: fn.url });\n }\n\n return body as Out;\n };\n}\n","import { StaticProvider, ɵresetCompiledComponents } from '@angular/core';\nimport { ɵSERVER_CONTEXT as SERVER_CONTEXT } from '@angular/platform-server';\n\nimport {\n BASE_URL,\n LOCALE,\n REQUEST,\n RESPONSE,\n ServerRequest,\n ServerResponse,\n} from '@analogjs/router/tokens';\nimport { SERVER_FN_DISPATCHER } from '@analogjs/router';\n\nimport { createServerFnDispatcher } from './server-fn/ssr-dispatcher';\n\nexport function provideServerContext({\n req,\n res,\n}: {\n req: ServerRequest;\n res: ServerResponse;\n}): StaticProvider[] {\n const baseUrl = getBaseUrl(req);\n const locale = detectLocale(req);\n\n // Optional chaining: a Nitro-bundled caller has no `import.meta.env` at all.\n if (import.meta.env?.DEV) {\n ɵresetCompiledComponents();\n }\n\n return [\n { provide: SERVER_CONTEXT, useValue: 'ssr-analog' },\n { provide: REQUEST, useValue: req },\n { provide: RESPONSE, useValue: res },\n { provide: BASE_URL, useValue: baseUrl },\n // Server functions called while rendering run in-process, in this injector.\n {\n provide: SERVER_FN_DISPATCHER,\n useValue: createServerFnDispatcher(req, res),\n },\n ...(locale ? [{ provide: LOCALE, useValue: locale }] : []),\n ];\n}\n\n/**\n * Detects the locale from the request URL path prefix or Accept-Language header.\n * URL prefix takes priority (e.g. /fr/about -> 'fr').\n */\nexport function detectLocale(req: ServerRequest): string | undefined {\n const url = req.originalUrl || req.url || '';\n const localeFromUrl = extractLocaleFromUrl(url);\n if (localeFromUrl) {\n return localeFromUrl;\n }\n\n return parseAcceptLanguage(req.headers['accept-language']);\n}\n\n/**\n * Extracts a locale from the first URL path segment if it matches\n * a BCP 47-like pattern (e.g. 'en', 'en-US', 'zh-Hans-CN').\n */\nexport function extractLocaleFromUrl(url: string): string | undefined {\n const pathname = url.split('?')[0];\n const segments = pathname.split('/').filter(Boolean);\n if (segments.length === 0) {\n return undefined;\n }\n\n const firstSegment = segments[0];\n // Match BCP 47 language tags: 2-letter language code with optional region/script\n // e.g. 'en', 'en-US', 'zh-Hans', 'zh-Hans-CN'\n if (/^[a-z]{2}(-[a-zA-Z]{2,4})?(-[a-zA-Z]{2}|\\d{3})?$/.test(firstSegment)) {\n return firstSegment;\n }\n\n return undefined;\n}\n\n/**\n * Parses the Accept-Language header and returns the most preferred language.\n */\nexport function parseAcceptLanguage(\n header: string | undefined,\n): string | undefined {\n if (!header) {\n return undefined;\n }\n\n const locales = header\n .split(',')\n .map((part) => {\n const [locale, qPart] = part.trim().split(';');\n const q = qPart ? parseFloat(qPart.replace('q=', '')) : 1;\n return { locale: locale.trim(), q };\n })\n .sort((a, b) => b.q - a.q);\n\n return locales[0]?.locale || undefined;\n}\n\nexport function getBaseUrl(req: ServerRequest) {\n const protocol = getRequestProtocol(req);\n const { headers } = req;\n // Node's `IncomingMessage` has no `originalUrl`, and a server function\n // endpoint is reached with a plain request, so fall back before dereferencing.\n const originalUrl = req.originalUrl || req.url || '/';\n const parsedUrl = new URL(\n '',\n `${protocol}://${headers.host}${\n originalUrl.endsWith('/')\n ? originalUrl.substring(0, originalUrl.length - 1)\n : originalUrl\n }`,\n );\n const baseUrl = parsedUrl.origin;\n\n return baseUrl;\n}\n\nexport function getRequestProtocol(\n req: ServerRequest,\n opts: { xForwardedProto?: boolean } = {},\n) {\n if (\n opts.xForwardedProto !== false &&\n req.headers['x-forwarded-proto'] === 'https'\n ) {\n return 'https';\n }\n\n return (req.connection as any)?.encrypted ? 'https' : 'http';\n}\n","/**\n * Nulls `def.tView` on every component definition that Angular has\n * compiled in this process. Angular caches the result of `consts()` on\n * `def.tView` — that factory is where `$localize` tagged templates are\n * evaluated — so without this reset the first rendered locale would be\n * frozen into the cache for the process lifetime.\n *\n * The set on `globalThis.__ngComponentDefs` is populated by a Vite\n * transform in `@analogjs/platform` that patches `@angular/core`'s\n * `getComponentId()` to mirror every compiled component definition to\n * a global Set, bypassing the `ngServerMode` guard that normally\n * prevents registration on the server.\n */\nexport function resetComponentDefTViews(): void {\n const defs = (globalThis as any).__ngComponentDefs as Set<any> | undefined;\n if (!defs) return;\n for (const def of defs) {\n def.tView = null;\n }\n}\n","import {\n ApplicationConfig,\n Provider,\n Type,\n enableProdMode,\n} from '@angular/core';\nimport {\n bootstrapApplication,\n type BootstrapContext,\n} from '@angular/platform-browser';\nimport { renderApplication } from '@angular/platform-server';\nimport type { ServerContext } from '@analogjs/router/tokens';\n\nimport { provideServerContext } from './provide-server-context';\nimport { resetComponentDefTViews } from './utils/reset-component-def-tviews';\n\n// Optional chaining: the server-function dispatch endpoint imports this entry\n// from a Nitro bundle, where `import.meta.env` is not defined at all.\nif (import.meta.env?.PROD) {\n enableProdMode();\n}\n\n/**\n * Returns a function that accepts the navigation URL,\n * the root HTML, and server context.\n *\n * @param rootComponent\n * @param config\n * @param platformProviders\n * @returns Promise<string | Reponse>\n */\nexport function render(\n rootComponent: Type<unknown>,\n config: ApplicationConfig,\n platformProviders: Provider[] = [],\n) {\n function bootstrap(context?: BootstrapContext) {\n return bootstrapApplication(rootComponent, config, context);\n }\n\n return async function render(\n url: string,\n document: string,\n serverContext: ServerContext,\n ) {\n resetComponentDefTViews();\n\n const html = await renderApplication(bootstrap, {\n document,\n url,\n platformProviders: [\n provideServerContext(serverContext),\n platformProviders,\n ],\n });\n\n return html;\n };\n}\n","/**\n * Pure string helpers for slicing a fully rendered SSR document into the parts\n * the streaming renderer flushes: the shell up to `<body>`, the authoritative\n * `<body>` inner HTML for the tail, and the authoritative `<head>` inner HTML\n * for the finalize-time head reconcile. Extracted from `render-stream` so they\n * can be unit tested without driving the platform.\n */\n\n/** Byte offset just after the opening `<body>` tag, or 0 if none. */\nexport function afterBodyOpen(html: string): number {\n const m = /<body[^>]*>/i.exec(html);\n return m ? m.index + m[0].length : 0;\n}\n\n/** Inner HTML of `<body>` from a fully rendered document string. */\nexport function bodyInner(html: string): string {\n const start = afterBodyOpen(html);\n const end = html.lastIndexOf('</body>');\n return html.slice(start, end > -1 ? end : html.length);\n}\n\n/** Inner HTML of `<head>` from a fully rendered document string. */\nexport function headInner(html: string): string {\n const open = /<head[^>]*>/i.exec(html);\n if (!open) return '';\n const start = open.index + open[0].length;\n const end = html.indexOf('</head>', start);\n return html.slice(start, end > -1 ? end : start);\n}\n","import type { ServerContext } from '@analogjs/router/tokens';\n\n/**\n * Per-request decisions about whether the streaming renderer should fall back\n * to a buffered render. Extracted from `render-stream` so they can be unit\n * tested without driving the platform.\n */\n\n/**\n * User agents that receive a fully buffered render (with a resolved `<head>`)\n * instead of the streamed shell. Streaming flushes the head before the app has\n * set a dynamic title/meta and reconciles it via a finalize script; a crawler\n * that does not run that script would index the shell's static head. Mirrors\n * Nuxt's bot bypass — streaming targets interactive clients, bots get the\n * buffered path whose head is byte-identical to the classic `render()`.\n */\nexport const SSR_BOT_RE =\n /bot|crawl|spider|slurp|mediapartners|facebookexternalhit|embedly|quora link preview|outbrain|pinterest|vkshare|w3c_validator|whatsapp|telegrambot|lighthouse|google-inspectiontool|headlesschrome|bingpreview/i;\n\nexport function isLikelyBot(serverContext: ServerContext): boolean {\n const ua = serverContext?.req?.headers?.['user-agent'];\n return typeof ua === 'string' && SSR_BOT_RE.test(ua);\n}\n\n/**\n * Whether streaming is disabled for this request by a `streaming: false` route\n * rule. The platform plugin translates that rule into an `x-analog-no-streaming`\n * response header (mirroring how `ssr: false` becomes `x-analog-no-ssr`); when\n * present, `renderStream` produces the buffered `render()` output for this\n * route instead of streaming.\n */\nexport function streamingDisabledByRoute(\n serverContext: ServerContext,\n): boolean {\n return serverContext?.res?.getHeader?.('x-analog-no-streaming') === 'true';\n}\n","/**\n * Tiny client runtime for progressive streaming SSR — EXPERIMENTAL.\n *\n * `renderStream` streams the document in three parts:\n * 1. the head + this runtime + an empty `<div data-analog-stream>` region;\n * 2. each `@defer` block, as it resolves on the server, as a\n * `<template data-analog-defer=\"ID\">…</template>` followed by a call to\n * `window.__analogPaint(\"ID\")` — this runtime paints the block into the\n * streaming region immediately, so content appears progressively and out\n * of document order;\n * 3. the authoritative document tail: the app's resolved `<head>` in a\n * `<template data-analog-head>` and the hydration-annotated body in a\n * `<template data-analog-authoritative>`, followed by\n * `window.__analogReconcileHead()` + `window.__analogFinalize()`. The head\n * is reconciled first (a dynamically-set `<title>`/meta is applied to the\n * live document, since the streamed shell head was flushed before the app\n * ran), then the body is swapped to the exact document Angular's\n * incremental hydration expects.\n *\n * Emitted into the document by `renderStream`. Exported as a string so it can\n * be injected verbatim and unit-tested against a DOM.\n */\nexport const DEFER_RECONCILE_RUNTIME = /* js */ `\n(function () {\n function region() {\n return document.querySelector('[data-analog-stream]');\n }\n window.__analogPaint = function (id) {\n var tpl = document.querySelector('template[data-analog-defer=\"' + id + '\"]');\n var r = region();\n if (!tpl || !r) return;\n r.appendChild(tpl.content.cloneNode(true));\n tpl.remove();\n };\n window.__analogReconcileHead = function () {\n // The shell head was flushed before the app rendered, so any title/meta the\n // app set during render (Title/Meta services, route meta) is missing from\n // the live document. Apply the authoritative head here, before hydration —\n // matching how a buffered render would have produced the head. Idempotent:\n // tags already present (charset, viewport, stylesheet/preload links) are\n // matched and left as-is; only changed/added ones are updated.\n var tpl = document.querySelector('template[data-analog-head]');\n if (!tpl) return;\n var frag = tpl.content;\n var head = document.head;\n var title = frag.querySelector('title');\n if (title) document.title = title.textContent || '';\n function metaKey(m) {\n if (m.hasAttribute('charset')) return 'charset';\n var attrs = ['name', 'property', 'http-equiv', 'itemprop'];\n for (var i = 0; i < attrs.length; i++) {\n if (m.hasAttribute(attrs[i])) return attrs[i] + '=' + m.getAttribute(attrs[i]);\n }\n return null;\n }\n var existingMeta = {};\n var metas = head.querySelectorAll('meta');\n for (var i = 0; i < metas.length; i++) {\n var k = metaKey(metas[i]);\n if (k) existingMeta[k] = metas[i];\n }\n frag.querySelectorAll('meta').forEach(function (m) {\n var key = metaKey(m);\n if (key == null) return;\n if (existingMeta[key]) existingMeta[key].replaceWith(m.cloneNode(true));\n else head.appendChild(m.cloneNode(true));\n });\n var existingHref = {};\n var links = head.querySelectorAll('link[href]');\n for (var j = 0; j < links.length; j++) {\n existingHref[links[j].getAttribute('href')] = true;\n }\n frag.querySelectorAll('link').forEach(function (l) {\n var href = l.getAttribute('href');\n if (href && existingHref[href]) return;\n head.appendChild(l.cloneNode(true));\n if (href) existingHref[href] = true;\n });\n tpl.remove();\n };\n window.__analogFinalize = function () {\n var auth = document.querySelector('template[data-analog-authoritative]');\n if (!auth) return;\n // Replace the entire body — preview region, block templates and runtime\n // scripts — with just the authoritative body, so the reconciled DOM matches\n // a buffered render byte-for-byte before hydration boots.\n document.body.replaceChildren(auth.content.cloneNode(true));\n };\n})();\n`;\n","/**\n * Progressive streaming SSR renderer — EXPERIMENTAL.\n *\n * Returns a `ReadableStream<Uint8Array>` that flushes bytes DURING the render,\n * not after it:\n * 1. the document head + a client reconcile runtime are flushed immediately,\n * before the app has finished rendering, so the browser starts fetching\n * assets right away;\n * 2. each `@defer (hydrate …)` block's content is flushed the moment it\n * resolves on the server — out of document order — while later blocks are\n * still pending (proven: a slow block does not hold back an early one);\n * 3. once the app is stable, the authoritative, fully hydration-annotated\n * document is flushed as the tail. This is byte-identical to a buffered\n * `renderApplication`, and is what Angular's incremental hydration runs\n * against on the client.\n *\n * Unlike a buffered renderer, this drives the platform directly\n * (`platformServer` + `bootstrapApplication` + `ɵrenderInternal`) so it can\n * interleave flushes with rendering. Angular's hydration annotation is\n * whole-document (the root's `ngh` index references every `@defer` container),\n * so the authoritative hydration payload is necessarily the tail: RENDERING\n * streams progressively, and hydration begins once the tail arrives.\n *\n * Depends on an upstream Angular per-block resolution hook exposed on two\n * globals (see {@link SsrStreamingGlobals}). When the primitive is absent,\n * `renderStream` degrades to a single buffered chunk so behaviour matches the\n * classic `render()` path, which is unchanged and remains the default.\n */\nimport {\n ApplicationConfig,\n Provider,\n Type,\n enableProdMode,\n} from '@angular/core';\nimport {\n bootstrapApplication,\n type BootstrapContext,\n} from '@angular/platform-browser';\nimport {\n renderApplication,\n platformServer,\n INITIAL_CONFIG,\n ɵrenderInternal as renderInternal,\n} from '@angular/platform-server';\nimport type { PlatformRef, ApplicationRef } from '@angular/core';\nimport type { ServerContext } from '@analogjs/router/tokens';\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nimport { provideServerContext } from './provide-server-context';\nimport { resetComponentDefTViews } from './utils/reset-component-def-tviews';\nimport { afterBodyOpen, bodyInner, headInner } from './utils/stream-html';\nimport { isLikelyBot, streamingDisabledByRoute } from './utils/stream-request';\nimport { DEFER_RECONCILE_RUNTIME } from './defer-reconcile-runtime';\n\nif (import.meta.env.PROD) {\n enableProdMode();\n}\n\n/**\n * Shape of the upstream Angular streaming primitive we consume, published on\n * `globalThis` by the streaming-enabled `@angular/core` build (see the\n * `deferStreamingPlugin` in `@analogjs/platform`):\n * - `__analogSsrDeferCapture` — the patched core invokes it once per resolved\n * `@defer` block on the server, passing the block's live `lContainer`. We\n * install a stable dispatcher here that routes to the current render (see\n * `installCaptureDispatcher`).\n * - `__analogSsrInternals.collectNativeNodesInLContainer` — collects a block's\n * rendered root nodes so we can serialize them via domino `outerHTML`.\n */\ninterface SsrStreamingGlobals {\n __analogSsrDeferCapture?: (ev: {\n ssrUniqueId: string | null;\n lContainer: unknown;\n }) => void;\n __analogSsrInternals?: {\n collectNativeNodesInLContainer?: (\n lContainer: unknown,\n out: unknown[],\n ) => void;\n };\n}\n\nfunction streamingPrimitiveAvailable(): boolean {\n const g = globalThis as unknown as SsrStreamingGlobals;\n return (\n typeof g.__analogSsrInternals?.collectNativeNodesInLContainer === 'function'\n );\n}\n\ntype DeferCaptureEvent = { ssrUniqueId: string | null; lContainer: unknown };\ntype DeferCaptureHandler = (ev: DeferCaptureEvent) => void;\n\n/**\n * Per-render capture handlers live in async-local storage, not a single shared\n * global slot, so concurrent renders in one process do not clobber each other.\n * `globalThis.__analogSsrDeferCapture` is a stable dispatcher installed once; it\n * routes each resolved `@defer` block to the handler of the render whose async\n * context it fired in. A block that resolves outside any render (no store) is a\n * no-op.\n */\nconst captureStore = new AsyncLocalStorage<DeferCaptureHandler>();\n\nfunction installCaptureDispatcher(): void {\n const g = globalThis as unknown as {\n __analogSsrDeferCapture?: DeferCaptureHandler & {\n __analogDispatcher?: boolean;\n };\n };\n if (g.__analogSsrDeferCapture?.__analogDispatcher) return;\n const dispatch = ((ev: DeferCaptureEvent) => {\n captureStore.getStore()?.(ev);\n }) as DeferCaptureHandler & { __analogDispatcher?: boolean };\n dispatch.__analogDispatcher = true;\n g.__analogSsrDeferCapture = dispatch;\n}\n\nlet warnedMissingPrimitive = false;\nfunction warnMissingPrimitiveOnce(): void {\n if (warnedMissingPrimitive || !import.meta.env.DEV) return;\n warnedMissingPrimitive = true;\n console.warn(\n '[@analogjs/router] renderStream: the streaming hook was not found on ' +\n '@angular/core, so rendering falls back to buffered. Enable ' +\n '`experimental.streaming` in your Analog config; if it already is, your ' +\n 'installed Angular version may be incompatible with the streaming patch.',\n );\n}\n\n/**\n * Serialize a `@defer` block's live domino subtree to HTML. Called a macrotask\n * after the block resolves, by which point change detection has filled in the\n * block's interpolations.\n */\nfunction serializeLContainerHtml(lContainer: unknown): string {\n const g = globalThis as unknown as SsrStreamingGlobals;\n const collect = g.__analogSsrInternals?.collectNativeNodesInLContainer;\n if (!collect) return '';\n const nodes: any[] = [];\n collect(lContainer, nodes);\n let html = '';\n for (const n of nodes) html += n?.outerHTML ?? n?.data ?? n?.nodeValue ?? '';\n return html;\n}\n\n/** Destroy the platform on a macrotask, matching `renderApplication`. */\nfunction asyncDestroyPlatform(platformRef: PlatformRef): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(() => {\n platformRef.destroy();\n resolve();\n }, 0);\n });\n}\n\n/**\n * Returns a function that renders a URL to a `ReadableStream<Uint8Array>`.\n *\n * Usage in main.server.ts:\n * ```ts\n * import { renderStream } from '@analogjs/router/server';\n * export default renderStream(App, config);\n * ```\n */\nexport function renderStream(\n rootComponent: Type<unknown>,\n config: ApplicationConfig,\n platformProviders: Provider[] = [],\n) {\n function bootstrap(context: BootstrapContext) {\n return bootstrapApplication(rootComponent, config, context);\n }\n\n return async function renderStream(\n url: string,\n document: string,\n serverContext: ServerContext,\n ): Promise<ReadableStream<Uint8Array>> {\n // Reset before every render — both the buffered fallback below and the\n // streaming path — so a prior render's locale/consts are not frozen for the\n // process lifetime (parity with render.ts).\n resetComponentDefTViews();\n\n // Fall back to a single buffered chunk so output matches the classic path\n // for:\n // - crawlers, which may not run the finalize script that reconciles a\n // dynamic <head>, so they get a buffered render with a resolved head;\n // - routes with a `streaming: false` rule (opt out per route);\n // - a missing streaming primitive.\n const primitiveAvailable = streamingPrimitiveAvailable();\n const bot = isLikelyBot(serverContext);\n const routeDisabled = streamingDisabledByRoute(serverContext);\n if (bot || routeDisabled || !primitiveAvailable) {\n // Warn only when the primitive is genuinely absent — the bot and\n // route-opt-out paths fall back to buffered by design, not by degradation.\n if (!bot && !routeDisabled && !primitiveAvailable) {\n warnMissingPrimitiveOnce();\n }\n const html = await renderApplication(\n (context) => bootstrapApplication(rootComponent, config, context),\n {\n document,\n url,\n platformProviders: [\n provideServerContext(serverContext),\n platformProviders,\n ],\n },\n );\n return new ReadableStream({\n start(controller) {\n controller.enqueue(new TextEncoder().encode(html as string));\n controller.close();\n },\n });\n }\n\n installCaptureDispatcher();\n const encoder = new TextEncoder();\n\n // The stream is returned immediately; `start` fills it as the render\n // progresses, so the consumer receives the head, then each @defer block the\n // moment it resolves, then the authoritative tail — true streaming.\n return new ReadableStream<Uint8Array>({\n async start(controller) {\n const enqueue = (s: string) => controller.enqueue(encoder.encode(s));\n\n // The capture handler fires once per @defer block as it resolves. The\n // block's DOM is not filled until the next change-detection tick, so we\n // serialize + flush it a macrotask later — flushing DURING the render.\n // It is scoped to this render via async-local storage (see\n // installCaptureDispatcher) so concurrent renders never cross-talk.\n let blockIndex = 0;\n let capturing = true;\n const seen = new Set<unknown>();\n const pendingFlushes: Promise<void>[] = [];\n const onBlockResolved: DeferCaptureHandler = (ev) => {\n // A block can reach `Complete` more than once during a render; only\n // stream each container once. Also ignore any resolution that fires\n // after the render has moved on to serializing the authoritative tail.\n if (!capturing || seen.has(ev.lContainer)) return;\n seen.add(ev.lContainer);\n const id = `s${blockIndex++}`;\n pendingFlushes.push(\n new Promise<void>((resolve) => {\n setTimeout(() => {\n const html = serializeLContainerHtml(ev.lContainer);\n enqueue(\n `<template data-analog-defer=\"${id}\">${html}</template>` +\n `<script>window.__analogPaint&&window.__analogPaint(${JSON.stringify(id)})</script>`,\n );\n resolve();\n }, 0);\n }),\n );\n };\n\n // Run the whole render inside the async-local context so every\n // change-detection tick and @defer resolution it schedules routes back\n // to THIS render's handler.\n await captureStore.run(onBlockResolved, async () => {\n const platformRef = platformServer([\n { provide: INITIAL_CONFIG, useValue: { document, url } },\n provideServerContext(serverContext),\n platformProviders,\n ]);\n\n // 1. Flush the head + reconcile runtime immediately (before the app is\n // rendered), then open the live streaming region.\n enqueue(\n document.slice(0, afterBodyOpen(document)) +\n `<script>${DEFER_RECONCILE_RUNTIME}</script>` +\n `<div data-analog-stream></div>`,\n );\n\n let appRef: ApplicationRef | undefined;\n let errored = false;\n try {\n // 2. Bootstrap + render. Blocks resolve out of order during this\n // phase and flush via the capture handler above.\n appRef = await bootstrap({ platformRef } as BootstrapContext);\n await appRef.whenStable();\n await Promise.all(pendingFlushes);\n // Stop capturing before serializing the tail so late resolutions\n // triggered by the hydration pass are not streamed as extra blocks.\n capturing = false;\n\n // 3. Flush the authoritative, fully hydration-annotated document as\n // the tail. Carried in <template>s (their inert `ng-state`\n // script survives). The app's resolved <head> ships alongside so\n // a dynamically-set title/meta — set during render, after the\n // shell head was already flushed — is reconciled onto the live\n // document before the runtime swaps in the body and hydration\n // boots.\n const authoritative = await renderInternal(platformRef, appRef);\n enqueue(\n `<template data-analog-head>${headInner(authoritative)}</template>` +\n `<template data-analog-authoritative>${bodyInner(authoritative)}</template>` +\n `<script>window.__analogReconcileHead&&window.__analogReconcileHead();` +\n `window.__analogFinalize&&window.__analogFinalize()</script>` +\n `</body></html>`,\n );\n } catch (err) {\n // The head + runtime were already flushed, so the status/headers are\n // committed; error the stream (a no-op silent close would hand the\n // client a truncated, non-hydratable 200) and log with block context.\n errored = true;\n console.error(\n `[@analogjs/router] renderStream failed for ${url} after ` +\n `${blockIndex} block(s); response truncated.`,\n err,\n );\n controller.error(err);\n } finally {\n await asyncDestroyPlatform(platformRef);\n if (!errored) controller.close();\n }\n });\n },\n });\n };\n}\n","import { createServerFnRef } from '@analogjs/router';\nimport type {\n ServerFn,\n ServerFnConfig,\n ServerFnHandler,\n StandardSchemaV1,\n} from '@analogjs/router';\n\nimport { serverFnRegistry } from './registry';\n\n/**\n * Define a server function. Authored in a `*.server.ts` module.\n *\n * Three call shapes, chosen for ergonomics — they all normalize to the same\n * `(config, handler)` form and the build transform derives the route id for each:\n *\n * ```ts\n * serverFn(() => inject(Svc).list()); // input-less GET\n * serverFn(schema, (input) => …); // schema ⇒ POST + input\n * serverFn({ method: 'POST' }, () => …); // explicit config\n * ```\n *\n * On the server the function self-registers and its handler runs via\n * `dispatchServerFn`. On the client the build transform replaces the body with a\n * proxy that calls `/_analog/fn/<id>`; the reference still carries\n * `id`/`url`/`method` so `injectServerFn`/`ServerFnClient` can dispatch.\n */\nexport function serverFn<Out>(\n handler: ServerFnHandler<void, Out>,\n): ServerFn<void, Out>;\nexport function serverFn<In, Out>(\n input: StandardSchemaV1<In>,\n handler: ServerFnHandler<In, Out>,\n): ServerFn<In, Out>;\nexport function serverFn<In, Out>(\n config: ServerFnConfig<In>,\n handler: ServerFnHandler<In, Out>,\n): ServerFn<In, Out>;\nexport function serverFn(\n arg1: unknown,\n arg2?: ServerFnHandler<unknown, unknown>,\n): ServerFn<unknown, unknown> {\n const { config, handler } = normalizeArgs(arg1, arg2);\n\n // GET is reserved for input-less reads; an input schema requires POST (the\n // input travels in the body, not the query). Build transforms reject this too.\n if (config.method === 'GET' && config.input) {\n throw new Error(\n '[analog] a serverFn with `input` must use POST; GET is reserved for input-less reads.',\n );\n }\n\n // `createServerFnRef` throws if the build-derived id is missing, so `ref.id`\n // is the authoritative route key here.\n const ref = createServerFnRef<unknown, unknown>(config);\n\n serverFnRegistry.set(ref.id, {\n id: ref.id,\n method: ref.method,\n config,\n handler,\n });\n\n return ref;\n}\n\nfunction normalizeArgs(\n arg1: unknown,\n arg2?: ServerFnHandler<unknown, unknown>,\n): {\n config: ServerFnConfig<unknown>;\n handler: ServerFnHandler<unknown, unknown>;\n} {\n // serverFn(handler) — input-less GET.\n if (typeof arg1 === 'function') {\n return {\n config: {},\n handler: arg1 as ServerFnHandler<unknown, unknown>,\n };\n }\n // serverFn(schema, handler) — a Standard Schema ⇒ POST + input.\n if (isStandardSchema(arg1)) {\n return {\n config: { input: arg1 as StandardSchemaV1<unknown> },\n handler: arg2 as ServerFnHandler<unknown, unknown>,\n };\n }\n // serverFn(config, handler) — explicit config object.\n return {\n config: (arg1 as ServerFnConfig<unknown>) ?? {},\n handler: arg2 as ServerFnHandler<unknown, unknown>,\n };\n}\n\nfunction isStandardSchema(value: unknown): value is StandardSchemaV1<unknown> {\n return typeof value === 'object' && value !== null && '~standard' in value;\n}\n","import {\n type ApplicationConfig,\n Injector,\n type StaticProvider,\n} from '@angular/core';\nimport { createApplication } from '@angular/platform-browser';\nimport {\n platformServer,\n provideServerRendering,\n} from '@angular/platform-server';\n\n/**\n * Builds the parent injector the server-function dispatch endpoint runs handlers\n * against, over HTTP.\n *\n * A plain `Injector.create({ providers })` resolves explicitly-listed providers\n * but not tree-shakeable `providedIn: 'root'` services — those attach to a\n * *bootstrapped* application's root injector, which `Injector.create` is not.\n * So the in-process SSR leg (whose parent is the app's own bootstrapped\n * injector) resolved `root` services while the HTTP leg did not — the same\n * handler could work while rendering and fail when called from the browser.\n *\n * Bootstrapping a real application on the server platform closes that gap: the\n * returned `appRef.injector` is a root environment injector, so both listed\n * providers and `providedIn: 'root'` services resolve, matching SSR.\n *\n * The generated endpoint passes the app's own server `ApplicationConfig` (the\n * one `main.server.ts` renders with), so a handler sees exactly the DI the app\n * configured — services, tokens, and interceptors alike — with no second\n * provider list to keep in sync. No root component is bootstrapped\n * (`createApplication`, not `bootstrapApplication`), so nothing renders, no\n * change detection runs, and the router registers but never navigates. It is a\n * DI container with the app's providers, built once and reused for the process,\n * with only `REQUEST`/`RESPONSE` rebuilt per call in the child.\n *\n * A bare provider array is also accepted (direct callers and tests without an\n * app config); it is wrapped with `provideServerRendering` so the server tokens\n * resolve the same way.\n */\nexport async function createServerFnAppInjector(\n configOrProviders: ApplicationConfig | StaticProvider[] = [],\n): Promise<Injector> {\n const config: ApplicationConfig = Array.isArray(configOrProviders)\n ? { providers: [provideServerRendering(), ...configOrProviders] }\n : configOrProviders;\n\n const appRef = await createApplication(config, {\n platformRef: platformServer(),\n });\n return appRef.injector;\n}\n","import type { Injector } from '@angular/core';\nimport { eventHandler, getRouterParam, readBody, type H3Event } from 'h3';\n\nimport { dispatchServerFn } from './dispatch';\n\n/**\n * The h3 request/response layer for the server-function dispatch route.\n *\n * `createServerFnAppInjector` bootstraps the parent injector once; this wraps\n * that in the `/_analog/fn/:id` handler the Nitro build registers. Kept as a\n * runtime function (rather than inlined into the generated module) so the\n * transport behaviour — body decoding, the malformed-body contract, and header\n * propagation — is unit-tested directly instead of by matching generated source.\n *\n * `appInjector` may be a promise: the generated module bootstraps the app at\n * import time and passes the pending injector, which is awaited on first request\n * and resolved instantly thereafter.\n */\nexport function createServerFnEventHandler(\n appInjector: Injector | Promise<Injector>,\n) {\n return eventHandler((event) => handleServerFnRequest(event, appInjector));\n}\n\n/**\n * Decode a server-function request, dispatch it, and write the result to the\n * h3 response. Same-origin, method, content-type, validation, and interceptors\n * are enforced inside `dispatchServerFn`; this owns only the h3 I/O around it.\n */\nexport async function handleServerFnRequest(\n event: H3Event,\n appInjector: Injector | Promise<Injector>,\n): Promise<unknown> {\n const id = getRouterParam(event, 'id') ?? '';\n\n // h3 parses the body before dispatch gets a say, and its parse error is an\n // HTML/500-shaped response rather than the JSON contract callers expect.\n let input: unknown;\n if (event.method !== 'GET') {\n try {\n input = await readBody(event);\n } catch {\n event.node.res.statusCode = 400;\n return { message: 'Malformed request body' };\n }\n }\n\n const { status, body, headers } = await dispatchServerFn(id, input, event, {\n parent: await appInjector,\n method: event.method,\n });\n\n event.node.res.statusCode = status;\n if (headers) {\n for (const [key, value] of Object.entries(headers)) {\n event.node.res.setHeader(key, value);\n }\n }\n return body;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ɵresetCompiledComponents","SERVER_CONTEXT","renderInternal"],"mappings":";;;;;;;;;AAEA;;;;AAIG;AACI,MAAM,gBAAgB,GAAG,IAAI,GAAG;;MCiB1B,sBAAsB,GAAG,IAAI,cAAc,CAEtD,wBAAwB;AAM1B;AACM,SAAU,wBAAwB,CACtC,YAAqC,EAAA;IAErC,OAAO;QACL,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM;AACnC,YAAA,OAAO,EAAE,sBAAsB;AAC/B,YAAA,QAAQ,EAAE,EAAE;AACZ,YAAA,KAAK,EAAE,IAAI;AACZ,SAAA,CAAC,CAAC;KACJ;AACH;AAEA;AACM,SAAU,gBAAgB,CAAC,GAAG,QAA4B,EAAA;AAC9D,IAAA,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC;AAC7C;AAEA,SAAS,OAAO,CACd,KAAc,EACd,OAAwB,EAAA;IAExB,OAAO;QACL,KAAK;QACL,OAAO;AACP,QAAA,IAAI,CAAC,KAAK,EAAA;AACR,YAAA,OAAO,OAAO,CAAC,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK,EAAqB,CAAC;QACpE,CAAC;KACF;AACH;AAEA;;;;;;;;AAQG;AACI,eAAe,eAAe,CACnC,YAAqC,EACrC,KAAc,EACd,OAG+B,EAC/B,WAAkC,CAA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,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,GAAG;AAC/B,YAAA,OAAO,EAAE,OAAO,EAAE,wBAAwB,EAAE;QAC9C;IACF;AAEA,IAAA,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,gBAAgB,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;QACzE,MAAM,EAAE,MAAM,WAAW;QACzB,MAAM,EAAE,KAAK,CAAC,MAAM;AACrB,KAAA,CAAC;IAEF,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,MAAM;IAClC,IAAI,OAAO,EAAE;AACX,QAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAClD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC;QACtC;IACF;AACA,IAAA,OAAO,IAAI;AACb;;AC3DA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"analogjs-router-server.mjs","sources":["../../../../packages/router/server/src/server-fn/registry.ts","../../../../packages/router/server/src/server-fn/interceptors.ts","../../../../packages/router/server/src/server-fn/same-origin.ts","../../../../packages/router/server/src/server-fn/dispatch.ts","../../../../packages/router/server/src/server-fn/ssr-dispatcher.ts","../../../../packages/router/server/src/provide-server-context.ts","../../../../packages/router/server/src/utils/reset-component-def-tviews.ts","../../../../packages/router/server/src/render.ts","../../../../packages/router/server/src/utils/stream-html.ts","../../../../packages/router/server/src/utils/stream-request.ts","../../../../packages/router/server/src/defer-reconcile-runtime.ts","../../../../packages/router/server/src/render-stream.ts","../../../../packages/router/server/src/server-fn/server-fn.ts","../../../../packages/router/server/src/server-fn/app-injector.ts","../../../../packages/router/server/src/server-fn/event-handler.ts","../../../../packages/router/server/src/analogjs-router-server.ts"],"sourcesContent":["import type { ServerFnDef } from '@analogjs/router';\n\n/**\n * Server-side registry of server functions, keyed by id. A `.server.ts` module\n * populates it as a side effect of `serverFn(...)` running at import time; the\n * Nitro dispatch route imports those modules to fill it, then looks up by id.\n */\nexport const serverFnRegistry = new Map<string, ServerFnDef>();\n","import { InjectionToken, type Provider } from '@angular/core';\n\nimport type { ServerFnContext } from '@analogjs/router';\n\n/** Context threaded through the interceptor chain and handed to the handler. */\nexport interface ServerFnInterceptorContext {\n readonly input: unknown;\n readonly context: ServerFnContext;\n /** Return a new context with additional typed fields merged in. */\n with(\n patch: Partial<ServerFnContext> & Record<string, unknown>,\n ): ServerFnInterceptorContext;\n}\n\nexport type ServerFnNext = (\n ctx: ServerFnInterceptorContext,\n) => Promise<unknown>;\n\n/** Functional interceptor, modeled on `HttpInterceptorFn`. */\nexport type ServerFnInterceptorFn = (\n ctx: ServerFnInterceptorContext,\n next: ServerFnNext,\n) => Promise<unknown> | unknown;\n\nexport const SERVER_FN_INTERCEPTORS = new InjectionToken<\n ServerFnInterceptorFn[]\n>('SERVER_FN_INTERCEPTORS');\n\nexport interface ServerFnsFeature {\n providers: Provider[];\n}\n\n/** `withServerFnInterceptors([...])` — registers the chain (DI, ordered). */\nexport function withServerFnInterceptors(\n interceptors: ServerFnInterceptorFn[],\n): ServerFnsFeature {\n return {\n providers: interceptors.map((fn) => ({\n provide: SERVER_FN_INTERCEPTORS,\n useValue: fn,\n multi: true,\n })),\n };\n}\n\n/** `provideServerFns(withServerFnInterceptors(...))` — mirrors provideHttpClient. */\nexport function provideServerFns(...features: ServerFnsFeature[]): Provider[] {\n return features.flatMap((f) => f.providers);\n}\n\nfunction makeCtx(\n input: unknown,\n context: ServerFnContext,\n): ServerFnInterceptorContext {\n return {\n input,\n context,\n with(patch) {\n return makeCtx(input, { ...context, ...patch } as ServerFnContext);\n },\n };\n}\n\n/**\n * Run the interceptor chain, then the handler, threading the context.\n *\n * `runInCtx` re-establishes the DI injection context around each interceptor\n * and the handler individually. This is what keeps `inject()` working in a\n * handler even when an upstream interceptor `await`s before calling `next`\n * (which would otherwise resume outside Angular's synchronous injection\n * context). It defaults to a pass-through for non-DI callers/tests.\n */\nexport async function runInterceptors(\n interceptors: ServerFnInterceptorFn[],\n input: unknown,\n handler: (\n input: unknown,\n context: ServerFnContext,\n ) => Promise<unknown> | unknown,\n runInCtx: <T>(fn: () => T) => T = (fn) => fn(),\n): Promise<unknown> {\n let i = -1;\n const dispatch: ServerFnNext = async (ctx) => {\n i += 1;\n if (i < interceptors.length) {\n return runInCtx(() => interceptors[i](ctx, dispatch));\n }\n return runInCtx(() => handler(ctx.input, ctx.context));\n };\n return dispatch(makeCtx(input, {} as ServerFnContext));\n}\n","/**\n * Same-origin enforcement for the server-function HTTP transport.\n *\n * Server functions are same-origin RPC: a client proxy only ever calls the\n * relative `/_analog/fn/:id` URL of its own app. A cross-origin page must not be\n * able to invoke them against a logged-in user (a CSRF-shaped attack), so the\n * transport rejects browser requests whose origin is not the app's own — out of\n * the box, with no per-app configuration.\n *\n * The signals used (`Sec-Fetch-Site`, `Origin`) are added by the browser and\n * cannot be forged by a cross-origin page's `fetch`. Non-browser callers (curl,\n * server-to-server, SSR in-process) send neither, so they are unaffected: the\n * guard blocks the cross-origin browser attack it is meant to, and nothing else.\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { ServerFnsFeature } from './interceptors';\n\n/** Node/h3 header bag shape (`IncomingHttpHeaders`). */\nexport type HeaderBag = Record<string, string | string[] | undefined>;\n\n/**\n * Origins permitted beyond the app's own, registered through DI:\n * `provideServerFns(withAllowedOrigins([...]))`. Empty by default — the\n * transport is same-origin unless an app opts out explicitly.\n */\nexport const SERVER_FN_ALLOWED_ORIGINS = new InjectionToken<string[]>(\n 'SERVER_FN_ALLOWED_ORIGINS',\n);\n\n/**\n * `withAllowedOrigins([...])` — permit cross-origin browser calls from the\n * listed origins, or pass `'*'` to disable the same-origin guard entirely.\n * Server functions are frequently cookie-authenticated, so this is an explicit\n * opt-out of CSRF protection: allow-list the exact origins you control.\n */\nexport function withAllowedOrigins(origins: string[]): ServerFnsFeature {\n return {\n providers: origins.map((origin) => ({\n provide: SERVER_FN_ALLOWED_ORIGINS,\n useValue: origin,\n multi: true,\n })),\n };\n}\n\nfunction firstHeader(value: string | string[] | undefined): string | undefined {\n return Array.isArray(value) ? value[0] : value;\n}\n\n/**\n * Whether an HTTP request to a server function may proceed.\n *\n * Allowed when the request is same-origin, carries no browser-origin signal at\n * all (a non-browser client, or a same-origin GET that omits `Origin`), or its\n * `Origin` is listed in `allowedOrigins`. Passing `'*'` in `allowedOrigins`\n * disables the check — the explicit opt-in to cross-origin access.\n *\n * `Sec-Fetch-Site` is the authoritative signal when present: `same-origin` and\n * `none` (a direct navigation, not a cross-site fetch) pass; `same-site` and\n * `cross-site` require an explicit `allowedOrigins` entry. When the header is\n * absent (older browsers, some proxies) the `Origin` host is compared to the\n * request host as a fallback.\n */\nexport function isServerFnOriginAllowed(\n headers: HeaderBag,\n allowedOrigins: readonly string[] = [],\n): boolean {\n if (allowedOrigins.includes('*')) {\n return true;\n }\n\n const origin = firstHeader(headers['origin']);\n const originAllowlisted =\n origin !== undefined && allowedOrigins.includes(origin);\n\n const site = firstHeader(headers['sec-fetch-site']);\n if (site) {\n if (site === 'same-origin' || site === 'none') {\n return true;\n }\n // same-site / cross-site: only when the origin is explicitly permitted.\n return originAllowlisted;\n }\n\n // No `Sec-Fetch-Site`: fall back to comparing the `Origin` host to the host.\n if (!origin) {\n // Non-browser client, or a same-origin GET with no `Origin` — not the\n // cross-origin browser request this guard exists to reject.\n return true;\n }\n if (originAllowlisted) {\n return true;\n }\n\n const host =\n firstHeader(headers['x-forwarded-host']) ?? firstHeader(headers['host']);\n if (!host) {\n return false;\n }\n try {\n return new URL(origin).host === host;\n } catch {\n return false;\n }\n}\n","import {\n Injector,\n runInInjectionContext,\n type StaticProvider,\n} from '@angular/core';\nimport { BASE_URL, LOCALE, REQUEST, RESPONSE } from '@analogjs/router/tokens';\nimport type { H3Event } from 'h3';\n\nimport { detectLocale, getBaseUrl } from '../provide-server-context';\nimport { serverFnRegistry } from './registry';\nimport { SERVER_FN_INTERCEPTORS, runInterceptors } from './interceptors';\nimport {\n SERVER_FN_ALLOWED_ORIGINS,\n isServerFnOriginAllowed,\n type HeaderBag,\n} from './same-origin';\n\nexport interface DispatchResult {\n status: number;\n body: unknown;\n /**\n * Headers from a returned `Response` (`fail`/`redirect`): Location, … The\n * value is an array when the header legitimately repeats, which is why\n * `Set-Cookie` is read separately below — collapsing several cookies into one\n * comma-joined value corrupts them.\n */\n headers?: Record<string, string | string[]>;\n}\n\nexport interface DispatchServerFnOptions {\n /**\n * The app's environment injector. The per-request injector is created as its\n * child, so handlers resolve app services (and `providedIn: 'root'` services,\n * when this is the app's bootstrapped injector) and registered interceptors\n * without re-listing them per request.\n */\n parent?: Injector;\n /** Extra per-request providers, for direct callers without an app injector. */\n providers?: StaticProvider[];\n /** Request HTTP method; enforced against the function's configured method. */\n method?: string;\n /**\n * Origins permitted beyond same-origin, merged with any registered through DI\n * (`provideServerFns(withAllowedOrigins([...]))`). The transport is\n * same-origin by default (cross-origin browser calls are rejected with 403);\n * `'*'` disables the check entirely. Only consulted for HTTP-transport calls\n * (those that pass `method`).\n */\n allowedOrigins?: string[];\n}\n\n/**\n * Server-side dispatch for a server function call.\n *\n * 1. reject cross-origin browser calls (403), unless allow-listed — HTTP\n * transport only (in-process callers omit `method` and are exempt)\n * 2. look up the function by id\n * 3. enforce the configured HTTP method (405 on mismatch)\n * 4. require a JSON body on input-bearing calls (415 otherwise)\n * 5. validate `input` against the Standard-Schema (4xx on failure)\n * 6. build a per-request injector (REQUEST/RESPONSE + app providers)\n * 7. run the interceptor chain, then the handler, re-entering\n * `runInInjectionContext` at every hop so `inject()` works even after an\n * interceptor `await`s before calling `next`\n * 8. a `Response` returned by an interceptor/handler (`fail`/`redirect`)\n * short-circuits with its status AND headers\n *\n * `options.method` is the request's HTTP method; when provided it is enforced\n * against the function's configured method AND it turns on the same-origin\n * guard. Transports (the generated Nitro handler) always pass it; trusted\n * in-process callers may omit it, which also exempts them from the origin guard.\n */\nexport async function dispatchServerFn(\n id: string,\n rawInput: unknown,\n event: Pick<H3Event, 'node'>,\n options: DispatchServerFnOptions = {},\n): Promise<DispatchResult> {\n const { parent, providers = [], method, allowedOrigins = [] } = options;\n const headers = (event.node.req.headers ?? {}) as HeaderBag;\n\n // Same-origin guard runs first — before we even confirm the function exists —\n // so a cross-origin page cannot probe which ids are registered. Gated on\n // `method` so only HTTP-transport calls are checked; in-process callers omit\n // it. The signals (`Origin`/`Sec-Fetch-Site`) are browser-set and unforgeable.\n if (method) {\n const allowed = [\n ...allowedOrigins,\n ...(parent?.get(SERVER_FN_ALLOWED_ORIGINS, []) ?? []),\n ];\n if (!isServerFnOriginAllowed(headers, allowed)) {\n return {\n status: 403,\n body: { message: 'Cross-origin server function call rejected' },\n };\n }\n }\n\n const def = serverFnRegistry.get(id);\n if (!def) {\n return { status: 404, body: { message: `Unknown server function: ${id}` } };\n }\n\n // Enforce the transport method: a GET-only read must not be POSTable, and an\n // input-bearing POST must not be reachable via GET.\n if (method && method.toUpperCase() !== def.method) {\n return {\n status: 405,\n body: { message: `Method ${method} not allowed for ${id}` },\n headers: { Allow: def.method },\n };\n }\n\n // Input travels as a JSON body. Reject anything else before decoding, so a\n // form post from a cross-origin page (which cannot set a JSON content type\n // without a CORS preflight) never reaches a handler. HTTP transport only.\n if (method && def.method === 'POST' && !isJsonContentType(headers)) {\n return {\n status: 415,\n body: { message: 'Server functions accept an application/json body' },\n };\n }\n\n let input = rawInput;\n if (def.config.input) {\n const result = await def.config.input['~standard'].validate(rawInput);\n if ('issues' in result && result.issues) {\n return { status: 400, body: { errors: result.issues } };\n }\n input = (result as { value: unknown }).value;\n }\n\n // Child of the app injector: only the request tokens are per-request; app\n // services + interceptors resolve up the parent chain. All four are provided\n // here so a handler resolves them the same way it would inside a component\n // during SSR, whether it was reached over HTTP or in-process.\n const req = event.node.req as Parameters<typeof getBaseUrl>[0];\n const locale = detectLocale(req);\n const injector = Injector.create({\n parent,\n providers: [\n { provide: REQUEST, useValue: event.node.req },\n { provide: RESPONSE, useValue: event.node.res },\n { provide: BASE_URL, useValue: getBaseUrl(req) },\n ...(locale ? [{ provide: LOCALE, useValue: locale }] : []),\n ...providers,\n ],\n });\n\n // Re-enter the injection context at each hop rather than wrapping the whole\n // chain once: an interceptor that awaits before `next` would otherwise run the\n // handler outside the context and break `inject()`.\n const runInCtx = <T>(fn: () => T): T => runInInjectionContext(injector, fn);\n const interceptors = injector.get(SERVER_FN_INTERCEPTORS, []);\n const outcome = await runInterceptors(\n interceptors,\n input,\n def.handler,\n runInCtx,\n );\n\n if (outcome instanceof Response) {\n const text = await outcome.text();\n const body = text ? safeJson(text) : null;\n const headers: Record<string, string | string[]> = {};\n outcome.headers.forEach((value, key) => {\n if (key.toLowerCase() !== 'set-cookie') {\n headers[key] = value;\n }\n });\n // `Headers.forEach` yields cookies comma-joined into a single value, which\n // is not a valid way to send more than one; `getSetCookie` keeps them apart.\n const setCookie = outcome.headers.getSetCookie?.() ?? [];\n if (setCookie.length) {\n headers['set-cookie'] = setCookie;\n }\n return {\n status: outcome.status,\n body,\n headers: Object.keys(headers).length ? headers : undefined,\n };\n }\n\n return { status: 200, body: outcome };\n}\n\nfunction isJsonContentType(headers: HeaderBag): boolean {\n const contentType = headers['content-type'];\n const value = Array.isArray(contentType) ? contentType[0] : contentType;\n if (!value) {\n return false;\n }\n const mediaType = value.split(';')[0].trim().toLowerCase();\n return mediaType === 'application/json' || mediaType.endsWith('+json');\n}\n\nfunction safeJson(text: string): unknown {\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n}\n","import { Injector } from '@angular/core';\nimport { HttpErrorResponse } from '@angular/common/http';\nimport type { ServerRequest, ServerResponse } from '@analogjs/router/tokens';\nimport type { ServerFn, ServerFnDispatcher } from '@analogjs/router';\nimport type { H3Event } from 'h3';\n\nimport { dispatchServerFn } from './dispatch';\n\n/**\n * The in-process transport used during SSR. `ServerFnClient` picks this up from\n * DI and calls the handler directly instead of issuing an HTTP request back\n * into the app — the render and the handler already share a process and a\n * request, so the round-trip only adds latency (and would need an absolute URL).\n *\n * `method` is deliberately not passed to `dispatchServerFn`: this is a trusted\n * in-process caller, so the HTTP-transport-only checks (same-origin, method\n * enforcement, content type) do not apply. Validation and the interceptor chain\n * still run, so an SSR call behaves like a browser call in every other respect.\n *\n * A non-2xx result is thrown as an `HttpErrorResponse` so the failure surfaces\n * on `resource.error()` exactly as it does in the browser.\n */\nexport function createServerFnDispatcher(\n req: ServerRequest,\n res: ServerResponse,\n): ServerFnDispatcher {\n const event = { node: { req, res } } as unknown as Pick<H3Event, 'node'>;\n\n return async <In, Out>(\n fn: ServerFn<In, Out>,\n input: In,\n injector: Injector,\n ): Promise<Out> => {\n const { status, body } = await dispatchServerFn(fn.id, input, event, {\n parent: injector,\n });\n\n if (status < 200 || status > 299) {\n throw new HttpErrorResponse({ status, error: body, url: fn.url });\n }\n\n return body as Out;\n };\n}\n","import { StaticProvider, ɵresetCompiledComponents } from '@angular/core';\nimport { ɵSERVER_CONTEXT as SERVER_CONTEXT } from '@angular/platform-server';\n\nimport {\n BASE_URL,\n LOCALE,\n REQUEST,\n RESPONSE,\n ServerRequest,\n ServerResponse,\n} from '@analogjs/router/tokens';\nimport { SERVER_FN_DISPATCHER } from '@analogjs/router';\n\nimport { createServerFnDispatcher } from './server-fn/ssr-dispatcher';\n\nexport function provideServerContext({\n req,\n res,\n}: {\n req: ServerRequest;\n res: ServerResponse;\n}): StaticProvider[] {\n const baseUrl = getBaseUrl(req);\n const locale = detectLocale(req);\n\n // Optional chaining: a Nitro-bundled caller has no `import.meta.env` at all.\n if (import.meta.env?.DEV) {\n ɵresetCompiledComponents();\n }\n\n return [\n { provide: SERVER_CONTEXT, useValue: 'ssr-analog' },\n { provide: REQUEST, useValue: req },\n { provide: RESPONSE, useValue: res },\n { provide: BASE_URL, useValue: baseUrl },\n // Server functions called while rendering run in-process, in this injector.\n {\n provide: SERVER_FN_DISPATCHER,\n useValue: createServerFnDispatcher(req, res),\n },\n ...(locale ? [{ provide: LOCALE, useValue: locale }] : []),\n ];\n}\n\n/**\n * Detects the locale from the request URL path prefix or Accept-Language header.\n * URL prefix takes priority (e.g. /fr/about -> 'fr').\n */\nexport function detectLocale(req: ServerRequest): string | undefined {\n const url = req.originalUrl || req.url || '';\n const localeFromUrl = extractLocaleFromUrl(url);\n if (localeFromUrl) {\n return localeFromUrl;\n }\n\n return parseAcceptLanguage(req.headers['accept-language']);\n}\n\n/**\n * Extracts a locale from the first URL path segment if it matches\n * a BCP 47-like pattern (e.g. 'en', 'en-US', 'zh-Hans-CN').\n */\nexport function extractLocaleFromUrl(url: string): string | undefined {\n const pathname = url.split('?')[0];\n const segments = pathname.split('/').filter(Boolean);\n if (segments.length === 0) {\n return undefined;\n }\n\n const firstSegment = segments[0];\n // Match BCP 47 language tags: 2-letter language code with optional region/script\n // e.g. 'en', 'en-US', 'zh-Hans', 'zh-Hans-CN'\n if (/^[a-z]{2}(-[a-zA-Z]{2,4})?(-[a-zA-Z]{2}|\\d{3})?$/.test(firstSegment)) {\n return firstSegment;\n }\n\n return undefined;\n}\n\n/**\n * Parses the Accept-Language header and returns the most preferred language.\n */\nexport function parseAcceptLanguage(\n header: string | undefined,\n): string | undefined {\n if (!header) {\n return undefined;\n }\n\n const locales = header\n .split(',')\n .map((part) => {\n const [locale, qPart] = part.trim().split(';');\n const q = qPart ? parseFloat(qPart.replace('q=', '')) : 1;\n return { locale: locale.trim(), q };\n })\n .sort((a, b) => b.q - a.q);\n\n return locales[0]?.locale || undefined;\n}\n\nexport function getBaseUrl(req: ServerRequest) {\n const protocol = getRequestProtocol(req);\n const { headers } = req;\n // Node's `IncomingMessage` has no `originalUrl`, and a server function\n // endpoint is reached with a plain request, so fall back before dereferencing.\n const originalUrl = req.originalUrl || req.url || '/';\n const parsedUrl = new URL(\n '',\n `${protocol}://${headers.host}${\n originalUrl.endsWith('/')\n ? originalUrl.substring(0, originalUrl.length - 1)\n : originalUrl\n }`,\n );\n const baseUrl = parsedUrl.origin;\n\n return baseUrl;\n}\n\nexport function getRequestProtocol(\n req: ServerRequest,\n opts: { xForwardedProto?: boolean } = {},\n) {\n if (\n opts.xForwardedProto !== false &&\n req.headers['x-forwarded-proto'] === 'https'\n ) {\n return 'https';\n }\n\n return (req.connection as any)?.encrypted ? 'https' : 'http';\n}\n","/**\n * Nulls `def.tView` on every component definition that Angular has\n * compiled in this process. Angular caches the result of `consts()` on\n * `def.tView` — that factory is where `$localize` tagged templates are\n * evaluated — so without this reset the first rendered locale would be\n * frozen into the cache for the process lifetime.\n *\n * The set on `globalThis.__ngComponentDefs` is populated by a Vite\n * transform in `@analogjs/platform` that patches `@angular/core`'s\n * `getComponentId()` to mirror every compiled component definition to\n * a global Set, bypassing the `ngServerMode` guard that normally\n * prevents registration on the server.\n */\nexport function resetComponentDefTViews(): void {\n const defs = (globalThis as any).__ngComponentDefs as Set<any> | undefined;\n if (!defs) return;\n for (const def of defs) {\n def.tView = null;\n }\n}\n","import {\n ApplicationConfig,\n Provider,\n Type,\n enableProdMode,\n} from '@angular/core';\nimport {\n bootstrapApplication,\n type BootstrapContext,\n} from '@angular/platform-browser';\nimport { renderApplication } from '@angular/platform-server';\nimport type { ServerContext } from '@analogjs/router/tokens';\n\nimport { provideServerContext } from './provide-server-context';\nimport { resetComponentDefTViews } from './utils/reset-component-def-tviews';\n\n// Optional chaining: the server-function dispatch endpoint imports this entry\n// from a Nitro bundle, where `import.meta.env` is not defined at all.\nif (import.meta.env?.PROD) {\n enableProdMode();\n}\n\n/**\n * Returns a function that accepts the navigation URL,\n * the root HTML, and server context.\n *\n * @param rootComponent\n * @param config\n * @param platformProviders\n * @returns Promise<string | Reponse>\n */\nexport function render(\n rootComponent: Type<unknown>,\n config: ApplicationConfig,\n platformProviders: Provider[] = [],\n) {\n function bootstrap(context: BootstrapContext) {\n return bootstrapApplication(rootComponent, config, context);\n }\n\n return async function render(\n url: string,\n document: string,\n serverContext: ServerContext,\n ) {\n resetComponentDefTViews();\n\n const html = await renderApplication(bootstrap, {\n document,\n url,\n platformProviders: [\n provideServerContext(serverContext),\n platformProviders,\n ],\n });\n\n return html;\n };\n}\n","/**\n * Pure string helpers for slicing a fully rendered SSR document into the parts\n * the streaming renderer flushes: the shell up to `<body>`, the authoritative\n * `<body>` inner HTML for the tail, and the authoritative `<head>` inner HTML\n * for the finalize-time head reconcile. Extracted from `render-stream` so they\n * can be unit tested without driving the platform.\n */\n\n/** Byte offset just after the opening `<body>` tag, or 0 if none. */\nexport function afterBodyOpen(html: string): number {\n const m = /<body[^>]*>/i.exec(html);\n return m ? m.index + m[0].length : 0;\n}\n\n/** Inner HTML of `<body>` from a fully rendered document string. */\nexport function bodyInner(html: string): string {\n const start = afterBodyOpen(html);\n const end = html.lastIndexOf('</body>');\n return html.slice(start, end > -1 ? end : html.length);\n}\n\n/** Inner HTML of `<head>` from a fully rendered document string. */\nexport function headInner(html: string): string {\n const open = /<head[^>]*>/i.exec(html);\n if (!open) return '';\n const start = open.index + open[0].length;\n const end = html.indexOf('</head>', start);\n return html.slice(start, end > -1 ? end : start);\n}\n","import type { ServerContext } from '@analogjs/router/tokens';\n\n/**\n * Per-request decisions about whether the streaming renderer should fall back\n * to a buffered render. Extracted from `render-stream` so they can be unit\n * tested without driving the platform.\n */\n\n/**\n * User agents that receive a fully buffered render (with a resolved `<head>`)\n * instead of the streamed shell. Streaming flushes the head before the app has\n * set a dynamic title/meta and reconciles it via a finalize script; a crawler\n * that does not run that script would index the shell's static head. Mirrors\n * Nuxt's bot bypass — streaming targets interactive clients, bots get the\n * buffered path whose head is byte-identical to the classic `render()`.\n */\nexport const SSR_BOT_RE =\n /bot|crawl|spider|slurp|mediapartners|facebookexternalhit|embedly|quora link preview|outbrain|pinterest|vkshare|w3c_validator|whatsapp|telegrambot|lighthouse|google-inspectiontool|headlesschrome|bingpreview/i;\n\nexport function isLikelyBot(serverContext: ServerContext): boolean {\n const ua = serverContext?.req?.headers?.['user-agent'];\n return typeof ua === 'string' && SSR_BOT_RE.test(ua);\n}\n\n/**\n * Whether streaming is disabled for this request by a `streaming: false` route\n * rule. The platform plugin translates that rule into an `x-analog-no-streaming`\n * response header (mirroring how `ssr: false` becomes `x-analog-no-ssr`); when\n * present, `renderStream` produces the buffered `render()` output for this\n * route instead of streaming.\n */\nexport function streamingDisabledByRoute(\n serverContext: ServerContext,\n): boolean {\n return serverContext?.res?.getHeader?.('x-analog-no-streaming') === 'true';\n}\n","/**\n * Tiny client runtime for progressive streaming SSR — EXPERIMENTAL.\n *\n * `renderStream` streams the document in three parts:\n * 1. the head + this runtime + an empty `<div data-analog-stream>` region;\n * 2. each `@defer` block, as it resolves on the server, as a\n * `<template data-analog-defer=\"ID\">…</template>` followed by a call to\n * `window.__analogPaint(\"ID\")` — this runtime paints the block into the\n * streaming region immediately, so content appears progressively and out\n * of document order;\n * 3. the authoritative document tail: the app's resolved `<head>` in a\n * `<template data-analog-head>` and the hydration-annotated body in a\n * `<template data-analog-authoritative>`, followed by\n * `window.__analogReconcileHead()` + `window.__analogFinalize()`. The head\n * is reconciled first (a dynamically-set `<title>`/meta is applied to the\n * live document, since the streamed shell head was flushed before the app\n * ran), then the body is swapped to the exact document Angular's\n * incremental hydration expects.\n *\n * Emitted into the document by `renderStream`. Exported as a string so it can\n * be injected verbatim and unit-tested against a DOM.\n */\nexport const DEFER_RECONCILE_RUNTIME = /* js */ `\n(function () {\n function region() {\n return document.querySelector('[data-analog-stream]');\n }\n window.__analogPaint = function (id) {\n var tpl = document.querySelector('template[data-analog-defer=\"' + id + '\"]');\n var r = region();\n if (!tpl || !r) return;\n r.appendChild(tpl.content.cloneNode(true));\n tpl.remove();\n };\n window.__analogReconcileHead = function () {\n // The shell head was flushed before the app rendered, so any title/meta the\n // app set during render (Title/Meta services, route meta) is missing from\n // the live document. Apply the authoritative head here, before hydration —\n // matching how a buffered render would have produced the head. Idempotent:\n // tags already present (charset, viewport, stylesheet/preload links) are\n // matched and left as-is; only changed/added ones are updated.\n var tpl = document.querySelector('template[data-analog-head]');\n if (!tpl) return;\n var frag = tpl.content;\n var head = document.head;\n var title = frag.querySelector('title');\n if (title) document.title = title.textContent || '';\n function metaKey(m) {\n if (m.hasAttribute('charset')) return 'charset';\n var attrs = ['name', 'property', 'http-equiv', 'itemprop'];\n for (var i = 0; i < attrs.length; i++) {\n if (m.hasAttribute(attrs[i])) return attrs[i] + '=' + m.getAttribute(attrs[i]);\n }\n return null;\n }\n var existingMeta = {};\n var metas = head.querySelectorAll('meta');\n for (var i = 0; i < metas.length; i++) {\n var k = metaKey(metas[i]);\n if (k) existingMeta[k] = metas[i];\n }\n frag.querySelectorAll('meta').forEach(function (m) {\n var key = metaKey(m);\n if (key == null) return;\n if (existingMeta[key]) existingMeta[key].replaceWith(m.cloneNode(true));\n else head.appendChild(m.cloneNode(true));\n });\n var existingHref = {};\n var links = head.querySelectorAll('link[href]');\n for (var j = 0; j < links.length; j++) {\n existingHref[links[j].getAttribute('href')] = true;\n }\n frag.querySelectorAll('link').forEach(function (l) {\n var href = l.getAttribute('href');\n if (href && existingHref[href]) return;\n head.appendChild(l.cloneNode(true));\n if (href) existingHref[href] = true;\n });\n tpl.remove();\n };\n window.__analogFinalize = function () {\n var auth = document.querySelector('template[data-analog-authoritative]');\n if (!auth) return;\n // Replace the entire body — preview region, block templates and runtime\n // scripts — with just the authoritative body, so the reconciled DOM matches\n // a buffered render byte-for-byte before hydration boots.\n document.body.replaceChildren(auth.content.cloneNode(true));\n };\n})();\n`;\n","/**\n * Progressive streaming SSR renderer — EXPERIMENTAL.\n *\n * Returns a `ReadableStream<Uint8Array>` that flushes bytes DURING the render,\n * not after it:\n * 1. the document head + a client reconcile runtime are flushed immediately,\n * before the app has finished rendering, so the browser starts fetching\n * assets right away;\n * 2. each `@defer (hydrate …)` block's content is flushed the moment it\n * resolves on the server — out of document order — while later blocks are\n * still pending (proven: a slow block does not hold back an early one);\n * 3. once the app is stable, the authoritative, fully hydration-annotated\n * document is flushed as the tail. This is byte-identical to a buffered\n * `renderApplication`, and is what Angular's incremental hydration runs\n * against on the client.\n *\n * Unlike a buffered renderer, this drives the platform directly\n * (`platformServer` + `bootstrapApplication` + `ɵrenderInternal`) so it can\n * interleave flushes with rendering. Angular's hydration annotation is\n * whole-document (the root's `ngh` index references every `@defer` container),\n * so the authoritative hydration payload is necessarily the tail: RENDERING\n * streams progressively, and hydration begins once the tail arrives.\n *\n * Depends on an upstream Angular per-block resolution hook exposed on two\n * globals (see {@link SsrStreamingGlobals}). When the primitive is absent,\n * `renderStream` degrades to a single buffered chunk so behaviour matches the\n * classic `render()` path, which is unchanged and remains the default.\n */\nimport {\n ApplicationConfig,\n Provider,\n Type,\n enableProdMode,\n} from '@angular/core';\nimport {\n bootstrapApplication,\n type BootstrapContext,\n} from '@angular/platform-browser';\nimport {\n renderApplication,\n platformServer,\n INITIAL_CONFIG,\n ɵrenderInternal as renderInternal,\n} from '@angular/platform-server';\nimport type { PlatformRef, ApplicationRef } from '@angular/core';\nimport type { ServerContext } from '@analogjs/router/tokens';\nimport { AsyncLocalStorage } from 'node:async_hooks';\n\nimport { provideServerContext } from './provide-server-context';\nimport { resetComponentDefTViews } from './utils/reset-component-def-tviews';\nimport { afterBodyOpen, bodyInner, headInner } from './utils/stream-html';\nimport { isLikelyBot, streamingDisabledByRoute } from './utils/stream-request';\nimport { DEFER_RECONCILE_RUNTIME } from './defer-reconcile-runtime';\n\nif (import.meta.env.PROD) {\n enableProdMode();\n}\n\n/**\n * Shape of the upstream Angular streaming primitive we consume, published on\n * `globalThis` by the streaming-enabled `@angular/core` build (see the\n * `deferStreamingPlugin` in `@analogjs/platform`):\n * - `__analogSsrDeferCapture` — the patched core invokes it once per resolved\n * `@defer` block on the server, passing the block's live `lContainer`. We\n * install a stable dispatcher here that routes to the current render (see\n * `installCaptureDispatcher`).\n * - `__analogSsrInternals.collectNativeNodesInLContainer` — collects a block's\n * rendered root nodes so we can serialize them via domino `outerHTML`.\n */\ninterface SsrStreamingGlobals {\n __analogSsrDeferCapture?: (ev: {\n ssrUniqueId: string | null;\n lContainer: unknown;\n }) => void;\n __analogSsrInternals?: {\n collectNativeNodesInLContainer?: (\n lContainer: unknown,\n out: unknown[],\n ) => void;\n };\n}\n\nfunction streamingPrimitiveAvailable(): boolean {\n const g = globalThis as unknown as SsrStreamingGlobals;\n return (\n typeof g.__analogSsrInternals?.collectNativeNodesInLContainer === 'function'\n );\n}\n\ntype DeferCaptureEvent = { ssrUniqueId: string | null; lContainer: unknown };\ntype DeferCaptureHandler = (ev: DeferCaptureEvent) => void;\n\n/**\n * Per-render capture handlers live in async-local storage, not a single shared\n * global slot, so concurrent renders in one process do not clobber each other.\n * `globalThis.__analogSsrDeferCapture` is a stable dispatcher installed once; it\n * routes each resolved `@defer` block to the handler of the render whose async\n * context it fired in. A block that resolves outside any render (no store) is a\n * no-op.\n */\nconst captureStore = new AsyncLocalStorage<DeferCaptureHandler>();\n\nfunction installCaptureDispatcher(): void {\n const g = globalThis as unknown as {\n __analogSsrDeferCapture?: DeferCaptureHandler & {\n __analogDispatcher?: boolean;\n };\n };\n if (g.__analogSsrDeferCapture?.__analogDispatcher) return;\n const dispatch = ((ev: DeferCaptureEvent) => {\n captureStore.getStore()?.(ev);\n }) as DeferCaptureHandler & { __analogDispatcher?: boolean };\n dispatch.__analogDispatcher = true;\n g.__analogSsrDeferCapture = dispatch;\n}\n\nlet warnedMissingPrimitive = false;\nfunction warnMissingPrimitiveOnce(): void {\n if (warnedMissingPrimitive || !import.meta.env.DEV) return;\n warnedMissingPrimitive = true;\n console.warn(\n '[@analogjs/router] renderStream: the streaming hook was not found on ' +\n '@angular/core, so rendering falls back to buffered. Enable ' +\n '`experimental.streaming` in your Analog config; if it already is, your ' +\n 'installed Angular version may be incompatible with the streaming patch.',\n );\n}\n\n/**\n * Serialize a `@defer` block's live domino subtree to HTML. Called a macrotask\n * after the block resolves, by which point change detection has filled in the\n * block's interpolations.\n */\nfunction serializeLContainerHtml(lContainer: unknown): string {\n const g = globalThis as unknown as SsrStreamingGlobals;\n const collect = g.__analogSsrInternals?.collectNativeNodesInLContainer;\n if (!collect) return '';\n const nodes: any[] = [];\n collect(lContainer, nodes);\n let html = '';\n for (const n of nodes) html += n?.outerHTML ?? n?.data ?? n?.nodeValue ?? '';\n return html;\n}\n\n/** Destroy the platform on a macrotask, matching `renderApplication`. */\nfunction asyncDestroyPlatform(platformRef: PlatformRef): Promise<void> {\n return new Promise((resolve) => {\n setTimeout(() => {\n platformRef.destroy();\n resolve();\n }, 0);\n });\n}\n\n/**\n * Returns a function that renders a URL to a `ReadableStream<Uint8Array>`.\n *\n * Usage in main.server.ts:\n * ```ts\n * import { renderStream } from '@analogjs/router/server';\n * export default renderStream(App, config);\n * ```\n */\nexport function renderStream(\n rootComponent: Type<unknown>,\n config: ApplicationConfig,\n platformProviders: Provider[] = [],\n) {\n function bootstrap(context: BootstrapContext) {\n return bootstrapApplication(rootComponent, config, context);\n }\n\n return async function renderStream(\n url: string,\n document: string,\n serverContext: ServerContext,\n ): Promise<ReadableStream<Uint8Array>> {\n // Reset before every render — both the buffered fallback below and the\n // streaming path — so a prior render's locale/consts are not frozen for the\n // process lifetime (parity with render.ts).\n resetComponentDefTViews();\n\n // Fall back to a single buffered chunk so output matches the classic path\n // for:\n // - crawlers, which may not run the finalize script that reconciles a\n // dynamic <head>, so they get a buffered render with a resolved head;\n // - routes with a `streaming: false` rule (opt out per route);\n // - a missing streaming primitive.\n const primitiveAvailable = streamingPrimitiveAvailable();\n const bot = isLikelyBot(serverContext);\n const routeDisabled = streamingDisabledByRoute(serverContext);\n if (bot || routeDisabled || !primitiveAvailable) {\n // Warn only when the primitive is genuinely absent — the bot and\n // route-opt-out paths fall back to buffered by design, not by degradation.\n if (!bot && !routeDisabled && !primitiveAvailable) {\n warnMissingPrimitiveOnce();\n }\n const html = await renderApplication(\n (context) => bootstrapApplication(rootComponent, config, context),\n {\n document,\n url,\n platformProviders: [\n provideServerContext(serverContext),\n platformProviders,\n ],\n },\n );\n return new ReadableStream({\n start(controller) {\n controller.enqueue(new TextEncoder().encode(html as string));\n controller.close();\n },\n });\n }\n\n installCaptureDispatcher();\n const encoder = new TextEncoder();\n\n // The stream is returned immediately; `start` fills it as the render\n // progresses, so the consumer receives the head, then each @defer block the\n // moment it resolves, then the authoritative tail — true streaming.\n return new ReadableStream<Uint8Array>({\n async start(controller) {\n const enqueue = (s: string) => controller.enqueue(encoder.encode(s));\n\n // The capture handler fires once per @defer block as it resolves. The\n // block's DOM is not filled until the next change-detection tick, so we\n // serialize + flush it a macrotask later — flushing DURING the render.\n // It is scoped to this render via async-local storage (see\n // installCaptureDispatcher) so concurrent renders never cross-talk.\n let blockIndex = 0;\n let capturing = true;\n const seen = new Set<unknown>();\n const pendingFlushes: Promise<void>[] = [];\n const onBlockResolved: DeferCaptureHandler = (ev) => {\n // A block can reach `Complete` more than once during a render; only\n // stream each container once. Also ignore any resolution that fires\n // after the render has moved on to serializing the authoritative tail.\n if (!capturing || seen.has(ev.lContainer)) return;\n seen.add(ev.lContainer);\n const id = `s${blockIndex++}`;\n pendingFlushes.push(\n new Promise<void>((resolve) => {\n setTimeout(() => {\n const html = serializeLContainerHtml(ev.lContainer);\n enqueue(\n `<template data-analog-defer=\"${id}\">${html}</template>` +\n `<script>window.__analogPaint&&window.__analogPaint(${JSON.stringify(id)})</script>`,\n );\n resolve();\n }, 0);\n }),\n );\n };\n\n // Run the whole render inside the async-local context so every\n // change-detection tick and @defer resolution it schedules routes back\n // to THIS render's handler.\n await captureStore.run(onBlockResolved, async () => {\n const platformRef = platformServer([\n { provide: INITIAL_CONFIG, useValue: { document, url } },\n provideServerContext(serverContext),\n platformProviders,\n ]);\n\n // 1. Flush the head + reconcile runtime immediately (before the app is\n // rendered), then open the live streaming region.\n enqueue(\n document.slice(0, afterBodyOpen(document)) +\n `<script>${DEFER_RECONCILE_RUNTIME}</script>` +\n `<div data-analog-stream></div>`,\n );\n\n let appRef: ApplicationRef | undefined;\n let errored = false;\n try {\n // 2. Bootstrap + render. Blocks resolve out of order during this\n // phase and flush via the capture handler above.\n appRef = await bootstrap({ platformRef } as BootstrapContext);\n await appRef.whenStable();\n await Promise.all(pendingFlushes);\n // Stop capturing before serializing the tail so late resolutions\n // triggered by the hydration pass are not streamed as extra blocks.\n capturing = false;\n\n // 3. Flush the authoritative, fully hydration-annotated document as\n // the tail. Carried in <template>s (their inert `ng-state`\n // script survives). The app's resolved <head> ships alongside so\n // a dynamically-set title/meta — set during render, after the\n // shell head was already flushed — is reconciled onto the live\n // document before the runtime swaps in the body and hydration\n // boots.\n const authoritative = await renderInternal(platformRef, appRef);\n enqueue(\n `<template data-analog-head>${headInner(authoritative)}</template>` +\n `<template data-analog-authoritative>${bodyInner(authoritative)}</template>` +\n `<script>window.__analogReconcileHead&&window.__analogReconcileHead();` +\n `window.__analogFinalize&&window.__analogFinalize()</script>` +\n `</body></html>`,\n );\n } catch (err) {\n // The head + runtime were already flushed, so the status/headers are\n // committed; error the stream (a no-op silent close would hand the\n // client a truncated, non-hydratable 200) and log with block context.\n errored = true;\n console.error(\n `[@analogjs/router] renderStream failed for ${url} after ` +\n `${blockIndex} block(s); response truncated.`,\n err,\n );\n controller.error(err);\n } finally {\n await asyncDestroyPlatform(platformRef);\n if (!errored) controller.close();\n }\n });\n },\n });\n };\n}\n","import { createServerFnRef } from '@analogjs/router';\nimport type {\n ServerFn,\n ServerFnConfig,\n ServerFnHandler,\n StandardSchemaV1,\n} from '@analogjs/router';\n\nimport { serverFnRegistry } from './registry';\n\n/**\n * Define a server function. Authored in a `*.server.ts` module.\n *\n * Three call shapes, chosen for ergonomics — they all normalize to the same\n * `(config, handler)` form and the build transform derives the route id for each:\n *\n * ```ts\n * serverFn(() => inject(Svc).list()); // input-less GET\n * serverFn(schema, (input) => …); // schema ⇒ POST + input\n * serverFn({ method: 'POST' }, () => …); // explicit config\n * ```\n *\n * On the server the function self-registers and its handler runs via\n * `dispatchServerFn`. On the client the build transform replaces the body with a\n * proxy that calls `/_analog/fn/<id>`; the reference still carries\n * `id`/`url`/`method` so `injectServerFn`/`ServerFnClient` can dispatch.\n */\nexport function serverFn<Out>(\n handler: ServerFnHandler<void, Out>,\n): ServerFn<void, Out>;\nexport function serverFn<In, Out>(\n input: StandardSchemaV1<In>,\n handler: ServerFnHandler<In, Out>,\n): ServerFn<In, Out>;\nexport function serverFn<In, Out>(\n config: ServerFnConfig<In>,\n handler: ServerFnHandler<In, Out>,\n): ServerFn<In, Out>;\nexport function serverFn(\n arg1: unknown,\n arg2?: ServerFnHandler<unknown, unknown>,\n): ServerFn<unknown, unknown> {\n const { config, handler } = normalizeArgs(arg1, arg2);\n\n // GET is reserved for input-less reads; an input schema requires POST (the\n // input travels in the body, not the query). Build transforms reject this too.\n if (config.method === 'GET' && config.input) {\n throw new Error(\n '[analog] a serverFn with `input` must use POST; GET is reserved for input-less reads.',\n );\n }\n\n // `createServerFnRef` throws if the build-derived id is missing, so `ref.id`\n // is the authoritative route key here.\n const ref = createServerFnRef<unknown, unknown>(config);\n\n serverFnRegistry.set(ref.id, {\n id: ref.id,\n method: ref.method,\n config,\n handler,\n });\n\n return ref;\n}\n\nfunction normalizeArgs(\n arg1: unknown,\n arg2?: ServerFnHandler<unknown, unknown>,\n): {\n config: ServerFnConfig<unknown>;\n handler: ServerFnHandler<unknown, unknown>;\n} {\n // serverFn(handler) — input-less GET.\n if (typeof arg1 === 'function') {\n return {\n config: {},\n handler: arg1 as ServerFnHandler<unknown, unknown>,\n };\n }\n // serverFn(schema, handler) — a Standard Schema ⇒ POST + input.\n if (isStandardSchema(arg1)) {\n return {\n config: { input: arg1 as StandardSchemaV1<unknown> },\n handler: arg2 as ServerFnHandler<unknown, unknown>,\n };\n }\n // serverFn(config, handler) — explicit config object.\n return {\n config: (arg1 as ServerFnConfig<unknown>) ?? {},\n handler: arg2 as ServerFnHandler<unknown, unknown>,\n };\n}\n\nfunction isStandardSchema(value: unknown): value is StandardSchemaV1<unknown> {\n return typeof value === 'object' && value !== null && '~standard' in value;\n}\n","import {\n type ApplicationConfig,\n Injector,\n type StaticProvider,\n} from '@angular/core';\nimport { createApplication } from '@angular/platform-browser';\nimport {\n platformServer,\n provideServerRendering,\n} from '@angular/platform-server';\n\n/**\n * Builds the parent injector the server-function dispatch endpoint runs handlers\n * against, over HTTP.\n *\n * A plain `Injector.create({ providers })` resolves explicitly-listed providers\n * but not tree-shakeable `providedIn: 'root'` services — those attach to a\n * *bootstrapped* application's root injector, which `Injector.create` is not.\n * So the in-process SSR leg (whose parent is the app's own bootstrapped\n * injector) resolved `root` services while the HTTP leg did not — the same\n * handler could work while rendering and fail when called from the browser.\n *\n * Bootstrapping a real application on the server platform closes that gap: the\n * returned `appRef.injector` is a root environment injector, so both listed\n * providers and `providedIn: 'root'` services resolve, matching SSR.\n *\n * The generated endpoint passes the app's own server `ApplicationConfig` (the\n * one `main.server.ts` renders with), so a handler sees exactly the DI the app\n * configured — services, tokens, and interceptors alike — with no second\n * provider list to keep in sync. No root component is bootstrapped\n * (`createApplication`, not `bootstrapApplication`), so nothing renders, no\n * change detection runs, and the router registers but never navigates. It is a\n * DI container with the app's providers, built once and reused for the process,\n * with only `REQUEST`/`RESPONSE` rebuilt per call in the child.\n *\n * A bare provider array is also accepted (direct callers and tests without an\n * app config); it is wrapped with `provideServerRendering` so the server tokens\n * resolve the same way.\n */\nexport async function createServerFnAppInjector(\n configOrProviders: ApplicationConfig | StaticProvider[] = [],\n): Promise<Injector> {\n const config: ApplicationConfig = Array.isArray(configOrProviders)\n ? { providers: [provideServerRendering(), ...configOrProviders] }\n : configOrProviders;\n\n const appRef = await createApplication(config, {\n platformRef: platformServer(),\n });\n return appRef.injector;\n}\n","import type { Injector } from '@angular/core';\nimport { eventHandler, getRouterParam, readBody, type H3Event } from 'h3';\n\nimport { dispatchServerFn } from './dispatch';\n\n/**\n * The h3 request/response layer for the server-function dispatch route.\n *\n * `createServerFnAppInjector` bootstraps the parent injector once; this wraps\n * that in the `/_analog/fn/:id` handler the Nitro build registers. Kept as a\n * runtime function (rather than inlined into the generated module) so the\n * transport behaviour — body decoding, the malformed-body contract, and header\n * propagation — is unit-tested directly instead of by matching generated source.\n *\n * `appInjector` may be a promise: the generated module bootstraps the app at\n * import time and passes the pending injector, which is awaited on first request\n * and resolved instantly thereafter.\n */\nexport function createServerFnEventHandler(\n appInjector: Injector | Promise<Injector>,\n) {\n return eventHandler((event) => handleServerFnRequest(event, appInjector));\n}\n\n/**\n * Decode a server-function request, dispatch it, and write the result to the\n * h3 response. Same-origin, method, content-type, validation, and interceptors\n * are enforced inside `dispatchServerFn`; this owns only the h3 I/O around it.\n */\nexport async function handleServerFnRequest(\n event: H3Event,\n appInjector: Injector | Promise<Injector>,\n): Promise<unknown> {\n const id = getRouterParam(event, 'id') ?? '';\n\n // h3 parses the body before dispatch gets a say, and its parse error is an\n // HTML/500-shaped response rather than the JSON contract callers expect.\n let input: unknown;\n if (event.method !== 'GET') {\n try {\n input = await readBody(event);\n } catch {\n event.node.res.statusCode = 400;\n return { message: 'Malformed request body' };\n }\n }\n\n const { status, body, headers } = await dispatchServerFn(id, input, event, {\n parent: await appInjector,\n method: event.method,\n });\n\n event.node.res.statusCode = status;\n if (headers) {\n for (const [key, value] of Object.entries(headers)) {\n event.node.res.setHeader(key, value);\n }\n }\n return body;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ɵresetCompiledComponents","SERVER_CONTEXT","renderInternal"],"mappings":";;;;;;;;;AAEA;;;;AAIG;AACI,MAAM,gBAAgB,GAAG,IAAI,GAAG;;MCiB1B,sBAAsB,GAAG,IAAI,cAAc,CAEtD,wBAAwB;AAM1B;AACM,SAAU,wBAAwB,CACtC,YAAqC,EAAA;IAErC,OAAO;QACL,SAAS,EAAE,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM;AACnC,YAAA,OAAO,EAAE,sBAAsB;AAC/B,YAAA,QAAQ,EAAE,EAAE;AACZ,YAAA,KA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outeEndpointURL(route);
|
|
114
114
|
if (!!import.meta.env['VITE_ANALOG_PUBLIC_BASE_URL'] &&
|
|
115
115
|
globalThis.$fetch) {
|
|
116
|
-
return globalThis.$fetch(url.pathname);
|
|
116
|
+
return globalThis.$fetch(`${url.pathname}${url.search}`);
|
|
117
117
|
}
|
|
118
118
|
return firstValueFrom(http.get(`${url.href}`));
|
|
119
119
|
}
|
|
@@ -565,16 +565,15 @@ function requestContextInterceptor(req, next) {
|
|
|
565
565
|
(req.url.startsWith('/') ||
|
|
566
566
|
req.url.startsWith(baseUrl) ||
|
|
567
567
|
req.url.startsWith(`/${apiPrefix}`))) {
|
|
568
|
-
const requestUrl = new URL(req.
|
|
569
|
-
const
|
|
568
|
+
const requestUrl = new URL(req.urlWithParams, baseUrl);
|
|
569
|
+
const fetchUrl = `${requestUrl.pathname}${requestUrl.search}`;
|
|
570
|
+
const cacheKey = makeCacheKey(req, fetchUrl);
|
|
570
571
|
const storeKey = makeStateKey(`analog_${cacheKey}`);
|
|
571
|
-
const fetchUrl = requestUrl.pathname;
|
|
572
572
|
const responseType = req.responseType === 'arraybuffer' ? 'arrayBuffer' : req.responseType;
|
|
573
573
|
return from(global.$fetch
|
|
574
574
|
.raw(fetchUrl, {
|
|
575
575
|
method: req.method,
|
|
576
576
|
body: req.body ? req.body : undefined,
|
|
577
|
-
params: requestUrl.searchParams,
|
|
578
577
|
responseType,
|
|
579
578
|
headers: req.headers.keys().reduce((hdrs, current) => {
|
|
580
579
|
return {
|
|
@@ -600,10 +599,10 @@ function requestContextInterceptor(req, next) {
|
|
|
600
599
|
if (!import.meta.env.SSR &&
|
|
601
600
|
(req.url.startsWith('/') || req.url.includes('/_analog/'))) {
|
|
602
601
|
// /_analog/ requests are full URLs
|
|
603
|
-
const
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
const cacheKey = makeCacheKey(req,
|
|
602
|
+
const toAbsoluteUrl = (url) => new URL(url, window.location.origin);
|
|
603
|
+
const requestUrl = toAbsoluteUrl(req.url).href;
|
|
604
|
+
const { pathname, search } = toAbsoluteUrl(req.urlWithParams);
|
|
605
|
+
const cacheKey = makeCacheKey(req, `${pathname}${search}`);
|
|
607
606
|
const storeKey = makeStateKey(`analog_${cacheKey}`);
|
|
608
607
|
const cacheRestoreResponse = transferState.get(storeKey, null);
|
|
609
608
|
if (cacheRestoreResponse) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analogjs-router.mjs","sources":["../../../../packages/router/src/lib/meta-tags.ts","../../../../packages/router/src/lib/endpoints.ts","../../../../packages/router/src/lib/inject-route-endpoint-url.ts","../../../../packages/router/src/lib/route-config.ts","../../../../packages/router/src/lib/markdown-helpers.ts","../../../../packages/router/src/lib/constants.ts","../../../../packages/router/src/lib/routes.ts","../../../../packages/router/src/lib/define-route.ts","../../../../packages/router/src/lib/cookie-interceptor.ts","../../../../packages/router/src/lib/provide-file-router.ts","../../../../packages/router/src/lib/inject-load.ts","../../../../packages/router/src/lib/get-load-resolver.ts","../../../../packages/router/src/lib/cache-key.ts","../../../../packages/router/src/lib/request-context.ts","../../../../packages/router/src/lib/form-action.directive.ts","../../../../packages/router/src/lib/debug/routes.ts","../../../../packages/router/src/lib/debug/index.ts","../../../../packages/router/src/lib/server-fn/dispatcher.ts","../../../../packages/router/src/lib/server-fn/inject-server-fn.ts","../../../../packages/router/src/lib/server-fn/server-fn-ref.ts","../../../../packages/router/src/analogjs-router.ts"],"sourcesContent":["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 = 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 = 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 let ANALOG_PAGE_ENDPOINTS: any = {};\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) {\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';\n\nimport { RedirectRouteMeta, RouteConfig, RouteMeta } from './models';\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 let { meta, ...routeConfig } = routeMeta ?? {};\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 (!routeConfig) {\n routeConfig = {};\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 if (ANALOG_PAGE_ENDPOINTS[routeConfig[ANALOG_META_KEY].endpointKey]) {\n const http = inject(HttpClient);\n const url = injectRouteEndpointURL(route);\n\n if (\n !!import.meta.env['VITE_ANALOG_PUBLIC_BASE_URL'] &&\n (globalThis as any).$fetch\n ) {\n return (globalThis as any).$fetch(url.pathname);\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","import { inject } from '@angular/core';\nimport { RouteExport } from './models';\n\ndeclare const Zone: any;\ntype RenderResult = string | { content: string };\ntype ContentRendererLike = {\n render: (content: string) => Promise<RenderResult>;\n};\n\n// The Zone is currently enabled by default, so we wouldn't need this check.\n// However, leaving this open space will be useful if zone.js becomes optional\n// in the future. This means we won't have to modify the current code, and it will\n// continue to work seamlessly.\nconst isNgZoneEnabled = typeof Zone !== 'undefined' && !!Zone.root;\n\nexport function toMarkdownModule(\n markdownFileFactory: () => Promise<string>,\n): () => Promise<RouteExport> {\n return async () => {\n const createLoader = () =>\n Promise.all([import('@analogjs/content'), markdownFileFactory()]);\n\n const [\n { parseRawContentFile, MarkdownRouteComponent, ContentRenderer },\n markdownFile,\n ]: [typeof import('@analogjs/content'), string] = await (isNgZoneEnabled\n ? // We are not able to use `runOutsideAngular` because we are not inside\n // an injection context to retrieve the `NgZone` instance.\n // The `Zone.root.run` is required when the code is running in the\n // browser since asynchronous tasks being scheduled in the current context\n // are a reason for unnecessary change detection cycles.\n Zone.root.run(createLoader)\n : createLoader());\n\n const { content, attributes } = parseRawContentFile(markdownFile);\n const { title, meta } = attributes;\n\n return {\n default: MarkdownRouteComponent,\n routeMeta: {\n data: { _analogContent: content },\n title,\n meta,\n resolve: {\n renderedAnalogContent: async () => {\n const contentRenderer = inject<any>(\n ContentRenderer as any,\n ) as ContentRendererLike;\n const rendered = await contentRenderer.render(content);\n return typeof rendered === 'string'\n ? rendered\n : (rendered as any).content;\n },\n },\n },\n };\n };\n}\n","export const ENDPOINT_EXTENSION = '.server.ts';\nexport const APP_DIR = 'src/app';\n","import { UrlSegment } from '@angular/router';\nimport type { Route } from '@angular/router';\nimport type { UrlMatcher } from '@angular/router';\n\nimport type { RouteExport, RouteMeta } from './models';\nimport { toRouteConfig } from './route-config';\nimport { toMarkdownModule } from './markdown-helpers';\nimport { ENDPOINT_EXTENSION } from './constants';\nimport { ANALOG_META_KEY } from './endpoints';\n\n/**\n * This variable reference is replaced with a glob of all page routes.\n */\nexport let ANALOG_ROUTE_FILES = {};\n\n/**\n * This variable reference is replaced with a glob of all content routes.\n */\nexport let ANALOG_CONTENT_ROUTE_FILES = {};\n\nexport type Files = Record<string, () => Promise<RouteExport | string>>;\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>;\n\ntype RawRouteByLevelMap = Record<number, RawRouteMap>;\n\n/**\n * A function used to parse list of files and create configuration of routes.\n *\n * @param files\n * @returns Array of routes\n */\nexport function createRoutes(files: Files, debug = false): Route[] {\n const filenames = Object.keys(files);\n\n if (filenames.length === 0) {\n return [];\n }\n\n // map filenames to raw routes and group them by level\n const rawRoutesByLevelMap = filenames.reduce((acc, filename) => {\n const rawPath = toRawPath(filename);\n const rawSegments = rawPath.split('/');\n // nesting level starts at 0\n // rawPath: /products => level: 0\n // rawPath: /products/:id => level: 1\n const level = rawSegments.length - 1;\n const rawSegment = rawSegments[level];\n const ancestorRawSegments = rawSegments.slice(0, level);\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 // add each raw route to its parent's children array\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 // create the parent level and/or raw route if it does not exist\n // parent route won't exist for nested routes that don't have a layout route\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 // only take raw routes from the root level\n // since they already contain nested routes as their children\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, debug);\n}\n\nfunction toRawPath(filename: string): string {\n return (\n filename\n .replace(\n // convert to relative path and remove file extension\n /^(?:[a-zA-Z]:[\\\\/])?(.*?)[\\\\/](?:routes|pages)[\\\\/]|(?:[\\\\/](?:app[\\\\/](?:routes|pages)|src[\\\\/]content)[\\\\/])|(\\.page\\.(js|ts|analog|ag)$)|(\\.(ts|md|analog|ag)$)/g,\n '',\n )\n // [[...slug]] => placeholder (named empty) which is stripped by toSegment\n .replace(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g, '(opt-$1)')\n .replace(/\\[\\.{3}.+\\]/, '**') // [...not-found] => **\n .replace(/\\[([^\\]]+)\\]/g, ':$1')\n ); // [id] => :id\n}\n\nfunction toSegment(rawSegment: string): string {\n return rawSegment\n .replace(/index|\\(.*?\\)/g, '') // replace named empty segments\n .replace(/\\.|\\/+/g, '/') // replace dots with slashes and remove redundant slashes\n .replace(/^\\/+|\\/+$/g, ''); // remove trailing slashes\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(rawRoutes: RawRoute[], files: Files, debug = false): 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, debug)\n : undefined;\n let module: (() => Promise<RouteExport>) | undefined = undefined;\n let analogMeta: { endpoint: string; endpointKey: string } | undefined =\n undefined;\n\n if (rawRoute.filename) {\n const isMarkdownFile = rawRoute.filename.endsWith('.md');\n\n if (!debug) {\n module = isMarkdownFile\n ? toMarkdownModule(files[rawRoute.filename] as () => Promise<string>)\n : (files[rawRoute.filename] as () => Promise<RouteExport>);\n }\n\n const endpointKey = rawRoute.filename.replace(\n /\\.page\\.(ts|analog|ag)$/,\n ENDPOINT_EXTENSION,\n );\n\n // get endpoint path\n const rawEndpoint = rawRoute.filename\n .replace(/\\.page\\.(ts|analog|ag)$/, '')\n .replace(/\\[\\[\\.\\.\\..+\\]\\]/, '**')\n .replace(/\\[\\.{3}.+\\]/, '**') // [...not-found] => **\n .replace(/^(.*?)\\/pages/, '/pages');\n\n // replace periods, remove (index) paths\n const endpoint = (rawEndpoint || '')\n .replace(/\\./g, '/')\n .replace(/\\/\\((.*?)\\)$/, '/-$1-');\n\n analogMeta = {\n endpoint,\n endpointKey,\n };\n }\n\n // Detect Next.js-style optional catch-all at this node: [[...param]]\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 baseChild = {\n path: '',\n component: m.default,\n ...toRouteConfig(m.routeMeta as RouteMeta | undefined),\n children,\n [ANALOG_META_KEY]: analogMeta,\n };\n\n // Base route first so static matches win, then optional catch-all matcher\n return [\n {\n ...baseChild,\n },\n ...(optCatchAllParam\n ? [\n {\n matcher:\n createOptionalCatchAllMatcher(optCatchAllParam),\n component: m.default,\n ...toRouteConfig(m.routeMeta as RouteMeta | undefined),\n [ANALOG_META_KEY]: analogMeta,\n },\n ]\n : []),\n ];\n }),\n }\n : {\n path: rawRoute.segment,\n ...(debug\n ? {\n filename: rawRoute.filename ? rawRoute.filename : undefined,\n isLayout: children && children.length > 0 ? true : false,\n }\n : {}),\n children,\n };\n\n routes.push(route);\n }\n\n return routes;\n}\n\nfunction sortRawRoutes(rawRoutes: RawRoute[]): void {\n rawRoutes.sort((a, b) => {\n let segmentA = deprioritizeSegment(a.segment);\n let segmentB = deprioritizeSegment(b.segment);\n\n // prioritize routes with fewer children\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 // deprioritize param and wildcard segments\n return segment.replace(':', '~~').replace('**', '~~~~');\n}\n\nexport const routes: Route[] = createRoutes({\n ...ANALOG_ROUTE_FILES,\n ...ANALOG_CONTENT_ROUTE_FILES,\n});\n","import { inject } from '@angular/core';\nimport { Route as NgRoute, Router } from '@angular/router';\nimport { ActivatedRoute } from '@angular/router';\n\ntype RouteOmitted =\n | 'component'\n | 'loadComponent'\n | 'loadChildren'\n | 'path'\n | 'pathMatch';\n\ntype RestrictedRoute = Omit<NgRoute, RouteOmitted>;\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) => {\n return route;\n};\n\n/**\n * Returns the instance of Angular Router\n *\n * @returns The router\n */\nexport const injectRouter = () => {\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 = () => {\n return inject(ActivatedRoute);\n};\n","import { isPlatformServer } from '@angular/common';\nimport { HttpHandlerFn, HttpHeaders, HttpRequest } from '@angular/common/http';\nimport { PLATFORM_ID, inject } from '@angular/core';\nimport { injectRequest } from '@analogjs/router/tokens';\n\nexport function cookieInterceptor(\n req: HttpRequest<unknown>,\n next: HttpHandlerFn,\n location = inject(PLATFORM_ID),\n serverRequest = injectRequest(),\n) {\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 makeEnvironmentProviders,\n} from '@angular/core';\nimport { provideRouter, RouterFeatures, ROUTES, Routes } from '@angular/router';\nimport { API_PREFIX } from '@analogjs/router/tokens';\nimport { ɵHTTP_ROOT_INTERCEPTOR_FNS as HTTP_ROOT_INTERCEPTOR_FNS } from '@angular/common/http';\n\nimport { routes } from './routes';\nimport { updateMetaTagsOnRouteChange } from './meta-tags';\nimport { cookieInterceptor } from './cookie-interceptor';\n\ndeclare const ANALOG_API_PREFIX: string;\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 const extraRoutesFeature = features.filter((feat) => feat.ɵkind >= 100);\n const routerFeatures = features.filter((feat) => feat.ɵkind < 100);\n\n return makeEnvironmentProviders([\n extraRoutesFeature.map((erf) => erf.ɵproviders),\n provideRouter(routes, ...routerFeatures),\n {\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useValue: () => updateMetaTagsOnRouteChange(),\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\n/**\n * Provides extra custom routes in addition to the routes\n * discovered from the filesystem-based routing. These routes are\n * inserted before the filesystem-based routes, and take priority in\n * route matching.\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 { Injector, inject } from '@angular/core';\nimport { ActivatedRoute, Data } from '@angular/router';\nimport { Observable, map } from 'rxjs';\n\nimport { PageServerLoad } from './route-types';\n\nexport function injectLoad<\n T extends (pageServerLoad: PageServerLoad) => Promise<any>,\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","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<any>,\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 let 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 HttpHandlerFn,\n HttpHeaders,\n HttpRequest,\n HttpResponse,\n} from '@angular/common/http';\n\nimport { from, of } from 'rxjs';\n\nimport { injectBaseURL, injectAPIPrefix } 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) {\n const apiPrefix = injectAPIPrefix();\n const baseUrl = injectBaseURL();\n const transferState = inject(TransferState);\n\n // during prerendering with Nitro\n if (\n typeof global !== 'undefined' &&\n global.$fetch &&\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(\n global.$fetch\n .raw(fetchUrl, {\n method: req.method as any,\n body: req.body ? req.body : undefined,\n params: requestUrl.searchParams,\n responseType,\n headers: req.headers.keys().reduce((hdrs, current) => {\n return {\n ...hdrs,\n [current]: req.headers.get(current),\n };\n }, {}),\n })\n .then((res) => {\n const cacheResponse = {\n body: res._data,\n headers: new HttpHeaders(res.headers),\n status: 200,\n 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 { Directive, inject, input, output } from '@angular/core';\nimport { ActivatedRoute, Params, Router } from '@angular/router';\n\nimport { injectRouteEndpointURL } from './inject-route-endpoint-url';\n\n@Directive({\n selector: 'form[action],form[method]',\n host: {\n '(submit)': `submitted($event)`,\n },\n standalone: true,\n})\nexport class FormAction {\n action = input<string>('');\n onSuccess = output<unknown>();\n onError = output<unknown>();\n state = output<\n 'submitting' | 'error' | 'redirect' | 'success' | 'navigate'\n >();\n private router = inject(Router);\n private route = inject(ActivatedRoute);\n private path = this._getPath();\n\n submitted($event: any) {\n $event.preventDefault();\n\n this.state.emit('submitting');\n const body = new FormData($event.target);\n\n if ($event.target.method.toUpperCase() === 'GET') {\n this._handleGet(body, this.router.url);\n } else {\n this._handlePost(body, this.path, $event);\n }\n }\n\n private _handleGet(body: FormData, path: string) {\n const params: Params = {};\n body.forEach((formVal, formKey) => (params[formKey] = formVal));\n\n this.state.emit('navigate');\n const url = path.split('?')[0];\n this.router.navigate([url], {\n queryParams: params,\n onSameUrlNavigation: 'reload',\n });\n }\n\n private _handlePost(\n body: FormData,\n path: string,\n $event: { target: HTMLFormElement } & Event,\n ) {\n fetch(path, {\n method: $event.target.method,\n body,\n })\n .then((res) => {\n if (res.ok) {\n if (res.redirected) {\n const redirectUrl = new URL(res.url).pathname;\n this.state.emit('redirect');\n this.router.navigate([redirectUrl]);\n } else if (this._isJSON(res.headers.get('Content-type'))) {\n res.json().then((result) => {\n this.onSuccess.emit(result);\n this.state.emit('success');\n });\n } else {\n res.text().then((result) => {\n this.onSuccess.emit(result);\n this.state.emit('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.state.emit('error');\n });\n } else {\n this.state.emit('error');\n }\n }\n })\n .catch((_) => {\n this.state.emit('error');\n });\n }\n\n private _getPath() {\n if (this.route) {\n return injectRouteEndpointURL(this.route.snapshot).pathname;\n }\n\n return `/api/_analog/pages${window.location.pathname}`;\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 { inject, InjectionToken } from '@angular/core';\nimport { Route } from '@angular/router';\n\nimport {\n ANALOG_CONTENT_ROUTE_FILES,\n ANALOG_ROUTE_FILES,\n createRoutes,\n} from '../routes';\n\nexport const DEBUG_ROUTES = new InjectionToken(\n '@analogjs/router debug routes',\n {\n providedIn: 'root',\n factory() {\n const debugRoutes = createRoutes(\n {\n ...ANALOG_ROUTE_FILES,\n ...ANALOG_CONTENT_ROUTE_FILES,\n },\n true,\n );\n\n return debugRoutes as (Route & DebugRoute)[];\n },\n },\n);\n\nexport type DebugRoute = {\n path: string;\n filename: string;\n isLayout: boolean;\n children?: DebugRoute[];\n};\n\nexport function injectDebugRoutes() {\n return inject(DEBUG_ROUTES);\n}\n","import { 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 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 { InjectionToken, type Injector } from '@angular/core';\n\nimport type { ServerFn } from './types';\n\n/**\n * In-process transport for a server function call.\n *\n * Provided on the server by `provideServerContext`, so during SSR a server\n * function runs in the same process — and the same request injector — as the\n * render instead of making an HTTP request back into the app. Absent in the\n * browser, where `ServerFnClient` falls back to `HttpClient`.\n *\n * `injector` is the **app environment injector** — `ServerFnClient` is\n * `providedIn: 'root'`, and SSR bootstraps a fresh application per request, so\n * its injector is both per-request and the right scope for a handler to resolve\n * from. It is passed rather than captured from the token because\n * `provideServerContext` is applied as *platform* providers, which sit above\n * the app's `providedIn: 'root'` services.\n *\n * Deliberately not a component's node injector: a handler resolves app-level\n * services, and making that depend on which component happened to call it would\n * be surprising and unportable.\n */\nexport type ServerFnDispatcher = <In, Out>(\n fn: ServerFn<In, Out>,\n input: In,\n injector: Injector,\n) => Promise<Out>;\n\nexport const SERVER_FN_DISPATCHER = new InjectionToken<ServerFnDispatcher>(\n '@analogjs/router Server Function Dispatcher',\n);\n","import {\n Injectable,\n Injector,\n assertInInjectionContext,\n inject,\n makeStateKey,\n resource,\n TransferState,\n type ResourceRef,\n} from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { firstValueFrom } from 'rxjs';\n\nimport type { ServerFn } from './types';\nimport { SERVER_FN_DISPATCHER } from './dispatcher';\n\n/**\n * Client transport for server functions. In the browser it goes through Angular\n * `HttpClient`, so client `HttpInterceptorFn`s apply. During SSR the dispatcher\n * token is provided, and the call short-circuits the HTTP round-trip: the\n * handler runs in-process in the current request injector. Lives in the client\n * entry (client-safe).\n */\n@Injectable({ providedIn: 'root' })\nexport class ServerFnClient {\n private readonly http = inject(HttpClient);\n private readonly transferState = inject(TransferState);\n private readonly injector = inject(Injector);\n private readonly dispatcher = inject(SERVER_FN_DISPATCHER, {\n optional: true,\n });\n\n /** True while rendering on the server (the in-process dispatcher is provided). */\n get isServer(): boolean {\n return !!this.dispatcher;\n }\n\n async call<In, Out>(fn: ServerFn<In, Out>, input: In): Promise<Out> {\n if (this.dispatcher) {\n return this.dispatcher(fn, input, this.injector);\n }\n\n const request$ =\n fn.method === 'GET'\n ? this.http.get<Out>(fn.url)\n : this.http.post<Out>(fn.url, input ?? {});\n return firstValueFrom(request$);\n }\n\n /** Key a read's value for TransferState hydration (fn id + input). */\n stateKey<Out>(fn: ServerFn<unknown, Out>, input: unknown) {\n return makeStateKey<Out>(`__analog_fn_${fn.id}_${stableInput(input)}`);\n }\n\n readSeed<Out>(fn: ServerFn<unknown, Out>, input: unknown): Out | undefined {\n const key = this.stateKey(fn, input);\n if (this.transferState.hasKey(key)) {\n const value = this.transferState.get(key, undefined as unknown as Out);\n this.transferState.remove(key); // single-use\n return value;\n }\n return undefined;\n }\n\n writeSeed<Out>(fn: ServerFn<unknown, Out>, input: unknown, value: Out): void {\n this.transferState.set(this.stateKey(fn, input), value);\n }\n}\n\n/** No-op provider hook; ServerFnClient is `providedIn: 'root'`. */\nexport function provideServerFnClient() {\n return [] as const;\n}\n\n// Stable sentinel for the input-less read: `resource()` treats an `undefined`\n// params value as \"idle, don't load\", so an input-less read must yield a\n// defined-but-ignored params. It is never sent — the call uses `undefined`.\nconst NO_INPUT = Symbol('analog.serverFn.noInput');\n\n/**\n * Reactive read of a server function as an Angular `resource()`.\n *\n * `args` is optional: omit it for an input-less read (the resource loads once);\n * provide it for an input-bearing read (returning `undefined` from `args` leaves\n * the resource idle until inputs are ready, the standard resource pattern). For\n * imperative calls (mutations, event handlers) use `injectServerFnMutation`.\n */\nexport function injectServerFn<Out>(\n fn: ServerFn<void, Out>,\n): ResourceRef<Out | undefined>;\nexport function injectServerFn<In, Out>(\n fn: ServerFn<In, Out>,\n args: () => In | undefined,\n): ResourceRef<Out | undefined>;\nexport function injectServerFn<In, Out>(\n fn: ServerFn<In, Out>,\n args?: () => In | undefined,\n): ResourceRef<Out | undefined> {\n assertInInjectionContext(injectServerFn);\n const client = inject(ServerFnClient);\n\n return resource<Out | undefined, unknown>({\n params: () => (args ? args() : NO_INPUT),\n loader: async ({ params }) => {\n const input = (params === NO_INPUT ? undefined : params) as In;\n // Hydrate from the SSR seed on first client render; else fetch and (on\n // the server) seed for the client.\n const seeded = client.readSeed(fn as ServerFn<unknown, Out>, input);\n if (seeded !== undefined) return seeded;\n const value = await client.call(fn, input);\n if (client.isServer) {\n client.writeSeed(fn as ServerFn<unknown, Out>, input, value);\n }\n return value;\n },\n });\n}\n\n/**\n * Imperative binding of a server function: returns a callable that dispatches\n * the call through `HttpClient` (so client interceptors apply) and resolves the\n * result. Use for mutations and event-driven calls; use `injectServerFn` for\n * reactive reads.\n */\nexport function injectServerFnMutation<In, Out>(\n fn: ServerFn<In, Out>,\n): (input: In) => Promise<Out> {\n assertInInjectionContext(injectServerFnMutation);\n const client = inject(ServerFnClient);\n return (input: In) => client.call(fn, input);\n}\n\nfunction stableInput(input: unknown): string {\n if (input === undefined || input === null) return '_';\n return JSON.stringify(input);\n}\n","import type { ServerFn, ServerFnMethod } from './types';\n\nexport interface ServerFnRefConfig {\n id?: string;\n method?: ServerFnMethod;\n /**\n * Only its presence matters here: when `method` is omitted, a config with an\n * `input` schema defaults to `POST`, otherwise `GET`. The schema itself is\n * never used to build the ref — validation happens server-side.\n */\n input?: unknown;\n}\n\n/**\n * Builds a server-function reference: the client-safe `{ __serverFn, id, url,\n * method }` metadata that `injectServerFn`/`ServerFnClient` dispatch through.\n *\n * Shared by both sides so they produce identical refs: the server `serverFn`\n * wraps this with registration + the handler, and the client build's scrub\n * transform emits a call to this factory in place of the server module so the\n * browser bundle carries only the ref, never the handler or its server imports.\n *\n * The returned value is callable-typed but throws if invoked directly — it is\n * always dispatched via `injectServerFn`/`ServerFnClient`, never called.\n */\nexport function createServerFnRef<In, Out>(\n config: ServerFnRefConfig,\n): ServerFn<In, Out> {\n if (!config.id) {\n throw new Error(\n '[analog] serverFn is missing its build-derived id. Server functions require the Analog build transform (@analogjs/platform / @analogjs/vite-plugin-nitro); a raw import without it is not supported.',\n );\n }\n const method: ServerFnMethod =\n config.method ?? (config.input ? 'POST' : 'GET');\n const url = `/_analog/fn/${config.id}`;\n\n const ref = (() => {\n throw new Error(\n `serverFn \"${config.id}\" must be called via injectServerFn/ServerFnClient`,\n );\n }) as unknown as ServerFn<In, Out>;\n\n return Object.assign(ref, {\n __serverFn: true as const,\n id: config.id,\n url,\n method,\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["HTTP_ROOT_INTERCEPTOR_FNS"],"mappings":";;;;;;;;;;AAKO,MAAM,mBAAmB,GAAG,MAAM,CACvC,sCAAsC,CACvC;AAED,MAAM,WAAW,GAAG,SAAS;AAC7B,MAAM,cAAc,GAAG,WAAW;AAClC;AACA,MAAM,uBAAu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IAAI,KAAK,KAAK,IAAI;AAAE,QAAA,OAAO,GAAG;AACrD,IAAA,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;AAC9B;;AC1HA;;;;;;;;;;;AAWG;AACG,SAAU,iBAAiB,CAC/B,MAAyB,EAAA;AAEzB,IAAA,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE;AACd,QAAA,MAAM,IAAI,KAAK,CACb,sMAAsM,CACvM;IACH;AACA,IAAA,MAAM,MAAM,GACV,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;AAClD,IAAA,MAAM,GAAG,GAAG,CAAA,YAAA,EAAe,MAAM,CAAC,EAAE,EAAE;AAEtC,IAAA,MAAM,GAAG,IAAI,MAAK;QAChB,MAAM,IAAI,KAAK,CACb,CAAA,UAAA,EAAa,MAAM,CAAC,EAAE,CAAA,kDAAA,CAAoD,CAC3E;AACH,IAAA,CAAC,CAAiC;AAElC,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;AACxB,QAAA,UAAU,EAAE,IAAa;QACzB,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,GAAG;QACH,MAAM;AACP,KAAA,CAAC;AACJ;;ACjDA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"analogjs-router.mjs","sources":["../../../../packages/router/src/lib/meta-tags.ts","../../../../packages/router/src/lib/endpoints.ts","../../../../packages/router/src/lib/inject-route-endpoint-url.ts","../../../../packages/router/src/lib/route-config.ts","../../../../packages/router/src/lib/markdown-helpers.ts","../../../../packages/router/src/lib/constants.ts","../../../../packages/router/src/lib/routes.ts","../../../../packages/router/src/lib/define-route.ts","../../../../packages/router/src/lib/cookie-interceptor.ts","../../../../packages/router/src/lib/provide-file-router.ts","../../../../packages/router/src/lib/inject-load.ts","../../../../packages/router/src/lib/get-load-resolver.ts","../../../../packages/router/src/lib/cache-key.ts","../../../../packages/router/src/lib/request-context.ts","../../../../packages/router/src/lib/form-action.directive.ts","../../../../packages/router/src/lib/debug/routes.ts","../../../../packages/router/src/lib/debug/index.ts","../../../../packages/router/src/lib/server-fn/dispatcher.ts","../../../../packages/router/src/lib/server-fn/inject-server-fn.ts","../../../../packages/router/src/lib/server-fn/server-fn-ref.ts","../../../../packages/router/src/analogjs-router.ts"],"sourcesContent":["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 = 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 = 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 let ANALOG_PAGE_ENDPOINTS: any = {};\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) {\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';\n\nimport { RedirectRouteMeta, RouteConfig, RouteMeta } from './models';\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 let { meta, ...routeConfig } = routeMeta ?? {};\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 (!routeConfig) {\n routeConfig = {};\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 if (ANALOG_PAGE_ENDPOINTS[routeConfig[ANALOG_META_KEY].endpointKey]) {\n const http = inject(HttpClient);\n const url = injectRouteEndpointURL(route);\n\n if (\n !!import.meta.env['VITE_ANALOG_PUBLIC_BASE_URL'] &&\n (globalThis as any).$fetch\n ) {\n return (globalThis as any).$fetch(`${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","import { inject } from '@angular/core';\nimport { RouteExport } from './models';\n\ndeclare const Zone: any;\ntype RenderResult = string | { content: string };\ntype ContentRendererLike = {\n render: (content: string) => Promise<RenderResult>;\n};\n\n// The Zone is currently enabled by default, so we wouldn't need this check.\n// However, leaving this open space will be useful if zone.js becomes optional\n// in the future. This means we won't have to modify the current code, and it will\n// continue to work seamlessly.\nconst isNgZoneEnabled = typeof Zone !== 'undefined' && !!Zone.root;\n\nexport function toMarkdownModule(\n markdownFileFactory: () => Promise<string>,\n): () => Promise<RouteExport> {\n return async () => {\n const createLoader = () =>\n Promise.all([import('@analogjs/content'), markdownFileFactory()]);\n\n const [\n { parseRawContentFile, MarkdownRouteComponent, ContentRenderer },\n markdownFile,\n ]: [typeof import('@analogjs/content'), string] = await (isNgZoneEnabled\n ? // We are not able to use `runOutsideAngular` because we are not inside\n // an injection context to retrieve the `NgZone` instance.\n // The `Zone.root.run` is required when the code is running in the\n // browser since asynchronous tasks being scheduled in the current context\n // are a reason for unnecessary change detection cycles.\n Zone.root.run(createLoader)\n : createLoader());\n\n const { content, attributes } = parseRawContentFile(markdownFile);\n const { title, meta } = attributes;\n\n return {\n default: MarkdownRouteComponent,\n routeMeta: {\n data: { _analogContent: content },\n title,\n meta,\n resolve: {\n renderedAnalogContent: async () => {\n const contentRenderer = inject<any>(\n ContentRenderer as any,\n ) as ContentRendererLike;\n const rendered = await contentRenderer.render(content);\n return typeof rendered === 'string'\n ? rendered\n : (rendered as any).content;\n },\n },\n },\n };\n };\n}\n","export const ENDPOINT_EXTENSION = '.server.ts';\nexport const APP_DIR = 'src/app';\n","import { UrlSegment } from '@angular/router';\nimport type { Route } from '@angular/router';\nimport type { UrlMatcher } from '@angular/router';\n\nimport type { RouteExport, RouteMeta } from './models';\nimport { toRouteConfig } from './route-config';\nimport { toMarkdownModule } from './markdown-helpers';\nimport { ENDPOINT_EXTENSION } from './constants';\nimport { ANALOG_META_KEY } from './endpoints';\n\n/**\n * This variable reference is replaced with a glob of all page routes.\n */\nexport let ANALOG_ROUTE_FILES = {};\n\n/**\n * This variable reference is replaced with a glob of all content routes.\n */\nexport let ANALOG_CONTENT_ROUTE_FILES = {};\n\nexport type Files = Record<string, () => Promise<RouteExport | string>>;\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>;\n\ntype RawRouteByLevelMap = Record<number, RawRouteMap>;\n\n/**\n * A function used to parse list of files and create configuration of routes.\n *\n * @param files\n * @returns Array of routes\n */\nexport function createRoutes(files: Files, debug = false): Route[] {\n const filenames = Object.keys(files);\n\n if (filenames.length === 0) {\n return [];\n }\n\n // map filenames to raw routes and group them by level\n const rawRoutesByLevelMap = filenames.reduce((acc, filename) => {\n const rawPath = toRawPath(filename);\n const rawSegments = rawPath.split('/');\n // nesting level starts at 0\n // rawPath: /products => level: 0\n // rawPath: /products/:id => level: 1\n const level = rawSegments.length - 1;\n const rawSegment = rawSegments[level];\n const ancestorRawSegments = rawSegments.slice(0, level);\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 // add each raw route to its parent's children array\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 // create the parent level and/or raw route if it does not exist\n // parent route won't exist for nested routes that don't have a layout route\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 // only take raw routes from the root level\n // since they already contain nested routes as their children\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, debug);\n}\n\nfunction toRawPath(filename: string): string {\n return (\n filename\n .replace(\n // convert to relative path and remove file extension\n /^(?:[a-zA-Z]:[\\\\/])?(.*?)[\\\\/](?:routes|pages)[\\\\/]|(?:[\\\\/](?:app[\\\\/](?:routes|pages)|src[\\\\/]content)[\\\\/])|(\\.page\\.(js|ts|analog|ag)$)|(\\.(ts|md|analog|ag)$)/g,\n '',\n )\n // [[...slug]] => placeholder (named empty) which is stripped by toSegment\n .replace(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g, '(opt-$1)')\n .replace(/\\[\\.{3}.+\\]/, '**') // [...not-found] => **\n .replace(/\\[([^\\]]+)\\]/g, ':$1')\n ); // [id] => :id\n}\n\nfunction toSegment(rawSegment: string): string {\n return rawSegment\n .replace(/index|\\(.*?\\)/g, '') // replace named empty segments\n .replace(/\\.|\\/+/g, '/') // replace dots with slashes and remove redundant slashes\n .replace(/^\\/+|\\/+$/g, ''); // remove trailing slashes\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(rawRoutes: RawRoute[], files: Files, debug = false): 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, debug)\n : undefined;\n let module: (() => Promise<RouteExport>) | undefined = undefined;\n let analogMeta: { endpoint: string; endpointKey: string } | undefined =\n undefined;\n\n if (rawRoute.filename) {\n const isMarkdownFile = rawRoute.filename.endsWith('.md');\n\n if (!debug) {\n module = isMarkdownFile\n ? toMarkdownModule(files[rawRoute.filename] as () => Promise<string>)\n : (files[rawRoute.filename] as () => Promise<RouteExport>);\n }\n\n const endpointKey = rawRoute.filename.replace(\n /\\.page\\.(ts|analog|ag)$/,\n ENDPOINT_EXTENSION,\n );\n\n // get endpoint path\n const rawEndpoint = rawRoute.filename\n .replace(/\\.page\\.(ts|analog|ag)$/, '')\n .replace(/\\[\\[\\.\\.\\..+\\]\\]/, '**')\n .replace(/\\[\\.{3}.+\\]/, '**') // [...not-found] => **\n .replace(/^(.*?)\\/pages/, '/pages');\n\n // replace periods, remove (index) paths\n const endpoint = (rawEndpoint || '')\n .replace(/\\./g, '/')\n .replace(/\\/\\((.*?)\\)$/, '/-$1-');\n\n analogMeta = {\n endpoint,\n endpointKey,\n };\n }\n\n // Detect Next.js-style optional catch-all at this node: [[...param]]\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 baseChild = {\n path: '',\n component: m.default,\n ...toRouteConfig(m.routeMeta as RouteMeta | undefined),\n children,\n [ANALOG_META_KEY]: analogMeta,\n };\n\n // Base route first so static matches win, then optional catch-all matcher\n return [\n {\n ...baseChild,\n },\n ...(optCatchAllParam\n ? [\n {\n matcher:\n createOptionalCatchAllMatcher(optCatchAllParam),\n component: m.default,\n ...toRouteConfig(m.routeMeta as RouteMeta | undefined),\n [ANALOG_META_KEY]: analogMeta,\n },\n ]\n : []),\n ];\n }),\n }\n : {\n path: rawRoute.segment,\n ...(debug\n ? {\n filename: rawRoute.filename ? rawRoute.filename : undefined,\n isLayout: children && children.length > 0 ? true : false,\n }\n : {}),\n children,\n };\n\n routes.push(route);\n }\n\n return routes;\n}\n\nfunction sortRawRoutes(rawRoutes: RawRoute[]): void {\n rawRoutes.sort((a, b) => {\n let segmentA = deprioritizeSegment(a.segment);\n let segmentB = deprioritizeSegment(b.segment);\n\n // prioritize routes with fewer children\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 // deprioritize param and wildcard segments\n return segment.replace(':', '~~').replace('**', '~~~~');\n}\n\nexport const routes: Route[] = createRoutes({\n ...ANALOG_ROUTE_FILES,\n ...ANALOG_CONTENT_ROUTE_FILES,\n});\n","import { inject } from '@angular/core';\nimport { Route as NgRoute, Router } from '@angular/router';\nimport { ActivatedRoute } from '@angular/router';\n\ntype RouteOmitted =\n | 'component'\n | 'loadComponent'\n | 'loadChildren'\n | 'path'\n | 'pathMatch';\n\ntype RestrictedRoute = Omit<NgRoute, RouteOmitted>;\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) => {\n return route;\n};\n\n/**\n * Returns the instance of Angular Router\n *\n * @returns The router\n */\nexport const injectRouter = () => {\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 = () => {\n return inject(ActivatedRoute);\n};\n","import { isPlatformServer } from '@angular/common';\nimport { HttpHandlerFn, HttpHeaders, HttpRequest } from '@angular/common/http';\nimport { PLATFORM_ID, inject } from '@angular/core';\nimport { injectRequest } from '@analogjs/router/tokens';\n\nexport function cookieInterceptor(\n req: HttpRequest<unknown>,\n next: HttpHandlerFn,\n location = inject(PLATFORM_ID),\n serverRequest = injectRequest(),\n) {\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 makeEnvironmentProviders,\n} from '@angular/core';\nimport { provideRouter, RouterFeatures, ROUTES, Routes } from '@angular/router';\nimport { API_PREFIX } from '@analogjs/router/tokens';\nimport { ɵHTTP_ROOT_INTERCEPTOR_FNS as HTTP_ROOT_INTERCEPTOR_FNS } from '@angular/common/http';\n\nimport { routes } from './routes';\nimport { updateMetaTagsOnRouteChange } from './meta-tags';\nimport { cookieInterceptor } from './cookie-interceptor';\n\ndeclare const ANALOG_API_PREFIX: string;\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 const extraRoutesFeature = features.filter((feat) => feat.ɵkind >= 100);\n const routerFeatures = features.filter((feat) => feat.ɵkind < 100);\n\n return makeEnvironmentProviders([\n extraRoutesFeature.map((erf) => erf.ɵproviders),\n provideRouter(routes, ...routerFeatures),\n {\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useValue: () => updateMetaTagsOnRouteChange(),\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\n/**\n * Provides extra custom routes in addition to the routes\n * discovered from the filesystem-based routing. These routes are\n * inserted before the filesystem-based routes, and take priority in\n * route matching.\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 { Injector, inject } from '@angular/core';\nimport { ActivatedRoute, Data } from '@angular/router';\nimport { Observable, map } from 'rxjs';\n\nimport { PageServerLoad } from './route-types';\n\nexport function injectLoad<\n T extends (pageServerLoad: PageServerLoad) => Promise<any>,\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","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<any>,\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 let 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 HttpHandlerFn,\n HttpHeaders,\n HttpRequest,\n HttpResponse,\n} from '@angular/common/http';\n\nimport { from, of } from 'rxjs';\n\nimport { injectBaseURL, injectAPIPrefix } 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) {\n const apiPrefix = injectAPIPrefix();\n const baseUrl = injectBaseURL();\n const transferState = inject(TransferState);\n\n // during prerendering with Nitro\n if (\n typeof global !== 'undefined' &&\n global.$fetch &&\n baseUrl &&\n (req.url.startsWith('/') ||\n req.url.startsWith(baseUrl) ||\n req.url.startsWith(`/${apiPrefix}`))\n ) {\n const requestUrl = new URL(req.urlWithParams, baseUrl);\n const fetchUrl = `${requestUrl.pathname}${requestUrl.search}`;\n const cacheKey = makeCacheKey(req, fetchUrl);\n const storeKey = makeStateKey<unknown>(`analog_${cacheKey}`);\n\n const responseType =\n req.responseType === 'arraybuffer' ? 'arrayBuffer' : req.responseType;\n\n return from(\n global.$fetch\n .raw(fetchUrl, {\n method: req.method as any,\n body: req.body ? req.body : undefined,\n responseType,\n headers: req.headers.keys().reduce((hdrs, current) => {\n return {\n ...hdrs,\n [current]: req.headers.get(current),\n };\n }, {}),\n })\n .then((res) => {\n const cacheResponse = {\n body: res._data,\n headers: new HttpHeaders(res.headers),\n status: 200,\n 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 toAbsoluteUrl = (url: string) => new URL(url, window.location.origin);\n const requestUrl = toAbsoluteUrl(req.url).href;\n const { pathname, search } = toAbsoluteUrl(req.urlWithParams);\n const cacheKey = makeCacheKey(req, `${pathname}${search}`);\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 { Directive, inject, input, output } from '@angular/core';\nimport { ActivatedRoute, Params, Router } from '@angular/router';\n\nimport { injectRouteEndpointURL } from './inject-route-endpoint-url';\n\n@Directive({\n selector: 'form[action],form[method]',\n host: {\n '(submit)': `submitted($event)`,\n },\n standalone: true,\n})\nexport class FormAction {\n action = input<string>('');\n onSuccess = output<unknown>();\n onError = output<unknown>();\n state = output<\n 'submitting' | 'error' | 'redirect' | 'success' | 'navigate'\n >();\n private router = inject(Router);\n private route = inject(ActivatedRoute);\n private path = this._getPath();\n\n submitted($event: any) {\n $event.preventDefault();\n\n this.state.emit('submitting');\n const body = new FormData($event.target);\n\n if ($event.target.method.toUpperCase() === 'GET') {\n this._handleGet(body, this.router.url);\n } else {\n this._handlePost(body, this.path, $event);\n }\n }\n\n private _handleGet(body: FormData, path: string) {\n const params: Params = {};\n body.forEach((formVal, formKey) => (params[formKey] = formVal));\n\n this.state.emit('navigate');\n const url = path.split('?')[0];\n this.router.navigate([url], {\n queryParams: params,\n onSameUrlNavigation: 'reload',\n });\n }\n\n private _handlePost(\n body: FormData,\n path: string,\n $event: { target: HTMLFormElement } & Event,\n ) {\n fetch(path, {\n method: $event.target.method,\n body,\n })\n .then((res) => {\n if (res.ok) {\n if (res.redirected) {\n const redirectUrl = new URL(res.url).pathname;\n this.state.emit('redirect');\n this.router.navigate([redirectUrl]);\n } else if (this._isJSON(res.headers.get('Content-type'))) {\n res.json().then((result) => {\n this.onSuccess.emit(result);\n this.state.emit('success');\n });\n } else {\n res.text().then((result) => {\n this.onSuccess.emit(result);\n this.state.emit('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.state.emit('error');\n });\n } else {\n this.state.emit('error');\n }\n }\n })\n .catch((_) => {\n this.state.emit('error');\n });\n }\n\n private _getPath() {\n if (this.route) {\n return injectRouteEndpointURL(this.route.snapshot).pathname;\n }\n\n return `/api/_analog/pages${window.location.pathname}`;\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 { inject, InjectionToken } from '@angular/core';\nimport { Route } from '@angular/router';\n\nimport {\n ANALOG_CONTENT_ROUTE_FILES,\n ANALOG_ROUTE_FILES,\n createRoutes,\n} from '../routes';\n\nexport const DEBUG_ROUTES = new InjectionToken(\n '@analogjs/router debug routes',\n {\n providedIn: 'root',\n factory() {\n const debugRoutes = createRoutes(\n {\n ...ANALOG_ROUTE_FILES,\n ...ANALOG_CONTENT_ROUTE_FILES,\n },\n true,\n );\n\n return debugRoutes as (Route & DebugRoute)[];\n },\n },\n);\n\nexport type DebugRoute = {\n path: string;\n filename: string;\n isLayout: boolean;\n children?: DebugRoute[];\n};\n\nexport function injectDebugRoutes() {\n return inject(DEBUG_ROUTES);\n}\n","import { 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 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 { InjectionToken, type Injector } from '@angular/core';\n\nimport type { ServerFn } from './types';\n\n/**\n * In-process transport for a server function call.\n *\n * Provided on the server by `provideServerContext`, so during SSR a server\n * function runs in the same process — and the same request injector — as the\n * render instead of making an HTTP request back into the app. Absent in the\n * browser, where `ServerFnClient` falls back to `HttpClient`.\n *\n * `injector` is the **app environment injector** — `ServerFnClient` is\n * `providedIn: 'root'`, and SSR bootstraps a fresh application per request, so\n * its injector is both per-request and the right scope for a handler to resolve\n * from. It is passed rather than captured from the token because\n * `provideServerContext` is applied as *platform* providers, which sit above\n * the app's `providedIn: 'root'` services.\n *\n * Deliberately not a component's node injector: a handler resolves app-level\n * services, and making that depend on which component happened to call it would\n * be surprising and unportable.\n */\nexport type ServerFnDispatcher = <In, Out>(\n fn: ServerFn<In, Out>,\n input: In,\n injector: Injector,\n) => Promise<Out>;\n\nexport const SERVER_FN_DISPATCHER = new InjectionToken<ServerFnDispatcher>(\n '@analogjs/router Server Function Dispatcher',\n);\n","import {\n Injectable,\n Injector,\n assertInInjectionContext,\n inject,\n makeStateKey,\n resource,\n TransferState,\n type ResourceRef,\n} from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { firstValueFrom } from 'rxjs';\n\nimport type { ServerFn } from './types';\nimport { SERVER_FN_DISPATCHER } from './dispatcher';\n\n/**\n * Client transport for server functions. In the browser it goes through Angular\n * `HttpClient`, so client `HttpInterceptorFn`s apply. During SSR the dispatcher\n * token is provided, and the call short-circuits the HTTP round-trip: the\n * handler runs in-process in the current request injector. Lives in the client\n * entry (client-safe).\n */\n@Injectable({ providedIn: 'root' })\nexport class ServerFnClient {\n private readonly http = inject(HttpClient);\n private readonly transferState = inject(TransferState);\n private readonly injector = inject(Injector);\n private readonly dispatcher = inject(SERVER_FN_DISPATCHER, {\n optional: true,\n });\n\n /** True while rendering on the server (the in-process dispatcher is provided). */\n get isServer(): boolean {\n return !!this.dispatcher;\n }\n\n async call<In, Out>(fn: ServerFn<In, Out>, input: In): Promise<Out> {\n if (this.dispatcher) {\n return this.dispatcher(fn, input, this.injector);\n }\n\n const request$ =\n fn.method === 'GET'\n ? this.http.get<Out>(fn.url)\n : this.http.post<Out>(fn.url, input ?? {});\n return firstValueFrom(request$);\n }\n\n /** Key a read's value for TransferState hydration (fn id + input). */\n stateKey<Out>(fn: ServerFn<unknown, Out>, input: unknown) {\n return makeStateKey<Out>(`__analog_fn_${fn.id}_${stableInput(input)}`);\n }\n\n readSeed<Out>(fn: ServerFn<unknown, Out>, input: unknown): Out | undefined {\n const key = this.stateKey(fn, input);\n if (this.transferState.hasKey(key)) {\n const value = this.transferState.get(key, undefined as unknown as Out);\n this.transferState.remove(key); // single-use\n return value;\n }\n return undefined;\n }\n\n writeSeed<Out>(fn: ServerFn<unknown, Out>, input: unknown, value: Out): void {\n this.transferState.set(this.stateKey(fn, input), value);\n }\n}\n\n/** No-op provider hook; ServerFnClient is `providedIn: 'root'`. */\nexport function provideServerFnClient() {\n return [] as const;\n}\n\n// Stable sentinel for the input-less read: `resource()` treats an `undefined`\n// params value as \"idle, don't load\", so an input-less read must yield a\n// defined-but-ignored params. It is never sent — the call uses `undefined`.\nconst NO_INPUT = Symbol('analog.serverFn.noInput');\n\n/**\n * Reactive read of a server function as an Angular `resource()`.\n *\n * `args` is optional: omit it for an input-less read (the resource loads once);\n * provide it for an input-bearing read (returning `undefined` from `args` leaves\n * the resource idle until inputs are ready, the standard resource pattern). For\n * imperative calls (mutations, event handlers) use `injectServerFnMutation`.\n */\nexport function injectServerFn<Out>(\n fn: ServerFn<void, Out>,\n): ResourceRef<Out | undefined>;\nexport function injectServerFn<In, Out>(\n fn: ServerFn<In, Out>,\n args: () => In | undefined,\n): ResourceRef<Out | undefined>;\nexport function injectServerFn<In, Out>(\n fn: ServerFn<In, Out>,\n args?: () => In | undefined,\n): ResourceRef<Out | undefined> {\n assertInInjectionContext(injectServerFn);\n const client = inject(ServerFnClient);\n\n return resource<Out | undefined, unknown>({\n params: () => (args ? args() : NO_INPUT),\n loader: async ({ params }) => {\n const input = (params === NO_INPUT ? undefined : params) as In;\n // Hydrate from the SSR seed on first client render; else fetch and (on\n // the server) seed for the client.\n const seeded = client.readSeed(fn as ServerFn<unknown, Out>, input);\n if (seeded !== undefined) return seeded;\n const value = await client.call(fn, input);\n if (client.isServer) {\n client.writeSeed(fn as ServerFn<unknown, Out>, input, value);\n }\n return value;\n },\n });\n}\n\n/**\n * Imperative binding of a server function: returns a callable that dispatches\n * the call through `HttpClient` (so client interceptors apply) and resolves the\n * result. Use for mutations and event-driven calls; use `injectServerFn` for\n * reactive reads.\n */\nexport function injectServerFnMutation<In, Out>(\n fn: ServerFn<In, Out>,\n): (input: In) => Promise<Out> {\n assertInInjectionContext(injectServerFnMutation);\n const client = inject(ServerFnClient);\n return (input: In) => client.call(fn, input);\n}\n\nfunction stableInput(input: unknown): string {\n if (input === undefined || input === null) return '_';\n return JSON.stringify(input);\n}\n","import type { ServerFn, ServerFnMethod } from './types';\n\nexport interface ServerFnRefConfig {\n id?: string;\n method?: ServerFnMethod;\n /**\n * Only its presence matters here: when `method` is omitted, a config with an\n * `input` schema defaults to `POST`, otherwise `GET`. The schema itself is\n * never used to build the ref — validation happens server-side.\n */\n input?: unknown;\n}\n\n/**\n * Builds a server-function reference: the client-safe `{ __serverFn, id, url,\n * method }` metadata that `injectServerFn`/`ServerFnClient` dispatch through.\n *\n * Shared by both sides so they produce identical refs: the server `serverFn`\n * wraps this with registration + the handler, and the client build's scrub\n * transform emits a call to this factory in place of the server module so the\n * browser bundle carries only the ref, never the handler or its server imports.\n *\n * The returned value is callable-typed but throws if invoked directly — it is\n * always dispatched via `injectServerFn`/`ServerFnClient`, never called.\n */\nexport function createServerFnRef<In, Out>(\n config: ServerFnRefConfig,\n): ServerFn<In, Out> {\n if (!config.id) {\n throw new Error(\n '[analog] serverFn is missing its build-derived id. Server functions require the Analog build transform (@analogjs/platform / @analogjs/vite-plugin-nitro); a raw import without it is not supported.',\n );\n }\n const method: ServerFnMethod =\n config.method ?? (config.input ? 'POST' : 'GET');\n const url = `/_analog/fn/${config.id}`;\n\n const ref = (() => {\n throw new Error(\n `serverFn \"${config.id}\" must be called via injectServerFn/ServerFnClient`,\n );\n }) as unknown as ServerFn<In, Out>;\n\n return Object.assign(ref, {\n __serverFn: true as const,\n id: config.id,\n url,\n method,\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["HTTP_ROOT_INTERCEPTOR_FNS"],"mappings":";;;;;;;;;;AAKO,MAAM,mBAAmB,GAAG,MAAM,CACvC,sCAAsC,CACvC;AAED,MAAM,WAAW,GAAG,SAAS;AAC7B,MAAM,cAAc,GAAG,WAAW;AAClC;AACA,MAAM,uBAAuB,GAAG,YAAY;AAC5C,MAAM,QAAQ,GAAG,MAAM;AACvB,MAAM,YAAY,GAAG,UAAU;AAC/B,MAAM,WAAW,GAAG,SAAS;AAC7B,MAAM,YAAY,GAAG,UAAU;SAkCf,2BAA2B,GAAA;AACzC,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAC7B,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC;AAEhC,IAAA,MAAM,CAAC;AACJ,SAAA,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,YAAY,aAAa,CAAC;SACtD,SAAS,CAAC,MAAK;AACd,QAAA,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;AAElE,QAAA,KAAK,MAAM,eAAe,IAAI,UAAU,EAAE;AACxC,YAAA,MAAM,OAAO,GAAG,UAAU,CACxB,eAAkC,CACtB;AACd,YAAA,WAAW,CAAC,SAAS,CAAC,OAAO,E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,KAAK,CACb,CAAA,UAAA,EAAa,MAAM,CAAC,EAAE,CAAA,kDAAA,CAAoD,CAC3E;AACH,IAAA,CAAC,CAAiC;AAElC,IAAA,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;AACxB,QAAA,UAAU,EAAE,IAAa;QACzB,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,GAAG;QACH,MAAM;AACP,KAAA,CAAC;AACJ;;ACjDA;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@analogjs/router",
|
|
3
|
-
"version": "2.7.0
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Filesystem-based routing for Angular",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Brandon Roberts <robertsbt@gmail.com>",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"url": "https://github.com/sponsors/brandonroberts"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@analogjs/content": "^2.7.0
|
|
27
|
+
"@analogjs/content": "^2.7.0",
|
|
28
28
|
"@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
29
29
|
"@angular/router": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0"
|
|
30
30
|
},
|