@nx/angular 0.0.0-pr-30651-cf7cc52 → 0.0.0-pr-30756-ba621b6

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/migrations.json CHANGED
@@ -1666,6 +1666,15 @@
1666
1666
  "alwaysAddToPackageJson": false
1667
1667
  }
1668
1668
  }
1669
+ },
1670
+ "20.8.1": {
1671
+ "version": "20.8.1-beta.0",
1672
+ "packages": {
1673
+ "@nx/angular-rspack": {
1674
+ "version": "^20.7.0",
1675
+ "alwaysAddToPackageJson": false
1676
+ }
1677
+ }
1669
1678
  }
1670
1679
  }
1671
1680
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "0.0.0-pr-30651-cf7cc52",
3
+ "version": "0.0.0-pr-30756-ba621b6",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Playwright and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -72,14 +72,14 @@
72
72
  "semver": "^7.5.3",
73
73
  "tslib": "^2.3.0",
74
74
  "webpack-merge": "^5.8.0",
75
- "@nx/devkit": "0.0.0-pr-30651-cf7cc52",
76
- "@nx/js": "0.0.0-pr-30651-cf7cc52",
77
- "@nx/eslint": "0.0.0-pr-30651-cf7cc52",
78
- "@nx/webpack": "0.0.0-pr-30651-cf7cc52",
79
- "@nx/rspack": "0.0.0-pr-30651-cf7cc52",
80
- "@nx/module-federation": "0.0.0-pr-30651-cf7cc52",
81
- "@nx/web": "0.0.0-pr-30651-cf7cc52",
82
- "@nx/workspace": "0.0.0-pr-30651-cf7cc52",
75
+ "@nx/devkit": "0.0.0-pr-30756-ba621b6",
76
+ "@nx/js": "0.0.0-pr-30756-ba621b6",
77
+ "@nx/eslint": "0.0.0-pr-30756-ba621b6",
78
+ "@nx/webpack": "0.0.0-pr-30756-ba621b6",
79
+ "@nx/rspack": "0.0.0-pr-30756-ba621b6",
80
+ "@nx/module-federation": "0.0.0-pr-30756-ba621b6",
81
+ "@nx/web": "0.0.0-pr-30756-ba621b6",
82
+ "@nx/workspace": "0.0.0-pr-30756-ba621b6",
83
83
  "piscina": "^4.4.0"
84
84
  },
85
85
  "peerDependencies": {
@@ -76,6 +76,12 @@ async function applicationGenerator(tree, schema) {
76
76
  skipInstall: options.skipPackageJson,
77
77
  skipFormat: true,
78
78
  });
79
+ if (options.ssr) {
80
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files/rspack-ssr'), options.appProjectSourceRoot, {
81
+ pathToDistFolder: (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(options.appProjectRoot), options.outputPath, 'browser'),
82
+ tmpl: '',
83
+ });
84
+ }
79
85
  }
80
86
  if (!options.skipFormat) {
81
87
  await (0, devkit_1.formatFiles)(tree);
@@ -0,0 +1,72 @@
1
+ import 'zone.js/node';
2
+
3
+ import { APP_BASE_HREF } from '@angular/common';
4
+ import { CommonEngine } from '@angular/ssr/node';
5
+ import * as express from 'express';
6
+ import { existsSync } from 'node:fs';
7
+ import { join } from 'node:path';
8
+ import bootstrap from './main.server';
9
+
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(), "<%= pathToDistFolder %>");
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/**', (req, res) => { });
25
+ // Serve static files from /browser
26
+ server.get(
27
+ '*.*',
28
+ express.static(distFolder, {
29
+ maxAge: '1y',
30
+ })
31
+ );
32
+
33
+ // All regular routes use the Angular engine
34
+ server.get('*', (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
+ console.log(`Node Express server listening on http://localhost:${port}`);
59
+ });
60
+ }
61
+
62
+ // Webpack will replace 'require' with '__webpack_require__'
63
+ // '__non_webpack_require__' is a proxy to Node 'require'
64
+ // The below code is to ensure that the server is run only when not requiring the bundle.
65
+ declare const __non_webpack_require__: NodeRequire;
66
+ const mainModule = __non_webpack_require__.main;
67
+ const moduleFilename = (mainModule && mainModule.filename) || '';
68
+ if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
69
+ run();
70
+ }
71
+
72
+ export default bootstrap;
@@ -20,7 +20,6 @@ export interface Schema {
20
20
  e2eTestRunner?: E2eTestRunner;
21
21
  backendProject?: string;
22
22
  strict?: boolean;
23
- standaloneConfig?: boolean;
24
23
  port?: number;
25
24
  setParserOptionsProject?: boolean;
26
25
  skipPackageJson?: boolean;
@@ -130,12 +130,6 @@
130
130
  "description": "Create an application with stricter type checking and build optimization options.",
131
131
  "default": true
132
132
  },
133
- "standaloneConfig": {
134
- "description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
135
- "type": "boolean",
136
- "default": true,
137
- "x-deprecated": "Nx only supports standaloneConfig"
138
- },
139
133
  "port": {
140
134
  "type": "number",
141
135
  "description": "The port at which the remote application should be served."
@@ -14,7 +14,9 @@ const enquirer_1 = require("enquirer");
14
14
  const SUPPORTED_EXECUTORS = [
15
15
  '@angular-devkit/build-angular:browser',
16
16
  '@angular-devkit/build-angular:dev-server',
17
+ '@angular-devkit/build-angular:server',
17
18
  '@nx/angular:webpack-browser',
19
+ '@nx/angular:webpack-server',
18
20
  '@nx/angular:dev-server',
19
21
  '@nx/angular:module-federation-dev-server',
20
22
  ];
@@ -22,21 +24,7 @@ const RENAMED_OPTIONS = {
22
24
  main: 'browser',
23
25
  ngswConfigPath: 'serviceWorker',
24
26
  };
25
- const REMOVED_OPTIONS = [
26
- 'publicHost',
27
- 'disableHostCheck',
28
- 'resourcesOutputPath',
29
- 'routesFile',
30
- 'routes',
31
- 'discoverRoutes',
32
- 'appModuleBundle',
33
- 'inputIndexPath',
34
- 'outputIndexPath',
35
- 'buildOptimizer',
36
- 'deployUrl',
37
- 'buildTarget',
38
- 'browserTarget',
39
- ];
27
+ const REMOVED_OPTIONS = ['buildOptimizer', 'buildTarget', 'browserTarget'];
40
28
  function normalizeFromProjectRoot(tree, path, projectRoot) {
41
29
  if (projectRoot === '.') {
42
30
  if (!path.startsWith('./')) {
@@ -268,6 +256,13 @@ async function convertToRspack(tree, schema) {
268
256
  }
269
257
  buildTargetNames.push(targetName);
270
258
  }
259
+ else if (target.executor === '@angular-devkit/build-angular:server' ||
260
+ target.executor === '@nx/angular:webpack-server') {
261
+ createConfigOptions.ssr ??= {};
262
+ createConfigOptions.ssr.entry ??= normalizeFromProjectRoot(tree, target.options.main, project.root);
263
+ createConfigOptions.server = './src/main.server.ts';
264
+ buildTargetNames.push(targetName);
265
+ }
271
266
  else if (target.executor === '@angular-devkit/build-angular:dev-server' ||
272
267
  target.executor === '@nx/angular:dev-server' ||
273
268
  target.executor === '@nx/angular:module-federation-dev-server') {
@@ -20,7 +20,6 @@ export interface Schema {
20
20
  e2eTestRunner?: E2eTestRunner;
21
21
  backendProject?: string;
22
22
  strict?: boolean;
23
- standaloneConfig?: boolean;
24
23
  inlineStyle?: boolean;
25
24
  inlineTemplate?: boolean;
26
25
  viewEncapsulation?: 'Emulated' | 'Native' | 'None';
@@ -144,12 +144,6 @@
144
144
  "description": "Create an application with stricter type checking and build optimization options.",
145
145
  "default": true
146
146
  },
147
- "standaloneConfig": {
148
- "description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
149
- "type": "boolean",
150
- "default": true,
151
- "x-deprecated": "Nx only supports standaloneConfig"
152
- },
153
147
  "setParserOptionsProject": {
154
148
  "type": "boolean",
155
149
  "description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
@@ -12,7 +12,6 @@ export interface NormalizedSchema {
12
12
  buildable?: boolean;
13
13
  publishable?: boolean;
14
14
  importPath?: string;
15
- standaloneConfig?: boolean;
16
15
  spec?: boolean;
17
16
  commonModule?: boolean;
18
17
  routing?: boolean;
@@ -12,7 +12,6 @@ export interface Schema {
12
12
  buildable?: boolean;
13
13
  publishable?: boolean;
14
14
  importPath?: string;
15
- standaloneConfig?: boolean;
16
15
  spec?: boolean;
17
16
  flat?: boolean;
18
17
  commonModule?: boolean;
@@ -108,12 +108,6 @@
108
108
  "enum": ["eslint", "none"],
109
109
  "default": "eslint"
110
110
  },
111
- "standaloneConfig": {
112
- "description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
113
- "type": "boolean",
114
- "default": true,
115
- "x-deprecated": "Nx only supports standaloneConfig"
116
- },
117
111
  "compilationMode": {
118
112
  "description": "Specifies the compilation mode to use. If not specified, it will default to `partial` for publishable libraries and to `full` for buildable libraries. The `full` value can not be used for publishable libraries.",
119
113
  "type": "string",
@@ -19,7 +19,6 @@ export interface Schema {
19
19
  e2eTestRunner?: E2eTestRunner;
20
20
  backendProject?: string;
21
21
  strict?: boolean;
22
- standaloneConfig?: boolean;
23
22
  inlineStyle?: boolean;
24
23
  inlineTemplate?: boolean;
25
24
  viewEncapsulation?: 'Emulated' | 'Native' | 'None';
@@ -138,12 +138,6 @@
138
138
  "description": "Create an application with stricter type checking and build optimization options.",
139
139
  "default": true
140
140
  },
141
- "standaloneConfig": {
142
- "description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
143
- "type": "boolean",
144
- "default": true,
145
- "x-deprecated": "Nx only supports standaloneConfig"
146
- },
147
141
  "setParserOptionsProject": {
148
142
  "type": "boolean",
149
143
  "description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
@@ -2,7 +2,7 @@ export declare const nxVersion: any;
2
2
  export declare const angularVersion = "~19.2.0";
3
3
  export declare const angularDevkitVersion = "~19.2.0";
4
4
  export declare const ngPackagrVersion = "~19.2.0";
5
- export declare const angularRspackVersion = "~20.6.1";
5
+ export declare const angularRspackVersion = "^20.7.0";
6
6
  export declare const ngrxVersion = "^19.0.0";
7
7
  export declare const rxjsVersion = "~7.8.0";
8
8
  export declare const zoneJsVersion = "~0.15.0";
@@ -5,7 +5,7 @@ exports.nxVersion = require('../../package.json').version;
5
5
  exports.angularVersion = '~19.2.0';
6
6
  exports.angularDevkitVersion = '~19.2.0';
7
7
  exports.ngPackagrVersion = '~19.2.0';
8
- exports.angularRspackVersion = '~20.6.1';
8
+ exports.angularRspackVersion = '^20.7.0';
9
9
  exports.ngrxVersion = '^19.0.0';
10
10
  exports.rxjsVersion = '~7.8.0';
11
11
  exports.zoneJsVersion = '~0.15.0';