@nx/react 24.0.0-beta.2 → 24.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/index.d.ts +0 -2
  2. package/dist/index.js +1 -5
  3. package/dist/internal.d.ts +1 -0
  4. package/dist/internal.js +3 -1
  5. package/dist/plugins/component-testing/index.js +92 -33
  6. package/dist/plugins/storybook/index.js +18 -18
  7. package/dist/plugins/with-react.d.ts +3 -7
  8. package/dist/plugins/with-react.js +5 -19
  9. package/dist/src/generators/application/application.js +1 -36
  10. package/dist/src/generators/application/files/base-rspack/rspack.config.js__tmpl__ +1 -24
  11. package/dist/src/generators/application/files/base-webpack/webpack.config.js__tmpl__ +1 -26
  12. package/dist/src/generators/application/lib/add-e2e.js +5 -6
  13. package/dist/src/generators/application/lib/add-linting.js +0 -1
  14. package/dist/src/generators/application/lib/add-project.js +0 -167
  15. package/dist/src/generators/application/lib/bundlers/add-rsbuild.js +0 -1
  16. package/dist/src/generators/application/lib/bundlers/add-vite.js +0 -2
  17. package/dist/src/generators/application/lib/bundlers/add-webpack.js +0 -1
  18. package/dist/src/generators/application/lib/create-application-files.d.ts +0 -1
  19. package/dist/src/generators/application/lib/create-application-files.js +2 -11
  20. package/dist/src/generators/application/lib/normalize-options.js +0 -4
  21. package/dist/src/generators/application/schema.d.ts +0 -2
  22. package/dist/src/generators/cypress-component-configuration/cypress-component-configuration.js +4 -16
  23. package/dist/src/generators/cypress-component-configuration/lib/add-files.d.ts +1 -2
  24. package/dist/src/generators/cypress-component-configuration/lib/add-files.js +4 -2
  25. package/dist/src/generators/cypress-component-configuration/schema.d.ts +0 -1
  26. package/dist/src/generators/init/init.js +3 -5
  27. package/dist/src/generators/init/schema.d.ts +0 -1
  28. package/dist/src/generators/library/lib/add-linting.js +0 -1
  29. package/dist/src/generators/library/lib/add-rollup-build-target.js +3 -47
  30. package/dist/src/generators/library/lib/normalize-options.js +0 -4
  31. package/dist/src/generators/library/library.js +1 -4
  32. package/dist/src/generators/library/schema.d.ts +0 -1
  33. package/dist/src/generators/stories/stories.js +0 -5
  34. package/dist/src/generators/storybook-configuration/configuration.js +1 -9
  35. package/dist/src/generators/storybook-configuration/schema.d.ts +0 -1
  36. package/dist/src/migrations/update-23-2-0/add-optional-module-federation-packages.js +2 -1
  37. package/dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.d.ts +4 -0
  38. package/dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.js +13 -0
  39. package/dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.md +40 -0
  40. package/dist/src/plugins/router-plugin.d.ts +0 -1
  41. package/dist/src/plugins/router-plugin.js +5 -42
  42. package/dist/src/utils/ast-utils.d.ts +0 -1
  43. package/dist/src/utils/ast-utils.js +0 -23
  44. package/dist/src/utils/ct-utils.d.ts +0 -7
  45. package/dist/src/utils/ct-utils.js +71 -55
  46. package/dist/src/utils/deprecation.d.ts +1 -1
  47. package/dist/src/utils/deprecation.js +3 -5
  48. package/dist/src/utils/framework.js +1 -3
  49. package/dist/src/utils/versions.d.ts +0 -7
  50. package/dist/src/utils/versions.js +2 -9
  51. package/executors.json +1 -17
  52. package/generators.json +0 -27
  53. package/migrations.json +6 -0
  54. package/package.json +17 -47
  55. package/dist/mf/dynamic-federation.d.ts +0 -69
  56. package/dist/mf/dynamic-federation.js +0 -141
  57. package/dist/mf/index.d.ts +0 -1
  58. package/dist/mf/index.js +0 -8
  59. package/dist/module-federation.d.ts +0 -5
  60. package/dist/module-federation.js +0 -20
  61. package/dist/src/executors/module-federation-dev-server/lib/index.d.ts +0 -2
  62. package/dist/src/executors/module-federation-dev-server/lib/index.js +0 -5
  63. package/dist/src/executors/module-federation-dev-server/lib/normalize-options.d.ts +0 -4
  64. package/dist/src/executors/module-federation-dev-server/lib/normalize-options.js +0 -19
  65. package/dist/src/executors/module-federation-dev-server/lib/start-remotes.d.ts +0 -5
  66. package/dist/src/executors/module-federation-dev-server/lib/start-remotes.js +0 -33
  67. package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +0 -6
  68. package/dist/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +0 -80
  69. package/dist/src/executors/module-federation-dev-server/schema.d.ts +0 -19
  70. package/dist/src/executors/module-federation-dev-server/schema.json +0 -142
  71. package/dist/src/executors/module-federation-ssr-dev-server/lib/index.d.ts +0 -2
  72. package/dist/src/executors/module-federation-ssr-dev-server/lib/index.js +0 -5
  73. package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.d.ts +0 -4
  74. package/dist/src/executors/module-federation-ssr-dev-server/lib/normalize-options.js +0 -23
  75. package/dist/src/executors/module-federation-ssr-dev-server/lib/start-remotes.d.ts +0 -5
  76. package/dist/src/executors/module-federation-ssr-dev-server/lib/start-remotes.js +0 -34
  77. package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +0 -3
  78. package/dist/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +0 -83
  79. package/dist/src/executors/module-federation-ssr-dev-server/schema.d.ts +0 -29
  80. package/dist/src/executors/module-federation-ssr-dev-server/schema.json +0 -81
  81. package/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts +0 -12
  82. package/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.js +0 -244
  83. package/dist/src/executors/module-federation-static-server/schema.d.ts +0 -3
  84. package/dist/src/executors/module-federation-static-server/schema.json +0 -16
  85. package/dist/src/generators/federate-module/federate-module.d.ts +0 -4
  86. package/dist/src/generators/federate-module/federate-module.js +0 -67
  87. package/dist/src/generators/federate-module/lib/utils.d.ts +0 -23
  88. package/dist/src/generators/federate-module/lib/utils.js +0 -99
  89. package/dist/src/generators/federate-module/schema.d.ts +0 -15
  90. package/dist/src/generators/federate-module/schema.json +0 -89
  91. package/dist/src/generators/host/files/common/src/app/__fileName__.js__tmpl__ +0 -40
  92. package/dist/src/generators/host/files/common/src/main.js__tmpl__ +0 -13
  93. package/dist/src/generators/host/files/common/tsconfig.lint.json__tmpl__ +0 -19
  94. package/dist/src/generators/host/files/common-ts/src/app/__fileName__.tsx__tmpl__ +0 -41
  95. package/dist/src/generators/host/files/common-ts/src/main.ts__tmpl__ +0 -13
  96. package/dist/src/generators/host/files/rspack-common/src/app/__fileName__.jsx__tmpl__ +0 -42
  97. package/dist/src/generators/host/files/rspack-common/src/main.jsx__tmpl__ +0 -13
  98. package/dist/src/generators/host/files/rspack-common/tsconfig.lint.json__tmpl__ +0 -19
  99. package/dist/src/generators/host/files/rspack-module-federation/module-federation.config.js__tmpl__ +0 -24
  100. package/dist/src/generators/host/files/rspack-module-federation/rspack.config.js__tmpl__ +0 -42
  101. package/dist/src/generators/host/files/rspack-module-federation/rspack.config.prod.js__tmpl__ +0 -66
  102. package/dist/src/generators/host/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -27
  103. package/dist/src/generators/host/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +0 -68
  104. package/dist/src/generators/host/files/rspack-module-federation-ssr/server.ts__tmpl__ +0 -28
  105. package/dist/src/generators/host/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +0 -49
  106. package/dist/src/generators/host/files/rspack-module-federation-ssr/tsconfig.server.json__tmpl__ +0 -17
  107. package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -22
  108. package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +0 -68
  109. package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +0 -28
  110. package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +0 -49
  111. package/dist/src/generators/host/files/rspack-module-federation-ssr-ts/tsconfig.server.json__tmpl__ +0 -17
  112. package/dist/src/generators/host/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -28
  113. package/dist/src/generators/host/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +0 -67
  114. package/dist/src/generators/host/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +0 -42
  115. package/dist/src/generators/host/files/webpack-module-federation/module-federation.config.js__tmpl__ +0 -24
  116. package/dist/src/generators/host/files/webpack-module-federation/webpack.config.js__tmpl__ +0 -17
  117. package/dist/src/generators/host/files/webpack-module-federation/webpack.config.prod.js__tmpl__ +0 -39
  118. package/dist/src/generators/host/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -19
  119. package/dist/src/generators/host/files/webpack-module-federation-ssr/server.ts__tmpl__ +0 -28
  120. package/dist/src/generators/host/files/webpack-module-federation-ssr/tsconfig.server.json__tmpl__ +0 -17
  121. package/dist/src/generators/host/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +0 -17
  122. package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -16
  123. package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/server.ts__tmpl__ +0 -28
  124. package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/tsconfig.server.json__tmpl__ +0 -17
  125. package/dist/src/generators/host/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +0 -17
  126. package/dist/src/generators/host/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -28
  127. package/dist/src/generators/host/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__ +0 -40
  128. package/dist/src/generators/host/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +0 -18
  129. package/dist/src/generators/host/host.d.ts +0 -4
  130. package/dist/src/generators/host/host.js +0 -174
  131. package/dist/src/generators/host/lib/add-module-federation-files.d.ts +0 -6
  132. package/dist/src/generators/host/lib/add-module-federation-files.js +0 -92
  133. package/dist/src/generators/host/lib/normalize-host-name.d.ts +0 -2
  134. package/dist/src/generators/host/lib/normalize-host-name.js +0 -12
  135. package/dist/src/generators/host/lib/setup-ssr-for-host.d.ts +0 -6
  136. package/dist/src/generators/host/lib/setup-ssr-for-host.js +0 -59
  137. package/dist/src/generators/host/lib/update-module-federation-e2e-project.d.ts +0 -3
  138. package/dist/src/generators/host/lib/update-module-federation-e2e-project.js +0 -19
  139. package/dist/src/generators/host/lib/update-module-federation-tsconfig.d.ts +0 -3
  140. package/dist/src/generators/host/lib/update-module-federation-tsconfig.js +0 -34
  141. package/dist/src/generators/host/schema.d.ts +0 -44
  142. package/dist/src/generators/host/schema.json +0 -173
  143. package/dist/src/generators/remote/files/common/src/main.js__tmpl__ +0 -1
  144. package/dist/src/generators/remote/files/common/src/remote-entry.js__tmpl__ +0 -1
  145. package/dist/src/generators/remote/files/common-ts/src/main.ts__tmpl__ +0 -1
  146. package/dist/src/generators/remote/files/common-ts/src/remote-entry.ts__tmpl__ +0 -1
  147. package/dist/src/generators/remote/files/rspack-common/src/main.jsx__tmpl__ +0 -1
  148. package/dist/src/generators/remote/files/rspack-common/src/remote-entry.js__tmpl__ +0 -1
  149. package/dist/src/generators/remote/files/rspack-module-federation/module-federation.config.js__tmpl__ +0 -12
  150. package/dist/src/generators/remote/files/rspack-module-federation/rspack.config.js__tmpl__ +0 -45
  151. package/dist/src/generators/remote/files/rspack-module-federation/rspack.config.prod.js__tmpl__ +0 -1
  152. package/dist/src/generators/remote/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -15
  153. package/dist/src/generators/remote/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +0 -71
  154. package/dist/src/generators/remote/files/rspack-module-federation-ssr/server.ts__tmpl__ +0 -45
  155. package/dist/src/generators/remote/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +0 -45
  156. package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -19
  157. package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +0 -71
  158. package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +0 -45
  159. package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +0 -45
  160. package/dist/src/generators/remote/files/rspack-module-federation-ssr-ts/tsconfig.lint.json__tmpl__ +0 -19
  161. package/dist/src/generators/remote/files/rspack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -16
  162. package/dist/src/generators/remote/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +0 -1
  163. package/dist/src/generators/remote/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +0 -45
  164. package/dist/src/generators/remote/files/rspack-module-federation-ts/tsconfig.lint.json__tmpl__ +0 -19
  165. package/dist/src/generators/remote/files/webpack-module-federation/module-federation.config.js__tmpl__ +0 -12
  166. package/dist/src/generators/remote/files/webpack-module-federation/webpack.config.js__tmpl__ +0 -17
  167. package/dist/src/generators/remote/files/webpack-module-federation/webpack.config.prod.js__tmpl__ +0 -1
  168. package/dist/src/generators/remote/files/webpack-module-federation-ssr/module-federation.server.config.js__tmpl__ +0 -9
  169. package/dist/src/generators/remote/files/webpack-module-federation-ssr/server.ts__tmpl__ +0 -45
  170. package/dist/src/generators/remote/files/webpack-module-federation-ssr/webpack.server.config.js__tmpl__ +0 -17
  171. package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +0 -13
  172. package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/server.ts__tmpl__ +0 -45
  173. package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/tsconfig.lint.json__tmpl__ +0 -19
  174. package/dist/src/generators/remote/files/webpack-module-federation-ssr-ts/webpack.server.config.ts__tmpl__ +0 -17
  175. package/dist/src/generators/remote/files/webpack-module-federation-ts/module-federation.config.ts__tmpl__ +0 -16
  176. package/dist/src/generators/remote/files/webpack-module-federation-ts/tsconfig.lint.json__tmpl__ +0 -19
  177. package/dist/src/generators/remote/files/webpack-module-federation-ts/webpack.config.prod.ts__tmpl__ +0 -1
  178. package/dist/src/generators/remote/files/webpack-module-federation-ts/webpack.config.ts__tmpl__ +0 -17
  179. package/dist/src/generators/remote/lib/add-remote-to-dynamic-host.d.ts +0 -2
  180. package/dist/src/generators/remote/lib/add-remote-to-dynamic-host.js +0 -12
  181. package/dist/src/generators/remote/lib/setup-package-json-exports-for-remote.d.ts +0 -3
  182. package/dist/src/generators/remote/lib/setup-package-json-exports-for-remote.js +0 -30
  183. package/dist/src/generators/remote/lib/setup-ssr-for-remote.d.ts +0 -4
  184. package/dist/src/generators/remote/lib/setup-ssr-for-remote.js +0 -61
  185. package/dist/src/generators/remote/lib/setup-tspath-for-remote.d.ts +0 -3
  186. package/dist/src/generators/remote/lib/setup-tspath-for-remote.js +0 -14
  187. package/dist/src/generators/remote/lib/update-host-with-remote.d.ts +0 -2
  188. package/dist/src/generators/remote/lib/update-host-with-remote.js +0 -79
  189. package/dist/src/generators/remote/remote.d.ts +0 -6
  190. package/dist/src/generators/remote/remote.js +0 -201
  191. package/dist/src/generators/remote/schema.d.ts +0 -39
  192. package/dist/src/generators/remote/schema.json +0 -173
  193. package/dist/src/generators/setup-ssr/files/server.ts__tmpl__ +0 -28
  194. package/dist/src/generators/setup-ssr/files/src/main.server.tsx__tmpl__ +0 -47
  195. package/dist/src/generators/setup-ssr/files/tsconfig.server.json__tmpl__ +0 -17
  196. package/dist/src/generators/setup-ssr/schema.d.ts +0 -8
  197. package/dist/src/generators/setup-ssr/schema.json +0 -54
  198. package/dist/src/generators/setup-ssr/setup-ssr.d.ts +0 -4
  199. package/dist/src/generators/setup-ssr/setup-ssr.js +0 -198
  200. package/dist/src/module-federation/ast-utils.d.ts +0 -8
  201. package/dist/src/module-federation/ast-utils.js +0 -101
  202. package/dist/src/rules/update-module-federation-project.d.ts +0 -11
  203. package/dist/src/rules/update-module-federation-project.js +0 -72
  204. package/dist/src/utils/add-mf-env-to-inputs.d.ts +0 -2
  205. package/dist/src/utils/add-mf-env-to-inputs.js +0 -29
  206. package/dist/src/utils/module-federation-deprecation.d.ts +0 -12
  207. package/dist/src/utils/module-federation-deprecation.js +0 -46
  208. package/dist/src/utils/normalize-remote.d.ts +0 -8
  209. package/dist/src/utils/normalize-remote.js +0 -31
@@ -1,142 +0,0 @@
1
- {
2
- "version": 2,
3
- "continuous": true,
4
- "outputCapture": "direct-nodejs",
5
- "title": "Module Federation Dev Server",
6
- "x-deprecated": "The `@nx/react:module-federation-dev-server` executor is deprecated. Dynamic federation in `@nx/react:consumer` removes the need for host-orchestrated remote serving. Removed in Nx v24.",
7
- "description": "Serve a web application.",
8
- "cli": "nx",
9
- "type": "object",
10
- "properties": {
11
- "devRemotes": {
12
- "type": "array",
13
- "items": {
14
- "oneOf": [
15
- {
16
- "type": "string"
17
- },
18
- {
19
- "type": "object",
20
- "properties": {
21
- "remoteName": {
22
- "type": "string"
23
- },
24
- "configuration": {
25
- "type": "string"
26
- }
27
- },
28
- "required": ["remoteName"],
29
- "additionalProperties": false
30
- }
31
- ]
32
- },
33
- "description": "List of Producer (remote) applications to run in development mode (i.e. using serve target).",
34
- "x-priority": "important",
35
- "alias": "devProducers"
36
- },
37
- "skipRemotes": {
38
- "type": "array",
39
- "items": {
40
- "type": "string"
41
- },
42
- "description": "List of Producer (remote) applications to not automatically serve, either statically or in development mode. This will not remove the Producers (remotes) from the `module-federation.config` file, and therefore the application may still try to fetch these Producers (remotes).\nThis option is useful if you have other means for serving the Producer (remote) application(s).\n**NOTE:** Producers (remotes) that are not in the workspace will be skipped automatically.",
43
- "x-priority": "important",
44
- "alias": "skipProducers"
45
- },
46
- "buildTarget": {
47
- "type": "string",
48
- "description": "Target which builds the application.",
49
- "x-priority": "important"
50
- },
51
- "port": {
52
- "type": "number",
53
- "description": "Port to listen on.",
54
- "default": 4200,
55
- "x-priority": "important"
56
- },
57
- "host": {
58
- "type": "string",
59
- "description": "Host to listen on.",
60
- "default": "localhost"
61
- },
62
- "ssl": {
63
- "type": "boolean",
64
- "description": "Serve using `HTTPS`.",
65
- "default": false
66
- },
67
- "sslKey": {
68
- "type": "string",
69
- "description": "SSL key to use for serving `HTTPS`."
70
- },
71
- "sslCert": {
72
- "type": "string",
73
- "description": "SSL certificate to use for serving `HTTPS`."
74
- },
75
- "watch": {
76
- "type": "boolean",
77
- "description": "Watches for changes and rebuilds application.",
78
- "default": true
79
- },
80
- "liveReload": {
81
- "type": "boolean",
82
- "description": "Whether to reload the page on change, using live-reload.",
83
- "default": true
84
- },
85
- "hmr": {
86
- "type": "boolean",
87
- "description": "Enable hot module replacement.",
88
- "default": false
89
- },
90
- "publicHost": {
91
- "type": "string",
92
- "description": "Public URL where the application will be served."
93
- },
94
- "open": {
95
- "type": "boolean",
96
- "description": "Open the application in the browser.",
97
- "default": false,
98
- "x-priority": "important"
99
- },
100
- "allowedHosts": {
101
- "type": "string",
102
- "description": "This option allows you to whitelist services that are allowed to access the dev server."
103
- },
104
- "memoryLimit": {
105
- "type": "number",
106
- "description": "Memory limit for type checking service process in `MB`."
107
- },
108
- "maxWorkers": {
109
- "type": "number",
110
- "description": "Number of workers to use for type checking."
111
- },
112
- "baseHref": {
113
- "type": "string",
114
- "description": "Base url for the application being built."
115
- },
116
- "static": {
117
- "type": "boolean",
118
- "description": "Whether to use a static file server instead of the webpack-dev-server. This should be used for Producer (remote) applications that are also Consumer (host) applications."
119
- },
120
- "isInitialHost": {
121
- "type": "boolean",
122
- "description": "Whether the Consumer (host) that is running this executor is the first in the project tree to do so.",
123
- "default": true,
124
- "x-priority": "internal",
125
- "alias": "isInitialConsumer"
126
- },
127
- "parallel": {
128
- "type": "number",
129
- "description": "Max number of parallel processes for building static Producers (remotes)"
130
- },
131
- "staticRemotesPort": {
132
- "type": "number",
133
- "description": "The port at which to serve the file-server for the static Producers (remotes).",
134
- "alias": "staticProducersPort"
135
- },
136
- "pathToManifestFile": {
137
- "type": "string",
138
- "description": "Path to a Module Federation manifest file (e.g. `my/path/to/module-federation.manifest.json`) containing the dynamic Producer (remote) applications relative to the workspace root."
139
- }
140
- },
141
- "examplesFile": "../../../docs/module-federation-dev-server-examples.md"
142
- }
@@ -1,2 +0,0 @@
1
- export * from './normalize-options';
2
- export * from './start-remotes';
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./normalize-options"), exports);
5
- tslib_1.__exportStar(require("./start-remotes"), exports);
@@ -1,4 +0,0 @@
1
- import { ModuleFederationSsrDevServerOptions, NormalizedModuleFederationSsrDevServerOptions } from '../schema';
2
- import { ExecutorContext } from '@nx/devkit';
3
- export declare function normalizeOptions(options: ModuleFederationSsrDevServerOptions): NormalizedModuleFederationSsrDevServerOptions;
4
- export declare function getBuildOptions(buildTarget: string, context: ExecutorContext): any;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizeOptions = normalizeOptions;
4
- exports.getBuildOptions = getBuildOptions;
5
- const path_1 = require("path");
6
- const devkit_1 = require("@nx/devkit");
7
- function normalizeOptions(options) {
8
- return {
9
- ...options,
10
- devRemotes: options.devRemotes ?? [],
11
- verbose: options.verbose ?? false,
12
- ssl: options.ssl ?? false,
13
- sslCert: options.sslCert ? (0, path_1.join)(devkit_1.workspaceRoot, options.sslCert) : undefined,
14
- sslKey: options.sslKey ? (0, path_1.join)(devkit_1.workspaceRoot, options.sslKey) : undefined,
15
- };
16
- }
17
- function getBuildOptions(buildTarget, context) {
18
- const target = (0, devkit_1.parseTargetString)(buildTarget, context);
19
- const buildOptions = (0, devkit_1.readTargetOptions)(target, context);
20
- return {
21
- ...buildOptions,
22
- };
23
- }
@@ -1,5 +0,0 @@
1
- import { ModuleFederationSsrDevServerOptions } from '../schema';
2
- import { ExecutorContext, ProjectConfiguration } from '@nx/devkit';
3
- export declare function startRemotes(remotes: string[], workspaceProjects: Record<string, ProjectConfiguration>, options: Partial<Pick<ModuleFederationSsrDevServerOptions, 'devRemotes' | 'host' | 'ssl' | 'sslCert' | 'sslKey' | 'verbose'>>, context: ExecutorContext): Promise<AsyncIterable<{
4
- success: boolean;
5
- }>[]>;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.startRemotes = startRemotes;
4
- const devkit_1 = require("@nx/devkit");
5
- async function startRemotes(remotes, workspaceProjects, options, context) {
6
- const remoteIters = [];
7
- const target = 'serve';
8
- for (const app of remotes) {
9
- const remoteProjectServeTarget = workspaceProjects[app].targets[target];
10
- const isUsingModuleFederationSsrDevServerExecutor = remoteProjectServeTarget.executor.includes('module-federation-ssr-dev-server');
11
- const configurationOverride = options.devRemotes?.find((remote) => typeof remote !== 'string' && remote.remoteName === app)?.configuration;
12
- {
13
- const defaultOverrides = {
14
- ...(options.host ? { host: options.host } : {}),
15
- ...(options.ssl ? { ssl: options.ssl } : {}),
16
- ...(options.sslCert ? { sslCert: options.sslCert } : {}),
17
- ...(options.sslKey ? { sslKey: options.sslKey } : {}),
18
- };
19
- const overrides = {
20
- watch: true,
21
- ...defaultOverrides,
22
- ...(isUsingModuleFederationSsrDevServerExecutor
23
- ? { isInitialHost: false }
24
- : {}),
25
- };
26
- remoteIters.push(await (0, devkit_1.runExecutor)({
27
- project: app,
28
- target,
29
- configuration: configurationOverride ?? context.configurationName,
30
- }, overrides, context));
31
- }
32
- }
33
- return remoteIters;
34
- }
@@ -1,3 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- import { ModuleFederationSsrDevServerOptions } from './schema';
3
- export default function moduleFederationSsrDevServer(ssrDevServerOptions: ModuleFederationSsrDevServerOptions, context: ExecutorContext): AsyncGenerator<any, any, any>;
@@ -1,83 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = moduleFederationSsrDevServer;
4
- const devkit_1 = require("@nx/devkit");
5
- const internal_1 = require("@nx/devkit/internal");
6
- const internal_2 = require("@nx/js/internal");
7
- const internal_3 = require("@nx/web/internal");
8
- const fs_1 = require("fs");
9
- const path_1 = require("path");
10
- const lib_1 = require("./lib");
11
- const assert_package_1 = require("../../utils/assert-package");
12
- const module_federation_deprecation_1 = require("../../utils/module-federation-deprecation");
13
- const executorName = '@nx/react:module-federation-ssr-dev-server';
14
- async function* moduleFederationSsrDevServer(ssrDevServerOptions, context) {
15
- (0, assert_package_1.assertPackageIsInstalled)('@nx/module-federation', executorName);
16
- (0, assert_package_1.assertPackageIsInstalled)('@nx/webpack', executorName);
17
- const { startRemoteIterators } = await import('@nx/module-federation/internal');
18
- const { ssrDevServerExecutor } = await import('@nx/webpack/internal');
19
- (0, module_federation_deprecation_1.warnReactMfSsrDevServerExecutorDeprecation)();
20
- const options = (0, lib_1.normalizeOptions)(ssrDevServerOptions);
21
- // TODO(JamesHenry): remove type assertion once the nx repo is updated to use https://github.com/nrwl/nx/pull/33095
22
- let iter = ssrDevServerExecutor(options, context);
23
- const projectConfig = context.projectsConfigurations.projects[context.projectName];
24
- let pathToManifestFile = (0, path_1.join)(context.root, (0, internal_2.getProjectSourceRoot)(projectConfig), 'assets/module-federation.manifest.json');
25
- if (options.pathToManifestFile) {
26
- const userPathToManifestFile = (0, path_1.join)(context.root, options.pathToManifestFile);
27
- if (!(0, fs_1.existsSync)(userPathToManifestFile)) {
28
- throw new Error(`The provided Module Federation manifest file path does not exist. Please check the file exists at "${userPathToManifestFile}".`);
29
- }
30
- else if ((0, path_1.extname)(userPathToManifestFile) !== '.json') {
31
- throw new Error(`The Module Federation manifest file must be a JSON. Please ensure the file at ${userPathToManifestFile} is a JSON.`);
32
- }
33
- pathToManifestFile = userPathToManifestFile;
34
- }
35
- if (!options.isInitialHost) {
36
- return yield* iter;
37
- }
38
- const { staticRemotesIter, devRemoteIters, remotes } = await startRemoteIterators(options, context, lib_1.startRemotes, pathToManifestFile, 'react', true);
39
- const combined = (0, internal_1.combineAsyncIterables)(staticRemotesIter, ...devRemoteIters);
40
- let refs = 1 + (devRemoteIters?.length ?? 0);
41
- for await (const result of combined) {
42
- if (result.success === false)
43
- throw new Error('Remotes failed to start');
44
- if (result.success)
45
- refs--;
46
- if (refs === 0)
47
- break;
48
- }
49
- return yield* (0, internal_1.combineAsyncIterables)(iter, (0, internal_1.createAsyncIterable)(async ({ next, done }) => {
50
- const host = options.host ?? 'localhost';
51
- const baseUrl = `http${options.ssl ? 's' : ''}://${host}:${options.port}`;
52
- if (!options.isInitialHost) {
53
- next({ success: true, baseUrl });
54
- done();
55
- return;
56
- }
57
- if (remotes.remotePorts.length === 0) {
58
- next({ success: true, baseUrl });
59
- done();
60
- return;
61
- }
62
- try {
63
- const portsToWaitFor = staticRemotesIter && options.staticRemotesPort
64
- ? [options.staticRemotesPort, ...remotes.remotePorts]
65
- : [...remotes.remotePorts];
66
- await Promise.all(portsToWaitFor.map((port) => (0, internal_3.waitForPortOpen)(port, {
67
- retries: 480,
68
- retryDelay: 2500,
69
- host,
70
- })));
71
- devkit_1.logger.info(`Nx all ssr remotes have started, server ready at ${baseUrl}`);
72
- next({ success: true, baseUrl });
73
- }
74
- catch (error) {
75
- throw new Error(`Nx failed to start ssr remotes. Check above for errors.`, {
76
- cause: error,
77
- });
78
- }
79
- finally {
80
- done();
81
- }
82
- }));
83
- }
@@ -1,29 +0,0 @@
1
- import { WebSsrDevServerOptions } from '@nx/webpack/internal';
2
- import { DevRemoteDefinition } from '@nx/module-federation/internal';
3
-
4
- export type ModuleFederationSsrDevServerOptions = WebSsrDevServerOptions & {
5
- devRemotes?: (
6
- | string
7
- | {
8
- remoteName: string;
9
- configuration: string;
10
- }
11
- )[];
12
-
13
- skipRemotes?: string[];
14
- host: string;
15
- pathToManifestFile?: string;
16
- staticRemotesPort?: number;
17
- parallel?: number;
18
- ssl?: boolean;
19
- sslKey?: string;
20
- sslCert?: string;
21
- isInitialHost?: boolean;
22
- verbose?: boolean;
23
- };
24
-
25
- export type NormalizedModuleFederationSsrDevServerOptions =
26
- ModuleFederationSsrDevServerOptions & {
27
- devRemotes: DevRemoteDefinition[];
28
- verbose: boolean;
29
- };
@@ -1,81 +0,0 @@
1
- {
2
- "version": 2,
3
- "continuous": true,
4
- "outputCapture": "direct-nodejs",
5
- "title": "Module Federation SSR Dev Server",
6
- "x-deprecated": "The `@nx/react:module-federation-ssr-dev-server` executor is deprecated. SSR is not first-classed in the new `@nx/react:consumer`/`@nx/react:provider` generators. Removed in Nx v24.",
7
- "description": "Serve a SSR Consumer (host) application along with its known Producers (remotes).",
8
- "cli": "nx",
9
- "type": "object",
10
- "properties": {
11
- "browserTarget": {
12
- "type": "string",
13
- "description": "Target which builds the browser application.",
14
- "x-priority": "important"
15
- },
16
- "serverTarget": {
17
- "type": "string",
18
- "description": "Target which builds the server application.",
19
- "x-priority": "important"
20
- },
21
- "port": {
22
- "type": "number",
23
- "description": "The port to be set on `process.env.PORT` for use in the server.",
24
- "default": 4200,
25
- "x-priority": "important"
26
- },
27
- "devRemotes": {
28
- "type": "array",
29
- "items": {
30
- "type": "string"
31
- },
32
- "description": "List of Producer (remote) applications to run in development mode (i.e. using serve target).",
33
- "x-priority": "important",
34
- "alias": "devProducers"
35
- },
36
- "skipRemotes": {
37
- "type": "array",
38
- "items": {
39
- "type": "string"
40
- },
41
- "description": "List of Producer (remote) applications to not automatically serve, either statically or in development mode.",
42
- "x-priority": "important",
43
- "alias": "skipProducers"
44
- },
45
- "host": {
46
- "type": "string",
47
- "description": "Host to listen on.",
48
- "default": "localhost"
49
- },
50
- "staticRemotesPort": {
51
- "type": "number",
52
- "description": "The port at which to serve the file-server for the static Producers (remotes).",
53
- "alias": "staticProducersPort"
54
- },
55
- "pathToManifestFile": {
56
- "type": "string",
57
- "description": "Path to a Module Federation manifest file (e.g. `my/path/to/module-federation.manifest.json`) containing the dynamic Producer (remote) applications relative to the workspace root."
58
- },
59
- "ssl": {
60
- "type": "boolean",
61
- "description": "Serve using HTTPS.",
62
- "default": false
63
- },
64
- "sslKey": {
65
- "type": "string",
66
- "description": "SSL key to use for serving HTTPS."
67
- },
68
- "sslCert": {
69
- "type": "string",
70
- "description": "SSL certificate to use for serving HTTPS."
71
- },
72
- "isInitialHost": {
73
- "type": "boolean",
74
- "description": "Whether the Consumer (host) that is running this executor is the first in the project tree to do so.",
75
- "default": true,
76
- "x-priority": "internal",
77
- "alias": "isInitialConsumer"
78
- }
79
- },
80
- "required": ["browserTarget", "serverTarget"]
81
- }
@@ -1,12 +0,0 @@
1
- import { ExecutorContext } from '@nx/devkit';
2
- import type { StaticRemotesConfig } from '@nx/module-federation/internal';
3
- import { ModuleFederationDevServerOptions } from '../module-federation-dev-server/schema';
4
- import { ModuleFederationStaticServerSchema } from './schema';
5
- export declare function startProxies(staticRemotesConfig: StaticRemotesConfig, hostServeOptions: ModuleFederationDevServerOptions, mappedLocationOfHost: string, mappedLocationsOfRemotes: Record<string, string>, sslOptions?: {
6
- pathToCert: string;
7
- pathToKey: string;
8
- }): void;
9
- export default function moduleFederationStaticServer(schema: ModuleFederationStaticServerSchema, context: ExecutorContext): AsyncGenerator<{
10
- success: boolean;
11
- baseUrl: string;
12
- }, any, any>;