@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,84 +0,0 @@
1
- <% if (classComponent) { %>
2
- import { Component } from 'react';
3
- <% } %>
4
-
5
- <% if (routing) { %>
6
- import { Route, Link } from 'react-router-dom';
7
- <% } %>
8
-
9
- <% if (hasStyles) {
10
- if (styledModule && styledModule !== 'styled-jsx') {
11
- var wrapper = 'Styled' + className;
12
- var extras = '';
13
- %>
14
- import styled from '<%= styledModule %>';
15
- <% } else {
16
- var wrapper = 'div';
17
- var extras = globalCss || styledModule === 'styled-jsx' ? '' : " className={styles['container']}";
18
- %>
19
- <%- style !== 'styled-jsx' ? globalCss ? `import './${fileName}.${style}';` : `import styles from './${fileName}.module.${style}';`: '' %>
20
- <% }
21
- } else {
22
- var wrapper = 'div';
23
- var extras = '';
24
- } %>
25
-
26
- <% if (styledModule && styledModule !== 'styled-jsx') { %>
27
- const Styled<%= className %> = styled.div`
28
- color: pink;
29
- `;
30
- <% }%>
31
- <% if(!isNextPage) { %>
32
- <% if (classComponent) { %>
33
- export class <%= className %> extends Component<{}> {
34
- override render() {
35
- return (
36
- <<%= wrapper %><%- extras %>>
37
- <%= styledModule === 'styled-jsx' ? `<style jsx>{\`div { color: pink; }\`}</style>` : `` %>
38
- <p>Welcome to <%= className %>!</p>
39
- <% if (routing) { %>
40
- <ul>
41
- <li><Link to="/"><%= name %> root</Link></li>
42
- </ul>
43
- <Route path="/" element={<div>This is the <%= name %> root route.</div>} />
44
- <% } %>
45
- </<%= wrapper %>>
46
- );
47
- }
48
- }
49
- <% } else { %>
50
- export function <%= className %>() {
51
- return (
52
- <<%= wrapper %><%- extras %>>
53
- <% if (styledModule === 'styled-jsx') { %><style jsx>{`div { color: pink; }`}</style><% } %>
54
- <h1>Welcome to <%= className %>!</h1>
55
- <% if (routing) { %>
56
- <ul>
57
- <li><Link to="/"><%= name %> root</Link></li>
58
- </ul>
59
- <Route path="/" element={<div>This is the <%= name %> root route.</div>} />
60
- <% } %>
61
- </<%= wrapper %>>
62
- );
63
- }
64
- <% } %>
65
-
66
- export default <%= className %>;
67
- <% } else { %>
68
- export default function <%= className %>() {
69
- return (
70
- <<%= wrapper %><%- extras %>>
71
- <% if (styledModule === 'styled-jsx') { %><style jsx>{`div { color: pink; }`}</style><% } %>
72
- <h1>Welcome to <%= className %>!</h1>
73
- <% if (routing) { %>
74
- <ul>
75
- <li><Link to="/"><%= name %> root</Link></li>
76
- </ul>
77
- <Route path="/" element={<div>This is the <%= name %> root route.</div>} />
78
- <% } %>
79
- </<%= wrapper %>>
80
- );
81
- };
82
- <% } %>
83
-
84
- <% if (inSourceTests === true) { %> <%- inSourceVitestTests %> <% } %>
@@ -1,13 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- import type * as ts from 'typescript';
3
- export interface CreateComponentSpecFileSchema {
4
- project: string;
5
- componentPath: string;
6
- js?: boolean;
7
- cypressProject?: string;
8
- skipFormat?: boolean;
9
- }
10
- export declare function componentCypressGenerator(host: Tree, schema: CreateComponentSpecFileSchema): Promise<void>;
11
- export declare function getArgsDefaultValue(property: ts.SyntaxKind): string;
12
- export declare function createComponentSpecFile(tree: Tree, { project, componentPath, js, cypressProject }: CreateComponentSpecFileSchema): void;
13
- export default componentCypressGenerator;
@@ -1,104 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.componentCypressGenerator = componentCypressGenerator;
4
- exports.getArgsDefaultValue = getArgsDefaultValue;
5
- exports.createComponentSpecFile = createComponentSpecFile;
6
- const devkit_1 = require("@nx/devkit");
7
- const path_1 = require("path");
8
- const ast_utils_1 = require("../../utils/ast-utils");
9
- const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
10
- let tsModule;
11
- async function componentCypressGenerator(host, schema) {
12
- createComponentSpecFile(host, schema);
13
- if (!schema.skipFormat) {
14
- await (0, devkit_1.formatFiles)(host);
15
- }
16
- }
17
- // TODO: candidate to refactor with the angular component story
18
- function getArgsDefaultValue(property) {
19
- if (!tsModule) {
20
- tsModule = (0, ensure_typescript_1.ensureTypescript)();
21
- }
22
- const typeNameToDefault = {
23
- [tsModule.SyntaxKind.StringKeyword]: '',
24
- [tsModule.SyntaxKind.NumberKeyword]: 0,
25
- [tsModule.SyntaxKind.BooleanKeyword]: false,
26
- };
27
- const resolvedValue = typeNameToDefault[property];
28
- if (resolvedValue === undefined) {
29
- return '';
30
- }
31
- else if (typeof resolvedValue === 'string') {
32
- return resolvedValue.replace(/\s/g, '+');
33
- }
34
- else {
35
- return resolvedValue;
36
- }
37
- }
38
- function createComponentSpecFile(tree, { project, componentPath, js, cypressProject }) {
39
- if (!tsModule) {
40
- tsModule = (0, ensure_typescript_1.ensureTypescript)();
41
- }
42
- const e2eProjectName = cypressProject || `${project}-e2e`;
43
- const projects = (0, devkit_1.getProjects)(tree);
44
- const e2eProject = projects.get(e2eProjectName);
45
- // cypress >= v10 will have a cypress.config.ts < v10 will have a cypress.json
46
- const isCypressV10 = tree.exists((0, path_1.join)(e2eProject.root, 'cypress.config.ts'));
47
- const e2eLibIntegrationFolderPath = (0, path_1.join)(e2eProject.sourceRoot, isCypressV10 ? 'e2e' : 'integration');
48
- const proj = projects.get(project);
49
- const componentFilePath = (0, devkit_1.joinPathFragments)(proj.sourceRoot, componentPath);
50
- const componentName = componentFilePath
51
- .slice(componentFilePath.lastIndexOf('/') + 1)
52
- .replace('.tsx', '')
53
- .replace('.jsx', '')
54
- .replace('.js', '');
55
- const contents = tree.read(componentFilePath, 'utf-8');
56
- if (contents === null) {
57
- throw new Error(`Failed to read ${componentFilePath}`);
58
- }
59
- const sourceFile = tsModule.createSourceFile(componentFilePath, contents, tsModule.ScriptTarget.Latest, true);
60
- const cmpDeclaration = (0, ast_utils_1.getComponentNode)(sourceFile);
61
- if (!cmpDeclaration) {
62
- const componentNodes = (0, ast_utils_1.findExportDeclarationsForJsx)(sourceFile);
63
- if (componentNodes?.length) {
64
- componentNodes.forEach((declaration) => {
65
- findPropsAndGenerateFileForCypress(tree, sourceFile, declaration, e2eLibIntegrationFolderPath, componentName, project, js, true);
66
- });
67
- }
68
- else {
69
- throw new Error(`Could not find any React component in file ${componentFilePath}`);
70
- }
71
- }
72
- else {
73
- findPropsAndGenerateFileForCypress(tree, sourceFile, cmpDeclaration, e2eLibIntegrationFolderPath, componentName, project, js);
74
- }
75
- }
76
- function findPropsAndGenerateFileForCypress(tree, sourceFile, cmpDeclaration, e2eLibIntegrationFolderPath, componentName, project, js, fromNodeArray) {
77
- const info = (0, ast_utils_1.parseComponentPropsInfo)(sourceFile, cmpDeclaration);
78
- let props = [];
79
- if (info) {
80
- if (!tsModule) {
81
- tsModule = (0, ensure_typescript_1.ensureTypescript)();
82
- }
83
- props = info.props.map((member) => {
84
- return {
85
- name: member.name.text,
86
- defaultValue: tsModule.isBindingElement(member)
87
- ? getArgsDefaultValue(member.kind)
88
- : getArgsDefaultValue(member.type.kind),
89
- };
90
- });
91
- }
92
- const isCypressV10 = (0, path_1.basename)(e2eLibIntegrationFolderPath) === 'e2e';
93
- const cyFilePrefix = isCypressV10 ? 'cy' : 'spec';
94
- (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files'), `${e2eLibIntegrationFolderPath}/${fromNodeArray
95
- ? componentName + '--' + cmpDeclaration.name.text
96
- : componentName}`, {
97
- projectName: project,
98
- componentName,
99
- componentSelector: cmpDeclaration.name.text,
100
- props,
101
- fileExt: js ? `${cyFilePrefix}.js` : `${cyFilePrefix}.ts`,
102
- });
103
- }
104
- exports.default = componentCypressGenerator;
@@ -1,13 +0,0 @@
1
- describe('<%=projectName%>: <%= componentSelector %> component', () => {
2
- beforeEach(() => cy.visit('/iframe.html?id=<%= componentSelector.toLowerCase() %>--primary<% if ( props && props.length > 0 ) { %>&args=<% } %><%
3
- for(let prop of props) {
4
- %><%=prop.name%><%
5
- if(prop.defaultValue !== undefined && (prop.defaultValue || prop.defaultValue === false)) {
6
- %>:<%=prop.defaultValue%><%
7
- } %>;<%
8
- }%>'));
9
-
10
- it('should render the component', () => {
11
- cy.get('h1').should('contain', 'Welcome to <%=componentSelector%>!');
12
- });
13
- });
@@ -1,45 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/schema",
3
- "cli": "nx",
4
- "$id": "NxReactComponentCypressSpec",
5
- "title": "Create component Cypress spec",
6
- "description": "Create a Storybook Cypress spec for a UI component that has a story.",
7
- "x-deprecated": "Use interactionTests instead. This option will be removed in v20.",
8
- "type": "object",
9
- "properties": {
10
- "project": {
11
- "type": "string",
12
- "description": "The project name for which to generate tests.",
13
- "examples": ["shared-ui-component"],
14
- "$default": {
15
- "$source": "projectName",
16
- "index": 0
17
- },
18
- "x-prompt": "What's name of the project for which to generate tests?",
19
- "x-priority": "important"
20
- },
21
- "componentPath": {
22
- "type": "string",
23
- "description": "Relative path to the component file from the library root?",
24
- "examples": ["lib/components"],
25
- "x-prompt": "What's path of the component relative to the project's lib root for which to generate a test?",
26
- "x-priority": "important"
27
- },
28
- "js": {
29
- "type": "boolean",
30
- "description": "Generate JavaScript files rather than TypeScript files.",
31
- "default": false
32
- },
33
- "cypressProject": {
34
- "type": "string",
35
- "description": "The Cypress project to generate the stories under. By default, inferred from `project`."
36
- },
37
- "skipFormat": {
38
- "description": "Skip formatting files.",
39
- "type": "boolean",
40
- "default": false,
41
- "x-priority": "internal"
42
- }
43
- },
44
- "required": ["project", "componentPath"]
45
- }
@@ -1,16 +0,0 @@
1
- const {composePlugins, withNx, withReact} = require('@nx/rspack');
2
- const {withModuleFederationForSSR} = require('@nx/rspack/module-federation');
3
-
4
- const baseConfig = require('./module-federation.config');
5
-
6
- const defaultConfig = {
7
- ...baseConfig
8
- };
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 for 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
- module.exports = composePlugins(withNx(), withReact({ssr: true}), withModuleFederationForSSR(defaultConfig, { dts: false }));
@@ -1,16 +0,0 @@
1
- import {composePlugins, withNx, withReact} from '@nx/rspack';
2
- import {withModuleFederationForSSR} from '@nx/rspack/module-federation';
3
-
4
- import baseConfig from './module-federation.config';
5
-
6
- const defaultConfig = {
7
- ...baseConfig
8
- };
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 for 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({ssr: true}), withModuleFederationForSSR(defaultConfig, { dts: false }));
@@ -1,4 +0,0 @@
1
- {
2
- "name": "<%= name %>",
3
- "version": "0.0.1"
4
- }
@@ -1,12 +0,0 @@
1
- {
2
- "name": "<%= name %>",
3
- "version": "0.0.1",
4
- "main": "./index.js",
5
- "types": "./index.d.ts",
6
- "exports": {
7
- ".": {
8
- "import": "./index.mjs",
9
- "require": "./index.js"
10
- }
11
- }
12
- }
@@ -1,16 +0,0 @@
1
- const {composePlugins, withNx, withReact} = require('@nx/rspack');
2
- const {withModuleFederationForSSR} = require('@nx/rspack/module-federation');
3
-
4
- const baseConfig = require("./module-federation.server.config");
5
-
6
- const defaultConfig = {
7
- ...baseConfig,
8
- };
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
- module.exports = composePlugins(withNx(), withReact({ssr: true}), withModuleFederationForSSR(defaultConfig, { dts: false }));
@@ -1,16 +0,0 @@
1
- import {composePlugins, withNx, withReact} from '@nx/rspack';
2
- import {withModuleFederationForSSR} from '@nx/rspack/module-federation';
3
-
4
- import baseConfig from "./module-federation.server.config";
5
-
6
- const defaultConfig = {
7
- ...baseConfig,
8
- };
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({ssr: true}), withModuleFederationForSSR(defaultConfig, { dts: false }));
@@ -1,2 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export default function replacePackage(tree: Tree): Promise<void>;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = replacePackage;
4
- const devkit_1 = require("@nx/devkit");
5
- const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
6
- async function replacePackage(tree) {
7
- await (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/react', '@nx/react');
8
- await (0, devkit_1.formatFiles)(tree);
9
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export default function removePackage(tree: Tree): Promise<void>;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = removePackage;
4
- const devkit_1 = require("@nx/devkit");
5
- async function removePackage(tree) {
6
- (0, devkit_1.removeDependenciesFromPackageJson)(tree, [], ['react-test-renderer']);
7
- await (0, devkit_1.formatFiles)(tree);
8
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export default function removePackage(tree: Tree): Promise<void>;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = removePackage;
4
- const devkit_1 = require("@nx/devkit");
5
- async function removePackage(tree) {
6
- (0, devkit_1.removeDependenciesFromPackageJson)(tree, [], ['react-test-renderer']);
7
- await (0, devkit_1.formatFiles)(tree);
8
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export default function addBabelCore(tree: Tree): Promise<void>;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = addBabelCore;
4
- const devkit_1 = require("@nx/devkit");
5
- const versions_1 = require("../../utils/versions");
6
- async function addBabelCore(tree) {
7
- const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
8
- if (packageJson?.devDependencies['@babel/preset-react']) {
9
- (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
10
- '@babel/core': versions_1.babelCoreVersion,
11
- });
12
- await (0, devkit_1.formatFiles)(tree);
13
- }
14
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export default function addTypings(tree: Tree): Promise<void>;
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = addTypings;
4
- const devkit_1 = require("@nx/devkit");
5
- async function addTypings(tree) {
6
- const projects = (0, devkit_1.getProjects)(tree);
7
- const buildExecutors = [
8
- '@nx/webpack:webpack',
9
- '@nx/vite:build',
10
- '@nx/rspack:rspack',
11
- ];
12
- const serveExecutors = [
13
- '@nx/webpack:dev-server',
14
- '@nx/vite:dev-server',
15
- '@nx/rspack:dev-server',
16
- ];
17
- const relatedTsConfigs = [
18
- 'tsconfig.app.json',
19
- 'tsconfig.lib.json',
20
- 'tsconfig.spec.json',
21
- ];
22
- const typesToAdd = [
23
- '@nx/react/typings/cssmodule.d.ts',
24
- '@nx/react/typings/image.d.ts',
25
- ];
26
- for (const [, config] of projects) {
27
- if (!buildExecutors.includes(config?.targets?.build?.executor)) {
28
- continue;
29
- }
30
- if (config?.targets?.serve?.executor &&
31
- !serveExecutors.includes(config?.targets?.serve?.executor)) {
32
- continue;
33
- }
34
- const rootPath = config.root;
35
- const projectTsConfigPath = (0, devkit_1.joinPathFragments)(rootPath, 'tsconfig.json');
36
- const projectTsConfig = (0, devkit_1.readJson)(tree, projectTsConfigPath);
37
- if (projectTsConfig.compilerOptions?.jsx !== 'react-jsx') {
38
- continue;
39
- }
40
- relatedTsConfigs.forEach((tsConfig) => {
41
- const tsConfigPath = (0, devkit_1.joinPathFragments)(rootPath, tsConfig);
42
- if (tree.exists(tsConfigPath)) {
43
- (0, devkit_1.updateJson)(tree, tsConfigPath, (json) => {
44
- const compilerOptions = json.compilerOptions || {};
45
- compilerOptions.types = [
46
- ...new Set([...(compilerOptions.types || []), ...typesToAdd]),
47
- ];
48
- if (json.files?.length > 0) {
49
- json.files = json.files.filter((file) => !['cssmodule.d.ts', 'image.d.ts'].includes(file));
50
- }
51
- return { ...json, compilerOptions };
52
- });
53
- }
54
- });
55
- }
56
- await (0, devkit_1.formatFiles)(tree);
57
- }
@@ -1,2 +0,0 @@
1
- import { type Tree } from '@nx/devkit';
2
- export default function (tree: Tree): Promise<void>;
@@ -1,53 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const devkit_1 = require("@nx/devkit");
5
- async function default_1(tree) {
6
- if (!hasModuleFederationProject(tree)) {
7
- return;
8
- }
9
- ensureTargetDefaultsContainProductionInputs(tree);
10
- await (0, devkit_1.formatFiles)(tree);
11
- }
12
- function ensureTargetDefaultsContainProductionInputs(tree) {
13
- const nxJson = (0, devkit_1.readNxJson)(tree);
14
- const webpackExecutor = '@nx/webpack:webpack';
15
- const mfEnvVar = 'NX_MF_DEV_SERVER_STATIC_REMOTES';
16
- nxJson.targetDefaults[webpackExecutor] ??= {};
17
- nxJson.targetDefaults[webpackExecutor].inputs ??= [
18
- 'production',
19
- '^production',
20
- { env: mfEnvVar },
21
- ];
22
- if (!nxJson.targetDefaults[webpackExecutor].inputs.includes('production')) {
23
- nxJson.targetDefaults[webpackExecutor].inputs.push('production');
24
- }
25
- if (!nxJson.targetDefaults[webpackExecutor].inputs.includes('^production')) {
26
- nxJson.targetDefaults[webpackExecutor].inputs.push('^production');
27
- }
28
- let mfEnvVarExists = false;
29
- for (const input of nxJson.targetDefaults[webpackExecutor].inputs) {
30
- if (typeof input === 'object' && input['env'] === mfEnvVar) {
31
- mfEnvVarExists = true;
32
- break;
33
- }
34
- }
35
- if (!mfEnvVarExists) {
36
- nxJson.targetDefaults[webpackExecutor].inputs.push({ env: mfEnvVar });
37
- }
38
- (0, devkit_1.updateNxJson)(tree, nxJson);
39
- }
40
- function hasModuleFederationProject(tree) {
41
- const projects = (0, devkit_1.getProjects)(tree);
42
- for (const project of projects.values()) {
43
- const targets = project.targets || {};
44
- for (const [_, target] of Object.entries(targets)) {
45
- if (target.executor === '@nx/webpack:webpack' &&
46
- (tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.ts')) ||
47
- tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.js')))) {
48
- return true;
49
- }
50
- }
51
- }
52
- return false;
53
- }
@@ -1,3 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- import { ModuleFederationConfig } from './models';
3
- export declare function loadModuleFederationConfigFromContext(context: ExecutorContext): ModuleFederationConfig;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadModuleFederationConfigFromContext = loadModuleFederationConfigFromContext;
4
- const path_1 = require("path");
5
- function loadModuleFederationConfigFromContext(context) {
6
- const p = context.projectsConfigurations.projects[context.projectName];
7
- const moduleFederationConfigPath = (0, path_1.join)(context.root, p.root, 'module-federation.config.js');
8
- try {
9
- return require(moduleFederationConfigPath);
10
- }
11
- catch {
12
- // TODO(jack): Add a link to guide
13
- throw new Error(`Could not load ${moduleFederationConfigPath}. Was this project generated with "@nx/react:host"?`);
14
- }
15
- }
@@ -1,24 +0,0 @@
1
- export type ModuleFederationLibrary = {
2
- type: string;
3
- name: string;
4
- };
5
- export type Remotes = string[] | [remoteName: string, remoteUrl: string][];
6
- export interface SharedLibraryConfig {
7
- singleton?: boolean;
8
- strictVersion?: boolean;
9
- requiredVersion?: false | string;
10
- eager?: boolean;
11
- }
12
- export type SharedFunction = (libraryName: string, sharedConfig: SharedLibraryConfig) => undefined | false | SharedLibraryConfig;
13
- export type AdditionalSharedConfig = Array<string | [libraryName: string, sharedConfig: SharedLibraryConfig] | {
14
- libraryName: string;
15
- sharedConfig: SharedLibraryConfig;
16
- }>;
17
- export interface ModuleFederationConfig {
18
- name: string;
19
- remotes?: Remotes;
20
- library?: ModuleFederationLibrary;
21
- exposes?: Record<string, string>;
22
- shared?: SharedFunction;
23
- additionalShared?: AdditionalSharedConfig;
24
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- export declare function readRootPackageJson(): {
2
- dependencies?: {
3
- [key: string]: string;
4
- };
5
- devDependencies?: {
6
- [key: string]: string;
7
- };
8
- };
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readRootPackageJson = readRootPackageJson;
4
- const devkit_1 = require("@nx/devkit");
5
- const fs_1 = require("fs");
6
- function readRootPackageJson() {
7
- const pkgJsonPath = (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, 'package.json');
8
- if (!(0, fs_1.existsSync)(pkgJsonPath)) {
9
- throw new Error('NX MFE: Could not find root package.json to determine dependency versions.');
10
- }
11
- return (0, devkit_1.readJsonFile)(pkgJsonPath);
12
- }
@@ -1,12 +0,0 @@
1
- import { ModuleFederationConfig } from '@nx/webpack/src/utils/module-federation';
2
- export declare function getFunctionDeterminateRemoteUrl(isServer?: boolean): (remote: string) => string;
3
- export declare function getModuleFederationConfig(mfConfig: ModuleFederationConfig, options?: {
4
- isServer: boolean;
5
- determineRemoteUrl?: (remote: string) => string;
6
- }): Promise<{
7
- sharedLibraries: import("@nx/webpack/src/utils/module-federation").SharedWorkspaceLibraryConfig;
8
- sharedDependencies: {
9
- [x: string]: import("@nx/webpack/src/utils/module-federation").SharedLibraryConfig;
10
- };
11
- mappedRemotes: {};
12
- }>;