@powerhousedao/shared 6.2.3 → 6.3.0-dev.2

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 (326) hide show
  1. package/dist/action-id-DON1WCeY.d.ts +19 -0
  2. package/dist/action-id-DON1WCeY.d.ts.map +1 -0
  3. package/dist/clis/args/access-token.d.mts +14 -2
  4. package/dist/clis/args/access-token.d.mts.map +1 -0
  5. package/dist/clis/args/access-token.mjs +21 -1
  6. package/dist/clis/args/access-token.mjs.map +1 -0
  7. package/dist/clis/args/{common-BXabdhiO.mjs → common-DG_SF8fN.mjs} +39 -8
  8. package/dist/clis/args/common-DG_SF8fN.mjs.map +1 -0
  9. package/dist/clis/args/{common-Bnm859xU.d.mts → common-DmerPWXo.d.mts} +8 -4
  10. package/dist/clis/args/common-DmerPWXo.d.mts.map +1 -0
  11. package/dist/clis/args/common.d.mts +1 -1
  12. package/dist/clis/args/common.mjs +1 -1
  13. package/dist/clis/args/connect.d.mts +448 -2
  14. package/dist/clis/args/connect.d.mts.map +1 -0
  15. package/dist/clis/args/connect.mjs +202 -1
  16. package/dist/clis/args/connect.mjs.map +1 -0
  17. package/dist/clis/args/{generate-BOItUNvP.mjs → generate-DMKgc6et.mjs} +2 -21
  18. package/dist/clis/args/generate-DMKgc6et.mjs.map +1 -0
  19. package/dist/clis/args/generate.d.mts +92 -2
  20. package/dist/clis/args/generate.d.mts.map +1 -0
  21. package/dist/clis/args/generate.mjs +1 -1
  22. package/dist/clis/args/{help-DVPTARGn.d.mts → help-BnD14eCa.d.mts} +62 -2
  23. package/dist/clis/args/help-BnD14eCa.d.mts.map +1 -0
  24. package/dist/clis/args/{help-DS1NlcJQ.mjs → help-Cjoe-b7d.mjs} +55 -15
  25. package/dist/clis/args/help-Cjoe-b7d.mjs.map +1 -0
  26. package/dist/clis/args/help.d.mts +1 -1
  27. package/dist/clis/args/help.mjs +16 -1
  28. package/dist/clis/args/host.d.mts +23 -0
  29. package/dist/clis/args/host.d.mts.map +1 -0
  30. package/dist/clis/args/host.mjs +35 -0
  31. package/dist/clis/args/host.mjs.map +1 -0
  32. package/dist/clis/args/index.d.mts +23 -19
  33. package/dist/clis/args/index.mjs +23 -19
  34. package/dist/clis/args/init.d.mts +53 -2
  35. package/dist/clis/args/init.d.mts.map +1 -0
  36. package/dist/clis/args/init.mjs +77 -1
  37. package/dist/clis/args/init.mjs.map +1 -0
  38. package/dist/clis/args/inspect.d.mts +11 -2
  39. package/dist/clis/args/inspect.d.mts.map +1 -0
  40. package/dist/clis/args/inspect.mjs +14 -1
  41. package/dist/clis/args/inspect.mjs.map +1 -0
  42. package/dist/clis/args/install.d.mts +35 -2
  43. package/dist/clis/args/install.d.mts.map +1 -0
  44. package/dist/clis/args/install.mjs +31 -1
  45. package/dist/clis/args/install.mjs.map +1 -0
  46. package/dist/clis/args/{login-CXRJXg71.d.mts → keyframes.d.mts} +13 -13
  47. package/dist/clis/args/keyframes.d.mts.map +1 -0
  48. package/dist/clis/args/keyframes.mjs +42 -0
  49. package/dist/clis/args/keyframes.mjs.map +1 -0
  50. package/dist/clis/args/list.d.mts +8 -2
  51. package/dist/clis/args/list.d.mts.map +1 -0
  52. package/dist/clis/args/list.mjs +6 -1
  53. package/dist/clis/args/list.mjs.map +1 -0
  54. package/dist/clis/args/login.d.mts +23 -2
  55. package/dist/clis/args/login.d.mts.map +1 -0
  56. package/dist/clis/args/login.mjs +39 -1
  57. package/dist/clis/args/login.mjs.map +1 -0
  58. package/dist/clis/args/{access-token-C5sKsH2O.d.mts → mcp.d.mts} +6 -7
  59. package/dist/clis/args/mcp.d.mts.map +1 -0
  60. package/dist/clis/args/mcp.mjs +22 -0
  61. package/dist/clis/args/mcp.mjs.map +1 -0
  62. package/dist/clis/args/migrate.d.mts +26 -2
  63. package/dist/clis/args/migrate.d.mts.map +1 -0
  64. package/dist/clis/args/migrate.mjs +43 -1
  65. package/dist/clis/args/migrate.mjs.map +1 -0
  66. package/dist/clis/args/{uninstall-CDx7lwxn.d.mts → model.d.mts} +28 -17
  67. package/dist/clis/args/model.d.mts.map +1 -0
  68. package/dist/clis/args/model.mjs +51 -0
  69. package/dist/clis/args/model.mjs.map +1 -0
  70. package/dist/clis/args/publish.d.mts +18 -2
  71. package/dist/clis/args/publish.d.mts.map +1 -0
  72. package/dist/clis/args/publish.mjs +26 -1
  73. package/dist/clis/args/publish.mjs.map +1 -0
  74. package/dist/clis/args/registry.d.mts +15 -2
  75. package/dist/clis/args/registry.d.mts.map +1 -0
  76. package/dist/clis/args/registry.mjs +22 -1
  77. package/dist/clis/args/registry.mjs.map +1 -0
  78. package/dist/clis/args/{unpublish-CEDsk6uv.d.mts → run.d.mts} +11 -12
  79. package/dist/clis/args/run.d.mts.map +1 -0
  80. package/dist/clis/args/run.mjs +33 -0
  81. package/dist/clis/args/run.mjs.map +1 -0
  82. package/dist/clis/args/{service-BBx5GDTc.d.mts → service-CLCvH3kf.d.mts} +4 -4
  83. package/dist/clis/args/service-CLCvH3kf.d.mts.map +1 -0
  84. package/dist/clis/args/service.d.mts +1 -1
  85. package/dist/clis/args/service.mjs +10 -1
  86. package/dist/clis/args/service.mjs.map +1 -0
  87. package/dist/clis/args/switchboard.d.mts +68 -2
  88. package/dist/clis/args/switchboard.d.mts.map +1 -0
  89. package/dist/clis/args/switchboard.mjs +84 -1
  90. package/dist/clis/args/switchboard.mjs.map +1 -0
  91. package/dist/clis/args/uninstall.d.mts +26 -2
  92. package/dist/clis/args/uninstall.d.mts.map +1 -0
  93. package/dist/clis/args/uninstall.mjs +15 -1
  94. package/dist/clis/args/uninstall.mjs.map +1 -0
  95. package/dist/clis/args/unpublish.d.mts +20 -2
  96. package/dist/clis/args/unpublish.d.mts.map +1 -0
  97. package/dist/clis/args/unpublish.mjs +29 -1
  98. package/dist/clis/args/unpublish.mjs.map +1 -0
  99. package/dist/clis/args/{vetra-BUNlAAPp.mjs → vetra-BqjDopAP.mjs} +18 -2
  100. package/dist/clis/args/vetra-BqjDopAP.mjs.map +1 -0
  101. package/dist/clis/args/vetra.d.mts +112 -2
  102. package/dist/clis/args/vetra.d.mts.map +1 -0
  103. package/dist/clis/args/vetra.mjs +1 -1
  104. package/dist/clis/{build-config-CmdMi_wu.mjs → build-config-BM1RL4u_.mjs} +87 -8
  105. package/dist/clis/build-config-BM1RL4u_.mjs.map +1 -0
  106. package/dist/clis/build-config.d.mts +26 -1
  107. package/dist/clis/build-config.d.mts.map +1 -1
  108. package/dist/clis/build-config.mjs +2 -2
  109. package/dist/clis/build-pieces.d.mts +71 -4
  110. package/dist/clis/build-pieces.d.mts.map +1 -1
  111. package/dist/clis/build-pieces.mjs +249 -26
  112. package/dist/clis/build-pieces.mjs.map +1 -1
  113. package/dist/clis/command-names.d.mts +3 -1
  114. package/dist/clis/command-names.d.mts.map +1 -1
  115. package/dist/clis/command-names.mjs +8 -1
  116. package/dist/clis/command-names.mjs.map +1 -1
  117. package/dist/clis/constants.d.mts +2 -2
  118. package/dist/clis/constants.mjs +92 -20
  119. package/dist/clis/constants.mjs.map +1 -1
  120. package/dist/clis/definition-sources.d.mts +26 -0
  121. package/dist/clis/definition-sources.d.mts.map +1 -0
  122. package/dist/clis/definition-sources.mjs +27 -0
  123. package/dist/clis/definition-sources.mjs.map +1 -0
  124. package/dist/clis/deprecations.d.mts +73 -0
  125. package/dist/clis/deprecations.d.mts.map +1 -0
  126. package/dist/clis/deprecations.mjs +121 -0
  127. package/dist/clis/deprecations.mjs.map +1 -0
  128. package/dist/clis/{index-6CZwrmQi.d.mts → index-DnZYG-8g.d.mts} +2 -2
  129. package/dist/clis/{index-6CZwrmQi.d.mts.map → index-DnZYG-8g.d.mts.map} +1 -1
  130. package/dist/clis/index.d.mts +2584 -901
  131. package/dist/clis/index.d.mts.map +1 -1
  132. package/dist/clis/index.mjs +1540 -919
  133. package/dist/clis/index.mjs.map +1 -1
  134. package/dist/clis/package-style.d.mts +32 -0
  135. package/dist/clis/package-style.d.mts.map +1 -0
  136. package/dist/clis/package-style.mjs +102 -0
  137. package/dist/clis/package-style.mjs.map +1 -0
  138. package/dist/clis/ph-dir.d.mts +26 -0
  139. package/dist/clis/ph-dir.d.mts.map +1 -0
  140. package/dist/clis/ph-dir.mjs +37 -0
  141. package/dist/clis/ph-dir.mjs.map +1 -0
  142. package/dist/clis/project-env.d.mts +6 -0
  143. package/dist/clis/project-env.d.mts.map +1 -1
  144. package/dist/clis/project-env.mjs +16 -1
  145. package/dist/clis/project-env.mjs.map +1 -1
  146. package/dist/clis/real-paths.d.mts +14 -0
  147. package/dist/clis/real-paths.d.mts.map +1 -0
  148. package/dist/clis/real-paths.mjs +36 -0
  149. package/dist/clis/real-paths.mjs.map +1 -0
  150. package/dist/clis/retired-flags.d.mts +45 -0
  151. package/dist/clis/retired-flags.d.mts.map +1 -0
  152. package/dist/clis/retired-flags.mjs +55 -0
  153. package/dist/clis/retired-flags.mjs.map +1 -0
  154. package/dist/clis/rolldown-runtime-B4iAMlE-.mjs +35 -0
  155. package/dist/clis/types-CZU17kAm.d.mts +2510 -0
  156. package/dist/clis/types-CZU17kAm.d.mts.map +1 -0
  157. package/dist/clis/utils.d.mts.map +1 -1
  158. package/dist/clis/utils.mjs.map +1 -1
  159. package/dist/{config-loader-C6dZB_iX.js → config-loader-B7SqNz8z.js} +24 -6
  160. package/dist/config-loader-B7SqNz8z.js.map +1 -0
  161. package/dist/connect/app-shell.d.ts +48 -0
  162. package/dist/connect/app-shell.d.ts.map +1 -0
  163. package/dist/connect/app-shell.js +90 -0
  164. package/dist/connect/app-shell.js.map +1 -0
  165. package/dist/connect/config-loader.d.ts +8 -1
  166. package/dist/connect/config-loader.d.ts.map +1 -1
  167. package/dist/connect/config-loader.js +2 -2
  168. package/dist/connect/connect-config-schema.d.ts +3 -0
  169. package/dist/connect/connect-config-schema.js +486 -0
  170. package/dist/connect/connect-config-schema.js.map +1 -0
  171. package/dist/connect/image-ref.d.ts +32 -0
  172. package/dist/connect/image-ref.d.ts.map +1 -0
  173. package/dist/connect/image-ref.js +80 -0
  174. package/dist/connect/image-ref.js.map +1 -0
  175. package/dist/connect/index.d.ts +84 -635
  176. package/dist/connect/index.d.ts.map +1 -1
  177. package/dist/connect/index.js +216 -553
  178. package/dist/connect/index.js.map +1 -1
  179. package/dist/connect/origin-placeholder.d.ts +52 -0
  180. package/dist/connect/origin-placeholder.d.ts.map +1 -0
  181. package/dist/connect/origin-placeholder.js +101 -0
  182. package/dist/connect/origin-placeholder.js.map +1 -0
  183. package/dist/connect-config-schema-cBfkNo1b.d.ts +1872 -0
  184. package/dist/connect-config-schema-cBfkNo1b.d.ts.map +1 -0
  185. package/dist/constants-5UFY_rXh.d.ts +9 -0
  186. package/dist/constants-5UFY_rXh.d.ts.map +1 -0
  187. package/dist/constants.d.ts +1 -1
  188. package/dist/constants.js +22 -6
  189. package/dist/constants.js.map +1 -1
  190. package/dist/document-drive/index.d.ts +3 -4
  191. package/dist/document-drive/index.d.ts.map +1 -1
  192. package/dist/document-drive/index.js +2 -13
  193. package/dist/document-drive/index.js.map +1 -1
  194. package/dist/document-model/action-id.d.ts +3 -0
  195. package/dist/document-model/action-id.js +59 -0
  196. package/dist/document-model/action-id.js.map +1 -0
  197. package/dist/document-model/dispatch.d.ts +25 -0
  198. package/dist/document-model/dispatch.d.ts.map +1 -0
  199. package/dist/document-model/dispatch.js +0 -0
  200. package/dist/document-model/errors.d.ts +3 -0
  201. package/dist/document-model/errors.js +214 -0
  202. package/dist/document-model/errors.js.map +1 -0
  203. package/dist/document-model/index.d.ts +5 -4
  204. package/dist/document-model/index.js +7 -5521
  205. package/dist/document-model/utils.d.ts +3 -2
  206. package/dist/document-model/utils.js +3 -2
  207. package/dist/document-model/version.d.ts +3 -0
  208. package/dist/document-model/version.js +8 -0
  209. package/dist/document-model/version.js.map +1 -0
  210. package/dist/document-model-CqySIaKV.js +5805 -0
  211. package/dist/document-model-CqySIaKV.js.map +1 -0
  212. package/dist/host-tokens/index.d.ts +3 -0
  213. package/dist/host-tokens/index.js +2 -0
  214. package/dist/host-tokens-DOeyxqLi.js +322 -0
  215. package/dist/host-tokens-DOeyxqLi.js.map +1 -0
  216. package/dist/{index-5gwOhPG5.d.ts → index-CUZ8eWun.d.ts} +2 -2
  217. package/dist/{index-5gwOhPG5.d.ts.map → index-CUZ8eWun.d.ts.map} +1 -1
  218. package/dist/index-D58WVj_E.d.ts +246 -0
  219. package/dist/index-D58WVj_E.d.ts.map +1 -0
  220. package/dist/index.d.ts +5 -5
  221. package/dist/processors/index.d.ts +2 -2
  222. package/dist/processors/index.js +177 -68
  223. package/dist/processors/index.js.map +1 -1
  224. package/dist/processors/testing.d.ts +22 -0
  225. package/dist/processors/testing.d.ts.map +1 -0
  226. package/dist/processors/testing.js +77 -0
  227. package/dist/processors/testing.js.map +1 -0
  228. package/dist/purge-CbAV5DVh.js +631 -0
  229. package/dist/purge-CbAV5DVh.js.map +1 -0
  230. package/dist/registry/index.d.ts +3 -3
  231. package/dist/registry/index.js +52 -9
  232. package/dist/registry/index.js.map +1 -1
  233. package/dist/registry/manifest-slim.d.ts +2 -2
  234. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  235. package/dist/types-CV2j3BvH.d.ts +5709 -0
  236. package/dist/types-CV2j3BvH.d.ts.map +1 -0
  237. package/dist/{types-CI3ren9F.d.ts → types-D_6ZcaJj.d.ts} +20 -12
  238. package/dist/types-D_6ZcaJj.d.ts.map +1 -0
  239. package/dist/{utils-CSF716ux.js → utils-DiV32YIj.js} +45 -2
  240. package/dist/utils-DiV32YIj.js.map +1 -0
  241. package/dist/utils-MrLmLEVr.js +78 -0
  242. package/dist/utils-MrLmLEVr.js.map +1 -0
  243. package/dist/version-BxLITo9P.d.ts +6 -0
  244. package/dist/version-BxLITo9P.d.ts.map +1 -0
  245. package/package.json +37 -3
  246. package/dist/clis/args/access-token-3Hqv_U8I.mjs +0 -22
  247. package/dist/clis/args/access-token-3Hqv_U8I.mjs.map +0 -1
  248. package/dist/clis/args/access-token-C5sKsH2O.d.mts.map +0 -1
  249. package/dist/clis/args/common-BXabdhiO.mjs.map +0 -1
  250. package/dist/clis/args/common-Bnm859xU.d.mts.map +0 -1
  251. package/dist/clis/args/connect-BG3HkYBk.mjs +0 -203
  252. package/dist/clis/args/connect-BG3HkYBk.mjs.map +0 -1
  253. package/dist/clis/args/connect-DjeiqXus.d.mts +0 -450
  254. package/dist/clis/args/connect-DjeiqXus.d.mts.map +0 -1
  255. package/dist/clis/args/generate-BOItUNvP.mjs.map +0 -1
  256. package/dist/clis/args/generate-BPBBLeUD.d.mts +0 -103
  257. package/dist/clis/args/generate-BPBBLeUD.d.mts.map +0 -1
  258. package/dist/clis/args/help-DS1NlcJQ.mjs.map +0 -1
  259. package/dist/clis/args/help-DVPTARGn.d.mts.map +0 -1
  260. package/dist/clis/args/init-CFeTq4Cq.d.mts +0 -52
  261. package/dist/clis/args/init-CFeTq4Cq.d.mts.map +0 -1
  262. package/dist/clis/args/init-Dvb42Y87.mjs +0 -67
  263. package/dist/clis/args/init-Dvb42Y87.mjs.map +0 -1
  264. package/dist/clis/args/inspect-BjRmtB86.d.mts +0 -13
  265. package/dist/clis/args/inspect-BjRmtB86.d.mts.map +0 -1
  266. package/dist/clis/args/inspect-UNQgtuR0.mjs +0 -15
  267. package/dist/clis/args/inspect-UNQgtuR0.mjs.map +0 -1
  268. package/dist/clis/args/install-B0tMyUMw.d.mts +0 -37
  269. package/dist/clis/args/install-B0tMyUMw.d.mts.map +0 -1
  270. package/dist/clis/args/install-F-27kF6m.mjs +0 -32
  271. package/dist/clis/args/install-F-27kF6m.mjs.map +0 -1
  272. package/dist/clis/args/list-Bkfn8Yuo.mjs +0 -7
  273. package/dist/clis/args/list-Bkfn8Yuo.mjs.map +0 -1
  274. package/dist/clis/args/list-DrbxA7JJ.d.mts +0 -10
  275. package/dist/clis/args/list-DrbxA7JJ.d.mts.map +0 -1
  276. package/dist/clis/args/login-CIFkQExi.mjs +0 -40
  277. package/dist/clis/args/login-CIFkQExi.mjs.map +0 -1
  278. package/dist/clis/args/login-CXRJXg71.d.mts.map +0 -1
  279. package/dist/clis/args/magic-string.es-BWtG0AyA.mjs +0 -1019
  280. package/dist/clis/args/magic-string.es-BWtG0AyA.mjs.map +0 -1
  281. package/dist/clis/args/migrate-DkCQRL2D.d.mts +0 -19
  282. package/dist/clis/args/migrate-DkCQRL2D.d.mts.map +0 -1
  283. package/dist/clis/args/migrate-DwJGhc2d.mjs +0 -29
  284. package/dist/clis/args/migrate-DwJGhc2d.mjs.map +0 -1
  285. package/dist/clis/args/publish-CeW4bOrl.d.mts +0 -16
  286. package/dist/clis/args/publish-CeW4bOrl.d.mts.map +0 -1
  287. package/dist/clis/args/publish-DHqlGWmL.mjs +0 -19
  288. package/dist/clis/args/publish-DHqlGWmL.mjs.map +0 -1
  289. package/dist/clis/args/registry-DIwES3l2.mjs +0 -23
  290. package/dist/clis/args/registry-DIwES3l2.mjs.map +0 -1
  291. package/dist/clis/args/registry-DNH8xuaE.d.mts +0 -17
  292. package/dist/clis/args/registry-DNH8xuaE.d.mts.map +0 -1
  293. package/dist/clis/args/service-BBx5GDTc.d.mts.map +0 -1
  294. package/dist/clis/args/service-Cpjlyeu5.mjs +0 -11
  295. package/dist/clis/args/service-Cpjlyeu5.mjs.map +0 -1
  296. package/dist/clis/args/switchboard-CCaAtU56.mjs +0 -85
  297. package/dist/clis/args/switchboard-CCaAtU56.mjs.map +0 -1
  298. package/dist/clis/args/switchboard-RrNb1fUH.d.mts +0 -70
  299. package/dist/clis/args/switchboard-RrNb1fUH.d.mts.map +0 -1
  300. package/dist/clis/args/uninstall-3U0B8g5c.mjs +0 -16
  301. package/dist/clis/args/uninstall-3U0B8g5c.mjs.map +0 -1
  302. package/dist/clis/args/uninstall-CDx7lwxn.d.mts.map +0 -1
  303. package/dist/clis/args/unpublish-CEDsk6uv.d.mts.map +0 -1
  304. package/dist/clis/args/unpublish-s9zUh6Gw.mjs +0 -30
  305. package/dist/clis/args/unpublish-s9zUh6Gw.mjs.map +0 -1
  306. package/dist/clis/args/vetra-BUNlAAPp.mjs.map +0 -1
  307. package/dist/clis/args/vetra-DkDaWFPi.d.mts +0 -111
  308. package/dist/clis/args/vetra-DkDaWFPi.d.mts.map +0 -1
  309. package/dist/clis/args/vetra-ports.test.d.mts +0 -2
  310. package/dist/clis/args/vetra-ports.test.mjs +0 -13354
  311. package/dist/clis/args/vetra-ports.test.mjs.map +0 -1
  312. package/dist/clis/build-config-CmdMi_wu.mjs.map +0 -1
  313. package/dist/clis/types-nzer4WIr.d.mts +0 -541
  314. package/dist/clis/types-nzer4WIr.d.mts.map +0 -1
  315. package/dist/config-loader-C6dZB_iX.js.map +0 -1
  316. package/dist/constants-DO4IYxuR.d.ts +0 -9
  317. package/dist/constants-DO4IYxuR.d.ts.map +0 -1
  318. package/dist/document-model/index.js.map +0 -1
  319. package/dist/index-D6833Siv.d.ts +0 -939
  320. package/dist/index-D6833Siv.d.ts.map +0 -1
  321. package/dist/types-CI3ren9F.d.ts.map +0 -1
  322. package/dist/types-CmeoQg_J.d.ts +0 -3337
  323. package/dist/types-CmeoQg_J.d.ts.map +0 -1
  324. package/dist/utils-BrKxCmKx.d.ts +0 -18
  325. package/dist/utils-BrKxCmKx.d.ts.map +0 -1
  326. package/dist/utils-CSF716ux.js.map +0 -1
@@ -1,3 +1,4 @@
1
+ import { readFileSync } from "node:fs";
1
2
  import { esmExternalRequirePlugin } from "rolldown/plugins";
2
3
  import "semver";
3
4
  const SHARED_DEP_SPECIFIERS = [
@@ -28,6 +29,14 @@ const SHARED_DEP_SPECIFIERS = [
28
29
  {
29
30
  specifier: "zod",
30
31
  package: "zod"
32
+ },
33
+ {
34
+ specifier: "@powerhousedao/connect-core",
35
+ package: "@powerhousedao/connect-core"
36
+ },
37
+ {
38
+ specifier: "@tanstack/react-router",
39
+ package: "@tanstack/react-router"
31
40
  }
32
41
  ].map((d) => d.specifier);
33
42
  /**
@@ -93,12 +102,16 @@ const entry = [
93
102
  "editors/index.ts",
94
103
  "editors/*/index.ts",
95
104
  "editors/*/module.ts",
105
+ "processors/index.ts",
106
+ "scalars/index.ts"
107
+ ];
108
+ const nodeEntry = [
109
+ ...entry.filter((path) => !/^editors\/\*\//.test(path)),
110
+ "processors/*/index.ts",
96
111
  "subgraphs/index.ts",
97
112
  "subgraphs/*/index.ts",
98
- "processors/index.ts",
99
- "processors/*/index.ts"
113
+ "pieces/index.ts"
100
114
  ];
101
- const nodeEntry = [...entry, "pieces/index.ts"];
102
115
  const PIECE_ENTRY_GLOB = "pieces/*/index.ts";
103
116
  const browserEntry = [...entry, "reactor/index.ts"];
104
117
  const alwaysBundle = ["**"];
@@ -110,7 +123,9 @@ const reactExternals = [
110
123
  ];
111
124
  const nodeNeverBundle = [
112
125
  "@powerhousedao/connect",
126
+ "@powerhousedao/connect-core",
113
127
  "@powerhousedao/ph-cli",
128
+ "@powerhousedao/ph-run",
114
129
  "@powerhousedao/reactor-api",
115
130
  "react",
116
131
  "react-dom",
@@ -135,15 +150,43 @@ const copy = [{
135
150
  from: "powerhouse.manifest.json",
136
151
  to: "dist"
137
152
  }];
153
+ const IMAGE_EXTENSIONS = [
154
+ ".apng",
155
+ ".avif",
156
+ ".bmp",
157
+ ".gif",
158
+ ".ico",
159
+ ".jpeg",
160
+ ".jpg",
161
+ ".png",
162
+ ".svg",
163
+ ".webp"
164
+ ];
165
+ const loader = Object.fromEntries(IMAGE_EXTENSIONS.map((ext) => [ext, "dataurl"]));
138
166
  const config = false;
139
167
  const clean = true;
140
168
  const dts = false;
141
169
  const sourcemap = true;
142
170
  const sharedNeverBundle = EXTERNALIZABLE_SHARED_SPECIFIERS.map((s) => new RegExp(`^${s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(/.*)?$`));
171
+ const SWITCHBOARD_PROCESSORS_STUB = "\0powerhouse:switchboard-processors";
172
+ function switchboardProcessorsStub() {
173
+ return {
174
+ name: "powerhouse:switchboard-processors-stub",
175
+ resolveId(source, importer) {
176
+ if (!importer || !/^\.\/switchboard(\.[cm]?[jt]s)?$/.test(source)) return null;
177
+ const path = importer.replaceAll("\\", "/");
178
+ return /(^|\/)processors\/factory\.[cm]?[jt]s$/.test(path) && !path.includes("/node_modules/") ? SWITCHBOARD_PROCESSORS_STUB : null;
179
+ },
180
+ load(id) {
181
+ return id === SWITCHBOARD_PROCESSORS_STUB ? "export const processorFactoryBuilders = [];" : null;
182
+ }
183
+ };
184
+ }
143
185
  const baseBrowserConfig = {
144
186
  entry: browserEntry,
145
187
  platform: "browser",
146
188
  copy,
189
+ loader,
147
190
  config,
148
191
  clean,
149
192
  dts,
@@ -151,15 +194,18 @@ const baseBrowserConfig = {
151
194
  plugins: [esmExternalRequirePlugin({
152
195
  external: reactExternals,
153
196
  skipDuplicateCheck: true
154
- })],
197
+ }), switchboardProcessorsStub()],
155
198
  inputOptions: { experimental: { resolveNewUrlToAsset: true } }
156
199
  };
200
+ const pluginList = (plugins) => plugins === void 0 ? [] : Array.isArray(plugins) ? plugins : [plugins];
201
+ const stylesheets = [/\.css$/];
157
202
  function buildBrowserBuildConfig(options = {}) {
158
203
  const sharedDeps = options.sharedDeps ?? true;
159
204
  return {
160
205
  ...baseBrowserConfig,
206
+ plugins: [...baseBrowserConfig.plugins, ...pluginList(options.plugins)],
161
207
  deps: {
162
- alwaysBundle,
208
+ alwaysBundle: options.bundleDependencies ?? true ? alwaysBundle : stylesheets,
163
209
  neverBundle: [...browserNeverBundle, ...sharedDeps ? sharedNeverBundle : []]
164
210
  }
165
211
  };
@@ -174,6 +220,35 @@ function findBundledSharedDeps(importedSpecs, outputs) {
174
220
  return importedSpecs.filter((spec) => !outputs.some((f) => findSharedImports(f.content, [spec]).includes(spec)));
175
221
  }
176
222
  /**
223
+ * Whether an editors/index.ts is only what the generator writes: each editor's
224
+ * module re-exported, and the `editors` list. Anything else it exports, such as
225
+ * a helper the package's index.ts passes on, a host may use.
226
+ */
227
+ function onlyReexportsEditors(source) {
228
+ const statements = source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/[^\n]*/g, "").split(";").map((statement) => statement.trim()).filter((statement) => statement.length > 0);
229
+ return statements.length > 0 && statements.every((statement) => /^export\s*\{\s*[\w$]+\s*\}\s*from\s*["']\.\/[\w.-]+\/module(\.js)?["']$/.test(statement) || /^export\s*\{\s*editors\s*\}\s*from\s*["']\.\/editors(\.js)?["']$/.test(statement));
230
+ }
231
+ /** A generated module a host has no use for, and what it builds to instead. */
232
+ function hostStubOf(file, projectRoot = process.cwd(), editorExports = false, readSource = (path) => readFileSync(path, "utf8")) {
233
+ const forward = (text) => text.replaceAll("\\", "/").toLowerCase();
234
+ const path = forward(file).split("?")[0];
235
+ if (path === `${forward(projectRoot)}/ai/tools.ts`) return "export const aiTools = [];";
236
+ if (path.endsWith("/editors/editors.ts")) return "export const editors = [];";
237
+ if (!editorExports && path.endsWith("/editors/index.ts") && onlyReexportsEditors(readSource(file.split("?")[0]))) return "export const editors = [];";
238
+ if (/\/document-models\/[^/]+\/v\d+\/hooks\.ts$/.test(path)) return "export {};";
239
+ }
240
+ /**
241
+ * Editors and document hooks run in a browser, and a host never renders. Left
242
+ * in, every document model takes `reactor-browser` and React to the server,
243
+ * and the editors take the design system.
244
+ */
245
+ function noBrowserCodeOnHosts(editorExports) {
246
+ return {
247
+ name: "ph:no-browser-code-on-hosts",
248
+ load: (file) => hostStubOf(file, process.cwd(), editorExports)
249
+ };
250
+ }
251
+ /**
177
252
  * The node build externalizes the same shared set as the browser build, for
178
253
  * the same reason the `@powerhousedao/reactor-api` entry in `nodeNeverBundle`
179
254
  * already gives: the host provides these, and a package carrying its own copy
@@ -192,6 +267,8 @@ function buildNodeBuildConfig(options = {}) {
192
267
  neverBundle: [...nodeNeverBundle, ...sharedDeps ? sharedNeverBundle : []]
193
268
  },
194
269
  platform: "node",
270
+ plugins: [noBrowserCodeOnHosts(options.editorExports ?? false), options.plugins],
271
+ loader,
195
272
  config,
196
273
  clean,
197
274
  dts,
@@ -212,19 +289,21 @@ function buildPieceBuildConfig(options) {
212
289
  entry: { index: options.entry },
213
290
  outDir: options.outDir,
214
291
  platform: "node",
292
+ ...options.plugins ? { plugins: options.plugins } : {},
215
293
  deps: {
216
294
  alwaysBundle,
217
295
  neverBundle: [],
218
296
  onlyBundle: false
219
297
  },
220
298
  outputOptions: { codeSplitting: false },
299
+ minify: true,
221
300
  config,
222
301
  clean,
223
302
  dts,
224
- sourcemap
303
+ sourcemap: false
225
304
  };
226
305
  }
227
306
  //#endregion
228
- export { buildNodeBuildConfig as a, nodeBuildConfig as c, buildBrowserBuildConfig as i, browserBuildConfig as n, buildPieceBuildConfig as o, browserEntry as r, findBundledSharedDeps as s, PIECE_ENTRY_GLOB as t };
307
+ export { buildBrowserBuildConfig as a, findBundledSharedDeps as c, onlyReexportsEditors as d, browserEntry as i, hostStubOf as l, PIECE_ENTRY_GLOB as n, buildNodeBuildConfig as o, browserBuildConfig as r, buildPieceBuildConfig as s, IMAGE_EXTENSIONS as t, nodeBuildConfig as u };
229
308
 
230
- //# sourceMappingURL=build-config-CmdMi_wu.mjs.map
309
+ //# sourceMappingURL=build-config-BM1RL4u_.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-config-BM1RL4u_.mjs","names":[],"sources":["../../connect/shared-deps.ts","../../clis/build-config.mts"],"sourcesContent":["import { satisfies, validRange } from \"semver\";\n\nexport type SharedDep = { specifier: string; package: string };\n\n/**\n * The dependency set Connect and loaded packages share via the import map.\n * `@powerhousedao/connect` is deliberately absent: it is the Connect app, not\n * vendored (a host with routes compiles its files), so its exports are for a\n * host's own routes and layout. Packages share `@powerhousedao/connect-core`.\n */\nexport const SHARED_DEPS: readonly SharedDep[] = [\n { specifier: \"document-model\", package: \"document-model\" },\n {\n specifier: \"@powerhousedao/document-engineering\",\n package: \"@powerhousedao/document-engineering\",\n },\n { specifier: \"@powerhousedao/shared\", package: \"@powerhousedao/shared\" },\n {\n specifier: \"@powerhousedao/shared/registry/urls\",\n package: \"@powerhousedao/shared\",\n },\n {\n specifier: \"@powerhousedao/design-system/connect\",\n package: \"@powerhousedao/design-system\",\n },\n {\n specifier: \"@powerhousedao/reactor-browser\",\n package: \"@powerhousedao/reactor-browser\",\n },\n // Connect already vendors zod (it is in DEFAULT_VENDOR_INCLUDE, so the\n // import map publishes an entry for it) and every generated project already\n // declares it as a peerDependency -- yet it was missing from this set, so\n // each package inlined a private copy anyway. It is the single biggest\n // dependency left in a minimal package.\n { specifier: \"zod\", package: \"zod\" },\n // One core and one router: slots, routes and router context reach every package.\n {\n specifier: \"@powerhousedao/connect-core\",\n package: \"@powerhousedao/connect-core\",\n },\n { specifier: \"@tanstack/react-router\", package: \"@tanstack/react-router\" },\n];\n\nexport const SHARED_DEP_SPECIFIERS: readonly string[] = SHARED_DEPS.map(\n (d) => d.specifier,\n);\n\n/**\n * The `@powerhousedao/shared` subpaths the production vendor bundles. The\n * bare root is deliberately absent: its type barrel references node-only\n * modules (`clis/`), which the current vite/rolldown cannot bundle for the\n * browser — vendoring the root fails the build (a pre-existing latent\n * issue). A package that imports the bare root is simply not shared; it\n * bundles its own copy.\n */\nexport const SHARED_SUBPATHS: readonly string[] = [\n \"connect\",\n \"document-model\",\n \"processors\",\n \"document-drive\",\n \"registry\",\n \"registry/urls\",\n \"registry/manifest-slim\",\n];\n\n/**\n * The specifiers a package build may safely externalize onto the host's\n * import map — i.e. the ones the vendor actually publishes an entry for.\n *\n * `@powerhousedao/shared` is narrowed to SHARED_SUBPATHS rather than taken as\n * a prefix: the bare root is never vendored (see SHARED_SUBPATHS), and\n * neither are its other subpaths (`analytics`, `constants`, `clis`, ...).\n * Externalizing those would leave a bare specifier in the package's output\n * that nothing in the import map resolves, so the package would fail to load\n * at runtime instead of simply bundling its own copy.\n */\nexport const EXTERNALIZABLE_SHARED_SPECIFIERS: readonly string[] = [\n ...new Set([\n ...SHARED_DEP_SPECIFIERS.filter((s) => s !== \"@powerhousedao/shared\"),\n ...SHARED_SUBPATHS.map((s) => `@powerhousedao/shared/${s}`),\n ]),\n];\n\n/** Split a specifier into its package name and subpath (\"\" for a root). */\nexport function parseDepSpec(spec: string): { pkg: string; sub: string } {\n if (spec.startsWith(\"@\")) {\n const parts = spec.split(\"/\");\n return { pkg: parts.slice(0, 2).join(\"/\"), sub: parts.slice(2).join(\"/\") };\n }\n const i = spec.indexOf(\"/\");\n return i === -1\n ? { pkg: spec, sub: \"\" }\n : { pkg: spec.slice(0, i), sub: spec.slice(i + 1) };\n}\n\nfunction isSharedSpecifier(spec: string, specs: readonly string[]): boolean {\n return specs.some((s) => spec === s || spec.startsWith(s + \"/\"));\n}\n\n/**\n * Return the import/export specifiers in `source` that are a shared\n * specifier (or a subpath of one), sorted. Heuristic: only statement\n * positions are scanned (`from \"x\"`, `import \"x\"`, `import(\"x\")`;\n * `export … from \"x\"` is covered by the `from` pattern), so import-like\n * text inside comments or strings can be reported too. That errs toward\n * over-reporting, which is the safe direction for the advisory build\n * warning.\n */\nexport function findSharedImports(\n source: string,\n specs: readonly string[] = SHARED_DEP_SPECIFIERS,\n): string[] {\n const found = new Set<string>();\n const patterns = [\n /\\bfrom\\s+[\"']([^\"'\\\\]+)[\"']/g,\n /\\bimport\\s+[\"']([^\"'\\\\]+)[\"']/g,\n /\\bimport\\s*\\(\\s*[\"']([^\"'\\\\]+)[\"']\\s*\\)/g,\n ];\n for (const re of patterns) {\n for (const m of source.matchAll(re)) {\n const spec = m[1];\n if (isSharedSpecifier(spec, specs)) found.add(spec);\n }\n }\n return [...found].sort();\n}\n\n/**\n * Rewrite a package source for blob import in a worker context (import maps\n * don't apply there): shared specifiers become their mapped URLs, and\n * relative (`./`, `../`) specifiers become absolute against `sourceUrl`\n * (a blob URL has no directory to resolve against). `#` subpath imports are\n * deliberately left alone: they resolve via the package's own\n * `package.json` \"imports\" field, which the rewrite cannot reproduce.\n * Returns the input unchanged when nothing matched.\n */\nexport function rewritePackageSource(\n source: string,\n sourceUrl: string,\n imports: Record<string, string>,\n): string {\n if (!Object.keys(imports).length) return source;\n const base = new URL(sourceUrl);\n const map = (spec: string): string | null => {\n const mapped = imports[spec];\n if (mapped) return mapped;\n if (spec.startsWith(\"./\") || spec.startsWith(\"../\")) {\n return new URL(spec, base).href;\n }\n return null;\n };\n let out = source;\n // The quote character is captured and reused: a source that quotes its\n // specifiers with ' would otherwise never match the replacement and be\n // left un-rewritten — silently, since the specifier still maps.\n for (const re of [\n /\\bfrom\\s+([\"'])([^\"'\\\\]+)\\1/g,\n /\\bimport\\s+([\"'])([^\"'\\\\]+)\\1/g,\n /\\bimport\\s*\\(\\s*([\"'])([^\"'\\\\]+)\\1\\s*\\)/g,\n ]) {\n out = out.replace(re, (match, quote: string, spec: string) => {\n // The match contains the quoted specifier exactly once and the\n // captured group has no quotes/backslashes ([^\"'\\\\]), so a literal\n // replace is safe.\n const mapped = map(spec);\n return mapped\n ? match.replace(`${quote}${spec}${quote}`, `${quote}${mapped}${quote}`)\n : match;\n });\n }\n return out;\n}\n\nexport type SharedDepMismatch = {\n package: string;\n required: string;\n provided: string;\n};\n\nexport type PackageDeps = {\n dependencies?: Record<string, unknown>;\n peerDependencies?: Record<string, unknown>;\n};\n\n/**\n * Compare a package's declared ranges against the host's version table.\n * `hostVersions` defines the checked set (only deps present in it are\n * checked). `*`, non-semver protocols (workspace:, file:, git:, npm:, URLs)\n * and unparseable ranges never mismatch.\n */\nexport function checkSharedDeps(\n pkgJson: PackageDeps,\n hostVersions: Record<string, string>,\n): SharedDepMismatch[] {\n const out: SharedDepMismatch[] = [];\n const entries = [\n ...Object.entries(pkgJson.dependencies ?? {}),\n ...Object.entries(pkgJson.peerDependencies ?? {}),\n ];\n for (const [dep, range] of entries) {\n const provided = hostVersions[dep];\n if (provided === undefined || typeof range !== \"string\") continue;\n if (range === \"*\" || /^[a-z]+:/i.test(range)) continue;\n if (!validRange(range)) continue;\n if (!satisfies(provided, range, { includePrerelease: true })) {\n out.push({ package: dep, required: range, provided });\n }\n }\n return out;\n}\n\nexport function formatSharedDepWarnings(\n mismatches: SharedDepMismatch[],\n): string[] {\n return mismatches.map(\n (m) =>\n `${m.package}: requires ${m.required}, Connect provides ${m.provided}`,\n );\n}\n\n/**\n * Stable filename for a local package's worker model bundle under\n * `__reactor_worker__/packages/`. Shared by the tab (URL computation via the\n * manifest) and the production prebuild (emitted entry names), so the two can\n * never drift. Scoped names flatten (`@scope/name` -> `scope__name`).\n */\nexport function workerPackageFileName(packageName: string): string {\n return `${packageName.replace(/^@/, \"\").replace(/[^\\w.-]+/g, \"__\")}.js`;\n}\n","import { readFileSync } from \"node:fs\";\nimport { esmExternalRequirePlugin } from \"rolldown/plugins\";\nimport type { InlineConfig } from \"tsdown\";\nimport {\n EXTERNALIZABLE_SHARED_SPECIFIERS,\n findSharedImports,\n} from \"../connect/shared-deps.js\";\n\nconst entry = [\n \"index.ts\",\n \"document-models/index.ts\",\n \"document-models/*/index.ts\",\n \"document-models/*/module.ts\",\n \"editors/index.ts\",\n \"editors/*/index.ts\",\n \"editors/*/module.ts\",\n \"processors/index.ts\",\n \"scalars/index.ts\",\n];\n\n// ./pieces is node-only for the same reason ./reactor is browser-only: a piece\n// is loaded and run by a host process, never by the browser. Only the list of\n// pieces builds here; each piece is its own build (buildPieceBuildConfig), so\n// two pieces never share a chunk and each ships as one self-contained module.\nconst nodeEntry = [\n ...entry.filter((path) => !/^editors\\/\\*\\//.test(path)),\n // Node-only: Connect reaches processors through processors/index.ts, and\n // subgraphs only over GraphQL.\n \"processors/*/index.ts\",\n \"subgraphs/index.ts\",\n \"subgraphs/*/index.ts\",\n \"pieces/index.ts\",\n];\n\n// Where a package's pieces live, one directory per piece, as the node entry\n// glob spells it; `ph build` expands it against the project to find them.\nexport const PIECE_ENTRY_GLOB = \"pieces/*/index.ts\";\n\n// ./reactor is browser-only: the SharedWorker needs it, the node build does not.\nexport const browserEntry = [...entry, \"reactor/index.ts\"];\n\nconst alwaysBundle = [\"**\"];\n\n// React must be external so `import ... from \"react\"` stays a bare import and\n// resolves to the host's React at runtime; bundled, a chunk would carry a second\n// React. In the browser build the externals below belong to esmExternalRequirePlugin\n// alone: rolldown converts a CommonJS `require(\"react\")` into an import only for\n// externals the plugin owns, and listed in neverBundle too the top-level external\n// wins, leaving a browser bundle with a require it cannot serve. use-sync-external-store\n// under zustand, and so under @xyflow/react, is the case that found this.\nconst reactExternals = [\n \"react\",\n \"react-dom\",\n \"react/jsx-runtime\",\n \"react-dom/client\",\n];\n\nconst nodeNeverBundle = [\n // we know that we don't want connect inside connect\n \"@powerhousedao/connect\",\n \"@powerhousedao/connect-core\",\n // published code would never need the cli\n \"@powerhousedao/ph-cli\",\n \"@powerhousedao/ph-run\",\n // the reactor-api host must provide a single class identity for\n // BaseSubgraph/BaseProcessor — inlining a copy here breaks the\n // prototype-chain check the package loader uses to detect subgraphs.\n \"@powerhousedao/reactor-api\",\n // react is resolved from esm.sh\n \"react\",\n \"react-dom\",\n \"react/jsx-runtime\",\n \"react-dom/client\",\n // build tools\n \"tailwindcss\",\n \"vitest\",\n \"tsdown\",\n \"@tailwindcss/cli\",\n \"@vitejs/plugin-react\",\n // testing tools\n \"@testing-library/jest-dom\",\n \"@testing-library/react\",\n \"@testing-library/user-event\",\n // types\n \"@types/node\",\n \"@types/react\",\n \"@types/react-dom\",\n // exclude pglite wasm/data chunks\n \"@electric-sql/pglite\",\n \"@electric-sql/pglite-tools\",\n];\n\n// The node build keeps React in neverBundle: node has createRequire, so a\n// CommonJS require of an external resolves there without the plugin.\nconst browserNeverBundle = nodeNeverBundle.filter(\n (spec) => typeof spec !== \"string\" || !reactExternals.includes(spec),\n);\n\nconst copy = [{ from: \"powerhouse.manifest.json\", to: \"dist\" }];\n\n// Images a module imports (a route's hero, an editor's SVG) become data URLs,\n// as Vite's import of an asset is a URL string. Inline, not emitted: Connect\n// loads a package's chunks through its import map, so an emitted file's\n// relative URL would resolve against the page, not the chunk.\nexport const IMAGE_EXTENSIONS = [\n \".apng\",\n \".avif\",\n \".bmp\",\n \".gif\",\n \".ico\",\n \".jpeg\",\n \".jpg\",\n \".png\",\n \".svg\",\n \".webp\",\n] as const;\nconst loader: NonNullable<InlineConfig[\"loader\"]> = Object.fromEntries(\n IMAGE_EXTENSIONS.map((ext) => [ext, \"dataurl\"]),\n);\n\nconst config = false;\nconst clean = true;\n// types are emitted via a separate tsc command\nconst dts = false;\nconst sourcemap = true;\n\n// Shared deps are externalized from every package build: the host (Connect)\n// resolves them to one bundled copy via the import map, so a package must\n// not inline its own copy (two instances of the same dep break identity\n// checks and double the download). One regexp per specifier covers the root\n// and every subpath (rolldown `external` accepts strings and regexps, not\n// function matchers, in this toolchain).\n//\n// Only the specifiers the vendor publishes are externalized — see\n// EXTERNALIZABLE_SHARED_SPECIFIERS. Externalizing one the import map has no\n// entry for would leave an unresolvable bare specifier in the output.\nconst sharedNeverBundle = EXTERNALIZABLE_SHARED_SPECIFIERS.map(\n (s) => new RegExp(`^${s.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")}(/.*)?$`),\n);\n\ntype Plugin = NonNullable<InlineConfig[\"plugins\"]>;\n\nconst SWITCHBOARD_PROCESSORS_STUB = \"\\0powerhouse:switchboard-processors\";\n\n// Connect runs processors with processorApp \"connect\", so the generated\n// factory's import of ./switchboard gets an empty list in the browser build.\nfunction switchboardProcessorsStub(): Plugin {\n return {\n name: \"powerhouse:switchboard-processors-stub\",\n resolveId(source, importer) {\n if (!importer || !/^\\.\\/switchboard(\\.[cm]?[jt]s)?$/.test(source)) {\n return null;\n }\n const path = importer.replaceAll(\"\\\\\", \"/\");\n const isFactory =\n /(^|\\/)processors\\/factory\\.[cm]?[jt]s$/.test(path) &&\n !path.includes(\"/node_modules/\");\n return isFactory ? SWITCHBOARD_PROCESSORS_STUB : null;\n },\n load(id) {\n return id === SWITCHBOARD_PROCESSORS_STUB\n ? \"export const processorFactoryBuilders = [];\"\n : null;\n },\n };\n}\n\nconst baseBrowserConfig = {\n entry: browserEntry,\n platform: \"browser\" as const,\n copy,\n loader,\n config,\n clean,\n dts,\n sourcemap,\n plugins: [\n esmExternalRequirePlugin({\n external: reactExternals,\n skipDuplicateCheck: true,\n }),\n switchboardProcessorsStub(),\n ],\n inputOptions: {\n experimental: { resolveNewUrlToAsset: true },\n },\n};\n\nconst pluginList = (plugins: InlineConfig[\"plugins\"]) =>\n plugins === undefined ? [] : Array.isArray(plugins) ? plugins : [plugins];\n\nexport type BrowserBuildConfigOptions = {\n /** Externalize the shared dependency set (default: true). */\n sharedDeps?: boolean;\n /** Extra bundler plugins, such as the external dependency guard. */\n plugins?: InlineConfig[\"plugins\"];\n /** Inline every dependency (default: true), as a package Connect loads from\n * the CDN needs. False leaves declared dependencies to the app that bundles it. */\n bundleDependencies?: boolean;\n};\n\n// A dependency's stylesheet stays bundled, so `style.css` keeps the vendor CSS.\nconst stylesheets = [/\\.css$/];\n\nexport function buildBrowserBuildConfig(\n options: BrowserBuildConfigOptions = {},\n): InlineConfig {\n const sharedDeps = options.sharedDeps ?? true;\n return {\n ...baseBrowserConfig,\n plugins: [...baseBrowserConfig.plugins, ...pluginList(options.plugins)],\n deps: {\n alwaysBundle:\n (options.bundleDependencies ?? true) ? alwaysBundle : stylesheets,\n neverBundle: [\n ...browserNeverBundle,\n ...(sharedDeps ? sharedNeverBundle : []),\n ],\n },\n };\n}\n\n// Kept for existing callers: the default (shared deps externalized).\nexport const browserBuildConfig = buildBrowserBuildConfig();\n\n/**\n * Shared specs a source imports but the built output no longer references as\n * bare imports — the bundler inlined them, which is exactly what the\n * external set is meant to prevent.\n */\nexport function findBundledSharedDeps(\n importedSpecs: string[],\n outputs: readonly { path: string; content: string }[],\n): string[] {\n return importedSpecs.filter(\n (spec) =>\n !outputs.some((f) => findSharedImports(f.content, [spec]).includes(spec)),\n );\n}\n\nexport type NodeBuildConfigOptions = {\n /** Externalize the shared dependency set (default: true). */\n sharedDeps?: boolean;\n /** Extra bundler plugins, such as the external dependency detector. */\n plugins?: InlineConfig[\"plugins\"];\n /**\n * Build a generated `editors/index.ts` as written, for a package whose\n * editors are rendered in Node: Connect prerenders its shell from\n * powerhouse-vetra-packages' editors. The `editors` list a host loads stays\n * empty.\n */\n editorExports?: boolean;\n};\n\n/**\n * Whether an editors/index.ts is only what the generator writes: each editor's\n * module re-exported, and the `editors` list. Anything else it exports, such as\n * a helper the package's index.ts passes on, a host may use.\n */\nexport function onlyReexportsEditors(source: string): boolean {\n const statements = source\n .replace(/\\/\\*[\\s\\S]*?\\*\\//g, \"\")\n .replace(/\\/\\/[^\\n]*/g, \"\")\n .split(\";\")\n .map((statement) => statement.trim())\n .filter((statement) => statement.length > 0);\n return (\n statements.length > 0 &&\n statements.every(\n (statement) =>\n /^export\\s*\\{\\s*[\\w$]+\\s*\\}\\s*from\\s*[\"']\\.\\/[\\w.-]+\\/module(\\.js)?[\"']$/.test(\n statement,\n ) ||\n /^export\\s*\\{\\s*editors\\s*\\}\\s*from\\s*[\"']\\.\\/editors(\\.js)?[\"']$/.test(\n statement,\n ),\n )\n );\n}\n\n/** A generated module a host has no use for, and what it builds to instead. */\nexport function hostStubOf(\n file: string,\n projectRoot = process.cwd(),\n editorExports = false,\n readSource: (file: string) => string = (path) => readFileSync(path, \"utf8\"),\n): string | undefined {\n const forward = (text: string) => text.replaceAll(\"\\\\\", \"/\").toLowerCase();\n const path = forward(file).split(\"?\")[0];\n // The assistant's tools run in the page it's open on.\n if (path === `${forward(projectRoot)}/ai/tools.ts`) {\n return \"export const aiTools = [];\";\n }\n // A package's index.ts takes `editors` from either, as its generator wrote it.\n if (path.endsWith(\"/editors/editors.ts\")) {\n return \"export const editors = [];\";\n }\n if (\n !editorExports &&\n path.endsWith(\"/editors/index.ts\") &&\n onlyReexportsEditors(readSource(file.split(\"?\")[0]))\n ) {\n return \"export const editors = [];\";\n }\n if (/\\/document-models\\/[^/]+\\/v\\d+\\/hooks\\.ts$/.test(path)) {\n return \"export {};\";\n }\n return undefined;\n}\n\n/**\n * Editors and document hooks run in a browser, and a host never renders. Left\n * in, every document model takes `reactor-browser` and React to the server,\n * and the editors take the design system.\n */\nfunction noBrowserCodeOnHosts(editorExports: boolean) {\n return {\n name: \"ph:no-browser-code-on-hosts\",\n load: (file: string) => hostStubOf(file, process.cwd(), editorExports),\n };\n}\n\n/**\n * The node build externalizes the same shared set as the browser build, for\n * the same reason the `@powerhousedao/reactor-api` entry in `nodeNeverBundle`\n * already gives: the host provides these, and a package carrying its own copy\n * is a second class identity as well as dead weight. What differs is only how\n * the import is resolved at runtime -- Connect's import map in the browser,\n * ordinary node resolution here, which works because these are declared for\n * the consumer to provide (`document-model`, `@powerhousedao/reactor-browser`\n * and `zod` are peerDependencies of every generated project).\n */\nexport function buildNodeBuildConfig(\n options: NodeBuildConfigOptions = {},\n): InlineConfig {\n const sharedDeps = options.sharedDeps ?? true;\n return {\n entry: nodeEntry,\n deps: {\n alwaysBundle,\n neverBundle: [\n ...nodeNeverBundle,\n ...(sharedDeps ? sharedNeverBundle : []),\n ],\n },\n platform: \"node\",\n plugins: [\n noBrowserCodeOnHosts(options.editorExports ?? false),\n options.plugins,\n ],\n loader,\n config,\n clean,\n dts,\n sourcemap,\n };\n}\n\n// Kept for existing callers: the default (shared deps externalized).\nexport const nodeBuildConfig: InlineConfig = buildNodeBuildConfig();\n\nexport type PieceBuildConfigOptions = {\n /** The piece's source entry, relative to the project: `pieces/<dir>/index.ts`. */\n entry: string;\n /** Where the piece lands: `<outDir>/node/pieces/<dir>`. */\n outDir: string;\n /** Extra bundler plugins, such as the external dependency detector. */\n plugins?: InlineConfig[\"plugins\"];\n};\n\n/**\n * One piece, bundled whole. A piece runs in a forked worker with no\n * node_modules beside it, so nothing the piece imports can be left to the\n * host: the framework, its dependencies and the shared set that every other\n * module kind externalizes are all inlined here, and only node built-ins stay\n * external. Code splitting is off for the same reason, so a dynamic import is\n * inlined too and the piece directory holds exactly one module.\n */\nexport function buildPieceBuildConfig(\n options: PieceBuildConfigOptions,\n): InlineConfig {\n return {\n entry: { index: options.entry },\n outDir: options.outDir,\n platform: \"node\",\n ...(options.plugins ? { plugins: options.plugins } : {}),\n deps: {\n alwaysBundle,\n neverBundle: [],\n // Inlining dependencies is the point here, so tsdown's hint about it\n // would only be noise on every piece.\n onlyBundle: false,\n },\n outputOptions: { codeSplitting: false },\n // The worker runs without source maps, so a map would only be shipped twice\n minify: true,\n config,\n clean,\n dts,\n sourcemap: false,\n };\n}\n"],"mappings":"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"}
@@ -1,10 +1,16 @@
1
- import { t as InlineConfig } from "./index-6CZwrmQi.mjs";
1
+ import { t as InlineConfig } from "./index-DnZYG-8g.mjs";
2
2
  //#region clis/build-config.d.mts
3
3
  export declare const PIECE_ENTRY_GLOB = "pieces/*/index.ts";
4
4
  export declare const browserEntry: string[];
5
+ export declare const IMAGE_EXTENSIONS: readonly [".apng", ".avif", ".bmp", ".gif", ".ico", ".jpeg", ".jpg", ".png", ".svg", ".webp"];
5
6
  export type BrowserBuildConfigOptions = {
6
7
  /** Externalize the shared dependency set (default: true). */
7
8
  sharedDeps?: boolean;
9
+ /** Extra bundler plugins, such as the external dependency guard. */
10
+ plugins?: InlineConfig["plugins"];
11
+ /** Inline every dependency (default: true), as a package Connect loads from
12
+ * the CDN needs. False leaves declared dependencies to the app that bundles it. */
13
+ bundleDependencies?: boolean;
8
14
  };
9
15
  export declare function buildBrowserBuildConfig(options?: BrowserBuildConfigOptions): InlineConfig;
10
16
  export declare const browserBuildConfig: InlineConfig;
@@ -20,7 +26,24 @@ export declare function findBundledSharedDeps(importedSpecs: string[], outputs:
20
26
  export type NodeBuildConfigOptions = {
21
27
  /** Externalize the shared dependency set (default: true). */
22
28
  sharedDeps?: boolean;
29
+ /** Extra bundler plugins, such as the external dependency detector. */
30
+ plugins?: InlineConfig["plugins"];
31
+ /**
32
+ * Build a generated `editors/index.ts` as written, for a package whose
33
+ * editors are rendered in Node: Connect prerenders its shell from
34
+ * powerhouse-vetra-packages' editors. The `editors` list a host loads stays
35
+ * empty.
36
+ */
37
+ editorExports?: boolean;
23
38
  };
39
+ /**
40
+ * Whether an editors/index.ts is only what the generator writes: each editor's
41
+ * module re-exported, and the `editors` list. Anything else it exports, such as
42
+ * a helper the package's index.ts passes on, a host may use.
43
+ */
44
+ export declare function onlyReexportsEditors(source: string): boolean;
45
+ /** A generated module a host has no use for, and what it builds to instead. */
46
+ export declare function hostStubOf(file: string, projectRoot?: string, editorExports?: boolean, readSource?: (file: string) => string): string | undefined;
24
47
  /**
25
48
  * The node build externalizes the same shared set as the browser build, for
26
49
  * the same reason the `@powerhousedao/reactor-api` entry in `nodeNeverBundle`
@@ -38,6 +61,8 @@ export type PieceBuildConfigOptions = {
38
61
  entry: string;
39
62
  /** Where the piece lands: `<outDir>/node/pieces/<dir>`. */
40
63
  outDir: string;
64
+ /** Extra bundler plugins, such as the external dependency detector. */
65
+ plugins?: InlineConfig["plugins"];
41
66
  };
42
67
  /**
43
68
  * One piece, bundled whole. A piece runs in a forked worker with no
@@ -1 +1 @@
1
- {"version":3,"file":"build-config.d.mts","names":[],"sources":["../../clis/build-config.mts"],"mappings":";;qBA6Ba;qBAGA;YAkGD;;EAEV;;wBAGc,wBACd,UAAS,4BACR;qBAeU,oBAAkB;;;;;;wBAOf,sBACd,yBACA;EAAoB;EAAc;;YAQxB;;EAEV;;;;;;;;;;;;wBAac,qBACd,UAAS,yBACR;qBAoBU,iBAAiB;YAElB;;EAEV;;EAEA;;;;;;;;;;wBAWc,sBACd,SAAS,0BACR"}
1
+ {"version":3,"file":"build-config.d.mts","names":[],"sources":["../../clis/build-config.mts"],"mappings":";;qBAoCa;qBAGA;qBAiEA;YAuFD;;EAEV;;EAEA,UAAU;;;EAGV;;wBAMc,wBACd,UAAS,4BACR;qBAiBU,oBAAkB;;;;;;wBAOf,sBACd,yBACA;EAAoB;EAAc;;YAQxB;;EAEV;;EAEA,UAAU;;;;;;;EAOV;;;;;;;wBAQc,qBAAqB;;wBAsBrB,WACd,cACA,sBACA,yBACA,cAAa;;;;;;;;;;;wBA+CC,qBACd,UAAS,yBACR;qBAyBU,iBAAiB;YAElB;;EAEV;;EAEA;;EAEA,UAAU;;;;;;;;;;wBAWI,sBACd,SAAS,0BACR"}
@@ -1,2 +1,2 @@
1
- import { a as buildNodeBuildConfig, c as nodeBuildConfig, i as buildBrowserBuildConfig, n as browserBuildConfig, o as buildPieceBuildConfig, r as browserEntry, s as findBundledSharedDeps, t as PIECE_ENTRY_GLOB } from "./build-config-CmdMi_wu.mjs";
2
- export { PIECE_ENTRY_GLOB, browserBuildConfig, browserEntry, buildBrowserBuildConfig, buildNodeBuildConfig, buildPieceBuildConfig, findBundledSharedDeps, nodeBuildConfig };
1
+ import { a as buildBrowserBuildConfig, c as findBundledSharedDeps, d as onlyReexportsEditors, i as browserEntry, l as hostStubOf, n as PIECE_ENTRY_GLOB, o as buildNodeBuildConfig, r as browserBuildConfig, s as buildPieceBuildConfig, t as IMAGE_EXTENSIONS, u as nodeBuildConfig } from "./build-config-BM1RL4u_.mjs";
2
+ export { IMAGE_EXTENSIONS, PIECE_ENTRY_GLOB, browserBuildConfig, browserEntry, buildBrowserBuildConfig, buildNodeBuildConfig, buildPieceBuildConfig, findBundledSharedDeps, hostStubOf, nodeBuildConfig, onlyReexportsEditors };
@@ -1,5 +1,60 @@
1
- import { t as InlineConfig } from "./index-6CZwrmQi.mjs";
2
- import { t as Manifest } from "./types-nzer4WIr.mjs";
1
+ import { t as Manifest } from "./types-CZU17kAm.mjs";
2
+ import { t as InlineConfig } from "./index-DnZYG-8g.mjs";
3
+ //#region clis/external-deps.d.mts
4
+ /** The files one module needs at run time, and why each was included. */
5
+ type FileTrace = {
6
+ /** Absolute paths. */
7
+ fileList: Set<string>;
8
+ /** Absolute path -> the absolute paths of the files that pulled it in. */
9
+ reasons: Map<string, {
10
+ parents: Set<string>;
11
+ }>;
12
+ };
13
+ /** Traces one file: @vercel/nft's nodeFileTrace, handed in by the CLI. */
14
+ type TraceFiles = (file: string) => Promise<FileTrace>;
15
+ /** A file the bundle cannot carry: a native addon or a WebAssembly module. */
16
+ type RequiredFile = {
17
+ file: string;
18
+ kind: "native" | "wasm";
19
+ };
20
+ type ExternalDependency = RequiredFile & {
21
+ name: string;
22
+ version: string;
23
+ /** The first of the package's own files seen importing it. */
24
+ importer?: string;
25
+ };
26
+ /** What one `ph build` learns about packages, shared by all of its builds. */
27
+ type DetectionCache = {
28
+ files: Map<string, Promise<RequiredFile | undefined>>;
29
+ wasm: Map<string, string | undefined>;
30
+ };
31
+ export declare const createDetectionCache: () => DetectionCache;
32
+ type ExternalDepsPluginOptions = {
33
+ /** The project root the dirs below are relative to. */
34
+ root?: string;
35
+ /** Browser build: a native package fails it; WebAssembly is bundled. */
36
+ browser?: boolean;
37
+ /** Dirs whose imports the bundler handles as usual: code no host runs. */
38
+ ignoreDirs?: string[];
39
+ /** Dirs that may not import a native or WebAssembly package. */
40
+ forbidDirs?: string[];
41
+ cache?: DetectionCache;
42
+ };
43
+ type Plugin = NonNullable<InlineConfig["plugins"]>;
44
+ /** `file` relative to `root`, with forward slashes on every platform. */
45
+ export declare function projectPath(root: string, file: string): string;
46
+ /** The first file `entry` cannot load without that a bundle cannot carry. */
47
+ export declare function findRequiredFile(entry: string, trace: TraceFiles, cache?: DetectionCache): Promise<RequiredFile | undefined>;
48
+ /** Keeps each package the code imports that needs such a file out of the bundle. */
49
+ export declare function externalDepsPlugin(trace: TraceFiles, found: Map<string, ExternalDependency>, options?: ExternalDepsPluginOptions): Plugin;
50
+ /**
51
+ * The detected packages `pkg` does not install for its consumers: anything
52
+ * outside dependencies, optionalDependencies and peerDependencies.
53
+ */
54
+ export declare function undeclaredExternalDependencies(found: Iterable<ExternalDependency>, pkg: Partial<Record<"dependencies" | "optionalDependencies" | "peerDependencies", Partial<Record<string, string>>>>): ExternalDependency[];
55
+ /** name -> version, sorted by name. */
56
+ export declare function externalDependencyVersions(found: Iterable<ExternalDependency>): Record<string, string>;
57
+ //#endregion
3
58
  //#region clis/build-pieces.d.mts
4
59
  export type PiecePlan = {
5
60
  /** The directory under pieces/, and so under <outDir>/node/pieces. */
@@ -12,6 +67,13 @@ export type PiecePlan = {
12
67
  export type PieceBuildTarget = {
13
68
  projectRoot: string;
14
69
  outDir: string;
70
+ /**
71
+ * @experimental Absolute: the directory that stands in for
72
+ * `<projectRoot>/<outDir>` on disk during this build. Every path the build
73
+ * names stays under `outDir`. Experimental while staged builds are
74
+ * introduced.
75
+ */
76
+ writeTo?: string;
15
77
  pieces: PiecePlan[];
16
78
  };
17
79
  export type PackagePiece = {
@@ -55,13 +117,16 @@ export type PackageIdentity = {
55
117
  export type PieceBuildOptions = {
56
118
  /** The bundler: tsdown's `build`, handed in so this module never loads it. */
57
119
  bundle: (config: InlineConfig) => Promise<unknown>;
120
+ /** Traces a module's run-time files; without it nothing is kept external. */
121
+ trace?: TraceFiles;
122
+ cache?: DetectionCache;
58
123
  };
59
124
  export declare function statSafe(p: string): import("node:fs").Stats | null;
60
125
  export declare function expandEntryGlobs(root: string, globs: string[]): string[];
61
126
  export declare function planPieces(projectRoot: string, outDir: string): PiecePlan[];
62
127
  export declare function createJsonReplacer(): (this: unknown, _key: string, value: unknown) => {} | null | undefined;
63
128
  export declare const DESCRIBE_HELPERS = "\nconst isRecord = (value) => typeof value === \"object\" && value !== null;\n\nfunction findPiece(mod) {\n const candidates = [\n ...Object.values(mod),\n ...(isRecord(mod.default) ? Object.values(mod.default) : []),\n mod.default,\n ];\n for (const candidate of candidates) {\n if (isRecord(candidate) && candidate.constructor?.name === \"Piece\") {\n return candidate;\n }\n }\n for (const candidate of candidates) {\n if (\n isRecord(candidate) &&\n typeof candidate.displayName === \"string\" &&\n (isRecord(candidate.actions) ||\n typeof candidate.actions === \"function\" ||\n typeof candidate.getAction === \"function\")\n ) {\n return candidate;\n }\n }\n return undefined;\n}\n\nfunction describePiece(piece) {\n if (typeof piece.metadata === \"function\") return piece.metadata();\n const call = (value) => (typeof value === \"function\" ? value.call(piece) : value);\n return {\n displayName: piece.displayName,\n logoUrl: piece.logoUrl,\n description: piece.description,\n authors: piece.authors,\n categories: piece.categories,\n auth: piece.auth,\n minimumSupportedRelease: piece.minimumSupportedRelease,\n maximumSupportedRelease: piece.maximumSupportedRelease,\n deprecated: piece.deprecated,\n actions: call(piece.actions) ?? {},\n triggers: call(piece.triggers) ?? {},\n };\n}\n\nfunction createJsonReplacer() {\n const ancestors = [];\n return function replace(_key, value) {\n if (typeof value === \"function\" || value === undefined) return undefined;\n if (typeof value === \"bigint\") return value.toString();\n if (typeof value !== \"object\" || value === null) return value;\n while (ancestors.length > 0 && ancestors.at(-1) !== this) ancestors.pop();\n if (ancestors.includes(value)) return undefined;\n ancestors.push(value);\n return value;\n };\n}\n";
64
- export declare const DESCRIBE_SCRIPT = "\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { isAbsolute, join } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nconst job = JSON.parse(readFileSync(process.argv[2], \"utf8\"));\n\nconst isRecord = (value) => typeof value === \"object\" && value !== null;\n\nfunction findPiece(mod) {\n const candidates = [\n ...Object.values(mod),\n ...(isRecord(mod.default) ? Object.values(mod.default) : []),\n mod.default,\n ];\n for (const candidate of candidates) {\n if (isRecord(candidate) && candidate.constructor?.name === \"Piece\") {\n return candidate;\n }\n }\n for (const candidate of candidates) {\n if (\n isRecord(candidate) &&\n typeof candidate.displayName === \"string\" &&\n (isRecord(candidate.actions) ||\n typeof candidate.actions === \"function\" ||\n typeof candidate.getAction === \"function\")\n ) {\n return candidate;\n }\n }\n return undefined;\n}\n\nfunction describePiece(piece) {\n if (typeof piece.metadata === \"function\") return piece.metadata();\n const call = (value) => (typeof value === \"function\" ? value.call(piece) : value);\n return {\n displayName: piece.displayName,\n logoUrl: piece.logoUrl,\n description: piece.description,\n authors: piece.authors,\n categories: piece.categories,\n auth: piece.auth,\n minimumSupportedRelease: piece.minimumSupportedRelease,\n maximumSupportedRelease: piece.maximumSupportedRelease,\n deprecated: piece.deprecated,\n actions: call(piece.actions) ?? {},\n triggers: call(piece.triggers) ?? {},\n };\n}\n\nfunction createJsonReplacer() {\n const ancestors = [];\n return function replace(_key, value) {\n if (typeof value === \"function\" || value === undefined) return undefined;\n if (typeof value === \"bigint\") return value.toString();\n if (typeof value !== \"object\" || value === null) return value;\n while (ancestors.length > 0 && ancestors.at(-1) !== this) ancestors.pop();\n if (ancestors.includes(value)) return undefined;\n ancestors.push(value);\n return value;\n };\n}\n\n// Says why the child gave up in the one place the parent always reads, so a\n// failure reports the cause and never the text of this script.\nfunction fail(message) {\n writeFileSync(job.outFile, JSON.stringify({ fatal: message }));\n process.exit(1);\n}\n\n// The module to load for a list entry; a bundle names its own main.\nfunction entryFile(piece) {\n const declared = piece.entry ?? piece.bundle;\n if (typeof declared !== \"string\") return undefined;\n const path = isAbsolute(declared) ? declared : join(job.projectRoot, declared);\n if (piece.entry) return path;\n const pkgFile = join(path, \"package.json\");\n if (!existsSync(pkgFile)) return undefined;\n const pkg = JSON.parse(readFileSync(pkgFile, \"utf8\"));\n return join(path, typeof pkg.main === \"string\" ? pkg.main : \"index.mjs\");\n}\n\nlet listModule;\ntry {\n listModule = await import(pathToFileURL(job.listPath).href);\n} catch (error) {\n fail(job.listPath + \" threw on import: \" + (error instanceof Error ? error.message : String(error)));\n}\nconst list = listModule.pieces ?? listModule.default;\nif (!Array.isArray(list)) {\n fail(job.listPath + ' exports no \"pieces\" array');\n}\n\nconst out = { list, pieces: [], errors: [] };\nfor (const piece of list) {\n const file = entryFile(piece);\n // A missing file is the parent's to report, with the message it owns.\n if (!file || !existsSync(file)) continue;\n try {\n const mod = await import(pathToFileURL(file).href);\n const found = findPiece(mod);\n if (!found) {\n throw new Error(\n \"no Piece export found in \" + file + \"; exports: \" + Object.keys(mod).join(\", \"),\n );\n }\n const metadata = JSON.parse(JSON.stringify(describePiece(found), createJsonReplacer()));\n out.pieces.push({ name: piece.name, metadata });\n } catch (error) {\n out.errors.push({\n name: piece.name,\n message: error instanceof Error ? error.message : String(error),\n });\n }\n}\nwriteFileSync(job.outFile, JSON.stringify(out, createJsonReplacer()));\n";
129
+ export declare const DESCRIBE_SCRIPT = "\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { isAbsolute, join, relative, sep } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nconst job = JSON.parse(readFileSync(process.argv[2], \"utf8\"));\n\nconst isRecord = (value) => typeof value === \"object\" && value !== null;\n\nfunction findPiece(mod) {\n const candidates = [\n ...Object.values(mod),\n ...(isRecord(mod.default) ? Object.values(mod.default) : []),\n mod.default,\n ];\n for (const candidate of candidates) {\n if (isRecord(candidate) && candidate.constructor?.name === \"Piece\") {\n return candidate;\n }\n }\n for (const candidate of candidates) {\n if (\n isRecord(candidate) &&\n typeof candidate.displayName === \"string\" &&\n (isRecord(candidate.actions) ||\n typeof candidate.actions === \"function\" ||\n typeof candidate.getAction === \"function\")\n ) {\n return candidate;\n }\n }\n return undefined;\n}\n\nfunction describePiece(piece) {\n if (typeof piece.metadata === \"function\") return piece.metadata();\n const call = (value) => (typeof value === \"function\" ? value.call(piece) : value);\n return {\n displayName: piece.displayName,\n logoUrl: piece.logoUrl,\n description: piece.description,\n authors: piece.authors,\n categories: piece.categories,\n auth: piece.auth,\n minimumSupportedRelease: piece.minimumSupportedRelease,\n maximumSupportedRelease: piece.maximumSupportedRelease,\n deprecated: piece.deprecated,\n actions: call(piece.actions) ?? {},\n triggers: call(piece.triggers) ?? {},\n };\n}\n\nfunction createJsonReplacer() {\n const ancestors = [];\n return function replace(_key, value) {\n if (typeof value === \"function\" || value === undefined) return undefined;\n if (typeof value === \"bigint\") return value.toString();\n if (typeof value !== \"object\" || value === null) return value;\n while (ancestors.length > 0 && ancestors.at(-1) !== this) ancestors.pop();\n if (ancestors.includes(value)) return undefined;\n ancestors.push(value);\n return value;\n };\n}\n\n// The parent's onDisk, for the paths a list names under the output directory.\nfunction onDisk(path) {\n if (!job.redirect) return path;\n const inside = relative(job.redirect.from, path);\n const leaves = inside === \"..\" || inside.startsWith(\"..\" + sep) || isAbsolute(inside);\n return leaves ? path : join(job.redirect.to, inside);\n}\n\n// Says why the child gave up in the one place the parent always reads, so a\n// failure reports the cause and never the text of this script.\nfunction fail(message) {\n writeFileSync(job.outFile, JSON.stringify({ fatal: message }));\n process.exit(1);\n}\n\n// The module to load for a list entry; a bundle names its own main.\nfunction entryFile(piece) {\n const declared = piece.entry ?? piece.bundle;\n if (typeof declared !== \"string\") return undefined;\n const path = isAbsolute(declared) ? declared : join(job.projectRoot, declared);\n if (piece.entry) return path;\n const pkgFile = join(onDisk(path), \"package.json\");\n if (!existsSync(pkgFile)) return undefined;\n const pkg = JSON.parse(readFileSync(pkgFile, \"utf8\"));\n return join(path, typeof pkg.main === \"string\" ? pkg.main : \"index.mjs\");\n}\n\nlet listModule;\ntry {\n listModule = await import(pathToFileURL(onDisk(job.listPath)).href);\n} catch (error) {\n fail(job.listPath + \" threw on import: \" + (error instanceof Error ? error.message : String(error)));\n}\nconst list = listModule.pieces ?? listModule.default;\nif (!Array.isArray(list)) {\n fail(job.listPath + ' exports no \"pieces\" array');\n}\n\nconst out = { list, pieces: [], errors: [] };\nfor (const piece of list) {\n const file = entryFile(piece);\n // A missing file is the parent's to report, with the message it owns.\n if (!file || !existsSync(onDisk(file))) continue;\n try {\n const mod = await import(pathToFileURL(onDisk(file)).href);\n const found = findPiece(mod);\n if (!found) {\n throw new Error(\n \"no Piece export found in \" + file + \"; exports: \" + Object.keys(mod).join(\", \"),\n );\n }\n const metadata = JSON.parse(JSON.stringify(describePiece(found), createJsonReplacer()));\n out.pieces.push({ name: piece.name, metadata });\n } catch (error) {\n out.errors.push({\n name: piece.name,\n message: error instanceof Error ? error.message : String(error),\n });\n }\n}\nwriteFileSync(job.outFile, JSON.stringify(out, createJsonReplacer()));\n";
65
130
  export declare function describePieces(projectRoot: string, listPath: string): DescribeResult;
66
131
  export type PieceLocation = {
67
132
  /** The piece directory, absolute. */
@@ -86,6 +151,7 @@ export declare function piecePackageJson(options: {
86
151
  description?: string;
87
152
  main: string;
88
153
  license?: string;
154
+ dependencies?: Record<string, string>;
89
155
  }): Record<string, unknown>;
90
156
  export declare function bundlePackageJson(dir: string, version: string): Record<string, unknown>;
91
157
  export declare function pieceDescriptor(piece: PackagePiece, version: string, metadata: PieceMetadata): Record<string, unknown>;
@@ -94,7 +160,8 @@ export declare function enrichManifestPieces(manifest: Manifest, built: BuiltPie
94
160
  unbuilt: string[];
95
161
  };
96
162
  export declare function buildPieces(target: PieceBuildTarget, pkg: PackageIdentity, options: PieceBuildOptions): Promise<BuiltPiece[]>;
97
- export declare function syncDistManifest(target: PieceBuildTarget, built: BuiltPiece[]): string | undefined;
163
+ export declare function syncDistManifest(target: PieceBuildTarget, built: BuiltPiece[], externalDependencies?: Record<string, string>): string | undefined;
98
164
  //#endregion
165
+ export type { DetectionCache, ExternalDependency, ExternalDepsPluginOptions, FileTrace, TraceFiles };
99
166
  export {};
100
167
  //# sourceMappingURL=build-pieces.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-pieces.d.mts","names":[],"sources":["../../clis/build-pieces.mts"],"mappings":";;;YA4BY;;EAEV;;EAEA;;EAEA;;YAKU;EACV;EACA;EACA,QAAQ;;YAKE;EACV;EACA;EACA;;YAKU,gBAAgB;EAC1B;EACA;EACA,UAAU;EACV,WAAW;;YAGD;EACV;EACA,UAAU;;YAGA;EACV,MAAM;EACN,QAAQ;EACR;IAAU;IAAc;;;YAGd;EACV;EACA;EACA;EACA;;EAEA;;EAEA;;YAGU;EACV;EACA;EACA;;YAGU;;EAEV,SAAS,QAAQ,iBAAiB;;wBAKpB,SAAS,8BAAS;wBAUlB,iBAAiB,cAAc;wBA4B/B,WAAW,qBAAqB,iBAAiB;wBAejD,uBAAkB,eAEK,cAAc;qBAiBxC;qBAiEA;wBAsFG,eACd,qBACA,mBACC;YA0BS;;EAEV;;EAEA;EACA;;wBAKc,qBACd,OAAO,cACP,qBACA,iBACC;wBAmCa,cAAc;EAC5B;EACA;;wBAac,mBAAmB;EACjC;EACA,QAAQ;;wBAWM,mBACd,OAAO,cACP,KAAK;wBAWS,iBAAiB;EAC/B;EACA;EACA;EACA;EACA;IACE;wBAeY,kBACd,aACA,kBACC;wBASa,gBACd,OAAO,cACP,iBACA,UAAU,gBACT;wBAUa,qBACd,UAAU,UACV,OAAO;EACJ,UAAU;EAAU;;wBAkCH,YACpB,QAAQ,kBACR,KAAK,iBACL,SAAS,oBACR,QAAQ;wBA0GK,iBACd,QAAQ,kBACR,OAAO"}
1
+ {"version":3,"file":"build-pieces.d.mts","names":[],"sources":["../../clis/external-deps.mts","../../clis/build-pieces.mts"],"mappings":";;;;KAQY;;EAEV,UAAU;;EAEV,SAAS;IAAc,SAAS;;;;KAItB,cAAc,iBAAiB,QAAQ;;KAGvC;EAAiB;EAAc;;KAE/B,qBAAqB;EAC/B;EACA;;EAEA;;;KAIU;EACV,OAAO,YAAY,QAAQ;EAC3B,MAAM;;qBAGK,4BAA2B;KAK5B;;EAEV;;EAEA;;EAEA;;EAEA;EACA,QAAQ;;KAGL,SAAS,YAAY;;wBAaV,YAAY,cAAc;;wBAwEpB,iBACpB,eACA,OAAO,YACP,QAAQ,iBACP,QAAQ;;wBAmDK,mBACd,OAAO,YACP,OAAO,YAAY,qBACnB,UAAS,4BACR;;;;;wBA8Da,+BACd,OAAO,SAAS,qBAChB,KAAK,QACH,qEAEE,QAAQ,4BAGX;;wBAUa,2BACd,OAAO,SAAS,sBACf;;;YChOS;;EAEV;;EAEA;;EAEA;;YAKU;EACV;EACA;;;;;;;EAOA;EACA,QAAQ;;YAKE;EACV;EACA;EACA;;YAKU,gBAAgB;EAC1B;EACA;EACA,UAAU;EACV,WAAW;;YAGD;EACV;EACA,UAAU;;YAGA;EACV,MAAM;EACN,QAAQ;EACR;IAAU;IAAc;;;YAGd;EACV;EACA;EACA;EACA;;EAEA;;EAEA;;YAGU;EACV;EACA;EACA;;YAGU;;EAEV,SAAS,QAAQ,iBAAiB;;EAElC,QAAQ;EACR,QAAQ;;wBAiCM,SAAS,8BAAS;wBAkBlB,iBAAiB,cAAc;wBA4B/B,WAAW,qBAAqB,iBAAiB;wBAejD,uBAAkB,eAEK,cAAc;qBAiBxC;qBAiEA;wBA8FG,eACd,qBACA,mBACC;YAqCS;;EAEV;;EAEA;EACA;;wBAKc,qBACd,OAAO,cACP,qBACA,iBACC;wBAgDa,cAAc;EAC5B;EACA;;wBAac,mBAAmB;EACjC;EACA,QAAQ;;wBAWM,mBACd,OAAO,cACP,KAAK;wBAWS,iBAAiB;EAC/B;EACA;EACA;EACA;EACA;EACA,eAAe;IACb;wBAeY,kBACd,aACA,kBACC;wBASa,gBACd,OAAO,cACP,iBACA,UAAU,gBACT;wBAUa,qBACd,UAAU,UACV,OAAO;EACJ,UAAU;EAAU;;wBAkCH,YACpB,QAAQ,kBACR,KAAK,iBACL,SAAS,oBACR,QAAQ;wBAwIK,iBACd,QAAQ,kBACR,OAAO,cACP,uBAAsB"}