@nx/angular 23.1.1 → 23.1.3
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/dist/src/builders/dev-server/dev-server.impl.js +21 -16
- package/dist/src/builders/webpack-browser/webpack-browser.impl.js +15 -12
- package/dist/src/builders/webpack-server/webpack-server.impl.js +8 -4
- package/dist/src/executors/application/application.impl.js +2 -2
- package/dist/src/executors/browser-esbuild/browser-esbuild.impl.js +1 -1
- package/dist/src/executors/extract-i18n/extract-i18n.impl.js +4 -4
- package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +8 -6
- package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +8 -8
- package/dist/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-packagr.d.ts +1 -1
- package/dist/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-packagr.js +2 -2
- package/dist/src/executors/package/ng-packagr-adjustments/ng-packagr.d.ts +1 -1
- package/dist/src/executors/package/ng-packagr-adjustments/ng-packagr.js +2 -2
- package/dist/src/executors/unit-test/unit-test.impl.js +2 -2
- package/dist/src/executors/utilities/builder-package.d.ts +1 -1
- package/dist/src/executors/utilities/builder-package.js +10 -4
- package/dist/src/generators/application/lib/add-e2e.js +1 -1
- package/dist/src/generators/application/lib/create-files.js +3 -3
- package/dist/src/generators/library/lib/create-files.js +3 -0
- package/dist/src/generators/ng-add/migrators/projects/lib.migrator.js +1 -2
- package/dist/src/generators/ng-add/utilities/format-files-task.js +2 -2
- package/dist/src/generators/ng-add/utilities/projects.js +2 -2
- package/dist/src/generators/ng-add/utilities/workspace.js +3 -4
- package/dist/src/generators/scam-to-standalone/lib/get-component-data-from-ast.d.ts +1 -1
- package/dist/src/generators/scam-to-standalone/lib/get-target-project.d.ts +1 -1
- package/dist/src/generators/scam-to-standalone/lib/replace-module-usages-with-component.d.ts +1 -1
- package/dist/src/generators/setup-mf/lib/setup-tspath-for-remote.js +3 -2
- package/dist/src/generators/setup-mf/setup-mf.js +2 -0
- package/dist/src/generators/setup-ssr/lib/add-dependencies.d.ts +1 -1
- package/dist/src/generators/setup-ssr/lib/add-dependencies.js +6 -1
- package/dist/src/generators/setup-ssr/lib/normalize-options.js +15 -3
- package/dist/src/generators/setup-ssr/lib/update-project-config.js +1 -1
- package/dist/src/generators/setup-ssr/schema.d.ts +2 -0
- package/dist/src/generators/setup-ssr/setup-ssr.js +1 -1
- package/dist/src/generators/utils/add-vitest.js +1 -2
- package/dist/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.js +2 -3
- package/dist/src/migrations/update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.js +3 -4
- package/dist/src/migrations/update-23-1-0/add-angular-build.md +1 -1
- package/dist/src/migrations/update-23-1-0/add-optional-webpack-packages.d.ts +2 -0
- package/dist/src/migrations/update-23-1-0/add-optional-webpack-packages.js +101 -0
- package/dist/src/migrations/update-23-1-0/add-optional-webpack-packages.md +39 -0
- package/dist/src/plugins/plugin.js +2 -4
- package/migrations.json +6 -0
- package/package.json +25 -13
|
@@ -3,20 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.executeDevServerBuilder = executeDevServerBuilder;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
|
-
const internal_1 = require("@nx/webpack/internal");
|
|
7
6
|
const fs_1 = require("fs");
|
|
8
|
-
const configuration_1 = require("nx/src/config/configuration");
|
|
9
|
-
const operators_1 = require("nx/src/project-graph/operators");
|
|
10
|
-
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
11
7
|
const path_1 = require("path");
|
|
12
8
|
const rxjs_1 = require("rxjs");
|
|
13
|
-
const
|
|
9
|
+
const operators_1 = require("rxjs/operators");
|
|
14
10
|
const builder_package_1 = require("../../executors/utilities/builder-package");
|
|
15
11
|
const esbuild_extensions_1 = require("../../executors/utilities/esbuild-extensions");
|
|
16
12
|
const patch_builder_context_1 = require("../../executors/utilities/patch-builder-context");
|
|
17
13
|
const buildable_libs_1 = require("../utilities/buildable-libs");
|
|
18
|
-
const webpack_1 = require("../utilities/webpack");
|
|
19
14
|
const lib_1 = require("./lib");
|
|
15
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
20
16
|
function executeDevServerBuilder(rawOptions, context) {
|
|
21
17
|
(0, lib_1.validateOptions)(rawOptions);
|
|
22
18
|
process.env.NX_TSCONFIG_PATH = (0, js_1.getRootTsConfigPath)();
|
|
@@ -28,10 +24,10 @@ function executeDevServerBuilder(rawOptions, context) {
|
|
|
28
24
|
projectName: context.target.project,
|
|
29
25
|
projectsConfigurations: (0, devkit_1.readProjectsConfigurationFromProjectGraph)(projectGraph),
|
|
30
26
|
root: context.workspaceRoot,
|
|
31
|
-
nxJsonConfiguration: (0,
|
|
27
|
+
nxJsonConfiguration: (0, internal_1.readNxJsonFromDisk)(devkit_1.workspaceRoot),
|
|
32
28
|
isVerbose: false,
|
|
33
29
|
});
|
|
34
|
-
const browserTargetProjectConfiguration = (0,
|
|
30
|
+
const browserTargetProjectConfiguration = (0, internal_1.readCachedProjectConfiguration)(parsedBuildTarget.project);
|
|
35
31
|
const buildTarget = browserTargetProjectConfiguration.targets[parsedBuildTarget.target];
|
|
36
32
|
const buildTargetOptions = {
|
|
37
33
|
...buildTarget.options,
|
|
@@ -102,32 +98,37 @@ function executeDevServerBuilder(rawOptions, context) {
|
|
|
102
98
|
* handle `@nx/angular:*` executors.
|
|
103
99
|
*/
|
|
104
100
|
(0, patch_builder_context_1.patchBuilderContext)(context, !isUsingWebpackBuilder, parsedBuildTarget);
|
|
105
|
-
(0, builder_package_1.
|
|
101
|
+
(0, builder_package_1.assertPackageIsInstalled)('@angular-devkit/build-angular', '@nx/angular:dev-server');
|
|
106
102
|
return (0, rxjs_1.combineLatest)([
|
|
107
103
|
(0, rxjs_1.from)(import('@angular-devkit/build-angular')),
|
|
108
104
|
(0, rxjs_1.from)((0, esbuild_extensions_1.loadPlugins)(buildTargetOptions.plugins, buildTargetOptions.tsConfig)),
|
|
109
105
|
(0, rxjs_1.from)((0, esbuild_extensions_1.loadMiddleware)(options.esbuildMiddleware, buildTargetOptions.tsConfig)),
|
|
110
106
|
(0, rxjs_1.from)(loadIndexHtmlFileTransformer(pathToIndexFileTransformer, buildTargetOptions.tsConfig, context, isUsingWebpackBuilder)),
|
|
111
|
-
]).pipe((0,
|
|
107
|
+
]).pipe((0, operators_1.switchMap)(([{ executeDevServerBuilder }, plugins, middleware, indexHtmlTransformer,]) => executeDevServerBuilder(delegateBuilderOptions, context, {
|
|
112
108
|
webpackConfiguration: isUsingWebpackBuilder
|
|
113
109
|
? async (baseWebpackConfig) => {
|
|
114
110
|
if (!buildLibsFromSource) {
|
|
115
111
|
const workspaceDependencies = dependencies
|
|
116
|
-
.filter((dep) => !(0,
|
|
112
|
+
.filter((dep) => !(0, internal_1.isNpmProject)(dep.node))
|
|
117
113
|
.map((dep) => dep.node.name);
|
|
118
114
|
// default for `nx run-many` is --all projects
|
|
119
115
|
// by passing an empty string for --projects, run-many will default to
|
|
120
116
|
// run the target for all projects.
|
|
121
117
|
// This will occur when workspaceDependencies = []
|
|
122
118
|
if (workspaceDependencies.length > 0) {
|
|
123
|
-
|
|
119
|
+
(0, builder_package_1.assertPackageIsInstalled)('@nx/webpack', '@nx/angular:dev-server');
|
|
120
|
+
const { WebpackNxBuildCoordinationPlugin } = await import('@nx/webpack/internal');
|
|
121
|
+
baseWebpackConfig.plugins.push(new WebpackNxBuildCoordinationPlugin(`nx run-many --target=${parsedBuildTarget.target} --projects=${workspaceDependencies.join(',')}`, { skipWatchingDeps: !options.watchDependencies }) // TODO(Colum): this can be removed when angular 20.2 is merged
|
|
124
122
|
);
|
|
125
123
|
}
|
|
126
124
|
}
|
|
127
125
|
if (!pathToWebpackConfig) {
|
|
128
126
|
return baseWebpackConfig;
|
|
129
127
|
}
|
|
130
|
-
|
|
128
|
+
(0, builder_package_1.assertPackageIsInstalled)('@nx/webpack', '@nx/angular:dev-server');
|
|
129
|
+
(0, builder_package_1.assertPackageIsInstalled)('webpack-merge', '@nx/angular:dev-server');
|
|
130
|
+
const { mergeCustomWebpackConfig } = await import('../utilities/webpack.js');
|
|
131
|
+
return mergeCustomWebpackConfig(baseWebpackConfig, pathToWebpackConfig, buildTargetOptions, context.target);
|
|
131
132
|
}
|
|
132
133
|
: undefined,
|
|
133
134
|
...(indexHtmlTransformer
|
|
@@ -154,7 +155,11 @@ async function loadIndexHtmlFileTransformer(pathToIndexFileTransformer, tsConfig
|
|
|
154
155
|
if (!pathToIndexFileTransformer) {
|
|
155
156
|
return undefined;
|
|
156
157
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
if (isUsingWebpackBuilder) {
|
|
159
|
+
(0, builder_package_1.assertPackageIsInstalled)('@nx/webpack', '@nx/angular:dev-server');
|
|
160
|
+
(0, builder_package_1.assertPackageIsInstalled)('webpack-merge', '@nx/angular:dev-server');
|
|
161
|
+
const { resolveIndexHtmlTransformer } = await import('../utilities/webpack.js');
|
|
162
|
+
return resolveIndexHtmlTransformer(pathToIndexFileTransformer, tsConfig, context.target);
|
|
163
|
+
}
|
|
164
|
+
return (0, esbuild_extensions_1.loadIndexHtmlTransformer)(pathToIndexFileTransformer, tsConfig);
|
|
160
165
|
}
|
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.executeWebpackBrowserBuilder = executeWebpackBrowserBuilder;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const internal_1 = require("@nx/webpack/internal");
|
|
6
5
|
const fs_1 = require("fs");
|
|
7
|
-
const operators_1 = require("nx/src/project-graph/operators");
|
|
8
|
-
const utils_1 = require("nx/src/tasks-runner/utils");
|
|
9
6
|
const path_1 = require("path");
|
|
10
7
|
const rxjs_1 = require("rxjs");
|
|
11
|
-
const
|
|
8
|
+
const operators_1 = require("rxjs/operators");
|
|
12
9
|
const builder_package_1 = require("../../executors/utilities/builder-package");
|
|
13
10
|
const buildable_libs_1 = require("../utilities/buildable-libs");
|
|
14
|
-
const
|
|
11
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
15
12
|
// This is required to ensure that the webpack version used by the Module Federation is the same as the one used by the builders.
|
|
16
13
|
const Module = require('module');
|
|
17
14
|
const originalResolveFilename = Module._resolveFilename;
|
|
@@ -36,11 +33,12 @@ function shouldSkipInitialTargetRun(projectGraph, project, target) {
|
|
|
36
33
|
allTargetNames.add(targetName);
|
|
37
34
|
}
|
|
38
35
|
}
|
|
39
|
-
const projectDependencyConfigs = (0,
|
|
36
|
+
const projectDependencyConfigs = (0, internal_1.getDependencyConfigs)({ project, target }, {}, projectGraph, Array.from(allTargetNames));
|
|
40
37
|
// if the task runner already ran the target, skip the initial run
|
|
41
38
|
return projectDependencyConfigs.some((d) => d.target === target && d.projects === 'dependencies');
|
|
42
39
|
}
|
|
43
40
|
function executeWebpackBrowserBuilder(options, context) {
|
|
41
|
+
(0, builder_package_1.assertPackageIsInstalled)('@nx/webpack', '@nx/angular:webpack-browser');
|
|
44
42
|
options.buildLibsFromSource ??= true;
|
|
45
43
|
options.watchDependencies ??= true;
|
|
46
44
|
const { buildLibsFromSource, customWebpackConfig, indexHtmlTransformer, watchDependencies, ...delegateBuilderOptions } = options;
|
|
@@ -64,12 +62,17 @@ function executeWebpackBrowserBuilder(options, context) {
|
|
|
64
62
|
dependencies = foundDependencies;
|
|
65
63
|
delegateBuilderOptions.tsConfig = (0, devkit_1.normalizePath)((0, path_1.relative)(context.workspaceRoot, tsConfigPath));
|
|
66
64
|
}
|
|
67
|
-
(0, builder_package_1.
|
|
68
|
-
|
|
65
|
+
(0, builder_package_1.assertPackageIsInstalled)('@angular-devkit/build-angular', '@nx/angular:webpack-browser');
|
|
66
|
+
(0, builder_package_1.assertPackageIsInstalled)('webpack-merge', '@nx/angular:webpack-browser');
|
|
67
|
+
return (0, rxjs_1.from)(Promise.all([
|
|
68
|
+
import('@angular-devkit/build-angular'),
|
|
69
|
+
import('@nx/webpack/internal'),
|
|
70
|
+
import('../utilities/webpack.js'),
|
|
71
|
+
])).pipe((0, operators_1.switchMap)(([{ executeBrowserBuilder }, { WebpackNxBuildCoordinationPlugin }, { mergeCustomWebpackConfig, resolveIndexHtmlTransformer },]) => executeBrowserBuilder(delegateBuilderOptions, context, {
|
|
69
72
|
webpackConfiguration: (baseWebpackConfig) => {
|
|
70
73
|
if (!buildLibsFromSource && delegateBuilderOptions.watch) {
|
|
71
74
|
const workspaceDependencies = dependencies
|
|
72
|
-
.filter((dep) => !(0,
|
|
75
|
+
.filter((dep) => !(0, internal_1.isNpmProject)(dep.node))
|
|
73
76
|
.map((dep) => dep.node.name);
|
|
74
77
|
// default for `nx run-many` is --all projects
|
|
75
78
|
// by passing an empty string for --projects, run-many will default to
|
|
@@ -79,17 +82,17 @@ function executeWebpackBrowserBuilder(options, context) {
|
|
|
79
82
|
const skipInitialRun = shouldSkipInitialTargetRun(projectGraph, context.target.project, context.target.target);
|
|
80
83
|
baseWebpackConfig.plugins.push(
|
|
81
84
|
// Cast away the angular/webpack plugin type difference (webpack versions).
|
|
82
|
-
new
|
|
85
|
+
new WebpackNxBuildCoordinationPlugin(`nx run-many --target=${context.target.target} --projects=${workspaceDependencies.join(',')}`, { skipInitialRun, skipWatchingDeps: !watchDependencies }));
|
|
83
86
|
}
|
|
84
87
|
}
|
|
85
88
|
if (!pathToWebpackConfig) {
|
|
86
89
|
return baseWebpackConfig;
|
|
87
90
|
}
|
|
88
|
-
return
|
|
91
|
+
return mergeCustomWebpackConfig(baseWebpackConfig, pathToWebpackConfig, delegateBuilderOptions, context.target);
|
|
89
92
|
},
|
|
90
93
|
...(pathToIndexFileTransformer
|
|
91
94
|
? {
|
|
92
|
-
indexHtml:
|
|
95
|
+
indexHtml: resolveIndexHtmlTransformer(pathToIndexFileTransformer, delegateBuilderOptions.tsConfig, context.target),
|
|
93
96
|
}
|
|
94
97
|
: {}),
|
|
95
98
|
})));
|
|
@@ -8,7 +8,6 @@ const rxjs_1 = require("rxjs");
|
|
|
8
8
|
const operators_1 = require("rxjs/operators");
|
|
9
9
|
const builder_package_1 = require("../../executors/utilities/builder-package");
|
|
10
10
|
const buildable_libs_1 = require("../utilities/buildable-libs");
|
|
11
|
-
const webpack_1 = require("../utilities/webpack");
|
|
12
11
|
// This is required to ensure that the webpack version used by the Module Federation is the same as the one used by the builders.
|
|
13
12
|
const Module = require('module');
|
|
14
13
|
const originalResolveFilename = Module._resolveFilename;
|
|
@@ -26,7 +25,7 @@ Module._resolveFilename = function (request, parent, isMain, options) {
|
|
|
26
25
|
return originalResolveFilename.call(this, request, parent, isMain, options);
|
|
27
26
|
};
|
|
28
27
|
function buildServerApp(options, context) {
|
|
29
|
-
(0, builder_package_1.
|
|
28
|
+
(0, builder_package_1.assertPackageIsInstalled)('@angular-devkit/build-angular', '@nx/angular:webpack-server');
|
|
30
29
|
const { buildLibsFromSource, customWebpackConfig, ...delegateOptions } = options;
|
|
31
30
|
// If there is a path to custom webpack config
|
|
32
31
|
// Invoke our own support for custom webpack config
|
|
@@ -42,7 +41,11 @@ function buildServerApp(options, context) {
|
|
|
42
41
|
return (0, rxjs_1.from)(import('@angular-devkit/build-angular')).pipe((0, operators_1.switchMap)(({ executeServerBuilder }) => executeServerBuilder(delegateOptions, context)));
|
|
43
42
|
}
|
|
44
43
|
function buildServerAppWithCustomWebpackConfiguration(options, context, pathToWebpackConfig) {
|
|
45
|
-
|
|
44
|
+
(0, builder_package_1.assertPackageIsInstalled)('webpack-merge', '@nx/angular:webpack-server');
|
|
45
|
+
return (0, rxjs_1.from)(Promise.all([
|
|
46
|
+
import('@angular-devkit/build-angular'),
|
|
47
|
+
import('../utilities/webpack.js'),
|
|
48
|
+
])).pipe((0, operators_1.switchMap)(([{ executeServerBuilder }, { mergeCustomWebpackConfig }]) => executeServerBuilder(options, context, {
|
|
46
49
|
webpackConfiguration: async (baseWebpackConfig) => {
|
|
47
50
|
// Angular auto includes code from @angular/platform-server
|
|
48
51
|
// This includes the code outside the shared scope created by ModuleFederation
|
|
@@ -50,7 +53,7 @@ function buildServerAppWithCustomWebpackConfiguration(options, context, pathToWe
|
|
|
50
53
|
// maintaining it within the shared scope.
|
|
51
54
|
// Therefore, if the build is an MF Server build, remove the auto-includes from
|
|
52
55
|
// the base webpack config from Angular
|
|
53
|
-
let mergedConfig = await
|
|
56
|
+
let mergedConfig = await mergeCustomWebpackConfig(baseWebpackConfig, pathToWebpackConfig, options, context.target);
|
|
54
57
|
if (mergedConfig.target === 'async-node') {
|
|
55
58
|
mergedConfig.entry.main = mergedConfig.entry.main.filter((m) => !m.startsWith('@angular/platform-server/init'));
|
|
56
59
|
mergedConfig.module.rules = mergedConfig.module.rules.filter((m) => !m.loader
|
|
@@ -62,6 +65,7 @@ function buildServerAppWithCustomWebpackConfiguration(options, context, pathToWe
|
|
|
62
65
|
})));
|
|
63
66
|
}
|
|
64
67
|
function executeWebpackServerBuilder(options, context) {
|
|
68
|
+
(0, builder_package_1.assertPackageIsInstalled)('@nx/webpack', '@nx/angular:webpack-server');
|
|
65
69
|
options.buildLibsFromSource ??= true;
|
|
66
70
|
process.env.NX_BUILD_LIBS_FROM_SOURCE = `${options.buildLibsFromSource}`;
|
|
67
71
|
process.env.NX_BUILD_TARGET = (0, devkit_1.targetToTargetString)({ ...context.target });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = applicationExecutor;
|
|
4
|
-
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
5
4
|
const buildable_libs_1 = require("../utilities/buildable-libs");
|
|
6
5
|
const builder_package_1 = require("../utilities/builder-package");
|
|
7
6
|
const esbuild_extensions_1 = require("../utilities/esbuild-extensions");
|
|
8
7
|
const normalize_options_1 = require("./utils/normalize-options");
|
|
9
8
|
const validate_options_1 = require("./utils/validate-options");
|
|
9
|
+
const ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
10
10
|
async function* applicationExecutor(options, context) {
|
|
11
11
|
(0, validate_options_1.validateOptions)(options);
|
|
12
12
|
const { buildLibsFromSource = true, plugins: pluginPaths, indexHtmlTransformer: indexHtmlTransformerPath, ...delegateExecutorOptions } = (0, normalize_options_1.normalizeOptions)(options);
|
|
@@ -25,7 +25,7 @@ async function* applicationExecutor(options, context) {
|
|
|
25
25
|
description: 'Build an application.',
|
|
26
26
|
optionSchema: require('./schema.json'),
|
|
27
27
|
}, context);
|
|
28
|
-
(0, builder_package_1.
|
|
28
|
+
(0, builder_package_1.assertPackageIsInstalled)('@angular/build', '@nx/angular:application');
|
|
29
29
|
const { buildApplication } = await import('@angular/build');
|
|
30
30
|
return yield* buildApplication(delegateExecutorOptions, builderContext, {
|
|
31
31
|
codePlugins: plugins,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = esbuildExecutor;
|
|
4
|
-
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
5
4
|
const buildable_libs_1 = require("../utilities/buildable-libs");
|
|
6
5
|
const esbuild_extensions_1 = require("../utilities/esbuild-extensions");
|
|
6
|
+
const ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
7
7
|
async function* esbuildExecutor(options, context) {
|
|
8
8
|
options.buildLibsFromSource ??= true;
|
|
9
9
|
const { buildLibsFromSource, plugins: pluginPaths, ...delegateExecutorOptions } = options;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = extractI18nExecutor;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
6
|
-
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
7
5
|
const builder_package_1 = require("../utilities/builder-package");
|
|
8
6
|
const patch_builder_context_1 = require("../utilities/patch-builder-context");
|
|
7
|
+
const ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
8
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
9
9
|
async function* extractI18nExecutor(options, context) {
|
|
10
10
|
const parsedBuildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context);
|
|
11
|
-
const buildTargetProjectConfiguration = (0,
|
|
11
|
+
const buildTargetProjectConfiguration = (0, internal_1.readCachedProjectConfiguration)(parsedBuildTarget.project);
|
|
12
12
|
const buildTarget = buildTargetProjectConfiguration.targets[parsedBuildTarget.target];
|
|
13
13
|
const isUsingEsbuildBuilder = [
|
|
14
14
|
'@angular/build:application',
|
|
@@ -29,7 +29,7 @@ async function* extractI18nExecutor(options, context) {
|
|
|
29
29
|
* handle `@nx/angular:*` executors.
|
|
30
30
|
*/
|
|
31
31
|
(0, patch_builder_context_1.patchBuilderContext)(builderContext, isUsingEsbuildBuilder, parsedBuildTarget);
|
|
32
|
-
(0, builder_package_1.
|
|
32
|
+
(0, builder_package_1.assertPackageIsInstalled)('@angular-devkit/build-angular', '@nx/angular:extract-i18n');
|
|
33
33
|
const { executeExtractI18nBuilder } = await import('@angular-devkit/build-angular');
|
|
34
34
|
return await executeExtractI18nBuilder(options, builderContext);
|
|
35
35
|
}
|
package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js
CHANGED
|
@@ -3,15 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.moduleFederationDevServerExecutor = moduleFederationDevServerExecutor;
|
|
4
4
|
const internal_1 = require("@nx/devkit/internal");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const builder_package_1 = require("../utilities/builder-package");
|
|
6
7
|
const lib_1 = require("./lib");
|
|
7
|
-
const internal_2 = require("@nx/
|
|
8
|
-
const internal_3 = require("@nx/web/internal");
|
|
9
|
-
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
8
|
+
const internal_2 = require("@nx/web/internal");
|
|
10
9
|
const dev_server_impl_1 = require("../../builders/dev-server/dev-server.impl");
|
|
11
10
|
const module_federation_1 = require("../../builders/utilities/module-federation");
|
|
12
11
|
const path_1 = require("path");
|
|
13
12
|
const fs_1 = require("fs");
|
|
14
13
|
const module_federation_deprecation_1 = require("../../utils/module-federation-deprecation");
|
|
14
|
+
const ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
15
15
|
// This is required to ensure that the webpack version used by the Module Federation is the same as the one used by the builders.
|
|
16
16
|
const Module = require('module');
|
|
17
17
|
const originalResolveFilename = Module._resolveFilename;
|
|
@@ -29,12 +29,14 @@ Module._resolveFilename = function (request, parent, isMain, options) {
|
|
|
29
29
|
return originalResolveFilename.call(this, request, parent, isMain, options);
|
|
30
30
|
};
|
|
31
31
|
async function* moduleFederationDevServerExecutor(schema, context) {
|
|
32
|
+
(0, builder_package_1.assertPackageIsInstalled)('@nx/module-federation', '@nx/angular:module-federation-dev-server');
|
|
33
|
+
const { startRemoteIterators } = await import('@nx/module-federation/internal');
|
|
32
34
|
(0, module_federation_deprecation_1.warnAngularMfDevServerExecutorDeprecation)();
|
|
33
35
|
const options = (0, lib_1.normalizeOptions)(schema);
|
|
34
36
|
const { projects: workspaceProjects } = (0, devkit_1.readProjectsConfigurationFromProjectGraph)(context.projectGraph);
|
|
35
37
|
const project = workspaceProjects[context.projectName];
|
|
36
38
|
const currIter = options.static
|
|
37
|
-
? (0,
|
|
39
|
+
? (0, internal_2.fileServerExecutor)({
|
|
38
40
|
port: options.port,
|
|
39
41
|
host: options.host,
|
|
40
42
|
ssl: options.ssl,
|
|
@@ -68,7 +70,7 @@ async function* moduleFederationDevServerExecutor(schema, context) {
|
|
|
68
70
|
pathToManifestFile = userPathToManifestFile;
|
|
69
71
|
}
|
|
70
72
|
(0, module_federation_1.validateDevRemotes)(options, workspaceProjects);
|
|
71
|
-
const { remotes, staticRemotesIter, devRemoteIters } = await
|
|
73
|
+
const { remotes, staticRemotesIter, devRemoteIters } = await startRemoteIterators(options, context, lib_1.startRemotes, pathToManifestFile, 'angular');
|
|
72
74
|
const removeBaseUrlEmission = (iter) => (0, internal_1.mapAsyncIterable)(iter, (v) => ({
|
|
73
75
|
...v,
|
|
74
76
|
baseUrl: undefined,
|
|
@@ -88,7 +90,7 @@ async function* moduleFederationDevServerExecutor(schema, context) {
|
|
|
88
90
|
const portsToWaitFor = staticRemotesIter
|
|
89
91
|
? [options.staticRemotesPort, ...remotes.remotePorts]
|
|
90
92
|
: [...remotes.remotePorts];
|
|
91
|
-
await Promise.all(portsToWaitFor.map((port) => (0,
|
|
93
|
+
await Promise.all(portsToWaitFor.map((port) => (0, internal_2.waitForPortOpen)(port, {
|
|
92
94
|
retries: 480,
|
|
93
95
|
retryDelay: 2500,
|
|
94
96
|
host: 'localhost',
|
package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js
CHANGED
|
@@ -3,17 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.moduleFederationSsrDevServerExecutor = moduleFederationSsrDevServerExecutor;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
-
const internal_2 = require("@nx/
|
|
7
|
-
const internal_3 = require("@nx/web/internal");
|
|
6
|
+
const internal_2 = require("@nx/web/internal");
|
|
8
7
|
const fs_1 = require("fs");
|
|
9
|
-
const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
|
|
10
|
-
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
11
8
|
const path_1 = require("path");
|
|
12
9
|
const module_federation_1 = require("../../builders/utilities/module-federation");
|
|
13
10
|
const builder_package_1 = require("../utilities/builder-package");
|
|
14
11
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
15
12
|
const start_dev_remotes_1 = require("./lib/start-dev-remotes");
|
|
16
13
|
const module_federation_deprecation_1 = require("../../utils/module-federation-deprecation");
|
|
14
|
+
const ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
17
15
|
// This is required to ensure that the webpack version used by the Module Federation is the same as the one used by the builders.
|
|
18
16
|
const Module = require('module');
|
|
19
17
|
const originalResolveFilename = Module._resolveFilename;
|
|
@@ -31,9 +29,11 @@ Module._resolveFilename = function (request, parent, isMain, options) {
|
|
|
31
29
|
return originalResolveFilename.call(this, request, parent, isMain, options);
|
|
32
30
|
};
|
|
33
31
|
async function* moduleFederationSsrDevServerExecutor(schema, context) {
|
|
32
|
+
(0, builder_package_1.assertPackageIsInstalled)('@nx/module-federation', '@nx/angular:module-federation-dev-ssr');
|
|
33
|
+
const { startRemoteIterators } = await import('@nx/module-federation/internal');
|
|
34
34
|
(0, module_federation_deprecation_1.warnAngularMfDevSsrExecutorDeprecation)();
|
|
35
35
|
const options = (0, normalize_options_1.normalizeOptions)(schema);
|
|
36
|
-
(0, builder_package_1.
|
|
36
|
+
(0, builder_package_1.assertPackageIsInstalled)('@angular-devkit/build-angular', '@nx/angular:module-federation-dev-ssr');
|
|
37
37
|
const { executeSSRDevServerBuilder } = await import('@angular-devkit/build-angular');
|
|
38
38
|
const currIter = (0, internal_1.eachValueFrom)(executeSSRDevServerBuilder(options, await (0, ngcli_adapter_1.createBuilderContext)({
|
|
39
39
|
builderName: '@nx/angular:webpack-server',
|
|
@@ -43,7 +43,7 @@ async function* moduleFederationSsrDevServerExecutor(schema, context) {
|
|
|
43
43
|
if (options.isInitialHost === false) {
|
|
44
44
|
return yield* currIter;
|
|
45
45
|
}
|
|
46
|
-
const { projects: workspaceProjects } = (0,
|
|
46
|
+
const { projects: workspaceProjects } = (0, devkit_1.readProjectsConfigurationFromProjectGraph)(context.projectGraph);
|
|
47
47
|
const project = workspaceProjects[context.projectName];
|
|
48
48
|
let pathToManifestFile;
|
|
49
49
|
if (options.pathToManifestFile) {
|
|
@@ -60,7 +60,7 @@ async function* moduleFederationSsrDevServerExecutor(schema, context) {
|
|
|
60
60
|
pathToManifestFile = (0, module_federation_1.getDynamicMfManifestFile)(project, context.root);
|
|
61
61
|
}
|
|
62
62
|
(0, module_federation_1.validateDevRemotes)({ devRemotes: options.devRemotes }, workspaceProjects);
|
|
63
|
-
const { remotes, staticRemotesIter, devRemoteIters } = await
|
|
63
|
+
const { remotes, staticRemotesIter, devRemoteIters } = await startRemoteIterators(options, context, start_dev_remotes_1.startRemotes, pathToManifestFile, 'angular', true);
|
|
64
64
|
const removeBaseUrlEmission = (iter) => (0, internal_1.mapAsyncIterable)(iter, (v) => ({
|
|
65
65
|
...v,
|
|
66
66
|
baseUrl: undefined,
|
|
@@ -80,7 +80,7 @@ async function* moduleFederationSsrDevServerExecutor(schema, context) {
|
|
|
80
80
|
const portsToWaitFor = staticRemotesIter && options.staticRemotesPort
|
|
81
81
|
? [options.staticRemotesPort, ...remotes.remotePorts]
|
|
82
82
|
: [...remotes.remotePorts];
|
|
83
|
-
await Promise.all(portsToWaitFor.map((port) => (0,
|
|
83
|
+
await Promise.all(portsToWaitFor.map((port) => (0, internal_2.waitForPortOpen)(port, {
|
|
84
84
|
retries: 480,
|
|
85
85
|
retryDelay: 2500,
|
|
86
86
|
host: 'localhost',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { NgPackagr } from 'ng-packagr';
|
|
2
2
|
export declare function getNgPackagrInstance(): Promise<NgPackagr>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNgPackagrInstance = getNgPackagrInstance;
|
|
4
|
-
const ng_packagr_1 = require("ng-packagr");
|
|
5
4
|
async function getNgPackagrInstance() {
|
|
6
5
|
const { getWriteBundlesTransformProvider } = await import('./ng-package/entry-point/write-bundles.di.js');
|
|
7
6
|
const { getStylesheetProcessorFactoryProvider } = await import('../../utilities/ng-packagr/stylesheet-processor.di.js');
|
|
8
|
-
const
|
|
7
|
+
const { ngPackagr } = await import('ng-packagr');
|
|
8
|
+
const packagr = ngPackagr();
|
|
9
9
|
packagr.withProviders([
|
|
10
10
|
getWriteBundlesTransformProvider(),
|
|
11
11
|
getStylesheetProcessorFactoryProvider(),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { NgPackagr } from 'ng-packagr';
|
|
2
2
|
export declare function getNgPackagrInstance(): Promise<NgPackagr>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNgPackagrInstance = getNgPackagrInstance;
|
|
4
|
-
const ng_packagr_1 = require("ng-packagr");
|
|
5
4
|
async function getNgPackagrInstance() {
|
|
6
5
|
const { getStylesheetProcessorFactoryProvider } = await import('../../utilities/ng-packagr/stylesheet-processor.di.js');
|
|
7
|
-
const
|
|
6
|
+
const { ngPackagr } = await import('ng-packagr');
|
|
7
|
+
const packagr = ngPackagr();
|
|
8
8
|
packagr.withProviders([getStylesheetProcessorFactoryProvider()]);
|
|
9
9
|
return packagr;
|
|
10
10
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = unitTestExecutor;
|
|
4
|
-
const ngcli_adapter_1 = require("nx/
|
|
4
|
+
const ngcli_adapter_1 = require("@nx/devkit/ngcli-adapter");
|
|
5
5
|
const targets_1 = require("../../utils/targets");
|
|
6
6
|
const semver_1 = require("semver");
|
|
7
7
|
const angular_version_utils_1 = require("../utilities/angular-version-utils");
|
|
@@ -22,7 +22,7 @@ async function* unitTestExecutor(options, context) {
|
|
|
22
22
|
const buildTargetSpecifier = options.buildTarget ?? `::development`;
|
|
23
23
|
const buildTarget = (0, targets_1.targetFromTargetString)(buildTargetSpecifier, context.projectName, 'build');
|
|
24
24
|
patchBuilderContext(builderContext, buildTarget);
|
|
25
|
-
(0, builder_package_1.
|
|
25
|
+
(0, builder_package_1.assertPackageIsInstalled)('@angular/build', '@nx/angular:unit-test');
|
|
26
26
|
const { executeUnitTestBuilder } = await import('@angular/build');
|
|
27
27
|
return yield* executeUnitTestBuilder(delegateExecutorOptions, builderContext, {
|
|
28
28
|
codePlugins: plugins,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function assertPackageIsInstalled(packageName: string, requiredBy: string): void;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
function
|
|
3
|
+
exports.assertPackageIsInstalled = assertPackageIsInstalled;
|
|
4
|
+
function assertPackageIsInstalled(packageName, requiredBy) {
|
|
5
5
|
try {
|
|
6
6
|
require.resolve(packageName);
|
|
7
7
|
}
|
|
8
|
-
catch {
|
|
9
|
-
|
|
8
|
+
catch (e) {
|
|
9
|
+
// Only a missing module means "not installed"; surface other resolution
|
|
10
|
+
// errors (e.g. a malformed package's exports) as-is instead of mislabeling.
|
|
11
|
+
const code = e.code;
|
|
12
|
+
if (code !== 'MODULE_NOT_FOUND' && code !== 'ERR_MODULE_NOT_FOUND') {
|
|
13
|
+
throw e;
|
|
14
|
+
}
|
|
15
|
+
throw new Error(`The "${packageName}" package is required by "${requiredBy}" but is not installed. Please install it and try again.`);
|
|
10
16
|
}
|
|
11
17
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addE2e = addE2e;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const internal_2 = require("@nx/eslint/internal");
|
|
6
|
-
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const versions_1 = require("../../../utils/versions");
|
|
8
8
|
async function addE2e(tree, options) {
|
|
9
9
|
// since e2e are separate projects, default to adding plugins
|
|
@@ -3,19 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createFiles = createFiles;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
|
-
const onboarding_1 = require("nx/src/nx-cloud/utilities/onboarding");
|
|
7
6
|
const test_runners_1 = require("../../../utils/test-runners");
|
|
8
7
|
const artifact_types_1 = require("../../utils/artifact-types");
|
|
9
8
|
const selector_1 = require("../../utils/selector");
|
|
10
9
|
const update_project_root_tsconfig_1 = require("../../utils/update-project-root-tsconfig");
|
|
10
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
11
11
|
async function createFiles(tree, options, rootOffset) {
|
|
12
12
|
const rootSelector = `${options.prefix}-root`;
|
|
13
13
|
(0, selector_1.validateHtmlSelector)(rootSelector);
|
|
14
14
|
const nxWelcomeSelector = `${options.prefix}-nx-welcome`;
|
|
15
15
|
(0, selector_1.validateHtmlSelector)(nxWelcomeSelector);
|
|
16
|
-
const onBoardingStatus = await (0,
|
|
16
|
+
const onBoardingStatus = await (0, internal_1.createNxCloudOnboardingURLForWelcomeApp)(tree, options.nxCloudToken);
|
|
17
17
|
const connectCloudUrl = onBoardingStatus === 'unclaimed' &&
|
|
18
|
-
(await (0,
|
|
18
|
+
(await (0, internal_1.getNxCloudAppOnBoardingUrl)(options.nxCloudToken));
|
|
19
19
|
const componentType = (0, artifact_types_1.getComponentType)(tree);
|
|
20
20
|
const componentFileSuffix = componentType ? `.${componentType}` : '';
|
|
21
21
|
const moduleTypeSeparator = (0, artifact_types_1.getModuleTypeSeparator)(tree);
|
|
@@ -41,6 +41,9 @@ function createFiles(tree, options, project) {
|
|
|
41
41
|
tpl: '',
|
|
42
42
|
};
|
|
43
43
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/base'), options.libraryOptions.projectRoot, substitutions);
|
|
44
|
+
if (options.libraryOptions.buildable && !options.libraryOptions.publishable) {
|
|
45
|
+
(0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.libraryOptions.projectRoot, 'package.json'), (json) => ({ ...json, private: true }));
|
|
46
|
+
}
|
|
44
47
|
if (options.libraryOptions.standalone) {
|
|
45
48
|
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/standalone-components'), options.libraryOptions.projectRoot, substitutions);
|
|
46
49
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LibMigrator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const devkit_2 = require("@nx/devkit");
|
|
6
5
|
const utilities_1 = require("../../utilities");
|
|
7
6
|
const builders_1 = require("../builders");
|
|
8
7
|
const project_migrator_1 = require("./project.migrator");
|
|
@@ -46,7 +45,7 @@ class LibMigrator extends project_migrator_1.ProjectMigrator {
|
|
|
46
45
|
!Object.keys(this.projectConfig.targets).length) {
|
|
47
46
|
this.logger.warn('The project does not have any targets configured. This might not be an issue. Skipping updating targets.');
|
|
48
47
|
}
|
|
49
|
-
(0,
|
|
48
|
+
(0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name, {
|
|
50
49
|
...this.projectConfig,
|
|
51
50
|
});
|
|
52
51
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatFilesTask = formatFilesTask;
|
|
4
|
-
const
|
|
4
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
5
|
function formatFilesTask(tree) {
|
|
6
6
|
if (!tree
|
|
7
7
|
.listChanges()
|
|
@@ -9,7 +9,7 @@ function formatFilesTask(tree) {
|
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
try {
|
|
12
|
-
(0,
|
|
12
|
+
(0, internal_1.runNxSync)(`format`, { cwd: tree.root, stdio: [0, 1, 2] });
|
|
13
13
|
}
|
|
14
14
|
catch { }
|
|
15
15
|
}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getAllProjects = getAllProjects;
|
|
4
4
|
exports.convertToNxProject = convertToNxProject;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
7
|
function getAllProjects(tree) {
|
|
8
8
|
const projects = (0, devkit_1.getProjects)(tree);
|
|
9
9
|
const result = {
|
|
@@ -26,7 +26,7 @@ function getAllProjects(tree) {
|
|
|
26
26
|
}
|
|
27
27
|
function convertToNxProject(tree, projectName) {
|
|
28
28
|
const angularJson = (0, devkit_1.readJson)(tree, 'angular.json');
|
|
29
|
-
const project = (0,
|
|
29
|
+
const project = (0, internal_1.toNewFormat)(angularJson).projects[projectName];
|
|
30
30
|
project.name = projectName;
|
|
31
31
|
(0, devkit_1.addProjectConfiguration)(tree, projectName, project);
|
|
32
32
|
delete angularJson.projects[projectName];
|
|
@@ -17,11 +17,10 @@ const devkit_1 = require("@nx/devkit");
|
|
|
17
17
|
const eslint_1 = require("@nx/eslint");
|
|
18
18
|
const internal_1 = require("@nx/eslint/internal");
|
|
19
19
|
const js_1 = require("@nx/js");
|
|
20
|
-
const default_base_1 = require("nx/src/utils/default-base");
|
|
21
20
|
const internal_2 = require("@nx/js/internal");
|
|
22
|
-
const angular_json_1 = require("nx/src/adapter/angular-json");
|
|
23
21
|
const versions_1 = require("../../../utils/versions");
|
|
24
22
|
const path_1 = require("path");
|
|
23
|
+
const internal_3 = require("@nx/devkit/internal");
|
|
25
24
|
function validateWorkspace(tree) {
|
|
26
25
|
const errors = [];
|
|
27
26
|
if (!tree.exists('package.json')) {
|
|
@@ -40,7 +39,7 @@ function validateWorkspace(tree) {
|
|
|
40
39
|
function createNxJson(tree, options, defaultProject) {
|
|
41
40
|
const targets = getWorkspaceCommonTargets(tree);
|
|
42
41
|
(0, devkit_1.writeJson)(tree, 'nx.json', {
|
|
43
|
-
defaultBase: options.defaultBase ?? (0,
|
|
42
|
+
defaultBase: options.defaultBase ?? (0, internal_3.deduceDefaultBase)(),
|
|
44
43
|
namedInputs: {
|
|
45
44
|
sharedGlobals: [],
|
|
46
45
|
default: ['{projectRoot}/**/*', 'sharedGlobals'],
|
|
@@ -278,7 +277,7 @@ function updateVsCodeRecommendedExtensions(tree) {
|
|
|
278
277
|
}
|
|
279
278
|
}
|
|
280
279
|
function deleteAngularJson(tree) {
|
|
281
|
-
const projects = (0,
|
|
280
|
+
const projects = (0, internal_3.toNewFormat)((0, devkit_1.readJson)(tree, 'angular.json')).projects;
|
|
282
281
|
if (!Object.keys(projects).length) {
|
|
283
282
|
tree.delete('angular.json');
|
|
284
283
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ProjectConfiguration } from 'nx/
|
|
1
|
+
import { ProjectConfiguration } from '@nx/devkit';
|
|
2
2
|
export declare function getTargetProject(projectName: string, projects: Map<string, ProjectConfiguration>): ProjectConfiguration;
|
package/dist/src/generators/scam-to-standalone/lib/replace-module-usages-with-component.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Tree } from 'nx/
|
|
1
|
+
import { Tree } from '@nx/devkit';
|
|
2
2
|
export declare function replaceModuleUsagesWithComponent(tree: Tree, moduleName: string, componentName: string): void;
|
|
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.setupTspathForRemote = setupTspathForRemote;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
|
-
const
|
|
6
|
+
const versions_1 = require("../../../utils/versions");
|
|
7
7
|
function setupTspathForRemote(tree, options) {
|
|
8
|
+
const { normalizeProjectName } = (0, devkit_1.ensurePackage)('@nx/module-federation', versions_1.nxVersion);
|
|
8
9
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.appName);
|
|
9
10
|
const exportPath = options.standalone
|
|
10
11
|
? `./src/app/remote-entry/entry.routes.ts`
|
|
11
12
|
: `./src/app/remote-entry/${options.entryModuleFileName}.ts`;
|
|
12
13
|
const exportName = options.standalone ? 'Routes' : 'Module';
|
|
13
|
-
(0, js_1.addTsConfigPath)(tree, `${
|
|
14
|
+
(0, js_1.addTsConfigPath)(tree, `${normalizeProjectName(options.appName)}/${exportName}`, [(0, devkit_1.joinPathFragments)(project.root, exportPath)]);
|
|
14
15
|
}
|
|
@@ -27,6 +27,7 @@ async function setupMf(tree, rawOptions) {
|
|
|
27
27
|
}, {
|
|
28
28
|
'@nx/web': versions_1.nxVersion,
|
|
29
29
|
'@nx/webpack': versions_1.nxVersion,
|
|
30
|
+
'webpack-merge': versions_1.webpackMergeVersion,
|
|
30
31
|
'@nx/module-federation': versions_1.nxVersion,
|
|
31
32
|
}));
|
|
32
33
|
}
|
|
@@ -50,6 +51,7 @@ async function setupMf(tree, rawOptions) {
|
|
|
50
51
|
if (!options.skipPackageJson) {
|
|
51
52
|
tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
52
53
|
'@nx/webpack': versions_1.nxVersion,
|
|
54
|
+
'webpack-merge': versions_1.webpackMergeVersion,
|
|
53
55
|
'@module-federation/enhanced': versions_1.moduleFederationEnhancedVersion,
|
|
54
56
|
'@nx/module-federation': versions_1.nxVersion,
|
|
55
57
|
}));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type Tree } from '@nx/devkit';
|
|
2
|
-
export declare function addDependencies(tree: Tree, isUsingApplicationBuilder: boolean): void;
|
|
2
|
+
export declare function addDependencies(tree: Tree, isUsingApplicationBuilder: boolean, isUsingWebpackBuilder: boolean): void;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addDependencies = addDependencies;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const versions_1 = require("../../../utils/versions");
|
|
5
6
|
const version_utils_1 = require("../../utils/version-utils");
|
|
6
|
-
function addDependencies(tree, isUsingApplicationBuilder) {
|
|
7
|
+
function addDependencies(tree, isUsingApplicationBuilder, isUsingWebpackBuilder) {
|
|
7
8
|
const pkgVersions = (0, version_utils_1.versions)(tree);
|
|
8
9
|
const dependencies = {
|
|
9
10
|
'@angular/platform-server': (0, devkit_1.getDependencyVersionFromPackageJson)(tree, '@angular/platform-server') ??
|
|
@@ -18,6 +19,10 @@ function addDependencies(tree, isUsingApplicationBuilder) {
|
|
|
18
19
|
dependencies['@angular/ssr'] = angularDevkitVersion;
|
|
19
20
|
if (!isUsingApplicationBuilder) {
|
|
20
21
|
devDependencies['browser-sync'] = pkgVersions.browserSyncVersion;
|
|
22
|
+
if (isUsingWebpackBuilder) {
|
|
23
|
+
devDependencies['@nx/webpack'] = versions_1.nxVersion;
|
|
24
|
+
devDependencies['webpack-merge'] = pkgVersions.webpackMergeVersion;
|
|
25
|
+
}
|
|
21
26
|
}
|
|
22
27
|
else {
|
|
23
28
|
dependencies['@angular-devkit/build-angular'] = angularDevkitVersion;
|
|
@@ -2,12 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
5
6
|
const ast_utils_1 = require("../../../utils/nx-devkit/ast-utils");
|
|
6
7
|
async function normalizeOptions(tree, options) {
|
|
7
8
|
const { targets, root } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// Resolve the executor via targetDefaults: readProjectConfiguration returns
|
|
10
|
+
// the raw config, so an inherited executor would otherwise read as undefined.
|
|
11
|
+
const buildTargetExecutor = targets.build.executor ??
|
|
12
|
+
(0, internal_1.readTargetDefaultsForTarget)('build', (0, devkit_1.readNxJson)(tree)?.targetDefaults)
|
|
13
|
+
?.executor;
|
|
14
|
+
if (!buildTargetExecutor) {
|
|
15
|
+
throw new Error(`The "build" target of the "${options.project}" project does not specify an executor. Please add an executor to the "build" target.`);
|
|
16
|
+
}
|
|
17
|
+
const isUsingApplicationBuilder = buildTargetExecutor === '@angular-devkit/build-angular:application' ||
|
|
18
|
+
buildTargetExecutor === '@angular/build:application' ||
|
|
19
|
+
buildTargetExecutor === '@nx/angular:application';
|
|
20
|
+
const isUsingWebpackBuilder = buildTargetExecutor === '@nx/angular:webpack-browser';
|
|
11
21
|
const isStandaloneApp = (0, ast_utils_1.isNgStandaloneApp)(tree, options.project);
|
|
12
22
|
return {
|
|
13
23
|
project: options.project,
|
|
@@ -21,6 +31,8 @@ async function normalizeOptions(tree, options) {
|
|
|
21
31
|
standalone: options.standalone ?? isStandaloneApp,
|
|
22
32
|
hydration: options.hydration ?? true,
|
|
23
33
|
isUsingApplicationBuilder,
|
|
34
|
+
isUsingWebpackBuilder,
|
|
35
|
+
buildTargetExecutor,
|
|
24
36
|
buildTargetTsConfigPath: targets.build.options?.tsConfig ??
|
|
25
37
|
(0, devkit_1.joinPathFragments)(root, 'tsconfig.app.json'),
|
|
26
38
|
};
|
|
@@ -54,7 +54,7 @@ function updateProjectConfigForBrowserBuilder(tree, options) {
|
|
|
54
54
|
const sourceRoot = (0, internal_2.getProjectSourceRoot)(projectConfig, tree);
|
|
55
55
|
projectConfig.targets.server = {
|
|
56
56
|
dependsOn: ['build'],
|
|
57
|
-
executor:
|
|
57
|
+
executor: options.buildTargetExecutor.startsWith('@angular-devkit/build-angular:')
|
|
58
58
|
? '@angular-devkit/build-angular:server'
|
|
59
59
|
: '@nx/angular:webpack-server',
|
|
60
60
|
options: {
|
|
@@ -9,7 +9,7 @@ async function setupSsr(tree, schema) {
|
|
|
9
9
|
(0, lib_1.validateOptions)(tree, schema);
|
|
10
10
|
const options = await (0, lib_1.normalizeOptions)(tree, schema);
|
|
11
11
|
if (!schema.skipPackageJson) {
|
|
12
|
-
(0, lib_1.addDependencies)(tree, options.isUsingApplicationBuilder);
|
|
12
|
+
(0, lib_1.addDependencies)(tree, options.isUsingApplicationBuilder, options.isUsingWebpackBuilder);
|
|
13
13
|
}
|
|
14
14
|
(0, lib_1.generateSSRFiles)(tree, options);
|
|
15
15
|
if (options.hydration) {
|
|
@@ -4,7 +4,6 @@ exports.addVitestAngular = addVitestAngular;
|
|
|
4
4
|
exports.addVitestAnalog = addVitestAnalog;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const internal_1 = require("@nx/devkit/internal");
|
|
7
|
-
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
8
7
|
const semver_1 = require("semver");
|
|
9
8
|
const versions_1 = require("../../utils/versions");
|
|
10
9
|
const version_utils_1 = require("./version-utils");
|
|
@@ -90,7 +89,7 @@ function validateVitestVersion(tree) {
|
|
|
90
89
|
let installedVitestVersion = null;
|
|
91
90
|
// Try to get the actual installed version from node_modules
|
|
92
91
|
try {
|
|
93
|
-
const { packageJson } = (0,
|
|
92
|
+
const { packageJson } = (0, internal_1.readModulePackageJson)('vitest');
|
|
94
93
|
installedVitestVersion = packageJson.version;
|
|
95
94
|
}
|
|
96
95
|
catch { }
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = migrateMfImportsToNewPackage;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const devkit_2 = require("@nx/devkit");
|
|
6
5
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
7
6
|
const MF_IMPORT_TO_UPDATE = 'ModuleFederationConfig';
|
|
8
7
|
const MF_CONFIG_IMPORT_SELECTOR = `ImportDeclaration:has(StringLiteral[value=@nx/webpack]):has(Identifier[name=ModuleFederationConfig])`;
|
|
@@ -23,7 +22,7 @@ async function migrateMfImportsToNewPackage(tree) {
|
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
for (const root of rootsToCheck) {
|
|
26
|
-
(0,
|
|
25
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, root, (filePath) => {
|
|
27
26
|
if (!filePath.endsWith('.ts') && !filePath.endsWith('.js')) {
|
|
28
27
|
return;
|
|
29
28
|
}
|
|
@@ -57,5 +56,5 @@ async function migrateMfImportsToNewPackage(tree) {
|
|
|
57
56
|
tree.write(filePath, contents);
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
|
-
await (0,
|
|
59
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
61
60
|
}
|
|
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.default = default_1;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const internal_1 = require("@nx/js/internal");
|
|
6
|
-
const
|
|
7
|
-
const nx_deps_cache_1 = require("nx/src/project-graph/nx-deps-cache");
|
|
6
|
+
const internal_2 = require("@nx/devkit/internal");
|
|
8
7
|
const version_utils_1 = require("../../generators/utils/version-utils");
|
|
9
8
|
const file_change_recorder_1 = require("../../utils/file-change-recorder");
|
|
10
9
|
const projects_1 = require("../utils/projects");
|
|
@@ -27,7 +26,7 @@ async function default_1(tree) {
|
|
|
27
26
|
const tsqueryModule = require('@phenomnomnominal/tsquery');
|
|
28
27
|
tsqueryAst = tsqueryModule.ast;
|
|
29
28
|
tsqueryQuery = tsqueryModule.query;
|
|
30
|
-
const cachedFileMap = (0,
|
|
29
|
+
const cachedFileMap = (0, internal_2.readFileMapCache)().fileMap.projectFileMap;
|
|
31
30
|
const filesWithNxAngularImports = [];
|
|
32
31
|
for (const graphNode of projects) {
|
|
33
32
|
const files = filterFilesWithNxAngularDep(cachedFileMap[graphNode.name] || []);
|
|
@@ -115,7 +114,7 @@ function addNgrxRouterStoreIfNotInstalled(tree) {
|
|
|
115
114
|
function filterFilesWithNxAngularDep(files) {
|
|
116
115
|
const filteredFiles = [];
|
|
117
116
|
for (const file of files) {
|
|
118
|
-
if (file.deps?.some((dep) => angularPluginTargetNames.includes((0,
|
|
117
|
+
if (file.deps?.some((dep) => angularPluginTargetNames.includes((0, internal_2.fileDataDepTarget)(dep)))) {
|
|
119
118
|
filteredFiles.push(file);
|
|
120
119
|
}
|
|
121
120
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#### Add `@angular/build` When Used by an Executor
|
|
2
2
|
|
|
3
|
-
The `@nx/angular:application` and `@nx/angular:unit-test` executors load the Angular builders by importing `@angular/build` directly, and any `@angular/build:*` executor is provided by that package, so `@angular/build` is a required runtime dependency for workspaces using those targets. Nothing declares it as a direct dependency, though: it has only ever been available transitively as a dependency of `@angular-devkit/build-angular`. That is not reliable (for example, under Yarn Berry it can be missing from `node_modules` even when `@angular-devkit/build-angular` is installed), and when `@angular/build` cannot be resolved the build fails with
|
|
3
|
+
The `@nx/angular:application` and `@nx/angular:unit-test` executors load the Angular builders by importing `@angular/build` directly, and any `@angular/build:*` executor is provided by that package, so `@angular/build` is a required runtime dependency for workspaces using those targets. Nothing declares it as a direct dependency, though: it has only ever been available transitively as a dependency of `@angular-devkit/build-angular`. That is not reliable (for example, under Yarn Berry it can be missing from `node_modules` even when `@angular-devkit/build-angular` is installed), and when `@angular/build` cannot be resolved the build fails with an error like `The "@angular/build" package is required by "@nx/angular:application" but is not installed`. This migration adds `@angular/build` to `devDependencies` when a project uses one of those executors and it is not already installed, at the version the application generator installs. An existing version is preserved.
|
|
4
4
|
|
|
5
5
|
Executor usage is detected on any target using `@nx/angular:application`, `@nx/angular:unit-test`, or an `@angular/build:*` executor. Targets that inherit their executor from an `nx.json` `targetDefaults` entry are detected too.
|
|
6
6
|
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = addOptionalWebpackPackages;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
+
const versions_1 = require("../../utils/versions");
|
|
7
|
+
const webpackExecutors = new Set([
|
|
8
|
+
'@nx/angular:webpack-browser',
|
|
9
|
+
'@nx/angular:webpack-server',
|
|
10
|
+
]);
|
|
11
|
+
const webpackBuildTargetExecutors = new Set([
|
|
12
|
+
'@nx/angular:webpack-browser',
|
|
13
|
+
'@angular-devkit/build-angular:browser',
|
|
14
|
+
]);
|
|
15
|
+
const moduleFederationExecutors = new Set([
|
|
16
|
+
'@nx/angular:module-federation-dev-server',
|
|
17
|
+
'@nx/angular:module-federation-dev-ssr',
|
|
18
|
+
]);
|
|
19
|
+
function resolveBuildTargetExecutor(targetString, projects, targetDefaults) {
|
|
20
|
+
const [projectName, targetName] = targetString.split(':');
|
|
21
|
+
const target = targetName
|
|
22
|
+
? projects.get(projectName)?.targets?.[targetName]
|
|
23
|
+
: undefined;
|
|
24
|
+
if (target === undefined) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
// The referenced build target can inherit its executor from targetDefaults,
|
|
28
|
+
// which the raw project config does not merge, so resolve it before matching.
|
|
29
|
+
return (target.executor ??
|
|
30
|
+
(0, internal_1.readTargetDefaultsForTarget)(targetName, targetDefaults)?.executor);
|
|
31
|
+
}
|
|
32
|
+
function usesWebpackDevServer(target, projects, targetDefaults) {
|
|
33
|
+
if (target.executor !== '@nx/angular:dev-server') {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return [target.options, ...Object.values(target.configurations ?? {})].some((options) => {
|
|
37
|
+
const buildTarget = options?.buildTarget ?? options?.browserTarget;
|
|
38
|
+
if (typeof buildTarget !== 'string') {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
const executor = resolveBuildTargetExecutor(buildTarget, projects, targetDefaults);
|
|
42
|
+
return (executor !== undefined && webpackBuildTargetExecutors.has(executor));
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async function addOptionalWebpackPackages(tree) {
|
|
46
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
47
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
48
|
+
const targetDefaults = nxJson?.targetDefaults;
|
|
49
|
+
let needsWebpack = false;
|
|
50
|
+
let needsModuleFederation = false;
|
|
51
|
+
let needsRspack = false;
|
|
52
|
+
for (const [, project] of projects) {
|
|
53
|
+
for (const target of Object.values(project.targets ?? {})) {
|
|
54
|
+
needsWebpack ||=
|
|
55
|
+
webpackExecutors.has(target.executor) ||
|
|
56
|
+
usesWebpackDevServer(target, projects, targetDefaults);
|
|
57
|
+
needsModuleFederation ||= moduleFederationExecutors.has(target.executor);
|
|
58
|
+
needsRspack ||= target.executor?.startsWith('@nx/rspack:') ?? false;
|
|
59
|
+
}
|
|
60
|
+
// Remotes get a plain dev-server (no Module Federation executor) but still
|
|
61
|
+
// generate a module-federation.config that requires @nx/module-federation
|
|
62
|
+
// at build time, so detect them by that config file too. This covers
|
|
63
|
+
// remotes whose host lives in a different workspace.
|
|
64
|
+
needsModuleFederation ||=
|
|
65
|
+
tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.ts')) ||
|
|
66
|
+
tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.js'));
|
|
67
|
+
}
|
|
68
|
+
// targetDefaults are keyed by target name or executor, and a default can set
|
|
69
|
+
// an executor that an empty project target inherits, so scan the keys and any
|
|
70
|
+
// executor on the default (both the object and array forms).
|
|
71
|
+
for (const [targetOrExecutor, config] of Object.entries(targetDefaults ?? {})) {
|
|
72
|
+
const executors = [targetOrExecutor];
|
|
73
|
+
for (const entry of Array.isArray(config) ? config : [config]) {
|
|
74
|
+
if (entry.executor != null) {
|
|
75
|
+
executors.push(entry.executor);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
for (const executor of executors) {
|
|
79
|
+
needsWebpack ||= webpackExecutors.has(executor);
|
|
80
|
+
needsModuleFederation ||= moduleFederationExecutors.has(executor);
|
|
81
|
+
needsRspack ||= executor.startsWith('@nx/rspack:');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
needsRspack ||=
|
|
85
|
+
nxJson?.plugins?.some((plugin) => typeof plugin === 'string'
|
|
86
|
+
? plugin === '@nx/rspack/plugin'
|
|
87
|
+
: plugin.plugin === '@nx/rspack/plugin') ?? false;
|
|
88
|
+
if (!needsWebpack && !needsModuleFederation && !needsRspack) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
92
|
+
...(needsWebpack
|
|
93
|
+
? {
|
|
94
|
+
'@nx/webpack': versions_1.nxVersion,
|
|
95
|
+
'webpack-merge': versions_1.webpackMergeVersion,
|
|
96
|
+
}
|
|
97
|
+
: {}),
|
|
98
|
+
...(needsModuleFederation ? { '@nx/module-federation': versions_1.nxVersion } : {}),
|
|
99
|
+
...(needsRspack ? { '@nx/rspack': versions_1.nxVersion } : {}),
|
|
100
|
+
}, undefined, true);
|
|
101
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#### Add Optional Webpack Packages
|
|
2
|
+
|
|
3
|
+
Adds `@nx/webpack`, `@nx/module-federation`, `@nx/rspack`, and `webpack-merge` to the workspace when existing targets require them.
|
|
4
|
+
|
|
5
|
+
These packages are no longer direct dependencies of `@nx/angular`; they are now optional peer dependencies, so installing `@nx/angular` no longer pulls webpack tooling into workspaces that only use the esbuild or Vite build stack. This migration backfills them for workspaces that already use webpack, Module Federation, or Rspack so those builds keep working after upgrading. Packages that are already present are left untouched.
|
|
6
|
+
|
|
7
|
+
A package is added only when a matching target exists:
|
|
8
|
+
|
|
9
|
+
- `@nx/webpack` and `webpack-merge`: an `@nx/angular:webpack-browser` or `@nx/angular:webpack-server` target, or an `@nx/angular:dev-server` whose build target uses `@nx/angular:webpack-browser` or `@angular-devkit/build-angular:browser`.
|
|
10
|
+
- `@nx/module-federation`: an `@nx/angular:module-federation-dev-server` or `@nx/angular:module-federation-dev-ssr` target, or a project with a `module-federation.config.{js,ts}` file (covers remotes whose host lives in another workspace).
|
|
11
|
+
- `@nx/rspack`: an `@nx/rspack:*` target or the `@nx/rspack/plugin` plugin in `nx.json`.
|
|
12
|
+
|
|
13
|
+
Targets that inherit their executor from an `nx.json` `targetDefaults` entry are detected too.
|
|
14
|
+
|
|
15
|
+
#### Examples
|
|
16
|
+
|
|
17
|
+
For a workspace with an `@nx/angular:webpack-browser` build target, the migration adds the webpack packages to `devDependencies`.
|
|
18
|
+
|
|
19
|
+
##### Before
|
|
20
|
+
|
|
21
|
+
```jsonc title="package.json"
|
|
22
|
+
{
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@nx/angular": "23.1.0",
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
##### After
|
|
30
|
+
|
|
31
|
+
```jsonc title="package.json"
|
|
32
|
+
{
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@nx/angular": "23.1.0",
|
|
35
|
+
"@nx/webpack": "23.1.0",
|
|
36
|
+
"webpack-merge": "^5.8.0",
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
```
|
|
@@ -8,8 +8,6 @@ const js_1 = require("@nx/js");
|
|
|
8
8
|
const node_fs_1 = require("node:fs");
|
|
9
9
|
const node_path_1 = require("node:path");
|
|
10
10
|
const posix = tslib_1.__importStar(require("node:path/posix"));
|
|
11
|
-
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
12
|
-
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
13
11
|
const targets_1 = require("../utils/targets");
|
|
14
12
|
const vitest_1 = require("./utils/vitest");
|
|
15
13
|
const knownExecutors = {
|
|
@@ -48,8 +46,8 @@ const knownExecutors = {
|
|
|
48
46
|
exports.createNodes = [
|
|
49
47
|
'**/angular.json',
|
|
50
48
|
async (configFiles, options, context) => {
|
|
51
|
-
const optionsHash = (0,
|
|
52
|
-
const cachePath = (0, node_path_1.join)(
|
|
49
|
+
const optionsHash = (0, internal_1.hashObject)(options);
|
|
50
|
+
const cachePath = (0, node_path_1.join)(internal_1.workspaceDataDirectory, `angular-${optionsHash}.hash`);
|
|
53
51
|
const projectsCache = new internal_1.PluginCache(cachePath);
|
|
54
52
|
const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
|
|
55
53
|
const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
package/migrations.json
CHANGED
|
@@ -366,6 +366,12 @@
|
|
|
366
366
|
"description": "Remove the `extendedDiagnostics` Angular compiler option from tsconfig files where `strictTemplates` resolves to `false`. Angular v22's `strict-templates-default` and `strict-safe-navigation-narrow` migrations can together produce this combination, which the Angular compiler rejects (`extendedDiagnostics` requires `strictTemplates` to be enabled).",
|
|
367
367
|
"factory": "./dist/src/migrations/update-23-1-0/remove-conflicting-extended-diagnostics",
|
|
368
368
|
"documentation": "./dist/src/migrations/update-23-1-0/remove-conflicting-extended-diagnostics.md"
|
|
369
|
+
},
|
|
370
|
+
"update-23-1-0-add-optional-webpack-packages": {
|
|
371
|
+
"version": "23.1.0-rc.3",
|
|
372
|
+
"description": "Add optional webpack, Module Federation, and Rspack packages when existing targets require them.",
|
|
373
|
+
"factory": "./dist/src/migrations/update-23-1-0/add-optional-webpack-packages",
|
|
374
|
+
"documentation": "./dist/src/migrations/update-23-1-0/add-optional-webpack-packages.md"
|
|
369
375
|
}
|
|
370
376
|
},
|
|
371
377
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/angular",
|
|
3
|
-
"version": "23.1.
|
|
3
|
+
"version": "23.1.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"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, 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.",
|
|
@@ -80,18 +80,14 @@
|
|
|
80
80
|
"picomatch": "4.0.4",
|
|
81
81
|
"semver": "^7.6.3",
|
|
82
82
|
"tslib": "^2.3.0",
|
|
83
|
-
"
|
|
84
|
-
"@nx/
|
|
85
|
-
"@nx/
|
|
86
|
-
"@nx/
|
|
87
|
-
"@nx/rspack": "23.1.1",
|
|
88
|
-
"@nx/eslint": "23.1.1",
|
|
89
|
-
"@nx/web": "23.1.1",
|
|
90
|
-
"@nx/webpack": "23.1.1"
|
|
83
|
+
"@nx/devkit": "23.1.3",
|
|
84
|
+
"@nx/eslint": "23.1.3",
|
|
85
|
+
"@nx/js": "23.1.3",
|
|
86
|
+
"@nx/web": "23.1.3"
|
|
91
87
|
},
|
|
92
88
|
"devDependencies": {
|
|
93
|
-
"@nx/vitest": "23.1.
|
|
94
|
-
"nx": "23.1.
|
|
89
|
+
"@nx/vitest": "23.1.3",
|
|
90
|
+
"nx": "23.1.3"
|
|
95
91
|
},
|
|
96
92
|
"peerDependencies": {
|
|
97
93
|
"@angular/build": ">= 20.0.0 < 23.0.0",
|
|
@@ -101,8 +97,12 @@
|
|
|
101
97
|
"@schematics/angular": ">= 20.0.0 < 23.0.0",
|
|
102
98
|
"ng-packagr": ">= 20.0.0 < 23.0.0",
|
|
103
99
|
"rxjs": "^6.5.3 || ^7.5.0",
|
|
104
|
-
"
|
|
105
|
-
"@nx/
|
|
100
|
+
"webpack-merge": "^5.8.0",
|
|
101
|
+
"@nx/module-federation": "23.1.3",
|
|
102
|
+
"@nx/webpack": "23.1.3",
|
|
103
|
+
"@nx/playwright": "23.1.3",
|
|
104
|
+
"@nx/rspack": "23.1.3",
|
|
105
|
+
"@nx/cypress": "23.1.3"
|
|
106
106
|
},
|
|
107
107
|
"peerDependenciesMeta": {
|
|
108
108
|
"@angular/build": {
|
|
@@ -114,11 +114,23 @@
|
|
|
114
114
|
"@nx/cypress": {
|
|
115
115
|
"optional": true
|
|
116
116
|
},
|
|
117
|
+
"@nx/module-federation": {
|
|
118
|
+
"optional": true
|
|
119
|
+
},
|
|
117
120
|
"@nx/playwright": {
|
|
118
121
|
"optional": true
|
|
119
122
|
},
|
|
123
|
+
"@nx/rspack": {
|
|
124
|
+
"optional": true
|
|
125
|
+
},
|
|
126
|
+
"@nx/webpack": {
|
|
127
|
+
"optional": true
|
|
128
|
+
},
|
|
120
129
|
"ng-packagr": {
|
|
121
130
|
"optional": true
|
|
131
|
+
},
|
|
132
|
+
"webpack-merge": {
|
|
133
|
+
"optional": true
|
|
122
134
|
}
|
|
123
135
|
},
|
|
124
136
|
"publishConfig": {
|