Skip to content

Commit 19bea19

Browse files
feat(angular-rspack,angular-rspack-compiler): support angular 20 (#99)
* feat(angular-rspack,angular-rspack-compiler): support angular 20 * chore(repo): integration test output updaet * chore(repo): rsbuild-ssr-csr server entry update * feat(angular-rspack): match changes in v20 * feat(angular-rspack): update nx and angular versions --------- Co-authored-by: Leosvel Pérez Espinosa <[email protected]>
1 parent ed68365 commit 19bea19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+5969
-5185
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,5 @@ apps/docs/__deploy
5353
.code-pushup
5454

5555
test-output
56+
.cursor/rules/nx-rules.mdc
57+
.github/instructions/nx.instructions.md

apps/docs/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"@rsbuild/plugin-sass": "^1.1.2"
55
},
66
"dependencies": {
7-
"@angular/common": "19.1.6",
8-
"@angular/core": "19.1.6",
9-
"@angular/material": "19.0.4",
10-
"@angular/platform-browser": "19.1.6",
11-
"@angular/platform-server": "19.1.6",
12-
"@angular/router": "19.1.6",
7+
"@angular/common": "20.0.0",
8+
"@angular/core": "20.0.0",
9+
"@angular/material": "20.0.0",
10+
"@angular/platform-browser": "20.0.0",
11+
"@angular/router": "20.0.0",
12+
"@angular/ssr": "20.0.0",
1313
"@nx/angular-rsbuild": "workspace:*",
1414
"highlight.js": "^11.11.1"
1515
}

apps/docs/src/app/app.config.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
2-
import { provideServerRendering } from '@angular/platform-server';
2+
import { provideServerRendering } from '@angular/ssr';
33
import { appConfig } from './app.config';
44

55
const serverConfig: ApplicationConfig = {

apps/docs/tsconfig.app.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

e2e/fixtures/rsbuild-csr-css/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"private": true,
33
"dependencies": {
4-
"@angular/common": "19.1.6",
5-
"@angular/core": "19.1.6",
6-
"@angular/platform-browser": "19.1.6",
7-
"@angular/router": "19.1.6",
4+
"@angular/common": "20.0.0",
5+
"@angular/core": "20.0.0",
6+
"@angular/platform-browser": "20.0.0",
7+
"@angular/router": "20.0.0",
88
"@nx/angular-rsbuild": "workspace:*"
99
},
1010
"devDependencies": {

e2e/fixtures/rsbuild-csr-less/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"private": true,
33
"dependencies": {
4-
"@angular/common": "19.1.6",
5-
"@angular/core": "19.1.6",
6-
"@angular/platform-browser": "19.1.6",
7-
"@angular/router": "19.1.6",
4+
"@angular/common": "20.0.0",
5+
"@angular/core": "20.0.0",
6+
"@angular/platform-browser": "20.0.0",
7+
"@angular/router": "20.0.0",
88
"@nx/angular-rsbuild": "workspace:*"
99
},
1010
"devDependencies": {

e2e/fixtures/rsbuild-ssr-css/src/app/app.config.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
2-
import { provideServerRendering } from '@angular/platform-server';
2+
import { provideServerRendering } from '@angular/ssr';
33
import { appConfig } from './app.config';
44

55
const serverConfig: ApplicationConfig = {
Lines changed: 74 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,76 @@
1-
// eslint-disable-next-line @nx/enforce-module-boundaries
2-
import { createServer } from '@nx/angular-rsbuild/ssr';
1+
import 'zone.js/node';
2+
3+
import { APP_BASE_HREF } from '@angular/common';
4+
import { CommonEngine } from '@angular/ssr/node';
5+
import express from 'express';
6+
import { existsSync } from 'node:fs';
7+
import { join } from 'node:path';
38
import bootstrap from './main.server';
49

5-
const server = createServer(bootstrap);
6-
7-
/** Add your custom server logic here
8-
*
9-
* For example, you can add a custom static file server:
10-
* server.app.use('/static', express.static(staticFolder));
11-
* Or add additional api routes:
12-
* server.app.get('/api/hello', (req, res) => {
13-
* res.send('Hello World!');
14-
* });
15-
* Or add additional middleware:
16-
* server.app.use((req, res, next) => {
17-
* res.send('Hello World!');
18-
* });
19-
*/
20-
21-
server.listen();
10+
// The Express app is exported so that it can be used by serverless Functions.
11+
export function app(): express.Express {
12+
const server = express();
13+
const distFolder = join(process.cwd(), 'dist/browser');
14+
const indexHtml = existsSync(join(distFolder, 'index.original.html'))
15+
? join(distFolder, 'index.original.html')
16+
: join(distFolder, 'index.html');
17+
18+
const commonEngine = new CommonEngine();
19+
20+
server.set('view engine', 'html');
21+
server.set('views', distFolder);
22+
23+
// Example Express Rest API endpoints
24+
// server.get('/api/{*splat}', (req, res) => { });
25+
// Serve static files from /browser
26+
server.use(
27+
express.static(distFolder, {
28+
maxAge: '1y',
29+
index: false,
30+
})
31+
);
32+
33+
// All regular routes use the Angular engine
34+
server.use((req, res, next) => {
35+
const { protocol, originalUrl, baseUrl, headers } = req;
36+
37+
commonEngine
38+
.render({
39+
bootstrap,
40+
documentFilePath: indexHtml,
41+
url: `${protocol}://${headers.host}${originalUrl}`,
42+
publicPath: distFolder,
43+
providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],
44+
})
45+
.then((html) => res.send(html))
46+
.catch((err) => next(err));
47+
});
48+
49+
return server;
50+
}
51+
52+
function run(): void {
53+
const port = process.env['PORT'] || 4000;
54+
55+
// Start up the Node server
56+
const server = app();
57+
server.listen(port, () => {
58+
// if (error) {
59+
// throw error;
60+
// }
61+
62+
console.log(`Node Express server listening on http://localhost:${port}`);
63+
});
64+
}
65+
66+
// Webpack will replace 'require' with '__webpack_require__'
67+
// '__non_webpack_require__' is a proxy to Node 'require'
68+
// The below code is to ensure that the server is run only when not requiring the bundle.
69+
declare const __non_webpack_require__: NodeRequire;
70+
const mainModule = __non_webpack_require__.main;
71+
const moduleFilename = (mainModule && mainModule.filename) || '';
72+
if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
73+
run();
74+
}
75+
76+
export default bootstrap;

e2e/fixtures/rspack-appshell-css/src/app/app.config.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
2-
import { provideServerRendering } from '@angular/platform-server';
2+
import { provideServerRendering } from '@angular/ssr';
33
import { appConfig } from './app.config';
44

55
const serverConfig: ApplicationConfig = {

e2e/fixtures/rspack-ssg-css/src/app/app.config.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
2-
import { provideServerRendering } from '@angular/platform-server';
2+
import { provideServerRendering } from '@angular/ssr';
33
import { appConfig } from './app.config';
44

55
const serverConfig: ApplicationConfig = {

e2e/fixtures/rspack-ssr-css/src/app/app.config.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
2-
import { provideServerRendering } from '@angular/platform-server';
2+
import { provideServerRendering } from '@angular/ssr';
33
import { appConfig } from './app.config';
44

55
const serverConfig: ApplicationConfig = {

nx.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
"dependsOn": ["^build"]
4040
},
4141
"build": {
42-
"cache": true
42+
"cache": true,
43+
"dependsOn": ["^build"]
4344
},
4445
"lint": {
4546
"cache": true,

package.json

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,58 +7,59 @@
77
"eslint-next/nx": "pnpx tsx --tsconfig tools/tsconfig.tools.json tools/scripts/eslint-next/bin.ts --report",
88
"check-format": "pnpx nx format:check",
99
"check-commit": "pnpm exec commitlint --from HEAD~1 --to HEAD",
10-
"release": "tsx tools/scripts/release.ts"
10+
"release": "tsx tools/scripts/release.ts",
11+
"dbg": "NX_TUI=false pnpm nx run rspack-ssg-css:build"
1112
},
1213
"private": true,
1314
"devDependencies": {
14-
"@analogjs/vite-plugin-angular": "1.14.1",
15-
"@analogjs/vitest-angular": "1.14.1",
16-
"@angular-devkit/architect": "0.1901.7",
17-
"@angular-devkit/build-angular": "19.1.7",
18-
"@angular-devkit/core": "19.1.7",
19-
"@angular-devkit/schematics": "19.1.7",
20-
"@angular/build": "19.1.7",
21-
"@angular/cli": "19.1.7",
22-
"@angular/compiler-cli": "19.1.6",
23-
"@angular/language-service": "19.1.6",
15+
"@analogjs/vite-plugin-angular": "1.17.0",
16+
"@analogjs/vitest-angular": "1.17.0",
17+
"@angular-devkit/architect": "0.2000.0",
18+
"@angular-devkit/build-angular": "20.0.0",
19+
"@angular-devkit/core": "20.0.0",
20+
"@angular-devkit/schematics": "20.0.0",
21+
"@angular/build": "20.0.0",
22+
"@angular/cli": "20.0.0",
23+
"@angular/compiler-cli": "20.0.0",
24+
"@angular/language-service": "20.0.0",
2425
"@commitlint/cli": "^19.5.0",
2526
"@commitlint/config-conventional": "^19.5.0",
2627
"@commitlint/types": "^19.5.0",
2728
"@eslint/js": "^9.8.0",
2829
"@module-federation/enhanced": "0.8.5",
2930
"@module-federation/sdk": "0.8.5",
30-
"@nx/angular": "21.0.0",
31-
"@nx/eslint": "21.0.0",
32-
"@nx/eslint-plugin": "21.0.0",
33-
"@nx/js": "21.0.0",
34-
"@nx/playwright": "21.0.0",
35-
"@nx/plugin": "21.0.0",
36-
"@nx/rsbuild": "21.0.0",
37-
"@nx/rspack": "21.0.0",
38-
"@nx/vite": "21.0.0",
39-
"@nx/web": "21.0.0",
40-
"@nx/workspace": "21.0.0",
31+
"@nx/angular": "21.2.0-beta.1",
32+
"@nx/eslint": "21.2.0-beta.1",
33+
"@nx/eslint-plugin": "21.2.0-beta.1",
34+
"@nx/js": "21.2.0-beta.1",
35+
"@nx/playwright": "21.2.0-beta.1",
36+
"@nx/plugin": "21.2.0-beta.1",
37+
"@nx/rsbuild": "21.2.0-beta.1",
38+
"@nx/rspack": "21.2.0-beta.1",
39+
"@nx/vite": "21.2.0-beta.1",
40+
"@nx/web": "21.2.0-beta.1",
41+
"@nx/workspace": "21.2.0-beta.1",
4142
"@playwright/test": "^1.36.0",
4243
"@rsbuild/core": "^1.1.12",
4344
"@rsbuild/plugin-less": "^1.1.1",
4445
"@rsbuild/plugin-sass": "^1.1.2",
4546
"@rspack/cli": "^1.3.10",
4647
"@rspack/core": "^1.3.10",
47-
"@rspack/dev-server": "1.0.9",
48-
"@schematics/angular": "19.1.7",
48+
"@rspack/dev-server": "1.1.2",
49+
"@schematics/angular": "20.0.0",
4950
"@swc-node/register": "~1.9.1",
5051
"@swc/cli": "0.6.0",
5152
"@swc/core": "~1.5.7",
5253
"@swc/helpers": "~0.5.11",
5354
"@types/express": "^4.17.21",
5455
"@types/node": "18.16.9",
5556
"@types/ws": "^8.5.13",
56-
"@typescript-eslint/eslint-plugin": "^8.13.0",
57-
"@typescript-eslint/parser": "^8.13.0",
58-
"@typescript-eslint/utils": "^8.13.0",
57+
"@typescript-eslint/eslint-plugin": "^8.29.0",
58+
"@typescript-eslint/parser": "^8.29.0",
59+
"@typescript-eslint/utils": "^8.29.0",
5960
"@vitest/coverage-v8": "^1.0.4",
6061
"@vitest/ui": "^1.3.1",
61-
"angular-eslint": "^19.0.2",
62+
"angular-eslint": "^20.0.0-alpha.1",
6263
"autoprefixer": "10.4.21",
6364
"commitlint-plugin-tense": "1.0.4",
6465
"css-loader": "^7.1.2",
@@ -73,7 +74,7 @@
7374
"jsonc-eslint-parser": "^2.4.0",
7475
"kill-port": "^2.0.1",
7576
"less-loader": "^12.2.0",
76-
"nx": "21.0.0",
77+
"nx": "21.2.0-beta.1",
7778
"loader-utils": "^3.3.1",
7879
"parse5-html-rewriting-stream": "7.0.0",
7980
"postcss": "8.5.3",
@@ -89,8 +90,8 @@
8990
"ts-morph": "^24.0.0",
9091
"ts-node": "10.9.1",
9192
"tsx": "^4.19.3",
92-
"typescript": "5.7.3",
93-
"typescript-eslint": "^8.13.0",
93+
"typescript": "5.8.3",
94+
"typescript-eslint": "^8.29.0",
9495
"verdaccio": "6.1.2",
9596
"vite": "6.3.3",
9697
"vite-plugin-dts": "4.5.3",
@@ -103,19 +104,19 @@
103104
},
104105
"dependencies": {
105106
"@ampproject/remapping": "2.3.0",
106-
"@angular/animations": "19.1.6",
107-
"@angular/cdk": "19.0.4",
108-
"@angular/common": "19.1.6",
109-
"@angular/compiler": "19.1.6",
110-
"@angular/core": "19.1.6",
111-
"@angular/forms": "19.1.6",
112-
"@angular/localize": "19.1.6",
113-
"@angular/material": "19.0.4",
114-
"@angular/platform-browser": "19.1.6",
115-
"@angular/platform-browser-dynamic": "19.1.6",
116-
"@angular/platform-server": "19.1.6",
117-
"@angular/router": "19.1.6",
118-
"@angular/ssr": "19.1.6",
107+
"@angular/animations": "20.0.0",
108+
"@angular/cdk": "20.0.0",
109+
"@angular/common": "20.0.0",
110+
"@angular/compiler": "20.0.0",
111+
"@angular/core": "20.0.0",
112+
"@angular/forms": "20.0.0",
113+
"@angular/localize": "20.0.0",
114+
"@angular/material": "20.0.0",
115+
"@angular/platform-browser": "20.0.0",
116+
"@angular/platform-browser-dynamic": "20.0.0",
117+
"@angular/platform-server": "20.0.0",
118+
"@angular/router": "20.0.0",
119+
"@angular/ssr": "20.0.0",
119120
"@babel/core": "7.26.10",
120121
"@code-pushup/cli": "^0.63.0",
121122
"@code-pushup/coverage-plugin": "^0.64.0",
@@ -125,7 +126,7 @@
125126
"@code-pushup/utils": "^0.63.0",
126127
"@commitlint/config-nx-scopes": "^19.5.0",
127128
"@netlify/functions": "^3.0.0",
128-
"@nx/devkit": "21.0.0",
129+
"@nx/devkit": "21.2.0-beta.1",
129130
"@types/minimatch": "^5.1.2",
130131
"ansis": "^3.9.0",
131132
"deepmerge": "^4.3.1",
@@ -134,7 +135,7 @@
134135
"highlight.js": "^11.11.1",
135136
"memfs": "^4.17.0",
136137
"minimatch": "^10.0.1",
137-
"piscina": "4.9.2",
138+
"piscina": "5.0.0",
138139
"rxjs": "~7.8.0",
139140
"serverless-http": "^3.2.0",
140141
"tslib": "^2.3.0",
@@ -150,10 +151,10 @@
150151
"@angular/build"
151152
],
152153
"allowedVersions": {
153-
"@angular/core": "19.1.6",
154-
"@angular/compiler": "19.1.6",
155-
"@angular/compiler-cli": "19.1.6",
156-
"@angular/build": "19.1.7"
154+
"@angular/core": "20.0.0",
155+
"@angular/compiler": "20.0.0",
156+
"@angular/compiler-cli": "20.0.0",
157+
"@angular/build": "20.0.0"
157158
}
158159
}
159160
},

packages/angular-rsbuild/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@
4848
"@ng-rspack/testing-setup": "workspace:*"
4949
},
5050
"peerDependencies": {
51-
"@angular/common": ">=19.0.0 <20.0.0",
52-
"@angular/ssr": ">=19.0.0 <20.0.0",
51+
"@angular/common": ">=19.0.0 <21.0.0",
52+
"@angular/ssr": ">=19.0.0 <21.0.0",
5353
"@rsbuild/core": ">=1.0.5 <2.0.0"
5454
},
5555
"nx": {

packages/angular-rspack-compiler/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
}
3737
},
3838
"dependencies": {
39-
"@angular/build": "19.2.3",
39+
"@angular/build": "20.0.0",
4040
"sass-embedded": "^1.79.3",
4141
"ts-morph": "^24.0.0",
4242
"tslib": "^2.3.0",
@@ -50,7 +50,7 @@
5050
"vitest": "^1.3.1"
5151
},
5252
"peerDependencies": {
53-
"@angular/compiler-cli": ">=19.0.0 <20.0.0",
53+
"@angular/compiler-cli": ">=19.0.0 <21.0.0",
5454
"@rsbuild/core": ">=1.0.5 <2.0.0"
5555
},
5656
"nx": {

0 commit comments

Comments
 (0)