@powerhousedao/shared 6.2.3-dev.23 → 6.2.3-dev.25

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 (264) hide show
  1. package/dist/analytics/index.d.ts +4 -4
  2. package/dist/analytics/index.d.ts.map +1 -1
  3. package/dist/analytics/index.js +25 -24
  4. package/dist/analytics/index.js.map +1 -1
  5. package/dist/clis/args/{access-token-Bf1K1Fpc.mjs → access-token-3Hqv_U8I.mjs} +2 -2
  6. package/dist/clis/args/{access-token-Bf1K1Fpc.mjs.map → access-token-3Hqv_U8I.mjs.map} +1 -1
  7. package/dist/clis/args/access-token-C5sKsH2O.d.mts +16 -0
  8. package/dist/clis/args/access-token-C5sKsH2O.d.mts.map +1 -0
  9. package/dist/clis/args/access-token.d.mts +3 -2
  10. package/dist/clis/args/access-token.mjs +1 -1
  11. package/dist/clis/args/{common-BpnFLR-_.mjs → common-BXabdhiO.mjs} +10 -2
  12. package/dist/clis/args/{common-BpnFLR-_.mjs.map → common-BXabdhiO.mjs.map} +1 -1
  13. package/dist/clis/args/common-Bnm859xU.d.mts +186 -0
  14. package/dist/clis/args/common-Bnm859xU.d.mts.map +1 -0
  15. package/dist/clis/args/common.d.mts +3 -2
  16. package/dist/clis/args/common.mjs +1 -1
  17. package/dist/clis/args/{connect-ByiLv365.mjs → connect-B6xK4YI_.mjs} +2 -2
  18. package/dist/clis/args/{connect-ByiLv365.mjs.map → connect-B6xK4YI_.mjs.map} +1 -1
  19. package/dist/clis/args/connect-DjeiqXus.d.mts +450 -0
  20. package/dist/clis/args/connect-DjeiqXus.d.mts.map +1 -0
  21. package/dist/clis/args/connect.d.mts +3 -2
  22. package/dist/clis/args/connect.mjs +1 -1
  23. package/dist/clis/args/{generate-C51i00At.mjs → generate-10dooJ-D.mjs} +2 -2
  24. package/dist/clis/args/{generate-C51i00At.mjs.map → generate-10dooJ-D.mjs.map} +1 -1
  25. package/dist/clis/args/generate-DmgiCzuf.d.mts +106 -0
  26. package/dist/clis/args/generate-DmgiCzuf.d.mts.map +1 -0
  27. package/dist/clis/args/generate.d.mts +3 -2
  28. package/dist/clis/args/generate.mjs +1 -1
  29. package/dist/clis/args/help-DVPTARGn.d.mts +190 -0
  30. package/dist/clis/args/help-DVPTARGn.d.mts.map +1 -0
  31. package/dist/clis/args/{help-D2SeQC09.mjs → help-yRmplJjW.mjs} +15 -15
  32. package/dist/clis/args/{help-D2SeQC09.mjs.map → help-yRmplJjW.mjs.map} +1 -1
  33. package/dist/clis/args/help.d.mts +3 -2
  34. package/dist/clis/args/help.mjs +1 -1
  35. package/dist/clis/args/index.d.mts +20 -19
  36. package/dist/clis/args/index.mjs +18 -18
  37. package/dist/clis/args/init-CFeTq4Cq.d.mts +52 -0
  38. package/dist/clis/args/init-CFeTq4Cq.d.mts.map +1 -0
  39. package/dist/clis/args/{init-DBYYsV0Y.mjs → init-Dvb42Y87.mjs} +2 -2
  40. package/dist/clis/args/{init-DBYYsV0Y.mjs.map → init-Dvb42Y87.mjs.map} +1 -1
  41. package/dist/clis/args/init.d.mts +3 -2
  42. package/dist/clis/args/init.mjs +1 -1
  43. package/dist/clis/args/inspect-BjRmtB86.d.mts +13 -0
  44. package/dist/clis/args/inspect-BjRmtB86.d.mts.map +1 -0
  45. package/dist/clis/args/{inspect-BzBsZ0UO.mjs → inspect-UNQgtuR0.mjs} +2 -2
  46. package/dist/clis/args/{inspect-BzBsZ0UO.mjs.map → inspect-UNQgtuR0.mjs.map} +1 -1
  47. package/dist/clis/args/inspect.d.mts +3 -2
  48. package/dist/clis/args/inspect.mjs +1 -1
  49. package/dist/clis/args/install-B0tMyUMw.d.mts +37 -0
  50. package/dist/clis/args/install-B0tMyUMw.d.mts.map +1 -0
  51. package/dist/clis/args/{install-D0jaysiP.mjs → install-F-27kF6m.mjs} +2 -2
  52. package/dist/clis/args/{install-D0jaysiP.mjs.map → install-F-27kF6m.mjs.map} +1 -1
  53. package/dist/clis/args/install.d.mts +3 -2
  54. package/dist/clis/args/install.mjs +1 -1
  55. package/dist/clis/args/{list-BaO47Btz.mjs → list-Bkfn8Yuo.mjs} +2 -2
  56. package/dist/clis/args/{list-BaO47Btz.mjs.map → list-Bkfn8Yuo.mjs.map} +1 -1
  57. package/dist/clis/args/list-DrbxA7JJ.d.mts +10 -0
  58. package/dist/clis/args/list-DrbxA7JJ.d.mts.map +1 -0
  59. package/dist/clis/args/list.d.mts +3 -2
  60. package/dist/clis/args/list.mjs +1 -1
  61. package/dist/clis/args/{login-DM-qhiYI.mjs → login-CIFkQExi.mjs} +2 -2
  62. package/dist/clis/args/{login-DM-qhiYI.mjs.map → login-CIFkQExi.mjs.map} +1 -1
  63. package/dist/clis/args/login-CXRJXg71.d.mts +25 -0
  64. package/dist/clis/args/login-CXRJXg71.d.mts.map +1 -0
  65. package/dist/clis/args/login.d.mts +3 -2
  66. package/dist/clis/args/login.mjs +1 -1
  67. package/dist/clis/args/{magic-string.es-h_0HDQBQ.mjs → magic-string.es-CB2hOw9v.mjs} +14 -13
  68. package/dist/clis/args/{magic-string.es-h_0HDQBQ.mjs.map → magic-string.es-CB2hOw9v.mjs.map} +1 -1
  69. package/dist/clis/args/migrate-DkCQRL2D.d.mts +19 -0
  70. package/dist/clis/args/migrate-DkCQRL2D.d.mts.map +1 -0
  71. package/dist/clis/args/{migrate-EitaI7jq.mjs → migrate-DwJGhc2d.mjs} +2 -2
  72. package/dist/clis/args/{migrate-EitaI7jq.mjs.map → migrate-DwJGhc2d.mjs.map} +1 -1
  73. package/dist/clis/args/migrate.d.mts +3 -2
  74. package/dist/clis/args/migrate.mjs +1 -1
  75. package/dist/clis/args/publish-CeW4bOrl.d.mts +16 -0
  76. package/dist/clis/args/publish-CeW4bOrl.d.mts.map +1 -0
  77. package/dist/clis/args/{publish-DfMF3Nmc.mjs → publish-DHqlGWmL.mjs} +2 -2
  78. package/dist/clis/args/{publish-DfMF3Nmc.mjs.map → publish-DHqlGWmL.mjs.map} +1 -1
  79. package/dist/clis/args/publish.d.mts +3 -2
  80. package/dist/clis/args/publish.mjs +1 -1
  81. package/dist/clis/args/{registry-Di1tZqbn.mjs → registry-DIwES3l2.mjs} +2 -2
  82. package/dist/clis/args/{registry-Di1tZqbn.mjs.map → registry-DIwES3l2.mjs.map} +1 -1
  83. package/dist/clis/args/registry-DNH8xuaE.d.mts +17 -0
  84. package/dist/clis/args/registry-DNH8xuaE.d.mts.map +1 -0
  85. package/dist/clis/args/registry.d.mts +3 -2
  86. package/dist/clis/args/registry.mjs +1 -1
  87. package/dist/clis/args/service-BBx5GDTc.d.mts +27 -0
  88. package/dist/clis/args/service-BBx5GDTc.d.mts.map +1 -0
  89. package/dist/clis/args/{service-jRX2qPul.mjs → service-Cpjlyeu5.mjs} +2 -2
  90. package/dist/clis/args/{service-jRX2qPul.mjs.map → service-Cpjlyeu5.mjs.map} +1 -1
  91. package/dist/clis/args/service.d.mts +3 -2
  92. package/dist/clis/args/service.mjs +1 -1
  93. package/dist/clis/args/{switchboard-BhR-ZwGV.mjs → switchboard-CCaAtU56.mjs} +2 -2
  94. package/dist/clis/args/{switchboard-BhR-ZwGV.mjs.map → switchboard-CCaAtU56.mjs.map} +1 -1
  95. package/dist/clis/args/switchboard-RrNb1fUH.d.mts +70 -0
  96. package/dist/clis/args/switchboard-RrNb1fUH.d.mts.map +1 -0
  97. package/dist/clis/args/switchboard.d.mts +3 -2
  98. package/dist/clis/args/switchboard.mjs +1 -1
  99. package/dist/clis/args/{uninstall-diefi70g.mjs → uninstall-3U0B8g5c.mjs} +2 -2
  100. package/dist/clis/args/{uninstall-diefi70g.mjs.map → uninstall-3U0B8g5c.mjs.map} +1 -1
  101. package/dist/clis/args/uninstall-CDx7lwxn.d.mts +28 -0
  102. package/dist/clis/args/uninstall-CDx7lwxn.d.mts.map +1 -0
  103. package/dist/clis/args/uninstall.d.mts +3 -2
  104. package/dist/clis/args/uninstall.mjs +1 -1
  105. package/dist/clis/args/unpublish-CEDsk6uv.d.mts +22 -0
  106. package/dist/clis/args/unpublish-CEDsk6uv.d.mts.map +1 -0
  107. package/dist/clis/args/{unpublish-C6eNRzsU.mjs → unpublish-s9zUh6Gw.mjs} +2 -2
  108. package/dist/clis/args/{unpublish-C6eNRzsU.mjs.map → unpublish-s9zUh6Gw.mjs.map} +1 -1
  109. package/dist/clis/args/unpublish.d.mts +3 -2
  110. package/dist/clis/args/unpublish.mjs +1 -1
  111. package/dist/clis/args/{vetra-DV0zQzba.mjs → vetra-BUNlAAPp.mjs} +2 -2
  112. package/dist/clis/args/{vetra-DV0zQzba.mjs.map → vetra-BUNlAAPp.mjs.map} +1 -1
  113. package/dist/clis/args/vetra-DkDaWFPi.d.mts +111 -0
  114. package/dist/clis/args/vetra-DkDaWFPi.d.mts.map +1 -0
  115. package/dist/clis/args/vetra-ports.test.d.mts +2 -1
  116. package/dist/clis/args/vetra-ports.test.mjs +281 -176
  117. package/dist/clis/args/vetra-ports.test.mjs.map +1 -1
  118. package/dist/clis/args/vetra.d.mts +3 -2
  119. package/dist/clis/args/vetra.mjs +1 -1
  120. package/dist/clis/{build-config-BkfXtfV8.mjs → build-config-CmdMi_wu.mjs} +3 -3
  121. package/dist/clis/{build-config-BkfXtfV8.mjs.map → build-config-CmdMi_wu.mjs.map} +1 -1
  122. package/dist/clis/build-config.d.mts +20 -17
  123. package/dist/clis/build-config.d.mts.map +1 -1
  124. package/dist/clis/build-config.mjs +1 -1
  125. package/dist/clis/build-pieces.d.mts +43 -37
  126. package/dist/clis/build-pieces.d.mts.map +1 -1
  127. package/dist/clis/build-pieces.mjs +3 -2
  128. package/dist/clis/build-pieces.mjs.map +1 -1
  129. package/dist/clis/command-names.d.mts +2 -2
  130. package/dist/clis/command-names.d.mts.map +1 -1
  131. package/dist/clis/command-names.mjs.map +1 -1
  132. package/dist/clis/constants.d.mts +3 -2
  133. package/dist/clis/constants.mjs +3 -3
  134. package/dist/clis/constants.mjs.map +1 -1
  135. package/dist/clis/{index-CyAv0ucZ.d.mts → index-DpixpHXl.d.mts} +1800 -1265
  136. package/dist/clis/index-DpixpHXl.d.mts.map +1 -0
  137. package/dist/clis/index.d.mts +1295 -1254
  138. package/dist/clis/index.d.mts.map +1 -1
  139. package/dist/clis/index.mjs +92 -55
  140. package/dist/clis/index.mjs.map +1 -1
  141. package/dist/clis/project-env.d.mts +4 -4
  142. package/dist/clis/project-env.d.mts.map +1 -1
  143. package/dist/clis/project-env.mjs.map +1 -1
  144. package/dist/clis/project-ports.d.mts +5 -5
  145. package/dist/clis/project-ports.d.mts.map +1 -1
  146. package/dist/clis/project-ports.mjs +1 -1
  147. package/dist/clis/project-ports.mjs.map +1 -1
  148. package/dist/clis/services/telemetry.d.mts +7 -7
  149. package/dist/clis/services/telemetry.d.mts.map +1 -1
  150. package/dist/clis/services/telemetry.mjs.map +1 -1
  151. package/dist/clis/{types-DXhVHupa.d.mts → types-CMFHKrgv.d.mts} +67 -29
  152. package/dist/clis/types-CMFHKrgv.d.mts.map +1 -0
  153. package/dist/clis/utils.d.mts +4 -4
  154. package/dist/clis/utils.d.mts.map +1 -1
  155. package/dist/clis/utils.mjs.map +1 -1
  156. package/dist/{config-loader-e4-qdVVI.js → config-loader-SYDWHtqk.js} +12 -7
  157. package/dist/config-loader-SYDWHtqk.js.map +1 -0
  158. package/dist/connect/config-loader.d.ts +7 -8
  159. package/dist/connect/config-loader.d.ts.map +1 -1
  160. package/dist/connect/config-loader.js +1 -1
  161. package/dist/connect/index.d.ts +75 -68
  162. package/dist/connect/index.d.ts.map +1 -1
  163. package/dist/connect/index.js +88 -30
  164. package/dist/connect/index.js.map +1 -1
  165. package/dist/connect/json-adapter.d.ts +3 -4
  166. package/dist/connect/json-adapter.d.ts.map +1 -1
  167. package/dist/connect/json-adapter.js.map +1 -1
  168. package/dist/{constants-BP_gjn8g.d.ts → constants-DO4IYxuR.d.ts} +2 -1
  169. package/dist/constants-DO4IYxuR.d.ts.map +1 -0
  170. package/dist/constants.d.ts +3 -2
  171. package/dist/constants.js.map +1 -1
  172. package/dist/document-drive/index.d.ts +104 -101
  173. package/dist/document-drive/index.d.ts.map +1 -1
  174. package/dist/document-drive/index.js +15 -4
  175. package/dist/document-drive/index.js.map +1 -1
  176. package/dist/document-model/index.d.ts +5 -4
  177. package/dist/document-model/index.js +440 -226
  178. package/dist/document-model/index.js.map +1 -1
  179. package/dist/document-model/mock.d.ts +2 -3
  180. package/dist/document-model/mock.d.ts.map +1 -1
  181. package/dist/document-model/mock.js +2 -1
  182. package/dist/document-model/mock.js.map +1 -1
  183. package/dist/document-model/utils.d.ts +3 -2
  184. package/dist/document-model/utils.js +1 -1
  185. package/dist/{index-CAs0TFVQ.d.ts → index-CDDyUSHE.d.ts} +40 -28
  186. package/dist/index-CDDyUSHE.d.ts.map +1 -0
  187. package/dist/index-D0JljlgO.d.ts +36 -0
  188. package/dist/index-D0JljlgO.d.ts.map +1 -0
  189. package/dist/index.d.ts +7 -6
  190. package/dist/index.js.map +1 -1
  191. package/dist/processors/index.d.ts +3 -2
  192. package/dist/processors/index.js +5 -1
  193. package/dist/processors/index.js.map +1 -1
  194. package/dist/registry/index.d.ts +15 -15
  195. package/dist/registry/index.d.ts.map +1 -1
  196. package/dist/registry/index.js +2 -1
  197. package/dist/registry/index.js.map +1 -1
  198. package/dist/registry/manifest-slim.d.ts +4 -3
  199. package/dist/registry/manifest-slim.d.ts.map +1 -1
  200. package/dist/registry/manifest-slim.js.map +1 -1
  201. package/dist/registry/updates.d.ts +3 -3
  202. package/dist/registry/updates.d.ts.map +1 -1
  203. package/dist/registry/updates.js.map +1 -1
  204. package/dist/registry/urls.d.ts +2 -2
  205. package/dist/registry/urls.d.ts.map +1 -1
  206. package/dist/registry/urls.js.map +1 -1
  207. package/dist/{types-C1in4fl3.d.ts → types-Bsp8VL2y.d.ts} +2 -2
  208. package/dist/types-Bsp8VL2y.d.ts.map +1 -0
  209. package/dist/{types-ooGknils.d.ts → types-VDHUeQnm.d.ts} +17 -35
  210. package/dist/types-VDHUeQnm.d.ts.map +1 -0
  211. package/dist/{types-glwGlTGx.d.ts → types-xLPOHE23.d.ts} +532 -433
  212. package/dist/types-xLPOHE23.d.ts.map +1 -0
  213. package/dist/{utils-DP122OSS.d.ts → utils-BrKxCmKx.d.ts} +2 -2
  214. package/dist/utils-BrKxCmKx.d.ts.map +1 -0
  215. package/dist/{utils-aaTmfxFW.js → utils-XotexSsQ.js} +3 -2
  216. package/dist/{utils-aaTmfxFW.js.map → utils-XotexSsQ.js.map} +1 -1
  217. package/package.json +5 -4
  218. package/dist/clis/args/access-token--9H57y8J.d.mts +0 -18
  219. package/dist/clis/args/access-token--9H57y8J.d.mts.map +0 -1
  220. package/dist/clis/args/common-yKU4B741.d.mts +0 -186
  221. package/dist/clis/args/common-yKU4B741.d.mts.map +0 -1
  222. package/dist/clis/args/connect-BD-C5BkE.d.mts +0 -452
  223. package/dist/clis/args/connect-BD-C5BkE.d.mts.map +0 -1
  224. package/dist/clis/args/generate-rd5SAYho.d.mts +0 -108
  225. package/dist/clis/args/generate-rd5SAYho.d.mts.map +0 -1
  226. package/dist/clis/args/help-CjAsudUn.d.mts +0 -193
  227. package/dist/clis/args/help-CjAsudUn.d.mts.map +0 -1
  228. package/dist/clis/args/init-CUXyfquF.d.mts +0 -55
  229. package/dist/clis/args/init-CUXyfquF.d.mts.map +0 -1
  230. package/dist/clis/args/inspect-DtZeoA5c.d.mts +0 -15
  231. package/dist/clis/args/inspect-DtZeoA5c.d.mts.map +0 -1
  232. package/dist/clis/args/install-CkP8zcHb.d.mts +0 -40
  233. package/dist/clis/args/install-CkP8zcHb.d.mts.map +0 -1
  234. package/dist/clis/args/list-BGf8s_gj.d.mts +0 -12
  235. package/dist/clis/args/list-BGf8s_gj.d.mts.map +0 -1
  236. package/dist/clis/args/login-DNsHwvqk.d.mts +0 -27
  237. package/dist/clis/args/login-DNsHwvqk.d.mts.map +0 -1
  238. package/dist/clis/args/migrate-sixkWhxm.d.mts +0 -21
  239. package/dist/clis/args/migrate-sixkWhxm.d.mts.map +0 -1
  240. package/dist/clis/args/publish-Dqe5DUst.d.mts +0 -18
  241. package/dist/clis/args/publish-Dqe5DUst.d.mts.map +0 -1
  242. package/dist/clis/args/registry-C_RfTsKB.d.mts +0 -19
  243. package/dist/clis/args/registry-C_RfTsKB.d.mts.map +0 -1
  244. package/dist/clis/args/service-Cou6l7l8.d.mts +0 -22
  245. package/dist/clis/args/service-Cou6l7l8.d.mts.map +0 -1
  246. package/dist/clis/args/switchboard-BlPaq2at.d.mts +0 -72
  247. package/dist/clis/args/switchboard-BlPaq2at.d.mts.map +0 -1
  248. package/dist/clis/args/uninstall-BpA3YYbw.d.mts +0 -31
  249. package/dist/clis/args/uninstall-BpA3YYbw.d.mts.map +0 -1
  250. package/dist/clis/args/unpublish-CvwaIimG.d.mts +0 -24
  251. package/dist/clis/args/unpublish-CvwaIimG.d.mts.map +0 -1
  252. package/dist/clis/args/vetra-CoMvTJK7.d.mts +0 -113
  253. package/dist/clis/args/vetra-CoMvTJK7.d.mts.map +0 -1
  254. package/dist/clis/index-CyAv0ucZ.d.mts.map +0 -1
  255. package/dist/clis/types-DXhVHupa.d.mts.map +0 -1
  256. package/dist/config-loader-e4-qdVVI.js.map +0 -1
  257. package/dist/constants-BP_gjn8g.d.ts.map +0 -1
  258. package/dist/index-CAs0TFVQ.d.ts.map +0 -1
  259. package/dist/index-C_iVZe7f.d.ts +0 -7
  260. package/dist/index-C_iVZe7f.d.ts.map +0 -1
  261. package/dist/types-C1in4fl3.d.ts.map +0 -1
  262. package/dist/types-glwGlTGx.d.ts.map +0 -1
  263. package/dist/types-ooGknils.d.ts.map +0 -1
  264. package/dist/utils-DP122OSS.d.ts.map +0 -1
@@ -1,2 +1,3 @@
1
- import { n as resolveSwitchboardPortDefault, r as vetraArgs, t as resolveConnectPortDefault } from "./vetra-CoMvTJK7.mjs";
2
- export { resolveConnectPortDefault, resolveSwitchboardPortDefault, vetraArgs };
1
+ import { n as resolveSwitchboardPortDefault, r as vetraArgs, t as resolveConnectPortDefault } from "./vetra-DkDaWFPi.mjs";
2
+ export { resolveConnectPortDefault, resolveSwitchboardPortDefault, vetraArgs };
3
+ export {};
@@ -1,2 +1,2 @@
1
- import { n as resolveSwitchboardPortDefault, r as vetraArgs, t as resolveConnectPortDefault } from "./vetra-DV0zQzba.mjs";
1
+ import { n as resolveSwitchboardPortDefault, r as vetraArgs, t as resolveConnectPortDefault } from "./vetra-BUNlAAPp.mjs";
2
2
  export { resolveConnectPortDefault, resolveSwitchboardPortDefault, vetraArgs };
@@ -58,7 +58,7 @@ const SHARED_SUBPATHS = [
58
58
  * that nothing in the import map resolves, so the package would fail to load
59
59
  * at runtime instead of simply bundling its own copy.
60
60
  */
61
- const EXTERNALIZABLE_SHARED_SPECIFIERS = [...new Set([...SHARED_DEP_SPECIFIERS.filter((s) => s !== "@powerhousedao/shared"), ...SHARED_SUBPATHS.map((s) => `@powerhousedao/shared/${s}`)])];
61
+ const EXTERNALIZABLE_SHARED_SPECIFIERS = [.../* @__PURE__ */ new Set([...SHARED_DEP_SPECIFIERS.filter((s) => s !== "@powerhousedao/shared"), ...SHARED_SUBPATHS.map((s) => `@powerhousedao/shared/${s}`)])];
62
62
  function isSharedSpecifier(spec, specs) {
63
63
  return specs.some((s) => spec === s || spec.startsWith(s + "/"));
64
64
  }
@@ -215,7 +215,7 @@ function buildPieceBuildConfig(options) {
215
215
  deps: {
216
216
  alwaysBundle,
217
217
  neverBundle: [],
218
- onlyAllowBundle: false
218
+ onlyBundle: false
219
219
  },
220
220
  outputOptions: { codeSplitting: false },
221
221
  config,
@@ -227,4 +227,4 @@ function buildPieceBuildConfig(options) {
227
227
  //#endregion
228
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 };
229
229
 
230
- //# sourceMappingURL=build-config-BkfXtfV8.mjs.map
230
+ //# sourceMappingURL=build-config-CmdMi_wu.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-config-BkfXtfV8.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\n * itself (no importable exports), so there is nothing to share.\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];\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","import { 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 \"subgraphs/index.ts\",\n \"subgraphs/*/index.ts\",\n \"processors/index.ts\",\n \"processors/*/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 = [...entry, \"pieces/index.ts\"];\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 // published code would never need the cli\n \"@powerhousedao/ph-cli\",\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\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\nconst baseBrowserConfig = {\n entry: browserEntry,\n platform: \"browser\" as const,\n copy,\n config,\n clean,\n dts,\n sourcemap,\n plugins: [\n esmExternalRequirePlugin({\n external: reactExternals,\n skipDuplicateCheck: true,\n }),\n ],\n inputOptions: {\n experimental: { resolveNewUrlToAsset: true },\n },\n};\n\nexport type BrowserBuildConfigOptions = {\n /** Externalize the shared dependency set (default: true). */\n sharedDeps?: boolean;\n};\n\nexport function buildBrowserBuildConfig(\n options: BrowserBuildConfigOptions = {},\n): InlineConfig {\n const sharedDeps = options.sharedDeps ?? true;\n return {\n ...baseBrowserConfig,\n deps: {\n alwaysBundle,\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};\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 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};\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 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 onlyAllowBundle: false,\n },\n outputOptions: { codeSplitting: false },\n config,\n clean,\n dts,\n sourcemap,\n };\n}\n"],"mappings":";;AAoCA,MAAa,wBA3BoC;CAC/C;EAAE,WAAW;EAAkB,SAAS;EAAkB;CAC1D;EACE,WAAW;EACX,SAAS;EACV;CACD;EAAE,WAAW;EAAyB,SAAS;EAAyB;CACxE;EACE,WAAW;EACX,SAAS;EACV;CACD;EACE,WAAW;EACX,SAAS;EACV;CACD;EACE,WAAW;EACX,SAAS;EACV;CAMD;EAAE,WAAW;EAAO,SAAS;EAAO;CACrC,CAEmE,KACjE,MAAM,EAAE,UACV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../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\n * itself (no importable exports), so there is nothing to share.\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];\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","import { 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 \"subgraphs/index.ts\",\n \"subgraphs/*/index.ts\",\n \"processors/index.ts\",\n \"processors/*/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 = [...entry, \"pieces/index.ts\"];\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 // published code would never need the cli\n \"@powerhousedao/ph-cli\",\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\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\nconst baseBrowserConfig = {\n entry: browserEntry,\n platform: \"browser\" as const,\n copy,\n config,\n clean,\n dts,\n sourcemap,\n plugins: [\n esmExternalRequirePlugin({\n external: reactExternals,\n skipDuplicateCheck: true,\n }),\n ],\n inputOptions: {\n experimental: { resolveNewUrlToAsset: true },\n },\n};\n\nexport type BrowserBuildConfigOptions = {\n /** Externalize the shared dependency set (default: true). */\n sharedDeps?: boolean;\n};\n\nexport function buildBrowserBuildConfig(\n options: BrowserBuildConfigOptions = {},\n): InlineConfig {\n const sharedDeps = options.sharedDeps ?? true;\n return {\n ...baseBrowserConfig,\n deps: {\n alwaysBundle,\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};\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 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};\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 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 config,\n clean,\n dts,\n sourcemap,\n };\n}\n"],"mappings":";;AAoCA,MAAa,wBAA2C;CA1BtD;EAAE,WAAW;EAAkB,SAAS;CAAiB;CACzD;EACE,WAAW;EACX,SAAS;CACX;CACA;EAAE,WAAW;EAAyB,SAAS;CAAwB;CACvE;EACE,WAAW;EACX,SAAS;CACX;CACA;EACE,WAAW;EACX,SAAS;CACX;CACA;EACE,WAAW;EACX,SAAS;CACX;CAMA;EAAE,WAAW;EAAO,SAAS;CAAM;AAGmB,CAAA,CAAY,KACjE,MAAM,EAAE,SACX;;;;;;;;;AAUA,MAAa,kBAAqC;CAChD;CACA;CACA;CACA;CACA;CACA;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1
+ import { t as InlineConfig } from "./index-DpixpHXl.mjs";
3
2
  //#region clis/build-config.d.mts
4
- declare const PIECE_ENTRY_GLOB = "pieces/*/index.ts";
5
- declare const browserEntry: string[];
6
- type BrowserBuildConfigOptions = {
7
- /** Externalize the shared dependency set (default: true). */sharedDeps?: boolean;
3
+ export declare const PIECE_ENTRY_GLOB = "pieces/*/index.ts";
4
+ export declare const browserEntry: string[];
5
+ export type BrowserBuildConfigOptions = {
6
+ /** Externalize the shared dependency set (default: true). */
7
+ sharedDeps?: boolean;
8
8
  };
9
- declare function buildBrowserBuildConfig(options?: BrowserBuildConfigOptions): InlineConfig;
10
- declare const browserBuildConfig: InlineConfig;
9
+ export declare function buildBrowserBuildConfig(options?: BrowserBuildConfigOptions): InlineConfig;
10
+ export declare const browserBuildConfig: InlineConfig;
11
11
  /**
12
12
  * Shared specs a source imports but the built output no longer references as
13
13
  * bare imports — the bundler inlined them, which is exactly what the
14
14
  * external set is meant to prevent.
15
15
  */
16
- declare function findBundledSharedDeps(importedSpecs: string[], outputs: readonly {
16
+ export declare function findBundledSharedDeps(importedSpecs: string[], outputs: readonly {
17
17
  path: string;
18
18
  content: string;
19
19
  }[]): string[];
20
- type NodeBuildConfigOptions = {
21
- /** Externalize the shared dependency set (default: true). */sharedDeps?: boolean;
20
+ export type NodeBuildConfigOptions = {
21
+ /** Externalize the shared dependency set (default: true). */
22
+ sharedDeps?: boolean;
22
23
  };
23
24
  /**
24
25
  * The node build externalizes the same shared set as the browser build, for
@@ -30,10 +31,12 @@ type NodeBuildConfigOptions = {
30
31
  * the consumer to provide (`document-model`, `@powerhousedao/reactor-browser`
31
32
  * and `zod` are peerDependencies of every generated project).
32
33
  */
33
- declare function buildNodeBuildConfig(options?: NodeBuildConfigOptions): InlineConfig;
34
- declare const nodeBuildConfig: InlineConfig;
35
- type PieceBuildConfigOptions = {
36
- /** The piece's source entry, relative to the project: `pieces/<dir>/index.ts`. */entry: string; /** Where the piece lands: `<outDir>/node/pieces/<dir>`. */
34
+ export declare function buildNodeBuildConfig(options?: NodeBuildConfigOptions): InlineConfig;
35
+ export declare const nodeBuildConfig: InlineConfig;
36
+ export type PieceBuildConfigOptions = {
37
+ /** The piece's source entry, relative to the project: `pieces/<dir>/index.ts`. */
38
+ entry: string;
39
+ /** Where the piece lands: `<outDir>/node/pieces/<dir>`. */
37
40
  outDir: string;
38
41
  };
39
42
  /**
@@ -44,7 +47,7 @@ type PieceBuildConfigOptions = {
44
47
  * external. Code splitting is off for the same reason, so a dynamic import is
45
48
  * inlined too and the piece directory holds exactly one module.
46
49
  */
47
- declare function buildPieceBuildConfig(options: PieceBuildConfigOptions): InlineConfig;
50
+ export declare function buildPieceBuildConfig(options: PieceBuildConfigOptions): InlineConfig;
48
51
  //#endregion
49
- export { BrowserBuildConfigOptions, NodeBuildConfigOptions, PIECE_ENTRY_GLOB, PieceBuildConfigOptions, browserBuildConfig, browserEntry, buildBrowserBuildConfig, buildNodeBuildConfig, buildPieceBuildConfig, findBundledSharedDeps, nodeBuildConfig };
52
+ export {};
50
53
  //# sourceMappingURL=build-config.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-config.d.mts","names":[],"sources":["../../clis/build-config.mts"],"mappings":";;;cA6Ba,gBAAA;AAAA,cAGA,YAAA;AAAA,KAkGD,yBAAA;EArGiB,6DAuG3B,UAAA;AAAA;AAAA,iBAGc,uBAAA,CACd,OAAA,GAAS,yBAAA,GACR,YAAA;AAAA,cAeU,kBAAA,EAAkB,YAAA;;;;;AAtB/B;iBA6BgB,qBAAA,CACd,aAAA,YACA,OAAA;EAAoB,IAAA;EAAc,OAAA;AAAA;AAAA,KAQxB,sBAAA;EAlC2B,6DAoCrC,UAAA;AAAA;;;;;;AAnBF;;;;;iBAgCgB,oBAAA,CACd,OAAA,GAAS,sBAAA,GACR,YAAA;AAAA,cAoBU,eAAA,EAAiB,YAAA;AAAA,KAElB,uBAAA;EAjDyB,kFAmDnC,KAAA,UAjDoB;EAmDpB,MAAA;AAAA;;;AA3CF;;;;;AAeA;iBAuCgB,qBAAA,CACd,OAAA,EAAS,uBAAA,GACR,YAAA"}
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,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-BkfXtfV8.mjs";
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
2
  export { PIECE_ENTRY_GLOB, browserBuildConfig, browserEntry, buildBrowserBuildConfig, buildNodeBuildConfig, buildPieceBuildConfig, findBundledSharedDeps, nodeBuildConfig };
@@ -1,36 +1,37 @@
1
- import { t as InlineConfig } from "./index-CyAv0ucZ.mjs";
2
- import { t as Manifest } from "./types-DXhVHupa.mjs";
3
- import * as node_fs0 from "node:fs";
4
-
1
+ import { t as InlineConfig } from "./index-DpixpHXl.mjs";
2
+ import { t as Manifest } from "./types-CMFHKrgv.mjs";
5
3
  //#region clis/build-pieces.d.mts
6
- type PiecePlan = {
7
- /** The directory under pieces/, and so under <outDir>/node/pieces. */dir: string; /** Source entry, relative to the project root: pieces/<dir>/index.ts. */
8
- entry: string; /** Where the piece lands, relative to the project root. */
4
+ export type PiecePlan = {
5
+ /** The directory under pieces/, and so under <outDir>/node/pieces. */
6
+ dir: string;
7
+ /** Source entry, relative to the project root: pieces/<dir>/index.ts. */
8
+ entry: string;
9
+ /** Where the piece lands, relative to the project root. */
9
10
  outDir: string;
10
11
  };
11
- type PieceBuildTarget = {
12
+ export type PieceBuildTarget = {
12
13
  projectRoot: string;
13
14
  outDir: string;
14
15
  pieces: PiecePlan[];
15
16
  };
16
- type PackagePiece = {
17
+ export type PackagePiece = {
17
18
  name: string;
18
19
  version: string;
19
20
  entry?: string;
20
21
  bundle?: string;
21
22
  };
22
- type PieceMetadata = Record<string, unknown> & {
23
+ export type PieceMetadata = Record<string, unknown> & {
23
24
  displayName?: string;
24
25
  description?: string;
25
26
  actions?: Record<string, unknown>;
26
27
  triggers?: Record<string, unknown>;
27
28
  };
28
- type DescribedPiece = {
29
+ export type DescribedPiece = {
29
30
  name: string;
30
31
  version: string;
31
32
  metadata: PieceMetadata;
32
33
  };
33
- type DescribeResult = {
34
+ export type DescribeResult = {
34
35
  list: PackagePiece[];
35
36
  pieces: DescribedPiece[];
36
37
  errors: {
@@ -38,58 +39,63 @@ type DescribeResult = {
38
39
  message: string;
39
40
  }[];
40
41
  };
41
- type BuiltPiece = {
42
+ export type BuiltPiece = {
42
43
  name: string;
43
44
  version: string;
44
45
  displayName?: string;
45
- description?: string; /** Piece directory, relative to the project root, `/` separated. */
46
- bundle: string; /** The descriptor inside it, relative to the project root, `/` separated. */
46
+ description?: string;
47
+ /** Piece directory, relative to the project root, `/` separated. */
48
+ bundle: string;
49
+ /** The descriptor inside it, relative to the project root, `/` separated. */
47
50
  descriptor: string;
48
51
  };
49
- type PackageIdentity = {
52
+ export type PackageIdentity = {
50
53
  name: string;
51
54
  version: string;
52
55
  license?: string;
53
56
  };
54
- type PieceBuildOptions = {
55
- /** The bundler: tsdown's `build`, handed in so this module never loads it. */bundle: (config: InlineConfig) => Promise<unknown>;
57
+ export type PieceBuildOptions = {
58
+ /** The bundler: tsdown's `build`, handed in so this module never loads it. */
59
+ bundle: (config: InlineConfig) => Promise<unknown>;
56
60
  };
57
- declare function statSafe(p: string): node_fs0.Stats | null;
58
- declare function expandEntryGlobs(root: string, globs: string[]): string[];
59
- declare function planPieces(projectRoot: string, outDir: string): PiecePlan[];
60
- declare function createJsonReplacer(): (this: unknown, _key: string, value: unknown) => {} | null | undefined;
61
- 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";
62
- 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, version: piece.version, 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";
63
- declare function describePieces(projectRoot: string, listPath: string): DescribeResult;
64
- type PieceLocation = {
65
- /** The piece directory, absolute. */dir: string; /** The module file, absolute; unset for a bundle, whose package.json names it. */
61
+ export declare function statSafe(p: string): import("node:fs").Stats | null;
62
+ export declare function expandEntryGlobs(root: string, globs: string[]): string[];
63
+ export declare function planPieces(projectRoot: string, outDir: string): PiecePlan[];
64
+ export declare function createJsonReplacer(): (this: unknown, _key: string, value: unknown) => {} | null | undefined;
65
+ 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";
66
+ 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, version: piece.version, 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";
67
+ export declare function describePieces(projectRoot: string, listPath: string): DescribeResult;
68
+ export type PieceLocation = {
69
+ /** The piece directory, absolute. */
70
+ dir: string;
71
+ /** The module file, absolute; unset for a bundle, whose package.json names it. */
66
72
  entryFile?: string;
67
73
  form: "entry" | "bundle";
68
74
  };
69
- declare function resolvePieceLocation(piece: PackagePiece, projectRoot: string, outDir: string): PieceLocation;
70
- declare function pieceListPath(target: {
75
+ export declare function resolvePieceLocation(piece: PackagePiece, projectRoot: string, outDir: string): PieceLocation;
76
+ export declare function pieceListPath(target: {
71
77
  projectRoot: string;
72
78
  outDir: string;
73
79
  }): string;
74
- declare function assertPiecesOutDir(target: {
80
+ export declare function assertPiecesOutDir(target: {
75
81
  outDir: string;
76
82
  pieces: PiecePlan[];
77
83
  }): void;
78
- declare function assertPieceVersion(piece: PackagePiece, pkg: PackageIdentity): void;
79
- declare function piecePackageJson(options: {
84
+ export declare function assertPieceVersion(piece: PackagePiece, pkg: PackageIdentity): void;
85
+ export declare function piecePackageJson(options: {
80
86
  name: string;
81
87
  version: string;
82
88
  description?: string;
83
89
  main: string;
84
90
  license?: string;
85
91
  }): Record<string, unknown>;
86
- declare function pieceDescriptor(piece: PackagePiece, metadata: PieceMetadata): Record<string, unknown>;
87
- declare function enrichManifestPieces(manifest: Manifest, built: BuiltPiece[]): {
92
+ export declare function pieceDescriptor(piece: PackagePiece, metadata: PieceMetadata): Record<string, unknown>;
93
+ export declare function enrichManifestPieces(manifest: Manifest, built: BuiltPiece[]): {
88
94
  manifest: Manifest;
89
95
  unbuilt: string[];
90
96
  };
91
- declare function buildPieces(target: PieceBuildTarget, pkg: PackageIdentity, options: PieceBuildOptions): Promise<BuiltPiece[]>;
92
- declare function syncDistManifest(target: PieceBuildTarget, built: BuiltPiece[]): string | undefined;
97
+ export declare function buildPieces(target: PieceBuildTarget, pkg: PackageIdentity, options: PieceBuildOptions): Promise<BuiltPiece[]>;
98
+ export declare function syncDistManifest(target: PieceBuildTarget, built: BuiltPiece[]): string | undefined;
93
99
  //#endregion
94
- export { BuiltPiece, DESCRIBE_HELPERS, DESCRIBE_SCRIPT, DescribeResult, DescribedPiece, PackageIdentity, PackagePiece, PieceBuildOptions, PieceBuildTarget, PieceLocation, PieceMetadata, PiecePlan, assertPieceVersion, assertPiecesOutDir, buildPieces, createJsonReplacer, describePieces, enrichManifestPieces, expandEntryGlobs, pieceDescriptor, pieceListPath, piecePackageJson, planPieces, resolvePieceLocation, statSafe, syncDistManifest };
100
+ export {};
95
101
  //# sourceMappingURL=build-pieces.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-pieces.d.mts","names":[],"sources":["../../clis/build-pieces.mts"],"mappings":";;;;;KA4BY,SAAA;wEAEV,GAAA,UAFU;EAIV,KAAA;EAEA,MAAA;AAAA;AAAA,KAKU,gBAAA;EACV,WAAA;EACA,MAAA;EACA,MAAA,EAAQ,SAAA;AAAA;AAAA,KAKE,YAAA;EACV,IAAA;EACA,OAAA;EACA,KAAA;EACA,MAAA;AAAA;AAAA,KAKU,aAAA,GAAgB,MAAA;EAC1B,WAAA;EACA,WAAA;EACA,OAAA,GAAU,MAAA;EACV,QAAA,GAAW,MAAA;AAAA;AAAA,KAGD,cAAA;EACV,IAAA;EACA,OAAA;EACA,QAAA,EAAU,aAAA;AAAA;AAAA,KAGA,cAAA;EACV,IAAA,EAAM,YA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KAAA,EAAO,UAAA;EACJ,QAAA,EAAU,QAAA;EAAU,OAAA;AAAA;AAAA,iBAkCH,WAAA,CACpB,MAAA,EAAQ,gBAAA,EACR,GAAA,EAAK,eAAA,EACL,OAAA,EAAS,iBAAA,GACR,OAAA,CAAQ,UAAA;AAAA,iBA4GK,gBAAA,CACd,MAAA,EAAQ,gBAAA,EACR,KAAA,EAAO,UAAA"}
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;EACA;;YAKU,gBAAgB;EAC1B;EACA;EACA,UAAU;EACV,WAAW;;YAGD;EACV;EACA;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;wBAgBY,gBACd,OAAO,cACP,UAAU,gBACT;wBAUa,qBACd,UAAU,UACV,OAAO;EACJ,UAAU;EAAU;;wBAkCH,YACpB,QAAQ,kBACR,KAAK,iBACL,SAAS,oBACR,QAAQ;wBA4GK,iBACd,QAAQ,kBACR,OAAO"}
@@ -1,4 +1,4 @@
1
- import { o as buildPieceBuildConfig, t as PIECE_ENTRY_GLOB } from "./build-config-BkfXtfV8.mjs";
1
+ import { o as buildPieceBuildConfig, t as PIECE_ENTRY_GLOB } from "./build-config-CmdMi_wu.mjs";
2
2
  import { tmpdir } from "node:os";
3
3
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
4
4
  import { copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
@@ -217,7 +217,8 @@ function resolvePieceLocation(piece, projectRoot, outDir) {
217
217
  const form = piece.entry ? "entry" : "bundle";
218
218
  if (!(form === "entry" ? statSafe(path)?.isFile() : statSafe(join(path, "package.json"))?.isFile())) throw new Error(`pieces: "${piece.name}" declares ${declared}, which is missing`);
219
219
  const dir = form === "entry" ? dirname(path) : path;
220
- const inside = relative(resolve(projectRoot, outDir, "node", "pieces"), dir);
220
+ const piecesRoot = resolve(projectRoot, outDir, "node", "pieces");
221
+ const inside = relative(piecesRoot, dir);
221
222
  if (inside === "" || inside.startsWith("..") || isAbsolute(inside)) {
222
223
  const expected = toPosix(join(outDir, "node", "pieces"));
223
224
  throw new Error(`pieces: "${piece.name}" declares ${declared}, which is outside ${expected}/; a piece is built to ${expected}/<dir>/index.mjs and its entry must point there`);
@@ -1 +1 @@
1
- {"version":3,"file":"build-pieces.mjs","names":[],"sources":["../../clis/build-pieces.mts"],"sourcesContent":["// The pieces half of a package build: find and bundle each piece whole, load\n// it once in a child process to learn what it is, and write what a host reads.\nimport { execFileSync } from \"node:child_process\";\nimport {\n copyFileSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\n readdirSync,\n readFileSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport {\n basename,\n dirname,\n isAbsolute,\n join,\n relative,\n resolve,\n sep,\n} from \"node:path\";\nimport type { InlineConfig } from \"tsdown\";\nimport type { Manifest, PieceModule } from \"../document-model/types.js\";\nimport { buildPieceBuildConfig, PIECE_ENTRY_GLOB } from \"./build-config.mjs\";\n\nexport type PiecePlan = {\n /** The directory under pieces/, and so under <outDir>/node/pieces. */\n dir: string;\n /** Source entry, relative to the project root: pieces/<dir>/index.ts. */\n entry: string;\n /** Where the piece lands, relative to the project root. */\n outDir: string;\n};\n\n// What buildPieces needs to know about the package it works in: where it is,\n// where it builds to, and which pieces the plan found.\nexport type PieceBuildTarget = {\n projectRoot: string;\n outDir: string;\n pieces: PiecePlan[];\n};\n\n// One entry of pieces/index.ts, as @powerhousedao/pieces-framework declares it.\n// Declared here so the build needs no dependency on a package meant for pieces.\nexport type PackagePiece = {\n name: string;\n version: string;\n entry?: string;\n bundle?: string;\n};\n\n// What a piece says about itself, in the framework's PieceMetadata shape.\n// Read from the built piece, so nothing in the build has to know the framework.\nexport type PieceMetadata = Record<string, unknown> & {\n displayName?: string;\n description?: string;\n actions?: Record<string, unknown>;\n triggers?: Record<string, unknown>;\n};\n\nexport type DescribedPiece = {\n name: string;\n version: string;\n metadata: PieceMetadata;\n};\n\nexport type DescribeResult = {\n list: PackagePiece[];\n pieces: DescribedPiece[];\n errors: { name: string; message: string }[];\n};\n\nexport type BuiltPiece = {\n name: string;\n version: string;\n displayName?: string;\n description?: string;\n /** Piece directory, relative to the project root, `/` separated. */\n bundle: string;\n /** The descriptor inside it, relative to the project root, `/` separated. */\n descriptor: string;\n};\n\nexport type PackageIdentity = {\n name: string;\n version: string;\n license?: string;\n};\n\nexport type PieceBuildOptions = {\n /** The bundler: tsdown's `build`, handed in so this module never loads it. */\n bundle: (config: InlineConfig) => Promise<unknown>;\n};\n\nconst toPosix = (p: string) => p.split(sep).join(\"/\");\n\nexport function statSafe(p: string) {\n try {\n return statSync(p);\n } catch {\n return null;\n }\n}\n\n// Expand entry globs (single-`*` segments only — the shape `browserEntry`\n// uses) against files on disk, resolving against `root`.\nexport function expandEntryGlobs(root: string, globs: string[]): string[] {\n const files = new Set<string>();\n for (const pattern of globs) {\n const segments = pattern.split(\"/\").filter(Boolean);\n let dirs = [root];\n for (const seg of segments) {\n const next: string[] = [];\n for (const d of dirs) {\n if (!statSafe(d)?.isDirectory()) continue;\n if (seg === \"*\") {\n for (const e of readdirSync(d, { withFileTypes: true })) {\n next.push(join(d, e.name));\n }\n } else {\n next.push(join(d, seg));\n }\n }\n dirs = next;\n }\n for (const f of dirs) {\n if (statSafe(f)?.isFile()) files.add(f);\n }\n }\n return [...files];\n}\n\n// The pieces a project holds, one per pieces/<dir>/index.ts, sorted by dir so\n// a build log and a manifest read the same from one run to the next.\nexport function planPieces(projectRoot: string, outDir: string): PiecePlan[] {\n return expandEntryGlobs(projectRoot, [PIECE_ENTRY_GLOB])\n .map((file) => {\n const dir = basename(dirname(file));\n return {\n dir,\n entry: relative(projectRoot, file),\n outDir: join(outDir, \"node\", \"pieces\", dir),\n };\n })\n .sort((a, b) => (a.dir < b.dir ? -1 : a.dir > b.dir ? 1 : 0));\n}\n\n// A JSON.stringify replacer that makes a piece's metadata serializable: props\n// carry resolvers, defaults may be class instances, and a schema may cycle.\nexport function createJsonReplacer() {\n const ancestors: object[] = [];\n return function replace(this: unknown, _key: string, value: unknown) {\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 // `this` is the holder, so popping back to it leaves the current path.\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 half of the child script that needs nothing from the job: a test\n// evaluates this text on its own, so neither copy can drift from the other.\n\n// `constructor?.name`: a module may export an Object.create(null), and the\n// real piece is usually beside it in the same module.\nexport 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`;\n\n// Runs in a child node process: loading a piece runs piece-authored top-level\n// code, and the runtime describes pieces in a worker for the same reason.\n\n// A string so it works from `src` under bun or tsx as well as from `dist`. It\n// answers through a file, leaving both its streams to the piece.\nexport 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${DESCRIBE_HELPERS}\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, version: piece.version, 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`;\n\n// What the child said went wrong, if it got that far, and otherwise how it\n// died: an exit status, never the whole script an `Error.message` carries.\nfunction childFailure(error: unknown, outFile: string): string {\n try {\n const answer = JSON.parse(readFileSync(outFile, \"utf8\")) as {\n fatal?: unknown;\n };\n if (typeof answer.fatal === \"string\") return answer.fatal;\n } catch {\n // no answer on disk: fall through to the exit status\n }\n const { status, signal } = error as {\n status?: number | null;\n signal?: string | null;\n };\n if (signal) return `the describe child was killed by ${signal}`;\n return `the describe child exited with code ${status ?? \"unknown\"}`;\n}\n\n// Load the built list and every piece it names in a child process and return\n// what they say about themselves. Throws when the list itself cannot be read.\n\n// Both of the child's streams are the parent's, so a piece that prints at\n// import time is heard rather than mixed into the answer.\nexport function describePieces(\n projectRoot: string,\n listPath: string,\n): DescribeResult {\n const dir = mkdtempSync(join(tmpdir(), \"ph-build-pieces-\"));\n const rel = toPosix(relative(projectRoot, listPath));\n try {\n const jobFile = join(dir, \"job.json\");\n const scriptFile = join(dir, \"describe.mjs\");\n const outFile = join(dir, \"describe.json\");\n writeFileSync(scriptFile, DESCRIBE_SCRIPT);\n writeFileSync(jobFile, JSON.stringify({ projectRoot, listPath, outFile }));\n try {\n execFileSync(process.execPath, [scriptFile, jobFile], {\n timeout: 60_000,\n stdio: \"inherit\",\n });\n } catch (error) {\n throw new Error(\n `pieces: could not load ${rel}: ${childFailure(error, outFile)}`,\n { cause: error },\n );\n }\n return JSON.parse(readFileSync(outFile, \"utf8\")) as DescribeResult;\n } finally {\n rmSync(dir, { recursive: true, force: true });\n }\n}\n\nexport type PieceLocation = {\n /** The piece directory, absolute. */\n dir: string;\n /** The module file, absolute; unset for a bundle, whose package.json names it. */\n entryFile?: string;\n form: \"entry\" | \"bundle\";\n};\n\n// Where a list entry says its built piece is, checked against the disk: a\n// listed piece nobody built would otherwise fail much later, in a host.\nexport function resolvePieceLocation(\n piece: PackagePiece,\n projectRoot: string,\n outDir: string,\n): PieceLocation {\n const declared = piece.entry ?? piece.bundle;\n if (typeof declared !== \"string\" || declared === \"\") {\n throw new Error(\n `pieces: \"${piece.name}\" declares neither an entry nor a bundle`,\n );\n }\n const path = isAbsolute(declared) ? declared : join(projectRoot, declared);\n const form = piece.entry ? \"entry\" : \"bundle\";\n const present =\n form === \"entry\"\n ? statSafe(path)?.isFile()\n : statSafe(join(path, \"package.json\"))?.isFile();\n if (!present) {\n throw new Error(\n `pieces: \"${piece.name}\" declares ${declared}, which is missing`,\n );\n }\n const dir = form === \"entry\" ? dirname(path) : path;\n // Both forms, not just `entry`: a descriptor.json is written into this\n // directory, and outside outDir that lands in tracked source.\n const piecesRoot = resolve(projectRoot, outDir, \"node\", \"pieces\");\n const inside = relative(piecesRoot, dir);\n if (inside === \"\" || inside.startsWith(\"..\") || isAbsolute(inside)) {\n const expected = toPosix(join(outDir, \"node\", \"pieces\"));\n throw new Error(\n `pieces: \"${piece.name}\" declares ${declared}, which is outside ${expected}/; ` +\n `a piece is built to ${expected}/<dir>/index.mjs and its entry must point there`,\n );\n }\n return form === \"entry\" ? { dir, entryFile: path, form } : { dir, form };\n}\n\n// Where the node build leaves the list of pieces a package ships. Its presence\n// on disk, not a pieces/<dir> in the source, is what says a package has them.\nexport function pieceListPath(target: {\n projectRoot: string;\n outDir: string;\n}): string {\n return resolve(\n target.projectRoot,\n target.outDir,\n \"node\",\n \"pieces\",\n \"index.mjs\",\n );\n}\n\n// `dist` is not a default here but a contract: a host reads a piece from\n// dist/node/pieces/<name>, and a list entry names that path literally.\nexport function assertPiecesOutDir(target: {\n outDir: string;\n pieces: PiecePlan[];\n}): void {\n if (target.pieces.length === 0 || target.outDir === \"dist\") return;\n throw new Error(\n `pieces: --out-dir ${target.outDir} cannot hold pieces; a piece is loaded from ` +\n `dist/node/pieces/<name> by the host, so a package that ships pieces builds to dist`,\n );\n}\n\n// A piece named after its package must carry the package's version: once\n// published, a drifted version resolves to the wrong tarball.\nexport function assertPieceVersion(\n piece: PackagePiece,\n pkg: PackageIdentity,\n): void {\n if (piece.name === pkg.name && piece.version !== pkg.version) {\n throw new Error(\n `pieces: \"${piece.name}\" declares version ${piece.version}, package.json says ${pkg.version}`,\n );\n }\n}\n\n// The package.json written beside a piece built from an `entry`, giving the\n// directory npm-bundle shape so a registry can serve it on its own.\nexport function piecePackageJson(options: {\n name: string;\n version: string;\n description?: string;\n main: string;\n license?: string;\n}): Record<string, unknown> {\n return {\n name: options.name,\n version: options.version,\n description: options.description ?? \"\",\n type: \"module\",\n main: options.main,\n ...(options.license ? { license: options.license } : {}),\n // Empty on purpose: the runtime treats a bundle that declares dependencies\n // as not self-contained, and everything a piece needs is inlined already.\n dependencies: {},\n };\n}\n\n// The descriptor written beside a piece: the list's name and version, then\n// whatever the piece said about itself, in the framework's PieceMetadata shape.\nexport function pieceDescriptor(\n piece: PackagePiece,\n metadata: PieceMetadata,\n): Record<string, unknown> {\n const { name: _name, version: _version, ...rest } = metadata;\n return { name: piece.name, version: piece.version, ...rest };\n}\n\n// The manifest's `pieces` with what the build learned: a built piece replaces\n// the source entry with its id in place, or is appended at the end.\n\n// A source entry nothing built is kept as it is and returned as `unbuilt`,\n// for the caller to warn about.\nexport function enrichManifestPieces(\n manifest: Manifest,\n built: BuiltPiece[],\n): { manifest: Manifest; unbuilt: string[] } {\n const byId = new Map(built.map((piece) => [piece.name, piece]));\n const toModule = (piece: BuiltPiece): PieceModule => ({\n id: piece.name,\n name: piece.displayName ?? piece.name,\n version: piece.version,\n ...(piece.description ? { description: piece.description } : {}),\n bundle: piece.bundle,\n descriptor: piece.descriptor,\n });\n const unbuilt: string[] = [];\n const seen = new Set<string>();\n const pieces: PieceModule[] = (manifest.pieces ?? []).map((entry) => {\n const hit = byId.get(entry.id);\n if (!hit) {\n unbuilt.push(entry.id);\n return entry;\n }\n seen.add(entry.id);\n return toModule(hit);\n });\n for (const piece of built) {\n if (!seen.has(piece.name)) pieces.push(toModule(piece));\n }\n return { manifest: { ...manifest, pieces }, unbuilt };\n}\n\nconst count = (record: unknown) =>\n typeof record === \"object\" && record !== null\n ? Object.keys(record).length\n : 0;\n\n// Build every planned piece, then read the built list and describe what it\n// names. Returns what was built, for the manifest.\nexport async function buildPieces(\n target: PieceBuildTarget,\n pkg: PackageIdentity,\n options: PieceBuildOptions,\n): Promise<BuiltPiece[]> {\n const { projectRoot, outDir } = target;\n assertPiecesOutDir(target);\n // resolve, not join: an absolute --out-dir is what the browser and node\n // steps hand tsdown, and joining it onto the project root mangles it.\n for (const piece of target.pieces) {\n console.log(`\\n▶ Building piece ${piece.dir}...`);\n await options.bundle(\n buildPieceBuildConfig({\n entry: resolve(projectRoot, piece.entry),\n outDir: resolve(projectRoot, piece.outDir),\n }),\n );\n }\n\n // The list is the source of truth for names and versions; a package that\n // built pieces without a list has nothing a host could read.\n const listPath = pieceListPath(target);\n if (!existsSync(listPath)) {\n throw new Error(\n `pieces: ${toPosix(relative(projectRoot, listPath))} was not built; ` +\n `pieces/index.ts must export the list of pieces this package ships`,\n );\n }\n const described = describePieces(projectRoot, listPath);\n\n const built: BuiltPiece[] = [];\n const listedDirs = new Set<string>();\n for (const piece of described.list) {\n const location = resolvePieceLocation(piece, projectRoot, outDir);\n assertPieceVersion(piece, pkg);\n const failure = described.errors.find((e) => e.name === piece.name);\n if (failure) {\n throw new Error(\n `pieces: \"${piece.name}\" could not be described: ${failure.message}`,\n );\n }\n const found = described.pieces.find((p) => p.name === piece.name);\n if (!found) {\n throw new Error(`pieces: \"${piece.name}\" was not described`);\n }\n const metadata = found.metadata;\n const relDir = toPosix(relative(projectRoot, location.dir));\n listedDirs.add(relDir);\n\n writeFileSync(\n join(location.dir, \"descriptor.json\"),\n JSON.stringify(\n pieceDescriptor(piece, metadata),\n createJsonReplacer(),\n 2,\n ) + \"\\n\",\n );\n if (location.form === \"entry\" && location.entryFile) {\n writeFileSync(\n join(location.dir, \"package.json\"),\n JSON.stringify(\n piecePackageJson({\n name: piece.name,\n version: piece.version,\n description: metadata.description,\n main: relative(location.dir, location.entryFile),\n license: pkg.license,\n }),\n null,\n 2,\n ) + \"\\n\",\n );\n }\n console.log(\n `piece: ${piece.name}@${piece.version} -> ${relDir} ` +\n `(${count(metadata.actions)} actions, ${count(metadata.triggers)} triggers)`,\n );\n built.push({\n name: piece.name,\n version: piece.version,\n displayName: metadata.displayName,\n description: metadata.description,\n bundle: relDir,\n descriptor: `${relDir}/descriptor.json`,\n });\n }\n\n warnUnlistedPieces(target.pieces, listedDirs);\n return built;\n}\n\n// A built piece no list entry points into ships without a host ever finding it.\nfunction warnUnlistedPieces(\n planned: PiecePlan[],\n listedDirs: Set<string>,\n): void {\n for (const piece of planned) {\n if (!listedDirs.has(toPosix(piece.outDir))) {\n console.warn(\n `⚠ pieces: pieces/${piece.dir} was built but pieces/index.ts does not list it; a host will not find it`,\n );\n }\n }\n}\n\n// Make sure the manifest ships under outDir (tsdown copies it only in the\n// browser build) and, when pieces were built, list them in that copy.\n\n// Always copied afresh: only <outDir>/node is cleaned by the builds, so a copy\n// left by the last build would otherwise outlive an edit to the source.\n\n// The source file is never written. Returns the path of the copy, if any.\nexport function syncDistManifest(\n target: PieceBuildTarget,\n built: BuiltPiece[],\n): string | undefined {\n const { projectRoot, outDir } = target;\n const source = join(projectRoot, \"powerhouse.manifest.json\");\n // resolve, not join: an absolute --out-dir is a location, not a suffix.\n const copy = resolve(projectRoot, outDir, \"powerhouse.manifest.json\");\n // The built list, not the source plan: a package whose pieces are all\n // `bundle:` entries has no pieces/<dir> and still ships pieces.\n const shipsPieces = existsSync(pieceListPath(target));\n if (!existsSync(source)) {\n if (shipsPieces) {\n console.warn(\"⚠ no powerhouse.manifest.json; pieces will not be listed\");\n }\n return undefined;\n }\n mkdirSync(dirname(copy), { recursive: true });\n copyFileSync(source, copy);\n if (!shipsPieces) return copy;\n\n const manifest = JSON.parse(readFileSync(copy, \"utf8\")) as Manifest;\n const enriched = enrichManifestPieces(manifest, built);\n for (const id of enriched.unbuilt) {\n console.warn(`⚠ manifest lists piece \"${id}\" but nothing built it`);\n }\n writeFileSync(copy, JSON.stringify(enriched.manifest, null, 2) + \"\\n\");\n return copy;\n}\n"],"mappings":";;;;;;AAiGA,MAAM,WAAW,MAAc,EAAE,MAAM,IAAI,CAAC,KAAK,IAAI;AAErD,SAAgB,SAAS,GAAW;AAClC,KAAI;AACF,SAAO,SAAS,EAAE;SACZ;AACN,SAAO;;;AAMX,SAAgB,iBAAiB,MAAc,OAA2B;CACxE,MAAM,wBAAQ,IAAI,KAAa;AAC/B,MAAK,MAAM,WAAW,OAAO;EAC3B,MAAM,WAAW,QAAQ,MAAM,IAAI,CAAC,OAAO,QAAQ;EACnD,IAAI,OAAO,CAAC,KAAK;AACjB,OAAK,MAAM,OAAO,UAAU;GAC1B,MAAM,OAAiB,EAAE;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AAS,SAAS,CAAC,YACpE;AACD,QAAM,KAAK;GACT,MAAM,MAAM;GACZ,SAAS,MAAM;GACf,aAAa,SAAS;GACtB,aAAa,SAAS;GACtB,QAAQ;GACR,YAAY,GAAG,OAAO;GACvB,CAAC;;AAGJ,oBAAmB,OAAO,QAAQ,WAAW;AAC7C,QAAO;;AAIT,SAAS,mBACP,SACA,YACM;AACN,MAAK,MAAM,SAAS,QAClB,KAAI,CAAC,WAAW,IAAI,QAAQ,MAAM,OAAO,CAAC,CACxC,SAAQ,KACN,oBAAoB,MAAM,IAAI,0EAC/B;;AAYP,SAAgB,iBACd,QACA,OACoB;CACpB,MAAM,EAAE,aAAa,WAAW;CAChC,MAAM,SAAS,KAAK,aAAa,2BAA2B;CAE5D,MAAM,OAAO,QAAQ,aAAa,QAAQ,2BAA2B;CAGrE,MAAM,cAAc,WAAW,cAAc,OAAO,CAAC;AACrD,KAAI,CAAC,WAAW,OAAO,EAAE;AACvB,MAAI,YACF,SAAQ,KAAK,2DAA2D;AAE1E;;AAEF,WAAU,QAAQ,KAAK,EAAE,EAAE,WAAW,MAAM,CAAC;AAC7C,cAAa,QAAQ,KAAK;AAC1B,KAAI,CAAC,YAAa,QAAO;CAGzB,MAAM,WAAW,qBADA,KAAK,MAAM,aAAa,MAAM,OAAO,CAAC,EACP,MAAM;AACtD,MAAK,MAAM,MAAM,SAAS,QACxB,SAAQ,KAAK,2BAA2B,GAAG,wBAAwB;AAErE,eAAc,MAAM,KAAK,UAAU,SAAS,UAAU,MAAM,EAAE,GAAG,KAAK;AACtE,QAAO"}
1
+ {"version":3,"file":"build-pieces.mjs","names":[],"sources":["../../clis/build-pieces.mts"],"sourcesContent":["// The pieces half of a package build: find and bundle each piece whole, load\n// it once in a child process to learn what it is, and write what a host reads.\nimport { execFileSync } from \"node:child_process\";\nimport {\n copyFileSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\n readdirSync,\n readFileSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport {\n basename,\n dirname,\n isAbsolute,\n join,\n relative,\n resolve,\n sep,\n} from \"node:path\";\nimport type { InlineConfig } from \"tsdown\";\nimport type { Manifest, PieceModule } from \"../document-model/types.js\";\nimport { buildPieceBuildConfig, PIECE_ENTRY_GLOB } from \"./build-config.mjs\";\n\nexport type PiecePlan = {\n /** The directory under pieces/, and so under <outDir>/node/pieces. */\n dir: string;\n /** Source entry, relative to the project root: pieces/<dir>/index.ts. */\n entry: string;\n /** Where the piece lands, relative to the project root. */\n outDir: string;\n};\n\n// What buildPieces needs to know about the package it works in: where it is,\n// where it builds to, and which pieces the plan found.\nexport type PieceBuildTarget = {\n projectRoot: string;\n outDir: string;\n pieces: PiecePlan[];\n};\n\n// One entry of pieces/index.ts, as @powerhousedao/pieces-framework declares it.\n// Declared here so the build needs no dependency on a package meant for pieces.\nexport type PackagePiece = {\n name: string;\n version: string;\n entry?: string;\n bundle?: string;\n};\n\n// What a piece says about itself, in the framework's PieceMetadata shape.\n// Read from the built piece, so nothing in the build has to know the framework.\nexport type PieceMetadata = Record<string, unknown> & {\n displayName?: string;\n description?: string;\n actions?: Record<string, unknown>;\n triggers?: Record<string, unknown>;\n};\n\nexport type DescribedPiece = {\n name: string;\n version: string;\n metadata: PieceMetadata;\n};\n\nexport type DescribeResult = {\n list: PackagePiece[];\n pieces: DescribedPiece[];\n errors: { name: string; message: string }[];\n};\n\nexport type BuiltPiece = {\n name: string;\n version: string;\n displayName?: string;\n description?: string;\n /** Piece directory, relative to the project root, `/` separated. */\n bundle: string;\n /** The descriptor inside it, relative to the project root, `/` separated. */\n descriptor: string;\n};\n\nexport type PackageIdentity = {\n name: string;\n version: string;\n license?: string;\n};\n\nexport type PieceBuildOptions = {\n /** The bundler: tsdown's `build`, handed in so this module never loads it. */\n bundle: (config: InlineConfig) => Promise<unknown>;\n};\n\nconst toPosix = (p: string) => p.split(sep).join(\"/\");\n\nexport function statSafe(p: string) {\n try {\n return statSync(p);\n } catch {\n return null;\n }\n}\n\n// Expand entry globs (single-`*` segments only — the shape `browserEntry`\n// uses) against files on disk, resolving against `root`.\nexport function expandEntryGlobs(root: string, globs: string[]): string[] {\n const files = new Set<string>();\n for (const pattern of globs) {\n const segments = pattern.split(\"/\").filter(Boolean);\n let dirs = [root];\n for (const seg of segments) {\n const next: string[] = [];\n for (const d of dirs) {\n if (!statSafe(d)?.isDirectory()) continue;\n if (seg === \"*\") {\n for (const e of readdirSync(d, { withFileTypes: true })) {\n next.push(join(d, e.name));\n }\n } else {\n next.push(join(d, seg));\n }\n }\n dirs = next;\n }\n for (const f of dirs) {\n if (statSafe(f)?.isFile()) files.add(f);\n }\n }\n return [...files];\n}\n\n// The pieces a project holds, one per pieces/<dir>/index.ts, sorted by dir so\n// a build log and a manifest read the same from one run to the next.\nexport function planPieces(projectRoot: string, outDir: string): PiecePlan[] {\n return expandEntryGlobs(projectRoot, [PIECE_ENTRY_GLOB])\n .map((file) => {\n const dir = basename(dirname(file));\n return {\n dir,\n entry: relative(projectRoot, file),\n outDir: join(outDir, \"node\", \"pieces\", dir),\n };\n })\n .sort((a, b) => (a.dir < b.dir ? -1 : a.dir > b.dir ? 1 : 0));\n}\n\n// A JSON.stringify replacer that makes a piece's metadata serializable: props\n// carry resolvers, defaults may be class instances, and a schema may cycle.\nexport function createJsonReplacer() {\n const ancestors: object[] = [];\n return function replace(this: unknown, _key: string, value: unknown) {\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 // `this` is the holder, so popping back to it leaves the current path.\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 half of the child script that needs nothing from the job: a test\n// evaluates this text on its own, so neither copy can drift from the other.\n\n// `constructor?.name`: a module may export an Object.create(null), and the\n// real piece is usually beside it in the same module.\nexport 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`;\n\n// Runs in a child node process: loading a piece runs piece-authored top-level\n// code, and the runtime describes pieces in a worker for the same reason.\n\n// A string so it works from `src` under bun or tsx as well as from `dist`. It\n// answers through a file, leaving both its streams to the piece.\nexport 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${DESCRIBE_HELPERS}\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, version: piece.version, 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`;\n\n// What the child said went wrong, if it got that far, and otherwise how it\n// died: an exit status, never the whole script an `Error.message` carries.\nfunction childFailure(error: unknown, outFile: string): string {\n try {\n const answer = JSON.parse(readFileSync(outFile, \"utf8\")) as {\n fatal?: unknown;\n };\n if (typeof answer.fatal === \"string\") return answer.fatal;\n } catch {\n // no answer on disk: fall through to the exit status\n }\n const { status, signal } = error as {\n status?: number | null;\n signal?: string | null;\n };\n if (signal) return `the describe child was killed by ${signal}`;\n return `the describe child exited with code ${status ?? \"unknown\"}`;\n}\n\n// Load the built list and every piece it names in a child process and return\n// what they say about themselves. Throws when the list itself cannot be read.\n\n// Both of the child's streams are the parent's, so a piece that prints at\n// import time is heard rather than mixed into the answer.\nexport function describePieces(\n projectRoot: string,\n listPath: string,\n): DescribeResult {\n const dir = mkdtempSync(join(tmpdir(), \"ph-build-pieces-\"));\n const rel = toPosix(relative(projectRoot, listPath));\n try {\n const jobFile = join(dir, \"job.json\");\n const scriptFile = join(dir, \"describe.mjs\");\n const outFile = join(dir, \"describe.json\");\n writeFileSync(scriptFile, DESCRIBE_SCRIPT);\n writeFileSync(jobFile, JSON.stringify({ projectRoot, listPath, outFile }));\n try {\n execFileSync(process.execPath, [scriptFile, jobFile], {\n timeout: 60_000,\n stdio: \"inherit\",\n });\n } catch (error) {\n throw new Error(\n `pieces: could not load ${rel}: ${childFailure(error, outFile)}`,\n { cause: error },\n );\n }\n return JSON.parse(readFileSync(outFile, \"utf8\")) as DescribeResult;\n } finally {\n rmSync(dir, { recursive: true, force: true });\n }\n}\n\nexport type PieceLocation = {\n /** The piece directory, absolute. */\n dir: string;\n /** The module file, absolute; unset for a bundle, whose package.json names it. */\n entryFile?: string;\n form: \"entry\" | \"bundle\";\n};\n\n// Where a list entry says its built piece is, checked against the disk: a\n// listed piece nobody built would otherwise fail much later, in a host.\nexport function resolvePieceLocation(\n piece: PackagePiece,\n projectRoot: string,\n outDir: string,\n): PieceLocation {\n const declared = piece.entry ?? piece.bundle;\n if (typeof declared !== \"string\" || declared === \"\") {\n throw new Error(\n `pieces: \"${piece.name}\" declares neither an entry nor a bundle`,\n );\n }\n const path = isAbsolute(declared) ? declared : join(projectRoot, declared);\n const form = piece.entry ? \"entry\" : \"bundle\";\n const present =\n form === \"entry\"\n ? statSafe(path)?.isFile()\n : statSafe(join(path, \"package.json\"))?.isFile();\n if (!present) {\n throw new Error(\n `pieces: \"${piece.name}\" declares ${declared}, which is missing`,\n );\n }\n const dir = form === \"entry\" ? dirname(path) : path;\n // Both forms, not just `entry`: a descriptor.json is written into this\n // directory, and outside outDir that lands in tracked source.\n const piecesRoot = resolve(projectRoot, outDir, \"node\", \"pieces\");\n const inside = relative(piecesRoot, dir);\n if (inside === \"\" || inside.startsWith(\"..\") || isAbsolute(inside)) {\n const expected = toPosix(join(outDir, \"node\", \"pieces\"));\n throw new Error(\n `pieces: \"${piece.name}\" declares ${declared}, which is outside ${expected}/; ` +\n `a piece is built to ${expected}/<dir>/index.mjs and its entry must point there`,\n );\n }\n return form === \"entry\" ? { dir, entryFile: path, form } : { dir, form };\n}\n\n// Where the node build leaves the list of pieces a package ships. Its presence\n// on disk, not a pieces/<dir> in the source, is what says a package has them.\nexport function pieceListPath(target: {\n projectRoot: string;\n outDir: string;\n}): string {\n return resolve(\n target.projectRoot,\n target.outDir,\n \"node\",\n \"pieces\",\n \"index.mjs\",\n );\n}\n\n// `dist` is not a default here but a contract: a host reads a piece from\n// dist/node/pieces/<name>, and a list entry names that path literally.\nexport function assertPiecesOutDir(target: {\n outDir: string;\n pieces: PiecePlan[];\n}): void {\n if (target.pieces.length === 0 || target.outDir === \"dist\") return;\n throw new Error(\n `pieces: --out-dir ${target.outDir} cannot hold pieces; a piece is loaded from ` +\n `dist/node/pieces/<name> by the host, so a package that ships pieces builds to dist`,\n );\n}\n\n// A piece named after its package must carry the package's version: once\n// published, a drifted version resolves to the wrong tarball.\nexport function assertPieceVersion(\n piece: PackagePiece,\n pkg: PackageIdentity,\n): void {\n if (piece.name === pkg.name && piece.version !== pkg.version) {\n throw new Error(\n `pieces: \"${piece.name}\" declares version ${piece.version}, package.json says ${pkg.version}`,\n );\n }\n}\n\n// The package.json written beside a piece built from an `entry`, giving the\n// directory npm-bundle shape so a registry can serve it on its own.\nexport function piecePackageJson(options: {\n name: string;\n version: string;\n description?: string;\n main: string;\n license?: string;\n}): Record<string, unknown> {\n return {\n name: options.name,\n version: options.version,\n description: options.description ?? \"\",\n type: \"module\",\n main: options.main,\n ...(options.license ? { license: options.license } : {}),\n // Empty on purpose: the runtime treats a bundle that declares dependencies\n // as not self-contained, and everything a piece needs is inlined already.\n dependencies: {},\n };\n}\n\n// The descriptor written beside a piece: the list's name and version, then\n// whatever the piece said about itself, in the framework's PieceMetadata shape.\nexport function pieceDescriptor(\n piece: PackagePiece,\n metadata: PieceMetadata,\n): Record<string, unknown> {\n const { name: _name, version: _version, ...rest } = metadata;\n return { name: piece.name, version: piece.version, ...rest };\n}\n\n// The manifest's `pieces` with what the build learned: a built piece replaces\n// the source entry with its id in place, or is appended at the end.\n\n// A source entry nothing built is kept as it is and returned as `unbuilt`,\n// for the caller to warn about.\nexport function enrichManifestPieces(\n manifest: Manifest,\n built: BuiltPiece[],\n): { manifest: Manifest; unbuilt: string[] } {\n const byId = new Map(built.map((piece) => [piece.name, piece]));\n const toModule = (piece: BuiltPiece): PieceModule => ({\n id: piece.name,\n name: piece.displayName ?? piece.name,\n version: piece.version,\n ...(piece.description ? { description: piece.description } : {}),\n bundle: piece.bundle,\n descriptor: piece.descriptor,\n });\n const unbuilt: string[] = [];\n const seen = new Set<string>();\n const pieces: PieceModule[] = (manifest.pieces ?? []).map((entry) => {\n const hit = byId.get(entry.id);\n if (!hit) {\n unbuilt.push(entry.id);\n return entry;\n }\n seen.add(entry.id);\n return toModule(hit);\n });\n for (const piece of built) {\n if (!seen.has(piece.name)) pieces.push(toModule(piece));\n }\n return { manifest: { ...manifest, pieces }, unbuilt };\n}\n\nconst count = (record: unknown) =>\n typeof record === \"object\" && record !== null\n ? Object.keys(record).length\n : 0;\n\n// Build every planned piece, then read the built list and describe what it\n// names. Returns what was built, for the manifest.\nexport async function buildPieces(\n target: PieceBuildTarget,\n pkg: PackageIdentity,\n options: PieceBuildOptions,\n): Promise<BuiltPiece[]> {\n const { projectRoot, outDir } = target;\n assertPiecesOutDir(target);\n // resolve, not join: an absolute --out-dir is what the browser and node\n // steps hand tsdown, and joining it onto the project root mangles it.\n for (const piece of target.pieces) {\n console.log(`\\n▶ Building piece ${piece.dir}...`);\n await options.bundle(\n buildPieceBuildConfig({\n entry: resolve(projectRoot, piece.entry),\n outDir: resolve(projectRoot, piece.outDir),\n }),\n );\n }\n\n // The list is the source of truth for names and versions; a package that\n // built pieces without a list has nothing a host could read.\n const listPath = pieceListPath(target);\n if (!existsSync(listPath)) {\n throw new Error(\n `pieces: ${toPosix(relative(projectRoot, listPath))} was not built; ` +\n `pieces/index.ts must export the list of pieces this package ships`,\n );\n }\n const described = describePieces(projectRoot, listPath);\n\n const built: BuiltPiece[] = [];\n const listedDirs = new Set<string>();\n for (const piece of described.list) {\n const location = resolvePieceLocation(piece, projectRoot, outDir);\n assertPieceVersion(piece, pkg);\n const failure = described.errors.find((e) => e.name === piece.name);\n if (failure) {\n throw new Error(\n `pieces: \"${piece.name}\" could not be described: ${failure.message}`,\n );\n }\n const found = described.pieces.find((p) => p.name === piece.name);\n if (!found) {\n throw new Error(`pieces: \"${piece.name}\" was not described`);\n }\n const metadata = found.metadata;\n const relDir = toPosix(relative(projectRoot, location.dir));\n listedDirs.add(relDir);\n\n writeFileSync(\n join(location.dir, \"descriptor.json\"),\n JSON.stringify(\n pieceDescriptor(piece, metadata),\n createJsonReplacer(),\n 2,\n ) + \"\\n\",\n );\n if (location.form === \"entry\" && location.entryFile) {\n writeFileSync(\n join(location.dir, \"package.json\"),\n JSON.stringify(\n piecePackageJson({\n name: piece.name,\n version: piece.version,\n description: metadata.description,\n main: relative(location.dir, location.entryFile),\n license: pkg.license,\n }),\n null,\n 2,\n ) + \"\\n\",\n );\n }\n console.log(\n `piece: ${piece.name}@${piece.version} -> ${relDir} ` +\n `(${count(metadata.actions)} actions, ${count(metadata.triggers)} triggers)`,\n );\n built.push({\n name: piece.name,\n version: piece.version,\n displayName: metadata.displayName,\n description: metadata.description,\n bundle: relDir,\n descriptor: `${relDir}/descriptor.json`,\n });\n }\n\n warnUnlistedPieces(target.pieces, listedDirs);\n return built;\n}\n\n// A built piece no list entry points into ships without a host ever finding it.\nfunction warnUnlistedPieces(\n planned: PiecePlan[],\n listedDirs: Set<string>,\n): void {\n for (const piece of planned) {\n if (!listedDirs.has(toPosix(piece.outDir))) {\n console.warn(\n `⚠ pieces: pieces/${piece.dir} was built but pieces/index.ts does not list it; a host will not find it`,\n );\n }\n }\n}\n\n// Make sure the manifest ships under outDir (tsdown copies it only in the\n// browser build) and, when pieces were built, list them in that copy.\n\n// Always copied afresh: only <outDir>/node is cleaned by the builds, so a copy\n// left by the last build would otherwise outlive an edit to the source.\n\n// The source file is never written. Returns the path of the copy, if any.\nexport function syncDistManifest(\n target: PieceBuildTarget,\n built: BuiltPiece[],\n): string | undefined {\n const { projectRoot, outDir } = target;\n const source = join(projectRoot, \"powerhouse.manifest.json\");\n // resolve, not join: an absolute --out-dir is a location, not a suffix.\n const copy = resolve(projectRoot, outDir, \"powerhouse.manifest.json\");\n // The built list, not the source plan: a package whose pieces are all\n // `bundle:` entries has no pieces/<dir> and still ships pieces.\n const shipsPieces = existsSync(pieceListPath(target));\n if (!existsSync(source)) {\n if (shipsPieces) {\n console.warn(\"⚠ no powerhouse.manifest.json; pieces will not be listed\");\n }\n return undefined;\n }\n mkdirSync(dirname(copy), { recursive: true });\n copyFileSync(source, copy);\n if (!shipsPieces) return copy;\n\n const manifest = JSON.parse(readFileSync(copy, \"utf8\")) as Manifest;\n const enriched = enrichManifestPieces(manifest, built);\n for (const id of enriched.unbuilt) {\n console.warn(`⚠ manifest lists piece \"${id}\" but nothing built it`);\n }\n writeFileSync(copy, JSON.stringify(enriched.manifest, null, 2) + \"\\n\");\n return copy;\n}\n"],"mappings":";;;;;;AAiGA,MAAM,WAAW,MAAc,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG;AAEpD,SAAgB,SAAS,GAAW;CAClC,IAAI;EACF,OAAO,SAAS,CAAC;CACnB,QAAQ;EACN,OAAO;CACT;AACF;AAIA,SA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AG,KAAK;CACrD,KAAK,MAAM,MAAM,SAAS,SACxB,QAAQ,KAAK,2BAA2B,GAAG,uBAAuB;CAEpE,cAAc,MAAM,KAAK,UAAU,SAAS,UAAU,MAAM,CAAC,IAAI,IAAI;CACrE,OAAO;AACT"}
@@ -1,5 +1,5 @@
1
1
  //#region clis/command-names.d.ts
2
- declare const phCliCommandNames: readonly ["generate", "vetra", "connect", "build", "publish", "list", "l", "access-token", "registry-login", "inspect", "is", "migrate", "switchboard", "reactor", "login", "logout", "install", "add", "i", "uninstall", "remove"];
2
+ export declare const phCliCommandNames: readonly ["generate", "vetra", "connect", "build", "publish", "list", "l", "access-token", "registry-login", "inspect", "is", "migrate", "switchboard", "reactor", "login", "logout", "install", "add", "i", "uninstall", "remove"];
3
3
  //#endregion
4
- export { phCliCommandNames };
4
+ export {};
5
5
  //# sourceMappingURL=command-names.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command-names.d.mts","names":[],"sources":["../../clis/command-names.ts"],"mappings":";cAEa,iBAAA"}
1
+ {"version":3,"file":"command-names.d.mts","names":[],"sources":["../../clis/command-names.ts"],"mappings":";qBAEa"}
@@ -1 +1 @@
1
- {"version":3,"file":"command-names.mjs","names":[],"sources":["../../clis/command-names.ts"],"sourcesContent":["// Hardcoded so ph-cmd's dispatch doesn't have to evaluate phCliHelpCommands.\n// The compile-time guard in args/help.ts catches drift.\nexport const phCliCommandNames = [\n \"generate\",\n \"vetra\",\n \"connect\",\n \"build\",\n \"publish\",\n \"list\",\n \"l\",\n \"access-token\",\n \"registry-login\",\n \"inspect\",\n \"is\",\n \"migrate\",\n \"switchboard\",\n \"reactor\",\n \"login\",\n \"logout\",\n \"install\",\n \"add\",\n \"i\",\n \"uninstall\",\n \"remove\",\n] as const;\n"],"mappings":";AAEA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
1
+ {"version":3,"file":"command-names.mjs","names":[],"sources":["../../clis/command-names.ts"],"sourcesContent":["// Hardcoded so ph-cmd's dispatch doesn't have to evaluate phCliHelpCommands.\n// The compile-time guard in args/help.ts catches drift.\nexport const phCliCommandNames = [\n \"generate\",\n \"vetra\",\n \"connect\",\n \"build\",\n \"publish\",\n \"list\",\n \"l\",\n \"access-token\",\n \"registry-login\",\n \"inspect\",\n \"is\",\n \"migrate\",\n \"switchboard\",\n \"reactor\",\n \"login\",\n \"logout\",\n \"install\",\n \"add\",\n \"i\",\n \"uninstall\",\n \"remove\",\n] as const;\n"],"mappings":";AAEA,MAAa,oBAAoB;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
@@ -1,2 +1,3 @@
1
- import { A as PIECES_FRAMEWORK_PACKAGE, B as VERSIONED_DEPENDENCIES, C as LEGACY_LINT_FORMAT_FILES, D as PH_BIN, E as PEER_EXTERNAL_DEPENDENCIES, F as PROJECT_PORT_BAND_SWITCHBOARD, G as externalDevDependencies, H as VERSIONED_PEER_DEPENDENCIES, I as PROJECT_PORT_BAND_VETRA_CONNECT, K as packageJsonExports, L as REACTOR_API_PACKAGE, M as POWERHOUSE_GLOBAL_DIR, N as PROJECT_PORT_BAND_SIZE, O as PH_GLOBAL_DIR_NAME, P as PROJECT_PORT_BAND_STUDIO, R as SECONDS_IN_DAY, S as LEGACY_LINT_FORMAT_DEPENDENCIES, T as MINIMUM_NODE_VERSION, U as defaultManifest, V as VERSIONED_DEV_DEPENDENCIES, W as externalDependencies, _ as DRIVES_PRESERVE_STRATEGIES, a as DEFAULT_CONFIG, b as GRAPHQL_TAG_PACKAGE, c as DEFAULT_CONNECT_STUDIO_PORT, d as DEFAULT_REGISTRY_URL, f as DEFAULT_RENOWN_URL, g as DEFAULT_VETRA_DRIVE_ID, h as DEFAULT_VETRA_CONNECT_PORT, i as BOILERPLATE_DEPENDENCY_OVERRIDES, j as POWERHOUSE_CONFIG_FILE, k as PH_GLOBAL_PROJECT_NAME, l as DEFAULT_EXPIRY_DAYS, m as DEFAULT_TIMEOUT, n as ANALYTICS_ENGINE_CORE_PACKAGE, o as DEFAULT_CONNECT_OUTDIR, p as DEFAULT_SWITCHBOARD_PORT, q as packageScripts, r as BOILERPLATE_ALLOWED_BUILDS, s as DEFAULT_CONNECT_PREVIEW_PORT, u as DEFAULT_EXPIRY_SECONDS, v as FEATURE_DEPENDENCIES, w as LOG_LEVELS, x as HOME_DIR, y as GRAPHQL_PACKAGE, z as SERVICE_ACTIONS } from "./types-DXhVHupa.mjs";
2
- export { ANALYTICS_ENGINE_CORE_PACKAGE, BOILERPLATE_ALLOWED_BUILDS, BOILERPLATE_DEPENDENCY_OVERRIDES, DEFAULT_CONFIG, DEFAULT_CONNECT_OUTDIR, DEFAULT_CONNECT_PREVIEW_PORT, DEFAULT_CONNECT_STUDIO_PORT, DEFAULT_EXPIRY_DAYS, DEFAULT_EXPIRY_SECONDS, DEFAULT_REGISTRY_URL, DEFAULT_RENOWN_URL, DEFAULT_SWITCHBOARD_PORT, DEFAULT_TIMEOUT, DEFAULT_VETRA_CONNECT_PORT, DEFAULT_VETRA_DRIVE_ID, DRIVES_PRESERVE_STRATEGIES, FEATURE_DEPENDENCIES, GRAPHQL_PACKAGE, GRAPHQL_TAG_PACKAGE, HOME_DIR, LEGACY_LINT_FORMAT_DEPENDENCIES, LEGACY_LINT_FORMAT_FILES, LOG_LEVELS, MINIMUM_NODE_VERSION, PEER_EXTERNAL_DEPENDENCIES, PH_BIN, PH_GLOBAL_DIR_NAME, PH_GLOBAL_PROJECT_NAME, PIECES_FRAMEWORK_PACKAGE, POWERHOUSE_CONFIG_FILE, POWERHOUSE_GLOBAL_DIR, PROJECT_PORT_BAND_SIZE, PROJECT_PORT_BAND_STUDIO, PROJECT_PORT_BAND_SWITCHBOARD, PROJECT_PORT_BAND_VETRA_CONNECT, REACTOR_API_PACKAGE, SECONDS_IN_DAY, SERVICE_ACTIONS, VERSIONED_DEPENDENCIES, VERSIONED_DEV_DEPENDENCIES, VERSIONED_PEER_DEPENDENCIES, defaultManifest, externalDependencies, externalDevDependencies, packageJsonExports, packageScripts };
1
+ import { A as PIECES_FRAMEWORK_PACKAGE, B as VERSIONED_DEPENDENCIES, C as LEGACY_LINT_FORMAT_FILES, D as PH_BIN, E as PEER_EXTERNAL_DEPENDENCIES, F as PROJECT_PORT_BAND_SWITCHBOARD, G as externalDevDependencies, H as VERSIONED_PEER_DEPENDENCIES, I as PROJECT_PORT_BAND_VETRA_CONNECT, K as packageJsonExports, L as REACTOR_API_PACKAGE, M as POWERHOUSE_GLOBAL_DIR, N as PROJECT_PORT_BAND_SIZE, O as PH_GLOBAL_DIR_NAME, P as PROJECT_PORT_BAND_STUDIO, R as SECONDS_IN_DAY, S as LEGACY_LINT_FORMAT_DEPENDENCIES, T as MINIMUM_NODE_VERSION, U as defaultManifest, V as VERSIONED_DEV_DEPENDENCIES, W as externalDependencies, _ as DRIVES_PRESERVE_STRATEGIES, a as DEFAULT_CONFIG, b as GRAPHQL_TAG_PACKAGE, c as DEFAULT_CONNECT_STUDIO_PORT, d as DEFAULT_REGISTRY_URL, f as DEFAULT_RENOWN_URL, g as DEFAULT_VETRA_DRIVE_ID, h as DEFAULT_VETRA_CONNECT_PORT, i as BOILERPLATE_DEPENDENCY_OVERRIDES, j as POWERHOUSE_CONFIG_FILE, k as PH_GLOBAL_PROJECT_NAME, l as DEFAULT_EXPIRY_DAYS, m as DEFAULT_TIMEOUT, n as ANALYTICS_ENGINE_CORE_PACKAGE, o as DEFAULT_CONNECT_OUTDIR, p as DEFAULT_SWITCHBOARD_PORT, q as packageScripts, r as BOILERPLATE_ALLOWED_BUILDS, s as DEFAULT_CONNECT_PREVIEW_PORT, u as DEFAULT_EXPIRY_SECONDS, v as FEATURE_DEPENDENCIES, w as LOG_LEVELS, x as HOME_DIR, y as GRAPHQL_PACKAGE, z as SERVICE_ACTIONS } from "./types-CMFHKrgv.mjs";
2
+ export { ANALYTICS_ENGINE_CORE_PACKAGE, BOILERPLATE_ALLOWED_BUILDS, BOILERPLATE_DEPENDENCY_OVERRIDES, DEFAULT_CONFIG, DEFAULT_CONNECT_OUTDIR, DEFAULT_CONNECT_PREVIEW_PORT, DEFAULT_CONNECT_STUDIO_PORT, DEFAULT_EXPIRY_DAYS, DEFAULT_EXPIRY_SECONDS, DEFAULT_REGISTRY_URL, DEFAULT_RENOWN_URL, DEFAULT_SWITCHBOARD_PORT, DEFAULT_TIMEOUT, DEFAULT_VETRA_CONNECT_PORT, DEFAULT_VETRA_DRIVE_ID, DRIVES_PRESERVE_STRATEGIES, FEATURE_DEPENDENCIES, GRAPHQL_PACKAGE, GRAPHQL_TAG_PACKAGE, HOME_DIR, LEGACY_LINT_FORMAT_DEPENDENCIES, LEGACY_LINT_FORMAT_FILES, LOG_LEVELS, MINIMUM_NODE_VERSION, PEER_EXTERNAL_DEPENDENCIES, PH_BIN, PH_GLOBAL_DIR_NAME, PH_GLOBAL_PROJECT_NAME, PIECES_FRAMEWORK_PACKAGE, POWERHOUSE_CONFIG_FILE, POWERHOUSE_GLOBAL_DIR, PROJECT_PORT_BAND_SIZE, PROJECT_PORT_BAND_STUDIO, PROJECT_PORT_BAND_SWITCHBOARD, PROJECT_PORT_BAND_VETRA_CONNECT, REACTOR_API_PACKAGE, SECONDS_IN_DAY, SERVICE_ACTIONS, VERSIONED_DEPENDENCIES, VERSIONED_DEV_DEPENDENCIES, VERSIONED_PEER_DEPENDENCIES, defaultManifest, externalDependencies, externalDevDependencies, packageJsonExports, packageScripts };
3
+ export {};