every-plugin 2.10.1 → 3.0.0-rc.3

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 +50 -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 +9 -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 +13 -26
  173. package/dist/plugin.cjs.map +1 -1
  174. package/dist/plugin.d.cts +57 -24
  175. package/dist/plugin.d.cts.map +1 -1
  176. package/dist/plugin.d.mts +58 -25
  177. package/dist/plugin.d.mts.map +1 -1
  178. package/dist/plugin.mjs +16 -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 +159 -33
  189. package/dist/runtime/errors.cjs.map +1 -1
  190. package/dist/runtime/errors.d.cts +64 -7
  191. package/dist/runtime/errors.d.cts.map +1 -1
  192. package/dist/runtime/errors.d.mts +64 -7
  193. package/dist/runtime/errors.d.mts.map +1 -1
  194. package/dist/runtime/errors.mjs +154 -30
  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 +57 -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 +57 -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 +56 -30
  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 +55 -31
  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 +25 -41
  265. package/dist/types.d.cts.map +1 -1
  266. package/dist/types.d.mts +25 -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 +17 -18
  371. package/src/identity.ts +36 -0
  372. package/src/index.ts +4 -0
  373. package/src/plugin.ts +88 -91
  374. package/src/remote-entry.ts +171 -0
  375. package/src/runtime/errors.ts +229 -26
  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 +218 -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 +271 -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 +25 -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
@@ -0,0 +1,81 @@
1
+ import { createRequire } from "node:module";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { execFile } from "node:child_process";
5
+ import { promisify } from "node:util";
6
+
7
+ //#region src/build/contract-types.ts
8
+ const execFileAsync = promisify(execFile);
9
+ const CONTRACT_ENTRY = path.join("src", "contract.ts");
10
+ const CONTRACT_TYPES_DIR = "types";
11
+ const CONTRACT_TYPES_FILE = path.join("types", "contract.d.ts");
12
+ function contractTypesUpToDate(cwd) {
13
+ const entry = path.join(cwd, CONTRACT_ENTRY);
14
+ const outFile = path.join(cwd, CONTRACT_TYPES_FILE);
15
+ if (!fs.existsSync(entry) || !fs.existsSync(outFile)) return false;
16
+ return fs.statSync(outFile).mtimeMs >= fs.statSync(entry).mtimeMs;
17
+ }
18
+ function resolveTscBinary(cwd) {
19
+ for (const from of [path.join(cwd, "package.json"), path.join(import.meta.dirname, "..", "..", "..", "package.json")]) try {
20
+ const pkgJsonPath = createRequire(path.resolve(from)).resolve("typescript/package.json");
21
+ return path.join(path.dirname(pkgJsonPath), "bin", "tsc");
22
+ } catch {}
23
+ return "tsc";
24
+ }
25
+ /**
26
+ * Regenerates types/contract.d.ts for a plugin workspace by invoking the
27
+ * workspace's TypeScript 7 binary with explicit flags — no tsconfig file
28
+ * involved, so emit layout is deterministic and there is nothing to sync.
29
+ *
30
+ * - "skipped": the workspace has no src/contract.ts
31
+ * - "up-to-date": types/contract.d.ts is newer than src/contract.ts
32
+ * - "generated": declarations were re-emitted (types/ is cleaned first, so
33
+ * stale nested layouts never survive)
34
+ */
35
+ async function generateContractTypes(cwd = process.cwd()) {
36
+ const entry = path.join(cwd, CONTRACT_ENTRY);
37
+ if (!fs.existsSync(entry)) return "skipped";
38
+ if (contractTypesUpToDate(cwd)) return "up-to-date";
39
+ const outDir = path.join(cwd, CONTRACT_TYPES_DIR);
40
+ fs.rmSync(outDir, {
41
+ recursive: true,
42
+ force: true
43
+ });
44
+ fs.mkdirSync(outDir, { recursive: true });
45
+ const tsc = resolveTscBinary(cwd);
46
+ const args = [
47
+ "--ignoreConfig",
48
+ "--emitDeclarationOnly",
49
+ "--declaration",
50
+ "--rootDir",
51
+ "src",
52
+ "--outDir",
53
+ CONTRACT_TYPES_DIR,
54
+ "--target",
55
+ "esnext",
56
+ "--module",
57
+ "esnext",
58
+ "--moduleResolution",
59
+ "bundler",
60
+ "--strict",
61
+ "--skipLibCheck",
62
+ CONTRACT_ENTRY
63
+ ];
64
+ try {
65
+ await execFileAsync(process.execPath, [tsc, ...args], { cwd });
66
+ } catch (error) {
67
+ const err = error;
68
+ const detail = [
69
+ err.stderr,
70
+ err.stdout,
71
+ err.message
72
+ ].filter(Boolean).join("\n").trim();
73
+ throw new Error(`Contract type generation failed for ${path.basename(cwd)} — tsc exited non-zero:\n${detail}`);
74
+ }
75
+ if (!fs.existsSync(path.join(cwd, CONTRACT_TYPES_FILE))) throw new Error(`Contract type generation produced no output — expected ${path.join(cwd, CONTRACT_TYPES_FILE)}`);
76
+ return "generated";
77
+ }
78
+
79
+ //#endregion
80
+ export { CONTRACT_ENTRY, CONTRACT_TYPES_DIR, CONTRACT_TYPES_FILE, contractTypesUpToDate, generateContractTypes, resolveTscBinary };
81
+ //# sourceMappingURL=contract-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-types.mjs","names":[],"sources":["../../src/build/contract-types.ts"],"sourcesContent":["import { execFile } from \"node:child_process\";\nimport fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { promisify } from \"node:util\";\n\nconst execFileAsync = promisify(execFile);\n\nexport type ContractTypesStatus = \"generated\" | \"up-to-date\" | \"skipped\";\n\nexport const CONTRACT_ENTRY = path.join(\"src\", \"contract.ts\");\nexport const CONTRACT_TYPES_DIR = \"types\";\nexport const CONTRACT_TYPES_FILE = path.join(\"types\", \"contract.d.ts\");\n\nexport function contractTypesUpToDate(cwd: string): boolean {\n const entry = path.join(cwd, CONTRACT_ENTRY);\n const outFile = path.join(cwd, CONTRACT_TYPES_FILE);\n if (!fs.existsSync(entry) || !fs.existsSync(outFile)) return false;\n return fs.statSync(outFile).mtimeMs >= fs.statSync(entry).mtimeMs;\n}\n\nexport function resolveTscBinary(cwd: string): string {\n for (const from of [\n path.join(cwd, \"package.json\"),\n path.join(import.meta.dirname, \"..\", \"..\", \"..\", \"package.json\"),\n ]) {\n try {\n const req = createRequire(path.resolve(from));\n const pkgJsonPath = req.resolve(\"typescript/package.json\");\n return path.join(path.dirname(pkgJsonPath), \"bin\", \"tsc\");\n } catch {\n // try the next resolution root\n }\n }\n return \"tsc\";\n}\n\n/**\n * Regenerates types/contract.d.ts for a plugin workspace by invoking the\n * workspace's TypeScript 7 binary with explicit flags — no tsconfig file\n * involved, so emit layout is deterministic and there is nothing to sync.\n *\n * - \"skipped\": the workspace has no src/contract.ts\n * - \"up-to-date\": types/contract.d.ts is newer than src/contract.ts\n * - \"generated\": declarations were re-emitted (types/ is cleaned first, so\n * stale nested layouts never survive)\n */\nexport async function generateContractTypes(\n cwd: string = process.cwd(),\n): Promise<ContractTypesStatus> {\n const entry = path.join(cwd, CONTRACT_ENTRY);\n if (!fs.existsSync(entry)) {\n return \"skipped\";\n }\n\n if (contractTypesUpToDate(cwd)) {\n return \"up-to-date\";\n }\n\n const outDir = path.join(cwd, CONTRACT_TYPES_DIR);\n fs.rmSync(outDir, { recursive: true, force: true });\n fs.mkdirSync(outDir, { recursive: true });\n\n const tsc = resolveTscBinary(cwd);\n const args = [\n \"--ignoreConfig\",\n \"--emitDeclarationOnly\",\n \"--declaration\",\n \"--rootDir\",\n \"src\",\n \"--outDir\",\n CONTRACT_TYPES_DIR,\n \"--target\",\n \"esnext\",\n \"--module\",\n \"esnext\",\n \"--moduleResolution\",\n \"bundler\",\n \"--strict\",\n \"--skipLibCheck\",\n CONTRACT_ENTRY,\n ];\n\n try {\n await execFileAsync(process.execPath, [tsc, ...args], { cwd });\n } catch (error) {\n const err = error as { message?: string; stdout?: string; stderr?: string };\n const detail = [err.stderr, err.stdout, err.message].filter(Boolean).join(\"\\n\").trim();\n throw new Error(\n `Contract type generation failed for ${path.basename(cwd)} — tsc exited non-zero:\\n${detail}`,\n );\n }\n\n if (!fs.existsSync(path.join(cwd, CONTRACT_TYPES_FILE))) {\n throw new Error(\n `Contract type generation produced no output — expected ${path.join(cwd, CONTRACT_TYPES_FILE)}`,\n );\n }\n\n return \"generated\";\n}\n"],"mappings":";;;;;;;AAMA,MAAM,gBAAgB,UAAU,QAAQ;AAIxC,MAAa,iBAAiB,KAAK,KAAK,OAAO,aAAa;AAC5D,MAAa,qBAAqB;AAClC,MAAa,sBAAsB,KAAK,KAAK,SAAS,eAAe;AAErE,SAAgB,sBAAsB,KAAsB;CAC1D,MAAM,QAAQ,KAAK,KAAK,KAAK,cAAc;CAC3C,MAAM,UAAU,KAAK,KAAK,KAAK,mBAAmB;CAClD,IAAI,CAAC,GAAG,WAAW,KAAK,KAAK,CAAC,GAAG,WAAW,OAAO,GAAG,OAAO;CAC7D,OAAO,GAAG,SAAS,OAAO,CAAC,CAAC,WAAW,GAAG,SAAS,KAAK,CAAC,CAAC;AAC5D;AAEA,SAAgB,iBAAiB,KAAqB;CACpD,KAAK,MAAM,QAAQ,CACjB,KAAK,KAAK,KAAK,cAAc,GAC7B,KAAK,KAAK,YAAY,SAAS,MAAM,MAAM,MAAM,cAAc,CACjE,GACE,IAAI;EAEF,MAAM,cADM,cAAc,KAAK,QAAQ,IAAI,CACrB,CAAC,CAAC,QAAQ,yBAAyB;EACzD,OAAO,KAAK,KAAK,KAAK,QAAQ,WAAW,GAAG,OAAO,KAAK;CAC1D,QAAQ,CAER;CAEF,OAAO;AACT;;;;;;;;;;;AAYA,eAAsB,sBACpB,MAAc,QAAQ,IAAI,GACI;CAC9B,MAAM,QAAQ,KAAK,KAAK,KAAK,cAAc;CAC3C,IAAI,CAAC,GAAG,WAAW,KAAK,GACtB,OAAO;CAGT,IAAI,sBAAsB,GAAG,GAC3B,OAAO;CAGT,MAAM,SAAS,KAAK,KAAK,KAAK,kBAAkB;CAChD,GAAG,OAAO,QAAQ;EAAE,WAAW;EAAM,OAAO;CAAK,CAAC;CAClD,GAAG,UAAU,QAAQ,EAAE,WAAW,KAAK,CAAC;CAExC,MAAM,MAAM,iBAAiB,GAAG;CAChC,MAAM,OAAO;EACX;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;CAEA,IAAI;EACF,MAAM,cAAc,QAAQ,UAAU,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,IAAI,CAAC;CAC/D,SAAS,OAAO;EACd,MAAM,MAAM;EACZ,MAAM,SAAS;GAAC,IAAI;GAAQ,IAAI;GAAQ,IAAI;EAAO,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK;EACrF,MAAM,IAAI,MACR,uCAAuC,KAAK,SAAS,GAAG,EAAE,2BAA2B,QACvF;CACF;CAEA,IAAI,CAAC,GAAG,WAAW,KAAK,KAAK,KAAK,mBAAmB,CAAC,GACpD,MAAM,IAAI,MACR,0DAA0D,KAAK,KAAK,KAAK,mBAAmB,GAC9F;CAGF,OAAO;AACT"}
@@ -0,0 +1,37 @@
1
+ const require_build_artifact_names = require('../artifact-names.cjs');
2
+
3
+ //#region src/build/rspack/build-report-plugin.ts
4
+ /**
5
+ * Emits `build-report.json` for the deploy leg: the container entry is hashed
6
+ * by the build's filename template (`remoteEntry.[contenthash].js`), and the
7
+ * report names it — in-compilation, so watch-mode cleans can't open a window
8
+ * where the report 404s (mirrors the `output.clean` rationale on the build
9
+ * plugin).
10
+ */
11
+ var BuildReportPlugin = class {
12
+ entryBase;
13
+ name = "BuildReportPlugin";
14
+ constructor(entryBase = "remoteEntry") {
15
+ this.entryBase = entryBase;
16
+ }
17
+ apply(compiler) {
18
+ compiler.hooks.thisCompilation.tap(this.name, (compilation) => {
19
+ const webpack = compiler.webpack;
20
+ const rawSource = webpack?.sources?.RawSource;
21
+ const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1e3;
22
+ compilation.hooks.processAssets.tap({
23
+ name: this.name,
24
+ stage
25
+ }, (assets) => {
26
+ const entry = require_build_artifact_names.findHashedEntry(Object.keys(assets), this.entryBase);
27
+ if (!entry || !rawSource) return;
28
+ const report = require_build_artifact_names.BuildEntryReportSchema.parse({ entry });
29
+ compilation.emitAsset("build-report.json", new rawSource(`${JSON.stringify(report, null, 2)}\n`));
30
+ });
31
+ });
32
+ }
33
+ };
34
+
35
+ //#endregion
36
+ exports.BuildReportPlugin = BuildReportPlugin;
37
+ //# sourceMappingURL=build-report-plugin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-report-plugin.cjs","names":["findHashedEntry","BuildEntryReportSchema"],"sources":["../../../src/build/rspack/build-report-plugin.ts"],"sourcesContent":["import type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { BuildEntryReportSchema, findHashedEntry } from \"../artifact-names\";\n\n/**\n * Emits `build-report.json` for the deploy leg: the container entry is hashed\n * by the build's filename template (`remoteEntry.[contenthash].js`), and the\n * report names it — in-compilation, so watch-mode cleans can't open a window\n * where the report 404s (mirrors the `output.clean` rationale on the build\n * plugin).\n */\nexport class BuildReportPlugin implements RspackPluginInstance {\n name = \"BuildReportPlugin\";\n\n constructor(private entryBase = \"remoteEntry\") {}\n\n apply(compiler: Compiler) {\n compiler.hooks.thisCompilation.tap(this.name, (compilation) => {\n const webpack = (compiler as Compiler & { webpack?: any }).webpack;\n const rawSource = webpack?.sources?.RawSource;\n const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1000;\n\n compilation.hooks.processAssets.tap({ name: this.name, stage }, (assets) => {\n const entry = findHashedEntry(Object.keys(assets), this.entryBase);\n if (!entry || !rawSource) return;\n\n const report = BuildEntryReportSchema.parse({ entry });\n compilation.emitAsset(\n \"build-report.json\",\n new rawSource(`${JSON.stringify(report, null, 2)}\\n`),\n );\n });\n });\n }\n}\n"],"mappings":";;;;;;;;;;AAUA,IAAa,oBAAb,MAA+D;CAGzC;CAFpB,OAAO;CAEP,YAAY,AAAQ,YAAY,eAAe;EAA3B;CAA4B;CAEhD,MAAM,UAAoB;EACxB,SAAS,MAAM,gBAAgB,IAAI,KAAK,OAAO,gBAAgB;GAC7D,MAAM,UAAW,SAA0C;GAC3D,MAAM,YAAY,SAAS,SAAS;GACpC,MAAM,QAAQ,SAAS,aAAa,kCAAkC;GAEtE,YAAY,MAAM,cAAc,IAAI;IAAE,MAAM,KAAK;IAAM;GAAM,IAAI,WAAW;IAC1E,MAAM,QAAQA,6CAAgB,OAAO,KAAK,MAAM,GAAG,KAAK,SAAS;IACjE,IAAI,CAAC,SAAS,CAAC,WAAW;IAE1B,MAAM,SAASC,oDAAuB,MAAM,EAAE,MAAM,CAAC;IACrD,YAAY,UACV,qBACA,IAAI,UAAU,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE,GAAG,CACtD;GACF,CAAC;EACH,CAAC;CACH;AACF"}
@@ -0,0 +1,18 @@
1
+ import { Compiler, RspackPluginInstance } from "@rspack/core";
2
+ //#region src/build/rspack/build-report-plugin.d.ts
3
+ /**
4
+ * Emits `build-report.json` for the deploy leg: the container entry is hashed
5
+ * by the build's filename template (`remoteEntry.[contenthash].js`), and the
6
+ * report names it — in-compilation, so watch-mode cleans can't open a window
7
+ * where the report 404s (mirrors the `output.clean` rationale on the build
8
+ * plugin).
9
+ */
10
+ declare class BuildReportPlugin implements RspackPluginInstance {
11
+ private entryBase;
12
+ name: string;
13
+ constructor(entryBase?: string);
14
+ apply(compiler: Compiler): void;
15
+ }
16
+ //#endregion
17
+ export { BuildReportPlugin };
18
+ //# sourceMappingURL=build-report-plugin.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-report-plugin.d.cts","names":[],"sources":["../../../src/build/rspack/build-report-plugin.ts"],"mappings":";;;;;;;;;cAUa,6BAA6B;UAGpB;EAFpB;EAEA,YAAoB;EAEpB,MAAM,UAAU"}
@@ -0,0 +1,18 @@
1
+ import { Compiler, RspackPluginInstance } from "@rspack/core";
2
+ //#region src/build/rspack/build-report-plugin.d.ts
3
+ /**
4
+ * Emits `build-report.json` for the deploy leg: the container entry is hashed
5
+ * by the build's filename template (`remoteEntry.[contenthash].js`), and the
6
+ * report names it — in-compilation, so watch-mode cleans can't open a window
7
+ * where the report 404s (mirrors the `output.clean` rationale on the build
8
+ * plugin).
9
+ */
10
+ declare class BuildReportPlugin implements RspackPluginInstance {
11
+ private entryBase;
12
+ name: string;
13
+ constructor(entryBase?: string);
14
+ apply(compiler: Compiler): void;
15
+ }
16
+ //#endregion
17
+ export { BuildReportPlugin };
18
+ //# sourceMappingURL=build-report-plugin.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-report-plugin.d.mts","names":[],"sources":["../../../src/build/rspack/build-report-plugin.ts"],"mappings":";;;;;;;;;cAUa,6BAA6B;UAGpB;EAFpB;EAEA,YAAoB;EAEpB,MAAM,UAAU"}
@@ -0,0 +1,37 @@
1
+ import { BuildEntryReportSchema, findHashedEntry } from "../artifact-names.mjs";
2
+
3
+ //#region src/build/rspack/build-report-plugin.ts
4
+ /**
5
+ * Emits `build-report.json` for the deploy leg: the container entry is hashed
6
+ * by the build's filename template (`remoteEntry.[contenthash].js`), and the
7
+ * report names it — in-compilation, so watch-mode cleans can't open a window
8
+ * where the report 404s (mirrors the `output.clean` rationale on the build
9
+ * plugin).
10
+ */
11
+ var BuildReportPlugin = class {
12
+ entryBase;
13
+ name = "BuildReportPlugin";
14
+ constructor(entryBase = "remoteEntry") {
15
+ this.entryBase = entryBase;
16
+ }
17
+ apply(compiler) {
18
+ compiler.hooks.thisCompilation.tap(this.name, (compilation) => {
19
+ const webpack = compiler.webpack;
20
+ const rawSource = webpack?.sources?.RawSource;
21
+ const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1e3;
22
+ compilation.hooks.processAssets.tap({
23
+ name: this.name,
24
+ stage
25
+ }, (assets) => {
26
+ const entry = findHashedEntry(Object.keys(assets), this.entryBase);
27
+ if (!entry || !rawSource) return;
28
+ const report = BuildEntryReportSchema.parse({ entry });
29
+ compilation.emitAsset("build-report.json", new rawSource(`${JSON.stringify(report, null, 2)}\n`));
30
+ });
31
+ });
32
+ }
33
+ };
34
+
35
+ //#endregion
36
+ export { BuildReportPlugin };
37
+ //# sourceMappingURL=build-report-plugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-report-plugin.mjs","names":[],"sources":["../../../src/build/rspack/build-report-plugin.ts"],"sourcesContent":["import type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { BuildEntryReportSchema, findHashedEntry } from \"../artifact-names\";\n\n/**\n * Emits `build-report.json` for the deploy leg: the container entry is hashed\n * by the build's filename template (`remoteEntry.[contenthash].js`), and the\n * report names it — in-compilation, so watch-mode cleans can't open a window\n * where the report 404s (mirrors the `output.clean` rationale on the build\n * plugin).\n */\nexport class BuildReportPlugin implements RspackPluginInstance {\n name = \"BuildReportPlugin\";\n\n constructor(private entryBase = \"remoteEntry\") {}\n\n apply(compiler: Compiler) {\n compiler.hooks.thisCompilation.tap(this.name, (compilation) => {\n const webpack = (compiler as Compiler & { webpack?: any }).webpack;\n const rawSource = webpack?.sources?.RawSource;\n const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1000;\n\n compilation.hooks.processAssets.tap({ name: this.name, stage }, (assets) => {\n const entry = findHashedEntry(Object.keys(assets), this.entryBase);\n if (!entry || !rawSource) return;\n\n const report = BuildEntryReportSchema.parse({ entry });\n compilation.emitAsset(\n \"build-report.json\",\n new rawSource(`${JSON.stringify(report, null, 2)}\\n`),\n );\n });\n });\n }\n}\n"],"mappings":";;;;;;;;;;AAUA,IAAa,oBAAb,MAA+D;CAGzC;CAFpB,OAAO;CAEP,YAAY,AAAQ,YAAY,eAAe;EAA3B;CAA4B;CAEhD,MAAM,UAAoB;EACxB,SAAS,MAAM,gBAAgB,IAAI,KAAK,OAAO,gBAAgB;GAC7D,MAAM,UAAW,SAA0C;GAC3D,MAAM,YAAY,SAAS,SAAS;GACpC,MAAM,QAAQ,SAAS,aAAa,kCAAkC;GAEtE,YAAY,MAAM,cAAc,IAAI;IAAE,MAAM,KAAK;IAAM;GAAM,IAAI,WAAW;IAC1E,MAAM,QAAQ,gBAAgB,OAAO,KAAK,MAAM,GAAG,KAAK,SAAS;IACjE,IAAI,CAAC,SAAS,CAAC,WAAW;IAE1B,MAAM,SAAS,uBAAuB,MAAM,EAAE,MAAM,CAAC;IACrD,YAAY,UACV,qBACA,IAAI,UAAU,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE,GAAG,CACtD;GACF,CAAC;EACH,CAAC;CACH;AACF"}
@@ -0,0 +1,47 @@
1
+ const require_build_artifact_names = require('../artifact-names.cjs');
2
+
3
+ //#region src/build/rspack/chunk-completeness-plugin.ts
4
+ /**
5
+ * Fails the build when a container entry's eager chunk references
6
+ * (`Promise.all([__webpack_require__.e(N), …])` in get factories) point at
7
+ * chunk files the compilation never emits. Rspack 2.x splitChunks re-ids the
8
+ * final chunk graph while the federation get-factory codegen can keep
9
+ * pre-split ids — the emitted entry then 404s its own chunks at load time and
10
+ * the failure surfaces downstream as `__webpack_modules__[r] is not a
11
+ * function`. SplitChunks is disabled in the composition for exactly this
12
+ * reason; this gate catches any regression loudly at build time instead.
13
+ */
14
+ var ChunkCompletenessPlugin = class {
15
+ entryBase;
16
+ name = "ChunkCompletenessPlugin";
17
+ constructor(entryBase = "remoteEntry") {
18
+ this.entryBase = entryBase;
19
+ }
20
+ apply(compiler) {
21
+ compiler.hooks.thisCompilation.tap(this.name, (compilation) => {
22
+ const stage = compiler.webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1e3;
23
+ compilation.hooks.processAssets.tap({
24
+ name: this.name,
25
+ stage
26
+ }, (assets) => {
27
+ const names = Object.keys(assets);
28
+ const entry = require_build_artifact_names.findHashedEntry(names, this.entryBase) ?? names.find((n) => n === `${this.entryBase}.js`);
29
+ if (!entry) return;
30
+ const jsFiles = new Set(names.filter((n) => n.endsWith(".js")));
31
+ const source = assets[entry].source().toString();
32
+ const special = /* @__PURE__ */ new Map();
33
+ const u = source.match(/\.u\s*=\s*(\w+)=>([^,;]+)/);
34
+ if (u) for (const m of u[2].matchAll(/(\d+)\s*===\s*\w+\s*\?\s*"([^"]+)"/g)) special.set(m[1], m[2]);
35
+ for (const pa of source.matchAll(/Promise\.all\(\[([^\]]*)\]\)/g)) for (const m of pa[1].matchAll(/(?:__webpack_require__|\w+)\.e\((\d+)\)/g)) {
36
+ const id = m[1];
37
+ const file = special.has(id) ? `${special.get(id)}.js` : `${id}.js`;
38
+ if (!jsFiles.has(file)) compilation.errors.push(/* @__PURE__ */ new Error(`[${this.name}] entry ${entry} eagerly loads chunk ${id} (${file}) but the compilation never emitted it — the built remote would fail at load time with "__webpack_modules__[r] is not a function".`));
39
+ }
40
+ });
41
+ });
42
+ }
43
+ };
44
+
45
+ //#endregion
46
+ exports.ChunkCompletenessPlugin = ChunkCompletenessPlugin;
47
+ //# sourceMappingURL=chunk-completeness-plugin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-completeness-plugin.cjs","names":["findHashedEntry"],"sources":["../../../src/build/rspack/chunk-completeness-plugin.ts"],"sourcesContent":["import type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { findHashedEntry } from \"../artifact-names\";\n\n/**\n * Fails the build when a container entry's eager chunk references\n * (`Promise.all([__webpack_require__.e(N), …])` in get factories) point at\n * chunk files the compilation never emits. Rspack 2.x splitChunks re-ids the\n * final chunk graph while the federation get-factory codegen can keep\n * pre-split ids — the emitted entry then 404s its own chunks at load time and\n * the failure surfaces downstream as `__webpack_modules__[r] is not a\n * function`. SplitChunks is disabled in the composition for exactly this\n * reason; this gate catches any regression loudly at build time instead.\n */\nexport class ChunkCompletenessPlugin implements RspackPluginInstance {\n name = \"ChunkCompletenessPlugin\";\n\n constructor(private entryBase = \"remoteEntry\") {}\n\n apply(compiler: Compiler) {\n compiler.hooks.thisCompilation.tap(this.name, (compilation) => {\n const webpack = (compiler as Compiler & { webpack?: any }).webpack;\n const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1000;\n\n compilation.hooks.processAssets.tap({ name: this.name, stage }, (assets) => {\n const names = Object.keys(assets);\n const entry =\n findHashedEntry(names, this.entryBase) ?? names.find((n) => n === `${this.entryBase}.js`);\n if (!entry) return;\n\n const jsFiles = new Set(names.filter((n) => n.endsWith(\".js\")));\n const source = assets[entry].source().toString();\n\n const special = new Map<string, string>();\n const u = source.match(/\\.u\\s*=\\s*(\\w+)=>([^,;]+)/);\n if (u) {\n for (const m of u[2].matchAll(/(\\d+)\\s*===\\s*\\w+\\s*\\?\\s*\"([^\"]+)\"/g)) {\n special.set(m[1], m[2]);\n }\n }\n\n for (const pa of source.matchAll(/Promise\\.all\\(\\[([^\\]]*)\\]\\)/g)) {\n for (const m of pa[1].matchAll(/(?:__webpack_require__|\\w+)\\.e\\((\\d+)\\)/g)) {\n const id = m[1];\n const file = special.has(id) ? `${special.get(id)}.js` : `${id}.js`;\n if (!jsFiles.has(file)) {\n compilation.errors.push(\n new Error(\n `[${this.name}] entry ${entry} eagerly loads chunk ${id} (${file}) but the compilation never emitted it — the built remote would fail at load time with \"__webpack_modules__[r] is not a function\".`,\n ),\n );\n }\n }\n }\n });\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,IAAa,0BAAb,MAAqE;CAG/C;CAFpB,OAAO;CAEP,YAAY,AAAQ,YAAY,eAAe;EAA3B;CAA4B;CAEhD,MAAM,UAAoB;EACxB,SAAS,MAAM,gBAAgB,IAAI,KAAK,OAAO,gBAAgB;GAE7D,MAAM,QADW,SAA0C,SACpC,aAAa,kCAAkC;GAEtE,YAAY,MAAM,cAAc,IAAI;IAAE,MAAM,KAAK;IAAM;GAAM,IAAI,WAAW;IAC1E,MAAM,QAAQ,OAAO,KAAK,MAAM;IAChC,MAAM,QACJA,6CAAgB,OAAO,KAAK,SAAS,KAAK,MAAM,MAAM,MAAM,MAAM,GAAG,KAAK,UAAU,IAAI;IAC1F,IAAI,CAAC,OAAO;IAEZ,MAAM,UAAU,IAAI,IAAI,MAAM,QAAQ,MAAM,EAAE,SAAS,KAAK,CAAC,CAAC;IAC9D,MAAM,SAAS,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS;IAE/C,MAAM,0BAAU,IAAI,IAAoB;IACxC,MAAM,IAAI,OAAO,MAAM,2BAA2B;IAClD,IAAI,GACF,KAAK,MAAM,KAAK,EAAE,EAAE,CAAC,SAAS,qCAAqC,GACjE,QAAQ,IAAI,EAAE,IAAI,EAAE,EAAE;IAI1B,KAAK,MAAM,MAAM,OAAO,SAAS,+BAA+B,GAC9D,KAAK,MAAM,KAAK,GAAG,EAAE,CAAC,SAAS,0CAA0C,GAAG;KAC1E,MAAM,KAAK,EAAE;KACb,MAAM,OAAO,QAAQ,IAAI,EAAE,IAAI,GAAG,QAAQ,IAAI,EAAE,EAAE,OAAO,GAAG,GAAG;KAC/D,IAAI,CAAC,QAAQ,IAAI,IAAI,GACnB,YAAY,OAAO,qBACjB,IAAI,MACF,IAAI,KAAK,KAAK,UAAU,MAAM,uBAAuB,GAAG,IAAI,KAAK,mIACnE,CACF;IAEJ;GAEJ,CAAC;EACH,CAAC;CACH;AACF"}
@@ -0,0 +1,47 @@
1
+ import { findHashedEntry } from "../artifact-names.mjs";
2
+
3
+ //#region src/build/rspack/chunk-completeness-plugin.ts
4
+ /**
5
+ * Fails the build when a container entry's eager chunk references
6
+ * (`Promise.all([__webpack_require__.e(N), …])` in get factories) point at
7
+ * chunk files the compilation never emits. Rspack 2.x splitChunks re-ids the
8
+ * final chunk graph while the federation get-factory codegen can keep
9
+ * pre-split ids — the emitted entry then 404s its own chunks at load time and
10
+ * the failure surfaces downstream as `__webpack_modules__[r] is not a
11
+ * function`. SplitChunks is disabled in the composition for exactly this
12
+ * reason; this gate catches any regression loudly at build time instead.
13
+ */
14
+ var ChunkCompletenessPlugin = class {
15
+ entryBase;
16
+ name = "ChunkCompletenessPlugin";
17
+ constructor(entryBase = "remoteEntry") {
18
+ this.entryBase = entryBase;
19
+ }
20
+ apply(compiler) {
21
+ compiler.hooks.thisCompilation.tap(this.name, (compilation) => {
22
+ const stage = compiler.webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1e3;
23
+ compilation.hooks.processAssets.tap({
24
+ name: this.name,
25
+ stage
26
+ }, (assets) => {
27
+ const names = Object.keys(assets);
28
+ const entry = findHashedEntry(names, this.entryBase) ?? names.find((n) => n === `${this.entryBase}.js`);
29
+ if (!entry) return;
30
+ const jsFiles = new Set(names.filter((n) => n.endsWith(".js")));
31
+ const source = assets[entry].source().toString();
32
+ const special = /* @__PURE__ */ new Map();
33
+ const u = source.match(/\.u\s*=\s*(\w+)=>([^,;]+)/);
34
+ if (u) for (const m of u[2].matchAll(/(\d+)\s*===\s*\w+\s*\?\s*"([^"]+)"/g)) special.set(m[1], m[2]);
35
+ for (const pa of source.matchAll(/Promise\.all\(\[([^\]]*)\]\)/g)) for (const m of pa[1].matchAll(/(?:__webpack_require__|\w+)\.e\((\d+)\)/g)) {
36
+ const id = m[1];
37
+ const file = special.has(id) ? `${special.get(id)}.js` : `${id}.js`;
38
+ if (!jsFiles.has(file)) compilation.errors.push(/* @__PURE__ */ new Error(`[${this.name}] entry ${entry} eagerly loads chunk ${id} (${file}) but the compilation never emitted it — the built remote would fail at load time with "__webpack_modules__[r] is not a function".`));
39
+ }
40
+ });
41
+ });
42
+ }
43
+ };
44
+
45
+ //#endregion
46
+ export { ChunkCompletenessPlugin };
47
+ //# sourceMappingURL=chunk-completeness-plugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-completeness-plugin.mjs","names":[],"sources":["../../../src/build/rspack/chunk-completeness-plugin.ts"],"sourcesContent":["import type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { findHashedEntry } from \"../artifact-names\";\n\n/**\n * Fails the build when a container entry's eager chunk references\n * (`Promise.all([__webpack_require__.e(N), …])` in get factories) point at\n * chunk files the compilation never emits. Rspack 2.x splitChunks re-ids the\n * final chunk graph while the federation get-factory codegen can keep\n * pre-split ids — the emitted entry then 404s its own chunks at load time and\n * the failure surfaces downstream as `__webpack_modules__[r] is not a\n * function`. SplitChunks is disabled in the composition for exactly this\n * reason; this gate catches any regression loudly at build time instead.\n */\nexport class ChunkCompletenessPlugin implements RspackPluginInstance {\n name = \"ChunkCompletenessPlugin\";\n\n constructor(private entryBase = \"remoteEntry\") {}\n\n apply(compiler: Compiler) {\n compiler.hooks.thisCompilation.tap(this.name, (compilation) => {\n const webpack = (compiler as Compiler & { webpack?: any }).webpack;\n const stage = webpack?.Compilation?.PROCESS_ASSETS_STAGE_ADDITIONS ?? 1000;\n\n compilation.hooks.processAssets.tap({ name: this.name, stage }, (assets) => {\n const names = Object.keys(assets);\n const entry =\n findHashedEntry(names, this.entryBase) ?? names.find((n) => n === `${this.entryBase}.js`);\n if (!entry) return;\n\n const jsFiles = new Set(names.filter((n) => n.endsWith(\".js\")));\n const source = assets[entry].source().toString();\n\n const special = new Map<string, string>();\n const u = source.match(/\\.u\\s*=\\s*(\\w+)=>([^,;]+)/);\n if (u) {\n for (const m of u[2].matchAll(/(\\d+)\\s*===\\s*\\w+\\s*\\?\\s*\"([^\"]+)\"/g)) {\n special.set(m[1], m[2]);\n }\n }\n\n for (const pa of source.matchAll(/Promise\\.all\\(\\[([^\\]]*)\\]\\)/g)) {\n for (const m of pa[1].matchAll(/(?:__webpack_require__|\\w+)\\.e\\((\\d+)\\)/g)) {\n const id = m[1];\n const file = special.has(id) ? `${special.get(id)}.js` : `${id}.js`;\n if (!jsFiles.has(file)) {\n compilation.errors.push(\n new Error(\n `[${this.name}] entry ${entry} eagerly loads chunk ${id} (${file}) but the compilation never emitted it — the built remote would fail at load time with \"__webpack_modules__[r] is not a function\".`,\n ),\n );\n }\n }\n }\n });\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,IAAa,0BAAb,MAAqE;CAG/C;CAFpB,OAAO;CAEP,YAAY,AAAQ,YAAY,eAAe;EAA3B;CAA4B;CAEhD,MAAM,UAAoB;EACxB,SAAS,MAAM,gBAAgB,IAAI,KAAK,OAAO,gBAAgB;GAE7D,MAAM,QADW,SAA0C,SACpC,aAAa,kCAAkC;GAEtE,YAAY,MAAM,cAAc,IAAI;IAAE,MAAM,KAAK;IAAM;GAAM,IAAI,WAAW;IAC1E,MAAM,QAAQ,OAAO,KAAK,MAAM;IAChC,MAAM,QACJ,gBAAgB,OAAO,KAAK,SAAS,KAAK,MAAM,MAAM,MAAM,MAAM,GAAG,KAAK,UAAU,IAAI;IAC1F,IAAI,CAAC,OAAO;IAEZ,MAAM,UAAU,IAAI,IAAI,MAAM,QAAQ,MAAM,EAAE,SAAS,KAAK,CAAC,CAAC;IAC9D,MAAM,SAAS,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,SAAS;IAE/C,MAAM,0BAAU,IAAI,IAAoB;IACxC,MAAM,IAAI,OAAO,MAAM,2BAA2B;IAClD,IAAI,GACF,KAAK,MAAM,KAAK,EAAE,EAAE,CAAC,SAAS,qCAAqC,GACjE,QAAQ,IAAI,EAAE,IAAI,EAAE,EAAE;IAI1B,KAAK,MAAM,MAAM,OAAO,SAAS,+BAA+B,GAC9D,KAAK,MAAM,KAAK,GAAG,EAAE,CAAC,SAAS,0CAA0C,GAAG;KAC1E,MAAM,KAAK,EAAE;KACb,MAAM,OAAO,QAAQ,IAAI,EAAE,IAAI,GAAG,QAAQ,IAAI,EAAE,EAAE,OAAO,GAAG,GAAG;KAC/D,IAAI,CAAC,QAAQ,IAAI,IAAI,GACnB,YAAY,OAAO,qBACjB,IAAI,MACF,IAAI,KAAK,KAAK,UAAU,MAAM,uBAAuB,GAAG,IAAI,KAAK,mIACnE,CACF;IAEJ;GAEJ,CAAC;EACH,CAAC;CACH;AACF"}
@@ -0,0 +1,69 @@
1
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
2
+ const require_fix_mf_data_uri_plugin = require('./fix-mf-data-uri-plugin.cjs');
3
+ const require_plugin = require('./plugin.cjs');
4
+ let node_fs = require("node:fs");
5
+ node_fs = require_runtime.__toESM(node_fs, 1);
6
+ let node_module = require("node:module");
7
+ let node_path = require("node:path");
8
+ node_path = require_runtime.__toESM(node_path, 1);
9
+
10
+ //#region src/build/rspack/compose.ts
11
+ var EveryPluginComposedBuild = class {
12
+ dts;
13
+ name = "EveryPluginComposedBuild";
14
+ constructor(dts = false) {
15
+ this.dts = dts;
16
+ }
17
+ apply(compiler) {
18
+ new require_plugin.EmitPluginManifest().apply(compiler);
19
+ new require_plugin.EveryPluginBuild({ dts: this.dts }).apply(compiler);
20
+ new require_fix_mf_data_uri_plugin.FixMfDataUriPlugin().apply(compiler);
21
+ }
22
+ };
23
+ const pluginRequire = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
24
+ /** Config filenames that mark a project root, nearest-first. Authored
25
+ * descriptor projects (the platform) carry bos.app.ts; generated child
26
+ * projects carry bos.config.json. */
27
+ const CONFIG_FILENAMES = ["bos.config.json", "bos.app.ts"];
28
+ function findBosConfigPath(from = process.cwd()) {
29
+ let current = node_path.default.resolve(from);
30
+ while (true) {
31
+ for (const filename of CONFIG_FILENAMES) {
32
+ const candidate = node_path.default.join(current, filename);
33
+ if (node_fs.default.existsSync(candidate)) return candidate;
34
+ }
35
+ const parent = node_path.default.dirname(current);
36
+ if (parent === current) return null;
37
+ current = parent;
38
+ }
39
+ }
40
+ function loadDrizzleMigrationsPlugin() {
41
+ try {
42
+ const mod = pluginRequire("@proj-airi/unplugin-drizzle-orm-migrations/rspack");
43
+ return mod.default ?? mod;
44
+ } catch {
45
+ return null;
46
+ }
47
+ }
48
+ function createPluginBaseConfig(options = {}) {
49
+ const shouldDeploy = process.env.DEPLOY === "true";
50
+ const plugins = [new EveryPluginComposedBuild(false)];
51
+ if (options.drizzle !== false) {
52
+ const drizzlePlugin = loadDrizzleMigrationsPlugin();
53
+ if (drizzlePlugin) plugins.push(drizzlePlugin());
54
+ else if (options.drizzle === true) throw new Error("createPluginBaseConfig({ drizzle: true }) requires @proj-airi/unplugin-drizzle-orm-migrations to be installed.");
55
+ }
56
+ return {
57
+ ...options.rspack,
58
+ externals: options.externals ?? options.rspack?.externals ?? ["pg", "@electric-sql/pglite"],
59
+ devtool: options.rspack?.devtool ?? (shouldDeploy ? false : "source-map"),
60
+ plugins,
61
+ infrastructureLogging: options.rspack?.infrastructureLogging ?? { level: "error" },
62
+ stats: options.rspack?.stats ?? "errors-warnings"
63
+ };
64
+ }
65
+
66
+ //#endregion
67
+ exports.createPluginBaseConfig = createPluginBaseConfig;
68
+ exports.findBosConfigPath = findBosConfigPath;
69
+ //# sourceMappingURL=compose.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.cjs","names":["EmitPluginManifest","EveryPluginBuild","FixMfDataUriPlugin","createRequire","path","fs"],"sources":["../../../src/build/rspack/compose.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { FixMfDataUriPlugin } from \"./fix-mf-data-uri-plugin\";\nimport { EmitPluginManifest, EveryPluginBuild } from \"./plugin\";\n\nclass EveryPluginComposedBuild implements RspackPluginInstance {\n name = \"EveryPluginComposedBuild\";\n\n constructor(private readonly dts: boolean = false) {}\n\n apply(compiler: Compiler) {\n new EmitPluginManifest().apply(compiler);\n new EveryPluginBuild({ dts: this.dts }).apply(compiler);\n new FixMfDataUriPlugin().apply(compiler);\n }\n}\n\nexport interface PluginBaseConfigOptions {\n drizzle?: boolean;\n externals?: string[];\n /** Concrete rspack fields to merge over the defaults (devtool, infrastructureLogging, ...). */\n rspack?: Partial<PluginBaseConfig>;\n}\n\nconst pluginRequire = createRequire(import.meta.url);\n\n/** Config filenames that mark a project root, nearest-first. Authored\n * descriptor projects (the platform) carry bos.app.ts; generated child\n * projects carry bos.config.json. */\nconst CONFIG_FILENAMES = [\"bos.config.json\", \"bos.app.ts\"] as const;\n\nexport function findBosConfigPath(from: string = process.cwd()): string | null {\n let current = path.resolve(from);\n while (true) {\n for (const filename of CONFIG_FILENAMES) {\n const candidate = path.join(current, filename);\n if (fs.existsSync(candidate)) return candidate;\n }\n const parent = path.dirname(current);\n if (parent === current) return null;\n current = parent;\n }\n}\n\nfunction loadDrizzleMigrationsPlugin(): ((...args: unknown[]) => unknown) | null {\n try {\n const mod = pluginRequire(\"@proj-airi/unplugin-drizzle-orm-migrations/rspack\");\n return (mod as { default?: (...args: unknown[]) => unknown }).default ?? mod;\n } catch {\n return null;\n }\n}\n\nexport interface PluginBaseConfig {\n externals: string[];\n devtool: false | \"source-map\";\n plugins: unknown[];\n infrastructureLogging: { level: \"error\" };\n stats: \"errors-warnings\";\n}\n\nexport function createPluginBaseConfig(options: PluginBaseConfigOptions = {}): PluginBaseConfig {\n const shouldDeploy = process.env.DEPLOY === \"true\";\n const plugins: unknown[] = [new EveryPluginComposedBuild(false)];\n\n if (options.drizzle !== false) {\n const drizzlePlugin = loadDrizzleMigrationsPlugin();\n if (drizzlePlugin) {\n plugins.push(drizzlePlugin());\n } else if (options.drizzle === true) {\n throw new Error(\n \"createPluginBaseConfig({ drizzle: true }) requires @proj-airi/unplugin-drizzle-orm-migrations to be installed.\",\n );\n }\n }\n\n return {\n ...options.rspack,\n externals: options.externals ?? options.rspack?.externals ?? [\"pg\", \"@electric-sql/pglite\"],\n devtool: options.rspack?.devtool ?? (shouldDeploy ? false : \"source-map\"),\n plugins,\n infrastructureLogging: options.rspack?.infrastructureLogging ?? { level: \"error\" },\n stats: options.rspack?.stats ?? \"errors-warnings\",\n };\n}\n"],"mappings":";;;;;;;;;;AAOA,IAAM,2BAAN,MAA+D;CAGhC;CAF7B,OAAO;CAEP,YAAY,AAAiB,MAAe,OAAO;EAAtB;CAAuB;CAEpD,MAAM,UAAoB;EACxB,IAAIA,kCAAmB,CAAC,CAAC,MAAM,QAAQ;EACvC,IAAIC,gCAAiB,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,QAAQ;EACtD,IAAIC,kDAAmB,CAAC,CAAC,MAAM,QAAQ;CACzC;AACF;AASA,MAAM,oBAAgBC,wEAA6B;;;;AAKnD,MAAM,mBAAmB,CAAC,mBAAmB,YAAY;AAEzD,SAAgB,kBAAkB,OAAe,QAAQ,IAAI,GAAkB;CAC7E,IAAI,UAAUC,kBAAK,QAAQ,IAAI;CAC/B,OAAO,MAAM;EACX,KAAK,MAAM,YAAY,kBAAkB;GACvC,MAAM,YAAYA,kBAAK,KAAK,SAAS,QAAQ;GAC7C,IAAIC,gBAAG,WAAW,SAAS,GAAG,OAAO;EACvC;EACA,MAAM,SAASD,kBAAK,QAAQ,OAAO;EACnC,IAAI,WAAW,SAAS,OAAO;EAC/B,UAAU;CACZ;AACF;AAEA,SAAS,8BAAwE;CAC/E,IAAI;EACF,MAAM,MAAM,cAAc,mDAAmD;EAC7E,OAAQ,IAAsD,WAAW;CAC3E,QAAQ;EACN,OAAO;CACT;AACF;AAUA,SAAgB,uBAAuB,UAAmC,CAAC,GAAqB;CAC9F,MAAM,eAAe,QAAQ,IAAI,WAAW;CAC5C,MAAM,UAAqB,CAAC,IAAI,yBAAyB,KAAK,CAAC;CAE/D,IAAI,QAAQ,YAAY,OAAO;EAC7B,MAAM,gBAAgB,4BAA4B;EAClD,IAAI,eACF,QAAQ,KAAK,cAAc,CAAC;OACvB,IAAI,QAAQ,YAAY,MAC7B,MAAM,IAAI,MACR,gHACF;CAEJ;CAEA,OAAO;EACL,GAAG,QAAQ;EACX,WAAW,QAAQ,aAAa,QAAQ,QAAQ,aAAa,CAAC,MAAM,sBAAsB;EAC1F,SAAS,QAAQ,QAAQ,YAAY,eAAe,QAAQ;EAC5D;EACA,uBAAuB,QAAQ,QAAQ,yBAAyB,EAAE,OAAO,QAAQ;EACjF,OAAO,QAAQ,QAAQ,SAAS;CAClC;AACF"}
@@ -0,0 +1,20 @@
1
+ //#region src/build/rspack/compose.d.ts
2
+ interface PluginBaseConfigOptions {
3
+ drizzle?: boolean;
4
+ externals?: string[];
5
+ /** Concrete rspack fields to merge over the defaults (devtool, infrastructureLogging, ...). */
6
+ rspack?: Partial<PluginBaseConfig>;
7
+ }
8
+ interface PluginBaseConfig {
9
+ externals: string[];
10
+ devtool: false | "source-map";
11
+ plugins: unknown[];
12
+ infrastructureLogging: {
13
+ level: "error";
14
+ };
15
+ stats: "errors-warnings";
16
+ }
17
+ declare function createPluginBaseConfig(options?: PluginBaseConfigOptions): PluginBaseConfig;
18
+ //#endregion
19
+ export { PluginBaseConfig, PluginBaseConfigOptions, createPluginBaseConfig };
20
+ //# sourceMappingURL=compose.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.d.cts","names":[],"sources":["../../../src/build/rspack/compose.ts"],"mappings":";UAmBiB;EACf;EACA;;EAEA,SAAS,QAAQ;;UAgCF;EACf;EACA;EACA;EACA;IAAyB;;EACzB;;iBAGc,uBAAuB,UAAS,0BAA+B"}
@@ -0,0 +1,20 @@
1
+ //#region src/build/rspack/compose.d.ts
2
+ interface PluginBaseConfigOptions {
3
+ drizzle?: boolean;
4
+ externals?: string[];
5
+ /** Concrete rspack fields to merge over the defaults (devtool, infrastructureLogging, ...). */
6
+ rspack?: Partial<PluginBaseConfig>;
7
+ }
8
+ interface PluginBaseConfig {
9
+ externals: string[];
10
+ devtool: false | "source-map";
11
+ plugins: unknown[];
12
+ infrastructureLogging: {
13
+ level: "error";
14
+ };
15
+ stats: "errors-warnings";
16
+ }
17
+ declare function createPluginBaseConfig(options?: PluginBaseConfigOptions): PluginBaseConfig;
18
+ //#endregion
19
+ export { PluginBaseConfig, PluginBaseConfigOptions, createPluginBaseConfig };
20
+ //# sourceMappingURL=compose.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.d.mts","names":[],"sources":["../../../src/build/rspack/compose.ts"],"mappings":";UAmBiB;EACf;EACA;;EAEA,SAAS,QAAQ;;UAgCF;EACf;EACA;EACA;EACA;IAAyB;;EACzB;;iBAGc,uBAAuB,UAAS,0BAA+B"}
@@ -0,0 +1,65 @@
1
+ import { FixMfDataUriPlugin } from "./fix-mf-data-uri-plugin.mjs";
2
+ import { EmitPluginManifest, EveryPluginBuild } from "./plugin.mjs";
3
+ import { createRequire } from "node:module";
4
+ import fs from "node:fs";
5
+ import path from "node:path";
6
+
7
+ //#region src/build/rspack/compose.ts
8
+ var EveryPluginComposedBuild = class {
9
+ dts;
10
+ name = "EveryPluginComposedBuild";
11
+ constructor(dts = false) {
12
+ this.dts = dts;
13
+ }
14
+ apply(compiler) {
15
+ new EmitPluginManifest().apply(compiler);
16
+ new EveryPluginBuild({ dts: this.dts }).apply(compiler);
17
+ new FixMfDataUriPlugin().apply(compiler);
18
+ }
19
+ };
20
+ const pluginRequire = createRequire(import.meta.url);
21
+ /** Config filenames that mark a project root, nearest-first. Authored
22
+ * descriptor projects (the platform) carry bos.app.ts; generated child
23
+ * projects carry bos.config.json. */
24
+ const CONFIG_FILENAMES = ["bos.config.json", "bos.app.ts"];
25
+ function findBosConfigPath(from = process.cwd()) {
26
+ let current = path.resolve(from);
27
+ while (true) {
28
+ for (const filename of CONFIG_FILENAMES) {
29
+ const candidate = path.join(current, filename);
30
+ if (fs.existsSync(candidate)) return candidate;
31
+ }
32
+ const parent = path.dirname(current);
33
+ if (parent === current) return null;
34
+ current = parent;
35
+ }
36
+ }
37
+ function loadDrizzleMigrationsPlugin() {
38
+ try {
39
+ const mod = pluginRequire("@proj-airi/unplugin-drizzle-orm-migrations/rspack");
40
+ return mod.default ?? mod;
41
+ } catch {
42
+ return null;
43
+ }
44
+ }
45
+ function createPluginBaseConfig(options = {}) {
46
+ const shouldDeploy = process.env.DEPLOY === "true";
47
+ const plugins = [new EveryPluginComposedBuild(false)];
48
+ if (options.drizzle !== false) {
49
+ const drizzlePlugin = loadDrizzleMigrationsPlugin();
50
+ if (drizzlePlugin) plugins.push(drizzlePlugin());
51
+ else if (options.drizzle === true) throw new Error("createPluginBaseConfig({ drizzle: true }) requires @proj-airi/unplugin-drizzle-orm-migrations to be installed.");
52
+ }
53
+ return {
54
+ ...options.rspack,
55
+ externals: options.externals ?? options.rspack?.externals ?? ["pg", "@electric-sql/pglite"],
56
+ devtool: options.rspack?.devtool ?? (shouldDeploy ? false : "source-map"),
57
+ plugins,
58
+ infrastructureLogging: options.rspack?.infrastructureLogging ?? { level: "error" },
59
+ stats: options.rspack?.stats ?? "errors-warnings"
60
+ };
61
+ }
62
+
63
+ //#endregion
64
+ export { createPluginBaseConfig, findBosConfigPath };
65
+ //# sourceMappingURL=compose.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compose.mjs","names":[],"sources":["../../../src/build/rspack/compose.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { FixMfDataUriPlugin } from \"./fix-mf-data-uri-plugin\";\nimport { EmitPluginManifest, EveryPluginBuild } from \"./plugin\";\n\nclass EveryPluginComposedBuild implements RspackPluginInstance {\n name = \"EveryPluginComposedBuild\";\n\n constructor(private readonly dts: boolean = false) {}\n\n apply(compiler: Compiler) {\n new EmitPluginManifest().apply(compiler);\n new EveryPluginBuild({ dts: this.dts }).apply(compiler);\n new FixMfDataUriPlugin().apply(compiler);\n }\n}\n\nexport interface PluginBaseConfigOptions {\n drizzle?: boolean;\n externals?: string[];\n /** Concrete rspack fields to merge over the defaults (devtool, infrastructureLogging, ...). */\n rspack?: Partial<PluginBaseConfig>;\n}\n\nconst pluginRequire = createRequire(import.meta.url);\n\n/** Config filenames that mark a project root, nearest-first. Authored\n * descriptor projects (the platform) carry bos.app.ts; generated child\n * projects carry bos.config.json. */\nconst CONFIG_FILENAMES = [\"bos.config.json\", \"bos.app.ts\"] as const;\n\nexport function findBosConfigPath(from: string = process.cwd()): string | null {\n let current = path.resolve(from);\n while (true) {\n for (const filename of CONFIG_FILENAMES) {\n const candidate = path.join(current, filename);\n if (fs.existsSync(candidate)) return candidate;\n }\n const parent = path.dirname(current);\n if (parent === current) return null;\n current = parent;\n }\n}\n\nfunction loadDrizzleMigrationsPlugin(): ((...args: unknown[]) => unknown) | null {\n try {\n const mod = pluginRequire(\"@proj-airi/unplugin-drizzle-orm-migrations/rspack\");\n return (mod as { default?: (...args: unknown[]) => unknown }).default ?? mod;\n } catch {\n return null;\n }\n}\n\nexport interface PluginBaseConfig {\n externals: string[];\n devtool: false | \"source-map\";\n plugins: unknown[];\n infrastructureLogging: { level: \"error\" };\n stats: \"errors-warnings\";\n}\n\nexport function createPluginBaseConfig(options: PluginBaseConfigOptions = {}): PluginBaseConfig {\n const shouldDeploy = process.env.DEPLOY === \"true\";\n const plugins: unknown[] = [new EveryPluginComposedBuild(false)];\n\n if (options.drizzle !== false) {\n const drizzlePlugin = loadDrizzleMigrationsPlugin();\n if (drizzlePlugin) {\n plugins.push(drizzlePlugin());\n } else if (options.drizzle === true) {\n throw new Error(\n \"createPluginBaseConfig({ drizzle: true }) requires @proj-airi/unplugin-drizzle-orm-migrations to be installed.\",\n );\n }\n }\n\n return {\n ...options.rspack,\n externals: options.externals ?? options.rspack?.externals ?? [\"pg\", \"@electric-sql/pglite\"],\n devtool: options.rspack?.devtool ?? (shouldDeploy ? false : \"source-map\"),\n plugins,\n infrastructureLogging: options.rspack?.infrastructureLogging ?? { level: \"error\" },\n stats: options.rspack?.stats ?? \"errors-warnings\",\n };\n}\n"],"mappings":";;;;;;;AAOA,IAAM,2BAAN,MAA+D;CAGhC;CAF7B,OAAO;CAEP,YAAY,AAAiB,MAAe,OAAO;EAAtB;CAAuB;CAEpD,MAAM,UAAoB;EACxB,IAAI,mBAAmB,CAAC,CAAC,MAAM,QAAQ;EACvC,IAAI,iBAAiB,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,QAAQ;EACtD,IAAI,mBAAmB,CAAC,CAAC,MAAM,QAAQ;CACzC;AACF;AASA,MAAM,gBAAgB,cAAc,YAAY,GAAG;;;;AAKnD,MAAM,mBAAmB,CAAC,mBAAmB,YAAY;AAEzD,SAAgB,kBAAkB,OAAe,QAAQ,IAAI,GAAkB;CAC7E,IAAI,UAAU,KAAK,QAAQ,IAAI;CAC/B,OAAO,MAAM;EACX,KAAK,MAAM,YAAY,kBAAkB;GACvC,MAAM,YAAY,KAAK,KAAK,SAAS,QAAQ;GAC7C,IAAI,GAAG,WAAW,SAAS,GAAG,OAAO;EACvC;EACA,MAAM,SAAS,KAAK,QAAQ,OAAO;EACnC,IAAI,WAAW,SAAS,OAAO;EAC/B,UAAU;CACZ;AACF;AAEA,SAAS,8BAAwE;CAC/E,IAAI;EACF,MAAM,MAAM,cAAc,mDAAmD;EAC7E,OAAQ,IAAsD,WAAW;CAC3E,QAAQ;EACN,OAAO;CACT;AACF;AAUA,SAAgB,uBAAuB,UAAmC,CAAC,GAAqB;CAC9F,MAAM,eAAe,QAAQ,IAAI,WAAW;CAC5C,MAAM,UAAqB,CAAC,IAAI,yBAAyB,KAAK,CAAC;CAE/D,IAAI,QAAQ,YAAY,OAAO;EAC7B,MAAM,gBAAgB,4BAA4B;EAClD,IAAI,eACF,QAAQ,KAAK,cAAc,CAAC;OACvB,IAAI,QAAQ,YAAY,MAC7B,MAAM,IAAI,MACR,gHACF;CAEJ;CAEA,OAAO;EACL,GAAG,QAAQ;EACX,WAAW,QAAQ,aAAa,QAAQ,QAAQ,aAAa,CAAC,MAAM,sBAAsB;EAC1F,SAAS,QAAQ,QAAQ,YAAY,eAAe,QAAQ;EAC5D;EACA,uBAAuB,QAAQ,QAAQ,yBAAyB,EAAE,OAAO,QAAQ;EACjF,OAAO,QAAQ,QAAQ,SAAS;CAClC;AACF"}
@@ -1,8 +1,10 @@
1
-
2
1
  //#region src/build/rspack/fix-mf-data-uri-plugin.ts
3
2
  const MF_DATA_URI_MARKER = "data:text/javascript,";
3
+ const NODE_MODULES_IMPORT_RE = /(["'])\/[^"']*?\/node_modules\/([^"']*)\1/g;
4
4
  var FixMfDataUriPlugin = class {
5
5
  name = "FixMfDataUriPlugin";
6
+ /** Bare specifier → on-disk absolute path, learned while rewriting. */
7
+ redirects = /* @__PURE__ */ new Map();
6
8
  apply(compiler) {
7
9
  compiler.hooks.compilation.tap(this.name, (_compilation, { normalModuleFactory }) => {
8
10
  normalModuleFactory.hooks.beforeResolve.tap(this.name, (resolveData) => {
@@ -10,6 +12,10 @@ var FixMfDataUriPlugin = class {
10
12
  if (!resolveData.request.includes(MF_DATA_URI_MARKER)) return;
11
13
  this.reencodeDataUri(resolveData);
12
14
  });
15
+ normalModuleFactory.hooks.resolve.tap(this.name, (resolveData) => {
16
+ const target = this.redirects.get(resolveData?.request ?? "");
17
+ if (target) resolveData.request = target;
18
+ });
13
19
  });
14
20
  }
15
21
  reencodeDataUri(resolveData) {
@@ -18,19 +24,13 @@ var FixMfDataUriPlugin = class {
18
24
  if (idx === -1) return;
19
25
  const contentStart = idx + 21;
20
26
  const prefix = request.substring(0, contentStart);
21
- const rawContent = request.substring(contentStart);
22
- if (isAlreadyEncoded(rawContent)) return;
23
- const decoded = safeDecode(rawContent);
27
+ const decoded = safeDecode(request.substring(contentStart)).replace(NODE_MODULES_IMPORT_RE, (match, _quote, rest) => {
28
+ this.redirects.set(rest, match.slice(1, -1));
29
+ return _quote + rest + _quote;
30
+ });
24
31
  resolveData.request = prefix + encodeURIComponent(decoded);
25
32
  }
26
33
  };
27
- function isAlreadyEncoded(content) {
28
- try {
29
- return decodeURIComponent(content) !== content;
30
- } catch {
31
- return false;
32
- }
33
- }
34
34
  function safeDecode(content) {
35
35
  try {
36
36
  return decodeURIComponent(content);
@@ -1 +1 @@
1
- {"version":3,"file":"fix-mf-data-uri-plugin.cjs","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"sourcesContent":["import type { Compiler, RspackPluginInstance } from \"@rspack/core\";\n\nconst MF_DATA_URI_MARKER = \"data:text/javascript,\";\n\nexport class FixMfDataUriPlugin implements RspackPluginInstance {\n name = \"FixMfDataUriPlugin\";\n\n apply(compiler: Compiler) {\n compiler.hooks.compilation.tap(this.name, (_compilation, { normalModuleFactory }) => {\n normalModuleFactory.hooks.beforeResolve.tap(this.name, (resolveData) => {\n if (!resolveData?.request) return;\n if (!resolveData.request.includes(MF_DATA_URI_MARKER)) return;\n this.reencodeDataUri(resolveData);\n });\n });\n }\n\n private reencodeDataUri(resolveData: { request: string }) {\n const { request } = resolveData;\n const idx = request.indexOf(MF_DATA_URI_MARKER);\n if (idx === -1) return;\n\n const contentStart = idx + MF_DATA_URI_MARKER.length;\n const prefix = request.substring(0, contentStart);\n const rawContent = request.substring(contentStart);\n\n if (isAlreadyEncoded(rawContent)) return;\n\n const decoded = safeDecode(rawContent);\n resolveData.request = prefix + encodeURIComponent(decoded);\n }\n}\n\nfunction isAlreadyEncoded(content: string): boolean {\n try {\n const decoded = decodeURIComponent(content);\n return decoded !== content;\n } catch {\n return false;\n }\n}\n\nfunction safeDecode(content: string): string {\n try {\n return decodeURIComponent(content);\n } catch {\n return content.replace(/%(?![0-9A-Fa-f]{2})/g, \"%25\");\n }\n}\n"],"mappings":";;AAEA,MAAM,qBAAqB;AAE3B,IAAa,qBAAb,MAAgE;CAC9D,OAAO;CAEP,MAAM,UAAoB;EACxB,SAAS,MAAM,YAAY,IAAI,KAAK,OAAO,cAAc,EAAE,0BAA0B;GACnF,oBAAoB,MAAM,cAAc,IAAI,KAAK,OAAO,gBAAgB;IACtE,IAAI,CAAC,aAAa,SAAS;IAC3B,IAAI,CAAC,YAAY,QAAQ,SAAS,kBAAkB,GAAG;IACvD,KAAK,gBAAgB,WAAW;GAClC,CAAC;EACH,CAAC;CACH;CAEA,AAAQ,gBAAgB,aAAkC;EACxD,MAAM,EAAE,YAAY;EACpB,MAAM,MAAM,QAAQ,QAAQ,kBAAkB;EAC9C,IAAI,QAAQ,IAAI;EAEhB,MAAM,eAAe,MAAM;EAC3B,MAAM,SAAS,QAAQ,UAAU,GAAG,YAAY;EAChD,MAAM,aAAa,QAAQ,UAAU,YAAY;EAEjD,IAAI,iBAAiB,UAAU,GAAG;EAElC,MAAM,UAAU,WAAW,UAAU;EACrC,YAAY,UAAU,SAAS,mBAAmB,OAAO;CAC3D;AACF;AAEA,SAAS,iBAAiB,SAA0B;CAClD,IAAI;EAEF,OADgB,mBAAmB,OACtB,MAAM;CACrB,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,WAAW,SAAyB;CAC3C,IAAI;EACF,OAAO,mBAAmB,OAAO;CACnC,QAAQ;EACN,OAAO,QAAQ,QAAQ,wBAAwB,KAAK;CACtD;AACF"}
1
+ {"version":3,"file":"fix-mf-data-uri-plugin.cjs","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"sourcesContent":["import type { Compiler, RspackPluginInstance } from \"@rspack/core\";\n\nconst MF_DATA_URI_MARKER = \"data:text/javascript,\";\nconst NODE_MODULES_IMPORT_RE = /([\"'])\\/[^\"']*?\\/node_modules\\/([^\"']*)\\1/g;\n\nexport class FixMfDataUriPlugin implements RspackPluginInstance {\n name = \"FixMfDataUriPlugin\";\n\n /** Bare specifier → on-disk absolute path, learned while rewriting. */\n private redirects = new Map<string, string>();\n\n apply(compiler: Compiler) {\n compiler.hooks.compilation.tap(this.name, (_compilation, { normalModuleFactory }) => {\n normalModuleFactory.hooks.beforeResolve.tap(this.name, (resolveData) => {\n if (!resolveData?.request) return;\n if (!resolveData.request.includes(MF_DATA_URI_MARKER)) return;\n this.reencodeDataUri(resolveData);\n });\n normalModuleFactory.hooks.resolve.tap(this.name, (resolveData) => {\n const target = this.redirects.get(resolveData?.request ?? \"\");\n if (target) {\n resolveData.request = target;\n }\n });\n });\n }\n\n private reencodeDataUri(resolveData: { request: string }) {\n const { request } = resolveData;\n const idx = request.indexOf(MF_DATA_URI_MARKER);\n if (idx === -1) return;\n\n const contentStart = idx + MF_DATA_URI_MARKER.length;\n const prefix = request.substring(0, contentStart);\n const rawContent = request.substring(contentStart);\n\n // The MF runtime's and rsbuild's generated data-URI modules import their\n // runtime pieces by absolute node_modules paths (`require.resolve` output),\n // which differ per machine. Rewriting them to bare specifiers keeps the\n // module — and therefore the module id space — machine-independent; the\n // recorded redirects resolve those specifiers back to this machine's\n // on-disk copies while the request (and thus the module id) stays bare.\n const decoded = safeDecode(rawContent).replace(\n NODE_MODULES_IMPORT_RE,\n (match, _quote: string, rest: string) => {\n this.redirects.set(rest, match.slice(1, -1));\n return _quote + rest + _quote;\n },\n );\n resolveData.request = prefix + encodeURIComponent(decoded);\n }\n}\n\nfunction safeDecode(content: string): string {\n try {\n return decodeURIComponent(content);\n } catch {\n return content.replace(/%(?![0-9A-Fa-f]{2})/g, \"%25\");\n }\n}\n"],"mappings":";AAEA,MAAM,qBAAqB;AAC3B,MAAM,yBAAyB;AAE/B,IAAa,qBAAb,MAAgE;CAC9D,OAAO;;CAGP,AAAQ,4BAAY,IAAI,IAAoB;CAE5C,MAAM,UAAoB;EACxB,SAAS,MAAM,YAAY,IAAI,KAAK,OAAO,cAAc,EAAE,0BAA0B;GACnF,oBAAoB,MAAM,cAAc,IAAI,KAAK,OAAO,gBAAgB;IACtE,IAAI,CAAC,aAAa,SAAS;IAC3B,IAAI,CAAC,YAAY,QAAQ,SAAS,kBAAkB,GAAG;IACvD,KAAK,gBAAgB,WAAW;GAClC,CAAC;GACD,oBAAoB,MAAM,QAAQ,IAAI,KAAK,OAAO,gBAAgB;IAChE,MAAM,SAAS,KAAK,UAAU,IAAI,aAAa,WAAW,EAAE;IAC5D,IAAI,QACF,YAAY,UAAU;GAE1B,CAAC;EACH,CAAC;CACH;CAEA,AAAQ,gBAAgB,aAAkC;EACxD,MAAM,EAAE,YAAY;EACpB,MAAM,MAAM,QAAQ,QAAQ,kBAAkB;EAC9C,IAAI,QAAQ,IAAI;EAEhB,MAAM,eAAe,MAAM;EAC3B,MAAM,SAAS,QAAQ,UAAU,GAAG,YAAY;EAShD,MAAM,UAAU,WARG,QAAQ,UAAU,YAQD,CAAC,CAAC,CAAC,QACrC,yBACC,OAAO,QAAgB,SAAiB;GACvC,KAAK,UAAU,IAAI,MAAM,MAAM,MAAM,GAAG,EAAE,CAAC;GAC3C,OAAO,SAAS,OAAO;EACzB,CACF;EACA,YAAY,UAAU,SAAS,mBAAmB,OAAO;CAC3D;AACF;AAEA,SAAS,WAAW,SAAyB;CAC3C,IAAI;EACF,OAAO,mBAAmB,OAAO;CACnC,QAAQ;EACN,OAAO,QAAQ,QAAQ,wBAAwB,KAAK;CACtD;AACF"}
@@ -2,6 +2,8 @@ import { Compiler, RspackPluginInstance } from "@rspack/core";
2
2
  //#region src/build/rspack/fix-mf-data-uri-plugin.d.ts
3
3
  declare class FixMfDataUriPlugin implements RspackPluginInstance {
4
4
  name: string;
5
+ /** Bare specifier → on-disk absolute path, learned while rewriting. */
6
+ private redirects;
5
7
  apply(compiler: Compiler): void;
6
8
  private reencodeDataUri;
7
9
  }