@nx/angular 20.2.0-canary.20241130-ec5a5e6 → 20.2.0-canary.20241203-6b87005

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 (209) hide show
  1. package/executors.json +1 -1
  2. package/fesm2022/nx-angular-mf.mjs.map +1 -1
  3. package/fesm2022/nx-angular-testing.mjs.map +1 -1
  4. package/fesm2022/nx-angular.mjs.map +1 -1
  5. package/generators.json +1 -1
  6. package/migrations.json +151 -1
  7. package/package.json +8 -15
  8. package/src/builders/dev-server/lib/normalize-options.js +3 -0
  9. package/src/builders/dev-server/lib/validate-options.js +1 -9
  10. package/src/builders/dev-server/schema.json +3 -4
  11. package/src/executors/application/application.impl.d.ts +1 -1
  12. package/src/executors/application/application.impl.js +4 -1
  13. package/src/executors/application/schema.json +78 -6
  14. package/src/executors/application/utils/normalize-options.d.ts +2 -0
  15. package/src/executors/application/utils/normalize-options.js +33 -0
  16. package/src/executors/application/utils/validate-options.js +18 -4
  17. package/src/executors/browser-esbuild/browser-esbuild.impl.d.ts +1 -1
  18. package/src/executors/browser-esbuild/browser-esbuild.impl.js +0 -9
  19. package/src/executors/browser-esbuild/schema.json +1 -1
  20. package/src/executors/delegate-build/delegate-build.impl.d.ts +1 -1
  21. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +1 -1
  22. package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +1 -1
  23. package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +8 -12
  24. package/src/executors/module-federation-ssr-dev-server/schema.d.ts +2 -14
  25. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-packagr.d.ts +1 -2
  26. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-packagr.js +11 -20
  27. package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.d.ts +1 -1
  28. package/src/executors/ng-packagr-lite/ng-packagr-lite.impl.js +1 -1
  29. package/src/executors/ng-packagr-lite/schema.json +0 -8
  30. package/src/executors/package/ng-packagr-adjustments/ng-packagr.d.ts +1 -2
  31. package/src/executors/package/ng-packagr-adjustments/ng-packagr.js +4 -21
  32. package/src/executors/package/package.impl.d.ts +2 -2
  33. package/src/executors/package/package.impl.js +1 -1
  34. package/src/executors/package/schema.d.ts +1 -3
  35. package/src/executors/package/schema.json +0 -10
  36. package/src/executors/utilities/ng-packagr/{stylesheet-processor.js → pre-v19/stylesheet-processor.js} +2 -2
  37. package/src/executors/utilities/ng-packagr/stylesheet-processor.di.js +11 -5
  38. package/src/executors/utilities/ng-packagr/tailwindcss.d.ts +0 -6
  39. package/src/executors/utilities/ng-packagr/tailwindcss.js +0 -32
  40. package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.d.ts +23 -0
  41. package/src/executors/utilities/ng-packagr/v19+/stylesheet-processor.js +93 -0
  42. package/src/generators/application/application.js +1 -0
  43. package/src/generators/application/files/ng-module/src/app/app.component.ts__tpl__ +4 -5
  44. package/src/generators/application/files/nx-welcome/claimed/ng-module/src/app/nx-welcome.component.ts__tpl__ +2 -1
  45. package/src/generators/application/files/nx-welcome/claimed/standalone/src/app/nx-welcome.component.ts__tpl__ +2 -2
  46. package/src/generators/application/files/nx-welcome/not-configured/ng-module/src/app/nx-welcome.component.ts__tpl__ +2 -1
  47. package/src/generators/application/files/nx-welcome/not-configured/standalone/src/app/nx-welcome.component.ts__tpl__ +2 -2
  48. package/src/generators/application/files/nx-welcome/unclaimed/ng-module/src/app/nx-welcome.component.ts__tpl__ +2 -1
  49. package/src/generators/application/files/nx-welcome/unclaimed/standalone/src/app/nx-welcome.component.ts__tpl__ +2 -2
  50. package/src/generators/application/files/standalone-components/src/app/app.component.ts__tpl__ +4 -6
  51. package/src/generators/application/lib/add-serve-static-target.d.ts +1 -1
  52. package/src/generators/application/lib/add-serve-static-target.js +1 -3
  53. package/src/generators/application/lib/create-files.js +4 -1
  54. package/src/generators/application/lib/create-project.js +24 -31
  55. package/src/generators/application/lib/normalize-options.js +1 -6
  56. package/src/generators/application/schema.d.ts +1 -0
  57. package/src/generators/application/schema.json +7 -2
  58. package/src/generators/component/component.js +4 -0
  59. package/src/generators/component/files/__fileName__.spec.ts__tpl__ +1 -1
  60. package/src/generators/component/files/__fileName__.ts__tpl__ +5 -13
  61. package/src/generators/component/lib/normalize-options.js +2 -0
  62. package/src/generators/component/schema.d.ts +1 -0
  63. package/src/generators/component/schema.json +5 -0
  64. package/src/generators/convert-to-application-executor/convert-to-application-executor.js +1 -4
  65. package/src/generators/convert-to-application-executor/schema.json +1 -1
  66. package/src/generators/directive/directive.js +5 -0
  67. package/src/generators/directive/files/__fileName__.ts__tpl__ +2 -2
  68. package/src/generators/directive/lib/normalize-options.js +3 -1
  69. package/src/generators/host/files/common/{v17+/src → src}/main.server.ts__tmpl__ +1 -1
  70. package/src/generators/host/lib/update-ssr-setup.js +2 -1
  71. package/src/generators/host/schema.d.ts +1 -0
  72. package/src/generators/host/schema.json +4 -0
  73. package/src/generators/pipe/files/__fileName__.ts__tpl__ +2 -2
  74. package/src/generators/pipe/lib/normalize-options.js +3 -1
  75. package/src/generators/pipe/pipe.js +5 -0
  76. package/src/generators/remote/files/common/{v17+/src → src}/main.server.ts__tmpl__ +1 -1
  77. package/src/generators/remote/lib/update-ssr-setup.js +2 -1
  78. package/src/generators/remote/schema.d.ts +1 -0
  79. package/src/generators/remote/schema.json +4 -0
  80. package/src/generators/scam/lib/normalize-options.js +3 -1
  81. package/src/generators/scam-directive/lib/normalize-options.js +3 -1
  82. package/src/generators/scam-pipe/lib/normalize-options.js +3 -1
  83. package/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.d.ts +1 -1
  84. package/src/generators/scam-to-standalone/lib/convert-scam-to-standalone.js +5 -4
  85. package/src/generators/setup-mf/files/entry-module-files/entry.component.ts__tmpl__ +2 -1
  86. package/src/generators/setup-mf/files/standalone-entry-component-files/entry.component.ts__tmpl__ +2 -2
  87. package/src/generators/setup-mf/lib/add-remote-entry.js +5 -0
  88. package/src/generators/setup-ssr/files/{server → pre-v19/server}/application-builder/__serverFileName__ +1 -1
  89. package/src/generators/setup-ssr/files/{server/server-builder/v17+ → pre-v19/server/server-builder}/__serverFileName__ +1 -1
  90. package/src/generators/setup-ssr/files/v19+/application-builder/ngmodule-src/__main__ +1 -0
  91. package/src/generators/setup-ssr/files/v19+/application-builder/ngmodule-src/app/__rootModuleFileName__ +13 -0
  92. package/src/generators/setup-ssr/files/v19+/application-builder/ngmodule-src/app/app.routes.server.ts__tpl__ +8 -0
  93. package/src/generators/setup-ssr/files/v19+/application-builder/server/__serverFileName__ +66 -0
  94. package/src/generators/setup-ssr/files/v19+/application-builder/standalone-src/__main__ +7 -0
  95. package/src/generators/setup-ssr/files/v19+/application-builder/standalone-src/app/app.config.server.ts__tpl__ +14 -0
  96. package/src/generators/setup-ssr/files/v19+/application-builder/standalone-src/app/app.routes.server.ts__tpl__ +8 -0
  97. package/src/generators/setup-ssr/files/v19+/application-builder-common-engine/server/__serverFileName__ +65 -0
  98. package/src/generators/setup-ssr/files/v19+/server-builder/ngmodule-src/__main__ +1 -0
  99. package/src/generators/setup-ssr/files/v19+/server-builder/ngmodule-src/app/__rootModuleFileName__ +14 -0
  100. package/src/generators/setup-ssr/files/v19+/server-builder/root/tsconfig.server.json.template +16 -0
  101. package/src/generators/setup-ssr/files/{server/server-builder/pre-v17 → v19+/server-builder/server}/__serverFileName__ +25 -15
  102. package/src/generators/setup-ssr/files/v19+/server-builder/standalone-src/__main__ +7 -0
  103. package/src/generators/setup-ssr/files/v19+/server-builder/standalone-src/app/app.config.server.ts.template +11 -0
  104. package/src/generators/setup-ssr/lib/add-dependencies.js +6 -17
  105. package/src/generators/setup-ssr/lib/add-hydration.d.ts +2 -2
  106. package/src/generators/setup-ssr/lib/add-hydration.js +10 -2
  107. package/src/generators/setup-ssr/lib/add-server-file.d.ts +2 -2
  108. package/src/generators/setup-ssr/lib/add-server-file.js +24 -10
  109. package/src/generators/setup-ssr/lib/generate-files.d.ts +2 -2
  110. package/src/generators/setup-ssr/lib/generate-files.js +20 -8
  111. package/src/generators/setup-ssr/lib/generate-server-ts-config.d.ts +3 -3
  112. package/src/generators/setup-ssr/lib/generate-server-ts-config.js +24 -3
  113. package/src/generators/setup-ssr/lib/normalize-options.d.ts +3 -14
  114. package/src/generators/setup-ssr/lib/normalize-options.js +23 -6
  115. package/src/generators/setup-ssr/lib/set-router-initial-navigation.d.ts +2 -2
  116. package/src/generators/setup-ssr/lib/update-project-config.d.ts +3 -3
  117. package/src/generators/setup-ssr/lib/update-project-config.js +36 -24
  118. package/src/generators/setup-ssr/lib/validate-options.js +5 -0
  119. package/src/generators/setup-ssr/schema.d.ts +5 -0
  120. package/src/generators/setup-ssr/schema.json +6 -8
  121. package/src/generators/setup-ssr/setup-ssr.js +6 -11
  122. package/src/generators/setup-tailwind/lib/index.d.ts +1 -1
  123. package/src/generators/setup-tailwind/lib/index.js +1 -1
  124. package/src/generators/setup-tailwind/lib/update-application-styles.js +1 -1
  125. package/src/generators/setup-tailwind/lib/validate-build-target.d.ts +3 -0
  126. package/src/generators/setup-tailwind/lib/{add-tailwind-config-path-to-project.js → validate-build-target.js} +4 -15
  127. package/src/generators/setup-tailwind/setup-tailwind.js +4 -1
  128. package/src/generators/utils/storybook-ast/component-info.js +12 -2
  129. package/src/generators/utils/validations.d.ts +1 -0
  130. package/src/generators/utils/validations.js +10 -0
  131. package/src/generators/utils/version-utils.js +2 -2
  132. package/src/migrations/update-20-2-0/add-localize-polyfill-to-targets.d.ts +3 -0
  133. package/src/migrations/update-20-2-0/add-localize-polyfill-to-targets.js +48 -0
  134. package/src/migrations/update-20-2-0/update-angular-cli.d.ts +3 -0
  135. package/src/migrations/update-20-2-0/update-angular-cli.js +23 -0
  136. package/src/migrations/update-20-2-0/update-angular-ssr-imports-to-use-node-entry-point.d.ts +2 -0
  137. package/src/migrations/update-20-2-0/update-angular-ssr-imports-to-use-node-entry-point.js +55 -0
  138. package/src/utils/backward-compatible-versions.d.ts +4 -4
  139. package/src/utils/backward-compatible-versions.js +20 -19
  140. package/src/utils/nx-devkit/ast-utils.d.ts +10 -1
  141. package/src/utils/nx-devkit/ast-utils.js +32 -9
  142. package/src/utils/versions.d.ts +7 -7
  143. package/src/utils/versions.js +7 -7
  144. package/esm2022/index.mjs +0 -2
  145. package/esm2022/mf/index.mjs +0 -2
  146. package/esm2022/mf/mf.mjs +0 -116
  147. package/esm2022/mf/nx-angular-mf.mjs +0 -5
  148. package/esm2022/nx-angular.mjs +0 -5
  149. package/esm2022/src/runtime/nx/data-persistence.mjs +0 -349
  150. package/esm2022/testing/index.mjs +0 -2
  151. package/esm2022/testing/nx-angular-testing.mjs +0 -5
  152. package/esm2022/testing/src/testing-utils.mjs +0 -38
  153. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.di.d.ts +0 -14
  154. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.di.js +0 -27
  155. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.transform.d.ts +0 -12
  156. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/compile-ngc.transform.js +0 -53
  157. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/entry-point.di.d.ts +0 -15
  158. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/entry-point.di.js +0 -28
  159. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/entry-point.transform.d.ts +0 -30
  160. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/entry-point.transform.js +0 -52
  161. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.di.d.ts +0 -12
  162. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.di.js +0 -20
  163. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.transform.d.ts +0 -9
  164. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/entry-point/write-package.transform.js +0 -320
  165. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/options.di.d.ts +0 -14
  166. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/options.di.js +0 -35
  167. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/package.di.d.ts +0 -14
  168. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ng-package/package.di.js +0 -37
  169. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.d.ts +0 -12
  170. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/ngc/compile-source-files.js +0 -178
  171. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.d.ts +0 -42
  172. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.di.d.ts +0 -10
  173. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.di.js +0 -17
  174. package/src/executors/ng-packagr-lite/ng-packagr-adjustments/pre-v17/styles/stylesheet-processor.js +0 -201
  175. package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.di.d.ts +0 -14
  176. package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.di.js +0 -26
  177. package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.d.ts +0 -12
  178. package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +0 -71
  179. package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/entry-point.di.d.ts +0 -13
  180. package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/entry-point.di.js +0 -32
  181. package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.d.ts +0 -14
  182. package/src/executors/package/ng-packagr-adjustments/ng-package/options.di.js +0 -35
  183. package/src/executors/package/ng-packagr-adjustments/ng-package/package.di.d.ts +0 -14
  184. package/src/executors/package/ng-packagr-adjustments/ng-package/package.di.js +0 -37
  185. package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.d.ts +0 -13
  186. package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +0 -183
  187. package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.d.ts +0 -36
  188. package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.di.d.ts +0 -10
  189. package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.di.js +0 -17
  190. package/src/executors/package/ng-packagr-adjustments/styles/stylesheet-processor.js +0 -194
  191. package/src/executors/package/ng-packagr-adjustments/utils/ng-compiler-cli.d.ts +0 -1
  192. package/src/executors/package/ng-packagr-adjustments/utils/ng-compiler-cli.js +0 -9
  193. package/src/generators/host/files/common/pre-v17/src/main.server.ts__tmpl__ +0 -66
  194. package/src/generators/remote/files/common/pre-v17/src/main.server.ts__tmpl__ +0 -72
  195. package/src/generators/setup-tailwind/lib/add-tailwind-config-path-to-project.d.ts +0 -3
  196. /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-bundles.di.d.ts +0 -0
  197. /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-bundles.di.js +0 -0
  198. /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-bundles.transform.d.ts +0 -0
  199. /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-bundles.transform.js +0 -0
  200. /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-package.di.d.ts +0 -0
  201. /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-package.di.js +0 -0
  202. /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-package.transform.d.ts +0 -0
  203. /package/src/executors/ng-packagr-lite/ng-packagr-adjustments/{v17+ → pre-v19}/ng-package/entry-point/write-package.transform.js +0 -0
  204. /package/src/executors/utilities/ng-packagr/{stylesheet-processor.d.ts → pre-v19/stylesheet-processor.d.ts} +0 -0
  205. /package/src/generators/setup-ssr/files/{ngmodule/src → pre-v19/ngmodule-src}/__main__ +0 -0
  206. /package/src/generators/setup-ssr/files/{ngmodule/src → pre-v19/ngmodule-src}/app/__rootModuleFileName__ +0 -0
  207. /package/src/generators/setup-ssr/files/{root → pre-v19/root}/tsconfig.server.json__tpl__ +0 -0
  208. /package/src/generators/setup-ssr/files/{standalone/src → pre-v19/standalone-src}/__main__ +0 -0
  209. /package/src/generators/setup-ssr/files/{standalone/src → pre-v19/standalone-src}/app/app.config.server.ts__tpl__ +0 -0
package/executors.json CHANGED
@@ -33,7 +33,7 @@
33
33
  "application": {
34
34
  "implementation": "./src/executors/application/application.impl",
35
35
  "schema": "./src/executors/application/schema.json",
36
- "description": "Builds an Angular application using [esbuild](https://esbuild.github.io/) with integrated SSR and prerendering capabilities. _Note: this is only supported in Angular versions >= 17.0.0_."
36
+ "description": "Builds an Angular application using [esbuild](https://esbuild.github.io/) with integrated SSR and prerendering capabilities."
37
37
  },
38
38
  "extract-i18n": {
39
39
  "implementation": "./src/executors/extract-i18n/extract-i18n.impl",
@@ -1 +1 @@
1
- {"version":3,"file":"nx-angular-mf.mjs","sources":["../../../../packages/angular/mf/mf.ts","../../../../packages/angular/mf/nx-angular-mf.ts"],"sourcesContent":["export type ResolveRemoteUrlFunction = (\n remoteName: string\n) => string | Promise<string>;\n\ndeclare const __webpack_init_sharing__: (scope: 'default') => Promise<void>;\ndeclare const __webpack_share_scopes__: { default: unknown };\n\nlet resolveRemoteUrl: ResolveRemoteUrlFunction;\n\n/**\n * @deprecated Use Runtime Helpers from '@module-federation/enhanced/runtime' instead. This will be removed in Nx 22.\n */\nexport function setRemoteUrlResolver(\n _resolveRemoteUrl: ResolveRemoteUrlFunction\n) {\n resolveRemoteUrl = _resolveRemoteUrl;\n}\n\nlet remoteUrlDefinitions: Record<string, string>;\n\n/**\n * @deprecated Use init() from '@module-federation/enhanced/runtime' instead. This will be removed in Nx 22.\n * If you have a remote app called `my-remote-app` and you want to use the `http://localhost:4201/mf-manifest.json` as the remote url, you should change it from:\n * ```ts\n * import { setRemoteDefinitions } from '@nx/angular/mf';\n *\n * setRemoteDefinitions({\n * 'my-remote-app': 'http://localhost:4201/mf-manifest.json'\n * });\n * ```\n * to use init():\n * ```ts\n * import { init } from '@module-federation/enhanced/runtime';\n *\n * init({\n * name: 'host',\n * remotes: [{\n * name: 'my-remote-app',\n * entry: 'http://localhost:4201/mf-manifest.json'\n * }]\n * });\n * ```\n */\nexport function setRemoteDefinitions(definitions: Record<string, string>) {\n remoteUrlDefinitions = definitions;\n}\n\n/**\n * @deprecated Use registerRemotes() from '@module-federation/enhanced/runtime' instead. This will be removed in Nx 22.\n * If you set a remote app with `setRemoteDefinition` such as:\n * ```ts\n * import { setRemoteDefinition } from '@nx/angular/mf';\n *\n * setRemoteDefinition(\n * 'my-remote-app',\n * 'http://localhost:4201/mf-manifest.json'\n * );\n * ```\n * change it to use registerRemotes():\n * ```ts\n * import { registerRemotes } from '@module-federation/enhanced/runtime';\n *\n * registerRemotes([\n * {\n * name: 'my-remote-app',\n * entry: 'http://localhost:4201/mf-manifest.json'\n * }\n * ]);\n * ```\n */\nexport function setRemoteDefinition(remoteName: string, remoteUrl: string) {\n remoteUrlDefinitions ??= {};\n remoteUrlDefinitions[remoteName] = remoteUrl;\n}\n\nlet remoteModuleMap = new Map<string, unknown>();\nlet remoteContainerMap = new Map<string, unknown>();\n\n/**\n * @deprecated Use loadRemote() from '@module-federation/enhanced/runtime' instead. This will be removed in Nx 22.\n * If you set a load a remote with `loadRemoteModule` such as:\n * ```ts\n * import { loadRemoteModule } from '@nx/angular/mf';\n *\n * loadRemoteModule('my-remote-app', './Module').then(m => m.RemoteEntryModule);\n * ```\n * change it to use loadRemote():\n * ```ts\n * import { loadRemote } from '@module-federation/enhanced/runtime';\n *\n * loadRemote<typeof import('my-remote-app/Module')>('my-remote-app/Module').then(m => m.RemoteEntryModule);\n * ```\n */\nexport async function loadRemoteModule(remoteName: string, moduleName: string) {\n const remoteModuleKey = `${remoteName}:${moduleName}`;\n if (remoteModuleMap.has(remoteModuleKey)) {\n return remoteModuleMap.get(remoteModuleKey);\n }\n\n const container = remoteContainerMap.has(remoteName)\n ? remoteContainerMap.get(remoteName)\n : await loadRemoteContainer(remoteName);\n\n const factory = await container.get(moduleName);\n const Module = factory();\n\n remoteModuleMap.set(remoteModuleKey, Module);\n\n return Module;\n}\n\nfunction loadModule(url: string) {\n return import(/* webpackIgnore:true */ url);\n}\n\nlet initialSharingScopeCreated = false;\n\nasync function loadRemoteContainer(remoteName: string) {\n if (!resolveRemoteUrl && !remoteUrlDefinitions) {\n throw new Error(\n 'Call setRemoteDefinitions or setRemoteUrlResolver to allow Dynamic Federation to find the remote apps correctly.'\n );\n }\n\n if (!initialSharingScopeCreated) {\n initialSharingScopeCreated = true;\n await __webpack_init_sharing__('default');\n }\n\n const remoteUrl = remoteUrlDefinitions\n ? remoteUrlDefinitions[remoteName]\n : await resolveRemoteUrl(remoteName);\n\n let containerUrl = remoteUrl;\n if (!remoteUrl.endsWith('.mjs') && !remoteUrl.endsWith('.js')) {\n containerUrl = `${remoteUrl}${\n remoteUrl.endsWith('/') ? '' : '/'\n }remoteEntry.mjs`;\n }\n\n const container = await loadModule(containerUrl);\n await container.init(__webpack_share_scopes__.default);\n\n remoteContainerMap.set(remoteName, container);\n return container;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings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AA,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,UAAU,CAAC,GAAW,EAAA;AAC7B,IAAA,OAAO,gCAAgC,GAAG,CAAC,CAAC;AAC9C,CAAC;AAED,IAAI,0BAA0B,GAAG,KAAK,CAAC;AAEvC,eAAe,mBAAmB,CAAC,UAAkB,EAAA;AACnD,IAAA,IAAI,CAAC,gBAAgB,IAAI,CAAC,oBAAoB,EAAE;AAC9C,QAAA,MAAM,IAAI,KAAK,CACb,kHAAkH,CACnH,CAAC;KACH;IAED,IAAI,CAAC,0BAA0B,EAAE;QAC/B,0BAA0B,GAAG,IAAI,CAAC;AAClC,QAAA,MAAM,wBAAwB,CAAC,SAAS,CAAC,CAAC;KAC3C;IAED,MAAM,SAAS,GAAG,oBAAoB;AACpC,UAAE,oBAAoB,CAAC,UAAU,CAAC;AAClC,UAAE,MAAM,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAEvC,IAAI,YAAY,GAAG,SAAS,CAAC;AAC7B,IAAA,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AAC7D,QAAA,YAAY,GAAG,CAAG,EAAA,SAAS,GACzB,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GACjC,iBAAiB,CAAC;KACnB;AAED,IAAA,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,SAAS,CAAC,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAEvD,IAAA,kBAAkB,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AAC9C,IAAA,OAAO,SAAS,CAAC;AACnB;;ACjJA;;AAEG;;;;"}
1
+ {"version":3,"file":"nx-angular-mf.mjs","sources":["../../../../packages/angular/mf/mf.ts","../../../../packages/angular/mf/nx-angular-mf.ts"],"sourcesContent":["export type ResolveRemoteUrlFunction = (\n remoteName: string\n) => string | Promise<string>;\n\ndeclare const __webpack_init_sharing__: (scope: 'default') => Promise<void>;\ndeclare const __webpack_share_scopes__: { default: unknown };\n\nlet resolveRemoteUrl: ResolveRemoteUrlFunction;\n\n/**\n * @deprecated Use Runtime Helpers from '@module-federation/enhanced/runtime' instead. This will be removed in Nx 22.\n */\nexport function setRemoteUrlResolver(\n _resolveRemoteUrl: ResolveRemoteUrlFunction\n) {\n resolveRemoteUrl = _resolveRemoteUrl;\n}\n\nlet remoteUrlDefinitions: Record<string, string>;\n\n/**\n * @deprecated Use init() from '@module-federation/enhanced/runtime' instead. This will be removed in Nx 22.\n * If you have a remote app called `my-remote-app` and you want to use the `http://localhost:4201/mf-manifest.json` as the remote url, you should change it from:\n * ```ts\n * import { setRemoteDefinitions } from '@nx/angular/mf';\n *\n * setRemoteDefinitions({\n * 'my-remote-app': 'http://localhost:4201/mf-manifest.json'\n * });\n * ```\n * to use init():\n * ```ts\n * import { init } from '@module-federation/enhanced/runtime';\n *\n * init({\n * name: 'host',\n * remotes: [{\n * name: 'my-remote-app',\n * entry: 'http://localhost:4201/mf-manifest.json'\n * }]\n * });\n * ```\n */\nexport function setRemoteDefinitions(definitions: Record<string, string>) {\n remoteUrlDefinitions = definitions;\n}\n\n/**\n * @deprecated Use registerRemotes() from '@module-federation/enhanced/runtime' instead. This will be removed in Nx 22.\n * If you set a remote app with `setRemoteDefinition` such as:\n * ```ts\n * import { setRemoteDefinition } from '@nx/angular/mf';\n *\n * setRemoteDefinition(\n * 'my-remote-app',\n * 'http://localhost:4201/mf-manifest.json'\n * );\n * ```\n * change it to use registerRemotes():\n * ```ts\n * import { registerRemotes } from '@module-federation/enhanced/runtime';\n *\n * registerRemotes([\n * {\n * name: 'my-remote-app',\n * entry: 'http://localhost:4201/mf-manifest.json'\n * }\n * ]);\n * ```\n */\nexport function setRemoteDefinition(remoteName: string, remoteUrl: string) {\n remoteUrlDefinitions ??= {};\n remoteUrlDefinitions[remoteName] = remoteUrl;\n}\n\nlet remoteModuleMap = new Map<string, unknown>();\nlet remoteContainerMap = new Map<string, unknown>();\n\n/**\n * @deprecated Use loadRemote() from '@module-federation/enhanced/runtime' instead. This will be removed in Nx 22.\n * If you set a load a remote with `loadRemoteModule` such as:\n * ```ts\n * import { loadRemoteModule } from '@nx/angular/mf';\n *\n * loadRemoteModule('my-remote-app', './Module').then(m => m.RemoteEntryModule);\n * ```\n * change it to use loadRemote():\n * ```ts\n * import { loadRemote } from '@module-federation/enhanced/runtime';\n *\n * loadRemote<typeof import('my-remote-app/Module')>('my-remote-app/Module').then(m => m.RemoteEntryModule);\n * ```\n */\nexport async function loadRemoteModule(remoteName: string, moduleName: string) {\n const remoteModuleKey = `${remoteName}:${moduleName}`;\n if (remoteModuleMap.has(remoteModuleKey)) {\n return remoteModuleMap.get(remoteModuleKey);\n }\n\n const container = remoteContainerMap.has(remoteName)\n ? remoteContainerMap.get(remoteName)\n : await loadRemoteContainer(remoteName);\n\n const factory = await container.get(moduleName);\n const Module = factory();\n\n remoteModuleMap.set(remoteModuleKey, Module);\n\n return Module;\n}\n\nfunction loadModule(url: string) {\n return import(/* webpackIgnore:true */ url);\n}\n\nlet initialSharingScopeCreated = false;\n\nasync function loadRemoteContainer(remoteName: string) {\n if (!resolveRemoteUrl && !remoteUrlDefinitions) {\n throw new Error(\n 'Call setRemoteDefinitions or setRemoteUrlResolver to allow Dynamic Federation to find the remote apps correctly.'\n );\n }\n\n if (!initialSharingScopeCreated) {\n initialSharingScopeCreated = true;\n await __webpack_init_sharing__('default');\n }\n\n const remoteUrl = remoteUrlDefinitions\n ? remoteUrlDefinitions[remoteName]\n : await resolveRemoteUrl(remoteName);\n\n let containerUrl = remoteUrl;\n if (!remoteUrl.endsWith('.mjs') && !remoteUrl.endsWith('.js')) {\n containerUrl = `${remoteUrl}${\n remoteUrl.endsWith('/') ? '' : '/'\n }remoteEntry.mjs`;\n }\n\n const container = await loadModule(containerUrl);\n await container.init(__webpack_share_scopes__.default);\n\n remoteContainerMap.set(remoteName, container);\n return container;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAOA,IAAI,gBAA0C;AAE9C;;AAEG;AACG,SAAU,oBAAoB,CAClC,iBAA2C,EAAA;IAE3C,gBAAgB,GAAG,iBAAiB;AACtC;AAEA,IAAI,oBAA4C;AAEhD;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACG,SAAU,oBAAoB,CAAC,WAAmC,EAAA;IACtE,oBAAoB,GAAG,WAAW;AACpC;AAEA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACa,SAAA,mBAAmB,CAAC,UAAkB,EAAE,SAAiB,EAAA;IACvE,oBAAoB,KAAK,EAAE;AAC3B,IAAA,oBAAoB,CAAC,UAAU,CAAC,GAAG,SAAS;AAC9C;AAEA,IAAI,eAAe,GAAG,IAAI,GAAG,EAAmB;AAChD,IAAI,kBAAkB,GAAG,IAAI,GAAG,EAAmB;AAEnD;;;;;;;;;;;;;;AAcG;AACI,eAAe,gBAAgB,CAAC,UAAkB,EAAE,UAAkB,EAAA;AAC3E,IAAA,MAAM,eAAe,GAAG,CAAA,EAAG,UAAU,CAAI,CAAA,EAAA,UAAU,EAAE;AACrD,IAAA,IAAI,eAAe,CAAC,GAAG,CAAC,eAAe,CAAC,EAAE;AACxC,QAAA,OAAO,eAAe,CAAC,GAAG,CAAC,eAAe,CAAC;;AAG7C,IAAA,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,UAAU;AACjD,UAAE,kBAAkB,CAAC,GAAG,CAAC,UAAU;AACnC,UAAE,MAAM,mBAAmB,CAAC,UAAU,CAAC;IAEzC,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC;AAC/C,IAAA,MAAM,MAAM,GAAG,OAAO,EAAE;AAExB,IAAA,eAAe,CAAC,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC;AAE5C,IAAA,OAAO,MAAM;AACf;AAEA,SAAS,UAAU,CAAC,GAAW,EAAA;AAC7B,IAAA,OAAO,gCAAgC,GAAG,CAAC;AAC7C;AAEA,IAAI,0BAA0B,GAAG,KAAK;AAEtC,eAAe,mBAAmB,CAAC,UAAkB,EAAA;AACnD,IAAA,IAAI,CAAC,gBAAgB,IAAI,CAAC,oBAAoB,EAAE;AAC9C,QAAA,MAAM,IAAI,KAAK,CACb,kHAAkH,CACnH;;IAGH,IAAI,CAAC,0BAA0B,EAAE;QAC/B,0BAA0B,GAAG,IAAI;AACjC,QAAA,MAAM,wBAAwB,CAAC,SAAS,CAAC;;IAG3C,MAAM,SAAS,GAAG;AAChB,UAAE,oBAAoB,CAAC,UAAU;AACjC,UAAE,MAAM,gBAAgB,CAAC,UAAU,CAAC;IAEtC,IAAI,YAAY,GAAG,SAAS;AAC5B,IAAA,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AAC7D,QAAA,YAAY,GAAG,CAAG,EAAA,SAAS,GACzB,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GACjC,iBAAiB;;AAGnB,IAAA,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC;IAChD,MAAM,SAAS,CAAC,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC;AAEtD,IAAA,kBAAkB,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC;AAC7C,IAAA,OAAO,SAAS;AAClB;;ACjJA;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"nx-angular-testing.mjs","sources":["../../../../packages/angular/testing/src/testing-utils.ts","../../../../packages/angular/testing/nx-angular-testing.ts"],"sourcesContent":["import type { Observable } from 'rxjs';\nimport { first, toArray } from 'rxjs/operators';\n\n/**\n * @deprecated This will be removed in Nx v21. If using RxJS 7, use `firstValueFrom(obs$.pipe(toArray()))`\n * or `lastValueFrom(obs$.pipe(toArray()))`. If using RxJS 6, use `obs$.pipe(toArray()).toPromise()`.\n *\n * @whatItDoes reads all the values from an observable and returns a promise\n * with an array of all values. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readAll(obs)\n * expect(res).toEqual([1, 2, 3, 4]);\n * ```\n */\nexport function readAll<T>(o: Observable<T>): Promise<T[]> {\n return o.pipe(toArray()).toPromise();\n}\n\n/**\n * @deprecated This will be removed in Nx v21. Since RxJS 7, use `firstValueFrom(obs$)`. If using RxJS 6,\n * use `obs$.pipe(first()).toPromise()`.\n *\n * @whatItDoes reads the first value from an observable and returns a promise\n * with it. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readFirst(obs)\n * expect(res).toEqual(1);\n * ```\n */\nexport function readFirst<T>(o: Observable<T>): Promise<T> {\n return o.pipe(first()).toPromise();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAGA;;;;;;;;;;;;;;AAcG;AACG,SAAU,OAAO,CAAI,CAAgB,EAAA;IACzC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;;;;AAcG;AACG,SAAU,SAAS,CAAI,CAAgB,EAAA;IAC3C,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC;AACrC;;ACvCA;;AAEG;;;;"}
1
+ {"version":3,"file":"nx-angular-testing.mjs","sources":["../../../../packages/angular/testing/src/testing-utils.ts","../../../../packages/angular/testing/nx-angular-testing.ts"],"sourcesContent":["import type { Observable } from 'rxjs';\nimport { first, toArray } from 'rxjs/operators';\n\n/**\n * @deprecated This will be removed in Nx v21. If using RxJS 7, use `firstValueFrom(obs$.pipe(toArray()))`\n * or `lastValueFrom(obs$.pipe(toArray()))`. If using RxJS 6, use `obs$.pipe(toArray()).toPromise()`.\n *\n * @whatItDoes reads all the values from an observable and returns a promise\n * with an array of all values. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readAll(obs)\n * expect(res).toEqual([1, 2, 3, 4]);\n * ```\n */\nexport function readAll<T>(o: Observable<T>): Promise<T[]> {\n return o.pipe(toArray()).toPromise();\n}\n\n/**\n * @deprecated This will be removed in Nx v21. Since RxJS 7, use `firstValueFrom(obs$)`. If using RxJS 6,\n * use `obs$.pipe(first()).toPromise()`.\n *\n * @whatItDoes reads the first value from an observable and returns a promise\n * with it. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readFirst(obs)\n * expect(res).toEqual(1);\n * ```\n */\nexport function readFirst<T>(o: Observable<T>): Promise<T> {\n return o.pipe(first()).toPromise();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAGA;;;;;;;;;;;;;;AAcG;AACG,SAAU,OAAO,CAAI,CAAgB,EAAA;IACzC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,SAAS,EAAE;AACtC;AAEA;;;;;;;;;;;;;;AAcG;AACG,SAAU,SAAS,CAAI,CAAgB,EAAA;IAC3C,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE;AACpC;;ACvCA;;AAEG;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"nx-angular.mjs","sources":["../../../../packages/angular/src/runtime/nx/data-persistence.ts","../../../../packages/angular/nx-angular.ts"],"sourcesContent":["import type { Type } from '@angular/core';\nimport type {\n ActivatedRouteSnapshot,\n RouterStateSnapshot,\n} from '@angular/router';\nimport type { RouterNavigationAction } from '@ngrx/router-store';\nimport { ROUTER_NAVIGATION } from '@ngrx/router-store';\nimport type { Action } from '@ngrx/store';\nimport type { Observable } from 'rxjs';\nimport { isObservable, of } from 'rxjs';\nimport {\n catchError,\n concatMap,\n filter,\n groupBy,\n map,\n mergeMap,\n switchMap,\n} from 'rxjs/operators';\n\nexport interface PessimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError(a: A, e: any): Observable<any> | any;\n}\n\nexport interface OptimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n undoAction(a: A, e: any): Observable<Action> | Action;\n}\n\nexport interface FetchOpts<T extends Array<unknown>, A> {\n id?(a: A, ...slices: [...T]): any;\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError?(a: A, e: any): Observable<any> | any;\n}\n\nexport interface HandleNavigationOpts<T extends Array<unknown>> {\n run(\n a: ActivatedRouteSnapshot,\n ...slices: [...T]\n ): Observable<Action> | Action | void;\n onError?(a: ActivatedRouteSnapshot, e: any): Observable<any> | any;\n}\n\nexport type ActionOrActionWithStates<T extends Array<unknown>, A> =\n | A\n | [A, ...T];\nexport type ActionOrActionWithState<T, A> = ActionOrActionWithStates<[T], A>;\nexport type ActionStatesStream<T extends Array<unknown>, A> = Observable<\n ActionOrActionWithStates<T, A>\n>;\nexport type ActionStateStream<T, A> = Observable<\n ActionOrActionWithStates<[T], A>\n>;\n\n/**\n * @whatItDoes Handles pessimistic updates (updating the server first).\n *\n * Updating the server, when implemented naively, suffers from race conditions and poor error handling.\n *\n * `pessimisticUpdate` addresses these problems. It runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('UPDATE_TODO'),\n * pessimisticUpdate({\n * // provides an action\n * run: (action: UpdateTodo) => {\n * // update the backend first, and then dispatch an action that will\n * // update the client side\n * return this.backend.updateTodo(action.todo.id, action.todo).pipe(\n * map((updated) => ({\n * type: 'UPDATE_TODO_SUCCESS',\n * todo: updated,\n * }))\n * );\n * },\n * onError: (action: UpdateTodo, error: any) => {\n * // we don't need to undo the changes on the client side.\n * // we can dispatch an error, or simply log the error here and return `null`\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```typescript\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * //...\n * ), { dispatch: false }\n * );\n * }\n * ```\n *\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `pessimisticUpdate` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function pessimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: PessimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\n/**\n * @whatItDoes Handles optimistic updates (updating the client first).\n *\n * It runs all fetches in order, which removes race conditions and forces the developer to handle errors.\n *\n * When using `optimisticUpdate`, in case of a failure, the developer has already updated the state locally,\n * so the developer must provide an undo action.\n *\n * The error handling must be done in the callback, or by means of the undo action.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('UPDATE_TODO'),\n * optimisticUpdate({\n * // provides an action\n * run: (action: UpdateTodo) => {\n * return this.backend.updateTodo(action.todo.id, action.todo).pipe(\n * mapTo({\n * type: 'UPDATE_TODO_SUCCESS',\n * })\n * );\n * },\n * undoAction: (action: UpdateTodo, error: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return {\n * type: 'UNDO_TODO_UPDATE',\n * todo: action.todo,\n * };\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```typescript\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * //...\n * ), { dispatch: false }\n * );\n * }\n * ```\n *\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `optimisticUpdate` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function optimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: OptimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.undoAction))\n );\n };\n}\n\n/**\n * @whatItDoes Handles data fetching.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `fetch` addresses these problems. It runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * loadTodos$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('GET_TODOS'),\n * fetch({\n * // provides an action\n * run: (a: GetTodos) => {\n * return this.backend.getAll().pipe(\n * map((response) => ({\n * type: 'TODOS',\n * todos: response.todos,\n * }))\n * );\n * },\n * onError: (action: GetTodos, error: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * This is correct, but because it set the concurrency to 1, it may not be performant.\n *\n * To fix that, you can provide the `id` function, like this:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * loadTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('GET_TODO'),\n * fetch({\n * id: (todo: GetTodo) => {\n * return todo.id;\n * },\n * // provides an action\n * run: (todo: GetTodo) => {\n * return this.backend.getTodo(todo.id).map((response) => ({\n * type: 'LOAD_TODO_SUCCESS',\n * todo: response.todo,\n * }));\n * },\n * onError: (action: GetTodo, error: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * With this setup, the requests for Todo 1 will run concurrently with the requests for Todo 2.\n *\n * In addition, if there are multiple requests for Todo 1 scheduled, it will only run the last one.\n *\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `fetch` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function fetch<T extends Array<unknown>, A extends Action>(\n opts: FetchOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n if (opts.id) {\n const groupedFetches = source.pipe(\n mapActionAndState(),\n groupBy(([action, ...store]) => {\n return opts.id(action, ...store);\n })\n );\n\n return groupedFetches.pipe(\n mergeMap((pairs) =>\n pairs.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)))\n )\n );\n }\n\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\n/**\n * @whatItDoes Handles data fetching as part of router navigation.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `navigation` addresses these problems.\n *\n * It checks if an activated router state contains the passed in component type, and, if it does, runs the `run`\n * callback. It provides the activated snapshot associated with the component and the current state. And it only runs\n * the last request.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * loadTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * // listens for the routerNavigation action from @ngrx/router-store\n * navigation(TodoComponent, {\n * run: (activatedRouteSnapshot: ActivatedRouteSnapshot) => {\n * return this.backend\n * .fetchTodo(activatedRouteSnapshot.params['id'])\n * .pipe(\n * map((todo) => ({\n * type: 'LOAD_TODO_SUCCESS',\n * todo: todo,\n * }))\n * );\n * },\n * onError: (\n * activatedRouteSnapshot: ActivatedRouteSnapshot,\n * error: any\n * ) => {\n * // we can log and error here and return null\n * // we can also navigate back\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * @param component\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `navigation` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function navigation<T extends Array<unknown>, A extends Action>(\n component: Type<any>,\n opts: HandleNavigationOpts<T>\n) {\n return (source: ActionStatesStream<T, A>) => {\n const nav = source.pipe(\n mapActionAndState(),\n filter(([action]) => isStateSnapshot(action)),\n map(([action, ...slices]) => {\n if (!isStateSnapshot(action)) {\n // Because of the above filter we'll never get here,\n // but this properly type narrows `action`\n return;\n }\n\n return [\n findSnapshot(component, action.payload.routerState.root),\n ...slices,\n ] as [ActivatedRouteSnapshot, ...T];\n }),\n filter(([snapshot]) => !!snapshot)\n );\n\n return nav.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)));\n };\n}\n\nfunction isStateSnapshot(\n action: any\n): action is RouterNavigationAction<RouterStateSnapshot> {\n return action.type === ROUTER_NAVIGATION;\n}\n\nfunction runWithErrorHandling<T extends Array<unknown>, A, R>(\n run: (a: A, ...slices: [...T]) => Observable<R> | R | void,\n onError: any\n) {\n return ([action, ...slices]: [A, ...T]): Observable<R> => {\n try {\n const r = wrapIntoObservable(run(action, ...slices));\n return r.pipe(catchError((e) => wrapIntoObservable(onError(action, e))));\n } catch (e) {\n return wrapIntoObservable(onError(action, e));\n }\n };\n}\n\n/**\n * @whatItDoes maps Observable<Action | [Action, State]> to\n * Observable<[Action, State]>\n */\nfunction mapActionAndState<T extends Array<unknown>, A>() {\n return (source: Observable<ActionOrActionWithStates<T, A>>) => {\n return source.pipe(\n map((value) => normalizeActionAndState(value) as [A, ...T])\n );\n };\n}\n\n/**\n * @whatItDoes Normalizes either a bare action or an array of action and slices\n * into an array of action and slices (or undefined)\n */\nfunction normalizeActionAndState<T extends Array<unknown>, A>(\n args: ActionOrActionWithStates<T, A>\n): [A, ...T] {\n let action: A, slices: T;\n\n if (args instanceof Array) {\n [action, ...slices] = args;\n } else {\n slices = [] as T;\n action = args;\n }\n\n return [action, ...slices];\n}\n\nfunction findSnapshot(\n component: Type<any>,\n s: ActivatedRouteSnapshot\n): ActivatedRouteSnapshot {\n if (s.routeConfig && s.routeConfig.component === component) {\n return s;\n }\n for (const c of s.children) {\n const ss = findSnapshot(component, c);\n if (ss) {\n return ss;\n }\n }\n return null;\n}\n\nfunction wrapIntoObservable<O>(obj: Observable<O> | O | void): Observable<O> {\n if (isObservable(obj)) {\n return obj;\n } else if (!obj) {\n return of();\n } else {\n return of(obj as O);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAuDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDG;AACG,SAAU,iBAAiB,CAC/B,IAAiC,EAAA;IAEjC,OAAO,CAAC,MAAgC,KAAwB;QAC9D,OAAO,MAAM,CAAC,IAAI,CAChB,iBAAiB,EAAE,EACnB,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CACxD,CAAC;AACJ,KAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DG;AACG,SAAU,gBAAgB,CAC9B,IAAgC,EAAA;IAEhC,OAAO,CAAC,MAAgC,KAAwB;QAC9D,OAAO,MAAM,CAAC,IAAI,CAChB,iBAAiB,EAAE,EACnB,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAC3D,CAAC;AACJ,KAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EG;AACG,SAAU,KAAK,CACnB,IAAqB,EAAA;IAErB,OAAO,CAAC,MAAgC,KAAwB;AAC9D,QAAA,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A,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC;KAC5B;SAAM;QACL,MAAM,GAAG,EAAO,CAAC;QACjB,MAAM,GAAG,IAAI,CAAC;KACf;AAED,IAAA,OAAO,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,YAAY,CACnB,SAAoB,EACpB,CAAyB,EAAA;AAEzB,IAAA,IAAI,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,WAAW,CAAC,SAAS,KAAK,SAAS,EAAE;AAC1D,QAAA,OAAO,CAAC,CAAC;KACV;AACD,IAAA,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QAC1B,MAAM,EAAE,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;QACtC,IAAI,EAAE,EAAE;AACN,YAAA,OAAO,EAAE,CAAC;SACX;KACF;AACD,IAAA,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,kBAAkB,CAAI,GAA6B,EAAA;AAC1D,IAAA,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE;AACrB,QAAA,OAAO,GAAG,CAAC;KACZ;SAAM,IAAI,CAAC,GAAG,EAAE;QACf,OAAO,EAAE,EAAE,CAAC;KACb;SAAM;AACL,QAAA,OAAO,EAAE,CAAC,GAAQ,CAAC,CAAC;KACrB;AACH;;ACpcA;;AAEG;;;;"}
1
+ {"version":3,"file":"nx-angular.mjs","sources":["../../../../packages/angular/src/runtime/nx/data-persistence.ts","../../../../packages/angular/nx-angular.ts"],"sourcesContent":["import type { Type } from '@angular/core';\nimport type {\n ActivatedRouteSnapshot,\n RouterStateSnapshot,\n} from '@angular/router';\nimport type { RouterNavigationAction } from '@ngrx/router-store';\nimport { ROUTER_NAVIGATION } from '@ngrx/router-store';\nimport type { Action } from '@ngrx/store';\nimport type { Observable } from 'rxjs';\nimport { isObservable, of } from 'rxjs';\nimport {\n catchError,\n concatMap,\n filter,\n groupBy,\n map,\n mergeMap,\n switchMap,\n} from 'rxjs/operators';\n\nexport interface PessimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError(a: A, e: any): Observable<any> | any;\n}\n\nexport interface OptimisticUpdateOpts<T extends Array<unknown>, A> {\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n undoAction(a: A, e: any): Observable<Action> | Action;\n}\n\nexport interface FetchOpts<T extends Array<unknown>, A> {\n id?(a: A, ...slices: [...T]): any;\n run(a: A, ...slices: [...T]): Observable<Action> | Action | void;\n onError?(a: A, e: any): Observable<any> | any;\n}\n\nexport interface HandleNavigationOpts<T extends Array<unknown>> {\n run(\n a: ActivatedRouteSnapshot,\n ...slices: [...T]\n ): Observable<Action> | Action | void;\n onError?(a: ActivatedRouteSnapshot, e: any): Observable<any> | any;\n}\n\nexport type ActionOrActionWithStates<T extends Array<unknown>, A> =\n | A\n | [A, ...T];\nexport type ActionOrActionWithState<T, A> = ActionOrActionWithStates<[T], A>;\nexport type ActionStatesStream<T extends Array<unknown>, A> = Observable<\n ActionOrActionWithStates<T, A>\n>;\nexport type ActionStateStream<T, A> = Observable<\n ActionOrActionWithStates<[T], A>\n>;\n\n/**\n * @whatItDoes Handles pessimistic updates (updating the server first).\n *\n * Updating the server, when implemented naively, suffers from race conditions and poor error handling.\n *\n * `pessimisticUpdate` addresses these problems. It runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('UPDATE_TODO'),\n * pessimisticUpdate({\n * // provides an action\n * run: (action: UpdateTodo) => {\n * // update the backend first, and then dispatch an action that will\n * // update the client side\n * return this.backend.updateTodo(action.todo.id, action.todo).pipe(\n * map((updated) => ({\n * type: 'UPDATE_TODO_SUCCESS',\n * todo: updated,\n * }))\n * );\n * },\n * onError: (action: UpdateTodo, error: any) => {\n * // we don't need to undo the changes on the client side.\n * // we can dispatch an error, or simply log the error here and return `null`\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```typescript\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * //...\n * ), { dispatch: false }\n * );\n * }\n * ```\n *\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `pessimisticUpdate` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function pessimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: PessimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\n/**\n * @whatItDoes Handles optimistic updates (updating the client first).\n *\n * It runs all fetches in order, which removes race conditions and forces the developer to handle errors.\n *\n * When using `optimisticUpdate`, in case of a failure, the developer has already updated the state locally,\n * so the developer must provide an undo action.\n *\n * The error handling must be done in the callback, or by means of the undo action.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('UPDATE_TODO'),\n * optimisticUpdate({\n * // provides an action\n * run: (action: UpdateTodo) => {\n * return this.backend.updateTodo(action.todo.id, action.todo).pipe(\n * mapTo({\n * type: 'UPDATE_TODO_SUCCESS',\n * })\n * );\n * },\n * undoAction: (action: UpdateTodo, error: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return {\n * type: 'UNDO_TODO_UPDATE',\n * todo: action.todo,\n * };\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * Note that if you don't return a new action from the run callback, you must set the dispatch property\n * of the effect to false, like this:\n *\n * ```typescript\n * class TodoEffects {\n * updateTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * //...\n * ), { dispatch: false }\n * );\n * }\n * ```\n *\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `optimisticUpdate` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function optimisticUpdate<T extends Array<unknown>, A extends Action>(\n opts: OptimisticUpdateOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.undoAction))\n );\n };\n}\n\n/**\n * @whatItDoes Handles data fetching.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `fetch` addresses these problems. It runs all fetches in order, which removes race conditions\n * and forces the developer to handle errors.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * loadTodos$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('GET_TODOS'),\n * fetch({\n * // provides an action\n * run: (a: GetTodos) => {\n * return this.backend.getAll().pipe(\n * map((response) => ({\n * type: 'TODOS',\n * todos: response.todos,\n * }))\n * );\n * },\n * onError: (action: GetTodos, error: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * This is correct, but because it set the concurrency to 1, it may not be performant.\n *\n * To fix that, you can provide the `id` function, like this:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * loadTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * ofType('GET_TODO'),\n * fetch({\n * id: (todo: GetTodo) => {\n * return todo.id;\n * },\n * // provides an action\n * run: (todo: GetTodo) => {\n * return this.backend.getTodo(todo.id).map((response) => ({\n * type: 'LOAD_TODO_SUCCESS',\n * todo: response.todo,\n * }));\n * },\n * onError: (action: GetTodo, error: any) => {\n * // dispatch an undo action to undo the changes in the client state\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * With this setup, the requests for Todo 1 will run concurrently with the requests for Todo 2.\n *\n * In addition, if there are multiple requests for Todo 1 scheduled, it will only run the last one.\n *\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `fetch` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function fetch<T extends Array<unknown>, A extends Action>(\n opts: FetchOpts<T, A>\n) {\n return (source: ActionStatesStream<T, A>): Observable<Action> => {\n if (opts.id) {\n const groupedFetches = source.pipe(\n mapActionAndState(),\n groupBy(([action, ...store]) => {\n return opts.id(action, ...store);\n })\n );\n\n return groupedFetches.pipe(\n mergeMap((pairs) =>\n pairs.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)))\n )\n );\n }\n\n return source.pipe(\n mapActionAndState(),\n concatMap(runWithErrorHandling(opts.run, opts.onError))\n );\n };\n}\n\n/**\n * @whatItDoes Handles data fetching as part of router navigation.\n *\n * Data fetching implemented naively suffers from race conditions and poor error handling.\n *\n * `navigation` addresses these problems.\n *\n * It checks if an activated router state contains the passed in component type, and, if it does, runs the `run`\n * callback. It provides the activated snapshot associated with the component and the current state. And it only runs\n * the last request.\n *\n * ## Example:\n *\n * ```typescript\n * @Injectable()\n * class TodoEffects {\n * loadTodo$ = createEffect(() =>\n * this.actions$.pipe(\n * // listens for the routerNavigation action from @ngrx/router-store\n * navigation(TodoComponent, {\n * run: (activatedRouteSnapshot: ActivatedRouteSnapshot) => {\n * return this.backend\n * .fetchTodo(activatedRouteSnapshot.params['id'])\n * .pipe(\n * map((todo) => ({\n * type: 'LOAD_TODO_SUCCESS',\n * todo: todo,\n * }))\n * );\n * },\n * onError: (\n * activatedRouteSnapshot: ActivatedRouteSnapshot,\n * error: any\n * ) => {\n * // we can log and error here and return null\n * // we can also navigate back\n * return null;\n * },\n * })\n * )\n * );\n *\n * constructor(private actions$: Actions, private backend: Backend) {}\n * }\n * ```\n *\n * @param component\n * @param opts\n *\n * @deprecated This will be removed in Nx v21. Import `navigation` from `@ngrx/router-store/data-persistence` instead.\n */\nexport function navigation<T extends Array<unknown>, A extends Action>(\n component: Type<any>,\n opts: HandleNavigationOpts<T>\n) {\n return (source: ActionStatesStream<T, A>) => {\n const nav = source.pipe(\n mapActionAndState(),\n filter(([action]) => isStateSnapshot(action)),\n map(([action, ...slices]) => {\n if (!isStateSnapshot(action)) {\n // Because of the above filter we'll never get here,\n // but this properly type narrows `action`\n return;\n }\n\n return [\n findSnapshot(component, action.payload.routerState.root),\n ...slices,\n ] as [ActivatedRouteSnapshot, ...T];\n }),\n filter(([snapshot]) => !!snapshot)\n );\n\n return nav.pipe(switchMap(runWithErrorHandling(opts.run, opts.onError)));\n };\n}\n\nfunction isStateSnapshot(\n action: any\n): action is RouterNavigationAction<RouterStateSnapshot> {\n return action.type === ROUTER_NAVIGATION;\n}\n\nfunction runWithErrorHandling<T extends Array<unknown>, A, R>(\n run: (a: A, ...slices: [...T]) => Observable<R> | R | void,\n onError: any\n) {\n return ([action, ...slices]: [A, ...T]): Observable<R> => {\n try {\n const r = wrapIntoObservable(run(action, ...slices));\n return r.pipe(catchError((e) => wrapIntoObservable(onError(action, e))));\n } catch (e) {\n return wrapIntoObservable(onError(action, e));\n }\n };\n}\n\n/**\n * @whatItDoes maps Observable<Action | [Action, State]> to\n * Observable<[Action, State]>\n */\nfunction mapActionAndState<T extends Array<unknown>, A>() {\n return (source: Observable<ActionOrActionWithStates<T, A>>) => {\n return source.pipe(\n map((value) => normalizeActionAndState(value) as [A, ...T])\n );\n };\n}\n\n/**\n * @whatItDoes Normalizes either a bare action or an array of action and slices\n * into an array of action and slices (or undefined)\n */\nfunction normalizeActionAndState<T extends Array<unknown>, A>(\n args: ActionOrActionWithStates<T, A>\n): [A, ...T] {\n let action: A, slices: T;\n\n if (args instanceof Array) {\n [action, ...slices] = args;\n } else {\n slices = [] as T;\n action = args;\n }\n\n return [action, ...slices];\n}\n\nfunction findSnapshot(\n component: Type<any>,\n s: ActivatedRouteSnapshot\n): ActivatedRouteSnapshot {\n if (s.routeConfig && s.routeConfig.component === component) {\n return s;\n }\n for (const c of s.children) {\n const ss = findSnapshot(component, c);\n if (ss) {\n return ss;\n }\n }\n return null;\n}\n\nfunction wrapIntoObservable<O>(obj: Observable<O> | O | void): Observable<O> {\n if (isObservable(obj)) {\n return obj;\n } else if (!obj) {\n return of();\n } else {\n return of(obj as O);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAuDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDG;AACG,SAAU,iBAAiB,CAC/B,IAAiC,EAAA;IAEjC,OAAO,CAAC,MAAgC,KAAwB;QAC9D,OAAO,MAAM,CAAC,IAAI,CAChB,iBAAiB,EAAE,EACnB,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CACxD;AACH,KAAC;AACH;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DG;AACG,SAAU,gBAAgB,CAC9B,IAAgC,EAAA;IAEhC,OAAO,CAAC,MAAgC,KAAwB;QAC9D,OAAO,MAAM,CAAC,IAAI,CAChB,iBAAiB,EAAE,EACnB,SAAS,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAC3D;AACH,KAAC;AACH;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EG;AACG,SAAU,KAAK,CACnB,IAAqB,EAAA;IAErB,OAAO,CAAC,MAAgC,KAAwB;AAC9D,QAAA,IAAI,IAAI,CAAC,EAAE,EAAE;AACX,YAAA,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAChC,iBAAiB,EAAE,EACnB,OAAO,CAAC,CAAC,CAAC,M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AAS,KAAK,SAAS,EAAE;AAC1D,QAAA,OAAO,CAAC;;AAEV,IAAA,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QAC1B,MAAM,EAAE,GAAG,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC;QACrC,IAAI,EAAE,EAAE;AACN,YAAA,OAAO,EAAE;;;AAGb,IAAA,OAAO,IAAI;AACb;AAEA,SAAS,kBAAkB,CAAI,GAA6B,EAAA;AAC1D,IAAA,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE;AACrB,QAAA,OAAO,GAAG;;SACL,IAAI,CAAC,GAAG,EAAE;QACf,OAAO,EAAE,EAAE;;SACN;AACL,QAAA,OAAO,EAAE,CAAC,GAAQ,CAAC;;AAEvB;;ACpcA;;AAEG;;;;"}
package/generators.json CHANGED
@@ -36,7 +36,7 @@
36
36
  "convert-to-application-executor": {
37
37
  "factory": "./src/generators/convert-to-application-executor/convert-to-application-executor",
38
38
  "schema": "./src/generators/convert-to-application-executor/schema.json",
39
- "description": "Converts projects to use the `@nx/angular:application` executor or the `@angular-devkit/build-angular:application` builder. _Note: this is only supported in Angular versions >= 17.0.0_."
39
+ "description": "Converts projects to use the `@nx/angular:application` executor or the `@angular-devkit/build-angular:application` builder."
40
40
  },
41
41
  "directive": {
42
42
  "factory": "./src/generators/directive/directive",
package/migrations.json CHANGED
@@ -278,6 +278,33 @@
278
278
  "version": "20.2.0-beta.2",
279
279
  "description": "Update the withModuleFederation import use @nx/module-federation/angular.",
280
280
  "factory": "./src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package"
281
+ },
282
+ "update-angular-cli-version-19-0-0": {
283
+ "cli": "nx",
284
+ "version": "20.2.0-beta.5",
285
+ "requires": {
286
+ "@angular/core": ">=19.0.0"
287
+ },
288
+ "description": "Update the @angular/cli package version to ~19.0.0.",
289
+ "factory": "./src/migrations/update-20-2-0/update-angular-cli"
290
+ },
291
+ "add-localize-polyfill-to-targets": {
292
+ "cli": "nx",
293
+ "version": "20.2.0-beta.5",
294
+ "requires": {
295
+ "@angular/core": ">=19.0.0-rc.1"
296
+ },
297
+ "description": "Add the '@angular/localize/init' polyfill to the 'polyfills' option of targets using esbuild-based executors.",
298
+ "factory": "./src/migrations/update-20-2-0/add-localize-polyfill-to-targets"
299
+ },
300
+ "update-angular-ssr-imports-to-use-node-entry-point": {
301
+ "cli": "nx",
302
+ "version": "20.2.0-beta.5",
303
+ "requires": {
304
+ "@angular/core": ">=19.0.0-rc.1"
305
+ },
306
+ "description": "Update '@angular/ssr' import paths to use the new '/node' entry point when 'CommonEngine' is detected.",
307
+ "factory": "./src/migrations/update-20-2-0/update-angular-ssr-imports-to-use-node-entry-point"
281
308
  }
282
309
  },
283
310
  "packageJsonUpdates": {
@@ -1171,7 +1198,7 @@
1171
1198
  }
1172
1199
  }
1173
1200
  },
1174
- "20.2.0": {
1201
+ "20.2.0-module-federation": {
1175
1202
  "version": "20.2.0-beta.3",
1176
1203
  "packages": {
1177
1204
  "@module-federation/enhanced": {
@@ -1191,6 +1218,129 @@
1191
1218
  "alwaysAddToPackageJson": false
1192
1219
  }
1193
1220
  }
1221
+ },
1222
+ "20.2.0": {
1223
+ "version": "20.2.0-beta.5",
1224
+ "x-prompt": "Do you want to update the Angular version to v19?",
1225
+ "requires": {
1226
+ "@angular/core": ">=18.2.0 <19.0.0"
1227
+ },
1228
+ "packages": {
1229
+ "@angular-devkit/build-angular": {
1230
+ "version": "~19.0.0",
1231
+ "alwaysAddToPackageJson": false
1232
+ },
1233
+ "@angular-devkit/core": {
1234
+ "version": "~19.0.0",
1235
+ "alwaysAddToPackageJson": false
1236
+ },
1237
+ "@angular-devkit/schematics": {
1238
+ "version": "~19.0.0",
1239
+ "alwaysAddToPackageJson": false
1240
+ },
1241
+ "@angular/build": {
1242
+ "version": "~19.0.0",
1243
+ "alwaysAddToPackageJson": false
1244
+ },
1245
+ "@angular/pwa": {
1246
+ "version": "~19.0.0",
1247
+ "alwaysAddToPackageJson": false
1248
+ },
1249
+ "@angular/ssr": {
1250
+ "version": "~19.0.0",
1251
+ "alwaysAddToPackageJson": false
1252
+ },
1253
+ "@schematics/angular": {
1254
+ "version": "~19.0.0",
1255
+ "alwaysAddToPackageJson": false
1256
+ },
1257
+ "@angular-devkit/architect": {
1258
+ "version": "~0.1900.0",
1259
+ "alwaysAddToPackageJson": false
1260
+ },
1261
+ "@angular-devkit/build-webpack": {
1262
+ "version": "~0.1900.0",
1263
+ "alwaysAddToPackageJson": false
1264
+ },
1265
+ "@angular/core": {
1266
+ "version": "~19.0.0",
1267
+ "alwaysAddToPackageJson": true
1268
+ },
1269
+ "@angular/material": {
1270
+ "version": "~19.0.0",
1271
+ "alwaysAddToPackageJson": false
1272
+ },
1273
+ "@angular/cdk": {
1274
+ "version": "~19.0.0",
1275
+ "alwaysAddToPackageJson": false
1276
+ },
1277
+ "ng-packagr": {
1278
+ "version": "~19.0.0",
1279
+ "alwaysAddToPackageJson": false
1280
+ },
1281
+ "zone.js": {
1282
+ "version": "~0.15.0",
1283
+ "alwaysAddToPackageJson": false
1284
+ }
1285
+ }
1286
+ },
1287
+ "20.2.0-analog": {
1288
+ "version": "20.2.0-beta.5",
1289
+ "packages": {
1290
+ "@analogjs/vitest-angular": {
1291
+ "version": "~1.10.0-beta.6",
1292
+ "alwaysAddToPackageJson": false
1293
+ },
1294
+ "@analogjs/vite-plugin-angular": {
1295
+ "version": "~1.10.0-beta.6",
1296
+ "alwaysAddToPackageJson": false
1297
+ }
1298
+ }
1299
+ },
1300
+ "20.2.0-jest": {
1301
+ "version": "20.2.0-beta.5",
1302
+ "requires": {
1303
+ "@angular-devkit/build-angular": ">=15.0.0 <20.0.0",
1304
+ "@angular/compiler-cli": ">=15.0.0 <20.0.0",
1305
+ "@angular/core": ">=15.0.0 <20.0.0",
1306
+ "@angular/platform-browser-dynamic": ">=15.0.0 <20.0.0",
1307
+ "jest": "^29.0.0"
1308
+ },
1309
+ "packages": {
1310
+ "jest-preset-angular": {
1311
+ "version": "~14.4.0",
1312
+ "alwaysAddToPackageJson": false
1313
+ }
1314
+ }
1315
+ },
1316
+ "20.2.0-angular-eslint": {
1317
+ "version": "20.2.0-beta.5",
1318
+ "requires": {
1319
+ "eslint": "^8.57.0 || ^9.0.0",
1320
+ "@angular/core": ">= 19.0.0 < 20.0.0"
1321
+ },
1322
+ "packages": {
1323
+ "angular-eslint": {
1324
+ "version": "^19.0.0",
1325
+ "alwaysAddToPackageJson": false
1326
+ },
1327
+ "@angular-eslint/eslint-plugin": {
1328
+ "version": "^19.0.0",
1329
+ "alwaysAddToPackageJson": false
1330
+ },
1331
+ "@angular-eslint/eslint-plugin-template": {
1332
+ "version": "^19.0.0",
1333
+ "alwaysAddToPackageJson": false
1334
+ },
1335
+ "@angular-eslint/template-parser": {
1336
+ "version": "^19.0.0",
1337
+ "alwaysAddToPackageJson": false
1338
+ },
1339
+ "@angular-eslint/utils": {
1340
+ "version": "^19.0.0",
1341
+ "alwaysAddToPackageJson": false
1342
+ }
1343
+ }
1194
1344
  }
1195
1345
  }
1196
1346
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "20.2.0-canary.20241130-ec5a5e6",
3
+ "version": "20.2.0-canary.20241203-6b87005",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Tailwind CSS, Playwright and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -39,20 +39,14 @@
39
39
  },
40
40
  ".": {
41
41
  "types": "./index.d.ts",
42
- "esm2022": "./esm2022/nx-angular.mjs",
43
- "esm": "./esm2022/nx-angular.mjs",
44
42
  "default": "./fesm2022/nx-angular.mjs"
45
43
  },
46
44
  "./mf": {
47
45
  "types": "./mf/index.d.ts",
48
- "esm2022": "./esm2022/mf/nx-angular-mf.mjs",
49
- "esm": "./esm2022/mf/nx-angular-mf.mjs",
50
46
  "default": "./fesm2022/nx-angular-mf.mjs"
51
47
  },
52
48
  "./testing": {
53
49
  "types": "./testing/index.d.ts",
54
- "esm2022": "./esm2022/testing/nx-angular-testing.mjs",
55
- "esm": "./esm2022/testing/nx-angular-testing.mjs",
56
50
  "default": "./fesm2022/nx-angular-testing.mjs"
57
51
  }
58
52
  },
@@ -72,19 +66,18 @@
72
66
  "@phenomnomnominal/tsquery": "~5.0.1",
73
67
  "@typescript-eslint/type-utils": "^8.0.0",
74
68
  "chalk": "^4.1.0",
75
- "find-cache-dir": "^3.3.2",
76
69
  "magic-string": "~0.30.2",
77
70
  "minimatch": "9.0.3",
78
71
  "semver": "^7.5.3",
79
72
  "tslib": "^2.3.0",
80
73
  "webpack-merge": "^5.8.0",
81
- "@nx/devkit": "20.2.0-canary.20241130-ec5a5e6",
82
- "@nx/js": "20.2.0-canary.20241130-ec5a5e6",
83
- "@nx/eslint": "20.2.0-canary.20241130-ec5a5e6",
84
- "@nx/webpack": "20.2.0-canary.20241130-ec5a5e6",
85
- "@nx/module-federation": "20.2.0-canary.20241130-ec5a5e6",
86
- "@nx/web": "20.2.0-canary.20241130-ec5a5e6",
87
- "@nx/workspace": "20.2.0-canary.20241130-ec5a5e6",
74
+ "@nx/devkit": "20.2.0-canary.20241203-6b87005",
75
+ "@nx/js": "20.2.0-canary.20241203-6b87005",
76
+ "@nx/eslint": "20.2.0-canary.20241203-6b87005",
77
+ "@nx/webpack": "20.2.0-canary.20241203-6b87005",
78
+ "@nx/module-federation": "20.2.0-canary.20241203-6b87005",
79
+ "@nx/web": "20.2.0-canary.20241203-6b87005",
80
+ "@nx/workspace": "20.2.0-canary.20241203-6b87005",
88
81
  "piscina": "^4.4.0"
89
82
  },
90
83
  "peerDependencies": {
@@ -1,18 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeOptions = normalizeOptions;
4
+ const angular_version_utils_1 = require("../../../executors/utilities/angular-version-utils");
4
5
  function normalizeOptions(schema) {
5
6
  let buildTarget = schema.buildTarget;
6
7
  if (schema.browserTarget) {
7
8
  buildTarget ??= schema.browserTarget;
8
9
  delete schema.browserTarget;
9
10
  }
11
+ const { major: angularMajorVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
10
12
  return {
11
13
  ...schema,
12
14
  buildTarget,
13
15
  host: schema.host ?? 'localhost',
14
16
  port: schema.port ?? 4200,
15
17
  liveReload: schema.liveReload ?? true,
18
+ hmr: angularMajorVersion < 19 ? schema.hmr ?? false : undefined,
16
19
  open: schema.open ?? false,
17
20
  ssl: schema.ssl ?? false,
18
21
  };
@@ -5,15 +5,7 @@ const devkit_1 = require("@nx/devkit");
5
5
  const semver_1 = require("semver");
6
6
  const angular_version_utils_1 = require("../../../executors/utilities/angular-version-utils");
7
7
  function validateOptions(options) {
8
- const { major: angularMajorVersion, version: angularVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
9
- if ((0, semver_1.lt)(angularVersion, '16.1.0') && options.forceEsbuild) {
10
- throw new Error((0, devkit_1.stripIndents) `The "forceEsbuild" option is only supported in Angular >= 16.1.0. You are currently using "${angularVersion}".
11
- You can resolve this error by removing the "forceEsbuild" option or by migrating to Angular 16.1.0.`);
12
- }
13
- if (angularMajorVersion < 17 && options.esbuildMiddleware?.length > 0) {
14
- throw new Error((0, devkit_1.stripIndents) `The "esbuildMiddleware" option is only supported in Angular >= 17.0.0. You are currently using "${angularVersion}".
15
- You can resolve this error by removing the "esbuildMiddleware" option or by migrating to Angular 17.0.0.`);
16
- }
8
+ const { version: angularVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
17
9
  if ((0, semver_1.lt)(angularVersion, '17.2.0') && options.prebundle) {
18
10
  throw new Error((0, devkit_1.stripIndents) `The "prebundle" option is only supported in Angular >= 17.2.0. You are currently using "${angularVersion}".
19
11
  You can resolve this error by removing the "prebundle" option or by migrating to Angular 17.2.0.`);
@@ -99,8 +99,7 @@
99
99
  },
100
100
  "hmr": {
101
101
  "type": "boolean",
102
- "description": "Enable hot module replacement.",
103
- "default": false
102
+ "description": "Enable hot module replacement. It defaults to `false` in Angular versions < 19.0.0. Otherwise, the value will be `undefined`."
104
103
  },
105
104
  "watch": {
106
105
  "type": "boolean",
@@ -113,7 +112,7 @@
113
112
  },
114
113
  "forceEsbuild": {
115
114
  "type": "boolean",
116
- "description": "Force the development server to use the 'browser-esbuild' builder when building. This is a developer preview option for the esbuild-based build system. _Note: this is only supported in Angular versions >= 16.1.0_.",
115
+ "description": "Force the development server to use the 'browser-esbuild' builder when building. This is a developer preview option for the esbuild-based build system.",
117
116
  "default": false
118
117
  },
119
118
  "inspect": {
@@ -151,7 +150,7 @@
151
150
  "x-priority": "important"
152
151
  },
153
152
  "esbuildMiddleware": {
154
- "description": "A list of HTTP request middleware functions. _Note: this is only supported in Angular versions >= 17.0.0_.",
153
+ "description": "A list of HTTP request middleware functions.",
155
154
  "type": "array",
156
155
  "items": {
157
156
  "type": "string",
@@ -1,4 +1,4 @@
1
+ import type { buildApplication as buildApplicationFn } from '@angular-devkit/build-angular';
1
2
  import type { ExecutorContext } from '@nx/devkit';
2
3
  import type { ApplicationExecutorOptions } from './schema';
3
- import type { buildApplication as buildApplicationFn } from '@angular-devkit/build-angular';
4
4
  export default function applicationExecutor(options: ApplicationExecutorOptions, context: ExecutorContext): ReturnType<typeof buildApplicationFn>;
@@ -6,9 +6,11 @@ const semver_1 = require("semver");
6
6
  const angular_version_utils_1 = require("../utilities/angular-version-utils");
7
7
  const buildable_libs_1 = require("../utilities/buildable-libs");
8
8
  const esbuild_extensions_1 = require("../utilities/esbuild-extensions");
9
+ const normalize_options_1 = require("./utils/normalize-options");
9
10
  const validate_options_1 = require("./utils/validate-options");
10
11
  async function* applicationExecutor(options, context) {
11
12
  (0, validate_options_1.validateOptions)(options);
13
+ options = (0, normalize_options_1.normalizeOptions)(options);
12
14
  const { buildLibsFromSource = true, plugins: pluginPaths, indexHtmlTransformer: indexHtmlTransformerPath, ...delegateExecutorOptions } = options;
13
15
  let dependencies;
14
16
  if (!buildLibsFromSource) {
@@ -20,7 +22,6 @@ async function* applicationExecutor(options, context) {
20
22
  const indexHtmlTransformer = indexHtmlTransformerPath
21
23
  ? await (0, esbuild_extensions_1.loadIndexHtmlTransformer)(indexHtmlTransformerPath, options.tsConfig)
22
24
  : undefined;
23
- const { buildApplication } = await import('@angular-devkit/build-angular');
24
25
  const builderContext = await (0, ngcli_adapter_1.createBuilderContext)({
25
26
  builderName: 'application',
26
27
  description: 'Build an application.',
@@ -28,10 +29,12 @@ async function* applicationExecutor(options, context) {
28
29
  }, context);
29
30
  const { version: angularVersion } = (0, angular_version_utils_1.getInstalledAngularVersionInfo)();
30
31
  if ((0, semver_1.gte)(angularVersion, '17.1.0')) {
32
+ const { buildApplication } = await import('@angular-devkit/build-angular');
31
33
  return yield* buildApplication(delegateExecutorOptions, builderContext, {
32
34
  codePlugins: plugins,
33
35
  indexHtmlTransformer,
34
36
  });
35
37
  }
38
+ const { buildApplication } = require('@angular-devkit/build-angular');
36
39
  return yield* buildApplication(delegateExecutorOptions, builderContext, plugins);
37
40
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema",
3
3
  "title": "Schema for Nx Application Executor",
4
- "description": "Builds an Angular application using [esbuild](https://esbuild.github.io/) with integrated SSR and prerendering capabilities. _Note: this is only supported in Angular versions >= 17.0.0_.",
4
+ "description": "Builds an Angular application using [esbuild](https://esbuild.github.io/) with integrated SSR and prerendering capabilities.",
5
5
  "examplesFile": "../../../docs/application-executor-examples.md",
6
6
  "outputCapture": "direct-nodejs",
7
7
  "type": "object",
@@ -20,7 +20,18 @@
20
20
  },
21
21
  "server": {
22
22
  "type": "string",
23
- "description": "The full path for the server entry point to the application, relative to the current workspace."
23
+ "description": "The full path for the server entry point to the application, relative to the current workspace.",
24
+ "oneOf": [
25
+ {
26
+ "type": "string",
27
+ "description": "The full path for the server entry point to the application, relative to the current workspace."
28
+ },
29
+ {
30
+ "const": false,
31
+ "type": "boolean",
32
+ "description": "Indicates that a server entry point is not provided. _Note: this is only supported in Angular versions >= 19.0.0_."
33
+ }
34
+ ]
24
35
  },
25
36
  "polyfills": {
26
37
  "description": "A list of polyfills to include in the build. Can be a full path for a file, relative to the current workspace or module specifier. Example: 'zone.js'.",
@@ -39,6 +50,31 @@
39
50
  "type": "string",
40
51
  "description": "Customize the base path for the URLs of resources in 'index.html' and component stylesheets. This option is only necessary for specific deployment scenarios, such as with Angular Elements or when utilizing different CDN locations. _Note: this is only supported in Angular versions >= 17.3.0_."
41
52
  },
53
+ "security": {
54
+ "description": "Security features to protect against XSS and other common attacks. _Note: this is only supported in Angular versions >= 19.0.0_.",
55
+ "type": "object",
56
+ "additionalProperties": false,
57
+ "properties": {
58
+ "autoCsp": {
59
+ "description": "Enables automatic generation of a hash-based Strict Content Security Policy (https://web.dev/articles/strict-csp#choose-hash) based on scripts in index.html. Will default to true once we are out of experimental/preview phases. It defaults to `false`.",
60
+ "oneOf": [
61
+ {
62
+ "type": "object",
63
+ "properties": {
64
+ "unsafeEval": {
65
+ "type": "boolean",
66
+ "description": "Include the `unsafe-eval` directive (https://web.dev/articles/strict-csp#remove-eval) in the auto-CSP. Please only enable this if you are absolutely sure that you need to, as allowing calls to eval will weaken the XSS defenses provided by the auto-CSP. It default to `false`."
67
+ }
68
+ },
69
+ "additionalProperties": false
70
+ },
71
+ {
72
+ "type": "boolean"
73
+ }
74
+ ]
75
+ }
76
+ }
77
+ },
42
78
  "scripts": {
43
79
  "description": "Global scripts to be included in the build.",
44
80
  "type": "array",
@@ -127,6 +163,34 @@
127
163
  "type": "string"
128
164
  },
129
165
  "default": []
166
+ },
167
+ "sass": {
168
+ "description": "Options to pass to the sass preprocessor. _Note: this is only supported in Angular versions >= 19.0.0_.",
169
+ "type": "object",
170
+ "properties": {
171
+ "fatalDeprecations": {
172
+ "description": "A set of deprecations to treat as fatal. If a deprecation warning of any provided type is encountered during compilation, the compiler will error instead. If a Version is provided, then all deprecations that were active in that compiler version will be treated as fatal.",
173
+ "type": "array",
174
+ "items": {
175
+ "type": "string"
176
+ }
177
+ },
178
+ "silenceDeprecations": {
179
+ "description": " A set of active deprecations to ignore. If a deprecation warning of any provided type is encountered during compilation, the compiler will ignore it instead.",
180
+ "type": "array",
181
+ "items": {
182
+ "type": "string"
183
+ }
184
+ },
185
+ "futureDeprecations": {
186
+ "description": "A set of future deprecations to opt into early. Future deprecations passed here will be treated as active by the compiler, emitting warnings as necessary.",
187
+ "type": "array",
188
+ "items": {
189
+ "type": "string"
190
+ }
191
+ }
192
+ },
193
+ "additionalProperties": false
130
194
  }
131
195
  },
132
196
  "additionalProperties": false
@@ -480,8 +544,7 @@
480
544
  "default": []
481
545
  },
482
546
  "prerender": {
483
- "description": "Prerender (SSG) pages of your application during build time.",
484
- "default": false,
547
+ "description": "Prerender (SSG) pages of your application during build time. It defaults to `false` in Angular versions < 19.0.0. Otherwise, the value will be `undefined`.",
485
548
  "oneOf": [
486
549
  {
487
550
  "type": "boolean",
@@ -518,6 +581,11 @@
518
581
  "entry": {
519
582
  "type": "string",
520
583
  "description": "The server entry-point that when executed will spawn the web server."
584
+ },
585
+ "experimentalPlatform": {
586
+ "description": "Specifies the platform for which the server bundle is generated. This affects the APIs and modules available in the server-side code. \n\n- `node`: (Default) Generates a bundle optimized for Node.js environments. \n- `neutral`: Generates a platform-neutral bundle suitable for environments like edge workers, and other serverless platforms. This option avoids using Node.js-specific APIs, making the bundle more portable. \n\nPlease note that this feature does not provide polyfills for Node.js modules. Additionally, it is experimental, and the feature may undergo changes in future versions. _Note: this is only supported in Angular versions >= 19.0.0_.",
587
+ "default": "node",
588
+ "enum": ["node", "neutral"]
521
589
  }
522
590
  },
523
591
  "additionalProperties": false
@@ -526,8 +594,12 @@
526
594
  },
527
595
  "appShell": {
528
596
  "type": "boolean",
529
- "description": "Generates an application shell during build time.",
530
- "default": false
597
+ "description": "Generates an application shell during build time. It defaults to `false` in Angular versions < 19.0.0. Otherwise, the value will be `undefined`."
598
+ },
599
+ "outputMode": {
600
+ "type": "string",
601
+ "description": "Defines the build output target. 'static': Generates a static site for deployment on any static hosting service. 'server': Produces an application designed for deployment on a server that supports server-side rendering (SSR). _Note: this is only supported in Angular versions >= 19.0.0_.",
602
+ "enum": ["static", "server"]
531
603
  },
532
604
  "buildLibsFromSource": {
533
605
  "type": "boolean",
@@ -0,0 +1,2 @@
1
+ import type { ApplicationExecutorOptions } from '../schema';
2
+ export declare function normalizeOptions(options: ApplicationExecutorOptions): ApplicationExecutorOptions;