@nx/angular 0.0.0-pr-33838-05b9549 → 0.0.0-pr-34018-741bc4e

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.
Files changed (28) hide show
  1. package/migrations.json +27 -17
  2. package/package.json +9 -9
  3. package/src/builders/dev-server/lib/validate-options.d.ts.map +1 -1
  4. package/src/builders/dev-server/lib/validate-options.js +3 -3
  5. package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts.map +1 -1
  6. package/src/generators/cypress-component-configuration/cypress-component-configuration.js +47 -8
  7. package/src/generators/library/lib/normalize-options.js +1 -1
  8. package/src/generators/ng-add/utilities/dependencies.d.ts.map +1 -1
  9. package/src/generators/ngrx/lib/normalize-options.js +1 -1
  10. package/src/generators/ngrx-feature-store/lib/normalize-options.js +1 -1
  11. package/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.d.ts.map +1 -1
  12. package/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.js +3 -1
  13. package/src/generators/setup-ssr/lib/generate-files.js +1 -1
  14. package/src/generators/utils/entry-point.js +1 -1
  15. package/src/generators/web-worker/lib/normalize-options.js +1 -1
  16. package/src/migrations/update-22-3-0/set-isolated-modules.d.ts +3 -0
  17. package/src/migrations/update-22-3-0/set-isolated-modules.d.ts.map +1 -0
  18. package/src/migrations/update-22-3-0/set-isolated-modules.js +52 -0
  19. package/src/migrations/update-22-3-0/update-jest-preset-angular-setup.d.ts +3 -0
  20. package/src/migrations/update-22-3-0/update-jest-preset-angular-setup.d.ts.map +1 -0
  21. package/src/migrations/update-22-3-0/update-jest-preset-angular-setup.js +63 -0
  22. package/src/utils/file-change-recorder.d.ts.map +1 -1
  23. package/src/utils/version-utils.js +3 -3
  24. package/src/utils/versions.d.ts +1 -1
  25. package/src/utils/versions.js +1 -1
  26. package/src/migrations/update-22-3-0/update-angular-cli.d.ts +0 -4
  27. package/src/migrations/update-22-3-0/update-angular-cli.d.ts.map +0 -1
  28. package/src/migrations/update-22-3-0/update-angular-cli.js +0 -14
package/migrations.json CHANGED
@@ -342,14 +342,6 @@
342
342
  "description": "Update the @angular/cli package version to ~20.3.0.",
343
343
  "factory": "./src/migrations/update-21-6-1/update-angular-cli"
344
344
  },
345
- "update-angular-cli-version-21-0-0": {
346
- "version": "22.3.0-beta.0",
347
- "requires": {
348
- "@angular/core": ">=21.0.0"
349
- },
350
- "description": "Update the @angular/cli package version to ~21.0.0.",
351
- "factory": "./src/migrations/update-22-3-0/update-angular-cli"
352
- },
353
345
  "update-ssr-webpack-config-22-2-0": {
354
346
  "version": "22.3.0-beta.0",
355
347
  "requires": {
@@ -381,6 +373,22 @@
381
373
  },
382
374
  "description": "Update 'vitest' unit test runner option to 'vitest-analog' in generator defaults.",
383
375
  "factory": "./src/migrations/update-22-3-0/update-unit-test-runner-option"
376
+ },
377
+ "set-isolated-modules-22-3-0": {
378
+ "version": "22.3.0-beta.3",
379
+ "requires": {
380
+ "@angular/core": ">=21.0.0"
381
+ },
382
+ "description": "Set 'isolatedModules' to 'true' in TypeScript test configurations for Angular projects.",
383
+ "factory": "./src/migrations/update-22-3-0/set-isolated-modules"
384
+ },
385
+ "update-jest-preset-angular-setup": {
386
+ "version": "22.3.0-beta.3",
387
+ "requires": {
388
+ "@angular/core": ">=21.0.0"
389
+ },
390
+ "description": "Replace 'jest-preset-angular/setup-jest' imports with the new 'setupZoneTestEnv' function.",
391
+ "factory": "./src/migrations/update-22-3-0/update-jest-preset-angular-setup"
384
392
  }
385
393
  },
386
394
  "packageJsonUpdates": {
@@ -1996,6 +2004,12 @@
1996
2004
  "@angular/core": ">=20.3.0 <21.0.0"
1997
2005
  },
1998
2006
  "packages": {
2007
+ "@angular/cli": {
2008
+ "version": "~21.0.0",
2009
+ "alwaysAddToPackageJson": false,
2010
+ "ignorePackageGroup": true,
2011
+ "ignoreMigrations": true
2012
+ },
1999
2013
  "@angular-devkit/build-angular": {
2000
2014
  "version": "~21.0.0",
2001
2015
  "alwaysAddToPackageJson": false
@@ -2145,18 +2159,14 @@
2145
2159
  }
2146
2160
  }
2147
2161
  },
2148
- "22.3.0-jest": {
2149
- "version": "22.3.0-beta.0",
2162
+ "22.3.2-ngrx": {
2163
+ "version": "22.3.2-beta.0",
2150
2164
  "requires": {
2151
- "@angular/compiler-cli": ">=19.0.0 <22.0.0",
2152
- "@angular/core": ">=19.0.0 <22.0.0",
2153
- "@angular/platform-browser": ">=19.0.0 <22.0.0",
2154
- "@angular/platform-browser-dynamic": ">=19.0.0 <22.0.0",
2155
- "jest": "^30.0.0"
2165
+ "@angular/core": "^21.0.0"
2156
2166
  },
2157
2167
  "packages": {
2158
- "jest-preset-angular": {
2159
- "version": "~16.0.0",
2168
+ "@ngrx/store": {
2169
+ "version": "^21.0.0",
2160
2170
  "alwaysAddToPackageJson": false
2161
2171
  }
2162
2172
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "0.0.0-pr-33838-05b9549",
3
+ "version": "0.0.0-pr-34018-741bc4e",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Playwright and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -62,14 +62,14 @@
62
62
  "migrations": "./migrations.json"
63
63
  },
64
64
  "dependencies": {
65
- "@nx/devkit": "0.0.0-pr-33838-05b9549",
66
- "@nx/eslint": "0.0.0-pr-33838-05b9549",
67
- "@nx/js": "0.0.0-pr-33838-05b9549",
68
- "@nx/module-federation": "0.0.0-pr-33838-05b9549",
69
- "@nx/rspack": "0.0.0-pr-33838-05b9549",
70
- "@nx/web": "0.0.0-pr-33838-05b9549",
71
- "@nx/webpack": "0.0.0-pr-33838-05b9549",
72
- "@nx/workspace": "0.0.0-pr-33838-05b9549",
65
+ "@nx/devkit": "0.0.0-pr-34018-741bc4e",
66
+ "@nx/eslint": "0.0.0-pr-34018-741bc4e",
67
+ "@nx/js": "0.0.0-pr-34018-741bc4e",
68
+ "@nx/module-federation": "0.0.0-pr-34018-741bc4e",
69
+ "@nx/rspack": "0.0.0-pr-34018-741bc4e",
70
+ "@nx/web": "0.0.0-pr-34018-741bc4e",
71
+ "@nx/webpack": "0.0.0-pr-34018-741bc4e",
72
+ "@nx/workspace": "0.0.0-pr-34018-741bc4e",
73
73
  "@phenomnomnominal/tsquery": "~5.0.1",
74
74
  "@typescript-eslint/type-utils": "^8.0.0",
75
75
  "enquirer": "~2.3.6",
@@ -1 +1 @@
1
- {"version":3,"file":"validate-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/builders/dev-server/lib/validate-options.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CASrD"}
1
+ {"version":3,"file":"validate-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/builders/dev-server/lib/validate-options.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAExC,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAUrD"}
@@ -4,10 +4,10 @@ exports.validateOptions = validateOptions;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const angular_version_utils_1 = require("../../../executors/utilities/angular-version-utils");
6
6
  function validateOptions(options) {
7
- const { major: angularMajorVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
7
+ const { major: angularMajorVersion, version: angularVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
8
8
  if (angularMajorVersion < 21) {
9
- if (options.define) {
10
- throw new Error((0, devkit_1.stripIndents) `The "define" option is only supported in Angular >= 21.0.0. You are currently using "${angularMajorVersion}".
9
+ if (options.define && Object.keys(options.define).length > 0) {
10
+ throw new Error((0, devkit_1.stripIndents) `The "define" option is only supported in Angular >= 21.0.0. You are currently using "${angularVersion}".
11
11
  You can resolve this error by removing the "define" option or by migrating to Angular 21.0.0.`);
12
12
  }
13
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cypress-component-configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/cypress-component-configuration/cypress-component-configuration.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,iBAAiB,EAMjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAYpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAgBxD;;;GAGG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,iBAAiB,CAAC,CA+C5B;AAmJD,eAAe,6BAA6B,CAAC"}
1
+ {"version":3,"file":"cypress-component-configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/cypress-component-configuration/cypress-component-configuration.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,iBAAiB,EAMjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAYpB,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAiBxD;;;GAGG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,iBAAiB,CAAC,CAsD5B;AAoJD,eAAe,6BAA6B,CAAC"}
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.cypressComponentConfiguration = cypressComponentConfiguration;
4
37
  const devkit_1 = require("@nx/devkit");
@@ -10,6 +43,7 @@ const component_info_1 = require("../utils/storybook-ast/component-info");
10
43
  const entry_point_1 = require("../utils/storybook-ast/entry-point");
11
44
  const module_info_1 = require("../utils/storybook-ast/module-info");
12
45
  const update_app_editor_tsconfig_excluded_files_1 = require("../utils/update-app-editor-tsconfig-excluded-files");
46
+ const semver_1 = require("semver");
13
47
  const webpackExecutors = new Set([
14
48
  '@nx/angular:webpack-browser',
15
49
  '@nrwl/angular:webpack-browser',
@@ -27,8 +61,8 @@ const esbuildExecutors = new Set([
27
61
  * storybook + cypress then use the componentCypressGenerator instead.
28
62
  */
29
63
  async function cypressComponentConfiguration(tree, options) {
64
+ const { componentConfigurationGenerator: baseCyCTConfig } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
30
65
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
31
- // Cypress Component Testing requires Zone.js
32
66
  let isZoneless;
33
67
  if (projectConfig.projectType === 'application') {
34
68
  // For applications, check the polyfills in the build target
@@ -39,11 +73,16 @@ async function cypressComponentConfiguration(tree, options) {
39
73
  isZoneless = (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'zone.js') === null;
40
74
  }
41
75
  if (isZoneless) {
42
- throw new Error(`Cypress Component Testing doesn't support Zoneless Angular projects yet. ` +
43
- `The project "${options.project}" is configured without Zone.js. ` +
44
- `See https://github.com/cypress-io/cypress/issues/31504.`);
76
+ const { getInstalledCypressVersion } = await Promise.resolve().then(() => __importStar(require('@nx/cypress/src/utils/versions')));
77
+ const installedCypressVersion = getInstalledCypressVersion(tree);
78
+ // Zoneless support was introduced in Cypress 15.8.0
79
+ // If Cypress is not yet installed, we'll install the latest version, which will have zoneless support
80
+ if (installedCypressVersion && (0, semver_1.lt)(installedCypressVersion, '15.8.0')) {
81
+ throw new Error(`Cypress Component Testing doesn't support Zoneless Angular projects for your installed Cypress version (${installedCypressVersion}). ` +
82
+ `The project "${options.project}" is configured without Zone.js. ` +
83
+ `Please upgrade Cypress to version 15.8.0 or higher.`);
84
+ }
45
85
  }
46
- const { componentConfigurationGenerator: baseCyCTConfig } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
47
86
  const tasks = [];
48
87
  tasks.push(await baseCyCTConfig(tree, {
49
88
  project: options.project,
@@ -53,7 +92,7 @@ async function cypressComponentConfiguration(tree, options) {
53
92
  skipPackageJson: options.skipPackageJson,
54
93
  }));
55
94
  await configureCypressCT(tree, options);
56
- tasks.push(await addFiles(tree, projectConfig, options));
95
+ tasks.push(await addFiles(tree, projectConfig, options, isZoneless));
57
96
  if (projectConfig.projectType === 'application') {
58
97
  (0, update_app_editor_tsconfig_excluded_files_1.updateAppEditorTsConfigExcludedFiles)(tree, projectConfig);
59
98
  }
@@ -62,11 +101,11 @@ async function cypressComponentConfiguration(tree, options) {
62
101
  }
63
102
  return (0, devkit_1.runTasksInSerial)(...tasks);
64
103
  }
65
- async function addFiles(tree, projectConfig, options) {
104
+ async function addFiles(tree, projectConfig, options, isZoneless) {
66
105
  const componentFile = (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress', 'support', 'component.ts');
67
106
  const { addMountDefinition } = require('@nx/cypress/src/utils/config');
68
107
  const updatedCmpContents = await addMountDefinition(tree.read(componentFile, 'utf-8'));
69
- tree.write(componentFile, `import { mount } from 'cypress/angular';\n${updatedCmpContents}`);
108
+ tree.write(componentFile, `import { mount } from '${isZoneless ? 'cypress/angular-zoneless' : 'cypress/angular'}';\n${updatedCmpContents}`);
70
109
  if (!options.generateTests) {
71
110
  return () => { };
72
111
  }
@@ -17,7 +17,7 @@ async function normalizeOptions(host, schema) {
17
17
  // Publishable libs cannot use `full` yet, so if its false then use the passed value or default to `full`
18
18
  compilationMode: schema.publishable
19
19
  ? 'partial'
20
- : schema.compilationMode ?? 'full',
20
+ : (schema.compilationMode ?? 'full'),
21
21
  skipModule: schema.skipModule || schema.standalone,
22
22
  ...schema,
23
23
  };
@@ -1 +1 @@
1
- {"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/ng-add/utilities/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,IAAI,EAAE,MAAM,YAAY,CAAC;AAI1E,wBAAgB,+CAA+C,CAC7D,IAAI,EAAE,IAAI,GACT,IAAI,CA4BN"}
1
+ {"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/ng-add/utilities/dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,IAAI,EAAE,MAAM,YAAY,CAAC;AAI1E,wBAAgB,+CAA+C,CAC7D,IAAI,EAAE,IAAI,GACT,IAAI,CA+BN"}
@@ -22,7 +22,7 @@ function normalizeOptions(tree, options) {
22
22
  : options.parent
23
23
  ? (0, path_1.dirname)(options.parent)
24
24
  : undefined,
25
- route: options.route === '' ? `''` : options.route ?? `''`,
25
+ route: options.route === '' ? `''` : (options.route ?? `''`),
26
26
  directory: (0, devkit_1.names)(options.directory).fileName,
27
27
  rxjsVersion,
28
28
  rxjsMajorVersion,
@@ -21,7 +21,7 @@ function normalizeOptions(tree, options) {
21
21
  name,
22
22
  subdirectory,
23
23
  parentDirectory: options.parent ? (0, path_1.dirname)(options.parent) : undefined,
24
- route: options.route === '' ? `''` : options.route ?? `''`,
24
+ route: options.route === '' ? `''` : (options.route ?? `''`),
25
25
  directory: (0, devkit_1.names)(options.directory).fileName,
26
26
  rxjsVersion,
27
27
  rxjsMajorVersion,
@@ -1 +1 @@
1
- {"version":3,"file":"convert-scam-to-standalone.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE1D,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGnD,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,UAAU,EACxB,qBAAqB,EAAE,MAAM,EAC7B,YAAY,EAAE,MAAM,EAAE,EACtB,cAAc,EAAE,MAAM,EAAE,EACxB,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,EACxB,IAAI,EAAE,IAAI,EACV,uBAAuB,EAAE,MAAM,EAC/B,aAAa,EAAE,MAAM,QAyDtB"}
1
+ {"version":3,"file":"convert-scam-to-standalone.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE1D,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGnD,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,UAAU,EACxB,qBAAqB,EAAE,MAAM,EAC7B,YAAY,EAAE,MAAM,EAAE,EACtB,cAAc,EAAE,MAAM,EAAE,EACxB,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,EACxB,IAAI,EAAE,IAAI,EACV,uBAAuB,EAAE,MAAM,EAC/B,aAAa,EAAE,MAAM,QA2DtB"}
@@ -11,7 +11,9 @@ function convertScamToStandalone(componentAST, componentFileContents, importsArr
11
11
  const componentDecoratorMetadataNode = tsquery(componentAST, COMPONENT_PROPERTY_SELECTOR, { visitAllChildren: true })[0];
12
12
  const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
13
13
  newComponentContents = `${componentFileContents.slice(0, componentDecoratorMetadataNode.getStart() - 1)}({
14
- imports: [${importsArray.join(',')}],${providersArray.length > 0 ? `providers: [${providersArray.join(',')}],` : ''}${componentFileContents.slice(componentDecoratorMetadataNode.getStart() + 1, moduleNodes[0].getStart() - 1)}`;
14
+ imports: [${importsArray.join(',')}],${providersArray.length > 0
15
+ ? `providers: [${providersArray.join(',')}],`
16
+ : ''}${componentFileContents.slice(componentDecoratorMetadataNode.getStart() + 1, moduleNodes[0].getStart() - 1)}`;
15
17
  tree.write(normalizedComponentPath, newComponentContents);
16
18
  const componentPathParts = (0, path_1.parse)(normalizedComponentPath);
17
19
  const pathToComponentSpec = (0, devkit_1.joinPathFragments)(componentPathParts.dir, '/', `${componentPathParts.name}.spec.ts`);
@@ -32,7 +32,7 @@ function generateSSRFiles(tree, options) {
32
32
  const sourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(project, tree);
33
33
  const ssrVersion = (0, devkit_1.getDependencyVersionFromPackageJson)(tree, '@angular/ssr');
34
34
  const cleanedSsrVersion = ssrVersion
35
- ? (0, semver_1.clean)(ssrVersion) ?? (0, semver_1.coerce)(ssrVersion).version
35
+ ? ((0, semver_1.clean)(ssrVersion) ?? (0, semver_1.coerce)(ssrVersion).version)
36
36
  : null;
37
37
  const componentType = (0, artifact_types_1.getComponentType)(tree);
38
38
  const appComponentInfo = (0, app_components_info_1.getAppComponentInfo)(tree, componentType ? `.${componentType}` : '', project);
@@ -6,7 +6,7 @@ const path_1 = require("path");
6
6
  function locateLibraryEntryPointFromDirectory(tree, directory, projectRoot, projectSourceRoot) {
7
7
  const ngPackageJsonPath = (0, devkit_1.joinPathFragments)(directory, 'ng-package.json');
8
8
  let entryPointFile = tree.exists(ngPackageJsonPath)
9
- ? (0, devkit_1.readJson)(tree, ngPackageJsonPath).lib?.entryFile ?? 'src/public_api.ts'
9
+ ? ((0, devkit_1.readJson)(tree, ngPackageJsonPath).lib?.entryFile ?? 'src/public_api.ts')
10
10
  : null;
11
11
  if (entryPointFile) {
12
12
  return (0, devkit_1.joinPathFragments)(directory, entryPointFile);
@@ -10,7 +10,7 @@ function normalizeOptions(tree, options) {
10
10
  if (projectType !== 'application') {
11
11
  throw new Error(`Web Worker can only be added to an application. Project '${options.project}' is a library.`);
12
12
  }
13
- const path = options.path ?? sourceRoot
13
+ const path = (options.path ?? sourceRoot)
14
14
  ? (0, devkit_1.joinPathFragments)(sourceRoot, 'app')
15
15
  : (0, devkit_1.joinPathFragments)(root, 'src', 'app');
16
16
  if (!tree.exists(path)) {
@@ -0,0 +1,3 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export default function (tree: Tree): Promise<void>;
3
+ //# sourceMappingURL=set-isolated-modules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-isolated-modules.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-22-3-0/set-isolated-modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,IAAI,EAEV,MAAM,YAAY,CAAC;AAWpB,yBAA+B,IAAI,EAAE,IAAI,iBA6CxC"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = default_1;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const tsconfig_utils_1 = require("../../generators/utils/tsconfig-utils");
6
+ const targets_1 = require("../../utils/targets");
7
+ const projects_1 = require("../utils/projects");
8
+ async function default_1(tree) {
9
+ const uniqueSpecTsConfigs = new Set();
10
+ const projects = await (0, projects_1.getProjectsFilteredByDependencies)([
11
+ 'npm:@angular/core',
12
+ 'npm:jest-preset-angular',
13
+ ]);
14
+ for (const graphNode of projects) {
15
+ const projectRoot = graphNode.data.root;
16
+ // add tsconfig.spec.json if it exists
17
+ const specTsConfigPath = (0, devkit_1.joinPathFragments)(projectRoot, 'tsconfig.spec.json');
18
+ if (tree.exists(specTsConfigPath)) {
19
+ uniqueSpecTsConfigs.add(specTsConfigPath);
20
+ }
21
+ // look for tsConfig in @nx/jest:jest tasks in case there are any
22
+ // custom test tsconfig files
23
+ for (const [, target] of (0, targets_1.allProjectTargets)(graphNode.data)) {
24
+ if (target.executor !== '@nx/jest:jest') {
25
+ continue;
26
+ }
27
+ for (const [, options] of (0, targets_1.allTargetOptions)(target)) {
28
+ if (typeof options?.tsConfig === 'string' &&
29
+ tree.exists(options.tsConfig)) {
30
+ uniqueSpecTsConfigs.add(options.tsConfig);
31
+ }
32
+ }
33
+ }
34
+ }
35
+ for (const tsConfig of uniqueSpecTsConfigs) {
36
+ setIsolatedModules(tree, tsConfig);
37
+ }
38
+ await (0, devkit_1.formatFiles)(tree);
39
+ }
40
+ function setIsolatedModules(tree, tsConfigPath) {
41
+ const compilerOptions = (0, tsconfig_utils_1.readCompilerOptionsFromTsConfig)(tree, tsConfigPath);
42
+ if (compilerOptions.isolatedModules === true) {
43
+ // already set to true
44
+ return;
45
+ }
46
+ // set isolatedModules to true
47
+ (0, devkit_1.updateJson)(tree, tsConfigPath, (json) => {
48
+ json.compilerOptions ??= {};
49
+ json.compilerOptions.isolatedModules = true;
50
+ return json;
51
+ });
52
+ }
@@ -0,0 +1,3 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ export default function (tree: Tree): Promise<void>;
3
+ //# sourceMappingURL=update-jest-preset-angular-setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-jest-preset-angular-setup.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-22-3-0/update-jest-preset-angular-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAG1E,yBAA+B,IAAI,EAAE,IAAI,iBA2ExC"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = default_1;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const projects_1 = require("../utils/projects");
6
+ async function default_1(tree) {
7
+ const projects = await (0, projects_1.getProjectsFilteredByDependencies)([
8
+ 'npm:jest-preset-angular',
9
+ ]);
10
+ if (!projects.length) {
11
+ return;
12
+ }
13
+ // The old 'jest-preset-angular/setup-jest' import only supported zone-based testing.
14
+ // Zoneless support was added in jest-preset-angular v14.3.0 with the new
15
+ // setupZonelessTestEnv function. Therefore, all projects using the old import
16
+ // were zone-based and should be migrated to setupZoneTestEnv.
17
+ // Regex patterns to match removed imports
18
+ // Matches: import 'jest-preset-angular/setup-jest'; (with optional .js/.mjs extension)
19
+ // Captures .mjs extension in group 3 to preserve it in the replacement
20
+ const setupJestImportRegex = /^(\s*)import\s+(['"`])jest-preset-angular\/setup-jest(?:\.js)?(\.mjs)?\2;?\s*$/gm;
21
+ // Matches: require('jest-preset-angular/setup-jest'); (with optional .js extension)
22
+ // Note: .mjs is not supported with require() so we don't capture it
23
+ const setupJestRequireRegex = /^(\s*)require\s*\(\s*(['"`])jest-preset-angular\/setup-jest(?:\.js)?\2\s*\)\s*;?\s*$/gm;
24
+ for (const project of projects) {
25
+ (0, devkit_1.visitNotIgnoredFiles)(tree, project.data.root, (file) => {
26
+ if (!file.endsWith('.ts')) {
27
+ return;
28
+ }
29
+ let content = tree.read(file, 'utf-8');
30
+ if (!content.includes('jest-preset-angular/setup-jest')) {
31
+ return;
32
+ }
33
+ let wasUpdated = false;
34
+ // Replace import statements, preserving .mjs extension if present
35
+ setupJestImportRegex.lastIndex = 0;
36
+ if (setupJestImportRegex.test(content)) {
37
+ setupJestImportRegex.lastIndex = 0;
38
+ content = content.replace(setupJestImportRegex, (_match, _leadingWhitespace, _quote, mjsExt) => {
39
+ const modulePath = mjsExt
40
+ ? 'jest-preset-angular/setup-env/zone/index.mjs'
41
+ : 'jest-preset-angular/setup-env/zone';
42
+ return `import { setupZoneTestEnv } from '${modulePath}';
43
+
44
+ setupZoneTestEnv();`;
45
+ });
46
+ wasUpdated = true;
47
+ }
48
+ // Replace require statements, keeping require syntax
49
+ setupJestRequireRegex.lastIndex = 0;
50
+ if (setupJestRequireRegex.test(content)) {
51
+ setupJestRequireRegex.lastIndex = 0;
52
+ content = content.replace(setupJestRequireRegex, `const { setupZoneTestEnv } = require('jest-preset-angular/setup-env/zone');
53
+
54
+ setupZoneTestEnv();`);
55
+ wasUpdated = true;
56
+ }
57
+ if (wasUpdated) {
58
+ tree.write(file, content);
59
+ }
60
+ });
61
+ }
62
+ await (0, devkit_1.formatFiles)(tree);
63
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"file-change-recorder.d.ts","sourceRoot":"","sources":["../../../../../packages/angular/src/utils/file-change-recorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,qBAAa,kBAAkB;IAWjB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAAQ,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAVlE,OAAO,CAAC,cAAc,CAAc;IAEpC,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,eAAe,IAAI,MAAM,CAE5B;gBAE4B,IAAI,EAAE,IAAI,EAAmB,QAAQ,EAAE,MAAM;IAI1E,YAAY,IAAI,IAAI;IAIpB,UAAU,IAAI,OAAO;IAIrB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAIhD,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjD,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAIxC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAI1C,uBAAuB,IAAI,IAAI;CAKhC"}
1
+ {"version":3,"file":"file-change-recorder.d.ts","sourceRoot":"","sources":["../../../../../packages/angular/src/utils/file-change-recorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,qBAAa,kBAAkB;IAY3B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAZ3B,OAAO,CAAC,cAAc,CAAc;IAEpC,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,eAAe,IAAI,MAAM,CAE5B;gBAGkB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,MAAM;IAKnC,YAAY,IAAI,IAAI;IAIpB,UAAU,IAAI,OAAO;IAIrB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAIhD,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAIjD,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAIxC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAI1C,uBAAuB,IAAI,IAAI;CAKhC"}
@@ -9,12 +9,12 @@ const versions = tslib_1.__importStar(require("./versions"));
9
9
  const versions_1 = require("./versions");
10
10
  function getPkgVersionForAngularMajorVersion(pkgVersionName, angularMajorVersion) {
11
11
  return angularMajorVersion < (0, semver_1.major)((0, semver_1.coerce)(versions_1.angularVersion))
12
- ? backward_compatible_versions_1.backwardCompatibleVersions[angularMajorVersion]?.[pkgVersionName] ??
13
- versions[pkgVersionName]
12
+ ? (backward_compatible_versions_1.backwardCompatibleVersions[angularMajorVersion]?.[pkgVersionName] ??
13
+ versions[pkgVersionName])
14
14
  : versions[pkgVersionName];
15
15
  }
16
16
  function getPkgVersionsForAngularMajorVersion(angularMajorVersion) {
17
17
  return angularMajorVersion < (0, semver_1.major)((0, semver_1.coerce)(versions_1.angularVersion))
18
- ? backward_compatible_versions_1.backwardCompatibleVersions[angularMajorVersion] ?? versions
18
+ ? (backward_compatible_versions_1.backwardCompatibleVersions[angularMajorVersion] ?? versions)
19
19
  : versions;
20
20
  }
@@ -2,7 +2,7 @@ export declare const nxVersion: any;
2
2
  export declare const angularVersion = "~21.0.0";
3
3
  export declare const angularDevkitVersion = "~21.0.0";
4
4
  export declare const ngPackagrVersion = "~21.0.0";
5
- export declare const ngrxVersion = "^20.0.0";
5
+ export declare const ngrxVersion = "^21.0.0";
6
6
  export declare const rxjsVersion = "~7.8.0";
7
7
  export declare const zoneJsVersion = "~0.15.0";
8
8
  export declare const tsLibVersion = "^2.3.0";
@@ -5,7 +5,7 @@ exports.nxVersion = require('../../package.json').version;
5
5
  exports.angularVersion = '~21.0.0';
6
6
  exports.angularDevkitVersion = '~21.0.0';
7
7
  exports.ngPackagrVersion = '~21.0.0';
8
- exports.ngrxVersion = '^20.0.0';
8
+ exports.ngrxVersion = '^21.0.0';
9
9
  exports.rxjsVersion = '~7.8.0';
10
10
  exports.zoneJsVersion = '~0.15.0';
11
11
  exports.tsLibVersion = '^2.3.0';
@@ -1,4 +0,0 @@
1
- import { type Tree } from '@nx/devkit';
2
- export declare const angularCliVersion = "~21.0.0";
3
- export default function (tree: Tree): Promise<void>;
4
- //# sourceMappingURL=update-angular-cli.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"update-angular-cli.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-22-3-0/update-angular-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,yBAA+B,IAAI,EAAE,IAAI,iBAaxC"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.angularCliVersion = void 0;
4
- exports.default = default_1;
5
- const devkit_1 = require("@nx/devkit");
6
- exports.angularCliVersion = '~21.0.0';
7
- async function default_1(tree) {
8
- const { devDependencies, dependencies } = (0, devkit_1.readJson)(tree, 'package.json');
9
- const hasAngularCli = devDependencies?.['@angular/cli'] || dependencies?.['@angular/cli'];
10
- if (hasAngularCli) {
11
- (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@angular/cli': exports.angularCliVersion });
12
- await (0, devkit_1.formatFiles)(tree);
13
- }
14
- }