every-plugin 2.10.0 → 3.0.0-rc.0

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 (462) hide show
  1. package/bin/every-plugin-serve.mjs +12 -0
  2. package/bin/every-plugin.mjs +59 -0
  3. package/dist/_virtual/_rolldown/runtime.cjs +1 -2
  4. package/dist/build/artifact-names.cjs +119 -0
  5. package/dist/build/artifact-names.cjs.map +1 -0
  6. package/dist/build/artifact-names.d.cts +68 -0
  7. package/dist/build/artifact-names.d.cts.map +1 -0
  8. package/dist/build/artifact-names.d.mts +68 -0
  9. package/dist/build/artifact-names.d.mts.map +1 -0
  10. package/dist/build/artifact-names.mjs +102 -0
  11. package/dist/build/artifact-names.mjs.map +1 -0
  12. package/dist/build/contract-types.cjs +89 -0
  13. package/dist/build/contract-types.cjs.map +1 -0
  14. package/dist/build/contract-types.mjs +81 -0
  15. package/dist/build/contract-types.mjs.map +1 -0
  16. package/dist/build/rspack/build-report-plugin.cjs +37 -0
  17. package/dist/build/rspack/build-report-plugin.cjs.map +1 -0
  18. package/dist/build/rspack/build-report-plugin.d.cts +18 -0
  19. package/dist/build/rspack/build-report-plugin.d.cts.map +1 -0
  20. package/dist/build/rspack/build-report-plugin.d.mts +18 -0
  21. package/dist/build/rspack/build-report-plugin.d.mts.map +1 -0
  22. package/dist/build/rspack/build-report-plugin.mjs +37 -0
  23. package/dist/build/rspack/build-report-plugin.mjs.map +1 -0
  24. package/dist/build/rspack/chunk-completeness-plugin.cjs +47 -0
  25. package/dist/build/rspack/chunk-completeness-plugin.cjs.map +1 -0
  26. package/dist/build/rspack/chunk-completeness-plugin.mjs +47 -0
  27. package/dist/build/rspack/chunk-completeness-plugin.mjs.map +1 -0
  28. package/dist/build/rspack/compose.cjs +69 -0
  29. package/dist/build/rspack/compose.cjs.map +1 -0
  30. package/dist/build/rspack/compose.d.cts +20 -0
  31. package/dist/build/rspack/compose.d.cts.map +1 -0
  32. package/dist/build/rspack/compose.d.mts +20 -0
  33. package/dist/build/rspack/compose.d.mts.map +1 -0
  34. package/dist/build/rspack/compose.mjs +65 -0
  35. package/dist/build/rspack/compose.mjs.map +1 -0
  36. package/dist/build/rspack/fix-mf-data-uri-plugin.cjs +11 -11
  37. package/dist/build/rspack/fix-mf-data-uri-plugin.cjs.map +1 -1
  38. package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts +2 -0
  39. package/dist/build/rspack/fix-mf-data-uri-plugin.d.cts.map +1 -1
  40. package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts +2 -0
  41. package/dist/build/rspack/fix-mf-data-uri-plugin.d.mts.map +1 -1
  42. package/dist/build/rspack/fix-mf-data-uri-plugin.mjs +11 -10
  43. package/dist/build/rspack/fix-mf-data-uri-plugin.mjs.map +1 -1
  44. package/dist/build/rspack/generated-config.cjs +35 -0
  45. package/dist/build/rspack/generated-config.cjs.map +1 -0
  46. package/dist/build/rspack/generated-config.mjs +32 -0
  47. package/dist/build/rspack/generated-config.mjs.map +1 -0
  48. package/dist/build/rspack/index.cjs +8 -5
  49. package/dist/build/rspack/index.d.cts +5 -3
  50. package/dist/build/rspack/index.d.mts +5 -3
  51. package/dist/build/rspack/index.mjs +5 -3
  52. package/dist/build/rspack/module-federation.cjs +2 -2
  53. package/dist/build/rspack/module-federation.cjs.map +1 -1
  54. package/dist/build/rspack/module-federation.mjs +1 -1
  55. package/dist/build/rspack/module-federation.mjs.map +1 -1
  56. package/dist/build/rspack/plugin.cjs +44 -69
  57. package/dist/build/rspack/plugin.cjs.map +1 -1
  58. package/dist/build/rspack/plugin.d.cts +4 -13
  59. package/dist/build/rspack/plugin.d.cts.map +1 -1
  60. package/dist/build/rspack/plugin.d.mts +4 -13
  61. package/dist/build/rspack/plugin.d.mts.map +1 -1
  62. package/dist/build/rspack/plugin.mjs +44 -69
  63. package/dist/build/rspack/plugin.mjs.map +1 -1
  64. package/dist/build/rspack/utils.cjs +7 -5
  65. package/dist/build/rspack/utils.cjs.map +1 -1
  66. package/dist/build/rspack/utils.mjs +7 -6
  67. package/dist/build/rspack/utils.mjs.map +1 -1
  68. package/dist/build/ui/factory.cjs +88 -0
  69. package/dist/build/ui/factory.cjs.map +1 -0
  70. package/dist/build/ui/factory.d.cts +11 -0
  71. package/dist/build/ui/factory.d.cts.map +1 -0
  72. package/dist/build/ui/factory.d.mts +11 -0
  73. package/dist/build/ui/factory.d.mts.map +1 -0
  74. package/dist/build/ui/factory.mjs +80 -0
  75. package/dist/build/ui/factory.mjs.map +1 -0
  76. package/dist/build/ui/generated-config.cjs +118 -0
  77. package/dist/build/ui/generated-config.cjs.map +1 -0
  78. package/dist/build/ui/generated-config.d.cts +33 -0
  79. package/dist/build/ui/generated-config.d.cts.map +1 -0
  80. package/dist/build/ui/generated-config.d.mts +33 -0
  81. package/dist/build/ui/generated-config.d.mts.map +1 -0
  82. package/dist/build/ui/generated-config.mjs +111 -0
  83. package/dist/build/ui/generated-config.mjs.map +1 -0
  84. package/dist/build/ui/hash-artifacts-plugin.cjs +61 -0
  85. package/dist/build/ui/hash-artifacts-plugin.cjs.map +1 -0
  86. package/dist/build/ui/hash-artifacts-plugin.d.cts +20 -0
  87. package/dist/build/ui/hash-artifacts-plugin.d.cts.map +1 -0
  88. package/dist/build/ui/hash-artifacts-plugin.d.mts +20 -0
  89. package/dist/build/ui/hash-artifacts-plugin.d.mts.map +1 -0
  90. package/dist/build/ui/hash-artifacts-plugin.mjs +58 -0
  91. package/dist/build/ui/hash-artifacts-plugin.mjs.map +1 -0
  92. package/dist/build/ui/index.cjs +90 -0
  93. package/dist/build/ui/index.cjs.map +1 -0
  94. package/dist/build/ui/index.d.cts +29 -0
  95. package/dist/build/ui/index.d.cts.map +1 -0
  96. package/dist/build/ui/index.d.mts +29 -0
  97. package/dist/build/ui/index.d.mts.map +1 -0
  98. package/dist/build/ui/index.mjs +68 -0
  99. package/dist/build/ui/index.mjs.map +1 -0
  100. package/dist/build/ui/manifest-plugin.cjs +37 -0
  101. package/dist/build/ui/manifest-plugin.cjs.map +1 -0
  102. package/dist/build/ui/manifest-plugin.d.cts +19 -0
  103. package/dist/build/ui/manifest-plugin.d.cts.map +1 -0
  104. package/dist/build/ui/manifest-plugin.d.mts +19 -0
  105. package/dist/build/ui/manifest-plugin.d.mts.map +1 -0
  106. package/dist/build/ui/manifest-plugin.mjs +37 -0
  107. package/dist/build/ui/manifest-plugin.mjs.map +1 -0
  108. package/dist/build/ui/rsbuild-config.cjs +203 -0
  109. package/dist/build/ui/rsbuild-config.cjs.map +1 -0
  110. package/dist/build/ui/rsbuild-config.d.cts +45 -0
  111. package/dist/build/ui/rsbuild-config.d.cts.map +1 -0
  112. package/dist/build/ui/rsbuild-config.d.mts +45 -0
  113. package/dist/build/ui/rsbuild-config.d.mts.map +1 -0
  114. package/dist/build/ui/rsbuild-config.mjs +200 -0
  115. package/dist/build/ui/rsbuild-config.mjs.map +1 -0
  116. package/dist/build/ui/stubs.cjs +107 -0
  117. package/dist/build/ui/stubs.cjs.map +1 -0
  118. package/dist/build/ui/stubs.d.cts +25 -0
  119. package/dist/build/ui/stubs.d.cts.map +1 -0
  120. package/dist/build/ui/stubs.d.mts +25 -0
  121. package/dist/build/ui/stubs.d.mts.map +1 -0
  122. package/dist/build/ui/stubs.mjs +106 -0
  123. package/dist/build/ui/stubs.mjs.map +1 -0
  124. package/dist/cli.cjs +83 -0
  125. package/dist/cli.cjs.map +1 -0
  126. package/dist/cli.d.cts +6 -0
  127. package/dist/cli.d.cts.map +1 -0
  128. package/dist/cli.d.mts +6 -0
  129. package/dist/cli.d.mts.map +1 -0
  130. package/dist/cli.mjs +82 -0
  131. package/dist/cli.mjs.map +1 -0
  132. package/dist/dev/serve.cjs +390 -0
  133. package/dist/dev/serve.cjs.map +1 -0
  134. package/dist/dev/serve.d.cts +23 -0
  135. package/dist/dev/serve.d.cts.map +1 -0
  136. package/dist/dev/serve.d.mts +23 -0
  137. package/dist/dev/serve.d.mts.map +1 -0
  138. package/dist/dev/serve.mjs +384 -0
  139. package/dist/dev/serve.mjs.map +1 -0
  140. package/dist/dev/watch-kill.cjs +39 -0
  141. package/dist/dev/watch-kill.cjs.map +1 -0
  142. package/dist/dev/watch-kill.mjs +38 -0
  143. package/dist/dev/watch-kill.mjs.map +1 -0
  144. package/dist/effect-helpers.cjs +23 -0
  145. package/dist/effect-helpers.cjs.map +1 -0
  146. package/dist/effect-helpers.d.cts +20 -0
  147. package/dist/effect-helpers.d.cts.map +1 -0
  148. package/dist/effect-helpers.d.mts +20 -0
  149. package/dist/effect-helpers.d.mts.map +1 -0
  150. package/dist/effect-helpers.mjs +22 -0
  151. package/dist/effect-helpers.mjs.map +1 -0
  152. package/dist/errors.cjs +49 -69
  153. package/dist/errors.cjs.map +1 -1
  154. package/dist/errors.d.cts +13 -96
  155. package/dist/errors.d.cts.map +1 -1
  156. package/dist/errors.d.mts +13 -96
  157. package/dist/errors.d.mts.map +1 -1
  158. package/dist/errors.mjs +16 -34
  159. package/dist/errors.mjs.map +1 -1
  160. package/dist/identity.cjs +19 -0
  161. package/dist/identity.cjs.map +1 -0
  162. package/dist/identity.d.cts +33 -0
  163. package/dist/identity.d.cts.map +1 -0
  164. package/dist/identity.d.mts +33 -0
  165. package/dist/identity.d.mts.map +1 -0
  166. package/dist/identity.mjs +16 -0
  167. package/dist/identity.mjs.map +1 -0
  168. package/dist/index.cjs +8 -5
  169. package/dist/index.d.cts +8 -6
  170. package/dist/index.d.mts +8 -6
  171. package/dist/index.mjs +6 -4
  172. package/dist/plugin.cjs +12 -26
  173. package/dist/plugin.cjs.map +1 -1
  174. package/dist/plugin.d.cts +44 -25
  175. package/dist/plugin.d.cts.map +1 -1
  176. package/dist/plugin.d.mts +45 -26
  177. package/dist/plugin.d.mts.map +1 -1
  178. package/dist/plugin.mjs +15 -29
  179. package/dist/plugin.mjs.map +1 -1
  180. package/dist/remote-entry.cjs +103 -0
  181. package/dist/remote-entry.cjs.map +1 -0
  182. package/dist/remote-entry.d.cts +53 -0
  183. package/dist/remote-entry.d.cts.map +1 -0
  184. package/dist/remote-entry.d.mts +53 -0
  185. package/dist/remote-entry.d.mts.map +1 -0
  186. package/dist/remote-entry.mjs +98 -0
  187. package/dist/remote-entry.mjs.map +1 -0
  188. package/dist/runtime/errors.cjs +140 -34
  189. package/dist/runtime/errors.cjs.map +1 -1
  190. package/dist/runtime/errors.d.cts +42 -7
  191. package/dist/runtime/errors.d.cts.map +1 -1
  192. package/dist/runtime/errors.d.mts +42 -7
  193. package/dist/runtime/errors.d.mts.map +1 -1
  194. package/dist/runtime/errors.mjs +136 -31
  195. package/dist/runtime/errors.mjs.map +1 -1
  196. package/dist/runtime/index.cjs +95 -23
  197. package/dist/runtime/index.cjs.map +1 -1
  198. package/dist/runtime/index.d.cts +16 -0
  199. package/dist/runtime/index.d.cts.map +1 -1
  200. package/dist/runtime/index.d.mts +16 -0
  201. package/dist/runtime/index.d.mts.map +1 -1
  202. package/dist/runtime/index.mjs +98 -26
  203. package/dist/runtime/index.mjs.map +1 -1
  204. package/dist/runtime/mf-config.cjs +3 -78
  205. package/dist/runtime/mf-config.cjs.map +1 -1
  206. package/dist/runtime/mf-config.d.cts +3 -49
  207. package/dist/runtime/mf-config.d.cts.map +1 -1
  208. package/dist/runtime/mf-config.d.mts +3 -49
  209. package/dist/runtime/mf-config.d.mts.map +1 -1
  210. package/dist/runtime/mf-config.mjs +5 -78
  211. package/dist/runtime/mf-config.mjs.map +1 -1
  212. package/dist/runtime/services/module-federation.service.cjs +63 -12
  213. package/dist/runtime/services/module-federation.service.cjs.map +1 -1
  214. package/dist/runtime/services/module-federation.service.d.cts +4 -13
  215. package/dist/runtime/services/module-federation.service.d.mts +4 -13
  216. package/dist/runtime/services/module-federation.service.mjs +63 -14
  217. package/dist/runtime/services/module-federation.service.mjs.map +1 -1
  218. package/dist/runtime/services/normalize.cjs +2 -22
  219. package/dist/runtime/services/normalize.d.cts +2 -21
  220. package/dist/runtime/services/normalize.d.mts +2 -21
  221. package/dist/runtime/services/normalize.mjs +2 -21
  222. package/dist/runtime/services/plugin-lifecycle.service.cjs +9 -11
  223. package/dist/runtime/services/plugin-lifecycle.service.cjs.map +1 -1
  224. package/dist/runtime/services/plugin-lifecycle.service.d.cts +3 -16
  225. package/dist/runtime/services/plugin-lifecycle.service.d.mts +3 -16
  226. package/dist/runtime/services/plugin-lifecycle.service.mjs +10 -13
  227. package/dist/runtime/services/plugin-lifecycle.service.mjs.map +1 -1
  228. package/dist/runtime/services/plugin-loader.service.cjs +30 -29
  229. package/dist/runtime/services/plugin-loader.service.cjs.map +1 -1
  230. package/dist/runtime/services/plugin-loader.service.d.cts +6 -53
  231. package/dist/runtime/services/plugin-loader.service.d.mts +6 -53
  232. package/dist/runtime/services/plugin-loader.service.mjs +29 -30
  233. package/dist/runtime/services/plugin-loader.service.mjs.map +1 -1
  234. package/dist/runtime/services/plugin.service.cjs +10 -12
  235. package/dist/runtime/services/plugin.service.cjs.map +1 -1
  236. package/dist/runtime/services/plugin.service.d.cts +14 -36
  237. package/dist/runtime/services/plugin.service.d.cts.map +1 -1
  238. package/dist/runtime/services/plugin.service.d.mts +14 -36
  239. package/dist/runtime/services/plugin.service.d.mts.map +1 -1
  240. package/dist/runtime/services/plugin.service.mjs +14 -18
  241. package/dist/runtime/services/plugin.service.mjs.map +1 -1
  242. package/dist/runtime/services/secrets.service.cjs +12 -12
  243. package/dist/runtime/services/secrets.service.cjs.map +1 -1
  244. package/dist/runtime/services/secrets.service.d.cts +3 -15
  245. package/dist/runtime/services/secrets.service.d.mts +3 -15
  246. package/dist/runtime/services/secrets.service.mjs +12 -13
  247. package/dist/runtime/services/secrets.service.mjs.map +1 -1
  248. package/dist/runtime/services/shared-identity.cjs +40 -0
  249. package/dist/runtime/services/shared-identity.cjs.map +1 -0
  250. package/dist/runtime/services/shared-identity.mjs +38 -0
  251. package/dist/runtime/services/shared-identity.mjs.map +1 -0
  252. package/dist/runtime/validation.cjs +2 -2
  253. package/dist/runtime/validation.cjs.map +1 -1
  254. package/dist/runtime/validation.mjs +2 -2
  255. package/dist/runtime/validation.mjs.map +1 -1
  256. package/dist/shared-deps-spec.cjs +384 -0
  257. package/dist/shared-deps-spec.cjs.map +1 -0
  258. package/dist/shared-deps-spec.d.cts +182 -0
  259. package/dist/shared-deps-spec.d.cts.map +1 -0
  260. package/dist/shared-deps-spec.d.mts +182 -0
  261. package/dist/shared-deps-spec.d.mts.map +1 -0
  262. package/dist/shared-deps-spec.mjs +368 -0
  263. package/dist/shared-deps-spec.mjs.map +1 -0
  264. package/dist/types.d.cts +22 -41
  265. package/dist/types.d.cts.map +1 -1
  266. package/dist/types.d.mts +22 -41
  267. package/dist/types.d.mts.map +1 -1
  268. package/dist/ui/manifest/construct.cjs +268 -0
  269. package/dist/ui/manifest/construct.cjs.map +1 -0
  270. package/dist/ui/manifest/construct.d.cts +48 -0
  271. package/dist/ui/manifest/construct.d.cts.map +1 -0
  272. package/dist/ui/manifest/construct.d.mts +48 -0
  273. package/dist/ui/manifest/construct.d.mts.map +1 -0
  274. package/dist/ui/manifest/construct.mjs +268 -0
  275. package/dist/ui/manifest/construct.mjs.map +1 -0
  276. package/dist/ui/manifest/contract.cjs +34 -0
  277. package/dist/ui/manifest/contract.cjs.map +1 -0
  278. package/dist/ui/manifest/contract.d.cts +26 -0
  279. package/dist/ui/manifest/contract.d.cts.map +1 -0
  280. package/dist/ui/manifest/contract.d.mts +26 -0
  281. package/dist/ui/manifest/contract.d.mts.map +1 -0
  282. package/dist/ui/manifest/contract.mjs +26 -0
  283. package/dist/ui/manifest/contract.mjs.map +1 -0
  284. package/dist/ui/manifest/descriptor.cjs +64 -0
  285. package/dist/ui/manifest/descriptor.cjs.map +1 -0
  286. package/dist/ui/manifest/descriptor.d.cts +60 -0
  287. package/dist/ui/manifest/descriptor.d.cts.map +1 -0
  288. package/dist/ui/manifest/descriptor.d.mts +60 -0
  289. package/dist/ui/manifest/descriptor.d.mts.map +1 -0
  290. package/dist/ui/manifest/descriptor.mjs +61 -0
  291. package/dist/ui/manifest/descriptor.mjs.map +1 -0
  292. package/dist/ui/manifest/generator.cjs +128 -0
  293. package/dist/ui/manifest/generator.cjs.map +1 -0
  294. package/dist/ui/manifest/generator.d.cts +41 -0
  295. package/dist/ui/manifest/generator.d.cts.map +1 -0
  296. package/dist/ui/manifest/generator.d.mts +41 -0
  297. package/dist/ui/manifest/generator.d.mts.map +1 -0
  298. package/dist/ui/manifest/generator.mjs +125 -0
  299. package/dist/ui/manifest/generator.mjs.map +1 -0
  300. package/dist/ui/manifest/index.cjs +35 -0
  301. package/dist/ui/manifest/index.d.cts +9 -0
  302. package/dist/ui/manifest/index.d.mts +9 -0
  303. package/dist/ui/manifest/index.mjs +9 -0
  304. package/dist/ui/manifest/manifest-schema.cjs +97 -0
  305. package/dist/ui/manifest/manifest-schema.cjs.map +1 -0
  306. package/dist/ui/manifest/manifest-schema.d.cts +132 -0
  307. package/dist/ui/manifest/manifest-schema.d.cts.map +1 -0
  308. package/dist/ui/manifest/manifest-schema.d.mts +132 -0
  309. package/dist/ui/manifest/manifest-schema.d.mts.map +1 -0
  310. package/dist/ui/manifest/manifest-schema.mjs +90 -0
  311. package/dist/ui/manifest/manifest-schema.mjs.map +1 -0
  312. package/dist/ui/manifest/mount-registry.cjs +52 -0
  313. package/dist/ui/manifest/mount-registry.cjs.map +1 -0
  314. package/dist/ui/manifest/mount-registry.d.cts +61 -0
  315. package/dist/ui/manifest/mount-registry.d.cts.map +1 -0
  316. package/dist/ui/manifest/mount-registry.d.mts +61 -0
  317. package/dist/ui/manifest/mount-registry.d.mts.map +1 -0
  318. package/dist/ui/manifest/mount-registry.mjs +48 -0
  319. package/dist/ui/manifest/mount-registry.mjs.map +1 -0
  320. package/dist/ui/manifest/nav.cjs +13 -0
  321. package/dist/ui/manifest/nav.cjs.map +1 -0
  322. package/dist/ui/manifest/nav.d.cts +34 -0
  323. package/dist/ui/manifest/nav.d.cts.map +1 -0
  324. package/dist/ui/manifest/nav.d.mts +34 -0
  325. package/dist/ui/manifest/nav.d.mts.map +1 -0
  326. package/dist/ui/manifest/nav.mjs +13 -0
  327. package/dist/ui/manifest/nav.mjs.map +1 -0
  328. package/dist/ui/manifest/route-config.cjs +33 -0
  329. package/dist/ui/manifest/route-config.cjs.map +1 -0
  330. package/dist/ui/manifest/route-config.d.cts +40 -0
  331. package/dist/ui/manifest/route-config.d.cts.map +1 -0
  332. package/dist/ui/manifest/route-config.d.mts +40 -0
  333. package/dist/ui/manifest/route-config.d.mts.map +1 -0
  334. package/dist/ui/manifest/route-config.mjs +33 -0
  335. package/dist/ui/manifest/route-config.mjs.map +1 -0
  336. package/dist/version-manifest.cjs +65 -0
  337. package/dist/version-manifest.cjs.map +1 -0
  338. package/dist/version-manifest.d.cts +52 -0
  339. package/dist/version-manifest.d.cts.map +1 -0
  340. package/dist/version-manifest.d.mts +52 -0
  341. package/dist/version-manifest.d.mts.map +1 -0
  342. package/dist/version-manifest.mjs +63 -0
  343. package/dist/version-manifest.mjs.map +1 -0
  344. package/package.json +165 -68
  345. package/skills/plugin-client/SKILL.md +24 -5
  346. package/skills/plugin-development/SKILL.md +79 -47
  347. package/skills/plugin-testing/SKILL.md +41 -12
  348. package/src/build/artifact-names.ts +117 -0
  349. package/src/build/contract-types.ts +101 -0
  350. package/src/build/rspack/build-report-plugin.ts +34 -0
  351. package/src/build/rspack/chunk-completeness-plugin.ts +57 -0
  352. package/src/build/rspack/compose.ts +87 -0
  353. package/src/build/rspack/fix-mf-data-uri-plugin.ts +23 -12
  354. package/src/build/rspack/generated-config.ts +35 -0
  355. package/src/build/rspack/index.ts +10 -5
  356. package/src/build/rspack/module-federation.ts +1 -1
  357. package/src/build/rspack/plugin.ts +103 -105
  358. package/src/build/rspack/utils.ts +8 -2
  359. package/src/build/ui/factory.ts +96 -0
  360. package/src/build/ui/generated-config.ts +133 -0
  361. package/src/build/ui/hash-artifacts-plugin.ts +79 -0
  362. package/src/build/ui/index.ts +98 -0
  363. package/src/build/ui/manifest-plugin.ts +54 -0
  364. package/src/build/ui/rsbuild-config.ts +256 -0
  365. package/src/build/ui/stubs.ts +103 -0
  366. package/src/cli.ts +100 -0
  367. package/src/dev/serve.ts +477 -0
  368. package/src/dev/watch-kill.ts +58 -0
  369. package/src/effect-helpers.ts +25 -0
  370. package/src/errors.ts +16 -18
  371. package/src/identity.ts +36 -0
  372. package/src/index.ts +4 -0
  373. package/src/plugin.ts +70 -92
  374. package/src/remote-entry.ts +171 -0
  375. package/src/runtime/errors.ts +186 -27
  376. package/src/runtime/index.ts +132 -43
  377. package/src/runtime/mf-config.ts +12 -107
  378. package/src/runtime/services/module-federation.service.ts +221 -117
  379. package/src/runtime/services/normalize.ts +1 -18
  380. package/src/runtime/services/plugin-lifecycle.service.ts +66 -75
  381. package/src/runtime/services/plugin-loader.service.ts +239 -212
  382. package/src/runtime/services/plugin.service.ts +61 -43
  383. package/src/runtime/services/secrets.service.ts +20 -15
  384. package/src/runtime/services/shared-identity.ts +68 -0
  385. package/src/runtime/validation.ts +5 -7
  386. package/src/shared-deps-spec.ts +478 -0
  387. package/src/types.ts +22 -48
  388. package/src/ui/manifest/construct.ts +403 -0
  389. package/src/ui/manifest/contract.ts +33 -0
  390. package/src/ui/manifest/descriptor.ts +96 -0
  391. package/src/ui/manifest/generator.ts +238 -0
  392. package/src/ui/manifest/index.ts +55 -0
  393. package/src/ui/manifest/manifest-schema.ts +107 -0
  394. package/src/ui/manifest/mount-registry.ts +50 -0
  395. package/src/ui/manifest/nav.ts +43 -0
  396. package/src/ui/manifest/route-config.ts +82 -0
  397. package/src/version-manifest.ts +88 -0
  398. package/dist/build/rspack/dev-server-middleware.cjs +0 -194
  399. package/dist/build/rspack/dev-server-middleware.cjs.map +0 -1
  400. package/dist/build/rspack/dev-server-middleware.mjs +0 -193
  401. package/dist/build/rspack/dev-server-middleware.mjs.map +0 -1
  402. package/dist/build/shared-deps.cjs +0 -83
  403. package/dist/build/shared-deps.cjs.map +0 -1
  404. package/dist/build/shared-deps.d.cts +0 -67
  405. package/dist/build/shared-deps.d.cts.map +0 -1
  406. package/dist/build/shared-deps.d.mts +0 -67
  407. package/dist/build/shared-deps.d.mts.map +0 -1
  408. package/dist/build/shared-deps.mjs +0 -79
  409. package/dist/build/shared-deps.mjs.map +0 -1
  410. package/dist/effect.cjs +0 -9
  411. package/dist/effect.d.cts +0 -1
  412. package/dist/effect.d.mts +0 -1
  413. package/dist/effect.mjs +0 -3
  414. package/dist/orpc-openapi.cjs +0 -17
  415. package/dist/orpc-openapi.d.cts +0 -2
  416. package/dist/orpc-openapi.d.mts +0 -2
  417. package/dist/orpc-openapi.mjs +0 -5
  418. package/dist/orpc.cjs +0 -46
  419. package/dist/orpc.d.cts +0 -7
  420. package/dist/orpc.d.mts +0 -7
  421. package/dist/orpc.mjs +0 -11
  422. package/dist/package.cjs +0 -23
  423. package/dist/package.cjs.map +0 -1
  424. package/dist/package.mjs +0 -17
  425. package/dist/package.mjs.map +0 -1
  426. package/dist/runtime/services/module-federation.service.d.cts.map +0 -1
  427. package/dist/runtime/services/module-federation.service.d.mts.map +0 -1
  428. package/dist/runtime/services/normalize.cjs.map +0 -1
  429. package/dist/runtime/services/normalize.d.cts.map +0 -1
  430. package/dist/runtime/services/normalize.d.mts.map +0 -1
  431. package/dist/runtime/services/normalize.mjs.map +0 -1
  432. package/dist/runtime/services/plugin-lifecycle.service.d.cts.map +0 -1
  433. package/dist/runtime/services/plugin-lifecycle.service.d.mts.map +0 -1
  434. package/dist/runtime/services/plugin-loader.service.d.cts.map +0 -1
  435. package/dist/runtime/services/plugin-loader.service.d.mts.map +0 -1
  436. package/dist/runtime/services/secrets.service.d.cts.map +0 -1
  437. package/dist/runtime/services/secrets.service.d.mts.map +0 -1
  438. package/dist/testing/index.cjs +0 -57
  439. package/dist/testing/index.cjs.map +0 -1
  440. package/dist/testing/index.d.cts +0 -54
  441. package/dist/testing/index.d.cts.map +0 -1
  442. package/dist/testing/index.d.mts +0 -54
  443. package/dist/testing/index.d.mts.map +0 -1
  444. package/dist/testing/index.mjs +0 -55
  445. package/dist/testing/index.mjs.map +0 -1
  446. package/dist/zod-core.cjs +0 -9
  447. package/dist/zod-core.d.cts +0 -1
  448. package/dist/zod-core.d.mts +0 -1
  449. package/dist/zod-core.mjs +0 -3
  450. package/dist/zod.cjs +0 -11
  451. package/dist/zod.d.cts +0 -2
  452. package/dist/zod.d.mts +0 -2
  453. package/dist/zod.mjs +0 -3
  454. package/src/build/rspack/dev-server-middleware.ts +0 -250
  455. package/src/build/shared-deps.ts +0 -102
  456. package/src/effect.ts +0 -1
  457. package/src/orpc-openapi.ts +0 -2
  458. package/src/orpc.ts +0 -9
  459. package/src/testing/index.ts +0 -87
  460. package/src/testing/mocks/module-federation.service.ts +0 -41
  461. package/src/zod-core.ts +0 -1
  462. package/src/zod.ts +0 -3
@@ -0,0 +1,87 @@
1
+ import fs from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import path from "node:path";
4
+ import type { Compiler, RspackPluginInstance } from "@rspack/core";
5
+ import { FixMfDataUriPlugin } from "./fix-mf-data-uri-plugin";
6
+ import { EmitPluginManifest, EveryPluginBuild } from "./plugin";
7
+
8
+ class EveryPluginComposedBuild implements RspackPluginInstance {
9
+ name = "EveryPluginComposedBuild";
10
+
11
+ constructor(private readonly dts: boolean = false) {}
12
+
13
+ apply(compiler: Compiler) {
14
+ new EmitPluginManifest().apply(compiler);
15
+ new EveryPluginBuild({ dts: this.dts }).apply(compiler);
16
+ new FixMfDataUriPlugin().apply(compiler);
17
+ }
18
+ }
19
+
20
+ export interface PluginBaseConfigOptions {
21
+ drizzle?: boolean;
22
+ externals?: string[];
23
+ /** Concrete rspack fields to merge over the defaults (devtool, infrastructureLogging, ...). */
24
+ rspack?: Partial<PluginBaseConfig>;
25
+ }
26
+
27
+ const pluginRequire = createRequire(import.meta.url);
28
+
29
+ /** Config filenames that mark a project root, nearest-first. Authored
30
+ * descriptor projects (the platform) carry bos.app.ts; generated child
31
+ * projects carry bos.config.json. */
32
+ const CONFIG_FILENAMES = ["bos.config.json", "bos.app.ts"] as const;
33
+
34
+ export function findBosConfigPath(from: string = process.cwd()): string | null {
35
+ let current = path.resolve(from);
36
+ while (true) {
37
+ for (const filename of CONFIG_FILENAMES) {
38
+ const candidate = path.join(current, filename);
39
+ if (fs.existsSync(candidate)) return candidate;
40
+ }
41
+ const parent = path.dirname(current);
42
+ if (parent === current) return null;
43
+ current = parent;
44
+ }
45
+ }
46
+
47
+ function loadDrizzleMigrationsPlugin(): ((...args: unknown[]) => unknown) | null {
48
+ try {
49
+ const mod = pluginRequire("@proj-airi/unplugin-drizzle-orm-migrations/rspack");
50
+ return (mod as { default?: (...args: unknown[]) => unknown }).default ?? mod;
51
+ } catch {
52
+ return null;
53
+ }
54
+ }
55
+
56
+ export interface PluginBaseConfig {
57
+ externals: string[];
58
+ devtool: false | "source-map";
59
+ plugins: unknown[];
60
+ infrastructureLogging: { level: "error" };
61
+ stats: "errors-warnings";
62
+ }
63
+
64
+ export function createPluginBaseConfig(options: PluginBaseConfigOptions = {}): PluginBaseConfig {
65
+ const shouldDeploy = process.env.DEPLOY === "true";
66
+ const plugins: unknown[] = [new EveryPluginComposedBuild(false)];
67
+
68
+ if (options.drizzle !== false) {
69
+ const drizzlePlugin = loadDrizzleMigrationsPlugin();
70
+ if (drizzlePlugin) {
71
+ plugins.push(drizzlePlugin());
72
+ } else if (options.drizzle === true) {
73
+ throw new Error(
74
+ "createPluginBaseConfig({ drizzle: true }) requires @proj-airi/unplugin-drizzle-orm-migrations to be installed.",
75
+ );
76
+ }
77
+ }
78
+
79
+ return {
80
+ ...options.rspack,
81
+ externals: options.externals ?? options.rspack?.externals ?? ["pg", "@electric-sql/pglite"],
82
+ devtool: options.rspack?.devtool ?? (shouldDeploy ? false : "source-map"),
83
+ plugins,
84
+ infrastructureLogging: options.rspack?.infrastructureLogging ?? { level: "error" },
85
+ stats: options.rspack?.stats ?? "errors-warnings",
86
+ };
87
+ }
@@ -1,10 +1,14 @@
1
1
  import type { Compiler, RspackPluginInstance } from "@rspack/core";
2
2
 
3
3
  const MF_DATA_URI_MARKER = "data:text/javascript,";
4
+ const NODE_MODULES_IMPORT_RE = /(["'])\/[^"']*?\/node_modules\/([^"']*)\1/g;
4
5
 
5
6
  export class FixMfDataUriPlugin implements RspackPluginInstance {
6
7
  name = "FixMfDataUriPlugin";
7
8
 
9
+ /** Bare specifier → on-disk absolute path, learned while rewriting. */
10
+ private redirects = new Map<string, string>();
11
+
8
12
  apply(compiler: Compiler) {
9
13
  compiler.hooks.compilation.tap(this.name, (_compilation, { normalModuleFactory }) => {
10
14
  normalModuleFactory.hooks.beforeResolve.tap(this.name, (resolveData) => {
@@ -12,6 +16,12 @@ export class FixMfDataUriPlugin implements RspackPluginInstance {
12
16
  if (!resolveData.request.includes(MF_DATA_URI_MARKER)) return;
13
17
  this.reencodeDataUri(resolveData);
14
18
  });
19
+ normalModuleFactory.hooks.resolve.tap(this.name, (resolveData) => {
20
+ const target = this.redirects.get(resolveData?.request ?? "");
21
+ if (target) {
22
+ resolveData.request = target;
23
+ }
24
+ });
15
25
  });
16
26
  }
17
27
 
@@ -24,22 +34,23 @@ export class FixMfDataUriPlugin implements RspackPluginInstance {
24
34
  const prefix = request.substring(0, contentStart);
25
35
  const rawContent = request.substring(contentStart);
26
36
 
27
- if (isAlreadyEncoded(rawContent)) return;
28
-
29
- const decoded = safeDecode(rawContent);
37
+ // The MF runtime's and rsbuild's generated data-URI modules import their
38
+ // runtime pieces by absolute node_modules paths (`require.resolve` output),
39
+ // which differ per machine. Rewriting them to bare specifiers keeps the
40
+ // module — and therefore the module id space — machine-independent; the
41
+ // recorded redirects resolve those specifiers back to this machine's
42
+ // on-disk copies while the request (and thus the module id) stays bare.
43
+ const decoded = safeDecode(rawContent).replace(
44
+ NODE_MODULES_IMPORT_RE,
45
+ (match, _quote: string, rest: string) => {
46
+ this.redirects.set(rest, match.slice(1, -1));
47
+ return _quote + rest + _quote;
48
+ },
49
+ );
30
50
  resolveData.request = prefix + encodeURIComponent(decoded);
31
51
  }
32
52
  }
33
53
 
34
- function isAlreadyEncoded(content: string): boolean {
35
- try {
36
- const decoded = decodeURIComponent(content);
37
- return decoded !== content;
38
- } catch {
39
- return false;
40
- }
41
- }
42
-
43
54
  function safeDecode(content: string): string {
44
55
  try {
45
56
  return decodeURIComponent(content);
@@ -0,0 +1,35 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+
4
+ import { findBosConfigPath } from "./compose";
5
+
6
+ export { findBosConfigPath };
7
+
8
+ function generatedRspackConfig(hasOverrides: boolean): string {
9
+ return `import { createPluginBaseConfig } from "every-plugin/build/rspack";
10
+ ${hasOverrides ? `import buildOverrides from "../build.config.ts";\n` : ""}
11
+ export default createPluginBaseConfig(${hasOverrides ? "buildOverrides" : "{}"});
12
+ `;
13
+ }
14
+
15
+ /**
16
+ * Ensures the synthesized rspack config exists for workspaces that no longer
17
+ * ship their own `rspack.config.js`. Returns the workspace-relative config
18
+ * path to pass via `--config`, or `null` when the workspace has its own
19
+ * `rspack.config.js` and bare `rspack build` should be used.
20
+ */
21
+ export function ensureGeneratedRspackConfig(cwd: string = process.cwd()): string | null {
22
+ if (fs.existsSync(path.join(cwd, "rspack.config.js"))) return null;
23
+
24
+ const overridesPath = path.resolve(cwd, "build.config.ts");
25
+ const hasOverrides = fs.existsSync(overridesPath);
26
+ const generatedDir = path.join(cwd, ".every-plugin");
27
+ const generatedConfig = path.join(generatedDir, "rspack.config.generated.mjs");
28
+ fs.mkdirSync(generatedDir, { recursive: true });
29
+ fs.writeFileSync(generatedConfig, generatedRspackConfig(hasOverrides));
30
+
31
+ console.log(
32
+ "[every-plugin] rspack.config.js not found — using the every-plugin build composition.",
33
+ );
34
+ return path.join(".every-plugin", "rspack.config.generated.mjs");
35
+ }
@@ -1,14 +1,19 @@
1
1
  export {
2
- getMajorMinorVersion,
3
2
  getPluginSharedDependencies,
4
- getPluginSharedDependenciesVersionRange,
3
+ isEffectCriticalSharedDep,
5
4
  type SharedDependencies,
6
5
  type SharedDependencyConfig,
7
- } from "../shared-deps";
6
+ } from "../../shared-deps-spec";
7
+ export { BuildReportPlugin } from "./build-report-plugin";
8
+ export {
9
+ createPluginBaseConfig,
10
+ type PluginBaseConfig,
11
+ type PluginBaseConfigOptions,
12
+ } from "./compose";
8
13
  export { FixMfDataUriPlugin } from "./fix-mf-data-uri-plugin";
9
14
  export {
10
15
  EmitPluginManifest,
11
- EveryPluginDevServer,
12
- type EveryPluginOptions,
16
+ EveryPluginBuild,
17
+ type EveryPluginBuildOptions,
13
18
  type PluginManifestEmitterOptions,
14
19
  } from "./plugin";
@@ -1,4 +1,4 @@
1
- import { getPluginSharedDependencies } from "../shared-deps";
1
+ import { getPluginSharedDependencies } from "../../shared-deps-spec";
2
2
  import type { PluginInfo } from "./utils";
3
3
 
4
4
  export function buildSharedDependencies(_pluginInfo: PluginInfo) {
@@ -3,26 +3,25 @@ import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { ModuleFederationPlugin } from "@module-federation/enhanced/rspack";
5
5
  import type { Compiler, RspackPluginInstance } from "@rspack/core";
6
- import { setupPluginMiddleware } from "./dev-server-middleware";
6
+ import {
7
+ DEV_ENTRY_FILENAME,
8
+ findHashedEntry,
9
+ isBuildInvocation,
10
+ uiEntryFilename,
11
+ } from "../artifact-names";
12
+ import { CONTRACT_TYPES_FILE, generateContractTypes } from "../contract-types";
13
+ import { BuildReportPlugin } from "./build-report-plugin";
14
+ import { ChunkCompletenessPlugin } from "./chunk-completeness-plugin";
7
15
  import { buildSharedDependencies } from "./module-federation";
8
- import { getPluginInfo, loadDevConfig } from "./utils";
16
+ import { getPluginInfo } from "./utils";
9
17
 
10
- export interface EveryPluginOptions {
11
- devConfigPath?: string;
12
- port?: number;
13
- pluginId?: string;
18
+ export interface EveryPluginBuildOptions {
14
19
  dts?: boolean;
15
20
  }
16
21
 
17
- export interface AdditionalExport {
18
- srcPath: string;
19
- exportNames: string[];
20
- }
21
-
22
22
  export interface PluginManifestEmitterOptions {
23
23
  manifestFileName?: string;
24
24
  contractFileName?: string;
25
- additionalExports?: AdditionalExport[];
26
25
  }
27
26
 
28
27
  export class EmitPluginManifest implements RspackPluginInstance {
@@ -42,9 +41,22 @@ export class EmitPluginManifest implements RspackPluginInstance {
42
41
  const contractFileName = this.options.contractFileName ?? "contract.d.ts";
43
42
  const manifestFileName = this.options.manifestFileName ?? "plugin.manifest.json";
44
43
 
45
- const sourceContractPath = path.join(context, "types", contractFileName);
44
+ let generationError: string | null = null;
45
+ try {
46
+ const status = await generateContractTypes(context);
47
+ if (status === "generated") {
48
+ console.log(`[EmitPluginManifest] Contract types regenerated (${context}).`);
49
+ }
50
+ } catch (error) {
51
+ generationError = error instanceof Error ? error.message : String(error);
52
+ }
53
+
54
+ if (generationError) {
55
+ console.warn(`[EmitPluginManifest] Skipping manifest generation — ${generationError}`);
56
+ return;
57
+ }
46
58
 
47
- let contractTypes: string;
59
+ const sourceContractPath = path.join(context, CONTRACT_TYPES_FILE);
48
60
 
49
61
  const tryReadFile = async (filePath: string): Promise<string | null> => {
50
62
  if (!fs.existsSync(filePath)) {
@@ -61,24 +73,18 @@ export class EmitPluginManifest implements RspackPluginInstance {
61
73
  }
62
74
  };
63
75
 
64
- contractTypes = (await tryReadFile(sourceContractPath)) ?? "";
76
+ const contractTypes = (await tryReadFile(sourceContractPath)) ?? "";
65
77
 
66
78
  if (!contractTypes) {
67
- const packageDir = context.split("/").pop();
68
- const nestedPath = path.join(context, "types", packageDir ?? "", "src", contractFileName);
69
-
70
- contractTypes = (await tryReadFile(nestedPath)) ?? "";
71
-
72
- if (!contractTypes) {
73
- console.warn(
74
- `[EmitPluginManifest] Contract file not found at ${sourceContractPath} or ${nestedPath}. ` +
75
- `Skipping manifest generation.`,
76
- );
77
- return;
78
- }
79
+ console.warn(
80
+ `[EmitPluginManifest] No contract types at ${sourceContractPath} ` +
81
+ `(no src/contract.ts in this workspace?). Skipping manifest generation.`,
82
+ );
83
+ return;
79
84
  }
80
85
 
81
86
  const contractSha256 = crypto.createHash("sha256").update(contractTypes).digest("hex");
87
+ const hashedEntry = findHashedEntry(Object.keys(compilation.assets), "remoteEntry");
82
88
  const manifest: Record<string, unknown> = {
83
89
  schemaVersion: 1,
84
90
  kind: "every-plugin/manifest",
@@ -87,7 +93,7 @@ export class EmitPluginManifest implements RspackPluginInstance {
87
93
  version: pluginInfo.version,
88
94
  },
89
95
  runtime: {
90
- remoteEntry: "./remoteEntry.js",
96
+ remoteEntry: `./${hashedEntry ?? DEV_ENTRY_FILENAME}`,
91
97
  },
92
98
  contract: {
93
99
  kind: "orpc",
@@ -100,37 +106,6 @@ export class EmitPluginManifest implements RspackPluginInstance {
100
106
  },
101
107
  };
102
108
 
103
- const additionalExportsEntries: Array<{ path: string; exports: string[]; sha256: string }> =
104
- [];
105
-
106
- if (this.options.additionalExports?.length) {
107
- for (const additional of this.options.additionalExports) {
108
- const sourcePath = path.join(context, "types", additional.srcPath);
109
- const content = await tryReadFile(sourcePath);
110
- if (!content) {
111
- console.warn(
112
- `[EmitPluginManifest] Additional export file not found at ${sourcePath}. Skipping.`,
113
- );
114
- continue;
115
- }
116
- const sha256 = crypto.createHash("sha256").update(content).digest("hex");
117
- const distPath = `./types/${additional.srcPath}`;
118
- additionalExportsEntries.push({
119
- path: distPath,
120
- exports: additional.exportNames,
121
- sha256,
122
- });
123
-
124
- if (rawSource) {
125
- compilation.emitAsset(`types/${additional.srcPath}`, new rawSource(content));
126
- }
127
- }
128
-
129
- if (additionalExportsEntries.length > 0) {
130
- manifest.additionalExports = additionalExportsEntries;
131
- }
132
- }
133
-
134
109
  if (rawSource) {
135
110
  compilation.emitAsset(
136
111
  manifestFileName,
@@ -143,27 +118,19 @@ export class EmitPluginManifest implements RspackPluginInstance {
143
118
  }
144
119
  }
145
120
 
146
- export class EveryPluginDevServer implements RspackPluginInstance {
147
- name = "EveryPluginDevServer";
121
+ export class EveryPluginBuild implements RspackPluginInstance {
122
+ name = "EveryPluginBuild";
148
123
 
149
- constructor(private options: EveryPluginOptions = {}) {}
124
+ constructor(private options: EveryPluginBuildOptions = {}) {}
150
125
 
151
126
  apply(compiler: Compiler) {
152
127
  const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());
153
- const devConfig = loadDevConfig(this.options.devConfigPath || "./plugin.dev.ts");
154
- const port = Number(process.env.PORT) || this.options.port || devConfig?.port || 3999;
155
128
 
156
129
  this.configureDefaults(compiler, pluginInfo);
157
130
 
158
- if (!compiler.options.devServer) {
159
- compiler.options.devServer = {};
160
- }
161
-
162
- this.configureDevServer(compiler, pluginInfo, devConfig, port);
163
-
164
131
  new ModuleFederationPlugin({
165
132
  name: pluginInfo.normalizedName,
166
- filename: "remoteEntry.js",
133
+ filename: uiEntryFilename({ isBuild: isBuildInvocation() }),
167
134
  dts: this.options.dts !== false,
168
135
  manifest: {},
169
136
  runtimePlugins: [require.resolve("@module-federation/node/runtimePlugin")],
@@ -175,6 +142,9 @@ export class EveryPluginDevServer implements RspackPluginInstance {
175
142
  shareStrategy: "version-first",
176
143
  }).apply(compiler);
177
144
 
145
+ new BuildReportPlugin().apply(compiler);
146
+ new ChunkCompletenessPlugin().apply(compiler);
147
+
178
148
  if (this.options.dts === false) {
179
149
  compiler.options.plugins = (compiler.options.plugins ?? []).filter(
180
150
  (p) =>
@@ -194,7 +164,10 @@ export class EveryPluginDevServer implements RspackPluginInstance {
194
164
  compiler.options.output.uniqueName = pluginInfo.normalizedName;
195
165
  compiler.options.output.publicPath = "auto";
196
166
  compiler.options.output.path = path.resolve(context, "dist");
197
- compiler.options.output.clean = true;
167
+ // Watch rebuilds must not wipe dist: the dev serve static handler serves
168
+ // this directory, and a clean on every rebuild opens a window where
169
+ // remoteEntry.js 404s for any consumer that loads mid-rebuild.
170
+ compiler.options.output.clean = !compiler.options.watch;
198
171
  compiler.options.output.library = { type: "commonjs-module" };
199
172
 
200
173
  if (!compiler.options.target) {
@@ -217,11 +190,38 @@ export class EveryPluginDevServer implements RspackPluginInstance {
217
190
 
218
191
  this.ensureTypeScriptLoader(compiler);
219
192
 
193
+ if (!compiler.options.optimization) {
194
+ compiler.options.optimization = {};
195
+ }
196
+ // rspack 2.x splitChunks re-ids the final chunk graph while the federation
197
+ // get-factory codegen keeps pre-split ids — the entry then references
198
+ // chunks that were never emitted (ChunkCompletenessPlugin's exact failure
199
+ // mode). Splitting off keeps the emitted bundle self-consistent.
200
+ compiler.options.optimization.splitChunks = false;
201
+ // The default deterministic module ids hash module identifiers that embed
202
+ // absolute resource paths, so the same source builds to different id
203
+ // spaces on different machines (host deploy train vs the image's
204
+ // dist-builder stage). A mixed-generation load — CDN-pinned entry +
205
+ // staged chunks — then splices two incompatible id spaces and fails with
206
+ // "__webpack_modules__[r] is not a function". Named ids derive from
207
+ // context-relative requests, keeping builds machine-independent and the
208
+ // two generations semantically identical.
209
+ compiler.options.optimization.moduleIds = "named";
210
+
220
211
  if (!compiler.options.resolve) {
221
212
  compiler.options.resolve = {};
222
213
  }
223
214
  compiler.options.resolve.extensions = ["...", ".tsx", ".ts"];
215
+ // Source-first for local flows: resolve framework packages through the
216
+ // `development` export condition (TS source) unless DEPLOY=true — the
217
+ // manual dist-first switch deploy-identical builds opt into. (NODE_ENV
218
+ // is unusable as the gate here: the rspack CLI defaults it to
219
+ // "production" for every `build` invocation, including local dev watch.)
220
+ // byDependency entries inherit the root conditions via "...", so
221
+ // dropping the strip lets esm/cjs deps pick up `development` too.
222
+ const sourceFirst = process.env.DEPLOY !== "true";
224
223
  compiler.options.resolve.conditionNames = [
224
+ ...(sourceFirst ? ["development"] : []),
225
225
  "webpack",
226
226
  "import",
227
227
  "module",
@@ -229,7 +229,18 @@ export class EveryPluginDevServer implements RspackPluginInstance {
229
229
  "node",
230
230
  "default",
231
231
  ];
232
- if (compiler.options.resolve.byDependency) {
232
+ if (sourceFirst) {
233
+ // Source-resolved TS packages (e.g. better-near-auth) use node-style
234
+ // `.js` specifiers for their own relative imports; map them to the
235
+ // on-disk `.ts` sources. `.js` stays first in the expansion: the alias
236
+ // picks the first target that exists on disk, and .ts-first made
237
+ // packages that also ship index.ts (e.g. @scure/base) resolve their
238
+ // TypeScript over their real JavaScript entry.
239
+ compiler.options.resolve.extensionAlias = {
240
+ ".js": [".js", ".ts", ".tsx"],
241
+ };
242
+ }
243
+ if (!sourceFirst && compiler.options.resolve.byDependency) {
233
244
  for (const depType of Object.keys(compiler.options.resolve.byDependency)) {
234
245
  const depConfig = (
235
246
  compiler.options.resolve.byDependency as Record<string, { conditionNames?: string[] }>
@@ -255,6 +266,25 @@ export class EveryPluginDevServer implements RspackPluginInstance {
255
266
  compiler.options.module.rules = [];
256
267
  }
257
268
 
269
+ // Source-first resolution pulls every-plugin src into the graph, which
270
+ // imports package.json (runtime/mf-config.ts). The MF shared chunks
271
+ // must emit it as a json module, not parse it as JavaScript.
272
+ const hasJsonRule = compiler.options.module.rules.some(
273
+ (rule: any) =>
274
+ typeof rule === "object" &&
275
+ rule !== null &&
276
+ "test" in rule &&
277
+ rule.test instanceof RegExp &&
278
+ rule.test.test(".json"),
279
+ );
280
+
281
+ if (!hasJsonRule) {
282
+ compiler.options.module.rules.push({
283
+ test: /\.json$/,
284
+ type: "json",
285
+ } as any);
286
+ }
287
+
258
288
  const hasTsLoader = compiler.options.module.rules.some(
259
289
  (rule: any) =>
260
290
  typeof rule === "object" &&
@@ -272,36 +302,4 @@ export class EveryPluginDevServer implements RspackPluginInstance {
272
302
  });
273
303
  }
274
304
  }
275
-
276
- private configureDevServer(compiler: Compiler, pluginInfo: any, devConfig: any, port: number) {
277
- if (!compiler.options.devServer) {
278
- return;
279
- }
280
-
281
- const context = compiler.options.context || process.cwd();
282
- const originalSetup = compiler.options.devServer.setupMiddlewares;
283
-
284
- compiler.options.devServer.port = port;
285
- compiler.options.devServer.static = path.join(context, "dist");
286
- compiler.options.devServer.hot = true;
287
- compiler.options.devServer.devMiddleware = { writeToDisk: true };
288
- compiler.options.devServer.headers = {
289
- "Access-Control-Allow-Origin": "*",
290
- "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
291
- "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization",
292
- };
293
-
294
- compiler.options.devServer.client = {
295
- logging: "warn",
296
- overlay: {
297
- warnings: false,
298
- errors: true,
299
- },
300
- };
301
-
302
- compiler.options.devServer.setupMiddlewares = (middlewares, devServer) => {
303
- setupPluginMiddleware(devServer, pluginInfo, devConfig, port);
304
- return originalSetup ? originalSetup(middlewares, devServer) : middlewares;
305
- };
306
- }
307
305
  }
@@ -1,6 +1,12 @@
1
1
  import fs from "node:fs";
2
+ import { createRequire } from "node:module";
2
3
  import path from "node:path";
3
- import { getNormalizedRemoteName } from "every-plugin/normalize";
4
+ import { remoteName } from "../../identity";
5
+
6
+ // Bare `require` only exists under bun's ESM; node ESM needs an explicit
7
+ // binding. tsx patches the module loader, so this require still loads the
8
+ // plugin.dev.ts source.
9
+ const require = createRequire(import.meta.url);
4
10
 
5
11
  export interface PluginInfo {
6
12
  name: string;
@@ -17,7 +23,7 @@ export function getPluginInfo(context: string): PluginInfo {
17
23
  return {
18
24
  name: pkg.name,
19
25
  version: pkg.version,
20
- normalizedName: getNormalizedRemoteName(pkg.name),
26
+ normalizedName: remoteName(pkg.name),
21
27
  dependencies: pkg.dependencies || {},
22
28
  peerDependencies: pkg.peerDependencies || {},
23
29
  };
@@ -0,0 +1,96 @@
1
+ /**
2
+ * The core ui's rsbuild factory — the workspace-form counterpart of
3
+ * `createUiRsbuildConfig` (folder-form plugin uis). The config object the
4
+ * generated `.every-plugin/ui.rsbuild.config.generated.mjs` materializes:
5
+ * the APP_NAME/APP_ACCOUNT defines come from the authored config through
6
+ * `readAuthoredConfigInput` (everything-dev/config), which the generated
7
+ * file loads in the workspace's own module graph.
8
+ */
9
+
10
+ import fs from "node:fs";
11
+ import path from "node:path";
12
+ import { CORE_UI_PLUGIN_KEY } from "../../ui/manifest/contract";
13
+ import { createUiRsbuildConfig } from "./rsbuild-config";
14
+
15
+ /**
16
+ * The platform skill family ships inside the framework packages' npm tarballs
17
+ * (`files: ["skills"]`), so resolving them from `node_modules` gives the core
18
+ * ui the same copies in the parent workspace (pnpm symlinks) and every
19
+ * generated child repo (published tarball). Served at `/skills/<pkg>/<skill>`.
20
+ */
21
+ const SKILL_PACKAGES = ["everything-dev", "every-plugin", "better-near-auth"] as const;
22
+
23
+ export function platformSkillCopies(workspaceRoot: string): Array<{
24
+ from: string;
25
+ to: string;
26
+ globOptions: { ignore: string[] };
27
+ }> {
28
+ return SKILL_PACKAGES.flatMap((name) => {
29
+ const from = path.join(workspaceRoot, "node_modules", name, "skills");
30
+ return fs.existsSync(from)
31
+ ? [
32
+ {
33
+ from,
34
+ to: `./skills/${name}`,
35
+ globOptions: { ignore: ["**/_artifacts/**"] },
36
+ },
37
+ ]
38
+ : [];
39
+ });
40
+ }
41
+
42
+ export interface CoreUiRsbuildConfigInput {
43
+ /** Authored config domain — stamped as `import.meta.env.APP_NAME`. */
44
+ domain?: string;
45
+ /** Authored config account — stamped as `import.meta.env.APP_ACCOUNT`. */
46
+ account?: string;
47
+ }
48
+
49
+ /**
50
+ * The core ui's MF build surface — entry points and the declared exposes
51
+ * (ADR 0008 §2). Entries and the bootstrap exposes resolve to GENERATED
52
+ * stubs (ADR 0023); only surfaces with consumers are declared: the browser
53
+ * bootstrap, the shared component barrel, the SSR router module, the
54
+ * composition engine, and the generated route config.
55
+ */
56
+ export const CORE_UI_WEB_ENTRY = "./src/entry.gen.ts";
57
+
58
+ export const CORE_UI_WEB_EXPOSES: Record<string, string> = {
59
+ "./Hydrate": "./src/hydrate.gen.tsx",
60
+ "./components": "./src/components/index.ts",
61
+ };
62
+
63
+ export const CORE_UI_NODE_ENTRY = "./src/router.server.gen.tsx";
64
+
65
+ export const CORE_UI_NODE_EXPOSES: Record<string, string> = {
66
+ "./Router": "./src/router.server.gen.tsx",
67
+ "./compose": "./src/compose.gen.ts",
68
+ "./routeConfig": "./src/routeConfig.gen.ts",
69
+ };
70
+
71
+ export function createCoreUiRsbuildConfig({ domain, account }: CoreUiRsbuildConfigInput = {}) {
72
+ const workspaceRoot = process.cwd();
73
+ const pkg = JSON.parse(fs.readFileSync(path.join(workspaceRoot, "package.json"), "utf-8")) as {
74
+ name: string;
75
+ };
76
+
77
+ return createUiRsbuildConfig({
78
+ workspaceRoot,
79
+ pkg,
80
+ role: "provider",
81
+ manifestName: CORE_UI_PLUGIN_KEY,
82
+ devPort: 3003,
83
+ webEntry: CORE_UI_WEB_ENTRY,
84
+ webExposes: CORE_UI_WEB_EXPOSES,
85
+ nodeEntry: CORE_UI_NODE_ENTRY,
86
+ nodeExposes: CORE_UI_NODE_EXPOSES,
87
+ copy: [
88
+ { from: path.join(workspaceRoot, "public"), to: "./" },
89
+ ...platformSkillCopies(workspaceRoot),
90
+ ],
91
+ define: {
92
+ "import.meta.env.APP_NAME": JSON.stringify(domain),
93
+ "import.meta.env.APP_ACCOUNT": JSON.stringify(account),
94
+ },
95
+ });
96
+ }