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
@@ -1 +1 @@
1
- {"version":3,"file":"fix-mf-data-uri-plugin.d.cts","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"mappings":";;cAIa,8BAA8B;EACzC;EAEA,MAAM,UAAU;UAUR"}
1
+ {"version":3,"file":"fix-mf-data-uri-plugin.d.cts","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"mappings":";;cAKa,8BAA8B;EACzC;;UAGQ;EAER,MAAM,UAAU;UAgBR"}
@@ -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
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fix-mf-data-uri-plugin.d.mts","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"mappings":";;cAIa,8BAA8B;EACzC;EAEA,MAAM,UAAU;UAUR"}
1
+ {"version":3,"file":"fix-mf-data-uri-plugin.d.mts","names":[],"sources":["../../../src/build/rspack/fix-mf-data-uri-plugin.ts"],"mappings":";;cAKa,8BAA8B;EACzC;;UAGQ;EAER,MAAM,UAAU;UAgBR"}
@@ -1,7 +1,10 @@
1
1
  //#region src/build/rspack/fix-mf-data-uri-plugin.ts
2
2
  const MF_DATA_URI_MARKER = "data:text/javascript,";
3
+ const NODE_MODULES_IMPORT_RE = /(["'])\/[^"']*?\/node_modules\/([^"']*)\1/g;
3
4
  var FixMfDataUriPlugin = class {
4
5
  name = "FixMfDataUriPlugin";
6
+ /** Bare specifier → on-disk absolute path, learned while rewriting. */
7
+ redirects = /* @__PURE__ */ new Map();
5
8
  apply(compiler) {
6
9
  compiler.hooks.compilation.tap(this.name, (_compilation, { normalModuleFactory }) => {
7
10
  normalModuleFactory.hooks.beforeResolve.tap(this.name, (resolveData) => {
@@ -9,6 +12,10 @@ var FixMfDataUriPlugin = class {
9
12
  if (!resolveData.request.includes(MF_DATA_URI_MARKER)) return;
10
13
  this.reencodeDataUri(resolveData);
11
14
  });
15
+ normalModuleFactory.hooks.resolve.tap(this.name, (resolveData) => {
16
+ const target = this.redirects.get(resolveData?.request ?? "");
17
+ if (target) resolveData.request = target;
18
+ });
12
19
  });
13
20
  }
14
21
  reencodeDataUri(resolveData) {
@@ -17,19 +24,13 @@ var FixMfDataUriPlugin = class {
17
24
  if (idx === -1) return;
18
25
  const contentStart = idx + 21;
19
26
  const prefix = request.substring(0, contentStart);
20
- const rawContent = request.substring(contentStart);
21
- if (isAlreadyEncoded(rawContent)) return;
22
- 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
+ });
23
31
  resolveData.request = prefix + encodeURIComponent(decoded);
24
32
  }
25
33
  };
26
- function isAlreadyEncoded(content) {
27
- try {
28
- return decodeURIComponent(content) !== content;
29
- } catch {
30
- return false;
31
- }
32
- }
33
34
  function safeDecode(content) {
34
35
  try {
35
36
  return decodeURIComponent(content);
@@ -1 +1 @@
1
- {"version":3,"file":"fix-mf-data-uri-plugin.mjs","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.mjs","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"}
@@ -0,0 +1,35 @@
1
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
2
+ const require_compose = require('./compose.cjs');
3
+ let node_fs = require("node:fs");
4
+ node_fs = require_runtime.__toESM(node_fs, 1);
5
+ let node_path = require("node:path");
6
+ node_path = require_runtime.__toESM(node_path, 1);
7
+
8
+ //#region src/build/rspack/generated-config.ts
9
+ function generatedRspackConfig(hasOverrides) {
10
+ return `import { createPluginBaseConfig } from "every-plugin/build/rspack";
11
+ ${hasOverrides ? `import buildOverrides from "../build.config.ts";\n` : ""}
12
+ export default createPluginBaseConfig(${hasOverrides ? "buildOverrides" : "{}"});
13
+ `;
14
+ }
15
+ /**
16
+ * Ensures the synthesized rspack config exists for workspaces that no longer
17
+ * ship their own `rspack.config.js`. Returns the workspace-relative config
18
+ * path to pass via `--config`, or `null` when the workspace has its own
19
+ * `rspack.config.js` and bare `rspack build` should be used.
20
+ */
21
+ function ensureGeneratedRspackConfig(cwd = process.cwd()) {
22
+ if (node_fs.default.existsSync(node_path.default.join(cwd, "rspack.config.js"))) return null;
23
+ const overridesPath = node_path.default.resolve(cwd, "build.config.ts");
24
+ const hasOverrides = node_fs.default.existsSync(overridesPath);
25
+ const generatedDir = node_path.default.join(cwd, ".every-plugin");
26
+ const generatedConfig = node_path.default.join(generatedDir, "rspack.config.generated.mjs");
27
+ node_fs.default.mkdirSync(generatedDir, { recursive: true });
28
+ node_fs.default.writeFileSync(generatedConfig, generatedRspackConfig(hasOverrides));
29
+ console.log("[every-plugin] rspack.config.js not found — using the every-plugin build composition.");
30
+ return node_path.default.join(".every-plugin", "rspack.config.generated.mjs");
31
+ }
32
+
33
+ //#endregion
34
+ exports.ensureGeneratedRspackConfig = ensureGeneratedRspackConfig;
35
+ //# sourceMappingURL=generated-config.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-config.cjs","names":["fs","path"],"sources":["../../../src/build/rspack/generated-config.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { findBosConfigPath } from \"./compose\";\n\nexport { findBosConfigPath };\n\nfunction generatedRspackConfig(hasOverrides: boolean): string {\n return `import { createPluginBaseConfig } from \"every-plugin/build/rspack\";\n${hasOverrides ? `import buildOverrides from \"../build.config.ts\";\\n` : \"\"}\nexport default createPluginBaseConfig(${hasOverrides ? \"buildOverrides\" : \"{}\"});\n`;\n}\n\n/**\n * Ensures the synthesized rspack config exists for workspaces that no longer\n * ship their own `rspack.config.js`. Returns the workspace-relative config\n * path to pass via `--config`, or `null` when the workspace has its own\n * `rspack.config.js` and bare `rspack build` should be used.\n */\nexport function ensureGeneratedRspackConfig(cwd: string = process.cwd()): string | null {\n if (fs.existsSync(path.join(cwd, \"rspack.config.js\"))) return null;\n\n const overridesPath = path.resolve(cwd, \"build.config.ts\");\n const hasOverrides = fs.existsSync(overridesPath);\n const generatedDir = path.join(cwd, \".every-plugin\");\n const generatedConfig = path.join(generatedDir, \"rspack.config.generated.mjs\");\n fs.mkdirSync(generatedDir, { recursive: true });\n fs.writeFileSync(generatedConfig, generatedRspackConfig(hasOverrides));\n\n console.log(\n \"[every-plugin] rspack.config.js not found — using the every-plugin build composition.\",\n );\n return path.join(\".every-plugin\", \"rspack.config.generated.mjs\");\n}\n"],"mappings":";;;;;;;;AAOA,SAAS,sBAAsB,cAA+B;CAC5D,OAAO;EACP,eAAe,uDAAuD,GAAG;wCACnC,eAAe,mBAAmB,KAAK;;AAE/E;;;;;;;AAQA,SAAgB,4BAA4B,MAAc,QAAQ,IAAI,GAAkB;CACtF,IAAIA,gBAAG,WAAWC,kBAAK,KAAK,KAAK,kBAAkB,CAAC,GAAG,OAAO;CAE9D,MAAM,gBAAgBA,kBAAK,QAAQ,KAAK,iBAAiB;CACzD,MAAM,eAAeD,gBAAG,WAAW,aAAa;CAChD,MAAM,eAAeC,kBAAK,KAAK,KAAK,eAAe;CACnD,MAAM,kBAAkBA,kBAAK,KAAK,cAAc,6BAA6B;CAC7E,gBAAG,UAAU,cAAc,EAAE,WAAW,KAAK,CAAC;CAC9C,gBAAG,cAAc,iBAAiB,sBAAsB,YAAY,CAAC;CAErE,QAAQ,IACN,uFACF;CACA,OAAOA,kBAAK,KAAK,iBAAiB,6BAA6B;AACjE"}
@@ -0,0 +1,32 @@
1
+ import { findBosConfigPath } from "./compose.mjs";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+
5
+ //#region src/build/rspack/generated-config.ts
6
+ function generatedRspackConfig(hasOverrides) {
7
+ return `import { createPluginBaseConfig } from "every-plugin/build/rspack";
8
+ ${hasOverrides ? `import buildOverrides from "../build.config.ts";\n` : ""}
9
+ export default createPluginBaseConfig(${hasOverrides ? "buildOverrides" : "{}"});
10
+ `;
11
+ }
12
+ /**
13
+ * Ensures the synthesized rspack config exists for workspaces that no longer
14
+ * ship their own `rspack.config.js`. Returns the workspace-relative config
15
+ * path to pass via `--config`, or `null` when the workspace has its own
16
+ * `rspack.config.js` and bare `rspack build` should be used.
17
+ */
18
+ function ensureGeneratedRspackConfig(cwd = process.cwd()) {
19
+ if (fs.existsSync(path.join(cwd, "rspack.config.js"))) return null;
20
+ const overridesPath = path.resolve(cwd, "build.config.ts");
21
+ const hasOverrides = fs.existsSync(overridesPath);
22
+ const generatedDir = path.join(cwd, ".every-plugin");
23
+ const generatedConfig = path.join(generatedDir, "rspack.config.generated.mjs");
24
+ fs.mkdirSync(generatedDir, { recursive: true });
25
+ fs.writeFileSync(generatedConfig, generatedRspackConfig(hasOverrides));
26
+ console.log("[every-plugin] rspack.config.js not found — using the every-plugin build composition.");
27
+ return path.join(".every-plugin", "rspack.config.generated.mjs");
28
+ }
29
+
30
+ //#endregion
31
+ export { ensureGeneratedRspackConfig };
32
+ //# sourceMappingURL=generated-config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-config.mjs","names":[],"sources":["../../../src/build/rspack/generated-config.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\n\nimport { findBosConfigPath } from \"./compose\";\n\nexport { findBosConfigPath };\n\nfunction generatedRspackConfig(hasOverrides: boolean): string {\n return `import { createPluginBaseConfig } from \"every-plugin/build/rspack\";\n${hasOverrides ? `import buildOverrides from \"../build.config.ts\";\\n` : \"\"}\nexport default createPluginBaseConfig(${hasOverrides ? \"buildOverrides\" : \"{}\"});\n`;\n}\n\n/**\n * Ensures the synthesized rspack config exists for workspaces that no longer\n * ship their own `rspack.config.js`. Returns the workspace-relative config\n * path to pass via `--config`, or `null` when the workspace has its own\n * `rspack.config.js` and bare `rspack build` should be used.\n */\nexport function ensureGeneratedRspackConfig(cwd: string = process.cwd()): string | null {\n if (fs.existsSync(path.join(cwd, \"rspack.config.js\"))) return null;\n\n const overridesPath = path.resolve(cwd, \"build.config.ts\");\n const hasOverrides = fs.existsSync(overridesPath);\n const generatedDir = path.join(cwd, \".every-plugin\");\n const generatedConfig = path.join(generatedDir, \"rspack.config.generated.mjs\");\n fs.mkdirSync(generatedDir, { recursive: true });\n fs.writeFileSync(generatedConfig, generatedRspackConfig(hasOverrides));\n\n console.log(\n \"[every-plugin] rspack.config.js not found — using the every-plugin build composition.\",\n );\n return path.join(\".every-plugin\", \"rspack.config.generated.mjs\");\n}\n"],"mappings":";;;;;AAOA,SAAS,sBAAsB,cAA+B;CAC5D,OAAO;EACP,eAAe,uDAAuD,GAAG;wCACnC,eAAe,mBAAmB,KAAK;;AAE/E;;;;;;;AAQA,SAAgB,4BAA4B,MAAc,QAAQ,IAAI,GAAkB;CACtF,IAAI,GAAG,WAAW,KAAK,KAAK,KAAK,kBAAkB,CAAC,GAAG,OAAO;CAE9D,MAAM,gBAAgB,KAAK,QAAQ,KAAK,iBAAiB;CACzD,MAAM,eAAe,GAAG,WAAW,aAAa;CAChD,MAAM,eAAe,KAAK,KAAK,KAAK,eAAe;CACnD,MAAM,kBAAkB,KAAK,KAAK,cAAc,6BAA6B;CAC7E,GAAG,UAAU,cAAc,EAAE,WAAW,KAAK,CAAC;CAC9C,GAAG,cAAc,iBAAiB,sBAAsB,YAAY,CAAC;CAErE,QAAQ,IACN,uFACF;CACA,OAAO,KAAK,KAAK,iBAAiB,6BAA6B;AACjE"}
@@ -1,11 +1,14 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_build_shared_deps = require('../shared-deps.cjs');
2
+ const require_shared_deps_spec = require('../../shared-deps-spec.cjs');
3
+ const require_build_report_plugin = require('./build-report-plugin.cjs');
3
4
  const require_fix_mf_data_uri_plugin = require('./fix-mf-data-uri-plugin.cjs');
4
5
  const require_plugin = require('./plugin.cjs');
6
+ const require_compose = require('./compose.cjs');
5
7
 
8
+ exports.BuildReportPlugin = require_build_report_plugin.BuildReportPlugin;
6
9
  exports.EmitPluginManifest = require_plugin.EmitPluginManifest;
7
- exports.EveryPluginDevServer = require_plugin.EveryPluginDevServer;
10
+ exports.EveryPluginBuild = require_plugin.EveryPluginBuild;
8
11
  exports.FixMfDataUriPlugin = require_fix_mf_data_uri_plugin.FixMfDataUriPlugin;
9
- exports.getMajorMinorVersion = require_build_shared_deps.getMajorMinorVersion;
10
- exports.getPluginSharedDependencies = require_build_shared_deps.getPluginSharedDependencies;
11
- exports.getPluginSharedDependenciesVersionRange = require_build_shared_deps.getPluginSharedDependenciesVersionRange;
12
+ exports.createPluginBaseConfig = require_compose.createPluginBaseConfig;
13
+ exports.getPluginSharedDependencies = require_shared_deps_spec.getPluginSharedDependencies;
14
+ exports.isEffectCriticalSharedDep = require_shared_deps_spec.isEffectCriticalSharedDep;
@@ -1,4 +1,6 @@
1
- import { SharedDependencies, SharedDependencyConfig, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange } from "../shared-deps.cjs";
1
+ import { SharedDependencies, SharedDependencyConfig, getPluginSharedDependencies, isEffectCriticalSharedDep } from "../../shared-deps-spec.cjs";
2
+ import { BuildReportPlugin } from "./build-report-plugin.cjs";
3
+ import { PluginBaseConfig, PluginBaseConfigOptions, createPluginBaseConfig } from "./compose.cjs";
2
4
  import { FixMfDataUriPlugin } from "./fix-mf-data-uri-plugin.cjs";
3
- import { EmitPluginManifest, EveryPluginDevServer, EveryPluginOptions, PluginManifestEmitterOptions } from "./plugin.cjs";
4
- export { EmitPluginManifest, EveryPluginDevServer, type EveryPluginOptions, FixMfDataUriPlugin, type PluginManifestEmitterOptions, type SharedDependencies, type SharedDependencyConfig, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange };
5
+ import { EmitPluginManifest, EveryPluginBuild, EveryPluginBuildOptions, PluginManifestEmitterOptions } from "./plugin.cjs";
6
+ export { BuildReportPlugin, EmitPluginManifest, EveryPluginBuild, type EveryPluginBuildOptions, FixMfDataUriPlugin, type PluginBaseConfig, type PluginBaseConfigOptions, type PluginManifestEmitterOptions, type SharedDependencies, type SharedDependencyConfig, createPluginBaseConfig, getPluginSharedDependencies, isEffectCriticalSharedDep };
@@ -1,4 +1,6 @@
1
- import { SharedDependencies, SharedDependencyConfig, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange } from "../shared-deps.mjs";
1
+ import { SharedDependencies, SharedDependencyConfig, getPluginSharedDependencies, isEffectCriticalSharedDep } from "../../shared-deps-spec.mjs";
2
+ import { BuildReportPlugin } from "./build-report-plugin.mjs";
3
+ import { PluginBaseConfig, PluginBaseConfigOptions, createPluginBaseConfig } from "./compose.mjs";
2
4
  import { FixMfDataUriPlugin } from "./fix-mf-data-uri-plugin.mjs";
3
- import { EmitPluginManifest, EveryPluginDevServer, EveryPluginOptions, PluginManifestEmitterOptions } from "./plugin.mjs";
4
- export { EmitPluginManifest, EveryPluginDevServer, type EveryPluginOptions, FixMfDataUriPlugin, type PluginManifestEmitterOptions, type SharedDependencies, type SharedDependencyConfig, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange };
5
+ import { EmitPluginManifest, EveryPluginBuild, EveryPluginBuildOptions, PluginManifestEmitterOptions } from "./plugin.mjs";
6
+ export { BuildReportPlugin, EmitPluginManifest, EveryPluginBuild, type EveryPluginBuildOptions, FixMfDataUriPlugin, type PluginBaseConfig, type PluginBaseConfigOptions, type PluginManifestEmitterOptions, type SharedDependencies, type SharedDependencyConfig, createPluginBaseConfig, getPluginSharedDependencies, isEffectCriticalSharedDep };
@@ -1,5 +1,7 @@
1
- import { getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange } from "../shared-deps.mjs";
1
+ import { getPluginSharedDependencies, isEffectCriticalSharedDep } from "../../shared-deps-spec.mjs";
2
+ import { BuildReportPlugin } from "./build-report-plugin.mjs";
2
3
  import { FixMfDataUriPlugin } from "./fix-mf-data-uri-plugin.mjs";
3
- import { EmitPluginManifest, EveryPluginDevServer } from "./plugin.mjs";
4
+ import { EmitPluginManifest, EveryPluginBuild } from "./plugin.mjs";
5
+ import { createPluginBaseConfig } from "./compose.mjs";
4
6
 
5
- export { EmitPluginManifest, EveryPluginDevServer, FixMfDataUriPlugin, getMajorMinorVersion, getPluginSharedDependencies, getPluginSharedDependenciesVersionRange };
7
+ export { BuildReportPlugin, EmitPluginManifest, EveryPluginBuild, FixMfDataUriPlugin, createPluginBaseConfig, getPluginSharedDependencies, isEffectCriticalSharedDep };
@@ -1,8 +1,8 @@
1
- const require_build_shared_deps = require('../shared-deps.cjs');
1
+ const require_shared_deps_spec = require('../../shared-deps-spec.cjs');
2
2
 
3
3
  //#region src/build/rspack/module-federation.ts
4
4
  function buildSharedDependencies(_pluginInfo) {
5
- return require_build_shared_deps.getPluginSharedDependencies();
5
+ return require_shared_deps_spec.getPluginSharedDependencies();
6
6
  }
7
7
 
8
8
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"module-federation.cjs","names":["getPluginSharedDependencies"],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import { getPluginSharedDependencies } from \"../shared-deps\";\nimport type { PluginInfo } from \"./utils\";\n\nexport function buildSharedDependencies(_pluginInfo: PluginInfo) {\n return getPluginSharedDependencies();\n}\n"],"mappings":";;;AAGA,SAAgB,wBAAwB,aAAyB;CAC/D,OAAOA,sDAA4B;AACrC"}
1
+ {"version":3,"file":"module-federation.cjs","names":["getPluginSharedDependencies"],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import { getPluginSharedDependencies } from \"../../shared-deps-spec\";\nimport type { PluginInfo } from \"./utils\";\n\nexport function buildSharedDependencies(_pluginInfo: PluginInfo) {\n return getPluginSharedDependencies();\n}\n"],"mappings":";;;AAGA,SAAgB,wBAAwB,aAAyB;CAC/D,OAAOA,qDAA4B;AACrC"}
@@ -1,4 +1,4 @@
1
- import { getPluginSharedDependencies } from "../shared-deps.mjs";
1
+ import { getPluginSharedDependencies } from "../../shared-deps-spec.mjs";
2
2
 
3
3
  //#region src/build/rspack/module-federation.ts
4
4
  function buildSharedDependencies(_pluginInfo) {
@@ -1 +1 @@
1
- {"version":3,"file":"module-federation.mjs","names":[],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import { getPluginSharedDependencies } from \"../shared-deps\";\nimport type { PluginInfo } from \"./utils\";\n\nexport function buildSharedDependencies(_pluginInfo: PluginInfo) {\n return getPluginSharedDependencies();\n}\n"],"mappings":";;;AAGA,SAAgB,wBAAwB,aAAyB;CAC/D,OAAO,4BAA4B;AACrC"}
1
+ {"version":3,"file":"module-federation.mjs","names":[],"sources":["../../../src/build/rspack/module-federation.ts"],"sourcesContent":["import { getPluginSharedDependencies } from \"../../shared-deps-spec\";\nimport type { PluginInfo } from \"./utils\";\n\nexport function buildSharedDependencies(_pluginInfo: PluginInfo) {\n return getPluginSharedDependencies();\n}\n"],"mappings":";;;AAGA,SAAgB,wBAAwB,aAAyB;CAC/D,OAAO,4BAA4B;AACrC"}
@@ -1,13 +1,16 @@
1
1
  const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
2
- const require_dev_server_middleware = require('./dev-server-middleware.cjs');
2
+ const require_build_artifact_names = require('../artifact-names.cjs');
3
+ const require_build_report_plugin = require('./build-report-plugin.cjs');
4
+ const require_contract_types = require('../contract-types.cjs');
5
+ const require_chunk_completeness_plugin = require('./chunk-completeness-plugin.cjs');
3
6
  const require_module_federation = require('./module-federation.cjs');
4
7
  const require_utils = require('./utils.cjs');
8
+ let node_crypto = require("node:crypto");
9
+ node_crypto = require_runtime.__toESM(node_crypto, 1);
5
10
  let node_fs = require("node:fs");
6
11
  node_fs = require_runtime.__toESM(node_fs, 1);
7
12
  let node_path = require("node:path");
8
13
  node_path = require_runtime.__toESM(node_path, 1);
9
- let node_crypto = require("node:crypto");
10
- node_crypto = require_runtime.__toESM(node_crypto, 1);
11
14
  let _module_federation_enhanced_rspack = require("@module-federation/enhanced/rspack");
12
15
 
13
16
  //#region src/build/rspack/plugin.ts
@@ -30,8 +33,17 @@ var EmitPluginManifest = class {
30
33
  const pluginInfo = require_utils.getPluginInfo(context);
31
34
  const contractFileName = this.options.contractFileName ?? "contract.d.ts";
32
35
  const manifestFileName = this.options.manifestFileName ?? "plugin.manifest.json";
33
- const sourceContractPath = node_path.default.join(context, "types", contractFileName);
34
- let contractTypes;
36
+ let generationError = null;
37
+ try {
38
+ if (await require_contract_types.generateContractTypes(context) === "generated") console.log(`[EmitPluginManifest] Contract types regenerated (${context}).`);
39
+ } catch (error) {
40
+ generationError = error instanceof Error ? error.message : String(error);
41
+ }
42
+ if (generationError) {
43
+ console.warn(`[EmitPluginManifest] Skipping manifest generation — ${generationError}`);
44
+ return;
45
+ }
46
+ const sourceContractPath = node_path.default.join(context, require_contract_types.CONTRACT_TYPES_FILE);
35
47
  const tryReadFile = async (filePath) => {
36
48
  if (!node_fs.default.existsSync(filePath)) return null;
37
49
  if (!node_fs.default.statSync(filePath).isFile()) return null;
@@ -41,17 +53,13 @@ var EmitPluginManifest = class {
41
53
  return null;
42
54
  }
43
55
  };
44
- contractTypes = await tryReadFile(sourceContractPath) ?? "";
56
+ const contractTypes = await tryReadFile(sourceContractPath) ?? "";
45
57
  if (!contractTypes) {
46
- const packageDir = context.split("/").pop();
47
- const nestedPath = node_path.default.join(context, "types", packageDir ?? "", "src", contractFileName);
48
- contractTypes = await tryReadFile(nestedPath) ?? "";
49
- if (!contractTypes) {
50
- console.warn(`[EmitPluginManifest] Contract file not found at ${sourceContractPath} or ${nestedPath}. Skipping manifest generation.`);
51
- return;
52
- }
58
+ console.warn(`[EmitPluginManifest] No contract types at ${sourceContractPath} (no src/contract.ts in this workspace?). Skipping manifest generation.`);
59
+ return;
53
60
  }
54
61
  const contractSha256 = node_crypto.default.createHash("sha256").update(contractTypes).digest("hex");
62
+ const hashedEntry = require_build_artifact_names.findHashedEntry(Object.keys(compilation.assets), "remoteEntry");
55
63
  const manifest = {
56
64
  schemaVersion: 1,
57
65
  kind: "every-plugin/manifest",
@@ -59,7 +67,7 @@ var EmitPluginManifest = class {
59
67
  name: pluginInfo.name,
60
68
  version: pluginInfo.version
61
69
  },
62
- runtime: { remoteEntry: "./remoteEntry.js" },
70
+ runtime: { remoteEntry: `./${hashedEntry ?? "remoteEntry.js"}` },
63
71
  contract: {
64
72
  kind: "orpc",
65
73
  types: {
@@ -70,26 +78,6 @@ var EmitPluginManifest = class {
70
78
  }
71
79
  }
72
80
  };
73
- const additionalExportsEntries = [];
74
- if (this.options.additionalExports?.length) {
75
- for (const additional of this.options.additionalExports) {
76
- const sourcePath = node_path.default.join(context, "types", additional.srcPath);
77
- const content = await tryReadFile(sourcePath);
78
- if (!content) {
79
- console.warn(`[EmitPluginManifest] Additional export file not found at ${sourcePath}. Skipping.`);
80
- continue;
81
- }
82
- const sha256 = node_crypto.default.createHash("sha256").update(content).digest("hex");
83
- const distPath = `./types/${additional.srcPath}`;
84
- additionalExportsEntries.push({
85
- path: distPath,
86
- exports: additional.exportNames,
87
- sha256
88
- });
89
- if (rawSource) compilation.emitAsset(`types/${additional.srcPath}`, new rawSource(content));
90
- }
91
- if (additionalExportsEntries.length > 0) manifest.additionalExports = additionalExportsEntries;
92
- }
93
81
  if (rawSource) {
94
82
  compilation.emitAsset(manifestFileName, new rawSource(`${JSON.stringify(manifest, null, 2)}\n`));
95
83
  compilation.emitAsset(`types/${contractFileName}`, new rawSource(`${contractTypes}`));
@@ -98,22 +86,18 @@ var EmitPluginManifest = class {
98
86
  });
99
87
  }
100
88
  };
101
- var EveryPluginDevServer = class {
89
+ var EveryPluginBuild = class {
102
90
  options;
103
- name = "EveryPluginDevServer";
91
+ name = "EveryPluginBuild";
104
92
  constructor(options = {}) {
105
93
  this.options = options;
106
94
  }
107
95
  apply(compiler) {
108
96
  const pluginInfo = require_utils.getPluginInfo(compiler.options.context || process.cwd());
109
- const devConfig = require_utils.loadDevConfig(this.options.devConfigPath || "./plugin.dev.ts");
110
- const port = Number(process.env.PORT) || this.options.port || devConfig?.port || 3999;
111
97
  this.configureDefaults(compiler, pluginInfo);
112
- if (!compiler.options.devServer) compiler.options.devServer = {};
113
- this.configureDevServer(compiler, pluginInfo, devConfig, port);
114
98
  new _module_federation_enhanced_rspack.ModuleFederationPlugin({
115
99
  name: pluginInfo.normalizedName,
116
- filename: "remoteEntry.js",
100
+ filename: require_build_artifact_names.uiEntryFilename({ isBuild: require_build_artifact_names.isBuildInvocation() }),
117
101
  dts: this.options.dts !== false,
118
102
  manifest: {},
119
103
  runtimePlugins: [require.resolve("@module-federation/node/runtimePlugin")],
@@ -122,6 +106,8 @@ var EveryPluginDevServer = class {
122
106
  shared: require_module_federation.buildSharedDependencies(pluginInfo),
123
107
  shareStrategy: "version-first"
124
108
  }).apply(compiler);
109
+ new require_build_report_plugin.BuildReportPlugin().apply(compiler);
110
+ new require_chunk_completeness_plugin.ChunkCompletenessPlugin().apply(compiler);
125
111
  if (this.options.dts === false) compiler.options.plugins = (compiler.options.plugins ?? []).filter((p) => !p || typeof p !== "object" || p.name !== "MFDevPlugin" && p.name !== "ModuleFederationDtsPlugin");
126
112
  }
127
113
  configureDefaults(compiler, pluginInfo) {
@@ -130,20 +116,25 @@ var EveryPluginDevServer = class {
130
116
  compiler.options.output.uniqueName = pluginInfo.normalizedName;
131
117
  compiler.options.output.publicPath = "auto";
132
118
  compiler.options.output.path = node_path.default.resolve(context, "dist");
133
- compiler.options.output.clean = true;
119
+ compiler.options.output.clean = !compiler.options.watch;
134
120
  compiler.options.output.library = { type: "commonjs-module" };
135
121
  if (!compiler.options.target) compiler.options.target = "async-node";
136
122
  if (!compiler.options.mode) compiler.options.mode = process.env.NODE_ENV === "development" ? "development" : "production";
137
123
  if (compiler.options.devtool === void 0) compiler.options.devtool = "source-map";
138
124
  if (!compiler.options.infrastructureLogging) compiler.options.infrastructureLogging = { level: "warn" };
139
125
  this.ensureTypeScriptLoader(compiler);
126
+ if (!compiler.options.optimization) compiler.options.optimization = {};
127
+ compiler.options.optimization.splitChunks = false;
128
+ compiler.options.optimization.moduleIds = "named";
140
129
  if (!compiler.options.resolve) compiler.options.resolve = {};
141
130
  compiler.options.resolve.extensions = [
142
131
  "...",
143
132
  ".tsx",
144
133
  ".ts"
145
134
  ];
135
+ const sourceFirst = process.env.DEPLOY !== "true";
146
136
  compiler.options.resolve.conditionNames = [
137
+ ...sourceFirst ? ["development"] : [],
147
138
  "webpack",
148
139
  "import",
149
140
  "module",
@@ -151,7 +142,12 @@ var EveryPluginDevServer = class {
151
142
  "node",
152
143
  "default"
153
144
  ];
154
- if (compiler.options.resolve.byDependency) for (const depType of Object.keys(compiler.options.resolve.byDependency)) {
145
+ if (sourceFirst) compiler.options.resolve.extensionAlias = { ".js": [
146
+ ".js",
147
+ ".ts",
148
+ ".tsx"
149
+ ] };
150
+ if (!sourceFirst && compiler.options.resolve.byDependency) for (const depType of Object.keys(compiler.options.resolve.byDependency)) {
155
151
  const depConfig = compiler.options.resolve.byDependency[depType];
156
152
  if (depConfig?.conditionNames) depConfig.conditionNames = depConfig.conditionNames.filter((c) => c !== "development");
157
153
  }
@@ -164,40 +160,19 @@ var EveryPluginDevServer = class {
164
160
  ensureTypeScriptLoader(compiler) {
165
161
  if (!compiler.options.module) compiler.options.module = { rules: [] };
166
162
  if (!compiler.options.module.rules) compiler.options.module.rules = [];
163
+ if (!compiler.options.module.rules.some((rule) => typeof rule === "object" && rule !== null && "test" in rule && rule.test instanceof RegExp && rule.test.test(".json"))) compiler.options.module.rules.push({
164
+ test: /\.json$/,
165
+ type: "json"
166
+ });
167
167
  if (!compiler.options.module.rules.some((rule) => typeof rule === "object" && rule !== null && "test" in rule && rule.test instanceof RegExp && rule.test.test(".ts"))) compiler.options.module.rules.push({
168
168
  test: /\.tsx?$/,
169
169
  use: "builtin:swc-loader",
170
170
  exclude: /node_modules/
171
171
  });
172
172
  }
173
- configureDevServer(compiler, pluginInfo, devConfig, port) {
174
- if (!compiler.options.devServer) return;
175
- const context = compiler.options.context || process.cwd();
176
- const originalSetup = compiler.options.devServer.setupMiddlewares;
177
- compiler.options.devServer.port = port;
178
- compiler.options.devServer.static = node_path.default.join(context, "dist");
179
- compiler.options.devServer.hot = true;
180
- compiler.options.devServer.devMiddleware = { writeToDisk: true };
181
- compiler.options.devServer.headers = {
182
- "Access-Control-Allow-Origin": "*",
183
- "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
184
- "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
185
- };
186
- compiler.options.devServer.client = {
187
- logging: "warn",
188
- overlay: {
189
- warnings: false,
190
- errors: true
191
- }
192
- };
193
- compiler.options.devServer.setupMiddlewares = (middlewares, devServer) => {
194
- require_dev_server_middleware.setupPluginMiddleware(devServer, pluginInfo, devConfig, port);
195
- return originalSetup ? originalSetup(middlewares, devServer) : middlewares;
196
- };
197
- }
198
173
  };
199
174
 
200
175
  //#endregion
201
176
  exports.EmitPluginManifest = EmitPluginManifest;
202
- exports.EveryPluginDevServer = EveryPluginDevServer;
177
+ exports.EveryPluginBuild = EveryPluginBuild;
203
178
  //# sourceMappingURL=plugin.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs","names":["getPluginInfo","path","fs","crypto","loadDevConfig","ModuleFederationPlugin","buildSharedDependencies"],"sources":["../../../src/build/rspack/plugin.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { ModuleFederationPlugin } from \"@module-federation/enhanced/rspack\";\nimport type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport { setupPluginMiddleware } from \"./dev-server-middleware\";\nimport { buildSharedDependencies } from \"./module-federation\";\nimport { getPluginInfo, loadDevConfig } from \"./utils\";\n\nexport interface EveryPluginOptions {\n devConfigPath?: string;\n port?: number;\n pluginId?: string;\n dts?: boolean;\n}\n\nexport interface AdditionalExport {\n srcPath: string;\n exportNames: string[];\n}\n\nexport interface PluginManifestEmitterOptions {\n manifestFileName?: string;\n contractFileName?: string;\n additionalExports?: AdditionalExport[];\n}\n\nexport class EmitPluginManifest implements RspackPluginInstance {\n name = \"EmitPluginManifest\";\n\n constructor(private options: PluginManifestEmitterOptions = {}) {}\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.tapPromise({ name: this.name, stage }, async () => {\n const context = compiler.options.context || process.cwd();\n const pluginInfo = getPluginInfo(context);\n const contractFileName = this.options.contractFileName ?? \"contract.d.ts\";\n const manifestFileName = this.options.manifestFileName ?? \"plugin.manifest.json\";\n\n const sourceContractPath = path.join(context, \"types\", contractFileName);\n\n let contractTypes: string;\n\n const tryReadFile = async (filePath: string): Promise<string | null> => {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n const stats = fs.statSync(filePath);\n if (!stats.isFile()) {\n return null;\n }\n try {\n return await fs.promises.readFile(filePath, \"utf8\");\n } catch {\n return null;\n }\n };\n\n contractTypes = (await tryReadFile(sourceContractPath)) ?? \"\";\n\n if (!contractTypes) {\n const packageDir = context.split(\"/\").pop();\n const nestedPath = path.join(context, \"types\", packageDir ?? \"\", \"src\", contractFileName);\n\n contractTypes = (await tryReadFile(nestedPath)) ?? \"\";\n\n if (!contractTypes) {\n console.warn(\n `[EmitPluginManifest] Contract file not found at ${sourceContractPath} or ${nestedPath}. ` +\n `Skipping manifest generation.`,\n );\n return;\n }\n }\n\n const contractSha256 = crypto.createHash(\"sha256\").update(contractTypes).digest(\"hex\");\n const manifest: Record<string, unknown> = {\n schemaVersion: 1,\n kind: \"every-plugin/manifest\",\n plugin: {\n name: pluginInfo.name,\n version: pluginInfo.version,\n },\n runtime: {\n remoteEntry: \"./remoteEntry.js\",\n },\n contract: {\n kind: \"orpc\",\n types: {\n path: `./types/${contractFileName}`,\n exportName: \"contract\",\n typeName: \"ContractType\",\n sha256: contractSha256,\n },\n },\n };\n\n const additionalExportsEntries: Array<{ path: string; exports: string[]; sha256: string }> =\n [];\n\n if (this.options.additionalExports?.length) {\n for (const additional of this.options.additionalExports) {\n const sourcePath = path.join(context, \"types\", additional.srcPath);\n const content = await tryReadFile(sourcePath);\n if (!content) {\n console.warn(\n `[EmitPluginManifest] Additional export file not found at ${sourcePath}. Skipping.`,\n );\n continue;\n }\n const sha256 = crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n const distPath = `./types/${additional.srcPath}`;\n additionalExportsEntries.push({\n path: distPath,\n exports: additional.exportNames,\n sha256,\n });\n\n if (rawSource) {\n compilation.emitAsset(`types/${additional.srcPath}`, new rawSource(content));\n }\n }\n\n if (additionalExportsEntries.length > 0) {\n manifest.additionalExports = additionalExportsEntries;\n }\n }\n\n if (rawSource) {\n compilation.emitAsset(\n manifestFileName,\n new rawSource(`${JSON.stringify(manifest, null, 2)}\\n`),\n );\n compilation.emitAsset(`types/${contractFileName}`, new rawSource(`${contractTypes}`));\n }\n });\n });\n }\n}\n\nexport class EveryPluginDevServer implements RspackPluginInstance {\n name = \"EveryPluginDevServer\";\n\n constructor(private options: EveryPluginOptions = {}) {}\n\n apply(compiler: Compiler) {\n const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());\n const devConfig = loadDevConfig(this.options.devConfigPath || \"./plugin.dev.ts\");\n const port = Number(process.env.PORT) || this.options.port || devConfig?.port || 3999;\n\n this.configureDefaults(compiler, pluginInfo);\n\n if (!compiler.options.devServer) {\n compiler.options.devServer = {};\n }\n\n this.configureDevServer(compiler, pluginInfo, devConfig, port);\n\n new ModuleFederationPlugin({\n name: pluginInfo.normalizedName,\n filename: \"remoteEntry.js\",\n dts: this.options.dts !== false,\n manifest: {},\n runtimePlugins: [require.resolve(\"@module-federation/node/runtimePlugin\")],\n library: { type: \"commonjs-module\" },\n exposes: {\n \"./plugin\": \"./src/index.ts\",\n },\n shared: buildSharedDependencies(pluginInfo),\n shareStrategy: \"version-first\",\n }).apply(compiler);\n\n if (this.options.dts === false) {\n compiler.options.plugins = (compiler.options.plugins ?? []).filter(\n (p) =>\n !p ||\n typeof p !== \"object\" ||\n ((p as any).name !== \"MFDevPlugin\" && (p as any).name !== \"ModuleFederationDtsPlugin\"),\n );\n }\n }\n\n private configureDefaults(compiler: Compiler, pluginInfo: any) {\n const context = compiler.options.context || process.cwd();\n\n if (!compiler.options.output) {\n compiler.options.output = {};\n }\n compiler.options.output.uniqueName = pluginInfo.normalizedName;\n compiler.options.output.publicPath = \"auto\";\n compiler.options.output.path = path.resolve(context, \"dist\");\n compiler.options.output.clean = true;\n compiler.options.output.library = { type: \"commonjs-module\" };\n\n if (!compiler.options.target) {\n compiler.options.target = \"async-node\";\n }\n\n if (!compiler.options.mode) {\n compiler.options.mode = process.env.NODE_ENV === \"development\" ? \"development\" : \"production\";\n }\n\n if (compiler.options.devtool === undefined) {\n compiler.options.devtool = \"source-map\";\n }\n\n if (!compiler.options.infrastructureLogging) {\n compiler.options.infrastructureLogging = {\n level: \"warn\",\n };\n }\n\n this.ensureTypeScriptLoader(compiler);\n\n if (!compiler.options.resolve) {\n compiler.options.resolve = {};\n }\n compiler.options.resolve.extensions = [\"...\", \".tsx\", \".ts\"];\n compiler.options.resolve.conditionNames = [\n \"webpack\",\n \"import\",\n \"module\",\n \"require\",\n \"node\",\n \"default\",\n ];\n if (compiler.options.resolve.byDependency) {\n for (const depType of Object.keys(compiler.options.resolve.byDependency)) {\n const depConfig = (\n compiler.options.resolve.byDependency as Record<string, { conditionNames?: string[] }>\n )[depType];\n if (depConfig?.conditionNames) {\n depConfig.conditionNames = depConfig.conditionNames.filter((c) => c !== \"development\");\n }\n }\n }\n compiler.options.resolve.fallback = {\n ...compiler.options.resolve.fallback,\n bufferutil: false,\n \"utf-8-validate\": false,\n };\n }\n\n private ensureTypeScriptLoader(compiler: Compiler) {\n if (!compiler.options.module) {\n compiler.options.module = { rules: [] } as any;\n }\n\n if (!compiler.options.module.rules) {\n compiler.options.module.rules = [];\n }\n\n const hasTsLoader = compiler.options.module.rules.some(\n (rule: any) =>\n typeof rule === \"object\" &&\n rule !== null &&\n \"test\" in rule &&\n rule.test instanceof RegExp &&\n rule.test.test(\".ts\"),\n );\n\n if (!hasTsLoader) {\n compiler.options.module.rules.push({\n test: /\\.tsx?$/,\n use: \"builtin:swc-loader\",\n exclude: /node_modules/,\n });\n }\n }\n\n private configureDevServer(compiler: Compiler, pluginInfo: any, devConfig: any, port: number) {\n if (!compiler.options.devServer) {\n return;\n }\n\n const context = compiler.options.context || process.cwd();\n const originalSetup = compiler.options.devServer.setupMiddlewares;\n\n compiler.options.devServer.port = port;\n compiler.options.devServer.static = path.join(context, \"dist\");\n compiler.options.devServer.hot = true;\n compiler.options.devServer.devMiddleware = { writeToDisk: true };\n compiler.options.devServer.headers = {\n \"Access-Control-Allow-Origin\": \"*\",\n \"Access-Control-Allow-Methods\": \"GET, POST, PUT, DELETE, PATCH, OPTIONS\",\n \"Access-Control-Allow-Headers\": \"X-Requested-With, content-type, Authorization\",\n };\n\n compiler.options.devServer.client = {\n logging: \"warn\",\n overlay: {\n warnings: false,\n errors: true,\n },\n };\n\n compiler.options.devServer.setupMiddlewares = (middlewares, devServer) => {\n setupPluginMiddleware(devServer, pluginInfo, devConfig, port);\n return originalSetup ? originalSetup(middlewares, devServer) : middlewares;\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;AA2BA,IAAa,qBAAb,MAAgE;CAG1C;CAFpB,OAAO;CAEP,YAAY,AAAQ,UAAwC,CAAC,GAAG;EAA5C;CAA6C;CAEjE,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,WAAW;IAAE,MAAM,KAAK;IAAM;GAAM,GAAG,YAAY;IACjF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,IAAI;IACxD,MAAM,aAAaA,4BAAc,OAAO;IACxC,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAC1D,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAE1D,MAAM,qB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AgB,cAAc,aAAa,SAAS,IAAI;EACjE;CACF;AACF"}
1
+ {"version":3,"file":"plugin.cjs","names":["getPluginInfo","generateContractTypes","path","CONTRACT_TYPES_FILE","fs","crypto","findHashedEntry","ModuleFederationPlugin","uiEntryFilename","isBuildInvocation","buildSharedDependencies","BuildReportPlugin","ChunkCompletenessPlugin"],"sources":["../../../src/build/rspack/plugin.ts"],"sourcesContent":["import crypto from \"node:crypto\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { ModuleFederationPlugin } from \"@module-federation/enhanced/rspack\";\nimport type { Compiler, RspackPluginInstance } from \"@rspack/core\";\nimport {\n DEV_ENTRY_FILENAME,\n findHashedEntry,\n isBuildInvocation,\n uiEntryFilename,\n} from \"../artifact-names\";\nimport { CONTRACT_TYPES_FILE, generateContractTypes } from \"../contract-types\";\nimport { BuildReportPlugin } from \"./build-report-plugin\";\nimport { ChunkCompletenessPlugin } from \"./chunk-completeness-plugin\";\nimport { buildSharedDependencies } from \"./module-federation\";\nimport { getPluginInfo } from \"./utils\";\n\nexport interface EveryPluginBuildOptions {\n dts?: boolean;\n}\n\nexport interface PluginManifestEmitterOptions {\n manifestFileName?: string;\n contractFileName?: string;\n}\n\nexport class EmitPluginManifest implements RspackPluginInstance {\n name = \"EmitPluginManifest\";\n\n constructor(private options: PluginManifestEmitterOptions = {}) {}\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.tapPromise({ name: this.name, stage }, async () => {\n const context = compiler.options.context || process.cwd();\n const pluginInfo = getPluginInfo(context);\n const contractFileName = this.options.contractFileName ?? \"contract.d.ts\";\n const manifestFileName = this.options.manifestFileName ?? \"plugin.manifest.json\";\n\n let generationError: string | null = null;\n try {\n const status = await generateContractTypes(context);\n if (status === \"generated\") {\n console.log(`[EmitPluginManifest] Contract types regenerated (${context}).`);\n }\n } catch (error) {\n generationError = error instanceof Error ? error.message : String(error);\n }\n\n if (generationError) {\n console.warn(`[EmitPluginManifest] Skipping manifest generation — ${generationError}`);\n return;\n }\n\n const sourceContractPath = path.join(context, CONTRACT_TYPES_FILE);\n\n const tryReadFile = async (filePath: string): Promise<string | null> => {\n if (!fs.existsSync(filePath)) {\n return null;\n }\n const stats = fs.statSync(filePath);\n if (!stats.isFile()) {\n return null;\n }\n try {\n return await fs.promises.readFile(filePath, \"utf8\");\n } catch {\n return null;\n }\n };\n\n const contractTypes = (await tryReadFile(sourceContractPath)) ?? \"\";\n\n if (!contractTypes) {\n console.warn(\n `[EmitPluginManifest] No contract types at ${sourceContractPath} ` +\n `(no src/contract.ts in this workspace?). Skipping manifest generation.`,\n );\n return;\n }\n\n const contractSha256 = crypto.createHash(\"sha256\").update(contractTypes).digest(\"hex\");\n const hashedEntry = findHashedEntry(Object.keys(compilation.assets), \"remoteEntry\");\n const manifest: Record<string, unknown> = {\n schemaVersion: 1,\n kind: \"every-plugin/manifest\",\n plugin: {\n name: pluginInfo.name,\n version: pluginInfo.version,\n },\n runtime: {\n remoteEntry: `./${hashedEntry ?? DEV_ENTRY_FILENAME}`,\n },\n contract: {\n kind: \"orpc\",\n types: {\n path: `./types/${contractFileName}`,\n exportName: \"contract\",\n typeName: \"ContractType\",\n sha256: contractSha256,\n },\n },\n };\n\n if (rawSource) {\n compilation.emitAsset(\n manifestFileName,\n new rawSource(`${JSON.stringify(manifest, null, 2)}\\n`),\n );\n compilation.emitAsset(`types/${contractFileName}`, new rawSource(`${contractTypes}`));\n }\n });\n });\n }\n}\n\nexport class EveryPluginBuild implements RspackPluginInstance {\n name = \"EveryPluginBuild\";\n\n constructor(private options: EveryPluginBuildOptions = {}) {}\n\n apply(compiler: Compiler) {\n const pluginInfo = getPluginInfo(compiler.options.context || process.cwd());\n\n this.configureDefaults(compiler, pluginInfo);\n\n new ModuleFederationPlugin({\n name: pluginInfo.normalizedName,\n filename: uiEntryFilename({ isBuild: isBuildInvocation() }),\n dts: this.options.dts !== false,\n manifest: {},\n runtimePlugins: [require.resolve(\"@module-federation/node/runtimePlugin\")],\n library: { type: \"commonjs-module\" },\n exposes: {\n \"./plugin\": \"./src/index.ts\",\n },\n shared: buildSharedDependencies(pluginInfo),\n shareStrategy: \"version-first\",\n }).apply(compiler);\n\n new BuildReportPlugin().apply(compiler);\n new ChunkCompletenessPlugin().apply(compiler);\n\n if (this.options.dts === false) {\n compiler.options.plugins = (compiler.options.plugins ?? []).filter(\n (p) =>\n !p ||\n typeof p !== \"object\" ||\n ((p as any).name !== \"MFDevPlugin\" && (p as any).name !== \"ModuleFederationDtsPlugin\"),\n );\n }\n }\n\n private configureDefaults(compiler: Compiler, pluginInfo: any) {\n const context = compiler.options.context || process.cwd();\n\n if (!compiler.options.output) {\n compiler.options.output = {};\n }\n compiler.options.output.uniqueName = pluginInfo.normalizedName;\n compiler.options.output.publicPath = \"auto\";\n compiler.options.output.path = path.resolve(context, \"dist\");\n // Watch rebuilds must not wipe dist: the dev serve static handler serves\n // this directory, and a clean on every rebuild opens a window where\n // remoteEntry.js 404s for any consumer that loads mid-rebuild.\n compiler.options.output.clean = !compiler.options.watch;\n compiler.options.output.library = { type: \"commonjs-module\" };\n\n if (!compiler.options.target) {\n compiler.options.target = \"async-node\";\n }\n\n if (!compiler.options.mode) {\n compiler.options.mode = process.env.NODE_ENV === \"development\" ? \"development\" : \"production\";\n }\n\n if (compiler.options.devtool === undefined) {\n compiler.options.devtool = \"source-map\";\n }\n\n if (!compiler.options.infrastructureLogging) {\n compiler.options.infrastructureLogging = {\n level: \"warn\",\n };\n }\n\n this.ensureTypeScriptLoader(compiler);\n\n if (!compiler.options.optimization) {\n compiler.options.optimization = {};\n }\n // rspack 2.x splitChunks re-ids the final chunk graph while the federation\n // get-factory codegen keeps pre-split ids — the entry then references\n // chunks that were never emitted (ChunkCompletenessPlugin's exact failure\n // mode). Splitting off keeps the emitted bundle self-consistent.\n compiler.options.optimization.splitChunks = false;\n // The default deterministic module ids hash module identifiers that embed\n // absolute resource paths, so the same source builds to different id\n // spaces on different machines (host deploy train vs the image's\n // dist-builder stage). A mixed-generation load — CDN-pinned entry +\n // staged chunks — then splices two incompatible id spaces and fails with\n // \"__webpack_modules__[r] is not a function\". Named ids derive from\n // context-relative requests, keeping builds machine-independent and the\n // two generations semantically identical.\n compiler.options.optimization.moduleIds = \"named\";\n\n if (!compiler.options.resolve) {\n compiler.options.resolve = {};\n }\n compiler.options.resolve.extensions = [\"...\", \".tsx\", \".ts\"];\n // Source-first for local flows: resolve framework packages through the\n // `development` export condition (TS source) unless DEPLOY=true — the\n // manual dist-first switch deploy-identical builds opt into. (NODE_ENV\n // is unusable as the gate here: the rspack CLI defaults it to\n // \"production\" for every `build` invocation, including local dev watch.)\n // byDependency entries inherit the root conditions via \"...\", so\n // dropping the strip lets esm/cjs deps pick up `development` too.\n const sourceFirst = process.env.DEPLOY !== \"true\";\n compiler.options.resolve.conditionNames = [\n ...(sourceFirst ? [\"development\"] : []),\n \"webpack\",\n \"import\",\n \"module\",\n \"require\",\n \"node\",\n \"default\",\n ];\n if (sourceFirst) {\n // Source-resolved TS packages (e.g. better-near-auth) use node-style\n // `.js` specifiers for their own relative imports; map them to the\n // on-disk `.ts` sources. `.js` stays first in the expansion: the alias\n // picks the first target that exists on disk, and .ts-first made\n // packages that also ship index.ts (e.g. @scure/base) resolve their\n // TypeScript over their real JavaScript entry.\n compiler.options.resolve.extensionAlias = {\n \".js\": [\".js\", \".ts\", \".tsx\"],\n };\n }\n if (!sourceFirst && compiler.options.resolve.byDependency) {\n for (const depType of Object.keys(compiler.options.resolve.byDependency)) {\n const depConfig = (\n compiler.options.resolve.byDependency as Record<string, { conditionNames?: string[] }>\n )[depType];\n if (depConfig?.conditionNames) {\n depConfig.conditionNames = depConfig.conditionNames.filter((c) => c !== \"development\");\n }\n }\n }\n compiler.options.resolve.fallback = {\n ...compiler.options.resolve.fallback,\n bufferutil: false,\n \"utf-8-validate\": false,\n };\n }\n\n private ensureTypeScriptLoader(compiler: Compiler) {\n if (!compiler.options.module) {\n compiler.options.module = { rules: [] } as any;\n }\n\n if (!compiler.options.module.rules) {\n compiler.options.module.rules = [];\n }\n\n // Source-first resolution pulls every-plugin src into the graph, which\n // imports package.json (runtime/mf-config.ts). The MF shared chunks\n // must emit it as a json module, not parse it as JavaScript.\n const hasJsonRule = compiler.options.module.rules.some(\n (rule: any) =>\n typeof rule === \"object\" &&\n rule !== null &&\n \"test\" in rule &&\n rule.test instanceof RegExp &&\n rule.test.test(\".json\"),\n );\n\n if (!hasJsonRule) {\n compiler.options.module.rules.push({\n test: /\\.json$/,\n type: \"json\",\n } as any);\n }\n\n const hasTsLoader = compiler.options.module.rules.some(\n (rule: any) =>\n typeof rule === \"object\" &&\n rule !== null &&\n \"test\" in rule &&\n rule.test instanceof RegExp &&\n rule.test.test(\".ts\"),\n );\n\n if (!hasTsLoader) {\n compiler.options.module.rules.push({\n test: /\\.tsx?$/,\n use: \"builtin:swc-loader\",\n exclude: /node_modules/,\n });\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0BA,IAAa,qBAAb,MAAgE;CAG1C;CAFpB,OAAO;CAEP,YAAY,AAAQ,UAAwC,CAAC,GAAG;EAA5C;CAA6C;CAEjE,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,WAAW;IAAE,MAAM,KAAK;IAAM;GAAM,GAAG,YAAY;IACjF,MAAM,UAAU,SAAS,QAAQ,WAAW,QAAQ,IAAI;IACxD,MAAM,aAAaA,4BAAc,OAAO;IACxC,MAAM,mBAAmB,KAAK,QAAQ,oBAAoB;IAC1D,MAAM,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D,IAAI,CAAC,SAAS,QAAQ,QACpB,SAAS,QAAQ,SAAS,EAAE,OAAO,CAAC,EAAE;EAGxC,IAAI,CAAC,SAAS,QAAQ,OAAO,OAC3B,SAAS,QAAQ,OAAO,QAAQ,CAAC;EAenC,IAAI,CATgB,SAAS,QAAQ,OAAO,MAAM,MAC/C,SACC,OAAO,SAAS,YAChB,SAAS,QACT,UAAU,QACV,KAAK,gBAAgB,UACrB,KAAK,KAAK,KAAK,OAAO,CAGX,GACb,SAAS,QAAQ,OAAO,MAAM,KAAK;GACjC,MAAM;GACN,MAAM;EACR,CAAQ;EAYV,IAAI,CATgB,SAAS,QAAQ,OAAO,MAAM,MAC/C,SACC,OAAO,SAAS,YAChB,SAAS,QACT,UAAU,QACV,KAAK,gBAAgB,UACrB,KAAK,KAAK,KAAK,KAAK,CAGT,GACb,SAAS,QAAQ,OAAO,MAAM,KAAK;GACjC,MAAM;GACN,KAAK;GACL,SAAS;EACX,CAAC;CAEL;AACF"}
@@ -1,19 +1,11 @@
1
1
  import { Compiler, RspackPluginInstance } from "@rspack/core";
2
2
  //#region src/build/rspack/plugin.d.ts
3
- interface EveryPluginOptions {
4
- devConfigPath?: string;
5
- port?: number;
6
- pluginId?: string;
3
+ interface EveryPluginBuildOptions {
7
4
  dts?: boolean;
8
5
  }
9
- interface AdditionalExport {
10
- srcPath: string;
11
- exportNames: string[];
12
- }
13
6
  interface PluginManifestEmitterOptions {
14
7
  manifestFileName?: string;
15
8
  contractFileName?: string;
16
- additionalExports?: AdditionalExport[];
17
9
  }
18
10
  declare class EmitPluginManifest implements RspackPluginInstance {
19
11
  private options;
@@ -21,15 +13,14 @@ declare class EmitPluginManifest implements RspackPluginInstance {
21
13
  constructor(options?: PluginManifestEmitterOptions);
22
14
  apply(compiler: Compiler): void;
23
15
  }
24
- declare class EveryPluginDevServer implements RspackPluginInstance {
16
+ declare class EveryPluginBuild implements RspackPluginInstance {
25
17
  private options;
26
18
  name: string;
27
- constructor(options?: EveryPluginOptions);
19
+ constructor(options?: EveryPluginBuildOptions);
28
20
  apply(compiler: Compiler): void;
29
21
  private configureDefaults;
30
22
  private ensureTypeScriptLoader;
31
- private configureDevServer;
32
23
  }
33
24
  //#endregion
34
- export { AdditionalExport, EmitPluginManifest, EveryPluginDevServer, EveryPluginOptions, PluginManifestEmitterOptions };
25
+ export { EmitPluginManifest, EveryPluginBuild, EveryPluginBuildOptions, PluginManifestEmitterOptions };
35
26
  //# sourceMappingURL=plugin.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"mappings":";;UASiB;EACf;EACA;EACA;EACA;;UAGe;EACf;EACA;;UAGe;EACf;EACA;EACA,oBAAoB;;cAGT,8BAA8B;UAGrB;EAFpB;EAEoB,YAAA,UAAS;EAE7B,MAAM,UAAU;;cAiHL,gCAAgC;UAGvB;EAFpB;EAEoB,YAAA,UAAS;EAE7B,MAAM,UAAU;UAqCR;UA6DA;UA2BA"}
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../../src/build/rspack/plugin.ts"],"mappings":";;UAiBiB;EACf;;UAGe;EACf;EACA;;cAGW,8BAA8B;UAGrB;EAFpB;EAEA,YAAoB,UAAS;EAE7B,MAAM,UAAU;;cAyFL,4BAA4B;UAGnB;EAFpB;EAEA,YAAoB,UAAS;EAE7B,MAAM,UAAU;UAgCR;UAsGA"}