@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
@@ -7,7 +7,6 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.augmentProgramWithVersioning = exports.cacheCompilerHost = void 0;
10
- const tslib_1 = require("tslib");
11
10
  const crypto_1 = require("crypto");
12
11
  const node_1 = require("ng-packagr/lib/graph/node");
13
12
  const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
@@ -36,7 +35,8 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
36
35
  const flatModuleFileDtsFilename = `${flatModuleFile}.d.ts`;
37
36
  const flatModuleFileDtsPath = (0, path_1.ensureUnixPath)(path.join(destinationPath, flatModuleFileDtsFilename));
38
37
  const hasIndexEntryFile = path.basename(entryFile.toLowerCase()) === 'index.ts';
39
- return Object.assign(Object.assign({}, compilerHost), {
38
+ return {
39
+ ...compilerHost,
40
40
  // ts specific
41
41
  fileExists: (fileName) => {
42
42
  const cache = sourcesFileCache.getOrCreate(fileName);
@@ -44,14 +44,16 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
44
44
  cache.exists = compilerHost.fileExists.call(this, fileName);
45
45
  }
46
46
  return cache.exists;
47
- }, getSourceFile: (fileName, languageVersion) => {
47
+ },
48
+ getSourceFile: (fileName, languageVersion) => {
48
49
  addDependee(fileName);
49
50
  const cache = sourcesFileCache.getOrCreate(fileName);
50
51
  if (!cache.sourceFile) {
51
52
  cache.sourceFile = compilerHost.getSourceFile.call(this, fileName, languageVersion);
52
53
  }
53
54
  return cache.sourceFile;
54
- }, writeFile: (fileName, data, writeByteOrderMark, onError, sourceFiles) => {
55
+ },
56
+ writeFile: (fileName, data, writeByteOrderMark, onError, sourceFiles) => {
55
57
  if (fileName.endsWith('.d.ts')) {
56
58
  if (fileName === flatModuleFileDtsPath) {
57
59
  if (hasIndexEntryFile) {
@@ -83,7 +85,7 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
83
85
  if (fileName.endsWith('.mjs')) {
84
86
  const cachedData = outputCache.get(fileName);
85
87
  map =
86
- (cachedData === null || cachedData === void 0 ? void 0 : cachedData.version) === version
88
+ cachedData?.version === version
87
89
  ? cachedData.map
88
90
  : require('convert-source-map').fromComment(data).toJSON();
89
91
  }
@@ -101,25 +103,29 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
101
103
  }
102
104
  }
103
105
  compilerHost.writeFile.call(this, fileName, data, writeByteOrderMark, onError, sourceFiles);
104
- }, readFile: (fileName) => {
106
+ },
107
+ readFile: (fileName) => {
105
108
  addDependee(fileName);
106
109
  const cache = sourcesFileCache.getOrCreate(fileName);
107
110
  if (cache.content === undefined) {
108
111
  cache.content = compilerHost.readFile.call(this, fileName);
109
112
  }
110
113
  return cache.content;
111
- }, resolveModuleNames: (moduleNames, containingFile) => {
114
+ },
115
+ resolveModuleNames: (moduleNames, containingFile) => {
112
116
  return moduleNames.map((moduleName) => {
113
117
  const { resolvedModule } = ts.resolveModuleName(moduleName, (0, path_1.ensureUnixPath)(containingFile), compilerOptions, compilerHost, moduleResolutionCache);
114
118
  return resolvedModule;
115
119
  });
116
- }, resourceNameToFileName: (resourceName, containingFilePath) => {
120
+ },
121
+ resourceNameToFileName: (resourceName, containingFilePath) => {
117
122
  const resourcePath = path.resolve(path.dirname(containingFilePath), resourceName);
118
123
  const containingNode = getNode(containingFilePath);
119
124
  const resourceNode = getNode(resourcePath);
120
125
  containingNode.dependsOn(resourceNode);
121
126
  return resourcePath;
122
- }, readResource: (fileName) => tslib_1.__awaiter(this, void 0, void 0, function* () {
127
+ },
128
+ readResource: async (fileName) => {
123
129
  addDependee(fileName);
124
130
  const cache = sourcesFileCache.getOrCreate(fileName);
125
131
  if (cache.content === undefined) {
@@ -132,7 +138,7 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
132
138
  }
133
139
  else {
134
140
  // stylesheet
135
- cache.content = yield stylesheetProcessor.process({
141
+ cache.content = await stylesheetProcessor.process({
136
142
  filePath: fileName,
137
143
  content: compilerHost.readFile.call(this, fileName),
138
144
  });
@@ -140,7 +146,8 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
140
146
  cache.exists = true;
141
147
  }
142
148
  return cache.content;
143
- }), transformResource: (data, context) => tslib_1.__awaiter(this, void 0, void 0, function* () {
149
+ },
150
+ transformResource: async (data, context) => {
144
151
  if (context.resourceFile || context.type !== 'style') {
145
152
  return null;
146
153
  }
@@ -149,7 +156,7 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
149
156
  const fileName = `${context.containingFile}-${key}.${inlineStyleLanguage}`;
150
157
  const cache = sourcesFileCache.getOrCreate(fileName);
151
158
  if (cache.content === undefined) {
152
- cache.content = yield stylesheetProcessor.process({
159
+ cache.content = await stylesheetProcessor.process({
153
160
  filePath: context.containingFile,
154
161
  content: data,
155
162
  });
@@ -161,7 +168,8 @@ function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionC
161
168
  return { content: cache.content };
162
169
  }
163
170
  return null;
164
- }) });
171
+ },
172
+ };
165
173
  }
166
174
  exports.cacheCompilerHost = cacheCompilerHost;
167
175
  function augmentProgramWithVersioning(program) {
@@ -1,13 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ngccCompilerCli = void 0;
4
- const tslib_1 = require("tslib");
5
- function ngccCompilerCli() {
6
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
7
- const compilerCliModule = yield new Function(`return import('@angular/compiler-cli/ngcc');`)();
8
- return compilerCliModule.process
9
- ? compilerCliModule
10
- : compilerCliModule.default;
11
- });
4
+ async function ngccCompilerCli() {
5
+ const compilerCliModule = await new Function(`return import('@angular/compiler-cli/ngcc');`)();
6
+ return compilerCliModule.process
7
+ ? compilerCliModule
8
+ : compilerCliModule.default;
12
9
  }
13
10
  exports.ngccCompilerCli = ngccCompilerCli;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.packageExecutor = exports.createLibraryExecutor = void 0;
4
- const tslib_1 = require("tslib");
5
4
  const rxjs_for_await_1 = require("@nx/devkit/src/utils/rxjs-for-await");
6
5
  const buildable_libs_utils_1 = require("@nx/js/src/utils/buildable-libs-utils");
7
6
  const path_1 = require("path");
@@ -11,25 +10,23 @@ const typescript_1 = require("../utilities/typescript");
11
10
  const entry_point_di_1 = require("./ng-packagr-adjustments/ng-package/entry-point/entry-point.di");
12
11
  const options_di_1 = require("./ng-packagr-adjustments/ng-package/options.di");
13
12
  const package_di_1 = require("./ng-packagr-adjustments/ng-package/package.di");
14
- function initializeNgPackagr(options, context, projectDependencies) {
15
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
16
- const packager = new (yield Promise.resolve().then(() => require('ng-packagr'))).NgPackagr([
17
- ...package_di_1.NX_PACKAGE_PROVIDERS,
18
- ...entry_point_di_1.NX_ENTRY_POINT_PROVIDERS,
19
- (0, options_di_1.nxProvideOptions)({
20
- tailwindConfig: options.tailwindConfig,
21
- watch: options.watch,
22
- }),
23
- ]);
24
- packager.forProject((0, path_1.resolve)(context.root, options.project));
25
- packager.withBuildTransform(package_di_1.NX_PACKAGE_TRANSFORM.provide);
26
- if (options.tsConfig) {
27
- const remappedTsConfigFilePath = (0, buildable_libs_utils_1.createTmpTsConfig)(options.tsConfig, context.root, context.projectsConfigurations.projects[context.projectName].root, projectDependencies);
28
- const tsConfig = yield (0, typescript_1.parseRemappedTsConfigAndMergeDefaults)(context.root, options.tsConfig, remappedTsConfigFilePath);
29
- packager.withTsConfig(tsConfig);
30
- }
31
- return packager;
32
- });
13
+ async function initializeNgPackagr(options, context, projectDependencies) {
14
+ const packager = new (await Promise.resolve().then(() => require('ng-packagr'))).NgPackagr([
15
+ ...package_di_1.NX_PACKAGE_PROVIDERS,
16
+ ...entry_point_di_1.NX_ENTRY_POINT_PROVIDERS,
17
+ (0, options_di_1.nxProvideOptions)({
18
+ tailwindConfig: options.tailwindConfig,
19
+ watch: options.watch,
20
+ }),
21
+ ]);
22
+ packager.forProject((0, path_1.resolve)(context.root, options.project));
23
+ packager.withBuildTransform(package_di_1.NX_PACKAGE_TRANSFORM.provide);
24
+ if (options.tsConfig) {
25
+ const remappedTsConfigFilePath = (0, buildable_libs_utils_1.createTmpTsConfig)(options.tsConfig, context.root, context.projectsConfigurations.projects[context.projectName].root, projectDependencies);
26
+ const tsConfig = await (0, typescript_1.parseRemappedTsConfigAndMergeDefaults)(context.root, options.tsConfig, remappedTsConfigFilePath);
27
+ packager.withTsConfig(tsConfig);
28
+ }
29
+ return packager;
33
30
  }
34
31
  /**
35
32
  * Creates an executor function that executes the library build of an Angular
@@ -37,25 +34,23 @@ function initializeNgPackagr(options, context, projectDependencies) {
37
34
  * @param initializeNgPackagr function that returns an ngPackagr instance to use for the build.
38
35
  */
39
36
  function createLibraryExecutor(initializeNgPackagr) {
40
- return function (options, context) {
41
- return tslib_1.__asyncGenerator(this, arguments, function* () {
42
- const { target, dependencies, topLevelDependencies } = (0, buildable_libs_utils_1.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, context.projectName, context.targetName, context.configurationName);
43
- if (!(0, buildable_libs_utils_1.checkDependentProjectsHaveBeenBuilt)(context.root, context.projectName, context.targetName, dependencies)) {
44
- return yield tslib_1.__await(Promise.resolve({ success: false }));
45
- }
46
- function updatePackageJson() {
47
- if (topLevelDependencies.length > 0 &&
48
- options.updateBuildableProjectDepsInPackageJson) {
49
- (0, buildable_libs_utils_1.updateBuildableProjectPackageJsonDependencies)(context.root, context.projectName, context.targetName, context.configurationName, target, topLevelDependencies, options.buildableProjectDepsInPackageJsonType);
50
- }
51
- }
52
- if (options.watch) {
53
- return yield tslib_1.__await(yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues((0, rxjs_for_await_1.eachValueFrom)((0, rxjs_1.from)(initializeNgPackagr(options, context, dependencies)).pipe((0, operators_1.switchMap)((packagr) => packagr.watch()), (0, operators_1.tap)(() => updatePackageJson()), (0, operators_1.mapTo)({ success: true })))))));
37
+ return async function* (options, context) {
38
+ const { target, dependencies, topLevelDependencies } = (0, buildable_libs_utils_1.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, context.projectName, context.targetName, context.configurationName);
39
+ if (!(0, buildable_libs_utils_1.checkDependentProjectsHaveBeenBuilt)(context.root, context.projectName, context.targetName, dependencies)) {
40
+ return Promise.resolve({ success: false });
41
+ }
42
+ function updatePackageJson() {
43
+ if (topLevelDependencies.length > 0 &&
44
+ options.updateBuildableProjectDepsInPackageJson) {
45
+ (0, buildable_libs_utils_1.updateBuildableProjectPackageJsonDependencies)(context.root, context.projectName, context.targetName, context.configurationName, target, topLevelDependencies, options.buildableProjectDepsInPackageJsonType);
54
46
  }
55
- return yield tslib_1.__await((0, rxjs_1.from)(initializeNgPackagr(options, context, dependencies))
56
- .pipe((0, operators_1.switchMap)((packagr) => packagr.build()), (0, operators_1.tap)(() => updatePackageJson()), (0, operators_1.mapTo)({ success: true }))
57
- .toPromise());
58
- });
47
+ }
48
+ if (options.watch) {
49
+ return yield* (0, rxjs_for_await_1.eachValueFrom)((0, rxjs_1.from)(initializeNgPackagr(options, context, dependencies)).pipe((0, operators_1.switchMap)((packagr) => packagr.watch()), (0, operators_1.tap)(() => updatePackageJson()), (0, operators_1.mapTo)({ success: true })));
50
+ }
51
+ return (0, rxjs_1.from)(initializeNgPackagr(options, context, dependencies))
52
+ .pipe((0, operators_1.switchMap)((packagr) => packagr.build()), (0, operators_1.tap)(() => updatePackageJson()), (0, operators_1.mapTo)({ success: true }))
53
+ .toPromise();
59
54
  };
60
55
  }
61
56
  exports.createLibraryExecutor = createLibraryExecutor;
@@ -12,7 +12,7 @@ function getInstalledPackageVersionInfo(pkgName) {
12
12
  const { packageJson: { version }, } = (0, package_json_1.readModulePackageJson)(pkgName);
13
13
  return { major: (0, semver_1.major)(version), version };
14
14
  }
15
- catch (_a) {
15
+ catch {
16
16
  return null;
17
17
  }
18
18
  }
@@ -27,7 +27,7 @@ function getTailwindSetup(basePath, tailwindConfig) {
27
27
  try {
28
28
  tailwindPackagePath = require.resolve('tailwindcss');
29
29
  }
30
- catch (_a) {
30
+ catch {
31
31
  const relativeTailwindConfigPath = (0, path_1.relative)(devkit_2.workspaceRoot, tailwindConfigPath);
32
32
  devkit_1.logger.warn(`Tailwind CSS configuration file found (${relativeTailwindConfigPath})` +
33
33
  ` but the 'tailwindcss' package is not installed.` +
@@ -64,7 +64,7 @@ function getTailwindPostCssPlugins({ tailwindConfigPath, tailwindPackagePath },
64
64
  }
65
65
  return [
66
66
  postcssImport({
67
- addModulesDirectories: includePaths !== null && includePaths !== void 0 ? includePaths : [],
67
+ addModulesDirectories: includePaths ?? [],
68
68
  resolve: (url) => (url.startsWith('~') ? url.substring(1) : url),
69
69
  }),
70
70
  require(tailwindPackagePath)({ config: tailwindConfigPath }),
@@ -9,40 +9,35 @@
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.parseRemappedTsConfigAndMergeDefaults = void 0;
12
- const tslib_1 = require("tslib");
13
12
  const ng_compiler_cli_1 = require("ng-packagr/lib/utils/ng-compiler-cli");
14
13
  const path_1 = require("path");
15
14
  const ts = require("typescript");
16
- function readDefaultTsConfig(fileName) {
17
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
18
- // these options are mandatory
19
- const extraOptions = {
20
- target: ts.ScriptTarget.ES2020,
21
- experimentalDecorators: true,
22
- // sourcemaps
23
- sourceMap: false,
24
- inlineSources: true,
25
- inlineSourceMap: true,
26
- outDir: '',
27
- declaration: true,
28
- // ng compiler to options
29
- enableResourceInlining: true,
30
- // these are required to set the appropriate EmitFlags
31
- flatModuleId: 'AUTOGENERATED',
32
- flatModuleOutFile: 'AUTOGENERATED',
33
- };
34
- const { readConfiguration } = yield (0, ng_compiler_cli_1.ngCompilerCli)();
35
- return readConfiguration(fileName, extraOptions);
36
- });
15
+ async function readDefaultTsConfig(fileName) {
16
+ // these options are mandatory
17
+ const extraOptions = {
18
+ target: ts.ScriptTarget.ES2020,
19
+ experimentalDecorators: true,
20
+ // sourcemaps
21
+ sourceMap: false,
22
+ inlineSources: true,
23
+ inlineSourceMap: true,
24
+ outDir: '',
25
+ declaration: true,
26
+ // ng compiler to options
27
+ enableResourceInlining: true,
28
+ // these are required to set the appropriate EmitFlags
29
+ flatModuleId: 'AUTOGENERATED',
30
+ flatModuleOutFile: 'AUTOGENERATED',
31
+ };
32
+ const { readConfiguration } = await (0, ng_compiler_cli_1.ngCompilerCli)();
33
+ return readConfiguration(fileName, extraOptions);
37
34
  }
38
35
  /**
39
36
  * Proxy function that ensures the configFilePath option points to the original file path.
40
37
  */
41
- function parseRemappedTsConfigAndMergeDefaults(workspaceRoot, originalFilePath, remappedFilePath) {
42
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
43
- const parsedConfiguration = yield readDefaultTsConfig(remappedFilePath);
44
- parsedConfiguration.options.configFilePath = (0, path_1.resolve)(workspaceRoot, originalFilePath);
45
- return parsedConfiguration;
46
- });
38
+ async function parseRemappedTsConfigAndMergeDefaults(workspaceRoot, originalFilePath, remappedFilePath) {
39
+ const parsedConfiguration = await readDefaultTsConfig(remappedFilePath);
40
+ parsedConfiguration.options.configFilePath = (0, path_1.resolve)(workspaceRoot, originalFilePath);
41
+ return parsedConfiguration;
47
42
  }
48
43
  exports.parseRemappedTsConfigAndMergeDefaults = parseRemappedTsConfigAndMergeDefaults;
@@ -1,92 +1,94 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addLintingGenerator = 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 lint_project_1 = require("@nx/linter/src/generators/lint-project/lint-project");
8
7
  const add_angular_eslint_dependencies_1 = require("./lib/add-angular-eslint-dependencies");
9
8
  const eslint_file_1 = require("@nx/linter/src/generators/utils/eslint-file");
10
9
  const string_utils_1 = require("@nx/devkit/src/utils/string-utils");
11
- function addLintingGenerator(tree, options) {
12
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
13
- const tasks = [];
14
- const rootProject = options.projectRoot === '.' || options.projectRoot === '';
15
- const lintTask = yield (0, linter_1.lintProjectGenerator)(tree, {
16
- linter: linter_1.Linter.EsLint,
17
- project: options.projectName,
18
- tsConfigPaths: [
19
- (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.app.json'),
20
- ],
21
- unitTestRunner: options.unitTestRunner,
22
- eslintFilePatterns: [
23
- (0, lint_project_1.mapLintPattern)(options.projectRoot, 'ts', rootProject),
24
- (0, lint_project_1.mapLintPattern)(options.projectRoot, 'html', rootProject),
25
- ],
26
- setParserOptionsProject: options.setParserOptionsProject,
27
- skipFormat: true,
28
- rootProject: rootProject,
29
- });
30
- tasks.push(lintTask);
31
- if ((0, eslint_file_1.isEslintConfigSupported)(tree)) {
32
- const eslintFile = (0, eslint_file_1.findEslintFile)(tree, options.projectRoot);
33
- // keep parser options if they exist
34
- const hasParserOptions = tree
35
- .read((0, devkit_1.joinPathFragments)(options.projectRoot, eslintFile), 'utf8')
36
- .includes(`${options.projectRoot}/tsconfig.*?.json`);
37
- (0, eslint_file_1.replaceOverridesInLintConfig)(tree, options.projectRoot, [
38
- {
39
- files: ['*.json'],
40
- parser: 'jsonc-eslint-parser',
41
- rules: {},
42
- },
43
- Object.assign(Object.assign({ files: ['*.ts'] }, (hasParserOptions
10
+ async function addLintingGenerator(tree, options) {
11
+ const tasks = [];
12
+ const rootProject = options.projectRoot === '.' || options.projectRoot === '';
13
+ const lintTask = await (0, linter_1.lintProjectGenerator)(tree, {
14
+ linter: linter_1.Linter.EsLint,
15
+ project: options.projectName,
16
+ tsConfigPaths: [
17
+ (0, devkit_1.joinPathFragments)(options.projectRoot, 'tsconfig.app.json'),
18
+ ],
19
+ unitTestRunner: options.unitTestRunner,
20
+ eslintFilePatterns: [
21
+ (0, lint_project_1.mapLintPattern)(options.projectRoot, 'ts', rootProject),
22
+ (0, lint_project_1.mapLintPattern)(options.projectRoot, 'html', rootProject),
23
+ ],
24
+ setParserOptionsProject: options.setParserOptionsProject,
25
+ skipFormat: true,
26
+ rootProject: rootProject,
27
+ });
28
+ tasks.push(lintTask);
29
+ if ((0, eslint_file_1.isEslintConfigSupported)(tree)) {
30
+ const eslintFile = (0, eslint_file_1.findEslintFile)(tree, options.projectRoot);
31
+ // keep parser options if they exist
32
+ const hasParserOptions = tree
33
+ .read((0, devkit_1.joinPathFragments)(options.projectRoot, eslintFile), 'utf8')
34
+ .includes(`${options.projectRoot}/tsconfig.*?.json`);
35
+ (0, eslint_file_1.replaceOverridesInLintConfig)(tree, options.projectRoot, [
36
+ {
37
+ files: ['*.json'],
38
+ parser: 'jsonc-eslint-parser',
39
+ rules: {},
40
+ },
41
+ {
42
+ files: ['*.ts'],
43
+ ...(hasParserOptions
44
44
  ? {
45
45
  parserOptions: {
46
46
  project: [`${options.projectRoot}/tsconfig.*?.json`],
47
47
  },
48
48
  }
49
- : {})), { extends: [
50
- 'plugin:@nx/angular',
51
- 'plugin:@angular-eslint/template/process-inline-templates',
52
- ], rules: {
53
- '@angular-eslint/directive-selector': [
54
- 'error',
55
- {
56
- type: 'attribute',
57
- prefix: (0, string_utils_1.camelize)(options.prefix),
58
- style: 'camelCase',
59
- },
60
- ],
61
- '@angular-eslint/component-selector': [
62
- 'error',
63
- {
64
- type: 'element',
65
- prefix: (0, string_utils_1.dasherize)(options.prefix),
66
- style: 'kebab-case',
67
- },
68
- ],
69
- } }),
70
- {
71
- files: ['*.html'],
72
- extends: ['plugin:@nx/angular-template'],
73
- /**
74
- * Having an empty rules object present makes it more obvious to the user where they would
75
- * extend things from if they needed to
76
- */
77
- rules: {},
49
+ : {}),
50
+ extends: [
51
+ 'plugin:@nx/angular',
52
+ 'plugin:@angular-eslint/template/process-inline-templates',
53
+ ],
54
+ rules: {
55
+ '@angular-eslint/directive-selector': [
56
+ 'error',
57
+ {
58
+ type: 'attribute',
59
+ prefix: (0, string_utils_1.camelize)(options.prefix),
60
+ style: 'camelCase',
61
+ },
62
+ ],
63
+ '@angular-eslint/component-selector': [
64
+ 'error',
65
+ {
66
+ type: 'element',
67
+ prefix: (0, string_utils_1.dasherize)(options.prefix),
68
+ style: 'kebab-case',
69
+ },
70
+ ],
78
71
  },
79
- ]);
80
- }
81
- if (!options.skipPackageJson) {
82
- const installTask = (0, add_angular_eslint_dependencies_1.addAngularEsLintDependencies)(tree);
83
- tasks.push(installTask);
84
- }
85
- if (!options.skipFormat) {
86
- yield (0, devkit_1.formatFiles)(tree);
87
- }
88
- return (0, devkit_1.runTasksInSerial)(...tasks);
89
- });
72
+ },
73
+ {
74
+ files: ['*.html'],
75
+ extends: ['plugin:@nx/angular-template'],
76
+ /**
77
+ * Having an empty rules object present makes it more obvious to the user where they would
78
+ * extend things from if they needed to
79
+ */
80
+ rules: {},
81
+ },
82
+ ]);
83
+ }
84
+ if (!options.skipPackageJson) {
85
+ const installTask = (0, add_angular_eslint_dependencies_1.addAngularEsLintDependencies)(tree);
86
+ tasks.push(installTask);
87
+ }
88
+ if (!options.skipFormat) {
89
+ await (0, devkit_1.formatFiles)(tree);
90
+ }
91
+ return (0, devkit_1.runTasksInSerial)(...tasks);
90
92
  }
91
93
  exports.addLintingGenerator = addLintingGenerator;
92
94
  exports.default = addLintingGenerator;
@@ -8,11 +8,15 @@ const string_utils_1 = require("@nx/devkit/src/utils/string-utils");
8
8
  */
9
9
  const extendAngularEslintJson = (json, options) => {
10
10
  const overrides = [
11
- Object.assign(Object.assign({}, json.overrides[0]), { files: ['*.ts'], extends: [
11
+ {
12
+ ...json.overrides[0],
13
+ files: ['*.ts'],
14
+ extends: [
12
15
  ...(json.overrides[0].extends || []),
13
16
  'plugin:@nx/angular',
14
17
  'plugin:@angular-eslint/template/process-inline-templates',
15
- ], rules: {
18
+ ],
19
+ rules: {
16
20
  '@angular-eslint/directive-selector': [
17
21
  'error',
18
22
  {
@@ -29,7 +33,8 @@ const extendAngularEslintJson = (json, options) => {
29
33
  style: 'kebab-case',
30
34
  },
31
35
  ],
32
- } }),
36
+ },
37
+ },
33
38
  {
34
39
  files: ['*.html'],
35
40
  extends: ['plugin:@nx/angular-template'],
@@ -40,7 +45,10 @@ const extendAngularEslintJson = (json, options) => {
40
45
  rules: {},
41
46
  },
42
47
  ];
43
- return Object.assign(Object.assign({}, json), { overrides });
48
+ return {
49
+ ...json,
50
+ overrides,
51
+ };
44
52
  };
45
53
  exports.extendAngularEslintJson = extendAngularEslintJson;
46
54
  /**