build: update Angular to version 16 · angular/universal@f07f9c2 · GitHub
Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit f07f9c2

Browse files
committed
build: update Angular to version 16
1 parent ae96fbc commit f07f9c2

11 files changed

Lines changed: 386 additions & 445 deletions

File tree

‎.github/workflows/dev-infra.yml‎

Lines changed: 2 additions & 2 deletions

‎.github/workflows/lock-closed.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
lock_closed:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: angular/dev-infra/github-actions/lock-closed@a8ea953071698c8900e90552e333f21ce994bae5
16+
- uses: angular/dev-infra/github-actions/lock-closed@65540caa0f3ad435ed8d8cb220f4c650b16845bc
1717
with:
1818
lock-bot-key: ${{ secrets.LOCK_BOT_PRIVATE_KEY }}

‎modules/builders/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
"typings": "src/index.d.ts",
2626
"builders": "builders.json",
2727
"peerDependencies": {
28-
"@angular-devkit/build-angular": "^15.0.0"
28+
"@angular-devkit/build-angular": "^16.0.0 || ^16.0.0-next.0"
2929
},
3030
"dependencies": {
31-
"@angular-devkit/architect": "~0.1502.0",
32-
"@angular-devkit/core": "~15.2.0",
31+
"@angular-devkit/architect": "~0.1600.0-next.2",
32+
"@angular-devkit/core": "~16.0.0-next.2",
3333
"@nguniversal/common": "0.0.0-PLACEHOLDER",
3434
"browser-sync": "^2.27.10",
3535
"express": "^4.18.2",

‎modules/builders/src/prerender/index.ts‎

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ import {
1212
createBuilder,
1313
targetFromTargetString,
1414
} from '@angular-devkit/architect';
15-
import { BrowserBuilderOptions } from '@angular-devkit/build-angular';
15+
import {
16+
BrowserBuilderOptions,
17+
BrowserBuilderOutput,
18+
ServerBuilderOutput,
19+
} from '@angular-devkit/build-angular';
1620
import { normalizeOptimization } from '@angular-devkit/build-angular/src/utils/normalize-optimization';
1721
import { augmentAppWithServiceWorker } from '@angular-devkit/build-angular/src/utils/service-worker';
1822
import * as fs from 'fs';
@@ -23,24 +27,18 @@ import { PrerenderBuilderOptions, PrerenderBuilderOutput } from './models';
2327
import { getIndexOutputFile, getRoutes } from './utils';
2428
import { RenderOptions, RenderResult } from './worker';
2529

26-
type BuildBuilderOutput = BuilderOutput & {
27-
baseOutputPath: string;
28-
outputPaths: string[];
29-
outputPath: string;
30-
};
31-
32-
type ScheduleBuildsOutput = BuilderOutput & {
33-
serverResult?: BuildBuilderOutput;
34-
browserResult?: BuildBuilderOutput;
35-
};
36-
3730
/**
3831
* Schedules the server and browser builds and returns their results if both builds are successful.
3932
*/
4033
async function _scheduleBuilds(
4134
options: PrerenderBuilderOptions,
4235
context: BuilderContext,
43-
): Promise<ScheduleBuildsOutput> {
36+
): Promise<
37+
BuilderOutput & {
38+
serverResult?: ServerBuilderOutput;
39+
browserResult?: BrowserBuilderOutput;
40+
}
41+
> {
4442
const browserTarget = targetFromTargetString(options.browserTarget);
4543
const serverTarget = targetFromTargetString(options.serverTarget);
4644

@@ -55,8 +53,8 @@ async function _scheduleBuilds(
5553

5654
try {
5755
const [browserResult, serverResult] = await Promise.all([
58-
browserTargetRun.result as unknown as BuildBuilderOutput,
59-
serverTargetRun.result as unknown as BuildBuilderOutput,
56+
browserTargetRun.result as unknown as BrowserBuilderOutput,
57+
serverTargetRun.result as unknown as ServerBuilderOutput,
6058
]);
6159

6260
const success =
@@ -78,8 +76,8 @@ async function _scheduleBuilds(
7876
async function _renderUniversal(
7977
routes: string[],
8078
context: BuilderContext,
81-
browserResult: BuildBuilderOutput,
82-
serverResult: BuildBuilderOutput,
79+
browserResult: BrowserBuilderOutput,
80+
serverResult: ServerBuilderOutput,
8381
browserOptions: BrowserBuilderOptions,
8482
numProcesses?: number,
8583
): Promise<PrerenderBuilderOutput> {
@@ -111,7 +109,7 @@ async function _renderUniversal(
111109

112110
try {
113111
// We need to render the routes for each locale from the browser output.
114-
for (const outputPath of browserResult.outputPaths) {
112+
for (const { path: outputPath } of browserResult.outputs) {
115113
const localeDirectory = path.relative(browserResult.baseOutputPath, outputPath);
116114
const serverBundlePath = path.join(baseOutputPath, localeDirectory, 'main.js');
117115
if (!fs.existsSync(serverBundlePath)) {

‎modules/builders/src/static-generator/index.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export async function execute(
5151
serviceWorker: false,
5252
});
5353

54-
const { success, error, outputPaths } = (await result) as BrowserBuilderOutput;
54+
const { success, error, outputs } = (await result) as BrowserBuilderOutput;
5555
if (!success) {
5656
return { success, error } as BuilderOutput;
5757
}
@@ -62,7 +62,7 @@ export async function execute(
6262

6363
const worker = createWorker();
6464
try {
65-
for (const outputPath of outputPaths) {
65+
for (const { path: outputPath } of outputs) {
6666
const spinner = ora(`Prerendering ${routes.length} route(s) to ${outputPath}...`).start();
6767

6868
const staticServer = await createStaticServer(outputPath);

‎modules/common/clover/src/module.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
ɵDomSharedStylesHost as DomSharedStylesHost,
2222
ɵSharedStylesHost as SharedStylesHost,
2323
TransferState,
24-
ɵescapeHtml as escapeHtml,
2524
} from '@angular/platform-browser';
2625
import { filter, mapTo, take } from 'rxjs/operators';
2726
import { SSRStylesHost } from './styles_host';
@@ -83,3 +82,15 @@ export class RendererModule {
8382
};
8483
}
8584
}
85+
86+
function escapeHtml(text: string): string {
87+
const escapedText: { [k: string]: string } = {
88+
'&': '&a;',
89+
'"': '&q;',
90+
"'": '&s;',
91+
'<': '&l;',
92+
'>': '&g;',
93+
};
94+
95+
return text.replace(/[&"'<>]/g, (s) => escapedText[s]);
96+
}

‎modules/common/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"tslib": "^2.3.0"
2121
},
2222
"peerDependencies": {
23-
"@angular/common": "^15.0.0",
24-
"@angular/core": "^15.0.0"
23+
"@angular/common": "^16.0.0 || ^16.0.0-next.0",
24+
"@angular/core": "^16.0.0 || ^16.0.0-next.0"
2525
},
2626
"schematics": "./schematics/collection.json",
2727
"ng-update": {

‎modules/express-engine/package.json‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
"node": "^16.13.0 || >=18.10.0"
1313
},
1414
"peerDependencies": {
15-
"@angular/common": "^15.0.0",
16-
"@angular/core": "^15.0.0",
17-
"@angular/platform-server": "^15.0.0",
15+
"@angular/common": "^16.0.0 || ^16.0.0-next.0",
16+
"@angular/core": "^16.0.0 || ^16.0.0-next.0",
1817
"express": "EXPRESS_VERSION"
1918
},
2019
"dependencies": {

‎modules/express-engine/schematics/utils/utils.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,23 +134,23 @@ export function addInitialNavigation(node: ts.CallExpression): ts.CallExpression
134134
return node;
135135
}
136136

137-
const enabledLiteral = ts.createStringLiteral('enabledBlocking');
137+
const enabledLiteral = ts.factory.createStringLiteral('enabledBlocking');
138138
// TypeScript will emit the Node with double quotes.
139139
// In schematics we usually write code with a single quotes
140140
// eslint-disable-next-line @typescript-eslint/no-explicit-any
141141
(enabledLiteral as any).singleQuote = true;
142142

143-
const initialNavigationProperty = ts.createPropertyAssignment(
143+
const initialNavigationProperty = ts.factory.createPropertyAssignment(
144144
'initialNavigation',
145145
enabledLiteral,
146146
);
147147
const routerOptions = existingOptions
148-
? ts.updateObjectLiteral(
148+
? ts.factory.updateObjectLiteralExpression(
149149
existingOptions,
150-
ts.createNodeArray([...existingOptions.properties, initialNavigationProperty]),
150+
ts.factory.createNodeArray([...existingOptions.properties, initialNavigationProperty]),
151151
)
152-
: ts.createObjectLiteral([initialNavigationProperty], true);
152+
: ts.factory.createObjectLiteralExpression([initialNavigationProperty], true);
153153
const args = [node.arguments[0], routerOptions];
154154

155-
return ts.createCall(node.expression, node.typeArguments, args);
155+
return ts.factory.createCallExpression(node.expression, node.typeArguments, args);
156156
}

‎package.json‎

Lines changed: 19 additions & 19 deletions

0 commit comments

Comments
 (0)