@angular/ssr 19.2.8 → 19.2.10
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.map +1 -1
- package/fesm2022/ssr.mjs +39 -16
- package/fesm2022/ssr.mjs.map +1 -1
- package/index.d.ts +769 -795
- package/node/index.d.ts +80 -87
- package/package.json +1 -1
- package/third_party/beasties/index.d.ts +9 -0
- package/third_party/beasties/index.js.map +1 -1
package/node/index.d.ts
CHANGED
|
@@ -1,10 +1,54 @@
|
|
|
1
|
-
import { ApplicationRef } from '@angular/core';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Type, ApplicationRef, StaticProvider } from '@angular/core';
|
|
2
|
+
import { IncomingMessage, ServerResponse } from 'node:http';
|
|
3
|
+
import { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
|
|
4
|
+
|
|
5
|
+
interface CommonEngineOptions {
|
|
6
|
+
/** A method that when invoked returns a promise that returns an `ApplicationRef` instance once resolved or an NgModule. */
|
|
7
|
+
bootstrap?: Type<{}> | (() => Promise<ApplicationRef>);
|
|
8
|
+
/** A set of platform level providers for all requests. */
|
|
9
|
+
providers?: StaticProvider[];
|
|
10
|
+
/** Enable request performance profiling data collection and printing the results in the server console. */
|
|
11
|
+
enablePerformanceProfiler?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface CommonEngineRenderOptions {
|
|
14
|
+
/** A method that when invoked returns a promise that returns an `ApplicationRef` instance once resolved or an NgModule. */
|
|
15
|
+
bootstrap?: Type<{}> | (() => Promise<ApplicationRef>);
|
|
16
|
+
/** A set of platform level providers for the current request. */
|
|
17
|
+
providers?: StaticProvider[];
|
|
18
|
+
url?: string;
|
|
19
|
+
document?: string;
|
|
20
|
+
documentFilePath?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Reduce render blocking requests by inlining critical CSS.
|
|
23
|
+
* Defaults to true.
|
|
24
|
+
*/
|
|
25
|
+
inlineCriticalCss?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Base path location of index file.
|
|
28
|
+
* Defaults to the 'documentFilePath' dirname when not provided.
|
|
29
|
+
*/
|
|
30
|
+
publicPath?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A common engine to use to server render an application.
|
|
34
|
+
*/
|
|
35
|
+
declare class CommonEngine {
|
|
36
|
+
private options?;
|
|
37
|
+
private readonly templateCache;
|
|
38
|
+
private readonly inlineCriticalCssProcessor;
|
|
39
|
+
private readonly pageIsSSG;
|
|
40
|
+
constructor(options?: CommonEngineOptions | undefined);
|
|
41
|
+
/**
|
|
42
|
+
* Render an HTML document for a specific URL with specified
|
|
43
|
+
* render options
|
|
44
|
+
*/
|
|
45
|
+
render(opts: CommonEngineRenderOptions): Promise<string>;
|
|
46
|
+
private inlineCriticalCss;
|
|
47
|
+
private retrieveSSGPage;
|
|
48
|
+
private renderApplication;
|
|
49
|
+
/** Retrieve the document from the cache or the filesystem */
|
|
50
|
+
private getDocument;
|
|
51
|
+
}
|
|
8
52
|
|
|
9
53
|
/**
|
|
10
54
|
* Angular server application engine.
|
|
@@ -16,7 +60,7 @@ import { Type } from '@angular/core';
|
|
|
16
60
|
*
|
|
17
61
|
* @developerPreview
|
|
18
62
|
*/
|
|
19
|
-
|
|
63
|
+
declare class AngularNodeAppEngine {
|
|
20
64
|
private readonly angularAppEngine;
|
|
21
65
|
/**
|
|
22
66
|
* Handles an incoming HTTP request by serving prerendered content, performing server-side rendering,
|
|
@@ -36,55 +80,16 @@ export declare class AngularNodeAppEngine {
|
|
|
36
80
|
}
|
|
37
81
|
|
|
38
82
|
/**
|
|
39
|
-
*
|
|
83
|
+
* Represents a middleware function for handling HTTP requests in a Node.js environment.
|
|
84
|
+
*
|
|
85
|
+
* @param req - The incoming HTTP request object.
|
|
86
|
+
* @param res - The outgoing HTTP response object.
|
|
87
|
+
* @param next - A callback function that signals the completion of the middleware or forwards the error if provided.
|
|
88
|
+
*
|
|
89
|
+
* @returns A Promise that resolves to void or simply void. The handler can be asynchronous.
|
|
90
|
+
* @developerPreview
|
|
40
91
|
*/
|
|
41
|
-
|
|
42
|
-
private options?;
|
|
43
|
-
private readonly templateCache;
|
|
44
|
-
private readonly inlineCriticalCssProcessor;
|
|
45
|
-
private readonly pageIsSSG;
|
|
46
|
-
constructor(options?: CommonEngineOptions | undefined);
|
|
47
|
-
/**
|
|
48
|
-
* Render an HTML document for a specific URL with specified
|
|
49
|
-
* render options
|
|
50
|
-
*/
|
|
51
|
-
render(opts: CommonEngineRenderOptions): Promise<string>;
|
|
52
|
-
private inlineCriticalCss;
|
|
53
|
-
private retrieveSSGPage;
|
|
54
|
-
private renderApplication;
|
|
55
|
-
/** Retrieve the document from the cache or the filesystem */
|
|
56
|
-
private getDocument;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export declare interface CommonEngineOptions {
|
|
60
|
-
/** A method that when invoked returns a promise that returns an `ApplicationRef` instance once resolved or an NgModule. */
|
|
61
|
-
bootstrap?: Type<{}> | (() => Promise<ApplicationRef>);
|
|
62
|
-
/** A set of platform level providers for all requests. */
|
|
63
|
-
providers?: StaticProvider[];
|
|
64
|
-
/** Enable request performance profiling data collection and printing the results in the server console. */
|
|
65
|
-
enablePerformanceProfiler?: boolean;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export declare interface CommonEngineRenderOptions {
|
|
69
|
-
/** A method that when invoked returns a promise that returns an `ApplicationRef` instance once resolved or an NgModule. */
|
|
70
|
-
bootstrap?: Type<{}> | (() => Promise<ApplicationRef>);
|
|
71
|
-
/** A set of platform level providers for the current request. */
|
|
72
|
-
providers?: StaticProvider[];
|
|
73
|
-
url?: string;
|
|
74
|
-
document?: string;
|
|
75
|
-
documentFilePath?: string;
|
|
76
|
-
/**
|
|
77
|
-
* Reduce render blocking requests by inlining critical CSS.
|
|
78
|
-
* Defaults to true.
|
|
79
|
-
*/
|
|
80
|
-
inlineCriticalCss?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Base path location of index file.
|
|
83
|
-
* Defaults to the 'documentFilePath' dirname when not provided.
|
|
84
|
-
*/
|
|
85
|
-
publicPath?: string;
|
|
86
|
-
}
|
|
87
|
-
|
|
92
|
+
type NodeRequestHandlerFunction = (req: IncomingMessage, res: ServerResponse, next: (err?: unknown) => void) => Promise<void> | void;
|
|
88
93
|
/**
|
|
89
94
|
* Attaches metadata to the handler function to mark it as a special handler for Node.js environments.
|
|
90
95
|
*
|
|
@@ -129,7 +134,21 @@ export declare interface CommonEngineRenderOptions {
|
|
|
129
134
|
* ```
|
|
130
135
|
* @developerPreview
|
|
131
136
|
*/
|
|
132
|
-
|
|
137
|
+
declare function createNodeRequestHandler<T extends NodeRequestHandlerFunction>(handler: T): T;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Streams a web-standard `Response` into a Node.js `ServerResponse`
|
|
141
|
+
* or `Http2ServerResponse`.
|
|
142
|
+
*
|
|
143
|
+
* This function adapts the web `Response` object to write its content
|
|
144
|
+
* to a Node.js response object, handling both HTTP/1.1 and HTTP/2.
|
|
145
|
+
*
|
|
146
|
+
* @param source - The web-standard `Response` object to stream from.
|
|
147
|
+
* @param destination - The Node.js response object (`ServerResponse` or `Http2ServerResponse`) to stream into.
|
|
148
|
+
* @returns A promise that resolves once the streaming operation is complete.
|
|
149
|
+
* @developerPreview
|
|
150
|
+
*/
|
|
151
|
+
declare function writeResponseToNodeResponse(source: Response, destination: ServerResponse | Http2ServerResponse): Promise<void>;
|
|
133
152
|
|
|
134
153
|
/**
|
|
135
154
|
* Converts a Node.js `IncomingMessage` or `Http2ServerRequest` into a
|
|
@@ -142,8 +161,7 @@ export declare function createNodeRequestHandler<T extends NodeRequestHandlerFun
|
|
|
142
161
|
* @returns A Web Standard `Request` object.
|
|
143
162
|
* @developerPreview
|
|
144
163
|
*/
|
|
145
|
-
|
|
146
|
-
|
|
164
|
+
declare function createWebRequestFromNodeRequest(nodeRequest: IncomingMessage | Http2ServerRequest): Request;
|
|
147
165
|
|
|
148
166
|
/**
|
|
149
167
|
* Determines whether the provided URL represents the main entry point module.
|
|
@@ -161,32 +179,7 @@ export declare function createWebRequestFromNodeRequest(nodeRequest: IncomingMes
|
|
|
161
179
|
* @returns `true` if the provided URL represents the main entry point, otherwise `false`.
|
|
162
180
|
* @developerPreview
|
|
163
181
|
*/
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Represents a middleware function for handling HTTP requests in a Node.js environment.
|
|
168
|
-
*
|
|
169
|
-
* @param req - The incoming HTTP request object.
|
|
170
|
-
* @param res - The outgoing HTTP response object.
|
|
171
|
-
* @param next - A callback function that signals the completion of the middleware or forwards the error if provided.
|
|
172
|
-
*
|
|
173
|
-
* @returns A Promise that resolves to void or simply void. The handler can be asynchronous.
|
|
174
|
-
* @developerPreview
|
|
175
|
-
*/
|
|
176
|
-
export declare type NodeRequestHandlerFunction = (req: IncomingMessage, res: ServerResponse, next: (err?: unknown) => void) => Promise<void> | void;
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Streams a web-standard `Response` into a Node.js `ServerResponse`
|
|
180
|
-
* or `Http2ServerResponse`.
|
|
181
|
-
*
|
|
182
|
-
* This function adapts the web `Response` object to write its content
|
|
183
|
-
* to a Node.js response object, handling both HTTP/1.1 and HTTP/2.
|
|
184
|
-
*
|
|
185
|
-
* @param source - The web-standard `Response` object to stream from.
|
|
186
|
-
* @param destination - The Node.js response object (`ServerResponse` or `Http2ServerResponse`) to stream into.
|
|
187
|
-
* @returns A promise that resolves once the streaming operation is complete.
|
|
188
|
-
* @developerPreview
|
|
189
|
-
*/
|
|
190
|
-
export declare function writeResponseToNodeResponse(source: Response, destination: ServerResponse | Http2ServerResponse): Promise<void>;
|
|
182
|
+
declare function isMainModule(url: string): boolean;
|
|
191
183
|
|
|
192
|
-
export { }
|
|
184
|
+
export { AngularNodeAppEngine, CommonEngine, createNodeRequestHandler, createWebRequestFromNodeRequest, isMainModule, writeResponseToNodeResponse };
|
|
185
|
+
export type { CommonEngineOptions, CommonEngineRenderOptions, NodeRequestHandlerFunction };
|
package/package.json
CHANGED