@nx/angular 21.0.0-beta.1 → 21.0.0-beta.11
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/fesm2022/nx-angular.mjs +0 -352
- package/fesm2022/nx-angular.mjs.map +1 -1
- package/generators.json +7 -2
- package/index.d.ts +1 -1
- package/migrations.json +199 -69
- package/ng-package.json +1 -1
- package/package.json +11 -14
- package/src/builders/dev-server/dev-server.impl.js +2 -3
- package/src/builders/dev-server/lib/normalize-options.js +1 -0
- package/src/builders/dev-server/schema.d.ts +4 -0
- package/src/builders/dev-server/schema.json +10 -4
- package/src/builders/webpack-browser/schema.d.ts +1 -4
- package/src/builders/webpack-browser/schema.json +5 -0
- package/src/builders/webpack-browser/webpack-browser.impl.js +5 -5
- package/src/executors/delegate-build/delegate-build.impl.d.ts +1 -3
- package/src/executors/delegate-build/delegate-build.impl.js +0 -3
- package/src/executors/module-federation-dev-server/schema.d.ts +3 -0
- package/src/executors/module-federation-dev-server/schema.json +2 -1
- package/src/executors/module-federation-ssr-dev-server/schema.json +1 -0
- package/src/executors/package/package.impl.js +1 -4
- package/src/generators/add-linting/add-linting.js +2 -17
- package/src/generators/add-linting/lib/create-eslint-configuration.d.ts +2 -2
- package/src/generators/add-linting/lib/create-eslint-configuration.js +2 -2
- package/src/generators/add-linting/schema.d.ts +1 -0
- package/src/generators/application/application.js +20 -1
- package/src/generators/application/files/rspack-ssr/server.ts__tmpl__ +72 -0
- package/src/generators/application/lib/add-e2e.js +2 -9
- package/src/generators/application/lib/add-linting.js +2 -2
- package/src/generators/application/lib/add-serve-static-target.js +1 -0
- package/src/generators/application/lib/add-unit-test-runner.js +2 -0
- package/src/generators/application/lib/create-project.js +1 -0
- package/src/generators/application/lib/normalize-options.d.ts +1 -1
- package/src/generators/application/lib/normalize-options.js +10 -4
- package/src/generators/application/schema.d.ts +2 -2
- package/src/generators/application/schema.json +1 -7
- package/src/generators/component-test/component-test.js +1 -1
- package/src/generators/convert-to-rspack/convert-to-rspack.d.ts +4 -0
- package/src/generators/convert-to-rspack/convert-to-rspack.js +329 -0
- package/src/generators/convert-to-rspack/lib/create-config.d.ts +2 -0
- package/src/generators/convert-to-rspack/lib/create-config.js +45 -0
- package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.d.ts +6 -0
- package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +77 -0
- package/src/generators/convert-to-rspack/lib/update-tsconfig.d.ts +2 -0
- package/src/generators/convert-to-rspack/lib/update-tsconfig.js +26 -0
- package/src/generators/convert-to-rspack/lib/validate-supported-executor.d.ts +2 -0
- package/src/generators/convert-to-rspack/lib/validate-supported-executor.js +14 -0
- package/src/generators/convert-to-rspack/schema.d.ts +5 -0
- package/src/generators/convert-to-rspack/schema.json +30 -0
- package/src/generators/host/host.js +1 -1
- package/src/generators/host/schema.d.ts +0 -1
- package/src/generators/host/schema.json +0 -6
- package/src/generators/library/lib/add-project.d.ts +1 -1
- package/src/generators/library/lib/add-project.js +7 -1
- package/src/generators/library/lib/normalize-options.js +3 -4
- package/src/generators/library/lib/normalized-schema.d.ts +0 -1
- package/src/generators/library/library.js +6 -3
- package/src/generators/library/schema.d.ts +0 -1
- package/src/generators/library/schema.json +0 -6
- package/src/generators/move/move.d.ts +3 -0
- package/src/generators/move/move.js +3 -0
- package/src/generators/ng-add/migrators/projects/e2e.migrator.js +4 -4
- package/src/generators/ngrx/ngrx.d.ts +3 -0
- package/src/generators/ngrx/ngrx.js +3 -0
- package/src/generators/ngrx/schema.json +1 -1
- package/src/generators/ngrx-feature-store/schema.d.ts +1 -1
- package/src/generators/remote/remote.js +1 -1
- package/src/generators/remote/schema.d.ts +0 -1
- package/src/generators/remote/schema.json +0 -6
- package/src/generators/setup-mf/lib/setup-serve-target.js +1 -0
- package/src/generators/setup-ssr/files/v19+/application-builder/ngmodule-src/app/__rootModuleFileName__ +2 -2
- package/src/generators/setup-ssr/files/v19+/application-builder/server/__serverFileName__ +1 -1
- package/src/generators/setup-ssr/files/v19+/application-builder/standalone-src/app/app.config.server.ts__tpl__ +2 -2
- package/src/generators/setup-ssr/files/v19+/application-builder-common-engine/server/__serverFileName__ +2 -0
- package/src/generators/setup-ssr/lib/generate-files.js +12 -1
- package/src/generators/setup-ssr/lib/update-project-config.js +1 -0
- package/src/generators/stories/stories.js +2 -2
- package/src/generators/utils/add-jest.d.ts +1 -0
- package/src/generators/utils/add-jest.js +2 -2
- package/src/generators/utils/add-vitest.d.ts +1 -0
- package/src/generators/utils/add-vitest.js +1 -1
- package/src/generators/utils/ensure-angular-dependencies.js +0 -1
- package/src/generators/utils/testing.js +1 -2
- package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +4 -4
- package/src/migrations/update-19-6-0/turn-off-dts-by-default.js +2 -2
- package/src/migrations/{update-16-1-0 → update-20-5-0}/update-angular-cli.d.ts +1 -1
- package/src/migrations/{update-16-1-0 → update-20-5-0}/update-angular-cli.js +1 -1
- package/src/migrations/{update-16-1-0/remove-ngcc-invocation.d.ts → update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.d.ts} +1 -1
- package/src/migrations/update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.js +122 -0
- package/src/migrations/update-21-0-0/set-continuous-option.d.ts +3 -0
- package/src/migrations/update-21-0-0/set-continuous-option.js +29 -0
- package/src/plugins/plugin.js +2 -0
- package/src/utils/backward-compatible-versions.js +2 -0
- package/src/utils/nx-devkit/ast-utils.d.ts +0 -8
- package/src/utils/nx-devkit/ast-utils.js +7 -12
- package/src/utils/versions.d.ts +7 -6
- package/src/utils/versions.js +8 -7
- package/fesm2022/nx-angular-testing.mjs +0 -45
- package/fesm2022/nx-angular-testing.mjs.map +0 -1
- package/src/migrations/update-16-0-0/remove-karma-defaults.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-karma-defaults.js +0 -52
- package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.js +0 -40
- package/src/migrations/update-16-0-0/remove-protractor-defaults.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-protractor-defaults.js +0 -52
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
- package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.d.ts +0 -2
- package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.js +0 -127
- package/src/migrations/update-16-1-0/remove-ngcc-invocation.js +0 -22
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.d.ts +0 -2
- package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +0 -62
- package/src/migrations/update-16-1-0/update-server-executor-config.d.ts +0 -2
- package/src/migrations/update-16-1-0/update-server-executor-config.js +0 -26
- package/src/runtime/nx/data-persistence.d.ts +0 -276
- package/testing/index.d.ts +0 -1
- package/testing/ng-package.json +0 -6
- package/testing/src/testing-utils.d.ts +0 -33
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.libraryGenerator = libraryGenerator;
|
4
4
|
const tslib_1 = require("tslib");
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
6
|
-
const eslint_1 = require("@nx/eslint");
|
7
6
|
const js_1 = require("@nx/js");
|
8
7
|
const init_1 = tslib_1.__importDefault(require("../../generators/init/init"));
|
9
8
|
const add_linting_1 = tslib_1.__importDefault(require("../add-linting/add-linting"));
|
@@ -25,6 +24,7 @@ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-projec
|
|
25
24
|
const test_runners_1 = require("../../utils/test-runners");
|
26
25
|
const add_vitest_1 = require("../utils/add-vitest");
|
27
26
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
27
|
+
const add_release_config_1 = require("@nx/js/src/generators/library/utils/add-release-config");
|
28
28
|
async function libraryGenerator(tree, schema) {
|
29
29
|
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(tree, 'angular', 'library');
|
30
30
|
// Do some validation checks
|
@@ -49,7 +49,7 @@ async function libraryGenerator(tree, schema) {
|
|
49
49
|
if (!libraryOptions.skipPackageJson) {
|
50
50
|
(0, ensure_angular_dependencies_1.ensureAngularDependencies)(tree);
|
51
51
|
}
|
52
|
-
const project = (0, add_project_1.addProject)(tree, libraryOptions);
|
52
|
+
const project = await (0, add_project_1.addProject)(tree, libraryOptions);
|
53
53
|
(0, create_files_1.createFiles)(tree, options, project);
|
54
54
|
(0, update_tsconfig_1.updateTsConfig)(tree, libraryOptions);
|
55
55
|
await addUnitTestRunner(tree, libraryOptions);
|
@@ -76,6 +76,9 @@ async function libraryGenerator(tree, schema) {
|
|
76
76
|
'ng-packagr': pkgVersions.ngPackagrVersion,
|
77
77
|
}, undefined, true);
|
78
78
|
(0, dependencies_1.addBuildableLibrariesPostCssDependencies)(tree);
|
79
|
+
if (libraryOptions.publishable) {
|
80
|
+
await (0, add_release_config_1.releaseTasks)(tree);
|
81
|
+
}
|
79
82
|
}
|
80
83
|
(0, js_1.addTsConfigPath)(tree, libraryOptions.importPath, [
|
81
84
|
(0, devkit_1.joinPathFragments)(libraryOptions.projectRoot, './src', 'index.ts'),
|
@@ -122,7 +125,7 @@ function setStrictMode(host, options) {
|
|
122
125
|
}
|
123
126
|
}
|
124
127
|
async function addLinting(host, options) {
|
125
|
-
if (options.linter ===
|
128
|
+
if (options.linter === 'none') {
|
126
129
|
return;
|
127
130
|
}
|
128
131
|
await (0, add_linting_1.default)(host, {
|
@@ -108,12 +108,6 @@
|
|
108
108
|
"enum": ["eslint", "none"],
|
109
109
|
"default": "eslint"
|
110
110
|
},
|
111
|
-
"standaloneConfig": {
|
112
|
-
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
113
|
-
"type": "boolean",
|
114
|
-
"default": true,
|
115
|
-
"x-deprecated": "Nx only supports standaloneConfig"
|
116
|
-
},
|
117
111
|
"compilationMode": {
|
118
112
|
"description": "Specifies the compilation mode to use. If not specified, it will default to `partial` for publishable libraries and to `full` for buildable libraries. The `full` value can not be used for publishable libraries.",
|
119
113
|
"type": "string",
|
@@ -1,3 +1,6 @@
|
|
1
1
|
import type { Tree } from '@nx/devkit';
|
2
2
|
import type { Schema } from './schema';
|
3
|
+
/**
|
4
|
+
* @deprecated Use the `@nx/workspace:move` generator instead. It will be removed in Nx v22.
|
5
|
+
*/
|
3
6
|
export declare function angularMoveGenerator(tree: Tree, schema: Schema): Promise<void>;
|
@@ -2,6 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.angularMoveGenerator = angularMoveGenerator;
|
4
4
|
const move_1 = require("@nx/workspace/src/generators/move/move");
|
5
|
+
/**
|
6
|
+
* @deprecated Use the `@nx/workspace:move` generator instead. It will be removed in Nx v22.
|
7
|
+
*/
|
5
8
|
async function angularMoveGenerator(tree, schema) {
|
6
9
|
process.env.NX_ANGULAR_MOVE_INVOKED = 'true';
|
7
10
|
await (0, move_1.moveGenerator)(tree, schema);
|
@@ -173,8 +173,8 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
173
173
|
}
|
174
174
|
else if (this.isCypressE2eProject()) {
|
175
175
|
(0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
176
|
-
const {
|
177
|
-
this.cypressInstalledVersion =
|
176
|
+
const { getInstalledCypressMajorVersion, } = require('@nx/cypress/src/utils/versions');
|
177
|
+
this.cypressInstalledVersion = getInstalledCypressMajorVersion(this.tree);
|
178
178
|
this.project = {
|
179
179
|
...this.project,
|
180
180
|
name,
|
@@ -215,7 +215,7 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
215
215
|
if (this.isProjectUsingEsLint) {
|
216
216
|
await (0, eslint_1.lintProjectGenerator)(this.tree, {
|
217
217
|
project: this.project.name,
|
218
|
-
linter:
|
218
|
+
linter: 'eslint',
|
219
219
|
unitTestRunner: this.options.unitTestRunner,
|
220
220
|
tsConfigPaths: [
|
221
221
|
(0, devkit_1.joinPathFragments)(this.project.newRoot, 'tsconfig.json'),
|
@@ -240,7 +240,7 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
|
|
240
240
|
const { configurationGenerator } = (require('@nx/cypress'));
|
241
241
|
await configurationGenerator(this.tree, {
|
242
242
|
project: this.project.name,
|
243
|
-
linter: this.isProjectUsingEsLint ?
|
243
|
+
linter: this.isProjectUsingEsLint ? 'eslint' : 'none',
|
244
244
|
skipFormat: true,
|
245
245
|
// any target would do, we replace it later with the target existing in the project being migrated
|
246
246
|
devServerTarget: `${this.appName}:serve`,
|
@@ -1,4 +1,7 @@
|
|
1
1
|
import type { GeneratorCallback, Tree } from '@nx/devkit';
|
2
2
|
import type { NgRxGeneratorOptions } from './schema';
|
3
|
+
/**
|
4
|
+
* @deprecated Use the 'ngrx-root-store' and 'ngrx-feature-store' generators instead. It will be removed in Nx v22.
|
5
|
+
*/
|
3
6
|
export declare function ngrxGenerator(tree: Tree, schema: NgRxGeneratorOptions): Promise<GeneratorCallback>;
|
4
7
|
export default ngrxGenerator;
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ngrxGenerator = ngrxGenerator;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
5
|
const lib_1 = require("./lib");
|
6
|
+
/**
|
7
|
+
* @deprecated Use the 'ngrx-root-store' and 'ngrx-feature-store' generators instead. It will be removed in Nx v22.
|
8
|
+
*/
|
6
9
|
async function ngrxGenerator(tree, schema) {
|
7
10
|
(0, lib_1.validateOptions)(tree, schema);
|
8
11
|
const options = (0, lib_1.normalizeOptions)(tree, schema);
|
@@ -3,7 +3,7 @@
|
|
3
3
|
"$id": "NxNgrxGenerator",
|
4
4
|
"title": "Add NgRx support to an application or library.",
|
5
5
|
"description": "Adds NgRx support to an application or library.",
|
6
|
-
"x-deprecated": "
|
6
|
+
"x-deprecated": "Use the 'ngrx-root-store' and 'ngrx-feature-store' generators instead. It will be removed in Nx v22.",
|
7
7
|
"cli": "nx",
|
8
8
|
"type": "object",
|
9
9
|
"examples": [
|
@@ -18,7 +18,7 @@ async function remote(tree, schema) {
|
|
18
18
|
if (options.host && !projects.has(options.host)) {
|
19
19
|
throw new Error(`The name of the application to be used as the host app does not exist. (${options.host})`);
|
20
20
|
}
|
21
|
-
await (0, project_name_and_root_utils_1.
|
21
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
|
22
22
|
const { projectName: remoteProjectName } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
|
23
23
|
name: options.name,
|
24
24
|
projectType: 'application',
|
@@ -138,12 +138,6 @@
|
|
138
138
|
"description": "Create an application with stricter type checking and build optimization options.",
|
139
139
|
"default": true
|
140
140
|
},
|
141
|
-
"standaloneConfig": {
|
142
|
-
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
143
|
-
"type": "boolean",
|
144
|
-
"default": true,
|
145
|
-
"x-deprecated": "Nx only supports standaloneConfig"
|
146
|
-
},
|
147
141
|
"setParserOptionsProject": {
|
148
142
|
"type": "boolean",
|
149
143
|
"description": "Whether or not to configure the ESLint `parserOptions.project` option. We do not do this by default for lint performance reasons.",
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { NgModule } from '@angular/core';
|
2
2
|
import { ServerModule } from '@angular/platform-server';<% if(serverRouting) { %>
|
3
|
-
import {
|
3
|
+
import { <%= provideServerRoutingFn %> } from '@angular/ssr';<% } %>
|
4
4
|
import { AppComponent } from './app.component';
|
5
5
|
import { AppModule } from './app.module';<% if(serverRouting) { %>
|
6
6
|
import { serverRoutes } from './app.routes.server';<% } %>
|
7
7
|
|
8
8
|
@NgModule({
|
9
9
|
imports: [AppModule, ServerModule],<% if(serverRouting) { %>
|
10
|
-
providers: [
|
10
|
+
providers: [<%= provideServerRoutingFn %>(serverRoutes)],<% } %>
|
11
11
|
bootstrap: [AppComponent],
|
12
12
|
})
|
13
13
|
export class <%= rootModuleClassName %> {}
|
@@ -61,6 +61,6 @@ if (isMainModule(import.meta.url)) {
|
|
61
61
|
}
|
62
62
|
|
63
63
|
/**
|
64
|
-
*
|
64
|
+
* Request handler used by the Angular CLI (for dev-server and during build) or Firebase Cloud Functions.
|
65
65
|
*/
|
66
66
|
export const reqHandler = createNodeRequestHandler(app);
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { mergeApplicationConfig, ApplicationConfig } from '@angular/core';
|
2
2
|
import { provideServerRendering } from '@angular/platform-server';<% if(serverRouting) { %>
|
3
|
-
import {
|
3
|
+
import { <%= provideServerRoutingFn %> } from '@angular/ssr';<% } %>
|
4
4
|
import { appConfig } from './app.config';<% if(serverRouting) { %>
|
5
5
|
import { serverRoutes } from './app.routes.server';<% } %>
|
6
6
|
|
7
7
|
const serverConfig: ApplicationConfig = {
|
8
8
|
providers: [
|
9
9
|
provideServerRendering()<% if(serverRouting) { %>,
|
10
|
-
|
10
|
+
<%= provideServerRoutingFn %>(serverRoutes)<% } %>
|
11
11
|
]
|
12
12
|
};
|
13
13
|
|
@@ -4,6 +4,7 @@ exports.generateSSRFiles = generateSSRFiles;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
5
|
const path_1 = require("path");
|
6
6
|
const version_utils_1 = require("../../utils/version-utils");
|
7
|
+
const semver_1 = require("semver");
|
7
8
|
function generateSSRFiles(tree, options) {
|
8
9
|
const project = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
9
10
|
if (project.targets.server ||
|
@@ -24,7 +25,17 @@ function generateSSRFiles(tree, options) {
|
|
24
25
|
pathToFiles = (0, path_1.join)(baseFilesPath, 'pre-v19', options.standalone ? 'standalone-src' : 'ngmodule-src');
|
25
26
|
}
|
26
27
|
const sourceRoot = project.sourceRoot ?? (0, devkit_1.joinPathFragments)(project.root, 'src');
|
27
|
-
(0,
|
28
|
+
const ssrVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, '@angular/ssr');
|
29
|
+
const cleanedSsrVersion = ssrVersion
|
30
|
+
? (0, semver_1.clean)(ssrVersion) ?? (0, semver_1.coerce)(ssrVersion).version
|
31
|
+
: null;
|
32
|
+
(0, devkit_1.generateFiles)(tree, pathToFiles, sourceRoot, {
|
33
|
+
...options,
|
34
|
+
provideServerRoutingFn: !cleanedSsrVersion || (0, semver_1.gte)(cleanedSsrVersion, '19.2.0')
|
35
|
+
? 'provideServerRouting'
|
36
|
+
: 'provideServerRoutesConfig',
|
37
|
+
tpl: '',
|
38
|
+
});
|
28
39
|
if (angularMajorVersion >= 19 && !options.serverRouting) {
|
29
40
|
tree.delete((0, devkit_1.joinPathFragments)(sourceRoot, 'app/app.routes.server.ts'));
|
30
41
|
}
|
@@ -76,6 +76,7 @@ function updateProjectConfigForBrowserBuilder(tree, options) {
|
|
76
76
|
defaultConfiguration: 'production',
|
77
77
|
};
|
78
78
|
projectConfig.targets['serve-ssr'] = {
|
79
|
+
continuous: true,
|
79
80
|
executor: '@angular-devkit/build-angular:ssr-dev-server',
|
80
81
|
configurations: {
|
81
82
|
development: {
|
@@ -7,7 +7,7 @@ const component_story_1 = tslib_1.__importDefault(require("../component-story/co
|
|
7
7
|
const component_info_1 = require("../utils/storybook-ast/component-info");
|
8
8
|
const entry_point_1 = require("../utils/storybook-ast/entry-point");
|
9
9
|
const module_info_1 = require("../utils/storybook-ast/module-info");
|
10
|
-
const
|
10
|
+
const picomatch = require("picomatch");
|
11
11
|
const versions_1 = require("../../utils/versions");
|
12
12
|
async function angularStoriesGenerator(tree, options) {
|
13
13
|
const entryPoints = (0, entry_point_1.getProjectEntryPoints)(tree, options.name);
|
@@ -17,7 +17,7 @@ async function angularStoriesGenerator(tree, options) {
|
|
17
17
|
componentsInfo.push(...(0, component_info_1.getComponentsInfo)(tree, entryPoint, moduleFilePaths, options.name), ...(0, component_info_1.getStandaloneComponentsInfo)(tree, entryPoint));
|
18
18
|
}
|
19
19
|
const componentInfos = componentsInfo.filter((f) => !options.ignorePaths?.some((pattern) => {
|
20
|
-
const shouldIgnorePath = (
|
20
|
+
const shouldIgnorePath = picomatch(pattern)((0, devkit_1.joinPathFragments)(f.moduleFolderPath, f.path, `${f.componentFileName}.ts`));
|
21
21
|
return shouldIgnorePath;
|
22
22
|
}));
|
23
23
|
for (const info of componentInfos) {
|
@@ -16,8 +16,8 @@ async function addJest(tree, options) {
|
|
16
16
|
skipSerializers: false,
|
17
17
|
skipPackageJson: options.skipPackageJson,
|
18
18
|
skipFormat: true,
|
19
|
-
addPlugin: false,
|
20
|
-
addExplicitTargets:
|
19
|
+
addPlugin: options.addPlugin ?? false,
|
20
|
+
addExplicitTargets: !options.addPlugin,
|
21
21
|
});
|
22
22
|
const setupFile = (0, devkit_1.joinPathFragments)(options.projectRoot, 'src', 'test-setup.ts');
|
23
23
|
if (options.strict && tree.exists(setupFile)) {
|
@@ -19,7 +19,6 @@ function ensureAngularDependencies(tree) {
|
|
19
19
|
const rxjsVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'rxjs') ?? pkgVersions.rxjsVersion;
|
20
20
|
const tsLibVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'tslib') ?? pkgVersions.tsLibVersion;
|
21
21
|
const zoneJsVersion = (0, version_utils_1.getInstalledPackageVersion)(tree, 'zone.js') ?? pkgVersions.zoneJsVersion;
|
22
|
-
dependencies['@angular/animations'] = angularVersion;
|
23
22
|
dependencies['@angular/common'] = angularVersion;
|
24
23
|
dependencies['@angular/compiler'] = angularVersion;
|
25
24
|
dependencies['@angular/core'] = angularVersion;
|
@@ -7,7 +7,6 @@ exports.generateTestLibrary = generateTestLibrary;
|
|
7
7
|
exports.createStorybookTestWorkspaceForLib = createStorybookTestWorkspaceForLib;
|
8
8
|
const devkit_1 = require("@nx/devkit");
|
9
9
|
const testing_1 = require("@nx/devkit/testing");
|
10
|
-
const eslint_1 = require("@nx/eslint");
|
11
10
|
const test_runners_1 = require("../../utils/test-runners");
|
12
11
|
const application_1 = require("../application/application");
|
13
12
|
const component_1 = require("../component/component");
|
@@ -40,7 +39,7 @@ async function createStorybookTestWorkspaceForLib(libName) {
|
|
40
39
|
await (0, library_1.libraryGenerator)(tree, {
|
41
40
|
directory: libName,
|
42
41
|
buildable: false,
|
43
|
-
linter:
|
42
|
+
linter: 'eslint',
|
44
43
|
publishable: false,
|
45
44
|
simpleName: false,
|
46
45
|
skipFormat: true,
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = default_1;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
5
|
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
6
|
+
const project_graph_1 = require("nx/src/config/project-graph");
|
7
|
+
const nx_deps_cache_1 = require("nx/src/project-graph/nx-deps-cache");
|
8
|
+
const version_utils_1 = require("../../generators/utils/version-utils");
|
6
9
|
const file_change_recorder_1 = require("../../utils/file-change-recorder");
|
7
|
-
const versions_1 = require("../../utils/versions");
|
8
10
|
const projects_1 = require("../utils/projects");
|
9
|
-
const nx_deps_cache_1 = require("nx/src/project-graph/nx-deps-cache");
|
10
|
-
const project_graph_1 = require("nx/src/config/project-graph");
|
11
11
|
let tsquery;
|
12
12
|
const angularPluginTargetNames = ['npm:@nx/angular', 'npm:@nrwl/angular'];
|
13
13
|
const dataPersistenceOperators = [
|
@@ -109,7 +109,7 @@ function addNgrxRouterStoreIfNotInstalled(tree) {
|
|
109
109
|
devDependencies?.['@ngrx/router-store']) {
|
110
110
|
return;
|
111
111
|
}
|
112
|
-
(0, devkit_1.addDependenciesToPackageJson)(tree, { '@ngrx/router-store':
|
112
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, { '@ngrx/router-store': (0, version_utils_1.versions)(tree).ngrxVersion }, {});
|
113
113
|
}
|
114
114
|
function filterFilesWithNxAngularDep(files) {
|
115
115
|
const filteredFiles = [];
|
@@ -2,12 +2,12 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.default = default_1;
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
5
|
-
const
|
5
|
+
const picomatch = require("picomatch");
|
6
6
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
7
7
|
async function default_1(tree) {
|
8
8
|
(0, devkit_1.visitNotIgnoredFiles)(tree, '', (path) => {
|
9
9
|
const webpackConfigGlob = '**/webpack*.config*.{js,ts,mjs,cjs}';
|
10
|
-
const result = (
|
10
|
+
const result = picomatch(webpackConfigGlob)(path);
|
11
11
|
if (!result) {
|
12
12
|
return;
|
13
13
|
}
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.angularCliVersion = void 0;
|
4
4
|
exports.default = default_1;
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
6
|
-
exports.angularCliVersion = '~
|
6
|
+
exports.angularCliVersion = '~19.2.0';
|
7
7
|
async function default_1(tree) {
|
8
8
|
let shouldFormat = false;
|
9
9
|
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import type
|
1
|
+
import { type Tree } from '@nx/devkit';
|
2
2
|
export default function (tree: Tree): Promise<void>;
|
@@ -0,0 +1,122 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = default_1;
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
5
|
+
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
6
|
+
const project_graph_1 = require("nx/src/config/project-graph");
|
7
|
+
const nx_deps_cache_1 = require("nx/src/project-graph/nx-deps-cache");
|
8
|
+
const version_utils_1 = require("../../generators/utils/version-utils");
|
9
|
+
const file_change_recorder_1 = require("../../utils/file-change-recorder");
|
10
|
+
const projects_1 = require("../utils/projects");
|
11
|
+
let tsquery;
|
12
|
+
const angularPluginTargetNames = ['npm:@nx/angular', 'npm:@nrwl/angular'];
|
13
|
+
const dataPersistenceOperators = [
|
14
|
+
'fetch',
|
15
|
+
'navigation',
|
16
|
+
'optimisticUpdate',
|
17
|
+
'pessimisticUpdate',
|
18
|
+
];
|
19
|
+
const newImportPath = '@ngrx/router-store/data-persistence';
|
20
|
+
async function default_1(tree) {
|
21
|
+
const projects = await (0, projects_1.getProjectsFilteredByDependencies)(tree, angularPluginTargetNames);
|
22
|
+
if (!projects.length) {
|
23
|
+
return;
|
24
|
+
}
|
25
|
+
(0, ensure_typescript_1.ensureTypescript)();
|
26
|
+
tsquery = require('@phenomnomnominal/tsquery').tsquery;
|
27
|
+
const cachedFileMap = (0, nx_deps_cache_1.readFileMapCache)().fileMap.projectFileMap;
|
28
|
+
const filesWithNxAngularImports = [];
|
29
|
+
for (const { graphNode } of projects) {
|
30
|
+
const files = filterFilesWithNxAngularDep(cachedFileMap[graphNode.name] || []);
|
31
|
+
filesWithNxAngularImports.push(...files);
|
32
|
+
}
|
33
|
+
let isAnyFileUsingDataPersistence = false;
|
34
|
+
for (const { file } of filesWithNxAngularImports) {
|
35
|
+
const updated = replaceDataPersistenceInFile(tree, file);
|
36
|
+
isAnyFileUsingDataPersistence ||= updated;
|
37
|
+
}
|
38
|
+
if (isAnyFileUsingDataPersistence) {
|
39
|
+
addNgrxRouterStoreIfNotInstalled(tree);
|
40
|
+
await (0, devkit_1.formatFiles)(tree);
|
41
|
+
}
|
42
|
+
}
|
43
|
+
function replaceDataPersistenceInFile(tree, file) {
|
44
|
+
const fileContents = tree.read(file, 'utf-8');
|
45
|
+
const fileAst = tsquery.ast(fileContents);
|
46
|
+
// "\\u002F" is the unicode code for "/", there's an issue with the query parser
|
47
|
+
// that prevents using "/" directly in regex queries
|
48
|
+
// https://github.com/estools/esquery/issues/68#issuecomment-415597670
|
49
|
+
const NX_ANGULAR_IMPORT_SELECTOR = 'ImportDeclaration:has(StringLiteral[value=/@(nx|nrwl)\\u002Fangular$/])';
|
50
|
+
const nxAngularImports = tsquery(fileAst, NX_ANGULAR_IMPORT_SELECTOR, { visitAllChildren: true });
|
51
|
+
if (!nxAngularImports.length) {
|
52
|
+
return false;
|
53
|
+
}
|
54
|
+
const recorder = new file_change_recorder_1.FileChangeRecorder(tree, file);
|
55
|
+
const IMPORT_SPECIFIERS_SELECTOR = 'ImportClause NamedImports ImportSpecifier';
|
56
|
+
for (const importDeclaration of nxAngularImports) {
|
57
|
+
const importSpecifiers = tsquery(importDeclaration, IMPORT_SPECIFIERS_SELECTOR, { visitAllChildren: true });
|
58
|
+
if (!importSpecifiers.length) {
|
59
|
+
continue;
|
60
|
+
}
|
61
|
+
// no imported symbol is a data persistence operator, skip
|
62
|
+
if (importSpecifiers.every((i) => !isOperatorImport(i))) {
|
63
|
+
continue;
|
64
|
+
}
|
65
|
+
// all imported symbols are data persistence operators, change import path
|
66
|
+
if (importSpecifiers.every((i) => isOperatorImport(i))) {
|
67
|
+
const IMPORT_PATH_SELECTOR = `${NX_ANGULAR_IMPORT_SELECTOR} > StringLiteral`;
|
68
|
+
const importPathNode = tsquery(importDeclaration, IMPORT_PATH_SELECTOR, {
|
69
|
+
visitAllChildren: true,
|
70
|
+
});
|
71
|
+
recorder.replace(importPathNode[0], `'${newImportPath}'`);
|
72
|
+
continue;
|
73
|
+
}
|
74
|
+
// mixed imports, split data persistence operators to a separate import
|
75
|
+
const operatorImportSpecifiers = [];
|
76
|
+
for (const importSpecifier of importSpecifiers) {
|
77
|
+
if (isOperatorImport(importSpecifier)) {
|
78
|
+
operatorImportSpecifiers.push(importSpecifier.getText());
|
79
|
+
recorder.remove(importSpecifier.getStart(), importSpecifier.getEnd() +
|
80
|
+
(hasTrailingComma(recorder.originalContent, importSpecifier)
|
81
|
+
? 1
|
82
|
+
: 0));
|
83
|
+
}
|
84
|
+
}
|
85
|
+
recorder.insertLeft(importDeclaration.getStart(), `import { ${operatorImportSpecifiers.join(', ')} } from '${newImportPath}';`);
|
86
|
+
}
|
87
|
+
if (recorder.hasChanged()) {
|
88
|
+
recorder.applyChanges();
|
89
|
+
return true;
|
90
|
+
}
|
91
|
+
return false;
|
92
|
+
}
|
93
|
+
function hasTrailingComma(content, node) {
|
94
|
+
return content[node.getEnd()] === ',';
|
95
|
+
}
|
96
|
+
function isOperatorImport(importSpecifier) {
|
97
|
+
return dataPersistenceOperators.includes(getOriginalIdentifierTextFromImportSpecifier(importSpecifier));
|
98
|
+
}
|
99
|
+
function getOriginalIdentifierTextFromImportSpecifier(importSpecifier) {
|
100
|
+
const children = importSpecifier.getChildren();
|
101
|
+
if (!children.length) {
|
102
|
+
return importSpecifier.getText();
|
103
|
+
}
|
104
|
+
return children[0].getText();
|
105
|
+
}
|
106
|
+
function addNgrxRouterStoreIfNotInstalled(tree) {
|
107
|
+
const { dependencies, devDependencies } = (0, devkit_1.readJson)(tree, 'package.json');
|
108
|
+
if (dependencies?.['@ngrx/router-store'] ||
|
109
|
+
devDependencies?.['@ngrx/router-store']) {
|
110
|
+
return;
|
111
|
+
}
|
112
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, { '@ngrx/router-store': (0, version_utils_1.versions)(tree).ngrxVersion }, {});
|
113
|
+
}
|
114
|
+
function filterFilesWithNxAngularDep(files) {
|
115
|
+
const filteredFiles = [];
|
116
|
+
for (const file of files) {
|
117
|
+
if (file.deps?.some((dep) => angularPluginTargetNames.includes((0, project_graph_1.fileDataDepTarget)(dep)))) {
|
118
|
+
filteredFiles.push(file);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
return filteredFiles;
|
122
|
+
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.continuousExecutors = void 0;
|
4
|
+
exports.default = default_1;
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
6
|
+
exports.continuousExecutors = new Set([
|
7
|
+
'@angular-devkit/build-angular:dev-server',
|
8
|
+
'@angular-devkit/build-angular:ssr-dev-server',
|
9
|
+
'@nx/angular:dev-server',
|
10
|
+
'@nx/angular:module-federation-dev-server',
|
11
|
+
'@nx/angular:module-federation-dev-ssr',
|
12
|
+
]);
|
13
|
+
async function default_1(tree) {
|
14
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
15
|
+
for (const [projectName, projectConfig] of projects) {
|
16
|
+
let updated = false;
|
17
|
+
for (const targetConfig of Object.values(projectConfig.targets ?? {})) {
|
18
|
+
if (exports.continuousExecutors.has(targetConfig.executor) &&
|
19
|
+
targetConfig.continuous === undefined) {
|
20
|
+
targetConfig.continuous = true;
|
21
|
+
updated = true;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
if (updated) {
|
25
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
await (0, devkit_1.formatFiles)(tree);
|
29
|
+
}
|
package/src/plugins/plugin.js
CHANGED
@@ -114,6 +114,7 @@ async function buildAngularProjects(configFilePath, options, angularWorkspaceRoo
|
|
114
114
|
await updateBuildTarget(nxTargetName, targets[nxTargetName], angularTarget, context, angularWorkspaceRoot, project.root, namedInputs);
|
115
115
|
}
|
116
116
|
else if (knownExecutors.devServer.has(angularTarget.builder)) {
|
117
|
+
targets[nxTargetName].continuous = true;
|
117
118
|
targets[nxTargetName].metadata.help.example.options = { port: 4201 };
|
118
119
|
}
|
119
120
|
else if (knownExecutors.extractI18n.has(angularTarget.builder)) {
|
@@ -128,6 +129,7 @@ async function buildAngularProjects(configFilePath, options, angularWorkspaceRoo
|
|
128
129
|
updateServerTarget(targets[nxTargetName], angularTarget, context, angularWorkspaceRoot, project.root, namedInputs);
|
129
130
|
}
|
130
131
|
else if (knownExecutors.serveSsr.has(angularTarget.builder)) {
|
132
|
+
targets[nxTargetName].continuous = true;
|
131
133
|
targets[nxTargetName].metadata.help.example.options = { port: 4201 };
|
132
134
|
}
|
133
135
|
else if (knownExecutors.prerender.has(angularTarget.builder)) {
|
@@ -6,6 +6,7 @@ exports.backwardCompatibleVersions = {
|
|
6
6
|
angularVersion: '~17.3.0',
|
7
7
|
angularDevkitVersion: '~17.3.0',
|
8
8
|
ngPackagrVersion: '~17.3.0',
|
9
|
+
angularRspackVersion: '~20.6.1',
|
9
10
|
ngrxVersion: '~17.0.0',
|
10
11
|
rxjsVersion: '~7.8.0',
|
11
12
|
zoneJsVersion: '~0.14.3',
|
@@ -33,6 +34,7 @@ exports.backwardCompatibleVersions = {
|
|
33
34
|
angularVersion: '~18.2.0',
|
34
35
|
angularDevkitVersion: '~18.2.0',
|
35
36
|
ngPackagrVersion: '~18.2.0',
|
37
|
+
angularRspackVersion: '~20.6.1',
|
36
38
|
ngrxVersion: '~18.0.2',
|
37
39
|
rxjsVersion: '~7.8.0',
|
38
40
|
zoneJsVersion: '~0.14.3',
|