@absolutejs/absolute 0.19.0-beta.952 → 0.19.0-beta.953

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ import type { SpaRouteEntry } from '../utils/spaRouteEnumeration';
2
+ /** Reads the `Routes` arrays captured for any `provideRouter(...)` call
3
+ * in `pageModule.providers` (compile-time rewrite records them) and
4
+ * walks them, eagerly resolving `loadChildren`. Returns one entry per
5
+ * leaf, with paths relative to the page's mount point. */
6
+ export declare const enumerateAngularSpaRoutes: (pageModule: unknown) => Promise<SpaRouteEntry[]>;
@@ -4,6 +4,7 @@ export { ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER, buildAbsoluteHttpTransferCach
4
4
  export { createDeterministicRandom, DETERMINISTIC_NOW, DETERMINISTIC_RANDOM, DETERMINISTIC_SEED, provideDeterministicEnv } from './deterministicEnv';
5
5
  export { handleAngularPageRequest } from './pageHandler';
6
6
  export { defineAngularPage } from './page';
7
+ export { __abs_provideRouter } from './internal/captureProvideRouter';
7
8
  export { preserveAcrossHmr } from './preserveAcrossHmr';
8
9
  export { withPendingTask } from './pendingTask';
9
10
  export { createTypedIsland } from './createIsland';
@@ -0,0 +1,11 @@
1
+ import { provideRouter, type Routes } from '@angular/router';
2
+ /** Runtime shim installed by AbsoluteJS's compile-time rewrite. User
3
+ * code in Angular pages calls `provideRouter(routes, ...features)`
4
+ * as usual; the compile pipeline rewrites those call sites to call
5
+ * this wrapper instead, which delegates to the real `provideRouter`
6
+ * and records the route table for sitemap enumeration. */
7
+ export declare const __abs_provideRouter: (routes: Routes, ...features: Parameters<typeof provideRouter> extends [Routes, ...infer F] ? F : unknown[]) => unknown;
8
+ /** Look up the `Routes` array captured for a given `EnvironmentProviders`
9
+ * entry from `provideRouter`. Returns `undefined` for any other provider
10
+ * shape. */
11
+ export declare const getRoutesForProviders: (providers: unknown) => Routes | undefined;
@@ -0,0 +1,5 @@
1
+ /** Returns the source with `provideRouter(...)` calls rewritten to use
2
+ * AbsoluteJS's capturing shim. Idempotent: returns the source unchanged
3
+ * when no `@angular/router` import is present or when the shim has
4
+ * already been injected. */
5
+ export declare const rewriteAngularProvideRouter: (source: string) => string;
@@ -1,6 +1,12 @@
1
1
  import type { SitemapConfig } from '../../types/sitemap';
2
- export declare const generateSitemap: (routes: {
2
+ type AppRoute = {
3
3
  method: string;
4
4
  path: string;
5
5
  handler?: unknown;
6
- }[], serverUrl: string, outDir: string, config?: SitemapConfig) => Promise<void>;
6
+ };
7
+ type AppLike = {
8
+ routes: AppRoute[];
9
+ handle: (request: Request) => Promise<Response>;
10
+ };
11
+ export declare const generateSitemap: (app: AppLike, serverUrl: string, outDir: string, config?: SitemapConfig) => Promise<void>;
12
+ export {};
@@ -0,0 +1,23 @@
1
+ export type SpaRouteSitemap = 'exclude' | 'include' | {
2
+ priority?: number;
3
+ changefreq?: 'always' | 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly' | 'never';
4
+ lastmod?: string;
5
+ };
6
+ export type SpaRouteEntry = {
7
+ /** Path relative to the page's mount point (no leading slash needed). */
8
+ path: string;
9
+ /** True when any segment is `:param`, `*`, or `**`. */
10
+ dynamic?: boolean;
11
+ /** Optional sitemap metadata read off `Route.data.sitemap`. */
12
+ sitemap?: SpaRouteSitemap;
13
+ };
14
+ /** True when the current async context is collecting SPA routes. Framework
15
+ * page handlers should short-circuit their SSR pipeline when this is set
16
+ * and instead call `recordSpaRoutes` with the page's enumerated routes. */
17
+ export declare const isCollectingSpaRoutes: () => boolean;
18
+ /** Push enumerated routes into the active collection. No-op when called
19
+ * outside a `collectSpaRoutes` scope. */
20
+ export declare const recordSpaRoutes: (entries: SpaRouteEntry[]) => void;
21
+ /** Run `task` with an active SPA-route collection scope and return whatever
22
+ * routes were recorded inside it. */
23
+ export declare const collectSpaRoutes: (task: () => Promise<unknown>) => Promise<SpaRouteEntry[]>;
@@ -18,6 +18,15 @@ export type AngularDeps = {
18
18
  };
19
19
  export type AngularPageDefinition<Props extends Record<string, unknown> = Record<never, never>> = {
20
20
  component: import('@angular/core').Type<unknown>;
21
+ /**
22
+ * Optional SPA route configuration for this page. When provided,
23
+ * the sitemap pipeline walks it (eagerly resolving `loadChildren`)
24
+ * and emits one entry per non-dynamic leaf, prefixed by the
25
+ * Elysia mount path. Pass the same `Routes` array given to
26
+ * `provideRouter(...)` so the single source of truth stays in
27
+ * user code.
28
+ */
29
+ routes?: import('@angular/router').Routes;
21
30
  /** Type-only marker used by handleAngularPageRequest to infer route props. */
22
31
  __absoluteAngularPageProps?: Props;
23
32
  };
package/package.json CHANGED
@@ -401,5 +401,5 @@
401
401
  ]
402
402
  }
403
403
  },
404
- "version": "0.19.0-beta.952"
404
+ "version": "0.19.0-beta.953"
405
405
  }