every-plugin 2.10.1 → 3.0.0-rc.10

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 (480) 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 +59 -0
  25. package/dist/build/rspack/chunk-completeness-plugin.cjs.map +1 -0
  26. package/dist/build/rspack/chunk-completeness-plugin.mjs +59 -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 +122 -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 +114 -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/client.cjs +69 -0
  133. package/dist/client.cjs.map +1 -0
  134. package/dist/client.d.cts +15 -0
  135. package/dist/client.d.cts.map +1 -0
  136. package/dist/client.d.mts +15 -0
  137. package/dist/client.d.mts.map +1 -0
  138. package/dist/client.mjs +68 -0
  139. package/dist/client.mjs.map +1 -0
  140. package/dist/dev/host.cjs +149 -0
  141. package/dist/dev/host.cjs.map +1 -0
  142. package/dist/dev/host.d.cts +32 -0
  143. package/dist/dev/host.d.cts.map +1 -0
  144. package/dist/dev/host.d.mts +32 -0
  145. package/dist/dev/host.d.mts.map +1 -0
  146. package/dist/dev/host.mjs +148 -0
  147. package/dist/dev/host.mjs.map +1 -0
  148. package/dist/dev/serve.cjs +295 -0
  149. package/dist/dev/serve.cjs.map +1 -0
  150. package/dist/dev/serve.d.cts +23 -0
  151. package/dist/dev/serve.d.cts.map +1 -0
  152. package/dist/dev/serve.d.mts +23 -0
  153. package/dist/dev/serve.d.mts.map +1 -0
  154. package/dist/dev/serve.mjs +289 -0
  155. package/dist/dev/serve.mjs.map +1 -0
  156. package/dist/dev/watch-kill.cjs +39 -0
  157. package/dist/dev/watch-kill.cjs.map +1 -0
  158. package/dist/dev/watch-kill.mjs +38 -0
  159. package/dist/dev/watch-kill.mjs.map +1 -0
  160. package/dist/effect-helpers.cjs +23 -0
  161. package/dist/effect-helpers.cjs.map +1 -0
  162. package/dist/effect-helpers.d.cts +20 -0
  163. package/dist/effect-helpers.d.cts.map +1 -0
  164. package/dist/effect-helpers.d.mts +20 -0
  165. package/dist/effect-helpers.d.mts.map +1 -0
  166. package/dist/effect-helpers.mjs +22 -0
  167. package/dist/effect-helpers.mjs.map +1 -0
  168. package/dist/errors.cjs +50 -69
  169. package/dist/errors.cjs.map +1 -1
  170. package/dist/errors.d.cts +13 -96
  171. package/dist/errors.d.cts.map +1 -1
  172. package/dist/errors.d.mts +13 -96
  173. package/dist/errors.d.mts.map +1 -1
  174. package/dist/errors.mjs +16 -34
  175. package/dist/errors.mjs.map +1 -1
  176. package/dist/identity.cjs +19 -0
  177. package/dist/identity.cjs.map +1 -0
  178. package/dist/identity.d.cts +33 -0
  179. package/dist/identity.d.cts.map +1 -0
  180. package/dist/identity.d.mts +33 -0
  181. package/dist/identity.d.mts.map +1 -0
  182. package/dist/identity.mjs +16 -0
  183. package/dist/identity.mjs.map +1 -0
  184. package/dist/index.cjs +11 -5
  185. package/dist/index.d.cts +9 -6
  186. package/dist/index.d.mts +9 -6
  187. package/dist/index.mjs +7 -4
  188. package/dist/plugin.cjs +13 -26
  189. package/dist/plugin.cjs.map +1 -1
  190. package/dist/plugin.d.cts +64 -25
  191. package/dist/plugin.d.cts.map +1 -1
  192. package/dist/plugin.d.mts +64 -25
  193. package/dist/plugin.d.mts.map +1 -1
  194. package/dist/plugin.mjs +16 -29
  195. package/dist/plugin.mjs.map +1 -1
  196. package/dist/remote-entry.cjs +102 -0
  197. package/dist/remote-entry.cjs.map +1 -0
  198. package/dist/remote-entry.d.cts +52 -0
  199. package/dist/remote-entry.d.cts.map +1 -0
  200. package/dist/remote-entry.d.mts +52 -0
  201. package/dist/remote-entry.d.mts.map +1 -0
  202. package/dist/remote-entry.mjs +98 -0
  203. package/dist/remote-entry.mjs.map +1 -0
  204. package/dist/runtime/errors.cjs +159 -33
  205. package/dist/runtime/errors.cjs.map +1 -1
  206. package/dist/runtime/errors.d.cts +64 -7
  207. package/dist/runtime/errors.d.cts.map +1 -1
  208. package/dist/runtime/errors.d.mts +64 -7
  209. package/dist/runtime/errors.d.mts.map +1 -1
  210. package/dist/runtime/errors.mjs +154 -30
  211. package/dist/runtime/errors.mjs.map +1 -1
  212. package/dist/runtime/index.cjs +95 -23
  213. package/dist/runtime/index.cjs.map +1 -1
  214. package/dist/runtime/index.d.cts +16 -0
  215. package/dist/runtime/index.d.cts.map +1 -1
  216. package/dist/runtime/index.d.mts +16 -0
  217. package/dist/runtime/index.d.mts.map +1 -1
  218. package/dist/runtime/index.mjs +98 -26
  219. package/dist/runtime/index.mjs.map +1 -1
  220. package/dist/runtime/mf-config.cjs +3 -78
  221. package/dist/runtime/mf-config.cjs.map +1 -1
  222. package/dist/runtime/mf-config.d.cts +3 -49
  223. package/dist/runtime/mf-config.d.cts.map +1 -1
  224. package/dist/runtime/mf-config.d.mts +3 -49
  225. package/dist/runtime/mf-config.d.mts.map +1 -1
  226. package/dist/runtime/mf-config.mjs +5 -78
  227. package/dist/runtime/mf-config.mjs.map +1 -1
  228. package/dist/runtime/services/module-federation.service.cjs +57 -12
  229. package/dist/runtime/services/module-federation.service.cjs.map +1 -1
  230. package/dist/runtime/services/module-federation.service.d.cts +4 -13
  231. package/dist/runtime/services/module-federation.service.d.mts +4 -13
  232. package/dist/runtime/services/module-federation.service.mjs +57 -14
  233. package/dist/runtime/services/module-federation.service.mjs.map +1 -1
  234. package/dist/runtime/services/normalize.cjs +2 -22
  235. package/dist/runtime/services/normalize.d.cts +2 -21
  236. package/dist/runtime/services/normalize.d.mts +2 -21
  237. package/dist/runtime/services/normalize.mjs +2 -21
  238. package/dist/runtime/services/plugin-lifecycle.service.cjs +9 -11
  239. package/dist/runtime/services/plugin-lifecycle.service.cjs.map +1 -1
  240. package/dist/runtime/services/plugin-lifecycle.service.d.cts +3 -16
  241. package/dist/runtime/services/plugin-lifecycle.service.d.mts +3 -16
  242. package/dist/runtime/services/plugin-lifecycle.service.mjs +10 -13
  243. package/dist/runtime/services/plugin-lifecycle.service.mjs.map +1 -1
  244. package/dist/runtime/services/plugin-loader.service.cjs +59 -30
  245. package/dist/runtime/services/plugin-loader.service.cjs.map +1 -1
  246. package/dist/runtime/services/plugin-loader.service.d.cts +6 -53
  247. package/dist/runtime/services/plugin-loader.service.d.mts +6 -53
  248. package/dist/runtime/services/plugin-loader.service.mjs +58 -31
  249. package/dist/runtime/services/plugin-loader.service.mjs.map +1 -1
  250. package/dist/runtime/services/plugin.service.cjs +10 -12
  251. package/dist/runtime/services/plugin.service.cjs.map +1 -1
  252. package/dist/runtime/services/plugin.service.d.cts +14 -36
  253. package/dist/runtime/services/plugin.service.d.cts.map +1 -1
  254. package/dist/runtime/services/plugin.service.d.mts +14 -36
  255. package/dist/runtime/services/plugin.service.d.mts.map +1 -1
  256. package/dist/runtime/services/plugin.service.mjs +14 -18
  257. package/dist/runtime/services/plugin.service.mjs.map +1 -1
  258. package/dist/runtime/services/secrets.service.cjs +12 -12
  259. package/dist/runtime/services/secrets.service.cjs.map +1 -1
  260. package/dist/runtime/services/secrets.service.d.cts +3 -15
  261. package/dist/runtime/services/secrets.service.d.mts +3 -15
  262. package/dist/runtime/services/secrets.service.mjs +12 -13
  263. package/dist/runtime/services/secrets.service.mjs.map +1 -1
  264. package/dist/runtime/services/shared-identity.cjs +40 -0
  265. package/dist/runtime/services/shared-identity.cjs.map +1 -0
  266. package/dist/runtime/services/shared-identity.mjs +38 -0
  267. package/dist/runtime/services/shared-identity.mjs.map +1 -0
  268. package/dist/runtime/validation.cjs +2 -2
  269. package/dist/runtime/validation.cjs.map +1 -1
  270. package/dist/runtime/validation.mjs +2 -2
  271. package/dist/runtime/validation.mjs.map +1 -1
  272. package/dist/shared-deps-spec.cjs +384 -0
  273. package/dist/shared-deps-spec.cjs.map +1 -0
  274. package/dist/shared-deps-spec.d.cts +182 -0
  275. package/dist/shared-deps-spec.d.cts.map +1 -0
  276. package/dist/shared-deps-spec.d.mts +182 -0
  277. package/dist/shared-deps-spec.d.mts.map +1 -0
  278. package/dist/shared-deps-spec.mjs +368 -0
  279. package/dist/shared-deps-spec.mjs.map +1 -0
  280. package/dist/types.d.cts +47 -41
  281. package/dist/types.d.cts.map +1 -1
  282. package/dist/types.d.mts +47 -41
  283. package/dist/types.d.mts.map +1 -1
  284. package/dist/ui/manifest/construct.cjs +319 -0
  285. package/dist/ui/manifest/construct.cjs.map +1 -0
  286. package/dist/ui/manifest/construct.d.cts +48 -0
  287. package/dist/ui/manifest/construct.d.cts.map +1 -0
  288. package/dist/ui/manifest/construct.d.mts +48 -0
  289. package/dist/ui/manifest/construct.d.mts.map +1 -0
  290. package/dist/ui/manifest/construct.mjs +319 -0
  291. package/dist/ui/manifest/construct.mjs.map +1 -0
  292. package/dist/ui/manifest/contract.cjs +34 -0
  293. package/dist/ui/manifest/contract.cjs.map +1 -0
  294. package/dist/ui/manifest/contract.d.cts +26 -0
  295. package/dist/ui/manifest/contract.d.cts.map +1 -0
  296. package/dist/ui/manifest/contract.d.mts +26 -0
  297. package/dist/ui/manifest/contract.d.mts.map +1 -0
  298. package/dist/ui/manifest/contract.mjs +26 -0
  299. package/dist/ui/manifest/contract.mjs.map +1 -0
  300. package/dist/ui/manifest/descriptor.cjs +64 -0
  301. package/dist/ui/manifest/descriptor.cjs.map +1 -0
  302. package/dist/ui/manifest/descriptor.d.cts +60 -0
  303. package/dist/ui/manifest/descriptor.d.cts.map +1 -0
  304. package/dist/ui/manifest/descriptor.d.mts +60 -0
  305. package/dist/ui/manifest/descriptor.d.mts.map +1 -0
  306. package/dist/ui/manifest/descriptor.mjs +61 -0
  307. package/dist/ui/manifest/descriptor.mjs.map +1 -0
  308. package/dist/ui/manifest/generator.cjs +128 -0
  309. package/dist/ui/manifest/generator.cjs.map +1 -0
  310. package/dist/ui/manifest/generator.d.cts +41 -0
  311. package/dist/ui/manifest/generator.d.cts.map +1 -0
  312. package/dist/ui/manifest/generator.d.mts +41 -0
  313. package/dist/ui/manifest/generator.d.mts.map +1 -0
  314. package/dist/ui/manifest/generator.mjs +125 -0
  315. package/dist/ui/manifest/generator.mjs.map +1 -0
  316. package/dist/ui/manifest/index.cjs +35 -0
  317. package/dist/ui/manifest/index.d.cts +9 -0
  318. package/dist/ui/manifest/index.d.mts +9 -0
  319. package/dist/ui/manifest/index.mjs +9 -0
  320. package/dist/ui/manifest/manifest-schema.cjs +97 -0
  321. package/dist/ui/manifest/manifest-schema.cjs.map +1 -0
  322. package/dist/ui/manifest/manifest-schema.d.cts +132 -0
  323. package/dist/ui/manifest/manifest-schema.d.cts.map +1 -0
  324. package/dist/ui/manifest/manifest-schema.d.mts +132 -0
  325. package/dist/ui/manifest/manifest-schema.d.mts.map +1 -0
  326. package/dist/ui/manifest/manifest-schema.mjs +90 -0
  327. package/dist/ui/manifest/manifest-schema.mjs.map +1 -0
  328. package/dist/ui/manifest/mount-registry.cjs +52 -0
  329. package/dist/ui/manifest/mount-registry.cjs.map +1 -0
  330. package/dist/ui/manifest/mount-registry.d.cts +61 -0
  331. package/dist/ui/manifest/mount-registry.d.cts.map +1 -0
  332. package/dist/ui/manifest/mount-registry.d.mts +61 -0
  333. package/dist/ui/manifest/mount-registry.d.mts.map +1 -0
  334. package/dist/ui/manifest/mount-registry.mjs +48 -0
  335. package/dist/ui/manifest/mount-registry.mjs.map +1 -0
  336. package/dist/ui/manifest/nav.cjs +13 -0
  337. package/dist/ui/manifest/nav.cjs.map +1 -0
  338. package/dist/ui/manifest/nav.d.cts +34 -0
  339. package/dist/ui/manifest/nav.d.cts.map +1 -0
  340. package/dist/ui/manifest/nav.d.mts +34 -0
  341. package/dist/ui/manifest/nav.d.mts.map +1 -0
  342. package/dist/ui/manifest/nav.mjs +13 -0
  343. package/dist/ui/manifest/nav.mjs.map +1 -0
  344. package/dist/ui/manifest/route-config.cjs +33 -0
  345. package/dist/ui/manifest/route-config.cjs.map +1 -0
  346. package/dist/ui/manifest/route-config.d.cts +40 -0
  347. package/dist/ui/manifest/route-config.d.cts.map +1 -0
  348. package/dist/ui/manifest/route-config.d.mts +40 -0
  349. package/dist/ui/manifest/route-config.d.mts.map +1 -0
  350. package/dist/ui/manifest/route-config.mjs +33 -0
  351. package/dist/ui/manifest/route-config.mjs.map +1 -0
  352. package/dist/version-manifest.cjs +77 -0
  353. package/dist/version-manifest.cjs.map +1 -0
  354. package/dist/version-manifest.d.cts +62 -0
  355. package/dist/version-manifest.d.cts.map +1 -0
  356. package/dist/version-manifest.d.mts +62 -0
  357. package/dist/version-manifest.d.mts.map +1 -0
  358. package/dist/version-manifest.mjs +75 -0
  359. package/dist/version-manifest.mjs.map +1 -0
  360. package/package.json +182 -68
  361. package/skills/plugin-client/SKILL.md +34 -9
  362. package/skills/plugin-development/SKILL.md +79 -47
  363. package/skills/plugin-testing/SKILL.md +42 -12
  364. package/src/build/artifact-names.ts +117 -0
  365. package/src/build/contract-types.ts +101 -0
  366. package/src/build/rspack/build-report-plugin.ts +34 -0
  367. package/src/build/rspack/chunk-completeness-plugin.ts +66 -0
  368. package/src/build/rspack/compose.ts +87 -0
  369. package/src/build/rspack/fix-mf-data-uri-plugin.ts +23 -12
  370. package/src/build/rspack/generated-config.ts +35 -0
  371. package/src/build/rspack/index.ts +10 -5
  372. package/src/build/rspack/module-federation.ts +1 -1
  373. package/src/build/rspack/plugin.ts +103 -105
  374. package/src/build/rspack/utils.ts +8 -2
  375. package/src/build/ui/factory.ts +96 -0
  376. package/src/build/ui/generated-config.ts +137 -0
  377. package/src/build/ui/hash-artifacts-plugin.ts +79 -0
  378. package/src/build/ui/index.ts +98 -0
  379. package/src/build/ui/manifest-plugin.ts +54 -0
  380. package/src/build/ui/rsbuild-config.ts +256 -0
  381. package/src/build/ui/stubs.ts +103 -0
  382. package/src/cli.ts +100 -0
  383. package/src/client.ts +111 -0
  384. package/src/dev/host.ts +235 -0
  385. package/src/dev/serve.ts +359 -0
  386. package/src/dev/watch-kill.ts +58 -0
  387. package/src/effect-helpers.ts +25 -0
  388. package/src/errors.ts +17 -18
  389. package/src/identity.ts +36 -0
  390. package/src/index.ts +13 -0
  391. package/src/plugin.ts +94 -91
  392. package/src/remote-entry.ts +170 -0
  393. package/src/runtime/errors.ts +229 -26
  394. package/src/runtime/index.ts +132 -43
  395. package/src/runtime/mf-config.ts +12 -107
  396. package/src/runtime/services/module-federation.service.ts +218 -117
  397. package/src/runtime/services/normalize.ts +1 -18
  398. package/src/runtime/services/plugin-lifecycle.service.ts +66 -75
  399. package/src/runtime/services/plugin-loader.service.ts +280 -209
  400. package/src/runtime/services/plugin.service.ts +61 -43
  401. package/src/runtime/services/secrets.service.ts +20 -15
  402. package/src/runtime/services/shared-identity.ts +68 -0
  403. package/src/runtime/validation.ts +5 -7
  404. package/src/shared-deps-spec.ts +478 -0
  405. package/src/types.ts +62 -50
  406. package/src/ui/manifest/construct.ts +456 -0
  407. package/src/ui/manifest/contract.ts +33 -0
  408. package/src/ui/manifest/descriptor.ts +96 -0
  409. package/src/ui/manifest/generator.ts +238 -0
  410. package/src/ui/manifest/index.ts +55 -0
  411. package/src/ui/manifest/manifest-schema.ts +107 -0
  412. package/src/ui/manifest/mount-registry.ts +50 -0
  413. package/src/ui/manifest/nav.ts +43 -0
  414. package/src/ui/manifest/route-config.ts +82 -0
  415. package/src/version-manifest.ts +106 -0
  416. package/dist/build/rspack/dev-server-middleware.cjs +0 -248
  417. package/dist/build/rspack/dev-server-middleware.cjs.map +0 -1
  418. package/dist/build/rspack/dev-server-middleware.mjs +0 -247
  419. package/dist/build/rspack/dev-server-middleware.mjs.map +0 -1
  420. package/dist/build/shared-deps.cjs +0 -83
  421. package/dist/build/shared-deps.cjs.map +0 -1
  422. package/dist/build/shared-deps.d.cts +0 -67
  423. package/dist/build/shared-deps.d.cts.map +0 -1
  424. package/dist/build/shared-deps.d.mts +0 -67
  425. package/dist/build/shared-deps.d.mts.map +0 -1
  426. package/dist/build/shared-deps.mjs +0 -79
  427. package/dist/build/shared-deps.mjs.map +0 -1
  428. package/dist/effect.cjs +0 -9
  429. package/dist/effect.d.cts +0 -1
  430. package/dist/effect.d.mts +0 -1
  431. package/dist/effect.mjs +0 -3
  432. package/dist/orpc-openapi.cjs +0 -17
  433. package/dist/orpc-openapi.d.cts +0 -2
  434. package/dist/orpc-openapi.d.mts +0 -2
  435. package/dist/orpc-openapi.mjs +0 -5
  436. package/dist/orpc.cjs +0 -46
  437. package/dist/orpc.d.cts +0 -7
  438. package/dist/orpc.d.mts +0 -7
  439. package/dist/orpc.mjs +0 -11
  440. package/dist/package.cjs +0 -23
  441. package/dist/package.cjs.map +0 -1
  442. package/dist/package.mjs +0 -17
  443. package/dist/package.mjs.map +0 -1
  444. package/dist/runtime/services/module-federation.service.d.cts.map +0 -1
  445. package/dist/runtime/services/module-federation.service.d.mts.map +0 -1
  446. package/dist/runtime/services/normalize.cjs.map +0 -1
  447. package/dist/runtime/services/normalize.d.cts.map +0 -1
  448. package/dist/runtime/services/normalize.d.mts.map +0 -1
  449. package/dist/runtime/services/normalize.mjs.map +0 -1
  450. package/dist/runtime/services/plugin-lifecycle.service.d.cts.map +0 -1
  451. package/dist/runtime/services/plugin-lifecycle.service.d.mts.map +0 -1
  452. package/dist/runtime/services/plugin-loader.service.d.cts.map +0 -1
  453. package/dist/runtime/services/plugin-loader.service.d.mts.map +0 -1
  454. package/dist/runtime/services/secrets.service.d.cts.map +0 -1
  455. package/dist/runtime/services/secrets.service.d.mts.map +0 -1
  456. package/dist/testing/index.cjs +0 -57
  457. package/dist/testing/index.cjs.map +0 -1
  458. package/dist/testing/index.d.cts +0 -54
  459. package/dist/testing/index.d.cts.map +0 -1
  460. package/dist/testing/index.d.mts +0 -54
  461. package/dist/testing/index.d.mts.map +0 -1
  462. package/dist/testing/index.mjs +0 -55
  463. package/dist/testing/index.mjs.map +0 -1
  464. package/dist/zod-core.cjs +0 -9
  465. package/dist/zod-core.d.cts +0 -1
  466. package/dist/zod-core.d.mts +0 -1
  467. package/dist/zod-core.mjs +0 -3
  468. package/dist/zod.cjs +0 -11
  469. package/dist/zod.d.cts +0 -2
  470. package/dist/zod.d.mts +0 -2
  471. package/dist/zod.mjs +0 -3
  472. package/src/build/rspack/dev-server-middleware.ts +0 -324
  473. package/src/build/shared-deps.ts +0 -102
  474. package/src/effect.ts +0 -1
  475. package/src/orpc-openapi.ts +0 -2
  476. package/src/orpc.ts +0 -9
  477. package/src/testing/index.ts +0 -87
  478. package/src/testing/mocks/module-federation.service.ts +0 -41
  479. package/src/zod-core.ts +0 -1
  480. package/src/zod.ts +0 -3
@@ -0,0 +1,359 @@
1
+ import { spawn } from "node:child_process";
2
+ import fs from "node:fs";
3
+ import http from "node:http";
4
+ import path from "node:path";
5
+ import { Effect } from "effect";
6
+ import sirv from "sirv";
7
+ import { DEV_ENTRY_FILENAME } from "../build/artifact-names";
8
+ import { ensureGeneratedRspackConfig } from "../build/rspack/generated-config";
9
+ import { getPluginInfo, loadDevConfig } from "../build/rspack/utils";
10
+ import {
11
+ ensureGeneratedUiRsbuildConfig,
12
+ pluginLayoutKey,
13
+ uiDistDirFor,
14
+ } from "../build/ui/generated-config";
15
+ import { PLUGIN_ERROR_STATUS_MAP } from "../errors";
16
+ import { loadRemoteWithRetry } from "../remote-entry";
17
+ import { startDirectModuleHost } from "./host";
18
+ import { killChildEscalating, watchParentDeath } from "./watch-kill";
19
+
20
+ const corsHeaders = {
21
+ "Access-Control-Allow-Origin": "*",
22
+ "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
23
+ "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization",
24
+ };
25
+
26
+ const applyCorsHeaders = (res: http.ServerResponse) => {
27
+ Object.entries(corsHeaders).forEach(([key, value]) => {
28
+ res.setHeader(key, value);
29
+ });
30
+ };
31
+
32
+ const normalizePrefix = (prefix?: string): string => {
33
+ if (!prefix) return "";
34
+ const cleaned = prefix.replace(/^\/+|\/+$/g, "");
35
+ return cleaned ? `/${cleaned}` : "";
36
+ };
37
+
38
+ const readRuntimeConfigFromEnv = (): any => {
39
+ const raw = process.env.BOS_RUNTIME_CONFIG;
40
+ if (!raw) return null;
41
+ try {
42
+ return JSON.parse(raw);
43
+ } catch {
44
+ return null;
45
+ }
46
+ };
47
+
48
+ const collectSiblingRemotes = (runtimeConfig: any, pluginId: string) => {
49
+ const siblings: Record<string, { remote: string }> = {};
50
+
51
+ const isApi = pluginId === "api" || runtimeConfig?.api?.name === pluginId;
52
+
53
+ const ownKey = runtimeConfig?.plugins?.[pluginId] ? pluginId : null;
54
+ let dependsOn: string[] = [];
55
+ if (ownKey) {
56
+ dependsOn = runtimeConfig.plugins[ownKey].dependsOn ?? [];
57
+ } else if (isApi) {
58
+ dependsOn = runtimeConfig?.api?.dependsOn ?? [];
59
+ }
60
+
61
+ for (const depId of dependsOn) {
62
+ const dep = runtimeConfig?.plugins?.[depId];
63
+ if (!dep || dep.source !== "local" || !dep.url) continue;
64
+ if (depId === pluginId) continue;
65
+ const base = dep.url.replace(/\/$/, "");
66
+ siblings[depId] = { remote: `${base}/${DEV_ENTRY_FILENAME}` };
67
+ }
68
+
69
+ return { siblings, dependsOn };
70
+ };
71
+
72
+ const loadPluginWithRetry = (
73
+ runtime: any,
74
+ pluginId: string,
75
+ remoteUrl: string,
76
+ options: Record<string, unknown> = { variables: {}, secrets: {} },
77
+ pluginsMap?: Record<string, unknown>,
78
+ timeoutMs = 90000,
79
+ ): Promise<any> =>
80
+ Effect.runPromise(
81
+ loadRemoteWithRetry({
82
+ label: pluginId,
83
+ remoteUrl,
84
+ load: () => runtime.usePlugin(pluginId, options, pluginsMap),
85
+ timeoutMs,
86
+ }),
87
+ );
88
+
89
+ const sendText = (res: http.ServerResponse, status: number, text: string) => {
90
+ res.statusCode = status;
91
+ res.setHeader("content-type", "text/plain; charset=utf-8");
92
+ res.end(text);
93
+ };
94
+
95
+ export interface PluginDevServeOptions {
96
+ cwd?: string;
97
+ port?: number;
98
+ watch?: boolean;
99
+ }
100
+
101
+ export interface PluginDevServerHandle {
102
+ port: number;
103
+ close: () => Promise<void>;
104
+ }
105
+
106
+ /**
107
+ * The dev server's plugin id — the workspace's npm package name, the same
108
+ * value the host passes as `runtimeId`. Both initialize sites must agree:
109
+ * `registerRemote` derives the MF remote name from it, and the plugin's
110
+ * database layer derives its migration slug from it, so a pre-normalized
111
+ * remote name here would migrate into a different schema than the host
112
+ * expects. plugin.dev.ts no longer carries a pluginId field.
113
+ */
114
+ export const resolveDevPluginId = (cwd: string): string => getPluginInfo(cwd).name;
115
+
116
+ export async function startPluginDevServer(
117
+ options: PluginDevServeOptions = {},
118
+ ): Promise<PluginDevServerHandle> {
119
+ process.env.BOS_DEV_SERVER = "1";
120
+ const cwd = options.cwd ?? process.cwd();
121
+ const pluginInfo = getPluginInfo(cwd);
122
+ const devConfig = loadDevConfig(path.join(cwd, "plugin.dev.ts"));
123
+ const pluginId = resolveDevPluginId(cwd);
124
+ const compositionKey = pluginLayoutKey(cwd) ?? pluginId;
125
+ const port = options.port ?? (Number(process.env.PORT) || devConfig?.port || 3999);
126
+ const rpcPrefix = normalizePrefix(devConfig?.prefix);
127
+
128
+ const distDir = path.join(cwd, "dist");
129
+ const serveStatic = sirv(distDir, { dev: true });
130
+
131
+ // No-watch mode (BOS_NO_WATCH=1): build once, serve the built output.
132
+ // Regression/CI stacks need no hot reload — watchers are the stack's
133
+ // heaviest processes and stall runs freeze under their accumulated
134
+ // footprint. One-shot builds exit; steady state is small static servers.
135
+ const noWatch = options.watch === false || process.env.BOS_NO_WATCH === "1";
136
+
137
+ const runOnce = (cmd: string, args: string[]) =>
138
+ new Promise<void>((resolve, reject) => {
139
+ const child = spawn(cmd, args, { cwd, stdio: "inherit", env: process.env });
140
+ child.on("error", reject);
141
+ child.on("exit", (code) => {
142
+ if (code === 0) resolve();
143
+ else reject(new Error(`❌ ${cmd} ${args.join(" ")} exited with ${code}`));
144
+ });
145
+ });
146
+
147
+ let watcher: ReturnType<typeof spawn> | null = null;
148
+ if (noWatch) {
149
+ const generatedConfig = ensureGeneratedRspackConfig(cwd);
150
+ await runOnce("rspack", generatedConfig ? ["build", "--config", generatedConfig] : ["build"]);
151
+ } else if (options.watch !== false) {
152
+ const generatedConfig = ensureGeneratedRspackConfig(cwd);
153
+ watcher = spawn(
154
+ "rspack",
155
+ generatedConfig ? ["build", "--watch", "--config", generatedConfig] : ["build", "--watch"],
156
+ {
157
+ cwd,
158
+ stdio: "inherit",
159
+ env: process.env,
160
+ },
161
+ );
162
+ watcher.on("error", (error) => {
163
+ console.error(`❌ Failed to spawn rspack build --watch: ${error.message}`);
164
+ });
165
+ }
166
+
167
+ let uiWatcher: ReturnType<typeof spawn> | null = null;
168
+ let uiStaticServer: http.Server | null = null;
169
+ const uiPort = process.env.BOS_UI_PORT;
170
+ const uiConfig = ensureGeneratedUiRsbuildConfig(cwd);
171
+ if (uiConfig && noWatch && uiPort) {
172
+ // Folder-form ui: one-shot build, then serve the ui source root's dist
173
+ // (the factory's absolute distPath target) statically on the ui port.
174
+ await runOnce("rsbuild", ["build", "--config", uiConfig]);
175
+ const uiDistDir = uiDistDirFor(cwd);
176
+ if (!fs.existsSync(path.join(uiDistDir, DEV_ENTRY_FILENAME))) {
177
+ throw new Error(
178
+ `❌ UI dist is missing at ${uiDistDir} after the rsbuild one-shot — build output layout mismatch?`,
179
+ );
180
+ }
181
+ const serveUiStatic = sirv(uiDistDir, { dev: true });
182
+ uiStaticServer = http.createServer((req, res) => {
183
+ applyCorsHeaders(res);
184
+ serveUiStatic(req, res, () => {
185
+ sendText(res, 404, "Not Found");
186
+ });
187
+ });
188
+ await new Promise<void>((resolve, reject) => {
189
+ uiStaticServer!.once("error", reject);
190
+ uiStaticServer!.listen(Number(uiPort), () => resolve());
191
+ });
192
+ console.log(`├─ 🎨 UI: http://localhost:${uiPort} (built, no watch)`);
193
+ } else if (uiConfig) {
194
+ uiWatcher = spawn("rsbuild", ["dev", "--config", uiConfig], {
195
+ cwd,
196
+ stdio: "inherit",
197
+ env: uiPort ? { ...process.env, PORT: uiPort } : process.env,
198
+ });
199
+ uiWatcher.on("error", (error) => {
200
+ console.error(`❌ Failed to spawn rsbuild ui dev: ${error.message}`);
201
+ });
202
+ console.log(`├─ 🎨 UI: ${uiPort ? `http://localhost:${uiPort}` : "(rsbuild auto port)"}`);
203
+ }
204
+
205
+ const handlers: { rpc: any; api: any } = { rpc: null, api: null };
206
+ const effectContextHolder: { context: unknown } = { context: null };
207
+ let runtime: { shutdown: () => Promise<void> } | null = null;
208
+ const host = await startDirectModuleHost({
209
+ name: pluginInfo.normalizedName,
210
+ version: pluginInfo.version,
211
+ handlers,
212
+ effectContext: () => effectContextHolder.context,
213
+ port,
214
+ staticHandler: serveStatic,
215
+ });
216
+
217
+ console.log(`🚀 ${pluginInfo.name} dev server listening on port ${host.port}`);
218
+ console.log(`├─ 📡 RPC: http://localhost:${host.port}/api/rpc${rpcPrefix}`);
219
+ console.log(`├─ 📖 Docs: http://localhost:${host.port}/api`);
220
+ console.log(`└─ 💚 Health: http://localhost:${host.port}/`);
221
+
222
+ const load = async () => {
223
+ try {
224
+ // Import framework internals directly. A package self-import can resolve
225
+ // the published entry while this source-first dev server is running,
226
+ // which leaves the runtime exports unavailable on Windows.
227
+ const { createPluginRuntime } = await import("../runtime");
228
+ const { RPCHandler } = await import("@orpc/server/fetch");
229
+ const { OpenAPIHandler } = await import("@orpc/openapi/fetch");
230
+ const { OpenAPIGenerator } = await import("@orpc/openapi");
231
+ const { OpenAPIReferenceHandlerPlugin } = await import("@orpc/openapi/plugins");
232
+ const { ZodToJsonSchemaConverter } = await import("@orpc/zod");
233
+ const { onError } = await import("@orpc/server");
234
+ const { formatORPCError } = await import("../errors");
235
+
236
+ const runtimeConfig = readRuntimeConfigFromEnv();
237
+ const { siblings, dependsOn } = collectSiblingRemotes(runtimeConfig, compositionKey);
238
+
239
+ if (dependsOn.length > 0) {
240
+ console.log(`🔗 Loading sibling plugin(s): ${dependsOn.join(", ")}`);
241
+ }
242
+
243
+ const registry: Record<string, { remote: string }> = {
244
+ [pluginId]: {
245
+ remote: `http://localhost:${host.port}/${DEV_ENTRY_FILENAME}`,
246
+ },
247
+ ...siblings,
248
+ };
249
+
250
+ const mfRuntime = createPluginRuntime({ registry });
251
+ runtime = mfRuntime;
252
+
253
+ const pluginsMap: Record<string, unknown> = {};
254
+ const siblingEffectContexts: unknown[] = [];
255
+ for (const depId of Object.keys(siblings)) {
256
+ const dep = await loadPluginWithRetry(mfRuntime, depId, siblings[depId]!.remote);
257
+ pluginsMap[depId] = { client: dep.createClient, router: dep.router };
258
+ if (dep.initialized?.effectContext) {
259
+ siblingEffectContexts.push(dep.initialized.effectContext);
260
+ }
261
+ console.log(`✅ Loaded dependency plugin: ${depId}`);
262
+ }
263
+
264
+ const loaded: any = await loadPluginWithRetry(
265
+ mfRuntime,
266
+ pluginId,
267
+ registry[pluginId]!.remote,
268
+ (devConfig?.config ?? { variables: {}, secrets: {} }) as Record<string, unknown>,
269
+ Object.keys(pluginsMap).length > 0 ? pluginsMap : undefined,
270
+ );
271
+
272
+ const { Context } = await import("effect");
273
+ effectContextHolder.context = [loaded.initialized?.effectContext, ...siblingEffectContexts]
274
+ .filter(Boolean)
275
+ .reduce((acc: any, ctx: any) => Context.merge(acc, ctx), Context.empty());
276
+
277
+ handlers.rpc = new RPCHandler(loaded.router, {
278
+ errorStatusMap: PLUGIN_ERROR_STATUS_MAP,
279
+ interceptors: [
280
+ onError((error: any) => {
281
+ const formatted = formatORPCError(error);
282
+ if (formatted) console.error(formatted);
283
+ }),
284
+ ],
285
+ });
286
+
287
+ const generator = new OpenAPIGenerator({ converters: [new ZodToJsonSchemaConverter()] });
288
+
289
+ handlers.api = new OpenAPIHandler(loaded.router, {
290
+ errorStatusMap: PLUGIN_ERROR_STATUS_MAP,
291
+ plugins: [
292
+ new OpenAPIReferenceHandlerPlugin({
293
+ spec: () => generator.generate(loaded.router, { version: "3.1.1" }),
294
+ }),
295
+ ],
296
+ interceptors: [
297
+ onError((error: any) => {
298
+ const formatted = formatORPCError(error);
299
+ if (formatted) console.error(formatted);
300
+ }),
301
+ ],
302
+ });
303
+
304
+ console.log(`✅ Plugin ready: ${pluginId}`);
305
+ } catch (error) {
306
+ console.error(`❌ Failed to load plugin ${pluginId}:`, error);
307
+ console.error(" Server stays up; fix the build and retry via rebuild.");
308
+ }
309
+ };
310
+
311
+ void load();
312
+
313
+ const close = async () => {
314
+ handlers.rpc = null;
315
+ handlers.api = null;
316
+ effectContextHolder.context = null;
317
+ for (const child of [watcher, uiWatcher]) {
318
+ if (child) {
319
+ await killChildEscalating(child);
320
+ }
321
+ }
322
+ if (uiStaticServer) {
323
+ await new Promise<void>((resolve) => uiStaticServer.close(() => resolve()));
324
+ }
325
+ await host.close();
326
+ if (runtime) await runtime.shutdown().catch(() => {});
327
+ };
328
+
329
+ process.once("SIGINT", async () => {
330
+ const timeout = setTimeout(() => process.exit(0), 3000);
331
+ await close();
332
+ clearTimeout(timeout);
333
+ process.exit(0);
334
+ });
335
+ process.once("SIGTERM", async () => {
336
+ const timeout = setTimeout(() => process.exit(0), 3000);
337
+ await close();
338
+ clearTimeout(timeout);
339
+ process.exit(0);
340
+ });
341
+
342
+ watchParentDeath(async () => {
343
+ const timeout = setTimeout(() => process.exit(0), 3000);
344
+ await close();
345
+ clearTimeout(timeout);
346
+ process.exit(0);
347
+ });
348
+
349
+ return { port, close };
350
+ }
351
+
352
+ const invokedAsCli = import.meta.main || (process.argv[1] ?? "").includes("every-plugin-serve");
353
+
354
+ if (invokedAsCli) {
355
+ startPluginDevServer().catch((error) => {
356
+ console.error("❌ Plugin dev server fatal error:", error);
357
+ process.exit(1);
358
+ });
359
+ }
@@ -0,0 +1,58 @@
1
+ interface KillableChild {
2
+ pid?: number | undefined;
3
+ kill: (signal?: NodeJS.Signals) => void;
4
+ exitCode: number | null;
5
+ killed: boolean;
6
+ addListener: (event: "exit", listener: () => void) => unknown;
7
+ removeListener: (event: "exit", listener: () => void) => unknown;
8
+ }
9
+
10
+ const waitForExit = (child: KillableChild, timeoutMs: number): Promise<boolean> =>
11
+ new Promise((resolve) => {
12
+ if (child.exitCode !== null) {
13
+ resolve(true);
14
+ return;
15
+ }
16
+ const onExit = () => {
17
+ clearTimeout(timer);
18
+ resolve(true);
19
+ };
20
+ const timer = setTimeout(() => {
21
+ child.removeListener("exit", onExit);
22
+ resolve(false);
23
+ }, timeoutMs);
24
+ child.addListener("exit", onExit);
25
+ });
26
+
27
+ export const killChildEscalating = async (
28
+ child: KillableChild,
29
+ terminateMs = 2000,
30
+ ): Promise<void> => {
31
+ if (child.exitCode !== null || child.killed) return;
32
+ child.kill("SIGTERM");
33
+ const exited = await waitForExit(child, terminateMs);
34
+ if (!exited) child.kill("SIGKILL");
35
+ };
36
+
37
+ export interface WatchParentDeathOptions {
38
+ intervalMs?: number;
39
+ getPpid?: () => number;
40
+ onParentDeath?: () => void | Promise<void>;
41
+ }
42
+
43
+ export const watchParentDeath = (
44
+ onParentDeath: () => void | Promise<void>,
45
+ opts?: Omit<WatchParentDeathOptions, "onParentDeath">,
46
+ ): { stop: () => void } => {
47
+ const getPpid = opts?.getPpid ?? (() => process.ppid);
48
+ const intervalMs = opts?.intervalMs ?? 200;
49
+ const initialPpid = getPpid();
50
+ const timer = setInterval(() => {
51
+ if (getPpid() !== initialPpid) {
52
+ clearInterval(timer);
53
+ void onParentDeath();
54
+ }
55
+ }, intervalMs);
56
+ timer.unref?.();
57
+ return { stop: () => clearInterval(timer) };
58
+ };
@@ -0,0 +1,25 @@
1
+ import { Context, Effect, Layer, type Scope } from "effect";
2
+
3
+ /**
4
+ * Builds a layer with the current scope and returns the built context.
5
+ *
6
+ * Resources are released when the plugin's scope closes. Use inside
7
+ * `initialize` for multi-service layers; resolve individual services from
8
+ * the returned context with `Context.get`.
9
+ */
10
+ export const buildScopedContext = <A, E, R>(
11
+ layer: Layer.Layer<A, E, R>,
12
+ ): Effect.Effect<Context.Context<A>, E, Scope.Scope | R> =>
13
+ Effect.flatMap(Effect.scope, (scope) => Layer.buildWithScope(layer, scope));
14
+
15
+ /**
16
+ * Builds a layer with the current scope and resolves one service from it.
17
+ *
18
+ * Equivalent to `buildScopedContext` + `Context.get` for single-service
19
+ * layers: `const db = yield* buildScoped(DatabaseTag, DatabaseLive(url))`.
20
+ */
21
+ export const buildScoped = <Identifier, Shape, E, R>(
22
+ tag: Context.Service<Identifier, Shape>,
23
+ layer: Layer.Layer<Identifier, E, R>,
24
+ ): Effect.Effect<Shape, E, Scope.Scope | R> =>
25
+ buildScopedContext(layer).pipe(Effect.map((context) => Context.get(context, tag)));
package/src/errors.ts CHANGED
@@ -1,18 +1,5 @@
1
- import { z } from "./zod";
2
-
3
- /**
4
- * Error pattern constants for categorizing infrastructure errors
5
- */
6
- export const ERROR_PATTERNS = {
7
- CONNECTION_REFUSED: ["ECONNREFUSED"],
8
- HOST_NOT_FOUND: ["ENOTFOUND", "EHOSTUNREACH"],
9
- TIMEOUT: ["ETIMEDOUT", "ESOCKETTIMEDOUT", "timeout"],
10
- CONNECTION_RESET: ["ECONNRESET", "EPIPE"],
11
- PERMISSION: ["EACCES", "EPERM", "permission denied"],
12
- AUTH: ["401", "unauthorized", "authentication failed"],
13
- RATE_LIMITED: ["429", "too many requests", "rate limit"],
14
- SERVICE_UNAVAILABLE: ["503", "service unavailable"],
15
- } as const;
1
+ import { COMMON_ERROR_STATUS_MAP } from "@orpc/server";
2
+ import { z } from "zod";
16
3
 
17
4
  /**
18
5
  * Common error schemas for plugin contracts.
@@ -124,14 +111,26 @@ export const PluginErrors = {
124
111
  } as const;
125
112
 
126
113
  /**
127
- * @deprecated Use individual imports or PluginErrors instead
114
+ * Error-code -> HTTP-status map for handlers.
115
+ *
116
+ * oRPC v2 resolves statuses at the handler boundary via `errorStatusMap`
117
+ * (default `COMMON_ERROR_STATUS_MAP`, where TIMEOUT is 408). Providing a
118
+ * map REPLACES the default entirely, so the standard codes must be spread
119
+ * back in. These custom entries preserve the v1 wire behavior:
120
+ * TIMEOUT -> 504, CONNECTION_ERROR -> 502.
128
121
  */
129
- export const CommonPluginErrors = PluginErrors;
122
+ export const PLUGIN_ERROR_STATUS_MAP: Record<string, number> = {
123
+ ...COMMON_ERROR_STATUS_MAP,
124
+ TIMEOUT: 504,
125
+ CONNECTION_ERROR: 502,
126
+ } as const;
130
127
 
128
+ export type { PluginLoadFailureInfo, PluginWarningInfo } from "./runtime/errors";
131
129
  export {
130
+ classifyPluginFailure,
131
+ defaultMissingSecretWarnings,
132
132
  extractFromFiberFailure,
133
133
  formatORPCError,
134
- isRetryableORPCCode,
135
134
  ModuleFederationError,
136
135
  PluginRuntimeError,
137
136
  toPluginRuntimeError,
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Plugin identity: every name a plugin workspace carries, derived from one
3
+ * input. Two seams live here:
4
+ *
5
+ * - `remoteName`/`containerName` absorb the framework's two normalizers (the
6
+ * Module Federation remote name and the UI container name) — runtime,
7
+ * build, and host consumers delegate to these instead of keeping private
8
+ * copies, so a name can never disagree across contexts.
9
+ * - `identity` derives the full name set from the config layout key (the
10
+ * `plugins/<key>` attachment in `bos.config.json`): the key itself (the
11
+ * composition key), the npm package name under the scaffold convention,
12
+ * and the two normalized build names.
13
+ *
14
+ * Normalization rules:
15
+ * - remote: lowercase, strip a single leading '@', replace '/' with '_',
16
+ * preserve hyphens and other characters
17
+ * ("@scope/my-plugin" → "scope_my-plugin")
18
+ * - container: replace every character outside [A-Za-z0-9_] with '_'
19
+ * ("@everything-dev/auth-plugin" → "_everything_dev_auth_plugin")
20
+ */
21
+ export interface PluginIdentity {
22
+ key: string;
23
+ npm: string;
24
+ remote: string;
25
+ container: string;
26
+ }
27
+
28
+ export const remoteName = (name: string): string =>
29
+ name.toLowerCase().replace(/^@/, "").replace(/\//g, "_");
30
+
31
+ export const containerName = (pkgName: string): string => pkgName.replace(/[^A-Za-z0-9_]/g, "_");
32
+
33
+ export const identity = (key: string): PluginIdentity => {
34
+ const npm = `@everything-dev/${key}-plugin`;
35
+ return { key, npm, remote: remoteName(npm), container: containerName(npm) };
36
+ };
package/src/index.ts CHANGED
@@ -1,3 +1,7 @@
1
+ import "@orpc/openapi/extensions/route";
2
+
3
+ export * from "./client";
4
+ export * from "./effect-helpers";
1
5
  export * from "./errors";
2
6
  export * from "./plugin";
3
7
  export * from "./runtime";
@@ -10,16 +14,25 @@ export type {
10
14
  EveryPlugin,
11
15
  InitializedPlugin,
12
16
  LoadedPlugin,
17
+ ModuleClientEntry,
18
+ ModuleEndpoint,
19
+ ModuleSurface,
20
+ ModuleTransport,
21
+ PluginClientEntry,
13
22
  PluginClientType,
14
23
  PluginConfigInput,
15
24
  PluginContext,
16
25
  PluginContract,
26
+ PluginEndpoint,
17
27
  PluginInstance,
18
28
  PluginMetadata,
19
29
  PluginRegistry,
20
30
  PluginRouterType,
21
31
  PluginRuntimeConfig,
22
32
  PluginSecrets,
33
+ PluginServicesEntry,
34
+ PluginSurface,
35
+ PluginTransport,
23
36
  PluginVariables,
24
37
  RegisteredPlugins,
25
38
  SecretsConfig,