@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
@@ -1,16 +1,43 @@
1
- import {composePlugins, withNx, withReact} from '@nx/rspack';
2
- import {withModuleFederation} from '@nx/rspack/module-federation';
1
+ import { NxAppRspackPlugin } from '@nx/rspack/app-plugin';
2
+ import { NxReactRspackPlugin } from '@nx/rspack/react-plugin';
3
+ import { NxModuleFederationPlugin, NxModuleFederationDevServerPlugin } from '@nx/module-federation/rspack';
4
+ import { join } from 'path';
3
5
 
4
- import baseConfig from './module-federation.config';
6
+ import config from './module-federation.config';
5
7
 
6
- const config = {
7
- ...baseConfig,
8
+ export default {
9
+ output: {
10
+ path: join(__dirname, '<%= rspackPluginOptions.outputPath %>'),
11
+ publicPath: 'auto'
12
+ },
13
+ devServer: {
14
+ port: <%= devServerPort %>,
15
+ headers: {
16
+ "Access-Control-Allow-Origin": "*"
17
+ },
18
+ historyApiFallback: {
19
+ index: '/index.html',
20
+ disableDotRule: true,
21
+ htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
22
+ },
23
+ },
24
+ plugins: [
25
+ new NxAppRspackPlugin({
26
+ tsConfig: '<%= rspackPluginOptions.tsConfig %>',
27
+ main: '<%= rspackPluginOptions.main %>',
28
+ index: '<%= rspackPluginOptions.index %>',
29
+ baseHref: '<%= rspackPluginOptions.baseHref %>',
30
+ assets: <%- JSON.stringify(rspackPluginOptions.assets) %>,
31
+ styles: <%- JSON.stringify(rspackPluginOptions.styles) %>,
32
+ outputHashing: process.env['NODE_ENV'] === 'production' ? 'all' : 'none',
33
+ optimization: process.env['NODE_ENV'] === 'production',
34
+ }),
35
+ new NxReactRspackPlugin({
36
+ // Uncomment this line if you don't want to use SVGR
37
+ // See: https://react-svgr.com/
38
+ // svgr: false
39
+ }),
40
+ new NxModuleFederationPlugin({ config }, { dts: false }),
41
+ new NxModuleFederationDevServerPlugin({ config }),
42
+ ],
8
43
  };
9
-
10
- // Nx plugins for rspack to build config object from Nx options and context.
11
- /**
12
- * DTS Plugin is disabled in Nx Workspaces as Nx already provides Typing support Module Federation
13
- * The DTS Plugin can be enabled by setting dts: true
14
- * Learn more about the DTS Plugin here: https://module-federation.io/configure/dts.html
15
- */
16
- export default composePlugins(withNx(), withReact(), withModuleFederation(config, { dts: false }));
@@ -1,9 +1,12 @@
1
+ /**
2
+ * Nx requires a default export of the config to allow correct resolution of the module federation graph.
3
+ **/
1
4
  module.exports = {
2
- name: '<%= projectName %>',
3
- <% if (dynamic) { %>
4
- library: { type: 'var', name: '<%= projectName %>'},
5
- <% } %>
6
- exposes: {
7
- './Module': './src/remote-entry.<%= js ? 'js' : 'ts' %>',
8
- },
5
+ name: '<%= projectName %>',
6
+ <%_ if (dynamic) { _%>
7
+ library: { type: 'var', name: '<%= projectName %>'},
8
+ <%_ } _%>
9
+ exposes: {
10
+ './Module': './src/remote-entry.<%= js ? 'js' : 'ts' %>',
11
+ },
9
12
  };
@@ -1,6 +1,6 @@
1
1
  const { composePlugins, withNx } = require('@nx/webpack');
2
2
  const { withReact } = require('@nx/react');
3
- const { withModuleFederation } = require('@nx/react/module-federation');
3
+ const { withModuleFederation } = require('@nx/module-federation/webpack');
4
4
 
5
5
  const baseConfig = require('./module-federation.config');
6
6
 
@@ -1,6 +1,9 @@
1
+ /**
2
+ * Nx requires a default export of the config to allow correct resolution of the module federation graph.
3
+ **/
1
4
  module.exports = {
2
- name: '<%= projectName %>',
3
- exposes: {
4
- './Module': '<%= appProjectRoot %>/src/remote-entry.<%= js ? 'js' : 'ts' %>',
5
- },
5
+ name: '<%= projectName %>',
6
+ exposes: {
7
+ './Module': '<%= appProjectRoot %>/src/remote-entry.<%= js ? 'js' : 'ts' %>',
8
+ },
6
9
  };
@@ -1,11 +1,11 @@
1
1
  const {composePlugins, withNx} = require('@nx/webpack');
2
2
  const {withReact} = require('@nx/react');
3
- const {withModuleFederationForSSR} = require('@nx/react/module-federation');
3
+ const {withModuleFederationForSSR} = require('@nx/module-federation/webpack');
4
4
 
5
5
  const baseConfig = require("./module-federation.server.config");
6
6
 
7
7
  const defaultConfig = {
8
- ...baseConfig,
8
+ ...baseConfig,
9
9
  };
10
10
 
11
11
  // Nx plugins for webpack to build config object from Nx options and context.
@@ -1,10 +1,13 @@
1
- import {ModuleFederationConfig} from '@nx/webpack';
1
+ import {ModuleFederationConfig} from '@nx/module-federation';
2
2
 
3
3
  const config: ModuleFederationConfig = {
4
- name: '<%= projectName %>',
5
- exposes: {
6
- './Module': '<%= appProjectRoot %>/src/remote-entry.<%= js ? 'js' : 'ts' %>',
7
- },
4
+ name: '<%= projectName %>',
5
+ exposes: {
6
+ './Module': '<%= appProjectRoot %>/src/remote-entry.<%= js ? 'js' : 'ts' %>',
7
+ },
8
8
  };
9
9
 
10
+ /**
11
+ * Nx requires a default export of the config to allow correct resolution of the module federation graph.
12
+ **/
10
13
  export default config;
@@ -1,11 +1,11 @@
1
1
  import {composePlugins, withNx} from '@nx/webpack';
2
2
  import {withReact} from '@nx/react';
3
- import {withModuleFederationForSSR} from '@nx/react/module-federation';
3
+ import {withModuleFederationForSSR} from '@nx/module-federation/webpack';
4
4
 
5
5
  import baseConfig from "./module-federation.server.config";
6
6
 
7
7
  const defaultConfig = {
8
- ...baseConfig,
8
+ ...baseConfig,
9
9
  };
10
10
 
11
11
  // Nx plugins for webpack to build config object from Nx options and context.
@@ -1,13 +1,16 @@
1
- import {ModuleFederationConfig} from '@nx/webpack';
1
+ import {ModuleFederationConfig} from '@nx/module-federation';
2
2
 
3
3
  const config: ModuleFederationConfig = {
4
- name: '<%= projectName %>',
5
- <% if (dynamic) { %>
6
- library: { type: 'var', name: '<%= projectName %>'},
7
- <% } %>
8
- exposes: {
9
- './Module': './src/remote-entry.<%= js ? 'js' : 'ts' %>',
10
- },
4
+ name: '<%= projectName %>',
5
+ <%_ if (dynamic) { _%>
6
+ library: { type: 'var', name: '<%= projectName %>'},
7
+ <%_ } _%>
8
+ exposes: {
9
+ './Module': './src/remote-entry.<%= js ? 'js' : 'ts' %>',
10
+ },
11
11
  };
12
12
 
13
+ /**
14
+ * Nx requires a default export of the config to allow correct resolution of the module federation graph.
15
+ **/
13
16
  export default config;
@@ -1,11 +1,11 @@
1
1
  import {composePlugins, withNx} from '@nx/webpack';
2
2
  import {withReact} from '@nx/react';
3
- import {withModuleFederation} from '@nx/react/module-federation';
3
+ import {withModuleFederation} from '@nx/module-federation/webpack';
4
4
 
5
5
  import baseConfig from './module-federation.config';
6
6
 
7
7
  const config = {
8
- ...baseConfig,
8
+ ...baseConfig,
9
9
  };
10
10
 
11
11
  // Nx plugins for webpack to build config object from Nx options and context.
@@ -1,4 +1,4 @@
1
- import type { GeneratorCallback, Tree } from '@nx/devkit';
1
+ import { GeneratorCallback, Tree } from '@nx/devkit';
2
2
  import { NormalizedSchema } from '../../application/schema';
3
3
  import type { Schema } from '../schema';
4
4
  export declare function setupSsrForRemote(tree: Tree, options: NormalizedSchema<Schema>, appName: string): Promise<GeneratorCallback>;
@@ -2,39 +2,61 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setupSsrForRemote = setupSsrForRemote;
4
4
  const devkit_1 = require("@nx/devkit");
5
+ const devkit_2 = require("@nx/devkit");
5
6
  const versions_1 = require("../../../utils/versions");
7
+ const create_application_files_1 = require("../../application/lib/create-application-files");
6
8
  async function setupSsrForRemote(tree, options, appName) {
7
9
  const tasks = [];
8
- const project = (0, devkit_1.readProjectConfiguration)(tree, appName);
10
+ const project = (0, devkit_2.readProjectConfiguration)(tree, appName);
9
11
  const pathToModuleFederationSsrFiles = options.typescriptConfiguration
10
12
  ? `${options.bundler === 'rspack' ? 'rspack-' : 'webpack-'}module-federation-ssr-ts`
11
13
  : `${options.bundler === 'rspack' ? 'rspack-' : 'webpack-'}module-federation-ssr`;
12
- (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, `../files/${pathToModuleFederationSsrFiles}`), project.root, {
13
- ...options,
14
- port: Number(options?.devServerPort) || 4200,
15
- appName,
16
- tmpl: '',
17
- browserBuildOutputPath: project.targets.build.options.outputPath,
18
- serverBuildOutputPath: project.targets.server.options.outputPath,
19
- });
14
+ const templateVariables = options.bundler === 'rspack'
15
+ ? {
16
+ ...(0, create_application_files_1.getDefaultTemplateVariables)(tree, options),
17
+ rspackPluginOptions: {
18
+ ...(0, create_application_files_1.createNxRspackPluginOptions)(options, (0, devkit_1.offsetFromRoot)(options.appProjectRoot), false),
19
+ mainServer: `./server.ts`,
20
+ },
21
+ port: Number(options?.devServerPort) || 4200,
22
+ appName,
23
+ }
24
+ : {
25
+ ...options,
26
+ port: Number(options?.devServerPort) || 4200,
27
+ appName,
28
+ tmpl: '',
29
+ browserBuildOutputPath: project.targets.build?.options?.outputPath,
30
+ serverBuildOutputPath: project.targets.server?.options?.outputPath,
31
+ };
32
+ (0, devkit_2.generateFiles)(tree, (0, devkit_2.joinPathFragments)(__dirname, `../files/${pathToModuleFederationSsrFiles}`), project.root, templateVariables);
20
33
  // For hosts to use when running remotes in static mode.
21
- const originalOutputPath = project.targets.build?.options?.outputPath;
34
+ const originalOutputPath = project.targets.build?.options?.outputPath ??
35
+ options.isUsingTsSolutionConfig
36
+ ? 'dist'
37
+ : (0, devkit_2.joinPathFragments)((0, devkit_1.offsetFromRoot)(options.appProjectRoot), 'dist', options.appProjectRoot != '.'
38
+ ? options.appProjectRoot
39
+ : options.projectName);
22
40
  const serverOptions = project.targets.server?.options;
23
41
  const serverOutputPath = serverOptions?.outputPath ??
24
- (0, devkit_1.joinPathFragments)(originalOutputPath, 'server');
42
+ (0, devkit_2.joinPathFragments)(originalOutputPath, 'server');
25
43
  const serverOutputName = serverOptions?.outputFileName ?? 'main.js';
26
44
  project.targets['serve-static'] = {
27
45
  dependsOn: ['build', 'server'],
28
46
  executor: 'nx:run-commands',
29
47
  defaultConfiguration: 'development',
30
48
  options: {
31
- command: `PORT=${options.devServerPort ?? 4200} node ${(0, devkit_1.joinPathFragments)(serverOutputPath, serverOutputName)}`,
49
+ command: `PORT=${options.devServerPort ?? 4200} node ${(0, devkit_2.joinPathFragments)(serverOutputPath, serverOutputName)}`,
32
50
  },
33
51
  };
34
- (0, devkit_1.updateProjectConfiguration)(tree, appName, project);
35
- const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
52
+ (0, devkit_2.updateProjectConfiguration)(tree, appName, project);
53
+ const installTask = (0, devkit_2.addDependenciesToPackageJson)(tree, {
36
54
  '@module-federation/node': versions_1.moduleFederationNodeVersion,
55
+ cors: versions_1.corsVersion,
56
+ isbot: versions_1.isbotVersion,
57
+ express: versions_1.expressVersion,
58
+ '@types/express': versions_1.typesExpressVersion,
37
59
  }, {});
38
60
  tasks.push(installTask);
39
- return (0, devkit_1.runTasksInSerial)(...tasks);
61
+ return (0, devkit_2.runTasksInSerial)(...tasks);
40
62
  }
@@ -8,7 +8,5 @@ function setupTspathForRemote(tree, options) {
8
8
  const project = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
9
9
  const exportPath = (0, maybe_js_1.maybeJs)(options, './src/remote-entry.ts');
10
10
  const exportName = 'Module';
11
- (0, js_1.addTsConfigPath)(tree, `${options.projectName}/${exportName}`, [
12
- (0, devkit_1.joinPathFragments)(project.root, exportPath),
13
- ]);
11
+ (0, js_1.addTsConfigPath)(tree, `${options.projectName.replace(/-/g, '_')}/${exportName}`, [(0, devkit_1.joinPathFragments)(project.root, exportPath)]);
14
12
  }
@@ -24,7 +24,7 @@ function updateHostWithRemote(host, hostName, remoteName) {
24
24
  }
25
25
  else {
26
26
  // TODO(jack): Point to the nx.dev guide when ready.
27
- devkit_1.logger.warn(`Could not find configuration at ${moduleFederationConfigPath}. Did you generate this project with "@nx/react:host"?`);
27
+ devkit_1.logger.warn(`Could not find configuration at ${moduleFederationConfigPath}. Did you generate this project with "@nx/react:host" or "@nx/react:consumer"?`);
28
28
  }
29
29
  if (host.exists(appComponentPath)) {
30
30
  let sourceCode = host.read(appComponentPath).toString();
@@ -32,7 +32,7 @@ function updateHostWithRemote(host, hostName, remoteName) {
32
32
  host.write(appComponentPath, (0, devkit_1.applyChangesToString)(sourceCode, (0, ast_utils_1.addRemoteRoute)(source, (0, devkit_1.names)(remoteName))));
33
33
  }
34
34
  else {
35
- devkit_1.logger.warn(`Could not find app component at ${appComponentPath}. Did you generate this project with "@nx/react:host"?`);
35
+ devkit_1.logger.warn(`Could not find app component at ${appComponentPath}. Did you generate this project with "@nx/react:host" or "@nx/react:consumer"?`);
36
36
  }
37
37
  }
38
38
  function findAppComponentPath(host, sourceRoot) {
@@ -3,5 +3,4 @@ import { NormalizedSchema } from '../application/schema';
3
3
  import { Schema } from './schema';
4
4
  export declare function addModuleFederationFiles(host: Tree, options: NormalizedSchema<Schema>): void;
5
5
  export declare function remoteGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
6
- export declare function remoteGeneratorInternal(host: Tree, schema: Schema): Promise<GeneratorCallback>;
7
6
  export default remoteGenerator;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addModuleFederationFiles = addModuleFederationFiles;
4
4
  exports.remoteGenerator = remoteGenerator;
5
- exports.remoteGeneratorInternal = remoteGeneratorInternal;
6
5
  const path_1 = require("path");
7
6
  const devkit_1 = require("@nx/devkit");
8
7
  const normalize_options_1 = require("../application/lib/normalize-options");
@@ -17,12 +16,22 @@ const add_mf_env_to_inputs_1 = require("../../utils/add-mf-env-to-inputs");
17
16
  const maybe_js_1 = require("../../utils/maybe-js");
18
17
  const js_1 = require("@nx/js");
19
18
  const versions_1 = require("../../utils/versions");
19
+ const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
20
+ const create_application_files_1 = require("../application/lib/create-application-files");
20
21
  function addModuleFederationFiles(host, options) {
21
- const templateVariables = {
22
- ...(0, devkit_1.names)(options.projectName),
23
- ...options,
24
- tmpl: '',
25
- };
22
+ const templateVariables = options.bundler === 'rspack'
23
+ ? {
24
+ ...(0, create_application_files_1.getDefaultTemplateVariables)(host, options),
25
+ rspackPluginOptions: {
26
+ ...(0, create_application_files_1.createNxRspackPluginOptions)(options, (0, devkit_1.offsetFromRoot)(options.appProjectRoot), false),
27
+ mainServer: `./server.ts`,
28
+ },
29
+ }
30
+ : {
31
+ ...(0, devkit_1.names)(options.projectName),
32
+ ...options,
33
+ tmpl: '',
34
+ };
26
35
  (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `./files/${options.js
27
36
  ? options.bundler === 'rspack'
28
37
  ? 'rspack-common'
@@ -46,23 +55,20 @@ function addModuleFederationFiles(host, options) {
46
55
  }
47
56
  }
48
57
  async function remoteGenerator(host, schema) {
49
- return await remoteGeneratorInternal(host, {
50
- projectNameAndRootFormat: 'derived',
51
- ...schema,
52
- });
53
- }
54
- async function remoteGeneratorInternal(host, schema) {
55
58
  const tasks = [];
56
59
  const options = {
57
- ...(await (0, normalize_options_1.normalizeOptions)(host, schema, '@nx/react:remote')),
60
+ ...(await (0, normalize_options_1.normalizeOptions)(host, {
61
+ ...schema,
62
+ useProjectJson: true,
63
+ })),
58
64
  // when js is set to true, we want to use the js configuration
59
65
  js: schema.js ?? false,
60
66
  typescriptConfiguration: schema.js
61
67
  ? false
62
68
  : schema.typescriptConfiguration ?? true,
63
69
  dynamic: schema.dynamic ?? false,
64
- // TODO(colum): remove when MF works with Crystal
65
- addPlugin: false,
70
+ // TODO(colum): remove when Webpack MF works with Crystal
71
+ addPlugin: !schema.bundler || schema.bundler === 'rspack' ? true : false,
66
72
  bundler: schema.bundler ?? 'rspack',
67
73
  };
68
74
  if (options.dynamic) {
@@ -73,14 +79,24 @@ async function remoteGeneratorInternal(host, schema) {
73
79
  throw new Error(`Invalid remote name provided: ${options.projectName}. ${isValidRemote.message}`);
74
80
  }
75
81
  }
82
+ await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
83
+ const REMOTE_NAME_REGEX = '^[a-zA-Z_$][a-zA-Z_$0-9]*$';
84
+ const remoteNameRegex = new RegExp(REMOTE_NAME_REGEX);
85
+ if (!remoteNameRegex.test(options.projectName)) {
86
+ throw new Error((0, devkit_1.stripIndents) `Invalid remote name: ${options.projectName}. Remote project names must:
87
+ - Start with a letter, dollar sign ($) or underscore (_)
88
+ - Followed by any valid character (letters, digits, underscores, or dollar signs)
89
+ The regular expression used is ${REMOTE_NAME_REGEX}.`);
90
+ }
76
91
  const initAppTask = await (0, application_1.default)(host, {
77
92
  ...options,
78
93
  name: options.projectName,
79
94
  skipFormat: true,
95
+ useProjectJson: true,
80
96
  });
81
97
  tasks.push(initAppTask);
82
- if (schema.host) {
83
- (0, update_host_with_remote_1.updateHostWithRemote)(host, schema.host, options.projectName);
98
+ if (options.host) {
99
+ (0, update_host_with_remote_1.updateHostWithRemote)(host, options.host, options.projectName);
84
100
  }
85
101
  // Module federation requires bootstrap code to be dynamically imported.
86
102
  // Renaming original entry file so we can use `import(./bootstrap)` in
@@ -90,36 +106,44 @@ async function remoteGeneratorInternal(host, schema) {
90
106
  (0, update_module_federation_project_1.updateModuleFederationProject)(host, options);
91
107
  (0, setup_tspath_for_remote_1.setupTspathForRemote)(host, options);
92
108
  if (options.ssr) {
93
- const setupSsrTask = await (0, setup_ssr_1.default)(host, {
94
- project: options.projectName,
95
- serverPort: options.devServerPort,
96
- skipFormat: true,
97
- bundler: options.bundler,
98
- });
99
- tasks.push(setupSsrTask);
109
+ if (options.bundler !== 'rspack') {
110
+ const setupSsrTask = await (0, setup_ssr_1.default)(host, {
111
+ project: options.projectName,
112
+ serverPort: options.devServerPort,
113
+ skipFormat: true,
114
+ bundler: options.bundler,
115
+ });
116
+ tasks.push(setupSsrTask);
117
+ }
100
118
  const setupSsrForRemoteTask = await (0, setup_ssr_for_remote_1.setupSsrForRemote)(host, options, options.projectName);
101
119
  tasks.push(setupSsrForRemoteTask);
102
120
  const projectConfig = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
103
- if (options.bundler === 'rspack') {
104
- projectConfig.targets.server.executor = '@nx/rspack:rspack';
105
- projectConfig.targets.server.options.rspackConfig = (0, devkit_1.joinPathFragments)(projectConfig.root, `rspack.server.config.${options.typescriptConfiguration ? 'ts' : 'js'}`);
106
- delete projectConfig.targets.server.options.webpackConfig;
107
- }
108
- else {
121
+ if (options.bundler !== 'rspack') {
109
122
  projectConfig.targets.server.options.webpackConfig = (0, devkit_1.joinPathFragments)(projectConfig.root, `webpack.server.config.${options.typescriptConfiguration ? 'ts' : 'js'}`);
123
+ (0, devkit_1.updateProjectConfiguration)(host, options.projectName, projectConfig);
110
124
  }
111
- (0, devkit_1.updateProjectConfiguration)(host, options.projectName, projectConfig);
112
125
  }
113
126
  if (!options.setParserOptionsProject) {
114
127
  host.delete((0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.lint.json'));
115
128
  }
129
+ if (options.host && options.bundler === 'rspack') {
130
+ const projectConfig = (0, devkit_1.readProjectConfiguration)(host, options.projectName);
131
+ projectConfig.targets.serve ??= {};
132
+ projectConfig.targets.serve.dependsOn ??= [];
133
+ projectConfig.targets.serve.dependsOn.push(`${options.host}:serve`);
134
+ (0, devkit_1.updateProjectConfiguration)(host, options.projectName, projectConfig);
135
+ }
116
136
  if (options.host && options.dynamic) {
117
137
  const hostConfig = (0, devkit_1.readProjectConfiguration)(host, schema.host);
118
138
  const pathToMFManifest = (0, devkit_1.joinPathFragments)(hostConfig.sourceRoot, 'assets/module-federation.manifest.json');
119
139
  (0, add_remote_to_dynamic_host_1.addRemoteToDynamicHost)(host, options.projectName, options.devServerPort, pathToMFManifest);
120
140
  }
121
- (0, add_mf_env_to_inputs_1.addMfEnvToTargetDefaultInputs)(host);
122
- const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, {}, { '@module-federation/enhanced': versions_1.moduleFederationEnhancedVersion });
141
+ (0, add_mf_env_to_inputs_1.addMfEnvToTargetDefaultInputs)(host, options.bundler);
142
+ const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
143
+ '@module-federation/enhanced': versions_1.moduleFederationEnhancedVersion,
144
+ '@nx/web': versions_1.nxVersion,
145
+ '@nx/module-federation': versions_1.nxVersion,
146
+ });
123
147
  tasks.push(installTask);
124
148
  if (!options.skipFormat) {
125
149
  await (0, devkit_1.formatFiles)(host);
@@ -1,4 +1,3 @@
1
- import type { ProjectNameAndRootFormat } from '@nx/devkit/src/generators/project-name-and-root-utils';
2
1
  import type { Linter, LinterType } from '@nx/eslint';
3
2
  import type { SupportedStyles } from '../../../typings/style';
4
3
  import type { NormalizedSchema as ApplicationNormalizedSchema } from '../application/schema';
@@ -7,15 +6,13 @@ export interface Schema {
7
6
  classComponent?: boolean;
8
7
  compiler?: 'babel' | 'swc';
9
8
  devServerPort?: number;
10
- directory?: string;
11
- projectNameAndRootFormat?: ProjectNameAndRootFormat;
9
+ directory: string;
12
10
  e2eTestRunner: 'cypress' | 'playwright' | 'none';
13
11
  globalCss?: boolean;
14
12
  host?: string;
15
13
  js?: boolean;
16
14
  linter: Linter | LinterType;
17
- name: string;
18
- pascalCaseFiles?: boolean;
15
+ name?: string;
19
16
  routing?: boolean;
20
17
  setParserOptionsProject?: boolean;
21
18
  skipFormat: boolean;
@@ -2,35 +2,29 @@
2
2
  "$schema": "https://json-schema.org/schema",
3
3
  "$id": "GeneratorReactRemote",
4
4
  "cli": "nx",
5
- "title": "Generate Module Federation Setup for React Remote App",
6
- "description": "Create Module Federation configuration files for given React Remote Application.",
5
+ "title": "Generate Module Federation Setup for React Producer (Remote) App",
6
+ "description": "Create Module Federation configuration files for given React Producer (Remote) Application.",
7
7
  "type": "object",
8
8
  "properties": {
9
- "name": {
9
+ "directory": {
10
+ "description": "The directory of the new application.",
10
11
  "type": "string",
11
- "description": "The name of the remote application to generate the Module Federation configuration",
12
+ "alias": "dir",
12
13
  "$default": {
13
14
  "$source": "argv",
14
15
  "index": 0
15
16
  },
16
- "x-prompt": "What name would you like to use as the remote application?",
17
- "pattern": "^[a-zA-Z][^:]*$",
18
- "x-priority": "important"
17
+ "x-prompt": "Which directory do you want to create the application in?"
19
18
  },
20
- "directory": {
21
- "description": "The directory of the new application.",
19
+ "name": {
22
20
  "type": "string",
23
- "alias": "dir",
21
+ "description": "The name of the Producer (remote) application to generate the Module Federation configuration",
22
+ "pattern": "^[a-zA-Z_$][a-zA-Z_$0-9]*$",
24
23
  "x-priority": "important"
25
24
  },
26
- "projectNameAndRootFormat": {
27
- "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
28
- "type": "string",
29
- "enum": ["as-provided", "derived"]
30
- },
31
25
  "dynamic": {
32
26
  "type": "boolean",
33
- "description": "Should the host application use dynamic federation?",
27
+ "description": "Should the Consumer (host) application use dynamic federation?",
34
28
  "default": false,
35
29
  "x-priority": "internal"
36
30
  },
@@ -119,12 +113,6 @@
119
113
  "description": "Add tags to the application (used for linting).",
120
114
  "alias": "t"
121
115
  },
122
- "pascalCaseFiles": {
123
- "type": "boolean",
124
- "description": "Use pascal case component file name (e.g. App.tsx).",
125
- "alias": "P",
126
- "default": false
127
- },
128
116
  "classComponent": {
129
117
  "type": "boolean",
130
118
  "description": "Use class components instead of functional component.",
@@ -159,16 +147,17 @@
159
147
  },
160
148
  "host": {
161
149
  "type": "string",
162
- "description": "The host / shell application for this remote.",
163
- "x-priority": "important"
150
+ "description": "The Consumer (host) application for this Producer (remote).",
151
+ "x-priority": "important",
152
+ "alias": "consumer"
164
153
  },
165
154
  "devServerPort": {
166
155
  "type": "number",
167
- "description": "The port for the dev server of the remote app.",
156
+ "description": "The port for the dev server of the Producer (remote) app.",
168
157
  "x-priority": "important"
169
158
  },
170
159
  "ssr": {
171
- "description": "Whether to configure SSR for the host application",
160
+ "description": "Whether to configure SSR for the Consumer (host) application",
172
161
  "type": "boolean",
173
162
  "default": false
174
163
  },
@@ -192,6 +181,6 @@
192
181
  "x-priority": "important"
193
182
  }
194
183
  },
195
- "required": ["name"],
184
+ "required": ["directory"],
196
185
  "additionalProperties": false
197
186
  }
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateProject = updateProject;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  function updateProject(tree, config, options) {
6
- if (config?.targets?.build?.executor === '@nx/webpack:webpack' ||
7
- config?.targets?.build?.executor === '@nrwl/webpack:webpack') {
6
+ if (config?.targets?.build?.executor === '@nx/webpack:webpack') {
8
7
  config.targets.build.options ??= {};
9
8
  config.targets.build.options.postcssConfig = (0, devkit_1.joinPathFragments)(config.root, 'postcss.config.js');
10
9
  (0, devkit_1.updateProjectConfiguration)(tree, options.project, config);
@@ -17,16 +17,6 @@
17
17
  "x-prompt": "For which project do you want to generate stories?",
18
18
  "x-priority": "important"
19
19
  },
20
- "generateCypressSpecs": {
21
- "type": "boolean",
22
- "description": "Automatically generate `*.spec.ts` files in the cypress e2e app generated by the cypress-configure generator.",
23
- "x-deprecated": "Use interactionTests instead. This option will be removed in v20."
24
- },
25
- "cypressProject": {
26
- "type": "string",
27
- "description": "The Cypress project to generate the stories under. This is inferred from `project` by default.",
28
- "x-deprecated": "Use interactionTests instead. This option will be removed in v20."
29
- },
30
20
  "interactionTests": {
31
21
  "type": "boolean",
32
22
  "description": "Set up Storybook interaction tests.",
@@ -5,11 +5,9 @@ export interface StorybookStoriesSchema {
5
5
  js?: boolean;
6
6
  ignorePaths?: string[];
7
7
  skipFormat?: boolean;
8
- cypressProject?: string;
9
- generateCypressSpecs?: boolean;
10
8
  }
11
9
  export declare function projectRootPath(tree: Tree, config: ProjectConfiguration): Promise<string>;
12
10
  export declare function containsComponentDeclaration(tree: Tree, componentPath: string): boolean;
13
- export declare function createAllStories(tree: Tree, projectName: string, interactionTests: boolean, js: boolean, projects: Map<string, ProjectConfiguration>, projectConfiguration: ProjectConfiguration, generateCypressSpecs?: boolean, cypressProject?: string, ignorePaths?: string[]): Promise<void>;
11
+ export declare function createAllStories(tree: Tree, projectName: string, interactionTests: boolean, js: boolean, projects: Map<string, ProjectConfiguration>, projectConfiguration: ProjectConfiguration, ignorePaths?: string[]): Promise<void>;
14
12
  export declare function storiesGenerator(host: Tree, schema: StorybookStoriesSchema): Promise<GeneratorCallback>;
15
13
  export default storiesGenerator;