@nx/angular 16.8.0-beta.4 → 16.8.0-beta.5

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 (212) hide show
  1. package/mf/mf.js +31 -36
  2. package/package.json +10 -10
  3. package/plugins/component-testing.js +48 -40
  4. package/src/builders/module-federation-dev-server/module-federation-dev-server.impl.js +4 -6
  5. package/src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl.js +4 -6
  6. package/src/builders/utilities/buildable-libs.js +1 -2
  7. package/src/builders/utilities/module-federation.js +2 -3
  8. package/src/builders/utilities/webpack.js +16 -21
  9. package/src/builders/webpack-browser/webpack-browser.impl.js +13 -13
  10. package/src/builders/webpack-dev-server/lib/normalize-options.js +8 -1
  11. package/src/builders/webpack-dev-server/webpack-dev-server.impl.js +24 -18
  12. package/src/builders/webpack-server/webpack-server.impl.js +5 -7
  13. package/src/executors/browser-esbuild/browser-esbuild.impl.js +19 -23
  14. package/src/executors/browser-esbuild/lib/buildable-libs.js +1 -2
  15. package/src/executors/delegate-build/delegate-build.impl.js +9 -12
  16. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +4 -7
  17. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.transform.js +4 -5
  18. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-package.transform.js +158 -156
  19. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/options.di.js +6 -3
  20. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.js +118 -118
  21. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/styles/stylesheet-processor.js +96 -103
  22. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ts/cache-compiler-host.js +20 -12
  23. package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.js +18 -21
  24. package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +6 -9
  25. package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.js +6 -3
  26. package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +122 -122
  27. package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +96 -103
  28. package/src/executors/package/ng-packagr-adjustments/ts/cache-compiler-host.js +21 -13
  29. package/src/executors/package/ng-packagr-adjustments/utils/ng-compiler-cli.js +5 -8
  30. package/src/executors/package/package.impl.js +33 -38
  31. package/src/executors/utilities/angular-version-utils.js +1 -1
  32. package/src/executors/utilities/tailwindcss.js +2 -2
  33. package/src/executors/utilities/typescript.js +23 -28
  34. package/src/generators/add-linting/add-linting.js +76 -74
  35. package/src/generators/add-linting/lib/create-eslint-configuration.js +12 -4
  36. package/src/generators/application/application.js +56 -55
  37. package/src/generators/application/lib/add-e2e.js +36 -40
  38. package/src/generators/application/lib/add-linting.js +12 -15
  39. package/src/generators/application/lib/add-proxy-config.js +4 -1
  40. package/src/generators/application/lib/add-unit-test-runner.js +15 -18
  41. package/src/generators/application/lib/create-files.js +44 -47
  42. package/src/generators/application/lib/enable-strict-type-checking.js +2 -2
  43. package/src/generators/application/lib/normalize-options.js +37 -25
  44. package/src/generators/application/lib/set-app-strict-default.js +1 -2
  45. package/src/generators/application/lib/update-editor-tsconfig.js +1 -2
  46. package/src/generators/component/component.js +40 -43
  47. package/src/generators/component/lib/normalize-options.js +15 -5
  48. package/src/generators/component-cypress-spec/component-cypress-spec.js +25 -28
  49. package/src/generators/component-story/component-story.js +19 -22
  50. package/src/generators/convert-to-with-mf/convert-to-with-mf.js +19 -22
  51. package/src/generators/convert-to-with-mf/lib/get-webpack-config-path.js +3 -4
  52. package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js +103 -106
  53. package/src/generators/cypress-component-configuration/cypress-component-configuration.js +59 -62
  54. package/src/generators/directive/directive.js +21 -24
  55. package/src/generators/directive/lib/normalize-options.js +11 -5
  56. package/src/generators/host/host.js +77 -67
  57. package/src/generators/host/lib/add-ssr.js +32 -35
  58. package/src/generators/init/init.js +101 -92
  59. package/src/generators/library/lib/add-standalone-component.js +18 -13
  60. package/src/generators/library/lib/enable-strict-type-checking.js +17 -5
  61. package/src/generators/library/lib/normalize-options.js +68 -53
  62. package/src/generators/library/library.js +89 -92
  63. package/src/generators/library-secondary-entry-point/lib/add-files.js +5 -1
  64. package/src/generators/library-secondary-entry-point/lib/normalize-options.js +6 -3
  65. package/src/generators/library-secondary-entry-point/lib/update-linting-file-patterns.js +1 -2
  66. package/src/generators/library-secondary-entry-point/library-secondary-entry-point.js +6 -9
  67. package/src/generators/move/lib/normalize-schema.js +5 -1
  68. package/src/generators/move/lib/update-module-name.js +1 -1
  69. package/src/generators/move/lib/update-ng-package.js +1 -2
  70. package/src/generators/move/lib/update-secondary-entry-points.js +1 -2
  71. package/src/generators/move/move.js +9 -12
  72. package/src/generators/ng-add/migrate-from-angular-cli.js +54 -53
  73. package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +4 -3
  74. package/src/generators/ng-add/migrators/builders/angular-devkit-ng-packagr.migrator.js +11 -12
  75. package/src/generators/ng-add/migrators/builders/angular-eslint-lint.migrator.js +39 -42
  76. package/src/generators/ng-add/migrators/builders/builder.migrator.js +1 -2
  77. package/src/generators/ng-add/migrators/migrator.js +7 -11
  78. package/src/generators/ng-add/migrators/projects/app.migrator.js +39 -43
  79. package/src/generators/ng-add/migrators/projects/e2e.migrator.js +115 -91
  80. package/src/generators/ng-add/migrators/projects/lib.migrator.js +23 -31
  81. package/src/generators/ng-add/migrators/projects/project.migrator.js +10 -14
  82. package/src/generators/ng-add/ng-add.js +5 -8
  83. package/src/generators/ng-add/utilities/dependencies.js +2 -3
  84. package/src/generators/ng-add/utilities/format-files-task.js +1 -1
  85. package/src/generators/ng-add/utilities/projects.js +1 -1
  86. package/src/generators/ng-add/utilities/workspace.js +25 -36
  87. package/src/generators/ngrx/lib/add-imports-to-module.js +1 -2
  88. package/src/generators/ngrx/lib/add-ngrx-to-package-json.js +1 -3
  89. package/src/generators/ngrx/lib/generate-files.js +11 -2
  90. package/src/generators/ngrx/lib/normalize-options.js +9 -4
  91. package/src/generators/ngrx/lib/validate-options.js +3 -3
  92. package/src/generators/ngrx/ngrx.js +18 -21
  93. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.actions.ts__tmpl__ +1 -1
  94. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.effects.spec.ts__tmpl__ +2 -2
  95. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.effects.ts__tmpl__ +2 -2
  96. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.facade.spec.ts__tmpl__ +6 -6
  97. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.facade.ts__tmpl__ +3 -3
  98. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.reducer.spec.ts__tmpl__ +3 -3
  99. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.reducer.ts__tmpl__ +2 -2
  100. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.selectors.spec.ts__tmpl__ +3 -3
  101. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.selectors.ts__tmpl__ +1 -1
  102. package/src/generators/ngrx-feature-store/files/no-inject/__directory__/__fileName__.effects.ts__tmpl__ +2 -2
  103. package/src/generators/ngrx-feature-store/files/no-inject/__directory__/__fileName__.facade.ts__tmpl__ +3 -3
  104. package/src/generators/ngrx-feature-store/lib/add-exports-barrel.js +4 -1
  105. package/src/generators/ngrx-feature-store/lib/add-imports.js +1 -1
  106. package/src/generators/ngrx-feature-store/lib/add-ngrx-to-package-json.js +1 -3
  107. package/src/generators/ngrx-feature-store/lib/generate-files.js +20 -4
  108. package/src/generators/ngrx-feature-store/lib/normalize-options.d.ts +1 -0
  109. package/src/generators/ngrx-feature-store/lib/normalize-options.js +22 -3
  110. package/src/generators/ngrx-feature-store/lib/validate-options.js +2 -2
  111. package/src/generators/ngrx-feature-store/ngrx-feature-store.js +18 -21
  112. package/src/generators/ngrx-root-store/lib/add-ngrx-to-package-json.js +8 -6
  113. package/src/generators/ngrx-root-store/lib/normalize-options.js +8 -4
  114. package/src/generators/ngrx-root-store/lib/validate-options.js +2 -2
  115. package/src/generators/ngrx-root-store/ngrx-root-store.js +27 -30
  116. package/src/generators/pipe/lib/normalize-options.js +9 -3
  117. package/src/generators/pipe/pipe.js +21 -24
  118. package/src/generators/remote/lib/add-ssr.js +46 -47
  119. package/src/generators/remote/lib/find-next-available-port.js +1 -2
  120. package/src/generators/remote/remote.js +52 -49
  121. package/src/generators/scam/lib/convert-component-to-scam.js +1 -2
  122. package/src/generators/scam/lib/normalize-options.js +11 -4
  123. package/src/generators/scam/scam.js +15 -12
  124. package/src/generators/scam-directive/lib/normalize-options.js +12 -4
  125. package/src/generators/scam-directive/scam-directive.js +13 -10
  126. package/src/generators/scam-pipe/lib/normalize-options.js +12 -4
  127. package/src/generators/scam-pipe/scam-pipe.js +13 -10
  128. package/src/generators/scam-to-standalone/scam-to-standalone.js +23 -26
  129. package/src/generators/setup-mf/lib/add-cypress-workaround.js +1 -1
  130. package/src/generators/setup-mf/lib/add-remote-to-host.js +4 -1
  131. package/src/generators/setup-mf/lib/change-build-target.js +10 -4
  132. package/src/generators/setup-mf/lib/generate-config.js +1 -1
  133. package/src/generators/setup-mf/lib/get-remotes-with-ports.js +1 -2
  134. package/src/generators/setup-mf/lib/normalize-options.js +5 -2
  135. package/src/generators/setup-mf/lib/set-tsconfig-target.js +7 -1
  136. package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +1 -2
  137. package/src/generators/setup-mf/lib/setup-serve-target.js +10 -3
  138. package/src/generators/setup-mf/setup-mf.js +32 -35
  139. package/src/generators/setup-ssr/lib/generate-files.js +8 -5
  140. package/src/generators/setup-ssr/lib/normalize-options.js +9 -10
  141. package/src/generators/setup-ssr/lib/update-project-config.js +21 -17
  142. package/src/generators/setup-ssr/setup-ssr.js +26 -27
  143. package/src/generators/setup-tailwind/lib/add-tailwind-config-path-to-project.js +6 -4
  144. package/src/generators/setup-tailwind/lib/detect-tailwind-installed-version.js +1 -2
  145. package/src/generators/setup-tailwind/lib/normalize-options.js +4 -1
  146. package/src/generators/setup-tailwind/lib/update-application-styles.js +5 -6
  147. package/src/generators/setup-tailwind/setup-tailwind.js +20 -23
  148. package/src/generators/stories/lib/get-e2e-project.js +1 -1
  149. package/src/generators/stories/stories.js +43 -50
  150. package/src/generators/storybook-configuration/lib/assert-compatible-storybook-version.js +1 -1
  151. package/src/generators/storybook-configuration/lib/generate-stories.js +10 -13
  152. package/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +12 -15
  153. package/src/generators/storybook-configuration/storybook-configuration.js +20 -16
  154. package/src/generators/utils/create-ts-config.js +1 -1
  155. package/src/generators/utils/entry-point.js +1 -2
  156. package/src/generators/utils/export-scam.js +1 -1
  157. package/src/generators/utils/insert-ngmodule-import.js +1 -1
  158. package/src/generators/utils/path.js +3 -3
  159. package/src/generators/utils/project.js +2 -3
  160. package/src/generators/utils/selector.js +1 -1
  161. package/src/generators/utils/storybook-ast/component-info.js +1 -2
  162. package/src/generators/utils/storybook-ast/entry-point.js +1 -2
  163. package/src/generators/utils/storybook-ast/module-info.js +1 -2
  164. package/src/generators/utils/storybook-ast/tree-utilities.js +1 -1
  165. package/src/generators/utils/testing.js +141 -139
  166. package/src/generators/utils/validations.js +1 -1
  167. package/src/generators/utils/version-utils.js +5 -7
  168. package/src/generators/web-worker/lib/normalize-options.js +6 -3
  169. package/src/generators/web-worker/web-worker.js +25 -28
  170. package/src/migrations/update-14-2-0/remove-show-circular-dependencies-option.js +10 -13
  171. package/src/migrations/update-14-2-0/update-angular-cli.js +14 -18
  172. package/src/migrations/update-14-2-0/update-libraries-secondary-entrypoints.js +22 -26
  173. package/src/migrations/update-14-2-0/update-ngcc-target.js +10 -14
  174. package/src/migrations/update-14-2-0/update-router-initial-navigation.js +31 -39
  175. package/src/migrations/update-14-2-0/update-tsconfig-target.js +48 -56
  176. package/src/migrations/update-14-5-0/migrate-mfe-to-mf.js +14 -17
  177. package/src/migrations/update-14-5-2/update-angular-cli.js +14 -18
  178. package/src/migrations/update-14-6-0/update-angular-cli.js +14 -18
  179. package/src/migrations/update-15-0-0/add-karma-inputs.js +27 -32
  180. package/src/migrations/update-15-0-0/switch-to-jasmine-marbles.js +62 -68
  181. package/src/migrations/update-15-2-0/remove-browserlist-config.js +34 -37
  182. package/src/migrations/update-15-2-0/remove-platform-server-exports.js +49 -52
  183. package/src/migrations/update-15-2-0/update-angular-cli.js +14 -18
  184. package/src/migrations/update-15-2-0/update-karma-main-file.js +11 -12
  185. package/src/migrations/update-15-2-0/update-typescript-target.js +40 -39
  186. package/src/migrations/update-15-2-0/update-workspace-config.js +16 -19
  187. package/src/migrations/update-15-5-0/update-angular-cli.js +14 -18
  188. package/src/migrations/update-15-7-0/install-required-packages.js +26 -28
  189. package/src/migrations/update-15-8-0/update-angular-cli.js +14 -18
  190. package/src/migrations/update-15-9-0/update-file-server-executor.js +31 -35
  191. package/src/migrations/update-15-9-0/update-testing-tsconfig.js +17 -22
  192. package/src/migrations/update-16-0-0/remove-karma-defaults.js +15 -18
  193. package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.js +22 -25
  194. package/src/migrations/update-16-0-0/remove-protractor-defaults.js +15 -18
  195. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +3 -6
  196. package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.js +38 -42
  197. package/src/migrations/update-16-1-0/remove-ngcc-invocation.js +15 -19
  198. package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +49 -52
  199. package/src/migrations/update-16-1-0/update-angular-cli.js +14 -18
  200. package/src/migrations/update-16-1-0/update-server-executor-config.js +13 -16
  201. package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +25 -29
  202. package/src/migrations/update-16-4-0/rename-angular-eslint-accesibility-rules.js +13 -16
  203. package/src/migrations/update-16-4-0/update-angular-cli.js +14 -18
  204. package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.js +19 -24
  205. package/src/migrations/update-16-7-0/update-angular-cli.js +14 -18
  206. package/src/migrations/utils/projects.js +9 -15
  207. package/src/utils/get-mf-projects.js +1 -2
  208. package/src/utils/mf/utils.js +43 -44
  209. package/src/utils/mf/with-module-federation-ssr.js +39 -24
  210. package/src/utils/mf/with-module-federation.js +40 -21
  211. package/src/utils/nx-devkit/ast-utils.js +2 -3
  212. package/src/utils/version-utils.js +2 -4
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AngularEslintLintMigrator = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  const linter_1 = require("@nx/linter");
7
6
  const path_1 = require("path");
@@ -11,13 +10,13 @@ class AngularEslintLintMigrator extends builder_migrator_1.BuilderMigrator {
11
10
  super(tree, '@angular-eslint/builder:lint', 'eslint', project, projectConfig, logger);
12
11
  }
13
12
  migrate() {
14
- var _a, _b;
15
13
  if (this.skipMigration) {
16
14
  return;
17
15
  }
18
16
  for (const [name, target] of this.targets) {
19
17
  this.oldEsLintConfigPath =
20
- (_b = (_a = target.options) === null || _a === void 0 ? void 0 : _a.eslintConfig) !== null && _b !== void 0 ? _b : (0, devkit_1.joinPathFragments)(this.project.oldRoot, '.eslintrc.json');
18
+ target.options?.eslintConfig ??
19
+ (0, devkit_1.joinPathFragments)(this.project.oldRoot, '.eslintrc.json');
21
20
  this.newEsLintConfigPath = this.convertRootPath(this.oldEsLintConfigPath);
22
21
  this.moveProjectRootFile(this.oldEsLintConfigPath);
23
22
  this.updateTargetConfiguration(name, target);
@@ -34,42 +33,42 @@ class AngularEslintLintMigrator extends builder_migrator_1.BuilderMigrator {
34
33
  }
35
34
  }
36
35
  }
37
- updateTargetConfiguration(targetName, target) {
38
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
39
- target.executor = '@nx/linter:eslint';
40
- if (!target.options) {
41
- this.logger.warn(`The target "${targetName}" is not specifying any options. Skipping updating the target configuration.`);
42
- return;
43
- }
44
- const existEsLintConfigPath = this.tree.exists(this.newEsLintConfigPath);
45
- if (!existEsLintConfigPath) {
46
- this.logger.warn(`The ESLint config file "${this.oldEsLintConfigPath}" could not be found. Skipping updating the file.`);
47
- }
48
- target.options.eslintConfig =
49
- target.options.eslintConfig && this.newEsLintConfigPath;
50
- target.options.lintFilePatterns =
51
- target.options.lintFilePatterns &&
52
- target.options.lintFilePatterns.map((pattern) => {
53
- // replace the old source root with the new root, we want to lint all
54
- // matching files in the project, not just the ones in the source root
55
- if (pattern.startsWith(this.project.oldSourceRoot)) {
56
- return (0, devkit_1.joinPathFragments)(this.project.newRoot, pattern.replace(this.project.oldSourceRoot, ''));
57
- }
58
- // replace the old root with the new root
59
- if (pattern.startsWith(this.project.oldRoot)) {
60
- return (0, devkit_1.joinPathFragments)(this.project.newRoot, pattern.replace(this.project.oldRoot, ''));
61
- }
62
- // do nothing, warn about the pattern
63
- 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.`);
64
- return pattern;
65
- });
66
- if (existEsLintConfigPath) {
67
- const eslintConfig = (0, devkit_1.readJson)(this.tree, this.newEsLintConfigPath);
68
- if ((0, linter_1.hasRulesRequiringTypeChecking)(eslintConfig)) {
69
- target.options.hasTypeAwareRules = true;
70
- }
36
+ async updateTargetConfiguration(targetName, target) {
37
+ target.executor = '@nx/linter:eslint';
38
+ if (!target.options) {
39
+ this.logger.warn(`The target "${targetName}" is not specifying any options. Skipping updating the target configuration.`);
40
+ return;
41
+ }
42
+ const existEsLintConfigPath = this.tree.exists(this.newEsLintConfigPath);
43
+ if (!existEsLintConfigPath) {
44
+ this.logger.warn(`The ESLint config file "${this.oldEsLintConfigPath}" could not be found. Skipping updating the file.`);
45
+ }
46
+ target.options.eslintConfig =
47
+ target.options.eslintConfig && this.newEsLintConfigPath;
48
+ target.options.lintFilePatterns =
49
+ target.options.lintFilePatterns &&
50
+ target.options.lintFilePatterns.map((pattern) => {
51
+ // replace the old source root with the new root, we want to lint all
52
+ // matching files in the project, not just the ones in the source root
53
+ if (pattern.startsWith(this.project.oldSourceRoot)) {
54
+ return (0, devkit_1.joinPathFragments)(this.project.newRoot, pattern.replace(this.project.oldSourceRoot, ''));
55
+ }
56
+ // replace the old root with the new root
57
+ if (pattern.startsWith(this.project.oldRoot)) {
58
+ return (0, devkit_1.joinPathFragments)(this.project.newRoot, pattern.replace(this.project.oldRoot, ''));
59
+ }
60
+ // do nothing, warn about the pattern
61
+ 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.`);
62
+ return pattern;
63
+ });
64
+ if (existEsLintConfigPath) {
65
+ const eslintConfig = (0, devkit_1.readJson)(this.tree, this.newEsLintConfigPath);
66
+ if ((0, linter_1.hasRulesRequiringTypeChecking)(eslintConfig)) {
67
+ target.options.hasTypeAwareRules = true;
71
68
  }
72
- (0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name, Object.assign({}, this.projectConfig));
69
+ }
70
+ (0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name, {
71
+ ...this.projectConfig,
73
72
  });
74
73
  }
75
74
  updateEsLintConfig() {
@@ -77,7 +76,6 @@ class AngularEslintLintMigrator extends builder_migrator_1.BuilderMigrator {
77
76
  return;
78
77
  }
79
78
  (0, devkit_1.updateJson)(this.tree, this.newEsLintConfigPath, (json) => {
80
- var _a;
81
79
  delete json.root;
82
80
  json.ignorePatterns = ['!**/*'];
83
81
  const rootEsLintConfigRelativePath = (0, devkit_1.joinPathFragments)((0, devkit_1.offsetFromRoot)(this.projectConfig.root), '.eslintrc.json');
@@ -91,9 +89,8 @@ class AngularEslintLintMigrator extends builder_migrator_1.BuilderMigrator {
91
89
  else {
92
90
  json.extends = rootEsLintConfigRelativePath;
93
91
  }
94
- (_a = json.overrides) === null || _a === void 0 ? void 0 : _a.forEach((override) => {
95
- var _a;
96
- if (!((_a = override.parserOptions) === null || _a === void 0 ? void 0 : _a.project)) {
92
+ json.overrides?.forEach((override) => {
93
+ if (!override.parserOptions?.project) {
97
94
  return;
98
95
  }
99
96
  override.parserOptions.project = [
@@ -33,8 +33,7 @@ class BuilderMigrator extends migrator_1.Migrator {
33
33
  return this.targets.size > 0;
34
34
  }
35
35
  collectBuilderTargets() {
36
- var _a;
37
- for (const [name, target] of Object.entries((_a = this.projectConfig.targets) !== null && _a !== void 0 ? _a : {})) {
36
+ for (const [name, target] of Object.entries(this.projectConfig.targets ?? {})) {
38
37
  if (target.executor === this.builderName) {
39
38
  this.targets.set(name, target);
40
39
  }
@@ -15,11 +15,11 @@ class Migrator {
15
15
  return this.convertSourceRootPath(asset);
16
16
  }
17
17
  else {
18
- return Object.assign(Object.assign({}, asset), { input: this.convertSourceRootPath(asset.input) });
18
+ return { ...asset, input: this.convertSourceRootPath(asset.input) };
19
19
  }
20
20
  }
21
21
  convertRootPath(originalPath) {
22
- return (originalPath === null || originalPath === void 0 ? void 0 : originalPath.startsWith(this.project.oldRoot))
22
+ return originalPath?.startsWith(this.project.oldRoot)
23
23
  ? (0, devkit_1.joinPathFragments)(this.project.newRoot, originalPath.replace(this.project.oldRoot, ''))
24
24
  : originalPath;
25
25
  }
@@ -58,16 +58,14 @@ class Migrator {
58
58
  }
59
59
  // TODO(leo): This should be moved to BuilderMigrator once everything is split into builder migrators.
60
60
  updateCacheableOperations(targetNames) {
61
- var _a;
62
61
  if (!targetNames.length) {
63
62
  return;
64
63
  }
65
64
  const nxJson = (0, devkit_1.readNxJson)(this.tree);
66
- Object.keys((_a = nxJson.tasksRunnerOptions) !== null && _a !== void 0 ? _a : {}).forEach((taskRunnerName) => {
67
- var _a;
65
+ Object.keys(nxJson.tasksRunnerOptions ?? {}).forEach((taskRunnerName) => {
68
66
  const taskRunner = nxJson.tasksRunnerOptions[taskRunnerName];
69
67
  taskRunner.options.cacheableOperations = Array.from(new Set([
70
- ...((_a = taskRunner.options.cacheableOperations) !== null && _a !== void 0 ? _a : []),
68
+ ...(taskRunner.options.cacheableOperations ?? []),
71
69
  ...targetNames,
72
70
  ]));
73
71
  });
@@ -76,26 +74,24 @@ class Migrator {
76
74
  // TODO(leo): This should be moved to BuilderMigrator once everything is split into builder migrators.
77
75
  updateTsConfigFile(tsConfigPath, rootTsConfigFile, projectOffsetFromRoot) {
78
76
  (0, devkit_1.updateJson)(this.tree, tsConfigPath, (json) => {
79
- var _a;
80
77
  json.extends = `${projectOffsetFromRoot}${rootTsConfigFile}`;
81
- json.compilerOptions = (_a = json.compilerOptions) !== null && _a !== void 0 ? _a : {};
78
+ json.compilerOptions = json.compilerOptions ?? {};
82
79
  json.compilerOptions.outDir = `${projectOffsetFromRoot}dist/out-tsc`;
83
80
  return json;
84
81
  });
85
82
  }
86
83
  convertSourceRootPath(originalPath) {
87
- return (originalPath === null || originalPath === void 0 ? void 0 : originalPath.startsWith(this.project.oldSourceRoot))
84
+ return originalPath?.startsWith(this.project.oldSourceRoot)
88
85
  ? (0, devkit_1.joinPathFragments)(this.project.newSourceRoot, originalPath.replace(this.project.oldSourceRoot, ''))
89
86
  : originalPath;
90
87
  }
91
88
  getTargetValuesForOption(target, optionPath) {
92
- var _a;
93
89
  const values = new Set();
94
90
  const value = this.getValueForOption(target.options, optionPath);
95
91
  if (value) {
96
92
  values.add(value);
97
93
  }
98
- for (const configuration of Object.values((_a = target.configurations) !== null && _a !== void 0 ? _a : {})) {
94
+ for (const configuration of Object.values(target.configurations ?? {})) {
99
95
  const value = this.getValueForOption(configuration, optionPath);
100
96
  if (value) {
101
97
  values.add(value);
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AppMigrator = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  const js_1 = require("@nx/js");
7
6
  const path_1 = require("path");
@@ -37,35 +36,28 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
37
36
  ? Object.keys(eslintBuilderMigrator.targets)[0]
38
37
  : undefined);
39
38
  }
40
- migrate() {
41
- const _super = Object.create(null, {
42
- migrate: { get: () => super.migrate }
43
- });
44
- var _a;
45
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
46
- if (this.skipMigration === true) {
47
- return;
48
- }
49
- yield _super.migrate.call(this);
50
- this.updateProjectConfiguration();
51
- yield this.e2eMigrator.migrate();
52
- this.moveProjectFiles();
53
- this.updateProjectConfigurationTargets();
54
- for (const builderMigrator of (_a = this.builderMigrators) !== null && _a !== void 0 ? _a : []) {
55
- yield builderMigrator.migrate();
56
- }
57
- this.updateTsConfigs();
58
- this.setCacheableOperations();
59
- });
39
+ async migrate() {
40
+ if (this.skipMigration === true) {
41
+ return;
42
+ }
43
+ await super.migrate();
44
+ this.updateProjectConfiguration();
45
+ await this.e2eMigrator.migrate();
46
+ this.moveProjectFiles();
47
+ this.updateProjectConfigurationTargets();
48
+ for (const builderMigrator of this.builderMigrators ?? []) {
49
+ await builderMigrator.migrate();
50
+ }
51
+ this.updateTsConfigs();
52
+ this.setCacheableOperations();
60
53
  }
61
54
  validate() {
62
- var _a, _b, _c;
63
55
  const errors = [
64
- ...((_a = super.validate()) !== null && _a !== void 0 ? _a : []),
65
- ...((_b = this.e2eMigrator.validate()) !== null && _b !== void 0 ? _b : []),
56
+ ...(super.validate() ?? []),
57
+ ...(this.e2eMigrator.validate() ?? []),
66
58
  ];
67
59
  for (const builderMigrator of this.builderMigrators) {
68
- errors.push(...((_c = builderMigrator.validate()) !== null && _c !== void 0 ? _c : []));
60
+ errors.push(...(builderMigrator.validate() ?? []));
69
61
  }
70
62
  return errors.length ? errors : null;
71
63
  }
@@ -105,7 +97,9 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
105
97
  this.moveFile((0, devkit_1.joinPathFragments)(this.project.oldRoot, 'project.json'), (0, devkit_1.joinPathFragments)(this.project.newRoot, 'project.json'));
106
98
  this.projectConfig.root = this.project.newRoot;
107
99
  this.projectConfig.sourceRoot = this.project.newSourceRoot;
108
- (0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name, Object.assign({}, this.projectConfig));
100
+ (0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name, {
101
+ ...this.projectConfig,
102
+ });
109
103
  }
110
104
  updateProjectConfigurationTargets() {
111
105
  if (!this.projectConfig.targets ||
@@ -117,7 +111,9 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
117
111
  this.updateServerTargetConfiguration();
118
112
  this.updatePrerenderTargetConfiguration();
119
113
  this.updateServeSsrTargetConfiguration();
120
- (0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name, Object.assign({}, this.projectConfig));
114
+ (0, devkit_1.updateProjectConfiguration)(this.tree, this.project.name, {
115
+ ...this.projectConfig,
116
+ });
121
117
  }
122
118
  updateTsConfigs() {
123
119
  const rootTsConfigFile = (0, js_1.getRootTsConfigPathInTree)(this.tree);
@@ -174,7 +170,6 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
174
170
  }));
175
171
  }
176
172
  updateBuildTargetConfiguration() {
177
- var _a, _b, _c, _d, _e, _f;
178
173
  if (!this.targetNames.build) {
179
174
  this.logger.warn('There is no build target in the project configuration. Skipping updating the build target configuration.');
180
175
  return;
@@ -189,7 +184,8 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
189
184
  this.logger.warn(`The target "${this.targetNames.build}" is not specifying any options or configurations. Skipping updating the target configuration.`);
190
185
  return;
191
186
  }
192
- const buildDevTsConfig = (_b = (_a = buildTarget.options) === null || _a === void 0 ? void 0 : _a.tsConfig) !== null && _b !== void 0 ? _b : (_d = (_c = buildTarget.configurations) === null || _c === void 0 ? void 0 : _c.development) === null || _d === void 0 ? void 0 : _d.tsConfig;
187
+ const buildDevTsConfig = buildTarget.options?.tsConfig ??
188
+ buildTarget.configurations?.development?.tsConfig;
193
189
  if (!buildDevTsConfig) {
194
190
  this.logger.warn(`The "${this.targetNames.build}" target does not have the "tsConfig" option configured. Skipping updating the tsConfig file.`);
195
191
  }
@@ -199,8 +195,8 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
199
195
  this.logger.warn(`The tsConfig file "${buildDevTsConfig}" specified in the "${this.targetNames.build}" target could not be found. Skipping updating the tsConfig file.`);
200
196
  }
201
197
  }
202
- this.convertBuildOptions((_e = buildTarget.options) !== null && _e !== void 0 ? _e : {});
203
- Object.values((_f = buildTarget.configurations) !== null && _f !== void 0 ? _f : {}).forEach((config) => this.convertBuildOptions(config));
198
+ this.convertBuildOptions(buildTarget.options ?? {});
199
+ Object.values(buildTarget.configurations ?? {}).forEach((config) => this.convertBuildOptions(config));
204
200
  }
205
201
  updatePrerenderTargetConfiguration() {
206
202
  if (!this.targetNames.prerender ||
@@ -217,7 +213,6 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
217
213
  this.convertPath(prerenderTarget.options.routesFile);
218
214
  }
219
215
  updateServerTargetConfiguration() {
220
- var _a, _b, _c, _d, _e, _f;
221
216
  if (!this.targetNames.server ||
222
217
  this.shouldSkipTargetTypeMigration('server')) {
223
218
  return;
@@ -229,7 +224,8 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
229
224
  this.logger.warn(`The target "${this.targetNames.server}" is not specifying any options or configurations. Skipping updating the target configuration.`);
230
225
  return;
231
226
  }
232
- const serverDevTsConfig = (_b = (_a = serverTarget.options) === null || _a === void 0 ? void 0 : _a.tsConfig) !== null && _b !== void 0 ? _b : (_d = (_c = serverTarget.configurations) === null || _c === void 0 ? void 0 : _c.development) === null || _d === void 0 ? void 0 : _d.tsConfig;
227
+ const serverDevTsConfig = serverTarget.options?.tsConfig ??
228
+ serverTarget.configurations?.development?.tsConfig;
233
229
  if (!serverDevTsConfig) {
234
230
  this.logger.warn(`The "${this.targetNames.server}" target does not have the "tsConfig" option configured. Skipping updating the tsConfig file.`);
235
231
  }
@@ -239,8 +235,8 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
239
235
  this.logger.warn(`The tsConfig file "${serverDevTsConfig}" specified in the "${this.targetNames.server}" target could not be found. Skipping updating the tsConfig file.`);
240
236
  }
241
237
  }
242
- this.convertServerOptions((_e = serverTarget.options) !== null && _e !== void 0 ? _e : {});
243
- Object.values((_f = serverTarget.configurations) !== null && _f !== void 0 ? _f : {}).forEach((config) => this.convertServerOptions(config));
238
+ this.convertServerOptions(serverTarget.options ?? {});
239
+ Object.values(serverTarget.configurations ?? {}).forEach((config) => this.convertServerOptions(config));
244
240
  }
245
241
  updateServeSsrTargetConfiguration() {
246
242
  if (!this.targetNames.serveSsr ||
@@ -255,13 +251,12 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
255
251
  return;
256
252
  }
257
253
  ['sslKey', 'sslCert', 'proxyConfig'].forEach((option) => {
258
- var _a;
259
254
  if (serveSsrTarget.options) {
260
255
  serveSsrTarget.options[option] =
261
256
  serveSsrTarget.options[option] &&
262
257
  this.convertPath(serveSsrTarget.options[option]);
263
258
  }
264
- for (const configuration of Object.values((_a = serveSsrTarget.configurations) !== null && _a !== void 0 ? _a : {})) {
259
+ for (const configuration of Object.values(serveSsrTarget.configurations ?? {})) {
265
260
  serveSsrTarget.configurations[configuration][option] =
266
261
  serveSsrTarget.configurations[configuration][option] &&
267
262
  this.convertPath(serveSsrTarget.configurations[configuration][option]);
@@ -269,12 +264,13 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
269
264
  });
270
265
  }
271
266
  updateTsConfigFileUsedByBuildTarget(rootTsConfigFile, projectOffsetFromRoot) {
272
- var _a, _b, _c, _d;
273
267
  if (!this.targetNames.build ||
274
268
  this.shouldSkipTargetTypeMigration('build')) {
275
269
  return;
276
270
  }
277
- const tsConfigPath = (_b = (_a = this.projectConfig.targets[this.targetNames.build].options) === null || _a === void 0 ? void 0 : _a.tsConfig) !== null && _b !== void 0 ? _b : (_d = (_c = this.projectConfig.targets[this.targetNames.build].configurations) === null || _c === void 0 ? void 0 : _c.development) === null || _d === void 0 ? void 0 : _d.tsConfig;
271
+ const tsConfigPath = this.projectConfig.targets[this.targetNames.build].options?.tsConfig ??
272
+ this.projectConfig.targets[this.targetNames.build].configurations
273
+ ?.development?.tsConfig;
278
274
  if (!tsConfigPath || !this.tree.exists(tsConfigPath)) {
279
275
  // we already logged a warning for these cases, so just return
280
276
  return;
@@ -282,19 +278,19 @@ class AppMigrator extends project_migrator_1.ProjectMigrator {
282
278
  this.updateTsConfigFile(tsConfigPath, rootTsConfigFile, projectOffsetFromRoot);
283
279
  }
284
280
  updateTsConfigFileUsedByServerTarget(projectOffsetFromRoot) {
285
- var _a, _b, _c, _d;
286
281
  if (!this.targetNames.server ||
287
282
  this.shouldSkipTargetTypeMigration('server')) {
288
283
  return;
289
284
  }
290
- const tsConfigPath = (_b = (_a = this.projectConfig.targets[this.targetNames.server].options) === null || _a === void 0 ? void 0 : _a.tsConfig) !== null && _b !== void 0 ? _b : (_d = (_c = this.projectConfig.targets[this.targetNames.server].configurations) === null || _c === void 0 ? void 0 : _c.development) === null || _d === void 0 ? void 0 : _d.tsConfig;
285
+ const tsConfigPath = this.projectConfig.targets[this.targetNames.server].options?.tsConfig ??
286
+ this.projectConfig.targets[this.targetNames.server].configurations
287
+ ?.development?.tsConfig;
291
288
  if (!tsConfigPath || !this.tree.exists(tsConfigPath)) {
292
289
  // we already logged a warning for these cases, so just return
293
290
  return;
294
291
  }
295
292
  (0, devkit_1.updateJson)(this.tree, tsConfigPath, (json) => {
296
- var _a;
297
- json.compilerOptions = (_a = json.compilerOptions) !== null && _a !== void 0 ? _a : {};
293
+ json.compilerOptions = json.compilerOptions ?? {};
298
294
  json.compilerOptions.outDir = `${projectOffsetFromRoot}dist/out-tsc`;
299
295
  return json;
300
296
  });