@angular/ssr 19.0.0-next.3 → 19.0.0-next.4
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/fesm2022/node.mjs +114 -55
- package/fesm2022/node.mjs.map +1 -1
- package/fesm2022/ssr.mjs +27 -31
- package/fesm2022/ssr.mjs.map +1 -1
- package/index.d.ts +78 -98
- package/node/index.d.ts +55 -0
- package/package.json +1 -1
- package/third_party/critters/THIRD_PARTY_LICENSES.txt +0 -24
- package/third_party/critters/index.js +62 -59
- package/third_party/critters/index.js.map +3 -3
package/index.d.ts
CHANGED
|
@@ -2,6 +2,68 @@ import type { ApplicationRef } from '@angular/core';
|
|
|
2
2
|
import { default as default_2 } from 'critters';
|
|
3
3
|
import type { Type } from '@angular/core';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Angular server application engine.
|
|
7
|
+
* Manages Angular server applications (including localized ones), handles rendering requests,
|
|
8
|
+
* and optionally transforms index HTML before rendering.
|
|
9
|
+
*
|
|
10
|
+
* @note This class should be instantiated once and used as a singleton across the server-side
|
|
11
|
+
* application to ensure consistent handling of rendering requests and resource management.
|
|
12
|
+
*
|
|
13
|
+
* @developerPreview
|
|
14
|
+
*/
|
|
15
|
+
export declare class AngularAppEngine {
|
|
16
|
+
/**
|
|
17
|
+
* Hooks for extending or modifying the behavior of the server application.
|
|
18
|
+
* These hooks are used by the Angular CLI when running the development server and
|
|
19
|
+
* provide extensibility points for the application lifecycle.
|
|
20
|
+
*
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
static ɵhooks: Hooks;
|
|
24
|
+
/**
|
|
25
|
+
* The manifest for the server application.
|
|
26
|
+
*/
|
|
27
|
+
private readonly manifest;
|
|
28
|
+
/**
|
|
29
|
+
* Renders a response for the given HTTP request using the server application.
|
|
30
|
+
*
|
|
31
|
+
* This method processes the request, determines the appropriate route and rendering context,
|
|
32
|
+
* and returns an HTTP response.
|
|
33
|
+
*
|
|
34
|
+
* If the request URL appears to be for a file (excluding `/index.html`), the method returns `null`.
|
|
35
|
+
* A request to `https://www.example.com/page/index.html` will render the Angular route
|
|
36
|
+
* corresponding to `https://www.example.com/page`.
|
|
37
|
+
*
|
|
38
|
+
* @param request - The incoming HTTP request object to be rendered.
|
|
39
|
+
* @param requestContext - Optional additional context for the request, such as metadata.
|
|
40
|
+
* @returns A promise that resolves to a Response object, or `null` if the request URL represents a file (e.g., `./logo.png`)
|
|
41
|
+
* rather than an application route.
|
|
42
|
+
*/
|
|
43
|
+
render(request: Request, requestContext?: unknown): Promise<Response | null>;
|
|
44
|
+
/**
|
|
45
|
+
* Retrieves the entry point path and locale for the Angular server application based on the provided URL.
|
|
46
|
+
*
|
|
47
|
+
* This method determines the appropriate entry point and locale for rendering the application by examining the URL.
|
|
48
|
+
* If there is only one entry point available, it is returned regardless of the URL.
|
|
49
|
+
* Otherwise, the method extracts a potential locale identifier from the URL and looks up the corresponding entry point.
|
|
50
|
+
*
|
|
51
|
+
* @param url - The URL used to derive the locale and determine the appropriate entry point.
|
|
52
|
+
* @returns A function that returns a promise resolving to an object with the `EntryPointExports` type,
|
|
53
|
+
* or `undefined` if no matching entry point is found for the extracted locale.
|
|
54
|
+
*/
|
|
55
|
+
private getEntryPointFromUrl;
|
|
56
|
+
/**
|
|
57
|
+
* Retrieves HTTP headers for a request associated with statically generated (SSG) pages,
|
|
58
|
+
* based on the URL pathname.
|
|
59
|
+
*
|
|
60
|
+
* @param request - The incoming request object.
|
|
61
|
+
* @returns A `Map` containing the HTTP headers as key-value pairs.
|
|
62
|
+
* @note This function should be used exclusively for retrieving headers of SSG pages.
|
|
63
|
+
*/
|
|
64
|
+
getHeaders(request: Request): Readonly<Map<string, string>>;
|
|
65
|
+
}
|
|
66
|
+
|
|
5
67
|
/**
|
|
6
68
|
* Manifest for the Angular server application engine, defining entry points.
|
|
7
69
|
*/
|
|
@@ -18,6 +80,15 @@ declare interface AngularAppEngineManifest {
|
|
|
18
80
|
* This is used to determine the root path of the application.
|
|
19
81
|
*/
|
|
20
82
|
readonly basePath: string;
|
|
83
|
+
/**
|
|
84
|
+
* A map that associates static paths with their corresponding HTTP headers.
|
|
85
|
+
* Each entry in the map consists of:
|
|
86
|
+
* - `key`: The static path as a string.
|
|
87
|
+
* - `value`: An array of tuples, where each tuple contains:
|
|
88
|
+
* - `headerName`: The name of the HTTP header.
|
|
89
|
+
* - `headerValue`: The value of the HTTP header.
|
|
90
|
+
*/
|
|
91
|
+
readonly staticPathsHeaders: Readonly<Map<string, readonly [headerName: string, headerValue: string][]>>;
|
|
21
92
|
}
|
|
22
93
|
|
|
23
94
|
/**
|
|
@@ -33,9 +104,10 @@ declare interface AngularAppManifest {
|
|
|
33
104
|
readonly assets: Readonly<Map<string, () => Promise<string>>>;
|
|
34
105
|
/**
|
|
35
106
|
* The bootstrap mechanism for the server application.
|
|
36
|
-
* A function that returns a
|
|
107
|
+
* A function that returns a promise that resolves to an `NgModule` or a function
|
|
108
|
+
* returning a promise that resolves to an `ApplicationRef`.
|
|
37
109
|
*/
|
|
38
|
-
readonly bootstrap: () => AngularBootstrap
|
|
110
|
+
readonly bootstrap: () => Promise<AngularBootstrap>;
|
|
39
111
|
/**
|
|
40
112
|
* Indicates whether critical CSS should be inlined into the HTML.
|
|
41
113
|
* If set to `true`, critical CSS will be inlined for faster page rendering.
|
|
@@ -115,6 +187,10 @@ declare class AngularServerApp {
|
|
|
115
187
|
* The `inlineCriticalCssProcessor` is responsible for handling critical CSS inlining.
|
|
116
188
|
*/
|
|
117
189
|
private inlineCriticalCssProcessor;
|
|
190
|
+
/**
|
|
191
|
+
* The bootstrap mechanism for the server application.
|
|
192
|
+
*/
|
|
193
|
+
private boostrap;
|
|
118
194
|
/**
|
|
119
195
|
* Renders a response for the given HTTP request using the server application.
|
|
120
196
|
*
|
|
@@ -147,31 +223,6 @@ declare class AngularServerApp {
|
|
|
147
223
|
private handleRendering;
|
|
148
224
|
}
|
|
149
225
|
|
|
150
|
-
/**
|
|
151
|
-
* Angular server application engine.
|
|
152
|
-
* Manages Angular server applications (including localized ones) and handles rendering requests.
|
|
153
|
-
|
|
154
|
-
* @developerPreview
|
|
155
|
-
*/
|
|
156
|
-
export declare interface AngularServerAppManager {
|
|
157
|
-
/**
|
|
158
|
-
* Renders a response for the given HTTP request using the server application.
|
|
159
|
-
*
|
|
160
|
-
* This method processes the request, determines the appropriate route and rendering context,
|
|
161
|
-
* and returns an HTTP response.
|
|
162
|
-
*
|
|
163
|
-
* If the request URL appears to be for a file (excluding `/index.html`), the method returns `null`.
|
|
164
|
-
* A request to `https://www.example.com/page/index.html` will render the Angular route
|
|
165
|
-
* corresponding to `https://www.example.com/page`.
|
|
166
|
-
*
|
|
167
|
-
* @param request - The incoming HTTP request object to be rendered.
|
|
168
|
-
* @param requestContext - Optional additional context for the request, such as metadata.
|
|
169
|
-
* @returns A promise that resolves to a Response object, or `null` if the request URL represents a file (e.g., `./logo.png`)
|
|
170
|
-
* rather than an application route.
|
|
171
|
-
*/
|
|
172
|
-
render(request: Request, requestContext?: unknown): Promise<Response | null>;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
226
|
declare interface CrittersBase {
|
|
176
227
|
embedLinkedStylesheet(link: PartialHTMLElement, document: PartialDocument): Promise<unknown>;
|
|
177
228
|
}
|
|
@@ -179,17 +230,6 @@ declare interface CrittersBase {
|
|
|
179
230
|
declare class CrittersBase extends default_2 {
|
|
180
231
|
}
|
|
181
232
|
|
|
182
|
-
/**
|
|
183
|
-
* Destroys the current `AngularAppEngine` instance, releasing any associated resources.
|
|
184
|
-
*
|
|
185
|
-
* This method resets the reference to the `AngularAppEngine` instance to `undefined`, allowing
|
|
186
|
-
* a new instance to be created on the next call to `getOrCreateAngularAppEngine()`. It is typically
|
|
187
|
-
* used when reinitializing the server environment or refreshing the application state is necessary.
|
|
188
|
-
*
|
|
189
|
-
* @developerPreview
|
|
190
|
-
*/
|
|
191
|
-
export declare function destroyAngularAppEngine(): void;
|
|
192
|
-
|
|
193
233
|
/**
|
|
194
234
|
* Represents the exports of an Angular server application entry point.
|
|
195
235
|
*/
|
|
@@ -206,18 +246,6 @@ declare interface EntryPointExports {
|
|
|
206
246
|
ɵdestroyAngularServerApp: () => void;
|
|
207
247
|
}
|
|
208
248
|
|
|
209
|
-
/**
|
|
210
|
-
* Retrieves an existing `AngularAppEngine` instance or creates a new one if none exists.
|
|
211
|
-
*
|
|
212
|
-
* This method ensures that only a single instance of `AngularAppEngine` is created and reused across
|
|
213
|
-
* the application lifecycle, providing efficient resource management. If the instance does not exist,
|
|
214
|
-
* it will be instantiated upon the first call.
|
|
215
|
-
*
|
|
216
|
-
* @developerPreview
|
|
217
|
-
* @returns The existing or newly created instance of `AngularAppEngine`.
|
|
218
|
-
*/
|
|
219
|
-
export declare function getOrCreateAngularAppEngine(): AngularServerAppManager;
|
|
220
|
-
|
|
221
249
|
/**
|
|
222
250
|
* Defines the names of available hooks for registering and triggering custom logic within the application.
|
|
223
251
|
*/
|
|
@@ -463,54 +491,6 @@ declare type RouteTreeNodeMetadataWithoutRoute = Omit<RouteTreeNodeMetadata, 'ro
|
|
|
463
491
|
*/
|
|
464
492
|
declare type SerializableRouteTreeNode = ReadonlyArray<RouteTreeNodeMetadata>;
|
|
465
493
|
|
|
466
|
-
/**
|
|
467
|
-
* Angular server application engine.
|
|
468
|
-
* Manages Angular server applications (including localized ones), handles rendering requests,
|
|
469
|
-
* and optionally transforms index HTML before rendering.
|
|
470
|
-
*/
|
|
471
|
-
export declare class ɵAngularAppEngine implements AngularServerAppManager {
|
|
472
|
-
/**
|
|
473
|
-
* Hooks for extending or modifying the behavior of the server application.
|
|
474
|
-
* These hooks are used by the Angular CLI when running the development server and
|
|
475
|
-
* provide extensibility points for the application lifecycle.
|
|
476
|
-
*
|
|
477
|
-
* @private
|
|
478
|
-
*/
|
|
479
|
-
static ɵhooks: Hooks;
|
|
480
|
-
/**
|
|
481
|
-
* The manifest for the server application.
|
|
482
|
-
*/
|
|
483
|
-
private readonly manifest;
|
|
484
|
-
/**
|
|
485
|
-
* Renders a response for the given HTTP request using the server application.
|
|
486
|
-
*
|
|
487
|
-
* This method processes the request, determines the appropriate route and rendering context,
|
|
488
|
-
* and returns an HTTP response.
|
|
489
|
-
*
|
|
490
|
-
* If the request URL appears to be for a file (excluding `/index.html`), the method returns `null`.
|
|
491
|
-
* A request to `https://www.example.com/page/index.html` will render the Angular route
|
|
492
|
-
* corresponding to `https://www.example.com/page`.
|
|
493
|
-
*
|
|
494
|
-
* @param request - The incoming HTTP request object to be rendered.
|
|
495
|
-
* @param requestContext - Optional additional context for the request, such as metadata.
|
|
496
|
-
* @returns A promise that resolves to a Response object, or `null` if the request URL represents a file (e.g., `./logo.png`)
|
|
497
|
-
* rather than an application route.
|
|
498
|
-
*/
|
|
499
|
-
render(request: Request, requestContext?: unknown): Promise<Response | null>;
|
|
500
|
-
/**
|
|
501
|
-
* Retrieves the entry point path and locale for the Angular server application based on the provided URL.
|
|
502
|
-
*
|
|
503
|
-
* This method determines the appropriate entry point and locale for rendering the application by examining the URL.
|
|
504
|
-
* If there is only one entry point available, it is returned regardless of the URL.
|
|
505
|
-
* Otherwise, the method extracts a potential locale identifier from the URL and looks up the corresponding entry point.
|
|
506
|
-
*
|
|
507
|
-
* @param url - The URL used to derive the locale and determine the appropriate entry point.
|
|
508
|
-
* @returns A function that returns a promise resolving to an object with the `EntryPointExports` type,
|
|
509
|
-
* or `undefined` if no matching entry point is found for the extracted locale.
|
|
510
|
-
*/
|
|
511
|
-
private getEntryPointFromUrl;
|
|
512
|
-
}
|
|
513
|
-
|
|
514
494
|
/**
|
|
515
495
|
* Destroys the existing `AngularServerApp` instance, releasing associated resources and resetting the
|
|
516
496
|
* reference to `undefined`.
|
package/node/index.d.ts
CHANGED
|
@@ -4,6 +4,61 @@ import type { ServerResponse } from 'node:http';
|
|
|
4
4
|
import { StaticProvider } from '@angular/core';
|
|
5
5
|
import { Type } from '@angular/core';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Angular server application engine.
|
|
9
|
+
* Manages Angular server applications (including localized ones), handles rendering requests,
|
|
10
|
+
* and optionally transforms index HTML before rendering.
|
|
11
|
+
*
|
|
12
|
+
* @note This class should be instantiated once and used as a singleton across the server-side
|
|
13
|
+
* application to ensure consistent handling of rendering requests and resource management.
|
|
14
|
+
*
|
|
15
|
+
* @developerPreview
|
|
16
|
+
*/
|
|
17
|
+
export declare class AngularNodeAppEngine {
|
|
18
|
+
private readonly angularAppEngine;
|
|
19
|
+
/**
|
|
20
|
+
* Renders an HTTP response based on the incoming request using the Angular server application.
|
|
21
|
+
*
|
|
22
|
+
* The method processes the incoming request, determines the appropriate route, and prepares the
|
|
23
|
+
* rendering context to generate a response. If the request URL corresponds to a static file (excluding `/index.html`),
|
|
24
|
+
* the method returns `null`.
|
|
25
|
+
*
|
|
26
|
+
* Example: A request to `https://www.example.com/page/index.html` will render the Angular route
|
|
27
|
+
* associated with `https://www.example.com/page`.
|
|
28
|
+
*
|
|
29
|
+
* @param request - The incoming HTTP request object to be rendered.
|
|
30
|
+
* @param requestContext - Optional additional context for the request, such as metadata or custom settings.
|
|
31
|
+
* @returns A promise that resolves to a `Response` object, or `null` if the request URL is for a static file
|
|
32
|
+
* (e.g., `./logo.png`) rather than an application route.
|
|
33
|
+
*/
|
|
34
|
+
render(request: IncomingMessage, requestContext?: unknown): Promise<Response | null>;
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves HTTP headers for a request associated with statically generated (SSG) pages,
|
|
37
|
+
* based on the URL pathname.
|
|
38
|
+
*
|
|
39
|
+
* @param request - The incoming request object.
|
|
40
|
+
* @returns A `Map` containing the HTTP headers as key-value pairs.
|
|
41
|
+
* @note This function should be used exclusively for retrieving headers of SSG pages.
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const angularAppEngine = new AngularNodeAppEngine();
|
|
45
|
+
*
|
|
46
|
+
* app.use(express.static('dist/browser', {
|
|
47
|
+
* setHeaders: (res, path) => {
|
|
48
|
+
* // Retrieve headers for the current request
|
|
49
|
+
* const headers = angularAppEngine.getHeaders(res.req);
|
|
50
|
+
*
|
|
51
|
+
* // Apply the retrieved headers to the response
|
|
52
|
+
* for (const { key, value } of headers) {
|
|
53
|
+
* res.setHeader(key, value);
|
|
54
|
+
* }
|
|
55
|
+
* }
|
|
56
|
+
}));
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
getHeaders(request: IncomingMessage): Readonly<Map<string, string>>;
|
|
60
|
+
}
|
|
61
|
+
|
|
7
62
|
/**
|
|
8
63
|
* A common engine to use to server render an application.
|
|
9
64
|
*/
|
package/package.json
CHANGED
|
@@ -3,15 +3,7 @@
|
|
|
3
3
|
Package: ansi-styles
|
|
4
4
|
License: "MIT"
|
|
5
5
|
|
|
6
|
-
MIT License
|
|
7
|
-
|
|
8
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
13
6
|
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
15
7
|
--------------------------------------------------------------------------------
|
|
16
8
|
Package: boolbase
|
|
17
9
|
License: "ISC"
|
|
@@ -21,15 +13,7 @@ License: "ISC"
|
|
|
21
13
|
Package: chalk
|
|
22
14
|
License: "MIT"
|
|
23
15
|
|
|
24
|
-
MIT License
|
|
25
|
-
|
|
26
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
27
|
-
|
|
28
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
29
16
|
|
|
30
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
31
|
-
|
|
32
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
33
17
|
--------------------------------------------------------------------------------
|
|
34
18
|
Package: color-convert
|
|
35
19
|
License: "MIT"
|
|
@@ -337,15 +321,7 @@ License: "MIT"
|
|
|
337
321
|
Package: supports-color
|
|
338
322
|
License: "MIT"
|
|
339
323
|
|
|
340
|
-
MIT License
|
|
341
|
-
|
|
342
|
-
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
343
324
|
|
|
344
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
345
|
-
|
|
346
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
347
|
-
|
|
348
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
349
325
|
--------------------------------------------------------------------------------
|
|
350
326
|
Package: unenv
|
|
351
327
|
License: "MIT"
|