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

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 (213) hide show
  1. package/mf/mf.js +31 -36
  2. package/package.json +10 -10
  3. package/plugins/component-testing.d.ts +0 -1
  4. package/plugins/component-testing.js +48 -40
  5. package/src/builders/module-federation-dev-server/module-federation-dev-server.impl.js +4 -6
  6. package/src/builders/module-federation-dev-ssr/module-federation-dev-ssr.impl.js +4 -6
  7. package/src/builders/utilities/buildable-libs.js +1 -2
  8. package/src/builders/utilities/module-federation.js +2 -3
  9. package/src/builders/utilities/webpack.js +16 -21
  10. package/src/builders/webpack-browser/webpack-browser.impl.js +13 -13
  11. package/src/builders/webpack-dev-server/lib/normalize-options.js +8 -1
  12. package/src/builders/webpack-dev-server/webpack-dev-server.impl.js +24 -18
  13. package/src/builders/webpack-server/webpack-server.impl.js +5 -7
  14. package/src/executors/browser-esbuild/browser-esbuild.impl.js +19 -23
  15. package/src/executors/browser-esbuild/lib/buildable-libs.js +1 -2
  16. package/src/executors/delegate-build/delegate-build.impl.js +9 -12
  17. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +4 -7
  18. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/entry-point.transform.js +4 -5
  19. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/write-package.transform.js +158 -156
  20. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/options.di.js +6 -3
  21. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.js +118 -118
  22. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/styles/stylesheet-processor.js +96 -103
  23. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ts/cache-compiler-host.js +20 -12
  24. package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.js +18 -21
  25. package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +6 -9
  26. package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.js +6 -3
  27. package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +122 -122
  28. package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +96 -103
  29. package/src/executors/package/ng-packagr-adjustments/ts/cache-compiler-host.js +21 -13
  30. package/src/executors/package/ng-packagr-adjustments/utils/ng-compiler-cli.js +5 -8
  31. package/src/executors/package/package.impl.js +33 -38
  32. package/src/executors/utilities/angular-version-utils.js +1 -1
  33. package/src/executors/utilities/tailwindcss.js +2 -2
  34. package/src/executors/utilities/typescript.js +23 -28
  35. package/src/generators/add-linting/add-linting.js +76 -74
  36. package/src/generators/add-linting/lib/create-eslint-configuration.js +12 -4
  37. package/src/generators/application/application.js +56 -55
  38. package/src/generators/application/lib/add-e2e.js +36 -40
  39. package/src/generators/application/lib/add-linting.js +12 -15
  40. package/src/generators/application/lib/add-proxy-config.js +4 -1
  41. package/src/generators/application/lib/add-unit-test-runner.js +15 -18
  42. package/src/generators/application/lib/create-files.js +44 -47
  43. package/src/generators/application/lib/enable-strict-type-checking.js +2 -2
  44. package/src/generators/application/lib/normalize-options.js +37 -25
  45. package/src/generators/application/lib/set-app-strict-default.js +1 -2
  46. package/src/generators/application/lib/update-editor-tsconfig.js +1 -2
  47. package/src/generators/component/component.js +40 -43
  48. package/src/generators/component/lib/normalize-options.js +15 -5
  49. package/src/generators/component-cypress-spec/component-cypress-spec.js +25 -28
  50. package/src/generators/component-story/component-story.js +19 -22
  51. package/src/generators/convert-to-with-mf/convert-to-with-mf.js +19 -22
  52. package/src/generators/convert-to-with-mf/lib/get-webpack-config-path.js +3 -4
  53. package/src/generators/convert-tslint-to-eslint/convert-tslint-to-eslint.js +103 -106
  54. package/src/generators/cypress-component-configuration/cypress-component-configuration.js +59 -62
  55. package/src/generators/directive/directive.js +21 -24
  56. package/src/generators/directive/lib/normalize-options.js +11 -5
  57. package/src/generators/host/host.js +77 -67
  58. package/src/generators/host/lib/add-ssr.js +32 -35
  59. package/src/generators/init/init.js +101 -92
  60. package/src/generators/library/lib/add-standalone-component.js +18 -13
  61. package/src/generators/library/lib/enable-strict-type-checking.js +17 -5
  62. package/src/generators/library/lib/normalize-options.js +68 -53
  63. package/src/generators/library/library.js +89 -92
  64. package/src/generators/library-secondary-entry-point/lib/add-files.js +5 -1
  65. package/src/generators/library-secondary-entry-point/lib/normalize-options.js +6 -3
  66. package/src/generators/library-secondary-entry-point/lib/update-linting-file-patterns.js +1 -2
  67. package/src/generators/library-secondary-entry-point/library-secondary-entry-point.js +6 -9
  68. package/src/generators/move/lib/normalize-schema.js +5 -1
  69. package/src/generators/move/lib/update-module-name.js +1 -1
  70. package/src/generators/move/lib/update-ng-package.js +1 -2
  71. package/src/generators/move/lib/update-secondary-entry-points.js +1 -2
  72. package/src/generators/move/move.js +9 -12
  73. package/src/generators/ng-add/migrate-from-angular-cli.js +54 -53
  74. package/src/generators/ng-add/migrators/builders/angular-devkit-karma.migrator.js +4 -3
  75. package/src/generators/ng-add/migrators/builders/angular-devkit-ng-packagr.migrator.js +11 -12
  76. package/src/generators/ng-add/migrators/builders/angular-eslint-lint.migrator.js +39 -42
  77. package/src/generators/ng-add/migrators/builders/builder.migrator.js +1 -2
  78. package/src/generators/ng-add/migrators/migrator.js +7 -11
  79. package/src/generators/ng-add/migrators/projects/app.migrator.js +39 -43
  80. package/src/generators/ng-add/migrators/projects/e2e.migrator.js +115 -91
  81. package/src/generators/ng-add/migrators/projects/lib.migrator.js +23 -31
  82. package/src/generators/ng-add/migrators/projects/project.migrator.js +10 -14
  83. package/src/generators/ng-add/ng-add.js +5 -8
  84. package/src/generators/ng-add/utilities/dependencies.js +2 -3
  85. package/src/generators/ng-add/utilities/format-files-task.js +1 -1
  86. package/src/generators/ng-add/utilities/projects.js +1 -1
  87. package/src/generators/ng-add/utilities/workspace.js +25 -36
  88. package/src/generators/ngrx/lib/add-imports-to-module.js +1 -2
  89. package/src/generators/ngrx/lib/add-ngrx-to-package-json.js +1 -3
  90. package/src/generators/ngrx/lib/generate-files.js +11 -2
  91. package/src/generators/ngrx/lib/normalize-options.js +9 -4
  92. package/src/generators/ngrx/lib/validate-options.js +3 -3
  93. package/src/generators/ngrx/ngrx.js +18 -21
  94. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.actions.ts__tmpl__ +1 -1
  95. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.effects.spec.ts__tmpl__ +2 -2
  96. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.effects.ts__tmpl__ +2 -2
  97. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.facade.spec.ts__tmpl__ +6 -6
  98. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.facade.ts__tmpl__ +3 -3
  99. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.reducer.spec.ts__tmpl__ +3 -3
  100. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.reducer.ts__tmpl__ +2 -2
  101. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.selectors.spec.ts__tmpl__ +3 -3
  102. package/src/generators/ngrx-feature-store/files/base/__directory__/__fileName__.selectors.ts__tmpl__ +1 -1
  103. package/src/generators/ngrx-feature-store/files/no-inject/__directory__/__fileName__.effects.ts__tmpl__ +2 -2
  104. package/src/generators/ngrx-feature-store/files/no-inject/__directory__/__fileName__.facade.ts__tmpl__ +3 -3
  105. package/src/generators/ngrx-feature-store/lib/add-exports-barrel.js +4 -1
  106. package/src/generators/ngrx-feature-store/lib/add-imports.js +1 -1
  107. package/src/generators/ngrx-feature-store/lib/add-ngrx-to-package-json.js +1 -3
  108. package/src/generators/ngrx-feature-store/lib/generate-files.js +20 -4
  109. package/src/generators/ngrx-feature-store/lib/normalize-options.d.ts +1 -0
  110. package/src/generators/ngrx-feature-store/lib/normalize-options.js +22 -3
  111. package/src/generators/ngrx-feature-store/lib/validate-options.js +2 -2
  112. package/src/generators/ngrx-feature-store/ngrx-feature-store.js +18 -21
  113. package/src/generators/ngrx-root-store/lib/add-ngrx-to-package-json.js +8 -6
  114. package/src/generators/ngrx-root-store/lib/normalize-options.js +8 -4
  115. package/src/generators/ngrx-root-store/lib/validate-options.js +2 -2
  116. package/src/generators/ngrx-root-store/ngrx-root-store.js +27 -30
  117. package/src/generators/pipe/lib/normalize-options.js +9 -3
  118. package/src/generators/pipe/pipe.js +21 -24
  119. package/src/generators/remote/lib/add-ssr.js +46 -47
  120. package/src/generators/remote/lib/find-next-available-port.js +1 -2
  121. package/src/generators/remote/remote.js +52 -49
  122. package/src/generators/scam/lib/convert-component-to-scam.js +1 -2
  123. package/src/generators/scam/lib/normalize-options.js +11 -4
  124. package/src/generators/scam/scam.js +15 -12
  125. package/src/generators/scam-directive/lib/normalize-options.js +12 -4
  126. package/src/generators/scam-directive/scam-directive.js +13 -10
  127. package/src/generators/scam-pipe/lib/normalize-options.js +12 -4
  128. package/src/generators/scam-pipe/scam-pipe.js +13 -10
  129. package/src/generators/scam-to-standalone/scam-to-standalone.js +23 -26
  130. package/src/generators/setup-mf/lib/add-cypress-workaround.js +1 -1
  131. package/src/generators/setup-mf/lib/add-remote-to-host.js +4 -1
  132. package/src/generators/setup-mf/lib/change-build-target.js +10 -4
  133. package/src/generators/setup-mf/lib/generate-config.js +1 -1
  134. package/src/generators/setup-mf/lib/get-remotes-with-ports.js +1 -2
  135. package/src/generators/setup-mf/lib/normalize-options.js +5 -2
  136. package/src/generators/setup-mf/lib/set-tsconfig-target.js +7 -1
  137. package/src/generators/setup-mf/lib/setup-host-if-dynamic.js +1 -2
  138. package/src/generators/setup-mf/lib/setup-serve-target.js +11 -4
  139. package/src/generators/setup-mf/setup-mf.js +32 -35
  140. package/src/generators/setup-ssr/lib/generate-files.js +8 -5
  141. package/src/generators/setup-ssr/lib/normalize-options.js +9 -10
  142. package/src/generators/setup-ssr/lib/update-project-config.js +21 -17
  143. package/src/generators/setup-ssr/setup-ssr.js +26 -27
  144. package/src/generators/setup-tailwind/lib/add-tailwind-config-path-to-project.js +6 -4
  145. package/src/generators/setup-tailwind/lib/detect-tailwind-installed-version.js +1 -2
  146. package/src/generators/setup-tailwind/lib/normalize-options.js +4 -1
  147. package/src/generators/setup-tailwind/lib/update-application-styles.js +5 -6
  148. package/src/generators/setup-tailwind/setup-tailwind.js +20 -23
  149. package/src/generators/stories/lib/get-e2e-project.js +1 -1
  150. package/src/generators/stories/stories.js +43 -50
  151. package/src/generators/storybook-configuration/lib/assert-compatible-storybook-version.js +1 -1
  152. package/src/generators/storybook-configuration/lib/generate-stories.js +10 -13
  153. package/src/generators/storybook-configuration/lib/generate-storybook-configuration.js +12 -15
  154. package/src/generators/storybook-configuration/storybook-configuration.js +20 -16
  155. package/src/generators/utils/create-ts-config.js +1 -1
  156. package/src/generators/utils/entry-point.js +1 -2
  157. package/src/generators/utils/export-scam.js +1 -1
  158. package/src/generators/utils/insert-ngmodule-import.js +1 -1
  159. package/src/generators/utils/path.js +3 -3
  160. package/src/generators/utils/project.js +2 -3
  161. package/src/generators/utils/selector.js +1 -1
  162. package/src/generators/utils/storybook-ast/component-info.js +1 -2
  163. package/src/generators/utils/storybook-ast/entry-point.js +1 -2
  164. package/src/generators/utils/storybook-ast/module-info.js +1 -2
  165. package/src/generators/utils/storybook-ast/tree-utilities.js +1 -1
  166. package/src/generators/utils/testing.js +141 -139
  167. package/src/generators/utils/validations.js +1 -1
  168. package/src/generators/utils/version-utils.js +5 -7
  169. package/src/generators/web-worker/lib/normalize-options.js +6 -3
  170. package/src/generators/web-worker/web-worker.js +25 -28
  171. package/src/migrations/update-14-2-0/remove-show-circular-dependencies-option.js +10 -13
  172. package/src/migrations/update-14-2-0/update-angular-cli.js +14 -18
  173. package/src/migrations/update-14-2-0/update-libraries-secondary-entrypoints.js +22 -26
  174. package/src/migrations/update-14-2-0/update-ngcc-target.js +10 -14
  175. package/src/migrations/update-14-2-0/update-router-initial-navigation.js +31 -39
  176. package/src/migrations/update-14-2-0/update-tsconfig-target.js +48 -56
  177. package/src/migrations/update-14-5-0/migrate-mfe-to-mf.js +14 -17
  178. package/src/migrations/update-14-5-2/update-angular-cli.js +14 -18
  179. package/src/migrations/update-14-6-0/update-angular-cli.js +14 -18
  180. package/src/migrations/update-15-0-0/add-karma-inputs.js +27 -32
  181. package/src/migrations/update-15-0-0/switch-to-jasmine-marbles.js +62 -68
  182. package/src/migrations/update-15-2-0/remove-browserlist-config.js +34 -37
  183. package/src/migrations/update-15-2-0/remove-platform-server-exports.js +49 -52
  184. package/src/migrations/update-15-2-0/update-angular-cli.js +14 -18
  185. package/src/migrations/update-15-2-0/update-karma-main-file.js +11 -12
  186. package/src/migrations/update-15-2-0/update-typescript-target.js +40 -39
  187. package/src/migrations/update-15-2-0/update-workspace-config.js +16 -19
  188. package/src/migrations/update-15-5-0/update-angular-cli.js +14 -18
  189. package/src/migrations/update-15-7-0/install-required-packages.js +26 -28
  190. package/src/migrations/update-15-8-0/update-angular-cli.js +14 -18
  191. package/src/migrations/update-15-9-0/update-file-server-executor.js +31 -35
  192. package/src/migrations/update-15-9-0/update-testing-tsconfig.js +17 -22
  193. package/src/migrations/update-16-0-0/remove-karma-defaults.js +15 -18
  194. package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.js +22 -25
  195. package/src/migrations/update-16-0-0/remove-protractor-defaults.js +15 -18
  196. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +3 -6
  197. package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.js +38 -42
  198. package/src/migrations/update-16-1-0/remove-ngcc-invocation.js +15 -19
  199. package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +49 -52
  200. package/src/migrations/update-16-1-0/update-angular-cli.js +14 -18
  201. package/src/migrations/update-16-1-0/update-server-executor-config.js +13 -16
  202. package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +25 -29
  203. package/src/migrations/update-16-4-0/rename-angular-eslint-accesibility-rules.js +13 -16
  204. package/src/migrations/update-16-4-0/update-angular-cli.js +14 -18
  205. package/src/migrations/update-16-6-0/explicitly-set-projects-to-update-buildable-deps.js +19 -24
  206. package/src/migrations/update-16-7-0/update-angular-cli.js +14 -18
  207. package/src/migrations/utils/projects.js +9 -15
  208. package/src/utils/get-mf-projects.js +1 -2
  209. package/src/utils/mf/utils.js +43 -44
  210. package/src/utils/mf/with-module-federation-ssr.js +39 -24
  211. package/src/utils/mf/with-module-federation.js +40 -21
  212. package/src/utils/nx-devkit/ast-utils.js +2 -3
  213. package/src/utils/version-utils.js +2 -4
@@ -1,21 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.scamDirectiveGenerator = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  const directive_1 = require("../directive/directive");
7
6
  const export_scam_1 = require("../utils/export-scam");
8
7
  const lib_1 = require("./lib");
9
- function scamDirectiveGenerator(tree, rawOptions) {
10
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
- (0, lib_1.validateOptions)(tree, rawOptions);
12
- const { inlineScam } = rawOptions, directiveOptions = tslib_1.__rest(rawOptions, ["inlineScam"]);
13
- yield (0, directive_1.directiveGenerator)(tree, Object.assign(Object.assign({}, directiveOptions), { skipImport: true, export: false, standalone: false, skipFormat: true }));
14
- const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
15
- (0, lib_1.convertDirectiveToScam)(tree, options);
16
- (0, export_scam_1.exportScam)(tree, options);
17
- yield (0, devkit_1.formatFiles)(tree);
8
+ async function scamDirectiveGenerator(tree, rawOptions) {
9
+ (0, lib_1.validateOptions)(tree, rawOptions);
10
+ const { inlineScam, ...directiveOptions } = rawOptions;
11
+ await (0, directive_1.directiveGenerator)(tree, {
12
+ ...directiveOptions,
13
+ skipImport: true,
14
+ export: false,
15
+ standalone: false,
16
+ skipFormat: true,
18
17
  });
18
+ const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
19
+ (0, lib_1.convertDirectiveToScam)(tree, options);
20
+ (0, export_scam_1.exportScam)(tree, options);
21
+ await (0, devkit_1.formatFiles)(tree);
19
22
  }
20
23
  exports.scamDirectiveGenerator = scamDirectiveGenerator;
21
24
  exports.default = scamDirectiveGenerator;
@@ -3,12 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeOptions = void 0;
4
4
  const path_1 = require("../../utils/path");
5
5
  function normalizeOptions(tree, options) {
6
- var _a, _b, _c;
7
- const { directory, fileName, filePath, name, path } = (0, path_1.normalizeNameAndPaths)(tree, Object.assign(Object.assign({}, options), { type: 'pipe' }));
8
- return Object.assign(Object.assign({}, options), { export: (_a = options.export) !== null && _a !== void 0 ? _a : true, flat: (_b = options.flat) !== null && _b !== void 0 ? _b : true, inlineScam: (_c = options.inlineScam) !== null && _c !== void 0 ? _c : true, directory,
6
+ const { directory, fileName, filePath, name, path } = (0, path_1.normalizeNameAndPaths)(tree, {
7
+ ...options,
8
+ type: 'pipe',
9
+ });
10
+ return {
11
+ ...options,
12
+ export: options.export ?? true,
13
+ flat: options.flat ?? true,
14
+ inlineScam: options.inlineScam ?? true,
15
+ directory,
9
16
  fileName,
10
17
  filePath,
11
18
  name,
12
- path });
19
+ path,
20
+ };
13
21
  }
14
22
  exports.normalizeOptions = normalizeOptions;
@@ -1,21 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.scamPipeGenerator = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  const pipe_1 = require("../pipe/pipe");
7
6
  const export_scam_1 = require("../utils/export-scam");
8
7
  const lib_1 = require("./lib");
9
- function scamPipeGenerator(tree, rawOptions) {
10
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
- (0, lib_1.validateOptions)(tree, rawOptions);
12
- const { inlineScam } = rawOptions, pipeOptions = tslib_1.__rest(rawOptions, ["inlineScam"]);
13
- yield (0, pipe_1.pipeGenerator)(tree, Object.assign(Object.assign({}, pipeOptions), { skipImport: true, export: false, standalone: false, skipFormat: true }));
14
- const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
15
- (0, lib_1.convertPipeToScam)(tree, options);
16
- (0, export_scam_1.exportScam)(tree, options);
17
- yield (0, devkit_1.formatFiles)(tree);
8
+ async function scamPipeGenerator(tree, rawOptions) {
9
+ (0, lib_1.validateOptions)(tree, rawOptions);
10
+ const { inlineScam, ...pipeOptions } = rawOptions;
11
+ await (0, pipe_1.pipeGenerator)(tree, {
12
+ ...pipeOptions,
13
+ skipImport: true,
14
+ export: false,
15
+ standalone: false,
16
+ skipFormat: true,
18
17
  });
18
+ const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
19
+ (0, lib_1.convertPipeToScam)(tree, options);
20
+ (0, export_scam_1.exportScam)(tree, options);
21
+ await (0, devkit_1.formatFiles)(tree);
19
22
  }
20
23
  exports.scamPipeGenerator = scamPipeGenerator;
21
24
  exports.default = scamPipeGenerator;
@@ -1,37 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.scamToStandalone = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  const lib_1 = require("./lib");
7
6
  const version_utils_1 = require("../utils/version-utils");
8
7
  const semver_1 = require("semver");
9
- function scamToStandalone(tree, { component, project: projectName, skipFormat }) {
10
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
- const installedAngularVersionInfo = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
12
- if ((0, semver_1.lt)(installedAngularVersionInfo.version, '14.1.0')) {
13
- throw new Error((0, devkit_1.stripIndents) `This generator is only supported with Angular >= 14.1.0. You are currently using ${installedAngularVersionInfo.version}.
8
+ async function scamToStandalone(tree, { component, project: projectName, skipFormat }) {
9
+ const installedAngularVersionInfo = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
10
+ if ((0, semver_1.lt)(installedAngularVersionInfo.version, '14.1.0')) {
11
+ throw new Error((0, devkit_1.stripIndents) `This generator is only supported with Angular >= 14.1.0. You are currently using ${installedAngularVersionInfo.version}.
14
12
  You can resolve this error by migrating to Angular 14.1.0.`);
15
- }
16
- const projects = (0, devkit_1.getProjects)(tree);
17
- let project = (0, lib_1.getTargetProject)(projectName, projects);
18
- const normalizedComponentPath = (0, devkit_1.joinPathFragments)(project.root, component);
19
- if (!tree.exists(normalizedComponentPath)) {
20
- throw new Error(`The path provided to the component (${normalizedComponentPath}) does not exist. Please ensure the correct path has been provided.`);
21
- }
22
- const { componentFileContents, componentAST, componentName } = (0, lib_1.getComponentDataFromAST)(tree, normalizedComponentPath);
23
- const isInlineScam = (0, lib_1.verifyIsInlineScam)(componentAST);
24
- if (!isInlineScam) {
25
- throw new Error('This generator currently only supports inline SCAMs. We could not find an accompanying NgModule within the component file, please ensure the SCAM provided is an inline scam.');
26
- }
27
- const { moduleNodes, exportsArray, importsArray, declarationsArray, providersArray, moduleName, } = (0, lib_1.getModuleMetadataFromAST)(componentAST, componentFileContents);
28
- (0, lib_1.verifyModuleIsScam)(exportsArray, componentName, declarationsArray);
29
- (0, lib_1.convertScamToStandalone)(componentAST, componentFileContents, importsArray, providersArray, moduleNodes, tree, normalizedComponentPath, componentName);
30
- (0, lib_1.replaceModuleUsagesWithComponent)(tree, moduleName, componentName);
31
- if (!skipFormat) {
32
- yield (0, devkit_1.formatFiles)(tree);
33
- }
34
- });
13
+ }
14
+ const projects = (0, devkit_1.getProjects)(tree);
15
+ let project = (0, lib_1.getTargetProject)(projectName, projects);
16
+ const normalizedComponentPath = (0, devkit_1.joinPathFragments)(project.root, component);
17
+ if (!tree.exists(normalizedComponentPath)) {
18
+ throw new Error(`The path provided to the component (${normalizedComponentPath}) does not exist. Please ensure the correct path has been provided.`);
19
+ }
20
+ const { componentFileContents, componentAST, componentName } = (0, lib_1.getComponentDataFromAST)(tree, normalizedComponentPath);
21
+ const isInlineScam = (0, lib_1.verifyIsInlineScam)(componentAST);
22
+ if (!isInlineScam) {
23
+ throw new Error('This generator currently only supports inline SCAMs. We could not find an accompanying NgModule within the component file, please ensure the SCAM provided is an inline scam.');
24
+ }
25
+ const { moduleNodes, exportsArray, importsArray, declarationsArray, providersArray, moduleName, } = (0, lib_1.getModuleMetadataFromAST)(componentAST, componentFileContents);
26
+ (0, lib_1.verifyModuleIsScam)(exportsArray, componentName, declarationsArray);
27
+ (0, lib_1.convertScamToStandalone)(componentAST, componentFileContents, importsArray, providersArray, moduleNodes, tree, normalizedComponentPath, componentName);
28
+ (0, lib_1.replaceModuleUsagesWithComponent)(tree, moduleName, componentName);
29
+ if (!skipFormat) {
30
+ await (0, devkit_1.formatFiles)(tree);
31
+ }
35
32
  }
36
33
  exports.scamToStandalone = scamToStandalone;
37
34
  exports.default = scamToStandalone;
@@ -14,7 +14,7 @@ function addCypressOnErrorWorkaround(tree, schema) {
14
14
  try {
15
15
  e2eProject = (0, devkit_1.readProjectConfiguration)(tree, e2eProjectName);
16
16
  }
17
- catch (_a) {
17
+ catch {
18
18
  devkit_1.logger.warn((0, devkit_1.stripIndents) `Could not find an associated e2e project for ${schema.appName} with name ${e2eProjectName}.
19
19
  If there is an associated e2e project for this application, and it uses Cypress, you will need to add a workaround to allow Cypress to test correctly.
20
20
  An error will be thrown in the console when you serve the application, coming from styles.js. It is an error that can be safely ignored and will not reach production due to how production builds of Angular are created.
@@ -55,7 +55,10 @@ function addRemoteToStaticHost(tree, options, hostProject) {
55
55
  }
56
56
  function addRemoteToDynamicHost(tree, options, pathToMfManifest) {
57
57
  (0, devkit_1.updateJson)(tree, pathToMfManifest, (manifest) => {
58
- return Object.assign(Object.assign({}, manifest), { [options.appName]: `http://localhost:${options.port}` });
58
+ return {
59
+ ...manifest,
60
+ [options.appName]: `http://localhost:${options.port}`,
61
+ };
59
62
  });
60
63
  }
61
64
  // TODO(colum): future work: allow dev to pass to path to routing module
@@ -5,12 +5,18 @@ const devkit_1 = require("@nx/devkit");
5
5
  function changeBuildTarget(host, options) {
6
6
  const appConfig = (0, devkit_1.readProjectConfiguration)(host, options.appName);
7
7
  appConfig.targets.build.executor = '@nx/angular:webpack-browser';
8
- appConfig.targets.build.options = Object.assign(Object.assign({}, appConfig.targets.build.options), { customWebpackConfig: {
8
+ appConfig.targets.build.options = {
9
+ ...appConfig.targets.build.options,
10
+ customWebpackConfig: {
9
11
  path: `${appConfig.root}/webpack.config.js`,
10
- } });
11
- appConfig.targets.build.configurations.production = Object.assign(Object.assign({}, appConfig.targets.build.configurations.production), { customWebpackConfig: {
12
+ },
13
+ };
14
+ appConfig.targets.build.configurations.production = {
15
+ ...appConfig.targets.build.configurations.production,
16
+ customWebpackConfig: {
12
17
  path: `${appConfig.root}/webpack.prod.config.js`,
13
- } });
18
+ },
19
+ };
14
20
  (0, devkit_1.updateProjectConfiguration)(host, options.appName, appConfig);
15
21
  }
16
22
  exports.changeBuildTarget = changeBuildTarget;
@@ -13,7 +13,7 @@ function generateWebpackConfig(tree, options, appRoot, remotesWithPorts) {
13
13
  tmpl: '',
14
14
  type: options.mfType,
15
15
  name: options.appName,
16
- remotes: remotesWithPorts !== null && remotesWithPorts !== void 0 ? remotesWithPorts : [],
16
+ remotes: remotesWithPorts ?? [],
17
17
  projectRoot: appRoot,
18
18
  standalone: options.standalone,
19
19
  });
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRemotesWithPorts = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  function getRemotesWithPorts(host, options) {
6
- var _a, _b, _c;
7
6
  // If type is host and remotes supplied, check remotes exist
8
7
  const remotesWithPort = [];
9
8
  if (options.mfType === 'host' &&
@@ -13,7 +12,7 @@ function getRemotesWithPorts(host, options) {
13
12
  const remoteConfig = (0, devkit_1.readProjectConfiguration)(host, remote);
14
13
  remotesWithPort.push({
15
14
  remoteName: remote,
16
- port: (_c = (_b = (_a = remoteConfig.targets['serve']) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.port) !== null && _c !== void 0 ? _c : 4200,
15
+ port: remoteConfig.targets['serve']?.options?.port ?? 4200,
17
16
  });
18
17
  }
19
18
  }
@@ -3,7 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeOptions = void 0;
4
4
  const project_1 = require("../../utils/project");
5
5
  function normalizeOptions(tree, options) {
6
- var _a, _b;
7
- return Object.assign(Object.assign({}, options), { federationType: (_a = options.federationType) !== null && _a !== void 0 ? _a : 'static', prefix: (_b = options.prefix) !== null && _b !== void 0 ? _b : (0, project_1.getProjectPrefix)(tree, options.appName) });
6
+ return {
7
+ ...options,
8
+ federationType: options.federationType ?? 'static',
9
+ prefix: options.prefix ?? (0, project_1.getProjectPrefix)(tree, options.appName),
10
+ };
8
11
  }
9
12
  exports.normalizeOptions = normalizeOptions;
@@ -5,6 +5,12 @@ const devkit_1 = require("@nx/devkit");
5
5
  function updateTsConfigTarget(tree, schema) {
6
6
  const { root } = (0, devkit_1.readProjectConfiguration)(tree, schema.appName);
7
7
  // tsconfig.app.json
8
- (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(root, `tsconfig.app.json`), (json) => (Object.assign(Object.assign({}, json), { compilerOptions: Object.assign(Object.assign({}, json.compilerOptions), { target: 'ES2020' }) })));
8
+ (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(root, `tsconfig.app.json`), (json) => ({
9
+ ...json,
10
+ compilerOptions: {
11
+ ...json.compilerOptions,
12
+ target: 'ES2020',
13
+ },
14
+ }));
9
15
  }
10
16
  exports.updateTsConfigTarget = updateTsConfigTarget;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setupHostIfDynamic = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  function setupHostIfDynamic(tree, options) {
6
- var _a;
7
6
  if (options.federationType === 'static') {
8
7
  return;
9
8
  }
@@ -16,7 +15,7 @@ function setupHostIfDynamic(tree, options) {
16
15
  if (tree.exists(pathToProdWebpackConfig)) {
17
16
  tree.delete(pathToProdWebpackConfig);
18
17
  }
19
- (_a = project.targets.build.configurations.production) === null || _a === void 0 ? true : delete _a.customWebpackConfig;
18
+ delete project.targets.build.configurations.production?.customWebpackConfig;
20
19
  (0, devkit_1.updateProjectConfiguration)(tree, options.appName, project);
21
20
  }
22
21
  exports.setupHostIfDynamic = setupHostIfDynamic;
@@ -3,15 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setupServeTarget = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  function setupServeTarget(host, options) {
6
- var _a, _b;
7
6
  const appConfig = (0, devkit_1.readProjectConfiguration)(host, options.appName);
8
- appConfig.targets['serve'] = Object.assign(Object.assign({}, appConfig.targets['serve']), { executor: options.mfType === 'host'
7
+ appConfig.targets['serve'] = {
8
+ ...appConfig.targets['serve'],
9
+ executor: options.mfType === 'host'
9
10
  ? '@nx/angular:module-federation-dev-server'
10
- : '@nx/angular:webpack-dev-server', options: Object.assign(Object.assign({}, appConfig.targets['serve'].options), { port: (_a = options.port) !== null && _a !== void 0 ? _a : undefined, publicHost: `http://localhost:${(_b = options.port) !== null && _b !== void 0 ? _b : 4200}` }) });
11
+ : '@nx/angular:webpack-dev-server',
12
+ options: {
13
+ ...appConfig.targets['serve'].options,
14
+ port: options.port ?? undefined,
15
+ publicHost: `http://localhost:${options.port ?? 4200}`,
16
+ },
17
+ };
11
18
  if (options.mfType === 'remote') {
12
19
  appConfig.targets['serve-static'] = {
13
20
  executor: '@nx/web:file-server',
14
- defaultConfiguration: 'development',
21
+ defaultConfiguration: 'production',
15
22
  options: {
16
23
  buildTarget: `${options.appName}:build`,
17
24
  port: options.port,
@@ -1,46 +1,43 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setupMf = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  const lib_1 = require("./lib");
7
6
  const version_utils_1 = require("../utils/version-utils");
8
7
  const versions_1 = require("../../utils/versions");
9
8
  const semver_1 = require("semver");
10
- function setupMf(tree, rawOptions) {
11
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
- const installedAngularInfo = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
13
- if ((0, semver_1.lt)(installedAngularInfo.version, '14.1.0') && rawOptions.standalone) {
14
- throw new Error(`The --standalone flag is not supported in your current version of Angular (${installedAngularInfo.version}). Please update to a version of Angular that supports Standalone Components (>= 14.1.0).`);
15
- }
16
- const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
17
- const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.appName);
18
- let installTask = () => { };
19
- if (options.mfType === 'remote') {
20
- (0, lib_1.addRemoteToHost)(tree, options);
21
- (0, lib_1.addRemoteEntry)(tree, options, projectConfig.root);
22
- (0, lib_1.removeDeadCodeFromRemote)(tree, options);
23
- installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/web': versions_1.nxVersion });
24
- }
25
- const remotesWithPorts = (0, lib_1.getRemotesWithPorts)(tree, options);
26
- (0, lib_1.generateWebpackConfig)(tree, options, projectConfig.root, remotesWithPorts);
27
- (0, lib_1.changeBuildTarget)(tree, options);
28
- (0, lib_1.updateTsConfigTarget)(tree, options);
29
- (0, lib_1.setupServeTarget)(tree, options);
30
- (0, lib_1.fixBootstrap)(tree, projectConfig.root, options);
31
- if (options.mfType === 'host') {
32
- (0, lib_1.setupHostIfDynamic)(tree, options);
33
- (0, lib_1.updateHostAppRoutes)(tree, options);
34
- }
35
- if (!options.skipE2E) {
36
- (0, lib_1.addCypressOnErrorWorkaround)(tree, options);
37
- }
38
- // format files
39
- if (!options.skipFormat) {
40
- yield (0, devkit_1.formatFiles)(tree);
41
- }
42
- return installTask;
43
- });
9
+ async function setupMf(tree, rawOptions) {
10
+ const installedAngularInfo = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
11
+ if ((0, semver_1.lt)(installedAngularInfo.version, '14.1.0') && rawOptions.standalone) {
12
+ throw new Error(`The --standalone flag is not supported in your current version of Angular (${installedAngularInfo.version}). Please update to a version of Angular that supports Standalone Components (>= 14.1.0).`);
13
+ }
14
+ const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
15
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.appName);
16
+ let installTask = () => { };
17
+ if (options.mfType === 'remote') {
18
+ (0, lib_1.addRemoteToHost)(tree, options);
19
+ (0, lib_1.addRemoteEntry)(tree, options, projectConfig.root);
20
+ (0, lib_1.removeDeadCodeFromRemote)(tree, options);
21
+ installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nx/web': versions_1.nxVersion });
22
+ }
23
+ const remotesWithPorts = (0, lib_1.getRemotesWithPorts)(tree, options);
24
+ (0, lib_1.generateWebpackConfig)(tree, options, projectConfig.root, remotesWithPorts);
25
+ (0, lib_1.changeBuildTarget)(tree, options);
26
+ (0, lib_1.updateTsConfigTarget)(tree, options);
27
+ (0, lib_1.setupServeTarget)(tree, options);
28
+ (0, lib_1.fixBootstrap)(tree, projectConfig.root, options);
29
+ if (options.mfType === 'host') {
30
+ (0, lib_1.setupHostIfDynamic)(tree, options);
31
+ (0, lib_1.updateHostAppRoutes)(tree, options);
32
+ }
33
+ if (!options.skipE2E) {
34
+ (0, lib_1.addCypressOnErrorWorkaround)(tree, options);
35
+ }
36
+ // format files
37
+ if (!options.skipFormat) {
38
+ await (0, devkit_1.formatFiles)(tree);
39
+ }
40
+ return installTask;
44
41
  }
45
42
  exports.setupMf = setupMf;
46
43
  exports.default = setupMf;
@@ -10,18 +10,21 @@ function generateSSRFiles(tree, schema) {
10
10
  const projectRoot = projectConfig.root;
11
11
  const browserBundleOutputPath = projectConfig.targets.build.options.outputPath;
12
12
  const pathToFiles = (0, devkit_1.joinPathFragments)(__dirname, '..', 'files');
13
- (0, devkit_1.generateFiles)(tree, (0, path_1.join)(pathToFiles, 'base'), projectRoot, Object.assign(Object.assign({}, schema), { tpl: '' }));
13
+ (0, devkit_1.generateFiles)(tree, (0, path_1.join)(pathToFiles, 'base'), projectRoot, {
14
+ ...schema,
15
+ tpl: '',
16
+ });
14
17
  if (schema.standalone) {
15
- (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'standalone'), projectRoot, Object.assign(Object.assign({}, schema), { browserBundleOutputPath, tpl: '' }));
18
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'standalone'), projectRoot, { ...schema, browserBundleOutputPath, tpl: '' });
16
19
  }
17
20
  else {
18
- (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'base'), projectRoot, Object.assign(Object.assign({}, schema), { browserBundleOutputPath, tpl: '' }));
21
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'base'), projectRoot, { ...schema, browserBundleOutputPath, tpl: '' });
19
22
  const { major: angularMajorVersion, version: angularVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
20
23
  if (angularMajorVersion < 15) {
21
- (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'v14'), projectRoot, Object.assign(Object.assign({}, schema), { browserBundleOutputPath, tpl: '' }));
24
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'v14'), projectRoot, { ...schema, browserBundleOutputPath, tpl: '' });
22
25
  }
23
26
  if ((0, semver_1.lt)(angularVersion, '15.2.0')) {
24
- (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'pre-v15-2'), projectRoot, Object.assign(Object.assign({}, schema), { browserBundleOutputPath, tpl: '' }));
27
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(pathToFiles, 'ngmodule', 'pre-v15-2'), projectRoot, { ...schema, browserBundleOutputPath, tpl: '' });
25
28
  }
26
29
  }
27
30
  }
@@ -3,19 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeOptions = void 0;
4
4
  const ast_utils_1 = require("../../../utils/nx-devkit/ast-utils");
5
5
  function normalizeOptions(tree, options) {
6
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
7
6
  const isStandaloneApp = (0, ast_utils_1.isNgStandaloneApp)(tree, options.project);
8
7
  return {
9
8
  project: options.project,
10
- appId: (_a = options.appId) !== null && _a !== void 0 ? _a : 'serverApp',
11
- main: (_b = options.main) !== null && _b !== void 0 ? _b : 'main.server.ts',
12
- serverFileName: (_c = options.serverFileName) !== null && _c !== void 0 ? _c : 'server.ts',
13
- serverPort: (_d = options.serverPort) !== null && _d !== void 0 ? _d : 4000,
14
- rootModuleFileName: (_e = options.rootModuleFileName) !== null && _e !== void 0 ? _e : 'app.server.module.ts',
15
- rootModuleClassName: (_f = options.rootModuleClassName) !== null && _f !== void 0 ? _f : 'AppServerModule',
16
- skipFormat: (_g = options.skipFormat) !== null && _g !== void 0 ? _g : false,
17
- standalone: (_h = options.standalone) !== null && _h !== void 0 ? _h : isStandaloneApp,
18
- hydration: (_j = options.hydration) !== null && _j !== void 0 ? _j : false,
9
+ appId: options.appId ?? 'serverApp',
10
+ main: options.main ?? 'main.server.ts',
11
+ serverFileName: options.serverFileName ?? 'server.ts',
12
+ serverPort: options.serverPort ?? 4000,
13
+ rootModuleFileName: options.rootModuleFileName ?? 'app.server.module.ts',
14
+ rootModuleClassName: options.rootModuleClassName ?? 'AppServerModule',
15
+ skipFormat: options.skipFormat ?? false,
16
+ standalone: options.standalone ?? isStandaloneApp,
17
+ hydration: options.hydration ?? false,
19
18
  };
20
19
  }
21
20
  exports.normalizeOptions = normalizeOptions;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateProjectConfig = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  function updateProjectConfig(tree, schema) {
6
- var _a;
7
6
  let projectConfig = (0, devkit_1.readProjectConfiguration)(tree, schema.project);
8
7
  const buildTarget = projectConfig.targets.build;
9
8
  const baseOutputPath = buildTarget.options.outputPath;
@@ -18,7 +17,12 @@ function updateProjectConfig(tree, schema) {
18
17
  projectConfig.targets.server = {
19
18
  dependsOn: ['build'],
20
19
  executor: '@angular-devkit/build-angular:server',
21
- options: Object.assign({ outputPath: (0, devkit_1.joinPathFragments)(baseOutputPath, 'server'), main: (0, devkit_1.joinPathFragments)(projectConfig.root, schema.serverFileName), tsConfig: (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.server.json') }, (buildTarget.options ? getServerOptions(buildTarget.options) : {})),
20
+ options: {
21
+ outputPath: (0, devkit_1.joinPathFragments)(baseOutputPath, 'server'),
22
+ main: (0, devkit_1.joinPathFragments)(projectConfig.root, schema.serverFileName),
23
+ tsConfig: (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.server.json'),
24
+ ...(buildTarget.options ? getServerOptions(buildTarget.options) : {}),
25
+ },
22
26
  configurations,
23
27
  defaultConfiguration: 'production',
24
28
  };
@@ -55,7 +59,7 @@ function updateProjectConfig(tree, schema) {
55
59
  };
56
60
  (0, devkit_1.updateProjectConfiguration)(tree, schema.project, projectConfig);
57
61
  const nxJson = (0, devkit_1.readNxJson)(tree);
58
- if (((_a = nxJson.tasksRunnerOptions) === null || _a === void 0 ? void 0 : _a.default) &&
62
+ if (nxJson.tasksRunnerOptions?.default &&
59
63
  !nxJson.tasksRunnerOptions.default.options.cacheableOperations.includes('server')) {
60
64
  nxJson.tasksRunnerOptions.default.options.cacheableOperations = [
61
65
  ...nxJson.tasksRunnerOptions.default.options.cacheableOperations,
@@ -67,20 +71,20 @@ function updateProjectConfig(tree, schema) {
67
71
  exports.updateProjectConfig = updateProjectConfig;
68
72
  function getServerOptions(options = {}) {
69
73
  return {
70
- buildOptimizer: options === null || options === void 0 ? void 0 : options.buildOptimizer,
71
- outputHashing: (options === null || options === void 0 ? void 0 : options.outputHashing) === 'all'
74
+ buildOptimizer: options?.buildOptimizer,
75
+ outputHashing: options?.outputHashing === 'all'
72
76
  ? 'media'
73
- : options === null || options === void 0 ? void 0 : options.outputHashing,
74
- fileReplacements: options === null || options === void 0 ? void 0 : options.fileReplacements,
75
- optimization: (options === null || options === void 0 ? void 0 : options.optimization) === undefined ? undefined : !!(options === null || options === void 0 ? void 0 : options.optimization),
76
- sourceMap: options === null || options === void 0 ? void 0 : options.sourceMap,
77
- stylePreprocessorOptions: options === null || options === void 0 ? void 0 : options.stylePreprocessorOptions,
78
- resourcesOutputPath: options === null || options === void 0 ? void 0 : options.resourcesOutputPath,
79
- deployUrl: options === null || options === void 0 ? void 0 : options.deployUrl,
80
- i18nMissingTranslation: options === null || options === void 0 ? void 0 : options.i18nMissingTranslation,
81
- preserveSymlinks: options === null || options === void 0 ? void 0 : options.preserveSymlinks,
82
- extractLicenses: options === null || options === void 0 ? void 0 : options.extractLicenses,
83
- inlineStyleLanguage: options === null || options === void 0 ? void 0 : options.inlineStyleLanguage,
84
- vendorChunk: options === null || options === void 0 ? void 0 : options.vendorChunk,
77
+ : options?.outputHashing,
78
+ fileReplacements: options?.fileReplacements,
79
+ optimization: options?.optimization === undefined ? undefined : !!options?.optimization,
80
+ sourceMap: options?.sourceMap,
81
+ stylePreprocessorOptions: options?.stylePreprocessorOptions,
82
+ resourcesOutputPath: options?.resourcesOutputPath,
83
+ deployUrl: options?.deployUrl,
84
+ i18nMissingTranslation: options?.i18nMissingTranslation,
85
+ preserveSymlinks: options?.preserveSymlinks,
86
+ extractLicenses: options?.extractLicenses,
87
+ inlineStyleLanguage: options?.inlineStyleLanguage,
88
+ vendorChunk: options?.vendorChunk,
85
89
  };
86
90
  }
@@ -1,37 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setupSsr = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const devkit_1 = require("@nx/devkit");
6
5
  const version_utils_1 = require("../utils/version-utils");
7
6
  const lib_1 = require("./lib");
8
- function setupSsr(tree, schema) {
9
- var _a, _b, _c, _d, _e, _f;
10
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
11
- (0, lib_1.validateOptions)(tree, schema);
12
- const options = (0, lib_1.normalizeOptions)(tree, schema);
13
- (0, lib_1.updateProjectConfig)(tree, options);
14
- (0, lib_1.generateSSRFiles)(tree, options);
15
- if (!options.standalone) {
16
- (0, lib_1.updateAppModule)(tree, options);
17
- }
18
- if (options.hydration) {
19
- (0, lib_1.addHydration)(tree, options);
20
- }
21
- const pkgVersions = (0, version_utils_1.versions)(tree);
22
- (0, devkit_1.addDependenciesToPackageJson)(tree, {
23
- '@nguniversal/express-engine': (_b = (_a = (0, version_utils_1.getInstalledPackageVersionInfo)(tree, '@nguniversal/express-engine')) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : pkgVersions.ngUniversalVersion,
24
- '@angular/platform-server': (_d = (_c = (0, version_utils_1.getInstalledPackageVersionInfo)(tree, '@angular/platform-server')) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : pkgVersions.angularVersion,
25
- }, {
26
- '@nguniversal/builders': (_f = (_e = (0, version_utils_1.getInstalledPackageVersionInfo)(tree, '@nguniversal/builders')) === null || _e === void 0 ? void 0 : _e.version) !== null && _f !== void 0 ? _f : pkgVersions.ngUniversalVersion,
27
- });
28
- if (!options.skipFormat) {
29
- yield (0, devkit_1.formatFiles)(tree);
30
- }
31
- return () => {
32
- (0, devkit_1.installPackagesTask)(tree);
33
- };
7
+ async function setupSsr(tree, schema) {
8
+ (0, lib_1.validateOptions)(tree, schema);
9
+ const options = (0, lib_1.normalizeOptions)(tree, schema);
10
+ (0, lib_1.updateProjectConfig)(tree, options);
11
+ (0, lib_1.generateSSRFiles)(tree, options);
12
+ if (!options.standalone) {
13
+ (0, lib_1.updateAppModule)(tree, options);
14
+ }
15
+ if (options.hydration) {
16
+ (0, lib_1.addHydration)(tree, options);
17
+ }
18
+ const pkgVersions = (0, version_utils_1.versions)(tree);
19
+ (0, devkit_1.addDependenciesToPackageJson)(tree, {
20
+ '@nguniversal/express-engine': (0, version_utils_1.getInstalledPackageVersionInfo)(tree, '@nguniversal/express-engine')
21
+ ?.version ?? pkgVersions.ngUniversalVersion,
22
+ '@angular/platform-server': (0, version_utils_1.getInstalledPackageVersionInfo)(tree, '@angular/platform-server')
23
+ ?.version ?? pkgVersions.angularVersion,
24
+ }, {
25
+ '@nguniversal/builders': (0, version_utils_1.getInstalledPackageVersionInfo)(tree, '@nguniversal/builders')
26
+ ?.version ?? pkgVersions.ngUniversalVersion,
34
27
  });
28
+ if (!options.skipFormat) {
29
+ await (0, devkit_1.formatFiles)(tree);
30
+ }
31
+ return () => {
32
+ (0, devkit_1.installPackagesTask)(tree);
33
+ };
35
34
  }
36
35
  exports.setupSsr = setupSsr;
37
36
  exports.default = setupSsr;
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addTailwindConfigPathToProject = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  function addTailwindConfigPathToProject(tree, options, project) {
6
- var _a, _b;
7
- const buildTarget = (_a = project.targets) === null || _a === void 0 ? void 0 : _a[options.buildTarget];
6
+ const buildTarget = project.targets?.[options.buildTarget];
8
7
  if (!buildTarget) {
9
8
  throw new Error((0, devkit_1.stripIndents) `The target "${options.buildTarget}" was not found for project "${options.project}".
10
9
  If you are using a different build target, please provide it using the "--buildTarget" option.
@@ -22,12 +21,15 @@ function addTailwindConfigPathToProject(tree, options, project) {
22
21
  .map((e) => `"${e}"`)
23
22
  .join(', ')}.`);
24
23
  }
25
- if (((_b = buildTarget.options) === null || _b === void 0 ? void 0 : _b.tailwindConfig) &&
24
+ if (buildTarget.options?.tailwindConfig &&
26
25
  tree.exists(buildTarget.options.tailwindConfig)) {
27
26
  throw new Error((0, devkit_1.stripIndents) `The "${buildTarget.options.tailwindConfig}" file is already configured for the project "${options.project}". Are you sure this is the right project to set up Tailwind?
28
27
  If you are sure, you can remove the configuration and re-run the generator.`);
29
28
  }
30
- buildTarget.options = Object.assign(Object.assign({}, buildTarget.options), { tailwindConfig: (0, devkit_1.joinPathFragments)(project.root, 'tailwind.config.js') });
29
+ buildTarget.options = {
30
+ ...buildTarget.options,
31
+ tailwindConfig: (0, devkit_1.joinPathFragments)(project.root, 'tailwind.config.js'),
32
+ };
31
33
  (0, devkit_1.updateProjectConfiguration)(tree, options.project, project);
32
34
  }
33
35
  exports.addTailwindConfigPathToProject = addTailwindConfigPathToProject;