@nx/angular 23.1.0 → 23.1.2
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/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/add-linting/add-linting.js +18 -7
- package/dist/src/generators/add-linting/schema.d.ts +4 -0
- package/dist/src/generators/add-linting/schema.json +8 -2
- package/dist/src/generators/application/lib/add-e2e.js +3 -2
- package/dist/src/generators/application/lib/add-linting.js +2 -1
- package/dist/src/generators/application/lib/create-files.js +3 -3
- package/dist/src/generators/application/schema.d.ts +4 -0
- package/dist/src/generators/application/schema.json +8 -2
- package/dist/src/generators/host/host.js +2 -1
- package/dist/src/generators/host/schema.d.ts +4 -0
- package/dist/src/generators/host/schema.json +8 -2
- package/dist/src/generators/library/lib/create-files.js +3 -0
- package/dist/src/generators/library/lib/normalized-schema.d.ts +4 -0
- package/dist/src/generators/library/library.js +4 -3
- package/dist/src/generators/library/schema.d.ts +4 -0
- package/dist/src/generators/library/schema.json +8 -2
- 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/remote/remote.js +4 -3
- package/dist/src/generators/remote/schema.d.ts +4 -0
- package/dist/src/generators/remote/schema.json +8 -2
- 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/generate-config.js +2 -1
- package/dist/src/generators/setup-mf/lib/setup-tspath-for-remote.js +3 -2
- package/dist/src/generators/setup-mf/schema.d.ts +4 -0
- package/dist/src/generators/setup-mf/schema.json +8 -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/generators/utils/tsconfig-utils.js +2 -7
- 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/dist/tailwind.d.ts +1 -1
- package/dist/tailwind.js +2 -2
- package/migrations.json +6 -0
- package/package.json +32 -13
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.host = host;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
+
const internal_2 = require("@nx/eslint/internal");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
8
|
const js_1 = require("@nx/js");
|
|
8
9
|
const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
|
|
@@ -81,7 +82,7 @@ async function host(tree, schema) {
|
|
|
81
82
|
prefix: options.prefix,
|
|
82
83
|
typescriptConfiguration,
|
|
83
84
|
standalone: options.standalone,
|
|
84
|
-
|
|
85
|
+
enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
|
|
85
86
|
});
|
|
86
87
|
let installTasks = [appInstallTask];
|
|
87
88
|
if (options.ssr) {
|
|
@@ -9,6 +9,10 @@ export interface Schema {
|
|
|
9
9
|
port?: number;
|
|
10
10
|
remotes?: string[];
|
|
11
11
|
dynamic?: boolean;
|
|
12
|
+
enableTypedLinting?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
15
|
+
*/
|
|
12
16
|
setParserOptionsProject?: boolean;
|
|
13
17
|
skipPackageJson?: boolean;
|
|
14
18
|
skipPostInstall?: boolean;
|
|
@@ -153,11 +153,17 @@
|
|
|
153
153
|
"description": "Create an application with stricter type checking and build optimization options.",
|
|
154
154
|
"default": true
|
|
155
155
|
},
|
|
156
|
-
"
|
|
156
|
+
"enableTypedLinting": {
|
|
157
157
|
"type": "boolean",
|
|
158
|
-
"description": "Whether
|
|
158
|
+
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
159
159
|
"default": false
|
|
160
160
|
},
|
|
161
|
+
"setParserOptionsProject": {
|
|
162
|
+
"type": "boolean",
|
|
163
|
+
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
164
|
+
"default": false,
|
|
165
|
+
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
166
|
+
},
|
|
161
167
|
"skipFormat": {
|
|
162
168
|
"description": "Skip formatting files.",
|
|
163
169
|
"type": "boolean",
|
|
@@ -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
|
}
|
|
@@ -18,6 +18,10 @@ export interface NormalizedSchema {
|
|
|
18
18
|
tags?: string;
|
|
19
19
|
strict?: boolean;
|
|
20
20
|
compilationMode?: 'full' | 'partial';
|
|
21
|
+
enableTypedLinting?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
24
|
+
*/
|
|
21
25
|
setParserOptionsProject?: boolean;
|
|
22
26
|
skipModule?: boolean;
|
|
23
27
|
skipPackageJson?: boolean;
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.libraryGenerator = libraryGenerator;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
+
const internal_2 = require("@nx/eslint/internal");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
8
|
const js_1 = require("@nx/js");
|
|
8
|
-
const
|
|
9
|
+
const internal_3 = require("@nx/js/internal");
|
|
9
10
|
const init_1 = tslib_1.__importDefault(require("../../generators/init/init"));
|
|
10
11
|
const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
|
|
11
12
|
const test_runners_1 = require("../../utils/test-runners");
|
|
@@ -71,7 +72,7 @@ async function libraryGenerator(tree, schema) {
|
|
|
71
72
|
() => (0, devkit_1.installPackagesTask)(tree),
|
|
72
73
|
];
|
|
73
74
|
if (libraryOptions.publishable) {
|
|
74
|
-
tasks.push(await (0,
|
|
75
|
+
tasks.push(await (0, internal_3.releaseTasks)(tree));
|
|
75
76
|
}
|
|
76
77
|
tasks.push(() => (0, internal_1.logShowProjectCommand)(libraryOptions.name));
|
|
77
78
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
@@ -123,7 +124,7 @@ async function addLinting(host, options) {
|
|
|
123
124
|
projectRoot: options.projectRoot,
|
|
124
125
|
prefix: options.prefix,
|
|
125
126
|
unitTestRunner: options.unitTestRunner,
|
|
126
|
-
|
|
127
|
+
enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
|
|
127
128
|
skipFormat: true,
|
|
128
129
|
skipPackageJson: options.skipPackageJson,
|
|
129
130
|
});
|
|
@@ -22,6 +22,10 @@ export interface Schema {
|
|
|
22
22
|
linter?: Linter | LinterType;
|
|
23
23
|
unitTestRunner?: UnitTestRunner;
|
|
24
24
|
compilationMode?: 'full' | 'partial';
|
|
25
|
+
enableTypedLinting?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
28
|
+
*/
|
|
25
29
|
setParserOptionsProject?: boolean;
|
|
26
30
|
skipModule?: boolean;
|
|
27
31
|
skipPackageJson?: boolean;
|
|
@@ -107,11 +107,17 @@
|
|
|
107
107
|
"type": "string",
|
|
108
108
|
"enum": ["full", "partial"]
|
|
109
109
|
},
|
|
110
|
-
"
|
|
110
|
+
"enableTypedLinting": {
|
|
111
111
|
"type": "boolean",
|
|
112
|
-
"description": "Whether
|
|
112
|
+
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
113
113
|
"default": false
|
|
114
114
|
},
|
|
115
|
+
"setParserOptionsProject": {
|
|
116
|
+
"type": "boolean",
|
|
117
|
+
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
118
|
+
"default": false,
|
|
119
|
+
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
120
|
+
},
|
|
115
121
|
"skipModule": {
|
|
116
122
|
"type": "boolean",
|
|
117
123
|
"description": "Whether to skip the creation of a default module when generating the library.",
|
|
@@ -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
|
}
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.remote = remote;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
+
const internal_2 = require("@nx/eslint/internal");
|
|
6
7
|
const devkit_1 = require("@nx/devkit");
|
|
7
|
-
const
|
|
8
|
+
const internal_3 = require("@nx/js/internal");
|
|
8
9
|
const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
|
|
9
10
|
const test_runners_1 = require("../../utils/test-runners");
|
|
10
11
|
const application_1 = require("../application/application");
|
|
@@ -68,12 +69,12 @@ async function remote(tree, schema) {
|
|
|
68
69
|
standalone: options.standalone,
|
|
69
70
|
prefix: options.prefix,
|
|
70
71
|
typescriptConfiguration,
|
|
71
|
-
|
|
72
|
+
enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
|
|
72
73
|
});
|
|
73
74
|
const installTasks = [appInstallTask];
|
|
74
75
|
if (!options.skipPackageJson) {
|
|
75
76
|
const installSwcHelpersTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
76
|
-
'@swc/helpers':
|
|
77
|
+
'@swc/helpers': internal_3.swcHelpersVersion,
|
|
77
78
|
});
|
|
78
79
|
installTasks.push(installSwcHelpersTask);
|
|
79
80
|
}
|
|
@@ -8,6 +8,10 @@ export interface Schema {
|
|
|
8
8
|
bundler?: 'webpack' | 'rspack';
|
|
9
9
|
host?: string;
|
|
10
10
|
port?: number;
|
|
11
|
+
enableTypedLinting?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
14
|
+
*/
|
|
11
15
|
setParserOptionsProject?: boolean;
|
|
12
16
|
skipPackageJson?: boolean;
|
|
13
17
|
prefix?: string;
|
|
@@ -143,11 +143,17 @@
|
|
|
143
143
|
"description": "Create an application with stricter type checking and build optimization options.",
|
|
144
144
|
"default": true
|
|
145
145
|
},
|
|
146
|
-
"
|
|
146
|
+
"enableTypedLinting": {
|
|
147
147
|
"type": "boolean",
|
|
148
|
-
"description": "Whether
|
|
148
|
+
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
149
149
|
"default": false
|
|
150
150
|
},
|
|
151
|
+
"setParserOptionsProject": {
|
|
152
|
+
"type": "boolean",
|
|
153
|
+
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
154
|
+
"default": false,
|
|
155
|
+
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
156
|
+
},
|
|
151
157
|
"skipFormat": {
|
|
152
158
|
"description": "Skip formatting files.",
|
|
153
159
|
"type": "boolean",
|
|
@@ -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;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateWebpackConfig = generateWebpackConfig;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const internal_1 = require("@nx/eslint/internal");
|
|
5
6
|
function generateWebpackConfig(tree, options, appRoot, remotesWithPorts) {
|
|
6
7
|
if (tree.exists(`${appRoot}/module-federation.config.js`) ||
|
|
7
8
|
tree.exists(`${appRoot}/webpack.config.js`) ||
|
|
@@ -25,7 +26,7 @@ function generateWebpackConfig(tree, options, appRoot, remotesWithPorts) {
|
|
|
25
26
|
standalone: options.standalone,
|
|
26
27
|
entryModuleFileName: options.entryModuleFileName,
|
|
27
28
|
});
|
|
28
|
-
if (!
|
|
29
|
+
if (!(0, internal_1.isTypedLintingEnabled)(options)) {
|
|
29
30
|
tree.delete((0, devkit_1.joinPathFragments)(appRoot, 'tsconfig.lint.json'));
|
|
30
31
|
}
|
|
31
32
|
}
|
|
@@ -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
|
}
|
|
@@ -17,6 +17,10 @@ export interface Schema {
|
|
|
17
17
|
standalone?: boolean;
|
|
18
18
|
skipE2E?: boolean;
|
|
19
19
|
typescriptConfiguration?: boolean;
|
|
20
|
+
enableTypedLinting?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated Use `enableTypedLinting` instead. This option will be removed in Nx v24.
|
|
23
|
+
*/
|
|
20
24
|
setParserOptionsProject?: boolean;
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -81,10 +81,16 @@
|
|
|
81
81
|
"description": "Whether the module federation configuration and webpack configuration files should use TS.",
|
|
82
82
|
"default": true
|
|
83
83
|
},
|
|
84
|
-
"
|
|
84
|
+
"enableTypedLinting": {
|
|
85
85
|
"type": "boolean",
|
|
86
|
-
"description": "Whether
|
|
86
|
+
"description": "Whether to enable typed linting. For flat configs, this configures the recommended `parserOptions.projectService` and `tsconfigRootDir`. For legacy `.eslintrc` configs, this configures `parserOptions.project`. We do not enable this by default for lint performance reasons.",
|
|
87
87
|
"default": false
|
|
88
|
+
},
|
|
89
|
+
"setParserOptionsProject": {
|
|
90
|
+
"type": "boolean",
|
|
91
|
+
"description": "Deprecated alias for `enableTypedLinting`.",
|
|
92
|
+
"default": false,
|
|
93
|
+
"x-deprecated": "Use `enableTypedLinting` instead. This option will be removed in Nx v24."
|
|
88
94
|
}
|
|
89
95
|
},
|
|
90
96
|
"required": ["appName", "mfType"],
|
|
@@ -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 { }
|
|
@@ -18,12 +18,7 @@ function getDefinedCompilerOption(tree, tsConfigPath, optionName) {
|
|
|
18
18
|
}
|
|
19
19
|
function readCompilerOptionsFromTsConfig(tree, tsConfigPath) {
|
|
20
20
|
const ts = (0, internal_1.ensureTypescript)();
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
readDirectory: () => [],
|
|
24
|
-
readFile: (path) => tree.read(path, 'utf-8'),
|
|
25
|
-
fileExists: (path) => tree.exists(path),
|
|
26
|
-
};
|
|
27
|
-
const parsed = ts.parseJsonConfigFileContent(ts.readConfigFile(tsConfigPath, tsSysFromTree.readFile).config, tsSysFromTree, (0, node_path_1.dirname)(tsConfigPath));
|
|
21
|
+
const host = (0, internal_1.createTreeParseConfigHost)(tree);
|
|
22
|
+
const parsed = ts.parseJsonConfigFileContent(ts.readConfigFile(tsConfigPath, host.readFile).config, host, (0, node_path_1.dirname)(tsConfigPath));
|
|
28
23
|
return parsed.options;
|
|
29
24
|
}
|
|
@@ -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
|
|