Skip to content

Commit 4b09887

Browse files
committed
feat(@angular/ssr): move CommonEngine API to /node entry-point
Refactored the `CommonEngine` API import path to remove Node.js dependencies from the `@angular/ssr` main entry-point. BREAKING CHANGE: The `CommonEngine` API now needs to be imported from `@angular/ssr/node`. **Before** ```ts import { CommonEngine } from '@angular/ssr'; ``` **After** ```ts import { CommonEngine } from '@angular/ssr/node'; ```
1 parent ac6935d commit 4b09887

File tree

21 files changed

+257
-45
lines changed

21 files changed

+257
-45
lines changed

goldens/public-api/angular/ssr/index.api.md

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,6 @@
44
55
```ts
66

7-
import { ApplicationRef } from '@angular/core';
8-
import { StaticProvider } from '@angular/core';
9-
import { Type } from '@angular/core';
10-
11-
// @public
12-
export class CommonEngine {
13-
constructor(options?: CommonEngineOptions | undefined);
14-
render(opts: CommonEngineRenderOptions): Promise<string>;
15-
}
16-
17-
// @public (undocumented)
18-
export interface CommonEngineOptions {
19-
bootstrap?: Type<{}> | (() => Promise<ApplicationRef>);
20-
enablePerformanceProfiler?: boolean;
21-
providers?: StaticProvider[];
22-
}
23-
24-
// @public (undocumented)
25-
export interface CommonEngineRenderOptions {
26-
bootstrap?: Type<{}> | (() => Promise<ApplicationRef>);
27-
// (undocumented)
28-
document?: string;
29-
// (undocumented)
30-
documentFilePath?: string;
31-
inlineCriticalCss?: boolean;
32-
providers?: StaticProvider[];
33-
publicPath?: string;
34-
// (undocumented)
35-
url?: string;
36-
}
37-
387
// (No @packageDocumentation comment for this package)
398

409
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## API Report File for "@angular/ssr_node"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
import { ApplicationRef } from '@angular/core';
8+
import { StaticProvider } from '@angular/core';
9+
import { Type } from '@angular/core';
10+
11+
// @public
12+
export class CommonEngine {
13+
constructor(options?: CommonEngineOptions | undefined);
14+
render(opts: CommonEngineRenderOptions): Promise<string>;
15+
}
16+
17+
// @public (undocumented)
18+
export interface CommonEngineOptions {
19+
bootstrap?: Type<{}> | (() => Promise<ApplicationRef>);
20+
enablePerformanceProfiler?: boolean;
21+
providers?: StaticProvider[];
22+
}
23+
24+
// @public (undocumented)
25+
export interface CommonEngineRenderOptions {
26+
bootstrap?: Type<{}> | (() => Promise<ApplicationRef>);
27+
// (undocumented)
28+
document?: string;
29+
// (undocumented)
30+
documentFilePath?: string;
31+
inlineCriticalCss?: boolean;
32+
providers?: StaticProvider[];
33+
publicPath?: string;
34+
// (undocumented)
35+
url?: string;
36+
}
37+
38+
// (No @packageDocumentation comment for this package)
39+
40+
```

packages/angular/ssr/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ ng_package(
4444
tags = ["release-package"],
4545
deps = [
4646
":ssr",
47+
"//packages/angular/ssr/node",
4748
],
4849
)
4950

packages/angular/ssr/node/BUILD.bazel

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
load("//tools:defaults.bzl", "ts_library")
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
ts_library(
6+
name = "node",
7+
srcs = glob(
8+
[
9+
"*.ts",
10+
"src/**/*.ts",
11+
],
12+
),
13+
module_name = "@angular/ssr/node",
14+
deps = [
15+
"//packages/angular/ssr",
16+
"@npm//@angular/core",
17+
"@npm//@angular/platform-server",
18+
"@npm//@types/node",
19+
],
20+
)

packages/angular/ssr/node/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.dev/license
7+
*/
8+
9+
export * from './public_api';
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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.dev/license
7+
*/
8+
9+
export {
10+
CommonEngine,
11+
type CommonEngineRenderOptions,
12+
type CommonEngineOptions,
13+
} from './src/common-engine/common-engine';

packages/angular/ssr/src/common-engine/inline-css-processor.ts renamed to packages/angular/ssr/node/src/common-engine/inline-css-processor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9+
import { ɵInlineCriticalCssProcessor as InlineCriticalCssProcessor } from '@angular/ssr';
910
import { readFile } from 'node:fs/promises';
10-
import { InlineCriticalCssProcessor } from '../utils/inline-critical-css';
1111

1212
export class CommonEngineInlineCriticalCssProcessor {
1313
private readonly resourceCache = new Map<string, string>();

packages/angular/ssr/private_export.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ export {
1616
setAngularAppManifest as ɵsetAngularAppManifest,
1717
setAngularAppEngineManifest as ɵsetAngularAppEngineManifest,
1818
} from './src/manifest';
19+
20+
export { InlineCriticalCssProcessor as ɵInlineCriticalCssProcessor } from './src/utils/inline-critical-css';

0 commit comments

Comments
 (0)