66 * found in the LICENSE file at https://angular.dev/license
77 */
88
9- import { ApplicationRef , Type } from '@angular/core' ;
109import type { AngularServerApp } from './app' ;
10+ import type { SerializableRouteTreeNode } from './routes/route-tree' ;
11+ import { AngularBootstrap } from './utils/ng' ;
1112
1213/**
1314 * Manifest for the Angular server application engine, defining entry points.
1415 */
1516export interface AngularAppEngineManifest {
1617 /**
1718 * A map of entry points for the server application.
18- * Each entry consists of:
19- * - `key`: The base href.
19+ * Each entry in the map consists of:
20+ * - `key`: The base href for the entry point .
2021 * - `value`: A function that returns a promise resolving to an object containing the `AngularServerApp` type.
2122 */
22- entryPoints : Map < string , ( ) => Promise < { AngularServerApp : typeof AngularServerApp } > > ;
23+ readonly entryPoints : Readonly <
24+ Map < string , ( ) => Promise < { AngularServerApp : typeof AngularServerApp } > >
25+ > ;
2326
2427 /**
2528 * The base path for the server application.
29+ * This is used to determine the root path of the application.
2630 */
27- basePath : string ;
31+ readonly basePath : string ;
2832}
2933
3034/**
@@ -33,33 +37,42 @@ export interface AngularAppEngineManifest {
3337export interface AngularAppManifest {
3438 /**
3539 * A record of assets required by the server application.
36- * Each entry consists of:
40+ * Each entry in the record consists of:
3741 * - `key`: The path of the asset.
38- * - `value`: A function returning a promise that resolves to the file contents.
42+ * - `value`: A function returning a promise that resolves to the file contents of the asset .
3943 */
40- assets : Record < string , ( ) => Promise < string > > ;
44+ readonly assets : Readonly < Record < string , ( ) => Promise < string > > > ;
4145
4246 /**
4347 * The bootstrap mechanism for the server application.
4448 * A function that returns a reference to an NgModule or a function returning a promise that resolves to an ApplicationRef.
4549 */
46- bootstrap : ( ) => Type < unknown > | ( ( ) => Promise < ApplicationRef > ) ;
50+ readonly bootstrap : ( ) => AngularBootstrap ;
4751
4852 /**
49- * Indicates whether critical CSS should be inlined.
53+ * Indicates whether critical CSS should be inlined into the HTML.
54+ * If set to `true`, critical CSS will be inlined for faster page rendering.
5055 */
51- inlineCriticalCss ?: boolean ;
56+ readonly inlineCriticalCss ?: boolean ;
57+
58+ /**
59+ * The route tree representation for the routing configuration of the application.
60+ * This represents the routing information of the application, mapping route paths to their corresponding metadata.
61+ * It is used for route matching and navigation within the server application.
62+ */
63+ readonly routes ?: SerializableRouteTreeNode ;
5264}
5365
5466/**
55- * Angular app manifest object.
67+ * The Angular app manifest object.
68+ * This is used internally to store the current Angular app manifest.
5669 */
5770let angularAppManifest : AngularAppManifest | undefined ;
5871
5972/**
6073 * Sets the Angular app manifest.
6174 *
62- * @param manifest - The manifest object to set.
75+ * @param manifest - The manifest object to set for the Angular application .
6376 */
6477export function setAngularAppManifest ( manifest : AngularAppManifest ) : void {
6578 angularAppManifest = manifest ;
@@ -74,7 +87,7 @@ export function setAngularAppManifest(manifest: AngularAppManifest): void {
7487export function getAngularAppManifest ( ) : AngularAppManifest {
7588 if ( ! angularAppManifest ) {
7689 throw new Error (
77- 'Angular app manifest is not set.' +
90+ 'Angular app manifest is not set. ' +
7891 `Please ensure you are using the '@angular/build:application' builder to build your server application.` ,
7992 ) ;
8093 }
@@ -83,7 +96,8 @@ export function getAngularAppManifest(): AngularAppManifest {
8396}
8497
8598/**
86- * Angular app engine manifest object.
99+ * The Angular app engine manifest object.
100+ * This is used internally to store the current Angular app engine manifest.
87101 */
88102let angularAppEngineManifest : AngularAppEngineManifest | undefined ;
89103
@@ -105,7 +119,7 @@ export function setAngularAppEngineManifest(manifest: AngularAppEngineManifest):
105119export function getAngularAppEngineManifest ( ) : AngularAppEngineManifest {
106120 if ( ! angularAppEngineManifest ) {
107121 throw new Error (
108- 'Angular app engine manifest is not set.' +
122+ 'Angular app engine manifest is not set. ' +
109123 `Please ensure you are using the '@angular/build:application' builder to build your server application.` ,
110124 ) ;
111125 }
0 commit comments