@nx/angular 21.0.0-canary.20250422-8619c1d → 21.0.0-canary.20250424-e23b25f
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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nx/angular",
|
3
|
-
"version": "21.0.0-canary.
|
3
|
+
"version": "21.0.0-canary.20250424-e23b25f",
|
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": {
|
@@ -67,14 +67,14 @@
|
|
67
67
|
"semver": "^7.5.3",
|
68
68
|
"tslib": "^2.3.0",
|
69
69
|
"webpack-merge": "^5.8.0",
|
70
|
-
"@nx/devkit": "21.0.0-canary.
|
71
|
-
"@nx/js": "21.0.0-canary.
|
72
|
-
"@nx/eslint": "21.0.0-canary.
|
73
|
-
"@nx/webpack": "21.0.0-canary.
|
74
|
-
"@nx/rspack": "21.0.0-canary.
|
75
|
-
"@nx/module-federation": "21.0.0-canary.
|
76
|
-
"@nx/web": "21.0.0-canary.
|
77
|
-
"@nx/workspace": "21.0.0-canary.
|
70
|
+
"@nx/devkit": "21.0.0-canary.20250424-e23b25f",
|
71
|
+
"@nx/js": "21.0.0-canary.20250424-e23b25f",
|
72
|
+
"@nx/eslint": "21.0.0-canary.20250424-e23b25f",
|
73
|
+
"@nx/webpack": "21.0.0-canary.20250424-e23b25f",
|
74
|
+
"@nx/rspack": "21.0.0-canary.20250424-e23b25f",
|
75
|
+
"@nx/module-federation": "21.0.0-canary.20250424-e23b25f",
|
76
|
+
"@nx/web": "21.0.0-canary.20250424-e23b25f",
|
77
|
+
"@nx/workspace": "21.0.0-canary.20250424-e23b25f",
|
78
78
|
"piscina": "^4.4.0"
|
79
79
|
},
|
80
80
|
"peerDependencies": {
|
@@ -24,7 +24,13 @@ const RENAMED_OPTIONS = {
|
|
24
24
|
main: 'browser',
|
25
25
|
ngswConfigPath: 'serviceWorker',
|
26
26
|
};
|
27
|
-
const
|
27
|
+
const DEFAULT_PORT = 4200;
|
28
|
+
const REMOVED_OPTIONS = [
|
29
|
+
'buildOptimizer',
|
30
|
+
'buildTarget',
|
31
|
+
'browserTarget',
|
32
|
+
'publicHost',
|
33
|
+
];
|
28
34
|
function normalizeFromProjectRoot(tree, path, projectRoot) {
|
29
35
|
if (projectRoot === '.') {
|
30
36
|
if (!path.startsWith('./')) {
|
@@ -244,6 +250,7 @@ async function convertToRspack(tree, schema) {
|
|
244
250
|
const serveTargetNames = [];
|
245
251
|
let customWebpackConfigPath;
|
246
252
|
(0, validate_supported_executor_1.validateSupportedBuildExecutor)(Object.values(project.targets));
|
253
|
+
let projectServePort = DEFAULT_PORT;
|
247
254
|
for (const [targetName, target] of Object.entries(project.targets)) {
|
248
255
|
if (target.executor === '@angular-devkit/build-angular:browser' ||
|
249
256
|
target.executor === '@nx/angular:webpack-browser') {
|
@@ -269,6 +276,9 @@ async function convertToRspack(tree, schema) {
|
|
269
276
|
createConfigOptions.devServer = {};
|
270
277
|
if (target.options) {
|
271
278
|
handleDevServerTargetOptions(tree, target.options, createConfigOptions.devServer, project.root);
|
279
|
+
if (target.options.port !== DEFAULT_PORT) {
|
280
|
+
projectServePort = target.options.port;
|
281
|
+
}
|
272
282
|
}
|
273
283
|
if (target.configurations) {
|
274
284
|
for (const [configurationName, configuration] of Object.entries(target.configurations)) {
|
@@ -288,6 +298,11 @@ async function convertToRspack(tree, schema) {
|
|
288
298
|
for (const targetName of [...buildTargetNames, ...serveTargetNames]) {
|
289
299
|
delete project.targets[targetName];
|
290
300
|
}
|
301
|
+
if (projectServePort !== DEFAULT_PORT) {
|
302
|
+
project.targets.serve ??= {};
|
303
|
+
project.targets.serve.options ??= {};
|
304
|
+
project.targets.serve.options.port = projectServePort;
|
305
|
+
}
|
291
306
|
(0, devkit_1.updateProjectConfiguration)(tree, projectName, project);
|
292
307
|
const { rspackInitGenerator } = (0, devkit_1.ensurePackage)('@nx/rspack', versions_1.nxVersion);
|
293
308
|
await rspackInitGenerator(tree, {
|
@@ -9,7 +9,7 @@ function createConfig(tree, opts, configurationOptions = {}, existingWebpackConf
|
|
9
9
|
? Object.entries(configurationOptions)
|
10
10
|
.map(([configurationName, configurationOptions]) => {
|
11
11
|
return `
|
12
|
-
${configurationName}: {
|
12
|
+
"${configurationName}": {
|
13
13
|
options: {
|
14
14
|
${JSON.stringify(configurationOptions, undefined, 2).slice(1, -1)}
|
15
15
|
}
|
@@ -17,6 +17,12 @@ function createConfig(tree, opts, configurationOptions = {}, existingWebpackConf
|
|
17
17
|
})
|
18
18
|
.join(',\n')
|
19
19
|
: '';
|
20
|
+
const createConfigContents = `createConfig({
|
21
|
+
options: {
|
22
|
+
root: __dirname,
|
23
|
+
${JSON.stringify(createConfigOptions, undefined, 2).slice(1, -1)}
|
24
|
+
}
|
25
|
+
}${hasConfigurations ? `, {${expandedConfigurationOptions}}` : ''});`;
|
20
26
|
const configContents = `
|
21
27
|
import { createConfig }from '@nx/angular-rspack';
|
22
28
|
${existingWebpackConfigPath
|
@@ -26,23 +32,14 @@ function createConfig(tree, opts, configurationOptions = {}, existingWebpackConf
|
|
26
32
|
: `import webpackMerge from 'webpack-merge';`}`
|
27
33
|
: ''}
|
28
34
|
|
29
|
-
${existingWebpackConfigPath ? 'const baseConfig = ' : 'export default '}createConfig({
|
30
|
-
options: {
|
31
|
-
root: __dirname,
|
32
|
-
${JSON.stringify(createConfigOptions, undefined, 2).slice(1, -1)}
|
33
|
-
}
|
34
|
-
}${hasConfigurations ? `, {${expandedConfigurationOptions}}` : ''});
|
35
35
|
${existingWebpackConfigPath
|
36
|
-
? `
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
? `export default async () => {
|
37
|
+
const baseConfig = await ${createConfigContents}
|
38
|
+
${isExistingWebpackConfigFunction
|
39
|
+
? `const oldConfig = await baseWebpackConfig;
|
40
40
|
const browserConfig = baseConfig[0];
|
41
|
-
return oldConfig(browserConfig)
|
42
|
-
|
43
|
-
|
44
|
-
`
|
45
|
-
: ''}
|
46
|
-
`;
|
41
|
+
return oldConfig(browserConfig);`
|
42
|
+
: 'return webpackMerge(baseConfig[0], baseWebpackConfig);'}};`
|
43
|
+
: `export default ${createConfigContents}`}`;
|
47
44
|
tree.write((0, devkit_1.joinPathFragments)(root, 'rspack.config.ts'), configContents);
|
48
45
|
}
|
@@ -30,7 +30,7 @@ function convertWebpackConfigToUseNxModuleFederationPlugin(webpackConfigContents
|
|
30
30
|
const withModuleFederationImportNodes = (0, tsquery_1.tsquery)(ast, 'ImportDeclaration:has(StringLiteral[value=@nx/module-federation/angular])');
|
31
31
|
if (withModuleFederationImportNodes.length > 0) {
|
32
32
|
const withModuleFederationImportNode = withModuleFederationImportNodes[0];
|
33
|
-
newWebpackConfigContents = `${webpackConfigContents.slice(0, withModuleFederationImportNode.getStart())}import { NxModuleFederationPlugin } from '@nx/module-federation/rspack';${webpackConfigContents.slice(withModuleFederationImportNode.getEnd())}`;
|
33
|
+
newWebpackConfigContents = `${webpackConfigContents.slice(0, withModuleFederationImportNode.getStart())}import { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } from '@nx/module-federation/rspack';${webpackConfigContents.slice(withModuleFederationImportNode.getEnd())}`;
|
34
34
|
ast = tsquery_1.tsquery.ast(newWebpackConfigContents);
|
35
35
|
const exportedWithModuleFederationNodes = (0, tsquery_1.tsquery)(ast, 'ExportAssignment:has(CallExpression > Identifier[name=withModuleFederation])');
|
36
36
|
if (exportedWithModuleFederationNodes.length > 0) {
|
@@ -38,9 +38,10 @@ function convertWebpackConfigToUseNxModuleFederationPlugin(webpackConfigContents
|
|
38
38
|
newWebpackConfigContents = `${newWebpackConfigContents.slice(0, exportedWithModuleFederationNode.getStart())}${newWebpackConfigContents.slice(exportedWithModuleFederationNode.getEnd())}
|
39
39
|
export default {
|
40
40
|
plugins: [
|
41
|
-
new NxModuleFederationPlugin(config, {
|
41
|
+
new NxModuleFederationPlugin({ config }, {
|
42
42
|
dts: false,
|
43
43
|
}),
|
44
|
+
new NxModuleFederationDevServerPlugin({ config }),
|
44
45
|
]
|
45
46
|
}
|
46
47
|
`;
|
@@ -52,7 +53,7 @@ function convertWebpackConfigToUseNxModuleFederationPlugin(webpackConfigContents
|
|
52
53
|
const withModuleFederationRequireNodes = (0, tsquery_1.tsquery)(ast, 'VariableStatement:has(CallExpression > Identifier[name=withModuleFederation], StringLiteral[value=@nx/module-federation/angular])');
|
53
54
|
if (withModuleFederationRequireNodes.length > 0) {
|
54
55
|
const withModuleFederationRequireNode = withModuleFederationRequireNodes[0];
|
55
|
-
newWebpackConfigContents = `${webpackConfigContents.slice(0, withModuleFederationRequireNode.getStart())}const { NxModuleFederationPlugin } = require('@nx/module-federation/rspack');${webpackConfigContents.slice(withModuleFederationRequireNode.getEnd())}`;
|
56
|
+
newWebpackConfigContents = `${webpackConfigContents.slice(0, withModuleFederationRequireNode.getStart())}const { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } = require('@nx/module-federation/rspack');${webpackConfigContents.slice(withModuleFederationRequireNode.getEnd())}`;
|
56
57
|
ast = tsquery_1.tsquery.ast(newWebpackConfigContents);
|
57
58
|
const exportedWithModuleFederationNodes = (0, tsquery_1.tsquery)(ast, 'ExpressionStatement:has(BinaryExpression > PropertyAccessExpression:has(Identifier[name=module], Identifier[name=exports]), CallExpression:has(Identifier[name=withModuleFederation]))');
|
58
59
|
if (exportedWithModuleFederationNodes.length > 0) {
|
@@ -63,6 +64,7 @@ function convertWebpackConfigToUseNxModuleFederationPlugin(webpackConfigContents
|
|
63
64
|
new NxModuleFederationPlugin({ config }, {
|
64
65
|
dts: false,
|
65
66
|
}),
|
67
|
+
new NxModuleFederationDevServerPlugin({ config }),
|
66
68
|
]
|
67
69
|
}
|
68
70
|
`;
|