@nx/angular 18.0.4 → 18.1.0-beta.1

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 (41) hide show
  1. package/executors.d.ts +1 -0
  2. package/executors.js +1 -0
  3. package/executors.json +5 -0
  4. package/migrations.json +78 -0
  5. package/package.json +10 -10
  6. package/src/builders/dev-server/dev-server.impl.js +2 -38
  7. package/src/builders/dev-server/lib/validate-options.js +4 -0
  8. package/src/builders/dev-server/schema.d.ts +1 -0
  9. package/src/builders/dev-server/schema.json +18 -0
  10. package/src/executors/application/application.impl.js +3 -3
  11. package/src/executors/application/schema.json +12 -0
  12. package/src/executors/application/utils/validate-options.js +31 -23
  13. package/src/executors/extract-i18n/extract-i18n.impl.d.ts +3 -0
  14. package/src/executors/extract-i18n/extract-i18n.impl.js +43 -0
  15. package/src/executors/extract-i18n/schema.d.ts +8 -0
  16. package/src/executors/extract-i18n/schema.json +45 -0
  17. package/src/executors/package/ng-packagr-adjustments/ng-packagr.js +2 -2
  18. package/src/executors/utilities/ng-packagr/stylesheet-processor.js +11 -2
  19. package/src/executors/utilities/patch-builder-context.d.ts +3 -0
  20. package/src/executors/utilities/patch-builder-context.js +41 -0
  21. package/src/generators/add-linting/add-linting.js +2 -1
  22. package/src/generators/add-linting/schema.d.ts +0 -1
  23. package/src/generators/application/application.js +0 -1
  24. package/src/generators/application/files/ng-module/src/app/nx-welcome.component.ts__tpl__ +1 -1
  25. package/src/generators/application/files/standalone-components/src/app/nx-welcome.component.ts__tpl__ +1 -1
  26. package/src/generators/application/lib/add-e2e.js +4 -2
  27. package/src/generators/application/lib/add-linting.js +0 -1
  28. package/src/generators/application/lib/add-unit-test-runner.js +0 -1
  29. package/src/generators/application/lib/normalize-options.js +0 -1
  30. package/src/generators/application/schema.d.ts +0 -1
  31. package/src/generators/cypress-component-configuration/cypress-component-configuration.js +2 -3
  32. package/src/generators/cypress-component-configuration/schema.d.ts +0 -1
  33. package/src/generators/library/schema.d.ts +1 -0
  34. package/src/generators/ng-add/utilities/workspace.js +1 -1
  35. package/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +2 -0
  36. package/src/generators/utils/add-jest.d.ts +0 -1
  37. package/src/generators/utils/add-jest.js +2 -1
  38. package/src/migrations/update-18-1-0/update-angular-cli.d.ts +3 -0
  39. package/src/migrations/update-18-1-0/update-angular-cli.js +23 -0
  40. package/src/utils/versions.d.ts +4 -4
  41. package/src/utils/versions.js +4 -4
package/executors.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from './src/executors/ng-packagr-lite/ng-packagr-lite.impl';
7
7
  export * from './src/executors/package/package.impl';
8
8
  export * from './src/executors/browser-esbuild/browser-esbuild.impl';
9
9
  export * from './src/executors/application/application.impl';
10
+ export * from './src/executors/extract-i18n/extract-i18n.impl';
10
11
  import { executeDevServerBuilder } from './src/builders/dev-server/dev-server.impl';
11
12
  export {
12
13
  /**
package/executors.js CHANGED
@@ -11,6 +11,7 @@ tslib_1.__exportStar(require("./src/executors/ng-packagr-lite/ng-packagr-lite.im
11
11
  tslib_1.__exportStar(require("./src/executors/package/package.impl"), exports);
12
12
  tslib_1.__exportStar(require("./src/executors/browser-esbuild/browser-esbuild.impl"), exports);
13
13
  tslib_1.__exportStar(require("./src/executors/application/application.impl"), exports);
14
+ tslib_1.__exportStar(require("./src/executors/extract-i18n/extract-i18n.impl"), exports);
14
15
  const dev_server_impl_1 = require("./src/builders/dev-server/dev-server.impl");
15
16
  Object.defineProperty(exports, "executeWebpackDevServerBuilder", { enumerable: true, get: function () { return dev_server_impl_1.executeDevServerBuilder; } });
16
17
  Object.defineProperty(exports, "executeDevServerBuilder", { enumerable: true, get: function () { return dev_server_impl_1.executeDevServerBuilder; } });
package/executors.json CHANGED
@@ -29,6 +29,11 @@
29
29
  "implementation": "./src/executors/application/application.impl",
30
30
  "schema": "./src/executors/application/schema.json",
31
31
  "description": "Builds an application with esbuild with support for incremental builds. _Note: this is only supported in Angular versions >= 17.0.0_."
32
+ },
33
+ "extract-i18n": {
34
+ "implementation": "./src/executors/extract-i18n/extract-i18n.impl",
35
+ "schema": "./src/executors/extract-i18n/schema.json",
36
+ "description": "Extracts i18n messages from source code."
32
37
  }
33
38
  },
34
39
  "builders": {
package/migrations.json CHANGED
@@ -362,6 +362,15 @@
362
362
  "version": "18.0.0-beta.0",
363
363
  "description": "Add NX_MF_DEV_SERVER_STATIC_REMOTES to inputs for task hashing when '@nx/angular:webpack-browser' is used for Module Federation.",
364
364
  "factory": "./src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults"
365
+ },
366
+ "update-angular-cli-version-17-2-0": {
367
+ "cli": "nx",
368
+ "version": "18.1.0-beta.1",
369
+ "requires": {
370
+ "@angular/core": ">=17.2.0"
371
+ },
372
+ "description": "Update the @angular/cli package version to ~17.2.0.",
373
+ "factory": "./src/migrations/update-18-1-0/update-angular-cli"
365
374
  }
366
375
  },
367
376
  "packageJsonUpdates": {
@@ -1630,6 +1639,75 @@
1630
1639
  "alwaysAddToPackageJson": false
1631
1640
  }
1632
1641
  }
1642
+ },
1643
+ "18.1.0-jest": {
1644
+ "version": "18.1.0-beta.1",
1645
+ "requires": {
1646
+ "@angular-devkit/build-angular": ">=15.0.0 <18.0.0",
1647
+ "@angular/compiler-cli": ">=15.0.0 <18.0.0",
1648
+ "@angular/core": ">=15.0.0 <18.0.0",
1649
+ "@angular/platform-browser-dynamic": ">=15.0.0 <18.0.0",
1650
+ "jest": "^29.0.0"
1651
+ },
1652
+ "packages": {
1653
+ "jest-preset-angular": {
1654
+ "version": "~14.0.2",
1655
+ "alwaysAddToPackageJson": false
1656
+ }
1657
+ }
1658
+ },
1659
+ "18.1.0": {
1660
+ "version": "18.1.0-beta.1",
1661
+ "packages": {
1662
+ "@angular-devkit/build-angular": {
1663
+ "version": "~17.2.0",
1664
+ "alwaysAddToPackageJson": false
1665
+ },
1666
+ "@angular-devkit/core": {
1667
+ "version": "~17.2.0",
1668
+ "alwaysAddToPackageJson": false
1669
+ },
1670
+ "@angular-devkit/schematics": {
1671
+ "version": "~17.2.0",
1672
+ "alwaysAddToPackageJson": false
1673
+ },
1674
+ "@angular/pwa": {
1675
+ "version": "~17.2.0",
1676
+ "alwaysAddToPackageJson": false
1677
+ },
1678
+ "@angular/ssr": {
1679
+ "version": "~17.2.0",
1680
+ "alwaysAddToPackageJson": false
1681
+ },
1682
+ "@schematics/angular": {
1683
+ "version": "~17.2.0",
1684
+ "alwaysAddToPackageJson": false
1685
+ },
1686
+ "@angular-devkit/architect": {
1687
+ "version": "~0.1702.0",
1688
+ "alwaysAddToPackageJson": false
1689
+ },
1690
+ "@angular-devkit/build-webpack": {
1691
+ "version": "~0.1702.0",
1692
+ "alwaysAddToPackageJson": false
1693
+ },
1694
+ "@angular/core": {
1695
+ "version": "~17.2.0",
1696
+ "alwaysAddToPackageJson": true
1697
+ },
1698
+ "@angular/material": {
1699
+ "version": "~17.2.0",
1700
+ "alwaysAddToPackageJson": false
1701
+ },
1702
+ "@angular/cdk": {
1703
+ "version": "~17.2.0",
1704
+ "alwaysAddToPackageJson": false
1705
+ },
1706
+ "ng-packagr": {
1707
+ "version": "~17.2.0",
1708
+ "alwaysAddToPackageJson": false
1709
+ }
1710
+ }
1633
1711
  }
1634
1712
  }
1635
1713
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "18.0.4",
3
+ "version": "18.1.0-beta.1",
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, 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- Upgrading AngularJS applications \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -78,16 +78,16 @@
78
78
  "tslib": "^2.3.0",
79
79
  "webpack": "^5.80.0",
80
80
  "webpack-merge": "^5.8.0",
81
- "@nx/devkit": "18.0.4",
82
- "@nx/cypress": "18.0.4",
83
- "@nx/jest": "18.0.4",
84
- "@nx/js": "18.0.4",
85
- "@nx/eslint": "18.0.4",
86
- "@nx/webpack": "18.0.4",
87
- "@nx/web": "18.0.4",
88
- "@nx/workspace": "18.0.4",
81
+ "@nx/devkit": "18.1.0-beta.1",
82
+ "@nx/cypress": "18.1.0-beta.1",
83
+ "@nx/jest": "18.1.0-beta.1",
84
+ "@nx/js": "18.1.0-beta.1",
85
+ "@nx/eslint": "18.1.0-beta.1",
86
+ "@nx/webpack": "18.1.0-beta.1",
87
+ "@nx/web": "18.1.0-beta.1",
88
+ "@nx/workspace": "18.1.0-beta.1",
89
89
  "piscina": "^4.2.1",
90
- "@nrwl/angular": "18.0.4"
90
+ "@nrwl/angular": "18.1.0-beta.1"
91
91
  },
92
92
  "peerDependencies": {
93
93
  "@angular-devkit/build-angular": ">= 15.0.0 < 18.0.0",
@@ -12,6 +12,7 @@ const rxjs_1 = require("rxjs");
12
12
  const operators_2 = require("rxjs/operators");
13
13
  const angular_version_utils_1 = require("../../executors/utilities/angular-version-utils");
14
14
  const esbuild_extensions_1 = require("../../executors/utilities/esbuild-extensions");
15
+ const patch_builder_context_1 = require("../../executors/utilities/patch-builder-context");
15
16
  const buildable_libs_1 = require("../utilities/buildable-libs");
16
17
  const webpack_1 = require("../utilities/webpack");
17
18
  const lib_1 = require("./lib");
@@ -95,7 +96,7 @@ function executeDevServerBuilder(rawOptions, context) {
95
96
  * builders. Since we are using a custom builder, we patch the context to
96
97
  * handle `@nx/angular:*` executors.
97
98
  */
98
- patchBuilderContext(context, !isUsingWebpackBuilder, parsedBuildTarget);
99
+ (0, patch_builder_context_1.patchBuilderContext)(context, !isUsingWebpackBuilder, parsedBuildTarget);
99
100
  return (0, rxjs_1.combineLatest)([
100
101
  (0, rxjs_1.from)(Promise.resolve().then(() => require('@angular-devkit/build-angular'))),
101
102
  (0, rxjs_1.from)((0, esbuild_extensions_1.loadPlugins)(buildTargetOptions.plugins, buildTargetOptions.tsConfig)),
@@ -157,40 +158,3 @@ async function loadIndexHtmlFileTransformer(pathToIndexFileTransformer, tsConfig
157
158
  ? (0, webpack_1.resolveIndexHtmlTransformer)(pathToIndexFileTransformer, tsConfig, context.target)
158
159
  : await (0, esbuild_extensions_1.loadIndexHtmlTransformer)(pathToIndexFileTransformer, tsConfig);
159
160
  }
160
- const executorToBuilderMap = new Map([
161
- [
162
- '@nx/angular:browser-esbuild',
163
- '@angular-devkit/build-angular:browser-esbuild',
164
- ],
165
- ['@nx/angular:application', '@angular-devkit/build-angular:application'],
166
- ]);
167
- function patchBuilderContext(context, isUsingEsbuildBuilder, buildTarget) {
168
- const originalGetBuilderNameForTarget = context.getBuilderNameForTarget;
169
- context.getBuilderNameForTarget = async (target) => {
170
- const builderName = await originalGetBuilderNameForTarget(target);
171
- if (executorToBuilderMap.has(builderName)) {
172
- return executorToBuilderMap.get(builderName);
173
- }
174
- return builderName;
175
- };
176
- if (isUsingEsbuildBuilder) {
177
- const originalGetTargetOptions = context.getTargetOptions;
178
- context.getTargetOptions = async (target) => {
179
- const options = await originalGetTargetOptions(target);
180
- if (target.project === buildTarget.project &&
181
- target.target === buildTarget.target &&
182
- target.configuration === buildTarget.configuration) {
183
- cleanBuildTargetOptions(options);
184
- }
185
- return options;
186
- };
187
- }
188
- }
189
- function cleanBuildTargetOptions(options) {
190
- delete options.buildLibsFromSource;
191
- delete options.customWebpackConfig;
192
- delete options.indexHtmlTransformer;
193
- delete options.indexFileTransformer;
194
- delete options.plugins;
195
- return options;
196
- }
@@ -14,5 +14,9 @@ function validateOptions(options) {
14
14
  throw new Error((0, devkit_1.stripIndents) `The "esbuildMiddleware" option is only supported in Angular >= 17.0.0. You are currently using "${angularVersion}".
15
15
  You can resolve this error by removing the "esbuildMiddleware" option or by migrating to Angular 17.0.0.`);
16
16
  }
17
+ if ((0, semver_1.lt)(angularVersion, '17.2.0') && options.prebundle) {
18
+ throw new Error((0, devkit_1.stripIndents) `The "prebundle" option is only supported in Angular >= 17.2.0. You are currently using "${angularVersion}".
19
+ You can resolve this error by removing the "prebundle" option or by migrating to Angular 17.2.0.`);
20
+ }
17
21
  }
18
22
  exports.validateOptions = validateOptions;
@@ -17,6 +17,7 @@ interface BaseSchema {
17
17
  watch?: boolean;
18
18
  poll?: number;
19
19
  forceEsbuild?: boolean;
20
+ prebundle?: boolean | { exclude: string[] };
20
21
  buildLibsFromSource?: boolean;
21
22
  esbuildMiddleware?: string[];
22
23
  }
@@ -116,6 +116,24 @@
116
116
  "description": "Force the development server to use the 'browser-esbuild' builder when building. This is a developer preview option for the esbuild-based build system. _Note: this is only supported in Angular versions >= 16.1.0_.",
117
117
  "default": false
118
118
  },
119
+ "prebundle": {
120
+ "description": "Enable and control the Vite-based development server's prebundling capabilities. To enable prebundling, the Angular CLI cache must also be enabled. This option has no effect when using the 'browser' or other Webpack-based builders. _Note: this is only supported in Angular versions >= 17.2.0_.",
121
+ "oneOf": [
122
+ { "type": "boolean" },
123
+ {
124
+ "type": "object",
125
+ "properties": {
126
+ "exclude": {
127
+ "description": "List of package imports that should not be prebundled by the development server. The packages will be bundled into the application code itself.",
128
+ "type": "array",
129
+ "items": { "type": "string" }
130
+ }
131
+ },
132
+ "additionalProperties": false,
133
+ "required": ["exclude"]
134
+ }
135
+ ]
136
+ },
119
137
  "buildLibsFromSource": {
120
138
  "type": "boolean",
121
139
  "description": "Read buildable libraries from source instead of building them separately. If not set, it will take the value specified in the `browserTarget` options, or it will default to `true` if it's also not set in the `browserTarget` options.",
@@ -8,7 +8,7 @@ const esbuild_extensions_1 = require("../utilities/esbuild-extensions");
8
8
  const validate_options_1 = require("./utils/validate-options");
9
9
  async function* applicationExecutor(options, context) {
10
10
  (0, validate_options_1.validateOptions)(options);
11
- const { buildLibsFromSource = true, plugins: pluginPaths, ...delegateExecutorOptions } = options;
11
+ const { buildLibsFromSource = true, plugins: pluginPaths, indexHtmlTransformer: indexHtmlTransformerPath, ...delegateExecutorOptions } = options;
12
12
  let dependencies;
13
13
  if (!buildLibsFromSource) {
14
14
  const { tsConfigPath, dependencies: foundDependencies } = (0, buildable_libs_1.createTmpTsConfigForBuildableLibs)(delegateExecutorOptions.tsConfig, context);
@@ -16,8 +16,8 @@ async function* applicationExecutor(options, context) {
16
16
  delegateExecutorOptions.tsConfig = tsConfigPath;
17
17
  }
18
18
  const plugins = await (0, esbuild_extensions_1.loadPlugins)(pluginPaths, options.tsConfig);
19
- const indexHtmlTransformer = options.indexHtmlTransformer
20
- ? await (0, esbuild_extensions_1.loadIndexHtmlTransformer)(options.indexHtmlTransformer, options.tsConfig)
19
+ const indexHtmlTransformer = indexHtmlTransformerPath
20
+ ? await (0, esbuild_extensions_1.loadIndexHtmlTransformer)(indexHtmlTransformerPath, options.tsConfig)
21
21
  : undefined;
22
22
  const { buildApplication } = await Promise.resolve().then(() => require('@angular-devkit/build-angular'));
23
23
  const builderContext = await (0, ngcli_adapter_1.createBuilderContext)({
@@ -135,6 +135,11 @@
135
135
  },
136
136
  "default": []
137
137
  },
138
+ "clearScreen": {
139
+ "type": "boolean",
140
+ "default": false,
141
+ "description": "Automatically clear the terminal screen during rebuilds. _Note: this is only supported in Angular versions >= 17.2.0_."
142
+ },
138
143
  "optimization": {
139
144
  "description": "Enables optimization of the build output. Including minification of scripts and styles, tree-shaking, dead-code elimination, inlining of critical CSS and fonts inlining. For more information, see https://angular.io/guide/workspace-config#optimization-configuration.",
140
145
  "default": true,
@@ -213,6 +218,13 @@
213
218
  "^\\.\\S+$": { "enum": ["text", "binary", "file", "empty"] }
214
219
  }
215
220
  },
221
+ "define": {
222
+ "description": "Defines global identifiers that will be replaced with a specified constant value when found in any JavaScript or TypeScript code including libraries. The value will be used directly. String values must be put in quotes. Identifiers within Angular metadata such as Component Decorators will not be replaced. _Note: this is only supported in Angular versions >= 17.2.0_.",
223
+ "type": "object",
224
+ "additionalProperties": {
225
+ "type": "string"
226
+ }
227
+ },
216
228
  "fileReplacements": {
217
229
  "description": "Replace compilation source files with other compilation source files in the build.",
218
230
  "type": "array",
@@ -8,32 +8,40 @@ function validateOptions(options) {
8
8
  if (angularMajorVersion < 17) {
9
9
  throw new Error(`The "application" executor requires Angular version 17 or greater. You are currently using version ${angularVersion}.`);
10
10
  }
11
- if (options.loader && (0, semver_1.lt)(angularVersion, '17.1.0')) {
12
- throw new Error(`The "loader" option requires Angular version 17.1.0 or greater. You are currently using version ${angularVersion}.`);
13
- }
14
- if (options.indexHtmlTransformer && (0, semver_1.lt)(angularVersion, '17.1.0')) {
15
- throw new Error(`The "indexHtmlTransformer" option requires Angular version 17.1.0 or greater. You are currently using version ${angularVersion}.`);
16
- }
17
- if (typeof options.index === 'object' &&
18
- options.index.preloadInitial !== undefined &&
19
- (0, semver_1.lt)(angularVersion, '17.1.0')) {
20
- throw new Error(`The "index.preloadInitial" option requires Angular version 17.1.0 or greater. You are currently using version ${angularVersion}.`);
21
- }
22
- if (options.optimization &&
23
- typeof options.optimization !== 'boolean' &&
24
- options.optimization.styles &&
25
- typeof options.optimization.styles !== 'boolean' &&
26
- (0, semver_1.lt)(angularVersion, '17.1.0')) {
27
- if (options.optimization.styles.removeSpecialComments === false) {
28
- throw new Error(`The "optimization.styles.removeSpecialComments" option requires Angular version 17.1.0 or greater. You are currently using version ${angularVersion}.`);
11
+ if ((0, semver_1.lt)(angularVersion, '17.1.0')) {
12
+ if (options.loader) {
13
+ throw new Error(`The "loader" option requires Angular version 17.1.0 or greater. You are currently using version ${angularVersion}.`);
14
+ }
15
+ if (options.indexHtmlTransformer) {
16
+ throw new Error(`The "indexHtmlTransformer" option requires Angular version 17.1.0 or greater. You are currently using version ${angularVersion}.`);
29
17
  }
30
- else if (options.optimization.styles.removeSpecialComments === true) {
31
- // silently remove the option, as it was the default before 17.1.0
32
- delete options.optimization.styles.removeSpecialComments;
18
+ if (typeof options.index === 'object' &&
19
+ options.index.preloadInitial !== undefined) {
20
+ throw new Error(`The "index.preloadInitial" option requires Angular version 17.1.0 or greater. You are currently using version ${angularVersion}.`);
21
+ }
22
+ if (options.optimization &&
23
+ typeof options.optimization !== 'boolean' &&
24
+ options.optimization.styles &&
25
+ typeof options.optimization.styles !== 'boolean') {
26
+ if (options.optimization.styles.removeSpecialComments === false) {
27
+ throw new Error(`The "optimization.styles.removeSpecialComments" option requires Angular version 17.1.0 or greater. You are currently using version ${angularVersion}.`);
28
+ }
29
+ else if (options.optimization.styles.removeSpecialComments === true) {
30
+ // silently remove the option, as it was the default before 17.1.0
31
+ delete options.optimization.styles.removeSpecialComments;
32
+ }
33
+ }
34
+ if (typeof options.outputPath === 'object') {
35
+ throw new Error(`The "outputPath" option as an object requires Angular version 17.1.0 or greater. You are currently using version ${angularVersion}.`);
33
36
  }
34
37
  }
35
- if (typeof options.outputPath === 'object' && (0, semver_1.lt)(angularVersion, '17.1.0')) {
36
- throw new Error(`The "outputPath" option as an object requires Angular version 17.1.0 or greater. You are currently using version ${angularVersion}.`);
38
+ if ((0, semver_1.lt)(angularVersion, '17.2.0')) {
39
+ if (options.define) {
40
+ throw new Error(`The "define" option requires Angular version 17.2.0 or greater. You are currently using version ${angularVersion}.`);
41
+ }
42
+ if (options.clearScreen !== undefined) {
43
+ throw new Error(`The "clearScreen" option requires Angular version 17.2.0 or greater. You are currently using version ${angularVersion}.`);
44
+ }
37
45
  }
38
46
  }
39
47
  exports.validateOptions = validateOptions;
@@ -0,0 +1,3 @@
1
+ import { type ExecutorContext } from '@nx/devkit';
2
+ import type { ExtractI18nExecutorOptions } from './schema';
3
+ export default function extractI18nExecutor(options: ExtractI18nExecutorOptions, context: ExecutorContext): AsyncGenerator<never, import("@angular-devkit/architect").BuilderOutput, unknown>;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const devkit_1 = require("@nx/devkit");
4
+ const ngcli_adapter_1 = require("nx/src/adapter/ngcli-adapter");
5
+ const project_graph_1 = require("nx/src/project-graph/project-graph");
6
+ const angular_version_utils_1 = require("../utilities/angular-version-utils");
7
+ const patch_builder_context_1 = require("../utilities/patch-builder-context");
8
+ async function* extractI18nExecutor(options, context) {
9
+ const parsedBuildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context);
10
+ const browserTargetProjectConfiguration = (0, project_graph_1.readCachedProjectConfiguration)(parsedBuildTarget.project);
11
+ const buildTarget = browserTargetProjectConfiguration.targets[parsedBuildTarget.target];
12
+ const isUsingEsbuildBuilder = [
13
+ '@angular-devkit/build-angular:application',
14
+ '@angular-devkit/build-angular:browser-esbuild',
15
+ '@nx/angular:application',
16
+ '@nx/angular:browser-esbuild',
17
+ ].includes(buildTarget.executor);
18
+ const builderContext = await (0, ngcli_adapter_1.createBuilderContext)({
19
+ builderName: 'extrct-i18n',
20
+ description: 'Extracts i18n messages from source code.',
21
+ optionSchema: await Promise.resolve().then(() => require('./schema.json')),
22
+ }, context);
23
+ /**
24
+ * The Angular CLI extract-i18n builder make some decisions based on the build
25
+ * target builder but it only considers `@angular-devkit/build-angular:*`
26
+ * builders. Since we are using a custom builder, we patch the context to
27
+ * handle `@nx/angular:*` executors.
28
+ */
29
+ (0, patch_builder_context_1.patchBuilderContext)(builderContext, isUsingEsbuildBuilder, parsedBuildTarget);
30
+ const { executeExtractI18nBuilder } = await Promise.resolve().then(() => require('@angular-devkit/build-angular'));
31
+ const delegateBuilderOptions = getDelegateBuilderOptions(options);
32
+ return await executeExtractI18nBuilder(delegateBuilderOptions, builderContext);
33
+ }
34
+ exports.default = extractI18nExecutor;
35
+ function getDelegateBuilderOptions(options) {
36
+ const delegateBuilderOptions = { ...options };
37
+ const { major: angularMajorVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
38
+ if (angularMajorVersion <= 17) {
39
+ delegateBuilderOptions.browserTarget = delegateBuilderOptions.buildTarget;
40
+ delete delegateBuilderOptions.buildTarget;
41
+ }
42
+ return delegateBuilderOptions;
43
+ }
@@ -0,0 +1,8 @@
1
+ import type { ExtractI18nBuilderOptions } from '@angular-devkit/build-angular';
2
+
3
+ export type ExtractI18nExecutorOptions = Omit<
4
+ ExtractI18nBuilderOptions,
5
+ 'browserTarget'
6
+ > & {
7
+ buildTarget: string;
8
+ };
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "title": "Schema for Nx extract-i18n Executor",
4
+ "description": "Extracts i18n messages from source code.",
5
+ "outputCapture": "direct-nodejs",
6
+ "type": "object",
7
+ "properties": {
8
+ "buildTarget": {
9
+ "type": "string",
10
+ "description": "A builder target to extract i18n messages in the format of `project:target[:configuration]`. You can also pass in more than one configuration name as a comma-separated list. Example: `project:target:production,staging`.",
11
+ "pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
12
+ },
13
+ "format": {
14
+ "type": "string",
15
+ "description": "Output format for the generated file.",
16
+ "default": "xlf",
17
+ "enum": [
18
+ "xmb",
19
+ "xlf",
20
+ "xlif",
21
+ "xliff",
22
+ "xlf2",
23
+ "xliff2",
24
+ "json",
25
+ "arb",
26
+ "legacy-migrate"
27
+ ]
28
+ },
29
+ "progress": {
30
+ "type": "boolean",
31
+ "description": "Log progress to the console.",
32
+ "default": true
33
+ },
34
+ "outputPath": {
35
+ "type": "string",
36
+ "description": "Path where output will be placed."
37
+ },
38
+ "outFile": {
39
+ "type": "string",
40
+ "description": "Name of the file to output."
41
+ }
42
+ },
43
+ "additionalProperties": false,
44
+ "required": ["buildTarget"]
45
+ }
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNgPackagrInstance = void 0;
4
4
  const ng_packagr_1 = require("ng-packagr");
5
5
  const angular_version_utils_1 = require("../../utilities/angular-version-utils");
6
- const stylesheet_processor_di_1 = require("../../utilities/ng-packagr/stylesheet-processor.di");
7
6
  async function getNgPackagrInstance(options) {
8
7
  const { major: angularMajorVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
9
8
  if (angularMajorVersion >= 17) {
9
+ const { STYLESHEET_PROCESSOR } = await Promise.resolve().then(() => require('../../utilities/ng-packagr/stylesheet-processor.di'));
10
10
  const packagr = (0, ng_packagr_1.ngPackagr)();
11
- packagr.withProviders([stylesheet_processor_di_1.STYLESHEET_PROCESSOR]);
11
+ packagr.withProviders([STYLESHEET_PROCESSOR]);
12
12
  return packagr;
13
13
  }
14
14
  const { NX_ENTRY_POINT_PROVIDERS } = await Promise.resolve().then(() => require('./ng-package/entry-point/entry-point.di'));
@@ -16,6 +16,8 @@ const color_1 = require("ng-packagr/lib/utils/color");
16
16
  // using this instead of the one from ng-packagr
17
17
  const tailwindcss_1 = require("./tailwindcss");
18
18
  const devkit_1 = require("@nx/devkit");
19
+ const semver_1 = require("semver");
20
+ const angular_version_utils_1 = require("../angular-version-utils");
19
21
  const maxWorkersVariable = process.env['NG_BUILD_MAX_WORKERS'];
20
22
  const maxThreads = typeof maxWorkersVariable === 'string' && maxWorkersVariable !== ''
21
23
  ? +maxWorkersVariable
@@ -46,14 +48,14 @@ class StylesheetProcessor {
46
48
  ];
47
49
  }
48
50
  async process({ filePath, content, }) {
49
- this.createRenderWorker();
51
+ await this.createRenderWorker();
50
52
  return this.renderWorker.run({ content, filePath });
51
53
  }
52
54
  /** Destory workers in pool. */
53
55
  destroy() {
54
56
  void this.renderWorker?.destroy();
55
57
  }
56
- createRenderWorker() {
58
+ async createRenderWorker() {
57
59
  if (this.renderWorker) {
58
60
  return;
59
61
  }
@@ -69,6 +71,12 @@ class StylesheetProcessor {
69
71
  currentDir = (0, path_1.dirname)(prevDir);
70
72
  }
71
73
  const browserslistData = browserslist(undefined, { path: this.basePath });
74
+ const { version: ngPackagrVersion } = (0, angular_version_utils_1.getInstalledPackageVersionInfo)('ng-packagr');
75
+ let postcssConfiguration;
76
+ if ((0, semver_1.gte)(ngPackagrVersion, '17.2.0')) {
77
+ const { loadPostcssConfiguration } = await Promise.resolve().then(() => require('ng-packagr/lib/styles/postcss-configuration'));
78
+ postcssConfiguration = await loadPostcssConfiguration(this.projectBasePath);
79
+ }
72
80
  this.renderWorker = new Piscina({
73
81
  filename: require.resolve('ng-packagr/lib/styles/stylesheet-processor-worker'),
74
82
  maxThreads,
@@ -77,6 +85,7 @@ class StylesheetProcessor {
77
85
  FORCE_COLOR: '' + color_1.colors.enabled,
78
86
  },
79
87
  workerData: {
88
+ postcssConfiguration,
80
89
  tailwindConfigPath: (0, tailwindcss_1.getTailwindConfigPath)(this.projectBasePath, devkit_1.workspaceRoot),
81
90
  projectBasePath: this.projectBasePath,
82
91
  browserslistData,
@@ -0,0 +1,3 @@
1
+ import type { BuilderContext } from '@angular-devkit/architect';
2
+ import type { Target } from '@nx/devkit';
3
+ export declare function patchBuilderContext(context: BuilderContext, isUsingEsbuildBuilder: boolean, buildTarget: Target): void;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.patchBuilderContext = void 0;
4
+ const executorToBuilderMap = new Map([
5
+ [
6
+ '@nx/angular:browser-esbuild',
7
+ '@angular-devkit/build-angular:browser-esbuild',
8
+ ],
9
+ ['@nx/angular:application', '@angular-devkit/build-angular:application'],
10
+ ]);
11
+ function patchBuilderContext(context, isUsingEsbuildBuilder, buildTarget) {
12
+ const originalGetBuilderNameForTarget = context.getBuilderNameForTarget;
13
+ context.getBuilderNameForTarget = async (target) => {
14
+ const builderName = await originalGetBuilderNameForTarget(target);
15
+ if (executorToBuilderMap.has(builderName)) {
16
+ return executorToBuilderMap.get(builderName);
17
+ }
18
+ return builderName;
19
+ };
20
+ if (isUsingEsbuildBuilder) {
21
+ const originalGetTargetOptions = context.getTargetOptions;
22
+ context.getTargetOptions = async (target) => {
23
+ const options = await originalGetTargetOptions(target);
24
+ if (target.project === buildTarget.project &&
25
+ target.target === buildTarget.target &&
26
+ target.configuration === buildTarget.configuration) {
27
+ cleanBuildTargetOptions(options);
28
+ }
29
+ return options;
30
+ };
31
+ }
32
+ }
33
+ exports.patchBuilderContext = patchBuilderContext;
34
+ function cleanBuildTargetOptions(options) {
35
+ delete options.buildLibsFromSource;
36
+ delete options.customWebpackConfig;
37
+ delete options.indexHtmlTransformer;
38
+ delete options.indexFileTransformer;
39
+ delete options.plugins;
40
+ return options;
41
+ }
@@ -20,7 +20,8 @@ async function addLintingGenerator(tree, options) {
20
20
  setParserOptionsProject: options.setParserOptionsProject,
21
21
  skipFormat: true,
22
22
  rootProject: rootProject,
23
- addPlugin: options.addPlugin,
23
+ addPlugin: false,
24
+ addExplicitTargets: true,
24
25
  });
25
26
  tasks.push(lintTask);
26
27
  if ((0, eslint_file_1.isEslintConfigSupported)(tree)) {
@@ -6,5 +6,4 @@ export interface AddLintingGeneratorSchema {
6
6
  skipFormat?: boolean;
7
7
  skipPackageJson?: boolean;
8
8
  unitTestRunner?: string;
9
- addPlugin?: boolean;
10
9
  }
@@ -12,7 +12,6 @@ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-projec
12
12
  async function applicationGenerator(tree, schema) {
13
13
  return await applicationGeneratorInternal(tree, {
14
14
  projectNameAndRootFormat: 'derived',
15
- addPlugin: false,
16
15
  ...schema,
17
16
  });
18
17
  }
@@ -699,7 +699,7 @@ import { Component, ViewEncapsulation } from '@angular/core';
699
699
  You can activate distributed tasks executions and caching by
700
700
  running:
701
701
  </p>
702
- <pre>nx connect-to-nx-cloud</pre>
702
+ <pre>nx connect</pre>
703
703
  <a href="https://nx.app/?utm_source=nx-project" target="_blank" rel="noreferrer"> What is Nx Cloud? </a>
704
704
  </div>
705
705
  <a id="nx-repo" class="button-pill rounded shadow" href="https://github.com/nrwl/nx?utm_source=nx-project" target="_blank" rel="noreferrer">
@@ -702,7 +702,7 @@ import { CommonModule } from '@angular/common';
702
702
  You can activate distributed tasks executions and caching by
703
703
  running:
704
704
  </p>
705
- <pre>nx connect-to-nx-cloud</pre>
705
+ <pre>nx connect</pre>
706
706
  <a href="https://nx.app/?utm_source=nx-project" target="_blank" rel="noreferrer"> What is Nx Cloud? </a>
707
707
  </div>
708
708
  <a id="nx-repo" class="button-pill rounded shadow" href="https://github.com/nrwl/nx?utm_source=nx-project" target="_blank" rel="noreferrer">
@@ -6,6 +6,8 @@ const devkit_1 = require("@nx/devkit");
6
6
  const versions_1 = require("../../../utils/versions");
7
7
  const version_utils_1 = require("../../utils/version-utils");
8
8
  async function addE2e(tree, options) {
9
+ // since e2e are separate projects, default to adding plugins
10
+ const addPlugin = process.env.NX_ADD_PLUGINS !== 'false';
9
11
  if (options.e2eTestRunner === 'cypress') {
10
12
  // TODO: This can call `@nx/web:static-config` generator when ready
11
13
  addFileServerTarget(tree, options, 'serve-static');
@@ -26,7 +28,7 @@ async function addE2e(tree, options) {
26
28
  devServerTarget: `${options.name}:serve:development`,
27
29
  baseUrl: 'http://localhost:4200',
28
30
  rootProject: options.rootProject,
29
- addPlugin: options.addPlugin,
31
+ addPlugin,
30
32
  });
31
33
  }
32
34
  else if (options.e2eTestRunner === 'playwright') {
@@ -49,7 +51,7 @@ async function addE2e(tree, options) {
49
51
  webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx serve ${options.name}`,
50
52
  webServerAddress: `http://localhost:${options.port ?? 4200}`,
51
53
  rootProject: options.rootProject,
52
- addPlugin: options.addPlugin,
54
+ addPlugin,
53
55
  });
54
56
  }
55
57
  }
@@ -15,7 +15,6 @@ async function addLinting(host, options) {
15
15
  skipPackageJson: options.skipPackageJson,
16
16
  unitTestRunner: options.unitTestRunner,
17
17
  skipFormat: true,
18
- addPlugin: options.addPlugin,
19
18
  });
20
19
  }
21
20
  exports.addLinting = addLinting;
@@ -10,7 +10,6 @@ async function addUnitTestRunner(host, options) {
10
10
  projectRoot: options.appProjectRoot,
11
11
  skipPackageJson: options.skipPackageJson,
12
12
  strict: options.strict,
13
- addPlugin: options.addPlugin,
14
13
  });
15
14
  }
16
15
  }
@@ -19,7 +19,6 @@ async function normalizeOptions(host, options) {
19
19
  });
20
20
  options.rootProject = appProjectRoot === '.';
21
21
  options.projectNameAndRootFormat = projectNameAndRootFormat;
22
- options.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
23
22
  const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
24
23
  const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
25
24
  const parsedTags = options.tags
@@ -31,5 +31,4 @@ export interface Schema {
31
31
  minimal?: boolean;
32
32
  bundler?: 'webpack' | 'esbuild';
33
33
  ssr?: boolean;
34
- addPlugin?: boolean;
35
34
  }
@@ -12,7 +12,6 @@ const entry_point_1 = require("../utils/storybook-ast/entry-point");
12
12
  const module_info_1 = require("../utils/storybook-ast/module-info");
13
13
  function cypressComponentConfiguration(tree, options) {
14
14
  return cypressComponentConfigurationInternal(tree, {
15
- addPlugin: false,
16
15
  ...options,
17
16
  });
18
17
  }
@@ -22,12 +21,12 @@ exports.cypressComponentConfiguration = cypressComponentConfiguration;
22
21
  * storybook + cypress then use the componentCypressGenerator instead.
23
22
  */
24
23
  async function cypressComponentConfigurationInternal(tree, options) {
25
- options.addPlugin ??= process.env.NX_ADD_PLUGINS !== 'false';
26
24
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
27
25
  const installTask = await (0, cypress_1.componentConfigurationGenerator)(tree, {
28
26
  project: options.project,
29
27
  skipFormat: true,
30
- addPlugin: options.addPlugin,
28
+ addPlugin: false,
29
+ addExplicitTargets: true,
31
30
  });
32
31
  await configureCypressCT(tree, options);
33
32
  await addFiles(tree, projectConfig, options);
@@ -3,5 +3,4 @@ export interface CypressComponentConfigSchema {
3
3
  generateTests: boolean;
4
4
  skipFormat?: boolean;
5
5
  buildTarget?: string;
6
- addPlugin?: boolean;
7
6
  }
@@ -40,4 +40,5 @@ export interface Schema {
40
40
  skipTests?: boolean;
41
41
  selector?: string;
42
42
  skipSelector?: boolean;
43
+ addPlugin?: boolean;
43
44
  }
@@ -151,7 +151,7 @@ function updatePackageJson(tree) {
151
151
  exports.updatePackageJson = updatePackageJson;
152
152
  async function updateRootEsLintConfig(tree, existingEsLintConfig, unitTestRunner) {
153
153
  await (0, eslint_1.lintInitGenerator)(tree, {
154
- addPlugin: process.env.NX_ADD_PLUGINS !== 'false',
154
+ addPlugin: false,
155
155
  });
156
156
  if (!existingEsLintConfig) {
157
157
  // There was no eslint config in the root, so we set it up and use it as-is
@@ -15,6 +15,8 @@ async function generateStorybookConfiguration(tree, options) {
15
15
  interactionTests: options.interactionTests,
16
16
  configureStaticServe: options.configureStaticServe,
17
17
  skipFormat: true,
18
+ addPlugin: false,
19
+ addExplicitTargets: true,
18
20
  });
19
21
  }
20
22
  exports.generateStorybookConfiguration = generateStorybookConfiguration;
@@ -4,6 +4,5 @@ export type AddJestOptions = {
4
4
  projectRoot: string;
5
5
  skipPackageJson: boolean;
6
6
  strict: boolean;
7
- addPlugin?: boolean;
8
7
  };
9
8
  export declare function addJest(tree: Tree, options: AddJestOptions): Promise<void>;
@@ -17,7 +17,8 @@ async function addJest(tree, options) {
17
17
  skipSerializers: false,
18
18
  skipPackageJson: options.skipPackageJson,
19
19
  skipFormat: true,
20
- addPlugin: options.addPlugin,
20
+ addPlugin: false,
21
+ addExplicitTargets: true,
21
22
  });
22
23
  const setupFile = (0, devkit_1.joinPathFragments)(options.projectRoot, 'src', 'test-setup.ts');
23
24
  if (options.strict && tree.exists(setupFile)) {
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare const angularCliVersion = "~17.2.0";
3
+ export default function (tree: Tree): Promise<void>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.angularCliVersion = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ exports.angularCliVersion = '~17.2.0';
6
+ async function default_1(tree) {
7
+ let shouldFormat = false;
8
+ (0, devkit_1.updateJson)(tree, 'package.json', (json) => {
9
+ if (json.devDependencies?.['@angular/cli']) {
10
+ json.devDependencies['@angular/cli'] = exports.angularCliVersion;
11
+ shouldFormat = true;
12
+ }
13
+ else if (json.dependencies?.['@angular/cli']) {
14
+ json.dependencies['@angular/cli'] = exports.angularCliVersion;
15
+ shouldFormat = true;
16
+ }
17
+ return json;
18
+ });
19
+ if (shouldFormat) {
20
+ await (0, devkit_1.formatFiles)(tree);
21
+ }
22
+ }
23
+ exports.default = default_1;
@@ -1,7 +1,7 @@
1
1
  export declare const nxVersion: any;
2
- export declare const angularVersion = "~17.1.0";
3
- export declare const angularDevkitVersion = "~17.1.0";
4
- export declare const ngPackagrVersion = "~17.1.0";
2
+ export declare const angularVersion = "~17.2.0";
3
+ export declare const angularDevkitVersion = "~17.2.0";
4
+ export declare const ngPackagrVersion = "~17.2.0";
5
5
  export declare const ngrxVersion = "~17.0.0";
6
6
  export declare const rxjsVersion = "~7.8.0";
7
7
  export declare const zoneJsVersion = "~0.14.3";
@@ -19,7 +19,7 @@ export declare const postcssVersion = "^8.4.5";
19
19
  export declare const postcssUrlVersion = "~10.1.3";
20
20
  export declare const autoprefixerVersion = "^10.4.0";
21
21
  export declare const tsNodeVersion = "10.9.1";
22
- export declare const jestPresetAngularVersion = "~13.1.4";
22
+ export declare const jestPresetAngularVersion = "~14.0.2";
23
23
  export declare const typesNodeVersion = "18.16.9";
24
24
  export declare const jasmineMarblesVersion = "^0.9.2";
25
25
  export declare const jsoncEslintParserVersion = "^2.1.0";
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.jsoncEslintParserVersion = exports.jasmineMarblesVersion = exports.typesNodeVersion = exports.jestPresetAngularVersion = exports.tsNodeVersion = exports.autoprefixerVersion = exports.postcssUrlVersion = exports.postcssVersion = exports.tailwindVersion = exports.angularEslintVersion = exports.moduleFederationNodeVersion = exports.browserSyncVersion = exports.typesExpressVersion = exports.expressVersion = exports.typesCorsVersion = exports.corsVersion = exports.tsLibVersion = exports.angularJsVersion = exports.zoneJsVersion = exports.rxjsVersion = exports.ngrxVersion = exports.ngPackagrVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = void 0;
4
4
  exports.nxVersion = require('../../package.json').version;
5
- exports.angularVersion = '~17.1.0';
6
- exports.angularDevkitVersion = '~17.1.0';
7
- exports.ngPackagrVersion = '~17.1.0';
5
+ exports.angularVersion = '~17.2.0';
6
+ exports.angularDevkitVersion = '~17.2.0';
7
+ exports.ngPackagrVersion = '~17.2.0';
8
8
  exports.ngrxVersion = '~17.0.0';
9
9
  exports.rxjsVersion = '~7.8.0';
10
10
  exports.zoneJsVersion = '~0.14.3';
@@ -22,7 +22,7 @@ exports.postcssVersion = '^8.4.5';
22
22
  exports.postcssUrlVersion = '~10.1.3';
23
23
  exports.autoprefixerVersion = '^10.4.0';
24
24
  exports.tsNodeVersion = '10.9.1';
25
- exports.jestPresetAngularVersion = '~13.1.4';
25
+ exports.jestPresetAngularVersion = '~14.0.2';
26
26
  exports.typesNodeVersion = '18.16.9';
27
27
  exports.jasmineMarblesVersion = '^0.9.2';
28
28
  exports.jsoncEslintParserVersion = '^2.1.0';