@absolutejs/absolute 0.19.0-beta.967 → 0.19.0-beta.969
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +156 -102
- package/dist/angular/index.js.map +7 -6
- package/dist/angular/server.js +156 -102
- package/dist/angular/server.js.map +7 -6
- package/dist/build.js +1559 -995
- package/dist/build.js.map +10 -5
- package/dist/index.js +1605 -1041
- package/dist/index.js.map +10 -5
- package/dist/src/angular/loadRouteMounts.d.ts +3 -0
- package/dist/src/angular/pageHandler.d.ts +9 -0
- package/dist/src/build/emitAngularProvidersFiles.d.ts +19 -0
- package/dist/src/build/emitAngularRouteMounts.d.ts +3 -0
- package/dist/src/build/runAngularHandlerScan.d.ts +12 -0
- package/dist/src/build/scanAngularHandlerCalls.d.ts +35 -0
- package/dist/src/build/scanAngularPageRoutes.d.ts +14 -0
- package/dist/types/angular.d.ts +11 -0
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { EnvironmentProviders, Provider } from '@angular/core';
|
|
1
2
|
import { type StreamingSlotEnhancerOptions } from '../core/responseEnhancers';
|
|
2
3
|
type AngularPageRenderOptions = StreamingSlotEnhancerOptions & {
|
|
3
4
|
collectStreamingSlots?: boolean;
|
|
@@ -18,6 +19,14 @@ export type AngularPageRequestInput<Ctx = unknown> = AngularPageRenderOptions &
|
|
|
18
19
|
request?: Request;
|
|
19
20
|
/** Mutable response init made available through Angular's RESPONSE_INIT token. */
|
|
20
21
|
responseInit?: ResponseInit;
|
|
22
|
+
/** Page-level Angular providers — `appProviders` for the typical case,
|
|
23
|
+
* `[...appProviders, provideRouter(routes)]` for sub-router pages, etc.
|
|
24
|
+
* These flow into `bootstrapApplication` at SSR. The framework's
|
|
25
|
+
* build pass (`runAngularHandlerScan`) reads the same expression
|
|
26
|
+
* via static AST analysis and emits a matching providers module the
|
|
27
|
+
* client bundle imports, so SSR and client bootstrap with identical
|
|
28
|
+
* DI trees without the page module exporting `providers`. */
|
|
29
|
+
providers?: ReadonlyArray<Provider | EnvironmentProviders>;
|
|
21
30
|
/** Sitemap metadata for this route. Statically read from the handler
|
|
22
31
|
* source at registration time, so only literal-object values are
|
|
23
32
|
* honoured. For finer control use `Route.data.sitemap` in the
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AngularHandlerCall } from './scanAngularHandlerCalls';
|
|
2
|
+
import { type AngularPageRoutes } from './scanAngularPageRoutes';
|
|
3
|
+
export type EmittedProvidersFile = {
|
|
4
|
+
manifestKey: string;
|
|
5
|
+
/** Absolute path to the emitted file. */
|
|
6
|
+
outputPath: string;
|
|
7
|
+
/** The mount path (e.g. `/portal/`) the generated file derived
|
|
8
|
+
* APP_BASE_HREF from, or null when the call wasn't inside a
|
|
9
|
+
* sub-router route. */
|
|
10
|
+
basePath: string | null;
|
|
11
|
+
/** `true` when the call carried a `providers:` argument. */
|
|
12
|
+
hasProviders: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare const emitAngularProvidersFiles: (projectRoot: string, calls: AngularHandlerCall[], pageRoutes: AngularPageRoutes[]) => EmittedProvidersFile[];
|
|
15
|
+
/** Absolute path of the directory the emitter writes to. Exposed so other
|
|
16
|
+
* build steps (`compileAngular`'s client wrapper, the SSR `pageHandler`)
|
|
17
|
+
* can compute relative paths to the generated files without hard-coding
|
|
18
|
+
* the convention. */
|
|
19
|
+
export declare const getProvidersOutputDir: (projectRoot: string) => string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type EmittedProvidersFile } from './emitAngularProvidersFiles';
|
|
2
|
+
import { type AngularHandlerCall } from './scanAngularHandlerCalls';
|
|
3
|
+
import { type AngularPageRoutes } from './scanAngularPageRoutes';
|
|
4
|
+
export type AngularHandlerScanResult = {
|
|
5
|
+
calls: AngularHandlerCall[];
|
|
6
|
+
pageRoutes: AngularPageRoutes[];
|
|
7
|
+
providersFiles: EmittedProvidersFile[];
|
|
8
|
+
/** Set of manifest keys that have a generated providers file the
|
|
9
|
+
* client bundle can import. */
|
|
10
|
+
manifestKeysWithProviders: Set<string>;
|
|
11
|
+
};
|
|
12
|
+
export declare const runAngularHandlerScan: (projectRoot: string, angularDirectory: string) => AngularHandlerScanResult;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type ImportSpec = {
|
|
2
|
+
/** Local name as used inside the providers expression. */
|
|
3
|
+
localName: string;
|
|
4
|
+
/** Original exported name (matches localName unless the source used `as`). */
|
|
5
|
+
importedName: string;
|
|
6
|
+
/** `true` when the import was a default import (`import foo from "..."`). */
|
|
7
|
+
isDefault: boolean;
|
|
8
|
+
/** Module specifier as written in the source — could be a bare package
|
|
9
|
+
* name (`@angular/router`) or a path (`./foo`, `../../utils/x`). The
|
|
10
|
+
* path forms are resolved to absolute file paths by `resolvedAbsPath`. */
|
|
11
|
+
source: string;
|
|
12
|
+
/** Absolute path the source resolves to, or `null` for bare specifiers
|
|
13
|
+
* (`@angular/router`, `firebase/auth`, …) which the generated file
|
|
14
|
+
* will re-import by the same bare specifier. */
|
|
15
|
+
resolvedAbsPath: string | null;
|
|
16
|
+
};
|
|
17
|
+
export type AngularHandlerCall = {
|
|
18
|
+
/** File the call lives in. */
|
|
19
|
+
sourceFile: string;
|
|
20
|
+
/** Manifest key extracted from `pagePath: asset(manifest, "Foo")`. */
|
|
21
|
+
manifestKey: string;
|
|
22
|
+
/** Verbatim source text of the `providers:` argument expression, or
|
|
23
|
+
* `null` if the call didn't include one. */
|
|
24
|
+
providersExpr: string | null;
|
|
25
|
+
/** Imports from the source file that the `providers:` expression refers
|
|
26
|
+
* to. Empty array when `providersExpr` is null. */
|
|
27
|
+
providerImports: ImportSpec[];
|
|
28
|
+
/** Mount path from the surrounding `.get("/path", ...)` / `.post(...)`
|
|
29
|
+
* Elysia chain. `null` when the call isn't directly inside such a
|
|
30
|
+
* registration (rare but possible — e.g. inside a helper function). */
|
|
31
|
+
mountPath: string | null;
|
|
32
|
+
};
|
|
33
|
+
/** Walk every TypeScript file under `projectRoot` and return all
|
|
34
|
+
* `handleAngularPageRequest({...})` calls found. */
|
|
35
|
+
export declare const scanAngularHandlerCalls: (projectRoot: string) => AngularHandlerCall[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type AngularPageRoutes = {
|
|
2
|
+
/** Absolute path of the page module. */
|
|
3
|
+
pageFile: string;
|
|
4
|
+
/** Manifest key (PascalCase of basename) — `home/home.ts` → `Home`. */
|
|
5
|
+
manifestKey: string;
|
|
6
|
+
/** True when the page module top-level declares
|
|
7
|
+
* `export const routes` (or `let`/`var`). */
|
|
8
|
+
hasRoutes: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const scanAngularPageRoutes: (pagesRoot: string) => AngularPageRoutes[];
|
|
11
|
+
/** Path the emitter uses as the import source for the page's routes —
|
|
12
|
+
* relative from the generated providers file (under
|
|
13
|
+
* `.absolutejs/generated/angular/providers/`) back to the page module. */
|
|
14
|
+
export declare const relativeRoutesImport: (emittedFromDir: string, pageFile: string) => string;
|
package/dist/types/angular.d.ts
CHANGED
|
@@ -27,3 +27,14 @@ export type CachedRouteData = {
|
|
|
27
27
|
requestContext: unknown;
|
|
28
28
|
headTag: `<head>${string}</head>`;
|
|
29
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* One entry in the build-emitted route-mounts map. The SSR handler
|
|
32
|
+
* tests each request URL against `pattern` and uses the matching
|
|
33
|
+
* `basePath` as `APP_BASE_HREF` so sub-router pages (mounted at
|
|
34
|
+
* `/portal/*`, `/admin/*`, etc.) get the right router base without
|
|
35
|
+
* the page explicitly overriding it.
|
|
36
|
+
*/
|
|
37
|
+
export type AngularRouteMount = {
|
|
38
|
+
pattern: RegExp;
|
|
39
|
+
basePath: string;
|
|
40
|
+
};
|
package/package.json
CHANGED