@visulima/vis 6.1.2 → 6.1.4
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 +31 -0
- package/LICENSE.md +0 -29
- package/dashboard/dist/index.html +10 -10
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +16 -10
- package/dist/generate/index.d.ts +25 -0
- package/dist/packem_chunks/CONFIG_FILES.js +6 -7
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog2.js +7 -7
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +129 -129
- package/dist/packem_chunks/dispatch.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 +5 -5
- 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 +1 -1
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler22.js +1 -1
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +1 -1
- 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 +2 -2
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler32.js +1 -1
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler40.js +1 -1
- package/dist/packem_chunks/handler46.js +1 -1
- 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/handler52.js +1 -1
- package/dist/packem_chunks/handler53.js +1 -1
- package/dist/packem_chunks/handler54.js +2 -2
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler56.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 +4 -4
- package/dist/packem_chunks/handler61.js +2 -2
- package/dist/packem_chunks/handler62.js +1 -1
- package/dist/packem_chunks/handler63.js +2 -61
- package/dist/packem_chunks/handler64.js +61 -6
- package/dist/packem_chunks/handler65.js +6 -8
- package/dist/packem_chunks/handler66.js +8 -2
- package/dist/packem_chunks/handler67.js +2 -28
- package/dist/packem_chunks/handler68.js +28 -12
- package/dist/packem_chunks/handler69.js +12 -25
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +25 -22
- package/dist/packem_chunks/handler71.js +22 -10
- package/dist/packem_chunks/handler72.js +10 -133
- package/dist/packem_chunks/handler73.js +133 -23
- package/dist/packem_chunks/handler74.js +23 -323
- package/dist/packem_chunks/handler75.js +274 -659
- package/dist/packem_chunks/handler76.js +13 -13
- package/dist/packem_chunks/handler77.js +12 -12
- package/dist/packem_chunks/handler78.js +1 -1
- package/dist/packem_chunks/handler79.js +69 -67
- 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 +1 -1
- package/dist/packem_chunks/html.js +707 -0
- package/dist/packem_chunks/index4.js +1 -1
- package/dist/packem_chunks/index6.js +57 -51
- package/dist/packem_chunks/index7.js +2 -2
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/run.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 +1 -1
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/{ReleaseClient-CWD9BC5w.js → ReleaseClient-CRuCHDsT.js} +1 -1
- package/dist/packem_shared/advisories-DHGJ6XhP.js +1 -0
- package/dist/packem_shared/affected-selection-DCT4CLex.js +1 -0
- package/dist/packem_shared/{affected-shas-B_kfSKss.js → affected-shas-CycHU3nr.js} +1 -1
- package/dist/packem_shared/{ai-analysis-BCJ1kuDM.js → ai-analysis-CO4rT3Nd.js} +1 -1
- package/dist/packem_shared/ai-cache-Dkb6me20.js +1 -0
- package/dist/packem_shared/{ai-fix-DIMErSws.js → ai-fix-C0OBhGDq.js} +1 -1
- package/dist/packem_shared/{augment-B9kSZuvW.js → augment-BSeqaai8.js} +1 -1
- package/dist/packem_shared/{bin-BcLTer1k.js → bin-DwACrJUJ.js} +1 -1
- package/dist/packem_shared/build-scripts-BeMIA-_q.js +1 -0
- package/dist/packem_shared/{command-runtime-HSsYGCQd.js → command-runtime-DG49t2MT.js} +1 -1
- package/dist/packem_shared/{dependency-scan-D_v3KM59.js → dependency-scan-D8e370_h.js} +1 -1
- package/dist/packem_shared/detect-C-9o_BPB.js +1 -0
- package/dist/packem_shared/{docker-DXqV-07f.js → docker-vRDm2lHX.js} +1 -1
- package/dist/packem_shared/{ecosystem-gate-CwsTc7YW.js → ecosystem-gate-DpO43yAS.js} +1 -1
- package/dist/packem_shared/env-BymuoTL8.js +4 -0
- package/dist/packem_shared/env-consistency-BDfAa56d.js +1 -0
- package/dist/packem_shared/{failure-log-DIsKBKaI.js → failure-log-BslhfaEO.js} +1 -1
- package/dist/packem_shared/glob-Cyk1H9ZL-6yDyaJwk.js +1 -0
- package/dist/packem_shared/{index-BzhrR_iC.js → index-0dnGN3GP.js} +1 -1
- package/dist/packem_shared/index-CIdjkZgt.js +1 -0
- package/dist/packem_shared/{index-9Ot7jTd4.js → index-Cwxbl_pY.js} +1 -1
- package/dist/packem_shared/index-Doab17tq.js +1 -0
- package/dist/packem_shared/{isAccessibleSync-DYKTrrvc-C-_5cgwu.js → isAccessibleSync-DYKTrrvc-CBsMZhj-.js} +1 -1
- package/dist/packem_shared/{lifecycle-CQjeMPY0.js → lifecycle-Gy7mqMGg.js} +2 -2
- package/dist/packem_shared/{lockfile-CiUtEbnt.js → lockfile-DEWjBrlY.js} +1 -1
- package/dist/packem_shared/manifests-kE5OweNT.js +1 -0
- package/dist/packem_shared/{min-release-age-JViyQuBM.js → min-release-age-yvuPbJ8G.js} +1 -1
- package/dist/packem_shared/missing-package-json-CEEPXqYi.js +1 -0
- package/dist/packem_shared/{multi-eco-lockfiles-fgkpeHJv.js → multi-eco-lockfiles-D5tM7pkg.js} +1 -1
- package/dist/packem_shared/{native-config-sync-TdTWjVgI.js → native-config-sync-DDGt3vvd.js} +1 -1
- package/dist/packem_shared/{npmrc-CHsOyMvA.js → npmrc-CIvOb61L.js} +1 -1
- package/dist/packem_shared/{osv-Do9PMOea.js → osv-4kFhXIoW.js} +1 -1
- package/dist/packem_shared/osv-bloom-DU6avR2k.js +2 -0
- package/dist/packem_shared/package-version-x7sPg2TM.js +4 -0
- package/dist/packem_shared/packument-Dg8cIDYR.js +1 -0
- package/dist/packem_shared/{pm-runner-RM72mDZg.js → pm-runner-Dboj-wZG.js} +1 -1
- package/dist/packem_shared/{project-name-filter-ZQaLgytG.js → project-name-filter-B3tKt-Pf.js} +1 -1
- package/dist/packem_shared/{provenance-SX1MxPUZ.js → provenance-BG5mu0H_.js} +1 -1
- package/dist/packem_shared/publish-DkgvB2Lk.js +34 -0
- package/dist/packem_shared/registry-CndByNx9.js +85 -0
- package/dist/packem_shared/registry-keys-CE-RZlp_.js +1 -0
- package/dist/packem_shared/{removeSync-g1D5kONg-LbjATA8v.js → removeSync-g1D5kONg-jOsRSIIv.js} +1 -1
- package/dist/packem_shared/{renderToString-DR0zDUjh-DXppT6AM.js → renderToString-DR0zDUjh-DeiCwydO.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-D9kdTNvl.js → resolve-explicit-Cge6eKPt.js} +1 -1
- package/dist/packem_shared/{resolve-runtime-DNukUjIr.js → resolve-runtime-D8rxuo3J.js} +1 -1
- package/dist/packem_shared/run-CKL4VGzQ.js +10 -0
- package/dist/packem_shared/{run-file-UBukWaha.js → run-file-D1mlOnd8.js} +1 -1
- package/dist/packem_shared/{run-summary-utils-CMeURYtS.js → run-summary-utils-DbyeUM6f.js} +1 -1
- package/dist/packem_shared/runtime-check-Dw0q3X67.js +1 -0
- package/dist/packem_shared/s1ngularity-BOl0c716.js +1 -0
- package/dist/packem_shared/{scaffold-files-DJlz36Mu.js → scaffold-files-B8zMyMvq.js} +1 -1
- package/dist/packem_shared/{scan-progress-DymX71_5.js → scan-progress-CY3XIDOY.js} +1 -1
- package/dist/packem_shared/selectors-BB0yaWyK.js +3 -0
- package/dist/packem_shared/{signatures-CeL0bOEo.js → signatures-r1SeDHLL.js} +1 -1
- package/dist/packem_shared/spinner-B_rRdoro.js +1 -0
- package/dist/packem_shared/{table-oA7p7-yP.js → table-bu4cV-it.js} +1 -1
- package/dist/packem_shared/{tabs-BiSifphV.js → tabs-A2EUpTHt.js} +1 -1
- package/dist/packem_shared/target-merge-ya19LiWB.js +1 -0
- package/dist/packem_shared/{target-options-DsHFmRZH.js → target-options-rIthWS4M.js} +1 -1
- package/dist/packem_shared/{task-env-C2lmxvzA.js → task-env-Cl4jNMCR.js} +1 -1
- package/dist/packem_shared/toolchain-Bt93i37e.js +5 -0
- package/dist/packem_shared/typosquats-BbebOgKM.js +1 -0
- package/dist/packem_shared/{use-measured-height-BHm-HiSF.js → use-measured-height-CwhybDI9.js} +1 -1
- package/dist/packem_shared/{verify-B_MblU_Q.js → verify-3WE9U_Bv.js} +1 -1
- package/dist/packem_shared/{vis-update-app-6QOYxnNx.js → vis-update-app-PjJWvxqF.js} +1 -1
- package/dist/packem_shared/{vis-user-error-3YS7sPYy.js → vis-user-error-BivZDkQD.js} +2 -2
- package/dist/packem_shared/{watch-CcTketln.js → watch-C-9-PD2m.js} +1 -1
- package/dist/packem_shared/{watch-loop-CGi66Fs0.js → watch-loop-dWYGUQwi.js} +1 -1
- package/dist/release/index.js +1 -1
- package/dist/release/plugin-sdk.d.ts +32 -0
- package/dist/release/presets.d.ts +38 -0
- package/dist/runtime/preload.js +1 -1
- package/index.js +26 -26
- package/package.json +19 -15
- package/schemas/vis-config.schema.json +12 -0
- package/dist/packem_shared/advisories-DO-P0V1_.js +0 -1
- package/dist/packem_shared/affected-selection-CeeZo7Uy.js +0 -1
- package/dist/packem_shared/ai-cache-iSIyY3So.js +0 -1
- package/dist/packem_shared/build-scripts-CEDx_nJp.js +0 -1
- package/dist/packem_shared/detect-CbMRSXkM.js +0 -1
- package/dist/packem_shared/env-BSXG3QKH.js +0 -4
- package/dist/packem_shared/env-consistency-B4rU4MQb.js +0 -1
- package/dist/packem_shared/glob-Cyk1H9ZL-CL9optrn.js +0 -1
- package/dist/packem_shared/index-BS6A9QR_.js +0 -1
- package/dist/packem_shared/manifests-Du4yKlf_.js +0 -1
- package/dist/packem_shared/missing-package-json-1BIoWQq0.js +0 -1
- package/dist/packem_shared/osv-bloom-BCAX5ARR.js +0 -2
- package/dist/packem_shared/package-version-Bq6Cne_7.js +0 -4
- package/dist/packem_shared/packument-CbTmbHU4.js +0 -1
- package/dist/packem_shared/publish-Dc0XGH3K.js +0 -34
- package/dist/packem_shared/readJsonSync-CbryXYxN-EWl7_7KX.js +0 -1
- package/dist/packem_shared/registry-Dg9XI6RT.js +0 -81
- package/dist/packem_shared/registry-keys-z038Ecb4.js +0 -1
- package/dist/packem_shared/run-DLvd3RIZ.js +0 -10
- package/dist/packem_shared/runtime-check-D3cRDuoi.js +0 -1
- package/dist/packem_shared/s1ngularity-BuU9Cxpy.js +0 -1
- package/dist/packem_shared/selectors-edwcgNl3.js +0 -3
- package/dist/packem_shared/spinner-CPoBymcv.js +0 -1
- package/dist/packem_shared/target-merge-DVJl-7Qz.js +0 -4
- package/dist/packem_shared/toolchain-CP79HNVy.js +0 -5
- package/dist/packem_shared/typosquats-BFKus_aM.js +0 -1
- package/dist/packem_shared/writeFileSync-DJoHk3Ks-BPRoepNw.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{createRequire as gt}from"node:module";import{J as We,b as _,F as M,q as Ke,X as K,j as wt}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as L,z,v as vt}from"../packem_shared/index-
|
|
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=L(e,s);if(!D(i))continue;let r;try{const a=z(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},q=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=tn(e);if(!Zt(n))return t;const s=new Map;for(const r of t){const o=r.currentVersion??r.currentRef;o&&s.set(ge(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=nn([o],{ecosystem:vn,workspaceRoot:e}).get(ge(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(ge(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=q(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,On=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}},_n=(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=On(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},_e=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=z(a)}catch{return}const c=_n(a,p);n.push(...c)},r=L(e,En);if(D(r))for(const a of X(r,{includeDirs:!1,includeSymlinks:!1,maxDepth:1}))_e(a.name)&&i(a.path);const o=L(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=L(e,a);D(p)&&i(p)}for(const a of t){const p=vt(a)?a:L(e,a);if(D(p))for(const c of X(p,{includeDirs:!1,includeSymlinks:!1}))_e(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:q(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},Ln=(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}`},Pn=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=q(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(v,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=Ln(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/${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=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 We,b as _,F as M,q as Ke,X as K,j as wt}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as L,z,v as vt}from"../packem_shared/index-0dnGN3GP.js";import{l as Ce,f as kt}from"./ts-loader.js";import{O as bt,aj as Rt,c as me,q as Te}from"./cli-main.js";import{O as he}from"../packem_shared/renderToString-DR0zDUjh-DeiCwydO.js";import{L as X,a as Et,R as V,O as H}from"../packem_shared/registry-CndByNx9.js";import{i as le}from"../packem_shared/index-BjdW45xX.js";import{v as xt,r as At,f as Ie}from"../packem_shared/ai-analysis-CO4rT3Nd.js";import{p as St,a as Ct,s as ze}from"../packem_shared/pm-runner-Dboj-wZG.js";import{a as Tt,r as It}from"../packem_shared/command-runtime-DG49t2MT.js";import{r as Ot,a as _t,p as Nt}from"../packem_shared/resolve-explicit-Cge6eKPt.js";import{s as jt}from"../packem_shared/min-release-age-yvuPbJ8G.js";import{U as Ut,s as Dt}from"../packem_shared/env-BymuoTL8.js";import{r as Bt,s as Lt}from"../packem_shared/typosquats-BbebOgKM.js";import{U as Pt,V as Vt,C as Oe,e as Mt}from"../packem_shared/vis-update-app-PjJWvxqF.js";import{hasBackup as Ft,restoreFromBackup as Gt,hasCatalogs as Ht,readCatalogs as qt,checkOutdated as Wt,collectInternalOutdated as Kt,fetchChangelogInfo as Ye,formatSummary as Je,promptPackageSelection as zt,toFilterArray as F,applyCatalogUpdates as Yt,formatOutdatedJson as Jt,formatOutdatedMinimal as Xt,formatOutdatedTable as Qt}from"./catalog2.js";import{h as Xe,P as Qe}from"../packem_shared/peer-warnings-CmYSxvql.js";import{p as Ze}from"../packem_shared/utils-DQFHJn72.js";import{L as Zt}from"../packem_shared/index-BisalDCf.js";import{y as D}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{s as ne}from"../packem_shared/index-B4AjSxHU.js";import{r as nn,a as ge,q as sn}from"../packem_shared/advisories-DHGJ6XhP.js";import{l as rn}from"../packem_shared/npmrc-CIvOb61L.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:qe}=He("node:readline"),{existsSync:en,realpathSync:tn}=He("node:fs"),on=e=>{const t=[];for(const n of e.filters)t.push("--filter",n);return e.workspaceRoot&&t.push("--filter","."),t.push("update"),e.latest&&t.push("--latest"),e.recursive&&t.push("--recursive"),e.interactive&&t.push("--interactive"),e.dev&&t.push("--dev"),e.prod&&t.push("--prod"),e.noOptional&&t.push("--no-optional"),e.noSave&&t.push("--no-save"),t.push(...e.packages),{args:t,bin:"pnpm"}},an=e=>{const t=[];return e.filters.length>0&&t.push("workspace",e.filters[0]),t.push("upgrade"),e.latest&&t.push("--latest"),t.push(...e.packages),{args:t,bin:"yarn"}},cn=e=>{const t=[];if(e.filters.length>0||e.recursive){t.push("workspaces","foreach","--all");for(const n of e.filters)t.push("--include",n)}return t.push("up"),e.interactive&&t.push("--interactive"),t.push(...e.packages),{args:t,bin:"yarn"}},ln=(e,t)=>{const n=["update"];e.latest&&t.push("npm does not support --latest flag. Packages will be updated within their semver range."),e.interactive&&t.push("npm does not support --interactive mode.");for(const s of e.filters)n.push("--workspace",s);return e.recursive&&n.push("--workspaces"),e.workspaceRoot&&n.push("--include-workspace-root"),e.dev&&n.push("--dev"),e.prod&&n.push("--production"),e.noOptional&&n.push("--no-optional"),e.noSave&&n.push("--no-save"),n.push(...e.packages),{args:n,bin:"npm"}},dn=e=>{const t=["update"];e.latest&&t.push("--latest");for(const n of e.filters)t.push("--filter",n);return t.push(...e.packages),{args:t,bin:"bun"}},un=(e,t,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=St(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=L(e,s);if(!D(i))continue;let r;try{r=Zt(z(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=L(e,s);if(!D(i))continue;let r;try{const a=z(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},q=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=nn(e);if(!en(n))return t;const s=new Map;for(const r of t){const o=r.currentVersion??r.currentRef;o&&s.set(ge(r.name,o),{name:r.name,version:o})}if(s.size===0)return t;const i=new Map;try{for(const[r,o]of s){const p=sn([o],{ecosystem:vn,workspaceRoot:e}).get(ge(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(ge(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=q(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,On=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}},_n=(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=On(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},_e=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=z(a)}catch{return}const c=_n(a,p);n.push(...c)},r=L(e,En);if(D(r))for(const a of X(r,{includeDirs:!1,includeSymlinks:!1,maxDepth:1}))_e(a.name)&&i(a.path);const o=L(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=L(e,a);D(p)&&i(p)}for(const a of t){const p=vt(a)?a:L(e,a);if(D(p))for(const c of X(p,{includeDirs:!1,includeSymlinks:!1}))_e(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:q(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},Ln=(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}`},Pn=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=q(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(v,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=Ln(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/${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=z(r)}catch(m){for(const g of o)n.push({reason:`read failed: ${m.message}`,update:g});continue}const p=a.includes(`\r
|
|
3
3
|
`)?`\r
|
|
4
4
|
`:`
|
|
5
|
-
`,c=a.split(/\r?\n/),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{sn(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=q(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=q(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",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=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("#")},Wn=/^\s*FROM\s+(?:--\S+\s+)*([^\s#]+)(?:\s[^#]*)?(#.*)?$/i,Kn=(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=Wn.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},zn=/^\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=zn.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=en.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"?Kn(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=L(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=q(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=q(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("/"),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:w,project:O,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=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);D(o)&&s(o)}const i=L(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}},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},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:Le(S,r.exclude)?w="matched --exclude":r.include.length>0&&!Le(S,r.include)?w="not matched by --include":r.respectDependabotConfig&&n&&ve(S,"gitlab",n)&&(w="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(w){c.push(C(w));continue}const T=q(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(Pn(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 K;case"minor":return _;case"patch":return We;default:return Ke}},Pe=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?` ${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)}`),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(`${We("✓")} All ecosystem references up to date.`),n.join(`
|
|
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{Ut(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=q(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=q(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",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=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("#")},Wn=/^\s*FROM\s+(?:--\S+\s+)*([^\s#]+)(?:\s[^#]*)?(#.*)?$/i,Kn=(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=Wn.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},zn=/^\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=zn.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=tn.native(i)}catch{o=i}if(n.has(o))return;n.add(o);let a;try{a=z(i)}catch{return}t.push(...r==="dockerfile"?Kn(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=L(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=q(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=q(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("/"),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:w,project:O,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=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);D(o)&&s(o)}const i=L(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}},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},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:Le(S,r.exclude)?w="matched --exclude":r.include.length>0&&!Le(S,r.include)?w="not matched by --include":r.respectDependabotConfig&&n&&ve(S,"gitlab",n)&&(w="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(w){c.push(C(w));continue}const T=q(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(Pn(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 K;case"minor":return _;case"patch":return We;default:return Ke}},Pe=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?` ${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)}`),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(`${We("✓")} All ecosystem references up to date.`),n.join(`
|
|
6
6
|
`);if(n.push(`${_("⚠")} No actionable updates found.`),e.failed.length>0){n.push(`
|
|
7
7
|
${_("Failed lookups:")}`);for(const r of e.failed)n.push(` ${r.file}: ${r.reason}`)}if(t.showIgnored&&e.ignored.length>0){n.push(`
|
|
8
8
|
${M("Ignored:")}`);for(const r of e.ignored)n.push(` ${M(r.name)} ${M(r.reason??"")}`)}return n.join(`
|
|
@@ -14,19 +14,19 @@ ${Ke("Ecosystem updates")} — ${String(s)} reference${s===1?"":"s"} can be bump
|
|
|
14
14
|
${_("Failed lookups:")}`);for(const r of e.failed)n.push(` ${r.file}: ${r.reason}`)}return t.previewOnly&&n.push(`
|
|
15
15
|
${_("ℹ")} ${M("Not applied automatically — re-run with `--interactive` to choose which to apply, or `--yes` to apply all.")}`),n.join(`
|
|
16
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=qe({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}},Os=e=>{const t=e.trim();return/^\d+(?:\.\d+)?$/.test(t)?Number.parseFloat(t)*1440:at(t)},
|
|
18
|
-
${_("⚠")} ${String(e.length)} package${e.length===1?"":"s"} skipped by target constraint (use --target latest to include):`);for(const n of e)t.info(` ${n.packageName} ${n.currentRange} → ${n.newRange} (${n.updateType})`)}},Fe=(e,t,n,s,i)=>{n==="json"?process.stdout.write(`${
|
|
19
|
-
`):n==="minimal"?process.stdout.write(`${
|
|
20
|
-
`):(
|
|
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}},Os=e=>{const t=e.trim();return/^\d+(?:\.\d+)?$/.test(t)?Number.parseFloat(t)*1440:at(t)},mr=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=L(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=L(e,".npmrc");if(D(n)){const s=z(n),i=/^\s*min-release-age\s*=\s*([^\s#;]+)/m.exec(s);return{minutes:i?Os(i[1]):void 0}}break}case"pnpm":{const n=L(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=L(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{}},_s={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 _s))return{added:[],unsupported:!0};const i=s.excludes??[],r=[...new Set(n)].filter(o=>!i.includes(o));return r.length===0?{added:[],unsupported:!1}:(jt(e,t,s.minutes,[...i,...r]),{added:r,unsupported:!1})},dt=(e,t,n)=>{n.added.length>0?e.info(`Added ${String(n.added.length)} package${n.added.length===1?"":"s"} to ${ct[t]??"the package manager config"} so --ignore-release-age versions install: ${n.added.join(", ")}`):n.unsupported&&e.warn(`${_("⚠")} npm has no per-package release-age exclude list, so vis can't exempt just the selected packages. Lower min-release-age in .npmrc or pass --min-release-age=0 to the install.`)},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
|
+
${_("⚠")} ${String(e.length)} package${e.length===1?"":"s"} skipped by target constraint (use --target latest to include):`);for(const n of e)t.info(` ${n.packageName} ${n.currentRange} → ${n.newRange} (${n.updateType})`)}},Fe=(e,t,n,s,i)=>{n==="json"?process.stdout.write(`${Jt({checkedCount:0,failed:t,filteredByTarget:[],ignored:[],outdated:e})}
|
|
19
|
+
`):n==="minimal"?process.stdout.write(`${Xt(e)}
|
|
20
|
+
`):(Qt(e,s),s.info(Je(e,i)))},Ge=async(e,t,n,s,i,r,o)=>{const a=Yt(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
22
|
Fetching changelogs...`);const c=await Ye(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 ze(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:
|
|
23
|
+
`);try{const{code:f,output:m}=await ze(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:Mt(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(`${_("⚠")} ${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(`${_("⚠")} --ignore-release-age: selecting the latest versions regardless of minimumReleaseAge.`):c&&(o.minimumReleaseAge!==void 0||f!==void 0)&&r.info("minimumReleaseAge gate disabled via MARSHALL_DISABLE_MIN_RELEASE_AGE."),!c&&o.minimumReleaseAge!==void 0&&f!==void 0&&o.minimumReleaseAge!==f){const x=t==="pnpm"?"pnpm-workspace.yaml":"bunfig.toml";r.warn(`${_("⚠")} minimumReleaseAge mismatch: vis config = ${String(o.minimumReleaseAge)} min, ${x} = ${String(f)} min. Consider keeping them in sync.`)}const h=rn(e),b=s["include-internal"],k=s.peer,y=qt(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(Oe,{current:x,total:j})):(process.stdout.write(`
|
|
24
24
|
`),l=Te(V.createElement(Oe,{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=Et(n.security,{disabled:w,minimumScore:C}),{checkedCount:E,failed:I,filteredByTarget:O,ignored:P,outdated:N}=await
|
|
25
|
+
`);const w=new Set;me("socket")&&w.add("socket"),me("depsDev")&&w.add("deps-dev");const C=n.security?.policies?.score?.minimum,T=Et(n.security,{disabled:w,minimumScore:C}),{checkedCount:E,failed:I,filteredByTarget:O,ignored:P,outdated:N}=await Wt(y,v,h,S,e,T,n.security?.acceptedRisks);l&&(l.clear(),l.unmount());const Q=b?{ignored:[],outdated:[]}:Kt(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)P.includes(x)||P.push(x);const Ee=E-N.length-I.length;if(I.length>0&&r.warn(`Failed to fetch: ${I.join(", ")}`),P.length>0&&r.info(`Skipped ${String(P.length)} ignored package${P.length===1?"":"s"}: ${P.join(", ")}`),!$&&E>N.length){const x=[...y.values()].reduce((Y,de)=>Y+de.size,0),j=x>E?` (${String(x)} catalog entries, ${String(x-E)} duplicates)`:"";r.info(`Checked ${String(E)} unique packages${j}: ${String(N.length)} outdated, ${String(Ee)} up-to-date${I.length>0?`, ${String(I.length)} failed`:""}${O.length>0?`, ${String(O.length)} skipped by target`:""}`)}if(N.length===0)return O.length>0?r.info(`All catalog dependencies are up to date within the current target.
|
|
26
26
|
${String(O.length)} package${O.length===1?" has":"s have"} newer versions available with --target latest:
|
|
27
27
|
${O.map(x=>` ${x.packageName} ${x.currentRange} → ${x.newRange} (${x.updateType})`).join(`
|
|
28
|
-
`)}`):r.info("All catalog dependencies are up to date."),we;const W=s.format??o.format??"table";let G;if(s.ai){const x=xt(s.aiType??"impact");G=await At(N,r,n.ai,x)}const se=!!s.dryRun;if(!se&&i.length>0&&s.marshallCheck!==!1){const x=await Ot(i);if(x.length>0){const j=await _t(x,{config:n?.security?.marshalls,workspaceRoot:e});if(!await Nt(j))return process.exitCode=1,{applied:!1,canceled:!0,jsonEmitted:!1}}}if($&&W==="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(`${_("⚠")} Ecosystem update scan failed: ${U.message}`)}}const de=new
|
|
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:
|
|
28
|
+
`)}`):r.info("All catalog dependencies are up to date."),we;const W=s.format??o.format??"table";let G;if(s.ai){const x=xt(s.aiType??"impact");G=await At(N,r,n.ai,x)}const se=!!s.dryRun;if(!se&&i.length>0&&s.marshallCheck!==!1){const x=await Ot(i);if(x.length>0){const j=await _t(x,{config:n?.security?.marshalls,workspaceRoot:e});if(!await Nt(j))return process.exitCode=1,{applied:!1,canceled:!0,jsonEmitted:!1}}}if($&&W==="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(`${_("⚠")} Ecosystem update scan failed: ${U.message}`)}}const de=new Pt([...N,...j],G??null);let ue;if(s.changelog){r.info("Fetching changelogs...");const R=await Ye(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(Vt,{autoExitSeconds:pt,changelogUrls:ue,checkedCount:E,filteredOutEntries:O,isDryRun:se,store:de,totalCatalogEntries:u}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),pe=process.stdout.columns||80;process.stdout.write(`
|
|
29
|
+
`);for(const R of N){const 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:Dt(oe);process.stdout.write(`${he(V.createElement(H,null," ",V.createElement(H,{color:mt},J),` ${R.packageName} ${R.currentRange} → ${R.newRange}`,V.createElement(H,{dimColor:!0},` ${R.updateType}`),Se?V.createElement(H,{color:Se},ht):null),{columns:pe})}
|
|
30
30
|
`)}if(process.stdout.write(`
|
|
31
31
|
`),r.info(Je(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(O.length>0){process.stdout.write(`
|
|
32
32
|
`);const R=`${String(O.length)} package${O.length===1?"":"s"} skipped by target constraint (use --target latest to include):`;process.stdout.write(`${he(V.createElement(H,{color:"yellow"},` ${R}`),{columns:pe})}
|
|
@@ -35,7 +35,7 @@ ${O.map(x=>` ${x.packageName} ${x.currentRange} → ${x.newRange} (${x.update
|
|
|
35
35
|
Applying ${String(ie.length)} catalog update${ie.length===1?"":"s"}...
|
|
36
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(`${_("⚠")} 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(W==="json"){const x={failed:I,filteredByTarget:O,ignored:P,outdated:N};G&&(x.aiAnalysis=G),process.stdout.write(`${JSON.stringify(x,void 0,2)}
|
|
37
37
|
`)}else r.info(`Would update ${String(N.length)} dependencies:
|
|
38
|
-
`),Fe(N,I,W,r,C),G&&(r.info(""),r.info(Ie(G))),Me(O,r);return{applied:!1,canceled:!1,jsonEmitted:W==="json"}}G&&W!=="json"&&(r.info(Ie(G)),r.info(""));let Z=N;if(s.interactive&&(Z=await
|
|
38
|
+
`),Fe(N,I,W,r,C),G&&(r.info(""),r.info(Ie(G))),Me(O,r);return{applied:!1,canceled:!1,jsonEmitted:W==="json"}}G&&W!=="json"&&(r.info(Ie(G)),r.info(""));let Z=N;if(s.interactive&&(Z=await zt(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
39
|
`),Fe(Z,[],W,r,C),Me(O,r);const ft={...s,install:s.install??o.install};return await Ge(e,t,Z,ft,r,h),{applied:!0,canceled:!1,jsonEmitted:W==="json"}},Ls=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(`${_("⚠")} --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 ze(a.bin,a.args,{cwd:e,env:process.env});if(d!==0)return r.error(`
|
|
40
40
|
${K("✖")} 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(`
|
|
@@ -45,4 +45,4 @@ ${K("✖")} Update failed (exit code ${String(m)})`),r.error(` Command: ${c}`),
|
|
|
45
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
46
|
${_("ℹ")} ${String(a.updates.length)} ecosystem reference${a.updates.length===1?"":"s"} can be bumped — not applied (--dry-run). Re-run without --dry-run and with \`--interactive\` or \`--yes\` to apply.`),a;if(!d)return p==="minimal"&&s.info(`
|
|
47
47
|
${_("ℹ")} ${String(a.updates.length)} ecosystem reference${a.updates.length===1?"":"s"} can be bumped — not applied automatically. Re-run with \`--interactive\` to choose, or \`--yes\` to apply all (or \`--no-actions\` / \`--no-docker\` / \`--no-gitlab\` to silence by ecosystem).`),a;let f=a.updates;if(t.interactive===!0&&process.stdout.isTTY&&!le&&(f=await Is(a.updates),f.length===0))return s.info(`${_("ℹ")} No ecosystem updates selected.`),a;const{applied:m,skipped:g}=nt(f);if(m.length>0&&s.info(`
|
|
48
|
-
${String(m.length)} ecosystem reference${m.length===1?"":"s"} updated.`),g.length>0){s.warn(`${_("⚠")} ${String(g.length)} ecosystem update${g.length===1?"":"s"} skipped:`);for(const h of g)s.warn(` ${h.update.name} (${h.update.file}:${String(h.update.line)}): ${h.reason}`)}return a},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.`)},
|
|
48
|
+
${String(m.length)} ecosystem reference${m.length===1?"":"s"} updated.`),g.length>0){s.warn(`${_("⚠")} ${String(g.length)} ecosystem update${g.length===1?"":"s"} skipped:`);for(const h of g)s.warn(` ${h.update.name} (${h.update.file}:${String(h.update.line)}): ${h.reason}`)}return a},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.`)},hr=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 Bt(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 Lt(o,s?.security?.typosquatAllowlist)){process.exitCode=1;return}}if(n.rollback){if(!Ft(o,a)){t.info("No backup found. Run 'vis update' first to create a backup.");return}if(Gt(o,a))t.info("Restored from backup.");else throw new Error("Failed to restore from backup.");return}if(!await Ps(n,r.length>0,t))return;const c=n.catalog!==!1&&Ht(o,a);let d;if(c)d=await Bs(o,a,s??{},n,r,t);else{const f=Ct(o,{backend:Tt(It({options:n,visConfig:s},o)),configBackend:s?.install?.backend,configCorepack:s?.install?.corepack}),m=f.name==="aube"?"":Rt(f.name);d=await Ls(o,f.name,m,n,r,t)}r.length===0&&d.ecosystemHandled!==!0&&await Ms(o,n,s??{},t,d)};export{lt as addReleaseAgeExcludesForInstall,hr as default,mr as formatMinutesAsTimeString,Os as parseNpmReleaseAgeValue,at as parseTimeStringToMinutes,Re as readPmNativeMinimumReleaseAge,Ps as requireBlanketUpdateConfirmation,Ms as runEcosystemUpdate,Vs as shouldApplyEcosystem};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as wt}from"node:module";import{a as
|
|
1
|
+
import{createRequire as wt}from"node:module";import{a as b,$ as rt,U as yt,v as nt,e as P,q as Tt}from"../packem_shared/index-0dnGN3GP.js";import{j as m,X as $,O as S,l as vt,i as St}from"../packem_shared/registry-CndByNx9.js";import it from"./index.js";import{x as at}from"../packem_shared/main-CgDAlZkm.js";import{y as G}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{q as $t}from"./cli-main.js";import{l as At}from"../packem_shared/spinner-B_rRdoro.js";import{C as ot,D as F,T as ct}from"../packem_shared/symbols-BXDZ_sKt.js";import{b as z,F as E,q as D,X as L,J as It}from"../packem_shared/index.server-Ca_EEVfw.js";import{withEnhancedPath as Mt}from"@visulima/task-runner";let mt;const kt=t=>(mt??=wt(import.meta.url))(t),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=t=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[e,s]=M.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return M.getBuiltinModule(t)}return kt(t)},{readFileSync:bt,writeFileSync:xt,unlinkSync:Ct}=B("node:fs"),{randomBytes:Et}=B("node:crypto"),{availableParallelism:W}=B("node:os");class I extends Error{constructor(e,s){super(e,s),this.name=this.constructor.name}}class Rt extends I{}class T extends I{}class V extends I{}class j extends I{stderr;constructor(e,s,n){super(e,n),this.stderr=s}}class X extends I{}class A extends I{commandTitle;constructor(e,s,n){super(s,n),this.commandTitle=e}}const dt=t=>t.includes("/"),O=(t,e)=>e?t.toLowerCase():t,jt=(t,e,s,n={})=>{const r=dt(t),i=n.caseInsensitive===!0,c=O(t,i),a=[];for(const o of e){const l=r?b(s,o):rt(o);it(c,O(l,i))&&a.push(o)}return a},_t=(t,e,s,n={})=>{if(!e||e.length===0)return[...t];const r=n.caseInsensitive===!0;return t.filter(i=>{for(const c of e){const a=dt(c)?b(s,i):rt(i),o=O(c,r);if(it(o,O(a,r)))return!1}return!0})},U=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=b(t,e);return s===""||!s.startsWith("..")&&!nt(s)},Ft=(t,e)=>{let s;for(const n of e)Pt(n,t)&&(s===void 0||n.length>s.length)&&(s=n);return s},Ot=async t=>{let e=0,s=0;const n=()=>(e+=1,`pattern-${e}`),r=()=>(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(b(w,h)),g.set(w,k)}for(const h of[...g.keys()].sort()){const w=b(t.cwd,h)||".";d.push({command:o.command,cwd:h,files:g.get(h)??[],id:r(),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:r(),source:"string",title:`${o.command} — ${b(t.cwd,u)||"."}`});return}d.push({command:o.command,files:l,id:r(),source:"string",title:o.command})},c=async(o,l,f,d)=>{if(typeof o=="string"){d.push({command:o,files:l,id:r(),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:r(),source:"function",title:u,verbatim:!0});return}if(Array.isArray(u)){for(const g of u)if(typeof g=="string")d.push({command:g,files:l,id:r(),source:"function",title:g,verbatim:!0});else if(_(g))i(g,l,f,d);else if(U(g))d.push({files:l,id:r(),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(U(u)){d.push({files:l,id:r(),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(U(o)){d.push({files:l,id:r(),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=>b(t.cwd,g)):f,u=[];await c(l,d,f,u),u.length!==0&&a.push({commands:u,files:d,id:n(),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
|
|
|
@@ -6,16 +6,16 @@ import{createRequire as wt}from"node:module";import{a as x,$ as nt,U as yt,v as
|
|
|
6
6
|
staged: { "*.ts": "eslint --fix" },
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
Coming from lint-staged or nano-staged? Run \`vis migrate lint-staged\` (or \`vis migrate nano-staged\`) to move the config in and remove the legacy files.`)},K=t=>{if(typeof t!="object"||t===null)throw new T("Staged config must be an object mapping glob patterns to tasks.");const e=Object.entries(t);if(e.length===0)throw new T("Staged config is empty — at least one glob pattern is required.");for(const[s,
|
|
10
|
-
`)?
|
|
11
|
-
`;return Buffer.from(
|
|
12
|
-
First attempt: ${
|
|
13
|
-
Second attempt: ${
|
|
14
|
-
`)},c=a=>{switch(a){case"failed":return L(
|
|
15
|
-
`):i(L(o)),a?.stack&&(s||!e)&&process.stderr.write(`${
|
|
16
|
-
`)},info({message:a}){i(
|
|
17
|
-
`);g.length>0&&l.push(g);const h=d.process?.signalCode??null;if(d.aborted||h!==null||u.exitCode===void 0){const w=d.aborted?"Task aborted by earlier failure.":h===null?g.trim()||"Task exited without a numeric status code.":`Task killed by signal ${h}.`;throw new
|
|
18
|
-
`)}},
|
|
9
|
+
Coming from lint-staged or nano-staged? Run \`vis migrate lint-staged\` (or \`vis migrate nano-staged\`) to move the config in and remove the legacy files.`)},K=t=>{if(typeof t!="object"||t===null)throw new T("Staged config must be an object mapping glob patterns to tasks.");const e=Object.entries(t);if(e.length===0)throw new T("Staged config is empty — at least one glob pattern is required.");for(const[s,n]of e){if(!s||s.trim()==="")throw new T("Staged config keys must be non-empty glob patterns.");lt(s,n)}return t},lt=(t,e)=>{if(typeof e=="string"){if(e.trim()==="")throw new T(`Task for "${t}" is an empty string.`);return}if(Array.isArray(e)){if(e.length===0)throw new T(`Task array for "${t}" is empty.`);for(const s of e)lt(t,s);return}if(typeof e!="function"){if(typeof e=="object"&&e!==null&&typeof e.command=="string"&&typeof e.task=="function")throw new T(`Task for "${t}" sets both \`command\` and \`task\` — use one or the other.`);if(_(e)){if(e.command.trim()==="")throw new T(`Command task for "${t}" has an empty \`command\`.`);return}if(!Dt(e))throw new T(`Invalid task for "${t}" — expected string, string[], function, { command, … }, or { title, task } object.`)}},Dt=t=>typeof t=="object"&&t!==null&&typeof t.title=="string"&&typeof t.task=="function",Y=2048,p=async(t,e)=>{const s=e.input===void 0?void 0:typeof e.input=="string"?e.input:e.input.toString("utf8"),n=await at("git",[...t],{nodeOptions:{cwd:e.cwd,env:e.env?{...process.env,...e.env}:void 0,stdio:s===void 0?["ignore","pipe","pipe"]:["pipe","pipe","pipe"]},stdin:s}),r=typeof n.exitCode=="number"?n.exitCode:1;if(r!==0&&!e.lenient){const{stderr:i}=n,c=i.length>Y?`${i.slice(0,Y)}…`:i;throw new j(`git ${t.join(" ")} failed with exit code ${r}: ${c.trim()}`,i)}return{exitCode:r,stderr:n.stderr,stdout:n.stdout}},x=async(t,e)=>{const{stdout:s}=await p(t,e);return s.trim()},Lt=async t=>{const e=await p(["rev-parse","--is-inside-work-tree"],{cwd:t,lenient:!0});return e.exitCode===0&&e.stdout.trim()==="true"},Ut=async t=>x(["rev-parse","--absolute-git-dir"],{cwd:t}),ut=async t=>x(["rev-parse","--show-toplevel"],{cwd:t}),q=async t=>x(["write-tree"],{cwd:t}),qt=async t=>{const e=await p(["rev-parse","HEAD^{tree}"],{cwd:t,lenient:!0});return e.exitCode===0?e.stdout.trim():""},R={major:2,minor:32},Bt=t=>{const e=/git version (\d+)\.(\d+)/.exec(t);if(!e)return null;const s=Number.parseInt(e[1]??"",10),n=Number.parseInt(e[2]??"",10);return Number.isNaN(s)||Number.isNaN(n)?null:{major:s,minor:n}},Ht=async t=>{const e=Bt(await x(["--version"],{cwd:t}));if(e===null)return;if(e.major<R.major||e.major===R.major&&e.minor<R.minor)throw new j(`Git ${R.major}.${R.minor} or newer is required; found ${e.major}.${e.minor}.`)},Gt="ACMR",J=500,zt=async t=>{const{stdout:e}=await p(["diff-files","--raw","-z"],{cwd:t}),s=e.split("\0").filter(r=>r.length>0),n=[];for(let r=0;r<s.length;r+=1){const i=s[r];if(!i?.startsWith(":"))continue;const c=i.slice(1).split(" "),a=c[3],o=c[4],l=s[r+1];r+=1,o==="A"&&a!==void 0&&/^0+$/.test(a)&&l!==void 0&&n.push(l)}return n},Z=async t=>{const{stdout:e}=await p(["ls-files","--others","--exclude-standard","-z"],{cwd:t});return e.split("\0").filter(s=>s.length>0)},Wt=async(t,e)=>{if(t.length===0)return;const s=`${t.join("\0")}\0`;await p(["rm","--cached","--quiet","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:e.cwd,input:s})},Vt=async t=>{const e=t.diffFilter??Gt,s=t.diff===void 0?["diff","--name-only","-z",`--diff-filter=${e}`,"--staged"]:["diff","--name-only","-z",`--diff-filter=${e}`,...t.diff.split(/\s+/).filter(Boolean)],{stdout:n}=await p(s,{cwd:t.cwd}),r=n.split("\0").filter(c=>c.length>0);if(r.length===0)return[];const i=t.workTree??await ut(t.cwd);return r.map(c=>nt(c)?c:P(i,c))},Xt=async(t,e)=>{if(t.length===0)return null;const s=[];for(let i=0;i<t.length;i+=J){const c=t.slice(i,i+J),{stdout:a}=await p(["diff","--binary","--unified=0","--no-color","--no-ext-diff","--src-prefix=a/","--dst-prefix=b/","--patch","--submodule=short","--",...c],{cwd:e.cwd});a.length>0&&s.push(a)}if(s.length===0)return null;const n=s.join(""),r=n.endsWith(`
|
|
10
|
+
`)?n:`${n}
|
|
11
|
+
`;return Buffer.from(r,"utf8")},Kt=async t=>{const{stdout:e}=await p(["status","--porcelain=v1","-z"],{cwd:t}),s=e.split("\0"),n=[];for(let r=0;r<s.length;r+=1){const i=s[r];if(i===void 0||i.length<4)continue;const c=i.charAt(0),a=i.charAt(1),o=i.slice(3),l=c==="R"||c==="C"||a==="R"||a==="C";c!==" "&&c!=="?"&&a!==" "&&a!=="?"&&n.push(o),l&&(r+=1)}return n},Yt=async(t,e)=>{if(t.length===0)return;const s=`${t.join("\0")}\0`;await p(["checkout","--force","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:e.cwd,input:s})},Jt=async(t,e)=>{if(await p(["update-index","--again"],{cwd:e.cwd,lenient:!0}),t.length===0)return;const s=`${t.join("\0")}\0`;await p(["add","-u","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:e.cwd,input:s})},Zt="vis_staged_automatic_backup",ft=()=>`${Zt}-${process.pid}-${Date.now()}-${Et(3).toString("hex")}`,Qt=async t=>{const e=await x(["stash","create"],{cwd:t});return e.length===0?null:(await p(["stash","store","-m",ft(),e],{cwd:t}),e)},te=async(t,e)=>{const{exitCode:s,stdout:n}=await p(["reflog","--format=%H %gs","refs/stash"],{cwd:t,lenient:!0});if(s!==0)return null;for(const r of n.split(/\r?\n/)){const i=r.indexOf(" ");if(i!==-1&&r.slice(i+1).includes(e))return r.slice(0,i)}return null},ee=async t=>{const e=ft(),{exitCode:s,stdout:n}=await p(["stash","push","--keep-index","--include-untracked","--quiet","-m",e],{cwd:t,lenient:!0});if(s!==0)return null;const r=n.trim();return r.length>0&&/no local changes/i.test(r)?null:te(t,e)},se=async t=>{const e=await x(["stash","create"],{cwd:t});return e.length===0?"":x(["rev-parse",`${e}^{tree}`],{cwd:t})},re=async(t,e)=>{const[s,n]=await Promise.all([x(["rev-parse",`${e}^{tree}`],{cwd:t}),x(["rev-parse",`${e}^2^{tree}`],{cwd:t})]);return{indexTree:n,worktreeTree:s}},ne=async(t,e)=>{const{exitCode:s,stdout:n}=await p(["reflog","--format=%H %gd","refs/stash"],{cwd:t,lenient:!0});if(s!==0)return null;for(const r of n.split(/\r?\n/)){const[i,c]=r.split(/\s+/,2);if(i===e&&c!==void 0)return c}return null},ht=async(t,e)=>{const{exitCode:s}=await p(["rev-parse","--verify","--quiet",`${e}^{commit}`],{cwd:t,lenient:!0});return s===0},ie=async(t,e)=>{const s=await ne(t,e);if(s===null)return null;const{exitCode:n,stdout:r}=await p(["rev-parse","--verify","--quiet",s],{cwd:t,lenient:!0});return n===0&&r.trim()===e?s:null},gt=async(t,e)=>{if(e===null)return;const s=await ie(t,e);s!==null&&await p(["stash","drop","--quiet",s],{cwd:t})},ae=async(t,e)=>{if(e===null)throw new V("Backup stash was not found — can't revert working tree.");if(!await ht(t,e))throw new V(`Backup stash ${e} is no longer reachable — can't revert working tree.`);await p(["reset","--hard","HEAD"],{cwd:t}),await p(["stash","apply","--index","--quiet",e],{cwd:t})},oe=async(t,e)=>{e!==null&&await ht(t,e)&&(await p(["stash","apply","--quiet",e],{cwd:t}),await gt(t,e))};class ce{stagedFiles=[];partiallyStaged=[];workTree="";gitDir="";preTaskIndexTree="";postTaskIndexTree="";headTree="";revertApplied=!1;warnings=[];cwd;options;patch=null;backupStashSha=null;merge=[];shouldStash;shouldHidePartial;shouldHideUnstaged;shouldHideAll;hideAllStashSha=null;intentToAddPaths=[];preTaskUntracked=new Set;constructor(e){this.cwd=e.cwd??process.cwd(),this.options=e,this.shouldStash=e.stash!==!1&&e.diff===void 0,this.shouldHidePartial=e.hidePartiallyStaged!==!1,this.shouldHideUnstaged=e.hideUnstaged===!0,this.shouldHideAll=e.hideAll===!0}async prepare(){if(!await Lt(this.cwd))throw new j(`Not a git repository: ${this.cwd}`);await Ht(this.cwd),this.workTree=await ut(this.cwd),this.gitDir=await Ut(this.cwd),this.stagedFiles=await Vt({cwd:this.workTree,diff:this.options.diff,diffFilter:this.options.diffFilter,workTree:this.workTree}),this.partiallyStaged=this.stagedFiles.length===0?[]:await Kt(this.workTree),this.snapshotMergeState(),this.intentToAddPaths=await zt(this.workTree),this.intentToAddPaths.length>0&&await Wt(this.intentToAddPaths,{cwd:this.workTree}),this.shouldStash?this.backupStashSha=await Qt(this.workTree):this.partiallyStaged.length>0&&this.warnings.push("Running with --no-stash on partially-staged files — unstaged deltas will be captured to a patch, but if re-applying the patch fails after tasks run the changes cannot be recovered."),this.shouldHideAll?this.hideAllStashSha=await ee(this.workTree):await this.hideUnstagedChanges(),this.preTaskIndexTree=this.stagedFiles.length===0?"":await q(this.workTree),this.postTaskIndexTree=this.preTaskIndexTree,this.headTree=await qt(this.workTree),this.preTaskUntracked=new Set(await Z(this.workTree))}async applyModifications({autoStage:e=!1}={}){if(this.stagedFiles.length===0)return;const s=this.stagedFiles.map(n=>b(this.workTree,n));if(await Jt(s,{cwd:this.workTree}),e){const r=(await Z(this.workTree)).filter(i=>!this.preTaskUntracked.has(i));if(r.length>0){const i=`${r.join("\0")}\0`;await p(["add","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:this.workTree,input:i})}}if(this.intentToAddPaths.length>0)try{await p(["add","--intent-to-add","--",...this.intentToAddPaths],{cwd:this.workTree})}catch{}this.postTaskIndexTree=await q(this.workTree)}indexTreeChanged(){return this.preTaskIndexTree.length>0&&this.postTaskIndexTree.length>0&&this.preTaskIndexTree!==this.postTaskIndexTree}postTaskIndexMatchesHead(){return this.postTaskIndexTree.length>0&&this.headTree.length>0&&this.postTaskIndexTree===this.headTree}async restoreUnstagedChanges(){if(this.revertApplied||this.patch===null||this.shouldHideAll)return;const{patch:e}=this,s=["apply","--whitespace=nowarn","--recount","--unidiff-zero"];let n;try{await p(s,{cwd:this.workTree,input:e}),this.patch=null;return}catch(r){n=r instanceof j?r.stderr:String(r)}try{await p([...s,"--3way"],{cwd:this.workTree,input:e})}catch(r){const i=r instanceof j&&r.stderr?r.stderr:String(r);throw new X(`Failed to re-apply unstaged changes after running tasks. Original changes remain in the backup stash — recover with \`git stash list\` and \`git stash apply\`.
|
|
12
|
+
First attempt: ${n??"(no stderr)"}
|
|
13
|
+
Second attempt: ${i}`,{cause:r})}this.patch=null}async releaseBackupIfRestored(){if(this.backupStashSha===null)return;const e=await re(this.workTree,this.backupStashSha),s=await se(this.workTree),n=await q(this.workTree);s!==e.worktreeTree||n!==e.indexTree||await this.dropBackup()}async revertForEmptyCommit(){this.shouldHideAll||await this.revert()}async revert(){if(this.backupStashSha!==null){try{await ae(this.workTree,this.backupStashSha)}catch(e){throw new X("Revert failed while restoring the backup stash. Use `git stash list` to recover manually.",{cause:e})}if(await this.dropBackup(),this.intentToAddPaths.length>0)try{await p(["add","--intent-to-add","--",...this.intentToAddPaths],{cwd:this.workTree})}catch{}this.revertApplied=!0}}async cleanup(e){if(this.restoreMergeState(),!e&&!this.revertApplied&&await this.restoreUnstagedChanges(),this.hideAllStashSha!==null)try{await oe(this.workTree,this.hideAllStashSha)}catch{}if(!this.revertApplied){if(e){await this.dropBackup();return}await this.releaseBackupIfRestored()}}recoveryHint(){return this.backupStashSha===null?null:`Backup stash is preserved (sha ${this.backupStashSha.slice(0,7)}) — restore with: git stash apply --index ${this.backupStashSha}`}async hideUnstagedChanges(){const e=new Set(this.stagedFiles.map(n=>b(this.workTree,n))),s=this.shouldHideUnstaged?[...e]:this.shouldHidePartial?this.partiallyStaged.filter(n=>e.has(n)):[];s.length!==0&&(this.patch=await Xt(s,{cwd:this.workTree}),this.patch!==null&&await Yt(s,{cwd:this.workTree}))}snapshotMergeState(){this.gitDir.length!==0&&(this.merge=["MERGE_HEAD","MERGE_MODE","MERGE_MSG"].map(e=>{const s=P(this.gitDir,e);return G(s)?{body:bt(s),existed:!0,name:e}:{body:null,existed:!1,name:e}}))}restoreMergeState(){if(!(this.gitDir.length===0||this.merge.length===0))for(const e of this.merge){const s=P(this.gitDir,e.name);try{e.existed&&e.body!==null?xt(s,e.body):G(s)&&Ct(s)}catch{}}}async dropBackup(){await gt(this.workTree,this.backupStashSha),this.backupStashSha=null}}const de=t=>{switch(t){case"failed":return"red";case"running":return"cyan";case"skipped":return"yellow";case"success":return"green";default:return"gray"}},Q=t=>{if(t==="running")return m.jsx(At,{type:"dots"});const e=t==="failed"?ot:t==="skipped"?F:t==="success"?ct:F;return m.jsx(S,{color:de(t),children:e})},tt=({state:t,tick:e,verbose:s})=>m.jsxs($,{flexDirection:"column",children:[[...t.patterns.values()].map(n=>m.jsxs($,{flexDirection:"column",children:[m.jsxs($,{children:[Q(n.status),m.jsxs(S,{children:[" ",n.title]})]}),[...n.commands.values()].map(r=>m.jsxs($,{flexDirection:"column",marginLeft:2,children:[m.jsxs($,{children:[Q(r.status),m.jsxs(S,{children:[" ",r.title," "]}),r.status!=="pending"&&r.status!=="running"?m.jsxs(S,{color:"gray",children:["(",r.durationMs,"ms)"]}):null]}),s&&r.output?m.jsx($,{flexDirection:"column",marginLeft:2,children:r.output.split(/\r?\n/).slice(0,20).map((i,c)=>m.jsx(S,{color:"gray",children:i},`${r.id}-line-${c}`))}):null,r.status==="failed"&&r.error?m.jsx($,{marginLeft:2,children:m.jsx(S,{color:"red",children:r.error.message})}):null]},r.id))]},n.id)),t.infoMessages.map((n,r)=>m.jsx(S,{color:"gray",children:n},`info-${r}`)),t.warnMessages.map((n,r)=>m.jsx(S,{color:"yellow",children:n},`warn-${r}`)),t.errorMessages.map(({message:n},r)=>m.jsx(S,{color:"red",children:n},`err-${r}`))]}),le=(t={})=>{const e=t.verbose===!0,s={errorMessages:[],infoMessages:[],patterns:new Map,started:!1,warnMessages:[]};let n=0;const r=$t(m.jsx(tt,{state:s,tick:n,verbose:e}),{exitOnCtrlC:!1,stdout:process.stderr}),i=()=>{n+=1,r.rerender(m.jsx(tt,{state:s,tick:n,verbose:e}))};return{commandEnd({commandId:c,durationMs:a,error:o,output:l,patternId:f,status:d}){const u=s.patterns.get(f)?.commands.get(c);u&&(u.status=d,u.durationMs=a,u.output=l,u.error=o,i())},commandStart({commandId:c,patternId:a}){const o=s.patterns.get(a)?.commands.get(c);o&&(o.status="running",i())},error({error:c,message:a}){s.errorMessages.push({error:c,message:a}),i()},info({message:c}){s.infoMessages.push(c),i()},patternEnd({patternId:c,status:a}){const o=s.patterns.get(c);o&&(o.status=a,i())},patternStart({patternId:c}){const a=s.patterns.get(c);a&&(a.status="running",i())},start({patterns:c}){s.started=!0;for(const a of c){const o=new Map;for(const l of a.commands)o.set(l.id,{durationMs:0,id:l.id,status:"pending",title:l.title});s.patterns.set(a.id,{commands:o,id:a.id,status:"pending",title:a.title})}i()},async stop(){r.unmount(),await r.waitUntilExit()},warn({message:c}){s.warnMessages.push(c),i()}}},et=(t={})=>{const{quiet:e=!1,verbose:s=!1}=t,n=new Map,r=new Map,i=a=>{e||process.stderr.write(`${a}
|
|
14
|
+
`)},c=a=>{switch(a){case"failed":return L(ot);case"running":return D(">");case"skipped":return z(F);case"success":return It(ct);default:return E(F)}};return{commandEnd({commandId:a,durationMs:o,error:l,output:f,status:d}){const u=r.get(a)??a,g=E(`(${o}ms)`);if(i(` ${c(d)} ${u} ${g}`),d==="failed"&&l&&i(E(l.message)),(d==="failed"||s)&&f&&f.trim().length>0)for(const h of f.split(/\r?\n/))i(` ${E(h)}`)},commandStart({commandId:a}){if(!s)return;const o=r.get(a)??a;i(` ${E("…")} ${o}`)},error({error:a,message:o}){e?process.stderr.write(`${L(o)}
|
|
15
|
+
`):i(L(o)),a?.stack&&(s||!e)&&process.stderr.write(`${E(a.stack)}
|
|
16
|
+
`)},info({message:a}){i(E(a))},patternEnd({patternId:a,status:o}){const l=n.get(a)??a;i(`${c(o)} ${l}`)},patternStart({patternId:a}){const o=n.get(a)??a;i(`${D(">")} ${o}`)},start({patterns:a}){if(a.length===0){i(E("No staged files matched any pattern."));return}const o=new Set(a.flatMap(l=>l.files)).size;i(`${D(">")} Running staged tasks on ${o} file${o===1?"":"s"} across ${a.length} pattern${a.length===1?"":"s"}`);for(const l of a){n.set(l.id,l.title);for(const f of l.commands)r.set(f.id,f.title)}},stop(){},warn({message:a}){i(z(a))}}},ue=async t=>{const{env:e}=process;if(t.debug===!0||t.quiet===!0||e.NODE_ENV==="test"||e.TERM==="dumb"||e.CI!==void 0||!process.stderr.isTTY)return et({quiet:t.quiet,verbose:t.verbose});try{return le({verbose:t.verbose})}catch{return et({quiet:t.quiet,verbose:t.verbose})}},fe=t=>{const e=[];let s="",n=!1,r=!1;for(let i=0;i<t.length;i+=1){const c=t[i];if(c===void 0)break;if(c==="\\"&&!n&&i+1<t.length){const a=t[i+1];if(a!==void 0){r&&a!=='"'&&a!=="\\"&&(s+=c),s+=a,i+=1;continue}}if(c==='"'&&!n){r=!r;continue}if(c==="'"&&!r){n=!n;continue}if(!n&&!r&&/\s/.test(c)){s.length>0&&(e.push(s),s="");continue}s+=c}if(n||r)throw new T(`Unterminated ${n?"single":"double"} quote in command: ${t}`);return s.length>0&&e.push(s),e},pt=process.platform==="win32"?28e3:131072,he=(t,e,s)=>{const n=[];let r=[],i=e;const c=s<=0?pt:s;for(const a of t){const o=Buffer.byteLength(a)+1;r.length>0&&i+o>c&&(n.push(r),r=[],i=e),r.push(a),i+=o}return r.length>0&&n.push(r),n},ge=async(t,e,s)=>{const n=fe(t);if(n.length===0)throw new A(t,"Empty command for staged task.");const[r,...i]=n;if(r===void 0)throw new A(t,"Empty command for staged task.");const c=Buffer.byteLength(r)+i.reduce((f,d)=>f+Buffer.byteLength(d)+1,0),a=s.verbatim===!0?[[]]:he(e,c,s.maxArgLength??pt),o=Date.now(),l=[];for(const f of a){if(s.signal?.aborted===!0)throw new A(t,"Task aborted by earlier failure.");const d=at(r,[...i,...f],{nodeOptions:{cwd:s.cwd,env:pe(s.env,s.cwd),killSignal:s.killSignal??"SIGTERM",stdio:["ignore","pipe","pipe"]},...s.signal===void 0?{}:{signal:s.signal}}),u=await d,g=[u.stdout,u.stderr].filter(w=>w.length>0).join(`
|
|
17
|
+
`);g.length>0&&l.push(g);const h=d.process?.signalCode??null;if(d.aborted||h!==null||u.exitCode===void 0){const w=d.aborted?"Task aborted by earlier failure.":h===null?g.trim()||"Task exited without a numeric status code.":`Task killed by signal ${h}.`;throw new A(t,w)}if(u.exitCode!==0)throw new A(t,g.trim()||`Exit code ${u.exitCode} from ${r}`)}return{durationMs:Date.now()-o,output:l.join(`
|
|
18
|
+
`)}},pe=(t,e)=>{const s={...process.env};process.stderr.isTTY&&s.FORCE_COLOR===void 0&&s.NO_COLOR===void 0&&(s.FORCE_COLOR="1");const n=t?{...s,...t}:s;return Mt(n,e)},we=async(t,e,s)=>{const n=ke(s.concurrent,t.length),r=[],i=new AbortController;let c=!1,a=0;const o=()=>{c||(c=!0,s.continueOnError||i.abort())};s.externalSignal&&(s.externalSignal.aborted?o():s.externalSignal.addEventListener("abort",()=>{o()},{once:!0}));const l=h=>{for(const w of h.commands)e.commandEnd({commandId:w.id,durationMs:0,patternId:h.id,status:"skipped"})},f=async h=>{if(c){l(h),e.patternEnd({patternId:h.id,status:"skipped"});return}e.patternStart({patternId:h.id});let w="success";for(const k of h.commands){if(c){e.commandEnd({commandId:k.id,durationMs:0,patternId:h.id,status:"skipped"}),w=w==="success"?"skipped":w;continue}e.commandStart({commandId:k.id,patternId:h.id});const C=await me(k,s,i.signal),v=C.status==="failed"&&i.signal.aborted?{...C,status:"skipped"}:C;if(e.commandEnd({commandId:k.id,durationMs:v.durationMs,error:v.error,output:v.output,patternId:h.id,status:v.status}),v.status==="failed"){r.push(k.title),w="failed",o();break}if(v.status==="skipped"){w=w==="success"?"skipped":w;break}}e.patternEnd({patternId:h.id,status:w})},d=async()=>{for(;a<t.length;){const h=t[a];a+=1,h&&await f(h)}},u=[];for(let h=0;h<Math.min(n,t.length);h+=1)u.push(d());await Promise.all(u);const g=s.externalSignal?.aborted===!0;return{failedCommands:r,success:r.length===0&&!g}},me=async(t,e,s)=>{const n=Date.now();try{if(t.source==="custom"&&t.run)return await t.run([...t.files]),{durationMs:Date.now()-n,status:"success"};if(t.command){const r=await ge(t.command,t.files,{cwd:t.cwd??e.cwd,killSignal:e.killSignal,maxArgLength:e.maxArgLength,signal:s,verbatim:t.verbatim===!0});return{durationMs:r.durationMs,output:e.verbose?r.output:void 0,status:"success"}}return{durationMs:Date.now()-n,error:new A(t.title,"Command has no invocation target."),status:"failed"}}catch(r){const i=r instanceof Error?r:new Error(String(r));return{durationMs:Date.now()-n,error:i,output:i instanceof A?i.message:void 0,status:"failed"}}},ke=(t,e)=>{if(t===!1)return 1;if(t===!0){const n=Math.max(1,typeof W=="function"?W():4);return Math.min(Math.max(1,e),n)}const s=Math.floor(t);return s>0?s:1},ye=!0,Te=t=>{try{return!Tt(t)}catch{return!1}},ve=t=>{try{const e=vt(t);return e?St(t,e).map(s=>P(t,s)):[]}catch{return[]}},Se=async(t={})=>{const e=t.cwd??process.cwd(),s=await ue(t),n=await Nt(t);typeof n!="function"&&K(n);const r=new ce({...t,cwd:e}),i=new AbortController;let c=!1;const a=d=>{if(c){process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a),process.kill(process.pid,d);return}c=!0,s.warn({message:`Received ${d} — cancelling staged tasks and restoring state. Press Ctrl+C again to abort.`}),i.abort()};process.on("SIGINT",a),process.on("SIGTERM",a);let o={failedCommands:[],ranTasks:!1,success:!0},l=!1,f=!1;try{await r.prepare(),l=!0;for(const C of r.warnings)s.warn({message:C});if(r.stagedFiles.length===0)return t.allowEmpty!==!0&&s.info({message:"No staged files found."}),f=!0,{failedCommands:[],ranTasks:!1,success:!0};const d=Te(e),u=_t(r.stagedFiles,t.ignore,e,{caseInsensitive:d});if(u.length===0&&r.stagedFiles.length>0)return s.info({message:"Every staged file was excluded by the `ignore` list."}),f=!0,{failedCommands:[],ranTasks:!1,success:!0};const g=typeof n=="function"?K(await n([...u])):n,h=await Ot({caseInsensitive:d,config:g,cwd:e,files:u,relative:t.relative,workspacePackages:ve(e)});if(s.start({patterns:h}),h.length===0)return s.info({message:"No staged files matched any pattern."}),f=!0,{failedCommands:[],ranTasks:!1,success:!0};const{failedCommands:w,success:k}=await we(h,s,{concurrent:t.concurrent??ye,continueOnError:t.continueOnError===!0,cwd:e,externalSignal:i.signal,killSignal:t.killSignal,maxArgLength:t.maxArgLength,verbose:t.verbose});if(o={failedCommands:w,ranTasks:!0,success:k},k){if(t.diff===void 0&&(await r.applyModifications({autoStage:t.autoStage===!0}),t.failOnChanges===!0&&r.indexTreeChanged()&&(s.warn({message:"Tasks modified staged content — failing because --fail-on-changes is set."}),o={failedCommands:[...w],ranTasks:!0,success:!1}),t.allowEmpty!==!0&&r.postTaskIndexMatchesHead()))throw await r.revertForEmptyCommit(),new Rt("All staged changes were reverted by tasks. Re-stage changes or rerun with --allow-empty.")}else t.revert===!0&&(s.info({message:"Reverting working tree from backup stash."}),await r.revert());return await r.restoreUnstagedChanges(),f=o.success,o}catch(d){const u=d instanceof Error?d.message:String(d),g=d instanceof Error?d:new Error(u);if(s.error({error:g,message:u}),d instanceof I)return{failedCommands:o.failedCommands,ranTasks:o.ranTasks,success:!1};throw d}finally{if(process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a),l){try{await r.cleanup(f)}catch(u){s.error({error:u,message:"Cleanup failed."})}const d=f?null:r.recoveryHint();d&&s.warn({message:d})}await s.stop()}},be="VIS_STAGED_CONCURRENT",st=t=>{const e=t.trim();if(e==="true"||e==="")return!0;if(e==="false")return!1;const s=Number(e);return Number.isNaN(s)?!0:s},xe=(t,e)=>{const s={};e!==void 0&&(s.config=e);const n=y=>t[y]===void 0?void 0:!!t[y],r=y=>{const N=t[y];return typeof N=="string"&&N.length>0?N:void 0},i=n("allow-empty");i!==void 0&&(s.allowEmpty=i);const c=n("auto-stage");c!==void 0&&(s.autoStage=c);const a=n("continue-on-error");a!==void 0&&(s.continueOnError=a);const o=n("debug");o!==void 0&&(s.debug=o);const l=n("fail-on-changes");l!==void 0&&(s.failOnChanges=l);const f=n("hide-partially-staged");f!==void 0&&(s.hidePartiallyStaged=f);const d=n("hide-unstaged");d!==void 0&&(s.hideUnstaged=d);const u=n("quiet");u!==void 0&&(s.quiet=u);const g=n("relative");g!==void 0&&(s.relative=g);const h=n("revert");h!==void 0&&(s.revert=h);const w=n("stash");w!==void 0&&(s.stash=w);const k=n("verbose");k!==void 0&&(s.verbose=k);const C=r("cwd");C!==void 0&&(s.cwd=C);const v=r("diff");v!==void 0&&(s.diff=v);const H=r("diff-filter");if(H!==void 0&&(s.diffFilter=H),n("force-kill")===!0&&(s.killSignal="SIGKILL"),t.concurrent===void 0){const y=process.env[be];y!==void 0&&(s.concurrent=st(y.trim()))}else{const{concurrent:y}=t;s.concurrent=st(typeof y=="string"?y:typeof y=="number"||typeof y=="boolean"?String(y):"")}return s},Ne=async({options:t,visConfig:e})=>{const n=(e??{}).staged;if(!n)throw new Error(`No "staged" config found in vis.config.ts. Add one:
|
|
19
19
|
|
|
20
20
|
// vis.config.ts
|
|
21
21
|
import { defineConfig } from "@visulima/vis/config";
|
|
@@ -24,4 +24,4 @@ Second attempt: ${n}`,{cause:r})}}async revert(){if(this.backupStashSha!==null){
|
|
|
24
24
|
staged: { '*': 'vis check --fix' },
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
Migrating from lint-staged or nano-staged? Run \`vis migrate lint-staged\` (or \`vis migrate nano-staged\`) to move the config in and remove the legacy files.`);(await
|
|
27
|
+
Migrating from lint-staged or nano-staged? Run \`vis migrate lint-staged\` (or \`vis migrate nano-staged\`) to move the config in and remove the legacy files.`);(await Se(xe(t,n))).success||(process.exitCode=1)};export{xe as buildRunOptions,Ne as default};
|