@visulima/vis 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE.md +5760 -4562
  3. package/dashboard/dist/index.html +12 -12
  4. package/dist/bin.js +1 -1
  5. package/dist/binx.js +2 -2
  6. package/dist/config/index.js +1 -1
  7. package/dist/packem_chunks/CONFIG_FILES.js +6 -6
  8. package/dist/packem_chunks/DEFAULT_CLEAN_KEEP.js +1 -1
  9. package/dist/packem_chunks/agent-instructions.js +7 -7
  10. package/dist/packem_chunks/bloom-status.js +2 -2
  11. package/dist/packem_chunks/bloom-sync.js +2 -2
  12. package/dist/packem_chunks/cache-attestation.js +1 -1
  13. package/dist/packem_chunks/catalog-detector.js +1 -1
  14. package/dist/packem_chunks/catalog.js +87 -111
  15. package/dist/packem_chunks/cli-exec.js +1 -1
  16. package/dist/packem_chunks/cli-main.js +192 -217
  17. package/dist/packem_chunks/defineReleasePlugin.js +3 -3
  18. package/dist/packem_chunks/detect.js +8 -3
  19. package/dist/packem_chunks/devtools.js +1 -1
  20. package/dist/packem_chunks/discord.js +4 -4
  21. package/dist/packem_chunks/dispatch.js +4 -4
  22. package/dist/packem_chunks/doctor-probe.js +2 -2
  23. package/dist/packem_chunks/extra-files.js +3 -3
  24. package/dist/packem_chunks/fix.js +11 -11
  25. package/dist/packem_chunks/git.js +3 -3
  26. package/dist/packem_chunks/group-tags.js +1 -1
  27. package/dist/packem_chunks/handler.js +1 -1
  28. package/dist/packem_chunks/handler10.js +5 -5
  29. package/dist/packem_chunks/handler11.js +1 -1
  30. package/dist/packem_chunks/handler12.js +16 -16
  31. package/dist/packem_chunks/handler13.js +5 -5
  32. package/dist/packem_chunks/handler14.js +1 -1
  33. package/dist/packem_chunks/handler15.js +1 -1
  34. package/dist/packem_chunks/handler16.js +1 -1
  35. package/dist/packem_chunks/handler17.js +1 -1
  36. package/dist/packem_chunks/handler18.js +1 -1
  37. package/dist/packem_chunks/handler19.js +5 -5
  38. package/dist/packem_chunks/handler2.js +1 -1
  39. package/dist/packem_chunks/handler20.js +2 -2
  40. package/dist/packem_chunks/handler21.js +2 -2
  41. package/dist/packem_chunks/handler22.js +8 -8
  42. package/dist/packem_chunks/handler23.js +1 -1
  43. package/dist/packem_chunks/handler24.js +1 -1
  44. package/dist/packem_chunks/handler25.js +1 -1
  45. package/dist/packem_chunks/handler26.js +5 -5
  46. package/dist/packem_chunks/handler27.js +1 -1
  47. package/dist/packem_chunks/handler28.js +3 -3
  48. package/dist/packem_chunks/handler29.js +1 -1
  49. package/dist/packem_chunks/handler3.js +2 -2
  50. package/dist/packem_chunks/handler30.js +1 -1
  51. package/dist/packem_chunks/handler31.js +2 -2
  52. package/dist/packem_chunks/handler32.js +2 -2
  53. package/dist/packem_chunks/handler33.js +2 -2
  54. package/dist/packem_chunks/handler34.js +3 -3
  55. package/dist/packem_chunks/handler35.js +5 -5
  56. package/dist/packem_chunks/handler36.js +1 -1
  57. package/dist/packem_chunks/handler37.js +2 -2
  58. package/dist/packem_chunks/handler38.js +6 -6
  59. package/dist/packem_chunks/handler39.js +8 -8
  60. package/dist/packem_chunks/handler4.js +4 -4
  61. package/dist/packem_chunks/handler40.js +34 -34
  62. package/dist/packem_chunks/handler41.js +5 -5
  63. package/dist/packem_chunks/handler42.js +4 -4
  64. package/dist/packem_chunks/handler43.js +3 -3
  65. package/dist/packem_chunks/handler44.js +2 -2
  66. package/dist/packem_chunks/handler45.js +1 -1
  67. package/dist/packem_chunks/handler46.js +1 -1
  68. package/dist/packem_chunks/handler47.js +1 -1
  69. package/dist/packem_chunks/handler48.js +3 -3
  70. package/dist/packem_chunks/handler49.js +1 -1
  71. package/dist/packem_chunks/handler5.js +6 -6
  72. package/dist/packem_chunks/handler50.js +6 -6
  73. package/dist/packem_chunks/handler51.js +13 -13
  74. package/dist/packem_chunks/handler52.js +3 -3
  75. package/dist/packem_chunks/handler53.js +5 -5
  76. package/dist/packem_chunks/handler54.js +2 -2
  77. package/dist/packem_chunks/handler55.js +1 -1
  78. package/dist/packem_chunks/handler56.js +4 -4
  79. package/dist/packem_chunks/handler57.js +5 -5
  80. package/dist/packem_chunks/handler58.js +5 -5
  81. package/dist/packem_chunks/handler59.js +8 -8
  82. package/dist/packem_chunks/handler6.js +7 -7
  83. package/dist/packem_chunks/handler60.js +3 -3
  84. package/dist/packem_chunks/handler61.js +21 -21
  85. package/dist/packem_chunks/handler62.js +12 -12
  86. package/dist/packem_chunks/handler63.js +3 -3
  87. package/dist/packem_chunks/handler64.js +5 -5
  88. package/dist/packem_chunks/handler65.js +8 -8
  89. package/dist/packem_chunks/handler66.js +2 -2
  90. package/dist/packem_chunks/handler67.js +25 -24
  91. package/dist/packem_chunks/handler68.js +153 -25
  92. package/dist/packem_chunks/handler69.js +10 -153
  93. package/dist/packem_chunks/handler7.js +1 -1
  94. package/dist/packem_chunks/handler70.js +22 -10
  95. package/dist/packem_chunks/handler71.js +17 -17
  96. package/dist/packem_chunks/handler72.js +104 -104
  97. package/dist/packem_chunks/handler73.js +20 -20
  98. package/dist/packem_chunks/handler74.js +45 -45
  99. package/dist/packem_chunks/handler75.js +27 -3
  100. package/dist/packem_chunks/handler76.js +3 -27
  101. package/dist/packem_chunks/handler77.js +68 -68
  102. package/dist/packem_chunks/handler78.js +30 -30
  103. package/dist/packem_chunks/handler8.js +1 -1
  104. package/dist/packem_chunks/handler9.js +1 -1
  105. package/dist/packem_chunks/heal-accept.js +9 -9
  106. package/dist/packem_chunks/heal.js +11 -11
  107. package/dist/packem_chunks/help-command.js +7 -63
  108. package/dist/packem_chunks/index.js +1 -1
  109. package/dist/packem_chunks/index2.js +48 -804
  110. package/dist/packem_chunks/index3.js +3 -7
  111. package/dist/packem_chunks/index4.js +801 -134
  112. package/dist/packem_chunks/index5.js +7 -73
  113. package/dist/packem_chunks/index6.js +73 -0
  114. package/dist/packem_chunks/index7.js +135 -0
  115. package/dist/packem_chunks/interface.js +2 -2
  116. package/dist/packem_chunks/keys-refresh.js +4 -4
  117. package/dist/packem_chunks/lean.js +3 -3
  118. package/dist/packem_chunks/list.js +3 -3
  119. package/dist/packem_chunks/loader.js +4 -4
  120. package/dist/packem_chunks/loader2.js +1 -1
  121. package/dist/packem_chunks/orchestrator.js +27 -27
  122. package/dist/packem_chunks/pre-mode.js +2 -2
  123. package/dist/packem_chunks/print-config.js +1 -1
  124. package/dist/packem_chunks/prompts.js +7 -7
  125. package/dist/packem_chunks/prune.js +3 -3
  126. package/dist/packem_chunks/publish-guards.js +1 -1
  127. package/dist/packem_chunks/resolveFormatter.js +5 -5
  128. package/dist/packem_chunks/run.js +1 -1
  129. package/dist/packem_chunks/security.js +1 -1
  130. package/dist/packem_chunks/shell-runner.js +1 -1
  131. package/dist/packem_chunks/slack.js +2 -2
  132. package/dist/packem_chunks/snapshot.js +2 -2
  133. package/dist/packem_chunks/stage-publisher.js +1 -1
  134. package/dist/packem_chunks/staged-registry.js +2 -2
  135. package/dist/packem_chunks/state.js +3 -3
  136. package/dist/packem_chunks/status.js +2 -2
  137. package/dist/packem_chunks/success-walk.js +4 -4
  138. package/dist/packem_chunks/sync.js +2 -2
  139. package/dist/packem_chunks/sync2.js +2 -2
  140. package/dist/packem_chunks/tar.js +3 -3
  141. package/dist/packem_chunks/tripwire.js +2 -2
  142. package/dist/packem_chunks/ts-loader.js +5 -9
  143. package/dist/packem_chunks/verify-lockfile.js +2 -2
  144. package/dist/packem_chunks/version-resolver.js +2 -2
  145. package/dist/packem_chunks/webhook.js +1 -1
  146. package/dist/packem_chunks/workflow-templates.js +5 -5
  147. package/dist/packem_chunks/workspace.js +2 -2
  148. package/dist/packem_shared/ReleaseClient-DAvbxCdo.js +1 -0
  149. package/dist/packem_shared/Table-DyORjLji-CC9cYgCG.js +11 -0
  150. package/dist/packem_shared/{VisReleaseError-DMGRBTNO.js → VisReleaseError-DZtgcKf8.js} +1 -1
  151. package/dist/packem_shared/_commonjsHelpers-DTfxOvZk.js +1 -0
  152. package/dist/packem_shared/advisories-DZd1uGqa.js +1 -0
  153. package/dist/packem_shared/affected-selection-CoRXp5H4.js +1 -0
  154. package/dist/packem_shared/affected-shas-Dd0P7fGD.js +1 -0
  155. package/dist/packem_shared/ai-analysis-DSQQDFU9.js +68 -0
  156. package/dist/packem_shared/ai-fix-6nXZbecQ.js +43 -0
  157. package/dist/packem_shared/augment-COAiXSIx.js +4 -0
  158. package/dist/packem_shared/bin-C2eYtJ_N.js +1 -0
  159. package/dist/packem_shared/build-scripts-pdVmqXRm.js +1 -0
  160. package/dist/packem_shared/clean-DRiLimTx.js +1 -0
  161. package/dist/packem_shared/command-runtime-CiLVo4ED.js +1 -0
  162. package/dist/packem_shared/{compile-cache-B_Vf_WxT.js → compile-cache-DoMHRsRZ.js} +1 -1
  163. package/dist/packem_shared/createAdapter-F7GidOzU.js +1 -0
  164. package/dist/packem_shared/createVersionActions-ByaJ1Nbv.js +1 -0
  165. package/dist/packem_shared/cyclonedx-B1vzerwP.js +4 -0
  166. package/dist/packem_shared/dependency-scan-DBH2Qo4I.js +1 -0
  167. package/dist/packem_shared/docker-Bex05Qcn.js +59 -0
  168. package/dist/packem_shared/failure-log-D92tM0ie.js +2 -0
  169. package/dist/packem_shared/formatBytes-BHAzNIrn-DFIppnY0.js +4 -0
  170. package/dist/packem_shared/getRandomSpinner-4ZEcbTYv-DCyIuj19.js +1 -0
  171. package/dist/packem_shared/giget-D8Kwb0kD.js +2 -0
  172. package/dist/packem_shared/glob-Cyk1H9ZL-ox19CSsT.js +1 -0
  173. package/dist/packem_shared/index-B4AjSxHU.js +1 -0
  174. package/dist/packem_shared/index-BisalDCf.js +39 -0
  175. package/dist/packem_shared/{index-BWl4DbMp.js → index-BjdW45xX.js} +1 -1
  176. package/dist/packem_shared/index-DHD8wb6Z.js +22 -0
  177. package/dist/packem_shared/index-DXPSWMbG.js +1 -0
  178. package/dist/packem_shared/index.server-BAjDJSEu.js +2 -0
  179. package/dist/packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js +1 -0
  180. package/dist/packem_shared/license-DvlYdo6T.js +1 -0
  181. package/dist/packem_shared/lifecycle-CfTZQHOG.js +2 -0
  182. package/dist/packem_shared/lockfile-35RFsJDs.js +1 -0
  183. package/dist/packem_shared/lockfile-DhHAaHN5.js +1 -0
  184. package/dist/packem_shared/main-BP-w-K-6.js +1 -0
  185. package/dist/packem_shared/manifests-BNSmpPF_.js +1 -0
  186. package/dist/packem_shared/min-release-age-ChzTC7_I.js +34 -0
  187. package/dist/packem_shared/missing-package-json-C0keIt78.js +1 -0
  188. package/dist/packem_shared/native-config-sync-BSzU4qUO.js +21 -0
  189. package/dist/packem_shared/osv-bloom-1JS__1or.js +2 -0
  190. package/dist/packem_shared/otelPlugin-D8LL2-4L.js +1 -0
  191. package/dist/packem_shared/package-version-Bb7KGF36.js +4 -0
  192. package/dist/packem_shared/packument-C55kVxcQ.js +1 -0
  193. package/dist/packem_shared/{peer-warnings-BXAzXqY3.js → peer-warnings-CmYSxvql.js} +1 -1
  194. package/dist/packem_shared/pm-runner-de-jCq8q.js +1 -0
  195. package/dist/packem_shared/project-name-filter-DYaIbrXa.js +7 -0
  196. package/dist/packem_shared/{prompt-BSAy8SMH.js → prompt-DMzaQEVa.js} +1 -1
  197. package/dist/packem_shared/provenance-CvfQEJPQ.js +1 -0
  198. package/dist/packem_shared/readJsonSync-CbryXYxN-B2aSeDpC.js +1 -0
  199. package/dist/packem_shared/registry-keys-DmBrAlhg.js +1 -0
  200. package/dist/packem_shared/resolve-explicit-DYaHAVDg.js +5 -0
  201. package/dist/packem_shared/resolve-runtime-C7NBCA1C.js +1 -0
  202. package/dist/packem_shared/run-file-jMngGQhs.js +1 -0
  203. package/dist/packem_shared/runtime-check-BklgEMkC.js +1 -0
  204. package/dist/packem_shared/s1ngularity-C8sva2SO.js +1 -0
  205. package/dist/packem_shared/scan-progress-aVHGZYWf.js +2 -0
  206. package/dist/packem_shared/selectors-B7lSFz7l.js +3 -0
  207. package/dist/packem_shared/signatures-oZ_2IneN.js +2 -0
  208. package/dist/packem_shared/{slug-DoueYuLo.js → slug-OBHcH7wV.js} +1 -1
  209. package/dist/packem_shared/spinner-CbJfWYwB.js +1 -0
  210. package/dist/packem_shared/sticky-comment-DjhyCIZt.js +1 -0
  211. package/dist/packem_shared/subtree-DtmcKAJK.js +2 -0
  212. package/dist/packem_shared/symbols-BXDZ_sKt.js +1 -0
  213. package/dist/packem_shared/tabs-BilwonkM.js +1 -0
  214. package/dist/packem_shared/target-merge-DCGow6Kw.js +4 -0
  215. package/dist/packem_shared/target-options-d_rIrLyq.js +1 -0
  216. package/dist/packem_shared/toolchain-DY11tPCw.js +5 -0
  217. package/dist/packem_shared/typosquats-Cdsnf6aN.js +1 -0
  218. package/dist/packem_shared/use-measured-height-BPQg2q_p.js +1 -0
  219. package/dist/packem_shared/utils-DQFHJn72.js +1 -0
  220. package/dist/packem_shared/verify-D8wYvB85.js +1 -0
  221. package/dist/packem_shared/vis-update-app-ngwL2mRv.js +1 -0
  222. package/dist/packem_shared/vis-user-error-CAu9wIbe.js +30 -0
  223. package/dist/packem_shared/watch-Dswvj6Zp.js +1 -0
  224. package/dist/packem_shared/watch-loop-COWvvSbR.js +11 -0
  225. package/dist/packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js +1 -0
  226. package/dist/release/core/changelog/index.d.ts +62 -2
  227. package/dist/release/core/package-managers/index.d.ts +25 -1
  228. package/dist/release/core/package-managers/index.js +1 -1
  229. package/dist/release/core/version-actions/index.d.ts +47 -2
  230. package/dist/release/core/version-actions/index.js +1 -1
  231. package/dist/release/index.d.ts +100 -1
  232. package/dist/release/index.js +1 -1
  233. package/dist/release/plugin-sdk.d.ts +16 -1
  234. package/dist/release/plugin-sdk.js +1 -1
  235. package/dist/release/presets.js +1 -1
  236. package/dist/release/types.js +1 -1
  237. package/dist/runtime/preload.js +1 -1
  238. package/index.js +26 -26
  239. package/package.json +14 -14
  240. package/dist/packem_chunks/detect2.js +0 -8
  241. package/dist/packem_chunks/registry.js +0 -48
  242. package/dist/packem_shared/ReleaseClient-BY4OZNCK.js +0 -1
  243. package/dist/packem_shared/_commonjsHelpers-B5Y90VFO.js +0 -1
  244. package/dist/packem_shared/advisories-DsXRmIA5.js +0 -1
  245. package/dist/packem_shared/affected-selection-BE6VFCDV.js +0 -1
  246. package/dist/packem_shared/affected-shas-BKEu4RZc.js +0 -1
  247. package/dist/packem_shared/ai-analysis-DikAj6rX.js +0 -68
  248. package/dist/packem_shared/ai-fix-bfWo0cZX.js +0 -43
  249. package/dist/packem_shared/augment-BkJxi_GW.js +0 -4
  250. package/dist/packem_shared/bin-B-TytgzW.js +0 -1
  251. package/dist/packem_shared/build-scripts-DWypBQ--.js +0 -1
  252. package/dist/packem_shared/clean-DWjQl14S.js +0 -1
  253. package/dist/packem_shared/command-runtime-DQ7ZpLYL.js +0 -1
  254. package/dist/packem_shared/createAdapter-bU4DIP3F.js +0 -1
  255. package/dist/packem_shared/createVersionActions-BK43SNDH.js +0 -1
  256. package/dist/packem_shared/cyclonedx-DLBi65MV.js +0 -4
  257. package/dist/packem_shared/dependency-scan-ZLOuLkGN.js +0 -1
  258. package/dist/packem_shared/docker-B4zAZCZG.js +0 -59
  259. package/dist/packem_shared/en-BDYMmM2_.js +0 -27
  260. package/dist/packem_shared/failure-log-DyhWPqno.js +0 -2
  261. package/dist/packem_shared/giget-CAxjpwew.js +0 -2
  262. package/dist/packem_shared/glob-BUjyjdE8-Dp_QcayW.js +0 -1
  263. package/dist/packem_shared/index-BAe6e0XE.js +0 -1
  264. package/dist/packem_shared/index-BLtnel38.js +0 -35
  265. package/dist/packem_shared/index-CuKDxOCI.js +0 -1
  266. package/dist/packem_shared/index-tNFGWxc0.js +0 -39
  267. package/dist/packem_shared/index.server-CusjRLCh.js +0 -2
  268. package/dist/packem_shared/license-t5KnNX6v.js +0 -1
  269. package/dist/packem_shared/lifecycle-KY9umOg6.js +0 -2
  270. package/dist/packem_shared/lockfile-YAuZf1gh.js +0 -1
  271. package/dist/packem_shared/main-D_cam4hv.js +0 -1
  272. package/dist/packem_shared/manifests-BwTn_1ad.js +0 -1
  273. package/dist/packem_shared/min-release-age-6avfn81h.js +0 -34
  274. package/dist/packem_shared/missing-package-json-Cl0vdz6K.js +0 -1
  275. package/dist/packem_shared/native-config-sync-CHMCJx7H.js +0 -21
  276. package/dist/packem_shared/osv-bloom-DdqDnLCt.js +0 -2
  277. package/dist/packem_shared/otelPlugin-DmKDBaPo.js +0 -1
  278. package/dist/packem_shared/package-version-BNRJ3o9C.js +0 -4
  279. package/dist/packem_shared/packument-B9-WqReu.js +0 -1
  280. package/dist/packem_shared/pm-runner-DRybtzOV.js +0 -1
  281. package/dist/packem_shared/project-name-filter-Dw0fC6IO.js +0 -7
  282. package/dist/packem_shared/provenance-CLxuqCfL.js +0 -1
  283. package/dist/packem_shared/readJsonSync-DweZd5ZA-CtrDlqpb.js +0 -1
  284. package/dist/packem_shared/registry-keys-cTN24144.js +0 -1
  285. package/dist/packem_shared/resolve-explicit-Uw6WQl9R.js +0 -5
  286. package/dist/packem_shared/resolve-runtime-DztanwkZ.js +0 -1
  287. package/dist/packem_shared/run-file-CaE5_xBY.js +0 -1
  288. package/dist/packem_shared/runtime-check-C32yE57I.js +0 -1
  289. package/dist/packem_shared/s1ngularity-BIYhg82u.js +0 -1
  290. package/dist/packem_shared/scan-progress-DWfY4zkp.js +0 -2
  291. package/dist/packem_shared/selectors-D2j4M9Ul.js +0 -3
  292. package/dist/packem_shared/signatures-C8iQ5fUq.js +0 -2
  293. package/dist/packem_shared/sticky-comment-D6_7-w8T.js +0 -1
  294. package/dist/packem_shared/subtree-DSm0QEoE.js +0 -2
  295. package/dist/packem_shared/symbols-DPTlrJ3B.js +0 -1
  296. package/dist/packem_shared/target-merge-DLxJTcxn.js +0 -11
  297. package/dist/packem_shared/target-options-3t4-2F-F.js +0 -1
  298. package/dist/packem_shared/toolchain-BPzbahcQ.js +0 -5
  299. package/dist/packem_shared/typosquats-BWrmhh36.js +0 -1
  300. package/dist/packem_shared/use-measured-height-BwAwGHjw.js +0 -1
  301. package/dist/packem_shared/utils-CRueU43T.js +0 -1
  302. package/dist/packem_shared/verify-CzUPT6Uk.js +0 -1
  303. package/dist/packem_shared/vis-update-app-D6Wq8ZHM.js +0 -1
  304. package/dist/packem_shared/vis-user-error-CfM4_ORo.js +0 -30
  305. package/dist/packem_shared/watch-D_oAxW_Z.js +0 -1
  306. package/dist/packem_shared/watch-loop-BrjblOz5.js +0 -11
@@ -1,7 +1,3 @@
1
- import{b as U,w as z,a as H,e as K,z as $}from"../packem_shared/index-BLtnel38.js";import{b as X}from"../packem_shared/index-tNFGWxc0.js";import{p as Z}from"./cli-main.js";import{k as I,W as A,j as x}from"../packem_shared/en-BDYMmM2_.js";const ee=(e,t)=>typeof e!="string"||e===""?"":e[0].toLowerCase()+e.slice(1),k=(e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleUpperCase(t.locale):e[0].toUpperCase())+e.slice(1),te=(e,t)=>`${e}::${t?.joiner??""}::${t?.locale??""}::${t?.knownAcronyms?.join(",")??""}::${t?.normalize?"true":"false"}::${t?.stripAnsi?"true":"false"}::${t?.stripEmoji?"true":"false"}::${t?.handleAnsi?"true":"false"}::${t?.handleEmoji?"true":"false"}`,j=(e,t)=>{const{length:r}=e;if(r===0)return"";if(r===1)return e[0];const n=[];let o="",s="";for(let i=0;i<r;i++){const l=e[i];if(I.test(l)){o?(n.push(o+s+l),o="",s=""):(n.length>0&&n.push(t),o=l);continue}o?(s&&(s+=t),s+=l):(n.length>0&&n.push(t),n.push(l))}return n.join("")},ne=/(?<![a-zß])SS(?![a-z])/g,re=e=>e.replaceAll(ne,"ß"),oe=(e,t)=>{if(typeof e!="string"||!e)return"";let r=!0;return j(A(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(o=>{const s=o,i=s.toLowerCase();return r?(r=!1,ee(i)):k(i,t)}),"")},se=new x(1e3),S=(e,t)=>{if(typeof e!="string")return"";const r=t?.cache??!1,n=t?.cacheStore??se;let o;if(r&&(o=te(e,t)),r&&o&&n.has(o))return n.get(o);const s=A(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(l=>{if(t?.handleAnsi&&I.test(l))return l;if(t?.toUpperCase)return t.locale?l.toLocaleUpperCase(t.locale):l.toUpperCase();const a=t?.locale?.startsWith("de")?re(l):l;return t?.locale?a.toLocaleLowerCase(t.locale):a.toLowerCase()}),i=j(s,t?.joiner??"-");return r&&o&&n.set(o,i),i},ie=new x(1e3),le=(e,t)=>S(e,{cacheStore:ie,...t,joiner:"_",toUpperCase:!0}),ae=(e,t)=>typeof e!="string"||!e?"":j(A(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(n=>k(n.toLowerCase(),{locale:t?.locale})),""),ce=new x(1e3),fe=(e,t)=>S(e,{cacheStore:ce,...t,joiner:"_"}),ue=(e,t)=>typeof e!="string"?"":j(A(e,{handleAnsi:t?.handleAnsi,handleEmoji:t?.handleEmoji,knownAcronyms:t?.knownAcronyms,locale:t?.locale,normalize:t?.normalize,separators:void 0,stripAnsi:t?.stripAnsi,stripEmoji:t?.stripEmoji}).map(n=>k(n,{locale:t?.locale})),"-"),m=e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),T={camel_case:e=>oe(m(e)),kebab_case:e=>S(m(e)),lower_case:e=>m(e).toLowerCase(),pascal_case:e=>ae(m(e)),path_join:(e,...t)=>{const r=[m(e),...t.map(n=>m(n))];return z(...r)},path_relative:(e,t)=>U(m(t),m(e)),snake_case:e=>fe(m(e)),upper_case:e=>m(e).toUpperCase(),upper_kebab_case:e=>ue(m(e)),upper_snake_case:e=>le(m(e))},N=(e,t,r=[])=>{const n=T[e];if(!n)throw new Error(`Unknown filter "${e}". Known filters: ${Object.keys(T).sort().join(", ")}.`);return n(t,...r)},R=e=>{const t=[];let r=0,n=0,o,s=-1;for(const i of e){if(s+=1,o){i===o&&(o=void 0);continue}if(i==='"'||i==="'"){o=i;continue}i==="("?r+=1:i===")"?r-=1:i===","&&r===0&&(t.push(e.slice(n,s)),n=s+1)}return t.push(e.slice(n)),t},pe=e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},me=/\[([^\]]+)\]/g,de=e=>{const t=e.trim(),r=t.indexOf("(");if(r===-1)return{args:[],name:t};if(!t.endsWith(")"))throw new Error(`Filter call "${e}" missing closing ")"`);const n=t.slice(0,r).trim(),o=t.slice(r+1,-1).trim();return o===""?{args:[],name:n}:{args:R(o).map(s=>{const i=s.trim();return pe(i)??i}),name:n}},he=e=>{const t=e.split("|").map(n=>n.trim()),r=t[0]??"";if(!r)throw new Error(`Empty variable name in expression "${e}"`);return{filters:t.slice(1).map(n=>de(n)),name:r}},ye=e=>e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?String(e):JSON.stringify(e),ge=(e,t)=>{const r=e.replaceAll(me,(n,o)=>{const{filters:s,name:i}=he(o);if(!Object.hasOwn(t,i))throw new Error(`Variable "${i}" used in filename "${e}" but not defined`);let l=t[i];for(const a of s)l=N(a.name,l,a.args);return ye(l)});return P(r)},P=e=>e.split("/").map(t=>t.endsWith(".tera")||t.endsWith(".twig")?t.slice(0,-5):t).join("/"),we=e=>e.endsWith(".raw")?e.slice(0,-4):e,$e=e=>{const t=e.split("/");return(t.at(-1)??"").startsWith("_")?!0:t.slice(0,-1).includes("partials")},be=(e,t)=>{if(!e.startsWith(`---
2
- `)&&!e.startsWith(`---\r
3
- `))return{body:e};const r=e.indexOf(`
4
- ---`,3);if(r===-1)return{body:e};let n=r+1+3;e[n]==="\r"&&(n+=1),e[n]===`
5
- `&&(n+=1);const o=e.startsWith(`---\r
6
- `)?5:4,s=e.slice(o,r).replaceAll("\r","");let i;try{i=t(s)}catch(l){const a=l instanceof Error?l.message:String(l);throw new Error(`Failed to parse frontmatter YAML: ${a}`,{cause:l})}if(i==null)return{body:e.slice(n)};if(typeof i!="object"||Array.isArray(i))throw new TypeError(`Frontmatter must be a YAML mapping, got ${Array.isArray(i)?"array":typeof i}`);return{body:e.slice(n),frontmatter:i}},Ee=/\{\{-?(.+?)-?\}\}|\{%-?(.+?)-?%\}/gs,q=e=>{const t=[];let r=0,n=1;const o=s=>{for(const i of s)i===`
7
- `&&(n+=1)};for(const s of e.matchAll(Ee)){const i=s.index??0;if(i>r){const c=e.slice(r,i);t.push({line:n,type:"text",value:c}),o(c)}const l=n,a=s[0];a.startsWith("{{")?t.push({line:l,type:"expr",value:(s[1]??"").trim()}):t.push({line:l,type:"stmt",value:(s[2]??"").trim()}),o(a),r=i+a.length}if(r<e.length){const s=e.slice(r);t.push({line:n,type:"text",value:s})}return t},Ae=new Set(["block","endblock","endfilter","endmacro","extends","filter","import","macro","set"]),F=(e,t)=>{let r=0;const n=(s,i)=>{throw new Error(`${t}:${s}: ${i}`)},o=s=>{const i=[];for(;r<e.length;){const l=e[r];if(l.type==="text"){i.push({type:"text",value:l.value}),r+=1;continue}if(l.type==="expr"){i.push({expression:l.value,line:l.line,type:"expr"}),r+=1;continue}const a=l.value.split(/\s+/)[0]??"";if(s.includes(a))return i;if(Ae.has(a)&&n(l.line,`Tera feature "{% ${a} %}" is not supported. Supported: if/else/endif, for/endfor, include. Rewrite the template to avoid macros, set, extends, block, and import.`),a==="if"){r+=1;const c=l.value.slice(2).trim(),p=o(["else","endif"]);let f;r<e.length&&e[r].type==="stmt"&&e[r].value.split(/\s+/)[0]==="else"&&(r+=1,f=o(["endif"])),(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endif")&&n(l.line,"Unterminated {% if %} — missing {% endif %}"),r+=1,i.push({alternate:f,condition:c,consequent:p,line:l.line,type:"if"});continue}if(a==="for"){r+=1;const c=l.value.slice(3).trim(),p=c.indexOf(" in ");p===-1&&n(l.line,"Malformed {% for %} — expected `for <name> in <collection>`");const f=c.slice(0,p).trim(),d=c.slice(p+4).trim();(!f||!d)&&n(l.line,"Malformed {% for %} — missing binding or collection");const u=o(["endfor"]);(r>=e.length||e[r].type!=="stmt"||e[r].value.split(/\s+/)[0]!=="endfor")&&n(l.line,"Unterminated {% for %} — missing {% endfor %}"),r+=1,i.push({binding:f,body:u,collection:d,line:l.line,type:"for"});continue}if(a==="include"){r+=1;const c=l.value.slice(7).trim(),p=G(c);p===void 0&&n(l.line,"Malformed {% include %} — expected a quoted partial name"),i.push({line:l.line,name:p,type:"include"});continue}n(l.line,`Unknown tag "{% ${a} %}". Supported: if, for, include.`)}return i};return o([])},G=e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return e.slice(1,-1)},je=e=>e==null?"":typeof e=="boolean"||typeof e=="number"?String(e):typeof e=="string"?e:JSON.stringify(e),ve=e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:!0,B=(e,t,r,n,o=!0)=>{const s=e.split(".");if(o&&s.length>0&&!Object.hasOwn(t,s[0]))throw new Error(`${n}:${r}: Variable "${e}" is not defined`);let i=t;for(const l of s){if(i==null)return;if(typeof i!="object")throw new TypeError(`${n}:${r}: Cannot read "${l}" on non-object value`);i=i[l]}return i},xe=e=>{const t=[];let r=0,n=0,o;for(let s=0;s<e.length;s+=1){const i=e[s];if(o){i===o&&(o=void 0);continue}if(i==='"'||i==="'"){o=i;continue}i==="("?r+=1:i===")"?r-=1:i==="|"&&r===0&&(t.push(e.slice(n,s)),n=s+1)}return t.push(e.slice(n)),t},ke=e=>{const t=e.trim(),r=t.indexOf("(");if(r===-1)return{args:[],name:t};if(!t.endsWith(")"))throw new Error(`Filter call "${e}" missing closing ")"`);const n=t.slice(0,r).trim(),o=t.slice(r+1,-1).trim();return o?{args:R(o).map(s=>s.trim()),name:n}:{args:[],name:n}},E=(e,t,r,n,o=!0)=>{const s=e.trim();if(s==="true")return!0;if(s==="false")return!1;if(s==="null"||s==="none")return null;const i=G(s);return i!==void 0?i:/^-?\d+(?:\.\d+)?$/.test(s)?Number(s):B(s,t,r,n,o)},D=(e,t,r,n,o=!0)=>{const s=xe(e),i=s[0].trim();let l=E(i,t,r,n,o);for(let a=1;a<s.length;a+=1){const c=s[a].trim(),{args:p,name:f}=ke(c),d=p.map(u=>E(u,t,r,n,o));try{l=N(f,l,d)}catch(u){const y=u instanceof Error?u.message:String(u);throw new Error(`${n}:${r}: ${y}`,{cause:u})}}return l},Y=(e,t)=>{let r,n=0;for(let o=0;o<=e.length-t.length;o+=1){const s=e[o];if(r){s===r&&(r=void 0);continue}if(s==='"'||s==="'"){r=s;continue}if(s==="("){n+=1;continue}if(s===")"){n-=1;continue}if(n===0&&e.slice(o,o+t.length)===t)return o}return-1},_=(e,t)=>{const r=[];let n=0,o=0;for(;o<=e.length-t.length;){const s=Y(e.slice(o),t);if(s===-1)break;r.push(e.slice(n,o+s)),o+=s+t.length,n=o}return r.push(e.slice(n)),r},g=(e,t,r,n)=>{const o=e.trim();if(o==="")return!1;if(o.startsWith("(")&&o.endsWith(")")&&Se(o)===o.length-1)return g(o.slice(1,-1),t,r,n);const s=_(o," or ");if(s.length>1)return s.some(l=>g(l,t,r,n));const i=_(o," and ");if(i.length>1)return i.every(l=>g(l,t,r,n));if(o.startsWith("not "))return!g(o.slice(4),t,r,n);for(const l of["==","!="]){const a=Y(o,l);if(a!==-1){const c=E(o.slice(0,a),t,n,r,!1),p=E(o.slice(a+l.length),t,n,r,!1),f=c===p;return l==="=="?f:!f}}return ve(D(o,t,n,r,!1))},Se=e=>{if(e[0]!=="(")return-1;let t=0,r,n=-1;for(const o of e){if(n+=1,r){o===r&&(r=void 0);continue}if(o==='"'||o==="'"){r=o;continue}if(o==="(")t+=1;else if(o===")"&&(t-=1,t===0))return n}return-1},b=(e,t)=>{let r="";for(const n of e){if(n.type==="text"){r+=n.value;continue}if(n.type==="expr"){r+=je(D(n.expression,t.scope,n.line,t.filename));continue}if(n.type==="if"){const o=g(n.condition,t.scope,t.filename,n.line)?n.consequent:n.alternate??[];r+=b(o,t);continue}if(n.type==="for"){const o=B(n.collection,t.scope,n.line,t.filename,!1);if(o==null)continue;if(!Array.isArray(o))throw new TypeError(`${t.filename}:${n.line}: {% for %} expected an array, got ${typeof o}`);for(const s of o){const i={...t.scope,[n.binding]:s};r+=b(n.body,{...t,scope:i})}continue}if(n.type==="include"){const o=t.partials?.get(n.name);if(!o)throw new Error(`${t.filename}:${n.line}: Partial "${n.name}" not found. Available: ${[...t.partials?.keys()??[]].join(", ")||"(none)"}`);const s=t.includeStack??new Set;if(s.has(n.name)){const i=[...s,n.name].join(" → ");throw new Error(`${t.filename}:${n.line}: Circular partial include detected: ${i}`)}s.add(n.name);try{r+=b(o,{...t,filename:`<partial:${n.name}>`,includeStack:s})}finally{s.delete(n.name)}}}return r},Ce=(e,t)=>F(q(e),t),v=(e,t)=>b(F(q(e),t.filename),t),L="template.yml",Oe=".raw",We=new Set([".cjs",".css",".env",".gitattributes",".gitignore",".graphql",".html",".ini",".js",".json",".json5",".jsonc",".jsx",".lock",".md",".mdx",".mjs",".prettierrc",".raw",".rs",".scss",".sh",".sql",".svg",".tera",".toml",".ts",".tsx",".twig",".txt",".vue",".xml",".yaml",".yml"]),Te=new Set(["Brewfile","CHANGELOG","CODEOWNERS","CONTRIBUTING","COPYING","Dockerfile","Gemfile","LICENCE","LICENSE","Makefile","NOTICE","Procfile","Rakefile","README","VERSION"]),_e=e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\")),r=t===-1?e:e.slice(t+1),n=r.lastIndexOf(".");return n===-1||n===0?"":r.slice(n).toLowerCase()},J=e=>{const t=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return t===-1?e:e.slice(t+1)},Le=e=>{const t=_e(e);if(t!=="")return We.has(t);const r=J(e);return Te.has(r)},Me=e=>{const t={default:e.default,internal:e.internal,order:e.order,prompt:e.prompt,required:e.required};switch(e.type){case"array":return{...t,type:"array"};case"boolean":return{...t,default:typeof t.default=="boolean"?t.default:void 0,type:"boolean"};case"enum":return{...t,multiple:e.multiple,type:"enum",values:e.values??[]};case"number":return{...t,type:"number"};case"string":return{...t,type:"string"};default:throw new Error(`Unsupported variable type "${String(e.type)}"`)}},Ue=e=>e.replaceAll("\\","/").replace(/^\.\//,"").replaceAll(/\/+/g,"/"),ze=(e,t,r)=>{const n=t.split("/").filter(Boolean);if(n.length===0)throw new Error("Empty destination path for value");let o=e;for(let s=0;s<n.length-1;s+=1){const i=n[s],l=o[i];if(l===void 0){const a={};o[i]=a,o=a}else if(typeof l=="object"&&!Buffer.isBuffer(l))o=l;else throw new TypeError(`Path conflict: "${n.slice(0,s+1).join("/")}" is both a file and a directory`)}o[n.at(-1)]=r},M=(e,t,r)=>{if(typeof e!="string")return Ie(e);const n=e.includes("{{")||e.includes("{%")?v(e,{filename:`${r}#frontmatter`,scope:t}):e;return g(n,t,`${r}#frontmatter`,1)},Ie=e=>e==null||e===!1||e===0||e===""?!1:Array.isArray(e)?e.length>0:typeof e=="string"?e!=="false"&&e!=="0":!0,Ge=(e,t)=>{const r=z(e,L),n=H(r);if(!n||typeof n!="object")throw new Error(`${r}: must contain a YAML mapping`);const o={};if(n.variables)for(const[a,c]of Object.entries(n.variables))o[a]=Me(c);const s=new Map,i=[];for(const a of K(e,{includeDirs:!1,includeSymlinks:!1})){if(a.path===r)continue;const c=U(e,a.path).replaceAll("\\","/");if(c===L)continue;if($e(c)){const f=$(a.path),d=Ce(f,c);for(const u of Ne(c))s.has(u)&&s.get(u)!==d&&Z.warn(`partial name "${u}" is declared by multiple files — last one wins. Use distinct names or fully-qualified includes.`),s.set(u,d);continue}if(c.endsWith(Oe)){const f=$(a.path);i.push({binary:null,isRaw:!0,rawText:f,relativePath:c});continue}if(Le(c)){const f=$(a.path);i.push({binary:null,isRaw:!1,rawText:f,relativePath:c});continue}const p=$(a.path,{buffer:!0});i.push({binary:p,isRaw:!1,rawText:null,relativePath:c})}const l=a=>{const c={...a.builtins,...a.options},p={},f={};for(const u of i){const y=u.relativePath;let w,C,O=!1;if(u.binary)w=u.binary;else if(u.isRaw)w=u.rawText??"";else{const Q=u.rawText??"",h=be(Q,V=>X(V));if(h.frontmatter){if(h.frontmatter.skip!==void 0&&M(h.frontmatter.skip,c,y)||h.frontmatter.if!==void 0&&!M(h.frontmatter.if,c,y))continue;typeof h.frontmatter.to=="string"&&(C=v(h.frontmatter.to,{filename:`${y}#frontmatter.to`,partials:s,scope:c})),h.frontmatter.force===!0&&(O=!0)}w=v(h.body,{filename:y,partials:s,scope:c})}const W=Ue(C??ge(we(y),c));ze(p,W,w),O&&(f[W]={force:!0})}const d={files:p};return Object.keys(f).length>0&&(d.filesMeta=f),d};return{about:{description:n.description??`Moon-format template at ${e}`,name:n.title??t},destination:n.destination,options:o,produce:l}},Ne=e=>{const t=P(e),r=J(t),n=new Set([r,t]);if(r.startsWith("_")){n.add(r.replace(/^_+/,""));const o=t.slice(0,t.length-r.length);n.add(`${o}${r.replace(/^_+/,"")}`)}return[...n]};export{Ge as loadMoonTemplate};
1
+ import{createRequire as N}from"node:module";import O from"./index.js";import{VisReleaseError as l}from"../packem_shared/VisReleaseError-DZtgcKf8.js";let _;const A=c=>(_??=N(import.meta.url))(c),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=c=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[e,t]=f.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return f.getBuiltinModule(c)}return A(c)},{readFile:b,rename:L,readdir:C}=x("node:fs/promises"),{isAbsolute:k,join:u,basename:S}=x("node:path");class m{constructor(e){this.runner=e}runner;async publishNative(e){throw new l({code:"CONFIG_INVALID",hint:'Set publish.publishStrategy back to "npm-publish-tarball" (the default), or use a package manager whose adapter implements native publish.',message:`publishStrategy "native" is not supported by the "${this.id}" adapter.`})}async readCatalogYaml(e){}}const w=(c,e)=>{if(c.exitCode===0)return{output:c.stdout,published:!0};const t=`${c.stdout}
2
+ ${c.stderr}`;if(/EPUBLISHCONFLICT|cannot publish over the previously published versions|forbidden.*409/i.test(t))return{alreadyPublished:!0,output:t,published:!1};throw new l({code:"PUBLISH_FAILED",message:`${e} failed: ${t}`})};class g extends m{id="npm";minVersion="11.5.1";async pack(e){const t=["pack","--json"];e.destination&&t.push("--pack-destination",e.destination);const s=await this.runner.run("npm",t,{cwd:e.cwd,silent:!0});if(s.exitCode!==0)throw new l({code:"PUBLISH_FAILED",message:`npm pack failed: ${s.stderr||s.stdout}`});const a=JSON.parse(s.stdout),r=a[0]?.filename;if(!r)throw new l({code:"PUBLISH_FAILED",hint:"Upgrade npm to a version that emits --json output, or report this with the raw stdout.",message:`npm pack: could not parse output: ${s.stdout}`});const n=e.destination??e.cwd;let i=k(r)?r:u(n,r);return e.filename&&(await(await import("node:fs/promises")).rename(i,u(n,e.filename)),i=u(n,e.filename)),{raw:a,tarball:i}}async installLockfileOnly(e){const t=await this.runner.run("npm",["install","--package-lock-only"],{cwd:e.cwd,silent:e.silent});if(t.exitCode!==0)throw new l({code:"CONFIG_INVALID",message:`npm install --package-lock-only failed: ${t.stderr||t.stdout}`})}async listWorkspacePackages(e){const t=await this.runner.run("npm",["query",".workspace","--json"],{cwd:e,silent:!0});if(t.exitCode!==0)return[];try{return JSON.parse(t.stdout).filter(a=>typeof a.name=="string").map(a=>({name:a.name,path:a.path??a.location??e,private:a.private??!1,version:a.version??"0.0.0"}))}catch{return[]}}async publish(e){const t=e.stage?["stage","publish",e.tarball]:["publish",e.tarball];e.tag&&t.push("--tag",e.tag),e.access&&t.push("--access",e.access),e.registry&&t.push("--registry",e.registry),e.otp&&t.push("--otp",e.otp),e.provenance&&t.push("--provenance"),e.stage&&t.push("--json");for(const r of e.extraArgs??[])t.push(r);const s=await this.runner.run("npm",t,{cwd:process.cwd(),silent:!0});if(s.exitCode===0){const r={output:s.stdout,published:!0};if(e.stage)try{const n=JSON.parse(s.stdout);r.stageId=n.id??n.stageId}catch{}return r}const a=`${s.stdout}
3
+ ${s.stderr}`;if(/EPUBLISHCONFLICT|cannot publish over the previously published versions|forbidden.*409/i.test(a))return{alreadyPublished:!0,output:a,published:!1};throw new l({code:"PUBLISH_FAILED",message:`npm publish failed: ${a}`})}async publishNative(e){const t=["publish"];e.tag&&t.push("--tag",e.tag),e.access&&t.push("--access",e.access),e.registry&&t.push("--registry",e.registry),e.otp&&t.push("--otp",e.otp),e.provenance&&t.push("--provenance");for(const a of e.extraArgs??[])t.push(a);const s=await this.runner.run("npm",t,{cwd:e.cwd,silent:!0});return w(s,"npm publish")}async detectVersion(e){const t=await this.runner.run("npm",["--version"],{cwd:e,silent:!0});return t.exitCode===0?t.stdout.trim():void 0}}class j extends m{id="bun";minVersion="1.1.36";async pack(e){const t=["pm","pack"];e.destination&&t.push("--destination",e.destination);const s=await this.runner.run("bun",t,{cwd:e.cwd,silent:!0});if(s.exitCode!==0)throw new l({code:"PUBLISH_FAILED",message:`bun pm pack failed: ${s.stderr||s.stdout}`});const a=/(?:^|["'\s])([^\s"']*\.tgz)/m.exec(s.stdout),r=e.destination??e.cwd;let n;if(a?.[1]){const i=a[1];n=k(i)?i:u(r,i)}else{const i=JSON.parse(await b(u(e.cwd,"package.json"),"utf8")),d=(i.name??"package").replaceAll("/","-").replace(/^@/,"");n=u(r,`${d}-${i.version??"0.0.0"}.tgz`)}if(e.filename&&S(n)!==e.filename){const i=u(r,e.filename);await L(n,i),n=i}return{raw:s.stdout,tarball:n}}async installLockfileOnly(e){const t=await this.runner.run("bun",["install","--lockfile-only"],{cwd:e.cwd,silent:e.silent});if(t.exitCode!==0)throw new l({code:"CONFIG_INVALID",message:`bun install --lockfile-only failed: ${t.stderr||t.stdout}`})}async listWorkspacePackages(e){try{const t=JSON.parse(await b(u(e,"package.json"),"utf8")),s=Array.isArray(t.workspaces)?t.workspaces:t.workspaces?.packages??[];if(s.length===0)return[];const a=new Set,r=["."],n=5,i=new Set;for(;r.length>0;){const o=r.shift();if(i.has(o)||(i.add(o),(o==="."?0:o.split("/").length)>n))continue;let p;try{p=await C(u(e,o),{withFileTypes:!0})}catch{continue}for(const h of p){if(!h.isDirectory()||h.name==="node_modules"||h.name.startsWith("."))continue;const y=o==="."?h.name:`${o}/${h.name}`;s.some(I=>O(I,y))&&a.add(y),r.push(y)}}const d=[];for(const o of a){const v=u(e,o,"package.json");try{const p=JSON.parse(await b(v,"utf8"));if(typeof p.name!="string")continue;d.push({name:p.name,path:u(e,o),private:p.private??!1,version:p.version??"0.0.0"})}catch{}}return d}catch{return[]}}async publish(e){return new g(this.runner).publish(e)}async publishNative(e){const t=["publish"];e.tag&&t.push("--tag",e.tag),e.access&&t.push("--access",e.access),e.registry&&t.push("--registry",e.registry);for(const a of e.extraArgs??[])t.push(a);const s=await this.runner.run("bun",t,{cwd:e.cwd,silent:!0});return w(s,"bun publish")}async detectVersion(e){const t=await this.runner.run("bun",["--version"],{cwd:e,silent:!0});return t.exitCode===0?t.stdout.trim():void 0}}class P extends m{id="pnpm";minVersion="9.5.0";async pack(e){const t=["pack","--json"];e.destination&&t.push("--pack-destination",e.destination);const s=await this.runner.run("pnpm",t,{cwd:e.cwd,silent:!0});if(s.exitCode!==0)throw new l({code:"PUBLISH_FAILED",message:`pnpm pack failed: ${s.stderr||s.stdout}`});const a=JSON.parse(s.stdout),{filename:r}=a;if(!r)throw new l({code:"PUBLISH_FAILED",message:`pnpm pack: could not parse output: ${s.stdout}`});const n=e.destination??e.cwd;let i=k(r)?r:u(n,r);return e.filename&&(await(await import("node:fs/promises")).rename(i,u(n,e.filename)),i=u(n,e.filename)),{raw:a,tarball:i}}async installLockfileOnly(e){const t=await this.runner.run("pnpm",["install","--lockfile-only"],{cwd:e.cwd,silent:e.silent});if(t.exitCode!==0)throw new l({code:"CONFIG_INVALID",message:`pnpm install --lockfile-only failed: ${t.stderr||t.stdout}`})}async listWorkspacePackages(e){const t=await this.runner.run("pnpm",["-r","ls","--depth","-1","--json"],{cwd:e,silent:!0});if(t.exitCode!==0)return[];try{return JSON.parse(t.stdout).filter(a=>typeof a.name=="string").map(a=>({name:a.name,path:a.path??e,private:a.private??!1,version:a.version??"0.0.0"}))}catch{return[]}}async publish(e){return new g(this.runner).publish(e)}async publishNative(e){const t=["publish","--no-git-checks"];e.tag&&t.push("--tag",e.tag),e.access&&t.push("--access",e.access),e.registry&&t.push("--registry",e.registry),e.otp&&t.push("--otp",e.otp),e.provenance&&t.push("--provenance");for(const a of e.extraArgs??[])t.push(a);const s=await this.runner.run("pnpm",t,{cwd:e.cwd,silent:!0});return w(s,"pnpm publish")}async detectVersion(e){const t=await this.runner.run("pnpm",["--version"],{cwd:e,silent:!0});return t.exitCode===0?t.stdout.trim():void 0}async readCatalogYaml(e){const t=await import("node:fs/promises");try{return await t.readFile(u(e,"pnpm-workspace.yaml"),"utf8")}catch{return}}}class $ extends m{id="yarn";minVersion="4.0.0";async pack(e){const t=e.destination??e.cwd,s=e.filename??"%s-%v.tgz",a=["pack","--out",u(t,s)],r=await this.runner.run("yarn",a,{cwd:e.cwd,silent:!0});if(r.exitCode!==0)throw new l({code:"PUBLISH_FAILED",message:`yarn pack failed: ${r.stderr||r.stdout}`});const n=await import("node:fs/promises"),i=await import("node:path"),d=JSON.parse(await n.readFile(i.join(e.cwd,"package.json"),"utf8")),o=s.replaceAll("%s",(d.name??"package").replaceAll("/","-").replace(/^@/,"")).replaceAll("%v",d.version??"0.0.0");return{raw:r.stdout,tarball:u(t,o)}}async installLockfileOnly(e){const t=await this.runner.run("yarn",["install","--mode","update-lockfile"],{cwd:e.cwd,silent:e.silent});if(t.exitCode!==0)throw new l({code:"CONFIG_INVALID",message:`yarn install --mode update-lockfile failed: ${t.stderr||t.stdout}`})}async listWorkspacePackages(e){const t=await this.runner.run("yarn",["workspaces","list","--json"],{cwd:e,silent:!0});if(t.exitCode!==0)return[];const s=[];for(const a of t.stdout.split(/\r?\n/)){const r=a.trim();if(r)try{const n=JSON.parse(r);if(typeof n.name!="string"||n.name==="")continue;s.push({name:n.name,path:n.location?u(e,n.location):e,private:!1,version:"0.0.0"})}catch{}}return s}async publish(e){return new g(this.runner).publish(e)}async publishNative(e){const t=["npm","publish"];e.tag&&t.push("--tag",e.tag),e.access&&t.push("--access",e.access),e.provenance&&t.push("--provenance");for(const a of e.extraArgs??[])t.push(a);const s=await this.runner.run("yarn",t,{cwd:e.cwd,silent:!0});return w(s,"yarn npm publish")}async detectVersion(e){const t=await this.runner.run("yarn",["--version"],{cwd:e,silent:!0});return t.exitCode===0?t.stdout.trim():void 0}}const B=async(c,e)=>{const t=await import("node:fs/promises"),s=await import("node:path");try{const r=JSON.parse(await t.readFile(s.join(c,"package.json"),"utf8"));if(typeof r.packageManager=="string"){const n=r.packageManager.indexOf("@"),i=n>0?r.packageManager.slice(0,n):r.packageManager;if(i==="pnpm"||i==="yarn"||i==="bun"||i==="npm")return i}}catch{}const a=async r=>{try{return await t.access(s.join(c,r)),!0}catch{return!1}};return await a("bun.lock")||await a("bun.lockb")?"bun":await a("pnpm-lock.yaml")||await a("pnpm-workspace.yaml")?"pnpm":await a("yarn.lock")?"yarn":"npm"},J=(c,e)=>{switch(c){case"bun":return new j(e);case"pnpm":return new P(e);case"yarn":return new $(e);default:return new g(e)}};export{g as N,J as c,B as d};