@visulima/vis 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/LICENSE.md +5760 -4562
- package/dashboard/dist/index.html +12 -12
- package/dist/bin.js +1 -1
- package/dist/binx.js +2 -2
- package/dist/config/index.js +1 -1
- package/dist/packem_chunks/CONFIG_FILES.js +6 -6
- package/dist/packem_chunks/DEFAULT_CLEAN_KEEP.js +1 -1
- package/dist/packem_chunks/agent-instructions.js +7 -7
- package/dist/packem_chunks/bloom-status.js +2 -2
- package/dist/packem_chunks/bloom-sync.js +2 -2
- package/dist/packem_chunks/cache-attestation.js +1 -1
- package/dist/packem_chunks/catalog-detector.js +1 -1
- package/dist/packem_chunks/catalog.js +87 -111
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +192 -217
- package/dist/packem_chunks/defineReleasePlugin.js +3 -3
- package/dist/packem_chunks/detect.js +8 -3
- package/dist/packem_chunks/devtools.js +1 -1
- package/dist/packem_chunks/discord.js +4 -4
- package/dist/packem_chunks/dispatch.js +4 -4
- package/dist/packem_chunks/doctor-probe.js +2 -2
- package/dist/packem_chunks/extra-files.js +3 -3
- package/dist/packem_chunks/fix.js +11 -11
- package/dist/packem_chunks/git.js +3 -3
- package/dist/packem_chunks/group-tags.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +5 -5
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +16 -16
- package/dist/packem_chunks/handler13.js +5 -5
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +5 -5
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +2 -2
- package/dist/packem_chunks/handler21.js +2 -2
- package/dist/packem_chunks/handler22.js +8 -8
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +5 -5
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +3 -3
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +2 -2
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler31.js +2 -2
- package/dist/packem_chunks/handler32.js +2 -2
- package/dist/packem_chunks/handler33.js +2 -2
- package/dist/packem_chunks/handler34.js +3 -3
- package/dist/packem_chunks/handler35.js +5 -5
- package/dist/packem_chunks/handler36.js +1 -1
- package/dist/packem_chunks/handler37.js +2 -2
- package/dist/packem_chunks/handler38.js +6 -6
- package/dist/packem_chunks/handler39.js +8 -8
- package/dist/packem_chunks/handler4.js +4 -4
- package/dist/packem_chunks/handler40.js +34 -34
- package/dist/packem_chunks/handler41.js +5 -5
- package/dist/packem_chunks/handler42.js +4 -4
- package/dist/packem_chunks/handler43.js +3 -3
- package/dist/packem_chunks/handler44.js +2 -2
- package/dist/packem_chunks/handler45.js +1 -1
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler47.js +1 -1
- package/dist/packem_chunks/handler48.js +3 -3
- package/dist/packem_chunks/handler49.js +1 -1
- package/dist/packem_chunks/handler5.js +6 -6
- package/dist/packem_chunks/handler50.js +6 -6
- package/dist/packem_chunks/handler51.js +13 -13
- package/dist/packem_chunks/handler52.js +3 -3
- package/dist/packem_chunks/handler53.js +5 -5
- package/dist/packem_chunks/handler54.js +2 -2
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler56.js +4 -4
- package/dist/packem_chunks/handler57.js +5 -5
- package/dist/packem_chunks/handler58.js +5 -5
- package/dist/packem_chunks/handler59.js +8 -8
- package/dist/packem_chunks/handler6.js +7 -7
- package/dist/packem_chunks/handler60.js +3 -3
- package/dist/packem_chunks/handler61.js +21 -21
- package/dist/packem_chunks/handler62.js +12 -12
- package/dist/packem_chunks/handler63.js +3 -3
- package/dist/packem_chunks/handler64.js +5 -5
- package/dist/packem_chunks/handler65.js +8 -8
- package/dist/packem_chunks/handler66.js +2 -2
- package/dist/packem_chunks/handler67.js +25 -24
- package/dist/packem_chunks/handler68.js +153 -25
- package/dist/packem_chunks/handler69.js +10 -153
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +22 -10
- package/dist/packem_chunks/handler71.js +17 -17
- package/dist/packem_chunks/handler72.js +104 -104
- package/dist/packem_chunks/handler73.js +20 -20
- package/dist/packem_chunks/handler74.js +45 -45
- package/dist/packem_chunks/handler75.js +27 -3
- package/dist/packem_chunks/handler76.js +3 -27
- package/dist/packem_chunks/handler77.js +68 -68
- package/dist/packem_chunks/handler78.js +30 -30
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +9 -9
- package/dist/packem_chunks/heal.js +11 -11
- package/dist/packem_chunks/help-command.js +7 -63
- package/dist/packem_chunks/index.js +1 -1
- package/dist/packem_chunks/index2.js +48 -804
- package/dist/packem_chunks/index3.js +3 -7
- package/dist/packem_chunks/index4.js +801 -134
- package/dist/packem_chunks/index5.js +7 -73
- package/dist/packem_chunks/index6.js +73 -0
- package/dist/packem_chunks/index7.js +135 -0
- package/dist/packem_chunks/interface.js +2 -2
- package/dist/packem_chunks/keys-refresh.js +4 -4
- package/dist/packem_chunks/lean.js +3 -3
- package/dist/packem_chunks/list.js +3 -3
- package/dist/packem_chunks/loader.js +4 -4
- package/dist/packem_chunks/loader2.js +1 -1
- package/dist/packem_chunks/orchestrator.js +27 -27
- package/dist/packem_chunks/pre-mode.js +2 -2
- package/dist/packem_chunks/print-config.js +1 -1
- package/dist/packem_chunks/prompts.js +7 -7
- package/dist/packem_chunks/prune.js +3 -3
- package/dist/packem_chunks/publish-guards.js +1 -1
- package/dist/packem_chunks/resolveFormatter.js +5 -5
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/security.js +1 -1
- package/dist/packem_chunks/shell-runner.js +1 -1
- package/dist/packem_chunks/slack.js +2 -2
- package/dist/packem_chunks/snapshot.js +2 -2
- package/dist/packem_chunks/stage-publisher.js +1 -1
- package/dist/packem_chunks/staged-registry.js +2 -2
- package/dist/packem_chunks/state.js +3 -3
- package/dist/packem_chunks/status.js +2 -2
- package/dist/packem_chunks/success-walk.js +4 -4
- package/dist/packem_chunks/sync.js +2 -2
- package/dist/packem_chunks/sync2.js +2 -2
- package/dist/packem_chunks/tar.js +3 -3
- package/dist/packem_chunks/tripwire.js +2 -2
- package/dist/packem_chunks/ts-loader.js +5 -9
- package/dist/packem_chunks/verify-lockfile.js +2 -2
- package/dist/packem_chunks/version-resolver.js +2 -2
- package/dist/packem_chunks/webhook.js +1 -1
- package/dist/packem_chunks/workflow-templates.js +5 -5
- package/dist/packem_chunks/workspace.js +2 -2
- package/dist/packem_shared/ReleaseClient-DAvbxCdo.js +1 -0
- package/dist/packem_shared/Table-DyORjLji-CC9cYgCG.js +11 -0
- package/dist/packem_shared/{VisReleaseError-DMGRBTNO.js → VisReleaseError-DZtgcKf8.js} +1 -1
- package/dist/packem_shared/_commonjsHelpers-DTfxOvZk.js +1 -0
- package/dist/packem_shared/advisories-DZd1uGqa.js +1 -0
- package/dist/packem_shared/affected-selection-CoRXp5H4.js +1 -0
- package/dist/packem_shared/affected-shas-Dd0P7fGD.js +1 -0
- package/dist/packem_shared/ai-analysis-DSQQDFU9.js +68 -0
- package/dist/packem_shared/ai-fix-6nXZbecQ.js +43 -0
- package/dist/packem_shared/augment-COAiXSIx.js +4 -0
- package/dist/packem_shared/bin-C2eYtJ_N.js +1 -0
- package/dist/packem_shared/build-scripts-pdVmqXRm.js +1 -0
- package/dist/packem_shared/clean-DRiLimTx.js +1 -0
- package/dist/packem_shared/command-runtime-CiLVo4ED.js +1 -0
- package/dist/packem_shared/{compile-cache-B_Vf_WxT.js → compile-cache-DoMHRsRZ.js} +1 -1
- package/dist/packem_shared/createAdapter-F7GidOzU.js +1 -0
- package/dist/packem_shared/createVersionActions-ByaJ1Nbv.js +1 -0
- package/dist/packem_shared/cyclonedx-B1vzerwP.js +4 -0
- package/dist/packem_shared/dependency-scan-DBH2Qo4I.js +1 -0
- package/dist/packem_shared/docker-Bex05Qcn.js +59 -0
- package/dist/packem_shared/failure-log-D92tM0ie.js +2 -0
- package/dist/packem_shared/formatBytes-BHAzNIrn-DFIppnY0.js +4 -0
- package/dist/packem_shared/getRandomSpinner-4ZEcbTYv-DCyIuj19.js +1 -0
- package/dist/packem_shared/giget-D8Kwb0kD.js +2 -0
- package/dist/packem_shared/glob-Cyk1H9ZL-ox19CSsT.js +1 -0
- package/dist/packem_shared/index-B4AjSxHU.js +1 -0
- package/dist/packem_shared/index-BisalDCf.js +39 -0
- package/dist/packem_shared/{index-BWl4DbMp.js → index-BjdW45xX.js} +1 -1
- package/dist/packem_shared/index-DHD8wb6Z.js +22 -0
- package/dist/packem_shared/index-DXPSWMbG.js +1 -0
- package/dist/packem_shared/index.server-BAjDJSEu.js +2 -0
- package/dist/packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js +1 -0
- package/dist/packem_shared/license-DvlYdo6T.js +1 -0
- package/dist/packem_shared/lifecycle-CfTZQHOG.js +2 -0
- package/dist/packem_shared/lockfile-35RFsJDs.js +1 -0
- package/dist/packem_shared/lockfile-DhHAaHN5.js +1 -0
- package/dist/packem_shared/main-BP-w-K-6.js +1 -0
- package/dist/packem_shared/manifests-BNSmpPF_.js +1 -0
- package/dist/packem_shared/min-release-age-ChzTC7_I.js +34 -0
- package/dist/packem_shared/missing-package-json-C0keIt78.js +1 -0
- package/dist/packem_shared/native-config-sync-BSzU4qUO.js +21 -0
- package/dist/packem_shared/osv-bloom-1JS__1or.js +2 -0
- package/dist/packem_shared/otelPlugin-D8LL2-4L.js +1 -0
- package/dist/packem_shared/package-version-Bb7KGF36.js +4 -0
- package/dist/packem_shared/packument-C55kVxcQ.js +1 -0
- package/dist/packem_shared/{peer-warnings-BXAzXqY3.js → peer-warnings-CmYSxvql.js} +1 -1
- package/dist/packem_shared/pm-runner-de-jCq8q.js +1 -0
- package/dist/packem_shared/project-name-filter-DYaIbrXa.js +7 -0
- package/dist/packem_shared/{prompt-BSAy8SMH.js → prompt-DMzaQEVa.js} +1 -1
- package/dist/packem_shared/provenance-CvfQEJPQ.js +1 -0
- package/dist/packem_shared/readJsonSync-CbryXYxN-B2aSeDpC.js +1 -0
- package/dist/packem_shared/registry-keys-DmBrAlhg.js +1 -0
- package/dist/packem_shared/resolve-explicit-DYaHAVDg.js +5 -0
- package/dist/packem_shared/resolve-runtime-C7NBCA1C.js +1 -0
- package/dist/packem_shared/run-file-jMngGQhs.js +1 -0
- package/dist/packem_shared/runtime-check-BklgEMkC.js +1 -0
- package/dist/packem_shared/s1ngularity-C8sva2SO.js +1 -0
- package/dist/packem_shared/scan-progress-aVHGZYWf.js +2 -0
- package/dist/packem_shared/selectors-B7lSFz7l.js +3 -0
- package/dist/packem_shared/signatures-oZ_2IneN.js +2 -0
- package/dist/packem_shared/{slug-DoueYuLo.js → slug-OBHcH7wV.js} +1 -1
- package/dist/packem_shared/spinner-CbJfWYwB.js +1 -0
- package/dist/packem_shared/sticky-comment-DjhyCIZt.js +1 -0
- package/dist/packem_shared/subtree-DtmcKAJK.js +2 -0
- package/dist/packem_shared/symbols-BXDZ_sKt.js +1 -0
- package/dist/packem_shared/tabs-BilwonkM.js +1 -0
- package/dist/packem_shared/target-merge-DCGow6Kw.js +4 -0
- package/dist/packem_shared/target-options-d_rIrLyq.js +1 -0
- package/dist/packem_shared/toolchain-DY11tPCw.js +5 -0
- package/dist/packem_shared/typosquats-Cdsnf6aN.js +1 -0
- package/dist/packem_shared/use-measured-height-BPQg2q_p.js +1 -0
- package/dist/packem_shared/utils-DQFHJn72.js +1 -0
- package/dist/packem_shared/verify-D8wYvB85.js +1 -0
- package/dist/packem_shared/vis-update-app-ngwL2mRv.js +1 -0
- package/dist/packem_shared/vis-user-error-CAu9wIbe.js +30 -0
- package/dist/packem_shared/watch-Dswvj6Zp.js +1 -0
- package/dist/packem_shared/watch-loop-COWvvSbR.js +11 -0
- package/dist/packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js +1 -0
- package/dist/release/core/changelog/index.d.ts +62 -2
- package/dist/release/core/package-managers/index.d.ts +25 -1
- package/dist/release/core/package-managers/index.js +1 -1
- package/dist/release/core/version-actions/index.d.ts +47 -2
- package/dist/release/core/version-actions/index.js +1 -1
- package/dist/release/index.d.ts +100 -1
- package/dist/release/index.js +1 -1
- package/dist/release/plugin-sdk.d.ts +16 -1
- package/dist/release/plugin-sdk.js +1 -1
- package/dist/release/presets.js +1 -1
- package/dist/release/types.js +1 -1
- package/dist/runtime/preload.js +1 -1
- package/index.js +26 -26
- package/package.json +14 -14
- package/dist/packem_chunks/detect2.js +0 -8
- package/dist/packem_chunks/registry.js +0 -48
- package/dist/packem_shared/ReleaseClient-BY4OZNCK.js +0 -1
- package/dist/packem_shared/_commonjsHelpers-B5Y90VFO.js +0 -1
- package/dist/packem_shared/advisories-DsXRmIA5.js +0 -1
- package/dist/packem_shared/affected-selection-BE6VFCDV.js +0 -1
- package/dist/packem_shared/affected-shas-BKEu4RZc.js +0 -1
- package/dist/packem_shared/ai-analysis-DikAj6rX.js +0 -68
- package/dist/packem_shared/ai-fix-bfWo0cZX.js +0 -43
- package/dist/packem_shared/augment-BkJxi_GW.js +0 -4
- package/dist/packem_shared/bin-B-TytgzW.js +0 -1
- package/dist/packem_shared/build-scripts-DWypBQ--.js +0 -1
- package/dist/packem_shared/clean-DWjQl14S.js +0 -1
- package/dist/packem_shared/command-runtime-DQ7ZpLYL.js +0 -1
- package/dist/packem_shared/createAdapter-bU4DIP3F.js +0 -1
- package/dist/packem_shared/createVersionActions-BK43SNDH.js +0 -1
- package/dist/packem_shared/cyclonedx-DLBi65MV.js +0 -4
- package/dist/packem_shared/dependency-scan-ZLOuLkGN.js +0 -1
- package/dist/packem_shared/docker-B4zAZCZG.js +0 -59
- package/dist/packem_shared/en-BDYMmM2_.js +0 -27
- package/dist/packem_shared/failure-log-DyhWPqno.js +0 -2
- package/dist/packem_shared/giget-CAxjpwew.js +0 -2
- package/dist/packem_shared/glob-BUjyjdE8-Dp_QcayW.js +0 -1
- package/dist/packem_shared/index-BAe6e0XE.js +0 -1
- package/dist/packem_shared/index-BLtnel38.js +0 -35
- package/dist/packem_shared/index-CuKDxOCI.js +0 -1
- package/dist/packem_shared/index-tNFGWxc0.js +0 -39
- package/dist/packem_shared/index.server-CusjRLCh.js +0 -2
- package/dist/packem_shared/license-t5KnNX6v.js +0 -1
- package/dist/packem_shared/lifecycle-KY9umOg6.js +0 -2
- package/dist/packem_shared/lockfile-YAuZf1gh.js +0 -1
- package/dist/packem_shared/main-D_cam4hv.js +0 -1
- package/dist/packem_shared/manifests-BwTn_1ad.js +0 -1
- package/dist/packem_shared/min-release-age-6avfn81h.js +0 -34
- package/dist/packem_shared/missing-package-json-Cl0vdz6K.js +0 -1
- package/dist/packem_shared/native-config-sync-CHMCJx7H.js +0 -21
- package/dist/packem_shared/osv-bloom-DdqDnLCt.js +0 -2
- package/dist/packem_shared/otelPlugin-DmKDBaPo.js +0 -1
- package/dist/packem_shared/package-version-BNRJ3o9C.js +0 -4
- package/dist/packem_shared/packument-B9-WqReu.js +0 -1
- package/dist/packem_shared/pm-runner-DRybtzOV.js +0 -1
- package/dist/packem_shared/project-name-filter-Dw0fC6IO.js +0 -7
- package/dist/packem_shared/provenance-CLxuqCfL.js +0 -1
- package/dist/packem_shared/readJsonSync-DweZd5ZA-CtrDlqpb.js +0 -1
- package/dist/packem_shared/registry-keys-cTN24144.js +0 -1
- package/dist/packem_shared/resolve-explicit-Uw6WQl9R.js +0 -5
- package/dist/packem_shared/resolve-runtime-DztanwkZ.js +0 -1
- package/dist/packem_shared/run-file-CaE5_xBY.js +0 -1
- package/dist/packem_shared/runtime-check-C32yE57I.js +0 -1
- package/dist/packem_shared/s1ngularity-BIYhg82u.js +0 -1
- package/dist/packem_shared/scan-progress-DWfY4zkp.js +0 -2
- package/dist/packem_shared/selectors-D2j4M9Ul.js +0 -3
- package/dist/packem_shared/signatures-C8iQ5fUq.js +0 -2
- package/dist/packem_shared/sticky-comment-D6_7-w8T.js +0 -1
- package/dist/packem_shared/subtree-DSm0QEoE.js +0 -2
- package/dist/packem_shared/symbols-DPTlrJ3B.js +0 -1
- package/dist/packem_shared/target-merge-DLxJTcxn.js +0 -11
- package/dist/packem_shared/target-options-3t4-2F-F.js +0 -1
- package/dist/packem_shared/toolchain-BPzbahcQ.js +0 -5
- package/dist/packem_shared/typosquats-BWrmhh36.js +0 -1
- package/dist/packem_shared/use-measured-height-BwAwGHjw.js +0 -1
- package/dist/packem_shared/utils-CRueU43T.js +0 -1
- package/dist/packem_shared/verify-CzUPT6Uk.js +0 -1
- package/dist/packem_shared/vis-update-app-D6Wq8ZHM.js +0 -1
- package/dist/packem_shared/vis-user-error-CfM4_ORo.js +0 -30
- package/dist/packem_shared/watch-D_oAxW_Z.js +0 -1
- package/dist/packem_shared/watch-loop-BrjblOz5.js +0 -11
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
`;)t+=1;continue}if(i==="/"&&e[t+1]==="*"){for(t+=2;t<s&&!(e[t]==="*"&&e[t+1]==="/");)t+=1;t+=2;continue}if(i===","){let a=t+1;for(;a<s&&/\s/.test(e[a]??"");)a+=1;const d=e[a];if(d==="}"||d==="]"){t+=1;continue}}n+=i,t+=1}return n},yn=(e,n)=>{const t=["renovate.json","renovate.json5",".renovaterc",".renovaterc.json"];for(const s of t){const r=_(e,s);if(!B(r))continue;let o;try{const a=K(r);o=JSON.parse($n(a))}catch{continue}if(!o)continue;if(Array.isArray(o.ignoreDeps))for(const a of["actions","docker","gitlab"])he(n[a],o.ignoreDeps);const i=[["github-actions","actions"],["dockerfile","docker"],["docker-compose","docker"],["gitlabci","gitlab"],["gitlabci-include","gitlab"]];for(const[a,d]of i){const c=o[a];he(n[d],c?.ignoreDeps)}if(!Array.isArray(o.packageRules))return;for(const a of o.packageRules){if(a.enabled!==!1)continue;const d=new Set;for(const u of a.matchManagers??[]){const f=mn[u];f&&d.add(f)}for(const u of a.matchDatasources??[]){const f=hn[u];f&&d.add(f)}d.size===0&&(d.add("actions"),d.add("docker"),d.add("gitlab"));const c=[...a.matchPackageNames??[],...a.matchDepNames??[],...a.matchPackagePatterns??[]];for(const u of d)he(n[u],c)}return}},wn=e=>{const n={actions:new Set,docker:new Set,gitlab:new Set};return gn(e,n),yn(e,n),n},we=(e,n,t)=>{const s=t[n];if(s.size===0)return!1;if(s.has(e))return!0;for(const r of s)if(/[*?[\]/.+]/.test(r))try{const o=r.replaceAll(/[.+^${}()|]/g,String.raw`\$&`).replaceAll("*",".*").replaceAll("?",".");if(new RegExp(`^${o}$`).test(e))return!0}catch{}return!1},z=e=>{const n=e.trim();if(n==="")return;const t=n.startsWith("v")||n.startsWith("V")?n.slice(1):n,s=(te.valid(t)?te.parse(t):void 0)??te.coerce(t,{includePrerelease:!0});if(s)return{major:s.major,minor:s.minor,normalized:`${String(s.major)}.${String(s.minor)}.${String(s.patch)}${s.prerelease.length>0?`-${s.prerelease.join(".")}`:""}`,patch:s.patch,prerelease:s.prerelease.length>0,raw:n}},kn=(e,n)=>te.rcompare(e.normalized,n.normalized),ke=(e,n,t,s)=>{if(!n&&t!=="latest")return;const r=e.filter(o=>o.prerelease?!1:n?t==="patch"&&(o.major!==n.major||o.minor!==n.minor)||t==="minor"&&o.major!==n.major?!1:te.gt(o.normalized,n.normalized):!0);if(r.length!==0)return r.toSorted(kn)[0]},ve=(e,n)=>!e||!n?"unknown":n.major!==e.major?"major":n.minor!==e.minor?"minor":n.patch!==e.patch?"patch":"unknown",vn="GitHub Actions",Ie=(e,n)=>`${e}@${n}`,bn=e=>({fixedVersions:e.fixedVersions,id:e.id,severity:e.severity,summary:e.summary}),Rn=(e,n)=>{if(n.length===0)return n;const t=sn(e);if(!tn(t))return n;const s=new Map;for(const o of n){const i=o.currentVersion??o.currentRef;i&&s.set(Ie(o.name,i),{name:o.name,version:i})}if(s.size===0)return n;const r=new Map;try{for(const[o,i]of s){const a=on([i],{ecosystem:vn,workspaceRoot:e}).get(i.name);a&&a.length>0&&r.set(o,a)}}catch{return n}return r.size===0?n:n.map(o=>{const i=o.currentVersion??o.currentRef;if(!i)return o;const a=r.get(Ie(o.name,i));return a?{...o,advisories:a.map(d=>bn(d))}:o})},tt=e=>{if(!e)return{};const n={};for(const t of e.split(",")){const s=/^\s*<([^>]+)>\s*;\s*(.+)$/.exec(t);if(!s)continue;const r=s[1]??"",o=s[2]??"";switch(/rel\s*=\s*"?([^";\s]+)"?/i.exec(o)?.[1]?.toLowerCase()){case"first":{n.first=r;break}case"last":{n.last=r;break}case"next":{n.next=r;break}case"prev":case"previous":{n.previous=r;break}}}return n};class xn{token;apiBase;fetchImpl;tagsCache=new Map;commitCache=new Map;constructor(n){this.token=n.token??process.env.GITHUB_TOKEN??process.env.GH_TOKEN,this.apiBase=n.apiBase??"https://api.github.com",this.fetchImpl=n.fetch??fetch}async listTags(n,t){const s=`${n}/${t}`,r=this.tagsCache.get(s);if(r)return r;const o=this.fetchTags(n,t);return this.tagsCache.set(s,o),o}async resolveRef(n,t,s){const r=`${n}/${t}@${s}`,o=this.commitCache.get(r);if(o)return o;const i=this.fetchCommit(n,t,s);return this.commitCache.set(r,i),i}buildHeaders(){const n={Accept:"application/vnd.github+json","User-Agent":"vis-update-actions","X-GitHub-Api-Version":"2022-11-28"};return this.token&&(n.Authorization=`Bearer ${this.token}`),n}async fetchTags(n,t){const s=`${this.apiBase}/repos/${encodeURIComponent(n)}/${encodeURIComponent(t)}/tags?per_page=100`,r={parsed:[],tags:[]},o=[];let i=s,a=0;for(;i&&a<5;){const c=i;let u;try{u=await this.fetchImpl(c,{headers:this.buildHeaders()})}catch{return r}if(!u.ok)return r;let f;try{f=await u.json()}catch{return r}if(!Array.isArray(f))return r;for(const g of f){const m=typeof g.name=="string"?g.name:"",h=typeof g.commit?.sha=="string"?g.commit.sha:"";m!==""&&h!==""&&o.push({name:m,sha:h})}i=tt(u.headers.get("link")).next,a+=1}const d=[];for(const c of o){const u=z(c.name);u&&d.push({...u,sha:c.sha})}return{parsed:d,tags:o}}async fetchCommit(n,t,s){const r=`${this.apiBase}/repos/${encodeURIComponent(n)}/${encodeURIComponent(t)}/commits/${encodeURIComponent(s)}`;try{const o=await this.fetchImpl(r,{headers:this.buildHeaders()});if(!o.ok)return;const i=await o.json();return typeof i.sha!="string"?void 0:{committedAt:i.commit?.committer?.date,sha:i.sha}}catch{return}}}const An=".github/workflows",Sn=".github/actions",Cn=/^\s*-?\s*uses:\s*(['"]?)([^'"\s#]+)\1(?:\s*#\s*(.+))?\s*$/,En=/^[a-f0-9]{40}$/i,jn=/actions-up-ignore-next-line(?::\s*(.+))?/i,Tn=/actions-up-ignore-start/i,In=/actions-up-ignore-end/i,Nn=e=>{const n=e.split("/");if(n.length<2)return;const[t,s,...r]=n;if(!(!t||!s))return{owner:t,repo:s,subpath:r.length>0?r.join("/"):void 0}},Dn=(e,n)=>{const t=n.split(/\r?\n/),s=[];let r,o=!1;for(const[i,a]of t.entries()){const d=a??"";if(Tn.test(d)&&(o=!0),In.test(d)){o=!1;continue}const c=d.trim(),u=c===""||c.startsWith("#")?jn.exec(d):void 0;if(u){r=u[1]??"actions-up-ignore-next-line";continue}const f=Cn.exec(d);if(!f){r=void 0;continue}const g=f[1]??"",m=g==="'"||g==='"'?g:"",h=f[2]??"",R=f[3]?.trim();if(h.startsWith("./")||h.startsWith("../")||h.startsWith("docker://")){r=void 0;continue}const A=h.lastIndexOf("@");if(A<=0){r=void 0;continue}const $=h.slice(0,A),S=h.slice(A+1),y=Nn($);if(!y){r=void 0;continue}let p=r??(o?"actions-up-ignore-block":void 0);if(R){const w=/^actions-up-ignore(?:-next-line)?(?::\s*(.+))?(?:\s|$)/i.exec(R);w&&(p=p??w[1]??"actions-up-ignore")}r=void 0,s.push({file:e,ignoreReason:p,isSha:En.test(S),line:i+1,original:`${m}${h}${m}`,owner:y.owner,quote:m,ref:S,repo:y.repo,slug:$,subpath:y.subpath,trailingComment:R&&!p?R:void 0})}return s},Ne=e=>e.endsWith(".yml")||e.endsWith(".yaml"),Un=(e,n=[])=>{const t=[],s=new Set,r=a=>{if(s.has(a))return;s.add(a);let d;try{d=K(a)}catch{return}const c=Dn(a,d);t.push(...c)},o=_(e,An);if(B(o))for(const a of Y(o,{includeDirs:!1,includeSymlinks:!1,maxDepth:1}))Ne(a.name)&&r(a.path);const i=_(e,Sn);if(B(i))for(const a of Y(i,{includeDirs:!1,includeSymlinks:!1,maxDepth:3}))(a.name==="action.yml"||a.name==="action.yaml")&&r(a.path);for(const a of["action.yml","action.yaml"]){const d=_(e,a);B(d)&&r(d)}for(const a of n){const d=kt(a)?a:_(e,a);if(B(d))for(const c of Y(d,{includeDirs:!1,includeSymlinks:!1}))Ne(c.name)&&r(c.path)}return t},On=40,Bn=1440*60*1e3,Vn=new Set(["develop","edge","main","master","stable","trunk"]),_n=e=>e.length===On&&/^[a-f0-9]{40}$/i.test(e)?!1:Vn.has(e.toLowerCase())?!0:z(e)===void 0,De=(e,n)=>{for(const t of n)try{if(new RegExp(t).test(e))return!0}catch{if(e.includes(t))return!0}return!1},Mn=(e,n,t,s)=>{const r=s==="sha"||e.isSha,{quote:o}=e;return r?`${o}${e.slug}@${n}${o} # ${t}`:`${o}${e.slug}@${t}${o}`},Pn=async(e,n)=>{const{ignoreRules:t,options:s,references:r,resolverOptions:o}=n,i=[],a=[],d=[];if(r.length===0)return{failed:d,ignored:a,updates:i};const c=new xn({apiBase:o?.apiBase,fetch:o?.fetch,token:s.githubToken??o?.token}),u=new Map;for(const $ of r){const S=`${$.owner}/${$.repo}`,y=u.get(S)??[];y.push($),u.set(S,y)}const f=Math.max(1,s.maxConcurrentRequests),g=[...u.keys()];let m=0;const h=async $=>{const S=u.get($)??[],[y,p]=$.split("/");if(!y||!p)return;let w;try{w=await c.listTags(y,p)}catch{for(const l of S)d.push({file:l.file,reason:`failed to list tags for ${$}`});return}for(const l of S){const C=l.slug;let k;if(l.ignoreReason?k=l.ignoreReason:De(C,s.exclude)?k="matched --exclude":s.include.length>0&&!De(C,s.include)?k="not matched by --include":s.respectDependabotConfig&&t&&we(C,"actions",t)&&(k="ignored by dependabot/renovate config"),k){a.push({currentRef:l.ref,currentVersion:l.isSha?l.trailingComment?.replace(/^#\s*/,""):l.ref,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:C,newRef:l.ref,newVersion:void 0,original:l.original,reason:k,replacement:l.original,updateType:"unknown"});continue}if(!s.includeBranches&&!l.isSha&&_n(l.ref)){a.push({currentRef:l.ref,currentVersion:l.ref,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:C,newRef:l.ref,newVersion:void 0,original:l.original,reason:"branch reference (use --include-branches)",replacement:l.original,updateType:"unknown"});continue}const E=l.isSha?l.trailingComment?.replace(/^#\s*/,"").split(/\s+/)[0]??"":l.ref,j=z(E);if(l.isSha&&!j&&s.mode!=="latest"){a.push({currentRef:l.ref,currentVersion:void 0,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:C,newRef:l.ref,newVersion:void 0,original:l.original,reason:`SHA pin has no version-hint comment; cannot apply --target=${s.mode}`,replacement:l.original,updateType:"unknown"});continue}const x=ke(w.parsed,j,s.mode);if(!x)continue;if(s.minAgeDays!==void 0){const M=await c.resolveRef(y,p,x.sha),D=M?.committedAt?new Date(M.committedAt).getTime():void 0;if(D&&(Date.now()-D)/Bn<s.minAgeDays){a.push({currentRef:l.ref,currentVersion:j?.raw,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:C,newRef:l.ref,newVersion:x.raw,original:l.original,reason:`release younger than ${String(s.minAgeDays)} days`,replacement:l.original,updateType:"unknown"});continue}}const T=s.style==="sha"||l.isSha?x.sha:x.raw,N=Mn(l,x.sha,x.raw,s.style);i.push({currentRef:l.ref,currentVersion:j?.raw??l.trailingComment?.replace(/^#\s*/,""),ecosystem:"actions",file:l.file,line:l.line,name:C,newRef:T,newVersion:x.raw,original:l.original,replacement:N,updateType:ve(j,x),url:`https://github.com/${y}/${p}/releases/tag/${x.raw}`})}},R=[];for(let $=0;$<Math.min(f,g.length);$++)R.push((async()=>{for(;m<g.length;){const S=g[m];m+=1,S!==void 0&&await h(S)}})());await Promise.all(R);const A=Rn(e,i);return{failed:d,ignored:a,updates:A}},qn=e=>e.toSorted((n,t)=>n.file!==t.file?n.file<t.file?-1:1:n.line-t.line),nt=e=>{const n=[],t=[];if(e.length===0)return{applied:n,skipped:t};const s=qn(e),r=new Map;for(const o of s){const i=r.get(o.file)??[];i.push(o),r.set(o.file,i)}for(const[o,i]of r){let a;try{a=K(o)}catch(g){for(const m of i)t.push({reason:`read failed: ${g.message}`,update:m});continue}const d=a.includes(`\r
|
|
1
|
+
import{createRequire as gt}from"node:module";import{J as qe,b as _,F as M,q as Ke,X as K,j as vt}from"../packem_shared/index.server-BAjDJSEu.js";import{e as L,z,v as wt,l as Se}from"../packem_shared/index-DHD8wb6Z.js";import{m as kt}from"./ts-loader.js";import{O as bt,an as Rt,c as me,C as Ce}from"./cli-main.js";import{L as X,G as Et,H as xt,I as At,l as St,r as Ct,c as Tt,k as It,J as Ot,K as ze,R as V,E as he,m as H,n as Ye,M as _t,t as F,N as Nt,O as jt,o as Dt,s as Ut}from"./catalog.js";import{i as le}from"../packem_shared/index-BjdW45xX.js";import{v as Bt,r as Lt,f as Te}from"../packem_shared/ai-analysis-DSQQDFU9.js";import{p as Pt,a as Vt,s as Je}from"../packem_shared/pm-runner-de-jCq8q.js";import{a as Mt,r as Ft}from"../packem_shared/command-runtime-CiLVo4ED.js";import{r as Gt,a as Ht,p as Wt}from"../packem_shared/resolve-explicit-DYaHAVDg.js";import{s as qt}from"../packem_shared/min-release-age-ChzTC7_I.js";import{s as Kt}from"../packem_shared/formatBytes-BHAzNIrn-DFIppnY0.js";import{r as zt,s as Yt}from"../packem_shared/typosquats-Cdsnf6aN.js";import{U as Jt,V as Xt,C as Ie,e as Qt}from"../packem_shared/vis-update-app-ngwL2mRv.js";import{h as Xe,P as Qe}from"../packem_shared/peer-warnings-CmYSxvql.js";import{p as Ze}from"../packem_shared/utils-DQFHJn72.js";import{L as Zt}from"../packem_shared/index-BisalDCf.js";import{y as U}from"../packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{s as ne}from"../packem_shared/index-B4AjSxHU.js";import{r as nn,q as sn}from"../packem_shared/advisories-DZd1uGqa.js";import{U as rn}from"../packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js";let yt;const $t=e=>(yt??=gt(import.meta.url))(e),ee=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,He=e=>{if(typeof ee<"u"&&ee.versions&&ee.versions.node){const[t,n]=ee.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return ee.getBuiltinModule(e)}return $t(e)},{createInterface:We}=He("node:readline"),{existsSync:en,realpathSync:tn}=He("node:fs"),on=e=>{const t=[];for(const n of e.filters)t.push("--filter",n);return e.workspaceRoot&&t.push("--filter","."),t.push("update"),e.latest&&t.push("--latest"),e.recursive&&t.push("--recursive"),e.interactive&&t.push("--interactive"),e.dev&&t.push("--dev"),e.prod&&t.push("--prod"),e.noOptional&&t.push("--no-optional"),e.noSave&&t.push("--no-save"),t.push(...e.packages),{args:t,bin:"pnpm"}},an=e=>{const t=[];return e.filters.length>0&&t.push("workspace",e.filters[0]),t.push("upgrade"),e.latest&&t.push("--latest"),t.push(...e.packages),{args:t,bin:"yarn"}},cn=e=>{const t=[];if(e.filters.length>0||e.recursive){t.push("workspaces","foreach","--all");for(const n of e.filters)t.push("--include",n)}return t.push("up"),e.interactive&&t.push("--interactive"),t.push(...e.packages),{args:t,bin:"yarn"}},ln=(e,t)=>{const n=["update"];e.latest&&t.push("npm does not support --latest flag. Packages will be updated within their semver range."),e.interactive&&t.push("npm does not support --interactive mode.");for(const s of e.filters)n.push("--workspace",s);return e.recursive&&n.push("--workspaces"),e.workspaceRoot&&n.push("--include-workspace-root"),e.dev&&n.push("--dev"),e.prod&&n.push("--production"),e.noOptional&&n.push("--no-optional"),e.noSave&&n.push("--no-save"),n.push(...e.packages),{args:n,bin:"npm"}},dn=e=>{const t=["update"];e.latest&&t.push("--latest");for(const n of e.filters)t.push("--filter",n);return t.push(...e.packages),{args:t,bin:"bun"}},un=(e,t)=>{const n=["outdated","--update"];return e.latest&&n.push("--latest"),e.interactive&&n.push("--interactive"),e.filters.length>0&&t.push("deno outdated has no --filter flag; ignoring."),(e.dev||e.prod)&&t.push("deno outdated has no --dev / --prod flags; dev/prod is governed by deno.json."),e.noOptional&&t.push("deno outdated has no --no-optional flag; ignoring."),e.noSave&&t.push("deno outdated has no --no-save flag; ignoring."),n.push(...e.packages),{args:n,bin:"deno"}},fn=(e,t,n)=>{const s=[];if(n.global&&e!=="aube"&&e!=="deno")return{command:{args:["update","--global",...n.packages],bin:"npm"},warnings:s};let i;switch(e){case"aube":{const r=Pt(n);i={args:r.args,bin:r.bin},s.push(...r.warnings);break}case"bun":{i=dn(n);break}case"deno":{i=un(n,s);break}case"npm":{i=ln(n,s);break}case"pnpm":{i=on(n);break}case"yarn":{i=t.startsWith("1.")?an(n):cn(n);break}default:{const r=e;throw new Error(`Unsupported package manager: ${String(r)}`)}}return{command:i,warnings:s}},et=e=>{const t=e.indexOf("@");return t<=0?e:e.slice(0,t)},pn=e=>{switch(e){case"docker":case"docker-compose":return"docker";case"github-actions":return"actions";case"gitlab-ci":return"gitlab";default:return}},mn=(e,t)=>{const n=[".github/dependabot.yml",".github/dependabot.yaml"];for(const s of n){const i=L(e,s);if(!U(i))continue;let r;try{r=Zt(z(i))}catch{continue}if(r?.updates){for(const o of r.updates){const a=pn(o["package-ecosystem"]);if(!(!a||!Array.isArray(o.ignore)))for(const p of o.ignore){const c=p["dependency-name"];typeof c=="string"&&c.length>0&&t[a].add(et(c))}}return}}},hn=Object.freeze({"docker-compose":"docker",dockerfile:"docker","github-actions":"actions",gitlabci:"gitlab","gitlabci-include":"gitlab"}),gn=Object.freeze({docker:"docker","github-tags":"actions"}),ge=(e,t)=>{if(t)for(const n of t)typeof n=="string"&&n.length>0&&e.add(et(n))},yn=e=>{let t="",n=0;const{length:s}=e;let i=!1,r="";for(;n<s;){const o=e[n]??"";if(i){if(t+=o,o==="\\"&&n+1<s){t+=e[n+1]??"",n+=2;continue}o===r&&(i=!1),n+=1;continue}if(o==='"'||o==="'"){i=!0,r=o,t+=o,n+=1;continue}if(o==="/"&&e[n+1]==="/"){for(;n<s&&e[n]!==`
|
|
2
|
+
`;)n+=1;continue}if(o==="/"&&e[n+1]==="*"){for(n+=2;n<s&&!(e[n]==="*"&&e[n+1]==="/");)n+=1;n+=2;continue}if(o===","){let a=n+1;for(;a<s&&/\s/.test(e[a]??"");)a+=1;const p=e[a];if(p==="}"||p==="]"){n+=1;continue}}t+=o,n+=1}return t},$n=(e,t)=>{const n=["renovate.json","renovate.json5",".renovaterc",".renovaterc.json"];for(const s of n){const i=L(e,s);if(!U(i))continue;let r;try{const a=z(i);r=JSON.parse(yn(a))}catch{continue}if(!r)continue;if(Array.isArray(r.ignoreDeps))for(const a of["actions","docker","gitlab"])ge(t[a],r.ignoreDeps);const o=[["github-actions","actions"],["dockerfile","docker"],["docker-compose","docker"],["gitlabci","gitlab"],["gitlabci-include","gitlab"]];for(const[a,p]of o){const c=r[a];ge(t[p],c?.ignoreDeps)}if(!Array.isArray(r.packageRules))return;for(const a of r.packageRules){if(a.enabled!==!1)continue;const p=new Set;for(const d of a.matchManagers??[]){const f=hn[d];f&&p.add(f)}for(const d of a.matchDatasources??[]){const f=gn[d];f&&p.add(f)}p.size===0&&(p.add("actions"),p.add("docker"),p.add("gitlab"));const c=[...a.matchPackageNames??[],...a.matchDepNames??[],...a.matchPackagePatterns??[]];for(const d of p)ge(t[d],c)}return}},vn=e=>{const t={actions:new Set,docker:new Set,gitlab:new Set};return mn(e,t),$n(e,t),t},ve=(e,t,n)=>{const s=n[t];if(s.size===0)return!1;if(s.has(e))return!0;for(const i of s)if(/[*?[\]/.+]/.test(i))try{const r=i.replaceAll(/[.+^${}()|]/g,String.raw`\$&`).replaceAll("*",".*").replaceAll("?",".");if(new RegExp(`^${r}$`).test(e))return!0}catch{}return!1},W=e=>{const t=e.trim();if(t==="")return;const n=t.startsWith("v")||t.startsWith("V")?t.slice(1):t,i=(ne.valid(n)?ne.parse(n):void 0)??ne.coerce(n,{includePrerelease:!0});if(i)return{major:i.major,minor:i.minor,normalized:`${String(i.major)}.${String(i.minor)}.${String(i.patch)}${i.prerelease.length>0?`-${i.prerelease.join(".")}`:""}`,patch:i.patch,prerelease:i.prerelease.length>0,raw:t}},wn=(e,t)=>ne.rcompare(e.normalized,t.normalized),we=(e,t,n,s)=>{if(!t&&n!=="latest")return;const i=e.filter(r=>r.prerelease?!1:t?n==="patch"&&(r.major!==t.major||r.minor!==t.minor)||n==="minor"&&r.major!==t.major?!1:ne.gt(r.normalized,t.normalized):!0);if(i.length!==0)return i.toSorted(wn)[0]},ke=(e,t)=>!e||!t?"unknown":t.major!==e.major?"major":t.minor!==e.minor?"minor":t.patch!==e.patch?"patch":"unknown",kn="GitHub Actions",Oe=(e,t)=>`${e}@${t}`,bn=e=>({fixedVersions:e.fixedVersions,id:e.id,severity:e.severity,summary:e.summary}),Rn=(e,t)=>{if(t.length===0)return t;const n=nn(e);if(!en(n))return t;const s=new Map;for(const r of t){const o=r.currentVersion??r.currentRef;o&&s.set(Oe(r.name,o),{name:r.name,version:o})}if(s.size===0)return t;const i=new Map;try{for(const[r,o]of s){const p=sn([o],{ecosystem:kn,workspaceRoot:e}).get(o.name);p&&p.length>0&&i.set(r,p)}}catch{return t}return i.size===0?t:t.map(r=>{const o=r.currentVersion??r.currentRef;if(!o)return r;const a=i.get(Oe(r.name,o));return a?{...r,advisories:a.map(p=>bn(p))}:r})},tt=e=>{if(!e)return{};const t={};for(const n of e.split(",")){const s=/^\s*<([^>]+)>\s*;\s*(.+)$/.exec(n);if(!s)continue;const i=s[1]??"",r=s[2]??"";switch(/rel\s*=\s*"?([^";\s]+)"?/i.exec(r)?.[1]?.toLowerCase()){case"first":{t.first=i;break}case"last":{t.last=i;break}case"next":{t.next=i;break}case"prev":case"previous":{t.previous=i;break}}}return t};class En{token;apiBase;fetchImpl;tagsCache=new Map;commitCache=new Map;constructor(t){this.token=t.token??process.env.GITHUB_TOKEN??process.env.GH_TOKEN,this.apiBase=t.apiBase??"https://api.github.com",this.fetchImpl=t.fetch??fetch}async listTags(t,n){const s=`${t}/${n}`,i=this.tagsCache.get(s);if(i)return i;const r=this.fetchTags(t,n);return this.tagsCache.set(s,r),r}async resolveRef(t,n,s){const i=`${t}/${n}@${s}`,r=this.commitCache.get(i);if(r)return r;const o=this.fetchCommit(t,n,s);return this.commitCache.set(i,o),o}buildHeaders(){const t={Accept:"application/vnd.github+json","User-Agent":"vis-update-actions","X-GitHub-Api-Version":"2022-11-28"};return this.token&&(t.Authorization=`Bearer ${this.token}`),t}async fetchTags(t,n){const s=`${this.apiBase}/repos/${encodeURIComponent(t)}/${encodeURIComponent(n)}/tags?per_page=100`,i={parsed:[],tags:[]},r=[];let o=s,a=0;for(;o&&a<5;){const c=o;let d;try{d=await this.fetchImpl(c,{headers:this.buildHeaders()})}catch{return i}if(!d.ok)return i;let f;try{f=await d.json()}catch{return i}if(!Array.isArray(f))return i;for(const m of f){const g=typeof m.name=="string"?m.name:"",h=typeof m.commit?.sha=="string"?m.commit.sha:"";g!==""&&h!==""&&r.push({name:g,sha:h})}o=tt(d.headers.get("link")).next,a+=1}const p=[];for(const c of r){const d=W(c.name);d&&p.push({...d,sha:c.sha})}return{parsed:p,tags:r}}async fetchCommit(t,n,s){const i=`${this.apiBase}/repos/${encodeURIComponent(t)}/${encodeURIComponent(n)}/commits/${encodeURIComponent(s)}`;try{const r=await this.fetchImpl(i,{headers:this.buildHeaders()});if(!r.ok)return;const o=await r.json();return typeof o.sha!="string"?void 0:{committedAt:o.commit?.committer?.date,sha:o.sha}}catch{return}}}const xn=".github/workflows",An=".github/actions",Sn=/^\s*-?\s*uses:\s*(['"]?)([^'"\s#]+)\1(?:\s*#\s*(.+))?\s*$/,Cn=/^[a-f0-9]{40}$/i,Tn=/actions-up-ignore-next-line(?::\s*(.+))?/i,In=/actions-up-ignore-start/i,On=/actions-up-ignore-end/i,_n=e=>{const t=e.split("/");if(t.length<2)return;const[n,s,...i]=t;if(!(!n||!s))return{owner:n,repo:s,subpath:i.length>0?i.join("/"):void 0}},Nn=(e,t)=>{const n=t.split(/\r?\n/),s=[];let i,r=!1;for(const[o,a]of n.entries()){const p=a??"";if(In.test(p)&&(r=!0),On.test(p)){r=!1;continue}const c=p.trim(),f=c===""||c.startsWith("#")?Tn.exec(p):void 0;if(f){i=f[1]??"actions-up-ignore-next-line";continue}const m=Sn.exec(p);if(!m){i=void 0;continue}const g=m[1]??"",h=g==="'"||g==='"'?g:"",b=m[2]??"",k=m[3]?.trim();if(b.startsWith("./")||b.startsWith("../")||b.startsWith("docker://")){i=void 0;continue}const y=b.lastIndexOf("@");if(y<=0){i=void 0;continue}const A=b.slice(0,y),w=b.slice(y+1),u=_n(A);if(!u){i=void 0;continue}let $=i??(r?"actions-up-ignore-block":void 0);if(k){const l=/^actions-up-ignore(?:-next-line)?(?::\s*(.+))?(?:\s|$)/i.exec(k);l&&($=$??l[1]??"actions-up-ignore")}i=void 0,s.push({file:e,ignoreReason:$,isSha:Cn.test(w),line:o+1,original:`${h}${b}${h}`,owner:u.owner,quote:h,ref:w,repo:u.repo,slug:A,subpath:u.subpath,trailingComment:k&&!$?k:void 0})}return s},_e=e=>e.endsWith(".yml")||e.endsWith(".yaml"),jn=(e,t=[])=>{const n=[],s=new Set,i=a=>{if(s.has(a))return;s.add(a);let p;try{p=z(a)}catch{return}const c=Nn(a,p);n.push(...c)},r=L(e,xn);if(U(r))for(const a of X(r,{includeDirs:!1,includeSymlinks:!1,maxDepth:1}))_e(a.name)&&i(a.path);const o=L(e,An);if(U(o))for(const a of X(o,{includeDirs:!1,includeSymlinks:!1,maxDepth:3}))(a.name==="action.yml"||a.name==="action.yaml")&&i(a.path);for(const a of["action.yml","action.yaml"]){const p=L(e,a);U(p)&&i(p)}for(const a of t){const p=wt(a)?a:L(e,a);if(U(p))for(const c of X(p,{includeDirs:!1,includeSymlinks:!1}))_e(c.name)&&i(c.path)}return n},Dn=40,Un=1440*60*1e3,Bn=new Set(["develop","edge","main","master","stable","trunk"]),Ln=e=>e.length===Dn&&/^[a-f0-9]{40}$/i.test(e)?!1:Bn.has(e.toLowerCase())?!0:W(e)===void 0,Ne=(e,t)=>{for(const n of t)try{if(new RegExp(n).test(e))return!0}catch{if(e.includes(n))return!0}return!1},Pn=(e,t,n,s)=>{const i=s==="sha"||e.isSha,{quote:r}=e;return i?`${r}${e.slug}@${t}${r} # ${n}`:`${r}${e.slug}@${n}${r}`},Vn=async(e,t)=>{const{ignoreRules:n,options:s,references:i,resolverOptions:r}=t,o=[],a=[],p=[];if(i.length===0)return{failed:p,ignored:a,updates:o};const c=new En({apiBase:r?.apiBase,fetch:r?.fetch,token:s.githubToken??r?.token}),d=new Map;for(const y of i){const A=`${y.owner}/${y.repo}`,w=d.get(A)??[];w.push(y),d.set(A,w)}const f=Math.max(1,s.maxConcurrentRequests),m=[...d.keys()];let g=0;const h=async y=>{const A=d.get(y)??[],[w,u]=y.split("/");if(!w||!u)return;let $;try{$=await c.listTags(w,u)}catch{for(const l of A)p.push({file:l.file,reason:`failed to list tags for ${y}`});return}for(const l of A){const S=l.slug;let v;if(l.ignoreReason?v=l.ignoreReason:Ne(S,s.exclude)?v="matched --exclude":s.include.length>0&&!Ne(S,s.include)?v="not matched by --include":s.respectDependabotConfig&&n&&ve(S,"actions",n)&&(v="ignored by dependabot/renovate config"),v){a.push({currentRef:l.ref,currentVersion:l.isSha?l.trailingComment?.replace(/^#\s*/,""):l.ref,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:S,newRef:l.ref,newVersion:void 0,original:l.original,reason:v,replacement:l.original,updateType:"unknown"});continue}if(!s.includeBranches&&!l.isSha&&Ln(l.ref)){a.push({currentRef:l.ref,currentVersion:l.ref,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:S,newRef:l.ref,newVersion:void 0,original:l.original,reason:"branch reference (use --include-branches)",replacement:l.original,updateType:"unknown"});continue}const C=l.isSha?l.trailingComment?.replace(/^#\s*/,"").split(/\s+/)[0]??"":l.ref,T=W(C);if(l.isSha&&!T&&s.mode!=="latest"){a.push({currentRef:l.ref,currentVersion:void 0,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:S,newRef:l.ref,newVersion:void 0,original:l.original,reason:`SHA pin has no version-hint comment; cannot apply --target=${s.mode}`,replacement:l.original,updateType:"unknown"});continue}const E=we($.parsed,T,s.mode);if(!E)continue;if(s.minAgeDays!==void 0){const P=await c.resolveRef(w,u,E.sha),N=P?.committedAt?new Date(P.committedAt).getTime():void 0;if(N&&(Date.now()-N)/Un<s.minAgeDays){a.push({currentRef:l.ref,currentVersion:T?.raw,ecosystem:"actions",file:l.file,ignored:!0,line:l.line,name:S,newRef:l.ref,newVersion:E.raw,original:l.original,reason:`release younger than ${String(s.minAgeDays)} days`,replacement:l.original,updateType:"unknown"});continue}}const I=s.style==="sha"||l.isSha?E.sha:E.raw,O=Pn(l,E.sha,E.raw,s.style);o.push({currentRef:l.ref,currentVersion:T?.raw??l.trailingComment?.replace(/^#\s*/,""),ecosystem:"actions",file:l.file,line:l.line,name:S,newRef:I,newVersion:E.raw,original:l.original,replacement:O,updateType:ke(T,E),url:`https://github.com/${w}/${u}/releases/tag/${E.raw}`})}},b=[];for(let y=0;y<Math.min(f,m.length);y++)b.push((async()=>{for(;g<m.length;){const A=m[g];g+=1,A!==void 0&&await h(A)}})());await Promise.all(b);const k=Rn(e,o);return{failed:p,ignored:a,updates:k}},Mn=e=>e.toSorted((t,n)=>t.file!==n.file?t.file<n.file?-1:1:t.line-n.line),nt=e=>{const t=[],n=[];if(e.length===0)return{applied:t,skipped:n};const s=Mn(e),i=new Map;for(const r of s){const o=i.get(r.file)??[];o.push(r),i.set(r.file,o)}for(const[r,o]of i){let a;try{a=z(r)}catch(m){for(const g of o)n.push({reason:`read failed: ${m.message}`,update:g});continue}const p=a.includes(`\r
|
|
3
3
|
`)?`\r
|
|
4
4
|
`:`
|
|
5
|
-
`,c=a.split(/\r?\n/),u=[];for(const g of i){const m=g.line-1,h=c[m];if(h===void 0){t.push({reason:`line ${String(g.line)} out of range`,update:g});continue}const R=h.indexOf(g.original);if(R===-1){t.push({reason:"original token not found on expected line",update:g});continue}const A=h.slice(0,R),$=h.slice(R+g.original.length),S=/#\s*v?\d/.test(g.replacement)&&/^\s*#\s*v?\d[\w.+-]*\s*$/i.test($)?"":$;c[m]=`${A}${g.replacement}${S}`,u.push(g)}if(u.length===0)continue;const f=c.join(d);try{vt(o,f),n.push(...u)}catch(g){for(const m of u)t.push({reason:`write failed: ${g.message}`,update:m})}}return{applied:n,skipped:t}};class Wn{tokens;fetchImpl;tagCache=new Map;constructor(n={}){this.tokens=n.tokens??{},this.fetchImpl=n.fetch??fetch}async listTags(n,t,s){const r=`${n}/${t}/${s}`,o=this.tagCache.get(r);if(o)return o;const i=n==="docker.io"?this.listDockerHubTags(t,s):this.listV2Tags(n,t,s);return this.tagCache.set(r,i),i}async listDockerHubTags(n,t){const s={parsed:[],raw:[]},r=[],o=new Map;let i=`https://hub.docker.com/v2/repositories/${encodeURIComponent(n)}/${encodeURIComponent(t)}/tags?page_size=100`,a=0;for(;i&&a<5;){try{const d=await this.fetchImpl(i,{headers:{Accept:"application/json"}});if(!d.ok)break;const c=await d.json();if(Array.isArray(c.results)){for(const u of c.results)if(typeof u.name=="string"&&(r.push(u.name),typeof u.last_updated=="string")){const f=Date.parse(u.last_updated);Number.isNaN(f)||o.set(u.name,f)}}i=typeof c.next=="string"?c.next:void 0}catch{break}a+=1}return r.length===0?s:{parsed:r.map(d=>{const c=z(d);if(c)return{...c,lastUpdated:o.get(d)}}).filter(d=>d!==void 0),raw:r}}async listV2Tags(n,t,s){const r={parsed:[],raw:[]},o=t==="library"?s:`${t}/${s}`,i={Accept:"application/json"},a=this.tokens[n]??process.env[`DOCKER_REGISTRY_TOKEN_${n.toUpperCase().replaceAll(/[^A-Z0-9]/g,"_")}`];a&&(i.Authorization=`Bearer ${a}`);const d=`https://${n}`,c=[];let u=`${d}/v2/${o}/tags/list?n=100`,f=i,g=0;const m=()=>{const h=[];for(const R of c){const A=z(R);A&&h.push({...A,lastUpdated:void 0})}return{parsed:h,raw:c}};for(;u&&g<5;){try{let h=await this.fetchImpl(u,{headers:f});if(h.status===401&&f===i){const $=Hn(h.headers.get("www-authenticate"));if($){const S=await this.fetchBearerToken($);S&&(f={...i,Authorization:`Bearer ${S}`},h=await this.fetchImpl(u,{headers:f}))}}if(!h.ok)return g===0?r:m();const R=await h.json();if(!Array.isArray(R.tags))return g===0?r:m();for(const $ of R.tags)typeof $=="string"&&c.push($);const A=tt(h.headers.get("link"));u=A.next?new URL(A.next,d).toString():void 0}catch{return g===0?r:m()}g+=1}return c.length===0?r:m()}async fetchBearerToken(n){const t=new URLSearchParams({scope:n.scope,service:n.service}),s=`${n.realm}?${t.toString()}`;try{const r=await this.fetchImpl(s,{headers:{Accept:"application/json"}});if(!r.ok)return;const o=await r.json();return o.token??o.access_token}catch{return}}}const Ln=e=>{const n=[];let t=0;const{length:s}=e;for(;t<s;){for(;t<s&&/\s/.test(e[t]??"");)t+=1;const r=t;for(;t<s&&e[t]!=="="&&e[t]!==",";)t+=1;const o=e.slice(r,t).trim();if(e[t]!=="="){for(;t<s&&e[t]!==",";)t+=1;t+=1;continue}t+=1;let i="";if(e[t]==='"'){for(t+=1;t<s&&e[t]!=='"';){if(e[t]==="\\"&&t+1<s){i+=e[t+1]??"",t+=2;continue}i+=e[t]??"",t+=1}t+=1}else{for(;t<s&&e[t]!==",";)i+=e[t]??"",t+=1;i=i.trim()}for(o.length>0&&n.push({key:o,value:i});t<s&&(/\s/.test(e[t]??"")||e[t]===",");)t+=1}return n},Hn=e=>{if(!e)return;const n=/^Bearer\s+(.*)$/i.exec(e);if(!n)return;const t=new Map;for(const{key:o,value:i}of Ln(n[1]??""))t.set(o.toLowerCase(),i);const s=t.get("realm"),r=t.get("service");if(s)return{realm:s,scope:t.get("scope")??"",service:r??""}},zn="docker.io",Fn="sha256:",ae=e=>{const n=e.trim();if(n===""||n.startsWith("$")||n.includes("${")||n.includes("$("))return;let t=n,s;const r=t.indexOf(`@${Fn}`);r!==-1&&(s=t.slice(r+1),t=t.slice(0,r));let o=zn,i=t;const a=t.indexOf("/");if(a>0){const h=t.slice(0,a);(h==="localhost"||h.includes(".")||h.includes(":"))&&(o=h,i=t.slice(a+1))}let d="latest",c=i;const u=i.lastIndexOf(":");u!==-1&&!i.slice(u).includes("/")&&(d=i.slice(u+1),c=i.slice(0,u));let f="library",g=c;const m=c.indexOf("/");if(m!==-1&&(f=c.slice(0,m),g=c.slice(m+1)),g!=="")return{digest:s,name:g,namespace:f,original:n,registry:o,tag:d}},ce=/vis-update-ignore-next-line/i,st=/vis-update-ignore(?:\s|$|:)/i,ot=e=>{const n=e.trim();return n===""||n.startsWith("#")},Gn=/^\s*FROM\s+(?:--\S+\s+)*([^\s#]+)(?:\s[^#]*)?(#.*)?$/i,Kn=(e,n)=>{const t=n.split(/\r?\n/),s=[];let r=!1;for(const[o,i]of t.entries()){if(ce.test(i)&&ot(i)){r=!0;continue}const a=Gn.exec(i);if(!a){i.trim()!==""&&!i.trim().startsWith("#")&&(r=!1);continue}const d=a[1]??"";if(d==="scratch"){r=!1;continue}const c=a[2]?.trim();let u=r?"vis-update-ignore-next-line":void 0;c&&ce.test(c)?u=u??"vis-update-ignore-next-line":c&&st.test(c)&&(u=u??"vis-update-ignore");const f=ae(d);r=!1,f&&s.push({...f,file:e,ignoreReason:u,kind:"dockerfile",line:o+1})}return s},Jn=/^\s*image:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,Yn=(e,n)=>{const t=n.split(/\r?\n/),s=[];let r=!1;for(const[o,i]of t.entries()){if(ce.test(i)&&ot(i)){r=!0;continue}const a=Jn.exec(i);if(!a){i.trim()!==""&&!i.trim().startsWith("#")&&(r=!1);continue}const d=a[2]??"",c=a[3]?.trim();let u=r?"vis-update-ignore-next-line":void 0;c&&ce.test(c)?u=u??"vis-update-ignore-next-line":c&&st.test(c)&&(u=u??"vis-update-ignore");const f=ae(d);r=!1,f&&s.push({...f,file:e,ignoreReason:u,kind:"compose",line:o+1})}return s},Ue=e=>{const n=e.toLowerCase();return n==="dockerfile"||n.startsWith("dockerfile.")?!0:n.endsWith(".dockerfile")},Xn=e=>{const n=e.toLowerCase();return/^(?:docker-)?compose(?:\..+)?\.ya?ml$/.test(n)},Zn=new Set([".cache",".git",".nx",".pnpm-store",".turbo","build","dist","node_modules"]),Qn=/(?:^|\/)(?:\.git|node_modules|\.pnpm-store|\.turbo|\.nx|dist|build|\.cache)(?:\/|$)/,es=e=>{const n=[];if(!B(e))return n;const t=new Set,s=(r,o)=>{let i;try{i=nn.native(r)}catch{i=r}if(t.has(i))return;t.add(i);let a;try{a=K(r)}catch{return}n.push(...o==="dockerfile"?Kn(r,a):Yn(r,a))};for(const r of Y(e,{includeDirs:!1,includeSymlinks:!1,skip:[Qn]})){const{name:o}=r;Zn.has(o)||(Ue(o)?s(r.path,"dockerfile"):Xn(o)&&s(r.path,"compose"))}for(const r of["Dockerfile","dockerfile","compose.yml","compose.yaml","docker-compose.yml","docker-compose.yaml"]){const o=_(e,r);B(o)&&s(o,Ue(r)?"dockerfile":"compose")}return n},ts=864e5,Oe=(e,n)=>{for(const t of n)try{if(new RegExp(t).test(e))return!0}catch{if(e.includes(t))return!0}return!1},Be=e=>{const n=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return e.registry==="docker.io"?n:`${e.registry}/${n}`},ns=e=>e.digest!==void 0&&e.digest.length>0,ss=e=>{if(e.registry==="docker.io")return`https://hub.docker.com/${e.namespace==="library"?`_/${e.name}`:`r/${e.namespace}/${e.name}`}/tags`;const n=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return`https://${e.registry}/${n}`},os=(e,n)=>{const t=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return`${e.registry==="docker.io"?t:`${e.registry}/${t}`}:${n}`},rt=async(e,n)=>{const{ignoreRules:t,options:s,references:r,registryOptions:o}=n,i=[],a=[],d=[];if(r.length===0)return{failed:d,ignored:a,updates:i};const c=new Wn({fetch:o?.fetch,tokens:o?.tokens}),u=new Map;for(const A of r){const $=`${A.registry}|${A.namespace}|${A.name}`,S=u.get($)??[];S.push(A),u.set($,S)}const f=Math.max(1,s.maxConcurrentRequests),g=[...u.keys()];let m=0;const h=async A=>{const $=u.get(A)??[],S=$[0];if(!S)return;let y;try{y=await c.listTags(S.registry,S.namespace,S.name)}catch{for(const p of $)d.push({file:p.file,reason:`failed to list tags for ${Be(p)}`});return}for(const p of $){const w=Be(p);let l;if(p.ignoreReason?l=p.ignoreReason:Oe(w,s.exclude)?l="matched --exclude":s.include.length>0&&!Oe(w,s.include)?l="not matched by --include":s.respectDependabotConfig&&t&&we(w,"docker",t)&&(l="ignored by dependabot/renovate config"),l){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:w,newRef:p.tag,newVersion:void 0,original:p.original,reason:l,replacement:p.original,updateType:"unknown"});continue}if(ns(p)){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:w,newRef:p.tag,newVersion:void 0,original:p.original,reason:"digest-pinned image (refresh the pin manually to update)",replacement:p.original,updateType:"digest"});continue}const C=z(p.tag);if(!C&&!s.includeBranches){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:w,newRef:p.tag,newVersion:void 0,original:p.original,reason:"non-semver tag (use --include-branches)",replacement:p.original,updateType:"unknown"});continue}if(!C&&s.mode!=="latest"){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:w,newRef:p.tag,newVersion:void 0,original:p.original,reason:`branch ref has no version baseline for --target=${s.mode}`,replacement:p.original,updateType:"unknown"});continue}const k=ke(y.parsed,C,s.mode);if(!k)continue;if(s.minAgeDays!==void 0&&k.lastUpdated!==void 0&&(Date.now()-k.lastUpdated)/ts<s.minAgeDays){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:w,newRef:k.raw,newVersion:k.raw,original:p.original,reason:`release younger than ${String(s.minAgeDays)} days`,replacement:p.original,updateType:"unknown"});continue}const E=k.raw,j=os(p,E);i.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,line:p.line,name:w,newRef:E,newVersion:E,original:p.original,replacement:j,updateType:ve(C,k),url:ss(p)})}},R=[];for(let A=0;A<Math.min(f,g.length);A++)R.push((async()=>{for(;m<g.length;){const $=g[m];m+=1,$!==void 0&&await h($)}})());return await Promise.all(R),{failed:d,ignored:a,updates:i}};class rs{token;tokenHeader;defaultApiBase;fetchImpl;tagCache=new Map;constructor(n){const t=n.token??process.env.GITLAB_TOKEN;t?(this.token=t,this.tokenHeader="PRIVATE-TOKEN"):process.env.CI_JOB_TOKEN?(this.token=process.env.CI_JOB_TOKEN,this.tokenHeader="JOB-TOKEN"):(this.token=void 0,this.tokenHeader="PRIVATE-TOKEN"),this.defaultApiBase=n.apiBase??"https://gitlab.com",this.fetchImpl=n.fetch??fetch}async listTags(n){const t=this.tagCache.get(n);if(t)return t;const s=this.fetchTags(n);return this.tagCache.set(n,s),s}resolveHostAndPath(n){const t=n.indexOf("/");if(t>0){const s=n.slice(0,t);if(s.includes("."))return{host:`https://${s}`,path:n.slice(t+1)}}return{host:this.defaultApiBase,path:n}}async fetchTags(n){const{host:t,path:s}=this.resolveHostAndPath(n),r=encodeURIComponent(s),o=`${t}/api/v4/projects/${r}/repository/tags?per_page=100`,i={Accept:"application/json","User-Agent":"vis-update-gitlab"};this.token&&(i[this.tokenHeader]=this.token);try{const a=await this.fetchImpl(o,{headers:i});if(!a.ok)return{error:`HTTP ${String(a.status)} from ${t}`,parsed:[],tags:[]};const d=await a.json();if(!Array.isArray(d))return{error:`unexpected response shape from ${t}`,parsed:[],tags:[]};const c=d.map(f=>({name:typeof f.name=="string"?f.name:"",sha:typeof f.commit?.id=="string"?f.commit.id:""})).filter(f=>f.name!==""),u=[];for(const f of c){const g=z(f.name);g&&u.push({...g,sha:f.sha})}return{parsed:u,tags:c}}catch(a){return{error:a instanceof Error?a.message:"fetch failed",parsed:[],tags:[]}}}}const is=/vis-update-ignore-next-line/i,ee=/vis-update-ignore(?:\s|$|:)/i,as=new Set([".gitlab-ci.yaml",".gitlab-ci.yml"]),cs=e=>as.has(e)||e.endsWith(".gitlab-ci.yml")||e.endsWith(".gitlab-ci.yaml"),ls=/^\s*-?\s*project:\s*(['"]?)([^'"\s#]+)\1(?:\s*#.*)?$/,us=/^\s*ref:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,ds=/^\s*-?\s*component:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,ps=/^\s*image:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,fs=/^\s*(?:-\s*)?(?:include:\s*)?\{([^}]*)\}\s*(?:#.*)?$/,gs=/project:\s*(['"]?)([^'"\s,}]+)\1/,ms=/ref:\s*(['"]?)([^'"\s,}]+)\1/,hs=/component:\s*(['"]?)([^'"\s,}]+)\1/,$s=/^(\s*-\s*name:\s*)(['"]?)([^'"\s#]+)\2(\s*#.*)?$/,ys=/^(\s*-\s*)(['"]?)([^'"\s#:]+:[^'"\s#]+)\2(\s*#.*)?$/,ws=/^\s*-?\s*[a-z_][\w-]*:\s*(?:#.*)?$/i,ks=(e,n)=>{const t=n.split(/\r?\n/),s=[],r=[];let o,i=!1,a=!1,d=-1;for(const[c,u]of t.entries()){const f=u??"",g=f.trim(),m=g===""||g.startsWith("#");if(is.test(f)&&m){i=!0;continue}const h=/^(\s*)services:\s*(?:#.*)?$/.exec(f);if(h){a=!0,d=h[1]?.length??0;continue}a&&g!==""&&!g.startsWith("-")&&!g.startsWith("#")&&f.search(/\S/)<=d&&(a=!1,d=-1);const R=ps.exec(f);if(R){const p=R[2]??"",w=ae(p);if(w){const l=R[3]?.trim();let C=i?"vis-update-ignore-next-line":void 0;l&&ee.test(l)&&(C=C??"vis-update-ignore"),r.push({...w,file:e,ignoreReason:C,kind:"compose",line:c+1})}i=!1;continue}if(a){const p=$s.exec(f),w=p?void 0:ys.exec(f),l=p??w;if(l){const C=l[3]??"",k=ae(C);if(k){const E=l[4]?.trim();let j=i?"vis-update-ignore-next-line":void 0;E&&ee.test(E)&&(j=j??"vis-update-ignore"),r.push({...k,file:e,ignoreReason:j,kind:"compose",line:c+1})}}}const A=ls.exec(f);if(A){o={line:c+1,project:A[2]??""};continue}const $=us.exec(f);if($&&o){const p=$[3]?.trim();let w=i?"vis-update-ignore-next-line":void 0;p&&ee.test(p)&&(w=w??"vis-update-ignore"),s.push({file:e,ignoreReason:w,kind:"project",line:c+1,original:$[2]??"",project:o.project,ref:$[2]??""}),o=void 0,i=!1;continue}const S=ds.exec(f);if(S){const p=S[2]??"",w=p.lastIndexOf("@");if(w>0){const l=p.slice(0,w),C=p.slice(w+1),k=l.lastIndexOf("/"),E=k>0?l.slice(0,k):l,j=k>0?l.slice(k+1):void 0,x=S[3]?.trim();let T=i?"vis-update-ignore-next-line":void 0;x&&ee.test(x)&&(T=T??"vis-update-ignore"),s.push({componentName:j,file:e,ignoreReason:T,kind:"component",line:c+1,original:p,project:E,ref:C})}i=!1;continue}const y=fs.exec(f);if(y){const p=y[1]??"",w=/#(.*)$/.exec(f)?.[1]?.trim();let l=i?"vis-update-ignore-next-line":void 0;w&&ee.test(w)&&(l=l??"vis-update-ignore");const C=hs.exec(p);if(C){const k=C[2]??"",E=k.lastIndexOf("@");if(E>0){const j=k.slice(0,E),x=k.slice(E+1),T=j.lastIndexOf("/"),N=T>0?j.slice(0,T):j,M=T>0?j.slice(T+1):void 0;s.push({componentName:M,file:e,ignoreReason:l,kind:"component",line:c+1,original:k,project:N,ref:x})}}else{const k=gs.exec(p),E=ms.exec(p);k&&E&&s.push({file:e,ignoreReason:l,kind:"project",line:c+1,original:E[2]??"",project:k[2]??"",ref:E[2]??""})}i=!1;continue}g!==""&&!g.startsWith("#")&&!ws.test(f)&&(i=!1)}return{images:r,includes:s}},Ve=/^(?:\.git|node_modules|\.pnpm-store|\.turbo|\.nx|dist|build|\.cache)$/,vs=e=>{const n=[],t=[];if(!B(e))return{images:t,includes:n};const s=o=>{let i;try{i=K(o)}catch{return}const{images:a,includes:d}=ks(o,i);n.push(...d),t.push(...a)};for(const o of[".gitlab-ci.yml",".gitlab-ci.yaml"]){const i=_(e,o);B(i)&&s(i)}const r=_(e,".gitlab");if(B(r))for(const o of Y(r,{includeDirs:!1,includeSymlinks:!1,skip:[Ve]}))(o.name.endsWith(".yml")||o.name.endsWith(".yaml"))&&s(o.path);for(const o of Y(e,{includeDirs:!1,includeSymlinks:!1,maxDepth:2,skip:[Ve]}))cs(o.name)&&!t.some(i=>i.file===o.path)&&!n.some(i=>i.file===o.path)&&s(o.path);return{images:t,includes:n}},_e=(e,n)=>{for(const t of n)try{if(new RegExp(t).test(e))return!0}catch{if(e.includes(t))return!0}return!1},bs=(e,n,t)=>{const s=e.indexOf("/");return s>0&&e.slice(0,s).includes(".")?`https://${e.slice(0,s)}/${e.slice(s+1)}/-/releases/${n}`:`${t}/${e}/-/releases/${n}`},Rs=async(e,n)=>{const{ignoreRules:t,imageReferences:s,includes:r,options:o,registryOptions:i,resolverOptions:a}=n,d=[],c=[],u=[];if(s.length>0){const y=await rt(e,{ignoreRules:t,options:o,references:s,registryOptions:i});for(const p of y.updates)d.push({...p,ecosystem:"gitlab"});for(const p of y.ignored)c.push({...p,ecosystem:"gitlab"});u.push(...y.failed)}if(r.length===0)return{failed:u,ignored:c,updates:d};const f=new rs({apiBase:a?.apiBase,fetch:a?.fetch,token:o.gitlabToken??a?.token}),g=a?.apiBase??"https://gitlab.com",m=new Map;for(const y of r){const p=m.get(y.project)??[];p.push(y),m.set(y.project,p)}const h=Math.max(1,o.maxConcurrentRequests),R=[...m.keys()];let A=0;const $=async y=>{const p=m.get(y)??[];let w;try{w=await f.listTags(y)}catch{for(const l of p)u.push({file:l.file,reason:`failed to list tags for ${y}`});return}if(w.error){for(const l of p)u.push({file:l.file,reason:`failed to list tags for ${y}: ${w.error}`});return}for(const l of p){const C=l.kind==="component"&&l.componentName?`${l.project}/${l.componentName}`:l.project;let k;l.ignoreReason?k=l.ignoreReason:_e(C,o.exclude)?k="matched --exclude":o.include.length>0&&!_e(C,o.include)?k="not matched by --include":o.respectDependabotConfig&&t&&we(C,"gitlab",t)&&(k="ignored by dependabot/renovate config");const E=N=>({currentRef:l.ref,currentVersion:l.ref,ecosystem:"gitlab",file:l.file,ignored:!0,line:l.line,name:C,newRef:l.ref,newVersion:void 0,original:l.original,reason:N,replacement:l.original,updateType:"unknown"});if(k){c.push(E(k));continue}const j=z(l.ref);if(!j&&!o.includeBranches){c.push(E("branch reference (use --include-branches)"));continue}if(!j&&o.mode!=="latest"){c.push(E(`branch ref has no version baseline for --target=${o.mode}`));continue}const x=ke(w.parsed,j,o.mode);if(!x)continue;let T;l.kind==="component"?T=`${l.componentName?`${l.project}/${l.componentName}`:l.project}@${x.raw}`:T=x.raw,d.push({currentRef:l.ref,currentVersion:j?.raw??l.ref,ecosystem:"gitlab",file:l.file,line:l.line,name:C,newRef:x.raw,newVersion:x.raw,original:l.original,replacement:T,updateType:ve(j,x),url:bs(l.project,x.raw,g)})}},S=[];for(let y=0;y<Math.min(h,R.length);y++)S.push((async()=>{for(;A<R.length;){const p=R[A];A+=1,p!==void 0&&await $(p)}})());return await Promise.all(S),{failed:u,ignored:c,updates:d}},xs={disabled:new Set,exclude:[],githubToken:void 0,gitlabToken:void 0,include:[],includeBranches:!1,maxConcurrentRequests:8,minAgeDays:void 0,mode:"latest",respectDependabotConfig:!0,style:"sha"},it=async e=>{const n={...xs,...e.options,disabled:e.options?.disabled??new Set},t=n.respectDependabotConfig?wn(e.workspaceRoot):void 0,s={actions:{failed:[],ignored:[],updates:[]},docker:{failed:[],ignored:[],updates:[]},gitlab:{failed:[],ignored:[],updates:[]}},r=[];let o=0;if(!n.disabled.has("actions")){const d=Un(e.workspaceRoot);d.length>0&&(o+=1,r.push(Pn(e.workspaceRoot,{ignoreRules:t,options:n,references:d}).then(c=>{s.actions=c})))}if(!n.disabled.has("docker")){const d=es(e.workspaceRoot);d.length>0&&(o+=1,r.push(rt(e.workspaceRoot,{ignoreRules:t,options:n,references:d}).then(c=>{s.docker=c})))}if(!n.disabled.has("gitlab")){const{images:d,includes:c}=vs(e.workspaceRoot);d.length+c.length>0&&(o+=1,r.push(Rs(e.workspaceRoot,{ignoreRules:t,imageReferences:d,includes:c,options:n}).then(u=>{s.gitlab=u})))}await Promise.all(r);const i=[...s.actions.updates,...s.docker.updates,...s.gitlab.updates],a=[...s.actions.ignored,...s.docker.ignored,...s.gitlab.ignored];return{failed:[...s.actions.failed,...s.docker.failed,...s.gitlab.failed],ignored:a,perEcosystem:s,scanned:o,updates:i}},As={actions:"GitHub Actions",docker:"Docker",gitlab:"GitLab CI"},$e=e=>e.updateType==="major",Ss=e=>{switch(e){case"major":return G;case"minor":return I;case"patch":return Fe;default:return Ge}},Me=e=>{const n=Ss(e.updateType),t=e.currentVersion??e.currentRef,s=e.newVersion??e.newRef,r=e.url?` ${q(e.url)}`:"",o=e.advisories&&e.advisories.length>0?` ${G(`⚠ ${String(e.advisories.length)} advisor${e.advisories.length===1?"y":"ies"}`)}`:"";return` ${n(e.updateType.padEnd(7))} ${e.name} ${q(t)} → ${s}${o}${r}`},Pe=e=>!e.advisories||e.advisories.length===0?[]:e.advisories.map(n=>` ${n.severity==="CRITICAL"||n.severity==="HIGH"?G(n.severity):I(n.severity)} ${n.id} ${q(n.summary)}`),Cs=(e,n)=>{const t=[],s=e.updates.length;if(s===0&&e.scanned===0)return"";if(s===0){if(e.failed.length===0&&e.ignored.length===0)return t.push(`${Fe("✓")} All ecosystem references up to date.`),t.join(`
|
|
6
|
-
`);if(
|
|
7
|
-
${
|
|
8
|
-
${
|
|
9
|
-
`)}
|
|
10
|
-
${
|
|
11
|
-
${
|
|
12
|
-
${
|
|
13
|
-
${
|
|
14
|
-
${
|
|
15
|
-
${
|
|
16
|
-
`)},
|
|
17
|
-
`)}}},
|
|
18
|
-
${
|
|
19
|
-
`):
|
|
20
|
-
`):(
|
|
21
|
-
Updated ${
|
|
22
|
-
Fetching changelogs...`);const c=await
|
|
23
|
-
`);try{const{code:f,output:
|
|
24
|
-
`),l=
|
|
25
|
-
`);const
|
|
26
|
-
${String(
|
|
27
|
-
${
|
|
28
|
-
`)}`):
|
|
29
|
-
`);for(const
|
|
5
|
+
`,c=a.split(/\r?\n/),d=[];for(const m of o){const g=m.line-1,h=c[g];if(h===void 0){n.push({reason:`line ${String(m.line)} out of range`,update:m});continue}const b=h.indexOf(m.original);if(b===-1){n.push({reason:"original token not found on expected line",update:m});continue}const k=h.slice(0,b),y=h.slice(b+m.original.length),u=/#\s*v?\d/.test(m.replacement)&&/^\s*#\s*v?\d[\w.+-]*\s*$/i.test(y)?"":y;c[g]=`${k}${m.replacement}${u}`,d.push(m)}if(d.length===0)continue;const f=c.join(p);try{rn(r,f),t.push(...d)}catch(m){for(const g of d)n.push({reason:`write failed: ${m.message}`,update:g})}}return{applied:t,skipped:n}};class Fn{tokens;fetchImpl;tagCache=new Map;constructor(t={}){this.tokens=t.tokens??{},this.fetchImpl=t.fetch??fetch}async listTags(t,n,s){const i=`${t}/${n}/${s}`,r=this.tagCache.get(i);if(r)return r;const o=t==="docker.io"?this.listDockerHubTags(n,s):this.listV2Tags(t,n,s);return this.tagCache.set(i,o),o}async listDockerHubTags(t,n){const s={parsed:[],raw:[]},i=[],r=new Map;let o=`https://hub.docker.com/v2/repositories/${encodeURIComponent(t)}/${encodeURIComponent(n)}/tags?page_size=100`,a=0;for(;o&&a<5;){try{const c=await this.fetchImpl(o,{headers:{Accept:"application/json"}});if(!c.ok)break;const d=await c.json();if(Array.isArray(d.results)){for(const f of d.results)if(typeof f.name=="string"&&(i.push(f.name),typeof f.last_updated=="string")){const m=Date.parse(f.last_updated);Number.isNaN(m)||r.set(f.name,m)}}o=typeof d.next=="string"?d.next:void 0}catch{break}a+=1}return i.length===0?s:{parsed:i.map(c=>{const d=W(c);if(d)return{...d,lastUpdated:r.get(c)}}).filter(c=>c!==void 0),raw:i}}async listV2Tags(t,n,s){const i={parsed:[],raw:[]},r=n==="library"?s:`${n}/${s}`,o={Accept:"application/json"},a=this.tokens[t]??process.env[`DOCKER_REGISTRY_TOKEN_${t.toUpperCase().replaceAll(/[^A-Z0-9]/g,"_")}`];a&&(o.Authorization=`Bearer ${a}`);const p=`https://${t}`,c=[];let d=`${p}/v2/${r}/tags/list?n=100`,f=o,m=0;const g=()=>{const h=[];for(const b of c){const k=W(b);k&&h.push({...k,lastUpdated:void 0})}return{parsed:h,raw:c}};for(;d&&m<5;){try{let h=await this.fetchImpl(d,{headers:f});if(h.status===401&&f===o){const y=Hn(h.headers.get("www-authenticate"));if(y){const A=await this.fetchBearerToken(y);A&&(f={...o,Authorization:`Bearer ${A}`},h=await this.fetchImpl(d,{headers:f}))}}if(!h.ok)return m===0?i:g();const b=await h.json();if(!Array.isArray(b.tags))return m===0?i:g();for(const y of b.tags)typeof y=="string"&&c.push(y);const k=tt(h.headers.get("link"));d=k.next?new URL(k.next,p).toString():void 0}catch{return m===0?i:g()}m+=1}return c.length===0?i:g()}async fetchBearerToken(t){const n=new URLSearchParams({scope:t.scope,service:t.service}),s=`${t.realm}?${n.toString()}`;try{const i=await this.fetchImpl(s,{headers:{Accept:"application/json"}});if(!i.ok)return;const r=await i.json();return r.token??r.access_token}catch{return}}}const Gn=e=>{const t=[];let n=0;const{length:s}=e;for(;n<s;){for(;n<s&&/\s/.test(e[n]??"");)n+=1;const i=n;for(;n<s&&e[n]!=="="&&e[n]!==",";)n+=1;const r=e.slice(i,n).trim();if(e[n]!=="="){for(;n<s&&e[n]!==",";)n+=1;n+=1;continue}n+=1;let o="";if(e[n]==='"'){for(n+=1;n<s&&e[n]!=='"';){if(e[n]==="\\"&&n+1<s){o+=e[n+1]??"",n+=2;continue}o+=e[n]??"",n+=1}n+=1}else{for(;n<s&&e[n]!==",";)o+=e[n]??"",n+=1;o=o.trim()}for(r.length>0&&t.push({key:r,value:o});n<s&&(/\s/.test(e[n]??"")||e[n]===",");)n+=1}return t},Hn=e=>{if(!e)return;const t=/^Bearer\s+(.*)$/i.exec(e);if(!t)return;const n=new Map;for(const{key:r,value:o}of Gn(t[1]??""))n.set(r.toLowerCase(),o);const s=n.get("realm"),i=n.get("service");if(s)return{realm:s,scope:n.get("scope")??"",service:i??""}},Wn="docker.io",qn="sha256:",ae=e=>{const t=e.trim();if(t===""||t.startsWith("$")||t.includes("${")||t.includes("$("))return;let n=t,s;const i=n.indexOf(`@${qn}`);i!==-1&&(s=n.slice(i+1),n=n.slice(0,i));let r=Wn,o=n;const a=n.indexOf("/");if(a>0){const h=n.slice(0,a);(h==="localhost"||h.includes(".")||h.includes(":"))&&(r=h,o=n.slice(a+1))}let p="latest",c=o;const d=o.lastIndexOf(":");d!==-1&&!o.slice(d).includes("/")&&(p=o.slice(d+1),c=o.slice(0,d));let f="library",m=c;const g=c.indexOf("/");if(g!==-1&&(f=c.slice(0,g),m=c.slice(g+1)),m!=="")return{digest:s,name:m,namespace:f,original:t,registry:r,tag:p}},ce=/vis-update-ignore-next-line/i,st=/vis-update-ignore(?:\s|$|:)/i,rt=e=>{const t=e.trim();return t===""||t.startsWith("#")},Kn=/^\s*FROM\s+(?:--\S+\s+)*([^\s#]+)(?:\s[^#]*)?(#.*)?$/i,zn=(e,t)=>{const n=t.split(/\r?\n/),s=[];let i=!1;for(const[r,o]of n.entries()){if(ce.test(o)&&rt(o)){i=!0;continue}const a=Kn.exec(o);if(!a){o.trim()!==""&&!o.trim().startsWith("#")&&(i=!1);continue}const p=a[1]??"";if(p==="scratch"){i=!1;continue}const c=a[2]?.trim();let d=i?"vis-update-ignore-next-line":void 0;c&&ce.test(c)?d=d??"vis-update-ignore-next-line":c&&st.test(c)&&(d=d??"vis-update-ignore");const f=ae(p);i=!1,f&&s.push({...f,file:e,ignoreReason:d,kind:"dockerfile",line:r+1})}return s},Yn=/^\s*image:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,Jn=(e,t)=>{const n=t.split(/\r?\n/),s=[];let i=!1;for(const[r,o]of n.entries()){if(ce.test(o)&&rt(o)){i=!0;continue}const a=Yn.exec(o);if(!a){o.trim()!==""&&!o.trim().startsWith("#")&&(i=!1);continue}const p=a[2]??"",c=a[3]?.trim();let d=i?"vis-update-ignore-next-line":void 0;c&&ce.test(c)?d=d??"vis-update-ignore-next-line":c&&st.test(c)&&(d=d??"vis-update-ignore");const f=ae(p);i=!1,f&&s.push({...f,file:e,ignoreReason:d,kind:"compose",line:r+1})}return s},je=e=>{const t=e.toLowerCase();return t==="dockerfile"||t.startsWith("dockerfile.")?!0:t.endsWith(".dockerfile")},Xn=e=>{const t=e.toLowerCase();return/^(?:docker-)?compose(?:\..+)?\.ya?ml$/.test(t)},Qn=new Set([".cache",".git",".nx",".pnpm-store",".turbo","build","dist","node_modules"]),Zn=/(?:^|\/)(?:\.git|node_modules|\.pnpm-store|\.turbo|\.nx|dist|build|\.cache)(?:\/|$)/,es=e=>{const t=[];if(!U(e))return t;const n=new Set,s=(i,r)=>{let o;try{o=tn.native(i)}catch{o=i}if(n.has(o))return;n.add(o);let a;try{a=z(i)}catch{return}t.push(...r==="dockerfile"?zn(i,a):Jn(i,a))};for(const i of X(e,{includeDirs:!1,includeSymlinks:!1,skip:[Zn]})){const{name:r}=i;Qn.has(r)||(je(r)?s(i.path,"dockerfile"):Xn(r)&&s(i.path,"compose"))}for(const i of["Dockerfile","dockerfile","compose.yml","compose.yaml","docker-compose.yml","docker-compose.yaml"]){const r=L(e,i);U(r)&&s(r,je(i)?"dockerfile":"compose")}return t},ts=864e5,De=(e,t)=>{for(const n of t)try{if(new RegExp(n).test(e))return!0}catch{if(e.includes(n))return!0}return!1},Ue=e=>{const t=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return e.registry==="docker.io"?t:`${e.registry}/${t}`},ns=e=>e.digest!==void 0&&e.digest.length>0,ss=e=>{if(e.registry==="docker.io")return`https://hub.docker.com/${e.namespace==="library"?`_/${e.name}`:`r/${e.namespace}/${e.name}`}/tags`;const t=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return`https://${e.registry}/${t}`},rs=(e,t)=>{const n=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return`${e.registry==="docker.io"?n:`${e.registry}/${n}`}:${t}`},it=async(e,t)=>{const{ignoreRules:n,options:s,references:i,registryOptions:r}=t,o=[],a=[],p=[];if(i.length===0)return{failed:p,ignored:a,updates:o};const c=new Fn({fetch:r?.fetch,tokens:r?.tokens}),d=new Map;for(const k of i){const y=`${k.registry}|${k.namespace}|${k.name}`,A=d.get(y)??[];A.push(k),d.set(y,A)}const f=Math.max(1,s.maxConcurrentRequests),m=[...d.keys()];let g=0;const h=async k=>{const y=d.get(k)??[],A=y[0];if(!A)return;let w;try{w=await c.listTags(A.registry,A.namespace,A.name)}catch{for(const u of y)p.push({file:u.file,reason:`failed to list tags for ${Ue(u)}`});return}for(const u of y){const $=Ue(u);let l;if(u.ignoreReason?l=u.ignoreReason:De($,s.exclude)?l="matched --exclude":s.include.length>0&&!De($,s.include)?l="not matched by --include":s.respectDependabotConfig&&n&&ve($,"docker",n)&&(l="ignored by dependabot/renovate config"),l){a.push({currentRef:u.tag,currentVersion:u.tag,ecosystem:"docker",file:u.file,ignored:!0,line:u.line,name:$,newRef:u.tag,newVersion:void 0,original:u.original,reason:l,replacement:u.original,updateType:"unknown"});continue}if(ns(u)){a.push({currentRef:u.tag,currentVersion:u.tag,ecosystem:"docker",file:u.file,ignored:!0,line:u.line,name:$,newRef:u.tag,newVersion:void 0,original:u.original,reason:"digest-pinned image (refresh the pin manually to update)",replacement:u.original,updateType:"digest"});continue}const S=W(u.tag);if(!S&&!s.includeBranches){a.push({currentRef:u.tag,currentVersion:u.tag,ecosystem:"docker",file:u.file,ignored:!0,line:u.line,name:$,newRef:u.tag,newVersion:void 0,original:u.original,reason:"non-semver tag (use --include-branches)",replacement:u.original,updateType:"unknown"});continue}if(!S&&s.mode!=="latest"){a.push({currentRef:u.tag,currentVersion:u.tag,ecosystem:"docker",file:u.file,ignored:!0,line:u.line,name:$,newRef:u.tag,newVersion:void 0,original:u.original,reason:`branch ref has no version baseline for --target=${s.mode}`,replacement:u.original,updateType:"unknown"});continue}const v=we(w.parsed,S,s.mode);if(!v)continue;if(s.minAgeDays!==void 0&&v.lastUpdated!==void 0&&(Date.now()-v.lastUpdated)/ts<s.minAgeDays){a.push({currentRef:u.tag,currentVersion:u.tag,ecosystem:"docker",file:u.file,ignored:!0,line:u.line,name:$,newRef:v.raw,newVersion:v.raw,original:u.original,reason:`release younger than ${String(s.minAgeDays)} days`,replacement:u.original,updateType:"unknown"});continue}const C=v.raw,T=rs(u,C);o.push({currentRef:u.tag,currentVersion:u.tag,ecosystem:"docker",file:u.file,line:u.line,name:$,newRef:C,newVersion:C,original:u.original,replacement:T,updateType:ke(S,v),url:ss(u)})}},b=[];for(let k=0;k<Math.min(f,m.length);k++)b.push((async()=>{for(;g<m.length;){const y=m[g];g+=1,y!==void 0&&await h(y)}})());return await Promise.all(b),{failed:p,ignored:a,updates:o}};class is{token;tokenHeader;defaultApiBase;fetchImpl;tagCache=new Map;constructor(t){const n=t.token??process.env.GITLAB_TOKEN;n?(this.token=n,this.tokenHeader="PRIVATE-TOKEN"):process.env.CI_JOB_TOKEN?(this.token=process.env.CI_JOB_TOKEN,this.tokenHeader="JOB-TOKEN"):(this.token=void 0,this.tokenHeader="PRIVATE-TOKEN"),this.defaultApiBase=t.apiBase??"https://gitlab.com",this.fetchImpl=t.fetch??fetch}async listTags(t){const n=this.tagCache.get(t);if(n)return n;const s=this.fetchTags(t);return this.tagCache.set(t,s),s}resolveHostAndPath(t){const n=t.indexOf("/");if(n>0){const s=t.slice(0,n);if(s.includes("."))return{host:`https://${s}`,path:t.slice(n+1)}}return{host:this.defaultApiBase,path:t}}async fetchTags(t){const{host:n,path:s}=this.resolveHostAndPath(t),i=encodeURIComponent(s),r=`${n}/api/v4/projects/${i}/repository/tags?per_page=100`,o={Accept:"application/json","User-Agent":"vis-update-gitlab"};this.token&&(o[this.tokenHeader]=this.token);try{const a=await this.fetchImpl(r,{headers:o});if(!a.ok)return{error:`HTTP ${String(a.status)} from ${n}`,parsed:[],tags:[]};const p=await a.json();if(!Array.isArray(p))return{error:`unexpected response shape from ${n}`,parsed:[],tags:[]};const c=p.map(f=>({name:typeof f.name=="string"?f.name:"",sha:typeof f.commit?.id=="string"?f.commit.id:""})).filter(f=>f.name!==""),d=[];for(const f of c){const m=W(f.name);m&&d.push({...m,sha:f.sha})}return{parsed:d,tags:c}}catch(a){return{error:a instanceof Error?a.message:"fetch failed",parsed:[],tags:[]}}}}const os=/vis-update-ignore-next-line/i,te=/vis-update-ignore(?:\s|$|:)/i,as=new Set([".gitlab-ci.yaml",".gitlab-ci.yml"]),cs=e=>as.has(e)||e.endsWith(".gitlab-ci.yml")||e.endsWith(".gitlab-ci.yaml"),ls=/^\s*-?\s*project:\s*(['"]?)([^'"\s#]+)\1(?:\s*#.*)?$/,ds=/^\s*ref:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,us=/^\s*-?\s*component:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,fs=/^\s*image:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,ps=/^\s*(?:-\s*)?(?:include:\s*)?\{([^}]*)\}\s*(?:#.*)?$/,ms=/project:\s*(['"]?)([^'"\s,}]+)\1/,hs=/ref:\s*(['"]?)([^'"\s,}]+)\1/,gs=/component:\s*(['"]?)([^'"\s,}]+)\1/,ys=/^(\s*-\s*name:\s*)(['"]?)([^'"\s#]+)\2(\s*#.*)?$/,$s=/^(\s*-\s*)(['"]?)([^'"\s#:]+:[^'"\s#]+)\2(\s*#.*)?$/,vs=/^\s*-?\s*[a-z_][\w-]*:\s*(?:#.*)?$/i,ws=(e,t)=>{const n=t.split(/\r?\n/),s=[],i=[];let r,o=!1,a=!1,p=-1;for(const[c,d]of n.entries()){const f=d??"",m=f.trim(),g=m===""||m.startsWith("#");if(os.test(f)&&g){o=!0;continue}const h=/^(\s*)services:\s*(?:#.*)?$/.exec(f);if(h){a=!0,p=h[1]?.length??0;continue}a&&m!==""&&!m.startsWith("-")&&!m.startsWith("#")&&f.search(/\S/)<=p&&(a=!1,p=-1);const b=fs.exec(f);if(b){const u=b[2]??"",$=ae(u);if($){const l=b[3]?.trim();let S=o?"vis-update-ignore-next-line":void 0;l&&te.test(l)&&(S=S??"vis-update-ignore"),i.push({...$,file:e,ignoreReason:S,kind:"compose",line:c+1})}o=!1;continue}if(a){const u=ys.exec(f),$=u?void 0:$s.exec(f),l=u??$;if(l){const S=l[3]??"",v=ae(S);if(v){const C=l[4]?.trim();let T=o?"vis-update-ignore-next-line":void 0;C&&te.test(C)&&(T=T??"vis-update-ignore"),i.push({...v,file:e,ignoreReason:T,kind:"compose",line:c+1})}}}const k=ls.exec(f);if(k){r={line:c+1,project:k[2]??""};continue}const y=ds.exec(f);if(y&&r){const u=y[3]?.trim();let $=o?"vis-update-ignore-next-line":void 0;u&&te.test(u)&&($=$??"vis-update-ignore"),s.push({file:e,ignoreReason:$,kind:"project",line:c+1,original:y[2]??"",project:r.project,ref:y[2]??""}),r=void 0,o=!1;continue}const A=us.exec(f);if(A){const u=A[2]??"",$=u.lastIndexOf("@");if($>0){const l=u.slice(0,$),S=u.slice($+1),v=l.lastIndexOf("/"),C=v>0?l.slice(0,v):l,T=v>0?l.slice(v+1):void 0,E=A[3]?.trim();let I=o?"vis-update-ignore-next-line":void 0;E&&te.test(E)&&(I=I??"vis-update-ignore"),s.push({componentName:T,file:e,ignoreReason:I,kind:"component",line:c+1,original:u,project:C,ref:S})}o=!1;continue}const w=ps.exec(f);if(w){const u=w[1]??"",$=/#(.*)$/.exec(f)?.[1]?.trim();let l=o?"vis-update-ignore-next-line":void 0;$&&te.test($)&&(l=l??"vis-update-ignore");const S=gs.exec(u);if(S){const v=S[2]??"",C=v.lastIndexOf("@");if(C>0){const T=v.slice(0,C),E=v.slice(C+1),I=T.lastIndexOf("/"),O=I>0?T.slice(0,I):T,P=I>0?T.slice(I+1):void 0;s.push({componentName:P,file:e,ignoreReason:l,kind:"component",line:c+1,original:v,project:O,ref:E})}}else{const v=ms.exec(u),C=hs.exec(u);v&&C&&s.push({file:e,ignoreReason:l,kind:"project",line:c+1,original:C[2]??"",project:v[2]??"",ref:C[2]??""})}o=!1;continue}m!==""&&!m.startsWith("#")&&!vs.test(f)&&(o=!1)}return{images:i,includes:s}},Be=/^(?:\.git|node_modules|\.pnpm-store|\.turbo|\.nx|dist|build|\.cache)$/,ks=e=>{const t=[],n=[];if(!U(e))return{images:n,includes:t};const s=r=>{let o;try{o=z(r)}catch{return}const{images:a,includes:p}=ws(r,o);t.push(...p),n.push(...a)};for(const r of[".gitlab-ci.yml",".gitlab-ci.yaml"]){const o=L(e,r);U(o)&&s(o)}const i=L(e,".gitlab");if(U(i))for(const r of X(i,{includeDirs:!1,includeSymlinks:!1,skip:[Be]}))(r.name.endsWith(".yml")||r.name.endsWith(".yaml"))&&s(r.path);for(const r of X(e,{includeDirs:!1,includeSymlinks:!1,maxDepth:2,skip:[Be]}))cs(r.name)&&!n.some(o=>o.file===r.path)&&!t.some(o=>o.file===r.path)&&s(r.path);return{images:n,includes:t}},Le=(e,t)=>{for(const n of t)try{if(new RegExp(n).test(e))return!0}catch{if(e.includes(n))return!0}return!1},bs=(e,t,n)=>{const s=e.indexOf("/");return s>0&&e.slice(0,s).includes(".")?`https://${e.slice(0,s)}/${e.slice(s+1)}/-/releases/${t}`:`${n}/${e}/-/releases/${t}`},Rs=async(e,t)=>{const{ignoreRules:n,imageReferences:s,includes:i,options:r,registryOptions:o,resolverOptions:a}=t,p=[],c=[],d=[];if(s.length>0){const w=await it(e,{ignoreRules:n,options:r,references:s,registryOptions:o});for(const u of w.updates)p.push({...u,ecosystem:"gitlab"});for(const u of w.ignored)c.push({...u,ecosystem:"gitlab"});d.push(...w.failed)}if(i.length===0)return{failed:d,ignored:c,updates:p};const f=new is({apiBase:a?.apiBase,fetch:a?.fetch,token:r.gitlabToken??a?.token}),m=a?.apiBase??"https://gitlab.com",g=new Map;for(const w of i){const u=g.get(w.project)??[];u.push(w),g.set(w.project,u)}const h=Math.max(1,r.maxConcurrentRequests),b=[...g.keys()];let k=0;const y=async w=>{const u=g.get(w)??[];let $;try{$=await f.listTags(w)}catch{for(const l of u)d.push({file:l.file,reason:`failed to list tags for ${w}`});return}if($.error){for(const l of u)d.push({file:l.file,reason:`failed to list tags for ${w}: ${$.error}`});return}for(const l of u){const S=l.kind==="component"&&l.componentName?`${l.project}/${l.componentName}`:l.project;let v;l.ignoreReason?v=l.ignoreReason:Le(S,r.exclude)?v="matched --exclude":r.include.length>0&&!Le(S,r.include)?v="not matched by --include":r.respectDependabotConfig&&n&&ve(S,"gitlab",n)&&(v="ignored by dependabot/renovate config");const C=O=>({currentRef:l.ref,currentVersion:l.ref,ecosystem:"gitlab",file:l.file,ignored:!0,line:l.line,name:S,newRef:l.ref,newVersion:void 0,original:l.original,reason:O,replacement:l.original,updateType:"unknown"});if(v){c.push(C(v));continue}const T=W(l.ref);if(!T&&!r.includeBranches){c.push(C("branch reference (use --include-branches)"));continue}if(!T&&r.mode!=="latest"){c.push(C(`branch ref has no version baseline for --target=${r.mode}`));continue}const E=we($.parsed,T,r.mode);if(!E)continue;let I;l.kind==="component"?I=`${l.componentName?`${l.project}/${l.componentName}`:l.project}@${E.raw}`:I=E.raw,p.push({currentRef:l.ref,currentVersion:T?.raw??l.ref,ecosystem:"gitlab",file:l.file,line:l.line,name:S,newRef:E.raw,newVersion:E.raw,original:l.original,replacement:I,updateType:ke(T,E),url:bs(l.project,E.raw,m)})}},A=[];for(let w=0;w<Math.min(h,b.length);w++)A.push((async()=>{for(;k<b.length;){const u=b[k];k+=1,u!==void 0&&await y(u)}})());return await Promise.all(A),{failed:d,ignored:c,updates:p}},Es={disabled:new Set,exclude:[],githubToken:void 0,gitlabToken:void 0,include:[],includeBranches:!1,maxConcurrentRequests:8,minAgeDays:void 0,mode:"latest",respectDependabotConfig:!0,style:"sha"},ot=async e=>{const t={...Es,...e.options,disabled:e.options?.disabled??new Set},n=t.respectDependabotConfig?vn(e.workspaceRoot):void 0,s={actions:{failed:[],ignored:[],updates:[]},docker:{failed:[],ignored:[],updates:[]},gitlab:{failed:[],ignored:[],updates:[]}},i=[];let r=0;if(!t.disabled.has("actions")){const c=jn(e.workspaceRoot);c.length>0&&(r+=1,i.push(Vn(e.workspaceRoot,{ignoreRules:n,options:t,references:c}).then(d=>{s.actions=d})))}if(!t.disabled.has("docker")){const c=es(e.workspaceRoot);c.length>0&&(r+=1,i.push(it(e.workspaceRoot,{ignoreRules:n,options:t,references:c}).then(d=>{s.docker=d})))}if(!t.disabled.has("gitlab")){const{images:c,includes:d}=ks(e.workspaceRoot);c.length+d.length>0&&(r+=1,i.push(Rs(e.workspaceRoot,{ignoreRules:n,imageReferences:c,includes:d,options:t}).then(f=>{s.gitlab=f})))}await Promise.all(i);const o=[...s.actions.updates,...s.docker.updates,...s.gitlab.updates],a=[...s.actions.ignored,...s.docker.ignored,...s.gitlab.ignored];return{failed:[...s.actions.failed,...s.docker.failed,...s.gitlab.failed],ignored:a,perEcosystem:s,scanned:r,updates:o}},xs={actions:"GitHub Actions",docker:"Docker",gitlab:"GitLab CI"},ye=e=>e.updateType==="major",As=e=>{switch(e){case"major":return K;case"minor":return _;case"patch":return qe;default:return Ke}},Pe=e=>{const t=As(e.updateType),n=e.currentVersion??e.currentRef,s=e.newVersion??e.newRef,i=e.url?` ${M(e.url)}`:"",r=e.advisories&&e.advisories.length>0?` ${K(`⚠ ${String(e.advisories.length)} advisor${e.advisories.length===1?"y":"ies"}`)}`:"";return` ${t(e.updateType.padEnd(7))} ${e.name} ${M(n)} → ${s}${r}${i}`},Ve=e=>!e.advisories||e.advisories.length===0?[]:e.advisories.map(t=>` ${t.severity==="CRITICAL"||t.severity==="HIGH"?K(t.severity):_(t.severity)} ${t.id} ${M(t.summary)}`),Ss=(e,t)=>{const n=[],s=e.updates.length;if(s===0&&e.scanned===0)return"";if(s===0){if(e.failed.length===0&&e.ignored.length===0)return n.push(`${qe("✓")} All ecosystem references up to date.`),n.join(`
|
|
6
|
+
`);if(n.push(`${_("⚠")} No actionable updates found.`),e.failed.length>0){n.push(`
|
|
7
|
+
${_("Failed lookups:")}`);for(const r of e.failed)n.push(` ${r.file}: ${r.reason}`)}if(t.showIgnored&&e.ignored.length>0){n.push(`
|
|
8
|
+
${M("Ignored:")}`);for(const r of e.ignored)n.push(` ${M(r.name)} ${M(r.reason??"")}`)}return n.join(`
|
|
9
|
+
`)}n.push(`
|
|
10
|
+
${Ke("Ecosystem updates")} — ${String(s)} reference${s===1?"":"s"} can be bumped:`);const i=e.updates.filter(r=>ye(r));if(i.length>0){n.push(`
|
|
11
|
+
${K(vt(`⚠ Breaking changes (${String(i.length)})`))}`),n.push(` ${M("Review release notes before applying — these cross a major-version boundary.")}`);for(const r of i)n.push(Pe(r)),n.push(...Ve(r))}for(const r of Object.keys(e.perEcosystem)){const o=e.perEcosystem[r];if(o.updates.length!==0){n.push(`
|
|
12
|
+
${xs[r]} (${String(o.updates.length)})`);for(const a of o.updates)n.push(Pe(a)),n.push(...Ve(a))}}if(t.showIgnored&&e.ignored.length>0){n.push(`
|
|
13
|
+
${M("Ignored:")}`);for(const r of e.ignored)n.push(` ${M(r.name)} ${M(r.reason??"")}`)}if(e.failed.length>0){n.push(`
|
|
14
|
+
${_("Failed lookups:")}`);for(const r of e.failed)n.push(` ${r.file}: ${r.reason}`)}return t.previewOnly&&n.push(`
|
|
15
|
+
${_("ℹ")} ${M("Not applied automatically — re-run with `--interactive` to choose which to apply, or `--yes` to apply all.")}`),n.join(`
|
|
16
|
+
`)},Cs=e=>JSON.stringify({ecosystems:{failed:e.failed,ignored:e.ignored,perEcosystem:e.perEcosystem,scanned:e.scanned,updates:e.updates}},void 0,2),Ts=()=>{const e=We({input:process.stdin,output:process.stdout});return{ask:t=>new Promise(n=>{e.question(t,s=>{n(s.trim())})}),close:()=>{e.close()},write:t=>{process.stdout.write(`${t}
|
|
17
|
+
`)}}},Is=(e,t)=>e.split(",").map(n=>Number.parseInt(n.trim(),10)-1).filter(n=>Number.isInteger(n)&&n>=0&&n<t),Os=async(e,t=Ts())=>{if(e.length===0)return t.close(),[];t.write(""),t.write("Outdated ecosystem references:");for(const[i,r]of e.entries()){const o=r.currentVersion??r.currentRef,a=r.newVersion??r.newRef,p=ye(r)?" [BREAKING]":"";t.write(` ${String(i+1)}. [${r.ecosystem}] ${r.name}: ${o} → ${a} (${r.updateType})${p}`)}t.write("");const s=(await t.ask("Apply updates? [a]ll / [s]afe / [n]one / numbers: ")).toLowerCase();if(s==="a"||s==="all")return t.close(),e;if(s==="s"||s==="safe")return t.close(),e.filter(i=>!ye(i));if(s==="n"||s==="none"||s==="")return t.close(),[];if(/^[\d ,]+$/.test(s)){const i=Is(s,e.length);return t.close(),i.map(r=>e[r]).filter(r=>r!==void 0)}return t.close(),[]},at=e=>{const t=e.trim();if(t==="")return;const n=/^(\d+(?:\.\d+)?)\s*([mhdw])?$/i.exec(t);if(!n)return;const s=Number.parseFloat(n[1]);if(!(!Number.isFinite(s)||s<0))switch((n[2]??"m").toLowerCase()){case"d":return s*60*24;case"h":return s*60;case"m":return s;case"w":return s*60*24*7;default:return}},_s=e=>{const t=e.trim();return/^\d+(?:\.\d+)?$/.test(t)?Number.parseFloat(t)*1440:at(t)},pr=e=>!Number.isFinite(e)||e<=0?"0m":e%1440===0?`${String(e/1440)}d`:e%60===0?`${String(e/60)}h`:`${String(e)}m`,be=(e,t)=>{try{switch(t){case"bun":{const n=L(e,"bunfig.toml");if(U(n)){const s=kt(n),i=s?.install?.minimumReleaseAge;return{excludes:Array.isArray(s?.install?.minimumReleaseAgeExcludes)?s.install.minimumReleaseAgeExcludes:void 0,minutes:typeof i=="number"?Math.round(i/60):void 0}}break}case"npm":{const n=L(e,".npmrc");if(U(n)){const s=z(n),i=/^\s*min-release-age\s*=\s*([^\s#;]+)/m.exec(s);return{minutes:i?_s(i[1]):void 0}}break}case"pnpm":{const n=L(e,"pnpm-workspace.yaml");if(U(n)){const s=Se(n);return{excludes:Array.isArray(s?.minimumReleaseAgeExclude)?s.minimumReleaseAgeExclude:void 0,minutes:typeof s?.minimumReleaseAge=="number"?s.minimumReleaseAge:void 0}}break}case"yarn":{const n=L(e,".yarnrc.yml");if(U(n)){const s=Se(n),i=s?.npmMinimalAgeGate,r=Array.isArray(s?.npmPreapprovedPackages)?s.npmPreapprovedPackages:void 0;if(typeof i=="string")return{excludes:r,minutes:at(i)};if(typeof i=="number")return{excludes:r,minutes:i}}break}default:break}}catch{}return{}},Ns={bun:"minimumReleaseAgeExcludes",pnpm:"minimumReleaseAgeExclude",yarn:"npmPreapprovedPackages"},ct={bun:"bunfig.toml minimumReleaseAgeExcludes",npm:".npmrc",pnpm:"pnpm-workspace.yaml minimumReleaseAgeExclude",yarn:".yarnrc.yml npmPreapprovedPackages"},lt=(e,t,n)=>{const s=be(t,e);if(typeof s.minutes!="number"||s.minutes<=0)return{added:[],unsupported:!1};if(!(e in Ns))return{added:[],unsupported:!0};const i=s.excludes??[],r=[...new Set(n)].filter(o=>!i.includes(o));return r.length===0?{added:[],unsupported:!1}:(qt(e,t,s.minutes,[...i,...r]),{added:r,unsupported:!1})},dt=(e,t,n)=>{n.added.length>0?e.info(`Added ${String(n.added.length)} package${n.added.length===1?"":"s"} to ${ct[t]??"the package manager config"} so --ignore-release-age versions install: ${n.added.join(", ")}`):n.unsupported&&e.warn(`${_("⚠")} npm has no per-package release-age exclude list, so vis can't exempt just the selected packages. Lower min-release-age in .npmrc or pass --min-release-age=0 to the install.`)},js=(e,t,n)=>{const s=e.latest?"latest":e.target??t.target??"latest";if(!["latest","minor","patch"].includes(s))throw new Error(`Invalid target "${s}". Use: latest, minor, or patch.`);const i=e.maxConcurrentRequests,r=typeof i=="number"&&i>0?i:t.maxConcurrentRequests,o=typeof e.releaseChannel=="string"?e.releaseChannel.toLowerCase():void 0;if(o!==void 0&&!["any","same","stable"].includes(o))throw new Error(`Invalid --release-channel "${String(e.releaseChannel)}". Use: any, same, or stable.`);const a=o??t.releaseChannel;return{exclude:[...F(e.exclude),...F(t.exclude)],ignore:F(t.ignore),include:[...F(e.include),...F(t.include),...n],includeLocked:e.includeLocked||t.includeLocked||!1,includePrerelease:e.prerelease||t.prerelease||!1,maxConcurrentRequests:r,minimumReleaseAge:t.minimumReleaseAge,minimumReleaseAgeExclude:t.minimumReleaseAgeExclude,packageMode:t.packageMode,releaseChannel:a,security:e.security===!1?!1:e.ai||(t.security??!0),target:s}},Me=(e,t)=>{if(e.length!==0){t.info(`
|
|
18
|
+
${_("⚠")} ${String(e.length)} package${e.length===1?"":"s"} skipped by target constraint (use --target latest to include):`);for(const n of e)t.info(` ${n.packageName} ${n.currentRange} → ${n.newRange} (${n.updateType})`)}},Fe=(e,t,n,s,i)=>{n==="json"?process.stdout.write(`${jt({checkedCount:0,failed:t,filteredByTarget:[],ignored:[],outdated:e})}
|
|
19
|
+
`):n==="minimal"?process.stdout.write(`${Dt(e)}
|
|
20
|
+
`):(Ut(e,s),s.info(Ye(e,i)))},Ge=async(e,t,n,s,i,r,o)=>{const a=Nt(e,n,t,!0,{useEditorconfig:o}),p=t==="pnpm"?"pnpm-workspace.yaml":"package.json";if(i.info(`
|
|
21
|
+
Updated ${p}`),a&&i.info(`Backup saved to ${a}`),s.changelog){i.info(`
|
|
22
|
+
Fetching changelogs...`);const c=await ze(n,void 0,r);for(const d of c){const f=d.releaseUrl??d.repoUrl??d.npmUrl;i.info(` ${d.packageName}: ${f}`)}}if(s["ignore-release-age"]===!0&&n.length>0&&dt(i,t,lt(t,e,n.map(c=>c.packageName))),s.install??!0){const c=t,d=["install"];i.info(`Running ${c} ${d.join(" ")}...
|
|
23
|
+
`);try{const{code:f,output:m}=await Je(c,d,{cwd:e,env:process.env});f!==0?i.warn(`${c} ${d.join(" ")} failed. You may need to run it manually.`):s.peer!==!0&&Xe(m)&&i.info(Qe)}catch{i.warn(`${c} ${d.join(" ")} failed. You may need to run it manually.`)}}},$e={applied:!1,canceled:!1,jsonEmitted:!1},Ds={actions:"GitHub Actions",docker:"Docker",gitlab:"GitLab CI"},Us={digest:"patch",major:"major",minor:"minor",patch:"patch",pin:"patch",unknown:"patch"},Bs=e=>({catalogName:Ds[e.ecosystem],currentRange:e.currentVersion??e.currentRef,detailUrl:e.url,displayName:e.name,kind:"ecosystem",newRange:e.newVersion??e.newRef,packageName:Qt(e),targetVersion:e.newVersion??e.newRef,updateType:Us[e.updateType]??"patch"}),Ls=async(e,t,n,s,i,r)=>{const o=n.update??{},a=[["global","--global is not supported in catalog mode"],["recursive","--recursive is not needed in catalog mode (catalogs are workspace-level)"],["filter","--filter is not supported in catalog mode (use --include/--exclude instead)"],["no-save","--no-save is not supported in catalog mode"],["workspace-root","--workspace-root is not needed in catalog mode"],["no-optional","--no-optional is not supported in catalog mode"]];for(const[x,j]of a)s[x]&&r.warn(`${_("⚠")} ${j}, ignoring.`);const p=s["ignore-release-age"]===!0,c=me("minReleaseAge")||p,{excludes:d,minutes:f}=c?{excludes:void 0,minutes:void 0}:be(e,t),m=c?void 0:o.minimumReleaseAge??f,g=c?void 0:o.minimumReleaseAgeExclude??d;if(p?r.info(`${_("⚠")} --ignore-release-age: selecting the latest versions regardless of minimumReleaseAge.`):c&&(o.minimumReleaseAge!==void 0||f!==void 0)&&r.info("minimumReleaseAge gate disabled via MARSHALL_DISABLE_MIN_RELEASE_AGE."),!c&&o.minimumReleaseAge!==void 0&&f!==void 0&&o.minimumReleaseAge!==f){const x=t==="pnpm"?"pnpm-workspace.yaml":"bunfig.toml";r.warn(`${_("⚠")} minimumReleaseAge mismatch: vis config = ${String(o.minimumReleaseAge)} min, ${x} = ${String(f)} min. Consider keeping them in sync.`)}const h=St(e),b=s["include-internal"],k=s.peer,y=Ct(e,t,{depFields:o.depFields,dev:s.dev,includeInternal:b,peer:k,prod:s.prod});if(y.size===0)return r.info("No catalogs found."),$e;const A={...o,minimumReleaseAge:m,minimumReleaseAgeExclude:g},w=js(s,A,i);let u=0;for(const x of y.values())u+=x.size;const $=!!process.stdout.isTTY&&!le;let l;const S=$?(x,j)=>{l?l.rerender(V.createElement(Ie,{current:x,total:j})):(process.stdout.write(`
|
|
24
|
+
`),l=Ce(V.createElement(Ie,{current:x,total:j}),{interactive:!0,patchConsole:!1}))}:(x,j)=>{r.info(`Checking ${String(x)}/${String(j)} dependencies...`)};$||r.info(`Checking ${String(u)} catalog dependencies...
|
|
25
|
+
`);const v=new Set;me("socket")&&v.add("socket"),me("depsDev")&&v.add("deps-dev");const C=n.security?.policies?.score?.minimum,T=Tt(n.security,{disabled:v,minimumScore:C}),{checkedCount:E,failed:I,filteredByTarget:O,ignored:P,outdated:N}=await It(y,w,h,S,e,T,n.security?.acceptedRisks);l&&(l.clear(),l.unmount());const Q=b?{ignored:[],outdated:[]}:Ot(e,{depFields:o.depFields,dev:s.dev,exclude:w.exclude,ignore:w.ignore,include:w.include,packageMode:w.packageMode,peer:k,prod:s.prod,target:w.target});if(Q.outdated.length>0){const x=new Set(N.map(j=>`${j.catalogName}|${j.packageName}`));for(const j of Q.outdated)x.has(`${j.catalogName}|${j.packageName}`)||N.push(j)}if(Q.ignored.length>0)for(const x of Q.ignored)P.includes(x)||P.push(x);const Re=E-N.length-I.length;if(I.length>0&&r.warn(`Failed to fetch: ${I.join(", ")}`),P.length>0&&r.info(`Skipped ${String(P.length)} ignored package${P.length===1?"":"s"}: ${P.join(", ")}`),!$&&E>N.length){const x=[...y.values()].reduce((Y,de)=>Y+de.size,0),j=x>E?` (${String(x)} catalog entries, ${String(x-E)} duplicates)`:"";r.info(`Checked ${String(E)} unique packages${j}: ${String(N.length)} outdated, ${String(Re)} up-to-date${I.length>0?`, ${String(I.length)} failed`:""}${O.length>0?`, ${String(O.length)} skipped by target`:""}`)}if(N.length===0)return O.length>0?r.info(`All catalog dependencies are up to date within the current target.
|
|
26
|
+
${String(O.length)} package${O.length===1?" has":"s have"} newer versions available with --target latest:
|
|
27
|
+
${O.map(x=>` ${x.packageName} ${x.currentRange} → ${x.newRange} (${x.updateType})`).join(`
|
|
28
|
+
`)}`):r.info("All catalog dependencies are up to date."),$e;const q=s.format??o.format??"table";let G;if(s.ai){const x=Bt(s.aiType??"impact");G=await Lt(N,r,n.ai,x)}const se=!!s.dryRun;if(!se&&i.length>0&&s.marshallCheck!==!1){const x=await Gt(i);if(x.length>0){const j=await Ht(x,{config:n?.security?.marshalls,workspaceRoot:e});if(!await Wt(j))return process.exitCode=1,{applied:!1,canceled:!0,jsonEmitted:!1}}}if($&&q==="table"){const x=new Map,j=[];let Y=!1;if(i.length===0){const R=ut(s,n);if(R.disabled.size<3)try{const D=await ot({options:R,workspaceRoot:e});Y=D.scanned>0;for(const B of D.updates){const J=Bs(B);x.set(J.packageName,B),j.push(J)}}catch(D){r.warn(`${_("⚠")} Ecosystem update scan failed: ${D.message}`)}}const de=new Jt([...N,...j],G??null);let ue;if(s.changelog){r.info("Fetching changelogs...");const R=await ze(N,void 0,h);ue=new Map;for(const D of R){const B=D.releaseUrl??D.repoUrl??D.npmUrl;B&&ue.set(D.packageName,B)}}const fe=n.tui?.autoExit??!1,pt=fe===!0?3:typeof fe=="number"?fe:0,Ee=await Ce(V.createElement(Xt,{autoExitSeconds:pt,changelogUrls:ue,checkedCount:E,filteredOutEntries:O,isDryRun:se,store:de,totalCatalogEntries:u}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),pe=process.stdout.columns||80;process.stdout.write(`
|
|
29
|
+
`);for(const R of N){const D=R.vulnerabilities?.length||R.socketReport&&R.socketReport.alerts.length>0,B=!!R.acceptedRisk,J=D?B?"✓":"⚠":"✓",mt=B?"gray":R.updateType==="major"?"red":R.updateType==="minor"?"yellow":"green",oe=R.socketReport?.score.overall,ht=oe===void 0?"":` [${String(Math.round(oe*100))}%]`,Ae=oe===void 0?void 0:Kt(oe);process.stdout.write(`${he(V.createElement(H,null," ",V.createElement(H,{color:mt},J),` ${R.packageName} ${R.currentRange} → ${R.newRange}`,V.createElement(H,{dimColor:!0},` ${R.updateType}`),Ae?V.createElement(H,{color:Ae},ht):null),{columns:pe})}
|
|
30
30
|
`)}if(process.stdout.write(`
|
|
31
|
-
`),
|
|
32
|
-
`);const
|
|
33
|
-
`);for(const
|
|
34
|
-
`)}const
|
|
35
|
-
Applying ${String(
|
|
36
|
-
`);const
|
|
37
|
-
`)}else
|
|
38
|
-
`),
|
|
39
|
-
`),
|
|
40
|
-
${
|
|
41
|
-
`),process.exitCode=
|
|
42
|
-
${
|
|
43
|
-
`),process.exitCode=
|
|
44
|
-
Continue? [y/N] `,
|
|
45
|
-
`);else if(
|
|
46
|
-
${
|
|
47
|
-
${
|
|
48
|
-
${String(
|
|
31
|
+
`),r.info(Ye(N,C)),E>N.length){const R=[...y.values()].reduce((B,J)=>B+J.size,0),D=R>E?` (${String(R)} catalog entries, ${String(R-E)} duplicates)`:"";r.log(),r.info(`Checked ${String(E)} unique packages${D}: ${String(Re)} up-to-date${I.length>0?`, ${String(I.length)} failed`:""}`)}if(O.length>0){process.stdout.write(`
|
|
32
|
+
`);const R=`${String(O.length)} package${O.length===1?"":"s"} skipped by target constraint (use --target latest to include):`;process.stdout.write(`${he(V.createElement(H,{color:"yellow"},` ${R}`),{columns:pe})}
|
|
33
|
+
`);for(const D of O)process.stdout.write(`${he(V.createElement(H,null," ",V.createElement(H,{dimColor:!0},D.packageName),` ${D.currentRange} → ${D.newRange}`,V.createElement(H,{dimColor:!0},` ${D.updateType}`)),{columns:pe})}
|
|
34
|
+
`)}const re=Array.isArray(Ee)?Ee:[],ie=re.filter(R=>R.kind!=="ecosystem"),xe=re.filter(R=>R.kind==="ecosystem").map(R=>x.get(R.packageName)).filter(R=>R!==void 0);if(!se&&re.length>0){if(ie.length>0){r.info(`
|
|
35
|
+
Applying ${String(ie.length)} catalog update${ie.length===1?"":"s"}...
|
|
36
|
+
`);const R={...s,install:s.install??o.install};await Ge(e,t,ie,R,r,h,n.editorconfig??!0)}if(xe.length>0){const{applied:R,skipped:D}=nt(xe);R.length>0&&r.info(`${String(R.length)} ecosystem reference${R.length===1?"":"s"} updated.`);for(const B of D)r.warn(`${_("⚠")} Skipped ${B.update.name} (${B.update.file}): ${B.reason}`)}return{applied:!0,canceled:!1,ecosystemHandled:Y,jsonEmitted:!1}}return{applied:!1,canceled:re.length===0,ecosystemHandled:Y,jsonEmitted:!1}}if(se){if(q==="json"){const x={failed:I,filteredByTarget:O,ignored:P,outdated:N};G&&(x.aiAnalysis=G),process.stdout.write(`${JSON.stringify(x,void 0,2)}
|
|
37
|
+
`)}else r.info(`Would update ${String(N.length)} dependencies:
|
|
38
|
+
`),Fe(N,I,q,r,C),G&&(r.info(""),r.info(Te(G))),Me(O,r);return{applied:!1,canceled:!1,jsonEmitted:q==="json"}}G&&q!=="json"&&(r.info(Te(G)),r.info(""));let Z=N;if(s.interactive&&(Z=await _t(N),Z.length===0))return r.info("No updates selected."),{applied:!1,canceled:!0,jsonEmitted:!1};r.info(`Updating ${String(Z.length)} catalog dependencies...
|
|
39
|
+
`),Fe(Z,[],q,r,C),Me(O,r);const ft={...s,install:s.install??o.install};return await Ge(e,t,Z,ft,r,h),{applied:!0,canceled:!1,jsonEmitted:q==="json"}},Ps=async(e,t,n,s,i,r)=>{if(s["ignore-release-age"]===!0){const d=be(e,t),f=typeof d.minutes=="number"&&d.minutes>0;if(f&&i.length>0){const m=i.map(g=>Ze(g).name);dt(r,t,lt(t,e,m))}else f&&r.warn(`${_("⚠")} --ignore-release-age without package names can't pre-exempt packages in pm-wrapper mode (vis doesn't know which will change). Pass explicit package names, use catalog mode, or lower the gate in ${ct[t]??"your package manager config"}.`)}const o={dev:s.dev,filters:F(s.filter),global:s.global,interactive:s.interactive,latest:s.latest||s.target==="latest",noOptional:s.optional===!1,noSave:s.save===!1,packages:i,prod:s.prod,recursive:s.recursive,workspaceRoot:s.workspaceRoot},{command:a,warnings:p}=fn(t,n,o);for(const d of p)r.warn(d);const c=`${a.bin} ${a.args.join(" ")}`.trim();if(s.dryRun)return r.info(`Would run: ${c}`),$e;r.info(`Running: ${c}`);try{const{code:d,output:f}=await Je(a.bin,a.args,{cwd:e,env:process.env});if(d!==0)return r.error(`
|
|
40
|
+
${K("✖")} Update failed (exit code ${String(d)})`),r.error(` Command: ${c}`),r.error(` Directory: ${e}
|
|
41
|
+
`),process.exitCode=d,{applied:!1,canceled:!1,jsonEmitted:!1};s.peer!==!0&&Xe(f)&&r.info(Qe)}catch(d){const m=d.status??1;return r.error(`
|
|
42
|
+
${K("✖")} Update failed (exit code ${String(m)})`),r.error(` Command: ${c}`),r.error(` Directory: ${e}
|
|
43
|
+
`),process.exitCode=m,{applied:!1,canceled:!1,jsonEmitted:!1}}return{applied:!0,canceled:!1,jsonEmitted:!1}},Vs=async(e,t,n)=>{const s=e.latest===!0||e.target==="latest";if(t||!s||e.dryRun===!0||e.yes===!0||e.interactive===!0)return!0;if(!(!!process.stdout.isTTY&&!le))return n.error(`${K("✖")} Refusing to run blanket --latest update in a non-interactive context.`),n.error(" Re-run with --yes to confirm, --dry-run to preview, or pass explicit package names."),process.exitCode=1,!1;const r=We({input:process.stdin,output:process.stdout});try{const a=(await new Promise(c=>{r.question(`${_("⚠")} About to upgrade ALL dependencies to their latest versions. This may include breaking changes.
|
|
44
|
+
Continue? [y/N] `,c)})).trim().toLowerCase();return a==="y"||a==="yes"?!0:(n.info("Aborted."),!1)}finally{r.close()}},ut=(e,t)=>{const n=new Set;e.actions===!1&&n.add("actions"),e.docker===!1&&n.add("docker"),e.gitlab===!1&&n.add("gitlab");const s=e.style??"sha";if(s!=="sha"&&s!=="preserve")throw new Error(`Invalid --style "${s}". Use: sha or preserve.`);const i=e.latest===!0?"latest":e.target??"latest";if(i!=="latest"&&i!=="minor"&&i!=="patch")throw new Error(`Invalid target "${i}". Use: latest, minor, or patch.`);const r=i,o=t.update??{};return{disabled:n,exclude:[...F(e.exclude),...F(o.exclude)],githubToken:e.actionsToken??void 0,gitlabToken:e.gitlabToken??void 0,include:F(e.include),includeBranches:e.includeBranches===!0,maxConcurrentRequests:typeof e.maxConcurrentRequests=="number"&&e.maxConcurrentRequests>0?e.maxConcurrentRequests:8,minAgeDays:typeof o.minimumReleaseAge=="number"&&o.minimumReleaseAge>0?o.minimumReleaseAge/1440:void 0,mode:r,respectDependabotConfig:!0,style:s}},Ms=(e,t)=>e.dryRun===!0||process.exitCode!==void 0&&process.exitCode!==0||t.canceled?!1:e.yes===!0?!0:e.interactive===!0&&!!process.stdout.isTTY&&!le,Fs=async(e,t,n,s,i)=>{const r=ut(t,n);if(r.disabled.size===3)return;let a;try{a=await ot({options:r,workspaceRoot:e})}catch(h){s.warn(`${_("⚠")} Ecosystem update scan failed: ${h.message}`);return}if(a.scanned===0)return a;const p=t.format??"table",c=!!t.dryRun,d=Ms(t,i);if(p==="json")i.jsonEmitted?s.warn(`${_("⚠")} ${String(a.updates.length)} ecosystem update${a.updates.length===1?"":"s"} available but not emitted in --format=json (catalog already wrote one JSON document). Rerun with --format=table or --no-catalog to see them.`):process.stdout.write(`${Cs(a)}
|
|
45
|
+
`);else if(p!=="minimal"){const h=Ss(a,{previewOnly:!d&&!c,showIgnored:t.interactive===!0});h&&s.info(h)}if(a.updates.length===0)return a;if(c)return p==="minimal"&&s.info(`
|
|
46
|
+
${_("ℹ")} ${String(a.updates.length)} ecosystem reference${a.updates.length===1?"":"s"} can be bumped — not applied (--dry-run). Re-run without --dry-run and with \`--interactive\` or \`--yes\` to apply.`),a;if(!d)return p==="minimal"&&s.info(`
|
|
47
|
+
${_("ℹ")} ${String(a.updates.length)} ecosystem reference${a.updates.length===1?"":"s"} can be bumped — not applied automatically. Re-run with \`--interactive\` to choose, or \`--yes\` to apply all (or \`--no-actions\` / \`--no-docker\` / \`--no-gitlab\` to silence by ecosystem).`),a;let f=a.updates;if(t.interactive===!0&&process.stdout.isTTY&&!le&&(f=await Os(a.updates),f.length===0))return s.info(`${_("ℹ")} No ecosystem updates selected.`),a;const{applied:m,skipped:g}=nt(f);if(m.length>0&&s.info(`
|
|
48
|
+
${String(m.length)} ecosystem reference${m.length===1?"":"s"} updated.`),g.length>0){s.warn(`${_("⚠")} ${String(g.length)} ecosystem update${g.length===1?"":"s"} skipped:`);for(const h of g)s.warn(` ${h.update.name} (${h.update.file}:${String(h.update.line)}): ${h.reason}`)}return a},Gs=e=>{const t=e.style;if(t!==void 0&&t!=="sha"&&t!=="preserve")throw new Error(`Invalid --style "${t}". Use: sha or preserve.`);const n=e.target;if(n!==void 0&&n!=="latest"&&n!=="minor"&&n!=="patch")throw new Error(`Invalid --target "${n}". Use: latest, minor, or patch.`)},mr=async({argument:e,logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!i)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");Gs(n);let r=e;const o=i,{packageManager:a}=bt(o);if(n.typosquatCheck!==!1){if(r.length>0){const f=r.map(h=>Ze(h)),m=s?.security?.typosquatAllowlist,g=await zt(f.map(h=>h.name),m);if(!g.ok){process.exitCode=1;return}r=f.map((h,b)=>{const k=g.packages[b];return k!==h.name?h.versionSpec?`${k}@${h.versionSpec}`:k??"":r[b]??""})}else if(!await Yt(o,s?.security?.typosquatAllowlist)){process.exitCode=1;return}}if(n.rollback){if(!Et(o,a)){t.info("No backup found. Run 'vis update' first to create a backup.");return}if(xt(o,a))t.info("Restored from backup.");else throw new Error("Failed to restore from backup.");return}if(!await Vs(n,r.length>0,t))return;const c=n.catalog!==!1&&At(o,a);let d;if(c)d=await Ls(o,a,s??{},n,r,t);else{const f=Vt(o,{backend:Mt(Ft({logger:t,options:n,visConfig:s},o)),configBackend:s?.install?.backend,configCorepack:s?.install?.corepack}),m=f.name==="aube"?"":Rt(f.name);d=await Ps(o,f.name,m,n,r,t)}r.length===0&&d.ecosystemHandled!==!0&&await Fs(o,n,s??{},t,d)};export{lt as addReleaseAgeExcludesForInstall,mr as default,pr as formatMinutesAsTimeString,_s as parseNpmReleaseAgeValue,at as parseTimeStringToMinutes,be as readPmNativeMinimumReleaseAge,Vs as requireBlanketUpdateConfirmation,Fs as runEcosystemUpdate,Ms as shouldApplyEcosystem};
|