@visulima/vis 2.0.2 → 3.0.1

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 +28 -0
  2. package/LICENSE.md +5395 -4307
  3. package/dist/bin.js +1 -1
  4. package/dist/binx.js +2 -2
  5. package/dist/config/index.js +1 -1
  6. package/dist/packem_chunks/CONFIG_FILES.js +6 -6
  7. package/dist/packem_chunks/DEFAULT_CLEAN_KEEP.js +1 -1
  8. package/dist/packem_chunks/agent-instructions.js +7 -7
  9. package/dist/packem_chunks/bloom-status.js +2 -2
  10. package/dist/packem_chunks/bloom-sync.js +2 -2
  11. package/dist/packem_chunks/cache-attestation.js +1 -1
  12. package/dist/packem_chunks/catalog-detector.js +1 -1
  13. package/dist/packem_chunks/catalog.js +87 -111
  14. package/dist/packem_chunks/cli-exec.js +1 -1
  15. package/dist/packem_chunks/cli-main.js +192 -217
  16. package/dist/packem_chunks/defineReleasePlugin.js +3 -3
  17. package/dist/packem_chunks/detect.js +8 -3
  18. package/dist/packem_chunks/devtools.js +1 -1
  19. package/dist/packem_chunks/discord.js +4 -4
  20. package/dist/packem_chunks/dispatch.js +4 -4
  21. package/dist/packem_chunks/doctor-probe.js +2 -2
  22. package/dist/packem_chunks/extra-files.js +3 -3
  23. package/dist/packem_chunks/fix.js +11 -11
  24. package/dist/packem_chunks/git.js +3 -3
  25. package/dist/packem_chunks/group-tags.js +1 -1
  26. package/dist/packem_chunks/handler.js +1 -1
  27. package/dist/packem_chunks/handler10.js +5 -5
  28. package/dist/packem_chunks/handler11.js +1 -1
  29. package/dist/packem_chunks/handler12.js +16 -16
  30. package/dist/packem_chunks/handler13.js +5 -5
  31. package/dist/packem_chunks/handler14.js +1 -1
  32. package/dist/packem_chunks/handler15.js +1 -1
  33. package/dist/packem_chunks/handler16.js +1 -1
  34. package/dist/packem_chunks/handler17.js +1 -1
  35. package/dist/packem_chunks/handler18.js +1 -1
  36. package/dist/packem_chunks/handler19.js +5 -5
  37. package/dist/packem_chunks/handler2.js +1 -1
  38. package/dist/packem_chunks/handler20.js +2 -2
  39. package/dist/packem_chunks/handler21.js +2 -2
  40. package/dist/packem_chunks/handler22.js +8 -8
  41. package/dist/packem_chunks/handler23.js +1 -1
  42. package/dist/packem_chunks/handler24.js +1 -1
  43. package/dist/packem_chunks/handler25.js +1 -1
  44. package/dist/packem_chunks/handler26.js +5 -5
  45. package/dist/packem_chunks/handler27.js +1 -1
  46. package/dist/packem_chunks/handler28.js +3 -3
  47. package/dist/packem_chunks/handler29.js +1 -1
  48. package/dist/packem_chunks/handler3.js +2 -2
  49. package/dist/packem_chunks/handler30.js +1 -1
  50. package/dist/packem_chunks/handler31.js +2 -2
  51. package/dist/packem_chunks/handler32.js +2 -2
  52. package/dist/packem_chunks/handler33.js +2 -2
  53. package/dist/packem_chunks/handler34.js +3 -3
  54. package/dist/packem_chunks/handler35.js +5 -5
  55. package/dist/packem_chunks/handler36.js +1 -1
  56. package/dist/packem_chunks/handler37.js +2 -2
  57. package/dist/packem_chunks/handler38.js +6 -6
  58. package/dist/packem_chunks/handler39.js +8 -8
  59. package/dist/packem_chunks/handler4.js +4 -4
  60. package/dist/packem_chunks/handler40.js +34 -34
  61. package/dist/packem_chunks/handler41.js +5 -5
  62. package/dist/packem_chunks/handler42.js +4 -4
  63. package/dist/packem_chunks/handler43.js +3 -3
  64. package/dist/packem_chunks/handler44.js +2 -2
  65. package/dist/packem_chunks/handler45.js +1 -1
  66. package/dist/packem_chunks/handler46.js +1 -1
  67. package/dist/packem_chunks/handler47.js +1 -1
  68. package/dist/packem_chunks/handler48.js +3 -3
  69. package/dist/packem_chunks/handler49.js +1 -1
  70. package/dist/packem_chunks/handler5.js +6 -6
  71. package/dist/packem_chunks/handler50.js +6 -6
  72. package/dist/packem_chunks/handler51.js +13 -13
  73. package/dist/packem_chunks/handler52.js +3 -3
  74. package/dist/packem_chunks/handler53.js +5 -5
  75. package/dist/packem_chunks/handler54.js +2 -2
  76. package/dist/packem_chunks/handler55.js +1 -1
  77. package/dist/packem_chunks/handler56.js +4 -4
  78. package/dist/packem_chunks/handler57.js +5 -5
  79. package/dist/packem_chunks/handler58.js +5 -5
  80. package/dist/packem_chunks/handler59.js +8 -8
  81. package/dist/packem_chunks/handler6.js +7 -7
  82. package/dist/packem_chunks/handler60.js +3 -3
  83. package/dist/packem_chunks/handler61.js +21 -21
  84. package/dist/packem_chunks/handler62.js +12 -12
  85. package/dist/packem_chunks/handler63.js +3 -3
  86. package/dist/packem_chunks/handler64.js +5 -5
  87. package/dist/packem_chunks/handler65.js +8 -8
  88. package/dist/packem_chunks/handler66.js +2 -2
  89. package/dist/packem_chunks/handler67.js +21 -21
  90. package/dist/packem_chunks/handler68.js +21 -21
  91. package/dist/packem_chunks/handler69.js +30 -30
  92. package/dist/packem_chunks/handler7.js +1 -1
  93. package/dist/packem_chunks/handler70.js +9 -9
  94. package/dist/packem_chunks/handler71.js +17 -17
  95. package/dist/packem_chunks/handler72.js +104 -104
  96. package/dist/packem_chunks/handler73.js +20 -20
  97. package/dist/packem_chunks/handler74.js +45 -45
  98. package/dist/packem_chunks/handler75.js +27 -3
  99. package/dist/packem_chunks/handler76.js +3 -27
  100. package/dist/packem_chunks/handler77.js +68 -68
  101. package/dist/packem_chunks/handler78.js +30 -30
  102. package/dist/packem_chunks/handler8.js +1 -1
  103. package/dist/packem_chunks/handler9.js +1 -1
  104. package/dist/packem_chunks/heal-accept.js +9 -9
  105. package/dist/packem_chunks/heal.js +11 -11
  106. package/dist/packem_chunks/help-command.js +7 -63
  107. package/dist/packem_chunks/index.js +1 -1
  108. package/dist/packem_chunks/index2.js +48 -802
  109. package/dist/packem_chunks/index3.js +3 -7
  110. package/dist/packem_chunks/index4.js +803 -134
  111. package/dist/packem_chunks/index5.js +7 -73
  112. package/dist/packem_chunks/index6.js +73 -0
  113. package/dist/packem_chunks/index7.js +135 -0
  114. package/dist/packem_chunks/interface.js +2 -2
  115. package/dist/packem_chunks/keys-refresh.js +4 -4
  116. package/dist/packem_chunks/lean.js +3 -3
  117. package/dist/packem_chunks/list.js +3 -3
  118. package/dist/packem_chunks/loader.js +4 -4
  119. package/dist/packem_chunks/loader2.js +1 -1
  120. package/dist/packem_chunks/orchestrator.js +27 -27
  121. package/dist/packem_chunks/pre-mode.js +2 -2
  122. package/dist/packem_chunks/print-config.js +1 -1
  123. package/dist/packem_chunks/prompts.js +7 -7
  124. package/dist/packem_chunks/prune.js +3 -3
  125. package/dist/packem_chunks/publish-guards.js +1 -1
  126. package/dist/packem_chunks/resolveFormatter.js +5 -5
  127. package/dist/packem_chunks/run.js +1 -1
  128. package/dist/packem_chunks/security.js +1 -1
  129. package/dist/packem_chunks/shell-runner.js +1 -1
  130. package/dist/packem_chunks/slack.js +2 -2
  131. package/dist/packem_chunks/snapshot.js +2 -2
  132. package/dist/packem_chunks/stage-publisher.js +1 -1
  133. package/dist/packem_chunks/staged-registry.js +2 -2
  134. package/dist/packem_chunks/state.js +3 -3
  135. package/dist/packem_chunks/status.js +2 -2
  136. package/dist/packem_chunks/success-walk.js +4 -4
  137. package/dist/packem_chunks/sync.js +2 -2
  138. package/dist/packem_chunks/sync2.js +2 -2
  139. package/dist/packem_chunks/tar.js +3 -3
  140. package/dist/packem_chunks/tripwire.js +2 -2
  141. package/dist/packem_chunks/ts-loader.js +5 -9
  142. package/dist/packem_chunks/verify-lockfile.js +2 -2
  143. package/dist/packem_chunks/version-resolver.js +2 -2
  144. package/dist/packem_chunks/webhook.js +1 -1
  145. package/dist/packem_chunks/workflow-templates.js +5 -5
  146. package/dist/packem_chunks/workspace.js +2 -2
  147. package/dist/packem_shared/ReleaseClient-DAvbxCdo.js +1 -0
  148. package/dist/packem_shared/Table-DyORjLji-CC9cYgCG.js +11 -0
  149. package/dist/packem_shared/{VisReleaseError-DMGRBTNO.js → VisReleaseError-DZtgcKf8.js} +1 -1
  150. package/dist/packem_shared/_commonjsHelpers-DTfxOvZk.js +1 -0
  151. package/dist/packem_shared/advisories-CyDqzi5j.js +1 -0
  152. package/dist/packem_shared/affected-selection-DPQR-Bd3.js +1 -0
  153. package/dist/packem_shared/affected-shas-Dd0P7fGD.js +1 -0
  154. package/dist/packem_shared/ai-analysis-DSQQDFU9.js +68 -0
  155. package/dist/packem_shared/ai-fix-6nXZbecQ.js +43 -0
  156. package/dist/packem_shared/augment-COAiXSIx.js +4 -0
  157. package/dist/packem_shared/bin-wafzkjaB.js +1 -0
  158. package/dist/packem_shared/build-scripts-pdVmqXRm.js +1 -0
  159. package/dist/packem_shared/clean-DRiLimTx.js +1 -0
  160. package/dist/packem_shared/command-runtime-CiLVo4ED.js +1 -0
  161. package/dist/packem_shared/{compile-cache-B_Vf_WxT.js → compile-cache-DoMHRsRZ.js} +1 -1
  162. package/dist/packem_shared/createAdapter-F7GidOzU.js +1 -0
  163. package/dist/packem_shared/createVersionActions-ByaJ1Nbv.js +1 -0
  164. package/dist/packem_shared/cyclonedx-C_ezHg8b.js +4 -0
  165. package/dist/packem_shared/dependency-scan-DBH2Qo4I.js +1 -0
  166. package/dist/packem_shared/docker-Br_iFmI-.js +59 -0
  167. package/dist/packem_shared/failure-log-D92tM0ie.js +2 -0
  168. package/dist/packem_shared/formatBytes-BHAzNIrn-DFIppnY0.js +4 -0
  169. package/dist/packem_shared/getRandomSpinner-4ZEcbTYv-DCyIuj19.js +1 -0
  170. package/dist/packem_shared/giget-CVyyR7x8.js +2 -0
  171. package/dist/packem_shared/glob-Cyk1H9ZL-ox19CSsT.js +1 -0
  172. package/dist/packem_shared/index-B4AjSxHU.js +1 -0
  173. package/dist/packem_shared/index-BisalDCf.js +39 -0
  174. package/dist/packem_shared/{index-BWl4DbMp.js → index-BjdW45xX.js} +1 -1
  175. package/dist/packem_shared/index-DHD8wb6Z.js +22 -0
  176. package/dist/packem_shared/index-DXPSWMbG.js +1 -0
  177. package/dist/packem_shared/index.server-CwSgbeN7.js +2 -0
  178. package/dist/packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js +1 -0
  179. package/dist/packem_shared/license-DvlYdo6T.js +1 -0
  180. package/dist/packem_shared/lifecycle-CfTZQHOG.js +2 -0
  181. package/dist/packem_shared/lockfile-35RFsJDs.js +1 -0
  182. package/dist/packem_shared/lockfile-DhHAaHN5.js +1 -0
  183. package/dist/packem_shared/main-BjJN8kWj.js +1 -0
  184. package/dist/packem_shared/manifests-BNSmpPF_.js +1 -0
  185. package/dist/packem_shared/min-release-age-ChzTC7_I.js +34 -0
  186. package/dist/packem_shared/missing-package-json-C0keIt78.js +1 -0
  187. package/dist/packem_shared/native-config-sync-BSzU4qUO.js +21 -0
  188. package/dist/packem_shared/osv-bloom-5wDAoZ1e.js +2 -0
  189. package/dist/packem_shared/otelPlugin-D8LL2-4L.js +1 -0
  190. package/dist/packem_shared/package-version-BJkg7-6H.js +4 -0
  191. package/dist/packem_shared/packument-C55kVxcQ.js +1 -0
  192. package/dist/packem_shared/{peer-warnings-BXAzXqY3.js → peer-warnings-CmYSxvql.js} +1 -1
  193. package/dist/packem_shared/pm-runner-de-jCq8q.js +1 -0
  194. package/dist/packem_shared/project-name-filter-BeREbPMI.js +7 -0
  195. package/dist/packem_shared/{prompt-BSAy8SMH.js → prompt-DMzaQEVa.js} +1 -1
  196. package/dist/packem_shared/provenance-CvfQEJPQ.js +1 -0
  197. package/dist/packem_shared/readJsonSync-CbryXYxN-B2aSeDpC.js +1 -0
  198. package/dist/packem_shared/registry-keys-DmBrAlhg.js +1 -0
  199. package/dist/packem_shared/resolve-explicit-COmP7eqr.js +5 -0
  200. package/dist/packem_shared/resolve-runtime-C7NBCA1C.js +1 -0
  201. package/dist/packem_shared/run-file-jMngGQhs.js +1 -0
  202. package/dist/packem_shared/runtime-check-BklgEMkC.js +1 -0
  203. package/dist/packem_shared/s1ngularity-RZOHbGrE.js +1 -0
  204. package/dist/packem_shared/scan-progress-C9nMDLis.js +2 -0
  205. package/dist/packem_shared/selectors-B7lSFz7l.js +3 -0
  206. package/dist/packem_shared/signatures-oZ_2IneN.js +2 -0
  207. package/dist/packem_shared/{slug-DoueYuLo.js → slug-OBHcH7wV.js} +1 -1
  208. package/dist/packem_shared/spinner-CbJfWYwB.js +1 -0
  209. package/dist/packem_shared/sticky-comment-DjhyCIZt.js +1 -0
  210. package/dist/packem_shared/subtree-DtmcKAJK.js +2 -0
  211. package/dist/packem_shared/symbols-BXDZ_sKt.js +1 -0
  212. package/dist/packem_shared/tabs-BilwonkM.js +1 -0
  213. package/dist/packem_shared/target-merge-D1xbylFw.js +4 -0
  214. package/dist/packem_shared/target-options-d_rIrLyq.js +1 -0
  215. package/dist/packem_shared/toolchain-DY11tPCw.js +5 -0
  216. package/dist/packem_shared/typosquats-D8ppc5kr.js +1 -0
  217. package/dist/packem_shared/use-measured-height-BPQg2q_p.js +1 -0
  218. package/dist/packem_shared/utils-DQFHJn72.js +1 -0
  219. package/dist/packem_shared/verify-D8wYvB85.js +1 -0
  220. package/dist/packem_shared/vis-update-app-ngwL2mRv.js +1 -0
  221. package/dist/packem_shared/vis-user-error-jhNwmkZp.js +30 -0
  222. package/dist/packem_shared/watch-Dswvj6Zp.js +1 -0
  223. package/dist/packem_shared/watch-loop-COWvvSbR.js +11 -0
  224. package/dist/packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js +1 -0
  225. package/dist/release/core/changelog/index.d.ts +62 -2
  226. package/dist/release/core/package-managers/index.d.ts +25 -1
  227. package/dist/release/core/package-managers/index.js +1 -1
  228. package/dist/release/core/version-actions/index.d.ts +47 -2
  229. package/dist/release/core/version-actions/index.js +1 -1
  230. package/dist/release/index.d.ts +100 -1
  231. package/dist/release/index.js +1 -1
  232. package/dist/release/plugin-sdk.d.ts +16 -1
  233. package/dist/release/plugin-sdk.js +1 -1
  234. package/dist/release/presets.js +1 -1
  235. package/dist/release/types.js +1 -1
  236. package/dist/runtime/preload.js +1 -1
  237. package/index.d.ts +204 -204
  238. package/index.js +26 -26
  239. package/package.json +13 -13
  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-CCBGdU8U.js +0 -1
  245. package/dist/packem_shared/affected-selection-Dj-ymxhw.js +0 -1
  246. package/dist/packem_shared/affected-shas-PwkVbPch.js +0 -1
  247. package/dist/packem_shared/ai-analysis-bGCAc1jR.js +0 -68
  248. package/dist/packem_shared/ai-fix-DV5-dHBY.js +0 -43
  249. package/dist/packem_shared/augment-24KX2nkI.js +0 -4
  250. package/dist/packem_shared/bin-CtzhnYMp.js +0 -1
  251. package/dist/packem_shared/build-scripts-w4SNeR7D.js +0 -1
  252. package/dist/packem_shared/clean-DWjQl14S.js +0 -1
  253. package/dist/packem_shared/command-runtime-BLFPUYAT.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-C4KaVTn1.js +0 -4
  257. package/dist/packem_shared/dependency-scan-D_ona0Qm.js +0 -1
  258. package/dist/packem_shared/docker-DaVs-9wK.js +0 -59
  259. package/dist/packem_shared/en-D3CfXlO7.js +0 -27
  260. package/dist/packem_shared/failure-log-CTneNcio.js +0 -2
  261. package/dist/packem_shared/giget-CAxjpwew.js +0 -2
  262. package/dist/packem_shared/glob-BUjyjdE8-C4M8e02u.js +0 -1
  263. package/dist/packem_shared/index-BAe6e0XE.js +0 -1
  264. package/dist/packem_shared/index-CTMU29dI.js +0 -1
  265. package/dist/packem_shared/index-uBVnF4ji.js +0 -35
  266. package/dist/packem_shared/index.server-CusjRLCh.js +0 -2
  267. package/dist/packem_shared/license-t5KnNX6v.js +0 -1
  268. package/dist/packem_shared/lifecycle-B8A2T3gx.js +0 -2
  269. package/dist/packem_shared/lockfile-Bccery3L.js +0 -1
  270. package/dist/packem_shared/main-D_cam4hv.js +0 -1
  271. package/dist/packem_shared/manifests-BDkwiVbh.js +0 -1
  272. package/dist/packem_shared/min-release-age-OaYpLwux.js +0 -34
  273. package/dist/packem_shared/missing-package-json-BqS-OnKd.js +0 -1
  274. package/dist/packem_shared/native-config-sync-Ds1FtcrM.js +0 -21
  275. package/dist/packem_shared/osv-bloom-pKp7urSB.js +0 -2
  276. package/dist/packem_shared/otelPlugin-DmKDBaPo.js +0 -1
  277. package/dist/packem_shared/package-version-C47v64aB.js +0 -4
  278. package/dist/packem_shared/packument-HBVbyf7x.js +0 -1
  279. package/dist/packem_shared/pm-runner-C6eTANt1.js +0 -1
  280. package/dist/packem_shared/project-name-filter-CJ3XX2TI.js +0 -7
  281. package/dist/packem_shared/provenance-D4Cza8cp.js +0 -1
  282. package/dist/packem_shared/public-api-WqUCiyIe.js +0 -131
  283. package/dist/packem_shared/readJsonSync-DweZd5ZA-0eZh9sGm.js +0 -1
  284. package/dist/packem_shared/registry-keys-C0ez2VND.js +0 -1
  285. package/dist/packem_shared/resolve-explicit-BbT764KS.js +0 -5
  286. package/dist/packem_shared/resolve-runtime-D_vZovbB.js +0 -1
  287. package/dist/packem_shared/run-file-DyPFFN9U.js +0 -1
  288. package/dist/packem_shared/runtime-check-D4um-yQq.js +0 -1
  289. package/dist/packem_shared/s1ngularity-St6dhKiq.js +0 -1
  290. package/dist/packem_shared/scan-progress-q-N2JtIp.js +0 -2
  291. package/dist/packem_shared/selectors-Ce_6UAoY.js +0 -3
  292. package/dist/packem_shared/signatures-Dyeyg1q9.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-Cfy7c__2.js +0 -11
  297. package/dist/packem_shared/target-options-7XcbqGDe.js +0 -1
  298. package/dist/packem_shared/toolchain-C_pNMBM6.js +0 -5
  299. package/dist/packem_shared/typosquats-xzcAGPiM.js +0 -1
  300. package/dist/packem_shared/use-measured-height-CBjN0fle.js +0 -1
  301. package/dist/packem_shared/utils-CRueU43T.js +0 -1
  302. package/dist/packem_shared/verify-Dve9PQj3.js +0 -1
  303. package/dist/packem_shared/vis-update-app-DMAC2pPf.js +0 -1
  304. package/dist/packem_shared/vis-user-error-xmha3L4n.js +0 -30
  305. package/dist/packem_shared/watch-BXOOX7lx.js +0 -1
  306. package/dist/packem_shared/watch-loop-Q7UpkVbr.js +0 -11
@@ -1,24 +1,24 @@
1
- import{w as O,z as _,l as B,j as D,u as ce,P as ae}from"../packem_shared/index-uBVnF4ji.js";import{t as le,l as t,m as h,i as a,r as A,X as de,R as pe,x as fe,e as J}from"./catalog.js";import"../packem_shared/en-D3CfXlO7.js";import{I as he}from"../packem_shared/index-BWl4DbMp.js";import me from"module-replacements/manifests/micro-utilities.json"with{type:"json"};import ue from"module-replacements/manifests/native.json"with{type:"json"};import ge from"module-replacements/manifests/preferred.json"with{type:"json"};import{s as Z}from"../packem_shared/index-BAe6e0XE.js";import{J as xe,I as ye,K as je,M as ke,p as y}from"./cli-main.js";import"../packem_shared/public-api-WqUCiyIe.js";import{A as we,y as ve}from"../packem_shared/pm-runner-C6eTANt1.js";import{ScrollView as $e}from"@visulima/tui-kit/scroll-view";import{ScrollBar as be}from"@visulima/tui-kit/scroll-bar";import{a as Q}from"../packem_shared/readJsonSync-DweZd5ZA-0eZh9sGm.js";import{s as Ce}from"../packem_shared/glob-BUjyjdE8-C4M8e02u.js";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
1
+ import{e as $,z as P,l as ae,U as le}from"../packem_shared/index-DHD8wb6Z.js";import{U as de,V as fe,W as he,T as pe,u as ue,Y as me,p as g,C as ge}from"./cli-main.js";import{i as xe}from"../packem_shared/index-BjdW45xX.js";import je from"module-replacements/manifests/micro-utilities.json"with{type:"json"};import ve from"module-replacements/manifests/native.json"with{type:"json"};import we from"module-replacements/manifests/preferred.json"with{type:"json"};import{D as ke,y as r,X as p,m as l,u as A,R as Ce,i as be,j as K}from"./catalog.js";import{s as U}from"../packem_shared/index-B4AjSxHU.js";import{y as W}from"../packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{U as I}from"../packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js";import{d as ye,n as Se}from"../packem_shared/pm-runner-de-jCq8q.js";import{p as ee}from"../packem_shared/readJsonSync-CbryXYxN-B2aSeDpC.js";import{l as Ee}from"../packem_shared/glob-Cyk1H9ZL-ox19CSsT.js";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
2
2
  const require = __cjs_mod__.createRequire(import.meta.url);
3
- const Se=["dependencies","devDependencies","peerDependencies","peerDependenciesMeta","optionalDependencies","bundleDependencies"],Oe=["overrides","pnpm","resolutions"],Ne=["engines","files"],Ee=r=>{const e=Z.coerce(r)?.major;return e!==void 0&&e>=10},Pe=r=>{const e=O(r,"pnpm-workspace.yaml");if(!B(e))return{overrides:{},source:"pnpm-workspace.yaml"};try{return{overrides:ce(e)?.overrides??{},source:"pnpm-workspace.yaml"}}catch{return{overrides:{},source:"pnpm-workspace.yaml"}}},Te=(r,e)=>{let o={};return e==="deno"?{overrides:{},source:"package.json"}:(e==="pnpm"?o=r.pnpm?.overrides??{}:e==="yarn"||e==="bun"?o=r.resolutions??{}:o=r.overrides??{},{overrides:o,source:"package.json"})},Ae=(r,e,o)=>o.name==="pnpm"&&Ee(o.version)?Pe(r):Te(e,o.name),X=(r,e)=>{const o=e;for(const c of Oe){const s=r.indexOf(c);if(s!==-1&&c!==o)return o==="overrides"?s:s+1}let n=-1;for(const c of Se){const s=r.indexOf(c);s>n&&(n=s)}if(n!==-1)return n+1;for(const c of Ne){const s=r.indexOf(c);if(s!==-1)return s}return r.length},De=(r,e)=>{const o=O(r,"pnpm-workspace.yaml");if(!B(o))throw new Error(`pnpm-workspace.yaml not found at ${o}. Cannot write overrides for pnpm v10+.`);let n=_(o);const c=`overrides:
4
- ${Object.entries(e).map(([s,l])=>` '${s}': '${l}'`).join(`
3
+ const Oe=["dependencies","devDependencies","peerDependencies","peerDependenciesMeta","optionalDependencies","bundleDependencies"],$e=["overrides","pnpm","resolutions"],De=["engines","files"],Ne=t=>{const e=U.coerce(t)?.major;return e!==void 0&&e>=10},Ae=t=>{const e=$(t,"pnpm-workspace.yaml");if(!W(e))return{overrides:{},source:"pnpm-workspace.yaml"};try{return{overrides:ae(e)?.overrides??{},source:"pnpm-workspace.yaml"}}catch{return{overrides:{},source:"pnpm-workspace.yaml"}}},Ie=(t,e)=>{let n={};return e==="deno"?{overrides:{},source:"package.json"}:(e==="pnpm"?n=t.pnpm?.overrides??{}:e==="yarn"||e==="bun"?n=t.resolutions??{}:n=t.overrides??{},{overrides:n,source:"package.json"})},Pe=(t,e,n)=>n.name==="pnpm"&&Ne(n.version)?Ae(t):Ie(e,n.name),R=(t,e)=>{const n=e;for(const c of $e){const s=t.indexOf(c);if(s!==-1&&c!==n)return n==="overrides"?s:s+1}let o=-1;for(const c of Oe){const s=t.indexOf(c);s>o&&(o=s)}if(o!==-1)return o+1;for(const c of De){const s=t.indexOf(c);if(s!==-1)return s}return t.length},Fe=(t,e)=>{const n=$(t,"pnpm-workspace.yaml");if(!W(n))throw new Error(`pnpm-workspace.yaml not found at ${n}. Cannot write overrides for pnpm v10+.`);let o=P(n);const s=`overrides:
4
+ ${Object.entries(e).map(([d,u])=>` '${d}': '${u}'`).join(`
5
5
  `)}
6
- `;n=/^overrides:\s*$/m.test(n)||/^overrides:\s*\n/m.test(n)?n.replace(/^overrides:\s*\n(?:(?:[ \t].*)?\n)*/m,c):`${n.trimEnd()}
6
+ `;o=/^overrides:\s*$/m.test(o)||/^overrides:\s*\n/m.test(o)?o.replace(/^overrides:\s*\n(?:(?:[ \t].*)?\n)*/m,s):`${o.trimEnd()}
7
7
 
8
- ${c}`,D(o,n)},_e=(r,e,o,n,c)=>{const s=_(r),l=le(r,s,{useEditorconfig:c});if(n==="pnpm"){const m=e.pnpm??{};if(m.overrides=o,e.pnpm)e.pnpm=m,D(r,`${JSON.stringify(e,null,l)}
9
- `);else{const k=Object.keys(e),i=X(k,"pnpm"),d=Object.entries(e);d.splice(i,0,["pnpm",m]),D(r,`${JSON.stringify(Object.fromEntries(d),null,l)}
10
- `)}}else{const m=n==="yarn"||n==="bun"?"resolutions":"overrides";if(e[m])e[m]=o,D(r,`${JSON.stringify(e,null,l)}
11
- `);else{const k=Object.keys(e),i=X(k,m),d=Object.entries(e);d.splice(i,0,[m,o]),D(r,`${JSON.stringify(Object.fromEntries(d),null,l)}
12
- `)}}},Ie=(r,e,o,n,c)=>{if(n.name==="deno")return{added:[],updated:[]};const s=_(e),l=JSON.parse(s),{overrides:m,source:k}=Ae(r,l,n),i=[],d=[],u=new Set;if(n.name==="npm")for(const f of["dependencies","devDependencies"]){const x=l[f];if(x)for(const $ of Object.keys(x))u.add($)}for(const f of o){const x=m[f.original];if(typeof x=="object")continue;let $=f.spec;n.name==="npm"&&u.has(f.original)&&($=`$${f.original}`),x!==$&&(x?d.push(f.original):i.push(f.original),m[f.original]=$)}if(i.length===0&&d.length===0)return{added:i,updated:d};const j=Object.fromEntries(Object.entries(m).sort(([f],[x])=>f.localeCompare(x)));return k==="pnpm-workspace.yaml"?De(r,j):_e(e,l,j,n.name,c),{added:i,updated:d}},Re=(r,e)=>{const o={bun:["bun.lock"],deno:["deno.lock"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]};for(const n of o[e]??[]){const c=O(r,n);try{return _(c)}catch{continue}}return""},Fe=(r,e,o)=>{if(!r)return!1;const n=e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`);switch(o){case"bun":return r.includes(`"${e}":`)||new RegExp(String.raw`(^|\s|[",])${n}@`,"m").test(r);case"deno":return r.includes(`"${e}"`)||r.includes(`"npm:${e}@`)||r.includes(`"jsr:${e}@`);case"npm":return r.includes(`"${e}":`)||r.includes(`"node_modules/${e}":`);case"pnpm":return new RegExp(String.raw`(^|\s|['"/])${n}(@|['"]?:)`,"m").test(r);case"yarn":return new RegExp(String.raw`(^|\s|[",])${n}@`,"m").test(r);default:return!1}};var z={exports:{}},U,H;function K(){if(H)return U;H=1;var r=Object.defineProperty,e=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,n=Object.prototype.hasOwnProperty,c=(i,d)=>{for(var u in d)r(i,u,{get:d[u],enumerable:!0})},s=(i,d,u,j)=>{if(d&&typeof d=="object"||typeof d=="function")for(let f of o(d))!n.call(i,f)&&f!==u&&r(i,f,{get:()=>d[f],enumerable:!(j=e(d,f))||j.enumerable});return i},l=i=>s(r({},"__esModule",{value:!0}),i),m={};c(m,{PURL_Type:()=>k}),U=l(m);var k=(i=>(i.APK="apk",i.BITBUCKET="bitbucket",i.COCOAPODS="cocoapods",i.CARGO="cargo",i.CHROME="chrome",i.COMPOSER="composer",i.CONAN="conan",i.CONDA="conda",i.CRAN="cran",i.DEB="deb",i.DOCKER="docker",i.GEM="gem",i.GENERIC="generic",i.GITHUB="github",i.GOLANG="golang",i.HACKAGE="hackage",i.HEX="hex",i.HUGGINGFACE="huggingface",i.MAVEN="maven",i.MLFLOW="mlflow",i.NPM="npm",i.NUGET="nuget",i.OCI="oci",i.PUB="pub",i.PYPI="pypi",i.QPKG="qpkg",i.RPM="rpm",i.SWID="swid",i.SWIFT="swift",i.VCS="vcs",i))(k||{});return U}var V;function Me(){return V||(V=1,(function(r){var e=Object.defineProperty,o=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,s=(d,u)=>{for(var j in u)e(d,j,{get:u[j],enumerable:!0})},l=(d,u,j,f)=>{if(u&&typeof u=="object"||typeof u=="function")for(let x of n(u))!c.call(d,x)&&x!==j&&e(d,x,{get:()=>u[x],enumerable:!(f=o(u,x))||f.enumerable});return d},m=(d,u,j)=>(l(d,u,"default"),j&&l(j,u,"default")),k={};s(k,{getManifestData:()=>i}),m(k,K(),r.exports);function i(d,u){try{const j=require("../manifest.json");if(!d)return j;const f=j[d];if(!f)return;if(!u)return f;const x=f.find(([$,g])=>g.package===u);return x?x[1]:void 0}catch{return}}r.exports={getManifestData:i,...K()}})(z)),z.exports}var Ge=Me();const Le=(r,e,o)=>{let n=r;if(e!=="all"&&(n=n.filter(c=>c.category===e)),o){const c=o.toLowerCase();n=n.filter(s=>s.packageName.toLowerCase().includes(c))}return n};class ze{#e;#t=new Set;constructor(e){this.#e={applyProgress:null,checkedEntries:new Set,entries:e,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",phase:"browsing",selectedIndex:0}}getSnapshot=()=>this.#e;subscribe=e=>(this.#t.add(e),()=>{this.#t.delete(e)});getFilteredEntries=()=>Le(this.#e.entries,this.#e.filterType,this.#e.filterText);#r(){this.#e={...this.#e};for(const e of this.#t)e()}select(e){const o=this.getFilteredEntries();this.#e.selectedIndex=o.length===0?-1:Math.max(0,Math.min(e,o.length-1)),this.#r()}toggleCheck(e){const o=new Set(this.#e.checkedEntries);o.has(e)?o.delete(e):o.add(e),this.#e.checkedEntries=o,this.#r()}toggleAll(){const e=this.getFilteredEntries(),o=new Set(this.#e.checkedEntries);if(e.every(n=>o.has(n.packageName)))for(const n of e)o.delete(n.packageName);else for(const n of e)o.add(n.packageName);this.#e.checkedEntries=o,this.#r()}setFilter(e){this.#e.filterType=e,this.#e.selectedIndex=0,this.#r()}setFilterText(e){this.#e.filterText=e,this.#e.selectedIndex=0,this.#r()}setFilterActive(e){this.#e.filterActive=e,this.#r()}setFocusedPanel(e){this.#e.focusedPanel=e,this.#r()}setPhase(e){this.#e.phase=e,this.#r()}setProgress(e,o){this.#e.applyProgress={current:e,total:o},this.#r()}setError(e){this.#e.error=e,this.#e.phase="error",this.#r()}getCheckedEntries(){return this.#e.entries.filter(e=>this.#e.checkedEntries.has(e.packageName))}}const ee={"micro-utility":"gray",native:"green",preferred:"yellow",socket:"cyan"},Ue={"micro-utility":"MICRO",native:"NATIVE",preferred:"PREF",socket:"SOCKET"},qe={"micro-utility":"Trivial utility package that can be replaced with inline code.",native:"Polyfill for a native JS/Node.js API. Use the built-in instead.",preferred:"A lighter or faster alternative package exists.",socket:"Security-hardened replacement from Socket.dev's @socketregistry."},Be=({entry:r,focused:e,scrollRef:o})=>{const n=e?"white":"gray";if(!r)return t.jsx(h,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:t.jsx(a,{dimColor:!0,children:"No entry selected"})});const c=ee[r.category]??"gray";return t.jsxs(h,{borderColor:n,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsx(h,{flexShrink:0,paddingTop:1,paddingX:2,children:t.jsx(a,{bold:!0,color:"white",children:r.packageName})}),t.jsxs($e,{flexGrow:1,flexShrink:1,paddingX:2,ref:o,scrollbar:!0,scrollbarColor:"gray",children:[t.jsx(a,{}),t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Category:"})}),t.jsx(a,{bold:!0,color:c,children:r.category})]}),t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Replace with:"})}),t.jsx(a,{children:r.replacement})]}),r.overrideSpec&&t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Override:"})}),t.jsx(a,{color:"cyan",children:r.overrideSpec})]}),t.jsxs(h,{children:[t.jsx(h,{width:14,children:t.jsx(a,{dimColor:!0,children:"Codemod:"})}),t.jsx(a,{color:r.hasCodemod?"green":"gray",children:r.hasCodemod?"available ⚙":"not available"})]}),t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"white",children:"DESCRIPTION"}),t.jsx(h,{marginTop:1,paddingLeft:2,children:t.jsx(a,{children:qe[r.category]??""})})]}),r.category==="native"&&t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"green",children:"ACTION"}),t.jsx(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:r.hasCodemod?t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"green",children:["✓"," ","Codemod will rewrite imports to use native API."]}),t.jsx(a,{dimColor:!0,children:" The package can then be removed from dependencies."})]}):t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"yellow",children:["ℹ"," ","No automated codemod available."]}),t.jsx(a,{dimColor:!0,children:" Manual migration required — replace usage with native equivalent."})]})})]}),r.category==="socket"&&t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"cyan",children:"ACTION"}),t.jsxs(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.jsxs(a,{color:"cyan",children:["✓"," ","Override will redirect resolution to the hardened package."]}),t.jsx(a,{dimColor:!0,children:" No source code changes needed — drop-in replacement."})]})]}),(r.category==="preferred"||r.category==="micro-utility")&&t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"yellow",children:"ACTION"}),t.jsx(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:r.hasCodemod?t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"green",children:["✓"," ","Codemod will rewrite imports to the recommended alternative."]}),t.jsx(a,{dimColor:!0,children:" The original package can then be removed from dependencies."})]}):t.jsxs(t.Fragment,{children:[t.jsxs(a,{color:"yellow",children:["ℹ"," ","Manual migration required."]}),r.docUrl?t.jsx(a,{dimColor:!0,children:" Open the migration guide below for the recommended alternative and steps."}):t.jsx(a,{dimColor:!0,children:" Consult the package's docs or the e18e module-replacements guide for an alternative."})]})})]}),t.jsxs(h,{flexDirection:"column",marginTop:1,children:[t.jsx(a,{dimColor:!0,children:"── "}),t.jsx(a,{bold:!0,color:"white",children:"LINKS"}),t.jsxs(h,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.jsxs(a,{color:"cyan",underline:!0,children:["https://npmx.dev/",r.packageName]}),r.docUrl&&t.jsx(a,{color:"cyan",underline:!0,children:r.docUrl})]})]})]})]})},Je=[{key:"all",label:"All",shortcut:"1"},{key:"native",label:"Native",shortcut:"2"},{key:"preferred",label:"Preferred",shortcut:"3"},{key:"micro-utility",label:"Micro",shortcut:"4"},{key:"socket",label:"Socket",shortcut:"5"}],Xe=({checked:r,entry:e,isSelected:o})=>{const n=ee[e.category]??"white",c=Ue[e.category]??e.category,s=r?"☑":"☐",l=e.hasCodemod?"⚙":" ";return t.jsxs(h,{flexShrink:0,height:1,children:[t.jsx(a,{children:o?">":" "}),t.jsxs(a,{color:r?"white":"gray",children:[" ",s," "]}),t.jsx(a,{bold:!0,color:n,children:`[${c}]`.padEnd(9)}),t.jsxs(a,{children:[" ",l," "]}),t.jsx(h,{flexGrow:1,children:t.jsx(a,{bold:o,inverse:o,wrap:"truncate",children:e.packageName})}),t.jsx(a,{dimColor:!0,children:" → "}),t.jsx(a,{wrap:"truncate",children:e.replacement})]})},He=({checkedEntries:r,entries:e,filterActive:o,filterText:n,filterType:c,focused:s,isDryRun:l,scrollOffset:m,selectedIndex:k,totalEntries:i,viewportHeight:d})=>{const u=s?"white":"gray";let j=0,f=0,x=0,$=0;for(const C of e)switch(C.category){case"micro-utility":{x++;break}case"native":{j++;break}case"preferred":{f++;break}case"socket":{$++;break}}const g=[];j>0&&g.push(`${j} native`),f>0&&g.push(`${f} preferred`),x>0&&g.push(`${x} micro`),$>0&&g.push(`${$} socket`);const w=g.length>0?` (${g.join(", ")})`:"",b=r.size,P=[];for(const[C,p]of e.entries())P.push(t.jsx(Xe,{checked:r.has(p.packageName),entry:p,isSelected:C===k},p.packageName));const N=e.length,T=N>d&&d>0;return t.jsxs(h,{borderColor:u,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[t.jsxs(h,{flexShrink:0,gap:1,paddingX:1,children:[t.jsx(a,{bold:!0,inverse:!0,children:" VIS OPTIMIZE "}),t.jsxs(a,{wrap:"truncate",children:[i," ","optimizations",w]}),!l&&b>0&&t.jsxs(a,{dimColor:!0,children:[" ","—",b," ","selected"]})]}),t.jsx(h,{flexShrink:0,gap:1,paddingX:1,paddingY:1,children:Je.map(C=>{const p=c===C.key;return t.jsxs(h,{children:[t.jsx(a,{dimColor:!p,children:"["}),t.jsx(a,{bold:p,color:p?"cyan":"gray",children:C.shortcut}),t.jsx(a,{dimColor:!p,children:"]"}),t.jsxs(a,{color:p?"white":"gray",children:[" ",C.label]})]},C.key)})}),o&&t.jsxs(h,{flexShrink:0,paddingX:1,children:[t.jsx(a,{bold:!0,color:"white",children:"/ "}),t.jsx(a,{children:n}),t.jsx(a,{inverse:!0,children:" "})]}),t.jsxs(h,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[t.jsx(h,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:t.jsx(h,{flexDirection:"column",marginTop:-m,children:P})}),T&&t.jsx(h,{flexShrink:0,marginLeft:1,marginRight:1,children:t.jsx(be,{contentHeight:N,placement:"inset",scrollOffset:m,style:"block",viewportHeight:d})})]})]})},Ke=100,W=10,Y={1:"all",2:"native",3:"preferred",4:"micro-utility",5:"socket"},Ve=({isDryRun:r,store:e})=>{const{exit:o}=xe(),{columns:n,rows:c}=ye(),s=A.useSyncExternalStore(e.subscribe,e.getSnapshot),l=A.useRef(null),[m,k]=A.useState(0),[i,d]=A.useState(!1),u=e.getFilteredEntries(),j=u[s.selectedIndex]??null,f=n>=Ke,x=Math.max(0,c-5),$=A.useCallback(g=>{o(g)},[o]);return je((g,w)=>{if(i){g==="y"||g==="Y"?$():d(!1);return}if(s.filterActive){w.escape?(e.setFilterActive(!1),e.setFilterText("")):w.return?e.setFilterActive(!1):w.backspace||w.delete?e.setFilterText(s.filterText.slice(0,-1)):g&&!w.ctrl&&!w.meta&&e.setFilterText(s.filterText+g);return}if(g==="q"){!r&&s.checkedEntries.size>0?d(!0):$();return}if(g==="/"){e.setFilterActive(!0);return}if(Y[g]){e.setFilter(Y[g]);return}if(w.tab){e.setFocusedPanel(s.focusedPanel==="list"?"detail":"list");return}if(s.focusedPanel==="list")if(w.upArrow||g==="k"){const b=Math.max(0,s.selectedIndex-1);e.select(b),b<m&&k(b)}else if(w.downArrow||g==="j"){const b=Math.min(u.length-1,s.selectedIndex+1);e.select(b),b>=m+x&&k(b-x+1)}else g===" "?j&&e.toggleCheck(j.packageName):g==="a"?e.toggleAll():w.return&&!r&&s.checkedEntries.size>0&&$(e.getCheckedEntries());else s.focusedPanel==="detail"&&(w.upArrow||g==="k"?l.current?.scrollBy(-1):(w.downArrow||g==="j")&&l.current?.scrollBy(1))},{isActive:s.phase==="browsing"}),c<W?t.jsx(h,{alignItems:"center",justifyContent:"center",children:t.jsxs(a,{color:"yellow",children:["Terminal too small. Resize to at least",W," ","rows."]})}):t.jsxs(h,{flexDirection:"column",height:c,width:n,children:[t.jsxs(h,{flexDirection:f?"row":"column",flexGrow:1,children:[t.jsx(h,{flexBasis:f?"50%":void 0,flexGrow:1,children:t.jsx(He,{checkedEntries:s.checkedEntries,entries:u,filterActive:s.filterActive,filterText:s.filterText,filterType:s.filterType,focused:s.focusedPanel==="list",isDryRun:r,scrollOffset:m,selectedIndex:s.selectedIndex,totalEntries:s.entries.length,viewportHeight:x})}),t.jsx(h,{flexBasis:f?"50%":void 0,flexGrow:1,children:t.jsx(Be,{entry:j,focused:s.focusedPanel==="detail",scrollRef:l})})]}),t.jsx(h,{flexShrink:0,paddingX:1,children:t.jsxs(a,{dimColor:!0,children:[r?"Preview mode":"space:toggle a:all enter:apply"," ","| tab:switch panel /: filter q:quit |","⚙","=codemod available"]})}),t.jsx(ke,{autoExitSeconds:3,onCancel:()=>{d(!1)},visible:i})]})},q=(r,e)=>{const o=new Set;try{const n=Q(r),c=e?[n.dependencies,n.optionalDependencies]:[n.dependencies,n.devDependencies,n.peerDependencies,n.optionalDependencies];for(const s of c)if(s)for(const l of Object.keys(s))o.add(l)}catch{}return o},re=r=>{const e=fe(r);if(e)return J(r,e);const o=O(r,"package.json");if(!B(o))return[];try{const n=Q(o),c=Array.isArray(n.workspaces)?n.workspaces:n.workspaces?.packages;return c?J(r,c):[]}catch{return[]}},We="https://github.com/es-tooling/module-replacements/blob/main/docs/modules",Ye=r=>`${We}/${r}.md`,Ze=r=>{if(r.type==="simple"&&r.replacement)return r.replacement;if(r.type==="native"){const e=r.nodeVersion?` (Node ${r.nodeVersion}+)`:"";return r.replacement?`${r.replacement}${e}`:`Native API${e}`}return r.type==="documented"&&r.docPath?"see migration guide":""},te=r=>{const e=[],o=(n,c)=>{const s=n.moduleReplacements;if(Array.isArray(s))for(const l of s)r.has(l.moduleName)&&e.push({category:c,docUrl:l.type==="documented"&&l.docPath?Ye(l.docPath):void 0,hasCodemod:!1,overrideSpec:void 0,packageName:l.moduleName,replacement:Ze(l)})};return o(ue,"native"),o(ge,"preferred"),o(me,"micro-utility"),e},oe=(r,e,o,n)=>{const c=Ge.getManifestData("npm")??[],s=[];for(const[,l]of c){if(l.deprecated)continue;const m=r.has(l.package),k=e?Fe(e,l.package,o.name):!1;if(!m&&!k)continue;const i=Z.coerce(l.version)?.major;if(i===void 0)continue;const d=n?`npm:${l.name}@${l.version}`:`npm:${l.name}@^${String(i)}`;s.push({category:"socket",hasCodemod:!1,overrideSpec:d,packageName:l.package,replacement:l.name})}return s};let G;const ne=async()=>{if(G)return G;try{return G=(await import("module-replacements-codemods")).codemods,G}catch{return{}}},ie=async r=>{try{const e=await ne();for(const o of r)o.category!=="socket"&&e[o.packageName]&&(o.hasCodemod=!0)}catch{}},se=async(r,e,o)=>{let n=0;try{const c=(await ne())[o];if(!c)return{filesChanged:0,packageName:o};const s=c({}),l=await Qe(e);for(const m of l){const k=_(m);if(k.includes(o))try{const i=await s.transform({file:{filename:m,source:k}});i!==k&&(await r.writeFile(m,i,"utf8"),n++)}catch(i){process.stderr.write(`warn: codemod transform failed for ${m}: ${i instanceof Error?i.message:String(i)}
13
- `)}}}catch{}return{filesChanged:n,packageName:o}},Qe=async r=>Ce("**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}",{absolute:!0,cwd:r,ignore:["**/.*/**","**/.*","**/node_modules/**","**/dist/**","**/coverage/**","**/.git/**","**/.next/**","**/.nuxt/**"]}),er=async({fs:r,logger:e,options:o,visConfig:n,workspaceRoot:c})=>{if(!c)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const s=we(c),l=!!o.dryRun,m=!!o.prod,k=!!o.pin;y.info(`Detected ${s.name} v${s.version}.`);const i=q(O(c,"package.json"),m),d=re(c),u=new Set(i);for(const p of d){const I=q(O(ae(c,p),"package.json"),m);for(const E of I)u.add(E)}d.length>0&&y.info(`Scanned ${String(d.length)} workspace package${d.length===1?"":"s"}.`),y.info(`Scanning dependencies...
14
- `);const j=Re(c,s.name),f=te(u),x=oe(u,j,s,k),$=new Set(f.map(p=>p.packageName)),g=x.filter(p=>!$.has(p.packageName)),w=[...f,...g];if(await ie(w),w.length===0){y.info("No optimizations found for your dependencies.");return}const b=!!process.stdout.isTTY&&!he,P=o.format==="json"||!!o.json;if(b&&!l&&!P){const p=new ze(w),I=await de(pe.createElement(Ve,{isDryRun:!1,store:p}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),E=Array.isArray(I)?I:[];if(E.length===0){y.info("No optimizations selected.");return}const R=E.filter(v=>v.category!=="socket"&&v.hasCodemod),F=E.filter(v=>v.category!=="socket"&&!v.hasCodemod),L=E.filter(v=>v.category==="socket");if(R.length>0){y.info(`
15
- Running ${String(R.length)} codemod${R.length===1?"":"s"}...
16
- `);for(const v of R){const S=await se(r,c,v.packageName);S.filesChanged>0?y.success(` ${v.packageName}: ${String(S.filesChanged)} file${S.filesChanged===1?"":"s"} updated`):y.info(` ${v.packageName}: no files changed`)}}if(F.length>0){y.warn(`
17
- ${String(F.length)} selected replacement${F.length===1?"":"s"} require manual migration (no codemod available):`);for(const v of F)y.info(` ${v.packageName} → ${v.replacement}`);y.notice(" Replace usage in your source code, then remove from dependencies.")}if(L.length>0){const v=L.filter(M=>M.overrideSpec).map(M=>({original:M.packageName,spec:M.overrideSpec})),S=Ie(c,O(c,"package.json"),v,s,n?.editorconfig??!0);S.added.length>0&&y.success(`
18
- Added ${String(S.added.length)} override${S.added.length===1?"":"s"}.`),S.updated.length>0&&y.success(`Updated ${String(S.updated.length)} override${S.updated.length===1?"":"s"}.`)}if(L.length>0&&o.install!==!1){y.info(`
19
- Running ${s.name} install to update lockfile...`);const v=ve(s,{dev:!1,filter:[],force:!1,frozenLockfile:!1,ignoreScripts:!1,lockfileOnly:!1,noOptional:!1,offline:!1,prod:!1,recursive:!1,silent:!1,workspaceRoot:!1},c,e);v!==0&&y.warn(`${s.name} install exited with code ${String(v)}. Run it manually.`)}y.info(""),y.success("Optimization complete.");return}if(P){process.stdout.write(`${JSON.stringify({e18e:f.map(p=>({category:p.category,hasCodemod:p.hasCodemod,packageName:p.packageName,replacement:p.replacement})),packageManager:s.name,socket:g.map(p=>({overrideSpec:p.overrideSpec,packageName:p.packageName,replacement:p.replacement})),total:w.length,workspaces:d.length},void 0,2)}
20
- `);return}const N=f.filter(p=>p.category==="native"),T=f.filter(p=>p.category==="preferred"),C=f.filter(p=>p.category==="micro-utility");if(N.length>0){y.info(`Native replacements (${String(N.length)}):`);for(const p of N)y.info(` ${p.hasCodemod?"⚙":" "} ${p.packageName} → ${p.replacement}`)}if(T.length>0){y.info(`
21
- Preferred alternatives (${String(T.length)}):`);for(const p of T)y.info(` ${p.hasCodemod?"⚙":" "} ${p.packageName} → ${p.replacement}`)}if(C.length>0){y.info(`
22
- Micro-utilities (${String(C.length)}):`);for(const p of C)y.info(` ${p.hasCodemod?"⚙":" "} ${p.packageName} → ${p.replacement}`)}if(g.length>0){y.info(`
23
- Socket.dev overrides (${String(g.length)}):`);for(const p of g)y.info(` ${p.packageName} → ${p.overrideSpec}`)}y.info(`
24
- Total: ${String(w.length)} optimizations available (⚙ = codemod available).`),l&&y.notice("Run without --dry-run for interactive selection.")},gr=Object.defineProperty({__proto__:null,buildE18eEntries:te,buildSocketEntries:oe,collectDepsFromPkgJson:q,default:er,discoverWorkspacePackages:re,markCodemodAvailability:ie,runCodemod:se},Symbol.toStringTag,{value:"Module"});export{re as A,te as F,se as I,Re as N,oe as T,ie as U,Ie as a,gr as h,q as x};
8
+ ${s}`,I(n,o)},Me=(t,e,n,o,c)=>{const s=P(t),d=ke(t,s,{useEditorconfig:c});if(o==="pnpm"){const u=e.pnpm??{};if(u.overrides=n,e.pnpm)e.pnpm=u,I(t,`${JSON.stringify(e,null,d)}
9
+ `);else{const j=Object.keys(e),i=R(j,"pnpm"),a=Object.entries(e);a.splice(i,0,["pnpm",u]),I(t,`${JSON.stringify(Object.fromEntries(a),null,d)}
10
+ `)}}else{const u=o==="yarn"||o==="bun"?"resolutions":"overrides";if(e[u])e[u]=n,I(t,`${JSON.stringify(e,null,d)}
11
+ `);else{const j=Object.keys(e),i=R(j,u),a=Object.entries(e);a.splice(i,0,[u,n]),I(t,`${JSON.stringify(Object.fromEntries(a),null,d)}
12
+ `)}}},Ge=(t,e,n,o,c)=>{if(o.name==="deno")return{added:[],updated:[]};const s=P(e),d=JSON.parse(s),{overrides:u,source:j}=Pe(t,d,o),i=[],a=[],m=new Set;if(o.name==="npm")for(const h of["dependencies","devDependencies"]){const v=d[h];if(v)for(const y of Object.keys(v))m.add(y)}for(const h of n){const v=u[h.original];if(typeof v=="object")continue;let y=h.spec;o.name==="npm"&&m.has(h.original)&&(y=`$${h.original}`),v!==y&&(v?a.push(h.original):i.push(h.original),u[h.original]=y)}if(i.length===0&&a.length===0)return{added:i,updated:a};const x=Object.fromEntries(Object.entries(u).sort(([h],[v])=>h.localeCompare(v)));return j==="pnpm-workspace.yaml"?Fe(t,x):Me(e,d,x,o.name,c),{added:i,updated:a}},Te=(t,e)=>{const n={bun:["bun.lock"],deno:["deno.lock"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]};for(const o of n[e]??[]){const c=$(t,o);try{return P(c)}catch{continue}}return""},_e=(t,e,n)=>{if(!t)return!1;const o=e.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`);switch(n){case"bun":return t.includes(`"${e}":`)||new RegExp(String.raw`(^|\s|[",])${o}@`,"m").test(t);case"deno":return t.includes(`"${e}"`)||t.includes(`"npm:${e}@`)||t.includes(`"jsr:${e}@`);case"npm":return t.includes(`"${e}":`)||t.includes(`"node_modules/${e}":`);case"pnpm":return new RegExp(String.raw`(^|\s|['"/])${o}(@|['"]?:)`,"m").test(t);case"yarn":return new RegExp(String.raw`(^|\s|[",])${o}@`,"m").test(t);default:return!1}};var q={exports:{}},H,X;function L(){if(X)return H;X=1;var t=Object.defineProperty,e=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,c=(i,a)=>{for(var m in a)t(i,m,{get:a[m],enumerable:!0})},s=(i,a,m,x)=>{if(a&&typeof a=="object"||typeof a=="function")for(let h of n(a))!o.call(i,h)&&h!==m&&t(i,h,{get:()=>a[h],enumerable:!(x=e(a,h))||x.enumerable});return i},d=i=>s(t({},"__esModule",{value:!0}),i),u={};c(u,{PURL_Type:()=>j}),H=d(u);var j=(i=>(i.APK="apk",i.BITBUCKET="bitbucket",i.COCOAPODS="cocoapods",i.CARGO="cargo",i.CHROME="chrome",i.COMPOSER="composer",i.CONAN="conan",i.CONDA="conda",i.CRAN="cran",i.DEB="deb",i.DOCKER="docker",i.GEM="gem",i.GENERIC="generic",i.GITHUB="github",i.GOLANG="golang",i.HACKAGE="hackage",i.HEX="hex",i.HUGGINGFACE="huggingface",i.MAVEN="maven",i.MLFLOW="mlflow",i.NPM="npm",i.NUGET="nuget",i.OCI="oci",i.PUB="pub",i.PYPI="pypi",i.QPKG="qpkg",i.RPM="rpm",i.SWID="swid",i.SWIFT="swift",i.VCS="vcs",i))(j||{});return H}var Q;function Be(){return Q||(Q=1,(function(t){var e=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,s=(a,m)=>{for(var x in m)e(a,x,{get:m[x],enumerable:!0})},d=(a,m,x,h)=>{if(m&&typeof m=="object"||typeof m=="function")for(let v of o(m))!c.call(a,v)&&v!==x&&e(a,v,{get:()=>m[v],enumerable:!(h=n(m,v))||h.enumerable});return a},u=(a,m,x)=>(d(a,m,"default"),x&&d(x,m,"default")),j={};s(j,{getManifestData:()=>i}),u(j,L(),t.exports);function i(a,m){try{const x=require("../manifest.json");if(!a)return x;const h=x[a];if(!h)return;if(!m)return h;const v=h.find(([y,k])=>k.package===m);return v?v[1]:void 0}catch{return}}t.exports={getManifestData:i,...L()}})(q)),q.exports}var ze=Be();const qe=(t,e,n)=>{let o=t;if(e!=="all"&&(o=o.filter(c=>c.category===e)),n){const c=n.toLowerCase();o=o.filter(s=>s.packageName.toLowerCase().includes(c))}return o};class He{#e;#r=new Set;constructor(e){this.#e={applyProgress:null,checkedEntries:new Set,entries:e,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",phase:"browsing",selectedIndex:0}}getSnapshot=()=>this.#e;subscribe=e=>(this.#r.add(e),()=>{this.#r.delete(e)});getFilteredEntries=()=>qe(this.#e.entries,this.#e.filterType,this.#e.filterText);#t(){this.#e={...this.#e};for(const e of this.#r)e()}select(e){const n=this.getFilteredEntries();this.#e.selectedIndex=n.length===0?-1:Math.max(0,Math.min(e,n.length-1)),this.#t()}toggleCheck(e){const n=new Set(this.#e.checkedEntries);n.has(e)?n.delete(e):n.add(e),this.#e.checkedEntries=n,this.#t()}toggleAll(){const e=this.getFilteredEntries(),n=new Set(this.#e.checkedEntries);if(e.every(c=>n.has(c.packageName)))for(const c of e)n.delete(c.packageName);else for(const c of e)n.add(c.packageName);this.#e.checkedEntries=n,this.#t()}setFilter(e){this.#e.filterType=e,this.#e.selectedIndex=0,this.#t()}setFilterText(e){this.#e.filterText=e,this.#e.selectedIndex=0,this.#t()}setFilterActive(e){this.#e.filterActive=e,this.#t()}setFocusedPanel(e){this.#e.focusedPanel=e,this.#t()}setPhase(e){this.#e.phase=e,this.#t()}setProgress(e,n){this.#e.applyProgress={current:e,total:n},this.#t()}setError(e){this.#e.error=e,this.#e.phase="error",this.#t()}getCheckedEntries(){return this.#e.entries.filter(e=>this.#e.checkedEntries.has(e.packageName))}}const te={"micro-utility":"gray",native:"green",preferred:"yellow",socket:"cyan"},Ve={"micro-utility":"MICRO",native:"NATIVE",preferred:"PREF",socket:"SOCKET"},We={"micro-utility":"Trivial utility package that can be replaced with inline code.",native:"Polyfill for a native JS/Node.js API. Use the built-in instead.",preferred:"A lighter or faster alternative package exists.",socket:"Security-hardened replacement from Socket.dev's @socketregistry."},Ye=({entry:t,focused:e,scrollRef:n})=>{const o=e?"white":"gray";if(!t)return r.jsx(p,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:r.jsx(l,{dimColor:!0,children:"No entry selected"})});const c=te[t.category]??"gray";return r.jsxs(p,{borderColor:o,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[r.jsx(p,{flexShrink:0,paddingTop:1,paddingX:2,children:r.jsx(l,{bold:!0,color:"white",children:t.packageName})}),r.jsxs(de,{flexGrow:1,flexShrink:1,paddingX:2,ref:n,scrollbar:!0,scrollbarColor:"gray",children:[r.jsx(l,{}),r.jsxs(p,{children:[r.jsx(p,{width:14,children:r.jsx(l,{dimColor:!0,children:"Category:"})}),r.jsx(l,{bold:!0,color:c,children:t.category})]}),r.jsxs(p,{children:[r.jsx(p,{width:14,children:r.jsx(l,{dimColor:!0,children:"Replace with:"})}),r.jsx(l,{children:t.replacement})]}),t.overrideSpec&&r.jsxs(p,{children:[r.jsx(p,{width:14,children:r.jsx(l,{dimColor:!0,children:"Override:"})}),r.jsx(l,{color:"cyan",children:t.overrideSpec})]}),r.jsxs(p,{children:[r.jsx(p,{width:14,children:r.jsx(l,{dimColor:!0,children:"Codemod:"})}),r.jsx(l,{color:t.hasCodemod?"green":"gray",children:t.hasCodemod?"available ⚙":"not available"})]}),r.jsxs(p,{flexDirection:"column",marginTop:1,children:[r.jsx(l,{dimColor:!0,children:"── "}),r.jsx(l,{bold:!0,color:"white",children:"DESCRIPTION"}),r.jsx(p,{marginTop:1,paddingLeft:2,children:r.jsx(l,{children:We[t.category]??""})})]}),t.category==="native"&&r.jsxs(p,{flexDirection:"column",marginTop:1,children:[r.jsx(l,{dimColor:!0,children:"── "}),r.jsx(l,{bold:!0,color:"green",children:"ACTION"}),r.jsx(p,{flexDirection:"column",marginTop:1,paddingLeft:2,children:t.hasCodemod?r.jsxs(r.Fragment,{children:[r.jsxs(l,{color:"green",children:["✓"," ","Codemod will rewrite imports to use native API."]}),r.jsx(l,{dimColor:!0,children:" The package can then be removed from dependencies."})]}):r.jsxs(r.Fragment,{children:[r.jsxs(l,{color:"yellow",children:["ℹ"," ","No automated codemod available."]}),r.jsx(l,{dimColor:!0,children:" Manual migration required — replace usage with native equivalent."})]})})]}),t.category==="socket"&&r.jsxs(p,{flexDirection:"column",marginTop:1,children:[r.jsx(l,{dimColor:!0,children:"── "}),r.jsx(l,{bold:!0,color:"cyan",children:"ACTION"}),r.jsxs(p,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[r.jsxs(l,{color:"cyan",children:["✓"," ","Override will redirect resolution to the hardened package."]}),r.jsx(l,{dimColor:!0,children:" No source code changes needed — drop-in replacement."})]})]}),(t.category==="preferred"||t.category==="micro-utility")&&r.jsxs(p,{flexDirection:"column",marginTop:1,children:[r.jsx(l,{dimColor:!0,children:"── "}),r.jsx(l,{bold:!0,color:"yellow",children:"ACTION"}),r.jsx(p,{flexDirection:"column",marginTop:1,paddingLeft:2,children:t.hasCodemod?r.jsxs(r.Fragment,{children:[r.jsxs(l,{color:"green",children:["✓"," ","Codemod will rewrite imports to the recommended alternative."]}),r.jsx(l,{dimColor:!0,children:" The original package can then be removed from dependencies."})]}):r.jsxs(r.Fragment,{children:[r.jsxs(l,{color:"yellow",children:["ℹ"," ","Manual migration required."]}),t.docUrl?r.jsx(l,{dimColor:!0,children:" Open the migration guide below for the recommended alternative and steps."}):r.jsx(l,{dimColor:!0,children:" Consult the package's docs or the e18e module-replacements guide for an alternative."})]})})]}),r.jsxs(p,{flexDirection:"column",marginTop:1,children:[r.jsx(l,{dimColor:!0,children:"── "}),r.jsx(l,{bold:!0,color:"white",children:"LINKS"}),r.jsxs(p,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[r.jsxs(l,{color:"cyan",underline:!0,children:["https://npmx.dev/",t.packageName]}),t.docUrl&&r.jsx(l,{color:"cyan",underline:!0,children:t.docUrl})]})]})]})]})},Ke=[{key:"all",label:"All",shortcut:"1"},{key:"native",label:"Native",shortcut:"2"},{key:"preferred",label:"Preferred",shortcut:"3"},{key:"micro-utility",label:"Micro",shortcut:"4"},{key:"socket",label:"Socket",shortcut:"5"}],Re=({checked:t,entry:e,isSelected:n})=>{const o=te[e.category]??"white",c=Ve[e.category]??e.category,s=t?"☑":"☐",d=e.hasCodemod?"⚙":" ";return r.jsxs(p,{flexShrink:0,height:1,children:[r.jsx(l,{children:n?">":" "}),r.jsxs(l,{color:t?"white":"gray",children:[" ",s," "]}),r.jsx(l,{bold:!0,color:o,children:`[${c}]`.padEnd(9)}),r.jsxs(l,{children:[" ",d," "]}),r.jsx(p,{flexGrow:1,children:r.jsx(l,{bold:n,inverse:n,wrap:"truncate",children:e.packageName})}),r.jsx(l,{dimColor:!0,children:" → "}),r.jsx(l,{wrap:"truncate",children:e.replacement})]})},Xe=({checkedEntries:t,entries:e,filterActive:n,filterText:o,filterType:c,focused:s,isDryRun:d,scrollOffset:u,selectedIndex:j,totalEntries:i,viewportHeight:a})=>{const m=s?"white":"gray";let x=0,h=0,v=0,y=0;for(const O of e)switch(O.category){case"micro-utility":{v++;break}case"native":{x++;break}case"preferred":{h++;break}case"socket":{y++;break}}const k=[];x>0&&k.push(`${x} native`),h>0&&k.push(`${h} preferred`),v>0&&k.push(`${v} micro`),y>0&&k.push(`${y} socket`);const w=k.length>0?` (${k.join(", ")})`:"",C=t.size,S=[];for(const[O,f]of e.entries())S.push(r.jsx(Re,{checked:t.has(f.packageName),entry:f,isSelected:O===j},f.packageName));const D=e.length,N=D>a&&a>0;return r.jsxs(p,{borderColor:m,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[r.jsxs(p,{flexShrink:0,gap:1,paddingX:1,children:[r.jsx(l,{bold:!0,inverse:!0,children:" VIS OPTIMIZE "}),r.jsxs(l,{wrap:"truncate",children:[i," ","optimizations",w]}),!d&&C>0&&r.jsxs(l,{dimColor:!0,children:[" ","—",C," ","selected"]})]}),r.jsx(p,{flexShrink:0,gap:1,paddingX:1,paddingY:1,children:Ke.map(O=>{const f=c===O.key;return r.jsxs(p,{children:[r.jsx(l,{dimColor:!f,children:"["}),r.jsx(l,{bold:f,color:f?"cyan":"gray",children:O.shortcut}),r.jsx(l,{dimColor:!f,children:"]"}),r.jsxs(l,{color:f?"white":"gray",children:[" ",O.label]})]},O.key)})}),n&&r.jsxs(p,{flexShrink:0,paddingX:1,children:[r.jsx(l,{bold:!0,color:"white",children:"/ "}),r.jsx(l,{children:o}),r.jsx(l,{inverse:!0,children:" "})]}),r.jsxs(p,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[r.jsx(p,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:r.jsx(p,{flexDirection:"column",marginTop:-u,children:S})}),N&&r.jsx(p,{flexShrink:0,marginLeft:1,marginRight:1,children:r.jsx(fe,{contentHeight:D,placement:"inset",scrollOffset:u,style:"block",viewportHeight:a})})]})]})},Le=100,Z=10,J={1:"all",2:"native",3:"preferred",4:"micro-utility",5:"socket"},Qe=({isDryRun:t,store:e})=>{const{exit:n}=he(),{columns:o,rows:c}=pe(),s=A.useSyncExternalStore(e.subscribe,e.getSnapshot),d=A.useRef(null),[u,j]=A.useState(0),[i,a]=A.useState(!1),m=e.getFilteredEntries(),x=m[s.selectedIndex]??null,h=o>=Le,y=Math.max(0,c-5),k=A.useCallback(w=>{n(w)},[n]);return ue((w,C)=>{if(i){w==="y"||w==="Y"?k():a(!1);return}if(s.filterActive){C.escape?(e.setFilterActive(!1),e.setFilterText("")):C.return?e.setFilterActive(!1):C.backspace||C.delete?e.setFilterText(s.filterText.slice(0,-1)):w&&!C.ctrl&&!C.meta&&e.setFilterText(s.filterText+w);return}if(w==="q"){!t&&s.checkedEntries.size>0?a(!0):k();return}if(w==="/"){e.setFilterActive(!0);return}if(J[w]){e.setFilter(J[w]);return}if(C.tab){e.setFocusedPanel(s.focusedPanel==="list"?"detail":"list");return}if(s.focusedPanel==="list")if(C.upArrow||w==="k"){const S=Math.max(0,s.selectedIndex-1);e.select(S),S<u&&j(S)}else if(C.downArrow||w==="j"){const S=Math.min(m.length-1,s.selectedIndex+1);e.select(S),S>=u+y&&j(S-y+1)}else w===" "?x&&e.toggleCheck(x.packageName):w==="a"?e.toggleAll():C.return&&!t&&s.checkedEntries.size>0&&k(e.getCheckedEntries());else s.focusedPanel==="detail"&&(C.upArrow||w==="k"?d.current?.scrollBy(-1):(C.downArrow||w==="j")&&d.current?.scrollBy(1))},{isActive:s.phase==="browsing"}),c<Z?r.jsx(p,{alignItems:"center",justifyContent:"center",children:r.jsxs(l,{color:"yellow",children:["Terminal too small. Resize to at least",Z," ","rows."]})}):r.jsxs(p,{flexDirection:"column",height:c,width:o,children:[r.jsxs(p,{flexDirection:h?"row":"column",flexGrow:1,children:[r.jsx(p,{flexBasis:h?"50%":void 0,flexGrow:1,children:r.jsx(Xe,{checkedEntries:s.checkedEntries,entries:m,filterActive:s.filterActive,filterText:s.filterText,filterType:s.filterType,focused:s.focusedPanel==="list",isDryRun:t,scrollOffset:u,selectedIndex:s.selectedIndex,totalEntries:s.entries.length,viewportHeight:y})}),r.jsx(p,{flexBasis:h?"50%":void 0,flexGrow:1,children:r.jsx(Ye,{entry:x,focused:s.focusedPanel==="detail",scrollRef:d})})]}),r.jsx(p,{flexShrink:0,paddingX:1,children:r.jsxs(l,{dimColor:!0,children:[t?"Preview mode":"space:toggle a:all enter:apply"," ","| tab:switch panel /: filter q:quit |","⚙","=codemod available"]})}),r.jsx(me,{autoExitSeconds:3,onCancel:()=>{a(!1)},visible:i})]})},V=(t,e)=>{const n=new Set;try{const o=ee(t),c=e?[o.dependencies,o.optionalDependencies]:[o.dependencies,o.devDependencies,o.peerDependencies,o.optionalDependencies];for(const s of c)if(s)for(const d of Object.keys(s))n.add(d)}catch{}return n},re=t=>{const e=be(t);if(e)return K(t,e);const n=$(t,"package.json");if(!W(n))return[];try{const o=ee(n),c=Array.isArray(o.workspaces)?o.workspaces:o.workspaces?.packages;return c?K(t,c):[]}catch{return[]}},Ze="https://github.com/es-tooling/module-replacements/blob/main/docs/modules",Je=t=>`${Ze}/${t}.md`,Ue=t=>{if(t.type==="simple"&&t.replacement)return t.replacement;if(t.type==="native"){const e=t.nodeVersion?` (Node ${t.nodeVersion}+)`:"";return t.replacement?`${t.replacement}${e}`:`Native API${e}`}return t.type==="documented"&&t.docPath?"see migration guide":""},ne=t=>{const e=[],n=(o,c)=>{const s=o.moduleReplacements;if(Array.isArray(s))for(const d of s)t.has(d.moduleName)&&e.push({category:c,docUrl:d.type==="documented"&&d.docPath?Je(d.docPath):void 0,hasCodemod:!1,overrideSpec:void 0,packageName:d.moduleName,replacement:Ue(d)})};return n(ve,"native"),n(we,"preferred"),n(je,"micro-utility"),e},se=(t,e,n,o)=>{const c=ze.getManifestData("npm")??[],s=[];for(const[,d]of c){if(d.deprecated)continue;const u=t.has(d.package),j=e?_e(e,d.package,n.name):!1;if(!u&&!j)continue;const i=U.coerce(d.version)?.major;if(i===void 0)continue;const a=o?`npm:${d.name}@${d.version}`:`npm:${d.name}@^${String(i)}`;s.push({category:"socket",hasCodemod:!1,overrideSpec:a,packageName:d.package,replacement:d.name})}return s};let B;const oe=async()=>{if(B)return B;try{return B=(await import("module-replacements-codemods")).codemods,B}catch{return{}}},ie=async t=>{try{const e=await oe();for(const n of t)n.category!=="socket"&&e[n.packageName]&&(n.hasCodemod=!0)}catch{}},ce=async(t,e,n)=>{let o=0;try{const s=(await oe())[n];if(!s)return{filesChanged:0,packageName:n};const d=s({}),u=await et(e);for(const j of u){const i=P(j);if(i.includes(n))try{const a=await d.transform({file:{filename:j,source:i}});a!==i&&(await t.writeFile(j,a,"utf8"),o++)}catch(a){process.stderr.write(`warn: codemod transform failed for ${j}: ${a instanceof Error?a.message:String(a)}
13
+ `)}}}catch{}return{filesChanged:o,packageName:n}},et=async t=>Ee("**/*.{cjs,cts,js,jsx,mjs,mts,ts,tsx}",{absolute:!0,cwd:t,ignore:["**/.*/**","**/.*","**/node_modules/**","**/dist/**","**/coverage/**","**/.git/**","**/.next/**","**/.nuxt/**"]}),tt=async({fs:t,logger:e,options:n,visConfig:o,workspaceRoot:c})=>{if(!c)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const s=ye(c),d=!!n.dryRun,u=!!n.prod,j=!!n.pin;g.info(`Detected ${s.name} v${s.version}.`);const i=V($(c,"package.json"),u),a=re(c),m=new Set(i);for(const f of a){const Y=V($(le(c,f),"package.json"),u);for(const F of Y)m.add(F)}a.length>0&&g.info(`Scanned ${String(a.length)} workspace package${a.length===1?"":"s"}.`),g.info(`Scanning dependencies...
14
+ `);const x=Te(c,s.name),h=ne(m),v=se(m,x,s,j),y=new Set(h.map(f=>f.packageName)),k=v.filter(f=>!y.has(f.packageName)),w=[...h,...k];if(await ie(w),w.length===0){g.info("No optimizations found for your dependencies.");return}const C=!!process.stdout.isTTY&&!xe,S=n.format==="json"||!!n.json;if(C&&!d&&!S){const f=new He(w),F=await ge(Ce.createElement(Qe,{isDryRun:!1,store:f}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),M=Array.isArray(F)?F:[];if(M.length===0){g.info("No optimizations selected.");return}const G=M.filter(b=>b.category!=="socket"&&b.hasCodemod),T=M.filter(b=>b.category!=="socket"&&!b.hasCodemod),z=M.filter(b=>b.category==="socket");if(G.length>0){g.info(`
15
+ Running ${String(G.length)} codemod${G.length===1?"":"s"}...
16
+ `);for(const b of G){const E=await ce(t,c,b.packageName);E.filesChanged>0?g.success(` ${b.packageName}: ${String(E.filesChanged)} file${E.filesChanged===1?"":"s"} updated`):g.info(` ${b.packageName}: no files changed`)}}if(T.length>0){g.warn(`
17
+ ${String(T.length)} selected replacement${T.length===1?"":"s"} require manual migration (no codemod available):`);for(const b of T)g.info(` ${b.packageName} → ${b.replacement}`);g.notice(" Replace usage in your source code, then remove from dependencies.")}if(z.length>0){const b=z.filter(_=>_.overrideSpec).map(_=>({original:_.packageName,spec:_.overrideSpec})),E=Ge(c,$(c,"package.json"),b,s,o?.editorconfig??!0);E.added.length>0&&g.success(`
18
+ Added ${String(E.added.length)} override${E.added.length===1?"":"s"}.`),E.updated.length>0&&g.success(`Updated ${String(E.updated.length)} override${E.updated.length===1?"":"s"}.`)}if(z.length>0&&n.install!==!1){g.info(`
19
+ Running ${s.name} install to update lockfile...`);const E=Se(s,{dev:!1,filter:[],force:!1,frozenLockfile:!1,ignoreScripts:!1,lockfileOnly:!1,noOptional:!1,offline:!1,prod:!1,recursive:!1,silent:!1,workspaceRoot:!1},c,e);E!==0&&g.warn(`${s.name} install exited with code ${String(E)}. Run it manually.`)}g.info(""),g.success("Optimization complete.");return}if(S){process.stdout.write(`${JSON.stringify({e18e:h.map(f=>({category:f.category,hasCodemod:f.hasCodemod,packageName:f.packageName,replacement:f.replacement})),packageManager:s.name,socket:k.map(f=>({overrideSpec:f.overrideSpec,packageName:f.packageName,replacement:f.replacement})),total:w.length,workspaces:a.length},void 0,2)}
20
+ `);return}const D=h.filter(f=>f.category==="native"),N=h.filter(f=>f.category==="preferred"),O=h.filter(f=>f.category==="micro-utility");if(D.length>0){g.info(`Native replacements (${String(D.length)}):`);for(const f of D)g.info(` ${f.hasCodemod?"⚙":" "} ${f.packageName} → ${f.replacement}`)}if(N.length>0){g.info(`
21
+ Preferred alternatives (${String(N.length)}):`);for(const f of N)g.info(` ${f.hasCodemod?"⚙":" "} ${f.packageName} → ${f.replacement}`)}if(O.length>0){g.info(`
22
+ Micro-utilities (${String(O.length)}):`);for(const f of O)g.info(` ${f.hasCodemod?"⚙":" "} ${f.packageName} → ${f.replacement}`)}if(k.length>0){g.info(`
23
+ Socket.dev overrides (${String(k.length)}):`);for(const f of k)g.info(` ${f.packageName} → ${f.overrideSpec}`)}g.info(`
24
+ Total: ${String(w.length)} optimizations available (⚙ = codemod available).`),d&&g.notice("Run without --dry-run for interactive selection.")},mt=Object.defineProperty({__proto__:null,buildE18eEntries:ne,buildSocketEntries:se,collectDepsFromPkgJson:V,default:tt,discoverWorkspacePackages:re,markCodemodAvailability:ie,runCodemod:ce},Symbol.toStringTag,{value:"Module"});export{se as a,ne as b,V as c,re as d,Ge as e,ce as f,mt as h,ie as m,Te as r};
@@ -1,25 +1,25 @@
1
- import{createRequire as K}from"node:module";import{I as w,j as P,E as u,q as T,s as v,V as D}from"../packem_shared/index.server-CusjRLCh.js";import{w as j,l as A,z as te,j as oe,q as W,b as $}from"../packem_shared/index-uBVnF4ji.js";import Z from"./index.js";import{T as se,Q as C,h as ne,Z as ae,_ as re,a0 as ie,a1 as pe}from"./cli-main.js";import{x as ce,e as q,k as I,a as B,u as L,b as fe}from"./catalog.js";import{a as S}from"../packem_shared/readJsonSync-DweZd5ZA-0eZh9sGm.js";import{l as le}from"../packem_shared/missing-package-json-BqS-OnKd.js";let X;const Y=e=>(X??=K(import.meta.url))(e),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ee=e=>{if(typeof V<"u"&&V.versions&&V.versions.node){const[a,o]=V.versions.node.split(".").map(Number);if(a>22||a===22&&o>=3||a===20&&o>=16)return V.getBuiltinModule(e)}return Y(e)},{readFileSync:G,writeFileSync:O}=ee("node:fs"),ge=e=>/[*?[\]{}!]/.test(e),de=e=>typeof e=="string"?e:e.reason,ue=e=>typeof e=="string"?void 0:e.replacement,U=(e,a)=>e.some(o=>Z(o,a)),Q=(e,a)=>{if(typeof e=="string")return!0;const o=Array.isArray(e.packages)&&e.packages.length>0,t=Array.isArray(e.paths)&&e.paths.length>0;return!!(!o&&!t||o&&a.packageName!==void 0&&U(e.packages,a.packageName)||t&&U(e.paths,a.packageDir))},me=(e,a)=>{const o=a[e.depName];if(o!==void 0&&Q(o,e))return{pattern:e.depName,rule:o};for(const[t,r]of Object.entries(a))if(ge(t)&&Z(t,e.depName)&&Q(r,e))return{pattern:t,rule:r}},he=(e,a)=>{if(Object.keys(a).length===0)return[];const o=[];for(const t of e){if(t.isInternal)continue;const r=me(t,a);r&&o.push({depName:t.depName,depType:t.depType,matchedPattern:r.pattern,packageDir:t.packageDir,packageJsonPath:t.packageJsonPath,packageName:t.packageName,reason:de(r.rule),replacement:ue(r.rule),specifier:t.specifier})}return o},ke=new Set(["dependencies","devDependencies","peerDependencies"]),ye=e=>e.startsWith("catalog:"),$e=e=>e.startsWith("workspace:"),Pe=(e,a)=>{if(!e)return!1;for(const o of e.values())if(o.has(a))return!0;return!1},we=(e,a={})=>{const o=a.min??3,t=new Set(a.ignoreDeps),r=e.filter(i=>i.isInternal||!ke.has(i.depType)||$e(i.specifier)||a.dep!==void 0&&i.depName!==a.dep?!1:!t.has(i.depName)),n=new Map;for(const i of r){const p=n.get(i.depName);p?p.push(i):n.set(i.depName,[i])}const s=[];for(const[i,p]of n){if(Pe(a.catalogs,i)||p.some(m=>ye(m.specifier)))continue;const c=new Map;for(const m of p){let d=c.get(m.specifier);d||(d=new Set,c.set(m.specifier,d)),d.add(m.packageJsonPath)}const f=[...c.entries()].sort((m,d)=>m[1].size!==d[1].size?d[1].size-m[1].size:m[0].localeCompare(d[0]))[0];!f||f[1].size<o||s.push({catalogName:"default",depName:i,instanceCount:f[1].size,specifier:f[0]})}return s.sort((i,p)=>i.depName.localeCompare(p.depName))},De=(e,a)=>{if(a.length===0)return;const o=j(e,"pnpm-workspace.yaml"),t=A(o)?G(o,"utf8"):"",r=t.includes(`\r
1
+ import{createRequire as Q}from"node:module";import{J as v,q as w,F as g,D as x,r as b,X as D}from"../packem_shared/index.server-CwSgbeN7.js";import{e as I,z as se,a as $}from"../packem_shared/index-DHD8wb6Z.js";import U from"./index.js";import{y as _}from"../packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{$ as oe,_ as F,v as ne,a4 as ae,a5 as ie,a6 as re,a7 as ce}from"./cli-main.js";import{i as pe,j as z,x as W,p as L,F as K,r as fe}from"./catalog.js";import{p as S}from"../packem_shared/readJsonSync-CbryXYxN-B2aSeDpC.js";import{U as le}from"../packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js";import{T as j}from"../packem_shared/target-merge-D1xbylFw.js";import{l as ue}from"../packem_shared/missing-package-json-C0keIt78.js";let Z;const ee=e=>(Z??=Q(import.meta.url))(e),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,te=e=>{if(typeof V<"u"&&V.versions&&V.versions.node){const[a,s]=V.versions.node.split(".").map(Number);if(a>22||a===22&&s>=3||a===20&&s>=16)return V.getBuiltinModule(e)}return ee(e)},{readFileSync:Y,writeFileSync:H}=te("node:fs"),de=e=>/[*?[\]{}!]/.test(e),ge=e=>typeof e=="string"?e:e.reason,me=e=>typeof e=="string"?void 0:e.replacement,q=(e,a)=>e.some(s=>U(s,a)),G=(e,a)=>{if(typeof e=="string")return!0;const s=Array.isArray(e.packages)&&e.packages.length>0,t=Array.isArray(e.paths)&&e.paths.length>0;return!!(!s&&!t||s&&a.packageName!==void 0&&q(e.packages,a.packageName)||t&&q(e.paths,a.packageDir))},he=(e,a)=>{const s=a[e.depName];if(s!==void 0&&G(s,e))return{pattern:e.depName,rule:s};for(const[t,r]of Object.entries(a))if(de(t)&&U(t,e.depName)&&G(r,e))return{pattern:t,rule:r}},ke=(e,a)=>{if(Object.keys(a).length===0)return[];const s=[];for(const t of e){if(t.isInternal)continue;const r=he(t,a);r&&s.push({depName:t.depName,depType:t.depType,matchedPattern:r.pattern,packageDir:t.packageDir,packageJsonPath:t.packageJsonPath,packageName:t.packageName,reason:ge(r.rule),replacement:me(r.rule),specifier:t.specifier})}return s},ye=new Set(["dependencies","devDependencies","peerDependencies"]),Pe=e=>e.startsWith("catalog:"),$e=e=>e.startsWith("workspace:"),we=(e,a)=>{if(!e)return!1;for(const s of e.values())if(s.has(a))return!0;return!1},ve=(e,a={})=>{const s=a.min??3,t=new Set(a.ignoreDeps),r=e.filter(i=>i.isInternal||!ye.has(i.depType)||$e(i.specifier)||a.dep!==void 0&&i.depName!==a.dep?!1:!t.has(i.depName)),n=new Map;for(const i of r){const c=n.get(i.depName);c?c.push(i):n.set(i.depName,[i])}const o=[];for(const[i,c]of n){if(we(a.catalogs,i)||c.some(h=>Pe(h.specifier)))continue;const p=new Map;for(const h of c){let d=p.get(h.specifier);d||(d=new Set,p.set(h.specifier,d)),d.add(h.packageJsonPath)}const m=[...p.entries()].sort((h,d)=>h[1].size!==d[1].size?d[1].size-h[1].size:h[0].localeCompare(d[0]))[0];!m||m[1].size<s||o.push({catalogName:"default",depName:i,instanceCount:m[1].size,specifier:m[0]})}return o.sort((i,c)=>i.depName.localeCompare(c.depName))},De=(e,a)=>{if(a.length===0)return;const s=I(e,"pnpm-workspace.yaml"),r=_(s)?Y(s,"utf8"):"",n=r.includes(`\r
2
2
  `)?`\r
3
3
  `:`
4
- `,n=a.filter(d=>d.catalogName==="default").sort((d,g)=>d.depName.localeCompare(g.depName));if(n.length===0)return;const s=t.length>0?t.split(r):[],i=s.findIndex(d=>/^catalog\s*:\s*$/.test(d));if(i===-1){const d=["catalog:"];for(const y of n)d.push(` ${y.depName}: "${y.specifier}"`);let g=0;for(;g<s.length&&(s[g]??"").trim().length===0;)g+=1;const h=[...s.slice(0,g),...d,"",...s.slice(g)].join(r);return O(o,h.endsWith(r)?h:`${h}${r}`),o}let p=s.length;const c=new Set;for(let d=i+1;d<s.length;d+=1){const g=s[d]??"",h=g.trimStart();if(g.length===0)continue;if(g.length-h.length===0&&h.length>0&&!h.startsWith("#")){p=d;break}const y=/^([\w./@-]+)\s*:/.exec(h);y?.[1]&&c.add(y[1])}const f=[];for(const d of n)c.has(d.depName)||f.push(` ${d.depName}: "${d.specifier}"`);if(f.length===0)return;const m=[...s.slice(0,p),...f,...s.slice(p)].join(r);return O(o,m.endsWith(r)?m:`${m}${r}`),o},ve=(e,a)=>{if(a.length===0)return"";const o=j(e,"pnpm-workspace.yaml"),t=A(o)?G(o,"utf8"):"",r=[...a].sort((i,p)=>i.depName.localeCompare(p.depName)),n=["--- pnpm-workspace.yaml","+++ pnpm-workspace.yaml"],s=t.includes(`\r
4
+ `,o=a.filter(d=>d.catalogName==="default").sort((d,u)=>d.depName.localeCompare(u.depName));if(o.length===0)return;const i=r.length>0?r.split(n):[],c=i.findIndex(d=>/^catalog\s*:\s*$/.test(d));if(c===-1){const d=["catalog:"];for(const J of o)d.push(` ${J.depName}: "${J.specifier}"`);let u=0;for(;u<i.length&&(i[u]??"").trim().length===0;)u+=1;const k=[...i.slice(0,u),...d,"",...i.slice(u)].join(n);return H(s,k.endsWith(n)?k:`${k}${n}`),s}let p=i.length;const f=new Set;for(let d=c+1;d<i.length;d+=1){const u=i[d]??"",k=u.trimStart();if(u.length===0)continue;if(u.length-k.length===0&&k.length>0&&!k.startsWith("#")){p=d;break}const P=/^([\w./@-]+)\s*:/.exec(k);P?.[1]&&f.add(P[1])}const m=[];for(const d of o)f.has(d.depName)||m.push(` ${d.depName}: "${d.specifier}"`);if(m.length===0)return;const h=[...i.slice(0,p),...m,...i.slice(p)].join(n);return H(s,h.endsWith(n)?h:`${h}${n}`),s},be=(e,a)=>{if(a.length===0)return"";const s=I(e,"pnpm-workspace.yaml"),r=_(s)?Y(s,"utf8"):"",n=[...a].sort((f,m)=>f.depName.localeCompare(m.depName)),o=["--- pnpm-workspace.yaml","+++ pnpm-workspace.yaml"],i=r.includes(`\r
5
5
  `)?`\r
6
6
  `:`
7
- `;if((t.length>0?t.split(s):[]).findIndex(i=>/^catalog\s*:\s*$/.test(i))===-1){n.push("@@ +1 @@","+catalog:");for(const i of r)n.push(`+ ${i.depName}: "${i.specifier}"`)}else{n.push("@@ catalog: @@");for(const i of r)n.push(`+ ${i.depName}: "${i.specifier}"`)}return n.join(s)},Ne=e=>{const a=[],o=ce(e);if(o){const r=j(e,"pnpm-workspace.yaml");for(const n of o)n.startsWith("!")||q(e,[n]).length===0&&a.push({pattern:n,source:"pnpm-workspace.yaml",sourcePath:r})}const t=j(e,"package.json");if(A(t)){const r=S(t).workspaces,n=Array.isArray(r)?r:r?.packages;if(n)for(const s of n)typeof s!="string"||s.startsWith("!")||q(e,[s]).length===0&&a.push({pattern:s,source:"package.json",sourcePath:t})}return a},be=(e,a={})=>{const{useEditorconfig:o}=a,t=new Map;for(const n of e){const s=t.get(n.sourcePath);s?s.push(n):t.set(n.sourcePath,[n])}const r=[];for(const[n,s]of t){const i=new Set(s.map(f=>f.pattern));if(n.endsWith(".yaml")||n.endsWith(".yml")){const f=te(n).split(`
8
- `).filter(m=>{const d=m.trim();if(!d.startsWith("- "))return!0;const g=d.slice(2).replaceAll(/^['"]|['"]$/g,"");return!i.has(g)}).join(`
9
- `);oe(n,f,{overwrite:!0}),r.push(n);continue}const p=S(n),c=p.workspaces;Array.isArray(c)?p.workspaces=c.filter(f=>typeof f!="string"||!i.has(f)):c&&Array.isArray(c.packages)&&(c.packages=c.packages.filter(f=>typeof f!="string"||!i.has(f))),W(n,p,{indent:I(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},xe=["dependencies","devDependencies","peerDependencies","optionalDependencies"],Je=(e,a={})=>{const o=new Set(a.ignoreBlocks),t=se(e),r=[];for(const n of t){const s=j(e,n,"package.json"),i=C(s);if(!i)continue;const p=typeof i.name=="string"?i.name:void 0;for(const c of xe){if(o.has(c))continue;const f=i[c];typeof f=="object"&&f!==null&&!Array.isArray(f)&&Object.keys(f).length===0&&r.push({depType:c,packageDir:n,packageJsonPath:s,packageName:p})}}return r},Te=(e,a={})=>{const{useEditorconfig:o}=a,t=new Map;for(const n of e){const s=t.get(n.packageJsonPath);s?s.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,s]of t){const i=S(n);for(const p of s){const c=i[p.depType];typeof c=="object"&&c!==null&&!Array.isArray(c)&&Object.keys(c).length===0&&Reflect.deleteProperty(i,p.depType)}W(n,i,{indent:I(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},Se=["dependencies","devDependencies","optionalDependencies","peerDependencies"],Me=(e,a={})=>{const o=new Set(a.depTypes??Se),t=new Set(a.ignoreDeps),r=new Map;for(const s of e)s.packageDir!=="."||!o.has(s.depType)||r.set(s.depName,{depType:s.depType,specifier:s.specifier});if(r.size===0)return[];const n=[];for(const s of e){if(s.packageDir==="."||!o.has(s.depType)||t.has(s.depName))continue;const i=r.get(s.depName);i&&n.push({childSpecifier:s.specifier,depName:s.depName,depType:s.depType,packageDir:s.packageDir,packageJsonPath:s.packageJsonPath,packageName:s.packageName,rootDepType:i.depType,rootSpecifier:i.specifier})}return n},je=(e,a)=>{if(!a)return[];const o=j(e,"package.json"),t=C(o);if(!t)return[];if(t.private!==!0)return[];const r=t.dependencies;if(typeof r!="object"||r===null||Array.isArray(r))return[];const n=Object.keys(r);return n.length===0?[]:[{depNames:n,packageJsonPath:o}]},Re=(e,a={})=>{const{useEditorconfig:o}=a,t=[];for(const r of e){const n=S(r.packageJsonPath),s=n.dependencies;if(typeof s!="object"||s===null)continue;const i=s;n.devDependencies??={};const p=n.devDependencies;for(const c of r.depNames){const f=i[c];typeof f=="string"&&(c in p||(p[c]=f),Reflect.deleteProperty(i,c))}Object.keys(i).length===0&&Reflect.deleteProperty(n,"dependencies"),W(r.packageJsonPath,n,{indent:I(r.packageJsonPath,{useEditorconfig:o}),overwrite:!0}),t.push(r.packageJsonPath)}return t},We=/^[a-z][\w-]*@\S+$/i,Ie=(e,a,o={})=>{if(!a)return[];const t=j(e,"package.json"),r=C(t);if(!r)return[];const n=r.packageManager;return typeof n=="string"&&We.test(n)?[]:[{packageJsonPath:t,suggested:o.suggested}]},Ee=(e,a={})=>{const{useEditorconfig:o}=a,t=[];for(const r of e){if(!r.suggested)continue;const n=S(r.packageJsonPath);n.packageManager=r.suggested,W(r.packageJsonPath,n,{indent:I(r.packageJsonPath,{useEditorconfig:o}),overwrite:!0}),t.push(r.packageJsonPath)}return t},Fe=(e,a)=>{if(!a)return[];const o=j(e,"package.json"),t=C(o);return t?t.private===!0?[]:[{packageJsonPath:o,rawValue:t.private}]:[]},Ve=(e,a={})=>{const{useEditorconfig:o}=a,t=[];for(const r of e){const n=S(r.packageJsonPath);let s=n;if("private"in n)n.private=!0;else{const{name:i,version:p,...c}=n,f={};i!==void 0&&(f.name=i),p!==void 0&&(f.version=p),f.private=!0;for(const[m,d]of Object.entries(c))f[m]=d;s=f}W(r.packageJsonPath,s,{indent:I(r.packageJsonPath,{useEditorconfig:o}),overwrite:!0}),t.push(r.packageJsonPath)}return t},Ae=[{id:"react",label:"React",members:["react","react-dom","react-test-renderer"]},{id:"next",label:"Next.js",members:["next","@next/font","@next/bundle-analyzer","@next/mdx","@next/third-parties","@next/eslint-plugin-next","eslint-config-next"]},{id:"babel",label:"Babel",prefixes:["@babel/"]},{id:"storybook",label:"Storybook",members:["storybook","sb"],prefixes:["@storybook/"]},{id:"vitest",label:"Vitest",members:["vitest"],prefixes:["@vitest/"]},{id:"playwright",label:"Playwright",members:["playwright","@playwright/test"]},{id:"trpc",label:"tRPC",prefixes:["@trpc/"]},{id:"prisma",label:"Prisma",members:["prisma"],prefixes:["@prisma/"]},{id:"turborepo",label:"Turborepo",members:["turbo","turbo-ignore","@turbo/gen","eslint-config-turbo","eslint-plugin-turbo"]},{id:"typescript-eslint",label:"typescript-eslint",members:["typescript-eslint"],prefixes:["@typescript-eslint/"]},{id:"eslint-stylistic",label:"ESLint Stylistic",prefixes:["@stylistic/"]},{id:"lexical",label:"Lexical",members:["lexical"],prefixes:["@lexical/"]},{id:"nx",label:"Nx",prefixes:["@nx/","@nrwl/"]}],Ce=new Set(["dependencies","devDependencies","peerDependencies"]),_e=(e,a)=>{for(const o of e)if(o.members?.includes(a)||o.prefixes?.some(t=>a.startsWith(t)))return o},ze=e=>e.startsWith("workspace:")||e.startsWith("catalog:"),Oe=(e,a={})=>{const o=new Set(a.ignoreFamilies),t=new Map;for(const i of Ae)t.set(i.id,i);for(const i of a.extraFamilies??[])t.set(i.id,i);const r=[...t.values()],n=new Map;for(const i of e){if(i.isInternal||!Ce.has(i.depType)||ze(i.specifier))continue;const p=_e(r,i.depName);if(!p||o.has(p.id))continue;const c=n.get(p.id),f={depName:i.depName,depType:i.depType,packageDir:i.packageDir,packageJsonPath:i.packageJsonPath,packageName:i.packageName,specifier:i.specifier};c?c.push(f):n.set(p.id,[f])}const s=[];for(const[i,p]of n){const c=[...new Set(p.map(m=>m.specifier))];if(c.length<2)continue;const f=t.get(i);f&&s.push({family:i,familyLabel:f.label??i,members:p,specifiers:c})}return s},qe=e=>e.startsWith("@types/"),Be=(e,a={})=>{const o=new Set(a.ignoreDeps),t=new Map,r=s=>{const i=t.get(s);if(i!==void 0)return i;try{const p=S(s).private===!0;return t.set(s,p),p}catch{return t.set(s,!1),!1}},n=[];for(const s of e)s.depType==="dependencies"&&qe(s.depName)&&(o.has(s.depName)||r(s.packageJsonPath)&&n.push({childSpecifier:s.specifier,depName:s.depName,packageDir:s.packageDir,packageJsonPath:s.packageJsonPath,packageName:s.packageName}));return n},Le=(e,a={})=>{const{useEditorconfig:o}=a,t=new Map;for(const n of e){const s=t.get(n.packageJsonPath);s?s.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,s]of t){const i=S(n),p=i.dependencies;if(typeof p!="object"||p===null)continue;const c=p;i.devDependencies??={};const f=i.devDependencies;for(const m of s){const d=c[m.depName];typeof d=="string"&&(m.depName in f||(f[m.depName]=d),Reflect.deleteProperty(c,m.depName))}Object.keys(c).length===0&&Reflect.deleteProperty(i,"dependencies"),W(n,i,{indent:I(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},Ue=e=>e.startsWith("workspace:"),Qe=(e,a={})=>{const o=a.fixSpecifier??"workspace:*",t=[];for(const r of e)r.isInternal&&(Ue(r.specifier)||t.push({depName:r.depName,depType:r.depType,fix:o,packageDir:r.packageDir,packageJsonPath:r.packageJsonPath,packageName:r.packageName,specifier:r.specifier}));return t},Ze=(e,a,o,t)=>{const r=a.split(".");let n=e;for(let p=0;p<r.length-1;p+=1){const c=r[p],f=n[c];(typeof f!="object"||f===null)&&(n[c]={}),n=n[c]}const s=r.at(-1);let i=n[s];(typeof i!="object"||i===null)&&(i={},n[s]=i),i[o]=t},Ge=(e,a={})=>{const{useEditorconfig:o}=a,t=new Map;for(const n of e){const s=t.get(n.packageJsonPath);s?s.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,s]of t){const i=S(n);for(const p of s)if(p.depType.includes("."))Ze(i,p.depType,p.depName,p.fix);else{const c=i[p.depType];typeof c=="object"&&c!==null&&(c[p.depName]=p.fix)}W(n,i,{indent:I(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},He=new Set(["dependencies","devDependencies","peerDependencies"]),Ke=e=>e.startsWith("catalog:"),Xe=e=>e.startsWith("workspace:"),Ye=e=>{if(!e.startsWith("catalog:"))return;const a=e.slice(8);return a===""?"default":a},et=(e,a)=>{if(e.get("default")?.has(a))return"default";const o=[...e.keys()].filter(t=>t!=="default").sort();for(const t of o)if(e.get(t)?.has(a))return t},tt=e=>e==="default"?"catalog:":`catalog:${e}`,ot=(e,a)=>{const o=[...e].sort((r,n)=>(r.packageName??r.packageDir).localeCompare(n.packageName??n.packageDir));let t;for(const r of o){const n=B(r.specifier);if(!n)continue;if(!t){t=r;continue}const s=B(t.specifier);if(!s){t=r;continue}const i=L(s,n),p=L(n,s);(a==="highest"&&i||a==="lowest"&&p)&&(t=r)}if(t)return{canonical:t,canonicalSource:t.packageName??t.packageDir}},st=(e,a={})=>{const o=a.resolve??"highest",t=new Set(a.ignoreDeps),r=[],n=e.filter(i=>i.isInternal||!He.has(i.depType)||Xe(i.specifier)||a.dep!==void 0&&i.depName!==a.dep?!1:!t.has(i.depName)),s=new Map;for(const i of n){const p=s.get(i.depName);p?p.push(i):s.set(i.depName,[i])}for(const[i,p]of s){const c=a.pinned?.get(i);if(c!==void 0){for(const g of p)g.specifier!==c&&r.push({canonicalSource:"cli:--pin",depName:i,depType:g.depType,fix:c,packageDir:g.packageDir,packageJsonPath:g.packageJsonPath,packageName:g.packageName,specifier:g.specifier});continue}if(o==="catalog"){const{catalogs:g}=a;if(!g)continue;const h=et(g,i);if(!h)continue;const y=tt(h);for(const x of p)Ye(x.specifier)!==h&&r.push({canonicalSource:`catalog:${h}`,depName:i,depType:x.depType,fix:y,packageDir:x.packageDir,packageJsonPath:x.packageJsonPath,packageName:x.packageName,specifier:x.specifier});continue}const f=p.filter(g=>!Ke(g.specifier));if(f.length<2||new Set(f.map(g=>g.specifier)).size<=1)continue;const m=ot(f,o);if(!m)continue;const d=m.canonical.specifier;for(const g of f)g.specifier!==d&&r.push({canonicalSource:m.canonicalSource,depName:i,depType:g.depType,fix:d,packageDir:g.packageDir,packageJsonPath:g.packageJsonPath,packageName:g.packageName,specifier:g.specifier})}return r},nt=(e,a={})=>{const{useEditorconfig:o}=a,t=new Map;for(const n of e){const s=t.get(n.packageJsonPath);s?s.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,s]of t){const i=S(n);for(const p of s){const c=i[p.depType];typeof c=="object"&&c!==null&&(c[p.depName]=p.fix)}W(n,i,{indent:I(n,{useEditorconfig:o}),overwrite:!0}),r.push(n)}return r},at=e=>{if(A(j(e,"pnpm-workspace.yaml")))return!0;const a=j(e,"package.json");if(!A(a))return!1;try{return S(a).workspaces!==void 0}catch{return!1}},E=(e,a)=>{const o=new Map;for(const t of e){const r=a(t),n=o.get(r);n?n.push(t):o.set(r,[t])}return o},rt=(e,a,o,t)=>{if(e.length===0){t.info(w("✓ workspace-protocol: no violations"));return}const r=o?"Fixed":"Found",n=o?T:v;t.info(n(P(`${r} ${String(e.length)} workspace-protocol violation${e.length===1?"":"s"}`)));for(const[s,i]of E(e,p=>p.packageName??p.packageJsonPath)){const p=$(a,i[0].packageJsonPath);t.info(` ${P(s)} ${u(`(${p})`)}`);for(const c of i){const f=o?T("→"):v("→");t.info(` ${u(c.depType)} ${c.depName}: ${D(c.specifier)} ${f} ${w(c.fix)}`)}}o||t.info(u(" Run with --fix to rewrite specifiers in place."))},it=(e,a,o)=>{if(e.length===0){o.info(w("✓ redefine-root: no violations"));return}o.info(v(P(`Found ${String(e.length)} dep${e.length===1?"":"s"} re-declared from root`)));for(const[t,r]of E(e,n=>n.packageName??n.packageJsonPath)){const n=$(a,r[0].packageJsonPath);o.info(` ${P(t)} ${u(`(${n})`)}`);for(const s of r)o.info(` ${u(s.depType)} ${s.depName}: ${D(s.childSpecifier)} ${u(`(root ${s.rootDepType}: ${s.rootSpecifier})`)}`)}o.info(u(" Remove these from child package.json files — root pin will resolve."))},pt=(e,a,o,t)=>{if(e.length===0){t.info(w("✓ workspace-versions: no drift"));return}const r=o?"Fixed":"Found",n=o?T:v;t.info(n(P(`${r} ${String(e.length)} workspace-version drift${e.length===1?"":"s"}`)));for(const[s,i]of E(e,p=>p.depName)){const p=i[0].fix,c=i[0].canonicalSource;t.info(` ${P(s)} ${u(`canonical: ${p} (from ${c})`)}`);for(const f of i){const m=$(a,f.packageJsonPath),d=f.packageName??m,g=o?T("→"):v("→");t.info(` ${d} ${u(`(${m})`)} ${u(f.depType)}: ${D(f.specifier)} ${g} ${w(f.fix)}`)}}o||t.info(u(" Run with --fix to align drifting specifiers."))},ct=(e,a,o)=>{if(e.length===0){o.info(w("✓ banned-deps: no violations"));return}o.info(D(P(`Found ${String(e.length)} banned dep${e.length===1?"":"s"}`)));for(const[t,r]of E(e,n=>n.packageName??n.packageJsonPath)){const n=$(a,r[0].packageJsonPath);o.info(` ${P(t)} ${u(`(${n})`)}`);for(const s of r){const i=s.replacement?` ${u("→")} ${w(s.replacement)}`:"";o.info(` ${u(s.depType)} ${D(s.depName)}${i}`),o.info(` ${u(s.reason)}`)}}},ft=(e,a,o,t)=>{if(e.length===0){t.info(w("✓ catalog-proposals: nothing worth promoting"));return}const r=o?"Added":"Would add",n=o?T:v;t.info(n(P(`${r} ${String(e.length)} catalog entr${e.length===1?"y":"ies"}`)));for(const s of e)t.info(` ${P(s.depName)}: ${w(s.specifier)} ${u(`(${String(s.instanceCount)} packages agree)`)}`);if(!o){const s=ve(a,e);if(s){t.info(""),t.info(u("Proposed pnpm-workspace.yaml changes:"));for(const i of s.split(`
10
- `))i.startsWith("+")?t.info(w(i)):i.startsWith("-")?t.info(D(i)):t.info(u(i))}t.info(u(" Run with --fix to write these entries to pnpm-workspace.yaml."))}},lt=(e,a,o,t)=>{if(e.length===0){t.info(w("✓ custom-types: no engines / packageManager / volta drift"));return}const r=o?"Fixed":"Found",n=o?T:v;t.info(n(P(`${r} ${String(e.length)} custom-type drift${e.length===1?"":"s"}`)));for(const[s,i]of E(e,p=>`${p.customType} ${p.depName}`)){const p=i[0].fix,c=i[0].canonicalSource;t.info(` ${P(s)} ${u(`canonical: ${p} (from ${c})`)}`);for(const f of i){const m=$(a,f.packageJsonPath),d=f.packageName??m,g=o?T("→"):v("→");t.info(` ${d} ${u(`(${m})`)}: ${D(f.specifier)} ${g} ${w(f.fix)}`)}}o||t.info(u(" Run with --fix to align engines/packageManager/volta versions."))},gt=(e,a,o,t)=>{if(e.length===0){t.info(w("✓ empty-deps: no empty dependency blocks"));return}const r=o?"Removed":"Found",n=o?T:v;t.info(n(P(`${r} ${String(e.length)} empty dependency block${e.length===1?"":"s"}`)));for(const[s,i]of E(e,p=>p.packageName??p.packageJsonPath)){const p=$(a,i[0].packageJsonPath);t.info(` ${P(s)} ${u(`(${p})`)}`);for(const c of i)t.info(` ${u(c.depType)}: ${D("{}")}`)}o||t.info(u(" Run with --fix to drop empty blocks."))},dt=(e,a,o,t)=>{if(e.length===0){t.info(w('✓ root-private: root package.json is "private": true'));return}const r=o?"Set":"Missing",n=o?T:D;for(const s of e){const i=$(a,s.packageJsonPath);if(t.info(n(P(`${r} "private": true on root ${u(`(${i})`)}`))),!o){const p=s.rawValue===void 0?"absent":JSON.stringify(s.rawValue);t.info(` ${u("current:")} ${D(p)}`)}}o||t.info(u(' Run with --fix to set "private": true.'))},ut=(e,a,o,t)=>{if(e.length===0){t.info(w("✓ root-package-manager: packageManager field present"));return}const r=o?"Set":"Missing",n=o?T:D;for(const s of e){const i=$(a,s.packageJsonPath);t.info(n(P(`${r} packageManager on root ${u(`(${i})`)}`))),!o&&!s.suggested&&t.info(u(" no canonical specifier configured (set policy.rootPackageManager.suggested to enable --fix)"))}o||t.info(u(' e.g. "packageManager": "pnpm@10.32.1"'))},mt=(e,a,o,t)=>{if(e.length===0){t.info(w("✓ root-deps: no runtime dependencies on private root"));return}const r=o?"Moved":"Found",n=o?T:v;for(const s of e){const i=$(a,s.packageJsonPath);t.info(n(P(`${r} ${String(s.depNames.length)} runtime dep${s.depNames.length===1?"":"s"} on private root ${u(`(${i})`)}`)));for(const p of s.depNames)t.info(` ${D(p)}`)}o||t.info(u(" Run with --fix to move them to devDependencies."))},ht=(e,a)=>{if(e.length===0){a.info(w("✓ missing-package-json: every workspace dir has a package.json"));return}a.info(v(P(`Found ${String(e.length)} workspace dir${e.length===1?"":"s"} without a package.json`)));for(const o of e)a.info(` ${D(o.packageDir)}`);a.info(u(" Either delete the directory or scaffold a package.json (vis create)."))},kt=(e,a,o)=>{if(e.length===0){o.info(w("✓ dead-workspace-pattern: every workspace pattern matches at least one package"));return}const t=a?"Removed":"Found",r=a?T:v;o.info(r(P(`${t} ${String(e.length)} unmatched workspace pattern${e.length===1?"":"s"}`)));for(const[n,s]of E(e,i=>i.source)){o.info(` ${P(n)}`);for(const i of s)o.info(` ${D(i.pattern)}`)}a||o.info(u(" Run with --fix to drop dead patterns."))},yt=(e,a,o,t)=>{if(e.length===0){t.info(w("✓ types-in-deps: no @types/* in dependencies of private packages"));return}const r=o?"Moved":"Found",n=o?T:v;t.info(n(P(`${r} ${String(e.length)} @types/* dep${e.length===1?"":"s"} in dependencies`)));for(const[s,i]of E(e,p=>p.packageName??p.packageJsonPath)){const p=$(a,i[0].packageJsonPath);t.info(` ${P(s)} ${u(`(${p})`)}`);for(const c of i)t.info(` ${D(c.depName)} ${u(c.childSpecifier)}`)}o||t.info(u(" Run with --fix to move them to devDependencies."))},$t=(e,a,o)=>{if(e.length===0){o.info(w("✓ similar-deps: every related dep family is in sync"));return}o.info(v(P(`Found ${String(e.length)} family${e.length===1?"":" families"} with version drift`)));for(const t of e){o.info(` ${P(t.familyLabel)} ${u(`(${t.specifiers.join(", ")})`)}`);for(const r of t.members){const n=$(a,r.packageJsonPath),s=r.packageName??n;o.info(` ${s} ${u(`(${n})`)} ${u(r.depType)}: ${D(r.depName)}@${v(r.specifier)}`)}}o.info(u(" Pick a single specifier per family and align by hand — auto-fix is unsafe across name boundaries."))},Pt=(e,a,o,t,r)=>{let n=!0;const s=i=>{n||r.info(""),n=!1,i()};t.workspaceProtocol&&s(()=>{rt(e.workspaceProtocol??[],a,o.workspaceProtocol,r)}),t.redefineRoot&&s(()=>{it(e.redefineRoot??[],a,r)}),t.workspaceVersions&&s(()=>{pt(e.workspaceVersions??[],a,o.workspaceVersions,r)}),t.customTypes&&s(()=>{lt(e.customTypes??[],a,o.customTypes,r)}),e.catalogProposals!==void 0&&s(()=>{ft(e.catalogProposals??[],a,o.catalogProposals,r)}),t.bannedDeps&&s(()=>{ct(e.bannedDeps??[],a,r)}),t.emptyDeps&&s(()=>{gt(e.emptyDeps??[],a,o.emptyDeps,r)}),t.rootPrivate&&s(()=>{dt(e.rootPrivate??[],a,o.rootPrivate,r)}),t.rootPackageManager&&s(()=>{ut(e.rootPackageManager??[],a,o.rootPackageManager,r)}),t.rootDeps&&s(()=>{mt(e.rootDeps??[],a,o.rootDeps,r)}),t.missingPackageJson&&s(()=>{ht(e.missingPackageJson??[],r)}),t.deadWorkspacePatterns&&s(()=>{kt(e.deadWorkspacePatterns??[],o.deadWorkspacePatterns,r)}),t.typesInDeps&&s(()=>{yt(e.typesInDeps??[],a,o.typesInDeps,r)}),t.similarDeps&&s(()=>{$t(e.similarDeps??[],a,r)})},wt=(e,a)=>{for(const o of e.workspaceProtocol??[]){const t=$(a,o.packageJsonPath);process.stdout.write(`workspace-protocol ${t} ${o.depType} ${o.depName} ${o.specifier} → ${o.fix}
11
- `)}for(const o of e.redefineRoot??[]){const t=$(a,o.packageJsonPath);process.stdout.write(`redefine-root ${t} ${o.depType} ${o.depName} ${o.childSpecifier}
12
- `)}for(const o of e.workspaceVersions??[]){const t=$(a,o.packageJsonPath);process.stdout.write(`workspace-versions ${t} ${o.depType} ${o.depName} ${o.specifier} → ${o.fix}
13
- `)}for(const o of e.customTypes??[]){const t=$(a,o.packageJsonPath);process.stdout.write(`custom-types ${t} ${o.customType} ${o.depName} ${o.specifier} → ${o.fix}
14
- `)}for(const o of e.bannedDeps??[]){const t=$(a,o.packageJsonPath);process.stdout.write(`banned-deps ${t} ${o.depType} ${o.depName} ${o.reason}
15
- `)}for(const o of e.catalogProposals??[])process.stdout.write(`catalog-proposal ${o.catalogName} ${o.depName} ${o.specifier} ${String(o.instanceCount)}
16
- `);for(const o of e.emptyDeps??[]){const t=$(a,o.packageJsonPath);process.stdout.write(`empty-deps ${t} ${o.depType}
17
- `)}for(const o of e.rootPrivate??[]){const t=$(a,o.packageJsonPath);process.stdout.write(`root-private ${t}
18
- `)}for(const o of e.rootPackageManager??[]){const t=$(a,o.packageJsonPath);process.stdout.write(`root-package-manager ${t} ${o.suggested??""}
19
- `)}for(const o of e.rootDeps??[]){const t=$(a,o.packageJsonPath);for(const r of o.depNames)process.stdout.write(`root-deps ${t} ${r}
20
- `)}for(const o of e.missingPackageJson??[])process.stdout.write(`missing-package-json ${o.packageDir}
21
- `);for(const o of e.deadWorkspacePatterns??[])process.stdout.write(`dead-workspace-pattern ${o.source} ${o.pattern}
22
- `);for(const o of e.typesInDeps??[]){const t=$(a,o.packageJsonPath);process.stdout.write(`types-in-deps ${t} ${o.depName} ${o.childSpecifier}
23
- `)}for(const o of e.similarDeps??[])for(const t of o.members){const r=$(a,t.packageJsonPath);process.stdout.write(`similar-deps ${o.family} ${r} ${t.depType} ${t.depName} ${t.specifier}
24
- `)}},Dt=(e,a,o,t)=>{const r=s=>({...s,packageJsonPath:$(a,s.packageJsonPath)}),n={fixed:o};if(t.workspaceProtocol){const s=(e.workspaceProtocol??[]).map(i=>r(i));n.workspaceProtocol={issues:s,total:s.length}}if(t.redefineRoot){const s=(e.redefineRoot??[]).map(i=>r(i));n.redefineRoot={issues:s,total:s.length}}if(t.workspaceVersions){const s=(e.workspaceVersions??[]).map(i=>r(i));n.workspaceVersions={issues:s,total:s.length}}if(t.customTypes){const s=(e.customTypes??[]).map(i=>r(i));n.customTypes={issues:s,total:s.length}}if(t.bannedDeps){const s=(e.bannedDeps??[]).map(i=>r(i));n.bannedDeps={issues:s,total:s.length}}if(e.catalogProposals!==void 0){const s=e.catalogProposals;n.catalogProposals={proposals:s,total:s.length}}if(t.emptyDeps){const s=(e.emptyDeps??[]).map(i=>r(i));n.emptyDeps={issues:s,total:s.length}}if(t.rootPrivate){const s=(e.rootPrivate??[]).map(i=>r(i));n.rootPrivate={issues:s,total:s.length}}if(t.rootPackageManager){const s=(e.rootPackageManager??[]).map(i=>r(i));n.rootPackageManager={issues:s,total:s.length}}if(t.rootDeps){const s=(e.rootDeps??[]).map(i=>r(i));n.rootDeps={issues:s,total:s.length}}if(t.missingPackageJson){const s=e.missingPackageJson??[];n.missingPackageJson={issues:s,total:s.length}}if(t.deadWorkspacePatterns){const s=e.deadWorkspacePatterns??[];n.deadWorkspacePatterns={issues:s,total:s.length}}if(t.typesInDeps){const s=(e.typesInDeps??[]).map(i=>r(i));n.typesInDeps={issues:s,total:s.length}}if(t.similarDeps){const s=(e.similarDeps??[]).map(i=>({...i,members:i.members.map(p=>({...p,packageJsonPath:$(a,p.packageJsonPath)}))}));n.similarDeps={issues:s,total:s.length}}process.stdout.write(`${JSON.stringify(n,void 0,2)}
25
- `)},J=(e,a,o)=>{const t=e[a];return typeof t=="boolean"?t:e[o]===!0},vt=e=>{const a=e,o=(e.ban?.length??0)>0,t=(e.pin?.length??0)>0,r=J(a,"workspaceProtocol","workspace-protocol"),n=J(a,"redefineRoot","redefine-root"),s=J(a,"bannedDeps","banned-deps"),i=J(a,"workspaceVersions","workspace-versions"),p=J(a,"customTypes","custom-types"),c=J(a,"emptyDeps","empty-deps"),f=J(a,"rootPrivate","root-private"),m=J(a,"rootPackageManager","root-package-manager"),d=J(a,"rootDeps","root-deps"),g=J(a,"missingPackageJson","missing-package-json"),h=J(a,"deadWorkspacePatterns","dead-workspace-patterns"),y=J(a,"typesInDeps","types-in-deps"),x=J(a,"similarDeps","similar-deps");return r||n||s||i||p||c||f||m||d||g||h||y||x||o||t?{bannedDeps:s||o,customTypes:p,deadWorkspacePatterns:h,emptyDeps:c,missingPackageJson:g,redefineRoot:n,rootDeps:d,rootPackageManager:m,rootPrivate:f,similarDeps:x,typesInDeps:y,workspaceProtocol:r,workspaceVersions:i||t}:{bannedDeps:!0,customTypes:!0,deadWorkspacePatterns:!0,emptyDeps:!0,missingPackageJson:!0,redefineRoot:!0,rootDeps:!0,rootPackageManager:!0,rootPrivate:!0,similarDeps:!0,typesInDeps:!0,workspaceProtocol:!0,workspaceVersions:!0}},Nt=e=>{const a=new Map;for(const o of e??[]){const t=o.lastIndexOf("@");if(t<=0||t===o.length-1)throw new Error(`Invalid --pin "${o}". Use: name@<specifier> (e.g. react@^18.2.0).`);const r=o.slice(0,t),n=o.slice(t+1);a.set(r,n)}return a},bt=new Set(["catalog","highest","lowest"]),xt=e=>{if(e===void 0)return"highest";if(!bt.has(e))throw new Error(`Invalid --resolve "${e}". Use: highest, lowest, or catalog.`);return e},R=(e,a)=>e?a===void 0||a===!0:!1,Jt={"custom-types":"policy.customTypes.autofix","workspace-protocol":"policy.workspaceProtocol.autofix","workspace-versions":"policy.workspaceVersions.autofix"},z=(e,a,o,t)=>{const r=Jt[a],n=o==="prompt"?`${r} = "prompt" (interactive mode not yet implemented; report-only)`:`${r} = false`,s=`Set "${r}": true (or remove it) to enable rewrites.`;e.warn(`${a}: ${String(t)} issue${t===1?"":"s"} not rewritten — ${n}. ${s}`)},Ft=async({logger:e,options:a,visConfig:o,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const r=t,n=a.fix??!1,s=a.format??"human",i=a.quiet??!1;if(!["human","json","minimal"].includes(s))throw new Error(`Invalid --format "${s}". Use: human, json, or minimal.`);const p=vt(a),c=o?.policy??{},f=o?.editorconfig??!0,m=Nt(a.pin),d=a.ban??[];(a.dep!==void 0||a.resolve!==void 0)&&!p.workspaceVersions&&!i&&e.warn("--dep / --resolve only apply to --workspace-versions; ignored.");const g=ne(r),h={},y={catalogProposals:!1,customTypes:!1,deadWorkspacePatterns:!1,emptyDeps:!1,rootDeps:!1,rootPackageManager:!1,rootPrivate:!1,typesInDeps:!1,workspaceProtocol:!1,workspaceVersions:!1},x=at(r);let N=0;if(p.workspaceProtocol){const l=Qe(g,{fixSpecifier:a.fixSpecifier}),k=R(n,c.workspaceProtocol?.autofix);k&&l.length>0&&(Ge(l,{useEditorconfig:f}),y.workspaceProtocol=!0),h.workspaceProtocol=l,k||(N+=l.length),n&&!k&&l.length>0&&!i&&z(e,"workspace-protocol",c.workspaceProtocol?.autofix,l.length)}if(p.redefineRoot){const l=Me(g,{ignoreDeps:c.redefineRoot?.ignore});h.redefineRoot=l,N+=l.length}if(p.workspaceVersions){const l=xt(a.resolve??c.workspaceVersions?.resolve),k=l==="catalog"?fe(r):void 0;l==="catalog"&&(!k||k.size===0)&&!i&&e.warn("--resolve catalog: no catalog found in pnpm-workspace.yaml or root package.json — nothing to align.");const b=st(g,{catalogs:k,dep:a.dep,ignoreDeps:c.workspaceVersions?.ignore,pinned:m.size>0?m:void 0,resolve:l}),F=R(n,c.workspaceVersions?.autofix);if(F&&b.length>0&&(nt(b,{useEditorconfig:f}),y.workspaceVersions=!0),h.workspaceVersions=b,F||(N+=b.length),n&&!F&&b.length>0&&!i&&z(e,"workspace-versions",c.workspaceVersions?.autofix,b.length),a.proposeMin!==void 0){if(l!=="catalog"&&!i)e.warn("--propose-min only runs under --resolve catalog; ignored.");else if(l==="catalog"){const M=we(g,{catalogs:k,ignoreDeps:c.workspaceVersions?.ignore,min:a.proposeMin});F&&M.length>0&&(De(r,M),y.catalogProposals=!0),h.catalogProposals=M}}}if(p.customTypes){const l=c.customTypes?.extraTypes,k=ae(l);if(k.length>0){for(const H of k)e.error(`policy.customTypes.${H}`);process.exitCode=1;return}const b=re(r,l),F=(a.resolve??c.customTypes?.resolve)==="lowest"?"lowest":"highest",M=ie(b,{dep:a.dep,ignoreDeps:c.customTypes?.ignore,resolve:F}),_=R(n,c.customTypes?.autofix);_&&M.length>0&&(pe(M,{useEditorconfig:f}),y.customTypes=!0),h.customTypes=M,_||(N+=M.length),n&&!_&&M.length>0&&!i&&z(e,"custom-types",c.customTypes?.autofix,M.length)}if(p.bannedDeps){const l={...c.bannedDeps};for(const b of d)l[b]={reason:"banned via --ban CLI flag"};Object.keys(l).length===0&&a.bannedDeps&&!i&&e.warn("--banned-deps: no policy.bannedDeps in vis config, nothing to check.");const k=he(g,l);h.bannedDeps=k,N+=k.length}if(p.emptyDeps){const l=Je(r,{ignoreBlocks:c.emptyDeps?.ignoreBlocks}),k=R(n,c.emptyDeps?.autofix);k&&l.length>0&&(Te(l,{useEditorconfig:f}),y.emptyDeps=!0),h.emptyDeps=l,k||(N+=l.length)}if(p.rootPrivate){const l=Fe(r,x),k=R(n,c.rootPrivate?.autofix);k&&l.length>0&&(Ve(l,{useEditorconfig:f}),y.rootPrivate=!0),h.rootPrivate=l,k||(N+=l.length)}if(p.rootPackageManager){const l=Ie(r,x,{suggested:c.rootPackageManager?.suggested}),k=R(n,c.rootPackageManager?.autofix);k&&l.some(b=>b.suggested!==void 0)&&(Ee(l,{useEditorconfig:f}),y.rootPackageManager=!0),h.rootPackageManager=l,(!k||!y.rootPackageManager)&&(N+=l.filter(b=>b.suggested===void 0||!y.rootPackageManager).length)}if(p.rootDeps){const l=je(r,x),k=R(n,c.rootDeps?.autofix);k&&l.length>0&&(Re(l,{useEditorconfig:f}),y.rootDeps=!0),h.rootDeps=l,k||(N+=l.length)}if(p.missingPackageJson){const l=le(r);h.missingPackageJson=l,N+=l.length}if(p.deadWorkspacePatterns){const l=Ne(r),k=R(n,c.deadWorkspacePatterns?.autofix);k&&l.length>0&&(be(l,{useEditorconfig:f}),y.deadWorkspacePatterns=!0),h.deadWorkspacePatterns=l,k||(N+=l.length)}if(p.typesInDeps){const l=Be(g,{ignoreDeps:c.typesInDeps?.ignore}),k=R(n,c.typesInDeps?.autofix);k&&l.length>0&&(Le(l,{useEditorconfig:f}),y.typesInDeps=!0),h.typesInDeps=l,k||(N+=l.length)}if(p.similarDeps){const l=Oe(g,{extraFamilies:c.similarDeps?.extraFamilies,ignoreFamilies:c.similarDeps?.ignoreFamilies});h.similarDeps=l,N+=l.length}i||(s==="json"?Dt(h,r,y,p):s==="minimal"?wt(h,r):Pt(h,r,y,p,e)),N>0&&(process.exitCode=1)};export{Ft as default};
7
+ `;if((r.length>0?r.split(i):[]).findIndex(f=>/^catalog\s*:\s*$/.test(f))===-1){o.push("@@ +1 @@","+catalog:");for(const f of n)o.push(`+ ${f.depName}: "${f.specifier}"`)}else{o.push("@@ catalog: @@");for(const f of n)o.push(`+ ${f.depName}: "${f.specifier}"`)}return o.join(i)},Ne=e=>{const a=[],s=pe(e);if(s){const r=I(e,"pnpm-workspace.yaml");for(const n of s)n.startsWith("!")||z(e,[n]).length===0&&a.push({pattern:n,source:"pnpm-workspace.yaml",sourcePath:r})}const t=I(e,"package.json");if(_(t)){const n=S(t).workspaces,o=Array.isArray(n)?n:n?.packages;if(o)for(const i of o)typeof i!="string"||i.startsWith("!")||z(e,[i]).length===0&&a.push({pattern:i,source:"package.json",sourcePath:t})}return a},Te=(e,a={})=>{const{useEditorconfig:s}=a,t=new Map;for(const n of e){const o=t.get(n.sourcePath);o?o.push(n):t.set(n.sourcePath,[n])}const r=[];for(const[n,o]of t){const i=new Set(o.map(m=>m.pattern));if(n.endsWith(".yaml")||n.endsWith(".yml")){const h=se(n).split(`
8
+ `).filter(d=>{const u=d.trim();if(!u.startsWith("- "))return!0;const k=u.slice(2).replaceAll(/^['"]|['"]$/g,"");return!i.has(k)}).join(`
9
+ `);le(n,h,{overwrite:!0}),r.push(n);continue}const p=S(n),f=p.workspaces;Array.isArray(f)?p.workspaces=f.filter(m=>typeof m!="string"||!i.has(m)):f&&Array.isArray(f.packages)&&(f.packages=f.packages.filter(m=>typeof m!="string"||!i.has(m))),j(n,p,{indent:W(n,{useEditorconfig:s}),overwrite:!0}),r.push(n)}return r},xe=["dependencies","devDependencies","peerDependencies","optionalDependencies"],Je=(e,a={})=>{const s=new Set(a.ignoreBlocks),t=oe(e),r=[];for(const n of t){const o=I(e,n,"package.json"),i=F(o);if(!i)continue;const c=typeof i.name=="string"?i.name:void 0;for(const p of xe){if(s.has(p))continue;const f=i[p];typeof f=="object"&&f!==null&&!Array.isArray(f)&&Object.keys(f).length===0&&r.push({depType:p,packageDir:n,packageJsonPath:o,packageName:c})}}return r},Se=(e,a={})=>{const{useEditorconfig:s}=a,t=new Map;for(const n of e){const o=t.get(n.packageJsonPath);o?o.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,o]of t){const i=S(n);for(const c of o){const p=i[c.depType];typeof p=="object"&&p!==null&&!Array.isArray(p)&&Object.keys(p).length===0&&Reflect.deleteProperty(i,c.depType)}j(n,i,{indent:W(n,{useEditorconfig:s}),overwrite:!0}),r.push(n)}return r},Ie=["dependencies","devDependencies","optionalDependencies","peerDependencies"],Me=(e,a={})=>{const s=new Set(a.depTypes??Ie),t=new Set(a.ignoreDeps),r=new Map;for(const o of e)o.packageDir!=="."||!s.has(o.depType)||r.set(o.depName,{depType:o.depType,specifier:o.specifier});if(r.size===0)return[];const n=[];for(const o of e){if(o.packageDir==="."||!s.has(o.depType)||t.has(o.depName))continue;const i=r.get(o.depName);i&&n.push({childSpecifier:o.specifier,depName:o.depName,depType:o.depType,packageDir:o.packageDir,packageJsonPath:o.packageJsonPath,packageName:o.packageName,rootDepType:i.depType,rootSpecifier:i.specifier})}return n},We=(e,a)=>{if(!a)return[];const s=I(e,"package.json"),t=F(s);if(!t)return[];if(t.private!==!0)return[];const r=t.dependencies;if(typeof r!="object"||r===null||Array.isArray(r))return[];const n=Object.keys(r);return n.length===0?[]:[{depNames:n,packageJsonPath:s}]},je=(e,a={})=>{const{useEditorconfig:s}=a,t=[];for(const r of e){const n=S(r.packageJsonPath),o=n.dependencies;if(typeof o!="object"||o===null)continue;const i=o;n.devDependencies??={};const c=n.devDependencies;for(const p of r.depNames){const f=i[p];typeof f=="string"&&(p in c||(c[p]=f),Reflect.deleteProperty(i,p))}Object.keys(i).length===0&&Reflect.deleteProperty(n,"dependencies"),j(r.packageJsonPath,n,{indent:W(r.packageJsonPath,{useEditorconfig:s}),overwrite:!0}),t.push(r.packageJsonPath)}return t},Ae=/^[a-z][\w-]*@\S+$/i,Ee=(e,a,s={})=>{if(!a)return[];const t=I(e,"package.json"),r=F(t);if(!r)return[];const n=r.packageManager;return typeof n=="string"&&Ae.test(n)?[]:[{packageJsonPath:t,suggested:s.suggested}]},Re=(e,a={})=>{const{useEditorconfig:s}=a,t=[];for(const r of e){if(!r.suggested)continue;const n=S(r.packageJsonPath);n.packageManager=r.suggested,j(r.packageJsonPath,n,{indent:W(r.packageJsonPath,{useEditorconfig:s}),overwrite:!0}),t.push(r.packageJsonPath)}return t},Ce=(e,a)=>{if(!a)return[];const s=I(e,"package.json"),t=F(s);return t?t.private===!0?[]:[{packageJsonPath:s,rawValue:t.private}]:[]},Ve=(e,a={})=>{const{useEditorconfig:s}=a,t=[];for(const r of e){const n=S(r.packageJsonPath);let o=n;if("private"in n)n.private=!0;else{const{name:i,version:c,...p}=n,f={};i!==void 0&&(f.name=i),c!==void 0&&(f.version=c),f.private=!0;for(const[m,h]of Object.entries(p))f[m]=h;o=f}j(r.packageJsonPath,o,{indent:W(r.packageJsonPath,{useEditorconfig:s}),overwrite:!0}),t.push(r.packageJsonPath)}return t},_e=[{id:"react",label:"React",members:["react","react-dom","react-test-renderer"]},{id:"next",label:"Next.js",members:["next","@next/font","@next/bundle-analyzer","@next/mdx","@next/third-parties","@next/eslint-plugin-next","eslint-config-next"]},{id:"babel",label:"Babel",prefixes:["@babel/"]},{id:"storybook",label:"Storybook",members:["storybook","sb"],prefixes:["@storybook/"]},{id:"vitest",label:"Vitest",members:["vitest"],prefixes:["@vitest/"]},{id:"playwright",label:"Playwright",members:["playwright","@playwright/test"]},{id:"trpc",label:"tRPC",prefixes:["@trpc/"]},{id:"prisma",label:"Prisma",members:["prisma"],prefixes:["@prisma/"]},{id:"turborepo",label:"Turborepo",members:["turbo","turbo-ignore","@turbo/gen","eslint-config-turbo","eslint-plugin-turbo"]},{id:"typescript-eslint",label:"typescript-eslint",members:["typescript-eslint"],prefixes:["@typescript-eslint/"]},{id:"eslint-stylistic",label:"ESLint Stylistic",prefixes:["@stylistic/"]},{id:"lexical",label:"Lexical",members:["lexical"],prefixes:["@lexical/"]},{id:"nx",label:"Nx",prefixes:["@nx/","@nrwl/"]}],Fe=new Set(["dependencies","devDependencies","peerDependencies"]),Oe=(e,a)=>{for(const s of e)if(s.members?.includes(a)||s.prefixes?.some(t=>a.startsWith(t)))return s},Be=e=>e.startsWith("workspace:")||e.startsWith("catalog:"),He=(e,a={})=>{const s=new Set(a.ignoreFamilies),t=new Map;for(const i of _e)t.set(i.id,i);for(const i of a.extraFamilies??[])t.set(i.id,i);const r=[...t.values()],n=new Map;for(const i of e){if(i.isInternal||!Fe.has(i.depType)||Be(i.specifier))continue;const c=Oe(r,i.depName);if(!c||s.has(c.id))continue;const p=n.get(c.id),f={depName:i.depName,depType:i.depType,packageDir:i.packageDir,packageJsonPath:i.packageJsonPath,packageName:i.packageName,specifier:i.specifier};p?p.push(f):n.set(c.id,[f])}const o=[];for(const[i,c]of n){const p=[...new Set(c.map(m=>m.specifier))];if(p.length<2)continue;const f=t.get(i);f&&o.push({family:i,familyLabel:f.label??i,members:c,specifiers:p})}return o},ze=e=>e.startsWith("@types/"),Le=(e,a={})=>{const s=new Set(a.ignoreDeps),t=new Map,r=o=>{const i=t.get(o);if(i!==void 0)return i;try{const p=S(o).private===!0;return t.set(o,p),p}catch{return t.set(o,!1),!1}},n=[];for(const o of e)o.depType==="dependencies"&&ze(o.depName)&&(s.has(o.depName)||r(o.packageJsonPath)&&n.push({childSpecifier:o.specifier,depName:o.depName,packageDir:o.packageDir,packageJsonPath:o.packageJsonPath,packageName:o.packageName}));return n},Ke=(e,a={})=>{const{useEditorconfig:s}=a,t=new Map;for(const n of e){const o=t.get(n.packageJsonPath);o?o.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,o]of t){const i=S(n),c=i.dependencies;if(typeof c!="object"||c===null)continue;const p=c;i.devDependencies??={};const f=i.devDependencies;for(const m of o){const h=p[m.depName];typeof h=="string"&&(m.depName in f||(f[m.depName]=h),Reflect.deleteProperty(p,m.depName))}Object.keys(p).length===0&&Reflect.deleteProperty(i,"dependencies"),j(n,i,{indent:W(n,{useEditorconfig:s}),overwrite:!0}),r.push(n)}return r},qe=e=>e.startsWith("workspace:"),Ge=(e,a={})=>{const s=a.fixSpecifier??"workspace:*",t=[];for(const r of e)r.isInternal&&(qe(r.specifier)||t.push({depName:r.depName,depType:r.depType,fix:s,packageDir:r.packageDir,packageJsonPath:r.packageJsonPath,packageName:r.packageName,specifier:r.specifier}));return t},Ue=(e,a,s,t)=>{const r=a.split(".");let n=e;for(let c=0;c<r.length-1;c+=1){const p=r[c],f=n[p];(typeof f!="object"||f===null)&&(n[p]={}),n=n[p]}const o=r.at(-1);let i=n[o];(typeof i!="object"||i===null)&&(i={},n[o]=i),i[s]=t},Ye=(e,a={})=>{const{useEditorconfig:s}=a,t=new Map;for(const n of e){const o=t.get(n.packageJsonPath);o?o.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,o]of t){const i=S(n);for(const c of o)if(c.depType.includes("."))Ue(i,c.depType,c.depName,c.fix);else{const p=i[c.depType];typeof p=="object"&&p!==null&&(p[c.depName]=c.fix)}j(n,i,{indent:W(n,{useEditorconfig:s}),overwrite:!0}),r.push(n)}return r},Xe=new Set(["dependencies","devDependencies","peerDependencies"]),Qe=e=>e.startsWith("catalog:"),Ze=e=>e.startsWith("workspace:"),et=e=>{if(!e.startsWith("catalog:"))return;const a=e.slice(8);return a===""?"default":a},tt=(e,a)=>{if(e.get("default")?.has(a))return"default";const s=[...e.keys()].filter(t=>t!=="default").sort();for(const t of s)if(e.get(t)?.has(a))return t},st=e=>e==="default"?"catalog:":`catalog:${e}`,ot=(e,a)=>{const s=[...e].sort((r,n)=>(r.packageName??r.packageDir).localeCompare(n.packageName??n.packageDir));let t;for(const r of s){const n=L(r.specifier);if(!n)continue;if(!t){t=r;continue}const o=L(t.specifier);if(!o){t=r;continue}const i=K(o,n),c=K(n,o);(a==="highest"&&i||a==="lowest"&&c)&&(t=r)}if(t)return{canonical:t,canonicalSource:t.packageName??t.packageDir}},nt=(e,a={})=>{const s=a.resolve??"highest",t=new Set(a.ignoreDeps),r=[],n=e.filter(i=>i.isInternal||!Xe.has(i.depType)||Ze(i.specifier)||a.dep!==void 0&&i.depName!==a.dep?!1:!t.has(i.depName)),o=new Map;for(const i of n){const c=o.get(i.depName);c?c.push(i):o.set(i.depName,[i])}for(const[i,c]of o){const p=a.pinned?.get(i);if(p!==void 0){for(const u of c)u.specifier!==p&&r.push({canonicalSource:"cli:--pin",depName:i,depType:u.depType,fix:p,packageDir:u.packageDir,packageJsonPath:u.packageJsonPath,packageName:u.packageName,specifier:u.specifier});continue}if(s==="catalog"){const{catalogs:u}=a;if(!u)continue;const k=tt(u,i);if(!k)continue;const J=st(k);for(const P of c)et(P.specifier)!==k&&r.push({canonicalSource:`catalog:${k}`,depName:i,depType:P.depType,fix:J,packageDir:P.packageDir,packageJsonPath:P.packageJsonPath,packageName:P.packageName,specifier:P.specifier});continue}const f=c.filter(u=>!Qe(u.specifier));if(f.length<2||new Set(f.map(u=>u.specifier)).size<=1)continue;const h=ot(f,s);if(!h)continue;const d=h.canonical.specifier;for(const u of f)u.specifier!==d&&r.push({canonicalSource:h.canonicalSource,depName:i,depType:u.depType,fix:d,packageDir:u.packageDir,packageJsonPath:u.packageJsonPath,packageName:u.packageName,specifier:u.specifier})}return r},at=(e,a={})=>{const{useEditorconfig:s}=a,t=new Map;for(const n of e){const o=t.get(n.packageJsonPath);o?o.push(n):t.set(n.packageJsonPath,[n])}const r=[];for(const[n,o]of t){const i=S(n);for(const c of o){const p=i[c.depType];typeof p=="object"&&p!==null&&(p[c.depName]=c.fix)}j(n,i,{indent:W(n,{useEditorconfig:s}),overwrite:!0}),r.push(n)}return r},it=e=>{if(_(I(e,"pnpm-workspace.yaml")))return!0;const a=I(e,"package.json");if(!_(a))return!1;try{return S(a).workspaces!==void 0}catch{return!1}},A=(e,a)=>{const s=new Map;for(const t of e){const r=a(t),n=s.get(r);n?n.push(t):s.set(r,[t])}return s},rt=(e,a,s,t)=>{if(e.length===0){t.info(v("✓ workspace-protocol: no violations"));return}const r=s?"Fixed":"Found",n=s?x:b;t.info(n(w(`${r} ${String(e.length)} workspace-protocol violation${e.length===1?"":"s"}`)));for(const[o,i]of A(e,c=>c.packageName??c.packageJsonPath)){const c=$(a,i[0].packageJsonPath);t.info(` ${w(o)} ${g(`(${c})`)}`);for(const p of i){const f=s?x("→"):b("→");t.info(` ${g(p.depType)} ${p.depName}: ${D(p.specifier)} ${f} ${v(p.fix)}`)}}s||t.info(g(" Run with --fix to rewrite specifiers in place."))},ct=(e,a,s)=>{if(e.length===0){s.info(v("✓ redefine-root: no violations"));return}s.info(b(w(`Found ${String(e.length)} dep${e.length===1?"":"s"} re-declared from root`)));for(const[t,r]of A(e,n=>n.packageName??n.packageJsonPath)){const n=$(a,r[0].packageJsonPath);s.info(` ${w(t)} ${g(`(${n})`)}`);for(const o of r)s.info(` ${g(o.depType)} ${o.depName}: ${D(o.childSpecifier)} ${g(`(root ${o.rootDepType}: ${o.rootSpecifier})`)}`)}s.info(g(" Remove these from child package.json files — root pin will resolve."))},pt=(e,a,s,t)=>{if(e.length===0){t.info(v("✓ workspace-versions: no drift"));return}const r=s?"Fixed":"Found",n=s?x:b;t.info(n(w(`${r} ${String(e.length)} workspace-version drift${e.length===1?"":"s"}`)));for(const[o,i]of A(e,c=>c.depName)){const c=i[0].fix,p=i[0].canonicalSource;t.info(` ${w(o)} ${g(`canonical: ${c} (from ${p})`)}`);for(const f of i){const m=$(a,f.packageJsonPath),h=f.packageName??m,d=s?x("→"):b("→");t.info(` ${h} ${g(`(${m})`)} ${g(f.depType)}: ${D(f.specifier)} ${d} ${v(f.fix)}`)}}s||t.info(g(" Run with --fix to align drifting specifiers."))},ft=(e,a,s)=>{if(e.length===0){s.info(v("✓ banned-deps: no violations"));return}s.info(D(w(`Found ${String(e.length)} banned dep${e.length===1?"":"s"}`)));for(const[t,r]of A(e,n=>n.packageName??n.packageJsonPath)){const n=$(a,r[0].packageJsonPath);s.info(` ${w(t)} ${g(`(${n})`)}`);for(const o of r){const i=o.replacement?` ${g("→")} ${v(o.replacement)}`:"";s.info(` ${g(o.depType)} ${D(o.depName)}${i}`),s.info(` ${g(o.reason)}`)}}},lt=(e,a,s,t)=>{if(e.length===0){t.info(v("✓ catalog-proposals: nothing worth promoting"));return}const r=s?"Added":"Would add",n=s?x:b;t.info(n(w(`${r} ${String(e.length)} catalog entr${e.length===1?"y":"ies"}`)));for(const o of e)t.info(` ${w(o.depName)}: ${v(o.specifier)} ${g(`(${String(o.instanceCount)} packages agree)`)}`);if(!s){const o=be(a,e);if(o){t.info(""),t.info(g("Proposed pnpm-workspace.yaml changes:"));for(const i of o.split(`
10
+ `))i.startsWith("+")?t.info(v(i)):i.startsWith("-")?t.info(D(i)):t.info(g(i))}t.info(g(" Run with --fix to write these entries to pnpm-workspace.yaml."))}},ut=(e,a,s,t)=>{if(e.length===0){t.info(v("✓ custom-types: no engines / packageManager / volta drift"));return}const r=s?"Fixed":"Found",n=s?x:b;t.info(n(w(`${r} ${String(e.length)} custom-type drift${e.length===1?"":"s"}`)));for(const[o,i]of A(e,c=>`${c.customType} ${c.depName}`)){const c=i[0].fix,p=i[0].canonicalSource;t.info(` ${w(o)} ${g(`canonical: ${c} (from ${p})`)}`);for(const f of i){const m=$(a,f.packageJsonPath),h=f.packageName??m,d=s?x("→"):b("→");t.info(` ${h} ${g(`(${m})`)}: ${D(f.specifier)} ${d} ${v(f.fix)}`)}}s||t.info(g(" Run with --fix to align engines/packageManager/volta versions."))},dt=(e,a,s,t)=>{if(e.length===0){t.info(v("✓ empty-deps: no empty dependency blocks"));return}const r=s?"Removed":"Found",n=s?x:b;t.info(n(w(`${r} ${String(e.length)} empty dependency block${e.length===1?"":"s"}`)));for(const[o,i]of A(e,c=>c.packageName??c.packageJsonPath)){const c=$(a,i[0].packageJsonPath);t.info(` ${w(o)} ${g(`(${c})`)}`);for(const p of i)t.info(` ${g(p.depType)}: ${D("{}")}`)}s||t.info(g(" Run with --fix to drop empty blocks."))},gt=(e,a,s,t)=>{if(e.length===0){t.info(v('✓ root-private: root package.json is "private": true'));return}const r=s?"Set":"Missing",n=s?x:D;for(const o of e){const i=$(a,o.packageJsonPath);if(t.info(n(w(`${r} "private": true on root ${g(`(${i})`)}`))),!s){const c=o.rawValue===void 0?"absent":JSON.stringify(o.rawValue);t.info(` ${g("current:")} ${D(c)}`)}}s||t.info(g(' Run with --fix to set "private": true.'))},mt=(e,a,s,t)=>{if(e.length===0){t.info(v("✓ root-package-manager: packageManager field present"));return}const r=s?"Set":"Missing",n=s?x:D;for(const o of e){const i=$(a,o.packageJsonPath);t.info(n(w(`${r} packageManager on root ${g(`(${i})`)}`))),!s&&!o.suggested&&t.info(g(" no canonical specifier configured (set policy.rootPackageManager.suggested to enable --fix)"))}s||t.info(g(' e.g. "packageManager": "pnpm@10.32.1"'))},ht=(e,a,s,t)=>{if(e.length===0){t.info(v("✓ root-deps: no runtime dependencies on private root"));return}const r=s?"Moved":"Found",n=s?x:b;for(const o of e){const i=$(a,o.packageJsonPath);t.info(n(w(`${r} ${String(o.depNames.length)} runtime dep${o.depNames.length===1?"":"s"} on private root ${g(`(${i})`)}`)));for(const c of o.depNames)t.info(` ${D(c)}`)}s||t.info(g(" Run with --fix to move them to devDependencies."))},kt=(e,a)=>{if(e.length===0){a.info(v("✓ missing-package-json: every workspace dir has a package.json"));return}a.info(b(w(`Found ${String(e.length)} workspace dir${e.length===1?"":"s"} without a package.json`)));for(const s of e)a.info(` ${D(s.packageDir)}`);a.info(g(" Either delete the directory or scaffold a package.json (vis create)."))},yt=(e,a,s)=>{if(e.length===0){s.info(v("✓ dead-workspace-pattern: every workspace pattern matches at least one package"));return}const t=a?"Removed":"Found",r=a?x:b;s.info(r(w(`${t} ${String(e.length)} unmatched workspace pattern${e.length===1?"":"s"}`)));for(const[n,o]of A(e,i=>i.source)){s.info(` ${w(n)}`);for(const i of o)s.info(` ${D(i.pattern)}`)}a||s.info(g(" Run with --fix to drop dead patterns."))},Pt=(e,a,s,t)=>{if(e.length===0){t.info(v("✓ types-in-deps: no @types/* in dependencies of private packages"));return}const r=s?"Moved":"Found",n=s?x:b;t.info(n(w(`${r} ${String(e.length)} @types/* dep${e.length===1?"":"s"} in dependencies`)));for(const[o,i]of A(e,c=>c.packageName??c.packageJsonPath)){const c=$(a,i[0].packageJsonPath);t.info(` ${w(o)} ${g(`(${c})`)}`);for(const p of i)t.info(` ${D(p.depName)} ${g(p.childSpecifier)}`)}s||t.info(g(" Run with --fix to move them to devDependencies."))},$t=(e,a,s)=>{if(e.length===0){s.info(v("✓ similar-deps: every related dep family is in sync"));return}s.info(b(w(`Found ${String(e.length)} family${e.length===1?"":" families"} with version drift`)));for(const t of e){s.info(` ${w(t.familyLabel)} ${g(`(${t.specifiers.join(", ")})`)}`);for(const r of t.members){const n=$(a,r.packageJsonPath),o=r.packageName??n;s.info(` ${o} ${g(`(${n})`)} ${g(r.depType)}: ${D(r.depName)}@${b(r.specifier)}`)}}s.info(g(" Pick a single specifier per family and align by hand — auto-fix is unsafe across name boundaries."))},wt=(e,a,s,t,r)=>{let n=!0;const o=i=>{n||r.info(""),n=!1,i()};t.workspaceProtocol&&o(()=>{rt(e.workspaceProtocol??[],a,s.workspaceProtocol,r)}),t.redefineRoot&&o(()=>{ct(e.redefineRoot??[],a,r)}),t.workspaceVersions&&o(()=>{pt(e.workspaceVersions??[],a,s.workspaceVersions,r)}),t.customTypes&&o(()=>{ut(e.customTypes??[],a,s.customTypes,r)}),e.catalogProposals!==void 0&&o(()=>{lt(e.catalogProposals??[],a,s.catalogProposals,r)}),t.bannedDeps&&o(()=>{ft(e.bannedDeps??[],a,r)}),t.emptyDeps&&o(()=>{dt(e.emptyDeps??[],a,s.emptyDeps,r)}),t.rootPrivate&&o(()=>{gt(e.rootPrivate??[],a,s.rootPrivate,r)}),t.rootPackageManager&&o(()=>{mt(e.rootPackageManager??[],a,s.rootPackageManager,r)}),t.rootDeps&&o(()=>{ht(e.rootDeps??[],a,s.rootDeps,r)}),t.missingPackageJson&&o(()=>{kt(e.missingPackageJson??[],r)}),t.deadWorkspacePatterns&&o(()=>{yt(e.deadWorkspacePatterns??[],s.deadWorkspacePatterns,r)}),t.typesInDeps&&o(()=>{Pt(e.typesInDeps??[],a,s.typesInDeps,r)}),t.similarDeps&&o(()=>{$t(e.similarDeps??[],a,r)})},vt=(e,a)=>{for(const s of e.workspaceProtocol??[]){const t=$(a,s.packageJsonPath);process.stdout.write(`workspace-protocol ${t} ${s.depType} ${s.depName} ${s.specifier} → ${s.fix}
11
+ `)}for(const s of e.redefineRoot??[]){const t=$(a,s.packageJsonPath);process.stdout.write(`redefine-root ${t} ${s.depType} ${s.depName} ${s.childSpecifier}
12
+ `)}for(const s of e.workspaceVersions??[]){const t=$(a,s.packageJsonPath);process.stdout.write(`workspace-versions ${t} ${s.depType} ${s.depName} ${s.specifier} → ${s.fix}
13
+ `)}for(const s of e.customTypes??[]){const t=$(a,s.packageJsonPath);process.stdout.write(`custom-types ${t} ${s.customType} ${s.depName} ${s.specifier} → ${s.fix}
14
+ `)}for(const s of e.bannedDeps??[]){const t=$(a,s.packageJsonPath);process.stdout.write(`banned-deps ${t} ${s.depType} ${s.depName} ${s.reason}
15
+ `)}for(const s of e.catalogProposals??[])process.stdout.write(`catalog-proposal ${s.catalogName} ${s.depName} ${s.specifier} ${String(s.instanceCount)}
16
+ `);for(const s of e.emptyDeps??[]){const t=$(a,s.packageJsonPath);process.stdout.write(`empty-deps ${t} ${s.depType}
17
+ `)}for(const s of e.rootPrivate??[]){const t=$(a,s.packageJsonPath);process.stdout.write(`root-private ${t}
18
+ `)}for(const s of e.rootPackageManager??[]){const t=$(a,s.packageJsonPath);process.stdout.write(`root-package-manager ${t} ${s.suggested??""}
19
+ `)}for(const s of e.rootDeps??[]){const t=$(a,s.packageJsonPath);for(const r of s.depNames)process.stdout.write(`root-deps ${t} ${r}
20
+ `)}for(const s of e.missingPackageJson??[])process.stdout.write(`missing-package-json ${s.packageDir}
21
+ `);for(const s of e.deadWorkspacePatterns??[])process.stdout.write(`dead-workspace-pattern ${s.source} ${s.pattern}
22
+ `);for(const s of e.typesInDeps??[]){const t=$(a,s.packageJsonPath);process.stdout.write(`types-in-deps ${t} ${s.depName} ${s.childSpecifier}
23
+ `)}for(const s of e.similarDeps??[])for(const t of s.members){const r=$(a,t.packageJsonPath);process.stdout.write(`similar-deps ${s.family} ${r} ${t.depType} ${t.depName} ${t.specifier}
24
+ `)}},Dt=(e,a,s,t)=>{const r=o=>({...o,packageJsonPath:$(a,o.packageJsonPath)}),n={fixed:s};if(t.workspaceProtocol){const o=(e.workspaceProtocol??[]).map(i=>r(i));n.workspaceProtocol={issues:o,total:o.length}}if(t.redefineRoot){const o=(e.redefineRoot??[]).map(i=>r(i));n.redefineRoot={issues:o,total:o.length}}if(t.workspaceVersions){const o=(e.workspaceVersions??[]).map(i=>r(i));n.workspaceVersions={issues:o,total:o.length}}if(t.customTypes){const o=(e.customTypes??[]).map(i=>r(i));n.customTypes={issues:o,total:o.length}}if(t.bannedDeps){const o=(e.bannedDeps??[]).map(i=>r(i));n.bannedDeps={issues:o,total:o.length}}if(e.catalogProposals!==void 0){const o=e.catalogProposals;n.catalogProposals={proposals:o,total:o.length}}if(t.emptyDeps){const o=(e.emptyDeps??[]).map(i=>r(i));n.emptyDeps={issues:o,total:o.length}}if(t.rootPrivate){const o=(e.rootPrivate??[]).map(i=>r(i));n.rootPrivate={issues:o,total:o.length}}if(t.rootPackageManager){const o=(e.rootPackageManager??[]).map(i=>r(i));n.rootPackageManager={issues:o,total:o.length}}if(t.rootDeps){const o=(e.rootDeps??[]).map(i=>r(i));n.rootDeps={issues:o,total:o.length}}if(t.missingPackageJson){const o=e.missingPackageJson??[];n.missingPackageJson={issues:o,total:o.length}}if(t.deadWorkspacePatterns){const o=e.deadWorkspacePatterns??[];n.deadWorkspacePatterns={issues:o,total:o.length}}if(t.typesInDeps){const o=(e.typesInDeps??[]).map(i=>r(i));n.typesInDeps={issues:o,total:o.length}}if(t.similarDeps){const o=(e.similarDeps??[]).map(i=>({...i,members:i.members.map(c=>({...c,packageJsonPath:$(a,c.packageJsonPath)}))}));n.similarDeps={issues:o,total:o.length}}process.stdout.write(`${JSON.stringify(n,void 0,2)}
25
+ `)},T=(e,a,s)=>{const t=e[a];return typeof t=="boolean"?t:e[s]===!0},bt=e=>{const a=e,s=(e.ban?.length??0)>0,t=(e.pin?.length??0)>0,r=T(a,"workspaceProtocol","workspace-protocol"),n=T(a,"redefineRoot","redefine-root"),o=T(a,"bannedDeps","banned-deps"),i=T(a,"workspaceVersions","workspace-versions"),c=T(a,"customTypes","custom-types"),p=T(a,"emptyDeps","empty-deps"),f=T(a,"rootPrivate","root-private"),m=T(a,"rootPackageManager","root-package-manager"),h=T(a,"rootDeps","root-deps"),d=T(a,"missingPackageJson","missing-package-json"),u=T(a,"deadWorkspacePatterns","dead-workspace-patterns"),k=T(a,"typesInDeps","types-in-deps"),J=T(a,"similarDeps","similar-deps");return r||n||o||i||c||p||f||m||h||d||u||k||J||s||t?{bannedDeps:o||s,customTypes:c,deadWorkspacePatterns:u,emptyDeps:p,missingPackageJson:d,redefineRoot:n,rootDeps:h,rootPackageManager:m,rootPrivate:f,similarDeps:J,typesInDeps:k,workspaceProtocol:r,workspaceVersions:i||t}:{bannedDeps:!0,customTypes:!0,deadWorkspacePatterns:!0,emptyDeps:!0,missingPackageJson:!0,redefineRoot:!0,rootDeps:!0,rootPackageManager:!0,rootPrivate:!0,similarDeps:!0,typesInDeps:!0,workspaceProtocol:!0,workspaceVersions:!0}},Nt=e=>{const a=new Map;for(const s of e??[]){const t=s.lastIndexOf("@");if(t<=0||t===s.length-1)throw new Error(`Invalid --pin "${s}". Use: name@<specifier> (e.g. react@^18.2.0).`);const r=s.slice(0,t),n=s.slice(t+1);a.set(r,n)}return a},Tt=new Set(["catalog","highest","lowest"]),xt=e=>{if(e===void 0)return"highest";if(!Tt.has(e))throw new Error(`Invalid --resolve "${e}". Use: highest, lowest, or catalog.`);return e},M=(e,a)=>e?a===void 0||a===!0:!1,Jt={"custom-types":"policy.customTypes.autofix","workspace-protocol":"policy.workspaceProtocol.autofix","workspace-versions":"policy.workspaceVersions.autofix"},B=(e,a,s,t)=>{const r=Jt[a],n=s==="prompt"?`${r} = "prompt" (interactive mode not yet implemented; report-only)`:`${r} = false`,o=`Set "${r}": true (or remove it) to enable rewrites.`;e.warn(`${a}: ${String(t)} issue${t===1?"":"s"} not rewritten — ${n}. ${o}`)},Ft=async({logger:e,options:a,visConfig:s,workspaceRoot:t})=>{if(!t)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const r=t,n=a.fix??!1,o=a.format??"human",i=a.quiet??!1;if(!["human","json","minimal"].includes(o))throw new Error(`Invalid --format "${o}". Use: human, json, or minimal.`);const c=bt(a),p=s?.policy??{},f=s?.editorconfig??!0,m=Nt(a.pin),h=a.ban??[];(a.dep!==void 0||a.resolve!==void 0)&&!c.workspaceVersions&&!i&&e.warn("--dep / --resolve only apply to --workspace-versions; ignored.");const d=ne(r),u={},k={catalogProposals:!1,customTypes:!1,deadWorkspacePatterns:!1,emptyDeps:!1,rootDeps:!1,rootPackageManager:!1,rootPrivate:!1,typesInDeps:!1,workspaceProtocol:!1,workspaceVersions:!1},J=it(r);let P=0;if(c.workspaceProtocol){const l=Ge(d,{fixSpecifier:a.fixSpecifier}),y=M(n,p.workspaceProtocol?.autofix);y&&l.length>0&&(Ye(l,{useEditorconfig:f}),k.workspaceProtocol=!0),u.workspaceProtocol=l,y||(P+=l.length),n&&!y&&l.length>0&&!i&&B(e,"workspace-protocol",p.workspaceProtocol?.autofix,l.length)}if(c.redefineRoot){const l=Me(d,{ignoreDeps:p.redefineRoot?.ignore});u.redefineRoot=l,P+=l.length}if(c.workspaceVersions){const l=xt(a.resolve??p.workspaceVersions?.resolve),y=l==="catalog"?fe(r):void 0;l==="catalog"&&(!y||y.size===0)&&!i&&e.warn("--resolve catalog: no catalog found in pnpm-workspace.yaml or root package.json — nothing to align.");const N=nt(d,{catalogs:y,dep:a.dep,ignoreDeps:p.workspaceVersions?.ignore,pinned:m.size>0?m:void 0,resolve:l}),R=M(n,p.workspaceVersions?.autofix);if(R&&N.length>0&&(at(N,{useEditorconfig:f}),k.workspaceVersions=!0),u.workspaceVersions=N,R||(P+=N.length),n&&!R&&N.length>0&&!i&&B(e,"workspace-versions",p.workspaceVersions?.autofix,N.length),a.proposeMin!==void 0){if(l!=="catalog"&&!i)e.warn("--propose-min only runs under --resolve catalog; ignored.");else if(l==="catalog"){const C=ve(d,{catalogs:y,ignoreDeps:p.workspaceVersions?.ignore,min:a.proposeMin});R&&C.length>0&&(De(r,C),k.catalogProposals=!0),u.catalogProposals=C}}}if(c.customTypes){const l=p.customTypes?.extraTypes,y=ae(l);if(y.length>0){for(const X of y)e.error(`policy.customTypes.${X}`);process.exitCode=1;return}const N=ie(r,l),C=(a.resolve??p.customTypes?.resolve)==="lowest"?"lowest":"highest",E=re(N,{dep:a.dep,ignoreDeps:p.customTypes?.ignore,resolve:C}),O=M(n,p.customTypes?.autofix);O&&E.length>0&&(ce(E,{useEditorconfig:f}),k.customTypes=!0),u.customTypes=E,O||(P+=E.length),n&&!O&&E.length>0&&!i&&B(e,"custom-types",p.customTypes?.autofix,E.length)}if(c.bannedDeps){const l={...p.bannedDeps};for(const N of h)l[N]={reason:"banned via --ban CLI flag"};Object.keys(l).length===0&&a.bannedDeps&&!i&&e.warn("--banned-deps: no policy.bannedDeps in vis config, nothing to check.");const y=ke(d,l);u.bannedDeps=y,P+=y.length}if(c.emptyDeps){const l=Je(r,{ignoreBlocks:p.emptyDeps?.ignoreBlocks}),y=M(n,p.emptyDeps?.autofix);y&&l.length>0&&(Se(l,{useEditorconfig:f}),k.emptyDeps=!0),u.emptyDeps=l,y||(P+=l.length)}if(c.rootPrivate){const l=Ce(r,J),y=M(n,p.rootPrivate?.autofix);y&&l.length>0&&(Ve(l,{useEditorconfig:f}),k.rootPrivate=!0),u.rootPrivate=l,y||(P+=l.length)}if(c.rootPackageManager){const l=Ee(r,J,{suggested:p.rootPackageManager?.suggested}),y=M(n,p.rootPackageManager?.autofix);y&&l.some(N=>N.suggested!==void 0)&&(Re(l,{useEditorconfig:f}),k.rootPackageManager=!0),u.rootPackageManager=l,(!y||!k.rootPackageManager)&&(P+=l.filter(N=>N.suggested===void 0||!k.rootPackageManager).length)}if(c.rootDeps){const l=We(r,J),y=M(n,p.rootDeps?.autofix);y&&l.length>0&&(je(l,{useEditorconfig:f}),k.rootDeps=!0),u.rootDeps=l,y||(P+=l.length)}if(c.missingPackageJson){const l=ue(r);u.missingPackageJson=l,P+=l.length}if(c.deadWorkspacePatterns){const l=Ne(r),y=M(n,p.deadWorkspacePatterns?.autofix);y&&l.length>0&&(Te(l,{useEditorconfig:f}),k.deadWorkspacePatterns=!0),u.deadWorkspacePatterns=l,y||(P+=l.length)}if(c.typesInDeps){const l=Le(d,{ignoreDeps:p.typesInDeps?.ignore}),y=M(n,p.typesInDeps?.autofix);y&&l.length>0&&(Ke(l,{useEditorconfig:f}),k.typesInDeps=!0),u.typesInDeps=l,y||(P+=l.length)}if(c.similarDeps){const l=He(d,{extraFamilies:p.similarDeps?.extraFamilies,ignoreFamilies:p.similarDeps?.ignoreFamilies});u.similarDeps=l,P+=l.length}i||(o==="json"?Dt(u,r,k,c):o==="minimal"?vt(u,r):wt(u,r,k,c,e)),P>0&&(process.exitCode=1)};export{Ft as default};