@visulima/vis 1.0.0-alpha.3 → 1.0.0-alpha.30
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 +1117 -24
- package/LICENSE.md +11958 -0
- package/README.md +344 -20
- package/dashboard/dist/index.html +152 -0
- package/dist/bin.js +1 -146
- package/dist/binx.js +3 -0
- package/dist/config/index.d.ts +3154 -0
- package/dist/config/index.js +1 -0
- package/dist/generate/index.d.ts +157 -0
- package/dist/generate/index.js +1 -0
- package/dist/packem_chunks/bin.js +1415 -0
- package/dist/packem_chunks/bloom-status.js +2 -0
- package/dist/packem_chunks/bloom-sync.js +2 -0
- package/dist/packem_chunks/cache-attestation.js +1 -0
- package/dist/packem_chunks/config.js +19 -0
- package/dist/packem_chunks/devtools.js +82 -0
- package/dist/packem_chunks/doctor-probe.js +2 -0
- package/dist/packem_chunks/fix.js +11 -0
- package/dist/packem_chunks/handler.js +1 -0
- package/dist/packem_chunks/handler10.js +1 -0
- package/dist/packem_chunks/handler11.js +5 -0
- package/dist/packem_chunks/handler12.js +1 -0
- package/dist/packem_chunks/handler13.js +27 -0
- package/dist/packem_chunks/handler14.js +5 -0
- package/dist/packem_chunks/handler15.js +1 -0
- package/dist/packem_chunks/handler16.js +1 -0
- package/dist/packem_chunks/handler17.js +1 -0
- package/dist/packem_chunks/handler18.js +1 -0
- package/dist/packem_chunks/handler19.js +1 -0
- package/dist/packem_chunks/handler2.js +4 -0
- package/dist/packem_chunks/handler20.js +5 -0
- package/dist/packem_chunks/handler21.js +2 -0
- package/dist/packem_chunks/handler22.js +2 -0
- package/dist/packem_chunks/handler23.js +1 -0
- package/dist/packem_chunks/handler24.js +1 -0
- package/dist/packem_chunks/handler25.js +5 -0
- package/dist/packem_chunks/handler26.js +1 -0
- package/dist/packem_chunks/handler27.js +3 -0
- package/dist/packem_chunks/handler28.js +1 -0
- package/dist/packem_chunks/handler29.js +7 -0
- package/dist/packem_chunks/handler3.js +4 -0
- package/dist/packem_chunks/handler30.js +33 -0
- package/dist/packem_chunks/handler31.js +3 -0
- package/dist/packem_chunks/handler32.js +8 -0
- package/dist/packem_chunks/handler33.js +1 -0
- package/dist/packem_chunks/handler34.js +5 -0
- package/dist/packem_chunks/handler35.js +11 -0
- package/dist/packem_chunks/handler36.js +3 -0
- package/dist/packem_chunks/handler37.js +22 -0
- package/dist/packem_chunks/handler38.js +61 -0
- package/dist/packem_chunks/handler39.js +3 -0
- package/dist/packem_chunks/handler4.js +6 -0
- package/dist/packem_chunks/handler40.js +6 -0
- package/dist/packem_chunks/handler41.js +24 -0
- package/dist/packem_chunks/handler42.js +153 -0
- package/dist/packem_chunks/handler43.js +25 -0
- package/dist/packem_chunks/handler44.js +10 -0
- package/dist/packem_chunks/handler45.js +708 -0
- package/dist/packem_chunks/handler46.js +24 -0
- package/dist/packem_chunks/handler47.js +322 -0
- package/dist/packem_chunks/handler48.js +48 -0
- package/dist/packem_chunks/handler49.js +3 -0
- package/dist/packem_chunks/handler5.js +8 -0
- package/dist/packem_chunks/handler50.js +27 -0
- package/dist/packem_chunks/handler51.js +195 -0
- package/dist/packem_chunks/handler52.js +34 -0
- package/dist/packem_chunks/handler6.js +1 -0
- package/dist/packem_chunks/handler7.js +1 -0
- package/dist/packem_chunks/handler8.js +1 -0
- package/dist/packem_chunks/handler9.js +1 -0
- package/dist/packem_chunks/heal-accept.js +10 -0
- package/dist/packem_chunks/heal.js +14 -0
- package/dist/packem_chunks/help-command.js +8 -0
- package/dist/packem_chunks/index.js +7 -0
- package/dist/packem_chunks/keys-refresh.js +4 -0
- package/dist/packem_chunks/list.js +3 -0
- package/dist/packem_chunks/loader.js +4 -0
- package/dist/packem_chunks/loader2.js +1 -0
- package/dist/packem_chunks/prune.js +3 -0
- package/dist/packem_chunks/run.js +1 -0
- package/dist/packem_chunks/status.js +2 -0
- package/dist/packem_chunks/sync.js +2 -0
- package/dist/packem_chunks/sync2.js +2 -0
- package/dist/packem_chunks/tar.js +3 -0
- package/dist/packem_chunks/tripwire.js +2 -0
- package/dist/packem_chunks/verify-lockfile.js +2 -0
- package/dist/packem_shared/Table-DoSoazT6-DwnyTUsA.js +12 -0
- package/dist/packem_shared/_commonjsHelpers-CLblCigl.js +1 -0
- package/dist/packem_shared/advisories-BxXiKFbL.js +1 -0
- package/dist/packem_shared/affected-shas-BdnlfiV1.js +1 -0
- package/dist/packem_shared/ai-analysis-KP8b5lc0.js +68 -0
- package/dist/packem_shared/ai-fix-BkPUHA0z.js +43 -0
- package/dist/packem_shared/anolilab-text-CAM_E6uK.js +13 -0
- package/dist/packem_shared/applyDefaults-BogleaFi.js +1 -0
- package/dist/packem_shared/build-scripts-DE6U8jVq.js +1 -0
- package/dist/packem_shared/cyclonedx-BpGVHqSW.js +4 -0
- package/dist/packem_shared/definePlugin-CWm4Dv_t.js +1 -0
- package/dist/packem_shared/dependency-scan-BUbOcMwX.js +1 -0
- package/dist/packem_shared/docker-CTE3s4LW.js +60 -0
- package/dist/packem_shared/failure-log-34Wl3npC.js +2 -0
- package/dist/packem_shared/giget-CcEy_Elm.js +2 -0
- package/dist/packem_shared/glob-D_7bct6p-D8itOHsr.js +1 -0
- package/dist/packem_shared/index-D1xC1Y_R.js +1 -0
- package/dist/packem_shared/index-DH-5hsrC.js +1 -0
- package/dist/packem_shared/index-hoWfZmNo.js +30 -0
- package/dist/packem_shared/license-zZU7aavK.js +1 -0
- package/dist/packem_shared/lifecycle-CXaqPGAQ.js +2 -0
- package/dist/packem_shared/lockfile-CrT86D6d.js +1 -0
- package/dist/packem_shared/lockfile-Cu2BH6bl.js +1 -0
- package/dist/packem_shared/manifests-BzWpKW8F.js +1 -0
- package/dist/packem_shared/min-release-age-BPVXwPUg.js +34 -0
- package/dist/packem_shared/native-config-sync-BRZZetn3.js +21 -0
- package/dist/packem_shared/osv-bloom-DSZcHLsM.js +2 -0
- package/dist/packem_shared/otelPlugin-CJR2T_lk.js +1 -0
- package/dist/packem_shared/peer-warnings-EvSJ18gE.js +1 -0
- package/dist/packem_shared/pm-runner-DmKT2FqF.js +1 -0
- package/dist/packem_shared/provenance-DkCA8BrN.js +1 -0
- package/dist/packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js +1 -0
- package/dist/packem_shared/registry-keys-Mixm4eAY.js +1 -0
- package/dist/packem_shared/resolve-explicit-D5E72FfN.js +5 -0
- package/dist/packem_shared/runtime-check-CilFOqUU.js +1 -0
- package/dist/packem_shared/s1ngularity-Qxc6tRRI.js +1 -0
- package/dist/packem_shared/scan-progress-DVtCtI2z.js +2 -0
- package/dist/packem_shared/selectors-DkgYFzdq.js +3 -0
- package/dist/packem_shared/signatures-byuFrtAH.js +2 -0
- package/dist/packem_shared/spinner-C8xs6QZv.js +1 -0
- package/dist/packem_shared/spinners-f91Rbo99-Bjf3NcO0.js +1 -0
- package/dist/packem_shared/symbols-CQmER5MT.js +1 -0
- package/dist/packem_shared/tabs-xZkm6Y_J.js +1 -0
- package/dist/packem_shared/toolchain-DoG6b_G_.js +5 -0
- package/dist/packem_shared/typosquats-BiDxQj7R.js +1 -0
- package/dist/packem_shared/use-measured-height-Lea6TCVD.js +1 -0
- package/dist/packem_shared/utils-DrNg0XTR.js +1 -0
- package/dist/packem_shared/verify-cLcZwKqe.js +1 -0
- package/dist/packem_shared/vis-update-app-BCKzlqj8.js +1 -0
- package/dist/packem_shared/watch-DEL0yol9.js +1 -0
- package/dist/packem_shared/watch-loop-C31Ar7BX.js +11 -0
- package/index.d.ts +436 -0
- package/index.js +613 -0
- package/package.json +71 -26
- package/schemas/project.schema.json +991 -0
- package/schemas/vis-config.schema.json +4958 -0
- package/skills/vis/SKILL.md +96 -0
- package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
- package/templates/buildkite-ci/template.yml +20 -0
- package/dist/ai-analysis.d.ts +0 -40
- package/dist/ai-cache.d.ts +0 -21
- package/dist/bin.d.ts +0 -1
- package/dist/catalog.d.ts +0 -110
- package/dist/commands/affected.d.ts +0 -3
- package/dist/commands/ai.d.ts +0 -3
- package/dist/commands/analyze.d.ts +0 -3
- package/dist/commands/check.d.ts +0 -3
- package/dist/commands/graph.d.ts +0 -3
- package/dist/commands/hook/constants.d.ts +0 -8
- package/dist/commands/hook/index.d.ts +0 -3
- package/dist/commands/hook/install.d.ts +0 -7
- package/dist/commands/hook/migrate.d.ts +0 -27
- package/dist/commands/hook/uninstall.d.ts +0 -3
- package/dist/commands/migrate/constants.d.ts +0 -12
- package/dist/commands/migrate/deps.d.ts +0 -32
- package/dist/commands/migrate/index.d.ts +0 -3
- package/dist/commands/migrate/json.d.ts +0 -20
- package/dist/commands/migrate/lint-staged.d.ts +0 -62
- package/dist/commands/migrate/types.d.ts +0 -20
- package/dist/commands/run.d.ts +0 -3
- package/dist/commands/staged.d.ts +0 -3
- package/dist/commands/update.d.ts +0 -3
- package/dist/config.d.ts +0 -40
- package/dist/config.js +0 -1
- package/dist/package-manager.d.ts +0 -23
- package/dist/workspace.d.ts +0 -58
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var yt=Object.defineProperty;var T=(e,t)=>yt(e,"name",{value:t,configurable:!0});import{createRequire as vt}from"node:module";import{q as tt,I as nt,e as U,T as X,E as F,j as wt}from"../packem_shared/Table-DoSoazT6-DwnyTUsA.js";import{M,l as B,B as Q,a as bt}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{b0 as Rt,an as ne,r as Be,b8 as xt,G as q,bI as At,B as Ct,J as St,X as st,bJ as Et,bK as ot,i as xe,h as jt,a as Tt,c as Ot,j as It,bL as Dt,k as Pe,R as _,l as Ut,d as Ae,n as W,bM as Nt,s as ve,T as Bt,bN as Pt,bO as Vt,bP as Mt,bQ as _t}from"./bin.js";import{H as Ft,e as qt,Z as Ve}from"../packem_shared/ai-analysis-KP8b5lc0.js";import{k as Lt,s as ce,b as rt,R as Wt}from"../packem_shared/pm-runner-DmKT2FqF.js";import{r as Gt,b as Ht,p as zt}from"../packem_shared/resolve-explicit-D5E72FfN.js";import{r as Kt,s as Jt}from"../packem_shared/typosquats-BiDxQj7R.js";import{U as Yt,C as Xt,a as Me}from"../packem_shared/vis-update-app-BCKzlqj8.js";import{h as it,P as at}from"../packem_shared/peer-warnings-EvSJ18gE.js";import{d as Zt}from"../packem_shared/utils-DrNg0XTR.js";import{r as tn,q as nn}from"../packem_shared/advisories-BxXiKFbL.js";import{E as sn}from"./config.js";const kt=vt(import.meta.url),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Qe=T(e=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[t,n]=ie.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return ie.getBuiltinModule(e)}return kt(e)},"__cjs_getBuiltinModule"),{createInterface:et}=Qe("node:readline"),{existsSync:Qt,realpathSync:en}=Qe("node:fs");var on=Object.defineProperty,ee=T((e,t)=>on(e,"name",{value:t,configurable:!0}),"s$1");const rn=ee(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"}},"resolvePnpm"),an=ee(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"}},"resolveYarnV1"),cn=ee(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"}},"resolveYarnBerry"),ln=ee((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"}},"resolveNpm"),un=ee(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"}},"resolveBun"),dn=ee((e,t)=>{const n=["outdated","--update"];return e.latest&&n.push("--latest"),e.interactive&&n.push("--interactive"),e.filters.length>0&&t.push("deno outdated has no --filter flag; ignoring."),(e.dev||e.prod)&&t.push("deno outdated has no --dev / --prod flags; dev/prod is governed by deno.json."),e.noOptional&&t.push("deno outdated has no --no-optional flag; ignoring."),e.noSave&&t.push("deno outdated has no --no-save flag; ignoring."),n.push(...e.packages),{args:n,bin:"deno"}},"resolveDeno"),pn=ee((e,t,n)=>{const s=[];if(n.global&&e!=="aube"&&e!=="deno")return{command:{args:["update","--global",...n.packages],bin:"npm"},warnings:s};let r;switch(e){case"aube":{const o=Lt(n);r={args:o.args,bin:o.bin},s.push(...o.warnings);break}case"bun":{r=un(n);break}case"deno":{r=dn(n,s);break}case"npm":{r=ln(n,s);break}case"pnpm":{r=rn(n);break}case"yarn":{r=t.startsWith("1.")?an(n):cn(n);break}default:{const o=e;throw new Error(`Unsupported package manager: ${String(o)}`)}}return{command:r,warnings:s}},"resolveUpdateCommand");var fn=Object.defineProperty,z=T((e,t)=>fn(e,"name",{value:t,configurable:!0}),"d$2");const ct=z(e=>{const t=e.indexOf("@");return t<=0?e:e.slice(0,t)},"stripVersionSpec"),gn=z(e=>{switch(e){case"docker":case"docker-compose":return"docker";case"github-actions":return"actions";case"gitlab-ci":return"gitlab";default:return}},"mapDependabotEcosystem"),mn=z((e,t)=>{const n=[".github/dependabot.yml",".github/dependabot.yaml"];for(const s of n){const r=M(e,s);if(!B(r))continue;let o;try{o=Rt(Q(r))}catch{continue}if(o?.updates){for(const i of o.updates){const a=gn(i["package-ecosystem"]);if(!(!a||!Array.isArray(i.ignore)))for(const d of i.ignore){const l=d["dependency-name"];typeof l=="string"&&l.length>0&&t[a].add(ct(l))}}return}}},"loadDependabot"),hn=Object.freeze({"docker-compose":"docker",dockerfile:"docker","github-actions":"actions",gitlabci:"gitlab","gitlabci-include":"gitlab"}),$n=Object.freeze({docker:"docker","github-tags":"actions"}),Ce=z((e,t)=>{if(t)for(const n of t)typeof n=="string"&&n.length>0&&e.add(ct(n))},"addAll"),yn=z(e=>{let t="",n=0;const{length:s}=e;let r=!1,o="";for(;n<s;){const i=e[n]??"";if(r){if(t+=i,i==="\\"&&n+1<s){t+=e[n+1]??"",n+=2;continue}i===o&&(r=!1),n+=1;continue}if(i==='"'||i==="'"){r=!0,o=i,t+=i,n+=1;continue}if(i==="/"&&e[n+1]==="/"){for(;n<s&&e[n]!==`
|
|
2
|
+
`;)n+=1;continue}if(i==="/"&&e[n+1]==="*"){for(n+=2;n<s&&!(e[n]==="*"&&e[n+1]==="/");)n+=1;n+=2;continue}if(i===","){let a=n+1;for(;a<s&&/\s/.test(e[a]??"");)a+=1;const d=e[a];if(d==="}"||d==="]"){n+=1;continue}}t+=i,n+=1}return t},"stripJsonComments"),vn=z((e,t)=>{const n=["renovate.json","renovate.json5",".renovaterc",".renovaterc.json"];for(const s of n){const r=M(e,s);if(!B(r))continue;let o;try{const a=Q(r);o=JSON.parse(yn(a))}catch{continue}if(!o)continue;if(Array.isArray(o.ignoreDeps))for(const a of["actions","docker","gitlab"])Ce(t[a],o.ignoreDeps);const i=[["github-actions","actions"],["dockerfile","docker"],["docker-compose","docker"],["gitlabci","gitlab"],["gitlabci-include","gitlab"]];for(const[a,d]of i){const l=o[a];Ce(t[d],l?.ignoreDeps)}if(!Array.isArray(o.packageRules))return;for(const a of o.packageRules){if(a.enabled!==!1)continue;const d=new Set;for(const c of a.matchManagers??[]){const f=hn[c];f&&d.add(f)}for(const c of a.matchDatasources??[]){const f=$n[c];f&&d.add(f)}d.size===0&&(d.add("actions"),d.add("docker"),d.add("gitlab"));const l=[...a.matchPackageNames??[],...a.matchDepNames??[],...a.matchPackagePatterns??[]];for(const c of d)Ce(t[c],l)}return}},"loadRenovate"),kn=z(e=>{const t={actions:new Set,docker:new Set,gitlab:new Set};return mn(e,t),vn(e,t),t},"loadIgnoreRules"),je=z((e,t,n)=>{const s=n[t];if(s.size===0)return!1;if(s.has(e))return!0;for(const r of s)if(/[*?[\]/.+]/.test(r))try{const o=r.replaceAll(/[.+^${}()|]/g,String.raw`\$&`).replaceAll("*",".*").replaceAll("?",".");if(new RegExp(`^${o}$`).test(e))return!0}catch{}return!1},"isIgnored");var wn=Object.defineProperty,ke=T((e,t)=>wn(e,"name",{value:t,configurable:!0}),"o$2");const G=ke(e=>{const t=e.trim();if(t==="")return;const n=t.startsWith("v")||t.startsWith("V")?t.slice(1):t,s=(ce.valid(n)?ce.parse(n):void 0)??ce.coerce(n,{includePrerelease:!0});if(s)return{major:s.major,minor:s.minor,normalized:`${String(s.major)}.${String(s.minor)}.${String(s.patch)}${s.prerelease.length>0?`-${s.prerelease.join(".")}`:""}`,patch:s.patch,prerelease:s.prerelease.length>0,raw:t}},"parseTag"),bn=ke((e,t)=>ce.rcompare(e.normalized,t.normalized),"compareTagsDesc"),Te=ke((e,t,n,s)=>{if(!t&&n!=="latest")return;const r=e.filter(o=>!s&&o.prerelease?!1:t?n==="patch"&&(o.major!==t.major||o.minor!==t.minor)||n==="minor"&&o.major!==t.major?!1:ce.gt(o.normalized,t.normalized):!0);if(r.length!==0)return r.toSorted(bn)[0]},"pickBestTag"),Oe=ke((e,t)=>!e||!t?"unknown":t.major!==e.major?"major":t.minor!==e.minor?"minor":t.patch!==e.patch?"patch":"unknown","classifyUpdate");var Rn=Object.defineProperty,Ie=T((e,t)=>Rn(e,"name",{value:t,configurable:!0}),"n$1");const xn="GitHub Actions",_e=Ie((e,t)=>`${e}@${t}`,"keyOf"),An=Ie(e=>({fixedVersions:e.fixedVersions,id:e.id,severity:e.severity,summary:e.summary}),"toAdvisory"),Cn=Ie((e,t)=>{if(t.length===0)return t;const n=tn(e);if(!Qt(n))return t;const s=new Map;for(const o of t){const i=o.currentVersion??o.currentRef;i&&s.set(_e(o.name,i),{name:o.name,version:i})}if(s.size===0)return t;const r=new Map;try{for(const[o,i]of s){const a=nn([i],{ecosystem:xn,workspaceRoot:e}).get(i.name);a&&a.length>0&&r.set(o,a)}}catch{return t}return r.size===0?t:t.map(o=>{const i=o.currentVersion??o.currentRef;if(!i)return o;const a=r.get(_e(o.name,i));return a?{...o,advisories:a.map(d=>An(d))}:o})},"decorateActionsAdvisories");var Sn=Object.defineProperty,En=T((e,t)=>Sn(e,"name",{value:t,configurable:!0}),"n");const lt=En(e=>{if(!e)return{};const t={};for(const n of e.split(",")){const s=/^\s*<([^>]+)>\s*;\s*(.+)$/.exec(n);if(!s)continue;const r=s[1]??"",o=s[2]??"";switch(/rel\s*=\s*"?([^";\s]+)"?/i.exec(o)?.[1]?.toLowerCase()){case"first":{t.first=r;break}case"last":{t.last=r;break}case"next":{t.next=r;break}case"prev":case"previous":{t.previous=r;break}}}return t},"parseLinkHeader");var jn=Object.defineProperty,Tn=T((e,t)=>jn(e,"name",{value:t,configurable:!0}),"l");class On{static{T(this,"ActionsResolver")}static{Tn(this,"ActionsResolver")}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}`,r=this.tagsCache.get(s);if(r)return r;const o=this.fetchTags(t,n);return this.tagsCache.set(s,o),o}async resolveRef(t,n,s){const r=`${t}/${n}@${s}`,o=this.commitCache.get(r);if(o)return o;const i=this.fetchCommit(t,n,s);return this.commitCache.set(r,i),i}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`,r={parsed:[],tags:[]},o=[];let i=s,a=0;for(;i&&a<5;){const l=i;let c;try{c=await this.fetchImpl(l,{headers:this.buildHeaders()})}catch{return r}if(!c.ok)return r;let f;try{f=await c.json()}catch{return r}if(!Array.isArray(f))return r;for(const g of f){const m=typeof g.name=="string"?g.name:"",h=typeof g.commit?.sha=="string"?g.commit.sha:"";m!==""&&h!==""&&o.push({name:m,sha:h})}i=lt(c.headers.get("link")).next,a+=1}const d=[];for(const l of o){const c=G(l.name);c&&d.push({...c,sha:l.sha})}return{parsed:d,tags:o}}async fetchCommit(t,n,s){const r=`${this.apiBase}/repos/${encodeURIComponent(t)}/${encodeURIComponent(n)}/commits/${encodeURIComponent(s)}`;try{const o=await this.fetchImpl(r,{headers:this.buildHeaders()});if(!o.ok)return;const i=await o.json();return typeof i.sha!="string"?void 0:{committedAt:i.commit?.committer?.date,sha:i.sha}}catch{return}}}var In=Object.defineProperty,ue=T((e,t)=>In(e,"name",{value:t,configurable:!0}),"f$1");const Dn=".github/workflows",Un=".github/actions",Nn=/^\s*-?\s*uses:\s*(['"]?)([^'"\s#]+)\1(?:\s*#\s*(.+))?\s*$/,Bn=/^[a-f0-9]{40}$/i,Pn=/actions-up-ignore-next-line(?::\s*(.+))?/i,Vn=/actions-up-ignore-start/i,Mn=/actions-up-ignore-end/i,_n=ue(e=>{const t=e.split("/");if(t.length<2)return;const[n,s,...r]=t;if(!(!n||!s))return{owner:n,repo:s,subpath:r.length>0?r.join("/"):void 0}},"splitSlug"),Fn=ue((e,t)=>{const n=t.split(/\r?\n/),s=[];let r,o=!1;for(const[i,a]of n.entries()){const d=a??"";if(Vn.test(d)&&(o=!0),Mn.test(d)){o=!1;continue}const l=d.trim(),c=l===""||l.startsWith("#")?Pn.exec(d):void 0;if(c){r=c[1]??"actions-up-ignore-next-line";continue}const f=Nn.exec(d);if(!f){r=void 0;continue}const g=f[1]??"",m=g==="'"||g==='"'?g:"",h=f[2]??"",x=f[3]?.trim();if(h.startsWith("./")||h.startsWith("../")||h.startsWith("docker://")){r=void 0;continue}const b=h.lastIndexOf("@");if(b<=0){r=void 0;continue}const v=h.slice(0,b),k=h.slice(b+1),w=_n(v);if(!w){r=void 0;continue}let p=r??(o?"actions-up-ignore-block":void 0);if(x){const $=/^actions-up-ignore(?:-next-line)?(?::\s*(.+))?(?:\s|$)/i.exec(x);$&&(p=p??$[1]??"actions-up-ignore")}r=void 0,s.push({file:e,ignoreReason:p,isSha:Bn.test(k),line:i+1,original:`${m}${h}${m}`,owner:w.owner,quote:m,ref:k,repo:w.repo,slug:v,subpath:w.subpath,trailingComment:x&&!p?x:void 0})}return s},"extractUsesFromContent"),Fe=ue(e=>e.endsWith(".yml")||e.endsWith(".yaml"),"isWorkflowFile"),qn=ue((e,t=[])=>{const n=[],s=new Set,r=ue(a=>{if(s.has(a))return;s.add(a);let d;try{d=Q(a)}catch{return}const l=Fn(a,d);n.push(...l)},"collectFile"),o=M(e,Dn);if(B(o))for(const a of ne(o,{includeDirs:!1,includeSymlinks:!1,maxDepth:1}))Fe(a.name)&&r(a.path);const i=M(e,Un);if(B(i))for(const a of ne(i,{includeDirs:!1,includeSymlinks:!1,maxDepth:3}))(a.name==="action.yml"||a.name==="action.yaml")&&r(a.path);for(const a of["action.yml","action.yaml"]){const d=M(e,a);B(d)&&r(d)}for(const a of t){const d=bt(a)?a:M(e,a);if(B(d))for(const l of ne(d,{includeDirs:!1,includeSymlinks:!1}))Fe(l.name)&&r(l.path)}return n},"scanActionsRepository");var Ln=Object.defineProperty,de=T((e,t)=>Ln(e,"name",{value:t,configurable:!0}),"p$2");const Wn=40,Gn=1440*60*1e3,Hn=new Set(["develop","edge","main","master","stable","trunk"]),zn=de(e=>e.length===Wn&&/^[a-f0-9]{40}$/i.test(e)?!1:Hn.has(e.toLowerCase())?!0:G(e)===void 0,"looksLikeBranch"),qe=de((e,t)=>{for(const n of t)try{if(new RegExp(n).test(e))return!0}catch{if(e.includes(n))return!0}return!1},"matchesPattern"),Kn=de((e,t,n,s)=>{const r=s==="sha"||e.isSha,{quote:o}=e;return r?`${o}${e.slug}@${t}${o} # ${n}`:`${o}${e.slug}@${n}${o}`},"buildReplacement"),Jn=de(async(e,t)=>{const{ignoreRules:n,options:s,references:r,resolverOptions:o}=t,i=[],a=[],d=[];if(r.length===0)return{failed:d,ignored:a,updates:i};const l=new On({apiBase:o?.apiBase,fetch:o?.fetch,token:s.githubToken??o?.token}),c=new Map;for(const v of r){const k=`${v.owner}/${v.repo}`,w=c.get(k)??[];w.push(v),c.set(k,w)}const f=Math.max(1,s.maxConcurrentRequests),g=[...c.keys()];let m=0;const h=de(async v=>{const k=c.get(v)??[],[w,p]=v.split("/");if(!w||!p)return;let $;try{$=await l.listTags(w,p)}catch{for(const u of k)d.push({file:u.file,reason:`failed to list tags for ${v}`});return}for(const u of k){const A=u.slug;let y;if(u.ignoreReason?y=u.ignoreReason:qe(A,s.exclude)?y="matched --exclude":s.include.length>0&&!qe(A,s.include)?y="not matched by --include":s.respectDependabotConfig&&n&&je(A,"actions",n)&&(y="ignored by dependabot/renovate config"),y){a.push({currentRef:u.ref,currentVersion:u.isSha?u.trailingComment?.replace(/^#\s*/,""):u.ref,ecosystem:"actions",file:u.file,ignored:!0,line:u.line,name:A,newRef:u.ref,newVersion:void 0,original:u.original,reason:y,replacement:u.original,updateType:"unknown"});continue}if(!s.includeBranches&&!u.isSha&&zn(u.ref)){a.push({currentRef:u.ref,currentVersion:u.ref,ecosystem:"actions",file:u.file,ignored:!0,line:u.line,name:A,newRef:u.ref,newVersion:void 0,original:u.original,reason:"branch reference (use --include-branches)",replacement:u.original,updateType:"unknown"});continue}const j=u.isSha?u.trailingComment?.replace(/^#\s*/,"").split(/\s+/)[0]??"":u.ref,R=G(j);if(u.isSha&&!R&&s.mode!=="latest"){a.push({currentRef:u.ref,currentVersion:void 0,ecosystem:"actions",file:u.file,ignored:!0,line:u.line,name:A,newRef:u.ref,newVersion:void 0,original:u.original,reason:`SHA pin has no version-hint comment; cannot apply --target=${s.mode}`,replacement:u.original,updateType:"unknown"});continue}const S=Te($.parsed,R,s.mode,!1);if(!S)continue;if(s.minAgeDays!==void 0){const O=await l.resolveRef(w,p,S.sha),K=O?.committedAt?new Date(O.committedAt).getTime():void 0;if(K&&(Date.now()-K)/Gn<s.minAgeDays){a.push({currentRef:u.ref,currentVersion:R?.raw,ecosystem:"actions",file:u.file,ignored:!0,line:u.line,name:A,newRef:u.ref,newVersion:S.raw,original:u.original,reason:`release younger than ${String(s.minAgeDays)} days`,replacement:u.original,updateType:"unknown"});continue}}const E=s.style==="sha"||u.isSha?S.sha:S.raw,P=Kn(u,S.sha,S.raw,s.style);i.push({currentRef:u.ref,currentVersion:R?.raw??u.trailingComment?.replace(/^#\s*/,""),ecosystem:"actions",file:u.file,line:u.line,name:A,newRef:E,newVersion:S.raw,original:u.original,replacement:P,updateType:Oe(R,S),url:`https://github.com/${w}/${p}/releases/tag/${S.raw}`})}},"processGroup"),x=[];for(let v=0;v<Math.min(f,g.length);v++)x.push((async()=>{for(;m<g.length;){const k=g[m];m+=1,k!==void 0&&await h(k)}})());await Promise.all(x);const b=Cn(e,i);return{failed:d,ignored:a,updates:b}},"checkActions");var Yn=Object.defineProperty,ut=T((e,t)=>Yn(e,"name",{value:t,configurable:!0}),"u$3");const Xn=ut(e=>e.toSorted((t,n)=>t.file!==n.file?t.file<n.file?-1:1:t.line-n.line),"orderUpdates"),Zn=ut(e=>{const t=[],n=[];if(e.length===0)return{applied:t,skipped:n};const s=Xn(e),r=new Map;for(const o of s){const i=r.get(o.file)??[];i.push(o),r.set(o.file,i)}for(const[o,i]of r){let a;try{a=Q(o)}catch(g){for(const m of i)n.push({reason:`read failed: ${g.message}`,update:m});continue}const d=a.includes(`\r
|
|
3
|
+
`)?`\r
|
|
4
|
+
`:`
|
|
5
|
+
`,l=a.split(/\r?\n/),c=[];for(const g of i){const m=g.line-1,h=l[m];if(h===void 0){n.push({reason:`line ${String(g.line)} out of range`,update:g});continue}const x=h.indexOf(g.original);if(x===-1){n.push({reason:"original token not found on expected line",update:g});continue}const b=h.slice(0,x),v=h.slice(x+g.original.length),k=/#\s*v?\d/.test(g.replacement)&&/^\s*#\s*v?\d[\w.+-]*\s*$/i.test(v)?"":v;l[m]=`${b}${g.replacement}${k}`,c.push(g)}if(c.length===0)continue;const f=l.join(d);try{sn(o,f),t.push(...c)}catch(g){for(const m of c)n.push({reason:`write failed: ${g.message}`,update:m})}}return{applied:t,skipped:n}},"applyEcosystemUpdates");var Qn=Object.defineProperty,me=T((e,t)=>Qn(e,"name",{value:t,configurable:!0}),"u$2");class es{static{T(this,"DockerRegistry")}static{me(this,"DockerRegistry")}tokens;fetchImpl;tagCache=new Map;constructor(t={}){this.tokens=t.tokens??{},this.fetchImpl=t.fetch??fetch}async listTags(t,n,s){const r=`${t}/${n}/${s}`,o=this.tagCache.get(r);if(o)return o;const i=t==="docker.io"?this.listDockerHubTags(n,s):this.listV2Tags(t,n,s);return this.tagCache.set(r,i),i}async listDockerHubTags(t,n){const s={parsed:[],raw:[]},r=[],o=new Map;let i=`https://hub.docker.com/v2/repositories/${encodeURIComponent(t)}/${encodeURIComponent(n)}/tags?page_size=100`,a=0;for(;i&&a<5;){try{const d=await this.fetchImpl(i,{headers:{Accept:"application/json"}});if(!d.ok)break;const l=await d.json();if(Array.isArray(l.results)){for(const c of l.results)if(typeof c.name=="string"&&(r.push(c.name),typeof c.last_updated=="string")){const f=Date.parse(c.last_updated);Number.isNaN(f)||o.set(c.name,f)}}i=typeof l.next=="string"?l.next:void 0}catch{break}a+=1}return r.length===0?s:{parsed:r.map(d=>{const l=G(d);if(l)return{...l,lastUpdated:o.get(d)}}).filter(d=>d!==void 0),raw:r}}async listV2Tags(t,n,s){const r={parsed:[],raw:[]},o=n==="library"?s:`${n}/${s}`,i={Accept:"application/json"},a=this.tokens[t]??process.env[`DOCKER_REGISTRY_TOKEN_${t.toUpperCase().replaceAll(/[^A-Z0-9]/g,"_")}`];a&&(i.Authorization=`Bearer ${a}`);const d=`https://${t}`,l=[];let c=`${d}/v2/${o}/tags/list?n=100`,f=i,g=0;const m=me(()=>{const h=[];for(const x of l){const b=G(x);b&&h.push({...b,lastUpdated:void 0})}return{parsed:h,raw:l}},"buildResult");for(;c&&g<5;){try{let h=await this.fetchImpl(c,{headers:f});if(h.status===401&&f===i){const v=ns(h.headers.get("www-authenticate"));if(v){const k=await this.fetchBearerToken(v);k&&(f={...i,Authorization:`Bearer ${k}`},h=await this.fetchImpl(c,{headers:f}))}}if(!h.ok)return g===0?r:m();const x=await h.json();if(!Array.isArray(x.tags))return g===0?r:m();for(const v of x.tags)typeof v=="string"&&l.push(v);const b=lt(h.headers.get("link"));c=b.next?new URL(b.next,d).toString():void 0}catch{return g===0?r:m()}g+=1}return l.length===0?r:m()}async fetchBearerToken(t){const n=new URLSearchParams({scope:t.scope,service:t.service}),s=`${t.realm}?${n.toString()}`;try{const r=await this.fetchImpl(s,{headers:{Accept:"application/json"}});if(!r.ok)return;const o=await r.json();return o.token??o.access_token}catch{return}}}const ts=me(e=>{const t=[];let n=0;const{length:s}=e;for(;n<s;){for(;n<s&&/\s/.test(e[n]??"");)n+=1;const r=n;for(;n<s&&e[n]!=="="&&e[n]!==",";)n+=1;const o=e.slice(r,n).trim();if(e[n]!=="="){for(;n<s&&e[n]!==",";)n+=1;n+=1;continue}n+=1;let i="";if(e[n]==='"'){for(n+=1;n<s&&e[n]!=='"';){if(e[n]==="\\"&&n+1<s){i+=e[n+1]??"",n+=2;continue}i+=e[n]??"",n+=1}n+=1}else{for(;n<s&&e[n]!==",";)i+=e[n]??"",n+=1;i=i.trim()}for(o.length>0&&t.push({key:o,value:i});n<s&&(/\s/.test(e[n]??"")||e[n]===",");)n+=1}return t},"splitAuthParams"),ns=me(e=>{if(!e)return;const t=/^Bearer\s+(.*)$/i.exec(e);if(!t)return;const n=new Map;for(const{key:o,value:i}of ts(t[1]??""))n.set(o.toLowerCase(),i);const s=n.get("realm"),r=n.get("service");if(s)return{realm:s,scope:n.get("scope")??"",service:r??""}},"parseAuthenticate");var ss=Object.defineProperty,H=T((e,t)=>ss(e,"name",{value:t,configurable:!0}),"d$1");const os="docker.io",rs="sha256:",he=H(e=>{const t=e.trim();if(t===""||t.startsWith("$")||t.includes("${")||t.includes("$("))return;let n=t,s;const r=n.indexOf(`@${rs}`);r!==-1&&(s=n.slice(r+1),n=n.slice(0,r));let o=os,i=n;const a=n.indexOf("/");if(a>0){const h=n.slice(0,a);(h==="localhost"||h.includes(".")||h.includes(":"))&&(o=h,i=n.slice(a+1))}let d="latest",l=i;const c=i.lastIndexOf(":");c!==-1&&!i.slice(c).includes("/")&&(d=i.slice(c+1),l=i.slice(0,c));let f="library",g=l;const m=l.indexOf("/");if(m!==-1&&(f=l.slice(0,m),g=l.slice(m+1)),g!=="")return{digest:s,name:g,namespace:f,original:t,registry:o,tag:d}},"parseImageReference"),$e=/vis-update-ignore-next-line/i,dt=/vis-update-ignore(?:\s|$|:)/i,pt=H(e=>{const t=e.trim();return t===""||t.startsWith("#")},"isCommentOnlyLine"),is=/^\s*FROM\s+(?:--\S+\s+)*([^\s#]+)(?:\s[^#]*)?(#.*)?$/i,as=H((e,t)=>{const n=t.split(/\r?\n/),s=[];let r=!1;for(const[o,i]of n.entries()){if($e.test(i)&&pt(i)){r=!0;continue}const a=is.exec(i);if(!a){i.trim()!==""&&!i.trim().startsWith("#")&&(r=!1);continue}const d=a[1]??"";if(d==="scratch"){r=!1;continue}const l=a[2]?.trim();let c=r?"vis-update-ignore-next-line":void 0;l&&$e.test(l)?c=c??"vis-update-ignore-next-line":l&&dt.test(l)&&(c=c??"vis-update-ignore");const f=he(d);r=!1,f&&s.push({...f,file:e,ignoreReason:c,kind:"dockerfile",line:o+1})}return s},"extractFromDockerfile"),cs=/^\s*image:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,ls=H((e,t)=>{const n=t.split(/\r?\n/),s=[];let r=!1;for(const[o,i]of n.entries()){if($e.test(i)&&pt(i)){r=!0;continue}const a=cs.exec(i);if(!a){i.trim()!==""&&!i.trim().startsWith("#")&&(r=!1);continue}const d=a[2]??"",l=a[3]?.trim();let c=r?"vis-update-ignore-next-line":void 0;l&&$e.test(l)?c=c??"vis-update-ignore-next-line":l&&dt.test(l)&&(c=c??"vis-update-ignore");const f=he(d);r=!1,f&&s.push({...f,file:e,ignoreReason:c,kind:"compose",line:o+1})}return s},"extractFromCompose"),Le=H(e=>{const t=e.toLowerCase();return t==="dockerfile"||t.startsWith("dockerfile.")?!0:t.endsWith(".dockerfile")},"isDockerfile"),us=H(e=>{const t=e.toLowerCase();return/^(?:docker-)?compose(?:\..+)?\.ya?ml$/.test(t)},"isComposeFile"),ds=new Set([".cache",".git",".nx",".pnpm-store",".turbo","build","dist","node_modules"]),ps=/(?:^|\/)(?:\.git|node_modules|\.pnpm-store|\.turbo|\.nx|dist|build|\.cache)(?:\/|$)/,fs=H(e=>{const t=[];if(!B(e))return t;const n=new Set,s=H((r,o)=>{let i;try{i=en.native(r)}catch{i=r}if(n.has(i))return;n.add(i);let a;try{a=Q(r)}catch{return}t.push(...o==="dockerfile"?as(r,a):ls(r,a))},"collect");for(const r of ne(e,{includeDirs:!1,includeSymlinks:!1,skip:[ps]})){const{name:o}=r;ds.has(o)||(Le(o)?s(r.path,"dockerfile"):us(o)&&s(r.path,"compose"))}for(const r of["Dockerfile","dockerfile","compose.yml","compose.yaml","docker-compose.yml","docker-compose.yaml"]){const o=M(e,r);B(o)&&s(o,Le(r)?"dockerfile":"compose")}return t},"scanDockerRepository");var gs=Object.defineProperty,Z=T((e,t)=>gs(e,"name",{value:t,configurable:!0}),"c");const ms=864e5,We=Z((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},"matchesPattern"),Ge=Z(e=>{const t=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return e.registry==="docker.io"?t:`${e.registry}/${t}`},"displayName"),hs=Z(e=>e.digest!==void 0&&e.digest.length>0,"hasDigestPin"),$s=Z(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}`},"buildRegistryUrl"),ys=Z((e,t)=>{const n=e.namespace==="library"?e.name:`${e.namespace}/${e.name}`;return`${e.registry==="docker.io"?n:`${e.registry}/${n}`}:${t}`},"buildReplacement"),ft=Z(async(e,t)=>{const{ignoreRules:n,options:s,references:r,registryOptions:o}=t,i=[],a=[],d=[];if(r.length===0)return{failed:d,ignored:a,updates:i};const l=new es({fetch:o?.fetch,tokens:o?.tokens}),c=new Map;for(const b of r){const v=`${b.registry}|${b.namespace}|${b.name}`,k=c.get(v)??[];k.push(b),c.set(v,k)}const f=Math.max(1,s.maxConcurrentRequests),g=[...c.keys()];let m=0;const h=Z(async b=>{const v=c.get(b)??[],k=v[0];if(!k)return;let w;try{w=await l.listTags(k.registry,k.namespace,k.name)}catch{for(const p of v)d.push({file:p.file,reason:`failed to list tags for ${Ge(p)}`});return}for(const p of v){const $=Ge(p);let u;if(p.ignoreReason?u=p.ignoreReason:We($,s.exclude)?u="matched --exclude":s.include.length>0&&!We($,s.include)?u="not matched by --include":s.respectDependabotConfig&&n&&je($,"docker",n)&&(u="ignored by dependabot/renovate config"),u){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:$,newRef:p.tag,newVersion:void 0,original:p.original,reason:u,replacement:p.original,updateType:"unknown"});continue}if(hs(p)){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:$,newRef:p.tag,newVersion:void 0,original:p.original,reason:"digest-pinned image (refresh the pin manually to update)",replacement:p.original,updateType:"digest"});continue}const A=G(p.tag);if(!A&&!s.includeBranches){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:$,newRef:p.tag,newVersion:void 0,original:p.original,reason:"non-semver tag (use --include-branches)",replacement:p.original,updateType:"unknown"});continue}if(!A&&s.mode!=="latest"){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:$,newRef:p.tag,newVersion:void 0,original:p.original,reason:`branch ref has no version baseline for --target=${s.mode}`,replacement:p.original,updateType:"unknown"});continue}const y=Te(w.parsed,A,s.mode,!1);if(!y)continue;if(s.minAgeDays!==void 0&&y.lastUpdated!==void 0&&(Date.now()-y.lastUpdated)/ms<s.minAgeDays){a.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,ignored:!0,line:p.line,name:$,newRef:y.raw,newVersion:y.raw,original:p.original,reason:`release younger than ${String(s.minAgeDays)} days`,replacement:p.original,updateType:"unknown"});continue}const j=y.raw,R=ys(p,j);i.push({currentRef:p.tag,currentVersion:p.tag,ecosystem:"docker",file:p.file,line:p.line,name:$,newRef:j,newVersion:j,original:p.original,replacement:R,updateType:Oe(A,y),url:$s(p)})}},"processGroup"),x=[];for(let b=0;b<Math.min(f,g.length);b++)x.push((async()=>{for(;m<g.length;){const v=g[m];m+=1,v!==void 0&&await h(v)}})());return await Promise.all(x),{failed:d,ignored:a,updates:i}},"checkDocker");var vs=Object.defineProperty,ks=T((e,t)=>vs(e,"name",{value:t,configurable:!0}),"g$1");class ws{static{T(this,"GitlabResolver")}static{ks(this,"GitlabResolver")}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),r=encodeURIComponent(s),o=`${n}/api/v4/projects/${r}/repository/tags?per_page=100`,i={Accept:"application/json","User-Agent":"vis-update-gitlab"};this.token&&(i[this.tokenHeader]=this.token);try{const a=await this.fetchImpl(o,{headers:i});if(!a.ok)return{error:`HTTP ${String(a.status)} from ${n}`,parsed:[],tags:[]};const d=await a.json();if(!Array.isArray(d))return{error:`unexpected response shape from ${n}`,parsed:[],tags:[]};const l=d.map(f=>({name:typeof f.name=="string"?f.name:"",sha:typeof f.commit?.id=="string"?f.commit.id:""})).filter(f=>f.name!==""),c=[];for(const f of l){const g=G(f.name);g&&c.push({...g,sha:f.sha})}return{parsed:c,tags:l}}catch(a){return{error:a instanceof Error?a.message:"fetch failed",parsed:[],tags:[]}}}}var bs=Object.defineProperty,ye=T((e,t)=>bs(e,"name",{value:t,configurable:!0}),"x");const Rs=/vis-update-ignore-next-line/i,ae=/vis-update-ignore(?:\s|$|:)/i,xs=new Set([".gitlab-ci.yaml",".gitlab-ci.yml"]),As=ye(e=>xs.has(e)||e.endsWith(".gitlab-ci.yml")||e.endsWith(".gitlab-ci.yaml"),"isGitlabCiFile"),Cs=/^\s*-?\s*project:\s*(['"]?)([^'"\s#]+)\1(?:\s*#.*)?$/,Ss=/^\s*ref:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,Es=/^\s*-?\s*component:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,js=/^\s*image:\s*(['"]?)([^'"\s#]+)\1(\s*#.*)?$/,Ts=/^\s*(?:-\s*)?(?:include:\s*)?\{([^}]*)\}\s*(?:#.*)?$/,Os=/project:\s*(['"]?)([^'"\s,}]+)\1/,Is=/ref:\s*(['"]?)([^'"\s,}]+)\1/,Ds=/component:\s*(['"]?)([^'"\s,}]+)\1/,Us=/^(\s*-\s*name:\s*)(['"]?)([^'"\s#]+)\2(\s*#.*)?$/,Ns=/^(\s*-\s*)(['"]?)([^'"\s#:]+:[^'"\s#]+)\2(\s*#.*)?$/,Bs=/^\s*-?\s*[a-z_][\w-]*:\s*(?:#.*)?$/i,Ps=ye((e,t)=>{const n=t.split(/\r?\n/),s=[],r=[];let o,i=!1,a=!1,d=-1;for(const[l,c]of n.entries()){const f=c??"",g=f.trim(),m=g===""||g.startsWith("#");if(Rs.test(f)&&m){i=!0;continue}const h=/^(\s*)services:\s*(?:#.*)?$/.exec(f);if(h){a=!0,d=h[1]?.length??0;continue}a&&g!==""&&!g.startsWith("-")&&!g.startsWith("#")&&f.search(/\S/)<=d&&(a=!1,d=-1);const x=js.exec(f);if(x){const p=x[2]??"",$=he(p);if($){const u=x[3]?.trim();let A=i?"vis-update-ignore-next-line":void 0;u&&ae.test(u)&&(A=A??"vis-update-ignore"),r.push({...$,file:e,ignoreReason:A,kind:"compose",line:l+1})}i=!1;continue}if(a){const p=Us.exec(f),$=p?void 0:Ns.exec(f),u=p??$;if(u){const A=u[3]??"",y=he(A);if(y){const j=u[4]?.trim();let R=i?"vis-update-ignore-next-line":void 0;j&&ae.test(j)&&(R=R??"vis-update-ignore"),r.push({...y,file:e,ignoreReason:R,kind:"compose",line:l+1})}}}const b=Cs.exec(f);if(b){o={line:l+1,project:b[2]??""};continue}const v=Ss.exec(f);if(v&&o){const p=v[3]?.trim();let $=i?"vis-update-ignore-next-line":void 0;p&&ae.test(p)&&($=$??"vis-update-ignore"),s.push({file:e,ignoreReason:$,kind:"project",line:l+1,original:v[2]??"",project:o.project,ref:v[2]??""}),o=void 0,i=!1;continue}const k=Es.exec(f);if(k){const p=k[2]??"",$=p.lastIndexOf("@");if($>0){const u=p.slice(0,$),A=p.slice($+1),y=u.lastIndexOf("/"),j=y>0?u.slice(0,y):u,R=y>0?u.slice(y+1):void 0,S=k[3]?.trim();let E=i?"vis-update-ignore-next-line":void 0;S&&ae.test(S)&&(E=E??"vis-update-ignore"),s.push({componentName:R,file:e,ignoreReason:E,kind:"component",line:l+1,original:p,project:j,ref:A})}i=!1;continue}const w=Ts.exec(f);if(w){const p=w[1]??"",$=/#(.*)$/.exec(f)?.[1]?.trim();let u=i?"vis-update-ignore-next-line":void 0;$&&ae.test($)&&(u=u??"vis-update-ignore");const A=Ds.exec(p);if(A){const y=A[2]??"",j=y.lastIndexOf("@");if(j>0){const R=y.slice(0,j),S=y.slice(j+1),E=R.lastIndexOf("/"),P=E>0?R.slice(0,E):R,O=E>0?R.slice(E+1):void 0;s.push({componentName:O,file:e,ignoreReason:u,kind:"component",line:l+1,original:y,project:P,ref:S})}}else{const y=Os.exec(p),j=Is.exec(p);y&&j&&s.push({file:e,ignoreReason:u,kind:"project",line:l+1,original:j[2]??"",project:y[2]??"",ref:j[2]??""})}i=!1;continue}g!==""&&!g.startsWith("#")&&!Bs.test(f)&&(i=!1)}return{images:r,includes:s}},"extractFromGitlabCi"),He=/^(?:\.git|node_modules|\.pnpm-store|\.turbo|\.nx|dist|build|\.cache)$/,Vs=ye(e=>{const t=[],n=[];if(!B(e))return{images:n,includes:t};const s=ye(o=>{let i;try{i=Q(o)}catch{return}const{images:a,includes:d}=Ps(o,i);t.push(...d),n.push(...a)},"collect");for(const o of[".gitlab-ci.yml",".gitlab-ci.yaml"]){const i=M(e,o);B(i)&&s(i)}const r=M(e,".gitlab");if(B(r))for(const o of ne(r,{includeDirs:!1,includeSymlinks:!1,skip:[He]}))(o.name.endsWith(".yml")||o.name.endsWith(".yaml"))&&s(o.path);for(const o of ne(e,{includeDirs:!1,includeSymlinks:!1,maxDepth:2,skip:[He]}))As(o.name)&&!n.some(i=>i.file===o.path)&&!t.some(i=>i.file===o.path)&&s(o.path);return{images:n,includes:t}},"scanGitlabRepository");var Ms=Object.defineProperty,le=T((e,t)=>Ms(e,"name",{value:t,configurable:!0}),"p$1");const ze=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},"matchesPattern"),_s=le((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}`},"buildReleaseUrl"),Fs=le(async(e,t)=>{const{ignoreRules:n,imageReferences:s,includes:r,options:o,registryOptions:i,resolverOptions:a}=t,d=[],l=[],c=[];if(s.length>0){const w=await ft(e,{ignoreRules:n,options:o,references:s,registryOptions:i});for(const p of w.updates)d.push({...p,ecosystem:"gitlab"});for(const p of w.ignored)l.push({...p,ecosystem:"gitlab"});c.push(...w.failed)}if(r.length===0)return{failed:c,ignored:l,updates:d};const f=new ws({apiBase:a?.apiBase,fetch:a?.fetch,token:o.gitlabToken??a?.token}),g=a?.apiBase??"https://gitlab.com",m=new Map;for(const w of r){const p=m.get(w.project)??[];p.push(w),m.set(w.project,p)}const h=Math.max(1,o.maxConcurrentRequests),x=[...m.keys()];let b=0;const v=le(async w=>{const p=m.get(w)??[];let $;try{$=await f.listTags(w)}catch{for(const u of p)c.push({file:u.file,reason:`failed to list tags for ${w}`});return}if($.error){for(const u of p)c.push({file:u.file,reason:`failed to list tags for ${w}: ${$.error}`});return}for(const u of p){const A=u.kind==="component"&&u.componentName?`${u.project}/${u.componentName}`:u.project;let y;u.ignoreReason?y=u.ignoreReason:ze(A,o.exclude)?y="matched --exclude":o.include.length>0&&!ze(A,o.include)?y="not matched by --include":o.respectDependabotConfig&&n&&je(A,"gitlab",n)&&(y="ignored by dependabot/renovate config");const j=le(P=>({currentRef:u.ref,currentVersion:u.ref,ecosystem:"gitlab",file:u.file,ignored:!0,line:u.line,name:A,newRef:u.ref,newVersion:void 0,original:u.original,reason:P,replacement:u.original,updateType:"unknown"}),"buildIgnored");if(y){l.push(j(y));continue}const R=G(u.ref);if(!R&&!o.includeBranches){l.push(j("branch reference (use --include-branches)"));continue}if(!R&&o.mode!=="latest"){l.push(j(`branch ref has no version baseline for --target=${o.mode}`));continue}const S=Te($.parsed,R,o.mode,!1);if(!S)continue;let E;u.kind==="component"?E=`${u.componentName?`${u.project}/${u.componentName}`:u.project}@${S.raw}`:E=S.raw,d.push({currentRef:u.ref,currentVersion:R?.raw??u.ref,ecosystem:"gitlab",file:u.file,line:u.line,name:A,newRef:S.raw,newVersion:S.raw,original:u.original,replacement:E,updateType:Oe(R,S),url:_s(u.project,S.raw,g)})}},"processGroup"),k=[];for(let w=0;w<Math.min(h,x.length);w++)k.push((async()=>{for(;b<x.length;){const p=x[b];b+=1,p!==void 0&&await v(p)}})());return await Promise.all(k),{failed:c,ignored:l,updates:d}},"checkGitlab");var qs=Object.defineProperty,Ls=T((e,t)=>qs(e,"name",{value:t,configurable:!0}),"r$1");const Ws={disabled:new Set,exclude:[],githubToken:void 0,gitlabToken:void 0,include:[],includeBranches:!1,maxConcurrentRequests:8,minAgeDays:void 0,mode:"latest",respectDependabotConfig:!0,style:"sha"},Gs=Ls(async e=>{const t={...Ws,...e.options,disabled:e.options?.disabled??new Set},n=t.respectDependabotConfig?kn(e.workspaceRoot):void 0,s={actions:{failed:[],ignored:[],updates:[]},docker:{failed:[],ignored:[],updates:[]},gitlab:{failed:[],ignored:[],updates:[]}},r=[];let o=0;if(!t.disabled.has("actions")){const d=qn(e.workspaceRoot);d.length>0&&(o+=1,r.push(Jn(e.workspaceRoot,{ignoreRules:n,options:t,references:d}).then(l=>{s.actions=l})))}if(!t.disabled.has("docker")){const d=fs(e.workspaceRoot);d.length>0&&(o+=1,r.push(ft(e.workspaceRoot,{ignoreRules:n,options:t,references:d}).then(l=>{s.docker=l})))}if(!t.disabled.has("gitlab")){const{images:d,includes:l}=Vs(e.workspaceRoot);d.length+l.length>0&&(o+=1,r.push(Fs(e.workspaceRoot,{ignoreRules:n,imageReferences:d,includes:l,options:t}).then(c=>{s.gitlab=c})))}await Promise.all(r);const i=[...s.actions.updates,...s.docker.updates,...s.gitlab.updates],a=[...s.actions.ignored,...s.docker.ignored,...s.gitlab.ignored];return{failed:[...s.actions.failed,...s.docker.failed,...s.gitlab.failed],ignored:a,perEcosystem:s,scanned:o,updates:i}},"checkEcosystems");var Hs=Object.defineProperty,se=T((e,t)=>Hs(e,"name",{value:t,configurable:!0}),"r");const zs={actions:"GitHub Actions",docker:"Docker",gitlab:"GitLab CI"},Se=se(e=>e.updateType==="major","isBreakingUpdate"),Ks=se(e=>{switch(e){case"major":return X;case"minor":return U;case"patch":return nt;default:return tt}},"colorForUpdateType"),Ke=se(e=>{const t=Ks(e.updateType),n=e.currentVersion??e.currentRef,s=e.newVersion??e.newRef,r=e.url?` ${F(e.url)}`:"",o=e.advisories&&e.advisories.length>0?` ${X(`⚠ ${String(e.advisories.length)} advisor${e.advisories.length===1?"y":"ies"}`)}`:"";return` ${t(e.updateType.padEnd(7))} ${e.name} ${F(n)} → ${s}${o}${r}`},"formatUpdateLine"),Je=se(e=>!e.advisories||e.advisories.length===0?[]:e.advisories.map(t=>` ${t.severity==="CRITICAL"||t.severity==="HIGH"?X(t.severity):U(t.severity)} ${t.id} ${F(t.summary)}`),"formatAdvisoryLines"),Js=se((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(`${nt("✓")} All ecosystem references up to date.`),n.join(`
|
|
6
|
+
`);if(n.push(`${U("⚠")} No actionable updates found.`),e.failed.length>0){n.push(`
|
|
7
|
+
${U("Failed lookups:")}`);for(const o of e.failed)n.push(` ${o.file}: ${o.reason}`)}if(t.showIgnored&&e.ignored.length>0){n.push(`
|
|
8
|
+
${F("Ignored:")}`);for(const o of e.ignored)n.push(` ${F(o.name)} ${F(o.reason??"")}`)}return n.join(`
|
|
9
|
+
`)}n.push(`
|
|
10
|
+
${tt("Ecosystem updates")} — ${String(s)} reference${s===1?"":"s"} can be bumped:`);const r=e.updates.filter(o=>Se(o));if(r.length>0){n.push(`
|
|
11
|
+
${X(wt(`⚠ Breaking changes (${String(r.length)})`))}`),n.push(` ${F("Review release notes before applying — these cross a major-version boundary.")}`);for(const o of r)n.push(Ke(o)),n.push(...Je(o))}for(const o of Object.keys(e.perEcosystem)){const i=e.perEcosystem[o];if(i.updates.length!==0){n.push(`
|
|
12
|
+
${zs[o]} (${String(i.updates.length)})`);for(const a of i.updates)n.push(Ke(a)),n.push(...Je(a))}}if(t.showIgnored&&e.ignored.length>0){n.push(`
|
|
13
|
+
${F("Ignored:")}`);for(const o of e.ignored)n.push(` ${F(o.name)} ${F(o.reason??"")}`)}if(e.failed.length>0){n.push(`
|
|
14
|
+
${U("Failed lookups:")}`);for(const o of e.failed)n.push(` ${o.file}: ${o.reason}`)}return t.previewOnly&&n.push(`
|
|
15
|
+
${U("ℹ")} ${F("Not applied automatically — re-run with `--interactive` to choose which to apply, or `--yes` to apply all.")}`),n.join(`
|
|
16
|
+
`)},"formatEcosystemReport"),Ys=se(e=>JSON.stringify({ecosystems:{failed:e.failed,ignored:e.ignored,perEcosystem:e.perEcosystem,scanned:e.scanned,updates:e.updates}},void 0,2),"formatEcosystemJson");var Xs=Object.defineProperty,te=T((e,t)=>Xs(e,"name",{value:t,configurable:!0}),"o");const Zs=te(()=>{const e=et({input:process.stdin,output:process.stdout});return{ask:te(t=>new Promise(n=>{e.question(t,s=>{n(s.trim())})}),"ask"),close:te(()=>{e.close()},"close"),write:te(t=>{process.stdout.write(`${t}
|
|
17
|
+
`)},"write")}},"createReadlineIO"),Qs=te((e,t)=>e.split(",").map(n=>Number.parseInt(n.trim(),10)-1).filter(n=>Number.isInteger(n)&&n>=0&&n<t),"parseIndexSelection"),eo=te(async(e,t=Zs())=>{if(e.length===0)return t.close(),[];t.write(""),t.write("Outdated ecosystem references:");for(const[s,r]of e.entries()){const o=r.currentVersion??r.currentRef,i=r.newVersion??r.newRef,a=Se(r)?" [BREAKING]":"";t.write(` ${String(s+1)}. [${r.ecosystem}] ${r.name}: ${o} → ${i} (${r.updateType})${a}`)}t.write("");const n=(await t.ask("Apply updates? [a]ll / [s]afe / [n]one / numbers: ")).toLowerCase();if(n==="a"||n==="all")return t.close(),e;if(n==="s"||n==="safe")return t.close(),e.filter(s=>!Se(s));if(n==="n"||n==="none"||n==="")return t.close(),[];if(/^[\d ,]+$/.test(n)){const s=Qs(n,e.length);return t.close(),s.map(r=>e[r]).filter(r=>r!==void 0)}return t.close(),[]},"promptEcosystemSelection");var to=Object.defineProperty,N=T((e,t)=>to(e,"name",{value:t,configurable:!0}),"y");const gt=N(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}},"parseTimeStringToMinutes"),no=N(e=>{const t=e.trim();return/^\d+(?:\.\d+)?$/.test(t)?Number.parseFloat(t)*1440:gt(t)},"parseNpmReleaseAgeValue"),So=N(e=>!Number.isFinite(e)||e<=0?"0m":e%1440===0?`${String(e/1440)}d`:e%60===0?`${String(e/60)}h`:`${String(e)}m`,"formatMinutesAsTimeString"),so=N((e,t)=>{try{switch(t){case"bun":{const n=M(e,"bunfig.toml");if(B(n)){const s=xt(n),r=s?.install?.minimumReleaseAge;return{excludes:Array.isArray(s?.install?.minimumReleaseAgeExcludes)?s.install.minimumReleaseAgeExcludes:void 0,minutes:typeof r=="number"?Math.round(r/60):void 0}}break}case"npm":{const n=M(e,".npmrc");if(B(n)){const s=Q(n),r=/^\s*min-release-age\s*=\s*([^\s#;]+)/m.exec(s);return{minutes:r?no(r[1]):void 0}}break}case"pnpm":{const n=M(e,"pnpm-workspace.yaml");if(B(n)){const s=Be(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=M(e,".yarnrc.yml");if(B(n)){const s=Be(n)?.npmMinimalAgeGate;if(typeof s=="string")return{minutes:gt(s)};if(typeof s=="number")return{minutes:s}}break}}}catch{}return{}},"readPmNativeMinimumReleaseAge"),oo=N((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 r=e.maxConcurrentRequests,o=typeof r=="number"&&r>0?r:t.maxConcurrentRequests,i=typeof e.releaseChannel=="string"?e.releaseChannel.toLowerCase():void 0;if(i!==void 0&&!["any","same","stable"].includes(i))throw new Error(`Invalid --release-channel "${String(e.releaseChannel)}". Use: any, same, or stable.`);const a=i??t.releaseChannel;return{exclude:[...q(e.exclude),...q(t.exclude)],ignore:q(t.ignore),include:[...q(e.include),...q(t.include),...n],includeLocked:e.includeLocked||t.includeLocked||!1,includePrerelease:e.prerelease||t.prerelease||!1,maxConcurrentRequests:o,minimumReleaseAge:t.minimumReleaseAge,minimumReleaseAgeExclude:t.minimumReleaseAgeExclude,packageMode:t.packageMode,releaseChannel:a,security:e.security===!1?!1:e.ai||(t.security??!0),target:s}},"buildCatalogCheckOptions"),Ye=N((e,t)=>{if(e.length!==0){t.info(`
|
|
18
|
+
${U("⚠")} ${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})`)}},"logFilteredByTarget"),Xe=N((e,t,n,s,r)=>{n==="json"?process.stdout.write(`${At({checkedCount:0,failed:t,filteredByTarget:[],ignored:[],outdated:e})}
|
|
19
|
+
`):n==="minimal"?process.stdout.write(`${Ct(e)}
|
|
20
|
+
`):(St(e,s),s.info(st(e,r)))},"writeFormattedOutput"),Ze=N(async(e,t,n,s,r,o,i)=>{const a=Et(e,n,t,!0,{useEditorconfig:i}),d=t==="pnpm"?"pnpm-workspace.yaml":"package.json";if(r.info(`
|
|
21
|
+
Updated ${d}`),a&&r.info(`Backup saved to ${a}`),s.changelog){r.info(`
|
|
22
|
+
Fetching changelogs...`);const l=await ot(n,void 0,o);for(const c of l){const f=c.releaseUrl??c.repoUrl??c.npmUrl;r.info(` ${c.packageName}: ${f}`)}}if(s.install??!0){const l=t,c=["install"];r.info(`Running ${l} ${c.join(" ")}...
|
|
23
|
+
`);try{const{code:f,output:g}=await rt(l,c,{cwd:e,env:process.env});f!==0?r.warn(`${l} ${c.join(" ")} failed. You may need to run it manually.`):s.peer!==!0&&it(g)&&r.info(at)}catch{r.warn(`${l} ${c.join(" ")} failed. You may need to run it manually.`)}}},"applyCatalogAndInstall"),Ee={applied:!1,canceled:!1,jsonEmitted:!1},ro=N(async(e,t,n,s,r,o)=>{const i=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[C,I]of a)s[C]&&o.warn(`${U("⚠")} ${I}, ignoring.`);const d=xe("minReleaseAge"),{excludes:l,minutes:c}=d?{excludes:void 0,minutes:void 0}:so(e,t),f=d?void 0:i.minimumReleaseAge??c,g=d?void 0:i.minimumReleaseAgeExclude??l;if(d&&(i.minimumReleaseAge!==void 0||c!==void 0)&&o.info("minimumReleaseAge gate disabled via MARSHALL_DISABLE_MIN_RELEASE_AGE."),!d&&i.minimumReleaseAge!==void 0&&c!==void 0&&i.minimumReleaseAge!==c){const C=t==="pnpm"?"pnpm-workspace.yaml":"bunfig.toml";o.warn(`${U("⚠")} minimumReleaseAge mismatch: vis config = ${String(i.minimumReleaseAge)} min, ${C} = ${String(c)} min. Consider keeping them in sync.`)}const m=jt(e),h=s["include-internal"],x=s.peer,b=Tt(e,t,{depFields:i.depFields,dev:s.dev,includeInternal:h,peer:x,prod:s.prod});if(b.size===0)return o.info("No catalogs found."),Ee;const v={...i,minimumReleaseAge:f,minimumReleaseAgeExclude:g},k=oo(s,v,r);let w=0;for(const C of b.values())w+=C.size;const p=!!process.stdout.isTTY&&!ve;let $;const u=p?(C,I)=>{$?$.rerender(_.createElement(Me,{current:C,total:I})):(process.stdout.write(`
|
|
24
|
+
`),$=Pe(_.createElement(Me,{current:C,total:I}),{interactive:!0,patchConsole:!1}))}:(C,I)=>{o.info(`Checking ${String(C)}/${String(I)} dependencies...`)};p||o.info(`Checking ${String(w)} catalog dependencies...
|
|
25
|
+
`);const A=new Set;xe("socket")&&A.add("socket"),xe("depsDev")&&A.add("deps-dev");const y=n.security?.policies?.score?.minimum,j=Ot(n.security,{disabled:A,minimumScore:y}),{checkedCount:R,failed:S,filteredByTarget:E,ignored:P,outdated:O}=await It(b,k,m,u,e,j,n.security?.acceptedRisks);$&&($.clear(),$.unmount());const K=h?{ignored:[],outdated:[]}:Dt(e,{depFields:i.depFields,dev:s.dev,exclude:k.exclude,ignore:k.ignore,include:k.include,packageMode:k.packageMode,peer:x,prod:s.prod,target:k.target});if(K.outdated.length>0){const C=new Set(O.map(I=>`${I.catalogName}|${I.packageName}`));for(const I of K.outdated)C.has(`${I.catalogName}|${I.packageName}`)||O.push(I)}if(K.ignored.length>0)for(const C of K.ignored)P.includes(C)||P.push(C);const De=R-O.length-S.length;if(S.length>0&&o.warn(`Failed to fetch: ${S.join(", ")}`),P.length>0&&o.info(`Skipped ${String(P.length)} ignored package${P.length===1?"":"s"}: ${P.join(", ")}`),!p&&R>O.length){const C=[...b.values()].reduce((re,we)=>re+we.size,0),I=C>R?` (${String(C)} catalog entries, ${String(C-R)} duplicates)`:"";o.info(`Checked ${String(R)} unique packages${I}: ${String(O.length)} outdated, ${String(De)} up-to-date${S.length>0?`, ${String(S.length)} failed`:""}${E.length>0?`, ${String(E.length)} skipped by target`:""}`)}if(O.length===0)return E.length>0?o.info(`All catalog dependencies are up to date within the current target.
|
|
26
|
+
${String(E.length)} package${E.length===1?" has":"s have"} newer versions available with --target latest:
|
|
27
|
+
${E.map(C=>` ${C.packageName} ${C.currentRange} → ${C.newRange} (${C.updateType})`).join(`
|
|
28
|
+
`)}`):o.info("All catalog dependencies are up to date."),Ee;const J=s.format??i.format??"table";let L;if(s.ai){const C=Ft(s.aiType??"impact");L=await qt(O,o,n.ai,C)}const pe=!!s.dryRun;if(!pe&&r.length>0&&s.marshallCheck!==!1){const C=await Gt(r);if(C.length>0){const I=await Ht(C,{config:n?.security?.marshalls,workspaceRoot:e});if(!await zt(I))return process.exitCode=1,{applied:!1,canceled:!0,jsonEmitted:!1}}}if(p&&J==="table"){const C=new Yt(O,L??null);let I;if(s.changelog){o.info("Fetching changelogs...");const D=await ot(O,void 0,m);I=new Map;for(const V of D){const Y=V.releaseUrl??V.repoUrl??V.npmUrl;Y&&I.set(V.packageName,Y)}}const re=n.tui?.autoExit??!1,we=re===!0?3:typeof re=="number"?re:0,Ue=await Pe(_.createElement(Xt,{autoExitSeconds:we,changelogUrls:I,checkedCount:R,filteredOutEntries:E,isDryRun:pe,store:C,totalCatalogEntries:w}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),be=process.stdout.columns||80;process.stdout.write(`
|
|
29
|
+
`);for(const D of O){const V=D.vulnerabilities?.length||D.socketReport&&D.socketReport.alerts.length>0,Y=!!D.acceptedRisk,Re=V?Y?"✓":"⚠":"✓",ht=Y?"gray":D.updateType==="major"?"red":D.updateType==="minor"?"yellow":"green",ge=D.socketReport?.score.overall,$t=ge===void 0?"":` [${String(Math.round(ge*100))}%]`,Ne=ge===void 0?void 0:Ut(ge);process.stdout.write(`${Ae(_.createElement(W,null," ",_.createElement(W,{color:ht},Re),` ${D.packageName} ${D.currentRange} → ${D.newRange}`,_.createElement(W,{dimColor:!0},` ${D.updateType}`),Ne?_.createElement(W,{color:Ne},$t):null),{columns:be})}
|
|
30
|
+
`)}if(process.stdout.write(`
|
|
31
|
+
`),o.info(st(O,y)),R>O.length){const D=[...b.values()].reduce((Y,Re)=>Y+Re.size,0),V=D>R?` (${String(D)} catalog entries, ${String(D-R)} duplicates)`:"";o.log(),o.info(`Checked ${String(R)} unique packages${V}: ${String(De)} up-to-date${S.length>0?`, ${String(S.length)} failed`:""}`)}if(E.length>0){process.stdout.write(`
|
|
32
|
+
`);const D=`${String(E.length)} package${E.length===1?"":"s"} skipped by target constraint (use --target latest to include):`;process.stdout.write(`${Ae(_.createElement(W,{color:"yellow"},` ${D}`),{columns:be})}
|
|
33
|
+
`);for(const V of E)process.stdout.write(`${Ae(_.createElement(W,null," ",_.createElement(W,{dimColor:!0},V.packageName),` ${V.currentRange} → ${V.newRange}`,_.createElement(W,{dimColor:!0},` ${V.updateType}`)),{columns:be})}
|
|
34
|
+
`)}const fe=Array.isArray(Ue)?Ue:[];if(fe.length>0&&!pe){o.info(`
|
|
35
|
+
Applying ${String(fe.length)} updates...
|
|
36
|
+
`);const D={...s,install:s.install??i.install};return await Ze(e,t,fe,D,o,m,n.editorconfig??!0),{applied:!0,canceled:!1,jsonEmitted:!1}}return{applied:!1,canceled:fe.length===0,jsonEmitted:!1}}if(pe){if(J==="json"){const C={failed:S,filteredByTarget:E,ignored:P,outdated:O};L&&(C.aiAnalysis=L),process.stdout.write(`${JSON.stringify(C,void 0,2)}
|
|
37
|
+
`)}else o.info(`Would update ${String(O.length)} dependencies:
|
|
38
|
+
`),Xe(O,S,J,o,y),L&&(o.info(""),o.info(Ve(L))),Ye(E,o);return{applied:!1,canceled:!1,jsonEmitted:J==="json"}}L&&J!=="json"&&(o.info(Ve(L)),o.info(""));let oe=O;if(s.interactive&&(oe=await Nt(O),oe.length===0))return o.info("No updates selected."),{applied:!1,canceled:!0,jsonEmitted:!1};o.info(`Updating ${String(oe.length)} catalog dependencies...
|
|
39
|
+
`),Xe(oe,[],J,o,y),Ye(E,o);const mt={...s,install:s.install??i.install};return await Ze(e,t,oe,mt,o,m),{applied:!0,canceled:!1,jsonEmitted:J==="json"}},"executeCatalogUpdate"),io=N(async(e,t,n,s,r,o)=>{const i={dev:s.dev,filters:q(s.filter),global:s.global,interactive:s.interactive,latest:s.latest||s.target==="latest",noOptional:s.optional===!1,noSave:s.save===!1,packages:r,prod:s.prod,recursive:s.recursive,workspaceRoot:s.workspaceRoot},{command:a,warnings:d}=pn(t,n,i);for(const c of d)o.warn(c);const l=`${a.bin} ${a.args.join(" ")}`.trim();if(s.dryRun)return o.info(`Would run: ${l}`),Ee;o.info(`Running: ${l}`);try{const{code:c,output:f}=await rt(a.bin,a.args,{cwd:e,env:process.env});if(c!==0)return o.error(`
|
|
40
|
+
${X("✖")} Update failed (exit code ${String(c)})`),o.error(` Command: ${l}`),o.error(` Directory: ${e}
|
|
41
|
+
`),process.exitCode=c,{applied:!1,canceled:!1,jsonEmitted:!1};s.peer!==!0&&it(f)&&o.info(at)}catch(c){const f=c.status??1;return o.error(`
|
|
42
|
+
${X("✖")} Update failed (exit code ${String(f)})`),o.error(` Command: ${l}`),o.error(` Directory: ${e}
|
|
43
|
+
`),process.exitCode=f,{applied:!1,canceled:!1,jsonEmitted:!1}}return{applied:!0,canceled:!1,jsonEmitted:!1}},"executePmWrapper"),ao=N(async(e,t,n)=>{const s=e.latest===!0||e.target==="latest";if(t||!s||e.dryRun===!0||e.yes===!0||e.interactive===!0)return!0;if(!(process.stdout.isTTY&&!ve))return n.error(`${X("✖")} Refusing to run blanket --latest update in a non-interactive context.`),n.error(" Re-run with --yes to confirm, --dry-run to preview, or pass explicit package names."),process.exitCode=1,!1;const r=et({input:process.stdin,output:process.stdout});try{const o=(await new Promise(i=>{r.question(`${U("⚠")} About to upgrade ALL dependencies to their latest versions. This may include breaking changes.
|
|
44
|
+
Continue? [y/N] `,i)})).trim().toLowerCase();return o==="y"||o==="yes"?!0:(n.info("Aborted."),!1)}finally{r.close()}},"requireBlanketUpdateConfirmation"),co=N((e,t)=>{const n=new Set;e.actions===!1&&n.add("actions"),e.docker===!1&&n.add("docker"),e.gitlab===!1&&n.add("gitlab");const s=e.style??"sha";if(s!=="sha"&&s!=="preserve")throw new Error(`Invalid --style "${s}". Use: sha or preserve.`);const r=e.latest===!0?"latest":e.target??"latest";if(r!=="latest"&&r!=="minor"&&r!=="patch")throw new Error(`Invalid target "${r}". Use: latest, minor, or patch.`);const o=r,i=t.update??{};return{disabled:n,exclude:[...q(e.exclude),...q(i.exclude)],githubToken:e.actionsToken??void 0,gitlabToken:e.gitlabToken??void 0,include:q(e.include),includeBranches:e.includeBranches===!0,maxConcurrentRequests:typeof e.maxConcurrentRequests=="number"&&e.maxConcurrentRequests>0?e.maxConcurrentRequests:8,minAgeDays:typeof i.minimumReleaseAge=="number"&&i.minimumReleaseAge>0?i.minimumReleaseAge/1440:void 0,mode:o,respectDependabotConfig:!0,style:s}},"buildEcosystemOptions"),lo=N((e,t)=>e.dryRun===!0||process.exitCode!==void 0&&process.exitCode!==0||t.canceled?!1:e.yes===!0?!0:e.interactive===!0&&!!process.stdout.isTTY&&!ve,"shouldApplyEcosystem"),uo=N(async(e,t,n,s,r)=>{const o=co(t,n);if(o.disabled.size===3)return;let i;try{i=await Gs({options:o,workspaceRoot:e})}catch(m){s.warn(`${U("⚠")} Ecosystem update scan failed: ${m.message}`);return}if(i.scanned===0)return i;const a=t.format??"table",d=!!t.dryRun,l=lo(t,r);if(a==="json")r.jsonEmitted?s.warn(`${U("⚠")} ${String(i.updates.length)} ecosystem update${i.updates.length===1?"":"s"} available but not emitted in --format=json (catalog already wrote one JSON document). Rerun with --format=table or --no-catalog to see them.`):process.stdout.write(`${Ys(i)}
|
|
45
|
+
`);else if(a!=="minimal"){const m=Js(i,{previewOnly:!l&&!d,showIgnored:t.interactive===!0});m&&s.info(m)}if(i.updates.length===0)return i;if(d)return a==="minimal"&&s.info(`
|
|
46
|
+
${U("ℹ")} ${String(i.updates.length)} ecosystem reference${i.updates.length===1?"":"s"} can be bumped — not applied (--dry-run). Re-run without --dry-run and with \`--interactive\` or \`--yes\` to apply.`),i;if(!l)return a==="minimal"&&s.info(`
|
|
47
|
+
${U("ℹ")} ${String(i.updates.length)} ecosystem reference${i.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).`),i;let c=i.updates;if(t.interactive===!0&&process.stdout.isTTY&&!ve&&(c=await eo(i.updates),c.length===0))return s.info(`${U("ℹ")} No ecosystem updates selected.`),i;const{applied:f,skipped:g}=Zn(c);if(f.length>0&&s.info(`
|
|
48
|
+
${String(f.length)} ecosystem reference${f.length===1?"":"s"} updated.`),g.length>0){s.warn(`${U("⚠")} ${String(g.length)} ecosystem update${g.length===1?"":"s"} skipped:`);for(const m of g)s.warn(` ${m.update.name} (${m.update.file}:${String(m.update.line)}): ${m.reason}`)}return i},"runEcosystemUpdate"),po=N(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.`)},"validateEcosystemFlags"),Eo=N(async({argument:e,logger:t,options:n,visConfig:s,workspaceRoot:r})=>{if(!r)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");po(n);let o=e;const i=r,{packageManager:a}=Bt(i);if(n.typosquatCheck!==!1){if(o.length>0){const c=o.map(m=>Zt(m)),f=s?.security?.typosquatAllowlist,g=await Kt(c.map(m=>m.name),f);if(!g.ok){process.exitCode=1;return}o=c.map((m,h)=>{const x=g.packages[h];return x!==m.name?m.versionSpec?`${x}@${m.versionSpec}`:x??"":o[h]??""})}else if(!await Jt(i,s?.security?.typosquatAllowlist)){process.exitCode=1;return}}if(n.rollback){if(!Pt(i,a)){t.info("No backup found. Run 'vis update' first to create a backup.");return}if(Vt(i,a))t.info("Restored from backup.");else throw new Error("Failed to restore from backup.");return}if(!await ao(n,o.length>0,t))return;const d=n.catalog!==!1&&Mt(i,a);let l;if(d)l=await ro(i,a,s??{},n,o,t);else{const c=Wt(i,{configBackend:s?.install?.backend,configCorepack:s?.install?.corepack}),f=c.name==="aube"?"":_t(c.name);l=await io(i,c.name,f,n,o,t)}o.length===0&&await uo(i,n,s??{},t,l)},"execute");export{Eo as default,So as formatMinutesAsTimeString,no as parseNpmReleaseAgeValue,gt as parseTimeStringToMinutes,so as readPmNativeMinimumReleaseAge,ao as requireBlanketUpdateConfirmation,uo as runEcosystemUpdate,lo as shouldApplyEcosystem};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var Je=Object.defineProperty;var v=(o,t)=>Je(o,"name",{value:t,configurable:!0});import{createRequire as qe}from"node:module";import{w as p,af as U,a5 as e,a6 as s,n as r,aH as Te,aG as Qe,aI as Ze,aF as et,aJ as tt,aK as rt,k as ot,R as nt,s as it}from"./bin.js";import{A as st}from"../packem_shared/pm-runner-DmKT2FqF.js";import{d as at}from"./config.js";import{o as lt,M as he,l as dt,B as ut,K as ht}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{g as mt,r as gt}from"../packem_shared/tabs-xZkm6Y_J.js";const Ke=qe(import.meta.url),Q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ye=v(o=>{if(typeof Q<"u"&&Q.versions&&Q.versions.node){const[t,i]=Q.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return Q.getBuiltinModule(o)}return Ke(o)},"__cjs_getBuiltinModule"),{writeFileSync:ct}=Ye("node:fs");var ft=Object.defineProperty,pt=v((o,t)=>ft(o,"name",{value:t,configurable:!0}),"p$2");const xt=pt((o,{whitespace:t=!0}={})=>o.replace(lt,i=>i.startsWith('"')||i[1]==="*"&&!i.endsWith("*/")?i:t?i.replaceAll(/\S/g," "):""),"p"),V=[{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js",postCreateCommand:"npm install"},description:"Node.js 22 with Git and GitHub CLI",id:"node",name:"Node.js"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",mounts:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],name:"Node.js + pnpm Monorepo",postCreateCommand:"corepack enable && pnpm install",remoteUser:"node",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js 22 with pnpm, corepack, and optimized volume mounts",id:"node-pnpm",name:"Node.js + pnpm"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",forwardPorts:[3e3,5432],name:"Node.js + PostgreSQL",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js with PostgreSQL via Docker Compose",id:"node-postgres",name:"Node.js + PostgreSQL"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{}},forwardPorts:[3e3],image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"Node.js + Docker",postCreateCommand:"npm install"},description:"Node.js 22 with Docker-in-Docker for container workflows",id:"node-dind",name:"Node.js + Docker-in-Docker"},{config:{customizations:{vscode:{extensions:["dbaeumer.vscode-eslint","esbenp.prettier-vscode","ms-azuretools.vscode-docker"]}},dockerComposeFile:"docker-compose.yml",features:{"ghcr.io/devcontainers/features/docker-in-docker:2":{}},forwardPorts:[3e3,5432,6379],name:"Full Stack",postCreateCommand:"npm install",service:"app",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}"},description:"Node.js + PostgreSQL + Redis + Docker via Compose",id:"fullstack",name:"Full Stack"},{config:{customizations:{vscode:{extensions:["ms-python.python","ms-python.vscode-pylance"],settings:{"editor.formatOnSave":!0,"python.defaultInterpreterPath":"/usr/local/bin/python"}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/github-cli:1":{},"ghcr.io/devcontainers/features/python:1":{version:"3.12"}},forwardPorts:[8e3],image:"mcr.microsoft.com/devcontainers/python:3.12",name:"Python",postCreateCommand:"pip install -r requirements.txt || true"},description:"Python 3.12 with pip and venv",id:"python",name:"Python"},{config:{customizations:{vscode:{extensions:["golang.go"],settings:{"editor.formatOnSave":!0,"go.toolsManagement.autoUpdate":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/go:1":{version:"1.22"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/go:1.22",name:"Go",postCreateCommand:"go mod download || true"},description:"Go 1.22 development environment",id:"go",name:"Go"},{config:{customizations:{vscode:{extensions:["rust-lang.rust-analyzer","tamasfe.even-better-toml"],settings:{"editor.formatOnSave":!0}}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/rust:1":{}},image:"mcr.microsoft.com/devcontainers/rust:latest",name:"Rust",postCreateCommand:"cargo build || true"},description:"Rust development with cargo and rust-analyzer",id:"rust",name:"Rust"},{config:{customizations:{vscode:{extensions:["vscjava.vscode-java-pack","vscjava.vscode-maven"]}},features:{"ghcr.io/devcontainers/features/git:1":{},"ghcr.io/devcontainers/features/java:1":{version:"17"}},forwardPorts:[8080],image:"mcr.microsoft.com/devcontainers/java:17",name:"Java",postCreateCommand:"./mvnw install || ./gradlew build || true"},description:"Java 17 with Maven/Gradle support",id:"java",name:"Java"},{config:{customizations:{vscode:{extensions:["ms-azuretools.vscode-docker","ms-kubernetes-tools.vscode-kubernetes-tools","hashicorp.terraform"]}},features:{"ghcr.io/devcontainers/features/aws-cli:1":{},"ghcr.io/devcontainers/features/azure-cli:1":{},"ghcr.io/devcontainers/features/docker-in-docker:2":{},"ghcr.io/devcontainers/features/kubectl-helm-minikube:1":{},"ghcr.io/devcontainers/features/terraform:1":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"DevOps"},description:"Docker, Kubernetes, Terraform, AWS & Azure CLIs",id:"devops",name:"DevOps"},{config:{features:{"ghcr.io/devcontainers/features/common-utils:2":{}},image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Minimal",remoteUser:"vscode"},description:"Bare Ubuntu with common utilities",id:"minimal",name:"Minimal"},{config:{image:"mcr.microsoft.com/devcontainers/base:ubuntu",name:"Custom"},description:"Minimal Ubuntu base - configure from scratch",id:"custom",name:"Custom (Blank)"}];var vt=Object.defineProperty,Pe=v((o,t)=>vt(o,"name",{value:t,configurable:!0}),"s$7");const jt=Pe(o=>{const t=he(o,".devcontainer","devcontainer.json");if(!dt(t))return null;const i=ut(t),c=xt(i),a=c!==i;let n;try{n=JSON.parse(c)}catch(l){const m=l instanceof Error?l.message:String(l);throw new Error(`Failed to parse ${t}: ${m}`,{cause:l})}return{config:n,hadComments:a}},"readDevcontainerJson"),bt=Pe((o,t,i)=>{const c=i?ht(i):he(o,".devcontainer"),a=i??he(c,"devcontainer.json");at(c),ct(a,`${JSON.stringify(t,null,2)}
|
|
2
|
+
`,"utf8")},"writeDevcontainerJson");var yt=Object.defineProperty,wt=v((o,t)=>yt(o,"name",{value:t,configurable:!0}),"s$6");const Ct={bun:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-bun-cache",target:"/home/node/.bun/install/cache",type:"volume"}],deno:[{source:"${localWorkspaceFolderBasename}-deno-cache",target:"/home/node/.cache/deno",type:"volume"}],npm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-npm-cache",target:"/home/node/.npm",type:"volume"}],pnpm:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-pnpm-store",target:"/home/node/.local/share/pnpm/store",type:"volume"}],yarn:[{source:"${localWorkspaceFolderBasename}-node_modules",target:"${containerWorkspaceFolder}/node_modules",type:"volume"},{source:"${localWorkspaceFolderBasename}-yarn-cache",target:"/home/node/.yarn/cache",type:"volume"}]},St=[{featureMatch:"docker-in-docker",mounts:[]},{featureMatch:"docker-outside-of-docker",mounts:[{source:"/var/run/docker.sock",target:"/var/run/docker.sock",type:"bind"}]},{featureMatch:"/features/git:",mounts:[{source:"${localWorkspaceFolderBasename}-git-config",target:"/home/node/.gitconfig",type:"volume"}]}],je=wt((o,t,i)=>{const c=[],a=new Set(i.map(l=>typeof l=="string"?l:l.target));if(o)for(const l of Ct[o])a.has(l.target)||c.push(l);const n=Object.keys(t);for(const{featureMatch:l,mounts:m}of St)if(n.some(g=>g.includes(l)))for(const g of m)a.has(g.target)||c.push(g);return c},"getSuggestedMounts"),N=["general","features","ports","lifecycle","extensions","environment","mounts","compose"];var kt=Object.defineProperty,oe=v((o,t)=>kt(o,"name",{value:t,configurable:!0}),"c$2");const Z=oe(o=>structuredClone(o),"deepClone");class Et{static{v(this,"DevcontainerStore")}static{oe(this,"DevcontainerStore")}#o=new Set;#e;constructor(t,i,c=null){const a=t===null,n=t??{name:""},l=Z(n);this.#e={config:l,detectedPm:c,extensionSearch:"",featureSearch:"",fieldEditing:!1,fieldIndex:0,hadComments:i,isDirty:!1,mode:a?"create":"edit",originalConfig:a?null:Z(n),section:"general",showTemplateSelector:a,suggestedMounts:je(c,l.features??{},l.mounts??[]),templateIndex:0}}getSnapshot=oe(()=>this.#e,"getSnapshot");subscribe=oe(t=>(this.#o.add(t),()=>{this.#o.delete(t)}),"subscribe");setSection(t){t!==this.#e.section&&this.#t({...this.#e,fieldEditing:!1,fieldIndex:0,section:t})}nextSection(){const t=(N.indexOf(this.#e.section)+1)%N.length;this.setSection(N[t])}previousSection(){const t=(N.indexOf(this.#e.section)-1+N.length)%N.length;this.setSection(N[t])}setFieldIndex(t){t!==this.#e.fieldIndex&&this.#t({...this.#e,fieldIndex:Math.max(0,t)})}setFieldEditing(t){t!==this.#e.fieldEditing&&this.#t({...this.#e,fieldEditing:t})}setTemplateIndex(t){const i=Math.max(0,Math.min(t,V.length-1));i!==this.#e.templateIndex&&this.#t({...this.#e,templateIndex:i})}applyTemplate(t){const i=V.find(c=>c.id===t);i&&this.#t(this.#r({...this.#e,config:Z(i.config),isDirty:!0,showTemplateSelector:!1}))}dismissTemplateSelector(){this.#t({...this.#e,showTemplateSelector:!1})}updateConfig(t){this.#t({...this.#e,config:{...this.#e.config,...t},isDirty:!0})}toggleFeature(t){const i={...this.#e.config.features};i[t]===void 0?i[t]={}:delete i[t],this.#t(this.#r({...this.#e,config:{...this.#e.config,features:i},isDirty:!0}))}setFeatureSearch(t){this.#t({...this.#e,featureSearch:t,fieldIndex:0})}addPort(t){const i=this.#e.config.forwardPorts??[];if(i.includes(t))return;const c=[...i,t];this.#t({...this.#e,config:{...this.#e.config,forwardPorts:c},isDirty:!0})}removePort(t){const i=[...this.#e.config.forwardPorts??[]];i.splice(t,1),this.#t({...this.#e,config:{...this.#e.config,forwardPorts:i.length>0?i:void 0},isDirty:!0})}toggleExtension(t){const i={...this.#e.config.customizations},c={...i.vscode},a=[...c.extensions??[]],n=a.indexOf(t);n===-1?a.push(t):a.splice(n,1),c.extensions=a.length>0?a:void 0,i.vscode=c.extensions||c.settings?c:void 0,this.#t({...this.#e,config:{...this.#e.config,customizations:i.vscode||i.jetbrains?i:void 0},isDirty:!0})}setExtensionSearch(t){this.#t({...this.#e,extensionSearch:t,fieldIndex:0})}addEnvVar(t,i,c){const a=t==="container"?"containerEnv":"remoteEnv",n={...this.#e.config[a],[i]:c};this.#t({...this.#e,config:{...this.#e.config,[a]:n},isDirty:!0})}removeEnvVar(t,i){const c=t==="container"?"containerEnv":"remoteEnv",a={...this.#e.config[c]};delete a[i],this.#t({...this.#e,config:{...this.#e.config,[c]:Object.keys(a).length>0?a:void 0},isDirty:!0})}addMount(t){const i=[...this.#e.config.mounts??[],t];this.#t(this.#r({...this.#e,config:{...this.#e.config,mounts:i},isDirty:!0}))}removeMount(t){const i=[...this.#e.config.mounts??[]];i.splice(t,1),this.#t(this.#r({...this.#e,config:{...this.#e.config,mounts:i.length>0?i:void 0},isDirty:!0}))}applySuggestedMounts(){if(this.#e.suggestedMounts.length===0)return;const t=[...this.#e.config.mounts??[],...this.#e.suggestedMounts];this.#t(this.#r({...this.#e,config:{...this.#e.config,mounts:t},isDirty:!0}))}setLifecycleCommand(t,i){this.#t({...this.#e,config:{...this.#e.config,[t]:i||void 0},isDirty:!0})}markClean(){this.#t({...this.#e,isDirty:!1,originalConfig:Z(this.#e.config)})}getJsonPreview(){return JSON.stringify(this.#n(),null,2)}cleanConfig(){return this.#n()}#n(){const t=Z(this.#e.config);for(const[i,c]of Object.entries(t))(c===""||c===void 0)&&delete t[i];return t.build&&(t.build.dockerfile===""&&delete t.build.dockerfile,t.build.context===""&&delete t.build.context,t.build.args&&Object.keys(t.build.args).length===0&&delete t.build.args,Object.keys(t.build).length===0&&delete t.build),t.forwardPorts?.length===0&&delete t.forwardPorts,t.mounts?.length===0&&delete t.mounts,t.runServices?.length===0&&delete t.runServices,t.capAdd?.length===0&&delete t.capAdd,t.securityOpt?.length===0&&delete t.securityOpt,t.features&&Object.keys(t.features).length===0&&delete t.features,t.customizations?.vscode?.extensions?.length===0&&delete t.customizations.vscode.extensions,t.customizations?.vscode&&Object.keys(t.customizations.vscode).length===0&&delete t.customizations.vscode,t.customizations&&Object.keys(t.customizations).length===0&&delete t.customizations,t.containerEnv&&Object.keys(t.containerEnv).length===0&&delete t.containerEnv,t.remoteEnv&&Object.keys(t.remoteEnv).length===0&&delete t.remoteEnv,t}#r(t){return{...t,suggestedMounts:je(t.detectedPm,t.config.features??{},t.config.mounts??[])}}#t(t){this.#e=t;for(const i of this.#o)try{i()}catch{}}}const be=[{category:"linting",description:"Integrates ESLint into the editor",id:"dbaeumer.vscode-eslint",name:"ESLint"},{category:"linting",description:"Stylelint CSS/SCSS linting",id:"stylelint.vscode-stylelint",name:"Stylelint"},{category:"formatting",description:"Opinionated code formatter",id:"esbenp.prettier-vscode",name:"Prettier"},{category:"formatting",description:"EditorConfig file support",id:"editorconfig.editorconfig",name:"EditorConfig"},{category:"formatting",description:"Fast Rust-based formatter and linter",id:"biomejs.biome",name:"Biome"},{category:"language",description:"Rich TypeScript and JavaScript support",id:"ms-vscode.vscode-typescript-next",name:"TypeScript Nightly"},{category:"language",description:"Tailwind CSS IntelliSense",id:"bradlc.vscode-tailwindcss",name:"Tailwind CSS"},{category:"language",description:"YAML language support with schemas",id:"redhat.vscode-yaml",name:"YAML"},{category:"language",description:"TOML language support",id:"tamasfe.even-better-toml",name:"TOML"},{category:"language",description:"Dockerfile and Docker Compose support",id:"ms-azuretools.vscode-docker",name:"Docker"},{category:"language",description:"Python language support with Pylance",id:"ms-python.python",name:"Python"},{category:"language",description:"Go language support",id:"golang.go",name:"Go"},{category:"language",description:"Rust language support via rust-analyzer",id:"rust-lang.rust-analyzer",name:"rust-analyzer"},{category:"git",description:"Git supercharged: blame, history, stash, etc.",id:"eamodio.gitlens",name:"GitLens"},{category:"git",description:"GitHub Pull Requests and Issues",id:"github.vscode-pull-request-github",name:"GitHub PR"},{category:"testing",description:"Vitest test explorer integration",id:"vitest.explorer",name:"Vitest Explorer"},{category:"testing",description:"Jest test runner and assertions",id:"orta.vscode-jest",name:"Jest"},{category:"debugging",description:"REST client for testing APIs",id:"humao.rest-client",name:"REST Client"},{category:"debugging",description:"Error Lens: inline error highlighting",id:"usernamehw.errorlens",name:"Error Lens"},{category:"other",description:"Intelligent code completion with AI",id:"github.copilot",name:"GitHub Copilot"},{category:"other",description:"Path autocompletion for imports",id:"christian-kohler.path-intellisense",name:"Path Intellisense"},{category:"other",description:"Import cost display in editor",id:"wix.vscode-import-cost",name:"Import Cost"},{category:"other",description:"Todo Tree: highlight and list TODOs",id:"gruntfuggly.todo-tree",name:"Todo Tree"}],ye=[{category:"language",description:"Node.js runtime via nvm with optional pnpm/yarn",id:"ghcr.io/devcontainers/features/node:1",name:"Node.js"},{category:"language",description:"Python runtime with pip and optional tools",id:"ghcr.io/devcontainers/features/python:1",name:"Python"},{category:"language",description:"Go compiler and tools",id:"ghcr.io/devcontainers/features/go:1",name:"Go"},{category:"language",description:"Rust toolchain via rustup",id:"ghcr.io/devcontainers/features/rust:1",name:"Rust"},{category:"language",description:"Java runtime and JDK via SDKMAN",id:"ghcr.io/devcontainers/features/java:1",name:"Java"},{category:"language",description:".NET SDK and runtime",id:"ghcr.io/devcontainers/features/dotnet:2",name:".NET"},{category:"tool",description:"Common utilities: zsh, Oh My Zsh, git, curl, etc.",id:"ghcr.io/devcontainers/features/common-utils:2",name:"Common Utilities"},{category:"tool",description:"Git version control",id:"ghcr.io/devcontainers/features/git:1",name:"Git"},{category:"tool",description:"Git Large File Storage support",id:"ghcr.io/devcontainers/features/git-lfs:1",name:"Git LFS"},{category:"tool",description:"GitHub CLI for repository management",id:"ghcr.io/devcontainers/features/github-cli:1",name:"GitHub CLI"},{category:"tool",description:"Run Docker containers inside the dev container",id:"ghcr.io/devcontainers/features/docker-in-docker:2",name:"Docker-in-Docker"},{category:"tool",description:"Access host Docker daemon from inside the container",id:"ghcr.io/devcontainers/features/docker-outside-of-docker:1",name:"Docker-from-Docker"},{category:"tool",description:"kubectl, Helm, and Minikube for Kubernetes",id:"ghcr.io/devcontainers/features/kubectl-helm-minikube:1",name:"Kubernetes Tools"},{category:"tool",description:"Infrastructure as code with Terraform",id:"ghcr.io/devcontainers/features/terraform:1",name:"Terraform"},{category:"tool",description:"Nix package manager",id:"ghcr.io/devcontainers/features/nix:1",name:"Nix"},{category:"tool",description:"SSH server for remote connections to the container",id:"ghcr.io/devcontainers/features/sshd:1",name:"SSH Server"},{category:"cloud",description:"Amazon Web Services CLI v2",id:"ghcr.io/devcontainers/features/aws-cli:1",name:"AWS CLI"},{category:"cloud",description:"Microsoft Azure CLI",id:"ghcr.io/devcontainers/features/azure-cli:1",name:"Azure CLI"},{category:"cloud",description:"Google Cloud Platform CLI",id:"ghcr.io/devcontainers/features/gcloud:1",name:"Google Cloud CLI"},{category:"database",description:"PostgreSQL client tools",id:"ghcr.io/devcontainers-extra/features/postgres-client:1",name:"PostgreSQL Client"},{category:"database",description:"Redis client tools",id:"ghcr.io/devcontainers-extra/features/redis-client:1",name:"Redis Client"}];var It=Object.defineProperty,De=v((o,t)=>It(o,"name",{value:t,configurable:!0}),"r$1");const ge=De(o=>{if(!o)return ye;const t=o.toLowerCase();return ye.filter(i=>i.name.toLowerCase().includes(t)||i.id.toLowerCase().includes(t)||i.description.toLowerCase().includes(t))},"filterFeatures"),fe=De(o=>{if(!o)return be;const t=o.toLowerCase();return be.filter(i=>i.name.toLowerCase().includes(t)||i.id.toLowerCase().includes(t)||i.description.toLowerCase().includes(t))},"filterExtensions");var Tt=Object.defineProperty,Pt=v((o,t)=>Tt(o,"name",{value:t,configurable:!0}),"t"),Dt=Object.defineProperty,Ot=Pt((o,t)=>Dt(o,"name",{value:t,configurable:!0}),"r"),Ft=Object.defineProperty,Oe=Ot((o,t)=>Ft(o,"name",{value:t,configurable:!0}),"r");const At=/^[a-z]$/i,Mt=Oe(o=>{const t=o.codePointAt(0);return t!==void 0&&(t<32||t===127)},"isControlCharacter"),$t=Oe((o,t)=>o.length===0||Mt(o)?!1:t.ctrl&&t.meta?!At.test(o):!(t.ctrl||t.meta),"isInsertableInput");var Lt=Object.defineProperty,Fe=v((o,t)=>Lt(o,"name",{value:t,configurable:!0}),"w$3"),Bt=Object.defineProperty,Ae=Fe((o,t)=>Bt(o,"name",{value:t,configurable:!0}),"A"),Nt=Object.defineProperty,ie=Ae((o,t)=>Nt(o,"name",{value:t,configurable:!0}),"p");const Rt=/\S+\s*$/,de=ie((o,t)=>o.length===0||!t?void 0:t.find(i=>i.startsWith(o))?.slice(o.length)??void 0,"findSuggestion"),Me=-1,zt=ie((o,t,i,c)=>t.leftArrow?Math.max(0,i-1):t.home||t.ctrl&&o==="a"?0:t.end||t.ctrl&&o==="e"?c:Me,"handleNavigation"),Gt=ie((o,t,i,c)=>{if(t.backspace&&c>0)return[i.slice(0,c-1)+i.slice(c),c-1];if(t.delete&&c<i.length)return[i.slice(0,c)+i.slice(c+1),c];if(t.ctrl&&o==="u")return[i.slice(c),0];if(t.ctrl&&o==="k")return[i.slice(0,c),c];if(t.ctrl&&o==="w"){const a=i.slice(0,c).replace(Rt,"");return[a+i.slice(c),a.length]}},"handleEditing");function X({defaultValue:o="",isDisabled:t=!1,mask:i=!1,onChange:c,onSubmit:a,placeholder:n,suggestions:l}){const[m,g]=p.useState(o),[f,j]=p.useState(o.length),x=p.useRef(m);x.current=m;const b=p.useRef(f);b.current=f;const w=p.useRef(c);w.current=c;const E=p.useRef(a);E.current=a;const D=de(m,l),R=p.useCallback((P,T)=>{const{current:I}=b,S=x.current;if(T.return){const C=de(S,l),k=C?S+C:S;C&&(g(k),j(k.length),w.current?.(k)),E.current?.(k);return}if(T.escape)return;if(T.rightArrow){const C=de(S,l);if(I===S.length&&C){const k=S+C;g(k),j(k.length),w.current?.(k);return}j(Math.min(S.length,I+1));return}const O=zt(P,T,I,S.length);if(O!==Me){j(O);return}const q=Gt(P,T,S,I);if(q){const[C,k]=q;g(C),j(k),w.current?.(C);return}if($t(P,T)){const C=S.slice(0,I)+P+S.slice(I);g(C),j(I+P.length),w.current?.(C)}},[l]);U(R,{isActive:!t});const L=i?"*".repeat(m.length):m,H=L.slice(0,f),J=L[f],ee=L.slice(f+1);return t?e.jsx(s,{children:e.jsx(r,{dimColor:!0,children:L||n||""})}):m.length===0&&n?e.jsxs(s,{children:[e.jsx(r,{dimColor:!0,inverse:!0,children:n[0]}),e.jsx(r,{dimColor:!0,children:n.slice(1)})]}):e.jsxs(s,{children:[e.jsxs(r,{children:[H,e.jsx(r,{inverse:!0,children:J??" "}),ee]}),D?e.jsx(r,{dimColor:!0,children:D}):void 0]})}v(X,"k");Fe(X,"q");Ae(X,"y");ie(X,"TextInput");var _t=Object.defineProperty,Wt=v((o,t)=>_t(o,"name",{value:t,configurable:!0}),"l$1");const $e=["dockerComposeFile","service"],Ut={dockerComposeFile:"Compose File",service:"Service"},we={dockerComposeFile:"docker-compose.yml",service:"app"},Vt={dockerComposeFile:"Path to Docker Compose file (relative to .devcontainer/)",service:"Which service in the compose file to connect the IDE to"},Xt=Wt(({config:o,fieldEditing:t,fieldIndex:i,onUpdate:c})=>{const a=!!o.dockerComposeFile,n=!!(o.image||o.build);return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsx(s,{marginBottom:1,children:e.jsx(r,{bold:!0,color:"cyan",children:"Docker Compose Integration"})}),n&&a&&e.jsx(s,{marginBottom:1,children:e.jsx(r,{color:"yellow",children:"Note: When using Docker Compose, the image/build settings in General are ignored."})}),$e.map((l,m)=>{const g=m===i,f=o[l]??"",j=Array.isArray(o[l])?o[l].join(", "):f;return e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{children:[e.jsx(s,{width:20,children:e.jsxs(r,{bold:g,color:g?"cyan":"white",children:[g?"❯ ":" ",Ut[l],":"]})}),e.jsx(s,{flexGrow:1,children:g&&t?e.jsx(X,{defaultValue:j,onChange:v(x=>{c({[l]:x||void 0})},"onChange"),placeholder:we[l]}):e.jsx(r,{color:j?"white":"gray",children:j||we[l]})})]}),e.jsx(s,{paddingLeft:4,children:e.jsx(r,{dimColor:!0,children:Vt[l]})})]},l)}),e.jsx(s,{marginTop:1,children:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]})},"DockerComposeSection"),Ht=$e.length;var Jt=Object.defineProperty,Le=v((o,t)=>Jt(o,"name",{value:t,configurable:!0}),"h$2");const qt=Le(({config:o,fieldIndex:t})=>{const i=o.containerEnv??{},c=o.remoteEnv??{},a=Object.keys(i),n=Object.keys(c),l=a.length,m=a.length+1,g=m+n.length,f=t<=l,j=t>l;return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsxs(s,{borderColor:f?"cyan":"gray",borderStyle:"single",flexDirection:"column",paddingX:1,paddingY:0,children:[e.jsxs(s,{flexShrink:0,marginBottom:a.length>0?1:0,children:[e.jsx(r,{bold:!0,color:f?"cyan":"white",children:"containerEnv"}),e.jsx(r,{dimColor:!0,children:" — baked into the container image"})]}),a.map((x,b)=>{const w=b===t;return e.jsx(s,{flexShrink:0,children:e.jsxs(r,{color:w?"cyan":void 0,inverse:w,wrap:"truncate",children:[w?" ❯ ":" ",e.jsx(r,{bold:!0,children:x}),e.jsx(r,{dimColor:!0,children:" = "}),e.jsx(r,{children:i[x]})]})},x)}),e.jsx(s,{flexShrink:0,marginTop:a.length>0?1:0,children:e.jsxs(r,{color:t===l?"cyan":"gray",inverse:t===l,children:[" ","+ Add variable..."]})})]}),e.jsxs(s,{borderColor:j?"cyan":"gray",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,paddingY:0,children:[e.jsxs(s,{flexShrink:0,marginBottom:n.length>0?1:0,children:[e.jsx(r,{bold:!0,color:j?"cyan":"white",children:"remoteEnv"}),e.jsx(r,{dimColor:!0,children:" — set at runtime by the IDE"})]}),n.map((x,b)=>{const w=m+b===t;return e.jsx(s,{flexShrink:0,children:e.jsxs(r,{color:w?"cyan":void 0,inverse:w,wrap:"truncate",children:[w?" ❯ ":" ",e.jsx(r,{bold:!0,children:x}),e.jsx(r,{dimColor:!0,children:" = "}),e.jsx(r,{children:c[x]})]})},x)}),e.jsx(s,{flexShrink:0,marginTop:n.length>0?1:0,children:e.jsxs(r,{color:t===g?"cyan":"gray",inverse:t===g,children:[" ","+ Add variable..."]})})]}),e.jsx(s,{flexShrink:0,marginTop:1,children:e.jsxs(r,{dimColor:!0,wrap:"truncate",children:[e.jsx(r,{bold:!0,color:"white",children:"a"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","add on + row"," ",e.jsx(r,{bold:!0,color:"white",children:"d"})," ","remove"," ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},"EnvironmentSection"),Kt=Le(o=>{const t=Object.keys(o.containerEnv??{}).length,i=Object.keys(o.remoteEnv??{}).length;return t+1+i+1},"getEnvFieldCount");var Yt=Object.defineProperty,Qt=v((o,t)=>Yt(o,"name",{value:t,configurable:!0}),"g$2");const Zt=Qt(({config:o,fieldIndex:t,scrollOffset:i,searchText:c,viewportHeight:a})=>{const n=p.useMemo(()=>new Set(o.customizations?.vscode?.extensions),[o.customizations?.vscode?.extensions]),l=p.useMemo(()=>fe(c),[c]),m=l.length,g=m>a&&a>0;return e.jsxs(s,{flexDirection:"column",flexGrow:1,children:[e.jsxs(s,{flexShrink:0,gap:1,paddingX:1,children:[e.jsxs(r,{bold:!0,color:"cyan",children:[n.size," ","selected"]}),c&&e.jsxs(r,{dimColor:!0,children:["— filter:"," ",e.jsx(r,{color:"yellow",children:c})," ","(",l.length," ","results)"]})]}),e.jsxs(s,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[e.jsx(s,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:e.jsx(s,{flexDirection:"column",marginTop:-i,children:l.map((f,j)=>{const x=j===t,b=n.has(f.id);return e.jsxs(s,{flexShrink:0,height:1,children:[e.jsx(r,{children:x?">":" "}),e.jsxs(r,{color:b?"white":"gray",children:[" ",b?"☑":"☐"," "]}),e.jsx(s,{flexGrow:1,children:e.jsxs(r,{bold:x,inverse:x,wrap:"truncate",children:[f.name,e.jsxs(r,{dimColor:!0,children:[" ","-",f.id]})]})})]},f.id)})})}),g&&e.jsx(s,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(Te,{contentHeight:m,placement:"inset",scrollOffset:i,style:"block",viewportHeight:a})})]}),l.length===0&&e.jsx(s,{paddingX:1,children:e.jsx(r,{dimColor:!0,children:"No extensions match the search."})})]})},"ExtensionsSection");var er=Object.defineProperty,tr=v((o,t)=>er(o,"name",{value:t,configurable:!0}),"g$1");const rr=tr(({config:o,fieldIndex:t,scrollOffset:i,searchText:c,viewportHeight:a})=>{const n=p.useMemo(()=>new Set(Object.keys(o.features??{})),[o.features]),l=p.useMemo(()=>ge(c),[c]),m=l.length,g=m>a&&a>0;return e.jsxs(s,{flexDirection:"column",flexGrow:1,children:[e.jsxs(s,{flexShrink:0,gap:1,paddingX:1,children:[e.jsxs(r,{bold:!0,color:"cyan",children:[n.size," ","selected"]}),c&&e.jsxs(r,{dimColor:!0,children:["— filter:"," ",e.jsx(r,{color:"yellow",children:c})," ","(",l.length," ","results)"]})]}),e.jsxs(s,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[e.jsx(s,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:e.jsx(s,{flexDirection:"column",marginTop:-i,children:l.map((f,j)=>{const x=j===t,b=n.has(f.id);return e.jsxs(s,{flexShrink:0,height:1,children:[e.jsx(r,{children:x?">":" "}),e.jsxs(r,{color:b?"white":"gray",children:[" ",b?"☑":"☐"," "]}),e.jsx(s,{flexGrow:1,children:e.jsxs(r,{bold:x,inverse:x,wrap:"truncate",children:[f.name,e.jsxs(r,{dimColor:!0,children:[" ","-",f.description]})]})})]},f.id)})})}),g&&e.jsx(s,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(Te,{contentHeight:m,placement:"inset",scrollOffset:i,style:"block",viewportHeight:a})})]}),l.length===0&&e.jsx(s,{paddingX:1,children:e.jsx(r,{dimColor:!0,children:"No features match the search."})})]})},"FeaturesSection");var or=Object.defineProperty,nr=v((o,t)=>or(o,"name",{value:t,configurable:!0}),"u$1");const me=["name","image","workspaceFolder","workspaceMount","remoteUser","containerUser","shutdownAction"],ir={containerUser:"Container User",image:"Image",name:"Name",remoteUser:"Remote User",shutdownAction:"Shutdown Action",workspaceFolder:"Workspace Folder",workspaceMount:"Workspace Mount"},Ce={containerUser:"root",image:"mcr.microsoft.com/devcontainers/javascript-node:22",name:"My Dev Container",remoteUser:"node",shutdownAction:"none | stopContainer",workspaceFolder:"/workspaces/${localWorkspaceFolderBasename}",workspaceMount:"source=${localWorkspaceFolder},target=...,type=bind"},ne=["privileged","overrideCommand"],sr={overrideCommand:"Override Command",privileged:"Privileged"},cr=me.length+ne.length,ar=nr(({config:o,fieldEditing:t,fieldIndex:i,onUpdate:c})=>e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsx(s,{marginBottom:1,children:e.jsx(r,{bold:!0,color:"cyan",children:"General Configuration"})}),me.map((a,n)=>{const l=n===i,m=o[a]??"";return e.jsxs(s,{marginBottom:1,children:[e.jsx(s,{width:20,children:e.jsxs(r,{bold:l,color:l?"cyan":"white",children:[l?"❯ ":" ",ir[a],":"]})}),e.jsx(s,{flexGrow:1,children:l&&t?e.jsx(X,{defaultValue:m,onChange:v(g=>{c({[a]:g})},"onChange"),placeholder:Ce[a]}):e.jsx(r,{color:m?"white":"gray",children:m||Ce[a]})})]},a)}),ne.map((a,n)=>{const l=me.length+n===i,m=o[a]??!1;return e.jsxs(s,{marginBottom:n<ne.length-1?1:0,children:[e.jsx(s,{width:20,children:e.jsxs(r,{bold:l,color:l?"cyan":"white",children:[l?"❯ ":" ",sr[a],":"]})}),e.jsx(s,{flexGrow:1,children:e.jsxs(r,{color:m?"green":"gray",children:[m?"yes":"no",l&&e.jsx(r,{dimColor:!0,children:" (Space to toggle)"})]})})]},a)}),e.jsx(s,{marginTop:1,children:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","edit field"," ",e.jsx(r,{bold:!0,color:"white",children:"Space"})," ","toggle"," ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),"GeneralSection"),Be=cr,ue=ne;var lr=Object.defineProperty,dr=v((o,t)=>lr(o,"name",{value:t,configurable:!0}),"s$3");const Ne=["postCreateCommand","postStartCommand","postAttachCommand","onCreateCommand"],ur={onCreateCommand:"On Create",postAttachCommand:"Post Attach",postCreateCommand:"Post Create",postStartCommand:"Post Start"},hr={onCreateCommand:"Runs once when the container is first created",postAttachCommand:"Runs each time the IDE attaches",postCreateCommand:"Runs after the container is created and workspace mounted",postStartCommand:"Runs each time the container starts"},mr=dr(({config:o,fieldEditing:t,fieldIndex:i,onSetCommand:c})=>e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsx(s,{marginBottom:1,children:e.jsx(r,{bold:!0,color:"cyan",children:"Lifecycle Commands"})}),Ne.map((a,n)=>{const l=n===i,m=o[a],g=Array.isArray(m)?m.join(" && "):m??"";return e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsx(s,{children:e.jsxs(r,{bold:l,color:l?"cyan":"white",children:[l?"❯ ":" ",ur[a]]})}),e.jsx(s,{paddingLeft:4,children:e.jsx(r,{dimColor:!0,children:hr[a]})}),e.jsx(s,{paddingLeft:4,children:l&&t?e.jsx(X,{defaultValue:g,onChange:v(f=>{c(a,f)},"onChange"),placeholder:"e.g. npm install"}):e.jsx(r,{color:g?"green":"gray",children:g||"(not set)"})})]},a)}),e.jsx(s,{marginTop:1,children:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","edit command"," ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","stop editing"]})})]}),"LifecycleSection"),gr=Ne.length;var fr=Object.defineProperty,Re=v((o,t)=>fr(o,"name",{value:t,configurable:!0}),"s$2");const Se=Re(o=>typeof o=="string"?o:`[${o.type}] ${o.source} → ${o.target}`,"formatMount"),pr=Re(({addingMount:o,config:t,detectedPm:i,fieldIndex:c,mountPhase:a,mountSource:n,mountTarget:l,mountType:m,suggestedMounts:g})=>{const f=t.mounts??[];return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsxs(s,{flexShrink:0,gap:1,paddingX:1,children:[e.jsxs(r,{bold:!0,color:"cyan",children:[f.length," ","mounts"]}),i&&e.jsxs(r,{dimColor:!0,children:["— detected:"," ",e.jsx(r,{color:"white",children:i})]})]}),g.length>0&&!o&&e.jsxs(s,{borderColor:"yellow",borderStyle:"single",flexDirection:"column",marginBottom:1,marginTop:1,paddingX:1,children:[e.jsxs(s,{flexShrink:0,children:[e.jsx(r,{bold:!0,color:"yellow",children:"Suggested mounts"}),e.jsxs(r,{dimColor:!0,children:[" ","— press"," ",e.jsx(r,{bold:!0,color:"white",children:"A"})," ","to add all"]})]}),g.map((j,x)=>e.jsx(s,{flexShrink:0,children:e.jsxs(r,{dimColor:!0,wrap:"truncate",children:[" + ",Se(j)]})},`suggestion-${String(x)}`))]}),f.length>0&&e.jsx(s,{flexDirection:"column",marginBottom:1,children:f.map((j,x)=>{const b=x===c;return e.jsxs(s,{flexShrink:0,height:1,children:[e.jsx(r,{children:b?">":" "}),e.jsx(s,{flexGrow:1,children:e.jsxs(r,{bold:b,inverse:b,wrap:"truncate",children:[" ",Se(j)]})})]},`mount-${String(x)}`)})}),!o&&e.jsx(s,{flexShrink:0,children:e.jsxs(r,{color:c===f.length?"cyan":"gray",inverse:c===f.length,children:[" ","+ Add mount..."]})}),o&&e.jsxs(s,{borderColor:"cyan",borderStyle:"single",flexDirection:"column",marginTop:1,paddingX:1,children:[e.jsx(s,{flexShrink:0,marginBottom:1,children:e.jsx(r,{bold:!0,color:"cyan",children:"New Mount"})}),e.jsxs(s,{flexShrink:0,children:[e.jsx(s,{width:12,children:e.jsxs(r,{bold:a==="source",color:a==="source"?"cyan":"white",children:[a==="source"?"❯ ":" ","Source:"]})}),e.jsx(r,{color:n?"yellow":"gray",children:n||(a==="source"?"_":"(type source, Enter to continue)")})]}),e.jsxs(s,{flexShrink:0,children:[e.jsx(s,{width:12,children:e.jsxs(r,{bold:a==="target",color:a==="target"?"cyan":"white",children:[a==="target"?"❯ ":" ","Target:"]})}),e.jsx(r,{color:l?"yellow":"gray",children:l||(a==="target"?"_":"/container/path")})]}),e.jsxs(s,{flexShrink:0,children:[e.jsx(s,{width:12,children:e.jsxs(r,{bold:a==="type",color:a==="type"?"cyan":"white",children:[a==="type"?"❯ ":" ","Type:"]})}),a==="type"?e.jsxs(r,{children:[e.jsx(r,{bold:m==="volume",color:m==="volume"?"cyan":"gray",children:"[1] volume"})," ",e.jsx(r,{bold:m==="bind",color:m==="bind"?"cyan":"gray",children:"[2] bind"})," ",e.jsx(r,{bold:m==="tmpfs",color:m==="tmpfs"?"cyan":"gray",children:"[3] tmpfs"})]}):e.jsx(r,{color:"gray",children:m})]}),e.jsx(s,{flexShrink:0,marginTop:1,children:e.jsx(r,{dimColor:!0,wrap:"truncate",children:a==="type"?"1/2/3 select type, Enter confirm, Esc cancel":"Type text, Enter next step, Esc cancel"})})]}),f.length===0&&!o&&g.length===0&&e.jsx(s,{marginTop:1,children:e.jsx(r,{dimColor:!0,children:"Tip: Use volume mounts for node_modules and caches to improve performance."})})]})},"MountsSection");var xr=Object.defineProperty,vr=v((o,t)=>xr(o,"name",{value:t,configurable:!0}),"s$1");const jr=vr(({addingPort:o,addPortValue:t,config:i,fieldIndex:c})=>{const a=i.forwardPorts??[],n=c===a.length;return e.jsxs(s,{flexDirection:"column",paddingX:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{bold:!0,color:"cyan",children:"Forwarded Ports"}),e.jsxs(r,{dimColor:!0,children:[" ","(",a.length," ","ports)"]})]}),a.map((l,m)=>{const g=m===c;return e.jsx(s,{children:e.jsxs(r,{color:g?"cyan":void 0,inverse:g,children:[" ",String(l)]})},`port-${String(l)}`)}),e.jsx(s,{marginTop:a.length>0?1:0,children:e.jsxs(r,{color:n?"cyan":"gray",inverse:n,children:[" ",n&&o?e.jsxs(r,{children:["Enter port:"," ",e.jsx(r,{color:"yellow",children:t||"_"})]}):"+ Add port..."]})}),e.jsx(s,{marginTop:1,children:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ",n?"type port number, Enter to confirm":"select"," ",e.jsx(r,{bold:!0,color:"white",children:"d"})," ","remove selected"," ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"]})})]})},"PortsSection");var br=Object.defineProperty,yr=v((o,t)=>br(o,"name",{value:t,configurable:!0}),"a");const wr=yr(({focused:o,hadComments:t,jsonPreview:i,mode:c,scrollRef:a})=>e.jsxs(s,{borderColor:o?"cyan":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsxs(s,{flexShrink:0,paddingX:1,children:[e.jsx(r,{bold:!0,color:o?"cyan":"white",children:"Preview"}),e.jsxs(r,{dimColor:!0,children:[" ","(",c==="create"?"new":"edit",")"]})]}),t&&c==="edit"&&e.jsx(s,{flexShrink:0,paddingX:1,children:e.jsx(r,{color:"yellow",children:"Comments will not be preserved."})}),e.jsx(Qe,{flexGrow:1,ref:a,scrollbar:!0,scrollbarColor:"gray",children:i.split(`
|
|
3
|
+
`).map((n,l)=>e.jsx(r,{color:"green",children:n},`line-${String(l)}`))})]}),"PreviewPanel");var Cr=Object.defineProperty,Sr=v((o,t)=>Cr(o,"name",{value:t,configurable:!0}),"r");const kr=Sr(o=>{const t=[],i=[],c=[];if(!o.image&&!o.build&&!o.dockerComposeFile&&t.push({field:"image",message:'One of "image", "build", or "dockerComposeFile" is required'}),o.build&&(o.image&&i.push({field:"image",message:'Both "image" and "build" are set; "build" takes precedence'}),o.build.dockerfile||t.push({field:"build.dockerfile",message:'"build" requires a "dockerfile" path'})),o.dockerComposeFile&&!o.service&&t.push({field:"service",message:'"service" is required when using "dockerComposeFile"'}),o.features!==void 0&&(typeof o.features!="object"||Array.isArray(o.features))&&t.push({field:"features",message:'"features" must be an object mapping feature IDs to options'}),o.forwardPorts)if(Array.isArray(o.forwardPorts))for(const[a,n]of o.forwardPorts.entries())typeof n=="number"&&(n<1||n>65535)&&t.push({field:"forwardPorts",message:`Invalid port ${String(n)} at index ${String(a)}`});else t.push({field:"forwardPorts",message:'"forwardPorts" must be an array'});return o.customizations?.vscode?.extensions&&!Array.isArray(o.customizations.vscode.extensions)&&t.push({field:"customizations.vscode.extensions",message:"Extensions must be an array"}),o.customizations?.vscode?.settings&&typeof o.customizations.vscode.settings!="object"&&t.push({field:"customizations.vscode.settings",message:"Settings must be an object"}),o.name||c.push({field:"name",message:"Consider adding a name for better identification"}),(!o.features||Object.keys(o.features).length===0)&&c.push({field:"features",message:"Consider adding features for common tools"}),(!o.customizations?.vscode?.extensions||o.customizations.vscode.extensions.length===0)&&c.push({field:"extensions",message:"Consider adding VS Code extensions for your stack"}),o.privileged&&i.push({field:"privileged",message:"Running in privileged mode is a security risk"}),{errors:t,suggestions:c,valid:t.length===0,warnings:i}},"validateConfig");var Er=Object.defineProperty,ze=v((o,t)=>Er(o,"name",{value:t,configurable:!0}),"$");const ke=80,Ee=15,Ir=120,Ge=[{description:"Container name, base image, workspace folder, and user",id:"general",label:"General"},{description:"Installable tools and runtimes (Node, Python, Docker, etc.)",id:"features",label:"Features"},{description:"Ports to forward from the container to your host",id:"ports",label:"Ports"},{description:"Commands to run at different stages of the container lifecycle",id:"lifecycle",label:"Lifecycle"},{description:"VS Code extensions to auto-install in the container",id:"extensions",label:"Extensions"},{description:"Environment variables for the container and IDE",id:"environment",label:"Env"},{description:"Volume and bind mounts for persistent data and caches",id:"mounts",label:"Mounts"},{description:"Docker Compose integration for multi-container setups",id:"compose",label:"Compose"}],Tr=new Map(Ge.map(o=>[o.id,o.description])),Pr=ze((o,t,i,c)=>{switch(o){case"compose":return Ht;case"environment":return Kt(t);case"extensions":return fe(c).length;case"features":return ge(i).length;case"general":return Be;case"lifecycle":return gr;case"mounts":return(t.mounts?.length??0)+1;case"ports":return(t.forwardPorts?.length??0)+1;default:return 0}},"getFieldCount"),Dr=ze(({onSave:o,store:t})=>{const{exit:i}=Ze(),{columns:c,rows:a}=et(),n=p.useSyncExternalStore(t.subscribe,t.getSnapshot),[l,m]=p.useState(!1),[g,f]=p.useState(!1),[j,x]=p.useState(!1),[b,w]=p.useState(null),[E,D]=p.useState("editor"),[R,L]=p.useState(0),[H,J]=p.useState(!1),[ee,P]=p.useState(""),[T,I]=p.useState(null),[S,O]=p.useState(""),[q,C]=p.useState(""),[k,z]=p.useState("key"),[se,te]=p.useState(!1),[ce,G]=p.useState(""),[ae,_]=p.useState(""),[pe,K]=p.useState("volume"),[A,W]=p.useState("source"),le=p.useRef(null),B=p.useRef(null),$=p.useRef(null),re=p.useRef(!0);p.useEffect(()=>(re.current=!0,()=>{re.current=!1,$.current&&clearTimeout($.current)}),[]);const xe=Pr(n.section,n.config,n.featureSearch,n.extensionSearch),Y=Math.max(1,a-9);p.useEffect(()=>{n.section!=="features"&&n.section!=="extensions"||L(u=>n.fieldIndex>=u+Y?n.fieldIndex-Y+1:n.fieldIndex<u?n.fieldIndex:u)},[n.fieldIndex,n.section,Y]),p.useEffect(()=>{L(0)},[n.section,n.featureSearch,n.extensionSearch]);const _e=p.useCallback(()=>{const u=t.cleanConfig(),h=kr(u);if(!h.valid){const y=h.errors[0];w(y?`Error: ${y.message}`:"Validation failed"),$.current&&clearTimeout($.current),$.current=setTimeout(()=>{re.current&&w(null)},3e3);return}o(u),t.markClean();const d=h.warnings.length;w(d>0?`Saved! (${String(d)} warning${d>1?"s":""})`:"Saved!"),$.current&&clearTimeout($.current),$.current=setTimeout(()=>{re.current&&w(null)},2e3)},[o,t]);U((u,h)=>{if(h.downArrow||u==="j")t.setTemplateIndex(n.templateIndex+1);else if(h.upArrow||u==="k")t.setTemplateIndex(n.templateIndex-1);else if(h.return){const d=V[n.templateIndex];d&&t.applyTemplate(d.id)}else h.escape&&t.dismissTemplateSelector()},{isActive:n.showTemplateSelector}),U((u,h)=>{if(h.escape){J(!1),P("");return}if(h.return){const d=Number.parseInt(ee,10);!Number.isNaN(d)&&d>0&&d<=65535&&t.addPort(d),J(!1),P("");return}if(h.backspace){P(d=>d.slice(0,-1));return}u&&/^\d$/u.test(u)&&P(d=>d+u)},{isActive:H}),U((u,h)=>{if(h.escape){I(null),O(""),C(""),z("key");return}if(h.return){if(k==="key"&&S){z("value");return}if(k==="value"&&S){t.addEnvVar(T,S,q),I(null),O(""),C(""),z("key");return}}if(h.backspace){k==="key"?O(d=>d.slice(0,-1)):C(d=>d.slice(0,-1));return}u&&!h.ctrl&&!h.meta&&(k==="key"?O(d=>d+u):C(d=>d+u))},{isActive:T!==null}),U((u,h)=>{if(h.escape){te(!1),G(""),_(""),W("source");return}if(h.return){if(A==="source"&&ce){W("target");return}if(A==="target"&&ae){W("type");return}if(A==="type"){t.addMount({source:ce,target:ae,type:pe}),te(!1),G(""),_(""),W("source");return}}if(A==="type"){switch(u){case"1":{K("volume");break}case"2":{K("bind");break}case"3":{K("tmpfs");break}}return}if(h.backspace){A==="source"?G(d=>d.slice(0,-1)):A==="target"&&_(d=>d.slice(0,-1));return}u&&!h.ctrl&&!h.meta&&(A==="source"?G(d=>d+u):A==="target"&&_(d=>d+u))},{isActive:se}),U((u,h)=>{if(u==="c"&&h.ctrl){i();return}if(!g){if(l){h.escape||u==="?"?m(!1):h.downArrow||u==="j"?le.current?.scrollBy(1):h.upArrow||u==="k"?le.current?.scrollBy(-1):u==="q"&&(m(!1),f(!0));return}if(j){if(h.escape){x(!1),n.section==="features"?t.setFeatureSearch(""):t.setExtensionSearch("");return}if(h.return){x(!1);return}if(h.backspace){n.section==="features"?t.setFeatureSearch(n.featureSearch.slice(0,-1)):t.setExtensionSearch(n.extensionSearch.slice(0,-1));return}if(u&&!h.ctrl&&!h.meta){n.section==="features"?t.setFeatureSearch(n.featureSearch+u):t.setExtensionSearch(n.extensionSearch+u);return}return}if(n.fieldEditing){if(h.escape){t.setFieldEditing(!1);return}if(h.return){t.setFieldEditing(!1);return}return}if(u==="?"){m(!0);return}if(u==="q"){n.isDirty?f(!0):i();return}if(u==="s"){_e();return}if(h.tab){D(d=>d==="editor"?"preview":"editor");return}if(E==="preview"){if(h.downArrow||u==="j"){B.current?.scrollBy(1);return}if(h.upArrow||u==="k"){B.current?.scrollBy(-1);return}if(h.pageDown){B.current?.scrollBy(10);return}if(h.pageUp){B.current?.scrollBy(-10);return}if(h.home){B.current?.scrollToTop();return}if(h.end){B.current?.scrollToBottom();return}h.escape&&D("editor");return}if(h.downArrow||u==="j"){xe>0&&t.setFieldIndex(Math.min(n.fieldIndex+1,xe-1));return}if(h.upArrow||u==="k"){t.setFieldIndex(Math.max(n.fieldIndex-1,0));return}if(h.return){switch(n.section){case"compose":case"general":case"lifecycle":{t.setFieldEditing(!0);break}case"environment":{const d=Object.keys(n.config.containerEnv??{}).length,y=d,M=d+1+Object.keys(n.config.remoteEnv??{}).length;n.fieldIndex===y?(I("container"),O(""),C(""),z("key")):n.fieldIndex===M&&(I("remote"),O(""),C(""),z("key"));break}case"mounts":{const d=n.config.mounts??[];n.fieldIndex===d.length&&(te(!0),G(""),_(""),K("volume"),W("source"));break}case"ports":{const d=n.config.forwardPorts??[];n.fieldIndex===d.length&&(J(!0),P(""));break}}return}if(u===" "){switch(n.section){case"extensions":{const d=fe(n.extensionSearch)[n.fieldIndex];d&&t.toggleExtension(d.id);break}case"features":{const d=ge(n.featureSearch)[n.fieldIndex];d&&t.toggleFeature(d.id);break}case"general":{const d=Be-ue.length,y=n.fieldIndex-d;if(y>=0&&y<ue.length){const M=ue[y];t.updateConfig({[M]:!n.config[M]})}break}}return}if(u==="/"){(n.section==="features"||n.section==="extensions")&&x(!0);return}if(u==="A"&&n.section==="mounts"){t.applySuggestedMounts();return}if(u==="a"){if(n.section==="environment"){const d=Object.keys(n.config.containerEnv??{}).length,y=n.fieldIndex<=d?"container":"remote";I(y),O(""),C(""),z("key")}else n.section==="mounts"&&(te(!0),G(""),_(""),K("volume"),W("source"));return}if(u==="d")switch(n.section){case"environment":{const d=Object.keys(n.config.containerEnv??{}),y=Object.keys(n.config.remoteEnv??{});if(n.fieldIndex<d.length)t.removeEnvVar("container",d[n.fieldIndex]),d.length===1||n.fieldIndex>=d.length-1&&t.setFieldIndex(d.length-2);else{const M=n.fieldIndex-d.length-1;M>=0&&M<y.length&&(t.removeEnvVar("remote",y[M]),y.length===1||M>=y.length-1&&t.setFieldIndex(n.fieldIndex-1))}break}case"mounts":{const d=n.config.mounts??[];if(n.fieldIndex<d.length){t.removeMount(n.fieldIndex);const y=d.length-1;n.fieldIndex>=y&&y>0&&t.setFieldIndex(y-1)}break}case"ports":{const d=n.config.forwardPorts??[];if(n.fieldIndex<d.length){t.removePort(n.fieldIndex);const y=d.length-1;n.fieldIndex>=y&&y>0&&t.setFieldIndex(y-1)}break}}}},{isActive:!n.showTemplateSelector&&!H&&T===null&&!se});const We=p.useMemo(()=>t.getJsonPreview(),[n.config]);if(c<ke||a<Ee)return e.jsx(s,{alignItems:"center",height:a,justifyContent:"center",width:c,children:e.jsxs(r,{color:"yellow",children:["Terminal too small (",c,"x",a,"), need"," ",ke,"x",Ee]})});if(n.showTemplateSelector)return e.jsx(s,{alignItems:"center",flexDirection:"column",height:a,justifyContent:"center",width:c,children:e.jsxs(s,{borderColor:"cyan",borderStyle:"round",flexDirection:"column",paddingX:2,paddingY:1,width:60,children:[e.jsx(s,{justifyContent:"center",marginBottom:1,children:e.jsx(r,{bold:!0,color:"cyan",children:"Select a Template"})}),V.map((u,h)=>{const d=h===n.templateIndex;return e.jsx(s,{children:e.jsxs(r,{color:d?"cyan":void 0,inverse:d,children:[d?" ❯ ":" ",e.jsx(r,{bold:d,children:u.name}),e.jsxs(r,{dimColor:!0,children:[" ","-",u.description]})]})},u.id)}),e.jsx(s,{justifyContent:"center",marginTop:1,children:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","navigate"," ",e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","select"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","blank"]})})]})});let F;switch(n.section){case"compose":{F=e.jsx(Xt,{config:n.config,fieldEditing:n.fieldEditing,fieldIndex:n.fieldIndex,onUpdate:v(u=>{t.updateConfig(u)},"onUpdate")});break}case"environment":{F=e.jsxs(s,{flexDirection:"column",children:[e.jsx(qt,{config:n.config,fieldIndex:n.fieldIndex}),T!==null&&e.jsx(s,{marginTop:1,paddingX:1,children:e.jsxs(r,{color:"cyan",children:["Add"," ",T," ","env:"," ",k==="key"?e.jsxs(r,{children:["key=",e.jsx(r,{color:"yellow",children:S||"_"})," ","(Enter to set value)"]}):e.jsxs(r,{children:[S,"=",e.jsx(r,{color:"yellow",children:q||"_"})," ","(Enter to confirm, Esc to cancel)"]})]})})]});break}case"extensions":{F=e.jsx(Zt,{config:n.config,fieldIndex:n.fieldIndex,scrollOffset:R,searchText:n.extensionSearch,viewportHeight:Y});break}case"features":{F=e.jsx(rr,{config:n.config,fieldIndex:n.fieldIndex,scrollOffset:R,searchText:n.featureSearch,viewportHeight:Y});break}case"general":{F=e.jsx(ar,{config:n.config,fieldEditing:n.fieldEditing,fieldIndex:n.fieldIndex,onUpdate:v(u=>{t.updateConfig(u)},"onUpdate")});break}case"lifecycle":{F=e.jsx(mr,{config:n.config,fieldEditing:n.fieldEditing,fieldIndex:n.fieldIndex,onSetCommand:v((u,h)=>{t.setLifecycleCommand(u,h)},"onSetCommand")});break}case"mounts":{F=e.jsx(pr,{addingMount:se,config:n.config,detectedPm:n.detectedPm,fieldIndex:n.fieldIndex,mountPhase:A,mountSource:ce,mountTarget:ae,mountType:pe,suggestedMounts:n.suggestedMounts});break}case"ports":{F=e.jsx(jr,{addingPort:H,addPortValue:ee,config:n.config,fieldIndex:n.fieldIndex});break}default:F=e.jsx(r,{children:"Unknown section"})}const Ue=e.jsxs(s,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:[e.jsxs(s,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:[e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"q"}),e.jsx(r,{dimColor:!0,children:"QUIT"})]}),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"?"}),e.jsx(r,{dimColor:!0,children:"HELP"})]}),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"}),e.jsx(r,{dimColor:!0,children:"NAV"})]}),(n.section==="features"||n.section==="extensions")&&e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Space"}),e.jsx(r,{dimColor:!0,children:"CHECK"})]}),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"←→"}),e.jsx(r,{dimColor:!0,children:"TABS"})]}),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Tab"}),e.jsx(r,{dimColor:!0,children:"PANEL"})]}),(n.section==="features"||n.section==="extensions")&&e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/"}),e.jsx(r,{dimColor:!0,children:"FILTER"})]}),e.jsxs(s,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"s"}),e.jsx(r,{dimColor:!0,children:"SAVE"})]})]}),e.jsxs(s,{paddingX:1,children:[b&&e.jsxs(r,{color:b.startsWith("Error")?"red":"green",children:[b," "]}),n.isDirty&&e.jsx(r,{color:"yellow",children:"[modified]"}),!n.isDirty&&!b&&e.jsx(r,{dimColor:!0,children:"[saved]"})]})]}),Ve=e.jsxs(tt,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"?"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:le,title:"KEYBOARD SHORTCUTS",visible:l,width:56,children:[e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"←→"}),e.jsx(r,{dimColor:!0,children:" Switch tabs"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"↑↓"}),"/",e.jsx(r,{bold:!0,color:"white",children:"j/k"}),e.jsx(r,{dimColor:!0,children:" Navigate within section"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"Tab"}),e.jsx(r,{dimColor:!0,children:" Switch editor/preview panel"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"Enter"}),e.jsx(r,{dimColor:!0,children:" Edit selected field"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"Esc"}),e.jsx(r,{dimColor:!0,children:" Stop editing / cancel"})]})]}),e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"FEATURES / EXTENSIONS"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"Space"}),e.jsx(r,{dimColor:!0,children:" Toggle selection"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"/"}),e.jsx(r,{dimColor:!0,children:" Search / filter"})]})]}),e.jsxs(s,{flexDirection:"column",marginBottom:1,children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"LISTS (Ports, Mounts, Env)"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"a"}),e.jsx(r,{dimColor:!0,children:" Add new entry"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"d"}),e.jsx(r,{dimColor:!0,children:" Delete selected entry"})]})]}),e.jsxs(s,{flexDirection:"column",children:[e.jsxs(s,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"ACTIONS"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"s"}),e.jsx(r,{dimColor:!0,children:" Save configuration"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"q"}),e.jsx(r,{dimColor:!0,children:" Quit"})]}),e.jsxs(r,{children:[" ",e.jsx(r,{bold:!0,color:"white",children:"?"}),e.jsx(r,{dimColor:!0,children:" Toggle help"})]})]})]}),Xe=e.jsx(wr,{focused:E==="preview",hadComments:n.hadComments,jsonPreview:We,mode:n.mode,scrollRef:B}),ve=c>=Ir,He=ve?Math.floor(c*.38):0;return e.jsxs(s,{flexDirection:"column",height:a,width:c,children:[e.jsxs(s,{flexShrink:0,gap:1,paddingX:1,children:[e.jsx(r,{bold:!0,inverse:!0,children:" VIS "}),e.jsxs(r,{wrap:"truncate",children:[n.mode==="create"?"Create":"Edit"," ","devcontainer"]})]}),e.jsx(s,{flexShrink:0,paddingX:1,paddingY:1,children:e.jsx(mt,{defaultValue:n.section,keyMap:{useNumbers:!1,useTab:!1},onChange:v(u=>{t.setSection(u),D("editor")},"onChange"),showIndex:!1,children:Ge.map(({id:u,label:h})=>e.jsx(gt,{name:u,children:h},u))})}),e.jsx(s,{flexShrink:0,paddingRight:2,children:e.jsx(r,{dimColor:!0,wrap:"truncate",children:Tr.get(n.section)??""})}),e.jsxs(s,{flexDirection:"row",flexGrow:1,overflow:"hidden",children:[e.jsx(s,{borderColor:E==="editor"?"white":"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,overflow:"hidden",children:F}),ve&&e.jsx(s,{flexShrink:0,width:He,children:Xe})]}),Ue,e.jsx(rt,{autoExitSeconds:3,onCancel:v(()=>{f(!1)},"onCancel"),visible:g}),Ve]})},"VisDevcontainerApp");var Or=Object.defineProperty,Ie=v((o,t)=>Or(o,"name",{value:t,configurable:!0}),"c");const Rr=Ie(async({logger:o,options:t,workspaceRoot:i})=>{if(!i)throw new Error("Could not determine workspace root. Run this command inside a monorepo or project directory.");const c=i,a=t.template,n=t.output,l=!!process.stdout.isTTY&&!it;let m=null;try{m=st(c).name}catch{}const g=jt(c);let f=g?.config??null;const j=g?.hadComments??!1;if(a&&!g){const E=V.find(D=>D.id===a);if(!E){const D=V.map(R=>R.id).join(", ");throw new Error(`Unknown template "${a}". Valid templates: ${D}`)}f=E.config}if(!l){f?o.info(JSON.stringify(f,null,2)):(o.error("No existing devcontainer.json found. Use --template to generate one in non-TTY mode."),process.exitCode=1);return}process.stdin.isTTY&&typeof process.stdin.setRawMode=="function"&&(process.stdin.setRawMode(!0),process.stdin.ref(),process.stdin.resume());const x=setInterval(()=>{},1e3),b=new Et(f,j,m);a&&!g&&b.dismissTemplateSelector();let w=null;if(await ot(nt.createElement(Dr,{onSave:Ie(E=>{bt(c,E,n),w=E},"onSave"),store:b}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit(),clearInterval(x),w){const E=n??".devcontainer/devcontainer.json";o.info(`DevContainer config saved to ${E}`)}},"execute");export{Rr as default};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var X=Object.defineProperty;var j=(c,o)=>X(c,"name",{value:o,configurable:!0});import{e as q,g as H,p as m,T as K,h as V,a as Z,G as f,i as A,c as _,j as Q,k as U,R as i,l as W,d as ee,n as y,X as D,B as te,J as oe,s as se}from"./bin.js";import{H as re,e as ae,Z as ne}from"../packem_shared/ai-analysis-KP8b5lc0.js";import{A as ie}from"../packem_shared/pm-runner-DmKT2FqF.js";import{U as ce,C as le,a as J}from"../packem_shared/vis-update-app-BCKzlqj8.js";var de=Object.defineProperty,ue=j((c,o)=>de(c,"name",{value:o,configurable:!0}),"A");const ve=ue(async({argument:c,logger:o,options:e,visConfig:n,workspaceRoot:R})=>{if(!R)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const u=R;if(e.securityConfig){const t=ie(u);if(q(n??{},t.name),e.sync&&t.name==="pnpm"){const s=H(n??{});if(s.length>0){m.info(`
|
|
2
|
+
Settings that would sync to pnpm-workspace.yaml:`);for(const x of s)m.success(` ${x}`)}else m.info("No security settings to sync.")}else e.sync&&t.name!=="pnpm"&&(m.info(`--sync is only available for pnpm projects. Your project uses ${t.name}.`),m.info("vis enforces security settings at the vis layer for non-pnpm projects."));if(!e.security&&!c?.length)return}const{packageManager:M}=K(u),N=V(u),l=n?.update??{},v=Z(u,M,{dev:e.dev,includeInternal:e["include-internal"],peer:e.peer,prod:e.prod});if(v.size===0){o.info("No catalogs found.");return}const h=e.target??l.target??"latest";if(!["latest","minor","patch"].includes(h))throw new Error(`Invalid target "${h}". Use: latest, minor, or patch.`);const z={exclude:[...f(e.exclude),...f(l.exclude)],ignore:f(l.ignore),include:[...f(e.include),...f(l.include),...c],includeLocked:!!e.includeLocked,includePrerelease:e.prerelease||l.prerelease||!1,security:e.security!==!1,target:h};let $=0;for(const t of v.values())$+=t.size;const w=!!process.stdout.isTTY&&!se;let d;const B=w?(t,s)=>{d?d.rerender(i.createElement(J,{current:t,total:s})):d=U(i.createElement(J,{current:t,total:s}),{interactive:!0,patchConsole:!1})}:(t,s)=>{o.info(`Checking ${String(t)}/${String(s)} dependencies...`)};w||o.info(`Checking ${String($)} catalog dependencies against npm registry...
|
|
3
|
+
`);const C=new Set;A("socket")&&C.add("socket"),A("depsDev")&&C.add("deps-dev");const k=n?.security?.policies?.score?.minimum,I=_(n?.security,{disabled:C,minimumScore:k}),{failed:E,outdated:a}=await Q(v,z,N,B,u,I,n?.security?.acceptedRisks);if(d&&(d.clear(),d.unmount()),E.length>0&&o.warn(`Failed to fetch: ${E.join(", ")}`),a.length===0){o.info("All catalog dependencies are up to date.");return}const b=e.format??l.format??"table",L=re(e.aiType??"impact"),p=e.ai?await ae(a,o,n?.ai,L):void 0;if(w&&b==="table"){const t=new ce(a,p??null),s=n?.tui?.autoExit??!1,x=s===!0?3:typeof s=="number"?s:0;await U(i.createElement(le,{autoExitSeconds:x,isDryRun:!0,store:t}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit();const O=process.stdout.columns||80;process.stdout.write(`
|
|
4
|
+
`);for(const r of a){const P=r.vulnerabilities?.length||r.socketReport&&r.socketReport.alerts.length>0,S=!!r.acceptedRisk,Y=P?S?"✓":"⚠":"✓",F=S?"gray":r.updateType==="major"?"red":r.updateType==="minor"?"yellow":"green",g=r.socketReport?.score.overall,G=g===void 0?"":` [${String(Math.round(g*100))}%]`,T=g===void 0?void 0:W(g);process.stdout.write(`${ee(i.createElement(y,null," ",i.createElement(y,{color:F},Y),` ${r.packageName} ${r.currentRange} → ${r.newRange}`,i.createElement(y,{dimColor:!0},` ${r.updateType}`),T?i.createElement(y,{color:T},G):null),{columns:O})}
|
|
5
|
+
`)}process.stdout.write(`
|
|
6
|
+
`),o.info(D(a,k))}else if(b==="json"){const t={failed:E,outdated:a};p&&(t.aiAnalysis=p),process.stdout.write(`${JSON.stringify(t,void 0,2)}
|
|
7
|
+
`)}else b==="minimal"?process.stdout.write(`${te(a)}
|
|
8
|
+
`):(oe(a,o),o.info(D(a,k)),p&&(o.info(""),o.info(ne(p))));e.exitCode&&a.length>0&&(process.exitCode=1)},"execute");export{ve as default};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var Re=Object.defineProperty;var f=(e,t)=>Re(e,"name",{value:t,configurable:!0});import{createRequire as Fe}from"node:module";import{a as He,M as te,z as _,l as ie,Q as Te}from"../packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js";import{x as Se}from"tinyexec";import{o as $e}from"../packem_shared/index-DH-5hsrC.js";import{a5 as w,n as $,a6 as E,k as qe}from"./bin.js";import{n as Ue}from"../packem_shared/spinner-C8xs6QZv.js";import{C as xe,D as B,T as Ce}from"../packem_shared/symbols-CQmER5MT.js";import{E as C,I as ze,e as oe,q as Q,T as J}from"../packem_shared/Table-DoSoazT6-DwnyTUsA.js";import{withEnhancedPath as Ve}from"@visulima/task-runner";const Ne=Fe(import.meta.url),R=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,U=f(e=>{if(typeof R<"u"&&R.versions&&R.versions.node){const[t,s]=R.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return R.getBuiltinModule(e)}return Ne(e)},"__cjs_getBuiltinModule"),{createRequire:Ge}=U("node:module"),{readFileSync:De,writeFileSync:_e,unlinkSync:Le}=U("node:fs"),{randomBytes:Be}=U("node:crypto"),{availableParallelism:ce}=U("node:os");var We=Object.defineProperty,Ie=f((e,t)=>We(e,"name",{value:t,configurable:!0}),"c$3");const Ke=Ge(import.meta.url),F=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,re=Ie(e=>{if(typeof F<"u"&&F.versions&&F.versions.node){const[t,s]=F.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return F.getBuiltinModule(e)}return Ke(e)},"a"),Ye=re("fs"),Qe=re("os"),Je=re("path");var Xe=Object.defineProperty,z=Ie((e,t)=>Xe(e,"name",{value:t,configurable:!0}),"o");const Ee=z(e=>{let t="";for(let s=0;s<e.length;s+=1){const r=e[s],n=r.toUpperCase();t+=r===n?r.toLowerCase():n}return t},"invertCase"),X=new Map,de=z((e,t)=>{const s=Je.join(e,`.is-fs-case-sensitive-test-${process.pid}`);try{return t.writeFileSync(s,""),!t.existsSync(Ee(s))}finally{try{t.unlinkSync(s)}catch{}}},"checkDirectoryCaseWithWrite"),Ze=z((e,t,s)=>{try{return de(e,s)}catch(r){if(t===void 0)return de(Qe.tmpdir(),s);throw r}},"checkDirectoryCaseWithFallback"),et=z((e,t=Ye,s=!0)=>{const r=e??process.cwd();if(s&&X.has(r))return X.get(r);let n;const i=Ee(r);return i!==r&&t.existsSync(r)?n=!t.existsSync(i):n=Ze(r,e,t),s&&X.set(r,n),n},"isFsCaseSensitive");var tt=Object.defineProperty,st=f((e,t)=>tt(e,"name",{value:t,configurable:!0}),"s$3");class O extends Error{static{f(this,"StagedError")}static{st(this,"StagedError")}constructor(t,s){super(t,s),this.name=this.constructor.name}}var rt=Object.defineProperty,nt=f((e,t)=>rt(e,"name",{value:t,configurable:!0}),"o$6");class at extends O{static{f(this,"ApplyEmptyCommitError")}static{nt(this,"ApplyEmptyCommitError")}}var it=Object.defineProperty,ot=f((e,t)=>it(e,"name",{value:t,configurable:!0}),"o$5");class T extends O{static{f(this,"ConfigError")}static{ot(this,"ConfigError")}}var ct=Object.defineProperty,dt=f((e,t)=>ct(e,"name",{value:t,configurable:!0}),"t$1");class le extends O{static{f(this,"GetBackupStashError")}static{dt(this,"GetBackupStashError")}}var lt=Object.defineProperty,ut=f((e,t)=>lt(e,"name",{value:t,configurable:!0}),"s$2");class D extends O{static{f(this,"GitError")}static{ut(this,"GitError")}stderr;constructor(t,s,r){super(t,r),this.stderr=s}}var ft=Object.defineProperty,ht=f((e,t)=>ft(e,"name",{value:t,configurable:!0}),"e");class ue extends O{static{f(this,"RestoreOriginalStateError")}static{ht(this,"RestoreOriginalStateError")}}var pt=Object.defineProperty,gt=f((e,t)=>pt(e,"name",{value:t,configurable:!0}),"o$2");class j extends O{static{f(this,"TaskError")}static{gt(this,"TaskError")}commandTitle;constructor(t,s,r){super(s,r),this.commandTitle=t}}var mt=Object.defineProperty,V=f((e,t)=>mt(e,"name",{value:t,configurable:!0}),"i");const wt=V(async e=>{if(e.config!==void 0)return e.config;throw new T(`No staged config provided. Add \`staged\` to your vis.config.ts:
|
|
2
|
+
|
|
3
|
+
import { defineConfig } from "@visulima/vis/config";
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
staged: { "*.ts": "eslint --fix" },
|
|
7
|
+
});
|
|
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.`)},"resolveConfig"),fe=V(e=>{if(typeof e!="object"||e===null)throw new T("Staged config must be an object mapping glob patterns to tasks.");const t=Object.entries(e);if(t.length===0)throw new T("Staged config is empty — at least one glob pattern is required.");for(const[s,r]of t){if(!s||s.trim()==="")throw new T("Staged config keys must be non-empty glob patterns.");je(s,r)}return e},"validateConfig"),je=V((e,t)=>{if(typeof t=="string"){if(t.trim()==="")throw new T(`Task for "${e}" is an empty string.`);return}if(Array.isArray(t)){if(t.length===0)throw new T(`Task array for "${e}" is empty.`);for(const s of t)je(e,s);return}if(typeof t!="function"&&!vt(t))throw new T(`Invalid task for "${e}" — expected string, string[], function, or { title, task } object.`)},"validateTask"),vt=V(e=>typeof e=="object"&&e!==null&&typeof e.title=="string"&&typeof e.task=="function","isCustomTask");var yt=Object.defineProperty,x=f((e,t)=>yt(e,"name",{value:t,configurable:!0}),"r$2");const he=2048,g=x(async(e,t)=>{const s=t.input===void 0?void 0:typeof t.input=="string"?t.input:t.input.toString("utf8"),r=await Se("git",[...e],{nodeOptions:{cwd:t.cwd,env:t.env?{...process.env,...t.env}:void 0,stdio:s===void 0?["ignore","pipe","pipe"]:["pipe","pipe","pipe"]},stdin:s}),n=typeof r.exitCode=="number"?r.exitCode:1;if(n!==0&&!t.lenient){const{stderr:i}=r,o=i.length>he?`${i.slice(0,he)}…`:i;throw new D(`git ${e.join(" ")} failed with exit code ${n}: ${o.trim()}`,i)}return{exitCode:n,stderr:r.stderr,stdout:r.stdout}},"git"),P=x(async(e,t)=>{const{stdout:s}=await g(e,t);return s.trim()},"gitOut"),kt=x(async e=>{const t=await g(["rev-parse","--is-inside-work-tree"],{cwd:e,lenient:!0});return t.exitCode===0&&t.stdout.trim()==="true"},"isGitRepo"),bt=x(async e=>P(["rev-parse","--absolute-git-dir"],{cwd:e}),"getGitDirectory"),Me=x(async e=>P(["rev-parse","--show-toplevel"],{cwd:e}),"getWorkTree"),pe=x(async e=>P(["write-tree"],{cwd:e}),"writeIndexTree"),Tt=x(async e=>{const t=await g(["rev-parse","HEAD^{tree}"],{cwd:e,lenient:!0});return t.exitCode===0?t.stdout.trim():""},"headTreeSha"),N={major:2,minor:32},St=x(e=>{const t=/git version (\d+)\.(\d+)/.exec(e);if(!t)return null;const s=Number.parseInt(t[1]??"",10),r=Number.parseInt(t[2]??"",10);return Number.isNaN(s)||Number.isNaN(r)?null:{major:s,minor:r}},"parseGitVersion"),$t=x(async e=>{const t=St(await P(["--version"],{cwd:e}));if(t!==null&&(t.major<N.major||t.major===N.major&&t.minor<N.minor))throw new D(`Git ${N.major}.${N.minor} or newer is required; found ${t.major}.${t.minor}.`)},"assertGitVersion");var xt=Object.defineProperty,I=f((e,t)=>xt(e,"name",{value:t,configurable:!0}),"a$2");const Ct="ACMR",ge=500,It=I(async e=>{const{stdout:t}=await g(["diff-files","--raw","-z"],{cwd:e}),s=t.split("\0").filter(n=>n.length>0),r=[];for(let n=0;n<s.length;n+=1){const i=s[n];if(!i?.startsWith(":"))continue;const o=i.slice(1).split(" "),a=o[3],c=o[4],d=s[n+1];n+=1,c==="A"&&a!==void 0&&/^0+$/.test(a)&&d!==void 0&&r.push(d)}return r},"getIntentToAddPaths"),me=I(async e=>{const{stdout:t}=await g(["ls-files","--others","--exclude-standard","-z"],{cwd:e});return t.split("\0").filter(s=>s.length>0)},"getUntrackedFiles"),Et=I(async(e,t)=>{if(e.length===0)return;const s=`${e.join("\0")}\0`;await g(["rm","--cached","--quiet","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:t.cwd,input:s})},"removeFromIndex"),jt=I(async e=>{const t=e.diffFilter??Ct,s=e.diff===void 0?["diff","--name-only","-z",`--diff-filter=${t}`,"--staged"]:["diff","--name-only","-z",`--diff-filter=${t}`,...e.diff.split(/\s+/).filter(Boolean)],{stdout:r}=await g(s,{cwd:e.cwd}),n=r.split("\0").filter(o=>o.length>0);if(n.length===0)return[];const i=e.workTree??await Me(e.cwd);return n.map(o=>He(o)?o:te(i,o))},"getFiles"),Mt=I(async(e,t)=>{if(e.length===0)return null;const s=[];for(let i=0;i<e.length;i+=ge){const o=e.slice(i,i+ge),{stdout:a}=await g(["diff","--binary","--unified=0","--no-color","--no-ext-diff","--src-prefix=a/","--dst-prefix=b/","--patch","--submodule=short","--",...o],{cwd:t.cwd});a.length>0&&s.push(a)}if(s.length===0)return null;const r=s.join(""),n=r.endsWith(`
|
|
10
|
+
`)?r:`${r}
|
|
11
|
+
`;return Buffer.from(n,"utf8")},"capturePatch"),Ot=I(async e=>{const{stdout:t}=await g(["status","--porcelain=v1","-z"],{cwd:e}),s=t.split("\0"),r=[];for(let n=0;n<s.length;n+=1){const i=s[n];if(i===void 0||i.length<4)continue;const o=i.charAt(0),a=i.charAt(1),c=i.slice(3),d=o==="R"||o==="C"||a==="R"||a==="C";o!==" "&&o!=="?"&&a!==" "&&a!=="?"&&r.push(c),d&&(n+=1)}return r},"getPartiallyStagedFiles"),At=I(async(e,t)=>{if(e.length===0)return;const s=`${e.join("\0")}\0`;await g(["checkout","--force","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:t.cwd,input:s})},"checkoutPaths"),Pt=I(async(e,t)=>{if(await g(["update-index","--again"],{cwd:t.cwd,lenient:!0}),e.length===0)return;const s=`${e.join("\0")}\0`;await g(["add","-u","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:t.cwd,input:s})},"updateIndexAgain");var Rt=Object.defineProperty,A=f((e,t)=>Rt(e,"name",{value:t,configurable:!0}),"r$1");const Ft="vis_staged_automatic_backup",Oe=A(()=>`${Ft}-${process.pid}-${Date.now()}-${Be(3).toString("hex")}`,"buildMessage"),Nt=A(async e=>{const t=await P(["stash","create"],{cwd:e});return t.length===0?null:(await g(["stash","store","-m",Oe(),t],{cwd:e}),t)},"createBackupStash"),Gt=A(async e=>{const t=Oe(),{exitCode:s,stdout:r}=await g(["stash","push","--keep-index","--include-untracked","--quiet","-m",t],{cwd:e,lenient:!0});if(s!==0)return null;const n=r.trim();return n.length>0&&/no local changes/i.test(n)?null:P(["rev-parse","stash@{0}"],{cwd:e})},"createHideAllStash"),ne=A(async(e,t)=>{const{exitCode:s,stdout:r}=await g(["reflog","--format=%H %gd","refs/stash"],{cwd:e,lenient:!0});if(s!==0)return null;for(const n of r.split(/\r?\n/)){const[i,o]=n.split(/\s+/,2);if(i===t&&o!==void 0)return o}return null},"findStashRefBySha"),we=A(async(e,t)=>{if(t===null)return;const s=await ne(e,t);s!==null&&await g(["stash","drop","--quiet",s],{cwd:e})},"dropBackupStash"),Dt=A(async(e,t)=>{if(t===null)throw new le("Backup stash was not found — can't revert working tree.");const s=await ne(e,t);if(s===null)throw new le(`Backup stash ${t} is no longer reachable — can't revert working tree.`);await g(["reset","--hard","HEAD"],{cwd:e}),await g(["stash","apply","--index","--quiet",s],{cwd:e})},"applyBackupStash"),_t=A(async(e,t)=>{if(t===null)return;const s=await ne(e,t);s!==null&&await g(["stash","pop","--quiet",s],{cwd:e})},"popHideAllStash");var Lt=Object.defineProperty,Ht=f((e,t)=>Lt(e,"name",{value:t,configurable:!0}),"l");class Bt{static{f(this,"GitWorkflow")}static{Ht(this,"GitWorkflow")}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(t){this.cwd=t.cwd??process.cwd(),this.options=t,this.shouldStash=t.stash!==!1&&t.diff===void 0,this.shouldHidePartial=t.hidePartiallyStaged!==!1,this.shouldHideUnstaged=t.hideUnstaged===!0,this.shouldHideAll=t.hideAll===!0}async prepare(){if(!await kt(this.cwd))throw new D(`Not a git repository: ${this.cwd}`);await $t(this.cwd),this.workTree=await Me(this.cwd),this.gitDir=await bt(this.cwd),this.stagedFiles=await jt({cwd:this.workTree,diff:this.options.diff,diffFilter:this.options.diffFilter,workTree:this.workTree}),this.partiallyStaged=this.stagedFiles.length===0?[]:await Ot(this.workTree),this.snapshotMergeState(),this.intentToAddPaths=await It(this.workTree),this.intentToAddPaths.length>0&&await Et(this.intentToAddPaths,{cwd:this.workTree}),this.shouldStash?this.backupStashSha=await Nt(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 Gt(this.workTree):await this.hideUnstagedChanges(),this.preTaskIndexTree=this.stagedFiles.length===0?"":await pe(this.workTree),this.postTaskIndexTree=this.preTaskIndexTree,this.headTree=await Tt(this.workTree),this.preTaskUntracked=new Set(await me(this.workTree))}async applyModifications({autoStage:t=!1}={}){if(this.stagedFiles.length===0)return;const s=this.stagedFiles.map(r=>_(this.workTree,r));if(await Pt(s,{cwd:this.workTree}),t){const r=(await me(this.workTree)).filter(n=>!this.preTaskUntracked.has(n));if(r.length>0){const n=`${r.join("\0")}\0`;await g(["add","--pathspec-from-file=-","--pathspec-file-nul","--"],{cwd:this.workTree,input:n})}}if(this.intentToAddPaths.length>0)try{await g(["add","--intent-to-add","--",...this.intentToAddPaths],{cwd:this.workTree})}catch{}this.postTaskIndexTree=await pe(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 t=["apply","--whitespace=nowarn","--recount","--unidiff-zero"];let s;try{await g(t,{cwd:this.workTree,input:this.patch});return}catch(r){s=r instanceof D?r.stderr:String(r)}try{await g([...t,"--3way"],{cwd:this.workTree,input:this.patch})}catch(r){const n=r instanceof D&&r.stderr?r.stderr:String(r);throw new ue(`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: ${s??"(no stderr)"}
|
|
13
|
+
Second attempt: ${n}`,{cause:r})}}async revert(){if(this.backupStashSha!==null){try{await Dt(this.workTree,this.backupStashSha)}catch(t){throw new ue("Revert failed while restoring the backup stash. Use `git stash list` to recover manually.",{cause:t})}if(await we(this.workTree,this.backupStashSha),this.intentToAddPaths.length>0)try{await g(["add","--intent-to-add","--",...this.intentToAddPaths],{cwd:this.workTree})}catch{}this.revertApplied=!0}}async cleanup(t){if(this.restoreMergeState(),this.hideAllStashSha!==null)try{await _t(this.workTree,this.hideAllStashSha)}catch{}t&&this.backupStashSha!==null&&!this.revertApplied&&await we(this.workTree,this.backupStashSha)}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 t=new Set(this.stagedFiles.map(r=>_(this.workTree,r))),s=this.shouldHideUnstaged?[...t]:this.shouldHidePartial?this.partiallyStaged.filter(r=>t.has(r)):[];s.length!==0&&(this.patch=await Mt(s,{cwd:this.workTree}),this.patch!==null&&await At(s,{cwd:this.workTree}))}snapshotMergeState(){this.gitDir.length!==0&&(this.merge=["MERGE_HEAD","MERGE_MODE","MERGE_MSG"].map(t=>{const s=te(this.gitDir,t);return ie(s)?{body:De(s),existed:!0,name:t}:{body:null,existed:!1,name:t}}))}restoreMergeState(){if(!(this.gitDir.length===0||this.merge.length===0))for(const t of this.merge){const s=te(this.gitDir,t.name);try{t.existed&&t.body!==null?_e(s,t.body):ie(s)&&Le(s)}catch{}}}}var qt=Object.defineProperty,W=f((e,t)=>qt(e,"name",{value:t,configurable:!0}),"r");const Ae=W(e=>e.includes("/"),"isPathStyle"),q=W((e,t)=>t?e.toLowerCase():e,"normalizeForMatch"),Ut=W((e,t,s,r={})=>{const n=Ae(e),i=r.caseInsensitive===!0,o=q(e,i),a=[];for(const c of t){const d=n?_(s,c):Te(c);$e(o,q(d,i))&&a.push(c)}return a},"matchFiles"),zt=W((e,t,s,r={})=>{if(!t||t.length===0)return[...e];const n=r.caseInsensitive===!0;return e.filter(i=>{for(const o of t){const a=Ae(o)?_(s,i):Te(i),c=q(o,n);if($e(c,q(a,n)))return!1}return!0})},"applyIgnore");var Vt=Object.defineProperty,L=f((e,t)=>Vt(e,"name",{value:t,configurable:!0}),"g");const Wt=L(e=>{switch(e){case"failed":return"red";case"running":return"cyan";case"skipped":return"yellow";case"success":return"green";default:return"gray"}},"colorForStatus"),ve=L(e=>{if(e==="running")return w.jsx(Ue,{type:"dots"});const t=e==="failed"?xe:e==="skipped"?B:e==="success"?Ce:B;return w.jsx($,{color:Wt(e),children:t})},"iconForStatus"),ye=L(({state:e,tick:t,verbose:s})=>w.jsxs(E,{flexDirection:"column",children:[[...e.patterns.values()].map(r=>w.jsxs(E,{flexDirection:"column",children:[w.jsxs(E,{children:[ve(r.status),w.jsxs($,{children:[" ",r.title]})]}),[...r.commands.values()].map(n=>w.jsxs(E,{flexDirection:"column",marginLeft:2,children:[w.jsxs(E,{children:[ve(n.status),w.jsxs($,{children:[" ",n.title," "]}),n.status!=="pending"&&n.status!=="running"?w.jsxs($,{color:"gray",children:["(",n.durationMs,"ms)"]}):null]}),s&&n.output?w.jsx(E,{flexDirection:"column",marginLeft:2,children:n.output.split(/\r?\n/).slice(0,20).map((i,o)=>w.jsx($,{color:"gray",children:i},`${n.id}-line-${o}`))}):null,n.status==="failed"&&n.error?w.jsx(E,{marginLeft:2,children:w.jsx($,{color:"red",children:n.error.message})}):null]},n.id))]},r.id)),e.infoMessages.map((r,n)=>w.jsx($,{color:"gray",children:r},`info-${n}`)),e.warnMessages.map((r,n)=>w.jsx($,{color:"yellow",children:r},`warn-${n}`)),e.errorMessages.map(({message:r},n)=>w.jsx($,{color:"red",children:r},`err-${n}`))]}),"App"),Kt=L((e={})=>{const t=e.verbose===!0,s={errorMessages:[],infoMessages:[],patterns:new Map,started:!1,warnMessages:[]};let r=0;const n=qe(w.jsx(ye,{state:s,tick:r,verbose:t}),{exitOnCtrlC:!1,stdout:process.stderr}),i=L(()=>{r+=1,n.rerender(w.jsx(ye,{state:s,tick:r,verbose:t}))},"refresh");return{commandEnd({commandId:o,durationMs:a,error:c,output:d,patternId:u,status:l}){const p=s.patterns.get(u)?.commands.get(o);p&&(p.status=l,p.durationMs=a,p.output=d,p.error=c,i())},commandStart({commandId:o,patternId:a}){const c=s.patterns.get(a)?.commands.get(o);c&&(c.status="running",i())},error({error:o,message:a}){s.errorMessages.push({error:o,message:a}),i()},info({message:o}){s.infoMessages.push(o),i()},patternEnd({patternId:o,status:a}){const c=s.patterns.get(o);c&&(c.status=a,i())},patternStart({patternId:o}){const a=s.patterns.get(o);a&&(a.status="running",i())},start({patterns:o}){s.started=!0;for(const a of o){const c=new Map;for(const d of a.commands)c.set(d.id,{durationMs:0,id:d.id,status:"pending",title:d.title});s.patterns.set(a.id,{commands:c,id:a.id,status:"pending",title:a.title})}i()},async stop(){n.unmount(),await n.waitUntilExit()},warn({message:o}){s.warnMessages.push(o),i()}}},"createInkRenderer");var Yt=Object.defineProperty,Z=f((e,t)=>Yt(e,"name",{value:t,configurable:!0}),"a$1");const ke=Z((e={})=>{const{quiet:t=!1,verbose:s=!1}=e,r=new Map,n=new Map,i=Z(a=>{t||process.stderr.write(`${a}
|
|
14
|
+
`)},"print"),o=Z(a=>{switch(a){case"failed":return J(xe);case"running":return Q(">");case"skipped":return oe(B);case"success":return ze(Ce);default:return C(B)}},"iconFor");return{commandEnd({commandId:a,durationMs:c,error:d,output:u,status:l}){const p=n.get(a)??a,v=C(`(${c}ms)`);if(i(` ${o(l)} ${p} ${v}`),l==="failed"&&d&&i(C(d.message)),(l==="failed"||s)&&u&&u.trim().length>0)for(const h of u.split(/\r?\n/))i(` ${C(h)}`)},commandStart({commandId:a}){if(!s)return;const c=n.get(a)??a;i(` ${C("…")} ${c}`)},error({error:a,message:c}){t?process.stderr.write(`${J(c)}
|
|
15
|
+
`):i(J(c)),a?.stack&&(s||!t)&&process.stderr.write(`${C(a.stack)}
|
|
16
|
+
`)},info({message:a}){i(C(a))},patternEnd({patternId:a,status:c}){const d=r.get(a)??a;i(`${o(c)} ${d}`)},patternStart({patternId:a}){const c=r.get(a)??a;i(`${Q(">")} ${c}`)},start({patterns:a}){if(a.length===0){i(C("No staged files matched any pattern."));return}const c=new Set(a.flatMap(d=>d.files)).size;i(`${Q(">")} Running staged tasks on ${c} file${c===1?"":"s"} across ${a.length} pattern${a.length===1?"":"s"}`);for(const d of a){r.set(d.id,d.title);for(const u of d.commands)n.set(u.id,u.title)}},stop(){},warn({message:a}){i(oe(a))}}},"createPlainRenderer");var Qt=Object.defineProperty,Jt=f((e,t)=>Qt(e,"name",{value:t,configurable:!0}),"t");const Xt=Jt(async e=>{const{env:t}=process;if(e.debug===!0||e.quiet===!0||t.NODE_ENV==="test"||t.TERM==="dumb"||t.CI!==void 0||!process.stderr.isTTY)return ke({quiet:e.quiet,verbose:e.verbose});try{return Kt({verbose:e.verbose})}catch{return ke({quiet:e.quiet,verbose:e.verbose})}},"pickRenderer");var Zt=Object.defineProperty,G=f((e,t)=>Zt(e,"name",{value:t,configurable:!0}),"a");const ee=G(e=>typeof e=="object"&&e!==null&&typeof e.title=="string"&&typeof e.task=="function","isCustomTask"),es=G(async e=>{let t=0,s=0;const r=G(()=>(t+=1,`pattern-${t}`),"nextPatternId"),n=G(()=>(s+=1,`cmd-${s}`),"nextCommandId"),i=G(async(a,c,d)=>{if(typeof a=="string"){d.push({command:a,files:c,id:n(),source:"string",title:a});return}if(Array.isArray(a)){for(const u of a)await i(u,c,d);return}if(typeof a=="function"){const u=await a([...c]);if(typeof u=="string"){d.push({command:u,files:c,id:n(),source:"function",title:u});return}if(Array.isArray(u)){for(const l of u)if(typeof l=="string")d.push({command:l,files:c,id:n(),source:"function",title:l});else if(ee(l))d.push({files:c,id:n(),run:l.task,source:"custom",title:l.title});else throw new T("Task function returned an array with an unsupported entry — expected strings or { title, task }.");return}if(ee(u)){d.push({files:c,id:n(),run:u.task,source:"custom",title:u.title});return}throw new T("Task function returned an unsupported value — expected string, string[], or { title, task }.")}if(ee(a)){d.push({files:c,id:n(),run:a.task,source:"custom",title:a.title});return}throw new T("Unsupported task value — expected string, string[], function, or { title, task }.")},"expandTask"),o=[];for(const[a,c]of Object.entries(e.config)){const d=Ut(a,e.files,e.cwd,{caseInsensitive:e.caseInsensitive===!0});if(d.length===0)continue;const u=e.relative?d.map(p=>_(e.cwd,p)):d,l=[];await i(c,u,l),l.length!==0&&o.push({commands:l,files:u,id:r(),pattern:a,title:`${a} — ${d.length} file${d.length===1?"":"s"}`})}return o},"buildTaskGraph");var ts=Object.defineProperty,K=f((e,t)=>ts(e,"name",{value:t,configurable:!0}),"c");const ss=K(e=>{const t=[];let s="",r=!1,n=!1;for(let i=0;i<e.length;i+=1){const o=e[i];if(o===void 0)break;if(o==="\\"&&!r&&i+1<e.length){const a=e[i+1];if(a!==void 0){n&&a!=='"'&&a!=="\\"&&(s+=o),s+=a,i+=1;continue}}if(o==='"'&&!r){n=!n;continue}if(o==="'"&&!n){r=!r;continue}if(!r&&!n&&/\s/.test(o)){s.length>0&&(t.push(s),s="");continue}s+=o}if(r||n)throw new T(`Unterminated ${r?"single":"double"} quote in command: ${e}`);return s.length>0&&t.push(s),t},"parseCommandString"),Pe=process.platform==="win32"?28e3:131072,rs=K((e,t,s)=>{const r=[];let n=[],i=t;const o=s<=0?Pe:s;for(const a of e){const c=Buffer.byteLength(a)+1;n.length>0&&i+c>o&&(r.push(n),n=[],i=t),n.push(a),i+=c}return n.length>0&&r.push(n),r},"chunkFiles"),ns=K(async(e,t,s)=>{const r=ss(e);if(r.length===0)throw new j(e,"Empty command for staged task.");const[n,...i]=r;if(n===void 0)throw new j(e,"Empty command for staged task.");const o=Buffer.byteLength(n)+i.reduce((u,l)=>u+Buffer.byteLength(l)+1,0),a=rs(t,o,s.maxArgLength??Pe),c=Date.now(),d=[];for(const u of a){if(s.signal?.aborted===!0)throw new j(e,"Task aborted by earlier failure.");const l=Se(n,[...i,...u],{nodeOptions:{cwd:s.cwd,env:as(s.env,s.cwd),killSignal:s.killSignal??"SIGTERM",stdio:["ignore","pipe","pipe"]},...s.signal===void 0?{}:{signal:s.signal}}),p=await l,v=[p.stdout,p.stderr].filter(m=>m.length>0).join(`
|
|
17
|
+
`);v.length>0&&d.push(v);const h=l.process?.signalCode??null;if(l.aborted||h!==null||p.exitCode===void 0){const m=l.aborted?"Task aborted by earlier failure.":h===null?v.trim()||"Task exited without a numeric status code.":`Task killed by signal ${h}.`;throw new j(e,m)}if(p.exitCode!==0)throw new j(e,v.trim()||`Exit code ${p.exitCode} from ${n}`)}return{durationMs:Date.now()-c,output:d.join(`
|
|
18
|
+
`)}},"execCommand"),as=K((e,t)=>{const s={...process.env};process.stderr.isTTY&&s.FORCE_COLOR===void 0&&s.NO_COLOR===void 0&&(s.FORCE_COLOR="1");const r=e?{...s,...e}:s;return Ve(r,t)},"buildTaskEnv");var is=Object.defineProperty,M=f((e,t)=>is(e,"name",{value:t,configurable:!0}),"o");const os=M(async(e,t,s)=>{const r=ds(s.concurrent,e.length),n=[],i=new AbortController;let o=!1,a=0;const c=M(()=>{o||(o=!0,s.continueOnError||i.abort())},"cancel");s.externalSignal&&(s.externalSignal.aborted?c():s.externalSignal.addEventListener("abort",()=>{c()},{once:!0}));const d=M(h=>{for(const m of h.commands)t.commandEnd({commandId:m.id,durationMs:0,patternId:h.id,status:"skipped"})},"emitSkippedCommands"),u=M(async h=>{if(o){d(h),t.patternEnd({patternId:h.id,status:"skipped"});return}t.patternStart({patternId:h.id});let m="success";for(const k of h.commands){if(o){t.commandEnd({commandId:k.id,durationMs:0,patternId:h.id,status:"skipped"}),m=m==="success"?"skipped":m;continue}t.commandStart({commandId:k.id,patternId:h.id});const b=await cs(k,s,i.signal),S=b.status==="failed"&&i.signal.aborted?{...b,status:"skipped"}:b;if(t.commandEnd({commandId:k.id,durationMs:S.durationMs,error:S.error,output:S.output,patternId:h.id,status:S.status}),S.status==="failed"){n.push(k.title),m="failed",c();break}if(S.status==="skipped"){m=m==="success"?"skipped":m;break}}t.patternEnd({patternId:h.id,status:m})},"runOne"),l=M(async()=>{for(;a<e.length;){const h=e[a];a+=1,h&&await u(h)}},"pickNext"),p=[];for(let h=0;h<Math.min(r,e.length);h+=1)p.push(l());await Promise.all(p);const v=s.externalSignal?.aborted===!0;return{failedCommands:n,success:n.length===0&&!v}},"runTasks"),cs=M(async(e,t,s)=>{const r=Date.now();try{if(e.source==="custom"&&e.run)return await e.run([...e.files]),{durationMs:Date.now()-r,status:"success"};if(e.command){const n=await ns(e.command,e.files,{cwd:t.cwd,killSignal:t.killSignal,maxArgLength:t.maxArgLength,signal:s});return{durationMs:n.durationMs,output:t.verbose?n.output:void 0,status:"success"}}return{durationMs:Date.now()-r,error:new j(e.title,"Command has no invocation target."),status:"failed"}}catch(n){const i=n instanceof Error?n:new Error(String(n));return{durationMs:Date.now()-r,error:i,output:i instanceof j?i.message:void 0,status:"failed"}}},"runCommand"),ds=M((e,t)=>{if(e===!1)return 1;if(e===!0){const r=Math.max(1,typeof ce=="function"?ce():4);return Math.min(Math.max(1,t),r)}const s=Math.floor(e);return s>0?s:1},"concurrencyLimit");var ls=Object.defineProperty,se=f((e,t)=>ls(e,"name",{value:t,configurable:!0}),"u");const us=!0,fs=se(e=>{try{return!et(e)}catch{return!1}},"detectCaseInsensitive"),hs=se(async(e={})=>{const t=e.cwd??process.cwd(),s=await Xt(e),r=await wt(e);typeof r!="function"&&fe(r);const n=new Bt({...e,cwd:t}),i=new AbortController;let o=!1;const a=se(l=>{if(o){process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a),process.kill(process.pid,l);return}o=!0,s.warn({message:`Received ${l} — cancelling staged tasks and restoring state. Press Ctrl+C again to abort.`}),i.abort()},"onInterrupt");process.on("SIGINT",a),process.on("SIGTERM",a);let c={failedCommands:[],ranTasks:!1,success:!0},d=!1,u=!1;try{await n.prepare(),d=!0;for(const b of n.warnings)s.warn({message:b});if(n.stagedFiles.length===0)return e.allowEmpty!==!0&&s.info({message:"No staged files found."}),u=!0,{failedCommands:[],ranTasks:!1,success:!0};const l=fs(t),p=zt(n.stagedFiles,e.ignore,t,{caseInsensitive:l});if(p.length===0&&n.stagedFiles.length>0)return s.info({message:"Every staged file was excluded by the `ignore` list."}),u=!0,{failedCommands:[],ranTasks:!1,success:!0};const v=typeof r=="function"?fe(await r([...p])):r,h=await es({caseInsensitive:l,config:v,cwd:t,files:p,relative:e.relative});if(s.start({patterns:h}),h.length===0)return s.info({message:"No staged files matched any pattern."}),u=!0,{failedCommands:[],ranTasks:!1,success:!0};const{failedCommands:m,success:k}=await os(h,s,{concurrent:e.concurrent??us,continueOnError:e.continueOnError===!0,cwd:t,externalSignal:i.signal,killSignal:e.killSignal,maxArgLength:e.maxArgLength,verbose:e.verbose});if(c={failedCommands:m,ranTasks:!0,success:k},k){if(e.diff===void 0&&(await n.applyModifications({autoStage:e.autoStage===!0}),e.failOnChanges===!0&&n.indexTreeChanged()&&(s.warn({message:"Tasks modified staged content — failing because --fail-on-changes is set."}),c={failedCommands:[...m],ranTasks:!0,success:!1}),e.allowEmpty!==!0&&n.postTaskIndexMatchesHead()))throw new at("All staged changes were reverted by tasks. Re-stage changes or rerun with --allow-empty.")}else if(e.revert===!0)s.info({message:"Reverting working tree from backup stash."}),await n.revert();else{const b=n.recoveryHint();b&&s.warn({message:b})}return await n.restoreUnstagedChanges(),u=c.success,c}catch(l){const p=l instanceof Error?l.message:String(l),v=l instanceof Error?l:new Error(p);if(s.error({error:v,message:p}),l instanceof O)return{failedCommands:c.failedCommands,ranTasks:c.ranTasks,success:!1};throw l}finally{if(process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a),d)try{await n.cleanup(u)}catch(l){s.error({error:l,message:"Cleanup failed."})}await s.stop()}},"runStaged");var ps=Object.defineProperty,gs=f((e,t)=>ps(e,"name",{value:t,configurable:!0}),"n");const ms="VIS_STAGED_CONCURRENT",be=gs(e=>{const t=e.trim();if(t==="true"||t==="")return!0;if(t==="false")return!1;const s=Number(t);return Number.isNaN(s)?!0:s},"parseConcurrent");var ws=Object.defineProperty,H=f((e,t)=>ws(e,"name",{value:t,configurable:!0}),"d");const vs=H((e,t)=>{const s={};t!==void 0&&(s.config=t);const r=H(y=>e[y]===void 0?void 0:!!e[y],"readBool"),n=H(y=>{const Y=e[y];return typeof Y=="string"&&Y.length>0?Y:void 0},"readString"),i=r("allow-empty");i!==void 0&&(s.allowEmpty=i);const o=r("auto-stage");o!==void 0&&(s.autoStage=o);const a=r("continue-on-error");a!==void 0&&(s.continueOnError=a);const c=r("debug");c!==void 0&&(s.debug=c);const d=r("fail-on-changes");d!==void 0&&(s.failOnChanges=d);const u=r("hide-partially-staged");u!==void 0&&(s.hidePartiallyStaged=u);const l=r("hide-unstaged");l!==void 0&&(s.hideUnstaged=l);const p=r("quiet");p!==void 0&&(s.quiet=p);const v=r("relative");v!==void 0&&(s.relative=v);const h=r("revert");h!==void 0&&(s.revert=h);const m=r("stash");m!==void 0&&(s.stash=m);const k=r("verbose");k!==void 0&&(s.verbose=k);const b=n("cwd");b!==void 0&&(s.cwd=b);const S=n("diff");S!==void 0&&(s.diff=S);const ae=n("diff-filter");if(ae!==void 0&&(s.diffFilter=ae),r("force-kill")===!0&&(s.killSignal="SIGKILL"),e.concurrent===void 0){const y=process.env[ms];y!==void 0&&(s.concurrent=be(y.trim()))}else{const{concurrent:y}=e;s.concurrent=be(typeof y=="string"?y:typeof y=="number"||typeof y=="boolean"?String(y):"")}return s},"buildRunOptions"),js=H(async({options:e,visConfig:t})=>{const s=(t??{}).staged;if(!s)throw new Error(`No "staged" config found in vis.config.ts. Add one:
|
|
19
|
+
|
|
20
|
+
// vis.config.ts
|
|
21
|
+
import { defineConfig } from "@visulima/vis/config";
|
|
22
|
+
|
|
23
|
+
export default defineConfig({
|
|
24
|
+
staged: { '*': 'vis check --fix' },
|
|
25
|
+
});
|
|
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 hs(vs(e,s))).success||(process.exitCode=1)},"execute");export{vs as buildRunOptions,js as default};
|