@visulima/vis 5.0.0 → 6.0.0
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 +101 -0
- package/LICENSE.md +151 -88
- package/README.md +2 -2
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +16 -18
- package/dist/packem_chunks/CONFIG_FILES.js +4 -4
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +61 -51
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +202 -176
- package/dist/packem_chunks/dart-plan.js +1 -1
- package/dist/packem_chunks/dart-projects.js +1 -1
- package/dist/packem_chunks/dispatch.js +1 -1
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +4 -4
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- 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 +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +2 -2
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler26.js +3 -3
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler39.js +6 -6
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +2 -2
- package/dist/packem_chunks/handler51.js +1 -1
- package/dist/packem_chunks/handler53.js +1 -1
- package/dist/packem_chunks/handler54.js +1 -1
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler58.js +1 -1
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler60.js +7 -7
- package/dist/packem_chunks/handler61.js +2 -2
- package/dist/packem_chunks/handler62.js +2 -2
- package/dist/packem_chunks/handler63.js +1 -1
- package/dist/packem_chunks/handler64.js +2 -2
- package/dist/packem_chunks/handler65.js +3 -3
- package/dist/packem_chunks/handler66.js +2 -2
- package/dist/packem_chunks/handler67.js +31 -20
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +4 -4
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +5 -5
- package/dist/packem_chunks/handler71.js +1 -1
- package/dist/packem_chunks/handler72.js +1 -1
- package/dist/packem_chunks/handler73.js +1 -1
- package/dist/packem_chunks/handler74.js +1 -1
- package/dist/packem_chunks/handler75.js +36 -36
- package/dist/packem_chunks/handler76.js +1 -1
- package/dist/packem_chunks/handler77.js +3 -3
- package/dist/packem_chunks/handler78.js +24 -24
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +40 -7
- package/dist/packem_chunks/index2.js +32 -32
- package/dist/packem_chunks/index6.js +1 -1
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +3 -4
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/orchestrator.js +1 -1
- package/dist/packem_chunks/prompts.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/ts-loader.js +5 -5
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/{affected-selection-BJXJW_3Q.js → affected-selection-DDxwjwM4.js} +1 -1
- package/dist/packem_shared/{affected-shas-B_kfSKss.js → affected-shas-BuaWvmsG.js} +1 -1
- package/dist/packem_shared/{ai-fix-BC6aIRJT.js → ai-fix-C2BhFFhi.js} +5 -5
- package/dist/packem_shared/{augment-B9kSZuvW.js → augment-CxUPE8KX.js} +1 -1
- package/dist/packem_shared/{bin-Dx8mjl3g.js → bin-Be7_QhQK.js} +1 -1
- package/dist/packem_shared/{build-scripts-CEDx_nJp.js → build-scripts-DxyVSkgM.js} +1 -1
- package/dist/packem_shared/command-runtime-BXvH5EC0.js +1 -0
- package/dist/packem_shared/{dart-pubspec-BK_cK2EP.js → dart-pubspec-DvmyleIr.js} +2 -2
- package/dist/packem_shared/{dependency-scan-B8jroa1D.js → dependency-scan-DKK3ZEZI.js} +1 -1
- package/dist/packem_shared/{docker-DXqV-07f.js → docker-BTuwdXaC.js} +1 -1
- package/dist/packem_shared/{ecosystem-gate-CeV20GSB.js → ecosystem-gate-BpQNUJzN.js} +1 -1
- package/dist/packem_shared/{env-consistency-Dt_uDbSP.js → env-consistency-CUBJHENL.js} +1 -1
- package/dist/packem_shared/{failure-log-D2x5BT8S.js → failure-log-kp0n2rbD.js} +1 -1
- package/dist/packem_shared/{formatBytes-BHAzNIrn-CrusHOew.js → formatBytes-BHAzNIrn-DRcKvqnb.js} +1 -1
- package/dist/packem_shared/{index-BzhrR_iC.js → index-BdMIfGVZ.js} +15 -15
- package/dist/packem_shared/index-C9ENZqH9.js +39 -0
- package/dist/packem_shared/{index-nEyN71oX.js → index-DQfNpt2u.js} +1 -1
- package/dist/packem_shared/{index-C_ScJMpb.js → index-DsSWb5XH.js} +1 -1
- package/dist/packem_shared/{index.server-sXNQYpsl.js → index.server-D8BLnYZO.js} +2 -2
- package/dist/packem_shared/{isAccessibleSync-DYKTrrvc-C-_5cgwu.js → isAccessibleSync-DYKTrrvc-BwaMhQs0.js} +1 -1
- package/dist/packem_shared/{lifecycle-D6PMPor-.js → lifecycle-BAhkhE2L.js} +1 -1
- package/dist/packem_shared/{lockfile-CiUtEbnt.js → lockfile-DHmlPGk1.js} +1 -1
- package/dist/packem_shared/{manifests-Du4yKlf_.js → manifests-Dd4Hoztt.js} +1 -1
- package/dist/packem_shared/{min-release-age-JViyQuBM.js → min-release-age-BJnOQaoF.js} +1 -1
- package/dist/packem_shared/{missing-package-json-Cu5YVAot.js → missing-package-json-DfzrGwe1.js} +1 -1
- package/dist/packem_shared/{multi-eco-lockfiles-B2X3yhyo.js → multi-eco-lockfiles-BIa6xvJc.js} +1 -1
- package/dist/packem_shared/{native-config-sync-TdTWjVgI.js → native-config-sync-Dr9XvxOf.js} +1 -1
- package/dist/packem_shared/osv-bloom-t40ra5U5.js +2 -0
- package/dist/packem_shared/{package-version-CiRZecQu.js → package-version-CFuNUWDG.js} +2 -2
- package/dist/packem_shared/{packument-Df46y5MY.js → packument-C9nRiBJf.js} +1 -1
- package/dist/packem_shared/pm-runner-ImwtpnWY.js +1 -0
- package/dist/packem_shared/{project-name-filter-CH8Ih7Qr.js → project-name-filter-C2rkW-Vn.js} +1 -1
- package/dist/packem_shared/{provenance-DKeR0Ig1.js → provenance-DF-ypZj3.js} +1 -1
- package/dist/packem_shared/{readJsonSync-CbryXYxN-EWl7_7KX.js → readJsonSync-CbryXYxN-Bm5i10UW.js} +1 -1
- package/dist/packem_shared/{registry-keys-DwB3ZXS_.js → registry-keys-BLuHOyZu.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-BmV8YBE-.js → resolve-explicit-BDaQRR6o.js} +1 -1
- package/dist/packem_shared/resolve-runtime-Cr19Pk6L.js +1 -0
- package/dist/packem_shared/{run-file-UBukWaha.js → run-file-XbRCF6Mp.js} +1 -1
- package/dist/packem_shared/{runtime-check-1U8HrQd9.js → runtime-check-Bh5q9IrT.js} +1 -1
- package/dist/packem_shared/{s1ngularity-DZhkIqL4.js → s1ngularity-UCZN7skW.js} +1 -1
- package/dist/packem_shared/{scan-progress-CkumcBG-.js → scan-progress-DcYI76zE.js} +1 -1
- package/dist/packem_shared/{selectors-edwcgNl3.js → selectors-DCiEU0iv.js} +2 -2
- package/dist/packem_shared/{signatures-BxTMck2l.js → signatures-CicxPHN4.js} +1 -1
- package/dist/packem_shared/target-merge-BClIXg2k.js +14 -0
- package/dist/packem_shared/{target-options-DsHFmRZH.js → target-options-PgWIuJnb.js} +1 -1
- package/dist/packem_shared/{task-env-DzR4RkOj.js → task-env-Dl08aklA.js} +1 -1
- package/dist/packem_shared/toolchain-DvUxlbDz.js +5 -0
- package/dist/packem_shared/{typosquats-8u0drCqQ.js → typosquats-DxPzyK7u.js} +1 -1
- package/dist/packem_shared/{verify-B_MblU_Q.js → verify-CadR9PUk.js} +1 -1
- package/dist/packem_shared/{vis-update-app-BCIccZfA.js → vis-update-app-DrFWQyPn.js} +1 -1
- package/dist/packem_shared/{vis-user-error-Dd7hwxlW.js → vis-user-error-k7CLTpA4.js} +15 -15
- package/dist/packem_shared/{watch-CcTketln.js → watch-Dr_6yz3o.js} +1 -1
- package/dist/packem_shared/watch-loop-BId9vT7Q.js +11 -0
- package/dist/packem_shared/{writeFileSync-DJoHk3Ks-BPRoepNw.js → writeFileSync-DJoHk3Ks-Dhem3Uof.js} +1 -1
- package/dist/release/core/version-actions/index.d.ts +1 -1
- package/dist/release/presets.d.ts +1 -55
- package/dist/release/presets.js +1 -1
- package/dist/release/types.d.ts +1 -18
- package/dist/runtime/preload.js +1 -1
- package/index.d.ts +204 -204
- package/index.js +26 -26
- package/package.json +10 -10
- package/schemas/vis-config.schema.json +6 -28
- package/schemas/vis-release-config.schema.json +1 -12
- package/dist/packem_shared/Table-BB8xHTU5-BLPS917D.js +0 -11
- package/dist/packem_shared/command-runtime-p4IXiIf6.js +0 -1
- package/dist/packem_shared/index-BisalDCf.js +0 -39
- package/dist/packem_shared/osv-bloom-BCAX5ARR.js +0 -2
- package/dist/packem_shared/pm-runner-3iiQayy-.js +0 -1
- package/dist/packem_shared/resolve-runtime-CNiHcVtx.js +0 -1
- package/dist/packem_shared/target-merge-DVJl-7Qz.js +0 -4
- package/dist/packem_shared/toolchain-BRdpaAC4.js +0 -5
- package/dist/packem_shared/watch-loop-BBkg02-Q.js +0 -11
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import{createRequire as gt}from"node:module";import{J as qe,b as
|
|
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"])ye(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];ye(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)ye(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},we=(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),ke=(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]},be=(e,t)=>!e||!t?"unknown":t.major!==e.major?"major":t.minor!==e.minor?"minor":t.patch!==e.patch?"patch":"unknown",kn="GitHub Actions",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=Et(e);if(!nn(n))return t;const s=new Map;for(const r of t){const o=r.currentVersion??r.currentRef;o&&s.set(he(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=xt([o],{ecosystem:kn,workspaceRoot:e}).get(he(o.name,o.version));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(he(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&&we(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=ke($.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:be(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
|
|
1
|
+
import{createRequire as gt}from"node:module";import{J as qe,b as O,F as M,q as ze,X as z,j as wt}from"../packem_shared/index.server-D8BLnYZO.js";import{e as P,a as K,z as vt}from"../packem_shared/index-BdMIfGVZ.js";import{l as Ce,f as kt}from"./ts-loader.js";import{O as bt,ao as Rt,c as me,q as Te}from"./cli-main.js";import{r as Et,M as he,V as xt,L as X,W as At,Y as St,Z as Ct,m as Tt,a as It,i as _t,n as Ot,_ as Nt,$ as Ke,R as V,O as ge,o as H,u as Ye,a0 as jt,t as F,a1 as Ut,a2 as Dt,v as Bt,w as Pt}from"./catalog.js";import{i as le}from"../packem_shared/index-BjdW45xX.js";import{v as Lt,r as Vt,f as Ie}from"../packem_shared/ai-analysis-pldoS_N4.js";import{p as Mt,a as Ft,s as Je}from"../packem_shared/pm-runner-ImwtpnWY.js";import{a as Gt,r as Ht}from"../packem_shared/command-runtime-BXvH5EC0.js";import{r as Wt,a as qt,p as zt}from"../packem_shared/resolve-explicit-BDaQRR6o.js";import{s as Kt}from"../packem_shared/min-release-age-BJnOQaoF.js";import{s as Yt}from"../packem_shared/formatBytes-BHAzNIrn-DRcKvqnb.js";import{r as Jt,s as Xt}from"../packem_shared/typosquats-DxPzyK7u.js";import{U as Qt,V as Zt,C as _e,e as en}from"../packem_shared/vis-update-app-DrFWQyPn.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{y as tn}from"../packem_shared/index-C9ENZqH9.js";import{y as D}from"../packem_shared/isAccessibleSync-DYKTrrvc-BwaMhQs0.js";import{s as ne}from"../packem_shared/index-B4AjSxHU.js";import{U as rn}from"../packem_shared/writeFileSync-DJoHk3Ks-Dhem3Uof.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:nn,realpathSync:sn}=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,n)=>{const s=[];if(n.global&&e!=="aube")return{command:{args:["update","--global",...n.packages],bin:"npm"},warnings:s};let i;switch(e){case"aube":{const r=Mt(n);i={args:r.args,bin:r.bin},s.push(...r.warnings);break}case"bun":{i=dn(n);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)},fn=e=>{switch(e){case"docker":case"docker-compose":return"docker";case"github-actions":return"actions";case"gitlab-ci":return"gitlab";default:return}},pn=(e,t)=>{const n=[".github/dependabot.yml",".github/dependabot.yaml"];for(const s of n){const i=P(e,s);if(!D(i))continue;let r;try{r=tn(K(i))}catch{continue}if(r?.updates){for(const o of r.updates){const a=fn(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}}},mn=Object.freeze({"docker-compose":"docker",dockerfile:"docker","github-actions":"actions",gitlabci:"gitlab","gitlabci-include":"gitlab"}),hn=Object.freeze({docker:"docker","github-tags":"actions"}),ye=(e,t)=>{if(t)for(const n of t)typeof n=="string"&&n.length>0&&e.add(et(n))},gn=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},yn=(e,t)=>{const n=["renovate.json","renovate.json5",".renovaterc",".renovaterc.json"];for(const s of n){const i=P(e,s);if(!D(i))continue;let r;try{const a=K(i);r=JSON.parse(gn(a))}catch{continue}if(!r)continue;if(Array.isArray(r.ignoreDeps))for(const a of["actions","docker","gitlab"])ye(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];ye(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=mn[d];f&&p.add(f)}for(const d of a.matchDatasources??[]){const f=hn[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)ye(t[d],c)}return}},$n=e=>{const t={actions:new Set,docker:new Set,gitlab:new Set};return pn(e,t),yn(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),ke=(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]},be=(e,t)=>!e||!t?"unknown":t.major!==e.major?"major":t.minor!==e.minor?"minor":t.patch!==e.patch?"patch":"unknown",vn="GitHub Actions",kn=e=>({fixedVersions:e.fixedVersions,id:e.id,severity:e.severity,summary:e.summary}),bn=(e,t)=>{if(t.length===0)return t;const n=Et(e);if(!nn(n))return t;const s=new Map;for(const r of t){const o=r.currentVersion??r.currentRef;o&&s.set(he(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=xt([o],{ecosystem:vn,workspaceRoot:e}).get(he(o.name,o.version));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(he(r.name,o));return a?{...r,advisories:a.map(p=>kn(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 Rn{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 En=".github/workflows",xn=".github/actions",An=/^\s*-?\s*uses:\s*(['"]?)([^'"\s#]+)\1(?:\s*#\s*(.+))?\s*$/,Sn=/^[a-f0-9]{40}$/i,Cn=/actions-up-ignore-next-line(?::\s*(.+))?/i,Tn=/actions-up-ignore-start/i,In=/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}},On=(e,t)=>{const n=t.split(/\r?\n/),s=[];let i,r=!1;for(const[o,a]of n.entries()){const p=a??"";if(Tn.test(p)&&(r=!0),In.test(p)){r=!1;continue}const c=p.trim(),f=c===""||c.startsWith("#")?Cn.exec(p):void 0;if(f){i=f[1]??"actions-up-ignore-next-line";continue}const m=An.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),v=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:Sn.test(v),line:o+1,original:`${h}${b}${h}`,owner:u.owner,quote:h,ref:v,repo:u.repo,slug:A,subpath:u.subpath,trailingComment:k&&!$?k:void 0})}return s},Oe=e=>e.endsWith(".yml")||e.endsWith(".yaml"),Nn=(e,t=[])=>{const n=[],s=new Set,i=a=>{if(s.has(a))return;s.add(a);let p;try{p=K(a)}catch{return}const c=On(a,p);n.push(...c)},r=P(e,En);if(D(r))for(const a of X(r,{includeDirs:!1,includeSymlinks:!1,maxDepth:1}))Oe(a.name)&&i(a.path);const o=P(e,xn);if(D(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=P(e,a);D(p)&&i(p)}for(const a of t){const p=vt(a)?a:P(e,a);if(D(p))for(const c of X(p,{includeDirs:!1,includeSymlinks:!1}))Oe(c.name)&&i(c.path)}return n},jn=40,Un=1440*60*1e3,Dn=new Set(["develop","edge","main","master","stable","trunk"]),Bn=e=>e.length===jn&&/^[a-f0-9]{40}$/i.test(e)?!1:Dn.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}`},Ln=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 Rn({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}`,v=d.get(A)??[];v.push(y),d.set(A,v)}const f=Math.max(1,s.maxConcurrentRequests),m=[...d.keys()];let g=0;const h=async y=>{const A=d.get(y)??[],[v,u]=y.split("/");if(!v||!u)return;let $;try{$=await c.listTags(v,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 w;if(l.ignoreReason?w=l.ignoreReason:Ne(S,s.exclude)?w="matched --exclude":s.include.length>0&&!Ne(S,s.include)?w="not matched by --include":s.respectDependabotConfig&&n&&ve(S,"actions",n)&&(w="ignored by dependabot/renovate config"),w){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:w,replacement:l.original,updateType:"unknown"});continue}if(!s.includeBranches&&!l.isSha&&Bn(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=ke($.parsed,T,s.mode);if(!E)continue;if(s.minAgeDays!==void 0){const L=await c.resolveRef(v,u,E.sha),N=L?.committedAt?new Date(L.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,_=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:_,updateType:be(T,E),url:`https://github.com/${v}/${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=bn(e,o);return{failed:p,ignored:a,updates:k}},Vn=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=Vn(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=K(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/),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=sn.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&&we($,"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=ke(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:be(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&&we(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=ke($.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:be(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"},$e=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(`${
|
|
7
|
-
${
|
|
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 Mn{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=Gn(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 Fn=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},Gn=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 Fn(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??""}},Hn="docker.io",Wn="sha256:",ae=e=>{const t=e.trim();if(t===""||t.startsWith("$")||t.includes("${")||t.includes("$("))return;let n=t,s;const i=n.indexOf(`@${Wn}`);i!==-1&&(s=n.slice(i+1),n=n.slice(0,i));let r=Hn,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("#")},qn=/^\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=qn.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},Kn=/^\s*image:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,Yn=(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[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")},Jn=e=>{const t=e.toLowerCase();return/^(?:docker-)?compose(?:\..+)?\.ya?ml$/.test(t)},Xn=new Set([".cache",".git",".nx",".pnpm-store",".turbo","build","dist","node_modules"]),Qn=/(?:^|\/)(?:\.git|node_modules|\.pnpm-store|\.turbo|\.nx|dist|build|\.cache)(?:\/|$)/,Zn=e=>{const t=[];if(!D(e))return t;const n=new Set,s=(i,r)=>{let o;try{o=sn.native(i)}catch{o=i}if(n.has(o))return;n.add(o);let a;try{a=K(i)}catch{return}t.push(...r==="dockerfile"?zn(i,a):Yn(i,a))};for(const i of X(e,{includeDirs:!1,includeSymlinks:!1,skip:[Qn]})){const{name:r}=i;Xn.has(r)||(je(r)?s(i.path,"dockerfile"):Jn(r)&&s(i.path,"compose"))}for(const i of["Dockerfile","dockerfile","compose.yml","compose.yaml","docker-compose.yml","docker-compose.yaml"]){const r=P(e,i);D(r)&&s(r,je(i)?"dockerfile":"compose")}return t},es=864e5,Ue=(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},De=e=>{const t=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return e.registry==="docker.io"?t:`${e.registry}/${t}`},ts=e=>e.digest!==void 0&&e.digest.length>0,ns=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}`},ss=(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 Mn({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 v;try{v=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 ${De(u)}`});return}for(const u of y){const $=De(u);let l;if(u.ignoreReason?l=u.ignoreReason:Ue($,s.exclude)?l="matched --exclude":s.include.length>0&&!Ue($,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(ts(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 w=ke(v.parsed,S,s.mode);if(!w)continue;if(s.minAgeDays!==void 0&&w.lastUpdated!==void 0&&(Date.now()-w.lastUpdated)/es<s.minAgeDays){a.push({currentRef:u.tag,currentVersion:u.tag,ecosystem:"docker",file:u.file,ignored:!0,line:u.line,name:$,newRef:w.raw,newVersion:w.raw,original:u.original,reason:`release younger than ${String(s.minAgeDays)} days`,replacement:u.original,updateType:"unknown"});continue}const C=w.raw,T=ss(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:be(S,w),url:ns(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 rs{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 is=/vis-update-ignore-next-line/i,te=/vis-update-ignore(?:\s|$|:)/i,os=new Set([".gitlab-ci.yaml",".gitlab-ci.yml"]),as=e=>os.has(e)||e.endsWith(".gitlab-ci.yml")||e.endsWith(".gitlab-ci.yaml"),cs=/^\s*-?\s*project:\s*(['"]?)([^'"\s#]+)\1(?:\s*#.*)?$/,ls=/^\s*ref:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,ds=/^\s*-?\s*component:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,us=/^\s*image:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,fs=/^\s*(?:-\s*)?(?:include:\s*)?\{([^}]*)\}\s*(?:#.*)?$/,ps=/project:\s*(['"]?)([^'"\s,}]+)\1/,ms=/ref:\s*(['"]?)([^'"\s,}]+)\1/,hs=/component:\s*(['"]?)([^'"\s,}]+)\1/,gs=/^(\s*-\s*name:\s*)(['"]?)([^'"\s#]+)\2(\s*#.*)?$/,ys=/^(\s*-\s*)(['"]?)([^'"\s#:]+:[^'"\s#]+)\2(\s*#.*)?$/,$s=/^\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(is.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=us.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=gs.exec(f),$=u?void 0:ys.exec(f),l=u??$;if(l){const S=l[3]??"",w=ae(S);if(w){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({...w,file:e,ignoreReason:T,kind:"compose",line:c+1})}}}const k=cs.exec(f);if(k){r={line:c+1,project:k[2]??""};continue}const y=ls.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=ds.exec(f);if(A){const u=A[2]??"",$=u.lastIndexOf("@");if($>0){const l=u.slice(0,$),S=u.slice($+1),w=l.lastIndexOf("/"),C=w>0?l.slice(0,w):l,T=w>0?l.slice(w+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 v=fs.exec(f);if(v){const u=v[1]??"",$=/#(.*)$/.exec(f)?.[1]?.trim();let l=o?"vis-update-ignore-next-line":void 0;$&&te.test($)&&(l=l??"vis-update-ignore");const S=hs.exec(u);if(S){const w=S[2]??"",C=w.lastIndexOf("@");if(C>0){const T=w.slice(0,C),E=w.slice(C+1),I=T.lastIndexOf("/"),_=I>0?T.slice(0,I):T,L=I>0?T.slice(I+1):void 0;s.push({componentName:L,file:e,ignoreReason:l,kind:"component",line:c+1,original:w,project:_,ref:E})}}else{const w=ps.exec(u),C=ms.exec(u);w&&C&&s.push({file:e,ignoreReason:l,kind:"project",line:c+1,original:C[2]??"",project:w[2]??"",ref:C[2]??""})}o=!1;continue}m!==""&&!m.startsWith("#")&&!$s.test(f)&&(o=!1)}return{images:i,includes:s}},Be=/^(?:\.git|node_modules|\.pnpm-store|\.turbo|\.nx|dist|build|\.cache)$/,vs=e=>{const t=[],n=[];if(!D(e))return{images:n,includes:t};const s=r=>{let o;try{o=K(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=P(e,r);D(o)&&s(o)}const i=P(e,".gitlab");if(D(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]}))as(r.name)&&!n.some(o=>o.file===r.path)&&!t.some(o=>o.file===r.path)&&s(r.path);return{images:n,includes:t}},Pe=(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},ks=(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}`},bs=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 v=await it(e,{ignoreRules:n,options:r,references:s,registryOptions:o});for(const u of v.updates)p.push({...u,ecosystem:"gitlab"});for(const u of v.ignored)c.push({...u,ecosystem:"gitlab"});d.push(...v.failed)}if(i.length===0)return{failed:d,ignored:c,updates:p};const f=new rs({apiBase:a?.apiBase,fetch:a?.fetch,token:r.gitlabToken??a?.token}),m=a?.apiBase??"https://gitlab.com",g=new Map;for(const v of i){const u=g.get(v.project)??[];u.push(v),g.set(v.project,u)}const h=Math.max(1,r.maxConcurrentRequests),b=[...g.keys()];let k=0;const y=async v=>{const u=g.get(v)??[];let $;try{$=await f.listTags(v)}catch{for(const l of u)d.push({file:l.file,reason:`failed to list tags for ${v}`});return}if($.error){for(const l of u)d.push({file:l.file,reason:`failed to list tags for ${v}: ${$.error}`});return}for(const l of u){const S=l.kind==="component"&&l.componentName?`${l.project}/${l.componentName}`:l.project;let w;l.ignoreReason?w=l.ignoreReason:Pe(S,r.exclude)?w="matched --exclude":r.include.length>0&&!Pe(S,r.include)?w="not matched by --include":r.respectDependabotConfig&&n&&ve(S,"gitlab",n)&&(w="ignored by dependabot/renovate config");const C=_=>({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:_,replacement:l.original,updateType:"unknown"});if(w){c.push(C(w));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=ke($.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:be(T,E),url:ks(l.project,E.raw,m)})}},A=[];for(let v=0;v<Math.min(h,b.length);v++)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}},Rs={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={...Rs,...e.options,disabled:e.options?.disabled??new Set},n=t.respectDependabotConfig?$n(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=Nn(e.workspaceRoot);c.length>0&&(r+=1,i.push(Ln(e.workspaceRoot,{ignoreRules:n,options:t,references:c}).then(d=>{s.actions=d})))}if(!t.disabled.has("docker")){const c=Zn(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}=vs(e.workspaceRoot);c.length+d.length>0&&(r+=1,i.push(bs(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}},Es={actions:"GitHub Actions",docker:"Docker",gitlab:"GitLab CI"},$e=e=>e.updateType==="major",xs=e=>{switch(e){case"major":return z;case"minor":return O;case"patch":return qe;default:return ze}},Le=e=>{const t=xs(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?` ${z(`⚠ ${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"?z(t.severity):O(t.severity)} ${t.id} ${M(t.summary)}`),As=(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(`${O("⚠")} No actionable updates found.`),e.failed.length>0){n.push(`
|
|
7
|
+
${O("Failed lookups:")}`);for(const r of e.failed)n.push(` ${r.file}: ${r.reason}`)}if(t.showIgnored&&e.ignored.length>0){n.push(`
|
|
8
8
|
${M("Ignored:")}`);for(const r of e.ignored)n.push(` ${M(r.name)} ${M(r.reason??"")}`)}return n.join(`
|
|
9
9
|
`)}n.push(`
|
|
10
|
-
${
|
|
11
|
-
${
|
|
12
|
-
${
|
|
10
|
+
${ze("Ecosystem updates")} — ${String(s)} reference${s===1?"":"s"} can be bumped:`);const i=e.updates.filter(r=>$e(r));if(i.length>0){n.push(`
|
|
11
|
+
${z(wt(`⚠ 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(Le(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
|
+
${Es[r]} (${String(o.updates.length)})`);for(const a of o.updates)n.push(Le(a)),n.push(...Ve(a))}}if(t.showIgnored&&e.ignored.length>0){n.push(`
|
|
13
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
|
-
${
|
|
15
|
-
${
|
|
16
|
-
`)},
|
|
17
|
-
`)}}},
|
|
18
|
-
${
|
|
14
|
+
${O("Failed lookups:")}`);for(const r of e.failed)n.push(` ${r.file}: ${r.reason}`)}return t.previewOnly&&n.push(`
|
|
15
|
+
${O("ℹ")} ${M("Not applied automatically — re-run with `--interactive` to choose which to apply, or `--yes` to apply all.")}`),n.join(`
|
|
16
|
+
`)},Ss=e=>JSON.stringify({ecosystems:{failed:e.failed,ignored:e.ignored,perEcosystem:e.perEcosystem,scanned:e.scanned,updates:e.updates}},void 0,2),Cs=()=>{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
|
+
`)}}},Ts=(e,t)=>e.split(",").map(n=>Number.parseInt(n.trim(),10)-1).filter(n=>Number.isInteger(n)&&n>=0&&n<t),Is=async(e,t=Cs())=>{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=$e(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=>!$e(i));if(s==="n"||s==="none"||s==="")return t.close(),[];if(/^[\d ,]+$/.test(s)){const i=Ts(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)},ur=e=>!Number.isFinite(e)||e<=0?"0m":e%1440===0?`${String(e/1440)}d`:e%60===0?`${String(e/60)}h`:`${String(e)}m`,Re=(e,t)=>{try{switch(t){case"bun":{const n=P(e,"bunfig.toml");if(D(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=P(e,".npmrc");if(D(n)){const s=K(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=P(e,"pnpm-workspace.yaml");if(D(n)){const s=Ce(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=P(e,".yarnrc.yml");if(D(n)){const s=Ce(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{}},Os={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=Re(t,e);if(typeof s.minutes!="number"||s.minutes<=0)return{added:[],unsupported:!1};if(!(e in Os))return{added:[],unsupported:!0};const i=s.excludes??[],r=[...new Set(n)].filter(o=>!i.includes(o));return r.length===0?{added:[],unsupported:!1}:(Kt(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(`${O("⚠")} 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.`)},Ns=(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
|
+
${O("⚠")} ${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(`${Dt({checkedCount:0,failed:t,filteredByTarget:[],ignored:[],outdated:e})}
|
|
19
19
|
`):n==="minimal"?process.stdout.write(`${Bt(e)}
|
|
20
|
-
`):(
|
|
20
|
+
`):(Pt(e,s),s.info(Ye(e,i)))},Ge=async(e,t,n,s,i,r,o)=>{const a=Ut(e,n,t,!0,{useEditorconfig:o}),p=t==="pnpm"?"pnpm-workspace.yaml":"package.json";if(i.info(`
|
|
21
21
|
Updated ${p}`),a&&i.info(`Backup saved to ${a}`),s.changelog){i.info(`
|
|
22
|
-
Fetching changelogs...`);const c=await
|
|
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.`)}}},
|
|
24
|
-
`),l=Te(V.createElement(
|
|
25
|
-
`);const
|
|
26
|
-
${String(
|
|
27
|
-
${
|
|
28
|
-
`)}`):r.info("All catalog dependencies are up to date."),
|
|
29
|
-
`);for(const R of N){const
|
|
22
|
+
Fetching changelogs...`);const c=await Ke(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.`)}}},we={applied:!1,canceled:!1,jsonEmitted:!1},js={actions:"GitHub Actions",docker:"Docker",gitlab:"GitLab CI"},Us={digest:"patch",major:"major",minor:"minor",patch:"patch",pin:"patch",unknown:"patch"},Ds=e=>({catalogName:js[e.ecosystem],currentRange:e.currentVersion??e.currentRef,detailUrl:e.url,displayName:e.name,kind:"ecosystem",newRange:e.newVersion??e.newRef,packageName:en(e),targetVersion:e.newVersion??e.newRef,updateType:Us[e.updateType]??"patch"}),Bs=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(`${O("⚠")} ${j}, ignoring.`);const p=s["ignore-release-age"]===!0,c=me("minReleaseAge")||p,{excludes:d,minutes:f}=c?{excludes:void 0,minutes:void 0}:Re(e,t),m=c?void 0:o.minimumReleaseAge??f,g=c?void 0:o.minimumReleaseAgeExclude??d;if(p?r.info(`${O("⚠")} --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(`${O("⚠")} minimumReleaseAge mismatch: vis config = ${String(o.minimumReleaseAge)} min, ${x} = ${String(f)} min. Consider keeping them in sync.`)}const h=Tt(e),b=s["include-internal"],k=s.peer,y=It(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."),we;const A={...o,minimumReleaseAge:m,minimumReleaseAgeExclude:g},v=Ns(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(_e,{current:x,total:j})):(process.stdout.write(`
|
|
24
|
+
`),l=Te(V.createElement(_e,{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 w=new Set;me("socket")&&w.add("socket"),me("depsDev")&&w.add("deps-dev");const C=n.security?.policies?.score?.minimum,T=_t(n.security,{disabled:w,minimumScore:C}),{checkedCount:E,failed:I,filteredByTarget:_,ignored:L,outdated:N}=await Ot(y,v,h,S,e,T,n.security?.acceptedRisks);l&&(l.clear(),l.unmount());const Q=b?{ignored:[],outdated:[]}:Nt(e,{depFields:o.depFields,dev:s.dev,exclude:v.exclude,ignore:v.ignore,include:v.include,packageMode:v.packageMode,peer:k,prod:s.prod,target:v.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)L.includes(x)||L.push(x);const Ee=E-N.length-I.length;if(I.length>0&&r.warn(`Failed to fetch: ${I.join(", ")}`),L.length>0&&r.info(`Skipped ${String(L.length)} ignored package${L.length===1?"":"s"}: ${L.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(Ee)} up-to-date${I.length>0?`, ${String(I.length)} failed`:""}${_.length>0?`, ${String(_.length)} skipped by target`:""}`)}if(N.length===0)return _.length>0?r.info(`All catalog dependencies are up to date within the current target.
|
|
26
|
+
${String(_.length)} package${_.length===1?" has":"s have"} newer versions available with --target latest:
|
|
27
|
+
${_.map(x=>` ${x.packageName} ${x.currentRange} → ${x.newRange} (${x.updateType})`).join(`
|
|
28
|
+
`)}`):r.info("All catalog dependencies are up to date."),we;const q=s.format??o.format??"table";let G;if(s.ai){const x=Lt(s.aiType??"impact");G=await Vt(N,r,n.ai,x)}const se=!!s.dryRun;if(!se&&i.length>0&&s.marshallCheck!==!1){const x=await Wt(i);if(x.length>0){const j=await qt(x,{config:n?.security?.marshalls,workspaceRoot:e});if(!await zt(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 U=await ot({options:R,workspaceRoot:e});Y=U.scanned>0;for(const B of U.updates){const J=Ds(B);x.set(J.packageName,B),j.push(J)}}catch(U){r.warn(`${O("⚠")} Ecosystem update scan failed: ${U.message}`)}}const de=new Qt([...N,...j],G??null);let ue;if(s.changelog){r.info("Fetching changelogs...");const R=await Ke(N,void 0,h);ue=new Map;for(const U of R){const B=U.releaseUrl??U.repoUrl??U.npmUrl;B&&ue.set(U.packageName,B)}}const fe=n.tui?.autoExit??!1,pt=fe===!0?3:typeof fe=="number"?fe:0,xe=await Te(V.createElement(Zt,{autoExitSeconds:pt,changelogUrls:ue,checkedCount:E,filteredOutEntries:_,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 U=R.vulnerabilities?.length||R.socketReport&&R.socketReport.alerts.length>0,B=!!R.acceptedRisk,J=U?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))}%]`,Se=oe===void 0?void 0:Yt(oe);process.stdout.write(`${ge(V.createElement(H,null," ",V.createElement(H,{color:mt},J),` ${R.packageName} ${R.currentRange} → ${R.newRange}`,V.createElement(H,{dimColor:!0},` ${R.updateType}`),Se?V.createElement(H,{color:Se},ht):null),{columns:pe})}
|
|
30
30
|
`)}if(process.stdout.write(`
|
|
31
|
-
`),r.info(Ye(N,C)),E>N.length){const R=[...y.values()].reduce((B,J)=>B+J.size,0),
|
|
32
|
-
`);const R=`${String(
|
|
33
|
-
`);for(const
|
|
31
|
+
`),r.info(Ye(N,C)),E>N.length){const R=[...y.values()].reduce((B,J)=>B+J.size,0),U=R>E?` (${String(R)} catalog entries, ${String(R-E)} duplicates)`:"";r.log(),r.info(`Checked ${String(E)} unique packages${U}: ${String(Ee)} up-to-date${I.length>0?`, ${String(I.length)} failed`:""}`)}if(_.length>0){process.stdout.write(`
|
|
32
|
+
`);const R=`${String(_.length)} package${_.length===1?"":"s"} skipped by target constraint (use --target latest to include):`;process.stdout.write(`${ge(V.createElement(H,{color:"yellow"},` ${R}`),{columns:pe})}
|
|
33
|
+
`);for(const U of _)process.stdout.write(`${ge(V.createElement(H,null," ",V.createElement(H,{dimColor:!0},U.packageName),` ${U.currentRange} → ${U.newRange}`,V.createElement(H,{dimColor:!0},` ${U.updateType}`)),{columns:pe})}
|
|
34
34
|
`)}const re=Array.isArray(xe)?xe:[],ie=re.filter(R=>R.kind!=="ecosystem"),Ae=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
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(Ae.length>0){const{applied:R,skipped:
|
|
36
|
+
`);const R={...s,install:s.install??o.install};await Ge(e,t,ie,R,r,h,n.editorconfig??!0)}if(Ae.length>0){const{applied:R,skipped:U}=nt(Ae);R.length>0&&r.info(`${String(R.length)} ecosystem reference${R.length===1?"":"s"} updated.`);for(const B of U)r.warn(`${O("⚠")} 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:_,ignored:L,outdated:N};G&&(x.aiAnalysis=G),process.stdout.write(`${JSON.stringify(x,void 0,2)}
|
|
37
37
|
`)}else r.info(`Would update ${String(N.length)} dependencies:
|
|
38
|
-
`),Fe(N,I,q,r,C),G&&(r.info(""),r.info(Ie(G))),Me(
|
|
39
|
-
`),Fe(Z,[],q,r,C),Me(
|
|
40
|
-
${
|
|
38
|
+
`),Fe(N,I,q,r,C),G&&(r.info(""),r.info(Ie(G))),Me(_,r);return{applied:!1,canceled:!1,jsonEmitted:q==="json"}}G&&q!=="json"&&(r.info(Ie(G)),r.info(""));let Z=N;if(s.interactive&&(Z=await jt(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(_,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=Re(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(`${O("⚠")} --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}=un(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}`),we;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
|
+
${z("✖")} Update failed (exit code ${String(d)})`),r.error(` Command: ${c}`),r.error(` Directory: ${e}
|
|
41
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
|
-
${
|
|
43
|
-
`),process.exitCode=m,{applied:!1,canceled:!1,jsonEmitted:!1}}return{applied:!0,canceled:!1,jsonEmitted:!1}},
|
|
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}},
|
|
45
|
-
`);else if(p!=="minimal"){const h=
|
|
46
|
-
${
|
|
47
|
-
${
|
|
48
|
-
${String(m.length)} ecosystem reference${m.length===1?"":"s"} updated.`),g.length>0){s.warn(`${
|
|
42
|
+
${z("✖")} 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}},Ls=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(`${z("✖")} 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(`${O("⚠")} 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}},Vs=(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,Ms=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(`${O("⚠")} Ecosystem update scan failed: ${h.message}`);return}if(a.scanned===0)return a;const p=t.format??"table",c=!!t.dryRun,d=Vs(t,i);if(p==="json")i.jsonEmitted?s.warn(`${O("⚠")} ${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(`${Ss(a)}
|
|
45
|
+
`);else if(p!=="minimal"){const h=As(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
|
+
${O("ℹ")} ${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
|
+
${O("ℹ")} ${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 Is(a.updates),f.length===0))return s.info(`${O("ℹ")} 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(`${O("⚠")} ${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},Fs=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.`)},fr=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.");Fs(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 Jt(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 Xt(o,s?.security?.typosquatAllowlist)){process.exitCode=1;return}}if(n.rollback){if(!At(o,a)){t.info("No backup found. Run 'vis update' first to create a backup.");return}if(St(o,a))t.info("Restored from backup.");else throw new Error("Failed to restore from backup.");return}if(!await Ls(n,r.length>0,t))return;const c=n.catalog!==!1&&Ct(o,a);let d;if(c)d=await Bs(o,a,s??{},n,r,t);else{const f=Ft(o,{backend:Gt(Ht({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 Ms(o,n,s??{},t,d)};export{lt as addReleaseAgeExcludesForInstall,fr as default,ur as formatMinutesAsTimeString,_s as parseNpmReleaseAgeValue,at as parseTimeStringToMinutes,Re as readPmNativeMinimumReleaseAge,Ls as requireBlanketUpdateConfirmation,Ms as runEcosystemUpdate,Vs as shouldApplyEcosystem};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as wt}from"node:module";import{
|
|
1
|
+
import{createRequire as wt}from"node:module";import{b as x,m as nt,U as yt,z as it,e as P,q as Tt}from"../packem_shared/index-BdMIfGVZ.js";import{F as m,X as E,o as b,z as vt,l as St}from"./catalog.js";import at from"./index.js";import{x as ot}from"../packem_shared/main-CgDAlZkm.js";import{y as B}from"../packem_shared/isAccessibleSync-DYKTrrvc-BwaMhQs0.js";import{q as $t}from"./cli-main.js";import{l as At}from"../packem_shared/spinner-ukDEdGvp.js";import{C as ct,D as F,T as dt}from"../packem_shared/symbols-BXDZ_sKt.js";import{b as z,F as C,q as D,X as L,J as It}from"../packem_shared/index.server-D8BLnYZO.js";import{withEnhancedPath as Mt}from"@visulima/task-runner";let mt;const kt=t=>(mt??=wt(import.meta.url))(t),I=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,G=t=>{if(typeof I<"u"&&I.versions&&I.versions.node){const[e,s]=I.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return I.getBuiltinModule(t)}return kt(t)},{readFileSync:bt,writeFileSync:xt,unlinkSync:Ct}=G("node:fs"),{randomBytes:Et}=G("node:crypto"),{availableParallelism:V}=G("node:os");class A extends Error{constructor(e,s){super(e,s),this.name=this.constructor.name}}class Rt extends A{}class T extends A{}class W extends A{}class R extends A{stderr;constructor(e,s,r){super(e,r),this.stderr=s}}class X extends A{}class $ extends A{commandTitle;constructor(e,s,r){super(s,r),this.commandTitle=e}}const lt=t=>t.includes("/"),O=(t,e)=>e?t.toLowerCase():t,jt=(t,e,s,r={})=>{const n=lt(t),i=r.caseInsensitive===!0,c=O(t,i),a=[];for(const o of e){const l=n?x(s,o):nt(o);at(c,O(l,i))&&a.push(o)}return a},_t=(t,e,s,r={})=>{if(!e||e.length===0)return[...t];const n=r.caseInsensitive===!0;return t.filter(i=>{for(const c of e){const a=lt(c)?x(s,i):nt(i),o=O(c,n);if(at(o,O(a,n)))return!1}return!0})},q=t=>typeof t=="object"&&t!==null&&typeof t.title=="string"&&typeof t.task=="function",_=t=>typeof t=="object"&&t!==null&&typeof t.command=="string"&&typeof t.task!="function",Pt=(t,e)=>{const s=x(t,e);return s===""||!s.startsWith("..")&&!it(s)},Ft=(t,e)=>{let s;for(const r of e)Pt(r,t)&&(s===void 0||r.length>s.length)&&(s=r);return s},Ot=async t=>{let e=0,s=0;const r=()=>(e+=1,`pattern-${e}`),n=()=>(s+=1,`cmd-${s}`),i=(o,l,f,d)=>{if(o.perPackage===!0){const u=t.workspacePackages??[],g=new Map;for(const h of f){const w=Ft(h,u)??t.cwd,k=g.get(w)??[];k.push(x(w,h)),g.set(w,k)}for(const h of[...g.keys()].sort()){const w=x(t.cwd,h)||".";d.push({command:o.command,cwd:h,files:g.get(h)??[],id:n(),source:"string",title:`${o.command} — ${w}`})}return}if(o.cwd!==void 0){const u=yt(t.cwd,o.cwd);d.push({command:o.command,cwd:u,files:f,id:n(),source:"string",title:`${o.command} — ${x(t.cwd,u)||"."}`});return}d.push({command:o.command,files:l,id:n(),source:"string",title:o.command})},c=async(o,l,f,d)=>{if(typeof o=="string"){d.push({command:o,files:l,id:n(),source:"string",title:o});return}if(Array.isArray(o)){for(const u of o)await c(u,l,f,d);return}if(_(o)){i(o,l,f,d);return}if(typeof o=="function"){const u=await o([...l]);if(typeof u=="string"){d.push({command:u,files:l,id:n(),source:"function",title:u});return}if(Array.isArray(u)){for(const g of u)if(typeof g=="string")d.push({command:g,files:l,id:n(),source:"function",title:g});else if(_(g))i(g,l,f,d);else if(q(g))d.push({files:l,id:n(),run:g.task,source:"custom",title:g.title});else throw new T("Task function returned an array with an unsupported entry — expected strings, { command, … }, or { title, task }.");return}if(_(u)){i(u,l,f,d);return}if(q(u)){d.push({files:l,id:n(),run:u.task,source:"custom",title:u.title});return}throw new T("Task function returned an unsupported value — expected string, string[], { command, … }, or { title, task }.")}if(q(o)){d.push({files:l,id:n(),run:o.task,source:"custom",title:o.title});return}throw new T("Unsupported task value — expected string, string[], function, { command, … }, or { title, task }.")},a=[];for(const[o,l]of Object.entries(t.config)){const f=jt(o,t.files,t.cwd,{caseInsensitive:t.caseInsensitive===!0});if(f.length===0)continue;const d=t.relative?f.map(g=>x(t.cwd,g)):f,u=[];await c(l,d,f,u),u.length!==0&&a.push({commands:u,files:d,id:r(),pattern:o,title:`${o} — ${f.length} file${f.length===1?"":"s"}`})}return a},Nt=async t=>{if(t.config!==void 0)return t.config;throw new T(`No staged config provided. Add \`staged\` to your vis.config.ts:
|
|
2
2
|
|
|
3
3
|
import { defineConfig } from "@visulima/vis/config";
|
|
4
4
|
|