@nx/angular 23.0.0-beta.16 → 23.0.0-beta.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "23.0.0-beta.16",
3
+ "version": "23.0.0-beta.18",
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, 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": {
@@ -61,13 +61,13 @@
61
61
  "migrations": "./migrations.json"
62
62
  },
63
63
  "dependencies": {
64
- "@nx/devkit": "23.0.0-beta.16",
65
- "@nx/eslint": "23.0.0-beta.16",
66
- "@nx/js": "23.0.0-beta.16",
67
- "@nx/module-federation": "23.0.0-beta.16",
68
- "@nx/rspack": "23.0.0-beta.16",
69
- "@nx/web": "23.0.0-beta.16",
70
- "@nx/webpack": "23.0.0-beta.16",
64
+ "@nx/devkit": "23.0.0-beta.18",
65
+ "@nx/eslint": "23.0.0-beta.18",
66
+ "@nx/js": "23.0.0-beta.18",
67
+ "@nx/module-federation": "23.0.0-beta.18",
68
+ "@nx/rspack": "23.0.0-beta.18",
69
+ "@nx/web": "23.0.0-beta.18",
70
+ "@nx/webpack": "23.0.0-beta.18",
71
71
  "@phenomnomnominal/tsquery": "~6.2.0",
72
72
  "@typescript-eslint/type-utils": "^8.0.0",
73
73
  "enquirer": "~2.3.6",
@@ -1 +1 @@
1
- {"version":3,"file":"add-linting.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/add-linting/add-linting.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAgBpB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAG1D,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,iBAAiB,CAAC,CA8I5B;AAED,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"add-linting.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/add-linting/add-linting.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAepB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAE1D,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,iBAAiB,CAAC,CA8I5B;AAED,eAAe,mBAAmB,CAAC"}
@@ -5,11 +5,9 @@ const internal_1 = require("@nx/devkit/internal");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const eslint_1 = require("@nx/eslint");
7
7
  const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
8
- const global_eslint_config_1 = require("@nx/eslint/src/generators/init/global-eslint-config");
9
- const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
8
+ const internal_2 = require("@nx/eslint/internal");
10
9
  const add_angular_eslint_dependencies_1 = require("./lib/add-angular-eslint-dependencies");
11
10
  const buildable_project_1 = require("./lib/buildable-project");
12
- const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
13
11
  async function addLintingGenerator(tree, options) {
14
12
  (0, assert_supported_angular_version_1.assertSupportedAngularVersion)(tree);
15
13
  const tasks = [];
@@ -29,16 +27,16 @@ async function addLintingGenerator(tree, options) {
29
27
  skipPackageJson: options.skipPackageJson,
30
28
  });
31
29
  tasks.push(lintTask);
32
- if ((0, eslint_file_1.isEslintConfigSupported)(tree)) {
33
- const eslintFile = (0, eslint_file_1.findEslintFile)(tree, options.projectRoot);
30
+ if ((0, internal_2.isEslintConfigSupported)(tree)) {
31
+ const eslintFile = (0, internal_2.findEslintFile)(tree, options.projectRoot);
34
32
  // keep parser options if they exist
35
33
  const hasParserOptions = tree
36
34
  .read((0, devkit_1.joinPathFragments)(options.projectRoot, eslintFile), 'utf8')
37
35
  .includes(`${options.projectRoot}/tsconfig.*?.json`);
38
- if ((0, flat_config_1.useFlatConfig)(tree)) {
39
- (0, eslint_file_1.addPredefinedConfigToFlatLintConfig)(tree, options.projectRoot, 'flat/angular', { checkBaseConfig: true });
40
- (0, eslint_file_1.addPredefinedConfigToFlatLintConfig)(tree, options.projectRoot, 'flat/angular-template', { checkBaseConfig: true });
41
- (0, eslint_file_1.addOverrideToLintConfig)(tree, options.projectRoot, {
36
+ if ((0, internal_2.useFlatConfig)(tree)) {
37
+ (0, internal_2.addPredefinedConfigToFlatLintConfig)(tree, options.projectRoot, 'flat/angular', { checkBaseConfig: true });
38
+ (0, internal_2.addPredefinedConfigToFlatLintConfig)(tree, options.projectRoot, 'flat/angular-template', { checkBaseConfig: true });
39
+ (0, internal_2.addOverrideToLintConfig)(tree, options.projectRoot, {
42
40
  files: ['*.ts'],
43
41
  rules: {
44
42
  '@angular-eslint/directive-selector': [
@@ -59,14 +57,14 @@ async function addLintingGenerator(tree, options) {
59
57
  ],
60
58
  },
61
59
  });
62
- (0, eslint_file_1.addOverrideToLintConfig)(tree, options.projectRoot, {
60
+ (0, internal_2.addOverrideToLintConfig)(tree, options.projectRoot, {
63
61
  files: ['*.html'],
64
62
  rules: {},
65
63
  });
66
64
  }
67
65
  else {
68
- (0, eslint_file_1.replaceOverridesInLintConfig)(tree, options.projectRoot, [
69
- ...(rootProject ? [global_eslint_config_1.typeScriptOverride, global_eslint_config_1.javaScriptOverride] : []),
66
+ (0, internal_2.replaceOverridesInLintConfig)(tree, options.projectRoot, [
67
+ ...(rootProject ? [internal_2.typeScriptOverride, internal_2.javaScriptOverride] : []),
70
68
  {
71
69
  files: ['*.ts'],
72
70
  ...(hasParserOptions
@@ -1 +1 @@
1
- {"version":3,"file":"add-angular-eslint-dependencies.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/add-linting/lib/add-angular-eslint-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAMpB,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,GAClB,iBAAiB,CAiCnB"}
1
+ {"version":3,"file":"add-angular-eslint-dependencies.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/add-linting/lib/add-angular-eslint-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAQpB,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,GAClB,iBAAiB,CAiCnB"}
@@ -2,14 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addAngularEsLintDependencies = addAngularEsLintDependencies;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
6
- const versions_1 = require("@nx/eslint/src/utils/versions");
5
+ const internal_1 = require("@nx/eslint/internal");
7
6
  const version_utils_1 = require("../../utils/version-utils");
8
7
  const buildable_project_1 = require("./buildable-project");
9
8
  function addAngularEsLintDependencies(tree, projectName) {
10
9
  const compatVersions = (0, version_utils_1.versions)(tree);
11
10
  const angularEslintVersionToInstall = compatVersions.angularEslintVersion;
12
- const usesEslintFlatConfig = (0, flat_config_1.useFlatConfig)(tree);
11
+ const usesEslintFlatConfig = (0, internal_1.useFlatConfig)(tree);
13
12
  const devDependencies = usesEslintFlatConfig
14
13
  ? {
15
14
  'angular-eslint': angularEslintVersionToInstall,
@@ -21,7 +20,7 @@ function addAngularEsLintDependencies(tree, projectName) {
21
20
  };
22
21
  if ('typescriptEslintVersion' in compatVersions) {
23
22
  devDependencies['@typescript-eslint/utils'] = usesEslintFlatConfig
24
- ? versions_1.eslint9__typescriptESLintVersion
23
+ ? internal_1.eslint9__typescriptESLintVersion
25
24
  : compatVersions.typescriptEslintVersion;
26
25
  }
27
26
  if ((0, buildable_project_1.isBuildableLibraryProject)(tree, projectName)) {
@@ -1 +1 @@
1
- {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/application/application.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAKjB,IAAI,EAEL,MAAM,YAAY,CAAC;AA0BpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CA+H5B;AAED,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/application/application.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,iBAAiB,EAKjB,IAAI,EAEL,MAAM,YAAY,CAAC;AA0BpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAgI5B;AAED,eAAe,oBAAoB,CAAC"}
@@ -39,7 +39,7 @@ async function applicationGenerator(tree, schema) {
39
39
  (0, lib_1.createProject)(tree, options);
40
40
  await (0, lib_1.createFiles)(tree, options, rootOffset);
41
41
  await (0, lib_1.addLinting)(tree, options);
42
- await (0, lib_1.addUnitTestRunner)(tree, options);
42
+ const unitTestRunnerTask = await (0, lib_1.addUnitTestRunner)(tree, options);
43
43
  const e2ePort = await (0, lib_1.addE2e)(tree, options);
44
44
  (0, lib_1.addServeStaticTarget)(tree, options, options.e2eTestRunner !== 'none' ? e2ePort : options.port);
45
45
  (0, lib_1.updateTsconfigFiles)(tree, options);
@@ -105,7 +105,8 @@ async function applicationGenerator(tree, schema) {
105
105
  if (!options.skipFormat) {
106
106
  await (0, devkit_1.formatFiles)(tree);
107
107
  }
108
- return () => {
108
+ return async () => {
109
+ await unitTestRunnerTask();
109
110
  (0, devkit_1.installPackagesTask)(tree);
110
111
  (0, internal_1.logShowProjectCommand)(options.name);
111
112
  };
@@ -1,4 +1,4 @@
1
- import type { Tree } from '@nx/devkit';
1
+ import type { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import type { NormalizedSchema } from './normalized-schema';
3
- export declare function addUnitTestRunner(host: Tree, options: NormalizedSchema): Promise<void>;
3
+ export declare function addUnitTestRunner(host: Tree, options: NormalizedSchema): Promise<GeneratorCallback>;
4
4
  //# sourceMappingURL=add-unit-test-runner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"add-unit-test-runner.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/application/lib/add-unit-test-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,iBAgC5E"}
1
+ {"version":3,"file":"add-unit-test-runner.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/application/lib/add-unit-test-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAI1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAgC5B"}
@@ -16,16 +16,15 @@ async function addUnitTestRunner(host, options) {
16
16
  runtimeTsconfigFileName: 'tsconfig.app.json',
17
17
  zoneless: options.zoneless,
18
18
  });
19
- break;
19
+ return () => { };
20
20
  case test_runners_1.UnitTestRunner.VitestAngular:
21
- await (0, add_vitest_1.addVitestAngular)(host, {
21
+ return (0, add_vitest_1.addVitestAngular)(host, {
22
22
  name: options.name,
23
23
  projectRoot: options.appProjectRoot,
24
24
  skipPackageJson: options.skipPackageJson,
25
25
  });
26
- break;
27
26
  case test_runners_1.UnitTestRunner.VitestAnalog:
28
- await (0, add_vitest_1.addVitestAnalog)(host, {
27
+ return (0, add_vitest_1.addVitestAnalog)(host, {
29
28
  name: options.name,
30
29
  projectRoot: options.appProjectRoot,
31
30
  skipFormat: options.skipFormat,
@@ -34,6 +33,7 @@ async function addUnitTestRunner(host, options) {
34
33
  addPlugin: options.addPlugin,
35
34
  zoneless: options.zoneless,
36
35
  });
37
- break;
36
+ default:
37
+ return () => { };
38
38
  }
39
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/library/library.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,iBAAiB,EAIjB,IAAI,EACL,MAAM,YAAY,CAAC;AAuBpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAkE5B;AAoED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/library/library.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,iBAAiB,EAIjB,IAAI,EACL,MAAM,YAAY,CAAC;AAuBpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAqE5B;AAoED,eAAe,gBAAgB,CAAC"}
@@ -45,7 +45,7 @@ async function libraryGenerator(tree, schema) {
45
45
  }
46
46
  const project = await (0, add_project_1.addProject)(tree, libraryOptions);
47
47
  (0, create_files_1.createFiles)(tree, options, project);
48
- await addUnitTestRunner(tree, libraryOptions);
48
+ const unitTestRunnerTask = await addUnitTestRunner(tree, libraryOptions);
49
49
  (0, update_tsconfig_files_1.updateTsConfigFiles)(tree, libraryOptions);
50
50
  updateNpmScopeIfBuildableOrPublishable(tree, libraryOptions);
51
51
  (0, set_generator_defaults_1.setGeneratorDefaults)(tree, options);
@@ -66,7 +66,10 @@ async function libraryGenerator(tree, schema) {
66
66
  if (!libraryOptions.skipFormat) {
67
67
  await (0, devkit_1.formatFiles)(tree);
68
68
  }
69
- const tasks = [() => (0, devkit_1.installPackagesTask)(tree)];
69
+ const tasks = [
70
+ unitTestRunnerTask,
71
+ () => (0, devkit_1.installPackagesTask)(tree),
72
+ ];
70
73
  if (libraryOptions.publishable) {
71
74
  tasks.push(await (0, internal_2.releaseTasks)(tree));
72
75
  }
@@ -85,17 +88,16 @@ async function addUnitTestRunner(host, options) {
85
88
  runtimeTsconfigFileName: 'tsconfig.lib.json',
86
89
  zoneless,
87
90
  });
88
- break;
91
+ return () => { };
89
92
  case test_runners_1.UnitTestRunner.VitestAngular:
90
- await (0, add_vitest_1.addVitestAngular)(host, {
93
+ return (0, add_vitest_1.addVitestAngular)(host, {
91
94
  name: options.name,
92
95
  projectRoot: options.projectRoot,
93
96
  skipPackageJson: options.skipPackageJson,
94
97
  useNxUnitTestRunnerExecutor: true,
95
98
  });
96
- break;
97
99
  case test_runners_1.UnitTestRunner.VitestAnalog:
98
- await (0, add_vitest_1.addVitestAnalog)(host, {
100
+ return (0, add_vitest_1.addVitestAnalog)(host, {
99
101
  name: options.name,
100
102
  projectRoot: options.projectRoot,
101
103
  skipFormat: options.skipFormat,
@@ -103,7 +105,8 @@ async function addUnitTestRunner(host, options) {
103
105
  strict: options.strict,
104
106
  zoneless,
105
107
  });
106
- break;
108
+ default:
109
+ return () => { };
107
110
  }
108
111
  }
109
112
  function updateNpmScopeIfBuildableOrPublishable(host, options) {
@@ -15,10 +15,10 @@ exports.deleteAngularJson = deleteAngularJson;
15
15
  exports.deleteGitKeepFilesIfNotNeeded = deleteGitKeepFilesIfNotNeeded;
16
16
  const devkit_1 = require("@nx/devkit");
17
17
  const eslint_1 = require("@nx/eslint");
18
- const setup_root_eslint_1 = require("@nx/eslint/src/generators/lint-project/setup-root-eslint");
18
+ const internal_1 = require("@nx/eslint/internal");
19
19
  const js_1 = require("@nx/js");
20
20
  const default_base_1 = require("nx/src/utils/default-base");
21
- const internal_1 = require("@nx/js/internal");
21
+ const internal_2 = require("@nx/js/internal");
22
22
  const angular_json_1 = require("nx/src/adapter/angular-json");
23
23
  const versions_1 = require("../../../utils/versions");
24
24
  const path_1 = require("path");
@@ -151,7 +151,7 @@ function updatePackageJson(tree) {
151
151
  packageJson.devDependencies['nx'] = versions_1.nxVersion;
152
152
  }
153
153
  if (!packageJson.devDependencies['prettier']) {
154
- packageJson.devDependencies['prettier'] = internal_1.prettierVersion;
154
+ packageJson.devDependencies['prettier'] = internal_2.prettierVersion;
155
155
  }
156
156
  return packageJson;
157
157
  });
@@ -162,7 +162,7 @@ async function updateRootEsLintConfig(tree, existingEsLintConfig, unitTestRunner
162
162
  });
163
163
  if (!existingEsLintConfig) {
164
164
  // There was no eslint config in the root, so we set it up and use it as-is
165
- (0, setup_root_eslint_1.setupRootEsLint)(tree, { unitTestRunner });
165
+ (0, internal_1.setupRootEsLint)(tree, { unitTestRunner });
166
166
  return;
167
167
  }
168
168
  existingEsLintConfig.ignorePatterns = ['**/*'];
@@ -1,4 +1,4 @@
1
- import { type Tree } from '@nx/devkit';
1
+ import { type GeneratorCallback, type Tree } from '@nx/devkit';
2
2
  export type AddVitestAngularOptions = {
3
3
  name: string;
4
4
  projectRoot: string;
@@ -14,6 +14,6 @@ export type AddVitestAnalogOptions = {
14
14
  zoneless: boolean;
15
15
  addPlugin?: boolean;
16
16
  };
17
- export declare function addVitestAngular(tree: Tree, options: AddVitestAngularOptions): Promise<void>;
18
- export declare function addVitestAnalog(tree: Tree, options: AddVitestAnalogOptions): Promise<void>;
17
+ export declare function addVitestAngular(tree: Tree, options: AddVitestAngularOptions): Promise<GeneratorCallback>;
18
+ export declare function addVitestAnalog(tree: Tree, options: AddVitestAnalogOptions): Promise<GeneratorCallback>;
19
19
  //# sourceMappingURL=add-vitest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"add-vitest.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/utils/add-vitest.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,IAAI,EAKV,MAAM,YAAY,CAAC;AAcpB,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,IAAI,CAAC,CAuDf;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAsCf"}
1
+ {"version":3,"file":"add-vitest.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/utils/add-vitest.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,iBAAiB,EAQtB,KAAK,IAAI,EAKV,MAAM,YAAY,CAAC;AAcpB,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,iBAAiB,CAAC,CAqD5B;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,iBAAiB,CAAC,CAuD5B"}
@@ -67,29 +67,36 @@ async function addVitestAngular(tree, options) {
67
67
  }
68
68
  configureTypeScriptForVitest(tree, options.projectRoot);
69
69
  addVitestScreenshotsToGitIgnore(tree);
70
- if (!options.skipPackageJson) {
71
- const pkgVersions = (0, version_utils_1.versions)(tree, { minAngularMajorVersion: 21 });
72
- const angularDevkitVersion = (0, version_utils_1.getInstalledAngularDevkitVersion)(tree) ??
73
- pkgVersions.angularDevkitVersion;
74
- (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
75
- '@angular/build': angularDevkitVersion,
76
- // @angular/build uses rolldown which injects @oxc-project/runtime
77
- // helpers at transform time but doesn't declare it as a dependency
78
- '@oxc-project/runtime': versions_1.oxcProjectRuntimeVersion,
79
- jsdom: pkgVersions.jsdomVersion,
80
- vitest: pkgVersions.vitestVersion,
81
- }, undefined, true);
70
+ if (options.skipPackageJson) {
71
+ return () => { };
82
72
  }
73
+ const pkgVersions = (0, version_utils_1.versions)(tree, { minAngularMajorVersion: 21 });
74
+ const angularDevkitVersion = (0, version_utils_1.getInstalledAngularDevkitVersion)(tree) ?? pkgVersions.angularDevkitVersion;
75
+ return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
76
+ '@angular/build': angularDevkitVersion,
77
+ jsdom: pkgVersions.jsdomVersion,
78
+ vitest: pkgVersions.vitestVersion,
79
+ }, undefined, true);
83
80
  }
84
81
  async function addVitestAnalog(tree, options) {
85
82
  const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
83
+ const tasks = [];
86
84
  if (!options.skipPackageJson) {
87
85
  const angularDevkitVersion = (0, version_utils_1.getInstalledAngularDevkitVersion)(tree) ??
88
86
  (0, version_utils_1.versions)(tree).angularDevkitVersion;
89
87
  const devDependencies = {
90
88
  '@angular/build': angularDevkitVersion,
91
- // @angular/build uses rolldown which injects @oxc-project/runtime
92
- // helpers at transform time but doesn't declare it as a dependency
89
+ // `@analogjs/vite-plugin-angular` (wired in by `@nx/vitest`'s
90
+ // configurationGenerator for `uiFramework: 'angular'`) registers
91
+ // an `angularVitestPlugin` whose `transform` hook downlevels
92
+ // `@angular/*` fesm2022 modules via
93
+ // `vite.transformWithOxc({ target: 'es2016', … })` so Zone.js
94
+ // `fakeAsync` can intercept async/await. The lowered code emits
95
+ // external `@oxc-project/runtime/helpers/*` imports (oxc default
96
+ // `HelperMode = 'Runtime'`). Nothing in the upstream chain
97
+ // (analogjs, @angular/core, vite, rolldown) declares the runtime
98
+ // in a way that's resolvable from the consumer's workspace, so
99
+ // it must be added here.
93
100
  '@oxc-project/runtime': versions_1.oxcProjectRuntimeVersion,
94
101
  };
95
102
  // Add compatible vitest/jsdom versions BEFORE calling configurationGenerator
@@ -99,11 +106,11 @@ async function addVitestAnalog(tree, options) {
99
106
  devDependencies['vitest'] = pkgVersions.vitestVersion;
100
107
  devDependencies['jsdom'] = pkgVersions.jsdomVersion;
101
108
  }
102
- (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, true);
109
+ tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies, undefined, true));
103
110
  }
104
111
  (0, devkit_1.ensurePackage)('@nx/vitest', versions_1.nxVersion);
105
112
  const { configurationGenerator } = await Promise.resolve().then(() => __importStar(require('@nx/vitest/generators')));
106
- await configurationGenerator(tree, {
113
+ tasks.push(await configurationGenerator(tree, {
107
114
  project: options.name,
108
115
  uiFramework: 'angular',
109
116
  testEnvironment: 'jsdom',
@@ -112,7 +119,8 @@ async function addVitestAnalog(tree, options) {
112
119
  skipFormat: options.skipFormat,
113
120
  skipPackageJson: options.skipPackageJson,
114
121
  zoneless: options.zoneless,
115
- });
122
+ }));
123
+ return (0, devkit_1.runTasksInSerial)(...tasks);
116
124
  }
117
125
  function validateVitestVersion(tree) {
118
126
  let installedVitestVersion = null;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = default_1;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
5
+ const internal_1 = require("@nx/eslint/internal");
6
6
  const projects_1 = require("../utils/projects");
7
7
  const preferStandaloneRule = '@angular-eslint/prefer-standalone';
8
8
  async function default_1(tree) {
@@ -11,20 +11,20 @@ async function default_1(tree) {
11
11
  ]);
12
12
  for (const graphNode of projects) {
13
13
  const root = graphNode.data.root;
14
- if (!(0, eslint_file_1.isEslintConfigSupported)(tree, root)) {
14
+ if (!(0, internal_1.isEslintConfigSupported)(tree, root)) {
15
15
  // ESLint config is not supported, skip
16
16
  continue;
17
17
  }
18
- if ((0, eslint_file_1.lintConfigHasOverride)(tree, root, (o) => !!o.rules?.[preferStandaloneRule], true)) {
18
+ if ((0, internal_1.lintConfigHasOverride)(tree, root, (o) => !!o.rules?.[preferStandaloneRule], true)) {
19
19
  // the @angular-eslint/prefer-standalone rule is set in an override, skip
20
20
  continue;
21
21
  }
22
22
  const ngEslintOverrideLookup = (o) => o.files?.includes('*.ts') &&
23
23
  Object.keys(o.rules ?? {}).some((r) => r.startsWith('@angular-eslint/'));
24
24
  const tsFilesOverrideLookup = (o) => o.files?.length === 1 && o.files[0] === '*.ts';
25
- if ((0, eslint_file_1.lintConfigHasOverride)(tree, root, ngEslintOverrideLookup, false)) {
25
+ if ((0, internal_1.lintConfigHasOverride)(tree, root, ngEslintOverrideLookup, false)) {
26
26
  // there is an override containing an Angular ESLint rule
27
- (0, eslint_file_1.updateOverrideInLintConfig)(tree, root, ngEslintOverrideLookup, (o) => {
27
+ (0, internal_1.updateOverrideInLintConfig)(tree, root, ngEslintOverrideLookup, (o) => {
28
28
  o.rules = {
29
29
  ...o.rules,
30
30
  [preferStandaloneRule]: 'off',
@@ -32,9 +32,9 @@ async function default_1(tree) {
32
32
  return o;
33
33
  });
34
34
  }
35
- else if ((0, eslint_file_1.lintConfigHasOverride)(tree, root, tsFilesOverrideLookup, false)) {
35
+ else if ((0, internal_1.lintConfigHasOverride)(tree, root, tsFilesOverrideLookup, false)) {
36
36
  // there is an override for just *.ts files
37
- (0, eslint_file_1.updateOverrideInLintConfig)(tree, root, tsFilesOverrideLookup, (o) => {
37
+ (0, internal_1.updateOverrideInLintConfig)(tree, root, tsFilesOverrideLookup, (o) => {
38
38
  o.rules = {
39
39
  ...o.rules,
40
40
  [preferStandaloneRule]: 'off',
@@ -44,7 +44,7 @@ async function default_1(tree) {
44
44
  }
45
45
  else {
46
46
  // there are no overrides for any Angular ESLint rule or just *.ts files, add a new override
47
- (0, eslint_file_1.addOverrideToLintConfig)(tree, root, {
47
+ (0, internal_1.addOverrideToLintConfig)(tree, root, {
48
48
  files: ['*.ts'],
49
49
  rules: {
50
50
  [preferStandaloneRule]: 'off',
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.rulesToRemove = void 0;
4
4
  exports.default = default_1;
5
5
  const devkit_1 = require("@nx/devkit");
6
- const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
6
+ const internal_1 = require("@nx/eslint/internal");
7
7
  const projects_1 = require("../utils/projects");
8
8
  exports.rulesToRemove = [
9
9
  '@angular-eslint/no-host-metadata-property',
@@ -17,7 +17,7 @@ async function default_1(tree) {
17
17
  let hasRootProject = false;
18
18
  for (const graphNode of projects) {
19
19
  const root = graphNode.data.root;
20
- if (!(0, eslint_file_1.isEslintConfigSupported)(tree, root)) {
20
+ if (!(0, internal_1.isEslintConfigSupported)(tree, root)) {
21
21
  // ESLint config is not supported, skip
22
22
  continue;
23
23
  }
@@ -36,12 +36,12 @@ async function default_1(tree) {
36
36
  // check root config, provide a root so it doesn't try to lookup a base config
37
37
  if (!hasRootProject) {
38
38
  // if there is no root project the root eslint config has not been processed
39
- if ((0, eslint_file_1.isEslintConfigSupported)(tree, '')) {
39
+ if ((0, internal_1.isEslintConfigSupported)(tree, '')) {
40
40
  removeRules(tree, '');
41
41
  }
42
42
  }
43
43
  // handle root base config, not providing a root will prioritize a base config
44
- const baseEslintConfig = (0, eslint_file_1.findEslintFile)(tree);
44
+ const baseEslintConfig = (0, internal_1.findEslintFile)(tree);
45
45
  if (baseEslintConfig && baseEslintConfig.includes('.base.')) {
46
46
  removeRules(tree, baseEslintConfig);
47
47
  }
@@ -50,12 +50,12 @@ async function default_1(tree) {
50
50
  function removeRules(tree, root) {
51
51
  for (const rule of exports.rulesToRemove) {
52
52
  const lookup = (o) => !!o.rules?.[rule];
53
- if (!(0, eslint_file_1.lintConfigHasOverride)(tree, root, lookup)) {
53
+ if (!(0, internal_1.lintConfigHasOverride)(tree, root, lookup)) {
54
54
  // it's not using the rule, skip
55
55
  continue;
56
56
  }
57
57
  // there is an override containing the rule, remove the rule
58
- (0, eslint_file_1.updateOverrideInLintConfig)(tree, root, lookup, (o) => {
58
+ (0, internal_1.updateOverrideInLintConfig)(tree, root, lookup, (o) => {
59
59
  delete o.rules[rule];
60
60
  return o;
61
61
  });
@@ -1 +1 @@
1
- {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/angular/src/utils/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAwC,CAAC;AAE/D,eAAO,MAAM,cAAc,YAAY,CAAC;AACxC,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,WAAW,YAAY,CAAC;AACrC,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,YAAY,WAAW,CAAC;AAErC,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,cAAc,YAAY,CAAC;AACxC,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAC9C,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAC3C,eAAO,MAAM,2BAA2B,YAAY,CAAC;AACrD,eAAO,MAAM,+BAA+B,WAAW,CAAC;AACxD,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,uBAAuB,YAAY,CAAC;AACjD,eAAO,MAAM,cAAc,WAAW,CAAC;AACvC,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,eAAO,MAAM,WAAW,WAAW,CAAC;AAEpC,eAAO,MAAM,wBAAwB,YAAY,CAAC;AAClD,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAE9C,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,eAAO,MAAM,YAAY,YAAY,CAAC;AAGtC,eAAO,MAAM,wBAAwB,aAAa,CAAC;AAEnD,eAAO,MAAM,wBAAwB,WAAW,CAAC"}
1
+ {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/angular/src/utils/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAwC,CAAC;AAE/D,eAAO,MAAM,cAAc,YAAY,CAAC;AACxC,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,WAAW,YAAY,CAAC;AACrC,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,YAAY,WAAW,CAAC;AAErC,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,cAAc,YAAY,CAAC;AACxC,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAC9C,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAC3C,eAAO,MAAM,2BAA2B,YAAY,CAAC;AACrD,eAAO,MAAM,+BAA+B,WAAW,CAAC;AACxD,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,uBAAuB,YAAY,CAAC;AACjD,eAAO,MAAM,cAAc,WAAW,CAAC;AACvC,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAC3C,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,eAAO,MAAM,WAAW,WAAW,CAAC;AAEpC,eAAO,MAAM,wBAAwB,YAAY,CAAC;AAClD,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAE9C,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,eAAO,MAAM,YAAY,YAAY,CAAC;AAQtC,eAAO,MAAM,wBAAwB,aAAa,CAAC;AAEnD,eAAO,MAAM,wBAAwB,WAAW,CAAC"}
@@ -29,7 +29,12 @@ exports.typesNodeVersion = '^22.0.0';
29
29
  exports.jasmineMarblesVersion = '^0.9.2';
30
30
  exports.vitestVersion = '^4.0.8';
31
31
  exports.jsdomVersion = '^27.1.0';
32
- // @angular/build uses rolldown which injects @oxc-project/runtime helpers
33
- // at transform time but doesn't declare it as a dependency
32
+ // `@analogjs/vite-plugin-angular` (vitest-analog path) registers an
33
+ // `angularVitestPlugin` whose `transform` hook downlevels `@angular/*`
34
+ // fesm2022 modules via `vite.transformWithOxc({ target: 'es2016', … })`
35
+ // so Zone.js `fakeAsync` can intercept async/await. The lowered code
36
+ // emits external `@oxc-project/runtime/helpers/*` imports (oxc default
37
+ // `HelperMode = 'Runtime'`). Nothing upstream declares the runtime, so
38
+ // we add it explicitly to user projects.
34
39
  exports.oxcProjectRuntimeVersion = '^0.115.0';
35
40
  exports.jsoncEslintParserVersion = '^2.1.0';