every-plugin 2.10.1 → 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 -248
  399. package/dist/build/rspack/dev-server-middleware.cjs.map +0 -1
  400. package/dist/build/rspack/dev-server-middleware.mjs +0 -247
  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 -324
  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
package/dist/types.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Plugin } from "./plugin.mjs";
2
+ import { Context, Scope } from "effect";
3
+ import { ContractedRouter, RouterClient } from "@orpc/server";
2
4
  import { AnyContractRouter, AnySchema, InferSchemaInput, InferSchemaOutput } from "@orpc/contract";
3
- import { Scope } from "effect";
4
- import { Router, RouterClient } from "@orpc/server";
5
5
  //#region src/types.d.ts
6
6
  /**
7
7
  * Registry bindings interface - populated via module augmentation
@@ -19,7 +19,7 @@ interface RegisteredPlugins {}
19
19
  /**
20
20
  * Base type for any plugin instance.
21
21
  */
22
- type AnyPlugin = Plugin<AnyContractRouter, AnySchema, AnySchema, AnySchema | undefined, any>;
22
+ type AnyPlugin = Plugin<AnyContractRouter, AnySchema, AnySchema, AnySchema | undefined>;
23
23
  /**
24
24
  * Loaded plugin constructor with binding information
25
25
  */
@@ -93,11 +93,20 @@ type PluginContext<T> = T extends {
93
93
  * Extract router type from plugin binding
94
94
  * Uses 'any' for context to support nested router compositions
95
95
  */
96
- type PluginRouterType<T> = Router<PluginContract<T>, any>;
96
+ type PluginRouterType<T> = ContractedRouter<PluginContract<T>, any>;
97
97
  /**
98
98
  * Extract client type from plugin binding
99
99
  */
100
100
  type PluginClientType<T> = RouterClient<PluginRouterType<T>>;
101
+ /**
102
+ * Sibling plugin entry passed to `initialize` and `createRouter`.
103
+ * `client` creates a typed in-process client for the plugin's router;
104
+ * `router` is the raw implemented router for cross-plugin merging.
105
+ */
106
+ type PluginServicesEntry<T = any> = {
107
+ client: (context?: PluginContextInput<T>) => PluginClientType<T>;
108
+ router: PluginRouterType<T>;
109
+ };
101
110
  /**
102
111
  * Extract plugin type from registered plugins by key
103
112
  * @param K - The plugin key
@@ -110,11 +119,7 @@ type RegisteredPlugin<K extends keyof R, R = RegisteredPlugins> = R[K] extends {
110
119
  variables: infer V extends AnySchema;
111
120
  secrets: infer S extends AnySchema;
112
121
  context: infer TRequestContext extends AnySchema | undefined;
113
- } ? Plugin<C, V, S, TRequestContext, any> : never : never;
114
- /**
115
- * Extract plugin constructor type from registry entry
116
- */
117
- type PluginConstructor<K extends keyof R, R = RegisteredPlugins> = RegisteredPlugin<K, R>;
122
+ } ? Plugin<C, V, S, TRequestContext> : never : never;
118
123
  /**
119
124
  * Extract context input type from plugin binding (for client creation)
120
125
  */
@@ -126,10 +131,6 @@ type PluginConfigInput<T> = {
126
131
  variables: InferSchemaInput<PluginVariables<T>>;
127
132
  secrets: InferSchemaInput<PluginSecrets<T>>;
128
133
  };
129
- /**
130
- * Extract deps context type from plugin instance (used for initialization)
131
- */
132
- type ContextOf<T extends AnyPlugin> = T extends Plugin<AnyContractRouter, AnySchema, AnySchema, AnySchema | undefined, infer TDeps> ? TDeps : never;
133
134
  /**
134
135
  * Plugin metadata for remote loading
135
136
  */
@@ -142,10 +143,6 @@ type PluginMetadata = {
142
143
  * Runtime registry configuration supporting both module and remote entries
143
144
  */
144
145
  type PluginRegistry = Record<string, PluginRegistryEntry>;
145
- /**
146
- * Legacy metadata-only registry (for backwards compatibility)
147
- */
148
- type PluginMetadataRegistry = Record<string, PluginMetadata>;
149
146
  /**
150
147
  * Configuration for secrets injection.
151
148
  * Secrets are hydrated into plugin configs using template replacement.
@@ -177,8 +174,13 @@ interface InitializedPlugin<T extends AnyPlugin = AnyPlugin> {
177
174
  variables: InferSchemaOutput<T["configSchema"]["variables"]>;
178
175
  secrets: InferSchemaOutput<T["configSchema"]["secrets"]>;
179
176
  };
180
- readonly context: ContextOf<T>;
181
- readonly scope: Scope.CloseableScope;
177
+ /**
178
+ * Built Effect context from the plugin's initialize Layer. Provided to
179
+ * handlers as `effect/context` — `.effect()` handlers `yield* Tag`,
180
+ * plain handlers use `Context.get(context["effect/context"], Tag)`.
181
+ */
182
+ readonly effectContext: Context.Context<any>;
183
+ readonly scope: Scope.Closeable;
182
184
  }
183
185
  /**
184
186
  * Helper type to detect type errors when looking up RegisteredPlugins
@@ -202,17 +204,6 @@ type UsePluginResult<K extends keyof R, R = RegisteredPlugins> = VerifyPluginBin
202
204
  readonly metadata: PluginMetadata;
203
205
  readonly initialized: InitializedPlugin<RegisteredPlugin<K, R>>;
204
206
  } : VerifyPluginBinding<K, R>;
205
- /**
206
- * Runtime options
207
- */
208
- interface RuntimeOptions {
209
- isolation?: "strict" | "shared" | "none";
210
- memoryLimit?: string;
211
- concurrency?: number;
212
- resourceTimeout?: string;
213
- debug?: boolean;
214
- metrics?: boolean;
215
- }
216
207
  /**
217
208
  * Extract registry type from runtime instance or use type directly
218
209
  * This allows EveryPlugin.Infer to work with both:
@@ -251,17 +242,7 @@ declare namespace EveryPlugin {
251
242
  interface PluginRuntimeConfig<R extends Record<string, PluginRegistryEntry> = Record<string, PluginRegistryEntry>> {
252
243
  registry: R;
253
244
  secrets?: SecretsConfig;
254
- options?: RuntimeOptions;
255
- }
256
- /**
257
- * Legacy plugin runtime configuration (metadata-only registry)
258
- * @deprecated Use PluginRuntimeConfig with module/remote entries instead
259
- */
260
- interface LegacyPluginRuntimeConfig {
261
- registry: PluginMetadataRegistry;
262
- secrets?: SecretsConfig;
263
- options?: RuntimeOptions;
264
245
  }
265
246
  //#endregion
266
- export { AnyPlugin, AnyPluginConstructor, ContextOf, EveryPlugin, ExtractPluginType, InferRegistryFromEntries, InitializedPlugin, LegacyPluginRuntimeConfig, LoadedPlugin, PluginClientType, PluginConfigInput, PluginConstructor, PluginContext, PluginContextInput, PluginContract, PluginInstance, PluginMetadata, PluginMetadataRegistry, PluginRegistry, PluginRegistryEntry, PluginRouterType, PluginRuntimeConfig, PluginSecrets, PluginVariables, RegisteredPlugin, RegisteredPlugins, RuntimeOptions, SecretsConfig, UsePluginResult };
247
+ export { AnyPlugin, AnyPluginConstructor, EveryPlugin, ExtractPluginType, InferRegistryFromEntries, InitializedPlugin, LoadedPlugin, PluginClientType, PluginConfigInput, PluginContext, PluginContextInput, PluginContract, PluginInstance, PluginMetadata, PluginRegistry, PluginRegistryEntry, PluginRouterType, PluginRuntimeConfig, PluginSecrets, PluginServicesEntry, PluginVariables, RegisteredPlugin, RegisteredPlugins, SecretsConfig, UsePluginResult };
267
248
  //# sourceMappingURL=types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;;;;;;;;;;;;UAuBiB;;;;KAKL,YAAY,OAAO,mBAAmB,WAAW,WAAW;;;;KAK5D;UACF;EACR;IACE,UAAU;IACV,WAAW;IACX,SAAS;IACT,SAAS;;;;;;KAOD;EACN,QAAQ;EAAsB;EAAiB;EAAkB;;EACjE;EAAgB;EAAkB;;;;;KAK5B,kBAAkB,KAAK;EAAY,cAAc;IAAM;;;;KAKvD,yBAAyB,UAAU,eAAe,2BAC3D,WAAW,IAAI,EAAE;EAAa,cAAc;IACzC,IACA,gBAAgB,oBACd,kBAAkB;;;;KAOd,eAAe,KAAK;EAC9B;IAAW,gBAAgB,UAAU;;IAEnC;;;;KAMQ,gBAAgB,KAAK;EAAY;IAAW,iBAAiB,UAAU;;IAC/E;;;;KAMQ,cAAc,KAAK;EAAY;IAAW,eAAe,UAAU;;IAC3E;;;;KAMQ,cAAc,KAAK;EAC7B;IAAW,eAAe,UAAU;;IAEl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EAC3B,eAAe,UAAU;EACzB,eAAe,wBAAwB;IAEvC,OAAO,GAAG,GAAG,GAAG;;;;KAOV,mBAAmB,KAC7B,cAAc,WAAW,YAAY,iBAAiB,cAAc;;;;KAK1D,kBAAkB;EAC5B,WAAW,iBAAiB,gBAAgB;EAC5C,SAAS,iBAAiB,cAAc;;;;;KAM9B;WACD;WACA;WACA;;;;;KAMC,iBAAiB,eAAe;;;;;UAM3B;GACd;;;;;UAMc,aAAa,UAAU,YAAY;WACzC,gBAAgB;WAChB,UAAU;;;;;UAMJ,eAAe,UAAU,YAAY;WAC3C,QAAQ;WACR,UAAU;;;;;UAMJ,kBAAkB,UAAU,YAAY;WAC9C,QAAQ;WACR,UAAU;WACV;IACP,WAAW,kBAAkB;IAC7B,SAAS,kBAAkB;;;;;;;WAOpB,eAAe,QAAQ;WACvB,OAAO,MAAM;;;;;KAMnB,oBAAoB,gBAAgB,GAAG,IAAI,qBAAqB,EAAE;EACrE,eAAe;IAEb;EACE,UAAU;EACV,WAAW;EACX,SAAS;EACT,SAAS;wBAGI,4IACF;;;;;;KAOL,gBAAgB,gBAAgB,GAAG,IAAI,qBACjD,oBAAoB,GAAG;WAER,eAAe,UAAU,mBAAmB,EAAE,QAAQ,iBAAiB,EAAE;WACzE,QAAQ,iBAAiB,EAAE;WAC3B,UAAU;WACV,aAAa,kBAAkB,iBAAiB,GAAG;IAE9D,oBAAoB,GAAG;;;;;;;KAQxB,WAAW,KAAK;EAAY,uBAAuB;IAAM,IAAI;;;;kBAKjD;;;;;;;;;;;;;;;;;;OAkBH,MACV,kBACA,SAAS,qBACP,gBAAgB,WAAW,UAAU,gBAAgB,GAAG,WAAW;;;;;UAMxD,oBACf,UAAU,eAAe,uBAAuB,eAAe;EAE/D,UAAU;EACV,UAAU"}
@@ -0,0 +1,268 @@
1
+ const require_mount_registry = require('./mount-registry.cjs');
2
+ const require_descriptor = require('./descriptor.cjs');
3
+ const require_nav = require('./nav.cjs');
4
+ const require_route_config = require('./route-config.cjs');
5
+ let _tanstack_react_router = require("@tanstack/react-router");
6
+
7
+ //#region src/ui/manifest/construct.ts
8
+ /**
9
+ * Host-side route-graph construction (ADR 0008 §1): manifests + route
10
+ * configs in → host-built tree out. The host constructs ITS OWN Route
11
+ * objects from validated manifest data via public `createRoute` APIs; no
12
+ * foreign route object is ever mutated. Gates are attached HOST-side from
13
+ * the mount registry — plugins cannot ship a route that escapes its
14
+ * mount's gate because plugins never construct route objects.
15
+ *
16
+ * Mounts are the ONLY cross-source parenting points: a root-level
17
+ * pathless layout file (`_public.tsx`) declares the mount for the whole
18
+ * composition (exactly one declaring source per mount); every other
19
+ * source's routes live under the same `_mount/` directory prefix and
20
+ * parent onto the shared mount route. This module executes inside the
21
+ * core ui's module graph (production MF expose `./compose`, dev source
22
+ * import) so constructed routes are minted by the same react/router
23
+ * instance that renders them.
24
+ */
25
+ /**
26
+ * TanStack's Route generics are intentionally invariant — routes built from
27
+ * manifest data can't satisfy them structurally. One named boundary for
28
+ * handing a constructed route to the tree-building APIs.
29
+ */
30
+ function toAnyRoute(route) {
31
+ return route;
32
+ }
33
+ /**
34
+ * Gate redirects are absolute: gates attach to root-level mount routes, and
35
+ * relatives would silently shift if a mount ever moved deeper in the tree.
36
+ * The login surface is plugin-owned, never core-known.
37
+ */
38
+ const LOGIN_TO = "/login";
39
+ const HOME_TO = "/";
40
+ /**
41
+ * Gate implementations by mount gate kind. Only `session` and `admin` are
42
+ * implemented (ADR 0008 §3); unimplemented mounts are rejected during mount
43
+ * declaration before any gate lookup, and gates are optional by type — a
44
+ * mount without an entry (or `none`) renders ungated.
45
+ */
46
+ const GATES = {
47
+ session: ({ context, location }) => {
48
+ if (!userOf(context)) throw (0, _tanstack_react_router.redirect)({
49
+ to: LOGIN_TO,
50
+ search: { redirect: location.pathname + location.searchStr }
51
+ });
52
+ },
53
+ admin: ({ context }) => {
54
+ const user = userOf(context);
55
+ if (!user) throw (0, _tanstack_react_router.redirect)({ to: LOGIN_TO });
56
+ if (user.role !== "admin") throw (0, _tanstack_react_router.redirect)({ to: HOME_TO });
57
+ }
58
+ };
59
+ const userOf = (context) => context?.user ?? context?.session?.user;
60
+ function joinPath(a, b) {
61
+ const left = a && a !== "/" ? a.replace(/\/+$/, "") : "";
62
+ const right = b && b !== "/" ? b.replace(/^\/+/, "") : "";
63
+ if (!left) return right ? `/${right}` : "/";
64
+ if (!right) return left;
65
+ return `${left}/${right}`;
66
+ }
67
+ const navOf = (options) => {
68
+ const nav = options.staticData?.nav;
69
+ if (nav && typeof nav === "object" && typeof nav.label === "string") return nav;
70
+ };
71
+ /** Layout routes (mount or pathless) pass their authored options through,
72
+ * like every other route kind. On mount routes the registry gate composes
73
+ * BEFORE the declaration's own beforeLoad so a source can never escape its
74
+ * mount's gate (ADR 0008 §3), while the declaration's return value still
75
+ * flows to children as route context. */
76
+ function layoutBeforeLoad(gate, declared) {
77
+ if (!gate) return declared;
78
+ return (args) => {
79
+ gate(args);
80
+ return declared?.(args);
81
+ };
82
+ }
83
+ const AUTHORED_OPTION_KEYS = require_route_config.ROUTE_OPTION_KEYS.filter((key) => key !== "beforeLoad" && key !== "component");
84
+ function authoredOptions(options) {
85
+ const authored = {};
86
+ for (const key of AUTHORED_OPTION_KEYS) if (options[key] !== void 0) authored[key] = options[key];
87
+ return authored;
88
+ }
89
+ function rootAuthoredOptions(options) {
90
+ const { params: _params, ...authored } = authoredOptions(options);
91
+ return authored;
92
+ }
93
+ async function constructTree(input) {
94
+ const refs = [...input.plugins].sort((a, b) => a.key.localeCompare(b.key));
95
+ const resolved = [];
96
+ for (const ref of refs) resolved.push(await input.resolve(ref));
97
+ const optionsByPlugin = /* @__PURE__ */ new Map();
98
+ for (const plugin of resolved) {
99
+ const optionsById = /* @__PURE__ */ new Map();
100
+ await Promise.all(plugin.manifest.routes.map(async (record) => {
101
+ const loader = plugin.routeConfig.routeConfigLoaders[record.id];
102
+ if (!loader) throw new Error(`routeConfig for "${plugin.key}" has no loader for route "${record.id}"`);
103
+ optionsById.set(record.id, await loader());
104
+ }));
105
+ optionsByPlugin.set(plugin.key, optionsById);
106
+ }
107
+ const declarations = /* @__PURE__ */ new Map();
108
+ for (const plugin of resolved) for (const record of plugin.manifest.routes) {
109
+ if (!record.mount) continue;
110
+ const mountId = record.mount;
111
+ if (!require_mount_registry.MOUNT_REGISTRY[mountId].implemented) throw new Error(`mount "${record.mount}" is declared vocabulary but unimplemented (ADR 0008 §3) — declared by "${plugin.key}"`);
112
+ const existing = declarations.get(mountId);
113
+ if (existing) throw new Error(`mount "${mountId}" declared by multiple sources: "${existing.key}" (${existing.record.file}) and "${plugin.key}" (${record.file})`);
114
+ declarations.set(mountId, {
115
+ key: plugin.key,
116
+ record,
117
+ options: optionsByPlugin.get(plugin.key).get(record.id)
118
+ });
119
+ }
120
+ const rootRoute = toAnyRoute((0, _tanstack_react_router.createRootRoute)({
121
+ ...input.rootOptions ? rootAuthoredOptions(input.rootOptions) : {},
122
+ component: input.rootOptions?.component ?? _tanstack_react_router.Outlet,
123
+ ...input.rootOptions?.beforeLoad ? { beforeLoad: input.rootOptions.beforeLoad } : {}
124
+ }));
125
+ const mountRoutes = /* @__PURE__ */ new Map();
126
+ for (const mountId of Object.keys(require_mount_registry.MOUNT_REGISTRY)) {
127
+ const declaration = declarations.get(mountId);
128
+ if (!declaration) continue;
129
+ const def = require_mount_registry.MOUNT_REGISTRY[mountId];
130
+ const gate = GATES[def.gate];
131
+ const options = declaration.options;
132
+ const route = (0, _tanstack_react_router.createRoute)({
133
+ id: `__mount_${mountId}`,
134
+ getParentRoute: () => rootRoute,
135
+ ...gate || options.beforeLoad ? { beforeLoad: layoutBeforeLoad(gate, options.beforeLoad) } : {},
136
+ ...authoredOptions(options),
137
+ component: options.component ?? _tanstack_react_router.Outlet
138
+ });
139
+ mountRoutes.set(mountId, toAnyRoute(route));
140
+ }
141
+ const mountByLayoutId = /* @__PURE__ */ new Map();
142
+ for (const [mountId, declaration] of declarations) mountByLayoutId.set(declaration.record.id, mountId);
143
+ const nav = [];
144
+ const mountCounts = {};
145
+ const childrenByParent = /* @__PURE__ */ new Map();
146
+ /** cross-plugin path-collision guard: claimed paths per parent route */
147
+ const claimedPathsByParent = /* @__PURE__ */ new Map();
148
+ const attach = (parent, child) => {
149
+ const list = childrenByParent.get(parent) ?? [];
150
+ list.push(child);
151
+ childrenByParent.set(parent, list);
152
+ };
153
+ for (const plugin of resolved) {
154
+ const optionsById = optionsByPlugin.get(plugin.key);
155
+ const fullPathById = /* @__PURE__ */ new Map();
156
+ const mountById = /* @__PURE__ */ new Map();
157
+ const byId = /* @__PURE__ */ new Map();
158
+ const parentFor = (record) => {
159
+ if (record.parentId) {
160
+ const local = byId.get(record.parentId);
161
+ if (local) return {
162
+ route: local.route,
163
+ fullPath: fullPathById.get(record.parentId),
164
+ mount: mountById.get(record.parentId)
165
+ };
166
+ const mount = mountByLayoutId.get(record.parentId);
167
+ if (mount) return {
168
+ route: mountRoutes.get(mount),
169
+ fullPath: "",
170
+ mount
171
+ };
172
+ throw new Error(`unresolvable parent "${record.parentId}" for "${record.id}" in "${plugin.key}" — mounts are the only cross-source parenting points`);
173
+ }
174
+ const firstSegment = record.id.split("/")[0] ?? "";
175
+ if (firstSegment.startsWith("_")) {
176
+ const mount = require_mount_registry.resolveMountSegment(firstSegment.slice(1));
177
+ if (mount && mountRoutes.has(mount)) return {
178
+ route: mountRoutes.get(mount),
179
+ fullPath: "",
180
+ mount
181
+ };
182
+ if (mount) throw new Error(`mount "${mount}" is not declared by any source (route "${record.id}" in "${plugin.key}")`);
183
+ throw new Error(`unknown mount "_${firstSegment.slice(1)}" (route "${record.id}" in "${plugin.key}")`);
184
+ }
185
+ throw new Error(`route "${record.id}" in "${plugin.key}" must live under a mount`);
186
+ };
187
+ const pending = plugin.manifest.routes.filter((record) => !record.mount);
188
+ let progressed = true;
189
+ while (pending.length > 0 && progressed) {
190
+ progressed = false;
191
+ for (let i = 0; i < pending.length; i += 1) {
192
+ const record = pending[i];
193
+ if (record.parentId && !byId.has(record.parentId) && !mountByLayoutId.has(record.parentId)) continue;
194
+ pending.splice(i, 1);
195
+ progressed = true;
196
+ const options = optionsById.get(record.id);
197
+ const parent = parentFor(record);
198
+ const routePath = record.path;
199
+ const isLayoutRoute = record.type === "layout" || routePath === void 0;
200
+ if (!isLayoutRoute) {
201
+ const siblings = claimedPathsByParent.get(parent.route) ?? /* @__PURE__ */ new Map();
202
+ const claimant = siblings.get(routePath);
203
+ if (claimant) throw new Error(`path collision: "${plugin.key}" route "${record.id}" declares "${routePath}" which is already claimed by "${claimant}" under the same parent`);
204
+ siblings.set(routePath, `${plugin.key}:${record.id}`);
205
+ claimedPathsByParent.set(parent.route, siblings);
206
+ }
207
+ const fullPath = joinPath(parent.fullPath, routePath);
208
+ let route;
209
+ if (isLayoutRoute) route = (0, _tanstack_react_router.createRoute)({
210
+ id: `${plugin.key}__${record.id}`,
211
+ getParentRoute: () => parent.route,
212
+ ...authoredOptions(options),
213
+ ...options.beforeLoad ? { beforeLoad: options.beforeLoad } : {},
214
+ component: options.component ?? _tanstack_react_router.Outlet
215
+ });
216
+ else route = (0, _tanstack_react_router.createRoute)({
217
+ path: routePath,
218
+ getParentRoute: () => parent.route,
219
+ ...authoredOptions(options),
220
+ ...options.beforeLoad ? { beforeLoad: options.beforeLoad } : {},
221
+ component: options.component ?? _tanstack_react_router.Outlet
222
+ });
223
+ byId.set(record.id, {
224
+ record,
225
+ route: toAnyRoute(route)
226
+ });
227
+ fullPathById.set(record.id, fullPath);
228
+ mountById.set(record.id, parent.mount);
229
+ attach(parent.route, toAnyRoute(route));
230
+ mountCounts[parent.mount] = (mountCounts[parent.mount] ?? 0) + 1;
231
+ const navDeclaration = navOf(options);
232
+ if (navDeclaration && navDeclaration.hidden !== true) nav.push({
233
+ id: `${plugin.key}:${record.id}`,
234
+ label: navDeclaration.label,
235
+ ...typeof navDeclaration.icon === "string" ? { icon: navDeclaration.icon } : {},
236
+ ...typeof navDeclaration.group === "string" ? { group: navDeclaration.group } : {},
237
+ ...typeof navDeclaration.order === "number" ? { order: navDeclaration.order } : {},
238
+ to: navDeclaration.to ?? fullPath,
239
+ plugin: plugin.key,
240
+ mount: parent.mount
241
+ });
242
+ break;
243
+ }
244
+ }
245
+ if (pending.length > 0) throw new Error(`unresolvable parentage in "${plugin.key}": ${pending.map((record) => record.id).join(", ")}`);
246
+ }
247
+ for (const [parent, children] of childrenByParent) parent.addChildren(children);
248
+ rootRoute.addChildren([...mountRoutes.values()]);
249
+ nav.sort(require_nav.compareNavItems);
250
+ return {
251
+ rootRoute,
252
+ routeTree: rootRoute,
253
+ digest: await require_descriptor.digestOf({
254
+ plugins: refs.map((ref) => ({
255
+ key: ref.key,
256
+ mfName: ref.mfName
257
+ })),
258
+ manifests: resolved.map((plugin) => plugin.manifest)
259
+ }),
260
+ manifests: resolved.map((plugin) => plugin.manifest),
261
+ nav: { items: nav },
262
+ mountCounts
263
+ };
264
+ }
265
+
266
+ //#endregion
267
+ exports.constructTree = constructTree;
268
+ //# sourceMappingURL=construct.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construct.cjs","names":["redirect","ROUTE_OPTION_KEYS","MOUNT_REGISTRY","createRootRoute","Outlet","createRoute","resolveMountSegment","compareNavItems","digestOf"],"sources":["../../../src/ui/manifest/construct.ts"],"sourcesContent":["import type { AnyRoute } from \"@tanstack/react-router\";\nimport { createRootRoute, createRoute, Outlet, redirect } from \"@tanstack/react-router\";\nimport { digestOf } from \"./descriptor\";\nimport type { PluginManifest, RouteRecord } from \"./manifest-schema\";\nimport { MOUNT_REGISTRY, type MountDef, type MountId, resolveMountSegment } from \"./mount-registry\";\nimport { compareNavItems, type NavDeclaration, type NavItem, type NavManifest } from \"./nav\";\nimport { ROUTE_OPTION_KEYS, type RouteConfigModule, type RouteOptionsBundle } from \"./route-config\";\n\n/**\n * Host-side route-graph construction (ADR 0008 §1): manifests + route\n * configs in → host-built tree out. The host constructs ITS OWN Route\n * objects from validated manifest data via public `createRoute` APIs; no\n * foreign route object is ever mutated. Gates are attached HOST-side from\n * the mount registry — plugins cannot ship a route that escapes its\n * mount's gate because plugins never construct route objects.\n *\n * Mounts are the ONLY cross-source parenting points: a root-level\n * pathless layout file (`_public.tsx`) declares the mount for the whole\n * composition (exactly one declaring source per mount); every other\n * source's routes live under the same `_mount/` directory prefix and\n * parent onto the shared mount route. This module executes inside the\n * core ui's module graph (production MF expose `./compose`, dev source\n * import) so constructed routes are minted by the same react/router\n * instance that renders them.\n */\n\n/**\n * TanStack's Route generics are intentionally invariant — routes built from\n * manifest data can't satisfy them structurally. One named boundary for\n * handing a constructed route to the tree-building APIs.\n */\nfunction toAnyRoute(route: unknown): AnyRoute {\n return route as AnyRoute;\n}\n\nexport interface GateUser {\n id: string;\n name?: string;\n /** Better Auth user role — \"admin\" gates the admin mount. */\n role?: string;\n}\n\nexport interface HostContext {\n user?: GateUser;\n session?: { user?: GateUser };\n}\n\ntype GateFn = (args: {\n context: HostContext;\n location: { pathname: string; searchStr: string };\n}) => void;\n\n/**\n * Gate redirects are absolute: gates attach to root-level mount routes, and\n * relatives would silently shift if a mount ever moved deeper in the tree.\n * The login surface is plugin-owned, never core-known.\n */\nconst LOGIN_TO: string = \"/login\";\nconst HOME_TO: string = \"/\";\n\n/**\n * Gate implementations by mount gate kind. Only `session` and `admin` are\n * implemented (ADR 0008 §3); unimplemented mounts are rejected during mount\n * declaration before any gate lookup, and gates are optional by type — a\n * mount without an entry (or `none`) renders ungated.\n */\nconst GATES: Partial<Record<MountDef[\"gate\"], GateFn>> = {\n session: ({ context, location }) => {\n const user = userOf(context);\n if (!user) {\n throw redirect({\n to: LOGIN_TO,\n search: { redirect: location.pathname + location.searchStr } as never,\n });\n }\n },\n admin: ({ context }) => {\n const user = userOf(context);\n if (!user) throw redirect({ to: LOGIN_TO });\n if (user.role !== \"admin\") throw redirect({ to: HOME_TO });\n },\n};\n\nconst userOf = (context: HostContext | undefined): GateUser | undefined =>\n context?.user ?? context?.session?.user;\n\nexport interface ConstructPluginRef {\n /** composition identity — plugin key; participates in the digest */\n key: string;\n /** deployment identity — the MF container name loadRemote targets */\n mfName: string;\n}\n\nexport interface ResolvedPlugin {\n key: string;\n manifest: PluginManifest;\n routeConfig: RouteConfigModule;\n}\n\nexport interface ConstructInput {\n name: string;\n plugins: ReadonlyArray<ConstructPluginRef>;\n resolve: (ref: ConstructPluginRef) => Promise<ResolvedPlugin>;\n /** core ui `__root` options — component/error/notFound + head baseline */\n rootOptions?: RouteOptionsBundle;\n}\n\nexport interface ConstructedTree {\n rootRoute: AnyRoute;\n routeTree: AnyRoute;\n digest: string;\n manifests: PluginManifest[];\n nav: NavManifest;\n /** constructed route count per mount id */\n mountCounts: Record<string, number>;\n}\n\ninterface MountDeclaration {\n key: string;\n record: RouteRecord;\n options: RouteOptionsBundle;\n}\n\nfunction joinPath(a: string | undefined, b: string | undefined): string {\n const left = a && a !== \"/\" ? a.replace(/\\/+$/, \"\") : \"\";\n const right = b && b !== \"/\" ? b.replace(/^\\/+/, \"\") : \"\";\n if (!left) return right ? `/${right}` : \"/\";\n if (!right) return left;\n return `${left}/${right}`;\n}\n\nconst navOf = (options: RouteOptionsBundle): NavDeclaration | undefined => {\n const nav = options.staticData?.nav;\n if (nav && typeof nav === \"object\" && typeof (nav as NavDeclaration).label === \"string\") {\n return nav as NavDeclaration;\n }\n return undefined;\n};\n\n/** Layout routes (mount or pathless) pass their authored options through,\n * like every other route kind. On mount routes the registry gate composes\n * BEFORE the declaration's own beforeLoad so a source can never escape its\n * mount's gate (ADR 0008 §3), while the declaration's return value still\n * flows to children as route context. */\nfunction layoutBeforeLoad(\n gate: GateFn | undefined,\n declared: RouteOptionsBundle[\"beforeLoad\"],\n): RouteOptionsBundle[\"beforeLoad\"] {\n if (!gate) return declared;\n return (args) => {\n gate(args);\n return declared?.(args);\n };\n}\n\nconst AUTHORED_OPTION_KEYS = ROUTE_OPTION_KEYS.filter(\n (key) => key !== \"beforeLoad\" && key !== \"component\",\n);\n\nfunction authoredOptions(options: RouteOptionsBundle): Partial<RouteOptionsBundle> {\n const authored: Partial<Record<keyof RouteOptionsBundle, unknown>> = {};\n for (const key of AUTHORED_OPTION_KEYS) {\n if (options[key] !== undefined) authored[key] = options[key];\n }\n return authored as Partial<RouteOptionsBundle>;\n}\n\nfunction rootAuthoredOptions(options: RouteOptionsBundle): Partial<RouteOptionsBundle> {\n const { params: _params, ...authored } = authoredOptions(options);\n return authored;\n}\n\nexport async function constructTree(input: ConstructInput): Promise<ConstructedTree> {\n const refs = [...input.plugins].sort((a, b) => a.key.localeCompare(b.key));\n const resolved: ResolvedPlugin[] = [];\n for (const ref of refs) {\n resolved.push(await input.resolve(ref));\n }\n\n const optionsByPlugin = new Map<string, Map<string, RouteOptionsBundle>>();\n for (const plugin of resolved) {\n const optionsById = new Map<string, RouteOptionsBundle>();\n await Promise.all(\n plugin.manifest.routes.map(async (record) => {\n const loader = plugin.routeConfig.routeConfigLoaders[record.id];\n if (!loader) {\n throw new Error(`routeConfig for \"${plugin.key}\" has no loader for route \"${record.id}\"`);\n }\n optionsById.set(record.id, await loader());\n }),\n );\n optionsByPlugin.set(plugin.key, optionsById);\n }\n\n const declarations = new Map<MountId, MountDeclaration>();\n for (const plugin of resolved) {\n for (const record of plugin.manifest.routes) {\n if (!record.mount) continue;\n const mountId = record.mount as MountId;\n const def = MOUNT_REGISTRY[mountId];\n if (!def.implemented) {\n throw new Error(\n `mount \"${record.mount}\" is declared vocabulary but unimplemented (ADR 0008 §3) — declared by \"${plugin.key}\"`,\n );\n }\n const existing = declarations.get(mountId);\n if (existing) {\n throw new Error(\n `mount \"${mountId}\" declared by multiple sources: \"${existing.key}\" (${existing.record.file}) and \"${plugin.key}\" (${record.file})`,\n );\n }\n declarations.set(mountId, {\n key: plugin.key,\n record,\n options: optionsByPlugin.get(plugin.key)!.get(record.id)!,\n });\n }\n }\n\n const rootRoute = toAnyRoute(\n createRootRoute({\n ...(input.rootOptions ? rootAuthoredOptions(input.rootOptions) : {}),\n component: input.rootOptions?.component ?? Outlet,\n ...(input.rootOptions?.beforeLoad ? { beforeLoad: input.rootOptions.beforeLoad } : {}),\n }),\n );\n\n const mountRoutes = new Map<MountId, AnyRoute>();\n for (const mountId of Object.keys(MOUNT_REGISTRY) as MountId[]) {\n const declaration = declarations.get(mountId);\n if (!declaration) continue;\n const def = MOUNT_REGISTRY[mountId]!;\n const gate = GATES[def.gate];\n const options = declaration.options;\n const route = createRoute({\n id: `__mount_${mountId}`,\n getParentRoute: () => rootRoute,\n ...(gate || options.beforeLoad\n ? { beforeLoad: layoutBeforeLoad(gate, options.beforeLoad) }\n : {}),\n ...authoredOptions(options),\n component: options.component ?? Outlet,\n });\n mountRoutes.set(mountId, toAnyRoute(route));\n }\n\n const mountByLayoutId = new Map<string, MountId>();\n for (const [mountId, declaration] of declarations) {\n mountByLayoutId.set(declaration.record.id, mountId);\n }\n\n const nav: NavItem[] = [];\n const mountCounts: Record<string, number> = {};\n const childrenByParent = new Map<AnyRoute, AnyRoute[]>();\n /** cross-plugin path-collision guard: claimed paths per parent route */\n const claimedPathsByParent = new Map<AnyRoute, Map<string, string>>();\n const attach = (parent: AnyRoute, child: AnyRoute) => {\n const list = childrenByParent.get(parent) ?? [];\n list.push(child);\n childrenByParent.set(parent, list);\n };\n\n for (const plugin of resolved) {\n const optionsById = optionsByPlugin.get(plugin.key)!;\n const fullPathById = new Map<string, string>();\n const mountById = new Map<string, MountId>();\n const byId = new Map<string, { record: RouteRecord; route: AnyRoute }>();\n\n const parentFor = (\n record: RouteRecord,\n ): { route: AnyRoute; fullPath: string; mount: MountId } => {\n if (record.parentId) {\n const local = byId.get(record.parentId);\n if (local) {\n return {\n route: local.route,\n fullPath: fullPathById.get(record.parentId)!,\n mount: mountById.get(record.parentId)!,\n };\n }\n const mount = mountByLayoutId.get(record.parentId);\n if (mount) return { route: mountRoutes.get(mount)!, fullPath: \"\", mount };\n throw new Error(\n `unresolvable parent \"${record.parentId}\" for \"${record.id}\" in \"${plugin.key}\" — mounts are the only cross-source parenting points`,\n );\n }\n const firstSegment = record.id.split(\"/\")[0] ?? \"\";\n if (firstSegment.startsWith(\"_\")) {\n const mount = resolveMountSegment(firstSegment.slice(1));\n if (mount && mountRoutes.has(mount))\n return { route: mountRoutes.get(mount)!, fullPath: \"\", mount };\n if (mount) {\n throw new Error(\n `mount \"${mount}\" is not declared by any source (route \"${record.id}\" in \"${plugin.key}\")`,\n );\n }\n throw new Error(\n `unknown mount \"_${firstSegment.slice(1)}\" (route \"${record.id}\" in \"${plugin.key}\")`,\n );\n }\n throw new Error(`route \"${record.id}\" in \"${plugin.key}\" must live under a mount`);\n };\n\n const pending = plugin.manifest.routes.filter((record) => !record.mount);\n let progressed = true;\n while (pending.length > 0 && progressed) {\n progressed = false;\n for (let i = 0; i < pending.length; i += 1) {\n const record = pending[i]!;\n if (\n record.parentId &&\n !byId.has(record.parentId) &&\n !mountByLayoutId.has(record.parentId)\n ) {\n continue;\n }\n pending.splice(i, 1);\n progressed = true;\n\n const options = optionsById.get(record.id)!;\n const parent = parentFor(record);\n const routePath = record.path;\n const isLayoutRoute = record.type === \"layout\" || routePath === undefined;\n if (!isLayoutRoute) {\n const siblings = claimedPathsByParent.get(parent.route) ?? new Map<string, string>();\n const claimant = siblings.get(routePath);\n if (claimant) {\n throw new Error(\n `path collision: \"${plugin.key}\" route \"${record.id}\" declares \"${routePath}\" which is already claimed by \"${claimant}\" under the same parent`,\n );\n }\n siblings.set(routePath, `${plugin.key}:${record.id}`);\n claimedPathsByParent.set(parent.route, siblings);\n }\n const fullPath = joinPath(parent.fullPath, routePath);\n let route: AnyRoute;\n if (isLayoutRoute) {\n route = createRoute({\n id: `${plugin.key}__${record.id}`,\n getParentRoute: () => parent.route,\n ...authoredOptions(options),\n ...(options.beforeLoad ? { beforeLoad: options.beforeLoad } : {}),\n component: options.component ?? Outlet,\n });\n } else {\n route = createRoute({\n path: routePath,\n getParentRoute: () => parent.route,\n ...authoredOptions(options),\n ...(options.beforeLoad ? { beforeLoad: options.beforeLoad } : {}),\n component: options.component ?? Outlet,\n });\n }\n\n byId.set(record.id, { record, route: toAnyRoute(route) });\n fullPathById.set(record.id, fullPath);\n mountById.set(record.id, parent.mount);\n attach(parent.route, toAnyRoute(route));\n mountCounts[parent.mount] = (mountCounts[parent.mount] ?? 0) + 1;\n\n const navDeclaration = navOf(options);\n if (navDeclaration && navDeclaration.hidden !== true) {\n nav.push({\n id: `${plugin.key}:${record.id}`,\n label: navDeclaration.label,\n ...(typeof navDeclaration.icon === \"string\" ? { icon: navDeclaration.icon } : {}),\n ...(typeof navDeclaration.group === \"string\" ? { group: navDeclaration.group } : {}),\n ...(typeof navDeclaration.order === \"number\" ? { order: navDeclaration.order } : {}),\n to: navDeclaration.to ?? fullPath,\n plugin: plugin.key,\n mount: parent.mount,\n });\n }\n break;\n }\n }\n if (pending.length > 0) {\n throw new Error(\n `unresolvable parentage in \"${plugin.key}\": ${pending.map((record) => record.id).join(\", \")}`,\n );\n }\n }\n\n for (const [parent, children] of childrenByParent) {\n (parent as { addChildren: (children: AnyRoute[]) => void }).addChildren(children);\n }\n rootRoute.addChildren([...mountRoutes.values()] as AnyRoute[]);\n nav.sort(compareNavItems);\n\n const digest = await digestOf({\n plugins: refs.map((ref) => ({ key: ref.key, mfName: ref.mfName })),\n manifests: resolved.map((plugin) => plugin.manifest),\n });\n\n return {\n rootRoute,\n routeTree: rootRoute,\n digest,\n manifests: resolved.map((plugin) => plugin.manifest),\n nav: { items: nav },\n mountCounts,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,SAAS,WAAW,OAA0B;CAC5C,OAAO;AACT;;;;;;AAwBA,MAAM,WAAmB;AACzB,MAAM,UAAkB;;;;;;;AAQxB,MAAM,QAAmD;CACvD,UAAU,EAAE,SAAS,eAAe;EAElC,IAAI,CADS,OAAO,OACZ,GACN,UAAMA,iCAAS;GACb,IAAI;GACJ,QAAQ,EAAE,UAAU,SAAS,WAAW,SAAS,UAAU;EA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I,kBAAkB,eAAe,WAAW,MAC9C,IAAI,KAAK;KACP,IAAI,GAAG,OAAO,IAAI,GAAG,OAAO;KAC5B,OAAO,eAAe;KACtB,GAAI,OAAO,eAAe,SAAS,WAAW,EAAE,MAAM,eAAe,KAAK,IAAI,CAAC;KAC/E,GAAI,OAAO,eAAe,UAAU,WAAW,EAAE,OAAO,eAAe,MAAM,IAAI,CAAC;KAClF,GAAI,OAAO,eAAe,UAAU,WAAW,EAAE,OAAO,eAAe,MAAM,IAAI,CAAC;KAClF,IAAI,eAAe,MAAM;KACzB,QAAQ,OAAO;KACf,OAAO,OAAO;IAChB,CAAC;IAEH;GACF;EACF;EACA,IAAI,QAAQ,SAAS,GACnB,MAAM,IAAI,MACR,8BAA8B,OAAO,IAAI,KAAK,QAAQ,KAAK,WAAW,OAAO,EAAE,CAAC,CAAC,KAAK,IAAI,GAC5F;CAEJ;CAEA,KAAK,MAAM,CAAC,QAAQ,aAAa,kBAC/B,AAAC,OAA2D,YAAY,QAAQ;CAElF,UAAU,YAAY,CAAC,GAAG,YAAY,OAAO,CAAC,CAAe;CAC7D,IAAI,KAAKG,2BAAe;CAOxB,OAAO;EACL;EACA,WAAW;EACX,cARmBC,4BAAS;GAC5B,SAAS,KAAK,KAAK,SAAS;IAAE,KAAK,IAAI;IAAK,QAAQ,IAAI;GAAO,EAAE;GACjE,WAAW,SAAS,KAAK,WAAW,OAAO,QAAQ;EACrD,CAAC;EAMC,WAAW,SAAS,KAAK,WAAW,OAAO,QAAQ;EACnD,KAAK,EAAE,OAAO,IAAI;EAClB;CACF;AACF"}
@@ -0,0 +1,48 @@
1
+ import { PluginManifest } from "./manifest-schema.cjs";
2
+ import { NavManifest } from "./nav.cjs";
3
+ import { RouteConfigModule, RouteOptionsBundle } from "./route-config.cjs";
4
+ import { AnyRoute } from "@tanstack/react-router";
5
+ //#region src/ui/manifest/construct.d.ts
6
+ interface GateUser {
7
+ id: string;
8
+ name?: string;
9
+ /** Better Auth user role — "admin" gates the admin mount. */
10
+ role?: string;
11
+ }
12
+ interface HostContext {
13
+ user?: GateUser;
14
+ session?: {
15
+ user?: GateUser;
16
+ };
17
+ }
18
+ interface ConstructPluginRef {
19
+ /** composition identity — plugin key; participates in the digest */
20
+ key: string;
21
+ /** deployment identity — the MF container name loadRemote targets */
22
+ mfName: string;
23
+ }
24
+ interface ResolvedPlugin {
25
+ key: string;
26
+ manifest: PluginManifest;
27
+ routeConfig: RouteConfigModule;
28
+ }
29
+ interface ConstructInput {
30
+ name: string;
31
+ plugins: ReadonlyArray<ConstructPluginRef>;
32
+ resolve: (ref: ConstructPluginRef) => Promise<ResolvedPlugin>;
33
+ /** core ui `__root` options — component/error/notFound + head baseline */
34
+ rootOptions?: RouteOptionsBundle;
35
+ }
36
+ interface ConstructedTree {
37
+ rootRoute: AnyRoute;
38
+ routeTree: AnyRoute;
39
+ digest: string;
40
+ manifests: PluginManifest[];
41
+ nav: NavManifest;
42
+ /** constructed route count per mount id */
43
+ mountCounts: Record<string, number>;
44
+ }
45
+ declare function constructTree(input: ConstructInput): Promise<ConstructedTree>;
46
+ //#endregion
47
+ export { ConstructInput, ConstructPluginRef, ConstructedTree, GateUser, HostContext, ResolvedPlugin, constructTree };
48
+ //# sourceMappingURL=construct.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construct.d.cts","names":[],"sources":["../../../src/ui/manifest/construct.ts"],"mappings":";;;;;UAmCiB;EACf;EACA;;EAEA;;UAGe;EACf,OAAO;EACP;IAAY,OAAO;;;UA0CJ;;EAEf;;EAEA;;UAGe;EACf;EACA,UAAU;EACV,aAAa;;UAGE;EACf;EACA,SAAS,cAAc;EACvB,UAAU,KAAK,uBAAuB,QAAQ;;EAE9C,cAAc;;UAGC;EACf,WAAW;EACX,WAAW;EACX;EACA,WAAW;EACX,KAAK;;EAEL,aAAa;;iBA0DO,cAAc,OAAO,iBAAiB,QAAQ"}
@@ -0,0 +1,48 @@
1
+ import { PluginManifest } from "./manifest-schema.mjs";
2
+ import { NavManifest } from "./nav.mjs";
3
+ import { RouteConfigModule, RouteOptionsBundle } from "./route-config.mjs";
4
+ import { AnyRoute } from "@tanstack/react-router";
5
+ //#region src/ui/manifest/construct.d.ts
6
+ interface GateUser {
7
+ id: string;
8
+ name?: string;
9
+ /** Better Auth user role — "admin" gates the admin mount. */
10
+ role?: string;
11
+ }
12
+ interface HostContext {
13
+ user?: GateUser;
14
+ session?: {
15
+ user?: GateUser;
16
+ };
17
+ }
18
+ interface ConstructPluginRef {
19
+ /** composition identity — plugin key; participates in the digest */
20
+ key: string;
21
+ /** deployment identity — the MF container name loadRemote targets */
22
+ mfName: string;
23
+ }
24
+ interface ResolvedPlugin {
25
+ key: string;
26
+ manifest: PluginManifest;
27
+ routeConfig: RouteConfigModule;
28
+ }
29
+ interface ConstructInput {
30
+ name: string;
31
+ plugins: ReadonlyArray<ConstructPluginRef>;
32
+ resolve: (ref: ConstructPluginRef) => Promise<ResolvedPlugin>;
33
+ /** core ui `__root` options — component/error/notFound + head baseline */
34
+ rootOptions?: RouteOptionsBundle;
35
+ }
36
+ interface ConstructedTree {
37
+ rootRoute: AnyRoute;
38
+ routeTree: AnyRoute;
39
+ digest: string;
40
+ manifests: PluginManifest[];
41
+ nav: NavManifest;
42
+ /** constructed route count per mount id */
43
+ mountCounts: Record<string, number>;
44
+ }
45
+ declare function constructTree(input: ConstructInput): Promise<ConstructedTree>;
46
+ //#endregion
47
+ export { ConstructInput, ConstructPluginRef, ConstructedTree, GateUser, HostContext, ResolvedPlugin, constructTree };
48
+ //# sourceMappingURL=construct.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construct.d.mts","names":[],"sources":["../../../src/ui/manifest/construct.ts"],"mappings":";;;;;UAmCiB;EACf;EACA;;EAEA;;UAGe;EACf,OAAO;EACP;IAAY,OAAO;;;UA0CJ;;EAEf;;EAEA;;UAGe;EACf;EACA,UAAU;EACV,aAAa;;UAGE;EACf;EACA,SAAS,cAAc;EACvB,UAAU,KAAK,uBAAuB,QAAQ;;EAE9C,cAAc;;UAGC;EACf,WAAW;EACX,WAAW;EACX;EACA,WAAW;EACX,KAAK;;EAEL,aAAa;;iBA0DO,cAAc,OAAO,iBAAiB,QAAQ"}