@analogjs/router 3.0.0-alpha.99 → 3.0.0-beta.10

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":"debug.page.mjs","names":[],"sources":["../../src/lib/debug/debug.page.ts"],"sourcesContent":["import { Component, OnInit, inject } from '@angular/core';\nimport { Route } from '@angular/router';\n\nimport { createRoutes as createBaseRoutes } from '../route-builder';\nimport {\n ANALOG_EXTRA_ROUTE_FILE_SOURCES,\n type ExtraRouteFileSource,\n} from '../route-files';\nimport { injectDebugRoutes, DebugRoute } from './routes';\n\ntype CollectedRoute = {\n path: string;\n filename: string;\n file: string;\n isLayout: boolean;\n source: 'page' | 'content';\n};\n\n@Component({\n selector: 'analogjs-debug-routes-page',\n standalone: true,\n template: `\n <h2>Routes</h2>\n\n <div class=\"table-container\">\n <div class=\"table-header\">\n <div class=\"header-cell path-col\">Route Path</div>\n <div class=\"header-cell file-col\">File</div>\n <div class=\"header-cell type-col\">Type</div>\n <div class=\"header-cell source-col\">Source</div>\n </div>\n <div class=\"table-body\">\n @for (collectedRoute of collectedRoutes; track $index) {\n <div class=\"table-row\">\n <div class=\"table-cell path-col\">{{ collectedRoute.path }}</div>\n <div class=\"table-cell file-col\" [title]=\"collectedRoute.filename\">\n {{ collectedRoute.file }}\n </div>\n <div class=\"table-cell type-col\">\n {{ collectedRoute.isLayout ? 'Layout' : 'Page' }}\n </div>\n <div class=\"table-cell source-col\">\n <span\n class=\"source-badge\"\n [class.page]=\"collectedRoute.source === 'page'\"\n [class.content]=\"collectedRoute.source === 'content'\"\n >\n {{ collectedRoute.source }}\n </span>\n </div>\n </div>\n }\n </div>\n </div>\n `,\n styles: `\n :host {\n width: 100%;\n }\n\n .table-container {\n width: 100%;\n max-width: 1000px;\n margin: 0 auto;\n background: white;\n border-radius: 8px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n overflow: hidden;\n }\n\n .table-header {\n display: grid;\n grid-template-columns: 2fr 2fr 1fr 1fr;\n background: gray;\n border-bottom: 2px solid #e5e7eb;\n }\n\n .header-cell {\n padding: 16px 24px;\n font-weight: 600;\n text-transform: uppercase;\n font-size: 14px;\n letter-spacing: 0.05em;\n color: white;\n }\n\n .table-body {\n display: flex;\n flex-direction: column;\n }\n\n .table-row {\n display: grid;\n grid-template-columns: 2fr 2fr 1fr 1fr;\n border-bottom: 1px solid #e5e7eb;\n transition: background-color 0.2s ease;\n }\n\n .table-row:last-child {\n border-bottom: none;\n }\n\n .table-row:hover {\n background-color: #f9fafb;\n }\n\n .table-cell {\n padding: 16px 24px;\n font-size: 16px;\n color: #4b5563;\n }\n\n .source-badge {\n display: inline-block;\n padding: 2px 8px;\n border-radius: 4px;\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n }\n\n .source-badge.page {\n background: #dbeafe;\n color: #1e40af;\n }\n\n .source-badge.content {\n background: #dcfce7;\n color: #166534;\n }\n\n @media (max-width: 640px) {\n .table-container {\n border-radius: 0;\n margin: 0;\n }\n\n .header-cell,\n .table-cell {\n padding: 12px 16px;\n }\n }\n `,\n})\nexport default class DebugRoutesComponent implements OnInit {\n collectedRoutes: CollectedRoute[] = [];\n\n private debugRoutes: (Route & DebugRoute)[] = injectDebugRoutes();\n private extraSources: ExtraRouteFileSource[] =\n inject(ANALOG_EXTRA_ROUTE_FILE_SOURCES, { optional: true }) ?? [];\n\n ngOnInit(): void {\n this.traverseRoutes(this.debugRoutes, undefined, 'page');\n\n for (const source of this.extraSources) {\n const contentDebugRoutes = createBaseRoutes(\n source.files,\n source.resolveModule,\n true,\n ) as (Route & DebugRoute)[];\n this.traverseRoutes(contentDebugRoutes, undefined, 'content');\n }\n\n this.collectedRoutes.sort((a, b) => a.path.localeCompare(b.path));\n }\n\n traverseRoutes(\n routes: DebugRoute[],\n parent?: string,\n source: 'page' | 'content' = 'page',\n ): void {\n routes.forEach((route) => {\n this.collectedRoutes.push({\n path: route.isLayout\n ? `${parent ? `/${parent}` : ''}${route.path ? `/${route.path}` : ''}`\n : `${parent ? `/${parent}` : ''}${\n route.path ? `/${route.path}` : '/'\n }`,\n filename: route.filename,\n file: route.filename?.replace(/(^.*)(pages|content)\\//, '') || '',\n isLayout: route.isLayout,\n source,\n });\n\n if (route.children) {\n const parentSegments = [parent, route.path];\n const fullParentPath = parentSegments.filter((s) => !!s).join('/');\n this.traverseRoutes(route.children, fullParentPath, source);\n }\n });\n }\n}\n"],"mappings":";;;;;AAiJA,IAAqB,uBAArB,MAAqB,qBAAoB;CA/HzC,cAAA;AAgIE,OAAA,kBAAoC,EAAE;AAE9B,OAAA,cAAsC,mBAAmB;AACzD,OAAA,eACN,OAAO,iCAAiC,EAAE,UAAU,MAAM,CAAC,IAAI,EAAE;;CAEnE,WAAQ;AACN,OAAK,eAAe,KAAK,aAAa,KAAA,GAAW,OAAO;AAExD,OAAK,MAAM,UAAU,KAAK,cAAc;GACtC,MAAM,qBAAqB,aACzB,OAAO,OACP,OAAO,eACP,KACyB;AAC3B,QAAK,eAAe,oBAAoB,KAAA,GAAW,UAAU;;AAG/D,OAAK,gBAAgB,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,CAAC;;CAGnE,eACE,QACA,QACA,SAA6B,QAAM;AAEnC,SAAO,SAAS,UAAS;AACvB,QAAK,gBAAgB,KAAK;IACxB,MAAM,MAAM,WACR,GAAG,SAAS,IAAI,WAAW,KAAK,MAAM,OAAO,IAAI,MAAM,SAAS,OAChE,GAAG,SAAS,IAAI,WAAW,KACzB,MAAM,OAAO,IAAI,MAAM,SAAS;IAEtC,UAAU,MAAM;IAChB,MAAM,MAAM,UAAU,QAAQ,0BAA0B,GAAG,IAAI;IAC/D,UAAU,MAAM;IAChB;IACD,CAAC;AAEF,OAAI,MAAM,UAAU;IAElB,MAAM,iBADiB,CAAC,QAAQ,MAAM,KAAK,CACL,QAAQ,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI;AAClE,SAAK,eAAe,MAAM,UAAU,gBAAgB,OAAO;;IAE7D;;;;;;;SA7Ce;GAAoB,MAAA,EAAA;GAAA,QAAA,GAAA,gBAAA;GAAA,CAAA;;;;;;SAApB;GAAoB,cAAA;GAAA,UAAA;GAAA,UAAA;GAAA,UA5H7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCT,UAAA;GAAA,QAAA,CAAA,2sDAAA;GAAA,CAAA;;;;;;;OA2FkB;CAAoB,YAAA,CAAA;QA/HxC;;aACW;GAA4B,YAC1B;GAAI,UACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCT,QAAA,CAAA,2sDAAA;GAAA,CAAA"}
1
+ {"version":3,"file":"debug.page.mjs","names":[],"sources":["../../src/lib/debug/debug.page.ts"],"sourcesContent":["import { Component, OnInit, inject } from '@angular/core';\nimport { Route } from '@angular/router';\n\nimport { createRoutes as createBaseRoutes } from '../route-builder';\nimport {\n ANALOG_EXTRA_ROUTE_FILE_SOURCES,\n type ExtraRouteFileSource,\n} from '../route-files';\nimport { injectDebugRoutes, DebugRoute } from './routes';\n\ntype CollectedRoute = {\n path: string;\n filename: string;\n file: string;\n isLayout: boolean;\n source: 'page' | 'content';\n};\n\n@Component({\n selector: 'analogjs-debug-routes-page',\n standalone: true,\n template: `\n <h2>Routes</h2>\n\n <div class=\"table-container\">\n <div class=\"table-header\">\n <div class=\"header-cell path-col\">Route Path</div>\n <div class=\"header-cell file-col\">File</div>\n <div class=\"header-cell type-col\">Type</div>\n <div class=\"header-cell source-col\">Source</div>\n </div>\n <div class=\"table-body\">\n @for (collectedRoute of collectedRoutes; track $index) {\n <div class=\"table-row\">\n <div class=\"table-cell path-col\">{{ collectedRoute.path }}</div>\n <div class=\"table-cell file-col\" [title]=\"collectedRoute.filename\">\n {{ collectedRoute.file }}\n </div>\n <div class=\"table-cell type-col\">\n {{ collectedRoute.isLayout ? 'Layout' : 'Page' }}\n </div>\n <div class=\"table-cell source-col\">\n <span\n class=\"source-badge\"\n [class.page]=\"collectedRoute.source === 'page'\"\n [class.content]=\"collectedRoute.source === 'content'\"\n >\n {{ collectedRoute.source }}\n </span>\n </div>\n </div>\n }\n </div>\n </div>\n `,\n styles: `\n :host {\n width: 100%;\n }\n\n .table-container {\n width: 100%;\n max-width: 1000px;\n margin: 0 auto;\n background: white;\n border-radius: 8px;\n box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n overflow: hidden;\n }\n\n .table-header {\n display: grid;\n grid-template-columns: 2fr 2fr 1fr 1fr;\n background: gray;\n border-bottom: 2px solid #e5e7eb;\n }\n\n .header-cell {\n padding: 16px 24px;\n font-weight: 600;\n text-transform: uppercase;\n font-size: 14px;\n letter-spacing: 0.05em;\n color: white;\n }\n\n .table-body {\n display: flex;\n flex-direction: column;\n }\n\n .table-row {\n display: grid;\n grid-template-columns: 2fr 2fr 1fr 1fr;\n border-bottom: 1px solid #e5e7eb;\n transition: background-color 0.2s ease;\n }\n\n .table-row:last-child {\n border-bottom: none;\n }\n\n .table-row:hover {\n background-color: #f9fafb;\n }\n\n .table-cell {\n padding: 16px 24px;\n font-size: 16px;\n color: #4b5563;\n }\n\n .source-badge {\n display: inline-block;\n padding: 2px 8px;\n border-radius: 4px;\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n }\n\n .source-badge.page {\n background: #dbeafe;\n color: #1e40af;\n }\n\n .source-badge.content {\n background: #dcfce7;\n color: #166534;\n }\n\n @media (max-width: 640px) {\n .table-container {\n border-radius: 0;\n margin: 0;\n }\n\n .header-cell,\n .table-cell {\n padding: 12px 16px;\n }\n }\n `,\n})\nexport default class DebugRoutesComponent implements OnInit {\n collectedRoutes: CollectedRoute[] = [];\n\n private debugRoutes: (Route & DebugRoute)[] = injectDebugRoutes();\n private extraSources: ExtraRouteFileSource[] =\n inject(ANALOG_EXTRA_ROUTE_FILE_SOURCES, { optional: true }) ?? [];\n\n ngOnInit(): void {\n this.traverseRoutes(this.debugRoutes, undefined, 'page');\n\n for (const source of this.extraSources) {\n const contentDebugRoutes = createBaseRoutes(\n source.files,\n source.resolveModule,\n true,\n ) as (Route & DebugRoute)[];\n this.traverseRoutes(contentDebugRoutes, undefined, 'content');\n }\n\n this.collectedRoutes.sort((a, b) => a.path.localeCompare(b.path));\n }\n\n traverseRoutes(\n routes: DebugRoute[],\n parent?: string,\n source: 'page' | 'content' = 'page',\n ): void {\n routes.forEach((route) => {\n this.collectedRoutes.push({\n path: route.isLayout\n ? `${parent ? `/${parent}` : ''}${route.path ? `/${route.path}` : ''}`\n : `${parent ? `/${parent}` : ''}${\n route.path ? `/${route.path}` : '/'\n }`,\n filename: route.filename,\n file: route.filename?.replace(/(^.*)(pages|content)\\//, '') || '',\n isLayout: route.isLayout,\n source,\n });\n\n if (route.children) {\n const parentSegments = [parent, route.path];\n const fullParentPath = parentSegments.filter((s) => !!s).join('/');\n this.traverseRoutes(route.children, fullParentPath, source);\n }\n });\n }\n}\n"],"mappings":";;;;;AAiJA,IAAqB,uBAArB,MAAqB,qBAAoB;CA/HzC,cAAA;EAgIE,KAAA,kBAAoC,CAAA;EAE5B,KAAA,cAAsC,kBAAiB;EACvD,KAAA,eACN,OAAO,iCAAiC,EAAE,UAAU,KAAI,CAAE,KAAK,CAAA;CA0ClE;CAxCC,WAAQ;EACN,KAAK,eAAe,KAAK,aAAa,KAAA,GAAW,MAAM;EAEvD,KAAK,MAAM,UAAU,KAAK,cAAc;GACtC,MAAM,qBAAqB,aACzB,OAAO,OACP,OAAO,eACP,IAAI;GAEN,KAAK,eAAe,oBAAoB,KAAA,GAAW,SAAS;EAC9D;EAEA,KAAK,gBAAgB,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;CAClE;CAEA,eACE,QACA,QACA,SAA6B,QAAM;EAEnC,OAAO,SAAS,UAAS;GACvB,KAAK,gBAAgB,KAAK;IACxB,MAAM,MAAM,WACR,GAAG,SAAS,IAAI,WAAW,KAAK,MAAM,OAAO,IAAI,MAAM,SAAS,OAChE,GAAG,SAAS,IAAI,WAAW,KACzB,MAAM,OAAO,IAAI,MAAM,SAAS;IAEtC,UAAU,MAAM;IAChB,MAAM,MAAM,UAAU,QAAQ,0BAA0B,EAAE,KAAK;IAC/D,UAAU,MAAM;IAChB;GACD,CAAA;GAED,IAAI,MAAM,UAAU;IAElB,MAAM,iBAAiB,CADC,QAAQ,MAAM,IACf,CAAc,CAAC,QAAQ,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG;IACjE,KAAK,eAAe,MAAM,UAAU,gBAAgB,MAAM;GAC5D;EACF,CAAC;CACH;CA9CmB;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAoB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAApB;EAAA,KAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAAoB,cAAA;GAAA,UAAA;GAAA,UAAA;GAAA,UA5H7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCT,UAAA;GAAA,QAAA,CAAA,0sDAAA;EAAA,CAAA;CAAA;;AA2FkB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAoB,YAAA,CAAA;EA/HxC,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAA4B,YAC1B;GAAI,UACN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCT,QAAA,CAAA,0sDAAA;EAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"route-files.mjs","names":[],"sources":["../../../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs","../../src/lib/json-ld.ts","../../src/lib/meta-tags.ts","../../src/lib/endpoints.ts","../../src/lib/inject-route-endpoint-url.ts","../../src/lib/route-config.ts","../../src/lib/constants.ts","../../src/lib/route-builder.ts","../../src/lib/route-files.ts"],"sourcesContent":["function isPlainObject(value) {\n if (!value || typeof value !== 'object') {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n const hasObjectPrototype = proto === null ||\n proto === Object.prototype ||\n Object.getPrototypeOf(proto) === null;\n if (!hasObjectPrototype) {\n return false;\n }\n return Object.prototype.toString.call(value) === '[object Object]';\n}\n\nexport { isPlainObject };\n","import { DOCUMENT, inject } from '@angular/core';\nimport type { ActivatedRouteSnapshot } from '@angular/router';\nimport { NavigationEnd, Router } from '@angular/router';\nimport { isPlainObject } from 'es-toolkit';\nimport { filter } from 'rxjs/operators';\n\nimport type { Graph, Thing, WithContext } from 'schema-dts';\n\nexport type JsonLdObject = Record<string, unknown>;\n\nexport function isJsonLdObject(value: unknown): value is JsonLdObject {\n return isPlainObject(value);\n}\n\nexport function normalizeJsonLd(value: unknown): JsonLdObject[] {\n if (Array.isArray(value)) {\n return value.filter(isJsonLdObject);\n }\n\n return isJsonLdObject(value) ? [value] : [];\n}\n\nexport type JsonLd = JsonLdObject | JsonLdObject[];\n\n/**\n * Typed JSON-LD document based on `schema-dts`.\n *\n * Accepts single Schema.org nodes (`WithContext<Thing>`),\n * `@graph`-based documents (`Graph`), or arrays of nodes.\n *\n * This is the canonical JSON-LD type for route authoring surfaces\n * (`routeMeta.jsonLd`, generated manifest).\n *\n * @example\n * ```ts\n * import type { WebPage, WithContext } from 'schema-dts';\n *\n * export const routeMeta = {\n * jsonLd: {\n * '@context': 'https://schema.org',\n * '@type': 'WebPage',\n * name: 'Products',\n * } satisfies WithContext<WebPage>,\n * };\n * ```\n */\nexport type AnalogJsonLdDocument =\n | WithContext<Thing>\n | Graph\n | WithContext<Thing>[];\n\nexport const ROUTE_JSON_LD_KEY: unique symbol = Symbol(\n '@analogjs/router Route JSON-LD Key',\n);\nconst JSON_LD_SCRIPT_SELECTOR = 'script[data-analog-json-ld]';\n\nexport function updateJsonLdOnRouteChange(\n router: Router = inject(Router),\n document: Document | null = inject(DOCUMENT, { optional: true }),\n): void {\n if (!document) {\n return;\n }\n\n router.events\n .pipe(filter((event) => event instanceof NavigationEnd))\n .subscribe(() => {\n const entries = getJsonLdEntries(router.routerState.snapshot.root);\n applyJsonLdToDocument(document, entries);\n });\n}\n\nexport function serializeJsonLd(entry: JsonLdObject): string | null {\n try {\n return JSON.stringify(entry)\n .replace(/</g, '\\\\u003c')\n .replace(/>/g, '\\\\u003e')\n .replace(/&/g, '\\\\u0026')\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029');\n } catch {\n return null;\n }\n}\n\nfunction getJsonLdEntries(route: ActivatedRouteSnapshot): JsonLdObject[] {\n const entries: JsonLdObject[] = [];\n let currentRoute: ActivatedRouteSnapshot | null = route;\n\n while (currentRoute) {\n entries.push(...normalizeJsonLd(currentRoute.data[ROUTE_JSON_LD_KEY]));\n currentRoute = currentRoute.firstChild;\n }\n\n return entries;\n}\n\nfunction applyJsonLdToDocument(\n document: Document,\n entries: JsonLdObject[],\n): void {\n document.querySelectorAll(JSON_LD_SCRIPT_SELECTOR).forEach((element) => {\n element.remove();\n });\n\n if (entries.length === 0) {\n return;\n }\n\n const head = document.head || document.getElementsByTagName('head')[0];\n if (!head) {\n return;\n }\n\n entries.forEach((entry, index) => {\n const serialized = serializeJsonLd(entry);\n if (!serialized) {\n return;\n }\n\n const script = document.createElement('script');\n script.type = 'application/ld+json';\n script.setAttribute('data-analog-json-ld', 'true');\n script.setAttribute('data-analog-json-ld-index', String(index));\n script.textContent = serialized;\n head.appendChild(script);\n });\n}\n","import { inject } from '@angular/core';\nimport { Meta, MetaDefinition as NgMetaTag } from '@angular/platform-browser';\nimport { ActivatedRouteSnapshot, NavigationEnd, Router } from '@angular/router';\nimport { filter } from 'rxjs/operators';\n\nexport const ROUTE_META_TAGS_KEY: unique symbol = Symbol(\n '@analogjs/router Route Meta Tags Key',\n);\n\nconst CHARSET_KEY = 'charset';\nconst HTTP_EQUIV_KEY = 'httpEquiv';\n// httpEquiv selector key needs to be in kebab case format\nconst HTTP_EQUIV_SELECTOR_KEY = 'http-equiv';\nconst NAME_KEY = 'name';\nconst PROPERTY_KEY = 'property';\nconst CONTENT_KEY = 'content';\nconst ITEMPROP_KEY = 'itemprop';\n\nexport type MetaTag =\n | (CharsetMetaTag & ExcludeRestMetaTagKeys<typeof CHARSET_KEY>)\n | (HttpEquivMetaTag & ExcludeRestMetaTagKeys<typeof HTTP_EQUIV_KEY>)\n | (NameMetaTag & ExcludeRestMetaTagKeys<typeof NAME_KEY>)\n | (PropertyMetaTag & ExcludeRestMetaTagKeys<typeof PROPERTY_KEY>)\n | (ItempropMetaTag & ExcludeRestMetaTagKeys<typeof ITEMPROP_KEY>);\n\ntype CharsetMetaTag = { [CHARSET_KEY]: string };\ntype HttpEquivMetaTag = { [HTTP_EQUIV_KEY]: string; [CONTENT_KEY]: string };\ntype NameMetaTag = { [NAME_KEY]: string; [CONTENT_KEY]: string };\ntype PropertyMetaTag = { [PROPERTY_KEY]: string; [CONTENT_KEY]: string };\ntype ItempropMetaTag = { [ITEMPROP_KEY]: string; [CONTENT_KEY]: string };\n\ntype MetaTagKey =\n | typeof CHARSET_KEY\n | typeof HTTP_EQUIV_KEY\n | typeof NAME_KEY\n | typeof PROPERTY_KEY\n | typeof ITEMPROP_KEY;\ntype ExcludeRestMetaTagKeys<Key extends MetaTagKey> = {\n [K in Exclude<MetaTagKey, Key>]?: never;\n};\n\ntype MetaTagSelector =\n | typeof CHARSET_KEY\n | `${\n | typeof HTTP_EQUIV_SELECTOR_KEY\n | typeof NAME_KEY\n | typeof PROPERTY_KEY\n | typeof ITEMPROP_KEY}=\"${string}\"`;\ntype MetaTagMap = Record<MetaTagSelector, MetaTag>;\n\nexport function updateMetaTagsOnRouteChange(\n router: Router = inject(Router),\n metaService: Meta = inject(Meta),\n): void {\n router.events\n .pipe(filter((event) => event instanceof NavigationEnd))\n .subscribe(() => {\n const metaTagMap = getMetaTagMap(router.routerState.snapshot.root);\n for (const metaTagSelector in metaTagMap) {\n const metaTag = metaTagMap[\n metaTagSelector as MetaTagSelector\n ] as NgMetaTag;\n metaService.updateTag(metaTag, metaTagSelector);\n }\n });\n}\n\nfunction getMetaTagMap(route: ActivatedRouteSnapshot): MetaTagMap {\n const metaTagMap = {} as MetaTagMap;\n let currentRoute: ActivatedRouteSnapshot | null = route;\n\n while (currentRoute) {\n const metaTags: MetaTag[] = currentRoute.data[ROUTE_META_TAGS_KEY] ?? [];\n for (const metaTag of metaTags) {\n metaTagMap[getMetaTagSelector(metaTag)] = metaTag;\n }\n\n currentRoute = currentRoute.firstChild;\n }\n\n return metaTagMap;\n}\n\nfunction getMetaTagSelector(metaTag: MetaTag): MetaTagSelector {\n if (metaTag.name) {\n return `${NAME_KEY}=\"${metaTag.name}\"`;\n }\n\n if (metaTag.property) {\n return `${PROPERTY_KEY}=\"${metaTag.property}\"`;\n }\n\n if (metaTag.httpEquiv) {\n return `${HTTP_EQUIV_SELECTOR_KEY}=\"${metaTag.httpEquiv}\"`;\n }\n\n if (metaTag.itemprop) {\n return `${ITEMPROP_KEY}=\"${metaTag.itemprop}\"`;\n }\n\n return CHARSET_KEY;\n}\n","export const ANALOG_META_KEY: unique symbol = Symbol(\n '@analogjs/router Analog Route Metadata Key',\n);\n\n/**\n * This variable reference is replaced with a glob of all route endpoints.\n */\nexport const ANALOG_PAGE_ENDPOINTS: Record<string, () => Promise<unknown>> = {};\n","import type { ActivatedRouteSnapshot, Route } from '@angular/router';\nimport { injectBaseURL, injectAPIPrefix } from '../../tokens/src/index.js';\n\nimport { ANALOG_META_KEY } from './endpoints';\n\nexport function injectRouteEndpointURL(route: ActivatedRouteSnapshot): URL {\n const routeConfig = route.routeConfig as Route & {\n [ANALOG_META_KEY]: { endpoint: string; endpointKey: string };\n };\n\n const apiPrefix = injectAPIPrefix();\n const baseUrl = injectBaseURL();\n const { queryParams, fragment: hash, params, parent } = route;\n const segment = parent?.url.map((segment) => segment.path).join('/') || '';\n const url = new URL(\n '',\n baseUrl ||\n (typeof window !== 'undefined' && window.location.origin\n ? window.location.origin\n : ''),\n );\n url.pathname = `${\n url.pathname.endsWith('/') ? url.pathname : url.pathname + '/'\n }${apiPrefix}/_analog${routeConfig[ANALOG_META_KEY].endpoint}`;\n url.search = `${new URLSearchParams(queryParams).toString()}`;\n url.hash = hash ?? '';\n\n Object.keys(params).forEach((param) => {\n url.pathname = url.pathname.replace(`[${param}]`, params[param]);\n });\n url.pathname = url.pathname.replace('**', segment);\n\n return url;\n}\n","import { inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport type { Route } from '@angular/router';\nimport { firstValueFrom } from 'rxjs';\nimport { injectInternalServerFetch } from '../../tokens/src/index.js';\n\nimport {\n DefaultRouteMeta,\n RedirectRouteMeta,\n RouteConfig,\n RouteMeta,\n} from './models';\nimport { ROUTE_JSON_LD_KEY, isJsonLdObject } from './json-ld';\nimport { ROUTE_META_TAGS_KEY } from './meta-tags';\nimport { ANALOG_PAGE_ENDPOINTS, ANALOG_META_KEY } from './endpoints';\nimport { injectRouteEndpointURL } from './inject-route-endpoint-url';\n\nexport function toRouteConfig(routeMeta: RouteMeta | undefined): RouteConfig {\n if (routeMeta && isRedirectRouteMeta(routeMeta)) {\n return routeMeta;\n }\n\n const defaultMeta: DefaultRouteMeta = (routeMeta ?? {}) as DefaultRouteMeta;\n const { meta, jsonLd, ...routeConfig } = defaultMeta;\n\n if (Array.isArray(meta)) {\n routeConfig.data = { ...routeConfig.data, [ROUTE_META_TAGS_KEY]: meta };\n } else if (typeof meta === 'function') {\n routeConfig.resolve = {\n ...routeConfig.resolve,\n [ROUTE_META_TAGS_KEY]: meta,\n };\n }\n\n if (Array.isArray(jsonLd) || isJsonLdObject(jsonLd)) {\n routeConfig.data = { ...routeConfig.data, [ROUTE_JSON_LD_KEY]: jsonLd };\n } else if (typeof jsonLd === 'function') {\n routeConfig.resolve = {\n ...routeConfig.resolve,\n [ROUTE_JSON_LD_KEY]: jsonLd,\n };\n }\n\n routeConfig.runGuardsAndResolvers =\n routeConfig.runGuardsAndResolvers ?? 'paramsOrQueryParamsChange';\n routeConfig.resolve = {\n ...routeConfig.resolve,\n load: async (route) => {\n const routeConfig = route.routeConfig as Route & {\n [ANALOG_META_KEY]: { endpoint: string; endpointKey: string };\n };\n\n // Content routes (from .md files in the pages directory) do not have\n // ANALOG_META_KEY — it is only set on page routes (.page.ts) in\n // route-builder.ts. The optional chain avoids a runtime crash when\n // the router resolves a content route during SSR / prerendering.\n if (ANALOG_PAGE_ENDPOINTS[routeConfig[ANALOG_META_KEY]?.endpointKey]) {\n const http = inject(HttpClient);\n const url = injectRouteEndpointURL(route);\n const internalFetch = injectInternalServerFetch();\n\n if (internalFetch) {\n return internalFetch(`${url.pathname}${url.search}`);\n }\n\n return firstValueFrom(http.get(`${url.href}`));\n }\n\n return {};\n },\n };\n\n return routeConfig;\n}\n\nfunction isRedirectRouteMeta(\n routeMeta: RouteMeta,\n): routeMeta is RedirectRouteMeta {\n return !!routeMeta.redirectTo;\n}\n","export const ENDPOINT_EXTENSION = '.server.ts';\nexport const APP_DIR = 'src/app';\n","import { UrlSegment } from '@angular/router';\nimport type { Route } from '@angular/router';\nimport type { UrlMatcher } from '@angular/router';\n\nimport type { RouteExport } from './models';\nimport { toRouteConfig } from './route-config';\nimport { ENDPOINT_EXTENSION } from './constants';\nimport { ANALOG_META_KEY } from './endpoints';\n\nexport type RouteModuleFactory = () => Promise<RouteExport>;\n\nexport type RouteModuleResolver<TFile> = (\n filename: string,\n fileLoader: () => Promise<TFile>,\n) => RouteModuleFactory;\n\ntype RawRoute = {\n filename: string | null;\n rawSegment: string;\n ancestorRawSegments: string[];\n segment: string;\n level: number;\n children: RawRoute[];\n};\n\ntype RawRouteMap = Record<string, RawRoute>;\ntype RawRouteByLevelMap = Record<number, RawRouteMap>;\n\nexport function createRoutes<TFile>(\n files: Record<string, () => Promise<TFile>>,\n resolveModule: RouteModuleResolver<TFile>,\n debug = false,\n): Route[] {\n const filenames = Object.keys(files).sort((a, b) => {\n const aPriority = getCollisionPriority(a);\n const bPriority = getCollisionPriority(b);\n\n return aPriority - bPriority;\n });\n\n if (filenames.length === 0) {\n return [];\n }\n\n const rawRoutesByLevelMap = filenames.reduce((acc, filename) => {\n const rawPath = toRawPath(filename);\n const rawSegments = rawPath.split('/');\n const level = rawSegments.length - 1;\n const rawSegment = rawSegments[level];\n const ancestorRawSegments = rawSegments.slice(0, level);\n\n const existing = acc[level]?.[rawPath];\n if (existing?.filename && existing.filename !== filename) {\n const existingPriority = getCollisionPriority(existing.filename);\n const nextPriority = getCollisionPriority(filename);\n const shouldKeepExisting = existingPriority < nextPriority;\n const chosenFilename = shouldKeepExisting ? existing.filename : filename;\n\n if (import.meta.env.DEV) {\n console.warn(\n `[Analog] Route files \"${existing.filename}\" and \"${filename}\" ` +\n `resolve to the same route path \"${rawPath}\". ` +\n `Only \"${chosenFilename}\" will be used.`,\n );\n }\n\n if (shouldKeepExisting) {\n return acc;\n }\n }\n\n return {\n ...acc,\n [level]: {\n ...acc[level],\n [rawPath]: {\n filename,\n rawSegment,\n ancestorRawSegments,\n segment: toSegment(rawSegment),\n level,\n children: [],\n },\n },\n };\n }, {} as RawRouteByLevelMap);\n\n const allLevels = Object.keys(rawRoutesByLevelMap).map(Number);\n const maxLevel = Math.max(...allLevels);\n\n for (let level = maxLevel; level > 0; level--) {\n const rawRoutesMap = rawRoutesByLevelMap[level];\n const rawPaths = Object.keys(rawRoutesMap);\n\n for (const rawPath of rawPaths) {\n const rawRoute = rawRoutesMap[rawPath];\n const parentRawPath = rawRoute.ancestorRawSegments.join('/');\n const parentRawSegmentIndex = rawRoute.ancestorRawSegments.length - 1;\n const parentRawSegment =\n rawRoute.ancestorRawSegments[parentRawSegmentIndex];\n\n rawRoutesByLevelMap[level - 1] ||= {};\n rawRoutesByLevelMap[level - 1][parentRawPath] ||= {\n filename: null,\n rawSegment: parentRawSegment,\n ancestorRawSegments: rawRoute.ancestorRawSegments.slice(\n 0,\n parentRawSegmentIndex,\n ),\n segment: toSegment(parentRawSegment),\n level: level - 1,\n children: [],\n };\n\n rawRoutesByLevelMap[level - 1][parentRawPath].children.push(rawRoute);\n }\n }\n\n const rootRawRoutesMap = rawRoutesByLevelMap[0];\n const rawRoutes = Object.keys(rootRawRoutesMap).map(\n (segment) => rootRawRoutesMap[segment],\n );\n sortRawRoutes(rawRoutes);\n\n return toRoutes(rawRoutes, files, resolveModule, debug);\n}\n\nfunction getCollisionPriority(filename: string): number {\n if (\n filename.includes('/src/app/pages/') ||\n filename.includes('/app/pages/') ||\n filename.includes('/src/content/')\n ) {\n return 0;\n }\n\n return 1;\n}\n\n/**\n * Strips directory prefixes and file extensions from a route filename to\n * produce the raw path used for route segment construction.\n *\n * The regex mirrors `filenameToRoutePath` in route-manifest.ts — changes\n * here must be kept in sync with that function. The first alternation\n * strips everything up to and including the first /routes/, /pages/, or\n * /content/ segment, which handles both app-local and additional directory\n * paths (e.g. `additionalPagesDirs`, `additionalContentDirs`).\n */\nfunction toRawPath(filename: string): string {\n return filename\n .replace(\n /^(?:[a-zA-Z]:[\\\\/])?(.*?)[\\\\/](?:routes|pages|content)[\\\\/]|(?:[\\\\/](?:app[\\\\/]pages|src[\\\\/]content)[\\\\/])|(\\.page\\.(js|ts)$)|(\\.(ts|md)$)/g,\n '',\n )\n .replace(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g, '(opt-$1)')\n .replace(/\\[\\.{3}.+\\]/, '**')\n .replace(/\\[([^\\]]+)\\]/g, ':$1');\n}\n\nfunction toSegment(rawSegment: string): string {\n return rawSegment\n .replace(/\\(.*?\\)/g, '')\n .replace(/(^|[./])index(?=[./]|$)/g, '$1')\n .replace(/\\.|\\/+/g, '/')\n .replace(/^\\/+|\\/+$/g, '');\n}\n\nfunction createOptionalCatchAllMatcher(paramName: string): UrlMatcher {\n return (segments) => {\n if (segments.length === 0) {\n return null;\n }\n const joined = segments.map((s) => s.path).join('/');\n return {\n consumed: segments,\n posParams: { [paramName]: new UrlSegment(joined, {}) },\n };\n };\n}\n\nfunction toRoutes<TFile>(\n rawRoutes: RawRoute[],\n files: Record<string, () => Promise<TFile>>,\n resolveModule: RouteModuleResolver<TFile>,\n debug = false,\n): Route[] {\n const routes: Route[] = [];\n\n for (const rawRoute of rawRoutes) {\n const children: Route[] | undefined =\n rawRoute.children.length > 0\n ? toRoutes(rawRoute.children, files, resolveModule, debug)\n : undefined;\n let module: RouteModuleFactory | undefined;\n let analogMeta: { endpoint: string; endpointKey: string } | undefined;\n\n if (rawRoute.filename) {\n if (!debug) {\n module = resolveModule(rawRoute.filename, files[rawRoute.filename]);\n }\n\n if (/\\.page\\.ts$/.test(rawRoute.filename)) {\n const endpointKey = rawRoute.filename.replace(\n /\\.page\\.ts$/,\n ENDPOINT_EXTENSION,\n );\n\n const rawEndpoint = rawRoute.filename\n .replace(/\\.page\\.ts$/, '')\n .replace(/\\[\\[\\.\\.\\..+\\]\\]/, '**')\n .replace(/\\[\\.{3}.+\\]/, '**')\n .replace(/^(.*?)\\/pages/, '/pages');\n\n // Strip the route group syntax from every segment, matching how the\n // page handlers are mounted. Anchoring this to the last segment left\n // the parens in place for a route like `(auth)/sign-up`, so the\n // request went to a path no handler answered and the load resolved\n // to an empty object.\n const endpoint = (rawEndpoint || '')\n .replace(/\\./g, '/')\n .replace(/\\/\\(([^/]+)\\)/g, '/-$1-');\n\n analogMeta = {\n endpoint,\n endpointKey,\n };\n }\n }\n\n const optCatchAllMatch = rawRoute.filename?.match(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/);\n const optCatchAllParam = optCatchAllMatch ? optCatchAllMatch[1] : null;\n\n type DebugRoute = Route & {\n filename?: string | null | undefined;\n isLayout?: boolean;\n };\n\n const route: Route & { meta?: typeof analogMeta } & DebugRoute = module\n ? {\n path: rawRoute.segment,\n loadChildren: () =>\n module!().then((m) => {\n if (import.meta.env.DEV) {\n const hasModuleDefault = !!m.default;\n const hasRedirect = !!m.routeMeta?.redirectTo;\n\n if (!hasModuleDefault && !hasRedirect) {\n console.warn(\n `[Analog] Missing default export at ${rawRoute.filename}`,\n );\n }\n }\n\n const routeConfig = toRouteConfig(m.routeMeta);\n const hasRedirect = 'redirectTo' in routeConfig;\n const baseChild = hasRedirect\n ? {\n path: '',\n ...routeConfig,\n }\n : {\n path: '',\n component: m.default,\n ...routeConfig,\n children,\n [ANALOG_META_KEY]: analogMeta,\n };\n\n return [\n {\n ...baseChild,\n },\n ...(optCatchAllParam\n ? [\n {\n matcher:\n createOptionalCatchAllMatcher(optCatchAllParam),\n ...(hasRedirect\n ? routeConfig\n : {\n component: m.default,\n ...routeConfig,\n [ANALOG_META_KEY]: analogMeta,\n }),\n },\n ]\n : []),\n ];\n }),\n }\n : {\n path: rawRoute.segment,\n ...(debug\n ? {\n filename: rawRoute.filename ? rawRoute.filename : undefined,\n isLayout: children && children.length > 0 ? true : false,\n }\n : {}),\n children,\n };\n\n routes.push(route);\n }\n\n return routes;\n}\n\nfunction sortRawRoutes(rawRoutes: RawRoute[]): void {\n rawRoutes.sort((a, b) => {\n let segmentA = deprioritizeSegment(a.segment);\n let segmentB = deprioritizeSegment(b.segment);\n\n if (a.children.length > b.children.length) {\n segmentA = `~${segmentA}`;\n } else if (a.children.length < b.children.length) {\n segmentB = `~${segmentB}`;\n }\n\n return segmentA > segmentB ? 1 : -1;\n });\n\n for (const rawRoute of rawRoutes) {\n sortRawRoutes(rawRoute.children);\n }\n}\n\nfunction deprioritizeSegment(segment: string): string {\n return segment.replaceAll(':', '~~').replaceAll('**', '~~~~');\n}\n","import { InjectionToken } from '@angular/core';\nimport type { RouteExport } from './models';\n\nexport type Files = Record<string, () => Promise<RouteExport>>;\n\n/**\n * This variable reference is replaced with a glob of all page routes.\n */\nexport const ANALOG_ROUTE_FILES = {};\n\nexport interface ExtraRouteFileSource {\n files: Record<string, () => Promise<unknown>>;\n resolveModule: (\n filename: string,\n fileLoader: () => Promise<unknown>,\n ) => () => Promise<RouteExport>;\n}\n\nexport const ANALOG_EXTRA_ROUTE_FILE_SOURCES: InjectionToken<\n ExtraRouteFileSource[]\n> = new InjectionToken('@analogjs/router extra route file sources');\n\n/**\n * Replaced at build time by the Vite router plugin with the number of\n * discovered content route files. Used in dev mode to warn when content\n * files exist but `withContentRoutes()` is not configured.\n */\nexport const ANALOG_CONTENT_FILE_COUNT = 0;\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AAAA,SAAS,cAAc,OAAO;AAC1B,KAAI,CAAC,SAAS,OAAO,UAAU,SAC3B,QAAO;CAEX,MAAM,QAAQ,OAAO,eAAe,MAAM;AAI1C,KAAI,EAHuB,UAAU,QACjC,UAAU,OAAO,aACjB,OAAO,eAAe,MAAM,KAAK,MAEjC,QAAO;AAEX,QAAO,OAAO,UAAU,SAAS,KAAK,MAAM,KAAK;;;;ACDrD,SAAgB,eAAe,OAAc;AAC3C,QAAO,cAAc,MAAM;;AAG7B,SAAgB,gBAAgB,OAAc;AAC5C,KAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,MAAM,OAAO,eAAe;AAGrC,QAAO,eAAe,MAAM,GAAG,CAAC,MAAM,GAAG,EAAE;;AAgC7C,IAAa,oBAAmC,OAC9C,qCACD;AACD,IAAM,0BAA0B;AAEhC,SAAgB,0BACd,SAAiB,OAAO,OAAO,EAC/B,WAA4B,OAAO,UAAU,EAAE,UAAU,MAAM,CAAC,EAAA;AAEhE,KAAI,CAAC,SACH;AAGF,QAAO,OACJ,KAAK,QAAQ,UAAU,iBAAiB,cAAc,CAAC,CACvD,gBAAe;AAEd,wBAAsB,UADN,iBAAiB,OAAO,YAAY,SAAS,KAAK,CAC1B;GACxC;;AAGN,SAAgB,gBAAgB,OAAmB;AACjD,KAAI;AACF,SAAO,KAAK,UAAU,MAAM,CACzB,QAAQ,MAAM,UAAU,CACxB,QAAQ,MAAM,UAAU,CACxB,QAAQ,MAAM,UAAU,CACxB,QAAQ,WAAW,UAA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,OAAO;;;;;;;AChU/D,IAAa,qBAAqB,EAAE;AAUpC,IAAa,kCAET,IAAI,eAAe,4CAA4C"}
1
+ {"version":3,"file":"route-files.mjs","names":[],"sources":["../../../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs","../../src/lib/json-ld.ts","../../src/lib/meta-tags.ts","../../src/lib/endpoints.ts","../../src/lib/inject-route-endpoint-url.ts","../../src/lib/route-config.ts","../../src/lib/constants.ts","../../src/lib/route-builder.ts","../../src/lib/route-files.ts"],"sourcesContent":["function isPlainObject(value) {\n if (!value || typeof value !== 'object') {\n return false;\n }\n const proto = Object.getPrototypeOf(value);\n const hasObjectPrototype = proto === null ||\n proto === Object.prototype ||\n Object.getPrototypeOf(proto) === null;\n if (!hasObjectPrototype) {\n return false;\n }\n return Object.prototype.toString.call(value) === '[object Object]';\n}\n\nexport { isPlainObject };\n","import { DOCUMENT, inject } from '@angular/core';\nimport type { ActivatedRouteSnapshot } from '@angular/router';\nimport { NavigationEnd, Router } from '@angular/router';\nimport { isPlainObject } from 'es-toolkit';\nimport { filter } from 'rxjs/operators';\n\nimport type { Graph, Thing, WithContext } from 'schema-dts';\n\nexport type JsonLdObject = Record<string, unknown>;\n\nexport function isJsonLdObject(value: unknown): value is JsonLdObject {\n return isPlainObject(value);\n}\n\nexport function normalizeJsonLd(value: unknown): JsonLdObject[] {\n if (Array.isArray(value)) {\n return value.filter(isJsonLdObject);\n }\n\n return isJsonLdObject(value) ? [value] : [];\n}\n\nexport type JsonLd = JsonLdObject | JsonLdObject[];\n\n/**\n * Typed JSON-LD document based on `schema-dts`.\n *\n * Accepts single Schema.org nodes (`WithContext<Thing>`),\n * `@graph`-based documents (`Graph`), or arrays of nodes.\n *\n * This is the canonical JSON-LD type for route authoring surfaces\n * (`routeMeta.jsonLd`, generated manifest).\n *\n * @example\n * ```ts\n * import type { WebPage, WithContext } from 'schema-dts';\n *\n * export const routeMeta = {\n * jsonLd: {\n * '@context': 'https://schema.org',\n * '@type': 'WebPage',\n * name: 'Products',\n * } satisfies WithContext<WebPage>,\n * };\n * ```\n */\nexport type AnalogJsonLdDocument =\n | WithContext<Thing>\n | Graph\n | WithContext<Thing>[];\n\nexport const ROUTE_JSON_LD_KEY: unique symbol = Symbol(\n '@analogjs/router Route JSON-LD Key',\n);\nconst JSON_LD_SCRIPT_SELECTOR = 'script[data-analog-json-ld]';\n\nexport function updateJsonLdOnRouteChange(\n router: Router = inject(Router),\n document: Document | null = inject(DOCUMENT, { optional: true }),\n): void {\n if (!document) {\n return;\n }\n\n router.events\n .pipe(filter((event) => event instanceof NavigationEnd))\n .subscribe(() => {\n const entries = getJsonLdEntries(router.routerState.snapshot.root);\n applyJsonLdToDocument(document, entries);\n });\n}\n\nexport function serializeJsonLd(entry: JsonLdObject): string | null {\n try {\n return JSON.stringify(entry)\n .replace(/</g, '\\\\u003c')\n .replace(/>/g, '\\\\u003e')\n .replace(/&/g, '\\\\u0026')\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029');\n } catch {\n return null;\n }\n}\n\nfunction getJsonLdEntries(route: ActivatedRouteSnapshot): JsonLdObject[] {\n const entries: JsonLdObject[] = [];\n let currentRoute: ActivatedRouteSnapshot | null = route;\n\n while (currentRoute) {\n entries.push(...normalizeJsonLd(currentRoute.data[ROUTE_JSON_LD_KEY]));\n currentRoute = currentRoute.firstChild;\n }\n\n return entries;\n}\n\nfunction applyJsonLdToDocument(\n document: Document,\n entries: JsonLdObject[],\n): void {\n document.querySelectorAll(JSON_LD_SCRIPT_SELECTOR).forEach((element) => {\n element.remove();\n });\n\n if (entries.length === 0) {\n return;\n }\n\n const head = document.head || document.getElementsByTagName('head')[0];\n if (!head) {\n return;\n }\n\n entries.forEach((entry, index) => {\n const serialized = serializeJsonLd(entry);\n if (!serialized) {\n return;\n }\n\n const script = document.createElement('script');\n script.type = 'application/ld+json';\n script.setAttribute('data-analog-json-ld', 'true');\n script.setAttribute('data-analog-json-ld-index', String(index));\n script.textContent = serialized;\n head.appendChild(script);\n });\n}\n","import { inject } from '@angular/core';\nimport { Meta, MetaDefinition as NgMetaTag } from '@angular/platform-browser';\nimport { ActivatedRouteSnapshot, NavigationEnd, Router } from '@angular/router';\nimport { filter } from 'rxjs/operators';\n\nexport const ROUTE_META_TAGS_KEY: unique symbol = Symbol(\n '@analogjs/router Route Meta Tags Key',\n);\n\nconst CHARSET_KEY = 'charset';\nconst HTTP_EQUIV_KEY = 'httpEquiv';\n// httpEquiv selector key needs to be in kebab case format\nconst HTTP_EQUIV_SELECTOR_KEY = 'http-equiv';\nconst NAME_KEY = 'name';\nconst PROPERTY_KEY = 'property';\nconst CONTENT_KEY = 'content';\nconst ITEMPROP_KEY = 'itemprop';\n\nexport type MetaTag =\n | (CharsetMetaTag & ExcludeRestMetaTagKeys<typeof CHARSET_KEY>)\n | (HttpEquivMetaTag & ExcludeRestMetaTagKeys<typeof HTTP_EQUIV_KEY>)\n | (NameMetaTag & ExcludeRestMetaTagKeys<typeof NAME_KEY>)\n | (PropertyMetaTag & ExcludeRestMetaTagKeys<typeof PROPERTY_KEY>)\n | (ItempropMetaTag & ExcludeRestMetaTagKeys<typeof ITEMPROP_KEY>);\n\ntype CharsetMetaTag = { [CHARSET_KEY]: string };\ntype HttpEquivMetaTag = { [HTTP_EQUIV_KEY]: string; [CONTENT_KEY]: string };\ntype NameMetaTag = { [NAME_KEY]: string; [CONTENT_KEY]: string };\ntype PropertyMetaTag = { [PROPERTY_KEY]: string; [CONTENT_KEY]: string };\ntype ItempropMetaTag = { [ITEMPROP_KEY]: string; [CONTENT_KEY]: string };\n\ntype MetaTagKey =\n | typeof CHARSET_KEY\n | typeof HTTP_EQUIV_KEY\n | typeof NAME_KEY\n | typeof PROPERTY_KEY\n | typeof ITEMPROP_KEY;\ntype ExcludeRestMetaTagKeys<Key extends MetaTagKey> = {\n [K in Exclude<MetaTagKey, Key>]?: never;\n};\n\ntype MetaTagSelector =\n | typeof CHARSET_KEY\n | `${\n | typeof HTTP_EQUIV_SELECTOR_KEY\n | typeof NAME_KEY\n | typeof PROPERTY_KEY\n | typeof ITEMPROP_KEY}=\"${string}\"`;\ntype MetaTagMap = Record<MetaTagSelector, MetaTag>;\n\nexport function updateMetaTagsOnRouteChange(\n router: Router = inject(Router),\n metaService: Meta = inject(Meta),\n): void {\n router.events\n .pipe(filter((event) => event instanceof NavigationEnd))\n .subscribe(() => {\n const metaTagMap = getMetaTagMap(router.routerState.snapshot.root);\n for (const metaTagSelector in metaTagMap) {\n const metaTag = metaTagMap[\n metaTagSelector as MetaTagSelector\n ] as NgMetaTag;\n metaService.updateTag(metaTag, metaTagSelector);\n }\n });\n}\n\nfunction getMetaTagMap(route: ActivatedRouteSnapshot): MetaTagMap {\n const metaTagMap = {} as MetaTagMap;\n let currentRoute: ActivatedRouteSnapshot | null = route;\n\n while (currentRoute) {\n const metaTags: MetaTag[] = currentRoute.data[ROUTE_META_TAGS_KEY] ?? [];\n for (const metaTag of metaTags) {\n metaTagMap[getMetaTagSelector(metaTag)] = metaTag;\n }\n\n currentRoute = currentRoute.firstChild;\n }\n\n return metaTagMap;\n}\n\nfunction getMetaTagSelector(metaTag: MetaTag): MetaTagSelector {\n if (metaTag.name) {\n return `${NAME_KEY}=\"${metaTag.name}\"`;\n }\n\n if (metaTag.property) {\n return `${PROPERTY_KEY}=\"${metaTag.property}\"`;\n }\n\n if (metaTag.httpEquiv) {\n return `${HTTP_EQUIV_SELECTOR_KEY}=\"${metaTag.httpEquiv}\"`;\n }\n\n if (metaTag.itemprop) {\n return `${ITEMPROP_KEY}=\"${metaTag.itemprop}\"`;\n }\n\n return CHARSET_KEY;\n}\n","export const ANALOG_META_KEY: unique symbol = Symbol(\n '@analogjs/router Analog Route Metadata Key',\n);\n\n/**\n * This variable reference is replaced with a glob of all route endpoints.\n */\nexport const ANALOG_PAGE_ENDPOINTS: Record<string, () => Promise<unknown>> = {};\n","import type { ActivatedRouteSnapshot, Route } from '@angular/router';\nimport { injectBaseURL, injectAPIPrefix } from '../../tokens/src/index.js';\n\nimport { ANALOG_META_KEY } from './endpoints';\n\nexport function injectRouteEndpointURL(route: ActivatedRouteSnapshot): URL {\n const routeConfig = route.routeConfig as Route & {\n [ANALOG_META_KEY]: { endpoint: string; endpointKey: string };\n };\n\n const apiPrefix = injectAPIPrefix();\n const baseUrl = injectBaseURL();\n const { queryParams, fragment: hash, params, parent } = route;\n const segment = parent?.url.map((segment) => segment.path).join('/') || '';\n const url = new URL(\n '',\n baseUrl ||\n (typeof window !== 'undefined' && window.location.origin\n ? window.location.origin\n : ''),\n );\n url.pathname = `${\n url.pathname.endsWith('/') ? url.pathname : url.pathname + '/'\n }${apiPrefix}/_analog${routeConfig[ANALOG_META_KEY].endpoint}`;\n url.search = `${new URLSearchParams(queryParams).toString()}`;\n url.hash = hash ?? '';\n\n Object.keys(params).forEach((param) => {\n url.pathname = url.pathname.replace(`[${param}]`, params[param]);\n });\n url.pathname = url.pathname.replace('**', segment);\n\n return url;\n}\n","import { inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport type { Route } from '@angular/router';\nimport { firstValueFrom } from 'rxjs';\nimport { injectInternalServerFetch } from '../../tokens/src/index.js';\n\nimport {\n DefaultRouteMeta,\n RedirectRouteMeta,\n RouteConfig,\n RouteMeta,\n} from './models';\nimport { ROUTE_JSON_LD_KEY, isJsonLdObject } from './json-ld';\nimport { ROUTE_META_TAGS_KEY } from './meta-tags';\nimport { ANALOG_PAGE_ENDPOINTS, ANALOG_META_KEY } from './endpoints';\nimport { injectRouteEndpointURL } from './inject-route-endpoint-url';\n\nexport function toRouteConfig(routeMeta: RouteMeta | undefined): RouteConfig {\n if (routeMeta && isRedirectRouteMeta(routeMeta)) {\n return routeMeta;\n }\n\n const defaultMeta: DefaultRouteMeta = (routeMeta ?? {}) as DefaultRouteMeta;\n const { meta, jsonLd, ...routeConfig } = defaultMeta;\n\n if (Array.isArray(meta)) {\n routeConfig.data = { ...routeConfig.data, [ROUTE_META_TAGS_KEY]: meta };\n } else if (typeof meta === 'function') {\n routeConfig.resolve = {\n ...routeConfig.resolve,\n [ROUTE_META_TAGS_KEY]: meta,\n };\n }\n\n if (Array.isArray(jsonLd) || isJsonLdObject(jsonLd)) {\n routeConfig.data = { ...routeConfig.data, [ROUTE_JSON_LD_KEY]: jsonLd };\n } else if (typeof jsonLd === 'function') {\n routeConfig.resolve = {\n ...routeConfig.resolve,\n [ROUTE_JSON_LD_KEY]: jsonLd,\n };\n }\n\n routeConfig.runGuardsAndResolvers =\n routeConfig.runGuardsAndResolvers ?? 'paramsOrQueryParamsChange';\n routeConfig.resolve = {\n ...routeConfig.resolve,\n load: async (route) => {\n const routeConfig = route.routeConfig as Route & {\n [ANALOG_META_KEY]: { endpoint: string; endpointKey: string };\n };\n\n // Content routes (from .md files in the pages directory) do not have\n // ANALOG_META_KEY — it is only set on page routes (.page.ts) in\n // route-builder.ts. The optional chain avoids a runtime crash when\n // the router resolves a content route during SSR / prerendering.\n if (ANALOG_PAGE_ENDPOINTS[routeConfig[ANALOG_META_KEY]?.endpointKey]) {\n const http = inject(HttpClient);\n const url = injectRouteEndpointURL(route);\n const internalFetch = injectInternalServerFetch();\n\n if (internalFetch) {\n return internalFetch(`${url.pathname}${url.search}`);\n }\n\n return firstValueFrom(http.get(`${url.href}`));\n }\n\n return {};\n },\n };\n\n return routeConfig;\n}\n\nfunction isRedirectRouteMeta(\n routeMeta: RouteMeta,\n): routeMeta is RedirectRouteMeta {\n return !!routeMeta.redirectTo;\n}\n","export const ENDPOINT_EXTENSION = '.server.ts';\nexport const APP_DIR = 'src/app';\n","import { UrlSegment } from '@angular/router';\nimport type { Route } from '@angular/router';\nimport type { UrlMatcher } from '@angular/router';\n\nimport type { RouteExport } from './models';\nimport { toRouteConfig } from './route-config';\nimport { ENDPOINT_EXTENSION } from './constants';\nimport { ANALOG_META_KEY } from './endpoints';\n\nexport type RouteModuleFactory = () => Promise<RouteExport>;\n\nexport type RouteModuleResolver<TFile> = (\n filename: string,\n fileLoader: () => Promise<TFile>,\n) => RouteModuleFactory;\n\ntype RawRoute = {\n filename: string | null;\n rawSegment: string;\n ancestorRawSegments: string[];\n segment: string;\n level: number;\n children: RawRoute[];\n};\n\ntype RawRouteMap = Record<string, RawRoute>;\ntype RawRouteByLevelMap = Record<number, RawRouteMap>;\n\nexport function createRoutes<TFile>(\n files: Record<string, () => Promise<TFile>>,\n resolveModule: RouteModuleResolver<TFile>,\n debug = false,\n): Route[] {\n const filenames = Object.keys(files).sort((a, b) => {\n const aPriority = getCollisionPriority(a);\n const bPriority = getCollisionPriority(b);\n\n return aPriority - bPriority;\n });\n\n if (filenames.length === 0) {\n return [];\n }\n\n const rawRoutesByLevelMap = filenames.reduce((acc, filename) => {\n const rawPath = toRawPath(filename);\n const rawSegments = rawPath.split('/');\n const level = rawSegments.length - 1;\n const rawSegment = rawSegments[level];\n const ancestorRawSegments = rawSegments.slice(0, level);\n\n const existing = acc[level]?.[rawPath];\n if (existing?.filename && existing.filename !== filename) {\n const existingPriority = getCollisionPriority(existing.filename);\n const nextPriority = getCollisionPriority(filename);\n const shouldKeepExisting = existingPriority < nextPriority;\n const chosenFilename = shouldKeepExisting ? existing.filename : filename;\n\n if (import.meta.env.DEV) {\n console.warn(\n `[Analog] Route files \"${existing.filename}\" and \"${filename}\" ` +\n `resolve to the same route path \"${rawPath}\". ` +\n `Only \"${chosenFilename}\" will be used.`,\n );\n }\n\n if (shouldKeepExisting) {\n return acc;\n }\n }\n\n return {\n ...acc,\n [level]: {\n ...acc[level],\n [rawPath]: {\n filename,\n rawSegment,\n ancestorRawSegments,\n segment: toSegment(rawSegment),\n level,\n children: [],\n },\n },\n };\n }, {} as RawRouteByLevelMap);\n\n const allLevels = Object.keys(rawRoutesByLevelMap).map(Number);\n const maxLevel = Math.max(...allLevels);\n\n for (let level = maxLevel; level > 0; level--) {\n const rawRoutesMap = rawRoutesByLevelMap[level];\n const rawPaths = Object.keys(rawRoutesMap);\n\n for (const rawPath of rawPaths) {\n const rawRoute = rawRoutesMap[rawPath];\n const parentRawPath = rawRoute.ancestorRawSegments.join('/');\n const parentRawSegmentIndex = rawRoute.ancestorRawSegments.length - 1;\n const parentRawSegment =\n rawRoute.ancestorRawSegments[parentRawSegmentIndex];\n\n rawRoutesByLevelMap[level - 1] ||= {};\n rawRoutesByLevelMap[level - 1][parentRawPath] ||= {\n filename: null,\n rawSegment: parentRawSegment,\n ancestorRawSegments: rawRoute.ancestorRawSegments.slice(\n 0,\n parentRawSegmentIndex,\n ),\n segment: toSegment(parentRawSegment),\n level: level - 1,\n children: [],\n };\n\n rawRoutesByLevelMap[level - 1][parentRawPath].children.push(rawRoute);\n }\n }\n\n const rootRawRoutesMap = rawRoutesByLevelMap[0];\n const rawRoutes = Object.keys(rootRawRoutesMap).map(\n (segment) => rootRawRoutesMap[segment],\n );\n sortRawRoutes(rawRoutes);\n\n return toRoutes(rawRoutes, files, resolveModule, debug);\n}\n\nfunction getCollisionPriority(filename: string): number {\n if (\n filename.includes('/src/app/pages/') ||\n filename.includes('/app/pages/') ||\n filename.includes('/src/content/')\n ) {\n return 0;\n }\n\n return 1;\n}\n\n/**\n * Strips directory prefixes and file extensions from a route filename to\n * produce the raw path used for route segment construction.\n *\n * The regex mirrors `filenameToRoutePath` in route-manifest.ts — changes\n * here must be kept in sync with that function. The first alternation\n * strips everything up to and including the first /routes/, /pages/, or\n * /content/ segment, which handles both app-local and additional directory\n * paths (e.g. `additionalPagesDirs`, `additionalContentDirs`).\n */\nfunction toRawPath(filename: string): string {\n return filename\n .replace(\n /^(?:[a-zA-Z]:[\\\\/])?(.*?)[\\\\/](?:routes|pages|content)[\\\\/]|(?:[\\\\/](?:app[\\\\/]pages|src[\\\\/]content)[\\\\/])|(\\.page\\.(js|ts)$)|(\\.(ts|md)$)/g,\n '',\n )\n .replace(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/g, '(opt-$1)')\n .replace(/\\[\\.{3}.+\\]/, '**')\n .replace(/\\[([^\\]]+)\\]/g, ':$1');\n}\n\nfunction toSegment(rawSegment: string): string {\n return rawSegment\n .replace(/\\(.*?\\)/g, '')\n .replace(/(^|[./])index(?=[./]|$)/g, '$1')\n .replace(/\\.|\\/+/g, '/')\n .replace(/^\\/+|\\/+$/g, '');\n}\n\nfunction createOptionalCatchAllMatcher(paramName: string): UrlMatcher {\n return (segments) => {\n if (segments.length === 0) {\n return null;\n }\n const joined = segments.map((s) => s.path).join('/');\n return {\n consumed: segments,\n posParams: { [paramName]: new UrlSegment(joined, {}) },\n };\n };\n}\n\nfunction toRoutes<TFile>(\n rawRoutes: RawRoute[],\n files: Record<string, () => Promise<TFile>>,\n resolveModule: RouteModuleResolver<TFile>,\n debug = false,\n): Route[] {\n const routes: Route[] = [];\n\n for (const rawRoute of rawRoutes) {\n const children: Route[] | undefined =\n rawRoute.children.length > 0\n ? toRoutes(rawRoute.children, files, resolveModule, debug)\n : undefined;\n let module: RouteModuleFactory | undefined;\n let analogMeta: { endpoint: string; endpointKey: string } | undefined;\n\n if (rawRoute.filename) {\n if (!debug) {\n module = resolveModule(rawRoute.filename, files[rawRoute.filename]);\n }\n\n if (/\\.page\\.ts$/.test(rawRoute.filename)) {\n const endpointKey = rawRoute.filename.replace(\n /\\.page\\.ts$/,\n ENDPOINT_EXTENSION,\n );\n\n const rawEndpoint = rawRoute.filename\n .replace(/\\.page\\.ts$/, '')\n .replace(/\\[\\[\\.\\.\\..+\\]\\]/, '**')\n .replace(/\\[\\.{3}.+\\]/, '**')\n .replace(/^(.*?)\\/pages/, '/pages');\n\n // Strip the route group syntax from every segment, matching how the\n // page handlers are mounted. Anchoring this to the last segment left\n // the parens in place for a route like `(auth)/sign-up`, so the\n // request went to a path no handler answered and the load resolved\n // to an empty object.\n const endpoint = (rawEndpoint || '')\n .replace(/\\./g, '/')\n .replace(/\\/\\(([^/]+)\\)/g, '/-$1-');\n\n analogMeta = {\n endpoint,\n endpointKey,\n };\n }\n }\n\n const optCatchAllMatch = rawRoute.filename?.match(/\\[\\[\\.\\.\\.([^\\]]+)\\]\\]/);\n const optCatchAllParam = optCatchAllMatch ? optCatchAllMatch[1] : null;\n\n type DebugRoute = Route & {\n filename?: string | null | undefined;\n isLayout?: boolean;\n };\n\n const route: Route & { meta?: typeof analogMeta } & DebugRoute = module\n ? {\n path: rawRoute.segment,\n loadChildren: () =>\n module!().then((m) => {\n if (import.meta.env.DEV) {\n const hasModuleDefault = !!m.default;\n const hasRedirect = !!m.routeMeta?.redirectTo;\n\n if (!hasModuleDefault && !hasRedirect) {\n console.warn(\n `[Analog] Missing default export at ${rawRoute.filename}`,\n );\n }\n }\n\n const routeConfig = toRouteConfig(m.routeMeta);\n const hasRedirect = 'redirectTo' in routeConfig;\n const baseChild = hasRedirect\n ? {\n path: '',\n ...routeConfig,\n }\n : {\n path: '',\n component: m.default,\n ...routeConfig,\n children,\n [ANALOG_META_KEY]: analogMeta,\n };\n\n return [\n {\n ...baseChild,\n },\n ...(optCatchAllParam\n ? [\n {\n matcher:\n createOptionalCatchAllMatcher(optCatchAllParam),\n ...(hasRedirect\n ? routeConfig\n : {\n component: m.default,\n ...routeConfig,\n [ANALOG_META_KEY]: analogMeta,\n }),\n },\n ]\n : []),\n ];\n }),\n }\n : {\n path: rawRoute.segment,\n ...(debug\n ? {\n filename: rawRoute.filename ? rawRoute.filename : undefined,\n isLayout: children && children.length > 0 ? true : false,\n }\n : {}),\n children,\n };\n\n routes.push(route);\n }\n\n return routes;\n}\n\nfunction sortRawRoutes(rawRoutes: RawRoute[]): void {\n rawRoutes.sort((a, b) => {\n let segmentA = deprioritizeSegment(a.segment);\n let segmentB = deprioritizeSegment(b.segment);\n\n if (a.children.length > b.children.length) {\n segmentA = `~${segmentA}`;\n } else if (a.children.length < b.children.length) {\n segmentB = `~${segmentB}`;\n }\n\n return segmentA > segmentB ? 1 : -1;\n });\n\n for (const rawRoute of rawRoutes) {\n sortRawRoutes(rawRoute.children);\n }\n}\n\nfunction deprioritizeSegment(segment: string): string {\n return segment.replaceAll(':', '~~').replaceAll('**', '~~~~');\n}\n","import { InjectionToken } from '@angular/core';\nimport type { RouteExport } from './models';\n\nexport type Files = Record<string, () => Promise<RouteExport>>;\n\n/**\n * This variable reference is replaced with a glob of all page routes.\n */\nexport const ANALOG_ROUTE_FILES = {};\n\nexport interface ExtraRouteFileSource {\n files: Record<string, () => Promise<unknown>>;\n resolveModule: (\n filename: string,\n fileLoader: () => Promise<unknown>,\n ) => () => Promise<RouteExport>;\n}\n\nexport const ANALOG_EXTRA_ROUTE_FILE_SOURCES: InjectionToken<\n ExtraRouteFileSource[]\n> = new InjectionToken('@analogjs/router extra route file sources');\n\n/**\n * Replaced at build time by the Vite router plugin with the number of\n * discovered content route files. Used in dev mode to warn when content\n * files exist but `withContentRoutes()` is not configured.\n */\nexport const ANALOG_CONTENT_FILE_COUNT = 0;\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AAAA,SAAS,cAAc,OAAO;CAC1B,IAAI,CAAC,SAAS,OAAO,UAAU,UAC3B,OAAO;CAEX,MAAM,QAAQ,OAAO,eAAe,KAAK;CAIzC,IAAI,EAHuB,UAAU,QACjC,UAAU,OAAO,aACjB,OAAO,eAAe,KAAK,MAAM,OAEjC,OAAO;CAEX,OAAO,OAAO,UAAU,SAAS,KAAK,KAAK,MAAM;AACrD;;;ACFA,SAAgB,eAAe,OAAc;CAC3C,OAAO,cAAc,KAAK;AAC5B;AAEA,SAAgB,gBAAgB,OAAc;CAC5C,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,OAAO,cAAc;CAGpC,OAAO,eAAe,KAAK,IAAI,CAAC,KAAK,IAAI,CAAA;AAC3C;AA+BA,IAAa,oBAAmC,OAC9C,oCAAoC;AAEtC,IAAM,0BAA0B;AAEhC,SAAgB,0BACd,SAAiB,OAAO,MAAM,GAC9B,WAA4B,OAAO,UAAU,EAAE,UAAU,KAAI,CAAE,GAAC;CAEhE,IAAI,CAAC,UACH;CAGF,OAAO,OAC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F,kBAAkB;KACpB;IACN,CACF,IACD,CAAA,CACL;GACH,CAAC;EACJ,IACD;GACE,MAAM,SAAS;GACf,GAAI,QACA;IACE,UAAU,SAAS,WAAW,SAAS,WAAW,KAAA;IAClD,UAAU,YAAY,SAAS,SAAS,IAAI,OAAO;GACpD,IACD,CAAA;GACJ;EACD;EAEL,OAAO,KAAK,KAAK;CACnB;CAEA,OAAO;AACT;AAEA,SAAS,cAAc,WAAqB;CAC1C,UAAU,MAAM,GAAG,MAAK;EACtB,IAAI,WAAW,oBAAoB,EAAE,OAAO;EAC5C,IAAI,WAAW,oBAAoB,EAAE,OAAO;EAE5C,IAAI,EAAE,SAAS,SAAS,EAAE,SAAS,QACjC,WAAW,IAAI;OACV,IAAI,EAAE,SAAS,SAAS,EAAE,SAAS,QACxC,WAAW,IAAI;EAGjB,OAAO,WAAW,WAAW,IAAI;CACnC,CAAC;CAED,KAAK,MAAM,YAAY,WACrB,cAAc,SAAS,QAAQ;AAEnC;AAEA,SAAS,oBAAoB,SAAe;CAC1C,OAAO,QAAQ,WAAW,KAAK,IAAI,CAAC,CAAC,WAAW,MAAM,MAAM;AAC9D;;;;;;ACjUA,IAAa,qBAAqB,CAAA;AAUlC,IAAa,kCAET,IAAI,eAAe,2CAA2C"}
@@ -1 +1 @@
1
- {"version":3,"file":"routes.mjs","names":[],"sources":["../../src/lib/routes.ts","../../src/lib/debug/routes.ts"],"sourcesContent":["import type { Route } from '@angular/router';\n\nimport type { RouteExport } from './models';\nimport { createRoutes as createBaseRoutes } from './route-builder';\nimport type { Files } from './route-files';\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 return createBaseRoutes(\n files,\n (_filename, fileLoader) => fileLoader as () => Promise<RouteExport>,\n debug,\n );\n}\n\nexport { ANALOG_ROUTE_FILES } from './route-files';\n","import { inject, InjectionToken } from '@angular/core';\nimport { Route } from '@angular/router';\n\nimport { ANALOG_ROUTE_FILES, createRoutes } from '../routes';\n\nexport const DEBUG_ROUTES: InjectionToken<(Route & DebugRoute)[]> =\n new InjectionToken<(Route & DebugRoute)[]>('@analogjs/router debug routes', {\n providedIn: 'root',\n factory() {\n const debugRoutes = createRoutes(ANALOG_ROUTE_FILES, true);\n\n return debugRoutes as (Route & DebugRoute)[];\n },\n });\n\nexport type DebugRoute = {\n path: string;\n filename: string;\n isLayout: boolean;\n children?: DebugRoute[];\n};\n\nexport function injectDebugRoutes(): (Route & DebugRoute)[] {\n return inject(DEBUG_ROUTES);\n}\n"],"mappings":";;;;;;;;;AAYA,SAAgB,aAAa,OAAc,QAAQ,OAAK;AACtD,QAAO,eACL,QACC,WAAW,eAAe,YAC3B,MACD;;;;ACZH,IAAa,eACX,IAAI,eAAuC,iCAAiC;CAC1E,YAAY;CACZ,UAAO;AAGL,SAFoB,aAAa,oBAAoB,KAAK;;CAI7D,CAAC;AASJ,SAAgB,oBAAiB;AAC/B,QAAO,OAAO,aAAa"}
1
+ {"version":3,"file":"routes.mjs","names":[],"sources":["../../src/lib/routes.ts","../../src/lib/debug/routes.ts"],"sourcesContent":["import type { Route } from '@angular/router';\n\nimport type { RouteExport } from './models';\nimport { createRoutes as createBaseRoutes } from './route-builder';\nimport type { Files } from './route-files';\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 return createBaseRoutes(\n files,\n (_filename, fileLoader) => fileLoader as () => Promise<RouteExport>,\n debug,\n );\n}\n\nexport { ANALOG_ROUTE_FILES } from './route-files';\n","import { inject, InjectionToken } from '@angular/core';\nimport { Route } from '@angular/router';\n\nimport { ANALOG_ROUTE_FILES, createRoutes } from '../routes';\n\nexport const DEBUG_ROUTES: InjectionToken<(Route & DebugRoute)[]> =\n new InjectionToken<(Route & DebugRoute)[]>('@analogjs/router debug routes', {\n providedIn: 'root',\n factory() {\n const debugRoutes = createRoutes(ANALOG_ROUTE_FILES, true);\n\n return debugRoutes as (Route & DebugRoute)[];\n },\n });\n\nexport type DebugRoute = {\n path: string;\n filename: string;\n isLayout: boolean;\n children?: DebugRoute[];\n};\n\nexport function injectDebugRoutes(): (Route & DebugRoute)[] {\n return inject(DEBUG_ROUTES);\n}\n"],"mappings":";;;;;;;;;AAYA,SAAgB,aAAa,OAAc,QAAQ,OAAK;CACtD,OAAO,eACL,QACC,WAAW,eAAe,YAC3B,KAAK;AAET;;;ACbA,IAAa,eACX,IAAI,eAAuC,iCAAiC;CAC1E,YAAY;CACZ,UAAO;EAGL,OAFoB,aAAa,oBAAoB,IAE9C;CACT;AACD,CAAA;AASH,SAAgB,oBAAiB;CAC/B,OAAO,OAAO,YAAY;AAC5B"}
@@ -35,7 +35,7 @@ var INJECT_TOKENS = {
35
35
  injectRouter: "Router",
36
36
  injectActivatedRoute: "ActivatedRoute"
37
37
  };
38
- var REMOVED_APIS = new Set(["defineRouteMeta", ...Object.keys(INJECT_TOKENS)]);
38
+ var REMOVED_APIS = /* @__PURE__ */ new Set(["defineRouteMeta", ...Object.keys(INJECT_TOKENS)]);
39
39
  var MIGRATION_DOC_URL = "https://analogjs.org/docs/guides/migrating-v2-to-v3#deprecated-router-apis-were-removed";
40
40
  function getNamedImports(sourceFile, moduleName) {
41
41
  return sourceFile.statements.filter((statement) => ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === moduleName && !!statement.importClause?.namedBindings && ts.isNamedImports(statement.importClause.namedBindings));
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-deprecated-router-apis.js","names":[],"sources":["../../../migrations/utils/source-edits.ts","../../../migrations/migrate-deprecated-router-apis/migrate-deprecated-router-apis.ts"],"sourcesContent":["import type { Tree } from '@angular-devkit/schematics';\n\nexport interface Edit {\n start: number;\n end: number;\n text: string;\n}\n\nexport function applyEdits(source: string, edits: Edit[]): string {\n // Apply right-to-left so earlier offsets stay valid.\n const sorted = [...edits].sort((a, b) => b.start - a.start);\n let result = source;\n for (const edit of sorted) {\n result = result.slice(0, edit.start) + edit.text + result.slice(edit.end);\n }\n return result;\n}\n\nconst SOURCE_EXTENSIONS = ['.ts', '.mts', '.cts', '.tsx'];\n\n/** Rewrites workspace TypeScript sources that contain `marker`. */\nexport function rewriteSourceFiles(\n tree: Tree,\n marker: string,\n rewrite: (filePath: string, source: string) => string | null,\n): string[] {\n const rewritten: string[] = [];\n tree.visit((filePath) => {\n if (filePath.includes('/node_modules/')) return;\n if (!SOURCE_EXTENSIONS.some((ext) => filePath.endsWith(ext))) return;\n\n const source = tree.read(filePath)?.toString('utf-8');\n if (!source?.includes(marker)) return;\n\n const result = rewrite(filePath, source);\n if (result !== null && result !== source) {\n tree.overwrite(filePath, result);\n rewritten.push(filePath);\n }\n });\n return rewritten;\n}\n","import type { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\n\nimport {\n applyEdits,\n rewriteSourceFiles,\n type Edit,\n} from '../utils/source-edits';\n\nconst ROUTER_PKG = '@analogjs/router';\nconst INJECT_TOKENS: Record<string, string> = {\n injectRouter: 'Router',\n injectActivatedRoute: 'ActivatedRoute',\n};\nconst REMOVED_APIS = new Set([\n 'defineRouteMeta',\n ...Object.keys(INJECT_TOKENS),\n]);\nconst MIGRATION_DOC_URL =\n 'https://analogjs.org/docs/guides/migrating-v2-to-v3#deprecated-router-apis-were-removed';\n\nfunction getNamedImports(\n sourceFile: ts.SourceFile,\n moduleName: string,\n): ts.ImportDeclaration[] {\n return sourceFile.statements.filter(\n (statement): statement is ts.ImportDeclaration =>\n ts.isImportDeclaration(statement) &&\n ts.isStringLiteral(statement.moduleSpecifier) &&\n statement.moduleSpecifier.text === moduleName &&\n !!statement.importClause?.namedBindings &&\n ts.isNamedImports(statement.importClause.namedBindings),\n );\n}\n\nfunction getImportElements(\n declaration: ts.ImportDeclaration,\n): readonly ts.ImportSpecifier[] {\n return (declaration.importClause?.namedBindings as ts.NamedImports).elements;\n}\n\nfunction getImportedNames(\n sourceFile: ts.SourceFile,\n moduleName: string,\n valuesOnly = false,\n): Set<string> {\n return new Set(\n getNamedImports(sourceFile, moduleName).flatMap((declaration) =>\n valuesOnly && declaration.importClause?.isTypeOnly\n ? []\n : getImportElements(declaration)\n .filter((element) => !(valuesOnly && element.isTypeOnly))\n .map((element) => element.name.text),\n ),\n );\n}\n\n/** Turns type-only `@angular/router` imports of the injected tokens into value imports. */\nfunction promoteTypeOnlyTokens(\n sourceFile: ts.SourceFile,\n tokens: Set<string>,\n): Edit[] {\n const edits: Edit[] = [];\n for (const declaration of getNamedImports(sourceFile, '@angular/router')) {\n const elements = getImportElements(declaration).filter((element) =>\n tokens.has(element.name.text),\n );\n if (elements.length === 0) continue;\n\n if (declaration.importClause?.isTypeOnly) {\n // `import type { A, Router }` -> `import { type A, Router }`\n const start = declaration.getStart(sourceFile);\n const typePrefix = /^import\\s+type\\s+/.exec(\n declaration.getText(sourceFile),\n )![0];\n edits.push({ start, end: start + typePrefix.length, text: 'import ' });\n for (const element of getImportElements(declaration)) {\n if (!tokens.has(element.name.text)) {\n const elementStart = element.getStart(sourceFile);\n edits.push({ start: elementStart, end: elementStart, text: 'type ' });\n }\n }\n } else {\n for (const element of elements.filter((element) => element.isTypeOnly)) {\n edits.push({\n start: element.getStart(sourceFile),\n end: element.end,\n text: element.getText(sourceFile).replace(/^type\\s+/, ''),\n });\n }\n }\n }\n return edits;\n}\n\n/**\n * Replaces `defineRouteMeta({...})` with the object literal typed as\n * `RouteMeta`, and `injectRouter()` / `injectActivatedRoute()` with\n * `inject(Router)` / `inject(ActivatedRoute)`.\n *\n * Returns `null` when the file doesn't use the removed APIs, and the\n * unchanged source when a non-call reference needs a manual migration.\n */\nexport function migrateRouterSource(\n filePath: string,\n source: string,\n): string | null {\n const sourceFile = ts.createSourceFile(\n filePath,\n source,\n ts.ScriptTarget.Latest,\n true,\n filePath.endsWith('.tsx') ? ts.ScriptKind.TSX : ts.ScriptKind.TS,\n );\n\n // Local binding name -> removed API name.\n const removedBindings = new Map<string, string>();\n const routerImports: ts.ImportDeclaration[] = [];\n for (const declaration of getNamedImports(sourceFile, ROUTER_PKG)) {\n const removed = getImportElements(declaration).filter((element) =>\n REMOVED_APIS.has((element.propertyName ?? element.name).text),\n );\n for (const element of removed) {\n removedBindings.set(\n element.name.text,\n (element.propertyName ?? element.name).text,\n );\n }\n if (removed.length > 0) routerImports.push(declaration);\n }\n if (routerImports.length === 0) return null;\n\n const edits: Edit[] = [];\n const angularRouterNames = new Set<string>();\n let needsInject = false;\n let needsRouteMeta = false;\n let hasNonCallReference = false;\n\n function visit(node: ts.Node): void {\n if (\n ts.isIdentifier(node) &&\n removedBindings.has(node.text) &&\n !ts.isImportSpecifier(node.parent) &&\n !(ts.isCallExpression(node.parent) && node.parent.expression === node)\n ) {\n hasNonCallReference = true;\n }\n if (\n ts.isCallExpression(node) &&\n ts.isIdentifier(node.expression) &&\n removedBindings.has(node.expression.text)\n ) {\n const api = removedBindings.get(node.expression.text)!;\n const callStart = node.getStart(sourceFile);\n if (api === 'defineRouteMeta') {\n const [routeMeta] = node.arguments;\n if (routeMeta) {\n // Strip only the call wrapper so rewrites nested in the argument\n // don't overlap this edit.\n edits.push(\n { start: callStart, end: routeMeta.getStart(sourceFile), text: '' },\n { start: routeMeta.end, end: node.end, text: '' },\n );\n const parent = node.parent;\n if (\n ts.isVariableDeclaration(parent) &&\n parent.initializer === node &&\n !parent.type\n ) {\n edits.push({\n start: parent.name.end,\n end: parent.name.end,\n text: ': RouteMeta',\n });\n needsRouteMeta = true;\n }\n }\n } else {\n const token = INJECT_TOKENS[api];\n edits.push({\n start: callStart,\n end: node.end,\n text: `inject(${token})`,\n });\n needsInject = true;\n angularRouterNames.add(token);\n }\n }\n ts.forEachChild(node, visit);\n }\n visit(sourceFile);\n if (hasNonCallReference) return source;\n\n const routerNames = getImportedNames(sourceFile, ROUTER_PKG);\n edits.push(...promoteTypeOnlyTokens(sourceFile, angularRouterNames));\n const ngRouterNames = getImportedNames(sourceFile, '@angular/router');\n const missingTokens = [...angularRouterNames].filter(\n (name) => !ngRouterNames.has(name),\n );\n const addedImports: string[] = [];\n if (\n needsInject &&\n !getImportedNames(sourceFile, '@angular/core', true).has('inject')\n ) {\n addedImports.push(`import { inject } from '@angular/core';`);\n }\n if (missingTokens.length > 0) {\n addedImports.push(\n `import { ${missingTokens.join(', ')} } from '@angular/router';`,\n );\n }\n\n routerImports.forEach((declaration, index) => {\n const remaining = getImportElements(declaration)\n .filter(\n (element) =>\n !REMOVED_APIS.has((element.propertyName ?? element.name).text),\n )\n .map((element) => element.getText(sourceFile));\n if (index === 0 && needsRouteMeta && !routerNames.has('RouteMeta')) {\n remaining.push('type RouteMeta');\n }\n\n const lines = index === 0 ? [...addedImports] : [];\n if (remaining.length > 0) {\n lines.push(`import { ${remaining.join(', ')} } from '${ROUTER_PKG}';`);\n }\n\n const start = declaration.getStart(sourceFile);\n let end = declaration.end;\n if (lines.length === 0 && source[end] === '\\n') {\n end++;\n }\n edits.push({ start, end, text: lines.join('\\n') });\n });\n\n return applyEdits(source, edits);\n}\n\nexport default function migrateDeprecatedRouterApis(): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const manual: string[] = [];\n const rewritten = rewriteSourceFiles(tree, ROUTER_PKG, (path, source) => {\n const result = migrateRouterSource(path, source);\n if (result === source) manual.push(path);\n return result;\n });\n if (manual.length > 0) {\n context.logger.warn(\n `Migrate the removed @analogjs/router APIs by hand in:\\n${manual\n .map((file) => ` - ${file}`)\n .join('\\n')}\\nSee ${MIGRATION_DOC_URL}`,\n );\n }\n if (rewritten.length > 0) {\n context.logger.info(\n `Replaced removed @analogjs/router APIs (defineRouteMeta, injectRouter, injectActivatedRoute) in:\\n${rewritten\n .map((file) => ` - ${file}`)\n .join('\\n')}\\nSee ${MIGRATION_DOC_URL}`,\n );\n }\n return tree;\n };\n}\n"],"mappings":";;AAQA,SAAgB,WAAW,QAAgB,OAAa;CAEtD,MAAM,SAAS,CAAC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,KAAK,OAAO,SAAS,KACxC;AAEF,QAAM,KAAK;GAAE;GAAO;GAAK,MAAM,MAAM,KAAK,KAAK;GAAE,CAAC;GAClD;AAEF,QAAO,WAAW,QAAQ,MAAM;;AAGlC,SAAwB,8BAA2B;AACjD,SAAQ,MAAY,YAA6B;EAC/C,MAAM,SAAmB,EAAE;EAC3B,MAAM,YAAY,mBAAmB,MAAM,aAAa,MAAM,WAAU;GACtE,MAAM,SAAS,oBAAoB,MAAM,OAAO;AAChD,OAAI,WAAW,OAAQ,QAAO,KAAK,KAAK;AACxC,UAAO;IACP;AACF,MAAI,OAAO,SAAS,EAClB,SAAQ,OAAO,KACb,0DAA0D,OACvD,KAAK,SAAS,OAAO,OAAO,CAC5B,KAAK,KAAK,CAAA,QAAS,oBACvB;AAEH,MAAI,UAAU,SAAS,EACrB,SAAQ,OAAO,KACb,qGAAqG,UAClG,KAAK,SAAS,OAAO,OAAO,CAC5B,KAAK,KAAK,CAAA,QAAS,oBACvB;AAEH,SAAO"}
1
+ {"version":3,"file":"migrate-deprecated-router-apis.js","names":[],"sources":["../../../migrations/utils/source-edits.ts","../../../migrations/migrate-deprecated-router-apis/migrate-deprecated-router-apis.ts"],"sourcesContent":["import type { Tree } from '@angular-devkit/schematics';\n\nexport interface Edit {\n start: number;\n end: number;\n text: string;\n}\n\nexport function applyEdits(source: string, edits: Edit[]): string {\n // Apply right-to-left so earlier offsets stay valid.\n const sorted = [...edits].sort((a, b) => b.start - a.start);\n let result = source;\n for (const edit of sorted) {\n result = result.slice(0, edit.start) + edit.text + result.slice(edit.end);\n }\n return result;\n}\n\nconst SOURCE_EXTENSIONS = ['.ts', '.mts', '.cts', '.tsx'];\n\n/** Rewrites workspace TypeScript sources that contain `marker`. */\nexport function rewriteSourceFiles(\n tree: Tree,\n marker: string,\n rewrite: (filePath: string, source: string) => string | null,\n): string[] {\n const rewritten: string[] = [];\n tree.visit((filePath) => {\n if (filePath.includes('/node_modules/')) return;\n if (!SOURCE_EXTENSIONS.some((ext) => filePath.endsWith(ext))) return;\n\n const source = tree.read(filePath)?.toString('utf-8');\n if (!source?.includes(marker)) return;\n\n const result = rewrite(filePath, source);\n if (result !== null && result !== source) {\n tree.overwrite(filePath, result);\n rewritten.push(filePath);\n }\n });\n return rewritten;\n}\n","import type { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\n\nimport {\n applyEdits,\n rewriteSourceFiles,\n type Edit,\n} from '../utils/source-edits';\n\nconst ROUTER_PKG = '@analogjs/router';\nconst INJECT_TOKENS: Record<string, string> = {\n injectRouter: 'Router',\n injectActivatedRoute: 'ActivatedRoute',\n};\nconst REMOVED_APIS = new Set([\n 'defineRouteMeta',\n ...Object.keys(INJECT_TOKENS),\n]);\nconst MIGRATION_DOC_URL =\n 'https://analogjs.org/docs/guides/migrating-v2-to-v3#deprecated-router-apis-were-removed';\n\nfunction getNamedImports(\n sourceFile: ts.SourceFile,\n moduleName: string,\n): ts.ImportDeclaration[] {\n return sourceFile.statements.filter(\n (statement): statement is ts.ImportDeclaration =>\n ts.isImportDeclaration(statement) &&\n ts.isStringLiteral(statement.moduleSpecifier) &&\n statement.moduleSpecifier.text === moduleName &&\n !!statement.importClause?.namedBindings &&\n ts.isNamedImports(statement.importClause.namedBindings),\n );\n}\n\nfunction getImportElements(\n declaration: ts.ImportDeclaration,\n): readonly ts.ImportSpecifier[] {\n return (declaration.importClause?.namedBindings as ts.NamedImports).elements;\n}\n\nfunction getImportedNames(\n sourceFile: ts.SourceFile,\n moduleName: string,\n valuesOnly = false,\n): Set<string> {\n return new Set(\n getNamedImports(sourceFile, moduleName).flatMap((declaration) =>\n valuesOnly && declaration.importClause?.isTypeOnly\n ? []\n : getImportElements(declaration)\n .filter((element) => !(valuesOnly && element.isTypeOnly))\n .map((element) => element.name.text),\n ),\n );\n}\n\n/** Turns type-only `@angular/router` imports of the injected tokens into value imports. */\nfunction promoteTypeOnlyTokens(\n sourceFile: ts.SourceFile,\n tokens: Set<string>,\n): Edit[] {\n const edits: Edit[] = [];\n for (const declaration of getNamedImports(sourceFile, '@angular/router')) {\n const elements = getImportElements(declaration).filter((element) =>\n tokens.has(element.name.text),\n );\n if (elements.length === 0) continue;\n\n if (declaration.importClause?.isTypeOnly) {\n // `import type { A, Router }` -> `import { type A, Router }`\n const start = declaration.getStart(sourceFile);\n const typePrefix = /^import\\s+type\\s+/.exec(\n declaration.getText(sourceFile),\n )![0];\n edits.push({ start, end: start + typePrefix.length, text: 'import ' });\n for (const element of getImportElements(declaration)) {\n if (!tokens.has(element.name.text)) {\n const elementStart = element.getStart(sourceFile);\n edits.push({ start: elementStart, end: elementStart, text: 'type ' });\n }\n }\n } else {\n for (const element of elements.filter((element) => element.isTypeOnly)) {\n edits.push({\n start: element.getStart(sourceFile),\n end: element.end,\n text: element.getText(sourceFile).replace(/^type\\s+/, ''),\n });\n }\n }\n }\n return edits;\n}\n\n/**\n * Replaces `defineRouteMeta({...})` with the object literal typed as\n * `RouteMeta`, and `injectRouter()` / `injectActivatedRoute()` with\n * `inject(Router)` / `inject(ActivatedRoute)`.\n *\n * Returns `null` when the file doesn't use the removed APIs, and the\n * unchanged source when a non-call reference needs a manual migration.\n */\nexport function migrateRouterSource(\n filePath: string,\n source: string,\n): string | null {\n const sourceFile = ts.createSourceFile(\n filePath,\n source,\n ts.ScriptTarget.Latest,\n true,\n filePath.endsWith('.tsx') ? ts.ScriptKind.TSX : ts.ScriptKind.TS,\n );\n\n // Local binding name -> removed API name.\n const removedBindings = new Map<string, string>();\n const routerImports: ts.ImportDeclaration[] = [];\n for (const declaration of getNamedImports(sourceFile, ROUTER_PKG)) {\n const removed = getImportElements(declaration).filter((element) =>\n REMOVED_APIS.has((element.propertyName ?? element.name).text),\n );\n for (const element of removed) {\n removedBindings.set(\n element.name.text,\n (element.propertyName ?? element.name).text,\n );\n }\n if (removed.length > 0) routerImports.push(declaration);\n }\n if (routerImports.length === 0) return null;\n\n const edits: Edit[] = [];\n const angularRouterNames = new Set<string>();\n let needsInject = false;\n let needsRouteMeta = false;\n let hasNonCallReference = false;\n\n function visit(node: ts.Node): void {\n if (\n ts.isIdentifier(node) &&\n removedBindings.has(node.text) &&\n !ts.isImportSpecifier(node.parent) &&\n !(ts.isCallExpression(node.parent) && node.parent.expression === node)\n ) {\n hasNonCallReference = true;\n }\n if (\n ts.isCallExpression(node) &&\n ts.isIdentifier(node.expression) &&\n removedBindings.has(node.expression.text)\n ) {\n const api = removedBindings.get(node.expression.text)!;\n const callStart = node.getStart(sourceFile);\n if (api === 'defineRouteMeta') {\n const [routeMeta] = node.arguments;\n if (routeMeta) {\n // Strip only the call wrapper so rewrites nested in the argument\n // don't overlap this edit.\n edits.push(\n { start: callStart, end: routeMeta.getStart(sourceFile), text: '' },\n { start: routeMeta.end, end: node.end, text: '' },\n );\n const parent = node.parent;\n if (\n ts.isVariableDeclaration(parent) &&\n parent.initializer === node &&\n !parent.type\n ) {\n edits.push({\n start: parent.name.end,\n end: parent.name.end,\n text: ': RouteMeta',\n });\n needsRouteMeta = true;\n }\n }\n } else {\n const token = INJECT_TOKENS[api];\n edits.push({\n start: callStart,\n end: node.end,\n text: `inject(${token})`,\n });\n needsInject = true;\n angularRouterNames.add(token);\n }\n }\n ts.forEachChild(node, visit);\n }\n visit(sourceFile);\n if (hasNonCallReference) return source;\n\n const routerNames = getImportedNames(sourceFile, ROUTER_PKG);\n edits.push(...promoteTypeOnlyTokens(sourceFile, angularRouterNames));\n const ngRouterNames = getImportedNames(sourceFile, '@angular/router');\n const missingTokens = [...angularRouterNames].filter(\n (name) => !ngRouterNames.has(name),\n );\n const addedImports: string[] = [];\n if (\n needsInject &&\n !getImportedNames(sourceFile, '@angular/core', true).has('inject')\n ) {\n addedImports.push(`import { inject } from '@angular/core';`);\n }\n if (missingTokens.length > 0) {\n addedImports.push(\n `import { ${missingTokens.join(', ')} } from '@angular/router';`,\n );\n }\n\n routerImports.forEach((declaration, index) => {\n const remaining = getImportElements(declaration)\n .filter(\n (element) =>\n !REMOVED_APIS.has((element.propertyName ?? element.name).text),\n )\n .map((element) => element.getText(sourceFile));\n if (index === 0 && needsRouteMeta && !routerNames.has('RouteMeta')) {\n remaining.push('type RouteMeta');\n }\n\n const lines = index === 0 ? [...addedImports] : [];\n if (remaining.length > 0) {\n lines.push(`import { ${remaining.join(', ')} } from '${ROUTER_PKG}';`);\n }\n\n const start = declaration.getStart(sourceFile);\n let end = declaration.end;\n if (lines.length === 0 && source[end] === '\\n') {\n end++;\n }\n edits.push({ start, end, text: lines.join('\\n') });\n });\n\n return applyEdits(source, edits);\n}\n\nexport default function migrateDeprecatedRouterApis(): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const manual: string[] = [];\n const rewritten = rewriteSourceFiles(tree, ROUTER_PKG, (path, source) => {\n const result = migrateRouterSource(path, source);\n if (result === source) manual.push(path);\n return result;\n });\n if (manual.length > 0) {\n context.logger.warn(\n `Migrate the removed @analogjs/router APIs by hand in:\\n${manual\n .map((file) => ` - ${file}`)\n .join('\\n')}\\nSee ${MIGRATION_DOC_URL}`,\n );\n }\n if (rewritten.length > 0) {\n context.logger.info(\n `Replaced removed @analogjs/router APIs (defineRouteMeta, injectRouter, injectActivatedRoute) in:\\n${rewritten\n .map((file) => ` - ${file}`)\n .join('\\n')}\\nSee ${MIGRATION_DOC_URL}`,\n );\n }\n return tree;\n };\n}\n"],"mappings":";;AAQA,SAAgB,WAAW,QAAgB,OAAa;CAEtD,MAAM,SAAS,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK;CAC1D,IAAI,SAAS;CACb,KAAK,MAAM,QAAQ,QACjB,SAAS,OAAO,MAAM,GAAG,KAAK,KAAK,IAAI,KAAK,OAAO,OAAO,MAAM,KAAK,GAAG;CAE1E,OAAO;AACT;AAEA,IAAM,oBAAoB;CAAC;CAAO;CAAQ;CAAQ;AAAM;;AAGxD,SAAgB,mBACd,MACA,QACA,SAA4D;CAE5D,MAAM,YAAsB,C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AK;AACjC;AAEA,SAAwB,8BAA2B;CACjD,QAAQ,MAAY,YAA6B;EAC/C,MAAM,SAAmB,CAAA;EACzB,MAAM,YAAY,mBAAmB,MAAM,aAAa,MAAM,WAAU;GACtE,MAAM,SAAS,oBAAoB,MAAM,MAAM;GAC/C,IAAI,WAAW,QAAQ,OAAO,KAAK,IAAI;GACvC,OAAO;EACT,CAAC;EACD,IAAI,OAAO,SAAS,GAClB,QAAQ,OAAO,KACb,0DAA0D,OACvD,KAAK,SAAS,OAAO,MAAM,CAAC,CAC5B,KAAK,IAAI,EAAC,QAAS,mBAAmB;EAG7C,IAAI,UAAU,SAAS,GACrB,QAAQ,OAAO,KACb,qGAAqG,UAClG,KAAK,SAAS,OAAO,MAAM,CAAC,CAC5B,KAAK,IAAI,EAAC,QAAS,mBAAmB;EAG7C,OAAO;CACT;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"remove-request-context-interceptor.js","names":[],"sources":["../../../migrations/remove-request-context-interceptor/remove-request-context-interceptor.ts"],"sourcesContent":["import type { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\n\nconst INTERCEPTOR = 'requestContextInterceptor';\n\ninterface Edit {\n start: number;\n end: number;\n}\n\ninterface NamedImport {\n declaration: ts.ImportDeclaration;\n bindings: ts.NamedImports;\n}\n\nfunction getNamedImports(sourceFile: ts.SourceFile): NamedImport[] {\n return sourceFile.statements.flatMap((declaration) => {\n const bindings = ts.isImportDeclaration(declaration)\n ? declaration.importClause?.namedBindings\n : undefined;\n return bindings && ts.isNamedImports(bindings)\n ? [{ declaration: declaration as ts.ImportDeclaration, bindings }]\n : [];\n });\n}\n\n/** Local names imported for `exportName` from `moduleName`. */\nfunction getImportNames(\n imports: NamedImport[],\n moduleName: string,\n exportName: string,\n): Set<string> {\n const names = new Set<string>();\n for (const { declaration, bindings } of imports) {\n if (\n !ts.isStringLiteral(declaration.moduleSpecifier) ||\n declaration.moduleSpecifier.text !== moduleName\n ) {\n continue;\n }\n for (const element of bindings.elements) {\n if ((element.propertyName ?? element.name).text === exportName) {\n names.add(element.name.text);\n }\n }\n }\n return names;\n}\n\nfunction isCallTo(\n node: ts.Node,\n names: Set<string>,\n): node is ts.CallExpression {\n return (\n ts.isCallExpression(node) &&\n ts.isIdentifier(node.expression) &&\n names.has(node.expression.text)\n );\n}\n\n/** Removes one element of a comma-separated list along with its separator. */\nfunction removeListElement(\n elements: ts.NodeArray<ts.Node>,\n index: number,\n listEnd: number,\n sourceFile: ts.SourceFile,\n): Edit {\n if (elements.length === 1) {\n return { start: elements.pos, end: listEnd };\n }\n if (index < elements.length - 1) {\n return {\n start: elements[index].getStart(sourceFile),\n end: elements[index + 1].getStart(sourceFile),\n };\n }\n return { start: elements[index - 1].getEnd(), end: elements[index].getEnd() };\n}\n\nfunction countReferences(sourceFile: ts.SourceFile, name: string): number {\n let count = 0;\n function visit(node: ts.Node): void {\n if (ts.isImportDeclaration(node)) return;\n if (ts.isIdentifier(node) && node.text === name) count++;\n ts.forEachChild(node, visit);\n }\n visit(sourceFile);\n return count;\n}\n\n/** Removes the import specifier for `name`, or the whole import if it is the only one. */\nfunction removeImport(\n imports: NamedImport[],\n name: string,\n sourceFile: ts.SourceFile,\n): Edit | undefined {\n for (const { declaration, bindings } of imports) {\n const index = bindings.elements.findIndex((el) => el.name.text === name);\n if (index === -1) continue;\n\n if (bindings.elements.length === 1 && !declaration.importClause?.name) {\n const end = declaration.getEnd();\n return {\n start: declaration.getStart(sourceFile),\n end: sourceFile.text[end] === '\\n' ? end + 1 : end,\n };\n }\n return removeListElement(\n bindings.elements,\n index,\n bindings.getEnd() - 1,\n sourceFile,\n );\n }\n return undefined;\n}\n\nfunction removeFromSource(filePath: string, source: string): string {\n const sourceFile = ts.createSourceFile(\n filePath,\n source,\n ts.ScriptTarget.Latest,\n true,\n );\n const imports = getNamedImports(sourceFile);\n const interceptorNames = getImportNames(\n imports,\n '@analogjs/router',\n INTERCEPTOR,\n );\n if (!interceptorNames.size) return source;\n\n const provideHttpClientNames = getImportNames(\n imports,\n '@angular/common/http',\n 'provideHttpClient',\n );\n const withInterceptorsNames = getImportNames(\n imports,\n '@angular/common/http',\n 'withInterceptors',\n );\n\n const edits: Edit[] = [];\n const removed = new Map<string, number>();\n const markRemoved = (name: string) =>\n removed.set(name, (removed.get(name) ?? 0) + 1);\n\n function visit(node: ts.Node): void {\n if (isCallTo(node, provideHttpClientNames)) {\n node.arguments.forEach((arg, argIndex) => {\n if (!isCallTo(arg, withInterceptorsNames)) return;\n const [interceptors] = arg.arguments;\n if (!interceptors || !ts.isArrayLiteralExpression(interceptors)) return;\n\n const index = interceptors.elements.findIndex(\n (el) => ts.isIdentifier(el) && interceptorNames.has(el.text),\n );\n if (index === -1) return;\n\n markRemoved((interceptors.elements[index] as ts.Identifier).text);\n if (interceptors.elements.length === 1) {\n markRemoved((arg.expression as ts.Identifier).text);\n edits.push(\n removeListElement(\n node.arguments,\n argIndex,\n node.getEnd() - 1,\n sourceFile,\n ),\n );\n } else {\n edits.push(\n removeListElement(\n interceptors.elements,\n index,\n interceptors.getEnd() - 1,\n sourceFile,\n ),\n );\n }\n });\n }\n ts.forEachChild(node, visit);\n }\n visit(sourceFile);\n\n for (const [name, count] of removed) {\n if (countReferences(sourceFile, name) === count) {\n const edit = removeImport(imports, name, sourceFile);\n if (edit) edits.push(edit);\n }\n }\n\n let result = source;\n for (const edit of edits.sort((a, b) => b.start - a.start)) {\n result = result.slice(0, edit.start) + result.slice(edit.end);\n }\n return result;\n}\n\nexport default function removeRequestContextInterceptor(): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const updatedFiles: string[] = [];\n const remainingFiles: string[] = [];\n\n tree.visit((filePath) => {\n if (filePath.includes('/node_modules/') || !filePath.endsWith('.ts')) {\n return;\n }\n const source = tree.read(filePath)?.toString('utf-8');\n if (!source?.includes(INTERCEPTOR)) return;\n\n const result = removeFromSource(filePath, source);\n if (result !== source) {\n tree.overwrite(filePath, result);\n updatedFiles.push(filePath);\n }\n if (result.includes(INTERCEPTOR)) {\n remainingFiles.push(filePath);\n }\n });\n\n if (updatedFiles.length) {\n context.logger.info(\n `Removed requestContextInterceptor, now registered by provideFileRouter(), from: ${updatedFiles.join(', ')}`,\n );\n }\n if (remainingFiles.length) {\n context.logger.warn(\n `requestContextInterceptor is still referenced in: ${remainingFiles.join(', ')}. ` +\n 'provideFileRouter() now registers it automatically, so remove any manual registration.',\n );\n }\n\n return tree;\n };\n}\n"],"mappings":";;AAGA,IAAM,cAAc;AAYpB,SAAS,gBAAgB,YAAyB;AAChD,QAAO,WAAW,WAAW,SAAS,gBAAe;EACnD,MAAM,WAAW,GAAG,oBAAoB,YAAY,GAChD,YAAY,cAAc,gBAC1B,KAAA;AACJ,SAAO,YAAY,GAAG,eAAe,SAAS,GAC1C,CAAC;GAAe;GAAqC;GAAU,CAAC,GAChE,EAAE;GACN;;;AAIJ,SAAS,eACP,SACA,YACA,YAAkB;CAElB,MAAM,wBAAQ,IAAI,KAAa;AAC/B,MAAK,MAAM,EAAE,aAAa,cAAc,SAAS;AAC/C,MACE,CAAC,GAAG,gBAAgB,YAAY,gBAAgB,IAChD,YAAY,gBAAgB,SAAS,WAErC;AAEF,OAAK,MAAM,WAAW,SAAS,SAC7B,MAAK,QAAQ,gBAAgB,QAAQ,MAAM,SAAS,WAClD,OAAM,IAAI,QAAQ,KAAK,KAAK;;AAIlC,QAAO;;AAGT,SAAS,SACP,MACA,OAAkB;AAElB,QACE,GAAG,iBAAiB,KAAK,IACzB,GAAG,aAAa,KAAK,WAAW,IAChC,MAAM,IAAI,KAAK,WAAW,KAAK;;;AAKnC,SAAS,kBACP,UACA,OACA,SACA,YAAyB;AAEzB,KAAI,SAAS,WAAW,EACtB,QAAO;EAAE,OAAO,SAAS;EAAK,KAAK;EAAS;AAE9C,KAAI,QAAQ,SAAS,SAAS,EAC5B,QAAO;EACL,OAAO,SAAS,OAAO,SAAS,WAAW;EAC3C,KAAK,SAAS,QAAQ,GAAG,SAAS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AACrD,OAAI,CAAC,QAAQ,SAAS,YAAY,CAAE;GAEpC,MAAM,SAAS,iBAAiB,UAAU,OAAO;AACjD,OAAI,WAAW,QAAQ;AACrB,SAAK,UAAU,UAAU,OAAO;AAChC,iBAAa,KAAK,SAAS;;AAE7B,OAAI,OAAO,SAAS,YAAY,CAC9B,gBAAe,KAAK,SAAS;IAE/B;AAEF,MAAI,aAAa,OACf,SAAQ,OAAO,KACb,mFAAmF,aAAa,KAAK,KAAK,GAC3G;AAEH,MAAI,eAAe,OACjB,SAAQ,OAAO,KACb,qDAAqD,eAAe,KAAK,KAAK,CAAA,0FAE/E;AAGH,SAAO"}
1
+ {"version":3,"file":"remove-request-context-interceptor.js","names":[],"sources":["../../../migrations/remove-request-context-interceptor/remove-request-context-interceptor.ts"],"sourcesContent":["import type { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\n\nconst INTERCEPTOR = 'requestContextInterceptor';\n\ninterface Edit {\n start: number;\n end: number;\n}\n\ninterface NamedImport {\n declaration: ts.ImportDeclaration;\n bindings: ts.NamedImports;\n}\n\nfunction getNamedImports(sourceFile: ts.SourceFile): NamedImport[] {\n return sourceFile.statements.flatMap((declaration) => {\n const bindings = ts.isImportDeclaration(declaration)\n ? declaration.importClause?.namedBindings\n : undefined;\n return bindings && ts.isNamedImports(bindings)\n ? [{ declaration: declaration as ts.ImportDeclaration, bindings }]\n : [];\n });\n}\n\n/** Local names imported for `exportName` from `moduleName`. */\nfunction getImportNames(\n imports: NamedImport[],\n moduleName: string,\n exportName: string,\n): Set<string> {\n const names = new Set<string>();\n for (const { declaration, bindings } of imports) {\n if (\n !ts.isStringLiteral(declaration.moduleSpecifier) ||\n declaration.moduleSpecifier.text !== moduleName\n ) {\n continue;\n }\n for (const element of bindings.elements) {\n if ((element.propertyName ?? element.name).text === exportName) {\n names.add(element.name.text);\n }\n }\n }\n return names;\n}\n\nfunction isCallTo(\n node: ts.Node,\n names: Set<string>,\n): node is ts.CallExpression {\n return (\n ts.isCallExpression(node) &&\n ts.isIdentifier(node.expression) &&\n names.has(node.expression.text)\n );\n}\n\n/** Removes one element of a comma-separated list along with its separator. */\nfunction removeListElement(\n elements: ts.NodeArray<ts.Node>,\n index: number,\n listEnd: number,\n sourceFile: ts.SourceFile,\n): Edit {\n if (elements.length === 1) {\n return { start: elements.pos, end: listEnd };\n }\n if (index < elements.length - 1) {\n return {\n start: elements[index].getStart(sourceFile),\n end: elements[index + 1].getStart(sourceFile),\n };\n }\n return { start: elements[index - 1].getEnd(), end: elements[index].getEnd() };\n}\n\nfunction countReferences(sourceFile: ts.SourceFile, name: string): number {\n let count = 0;\n function visit(node: ts.Node): void {\n if (ts.isImportDeclaration(node)) return;\n if (ts.isIdentifier(node) && node.text === name) count++;\n ts.forEachChild(node, visit);\n }\n visit(sourceFile);\n return count;\n}\n\n/** Removes the import specifier for `name`, or the whole import if it is the only one. */\nfunction removeImport(\n imports: NamedImport[],\n name: string,\n sourceFile: ts.SourceFile,\n): Edit | undefined {\n for (const { declaration, bindings } of imports) {\n const index = bindings.elements.findIndex((el) => el.name.text === name);\n if (index === -1) continue;\n\n if (bindings.elements.length === 1 && !declaration.importClause?.name) {\n const end = declaration.getEnd();\n return {\n start: declaration.getStart(sourceFile),\n end: sourceFile.text[end] === '\\n' ? end + 1 : end,\n };\n }\n return removeListElement(\n bindings.elements,\n index,\n bindings.getEnd() - 1,\n sourceFile,\n );\n }\n return undefined;\n}\n\nfunction removeFromSource(filePath: string, source: string): string {\n const sourceFile = ts.createSourceFile(\n filePath,\n source,\n ts.ScriptTarget.Latest,\n true,\n );\n const imports = getNamedImports(sourceFile);\n const interceptorNames = getImportNames(\n imports,\n '@analogjs/router',\n INTERCEPTOR,\n );\n if (!interceptorNames.size) return source;\n\n const provideHttpClientNames = getImportNames(\n imports,\n '@angular/common/http',\n 'provideHttpClient',\n );\n const withInterceptorsNames = getImportNames(\n imports,\n '@angular/common/http',\n 'withInterceptors',\n );\n\n const edits: Edit[] = [];\n const removed = new Map<string, number>();\n const markRemoved = (name: string) =>\n removed.set(name, (removed.get(name) ?? 0) + 1);\n\n function visit(node: ts.Node): void {\n if (isCallTo(node, provideHttpClientNames)) {\n node.arguments.forEach((arg, argIndex) => {\n if (!isCallTo(arg, withInterceptorsNames)) return;\n const [interceptors] = arg.arguments;\n if (!interceptors || !ts.isArrayLiteralExpression(interceptors)) return;\n\n const index = interceptors.elements.findIndex(\n (el) => ts.isIdentifier(el) && interceptorNames.has(el.text),\n );\n if (index === -1) return;\n\n markRemoved((interceptors.elements[index] as ts.Identifier).text);\n if (interceptors.elements.length === 1) {\n markRemoved((arg.expression as ts.Identifier).text);\n edits.push(\n removeListElement(\n node.arguments,\n argIndex,\n node.getEnd() - 1,\n sourceFile,\n ),\n );\n } else {\n edits.push(\n removeListElement(\n interceptors.elements,\n index,\n interceptors.getEnd() - 1,\n sourceFile,\n ),\n );\n }\n });\n }\n ts.forEachChild(node, visit);\n }\n visit(sourceFile);\n\n for (const [name, count] of removed) {\n if (countReferences(sourceFile, name) === count) {\n const edit = removeImport(imports, name, sourceFile);\n if (edit) edits.push(edit);\n }\n }\n\n let result = source;\n for (const edit of edits.sort((a, b) => b.start - a.start)) {\n result = result.slice(0, edit.start) + result.slice(edit.end);\n }\n return result;\n}\n\nexport default function removeRequestContextInterceptor(): Rule {\n return (tree: Tree, context: SchematicContext) => {\n const updatedFiles: string[] = [];\n const remainingFiles: string[] = [];\n\n tree.visit((filePath) => {\n if (filePath.includes('/node_modules/') || !filePath.endsWith('.ts')) {\n return;\n }\n const source = tree.read(filePath)?.toString('utf-8');\n if (!source?.includes(INTERCEPTOR)) return;\n\n const result = removeFromSource(filePath, source);\n if (result !== source) {\n tree.overwrite(filePath, result);\n updatedFiles.push(filePath);\n }\n if (result.includes(INTERCEPTOR)) {\n remainingFiles.push(filePath);\n }\n });\n\n if (updatedFiles.length) {\n context.logger.info(\n `Removed requestContextInterceptor, now registered by provideFileRouter(), from: ${updatedFiles.join(', ')}`,\n );\n }\n if (remainingFiles.length) {\n context.logger.warn(\n `requestContextInterceptor is still referenced in: ${remainingFiles.join(', ')}. ` +\n 'provideFileRouter() now registers it automatically, so remove any manual registration.',\n );\n }\n\n return tree;\n };\n}\n"],"mappings":";;AAGA,IAAM,cAAc;AAYpB,SAAS,gBAAgB,YAAyB;CAChD,OAAO,WAAW,WAAW,SAAS,gBAAe;EACnD,MAAM,WAAW,GAAG,oBAAoB,WAAW,IAC/C,YAAY,cAAc,gBAC1B,KAAA;EACJ,OAAO,YAAY,GAAG,eAAe,QAAQ,IACzC,CAAC;GAAe;GAAqC;EAAQ,CAAE,IAC/D,CAAA;CACN,CAAC;AACH;;AAGA,SAAS,eACP,SACA,YACA,YAAkB;CAElB,MAAM,wBAAQ,IAAI,IAAG;CACrB,KAAK,MAAM,EAAE,aAAa,cAAc,SAAS;EAC/C,IACE,CAAC,GAAG,gBAAgB,YAAY,eAAe,KAC/C,YAAY,gBAAgB,SAAS,YAErC;EAEF,KAAK,MAAM,WAAW,SAAS,UAC7B,KAAK,QAAQ,gBAAgB,QAAQ,KAAA,CAAM,SAAS,YAClD,MAAM,IAAI,QAAQ,KAAK,IAAI;CAGjC;CACA,OAAO;AACT;AAEA,SAAS,SACP,MACA,OAAkB;CAElB,OACE,GAAG,iBAAiB,IAAI,KACxB,GAAG,aAAa,KAAK,UAAU,KAC/B,MAAM,IAAI,KAAK,WAAW,IAAI;AAElC;;AAGA,SAAS,kBACP,UACA,OACA,SACA,YAAyB;CAEzB,IAAI,SAAS,WAAW,GACtB,OAAO;EAAE,OAAO,SAAS;EAAK,KAAK;CAAO;CAE5C,IAAI,QAAQ,SAAS,SAAS,GAC5B,OAAO;EACL,OAAO,SAAS,MAAM,CAAC,SAAS,UAAU;EAC1C,KAAK,SAAS,QAAQ,EAAE,CAAC,SAAS,UAAU;CAC7C;CAEH,OAAO;EAAE,OAAO,SAAS,QAAQ,EAAE,CAAC,OAAM;EAAI,KAAK,SAAS,MAAM,CAAC,OA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AQ,SAAS,WAAW,GAAG;GAEpC,MAAM,SAAS,iBAAiB,UAAU,MAAM;GAChD,IAAI,WAAW,QAAQ;IACrB,KAAK,UAAU,UAAU,MAAM;IAC/B,aAAa,KAAK,QAAQ;GAC5B;GACA,IAAI,OAAO,SAAS,WAAW,GAC7B,eAAe,KAAK,QAAQ;EAEhC,CAAC;EAED,IAAI,aAAa,QACf,QAAQ,OAAO,KACb,mFAAmF,aAAa,KAAK,IAAI,GAAG;EAGhH,IAAI,eAAe,QACjB,QAAQ,OAAO,KACb,qDAAqD,eAAe,KAAK,IAAI,EAAC,yFACY;EAI9F,OAAO;CACT;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@analogjs/router",
3
- "version": "3.0.0-alpha.99",
3
+ "version": "3.0.0-beta.10",
4
4
  "description": "Filesystem-based routing for Angular",
5
5
  "type": "module",
6
6
  "author": "Brandon Roberts <robertsbt@gmail.com>",
@@ -69,7 +69,7 @@
69
69
  "url": "https://github.com/sponsors/brandonroberts"
70
70
  },
71
71
  "peerDependencies": {
72
- "@analogjs/content": "3.0.0-alpha.99",
72
+ "@analogjs/content": "3.0.0-beta.10",
73
73
  "@angular/core": "^20.0.0 || ^21.0.0 || ^22.0.0",
74
74
  "@angular/platform-server": "^20.0.0 || ^21.0.0 || ^22.0.0",
75
75
  "@angular/router": "^20.0.0 || ^21.0.0 || ^22.0.0",
@@ -105,8 +105,8 @@
105
105
  "tslib": "^2.3.0"
106
106
  },
107
107
  "devDependencies": {
108
- "@analogjs/vite-plugin-angular": "3.0.0-alpha.99",
109
- "@analogjs/vitest-angular": "3.0.0-alpha.99"
108
+ "@analogjs/vite-plugin-angular": "3.0.0-beta.10",
109
+ "@analogjs/vitest-angular": "3.0.0-beta.10"
110
110
  },
111
111
  "ng-update": {
112
112
  "packageGroup": [
@@ -1,2 +1,3 @@
1
+ import { type ContentFileLoader } from '@analogjs/content';
1
2
  import type { RouteExport } from '../../../src/lib/models';
2
- export declare function toMarkdownModule(markdownFileFactory: () => Promise<string>): () => Promise<RouteExport>;
3
+ export declare function toMarkdownModule(markdownFileFactory: ContentFileLoader): () => Promise<RouteExport>;
@@ -1,8 +1,9 @@
1
1
  import type { Route } from '@angular/router';
2
+ import type { ContentFileModule } from '@analogjs/content';
2
3
  import type { RouteExport } from '../../../src/lib/models';
3
4
  /**
4
5
  * This variable reference is replaced with a glob of all content routes.
5
6
  */
6
7
  export declare const ANALOG_CONTENT_ROUTE_FILES: {};
7
- export type Files = Record<string, () => Promise<RouteExport | string>>;
8
+ export type Files = Record<string, () => Promise<RouteExport | string | ContentFileModule>>;
8
9
  export declare function createContentRoutes(files: Files, debug?: boolean): Route[];