@angular/ssr 19.0.0-next.7 → 19.0.0-next.8
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 +50 -1
- package/fesm2022/node.mjs.map +1 -1
- package/fesm2022/ssr.mjs +106 -39
- package/fesm2022/ssr.mjs.map +1 -1
- package/index.d.ts +87 -16
- package/node/index.d.ts +57 -0
- package/package.json +7 -7
- package/third_party/critters/THIRD_PARTY_LICENSES.txt +24 -0
package/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ApplicationRef } from '@angular/core';
|
|
2
2
|
import { default as default_2 } from 'critters';
|
|
3
3
|
import { EnvironmentProviders } from '@angular/core';
|
|
4
|
+
import { InjectionToken } from '@angular/core';
|
|
4
5
|
import type { Type } from '@angular/core';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -26,6 +27,10 @@ export declare class AngularAppEngine {
|
|
|
26
27
|
* The manifest for the server application.
|
|
27
28
|
*/
|
|
28
29
|
private readonly manifest;
|
|
30
|
+
/**
|
|
31
|
+
* A cache that holds entry points, keyed by their potential locale string.
|
|
32
|
+
*/
|
|
33
|
+
private readonly entryPointsCache;
|
|
29
34
|
/**
|
|
30
35
|
* Renders a response for the given HTTP request using the server application.
|
|
31
36
|
*
|
|
@@ -42,18 +47,6 @@ export declare class AngularAppEngine {
|
|
|
42
47
|
* rather than an application route.
|
|
43
48
|
*/
|
|
44
49
|
render(request: Request, requestContext?: unknown): Promise<Response | null>;
|
|
45
|
-
/**
|
|
46
|
-
* Retrieves the entry point path and locale for the Angular server application based on the provided URL.
|
|
47
|
-
*
|
|
48
|
-
* This method determines the appropriate entry point and locale for rendering the application by examining the URL.
|
|
49
|
-
* If there is only one entry point available, it is returned regardless of the URL.
|
|
50
|
-
* Otherwise, the method extracts a potential locale identifier from the URL and looks up the corresponding entry point.
|
|
51
|
-
*
|
|
52
|
-
* @param url - The URL used to derive the locale and determine the appropriate entry point.
|
|
53
|
-
* @returns A function that returns a promise resolving to an object with the `EntryPointExports` type,
|
|
54
|
-
* or `undefined` if no matching entry point is found for the extracted locale.
|
|
55
|
-
*/
|
|
56
|
-
private getEntryPointFromUrl;
|
|
57
50
|
/**
|
|
58
51
|
* Retrieves HTTP headers for a request associated with statically generated (SSG) pages,
|
|
59
52
|
* based on the URL pathname.
|
|
@@ -63,6 +56,25 @@ export declare class AngularAppEngine {
|
|
|
63
56
|
* @note This function should be used exclusively for retrieving headers of SSG pages.
|
|
64
57
|
*/
|
|
65
58
|
getPrerenderHeaders(request: Request): ReadonlyMap<string, string>;
|
|
59
|
+
/**
|
|
60
|
+
* Retrieves the exports for a specific entry point, caching the result.
|
|
61
|
+
*
|
|
62
|
+
* @param potentialLocale - The locale string used to find the corresponding entry point.
|
|
63
|
+
* @returns A promise that resolves to the entry point exports or `undefined` if not found.
|
|
64
|
+
*/
|
|
65
|
+
private getEntryPointExports;
|
|
66
|
+
/**
|
|
67
|
+
* Retrieves the entry point for a given URL by determining the locale and mapping it to
|
|
68
|
+
* the appropriate application bundle.
|
|
69
|
+
*
|
|
70
|
+
* This method determines the appropriate entry point and locale for rendering the application by examining the URL.
|
|
71
|
+
* If there is only one entry point available, it is returned regardless of the URL.
|
|
72
|
+
* Otherwise, the method extracts a potential locale identifier from the URL and looks up the corresponding entry point.
|
|
73
|
+
*
|
|
74
|
+
* @param url - The URL of the request.
|
|
75
|
+
* @returns A promise that resolves to the entry point exports or `undefined` if not found.
|
|
76
|
+
*/
|
|
77
|
+
private getEntryPointExportsForUrl;
|
|
66
78
|
}
|
|
67
79
|
|
|
68
80
|
/**
|
|
@@ -120,6 +132,11 @@ declare interface AngularAppManifest {
|
|
|
120
132
|
* It is used for route matching and navigation within the server application.
|
|
121
133
|
*/
|
|
122
134
|
readonly routes?: SerializableRouteTreeNode;
|
|
135
|
+
/**
|
|
136
|
+
* An optional string representing the locale or language code to be used for
|
|
137
|
+
* the application, aiding with localization and rendering content specific to the locale.
|
|
138
|
+
*/
|
|
139
|
+
readonly locale?: string;
|
|
123
140
|
}
|
|
124
141
|
|
|
125
142
|
/**
|
|
@@ -233,6 +250,31 @@ declare class AngularServerApp {
|
|
|
233
250
|
private handleRendering;
|
|
234
251
|
}
|
|
235
252
|
|
|
253
|
+
/**
|
|
254
|
+
* Annotates a request handler function with metadata, marking it as a special
|
|
255
|
+
* handler.
|
|
256
|
+
*
|
|
257
|
+
* @param handler - The request handler function to be annotated.
|
|
258
|
+
* @returns The same handler function passed in, with metadata attached.
|
|
259
|
+
*
|
|
260
|
+
* @example
|
|
261
|
+
* Example usage in a Hono application:
|
|
262
|
+
* ```ts
|
|
263
|
+
* const app = new Hono();
|
|
264
|
+
* export default createRequestHandler(app.fetch);
|
|
265
|
+
* ```
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* Example usage in a H3 application:
|
|
269
|
+
* ```ts
|
|
270
|
+
* const app = createApp();
|
|
271
|
+
* const handler = toWebHandler(app);
|
|
272
|
+
* export default createRequestHandler(handler);
|
|
273
|
+
* ```
|
|
274
|
+
* @developerPreview
|
|
275
|
+
*/
|
|
276
|
+
export declare function createRequestHandler(handler: RequestHandlerFunction): RequestHandlerFunction;
|
|
277
|
+
|
|
236
278
|
declare interface CrittersBase {
|
|
237
279
|
embedLinkedStylesheet(link: PartialHTMLElement, document: PartialDocument): Promise<unknown>;
|
|
238
280
|
}
|
|
@@ -310,13 +352,14 @@ declare interface HooksMapping {
|
|
|
310
352
|
|
|
311
353
|
|
|
312
354
|
/**
|
|
313
|
-
*
|
|
314
|
-
*
|
|
355
|
+
* Defines a handler function type for transforming HTML content.
|
|
356
|
+
* This function receives an object with the HTML to be processed.
|
|
315
357
|
*
|
|
316
|
-
* @param ctx -
|
|
317
|
-
* @returns The
|
|
358
|
+
* @param ctx - An object containing the URL and HTML content to be transformed.
|
|
359
|
+
* @returns The transformed HTML as a string or a promise that resolves to the transformed HTML.
|
|
318
360
|
*/
|
|
319
361
|
declare type HtmlTransformHandler = (ctx: {
|
|
362
|
+
url: URL;
|
|
320
363
|
html: string;
|
|
321
364
|
}) => string | Promise<string>;
|
|
322
365
|
|
|
@@ -392,6 +435,34 @@ export declare enum RenderMode {
|
|
|
392
435
|
Prerender = 3
|
|
393
436
|
}
|
|
394
437
|
|
|
438
|
+
/**
|
|
439
|
+
* Injection token for the current request.
|
|
440
|
+
* @developerPreview
|
|
441
|
+
*/
|
|
442
|
+
export declare const REQUEST: InjectionToken<Request>;
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Injection token for additional request context.
|
|
446
|
+
* @developerPreview
|
|
447
|
+
*/
|
|
448
|
+
export declare const REQUEST_CONTEXT: InjectionToken<unknown>;
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Function for handling HTTP requests in a web environment.
|
|
453
|
+
*
|
|
454
|
+
* @param request - The incoming HTTP request object.
|
|
455
|
+
* @returns A Promise resolving to a `Response` object, `null`, or directly a `Response`,
|
|
456
|
+
* supporting both synchronous and asynchronous handling.
|
|
457
|
+
*/
|
|
458
|
+
declare type RequestHandlerFunction = (request: Request) => Promise<Response | null> | null | Response;
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Injection token for the response initialization options.
|
|
462
|
+
* @developerPreview
|
|
463
|
+
*/
|
|
464
|
+
export declare const RESPONSE_INIT: InjectionToken<ResponseInit>;
|
|
465
|
+
|
|
395
466
|
/**
|
|
396
467
|
* A route tree implementation that supports efficient route matching, including support for wildcard routes.
|
|
397
468
|
* This structure is useful for organizing and retrieving routes in a hierarchical manner,
|
package/node/index.d.ts
CHANGED
|
@@ -109,6 +109,52 @@ export declare interface CommonEngineRenderOptions {
|
|
|
109
109
|
publicPath?: string;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Attaches metadata to the handler function to mark it as a special handler for Node.js environments.
|
|
114
|
+
*
|
|
115
|
+
* @typeParam T - The type of the handler function.
|
|
116
|
+
* @param handler - The handler function to be defined and annotated.
|
|
117
|
+
* @returns The same handler function passed as an argument, with metadata attached.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* Usage in an Express application:
|
|
121
|
+
* ```ts
|
|
122
|
+
* const app = express();
|
|
123
|
+
* export default createNodeRequestHandler(app);
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* Usage in a Hono application:
|
|
128
|
+
* ```ts
|
|
129
|
+
* const app = new Hono();
|
|
130
|
+
* export default createNodeRequestHandler(async (req, res, next) => {
|
|
131
|
+
* try {
|
|
132
|
+
* const webRes = await app.fetch(createWebRequestFromNodeRequest(req));
|
|
133
|
+
* if (webRes) {
|
|
134
|
+
* await writeResponseToNodeResponse(webRes, res);
|
|
135
|
+
* } else {
|
|
136
|
+
* next();
|
|
137
|
+
* }
|
|
138
|
+
* } catch (error) {
|
|
139
|
+
* next(error);
|
|
140
|
+
* }
|
|
141
|
+
* }));
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* Usage in a Fastify application:
|
|
146
|
+
* ```ts
|
|
147
|
+
* const app = Fastify();
|
|
148
|
+
* export default createNodeRequestHandler(async (req, res) => {
|
|
149
|
+
* await app.ready();
|
|
150
|
+
* app.server.emit('request', req, res);
|
|
151
|
+
* res.send('Hello from Fastify with Node Next Handler!');
|
|
152
|
+
* }));
|
|
153
|
+
* ```
|
|
154
|
+
* @developerPreview
|
|
155
|
+
*/
|
|
156
|
+
export declare function createNodeRequestHandler<T extends RequestHandlerFunction>(handler: T): T;
|
|
157
|
+
|
|
112
158
|
/**
|
|
113
159
|
* Converts a Node.js `IncomingMessage` into a Web Standard `Request`.
|
|
114
160
|
*
|
|
@@ -137,6 +183,17 @@ export declare function createWebRequestFromNodeRequest(nodeRequest: IncomingMes
|
|
|
137
183
|
*/
|
|
138
184
|
export declare function isMainModule(url: string): boolean;
|
|
139
185
|
|
|
186
|
+
/**
|
|
187
|
+
* Represents a middleware function for handling HTTP requests in a Node.js environment.
|
|
188
|
+
*
|
|
189
|
+
* @param req - The incoming HTTP request object.
|
|
190
|
+
* @param res - The outgoing HTTP response object.
|
|
191
|
+
* @param next - A callback function that signals the completion of the middleware or forwards the error if provided.
|
|
192
|
+
*
|
|
193
|
+
* @returns A Promise that resolves to void or simply void. The handler can be asynchronous.
|
|
194
|
+
*/
|
|
195
|
+
declare type RequestHandlerFunction = (req: IncomingMessage, res: ServerResponse, next: (err?: unknown) => void) => Promise<void> | void;
|
|
196
|
+
|
|
140
197
|
/**
|
|
141
198
|
* Streams a web-standard `Response` into a Node.js `ServerResponse`.
|
|
142
199
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/ssr",
|
|
3
|
-
"version": "19.0.0-next.
|
|
3
|
+
"version": "19.0.0-next.8",
|
|
4
4
|
"description": "Angular server side rendering utilities",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/angular/angular-cli",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"@angular/router": "^19.0.0-next.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@angular/common": "19.0.0-next.
|
|
26
|
-
"@angular/compiler": "19.0.0-next.
|
|
27
|
-
"@angular/core": "19.0.0-next.
|
|
28
|
-
"@angular/platform-browser": "19.0.0-next.
|
|
29
|
-
"@angular/platform-server": "19.0.0-next.
|
|
30
|
-
"@angular/router": "19.0.0-next.
|
|
25
|
+
"@angular/common": "19.0.0-next.7",
|
|
26
|
+
"@angular/compiler": "19.0.0-next.7",
|
|
27
|
+
"@angular/core": "19.0.0-next.7",
|
|
28
|
+
"@angular/platform-browser": "19.0.0-next.7",
|
|
29
|
+
"@angular/platform-server": "19.0.0-next.7",
|
|
30
|
+
"@angular/router": "19.0.0-next.7",
|
|
31
31
|
"@bazel/runfiles": "^5.8.1"
|
|
32
32
|
},
|
|
33
33
|
"schematics": "./schematics/collection.json",
|
|
@@ -3,7 +3,15 @@
|
|
|
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.
|
|
6
13
|
|
|
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.
|
|
7
15
|
--------------------------------------------------------------------------------
|
|
8
16
|
Package: boolbase
|
|
9
17
|
License: "ISC"
|
|
@@ -13,7 +21,15 @@ License: "ISC"
|
|
|
13
21
|
Package: chalk
|
|
14
22
|
License: "MIT"
|
|
15
23
|
|
|
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:
|
|
16
29
|
|
|
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.
|
|
17
33
|
--------------------------------------------------------------------------------
|
|
18
34
|
Package: color-convert
|
|
19
35
|
License: "MIT"
|
|
@@ -321,7 +337,15 @@ License: "MIT"
|
|
|
321
337
|
Package: supports-color
|
|
322
338
|
License: "MIT"
|
|
323
339
|
|
|
340
|
+
MIT License
|
|
341
|
+
|
|
342
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
|
324
343
|
|
|
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.
|
|
325
349
|
--------------------------------------------------------------------------------
|
|
326
350
|
Package: unenv
|
|
327
351
|
License: "MIT"
|