@angular/ssr 20.0.0-next.5 → 20.0.0-next.7

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/node/index.d.ts CHANGED
@@ -1,10 +1,54 @@
1
- import { ApplicationRef } from '@angular/core';
2
- import type { Http2ServerRequest } from 'node:http2';
3
- import type { Http2ServerResponse } from 'node:http2';
4
- import type { IncomingMessage } from 'node:http';
5
- import type { ServerResponse } from 'node:http';
6
- import { StaticProvider } from '@angular/core';
7
- import { Type } from '@angular/core';
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.
@@ -14,7 +58,7 @@ import { Type } from '@angular/core';
14
58
  * @remarks This class should be instantiated once and used as a singleton across the server-side
15
59
  * application to ensure consistent handling of rendering requests and resource management.
16
60
  */
17
- export declare class AngularNodeAppEngine {
61
+ declare class AngularNodeAppEngine {
18
62
  private readonly angularAppEngine;
19
63
  constructor();
20
64
  /**
@@ -35,55 +79,15 @@ export declare class AngularNodeAppEngine {
35
79
  }
36
80
 
37
81
  /**
38
- * A common engine to use to server render an application.
82
+ * Represents a middleware function for handling HTTP requests in a Node.js environment.
83
+ *
84
+ * @param req - The incoming HTTP request object.
85
+ * @param res - The outgoing HTTP response object.
86
+ * @param next - A callback function that signals the completion of the middleware or forwards the error if provided.
87
+ *
88
+ * @returns A Promise that resolves to void or simply void. The handler can be asynchronous.
39
89
  */
40
- export declare class CommonEngine {
41
- private options?;
42
- private readonly templateCache;
43
- private readonly inlineCriticalCssProcessor;
44
- private readonly pageIsSSG;
45
- constructor(options?: CommonEngineOptions | undefined);
46
- /**
47
- * Render an HTML document for a specific URL with specified
48
- * render options
49
- */
50
- render(opts: CommonEngineRenderOptions): Promise<string>;
51
- private inlineCriticalCss;
52
- private retrieveSSGPage;
53
- private renderApplication;
54
- /** Retrieve the document from the cache or the filesystem */
55
- private getDocument;
56
- }
57
-
58
- export declare interface CommonEngineOptions {
59
- /** A method that when invoked returns a promise that returns an `ApplicationRef` instance once resolved or an NgModule. */
60
- bootstrap?: Type<{}> | (() => Promise<ApplicationRef>);
61
- /** A set of platform level providers for all requests. */
62
- providers?: StaticProvider[];
63
- /** Enable request performance profiling data collection and printing the results in the server console. */
64
- enablePerformanceProfiler?: boolean;
65
- }
66
-
67
- export declare interface CommonEngineRenderOptions {
68
- /** A method that when invoked returns a promise that returns an `ApplicationRef` instance once resolved or an NgModule. */
69
- bootstrap?: Type<{}> | (() => Promise<ApplicationRef>);
70
- /** A set of platform level providers for the current request. */
71
- providers?: StaticProvider[];
72
- url?: string;
73
- document?: string;
74
- documentFilePath?: string;
75
- /**
76
- * Reduce render blocking requests by inlining critical CSS.
77
- * Defaults to true.
78
- */
79
- inlineCriticalCss?: boolean;
80
- /**
81
- * Base path location of index file.
82
- * Defaults to the 'documentFilePath' dirname when not provided.
83
- */
84
- publicPath?: string;
85
- }
86
-
90
+ type NodeRequestHandlerFunction = (req: IncomingMessage, res: ServerResponse, next: (err?: unknown) => void) => Promise<void> | void;
87
91
  /**
88
92
  * Attaches metadata to the handler function to mark it as a special handler for Node.js environments.
89
93
  *
@@ -127,7 +131,20 @@ export declare interface CommonEngineRenderOptions {
127
131
  * }));
128
132
  * ```
129
133
  */
130
- export declare function createNodeRequestHandler<T extends NodeRequestHandlerFunction>(handler: T): T;
134
+ declare function createNodeRequestHandler<T extends NodeRequestHandlerFunction>(handler: T): T;
135
+
136
+ /**
137
+ * Streams a web-standard `Response` into a Node.js `ServerResponse`
138
+ * or `Http2ServerResponse`.
139
+ *
140
+ * This function adapts the web `Response` object to write its content
141
+ * to a Node.js response object, handling both HTTP/1.1 and HTTP/2.
142
+ *
143
+ * @param source - The web-standard `Response` object to stream from.
144
+ * @param destination - The Node.js response object (`ServerResponse` or `Http2ServerResponse`) to stream into.
145
+ * @returns A promise that resolves once the streaming operation is complete.
146
+ */
147
+ declare function writeResponseToNodeResponse(source: Response, destination: ServerResponse | Http2ServerResponse): Promise<void>;
131
148
 
132
149
  /**
133
150
  * Converts a Node.js `IncomingMessage` or `Http2ServerRequest` into a
@@ -139,8 +156,7 @@ export declare function createNodeRequestHandler<T extends NodeRequestHandlerFun
139
156
  * @param nodeRequest - The Node.js request object (`IncomingMessage` or `Http2ServerRequest`) to convert.
140
157
  * @returns A Web Standard `Request` object.
141
158
  */
142
- export declare function createWebRequestFromNodeRequest(nodeRequest: IncomingMessage | Http2ServerRequest): Request;
143
-
159
+ declare function createWebRequestFromNodeRequest(nodeRequest: IncomingMessage | Http2ServerRequest): Request;
144
160
 
145
161
  /**
146
162
  * Determines whether the provided URL represents the main entry point module.
@@ -157,30 +173,7 @@ export declare function createWebRequestFromNodeRequest(nodeRequest: IncomingMes
157
173
  * @param url The URL of the module to check. This should typically be `import.meta.url`.
158
174
  * @returns `true` if the provided URL represents the main entry point, otherwise `false`.
159
175
  */
160
- export declare function isMainModule(url: string): boolean;
161
-
162
- /**
163
- * Represents a middleware function for handling HTTP requests in a Node.js environment.
164
- *
165
- * @param req - The incoming HTTP request object.
166
- * @param res - The outgoing HTTP response object.
167
- * @param next - A callback function that signals the completion of the middleware or forwards the error if provided.
168
- *
169
- * @returns A Promise that resolves to void or simply void. The handler can be asynchronous.
170
- */
171
- export declare type NodeRequestHandlerFunction = (req: IncomingMessage, res: ServerResponse, next: (err?: unknown) => void) => Promise<void> | void;
172
-
173
- /**
174
- * Streams a web-standard `Response` into a Node.js `ServerResponse`
175
- * or `Http2ServerResponse`.
176
- *
177
- * This function adapts the web `Response` object to write its content
178
- * to a Node.js response object, handling both HTTP/1.1 and HTTP/2.
179
- *
180
- * @param source - The web-standard `Response` object to stream from.
181
- * @param destination - The Node.js response object (`ServerResponse` or `Http2ServerResponse`) to stream into.
182
- * @returns A promise that resolves once the streaming operation is complete.
183
- */
184
- export declare function writeResponseToNodeResponse(source: Response, destination: ServerResponse | Http2ServerResponse): Promise<void>;
176
+ declare function isMainModule(url: string): boolean;
185
177
 
186
- export { }
178
+ export { AngularNodeAppEngine, CommonEngine, createNodeRequestHandler, createWebRequestFromNodeRequest, isMainModule, writeResponseToNodeResponse };
179
+ export type { CommonEngineOptions, CommonEngineRenderOptions, NodeRequestHandlerFunction };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/ssr",
3
- "version": "20.0.0-next.5",
3
+ "version": "20.0.0-next.7",
4
4
  "description": "Angular server side rendering utilities",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -29,12 +29,12 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@angular-devkit/schematics": "workspace:*",
32
- "@angular/common": "20.0.0-next.5",
33
- "@angular/compiler": "20.0.0-next.5",
34
- "@angular/core": "20.0.0-next.5",
35
- "@angular/platform-browser": "20.0.0-next.5",
36
- "@angular/platform-server": "20.0.0-next.5",
37
- "@angular/router": "20.0.0-next.5",
32
+ "@angular/common": "20.0.0-next.7",
33
+ "@angular/compiler": "20.0.0-next.7",
34
+ "@angular/core": "20.0.0-next.7",
35
+ "@angular/platform-browser": "20.0.0-next.7",
36
+ "@angular/platform-server": "20.0.0-next.7",
37
+ "@angular/router": "20.0.0-next.7",
38
38
  "@schematics/angular": "workspace:*"
39
39
  },
40
40
  "sideEffects": false,
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+
9
+ export { default } from 'beasties';
@@ -11348,7 +11348,8 @@ function isSubpath(basePath, currentPath) {
11348
11348
  }
11349
11349
 
11350
11350
  const removePseudoClassesAndElementsPattern = /(?<!\\)::?[a-z-]+(?:\(.+\))?/gi;
11351
- const doubleNestingPattern = />\s*(?=>|$)/g;
11351
+ const implicitUniversalPattern = /([>+~])\s*(?!\1)([>+~])/g;
11352
+ const emptyCombinatorPattern = /([>+~])\s*(?=\1|$)/g;
11352
11353
  const removeTrailingCommasPattern = /\(\s*,|,\s*\)/g;
11353
11354
  class Beasties {
11354
11355
  #selectorCache = /* @__PURE__ */ new Map();
@@ -11739,9 +11740,7 @@ class Beasties {
11739
11740
  if (failedSelectors.length !== 0) {
11740
11741
  this.logger.warn?.(
11741
11742
  `${failedSelectors.length} rules skipped due to selector errors:
11742
- ${failedSelectors.join(
11743
- "\n "
11744
- )}`
11743
+ ${failedSelectors.join("\n ")}`
11745
11744
  );
11746
11745
  }
11747
11746
  const preloadedFonts = /* @__PURE__ */ new Set();
@@ -11820,7 +11819,7 @@ class Beasties {
11820
11819
  if (normalizedSelector !== void 0) {
11821
11820
  return normalizedSelector;
11822
11821
  }
11823
- normalizedSelector = sel.replace(removePseudoClassesAndElementsPattern, "").replace(removeTrailingCommasPattern, (match) => match.includes("(") ? "(" : ")").replace(doubleNestingPattern, "> *").trim();
11822
+ normalizedSelector = sel.replace(removePseudoClassesAndElementsPattern, "").replace(removeTrailingCommasPattern, (match) => match.includes("(") ? "(" : ")").replace(implicitUniversalPattern, "$1 * $2").replace(emptyCombinatorPattern, "$1 *").trim();
11824
11823
  this.#selectorCache.set(sel, normalizedSelector);
11825
11824
  return normalizedSelector;
11826
11825
  }