@nx/react 0.0.0-pr-31222-862e973 → 0.0.0-pr-31313-387cdca

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 (306) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1 -1
  3. package/generators.json +9 -13
  4. package/index.d.ts +1 -2
  5. package/index.js +2 -5
  6. package/mf/dynamic-federation.d.ts +64 -0
  7. package/mf/dynamic-federation.js +64 -0
  8. package/migrations.json +80 -148
  9. package/module-federation.d.ts +6 -4
  10. package/module-federation.js +16 -7
  11. package/package.json +11 -11
  12. package/plugins/bundle-rollup.js +4 -1
  13. package/plugins/component-testing/index.js +1 -1
  14. package/plugins/jest.js +6 -11
  15. package/plugins/nx-react-webpack-plugin/lib/apply-react-config.js +6 -22
  16. package/plugins/storybook/index.js +1 -2
  17. package/plugins/with-react.d.ts +4 -0
  18. package/router-plugin.d.ts +1 -0
  19. package/router-plugin.js +5 -0
  20. package/src/executors/module-federation-dev-server/lib/index.d.ts +2 -0
  21. package/src/executors/module-federation-dev-server/lib/index.js +5 -0
  22. package/src/executors/module-federation-dev-server/lib/normalize-options.d.ts +4 -0
  23. package/src/executors/module-federation-dev-server/lib/normalize-options.js +19 -0
  24. package/src/executors/module-federation-dev-server/lib/start-remotes.d.ts +5 -0
  25. package/src/executors/module-federation-dev-server/lib/start-remotes.js +33 -0
  26. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +1 -1
  27. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +6 -110
  28. package/src/executors/module-federation-dev-server/schema.d.ts +9 -7
  29. package/src/executors/module-federation-dev-server/schema.json +15 -10
  30. package/src/executors/module-federation-ssr-dev-server/lib/index.d.ts +2 -0
  31. package/src/executors/module-federation-ssr-dev-server/lib/index.js +5 -0
  32. package/src/executors/module-federation-ssr-dev-server/lib/normalize-options.d.ts +4 -0
  33. package/src/executors/module-federation-ssr-dev-server/lib/normalize-options.js +23 -0
  34. package/src/executors/module-federation-ssr-dev-server/lib/start-remotes.d.ts +5 -0
  35. package/src/executors/module-federation-ssr-dev-server/lib/start-remotes.js +34 -0
  36. package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +1 -17
  37. package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +5 -153
  38. package/src/executors/module-federation-ssr-dev-server/schema.d.ts +29 -0
  39. package/src/executors/module-federation-ssr-dev-server/schema.json +14 -9
  40. package/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts +2 -2
  41. package/src/executors/module-federation-static-server/module-federation-static-server.impl.js +11 -12
  42. package/src/executors/module-federation-static-server/schema.json +2 -1
  43. package/src/generators/application/application.d.ts +3 -3
  44. package/src/generators/application/application.js +108 -186
  45. package/src/generators/application/files/base-rsbuild/src/app/__fileName__.spec.tsx__tmpl__ +10 -0
  46. package/src/generators/application/files/base-rsbuild/src/assets/.gitkeep +0 -0
  47. package/src/generators/application/files/base-rsbuild/src/favicon.ico +0 -0
  48. package/src/generators/application/files/base-rsbuild/src/index.html +14 -0
  49. package/src/generators/application/files/base-rsbuild/src/main.tsx__tmpl__ +32 -0
  50. package/src/generators/application/files/base-rsbuild/tsconfig.app.json__tmpl__ +31 -0
  51. package/src/generators/application/files/base-rspack/rspack.config.js__tmpl__ +53 -0
  52. package/src/generators/application/files/base-rspack/src/app/__fileName__.spec.tsx__tmpl__ +3 -3
  53. package/src/generators/application/files/base-rspack/src/main.tsx__tmpl__ +27 -5
  54. package/src/generators/application/files/base-rspack/tsconfig.app.json__tmpl__ +21 -4
  55. package/src/generators/application/files/base-vite/src/app/__fileName__.spec.tsx__tmpl__ +3 -3
  56. package/src/generators/application/files/base-vite/src/main.tsx__tmpl__ +31 -6
  57. package/src/generators/application/files/base-vite/tsconfig.app.json__tmpl__ +20 -3
  58. package/src/generators/application/files/base-webpack/src/app/__fileName__.spec.tsx__tmpl__ +3 -3
  59. package/src/generators/application/files/base-webpack/src/main.tsx__tmpl__ +22 -2
  60. package/src/generators/application/files/base-webpack/tsconfig.app.json__tmpl__ +21 -4
  61. package/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +4 -4
  62. package/src/generators/application/files/react-router-ssr/common/app/app-nav.tsx__tmpl__ +14 -0
  63. package/src/generators/application/files/react-router-ssr/common/app/entry.client.tsx__tmpl__ +18 -0
  64. package/src/generators/application/files/react-router-ssr/common/app/entry.server.tsx__tmpl__ +74 -0
  65. package/src/generators/application/files/react-router-ssr/common/app/root.tsx__tmpl__ +51 -0
  66. package/src/generators/application/files/react-router-ssr/common/app/routes/about.tsx__tmpl__ +7 -0
  67. package/src/generators/application/files/react-router-ssr/common/app/routes.tsx__tmpl__ +6 -0
  68. package/src/generators/application/files/react-router-ssr/common/public/favicon.ico +0 -0
  69. package/src/generators/application/files/react-router-ssr/common/react-router.config.ts__tmpl__ +5 -0
  70. package/src/generators/application/files/react-router-ssr/common/tests/routes/_index.spec.tsx__tmpl__ +16 -0
  71. package/src/generators/application/files/react-router-ssr/common/tsconfig.app.json__tmpl__ +23 -0
  72. package/src/generators/application/files/react-router-ssr/common/tsconfig.json__tmpl__ +27 -0
  73. package/src/generators/application/files/react-router-ssr/non-root/.gitignore__tmpl__ +5 -0
  74. package/src/generators/application/files/react-router-ssr/non-root/package.json__tmpl__ +21 -0
  75. package/src/generators/application/files/react-router-ssr/nx-welcome/claimed/app/nx-welcome.tsx__tmpl__ +866 -0
  76. package/src/generators/application/files/react-router-ssr/nx-welcome/not-configured/app/nx-welcome.tsx__tmpl__ +866 -0
  77. package/src/generators/application/files/react-router-ssr/nx-welcome/unclaimed/app/nx-welcome.tsx__tmpl__ +864 -0
  78. package/src/generators/application/files/react-router-ssr/ts-solution/package.json__tmpl__ +21 -0
  79. package/src/generators/application/files/react-router-ssr/ts-solution/tsconfig.app.json__tmpl__ +39 -0
  80. package/src/generators/application/files/style-css-module/src/app/__fileName__.tsx__tmpl__ +28 -18
  81. package/src/generators/application/files/style-global-css/src/app/__fileName__.tsx__tmpl__ +29 -20
  82. package/src/generators/application/files/style-none/src/app/__fileName__.tsx__tmpl__ +26 -16
  83. package/src/generators/application/files/style-styled-jsx/src/app/__fileName__.tsx__tmpl__ +31 -22
  84. package/src/generators/application/files/style-styled-module/src/app/__fileName__.tsx__tmpl__ +30 -21
  85. package/src/generators/application/files/style-tailwind/src/app/__fileName__.tsx__tmpl__ +29 -19
  86. package/src/generators/application/lib/add-e2e.d.ts +1 -1
  87. package/src/generators/application/lib/add-e2e.js +74 -65
  88. package/src/generators/application/lib/add-jest.js +27 -2
  89. package/src/generators/application/lib/add-linting.d.ts +4 -0
  90. package/src/generators/application/lib/add-linting.js +86 -0
  91. package/src/generators/application/lib/add-project.js +112 -6
  92. package/src/generators/application/lib/add-routing.js +1 -1
  93. package/src/generators/application/lib/bundlers/add-rsbuild.d.ts +4 -0
  94. package/src/generators/application/lib/bundlers/add-rsbuild.js +63 -0
  95. package/src/generators/application/lib/bundlers/add-rspack.d.ts +4 -0
  96. package/src/generators/application/lib/bundlers/add-rspack.js +37 -0
  97. package/src/generators/application/lib/bundlers/add-vite.d.ts +4 -0
  98. package/src/generators/application/lib/bundlers/add-vite.js +76 -0
  99. package/src/generators/application/lib/bundlers/add-webpack.d.ts +3 -0
  100. package/src/generators/application/lib/bundlers/add-webpack.js +18 -0
  101. package/src/generators/application/lib/create-application-files.d.ts +61 -0
  102. package/src/generators/application/lib/create-application-files.js +102 -19
  103. package/src/generators/application/lib/get-app-tests.js +10 -11
  104. package/src/generators/application/lib/install-common-dependencies.d.ts +1 -1
  105. package/src/generators/application/lib/install-common-dependencies.js +18 -4
  106. package/src/generators/application/lib/normalize-options.d.ts +1 -3
  107. package/src/generators/application/lib/normalize-options.js +17 -19
  108. package/src/generators/application/lib/update-jest-config.js +5 -0
  109. package/src/generators/application/schema.d.ts +12 -6
  110. package/src/generators/application/schema.json +44 -42
  111. package/src/generators/component/component.d.ts +0 -1
  112. package/src/generators/component/component.js +19 -37
  113. package/src/generators/component/files/__fileName__.__ext__ +83 -0
  114. package/src/generators/component/lib/normalize-options.js +13 -15
  115. package/src/generators/component/schema.d.ts +13 -25
  116. package/src/generators/component/schema.json +13 -49
  117. package/src/generators/component-story/component-story.js +1 -2
  118. package/src/generators/component-story/files/jsx/__componentFileName__.stories.jsx__tmpl__ +5 -5
  119. package/src/generators/component-story/files/tsx/__componentFileName__.stories.tsx__tmpl__ +3 -4
  120. package/src/generators/component-test/component-test.js +1 -1
  121. package/src/generators/cypress-component-configuration/cypress-component-configuration.js +0 -2
  122. package/src/generators/cypress-component-configuration/lib/add-files.d.ts +1 -1
  123. package/src/generators/cypress-component-configuration/lib/add-files.js +7 -4
  124. package/src/generators/federate-module/federate-module.js +12 -22
  125. package/src/generators/federate-module/schema.d.ts +0 -1
  126. package/src/generators/federate-module/schema.json +13 -12
  127. package/src/generators/hook/files/{__fileName__.ts__tmpl__ → __fileName__.__ext__} +3 -1
  128. package/src/generators/hook/hook.d.ts +0 -1
  129. package/src/generators/hook/hook.js +35 -83
  130. package/src/generators/hook/schema.d.ts +4 -17
  131. package/src/generators/hook/schema.json +19 -46
  132. package/src/generators/host/files/common/src/app/__fileName__.js__tmpl__ +28 -21
  133. package/src/generators/host/files/common/src/main.js__tmpl__ +12 -9
  134. package/src/generators/host/files/common-ts/src/app/__fileName__.tsx__tmpl__ +28 -28
  135. package/src/generators/host/files/common-ts/src/main.ts__tmpl__ +12 -9
  136. package/src/generators/host/files/rspack-common/src/app/__fileName__.jsx__tmpl__ +22 -13
  137. package/src/generators/host/files/rspack-common/src/main.jsx__tmpl__ +12 -9
  138. package/src/generators/host/files/rspack-module-federation/module-federation.config.js__tmpl__ +8 -5
  139. package/src/generators/host/files/rspack-module-federation/rspack.config.js__tmpl__ +37 -13
  140. package/src/generators/host/files/rspack-module-federation/rspack.config.prod.js__tmpl__ +60 -30
  141. package/src/generators/host/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +16 -5
  142. package/src/generators/host/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +66 -0
  143. package/src/generators/host/files/rspack-module-federation-ssr/server.ts__tmpl__ +1 -1
  144. package/src/generators/host/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +49 -0
  145. package/src/generators/host/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +16 -7
  146. package/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +66 -0
  147. package/src/generators/host/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +1 -1
  148. package/src/generators/host/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +49 -0
  149. package/src/generators/host/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +22 -19
  150. package/src/generators/host/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +61 -30
  151. package/src/generators/host/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +37 -13
  152. package/src/generators/host/files/webpack-module-federation/module-federation.config.js__tmpl__ +8 -5
  153. package/src/generators/host/files/webpack-module-federation/webpack.config.js__tmpl__ +1 -1
  154. package/src/generators/host/files/webpack-module-federation/webpack.config.prod.js__tmpl__ +24 -22
  155. package/src/generators/host/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +10 -7
  156. package/src/generators/host/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +2 -2
  157. package/src/generators/host/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +10 -7
  158. package/src/generators/host/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +2 -2
  159. package/src/generators/host/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +22 -19
  160. package/src/generators/host/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__ +25 -23
  161. package/src/generators/host/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +4 -3
  162. package/src/generators/host/host.d.ts +0 -1
  163. package/src/generators/host/host.js +31 -27
  164. package/src/generators/host/lib/add-module-federation-files.js +29 -13
  165. package/src/generators/host/lib/normalize-host-name.d.ts +2 -0
  166. package/src/generators/host/lib/normalize-host-name.js +12 -0
  167. package/src/generators/host/lib/normalize-remote.js +10 -6
  168. package/src/generators/host/lib/setup-ssr-for-host.d.ts +3 -3
  169. package/src/generators/host/lib/setup-ssr-for-host.js +46 -22
  170. package/src/generators/host/lib/update-module-federation-tsconfig.d.ts +3 -0
  171. package/src/generators/host/lib/update-module-federation-tsconfig.js +39 -0
  172. package/src/generators/host/schema.d.ts +2 -5
  173. package/src/generators/host/schema.json +16 -27
  174. package/src/generators/init/init.d.ts +1 -1
  175. package/src/generators/init/init.js +31 -6
  176. package/src/generators/init/schema.d.ts +2 -0
  177. package/src/generators/library/files/common/tsconfig.lib.json__tmpl__ +1 -1
  178. package/src/generators/library/files/vite/tsconfig.lib.json__tmpl__ +1 -1
  179. package/src/generators/library/lib/add-linting.js +1 -1
  180. package/src/generators/library/lib/add-rollup-build-target.d.ts +3 -1
  181. package/src/generators/library/lib/add-rollup-build-target.js +34 -32
  182. package/src/generators/library/lib/create-files.d.ts +1 -1
  183. package/src/generators/library/lib/create-files.js +23 -2
  184. package/src/generators/library/lib/determine-entry-fields.d.ts +3 -0
  185. package/src/generators/library/lib/determine-entry-fields.js +22 -0
  186. package/src/generators/library/lib/install-common-dependencies.d.ts +1 -1
  187. package/src/generators/library/lib/install-common-dependencies.js +5 -3
  188. package/src/generators/library/lib/normalize-options.js +11 -6
  189. package/src/generators/library/library.js +80 -35
  190. package/src/generators/library/schema.d.ts +5 -5
  191. package/src/generators/library/schema.json +38 -36
  192. package/src/generators/redux/files/js/__fileName__.__ext__ +114 -0
  193. package/src/generators/redux/files/{__fileName__.slice.spec.ts__tmpl__ → js/__fileName__.spec.__ext__} +1 -1
  194. package/src/generators/redux/files/ts/__fileName__.spec.__ext__ +56 -0
  195. package/src/generators/redux/redux.d.ts +0 -1
  196. package/src/generators/redux/redux.js +27 -36
  197. package/src/generators/redux/schema.d.ts +12 -8
  198. package/src/generators/redux/schema.json +21 -23
  199. package/src/generators/remote/files/rspack-module-federation/module-federation.config.js__tmpl__ +10 -7
  200. package/src/generators/remote/files/rspack-module-federation/rspack.config.js__tmpl__ +40 -13
  201. package/src/generators/remote/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +13 -4
  202. package/src/generators/remote/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +69 -0
  203. package/src/generators/remote/files/rspack-module-federation-ssr/server.ts__tmpl__ +2 -2
  204. package/src/generators/remote/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +45 -0
  205. package/src/generators/remote/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +13 -4
  206. package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +69 -0
  207. package/src/generators/remote/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +2 -2
  208. package/src/generators/remote/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +45 -0
  209. package/src/generators/remote/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +11 -8
  210. package/src/generators/remote/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +40 -13
  211. package/src/generators/remote/files/webpack-module-federation/module-federation.config.js__tmpl__ +10 -7
  212. package/src/generators/remote/files/webpack-module-federation/webpack.config.js__tmpl__ +1 -1
  213. package/src/generators/remote/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +7 -4
  214. package/src/generators/remote/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +2 -2
  215. package/src/generators/remote/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +8 -5
  216. package/src/generators/remote/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +2 -2
  217. package/src/generators/remote/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +11 -8
  218. package/src/generators/remote/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +2 -2
  219. package/src/generators/remote/lib/setup-ssr-for-remote.d.ts +1 -1
  220. package/src/generators/remote/lib/setup-ssr-for-remote.js +37 -15
  221. package/src/generators/remote/lib/setup-tspath-for-remote.js +1 -3
  222. package/src/generators/remote/lib/update-host-with-remote.js +2 -2
  223. package/src/generators/remote/remote.d.ts +0 -1
  224. package/src/generators/remote/remote.js +57 -33
  225. package/src/generators/remote/schema.d.ts +2 -5
  226. package/src/generators/remote/schema.json +16 -27
  227. package/src/generators/setup-tailwind/lib/update-project.js +1 -2
  228. package/src/generators/stories/schema.json +0 -10
  229. package/src/generators/stories/stories.d.ts +1 -3
  230. package/src/generators/stories/stories.js +9 -20
  231. package/src/generators/storybook-configuration/configuration.js +2 -11
  232. package/src/generators/storybook-configuration/schema.d.ts +0 -3
  233. package/src/generators/storybook-configuration/schema.json +0 -15
  234. package/src/migrations/update-18-0-0/add-mf-env-var-to-target-defaults.js +11 -6
  235. package/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.d.ts +2 -0
  236. package/src/migrations/update-20-2-0/migrate-mf-imports-to-new-package.js +66 -0
  237. package/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.d.ts +2 -0
  238. package/src/migrations/update-20-2-0/migrate-with-mf-import-to-new-package.js +41 -0
  239. package/src/migrations/update-20-3-0/ensure-nx-module-federation-package.d.ts +2 -0
  240. package/src/migrations/update-20-3-0/ensure-nx-module-federation-package.js +18 -0
  241. package/src/migrations/update-21-0-0/update-babel-loose.d.ts +2 -0
  242. package/src/migrations/update-21-0-0/update-babel-loose.js +30 -0
  243. package/src/plugins/router-plugin.d.ts +10 -0
  244. package/src/plugins/router-plugin.js +221 -0
  245. package/src/rules/update-module-federation-project.d.ts +2 -1
  246. package/src/rules/update-module-federation-project.js +37 -48
  247. package/src/utils/add-mf-env-to-inputs.d.ts +1 -1
  248. package/src/utils/add-mf-env-to-inputs.js +8 -11
  249. package/src/utils/assertion.d.ts +2 -0
  250. package/src/utils/assertion.js +6 -0
  251. package/src/utils/ast-utils.d.ts +1 -1
  252. package/src/utils/ast-utils.js +2 -2
  253. package/src/utils/create-ts-config.js +57 -7
  254. package/src/utils/ct-utils.d.ts +1 -1
  255. package/src/utils/ct-utils.js +2 -7
  256. package/src/utils/has-rsbuild-plugin.d.ts +2 -0
  257. package/src/utils/has-rsbuild-plugin.js +10 -0
  258. package/src/utils/has-rspack-plugin.d.ts +2 -0
  259. package/src/utils/has-rspack-plugin.js +10 -0
  260. package/src/utils/testing-generators.js +2 -4
  261. package/src/utils/version-utils.d.ts +14 -0
  262. package/src/utils/version-utils.js +56 -0
  263. package/src/utils/versions.d.ts +25 -17
  264. package/src/utils/versions.js +28 -19
  265. package/src/generators/component/files/__fileName__.tsx__tmpl__ +0 -84
  266. package/src/generators/component-cypress-spec/component-cypress-spec.d.ts +0 -13
  267. package/src/generators/component-cypress-spec/component-cypress-spec.js +0 -104
  268. package/src/generators/component-cypress-spec/files/__componentName__.__fileExt__ +0 -13
  269. package/src/generators/component-cypress-spec/schema.json +0 -45
  270. package/src/generators/host/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__ +0 -16
  271. package/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__ +0 -16
  272. package/src/generators/library/files/common/package.json__tmpl__ +0 -4
  273. package/src/generators/library/files/vite/package.json__tmpl__ +0 -12
  274. package/src/generators/remote/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__ +0 -16
  275. package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__ +0 -16
  276. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
  277. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
  278. package/src/migrations/update-16-2-0-remove-package/update-16-2-0-remove-package.d.ts +0 -2
  279. package/src/migrations/update-16-2-0-remove-package/update-16-2-0-remove-package.js +0 -8
  280. package/src/migrations/update-16-3-0/remove-types-react-router-dom-package.d.ts +0 -2
  281. package/src/migrations/update-16-3-0/remove-types-react-router-dom-package.js +0 -8
  282. package/src/migrations/update-16-7-0/add-babel-core.d.ts +0 -2
  283. package/src/migrations/update-16-7-0/add-babel-core.js +0 -14
  284. package/src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings.d.ts +0 -2
  285. package/src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings.js +0 -57
  286. package/src/migrations/update-18-1-1/fix-target-defaults-inputs.d.ts +0 -2
  287. package/src/migrations/update-18-1-1/fix-target-defaults-inputs.js +0 -53
  288. package/src/module-federation/load-config.d.ts +0 -3
  289. package/src/module-federation/load-config.js +0 -15
  290. package/src/module-federation/models.d.ts +0 -24
  291. package/src/module-federation/models.js +0 -2
  292. package/src/module-federation/package-json.d.ts +0 -8
  293. package/src/module-federation/package-json.js +0 -12
  294. package/src/module-federation/utils.d.ts +0 -12
  295. package/src/module-federation/utils.js +0 -75
  296. package/src/module-federation/with-module-federation-ssr.d.ts +0 -2
  297. package/src/module-federation/with-module-federation-ssr.js +0 -50
  298. package/src/module-federation/with-module-federation.d.ts +0 -7
  299. package/src/module-federation/with-module-federation.js +0 -63
  300. package/src/utils/build-static.remotes.d.ts +0 -4
  301. package/src/utils/build-static.remotes.js +0 -65
  302. package/src/utils/format-file.d.ts +0 -1
  303. package/src/utils/format-file.js +0 -11
  304. /package/src/generators/component/files/{__fileName__.spec.tsx__tmpl__ → __fileName__.spec.__ext__} +0 -0
  305. /package/src/generators/hook/files/{__fileName__.spec.tsx__tmpl__ → __fileName__.spec.__specExt__} +0 -0
  306. /package/src/generators/redux/files/{__fileName__.slice.ts__tmpl__ → ts/__fileName__.__ext__} +0 -0
@@ -13,26 +13,6 @@ function applyReactConfig(options, config = {}) {
13
13
  ref: true,
14
14
  };
15
15
  const svgrOptions = typeof options.svgr === 'object' ? options.svgr : defaultSvgrOptions;
16
- // TODO(v20): Remove file-loader and use `?react` querystring to differentiate between asset and SVGR.
17
- // It should be:
18
- // use: [{
19
- // test: /\.svg$/i,
20
- // type: 'asset',
21
- // resourceQuery: /react/, // *.svg?react
22
- // },
23
- // {
24
- // test: /\.svg$/i,
25
- // issuer: /\.[jt]sx?$/,
26
- // resourceQuery: { not: [/react/] }, // exclude react component if *.svg?react
27
- // use: ['@svgr/webpack'],
28
- // }],
29
- // See:
30
- // - SVGR: https://react-svgr.com/docs/webpack/#use-svgr-and-asset-svg-in-the-same-project
31
- // - Vite: https://www.npmjs.com/package/vite-plugin-svgr
32
- // - Rsbuild: https://github.com/web-infra-dev/rsbuild/pull/1783
33
- // Note: We also need a migration for any projects that are using SVGR to convert
34
- // `import { ReactComponent as X } from './x.svg` to
35
- // `import X from './x.svg?react';
36
16
  config.module.rules.push({
37
17
  test: /\.svg$/,
38
18
  issuer: /\.(js|ts|md)x?$/,
@@ -57,7 +37,9 @@ function applyReactConfig(options, config = {}) {
57
37
  };
58
38
  }
59
39
  function addHotReload(config) {
60
- if (config.mode === 'development' && config['devServer']?.hot) {
40
+ if (config.mode === 'development' &&
41
+ typeof config['devServer'] === 'object' &&
42
+ config['devServer']?.hot) {
61
43
  // add `react-refresh/babel` to babel loader plugin
62
44
  const babelLoader = config.module.rules.find((rule) => rule &&
63
45
  typeof rule !== 'string' &&
@@ -80,7 +62,9 @@ function addHotReload(config) {
80
62
  // We remove potentially conflicting rules that target SVGs because we use @svgr/webpack loader
81
63
  // See https://github.com/nrwl/nx/issues/14383
82
64
  function removeSvgLoaderIfPresent(config) {
83
- const svgLoaderIdx = config.module.rules.findIndex((rule) => typeof rule === 'object' && rule.test.toString().includes('svg'));
65
+ const svgLoaderIdx = config.module.rules.findIndex((rule) => typeof rule === 'object' &&
66
+ typeof rule.test !== 'undefined' &&
67
+ rule.test.toString().includes('svg'));
84
68
  if (svgLoaderIdx === -1)
85
69
  return;
86
70
  config.module.rules.splice(svgLoaderIdx, 1);
@@ -73,8 +73,7 @@ const fixBabelConfigurationIfNeeded = (webpackConfig, projectData) => {
73
73
  return;
74
74
  const isUsingBabelUpwardRootMode = Object.keys(projectData.projectNode.data.targets).find((k) => {
75
75
  const targetConfig = projectData.projectNode.data.targets[k];
76
- return ((targetConfig.executor === '@nx/webpack:webpack' ||
77
- targetConfig.executor === '@nrwl/webpack:webpack') &&
76
+ return (targetConfig.executor === '@nx/webpack:webpack' &&
78
77
  targetConfig.options?.babelUpwardRootMode);
79
78
  });
80
79
  if (isUsingBabelUpwardRootMode)
@@ -6,6 +6,10 @@ export interface SvgrOptions {
6
6
  ref?: boolean;
7
7
  }
8
8
  export interface WithReactOptions extends WithWebOptions {
9
+ /**
10
+ * @deprecated Add SVGR support in your Webpack configuration without relying on Nx. See https://react-svgr.com/docs/webpack/
11
+ * TODO(v22): Remove this option and migrate userland webpack config to explicitly configure @svgr/webpack
12
+ * */
9
13
  svgr?: boolean | SvgrOptions;
10
14
  }
11
15
  /**
@@ -0,0 +1 @@
1
+ export { createNodesV2, ReactRouterPluginOptions, } from './src/plugins/router-plugin';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createNodesV2 = void 0;
4
+ var router_plugin_1 = require("./src/plugins/router-plugin");
5
+ Object.defineProperty(exports, "createNodesV2", { enumerable: true, get: function () { return router_plugin_1.createNodesV2; } });
@@ -0,0 +1,2 @@
1
+ export * from './normalize-options';
2
+ export * from './start-remotes';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./normalize-options"), exports);
5
+ tslib_1.__exportStar(require("./start-remotes"), exports);
@@ -0,0 +1,4 @@
1
+ import { ExecutorContext } from '@nx/devkit';
2
+ import { ModuleFederationDevServerOptions, NormalizedModuleFederationDevServerOptions } from '../schema';
3
+ export declare function getBuildOptions(buildTarget: string, context: ExecutorContext): any;
4
+ export declare function normalizeOptions(options: ModuleFederationDevServerOptions): NormalizedModuleFederationDevServerOptions;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBuildOptions = getBuildOptions;
4
+ exports.normalizeOptions = normalizeOptions;
5
+ const devkit_1 = require("@nx/devkit");
6
+ function getBuildOptions(buildTarget, context) {
7
+ const target = (0, devkit_1.parseTargetString)(buildTarget, context);
8
+ const buildOptions = (0, devkit_1.readTargetOptions)(target, context);
9
+ return {
10
+ ...buildOptions,
11
+ };
12
+ }
13
+ function normalizeOptions(options) {
14
+ return {
15
+ ...options,
16
+ devRemotes: options.devRemotes ?? [],
17
+ verbose: options.verbose ?? false,
18
+ };
19
+ }
@@ -0,0 +1,5 @@
1
+ import { ExecutorContext, ProjectConfiguration } from '@nx/devkit';
2
+ import { NormalizedModuleFederationDevServerOptions } from '../schema';
3
+ export declare function startRemotes(remotes: string[], workspaceProjects: Record<string, ProjectConfiguration>, options: Pick<NormalizedModuleFederationDevServerOptions, 'devRemotes' | 'host' | 'ssl' | 'sslCert' | 'sslKey' | 'verbose'>, context: ExecutorContext, target?: 'serve' | 'serve-static'): Promise<AsyncIterable<{
4
+ success: boolean;
5
+ }>[]>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.startRemotes = startRemotes;
4
+ const devkit_1 = require("@nx/devkit");
5
+ async function startRemotes(remotes, workspaceProjects, options, context, target = 'serve') {
6
+ const remoteIters = [];
7
+ for (const app of remotes) {
8
+ const remoteProjectServeTarget = workspaceProjects[app].targets[target];
9
+ const isUsingModuleFederationDevServerExecutor = remoteProjectServeTarget.executor.includes('module-federation-dev-server');
10
+ const configurationOverride = options.devRemotes?.find((r) => typeof r !== 'string' && r.remoteName === app)?.configuration;
11
+ const defaultOverrides = {
12
+ ...(options.host ? { host: options.host } : {}),
13
+ ...(options.ssl ? { ssl: options.ssl } : {}),
14
+ ...(options.sslCert ? { sslCert: options.sslCert } : {}),
15
+ ...(options.sslKey ? { sslKey: options.sslKey } : {}),
16
+ };
17
+ const overrides = target === 'serve'
18
+ ? {
19
+ watch: true,
20
+ ...(isUsingModuleFederationDevServerExecutor
21
+ ? { isInitialHost: false }
22
+ : {}),
23
+ ...defaultOverrides,
24
+ }
25
+ : { ...defaultOverrides };
26
+ remoteIters.push(await (0, devkit_1.runExecutor)({
27
+ project: app,
28
+ target,
29
+ configuration: configurationOverride ?? context.configurationName,
30
+ }, overrides, context));
31
+ }
32
+ return remoteIters;
33
+ }
@@ -1,6 +1,6 @@
1
1
  import { ExecutorContext } from '@nx/devkit';
2
2
  import { ModuleFederationDevServerOptions } from './schema';
3
- export default function moduleFederationDevServer(options: ModuleFederationDevServerOptions, context: ExecutorContext): AsyncIterableIterator<{
3
+ export default function moduleFederationDevServer(schema: ModuleFederationDevServerOptions, context: ExecutorContext): AsyncIterableIterator<{
4
4
  success: boolean;
5
5
  baseUrl?: string;
6
6
  }>;
@@ -4,96 +4,14 @@ exports.default = moduleFederationDevServer;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const dev_server_impl_1 = require("@nx/webpack/src/executors/dev-server/dev-server.impl");
6
6
  const file_server_impl_1 = require("@nx/web/src/executors/file-server/file-server.impl");
7
- const module_federation_1 = require("@nx/webpack/src/utils/module-federation");
7
+ const utils_1 = require("@nx/module-federation/src/executors/utils");
8
8
  const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
9
9
  const wait_for_port_open_1 = require("@nx/web/src/utils/wait-for-port-open");
10
10
  const fs_1 = require("fs");
11
11
  const path_1 = require("path");
12
- const start_remote_proxies_1 = require("@nx/webpack/src/utils/module-federation/start-remote-proxies");
13
- const parse_static_remotes_config_1 = require("@nx/webpack/src/utils/module-federation/parse-static-remotes-config");
14
- const build_static_remotes_1 = require("../../utils/build-static.remotes");
15
- function getBuildOptions(buildTarget, context) {
16
- const target = (0, devkit_1.parseTargetString)(buildTarget, context);
17
- const buildOptions = (0, devkit_1.readTargetOptions)(target, context);
18
- return {
19
- ...buildOptions,
20
- };
21
- }
22
- function startStaticRemotesFileServer(staticRemotesConfig, context, options) {
23
- if (!staticRemotesConfig.remotes ||
24
- staticRemotesConfig.remotes.length === 0) {
25
- return;
26
- }
27
- let shouldMoveToCommonLocation = false;
28
- let commonOutputDirectory;
29
- for (const app of staticRemotesConfig.remotes) {
30
- const remoteBasePath = staticRemotesConfig.config[app].basePath;
31
- if (!commonOutputDirectory) {
32
- commonOutputDirectory = remoteBasePath;
33
- }
34
- else if (commonOutputDirectory !== remoteBasePath) {
35
- shouldMoveToCommonLocation = true;
36
- break;
37
- }
38
- }
39
- if (shouldMoveToCommonLocation) {
40
- commonOutputDirectory = (0, path_1.join)(devkit_1.workspaceRoot, 'tmp/static-remotes');
41
- for (const app of staticRemotesConfig.remotes) {
42
- const remoteConfig = staticRemotesConfig.config[app];
43
- (0, fs_1.cpSync)(remoteConfig.outputPath, (0, path_1.join)(commonOutputDirectory, remoteConfig.urlSegment), {
44
- force: true,
45
- recursive: true,
46
- });
47
- }
48
- }
49
- const staticRemotesIter = (0, file_server_impl_1.default)({
50
- cors: true,
51
- watch: false,
52
- staticFilePath: commonOutputDirectory,
53
- parallel: false,
54
- spa: false,
55
- withDeps: false,
56
- host: options.host,
57
- port: options.staticRemotesPort,
58
- ssl: options.ssl,
59
- sslCert: options.sslCert,
60
- sslKey: options.sslKey,
61
- cacheSeconds: -1,
62
- }, context);
63
- return staticRemotesIter;
64
- }
65
- async function startRemotes(remotes, context, options, target = 'serve') {
66
- const remoteIters = [];
67
- for (const app of remotes) {
68
- const remoteProjectServeTarget = context.projectGraph.nodes[app].data.targets[target];
69
- const isUsingModuleFederationDevServerExecutor = remoteProjectServeTarget.executor.includes('module-federation-dev-server');
70
- const configurationOverride = options.devRemotes?.find((r) => typeof r !== 'string' && r.remoteName === app)?.configuration;
71
- const defaultOverrides = {
72
- ...(options.host ? { host: options.host } : {}),
73
- ...(options.ssl ? { ssl: options.ssl } : {}),
74
- ...(options.sslCert ? { sslCert: options.sslCert } : {}),
75
- ...(options.sslKey ? { sslKey: options.sslKey } : {}),
76
- };
77
- const overrides = target === 'serve'
78
- ? {
79
- watch: true,
80
- ...(isUsingModuleFederationDevServerExecutor
81
- ? { isInitialHost: false }
82
- : {}),
83
- ...defaultOverrides,
84
- }
85
- : { ...defaultOverrides };
86
- remoteIters.push(await (0, devkit_1.runExecutor)({
87
- project: app,
88
- target,
89
- configuration: configurationOverride ?? context.configurationName,
90
- }, overrides, context));
91
- }
92
- return remoteIters;
93
- }
94
- async function* moduleFederationDevServer(options, context) {
95
- // Force Node to resolve to look for the nx binary that is inside node_modules
96
- const nxBin = require.resolve('nx/bin/nx');
12
+ const lib_1 = require("./lib");
13
+ async function* moduleFederationDevServer(schema, context) {
14
+ const options = (0, lib_1.normalizeOptions)(schema);
97
15
  const currIter = options.static
98
16
  ? (0, file_server_impl_1.default)({
99
17
  ...options,
@@ -105,7 +23,7 @@ async function* moduleFederationDevServer(options, context) {
105
23
  }, context)
106
24
  : (0, dev_server_impl_1.default)(options, context);
107
25
  const p = context.projectsConfigurations.projects[context.projectName];
108
- const buildOptions = getBuildOptions(options.buildTarget, context);
26
+ const buildOptions = (0, lib_1.getBuildOptions)(options.buildTarget, context);
109
27
  let pathToManifestFile = (0, path_1.join)(context.root, p.sourceRoot, 'assets/module-federation.manifest.json');
110
28
  if (options.pathToManifestFile) {
111
29
  const userPathToManifestFile = (0, path_1.join)(context.root, options.pathToManifestFile);
@@ -120,29 +38,7 @@ async function* moduleFederationDevServer(options, context) {
120
38
  if (!options.isInitialHost) {
121
39
  return yield* currIter;
122
40
  }
123
- const moduleFederationConfig = (0, module_federation_1.getModuleFederationConfig)(buildOptions.tsConfig, context.root, p.root, 'react');
124
- const remoteNames = options.devRemotes?.map((r) => typeof r === 'string' ? r : r.remoteName);
125
- const remotes = (0, module_federation_1.getRemotes)(remoteNames, options.skipRemotes, moduleFederationConfig, {
126
- projectName: context.projectName,
127
- projectGraph: context.projectGraph,
128
- root: context.root,
129
- }, pathToManifestFile);
130
- options.staticRemotesPort ??= remotes.staticRemotePort;
131
- // Set NX_MF_DEV_REMOTES for the Nx Runtime Library Control Plugin
132
- process.env.NX_MF_DEV_REMOTES = JSON.stringify([
133
- ...(remotes.devRemotes.map((r) => typeof r === 'string' ? r : r.remoteName) ?? []),
134
- p.name,
135
- ]);
136
- const staticRemotesConfig = (0, parse_static_remotes_config_1.parseStaticRemotesConfig)([...remotes.staticRemotes, ...remotes.dynamicRemotes], context);
137
- const mappedLocationsOfStaticRemotes = await (0, build_static_remotes_1.buildStaticRemotes)(staticRemotesConfig, nxBin, context, options);
138
- const devRemoteIters = await startRemotes(remotes.devRemotes, context, options, 'serve');
139
- const staticRemotesIter = startStaticRemotesFileServer(staticRemotesConfig, context, options);
140
- (0, start_remote_proxies_1.startRemoteProxies)(staticRemotesConfig, mappedLocationsOfStaticRemotes, options.ssl
141
- ? {
142
- pathToCert: (0, path_1.join)(devkit_1.workspaceRoot, options.sslCert),
143
- pathToKey: (0, path_1.join)(devkit_1.workspaceRoot, options.sslKey),
144
- }
145
- : undefined);
41
+ const { staticRemotesIter, devRemoteIters, remotes } = await (0, utils_1.startRemoteIterators)(options, context, lib_1.startRemotes, pathToManifestFile, 'react');
146
42
  return yield* (0, async_iterable_1.combineAsyncIterables)(currIter, ...devRemoteIters, ...(staticRemotesIter ? [staticRemotesIter] : []), (0, async_iterable_1.createAsyncIterable)(async ({ next, done }) => {
147
43
  if (!options.isInitialHost) {
148
44
  done();
@@ -1,17 +1,19 @@
1
1
  import { WebDevServerOptions } from '@nx/webpack';
2
+ import { DevRemoteDefinition } from '@nx/module-federation/src/executors/utils';
2
3
 
3
4
  export type ModuleFederationDevServerOptions = WebDevServerOptions & {
4
- devRemotes?: (
5
- | string
6
- | {
7
- remoteName: string;
8
- configuration: string;
9
- }
10
- )[];
5
+ devRemotes?: DevRemoteDefinition[];
11
6
  skipRemotes?: string[];
12
7
  static?: boolean;
13
8
  isInitialHost?: boolean;
14
9
  parallel?: number;
15
10
  staticRemotesPort?: number;
16
11
  pathToManifestFile?: string;
12
+ verbose?: boolean;
17
13
  };
14
+
15
+ export type NormalizedModuleFederationDevServerOptions =
16
+ ModuleFederationDevServerOptions & {
17
+ devRemotes: DevRemoteDefinition[];
18
+ verbose: boolean;
19
+ };
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "version": 2,
3
+ "continuous": true,
3
4
  "outputCapture": "direct-nodejs",
4
5
  "title": "Module Federation Dev Server",
5
6
  "description": "Serve a web application.",
@@ -28,16 +29,18 @@
28
29
  }
29
30
  ]
30
31
  },
31
- "description": "List of remote applications to run in development mode (i.e. using serve target).",
32
- "x-priority": "important"
32
+ "description": "List of Producer (remote) applications to run in development mode (i.e. using serve target).",
33
+ "x-priority": "important",
34
+ "alias": "devProducers"
33
35
  },
34
36
  "skipRemotes": {
35
37
  "type": "array",
36
38
  "items": {
37
39
  "type": "string"
38
40
  },
39
- "description": "List of remote applications to not automatically serve, either statically or in development mode. This will not remove the remotes from the `module-federation.config` file, and therefore the application may still try to fetch these remotes.\nThis option is useful if you have other means for serving the `remote` application(s).\n**NOTE:** Remotes that are not in the workspace will be skipped automatically.",
40
- "x-priority": "important"
41
+ "description": "List of Producer (remote) applications to not automatically serve, either statically or in development mode. This will not remove the Producers (remotes) from the `module-federation.config` file, and therefore the application may still try to fetch these Producers (remotes).\nThis option is useful if you have other means for serving the Producer (remote) application(s).\n**NOTE:** Producers (remotes) that are not in the workspace will be skipped automatically.",
42
+ "x-priority": "important",
43
+ "alias": "skipProducers"
41
44
  },
42
45
  "buildTarget": {
43
46
  "type": "string",
@@ -111,25 +114,27 @@
111
114
  },
112
115
  "static": {
113
116
  "type": "boolean",
114
- "description": "Whether to use a static file server instead of the webpack-dev-server. This should be used for remote applications that are also host applications."
117
+ "description": "Whether to use a static file server instead of the webpack-dev-server. This should be used for Producer (remote) applications that are also Consumer (host) applications."
115
118
  },
116
119
  "isInitialHost": {
117
120
  "type": "boolean",
118
- "description": "Whether the host that is running this executor is the first in the project tree to do so.",
121
+ "description": "Whether the Consumer (host) that is running this executor is the first in the project tree to do so.",
119
122
  "default": true,
120
- "x-priority": "internal"
123
+ "x-priority": "internal",
124
+ "alias": "isInitialConsumer"
121
125
  },
122
126
  "parallel": {
123
127
  "type": "number",
124
- "description": "Max number of parallel processes for building static remotes"
128
+ "description": "Max number of parallel processes for building static Producers (remotes)"
125
129
  },
126
130
  "staticRemotesPort": {
127
131
  "type": "number",
128
- "description": "The port at which to serve the file-server for the static remotes."
132
+ "description": "The port at which to serve the file-server for the static Producers (remotes).",
133
+ "alias": "staticProducersPort"
129
134
  },
130
135
  "pathToManifestFile": {
131
136
  "type": "string",
132
- "description": "Path to a Module Federation manifest file (e.g. `my/path/to/module-federation.manifest.json`) containing the dynamic remote applications relative to the workspace root."
137
+ "description": "Path to a Module Federation manifest file (e.g. `my/path/to/module-federation.manifest.json`) containing the dynamic Producer (remote) applications relative to the workspace root."
133
138
  }
134
139
  },
135
140
  "examplesFile": "../../../docs/module-federation-dev-server-examples.md"
@@ -0,0 +1,2 @@
1
+ export * from './normalize-options';
2
+ export * from './start-remotes';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./normalize-options"), exports);
5
+ tslib_1.__exportStar(require("./start-remotes"), exports);
@@ -0,0 +1,4 @@
1
+ import { ModuleFederationSsrDevServerOptions, NormalizedModuleFederationSsrDevServerOptions } from '../schema';
2
+ import { ExecutorContext } from '@nx/devkit';
3
+ export declare function normalizeOptions(options: ModuleFederationSsrDevServerOptions): NormalizedModuleFederationSsrDevServerOptions;
4
+ export declare function getBuildOptions(buildTarget: string, context: ExecutorContext): any;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.normalizeOptions = normalizeOptions;
4
+ exports.getBuildOptions = getBuildOptions;
5
+ const path_1 = require("path");
6
+ const devkit_1 = require("@nx/devkit");
7
+ function normalizeOptions(options) {
8
+ return {
9
+ ...options,
10
+ devRemotes: options.devRemotes ?? [],
11
+ verbose: options.verbose ?? false,
12
+ ssl: options.ssl ?? false,
13
+ sslCert: options.sslCert ? (0, path_1.join)(devkit_1.workspaceRoot, options.sslCert) : undefined,
14
+ sslKey: options.sslKey ? (0, path_1.join)(devkit_1.workspaceRoot, options.sslKey) : undefined,
15
+ };
16
+ }
17
+ function getBuildOptions(buildTarget, context) {
18
+ const target = (0, devkit_1.parseTargetString)(buildTarget, context);
19
+ const buildOptions = (0, devkit_1.readTargetOptions)(target, context);
20
+ return {
21
+ ...buildOptions,
22
+ };
23
+ }
@@ -0,0 +1,5 @@
1
+ import { ModuleFederationSsrDevServerOptions } from '../schema';
2
+ import { ExecutorContext, ProjectConfiguration } from '@nx/devkit';
3
+ export declare function startRemotes(remotes: string[], workspaceProjects: Record<string, ProjectConfiguration>, options: Partial<Pick<ModuleFederationSsrDevServerOptions, 'devRemotes' | 'host' | 'ssl' | 'sslCert' | 'sslKey' | 'verbose'>>, context: ExecutorContext): Promise<AsyncIterable<{
4
+ success: boolean;
5
+ }>[]>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.startRemotes = startRemotes;
4
+ const devkit_1 = require("@nx/devkit");
5
+ async function startRemotes(remotes, workspaceProjects, options, context) {
6
+ const remoteIters = [];
7
+ const target = 'serve';
8
+ for (const app of remotes) {
9
+ const remoteProjectServeTarget = workspaceProjects[app].targets[target];
10
+ const isUsingModuleFederationSsrDevServerExecutor = remoteProjectServeTarget.executor.includes('module-federation-ssr-dev-server');
11
+ const configurationOverride = options.devRemotes?.find((remote) => typeof remote !== 'string' && remote.remoteName === app)?.configuration;
12
+ {
13
+ const defaultOverrides = {
14
+ ...(options.host ? { host: options.host } : {}),
15
+ ...(options.ssl ? { ssl: options.ssl } : {}),
16
+ ...(options.sslCert ? { sslCert: options.sslCert } : {}),
17
+ ...(options.sslKey ? { sslKey: options.sslKey } : {}),
18
+ };
19
+ const overrides = {
20
+ watch: true,
21
+ ...defaultOverrides,
22
+ ...(isUsingModuleFederationSsrDevServerExecutor
23
+ ? { isInitialHost: false }
24
+ : {}),
25
+ };
26
+ remoteIters.push(await (0, devkit_1.runExecutor)({
27
+ project: app,
28
+ target,
29
+ configuration: configurationOverride ?? context.configurationName,
30
+ }, overrides, context));
31
+ }
32
+ }
33
+ return remoteIters;
34
+ }
@@ -1,19 +1,3 @@
1
1
  import { ExecutorContext } from '@nx/devkit';
2
- import { WebSsrDevServerOptions } from '@nx/webpack/src/executors/ssr-dev-server/schema';
3
- type ModuleFederationSsrDevServerOptions = WebSsrDevServerOptions & {
4
- devRemotes?: (string | {
5
- remoteName: string;
6
- configuration: string;
7
- })[];
8
- skipRemotes?: string[];
9
- host: string;
10
- pathToManifestFile?: string;
11
- staticRemotesPort?: number;
12
- parallel?: number;
13
- ssl?: boolean;
14
- sslKey?: string;
15
- sslCert?: string;
16
- isInitialHost?: boolean;
17
- };
2
+ import { ModuleFederationSsrDevServerOptions } from './schema';
18
3
  export default function moduleFederationSsrDevServer(ssrDevServerOptions: ModuleFederationSsrDevServerOptions, context: ExecutorContext): AsyncGenerator<any, any, any>;
19
- export {};