@nx/angular 24.0.0-canary.20261016-5ef7804 → 24.0.0-canary.20261020-e7ffd79

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 (119) hide show
  1. package/dist/fesm2022/nx-angular.mjs +0 -4
  2. package/dist/generators.d.ts +0 -4
  3. package/dist/generators.js +0 -4
  4. package/dist/ready-check.d.ts +1 -0
  5. package/dist/ready-check.js +8 -0
  6. package/dist/src/executors/application/schema.json +1 -2
  7. package/dist/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-bundles.transform.js +9 -1
  8. package/dist/src/executors/unit-test/schema.json +6 -1
  9. package/dist/src/executors/unit-test/unit-test.impl.js +5 -0
  10. package/dist/src/executors/utilities/ng-packagr/stylesheet-processor.js +35 -10
  11. package/dist/src/generators/add-linting/add-linting.js +0 -2
  12. package/dist/src/generators/add-linting/schema.d.ts +0 -1
  13. package/dist/src/generators/application/application.js +1 -2
  14. package/dist/src/generators/application/lib/add-e2e.js +2 -6
  15. package/dist/src/generators/application/lib/add-linting.js +0 -1
  16. package/dist/src/generators/application/lib/add-serve-static-target.js +2 -0
  17. package/dist/src/generators/application/lib/add-unit-test-runner.js +0 -2
  18. package/dist/src/generators/application/lib/create-project.js +2 -0
  19. package/dist/src/generators/application/lib/normalize-options.d.ts +1 -1
  20. package/dist/src/generators/application/lib/normalize-options.js +1 -8
  21. package/dist/src/generators/application/schema.d.ts +0 -1
  22. package/dist/src/generators/convert-to-rspack/convert-to-rspack.js +6 -1
  23. package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.js +3 -15
  24. package/dist/src/generators/init/init.js +1 -2
  25. package/dist/src/generators/init/schema.d.ts +0 -2
  26. package/dist/src/generators/library/schema.d.ts +0 -1
  27. package/dist/src/generators/ng-add/migrators/builders/angular-eslint-lint.migrator.js +12 -1
  28. package/dist/src/generators/ng-add/migrators/projects/app.migrator.d.ts +1 -0
  29. package/dist/src/generators/ng-add/migrators/projects/app.migrator.js +22 -0
  30. package/dist/src/generators/ng-add/migrators/projects/e2e.migrator.js +12 -16
  31. package/dist/src/generators/ng-add/utilities/workspace.js +1 -3
  32. package/dist/src/generators/setup-ssr/files/v20+/application-builder/server/__serverFileName__ +15 -1
  33. package/dist/src/generators/setup-ssr/lib/add-dependencies.js +4 -0
  34. package/dist/src/generators/setup-ssr/lib/update-project-config.js +1 -0
  35. package/dist/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +0 -2
  36. package/dist/src/generators/utils/add-jest.d.ts +0 -1
  37. package/dist/src/generators/utils/add-jest.js +0 -2
  38. package/dist/src/generators/utils/add-vitest.d.ts +0 -1
  39. package/dist/src/generators/utils/add-vitest.js +0 -1
  40. package/dist/src/generators/utils/testing.d.ts +4 -0
  41. package/dist/src/generators/utils/testing.js +19 -0
  42. package/dist/src/migrations/update-23-1-0/add-angular-build.js +7 -3
  43. package/dist/src/migrations/update-23-1-0/add-angular-build.md +1 -1
  44. package/dist/src/migrations/update-23-1-0/add-trust-proxy-headers.js +9 -2
  45. package/dist/src/migrations/update-24-0-0/add-ready-when-signal.d.ts +4 -0
  46. package/dist/src/migrations/update-24-0-0/add-ready-when-signal.js +12 -0
  47. package/dist/src/migrations/update-24-0-0/add-ready-when-signal.md +59 -0
  48. package/dist/src/migrations/update-24-0-0/remove-scam-generator-defaults.d.ts +2 -0
  49. package/dist/src/migrations/update-24-0-0/remove-scam-generator-defaults.js +85 -0
  50. package/dist/src/migrations/update-24-0-0/remove-scam-generator-defaults.md +48 -0
  51. package/dist/src/migrations/update-24-0-0/upgrade-to-angular-22-2.d.ts +5 -0
  52. package/dist/src/migrations/update-24-0-0/upgrade-to-angular-22-2.js +332 -0
  53. package/dist/src/migrations/update-24-0-0/upgrade-to-angular-22-2.md +46 -0
  54. package/dist/src/plugins/plugin.js +3 -5
  55. package/dist/src/plugins/utils/dev-server-ready-check.d.ts +17 -0
  56. package/dist/src/plugins/utils/dev-server-ready-check.js +213 -0
  57. package/dist/src/utils/assert-cypress-component-testing-support.js +10 -0
  58. package/dist/src/utils/versions.d.ts +4 -4
  59. package/dist/src/utils/versions.js +4 -4
  60. package/dist/types/nx-angular.d.ts +1 -3
  61. package/generators.json +0 -24
  62. package/migrations.json +109 -0
  63. package/package.json +13 -12
  64. package/dist/fesm2022/nx-angular.mjs.map +0 -1
  65. package/dist/src/generators/scam/lib/convert-component-to-scam.d.ts +0 -3
  66. package/dist/src/generators/scam/lib/convert-component-to-scam.js +0 -41
  67. package/dist/src/generators/scam/lib/index.d.ts +0 -2
  68. package/dist/src/generators/scam/lib/index.js +0 -5
  69. package/dist/src/generators/scam/lib/normalize-options.d.ts +0 -3
  70. package/dist/src/generators/scam/lib/normalize-options.js +0 -34
  71. package/dist/src/generators/scam/scam.d.ts +0 -7
  72. package/dist/src/generators/scam/scam.js +0 -28
  73. package/dist/src/generators/scam/schema.d.ts +0 -30
  74. package/dist/src/generators/scam/schema.json +0 -126
  75. package/dist/src/generators/scam-directive/lib/convert-directive-to-scam.d.ts +0 -3
  76. package/dist/src/generators/scam-directive/lib/convert-directive-to-scam.js +0 -41
  77. package/dist/src/generators/scam-directive/lib/index.d.ts +0 -2
  78. package/dist/src/generators/scam-directive/lib/index.js +0 -5
  79. package/dist/src/generators/scam-directive/lib/normalize-options.d.ts +0 -3
  80. package/dist/src/generators/scam-directive/lib/normalize-options.js +0 -34
  81. package/dist/src/generators/scam-directive/scam-directive.d.ts +0 -7
  82. package/dist/src/generators/scam-directive/scam-directive.js +0 -28
  83. package/dist/src/generators/scam-directive/schema.d.ts +0 -23
  84. package/dist/src/generators/scam-directive/schema.json +0 -89
  85. package/dist/src/generators/scam-pipe/lib/convert-pipe-to-scam.d.ts +0 -3
  86. package/dist/src/generators/scam-pipe/lib/convert-pipe-to-scam.js +0 -41
  87. package/dist/src/generators/scam-pipe/lib/index.d.ts +0 -2
  88. package/dist/src/generators/scam-pipe/lib/index.js +0 -5
  89. package/dist/src/generators/scam-pipe/lib/normalize-options.d.ts +0 -3
  90. package/dist/src/generators/scam-pipe/lib/normalize-options.js +0 -36
  91. package/dist/src/generators/scam-pipe/scam-pipe.d.ts +0 -7
  92. package/dist/src/generators/scam-pipe/scam-pipe.js +0 -28
  93. package/dist/src/generators/scam-pipe/schema.d.ts +0 -21
  94. package/dist/src/generators/scam-pipe/schema.json +0 -67
  95. package/dist/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.d.ts +0 -3
  96. package/dist/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.js +0 -35
  97. package/dist/src/generators/scam-to-standalone/lib/get-component-data-from-ast.d.ts +0 -6
  98. package/dist/src/generators/scam-to-standalone/lib/get-component-data-from-ast.js +0 -15
  99. package/dist/src/generators/scam-to-standalone/lib/get-module-metadata-from-ast.d.ts +0 -9
  100. package/dist/src/generators/scam-to-standalone/lib/get-module-metadata-from-ast.js +0 -51
  101. package/dist/src/generators/scam-to-standalone/lib/get-target-project.d.ts +0 -2
  102. package/dist/src/generators/scam-to-standalone/lib/get-target-project.js +0 -13
  103. package/dist/src/generators/scam-to-standalone/lib/index.d.ts +0 -8
  104. package/dist/src/generators/scam-to-standalone/lib/index.js +0 -11
  105. package/dist/src/generators/scam-to-standalone/lib/replace-module-usages-with-component.d.ts +0 -2
  106. package/dist/src/generators/scam-to-standalone/lib/replace-module-usages-with-component.js +0 -20
  107. package/dist/src/generators/scam-to-standalone/lib/selector-exists-in-ast.d.ts +0 -2
  108. package/dist/src/generators/scam-to-standalone/lib/selector-exists-in-ast.js +0 -7
  109. package/dist/src/generators/scam-to-standalone/lib/verify-is-inline-scam.d.ts +0 -2
  110. package/dist/src/generators/scam-to-standalone/lib/verify-is-inline-scam.js +0 -10
  111. package/dist/src/generators/scam-to-standalone/lib/verify-module-is-scam.d.ts +0 -1
  112. package/dist/src/generators/scam-to-standalone/lib/verify-module-is-scam.js +0 -11
  113. package/dist/src/generators/scam-to-standalone/scam-to-standalone.d.ts +0 -7
  114. package/dist/src/generators/scam-to-standalone/scam-to-standalone.js +0 -31
  115. package/dist/src/generators/scam-to-standalone/schema.d.ts +0 -5
  116. package/dist/src/generators/scam-to-standalone/schema.json +0 -32
  117. package/dist/src/generators/utils/export-scam.d.ts +0 -11
  118. package/dist/src/generators/utils/export-scam.js +0 -35
  119. package/dist/types/nx-angular.d.ts.map +0 -1
@@ -1,4 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- //# sourceMappingURL=nx-angular.mjs.map
@@ -9,10 +9,6 @@ export * from './src/generators/library/library';
9
9
  export * from './src/generators/ngrx-feature-store/ngrx-feature-store';
10
10
  export * from './src/generators/ngrx-root-store/ngrx-root-store';
11
11
  export * from './src/generators/pipe/pipe';
12
- export * from './src/generators/scam-directive/scam-directive';
13
- export * from './src/generators/scam-pipe/scam-pipe';
14
- export * from './src/generators/scam-to-standalone/scam-to-standalone';
15
- export * from './src/generators/scam/scam';
16
12
  export * from './src/generators/setup-ssr/setup-ssr';
17
13
  export * from './src/generators/stories/stories';
18
14
  export * from './src/generators/storybook-configuration/storybook-configuration';
@@ -13,10 +13,6 @@ tslib_1.__exportStar(require("./src/generators/library/library"), exports);
13
13
  tslib_1.__exportStar(require("./src/generators/ngrx-feature-store/ngrx-feature-store"), exports);
14
14
  tslib_1.__exportStar(require("./src/generators/ngrx-root-store/ngrx-root-store"), exports);
15
15
  tslib_1.__exportStar(require("./src/generators/pipe/pipe"), exports);
16
- tslib_1.__exportStar(require("./src/generators/scam-directive/scam-directive"), exports);
17
- tslib_1.__exportStar(require("./src/generators/scam-pipe/scam-pipe"), exports);
18
- tslib_1.__exportStar(require("./src/generators/scam-to-standalone/scam-to-standalone"), exports);
19
- tslib_1.__exportStar(require("./src/generators/scam/scam"), exports);
20
16
  tslib_1.__exportStar(require("./src/generators/setup-ssr/setup-ssr"), exports);
21
17
  tslib_1.__exportStar(require("./src/generators/stories/stories"), exports);
22
18
  tslib_1.__exportStar(require("./src/generators/storybook-configuration/storybook-configuration"), exports);
@@ -0,0 +1 @@
1
+ export declare function waitForDevServer(workspaceConfigPath: string): Promise<void>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.waitForDevServer = waitForDevServer;
4
+ const dev_server_ready_check_1 = require("./src/plugins/utils/dev-server-ready-check");
5
+ async function waitForDevServer(workspaceConfigPath) {
6
+ await (0, dev_server_ready_check_1.waitForAngularDevServer)(workspaceConfigPath);
7
+ process.exit(0);
8
+ }
@@ -522,8 +522,7 @@
522
522
  },
523
523
  "preloadInitial": {
524
524
  "type": "boolean",
525
- "default": true,
526
- "description": "Generates 'preload', 'modulepreload', and 'preconnect' link elements for initial application files and resources."
525
+ "description": "Generates 'preload', 'modulepreload', and 'preconnect' link elements for initial application files and resources. Defaults to false when a service worker is enabled; otherwise true. _Note: defaulting to false when a service worker is enabled only applies in Angular versions >= 22.2.0. Earlier versions default to true._"
527
526
  }
528
527
  },
529
528
  "required": ["input"]
@@ -12,8 +12,10 @@ exports.writeBundlesTransform = void 0;
12
12
  exports.removeSourceMappingUrl = removeSourceMappingUrl;
13
13
  exports.remapDeclarationMapSources = remapDeclarationMapSources;
14
14
  exports.normalizeEsm2022Path = normalizeEsm2022Path;
15
+ const tslib_1 = require("tslib");
15
16
  const transform_1 = require("ng-packagr/src/lib/graph/transform");
16
17
  const nodes_1 = require("ng-packagr/src/lib/ng-package/nodes");
18
+ const ngPackagrNodes = tslib_1.__importStar(require("ng-packagr/src/lib/ng-package/nodes"));
17
19
  const package_1 = require("ng-packagr/src/lib/ng-package/package");
18
20
  const path_1 = require("ng-packagr/src/lib/utils/path");
19
21
  const promises_1 = require("node:fs/promises");
@@ -29,9 +31,15 @@ async function shouldWriteFile(filePath, newContent) {
29
31
  return true;
30
32
  }
31
33
  }
34
+ // ng-packagr 22.2.0 to 22.2.3 build entry points in parallel and export this
35
+ // to find the one a graph is scoped to. 22.2.4 reverted that:
36
+ // https://github.com/ng-packagr/ng-packagr/issues/3451
37
+ const { getActiveEntryPoint } = ngPackagrNodes;
32
38
  const writeBundlesTransform = (_options) => {
33
39
  return (0, transform_1.transformFromPromise)(async (graph) => {
34
- const entryPointNode = graph.find((0, nodes_1.isEntryPointInProgress)());
40
+ const entryPointNode = getActiveEntryPoint
41
+ ? getActiveEntryPoint(graph)
42
+ : graph.find((0, nodes_1.isEntryPointInProgress)());
35
43
  if (!entryPointNode) {
36
44
  return;
37
45
  }
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "runnerConfig": {
24
24
  "type": ["string", "boolean"],
25
- "description": "Specifies the configuration file for the selected test runner. If a string is provided, it will be used as the path to the configuration file. If `true`, the builder will search for a default configuration file (e.g., `vitest.config.ts` or `karma.conf.js`). If `false`, no external configuration file will be used.\\nFor Vitest, this enables advanced options and the use of custom plugins. Please note that while the file is loaded, the Angular team does not provide direct support for its specific contents or any third-party plugins used within it.",
25
+ "description": "Specifies the configuration file for the selected test runner. If a string is provided, it will be used as the path to the configuration file. If `true`, the builder will search for a default configuration file (e.g., `vitest-base.config.mts` or `karma.conf.js`). If `false`, no external configuration file will be used.\\nFor Vitest, this enables advanced options and the use of custom plugins. Please note that while the file is loaded, the Angular team does not provide direct support for its specific contents or any third-party plugins used within it.",
26
26
  "default": false
27
27
  },
28
28
  "browsers": {
@@ -46,6 +46,11 @@
46
46
  "type": "boolean",
47
47
  "description": "Enables isolation for test execution. When true, Vitest runs tests in separate threads or processes. This option is only available for the Vitest runner. Defaults to false to align with the Karma/Jasmine experience. _Note: this is only supported in Angular versions >= 22.0.0_."
48
48
  },
49
+ "splitting": {
50
+ "type": "boolean",
51
+ "description": "Enables code splitting for test execution. When enabled, shared code between test files is split into separate chunks. Issues with live ESM bindings in Node.js environments (such as uninitialized exports or mocking failures) can be resolved by disabling splitting. This option is only available for the Vitest runner. Defaults to `true`. _Note: this is only supported in Angular versions >= 22.2.0_.",
52
+ "x-deprecated": "No longer needed with Vitest 5."
53
+ },
49
54
  "quiet": {
50
55
  "type": "boolean",
51
56
  "description": "Suppresses the verbose build summary and stats table on each rebuild. Defaults to `true` locally and `false` in CI environments. _Note: this is only supported in Angular versions >= 22.0.0_."
@@ -47,6 +47,11 @@ function validateOptions(options) {
47
47
  throw new Error(`The "quiet" option requires Angular version 22.0.0 or greater. You are currently using version ${angularVersion}.`);
48
48
  }
49
49
  }
50
+ if ((0, semver_1.lt)(angularVersion, '22.2.0')) {
51
+ if (options.splitting !== undefined) {
52
+ throw new Error(`The "splitting" option requires Angular version 22.2.0 or greater. You are currently using version ${angularVersion}.`);
53
+ }
54
+ }
50
55
  }
51
56
  /**
52
57
  * The Angular CLI unit-test builder only accepts the `@angular/build:application`
@@ -13,6 +13,7 @@ const devkit_1 = require("@nx/devkit");
13
13
  const browserslist_1 = tslib_1.__importDefault(require("browserslist"));
14
14
  const component_stylesheets_1 = require("ng-packagr/src/lib/styles/component-stylesheets");
15
15
  const postcss_configuration_1 = require("ng-packagr/src/lib/styles/postcss-configuration");
16
+ const semver_1 = require("semver");
16
17
  const ng_packagr_version_1 = require("./ng-packagr-version");
17
18
  var CssUrl;
18
19
  (function (CssUrl) {
@@ -20,7 +21,13 @@ var CssUrl;
20
21
  CssUrl["none"] = "none";
21
22
  })(CssUrl || (exports.CssUrl = CssUrl = {}));
22
23
  function getStylesheetProcessor() {
23
- const { major: ngPackagrMajorVersion } = (0, ng_packagr_version_1.getNgPackagrVersionInfo)();
24
+ const { major: ngPackagrMajorVersion, version: ngPackagrVersion } = (0, ng_packagr_version_1.getNgPackagrVersionInfo)();
25
+ // ng-packagr >= 22.2 resolves the style config once per package, older
26
+ // versions resolve it for each entry point
27
+ const resolvePerPackage = !(0, semver_1.lt)(ngPackagrVersion, '22.2.0');
28
+ // ng-packagr calls this factory once per build, so a later build in the
29
+ // same process reads config changes
30
+ const styleConfigCache = new Map();
24
31
  class StylesheetProcessor extends component_stylesheets_1.ComponentStylesheetBundler {
25
32
  constructor(projectBasePath, basePath, cssUrl, includePaths, sass, cacheDirectory, watch) {
26
33
  if (ngPackagrMajorVersion === 22) {
@@ -34,21 +41,17 @@ function getStylesheetProcessor() {
34
41
  path: require.resolve('ng-packagr/.browserslistrc'),
35
42
  });
36
43
  }
37
- const browserslistData = (0, browserslist_1.default)(undefined, { path: basePath });
38
- let searchDirs = (0, postcss_configuration_1.generateSearchDirectories)([projectBasePath]);
39
- const postcssConfiguration = (0, postcss_configuration_1.loadPostcssConfiguration)(searchDirs);
40
- // (nx-specific): we support loading the TailwindCSS config from the root of the workspace
41
- searchDirs = (0, postcss_configuration_1.generateSearchDirectories)([projectBasePath, devkit_1.workspaceRoot]);
44
+ const { postcssConfiguration, tailwindConfiguration, target } = resolvePerPackage
45
+ ? getPackageStyleConfig(styleConfigCache, projectBasePath)
46
+ : resolveStyleConfig(projectBasePath, basePath);
42
47
  super({
43
48
  cacheDirectory: cacheDirectory,
44
49
  postcssConfiguration: postcssConfiguration,
45
- tailwindConfiguration: postcssConfiguration
46
- ? undefined
47
- : (0, postcss_configuration_1.getTailwindConfig)(searchDirs, projectBasePath),
50
+ tailwindConfiguration: tailwindConfiguration,
48
51
  sass: sass,
49
52
  workspaceRoot: projectBasePath,
50
53
  cssUrl: cssUrl,
51
- target: transformSupportedBrowsersToTargets(browserslistData),
54
+ target: target,
52
55
  includePaths: includePaths,
53
56
  }, 'css', watch);
54
57
  this.projectBasePath = projectBasePath;
@@ -65,6 +68,28 @@ function getStylesheetProcessor() {
65
68
  }
66
69
  return StylesheetProcessor;
67
70
  }
71
+ function getPackageStyleConfig(styleConfigCache, projectBasePath) {
72
+ let config = styleConfigCache.get(projectBasePath);
73
+ if (!config) {
74
+ config = resolveStyleConfig(projectBasePath, projectBasePath);
75
+ styleConfigCache.set(projectBasePath, config);
76
+ }
77
+ return config;
78
+ }
79
+ function resolveStyleConfig(projectBasePath, browserslistPath) {
80
+ const browserslistData = (0, browserslist_1.default)(undefined, { path: browserslistPath });
81
+ let searchDirs = (0, postcss_configuration_1.generateSearchDirectories)([projectBasePath]);
82
+ const postcssConfiguration = (0, postcss_configuration_1.loadPostcssConfiguration)(searchDirs);
83
+ // (nx-specific): we support loading the TailwindCSS config from the root of the workspace
84
+ searchDirs = (0, postcss_configuration_1.generateSearchDirectories)([projectBasePath, devkit_1.workspaceRoot]);
85
+ return {
86
+ postcssConfiguration,
87
+ tailwindConfiguration: postcssConfiguration
88
+ ? undefined
89
+ : (0, postcss_configuration_1.getTailwindConfig)(searchDirs, projectBasePath),
90
+ target: transformSupportedBrowsersToTargets(browserslistData),
91
+ };
92
+ }
68
93
  function transformSupportedBrowsersToTargets(supportedBrowsers) {
69
94
  const transformed = [];
70
95
  // https://esbuild.github.io/api/#target
@@ -26,8 +26,6 @@ async function addLintingGenerator(tree, options) {
26
26
  unitTestRunner: options.unitTestRunner,
27
27
  enableTypedLinting: (0, internal_3.isTypedLintingEnabled)(options),
28
28
  rootProject: rootProject,
29
- addPlugin: options.addPlugin ?? false,
30
- addExplicitTargets: true,
31
29
  skipPackageJson: options.skipPackageJson,
32
30
  }));
33
31
  // The angular-eslint presets, selector rules and dependency install below have
@@ -13,5 +13,4 @@ export interface AddLintingGeneratorSchema {
13
13
  skipFormat?: boolean;
14
14
  skipPackageJson?: boolean;
15
15
  unitTestRunner?: string;
16
- addPlugin?: boolean;
17
16
  }
@@ -21,7 +21,7 @@ async function applicationGenerator(tree, schema) {
21
21
  if (isRspack) {
22
22
  schema.bundler = 'webpack';
23
23
  }
24
- const options = await (0, lib_1.normalizeOptions)(tree, schema, isRspack);
24
+ const options = await (0, lib_1.normalizeOptions)(tree, schema);
25
25
  const rootOffset = (0, devkit_1.offsetFromRoot)(options.appProjectRoot);
26
26
  await (0, js_1.initGenerator)(tree, {
27
27
  ...options,
@@ -32,7 +32,6 @@ async function applicationGenerator(tree, schema) {
32
32
  await (0, init_1.angularInitGenerator)(tree, {
33
33
  ...options,
34
34
  skipFormat: true,
35
- addPlugin: options.addPlugin,
36
35
  });
37
36
  if (!options.skipPackageJson) {
38
37
  (0, ensure_angular_dependencies_1.ensureAngularDependencies)(tree, options.zoneless);
@@ -6,10 +6,6 @@ const internal_1 = require("@nx/devkit/internal");
6
6
  const internal_2 = require("@nx/eslint/internal");
7
7
  const versions_1 = require("../../../utils/versions");
8
8
  async function addE2e(tree, options) {
9
- // since e2e are separate projects, default to adding plugins
10
- const nxJson = (0, devkit_1.readNxJson)(tree);
11
- const addPlugin = nxJson['useInferencePlugins'] !== false &&
12
- process.env.NX_ADD_PLUGINS !== 'false';
13
9
  const e2eWebServerInfo = getAngularE2EWebServerInfo(tree, options.name, options.port);
14
10
  if (options.e2eTestRunner === 'cypress') {
15
11
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
@@ -36,7 +32,6 @@ async function addE2e(tree, options) {
36
32
  ciWebServerCommand: e2eWebServerInfo.e2eCiWebServerCommand,
37
33
  ciBaseUrl: e2eWebServerInfo.e2eCiBaseUrl,
38
34
  rootProject: options.rootProject,
39
- addPlugin,
40
35
  });
41
36
  }
42
37
  else if (options.e2eTestRunner === 'playwright') {
@@ -58,8 +53,9 @@ async function addE2e(tree, options) {
58
53
  enableTypedLinting: (0, internal_2.isTypedLintingEnabled)(options),
59
54
  webServerCommand: e2eWebServerInfo.e2eWebServerCommand,
60
55
  webServerAddress: e2eWebServerInfo.e2eWebServerAddress,
56
+ ciWebServerCommand: e2eWebServerInfo.e2eCiWebServerCommand,
57
+ ciWebServerAddress: e2eWebServerInfo.e2eCiBaseUrl,
61
58
  rootProject: options.rootProject,
62
- addPlugin,
63
59
  });
64
60
  }
65
61
  return e2eWebServerInfo.e2ePort;
@@ -17,6 +17,5 @@ async function addLinting(host, options) {
17
17
  skipPackageJson: options.skipPackageJson,
18
18
  unitTestRunner: options.unitTestRunner,
19
19
  skipFormat: true,
20
- addPlugin: options.addPlugin,
21
20
  });
22
21
  }
@@ -14,6 +14,8 @@ function addFileServerTarget(tree, options, targetName, e2ePort) {
14
14
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.name);
15
15
  projectConfig.targets[targetName] = {
16
16
  continuous: true,
17
+ readyWhen: { signal: true },
18
+ dependsOn: ['build'],
17
19
  executor: '@nx/web:file-server',
18
20
  options: {
19
21
  buildTarget: `${options.name}:build`,
@@ -12,7 +12,6 @@ async function addUnitTestRunner(host, options) {
12
12
  projectRoot: options.appProjectRoot,
13
13
  skipPackageJson: options.skipPackageJson,
14
14
  strict: options.strict,
15
- addPlugin: options.addPlugin,
16
15
  runtimeTsconfigFileName: 'tsconfig.app.json',
17
16
  zoneless: options.zoneless,
18
17
  });
@@ -30,7 +29,6 @@ async function addUnitTestRunner(host, options) {
30
29
  skipFormat: options.skipFormat,
31
30
  skipPackageJson: options.skipPackageJson,
32
31
  strict: options.strict,
33
- addPlugin: options.addPlugin,
34
32
  zoneless: options.zoneless,
35
33
  });
36
34
  default:
@@ -80,6 +80,7 @@ function createProjectForEsbuild(tree, options) {
80
80
  },
81
81
  serve: {
82
82
  continuous: true,
83
+ readyWhen: { signal: true },
83
84
  executor: '@angular/build:dev-server',
84
85
  options: options.port ? { port: options.port } : undefined,
85
86
  configurations: {
@@ -173,6 +174,7 @@ function createProjectForWebpack(tree, options) {
173
174
  },
174
175
  serve: {
175
176
  continuous: true,
177
+ readyWhen: { signal: true },
176
178
  executor: '@angular-devkit/build-angular:dev-server',
177
179
  options: options.port ? { port: options.port } : undefined,
178
180
  configurations: {
@@ -1,4 +1,4 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  import type { Schema } from '../schema';
3
3
  import type { NormalizedSchema } from './normalized-schema';
4
- export declare function normalizeOptions(host: Tree, options: Partial<Schema>, isRspack?: boolean): Promise<NormalizedSchema>;
4
+ export declare function normalizeOptions(host: Tree, options: Partial<Schema>): Promise<NormalizedSchema>;
@@ -6,18 +6,13 @@ const internal_1 = require("@nx/devkit/internal");
6
6
  const internal_2 = require("@nx/js/internal");
7
7
  const test_runners_1 = require("../../../utils/test-runners");
8
8
  const version_utils_1 = require("../../utils/version-utils");
9
- function arePluginsExplicitlyDisabled(host) {
10
- const { useInferencePlugins } = (0, devkit_1.readNxJson)(host);
11
- const addPluginEnvVar = process.env.NX_ADD_PLUGINS;
12
- return useInferencePlugins === false || addPluginEnvVar === 'false';
13
- }
14
9
  function validateBundler(bundler) {
15
10
  if (['esbuild', 'webpack', 'rspack'].includes(bundler)) {
16
11
  return bundler;
17
12
  }
18
13
  throw new Error(`Invalid bundler: ${bundler}. Please use one of the following: 'esbuild', 'webpack', 'rspack'.`);
19
14
  }
20
- async function normalizeOptions(host, options, isRspack) {
15
+ async function normalizeOptions(host, options) {
21
16
  await (0, internal_1.ensureRootProjectName)(options, 'application');
22
17
  const { projectName: appProjectName, projectRoot: appProjectRoot } = await (0, internal_1.determineProjectNameAndRootOptions)(host, {
23
18
  name: options.name,
@@ -32,7 +27,6 @@ async function normalizeOptions(host, options, isRspack) {
32
27
  ? options.tags.split(',').map((s) => s.trim())
33
28
  : [];
34
29
  const bundler = validateBundler(options.bundler ?? 'esbuild');
35
- const addPlugin = options.addPlugin ?? (!arePluginsExplicitlyDisabled(host) && isRspack);
36
30
  const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(host);
37
31
  const zonelessDefaultValue = angularMajorVersion >= 21 ? true : false;
38
32
  const unitTestRunner = options.unitTestRunner ??
@@ -43,7 +37,6 @@ async function normalizeOptions(host, options, isRspack) {
43
37
  : test_runners_1.UnitTestRunner.Jest);
44
38
  // Set defaults and then overwrite with user options
45
39
  return {
46
- addPlugin,
47
40
  style: 'css',
48
41
  routing: true,
49
42
  inlineStyle: false,
@@ -32,7 +32,6 @@ export interface Schema {
32
32
  bundler?: 'webpack' | 'esbuild' | 'rspack';
33
33
  ssr?: boolean;
34
34
  nxCloudToken?: string;
35
- addPlugin?: boolean;
36
35
  zoneless?: boolean;
37
36
  formatter?: 'prettier' | 'oxfmt' | 'none';
38
37
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertToRspack = convertToRspack;
4
4
  const internal_1 = require("@nx/devkit/internal");
5
5
  const devkit_1 = require("@nx/devkit");
6
+ const node_util_1 = require("node:util");
6
7
  const path_1 = require("path");
7
8
  const posix_1 = require("path/posix");
8
9
  const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
@@ -356,7 +357,6 @@ async function convertToRspack(tree, schema) {
356
357
  // ensure plugin is registered
357
358
  const { rspackInitGenerator } = (0, devkit_1.ensurePackage)('@nx/rspack', versions_1.nxVersion);
358
359
  await rspackInitGenerator(tree, {
359
- addPlugin: true,
360
360
  framework: 'angular',
361
361
  });
362
362
  // find the inferred target names
@@ -491,6 +491,11 @@ async function convertToRspack(tree, schema) {
491
491
  if (serveTarget.config.continuous) {
492
492
  delete serveTarget.config.continuous;
493
493
  }
494
+ // Nx writes it for the dev server builders, and it would override the
495
+ // readyWhen inferred for the Rspack serve target
496
+ if ((0, node_util_1.isDeepStrictEqual)(serveTarget.config.readyWhen, { signal: true })) {
497
+ delete serveTarget.config.readyWhen;
498
+ }
494
499
  if (serveTarget.config.syncGenerators?.length === 1 &&
495
500
  serveTarget.config.syncGenerators[0] === '@nx/js:typescript-sync') {
496
501
  delete serveTarget.config.syncGenerators;
@@ -64,8 +64,6 @@ async function cypressComponentConfiguration(tree, options) {
64
64
  tasks.push(await baseCyCTConfig(tree, {
65
65
  project: options.project,
66
66
  skipFormat: true,
67
- addPlugin: false,
68
- addExplicitTargets: true,
69
67
  skipPackageJson: options.skipPackageJson,
70
68
  }));
71
69
  await configureCypressCT(tree, options);
@@ -142,20 +140,10 @@ async function configureCypressCT(tree, options) {
142
140
  throw new Error('Unable to find a valid build configuration. Try passing in a target for an Angular app (e.g. --build-target=<project>:<target>[:<configuration>]).');
143
141
  }
144
142
  }
145
- const ctConfigOptions = {};
143
+ const ctConfigOptions = {
144
+ buildTarget: found.target,
145
+ };
146
146
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
147
- if (projectConfig.targets?.['component-test']?.executor ===
148
- '@nx/cypress:cypress') {
149
- projectConfig.targets['component-test'].options = {
150
- ...projectConfig.targets['component-test'].options,
151
- skipServe: true,
152
- devServerTarget: found.target,
153
- };
154
- (0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
155
- }
156
- else {
157
- ctConfigOptions.buildTarget = found.target;
158
- }
159
147
  const { addDefaultCTConfig, getProjectCypressConfigPath, getInstalledCypressMajorVersion, } = require('@nx/cypress/internal');
160
148
  const cypressConfigPath = getProjectCypressConfigPath(tree, projectConfig.root);
161
149
  const updatedCyConfig = await addDefaultCTConfig(tree.read(cypressConfigPath, 'utf-8'), ctConfigOptions, '@nx/angular/plugins/component-testing', getInstalledCypressMajorVersion(tree));
@@ -16,8 +16,7 @@ async function angularInitGenerator(tree, options) {
16
16
  // generators do not use `angular.json`, and `nx init` should split
17
17
  // `angular.json` into multiple `project.json` files -- as this is preferred
18
18
  // by most folks we've talked to.
19
- options.addPlugin ??= process.env.NX_RUNNING_NX_IMPORT === 'true';
20
- if (options.addPlugin) {
19
+ if (process.env.NX_RUNNING_NX_IMPORT === 'true') {
21
20
  await (0, internal_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/angular/plugin', plugin_1.createNodes, {
22
21
  targetNamePrefix: ['', 'angular:', 'angular-'],
23
22
  }, options.updatePackageScripts);
@@ -3,7 +3,5 @@ export interface Schema {
3
3
  skipInstall?: boolean;
4
4
  skipPackageJson?: boolean;
5
5
  keepExistingVersions?: boolean;
6
- /* internal */
7
- addPlugin?: boolean;
8
6
  updatePackageScripts?: boolean;
9
7
  }
@@ -39,6 +39,5 @@ export interface Schema {
39
39
  skipTests?: boolean;
40
40
  selector?: string;
41
41
  skipSelector?: boolean;
42
- addPlugin?: boolean;
43
42
  skipTsConfig?: boolean;
44
43
  }
@@ -33,7 +33,6 @@ class AngularEslintLintMigrator extends builder_migrator_1.BuilderMigrator {
33
33
  }
34
34
  }
35
35
  async updateTargetConfiguration(targetName, target) {
36
- target.executor = '@nx/eslint:lint';
37
36
  if (!target.options) {
38
37
  this.logger.warn(`The target "${targetName}" is not specifying any options. Skipping updating the target configuration.`);
39
38
  return;
@@ -60,6 +59,18 @@ class AngularEslintLintMigrator extends builder_migrator_1.BuilderMigrator {
60
59
  this.logger.warn(`The lint file pattern "${pattern}" specified in the "${targetName}" target is not contained in the project root or source root. The pattern will not be updated.`);
61
60
  return pattern;
62
61
  });
62
+ // `@nx/eslint:lint` is gone in v24, so the migrated target runs the ESLint
63
+ // CLI directly. Patterns were rebased onto the new project root above.
64
+ const eslintConfig = target.options.eslintConfig && this.newEsLintConfigPath;
65
+ const patterns = target.options.lintFilePatterns ?? [];
66
+ delete target.executor;
67
+ delete target.options;
68
+ target.command = [
69
+ 'eslint',
70
+ ...(eslintConfig ? ['--config', eslintConfig] : []),
71
+ // Quoted so ESLint, not the shell, expands the globs: sh has no globstar.
72
+ ...patterns.map((pattern) => `"${pattern}"`),
73
+ ].join(' ');
63
74
  (0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name, {
64
75
  ...this.projectConfig,
65
76
  });
@@ -19,6 +19,7 @@ export declare class AppMigrator extends ProjectMigrator<SupportedTargets> {
19
19
  private updatePrerenderTargetConfiguration;
20
20
  private updateServerTargetConfiguration;
21
21
  private updateServeSsrTargetConfiguration;
22
+ private updateDevServerTargets;
22
23
  private updateTsConfigFileUsedByBuildTarget;
23
24
  private updateTsConfigFileUsedByServerTarget;
24
25
  }
@@ -50,6 +50,11 @@ const supportedTargets = {
50
50
  ],
51
51
  },
52
52
  };
53
+ const readySignalingServeBuilders = new Set([
54
+ '@angular/build:dev-server',
55
+ '@angular-devkit/build-angular:dev-server',
56
+ '@angular-devkit/build-angular:ssr-dev-server',
57
+ ]);
53
58
  // TODO(leo): this will replace `supportedTargets` once the full refactor is done.
54
59
  const supportedBuilderMigrators = [
55
60
  builders_1.AngularBuildUnitTestMigrator,
@@ -139,6 +144,7 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
139
144
  this.updateServerTargetConfiguration();
140
145
  this.updatePrerenderTargetConfiguration();
141
146
  this.updateServeSsrTargetConfiguration();
147
+ this.updateDevServerTargets();
142
148
  (0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name, {
143
149
  ...this.projectConfig,
144
150
  });
@@ -342,6 +348,22 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
342
348
  }
343
349
  });
344
350
  }
351
+ updateDevServerTargets() {
352
+ for (const targetType of ['serve', 'serveSsr']) {
353
+ const targetName = this.targetNames[targetType];
354
+ if (!targetName || this.shouldSkipTargetTypeMigration(targetType)) {
355
+ continue;
356
+ }
357
+ const target = this.projectConfig.targets[targetName];
358
+ if (!readySignalingServeBuilders.has(target.executor)) {
359
+ continue;
360
+ }
361
+ target.continuous ??= true;
362
+ if (target.readyWhen === undefined) {
363
+ target.readyWhen = { signal: true };
364
+ }
365
+ }
366
+ }
345
367
  updateTsConfigFileUsedByBuildTarget(rootTsConfigFile, projectOffsetFromRoot) {
346
368
  if (!this.targetNames.build ||
347
369
  this.shouldSkipTargetTypeMigration('build')) {
@@ -223,9 +223,6 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
223
223
  tags: [],
224
224
  implicitDependencies: [this.appName],
225
225
  });
226
- const nxJson = (0, devkit_1.readNxJson)(this.tree) ?? {};
227
- const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
228
- nxJson.useInferencePlugins !== false;
229
226
  const { configurationGenerator } = (require('@nx/cypress'));
230
227
  await configurationGenerator(this.tree, {
231
228
  project: this.project.name,
@@ -234,7 +231,6 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
234
231
  // any target would do, we replace it later with the target existing in the project being migrated
235
232
  devServerTarget: `${this.appName}:serve`,
236
233
  baseUrl: 'http://localhost:4200',
237
- addPlugin,
238
234
  });
239
235
  const cypressConfigFilePath = this.updateOrCreateCypressConfigFile(oldCypressConfigFilePath);
240
236
  this.updateCypressProjectConfiguration(cypressConfigFilePath);
@@ -284,21 +280,21 @@ class E2eMigrator extends project_migrator_1.ProjectMigrator {
284
280
  });
285
281
  }
286
282
  updateE2eCypressTarget(existingTarget, cypressConfig) {
283
+ // `@nx/cypress:cypress` is gone in v24, so the migrated target runs the
284
+ // Cypress CLI directly against the rebased config. `watch` selected the
285
+ // interactive runner, which is `cypress open`.
286
+ const isInteractive = existingTarget.options?.watch === true;
287
+ if (existingTarget.options?.devServerTarget) {
288
+ this.logger.warn(`The "devServerTarget" option is not supported by the Cypress CLI. Start "${existingTarget.options.devServerTarget}" separately, or set "baseUrl" in "${cypressConfig}".`);
289
+ }
287
290
  const updatedTarget = {
288
291
  ...existingTarget,
289
- executor: '@nx/cypress:cypress',
290
- options: {
291
- ...existingTarget.options,
292
- cypressConfig,
293
- },
292
+ command: `cypress ${isInteractive ? 'open' : 'run'} --e2e --config-file ${(0, path_1.basename)(cypressConfig)}`,
293
+ options: { cwd: (0, path_1.dirname)(cypressConfig) },
294
294
  };
295
- delete updatedTarget.options.configFile;
296
- if (updatedTarget.options.tsConfig) {
297
- updatedTarget.options.tsConfig = (0, devkit_1.joinPathFragments)(this.project.newRoot, 'tsconfig.json');
298
- }
299
- else {
300
- delete updatedTarget.options.tsConfig;
301
- }
295
+ delete updatedTarget.executor;
296
+ delete updatedTarget.configurations;
297
+ delete updatedTarget.defaultConfiguration;
302
298
  return updatedTarget;
303
299
  }
304
300
  cypressConfigGlobToNewGlob(globPattern) {
@@ -156,9 +156,7 @@ function updatePackageJson(tree) {
156
156
  });
157
157
  }
158
158
  async function updateRootEsLintConfig(tree, existingEsLintConfig, unitTestRunner) {
159
- await (0, eslint_1.lintInitGenerator)(tree, {
160
- addPlugin: false,
161
- });
159
+ await (0, eslint_1.lintInitGenerator)(tree, {});
162
160
  if (!existingEsLintConfig) {
163
161
  // There was no eslint config in the root, so we set it up and use it as-is
164
162
  (0, internal_1.setupRootEsLint)(tree, { unitTestRunner });
@@ -55,8 +55,22 @@ app.use('/**', (req, res, next) => {
55
55
  */
56
56
  if (isMainModule(import.meta.url) || process.env['pm_id']) {
57
57
  const port = process.env['PORT'] || <%= serverPort %>;
58
- app.listen(port, () => {
58
+ const server = app.listen(port, async (error?: Error) => {
59
+ if (error) {
60
+ throw error;
61
+ }
62
+
59
63
  console.log(`Node Express server listening on http://localhost:${port}`);
64
+ // Set when Nx waits for this server to be ready
65
+ if (process.env['NX_READY_SIGNAL_SOCKET']) {
66
+ try {
67
+ // Function keeps TypeScript and bundlers from rewriting or bundling the import
68
+ const load = new Function('s', 'return import(s)') as (s: string) => Promise<{ emitReadySignal(server: unknown): boolean }>;
69
+ (await load('@nx/js/ready-signal')).emitReadySignal(server);
70
+ } catch {
71
+ // @nx/js isn't installed
72
+ }
73
+ }
60
74
  });
61
75
  }
62
76