@visulima/vis 6.4.4 → 6.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/LICENSE.md +0 -51
- package/README.md +27 -25
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/cargo-plan.js +1 -1
- package/dist/packem_chunks/catalog-detector.js +1 -1
- package/dist/packem_chunks/catalog.js +11 -1
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +130 -131
- package/dist/packem_chunks/context.js +4 -4
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +1 -1
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler32.js +1 -1
- package/dist/packem_chunks/handler39.js +5 -5
- package/dist/packem_chunks/handler4.js +1 -1
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler49.js +1 -1
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +1 -1
- package/dist/packem_chunks/handler51.js +1 -1
- package/dist/packem_chunks/handler52.js +1 -1
- package/dist/packem_chunks/handler54.js +1 -1
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler56.js +5 -5
- package/dist/packem_chunks/handler58.js +1 -1
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler60.js +1 -1
- package/dist/packem_chunks/handler61.js +1 -1
- package/dist/packem_chunks/handler62.js +1 -1
- package/dist/packem_chunks/handler63.js +1 -1
- package/dist/packem_chunks/handler64.js +1 -1
- package/dist/packem_chunks/handler65.js +1 -1
- package/dist/packem_chunks/handler66.js +1 -1
- package/dist/packem_chunks/handler67.js +1 -1
- package/dist/packem_chunks/handler68.js +12 -28
- package/dist/packem_chunks/handler69.js +37 -12
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +1 -1
- package/dist/packem_chunks/handler71.js +1 -1
- package/dist/packem_chunks/handler72.js +311 -10
- package/dist/packem_chunks/handler73.js +10 -133
- package/dist/packem_chunks/handler74.js +133 -23
- package/dist/packem_chunks/handler75.js +23 -323
- package/dist/packem_chunks/handler76.js +1 -1
- package/dist/packem_chunks/handler77.js +1 -1
- package/dist/packem_chunks/handler78.js +1 -1
- package/dist/packem_chunks/handler79.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +1 -1
- package/dist/packem_chunks/index3.js +28 -35
- package/dist/packem_chunks/index5.js +140 -801
- package/dist/packem_chunks/index6.js +801 -140
- package/dist/packem_chunks/index7.js +1 -1
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/native-addon.js +12 -0
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/python-plan.js +1 -1
- package/dist/packem_chunks/python-projects.js +1 -1
- package/dist/packem_chunks/python.js +1 -1
- package/dist/packem_chunks/snapshot.js +2 -2
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_chunks/version-resolver.js +1 -1
- package/dist/packem_chunks/workspace.js +1 -1
- package/dist/packem_shared/{ReleaseClient-DaoIXjdn.js → ReleaseClient-CQaGkUHL.js} +1 -1
- package/dist/packem_shared/{advisories-CePsyvwG.js → advisories-DzWrfMwP.js} +1 -1
- package/dist/packem_shared/{affected-selection-CeiYNePc.js → affected-selection-mQmHyn-j.js} +1 -1
- package/dist/packem_shared/{ai-analysis-BA0POlbg.js → ai-analysis-CIN__RZj.js} +1 -1
- package/dist/packem_shared/{ai-cache-DPBsl-hV.js → ai-cache-BgoifbUT.js} +1 -1
- package/dist/packem_shared/{ai-fix-B77m7n2b.js → ai-fix-BG2olCnp.js} +1 -1
- package/dist/packem_shared/apply-BrRx__KL.js +8 -0
- package/dist/packem_shared/apply-release-plan-Cf6TJxK2.js +15 -0
- package/dist/packem_shared/{bin-D3ykhfdS.js → bin-DcZlUzKR.js} +1 -1
- package/dist/packem_shared/{build-scripts-DroekY_B.js → build-scripts-BtdNDGRO.js} +1 -1
- package/dist/packem_shared/createVersionActions-GD1Y4pNe.js +1 -0
- package/dist/packem_shared/{dependency-scan-DRFM_81X.js → dependency-scan-BmnwM6FX.js} +1 -1
- package/dist/packem_shared/{detect-BcgSLkMm.js → detect-DwXq9NzG.js} +1 -1
- package/dist/packem_shared/{docker-BvjXmtDx.js → docker-CN9h1ZAl.js} +1 -1
- package/dist/packem_shared/{ecosystem-gate-cnVeegV2.js → ecosystem-gate-DX0ZULH7.js} +1 -1
- package/dist/packem_shared/{env-Aebh_7xU.js → env-BUf_aJzW.js} +1 -1
- package/dist/packem_shared/{env-consistency-CsRtFVjG.js → env-consistency-B69mYzeD.js} +1 -1
- package/dist/packem_shared/{failure-log-Busa1iE8.js → failure-log-DiIZhhLI.js} +1 -1
- package/dist/packem_shared/glob-Cyk1H9ZL-CoX0RPCo.js +1 -0
- package/dist/packem_shared/{index-CiJWXOfI.js → index-CBn2VY5B.js} +1 -1
- package/dist/packem_shared/{index-BGIPGEa6.js → index-DhxUCW8T.js} +1 -1
- package/dist/packem_shared/junit-audit-CuJShWCH.js +13 -0
- package/dist/packem_shared/{lifecycle-C9PINrzB.js → lifecycle-GbShWxRp.js} +1 -1
- package/dist/packem_shared/{manifests-CGl2k8eD.js → manifests-dmM8N980.js} +1 -1
- package/dist/packem_shared/{min-release-age-Bm6IFgxW.js → min-release-age-PO0aM3R7.js} +1 -1
- package/dist/packem_shared/{missing-package-json-CNN9E7An.js → missing-package-json-BhiqxoDg.js} +1 -1
- package/dist/packem_shared/{multi-eco-lockfiles-DrgeQKa3.js → multi-eco-lockfiles-BK7QtgHY.js} +1 -1
- package/dist/packem_shared/{native-config-sync-CKePir7A.js → native-config-sync-B0GvRp9j.js} +1 -1
- package/dist/packem_shared/{osv-CtKBUlaU.js → osv-J53omdC9.js} +1 -1
- package/dist/packem_shared/{package-version-ChA7gKlB.js → package-version-C6xroAcI.js} +1 -1
- package/dist/packem_shared/{packument-DV0k4rzI.js → packument-DZRLzoJA.js} +1 -1
- package/dist/packem_shared/{project-name-filter-BnHcuGOv.js → project-name-filter-DHT0wEZm.js} +1 -1
- package/dist/packem_shared/{provenance-hAvGHOgZ.js → provenance-Cv6Fj_BX.js} +1 -1
- package/dist/packem_shared/{publish-missing-Df39xUBX.js → publish-missing-CfwPeX1q.js} +1 -1
- package/dist/packem_shared/{registry-D8odQGcR.js → registry-B5KGXKED.js} +1 -1
- package/dist/packem_shared/{registry-keys-BLiJKMuS.js → registry-keys-BXUXfg-B.js} +1 -1
- package/dist/packem_shared/{renderToString-DR0zDUjh-lzGitq_6.js → renderToString-DR0zDUjh-BY4_eILr.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-CODAmTx4.js → resolve-explicit-Sfza3_kc.js} +1 -1
- package/dist/packem_shared/{run-summary-utils-CINjiLBE.js → run-summary-utils-CQjbLnkh.js} +1 -1
- package/dist/packem_shared/{runtime-check-BMDR1_bb.js → runtime-check-BTZdc1k2.js} +1 -1
- package/dist/packem_shared/{s1ngularity-RvRfoneb.js → s1ngularity-BrjAz--X.js} +1 -1
- package/dist/packem_shared/{scaffold-files-BdvNqI-N.js → scaffold-files-B77HPWjE.js} +1 -1
- package/dist/packem_shared/{scan-progress-aGfhWB5U.js → scan-progress-D5c-HQ_W.js} +1 -1
- package/dist/packem_shared/{selectors-CB84rN3y.js → selectors-l6BxIFLB.js} +1 -1
- package/dist/packem_shared/{signatures-yyWil8DY.js → signatures-C4MN75Bv.js} +1 -1
- package/dist/packem_shared/{spinner-DeG1597-.js → spinner-BryD7iJl.js} +1 -1
- package/dist/packem_shared/{table-B80pPNSi.js → table-BzBEMntH.js} +1 -1
- package/dist/packem_shared/{tabs-BAZbyp4k.js → tabs-DL_c_u-P.js} +1 -1
- package/dist/packem_shared/{toolchain-BPOxrpDU.js → toolchain-CbsBoqgN.js} +1 -1
- package/dist/packem_shared/{typosquats-Ch-a1qTB.js → typosquats-DRl1AA90.js} +1 -1
- package/dist/packem_shared/{use-measured-height-DVKGDAAE.js → use-measured-height-DobMKRXG.js} +1 -1
- package/dist/packem_shared/{vis-update-app-u5igJf_k.js → vis-update-app-CyCv-5iU.js} +1 -1
- package/dist/packem_shared/{vis-user-error-cD2VO4b_.js → vis-user-error-DjdeJsEK.js} +1 -1
- package/dist/packem_shared/{watch-loop-dAIFTLTH.js → watch-loop-D2QKvSts.js} +1 -1
- package/dist/release/index.js +1 -1
- package/index.js +26 -26
- package/package.json +10 -10
- package/dist/packem_chunks/cargo-lock.js +0 -5
- package/dist/packem_chunks/catalog2.js +0 -11
- package/dist/packem_shared/apply-DA-Dv8Pq.js +0 -8
- package/dist/packem_shared/apply-release-plan-BZ_E8GXQ.js +0 -15
- package/dist/packem_shared/clean-package-json-rutwkKl-.js +0 -1
- package/dist/packem_shared/createVersionActions-DXo4z8VN.js +0 -1
- package/dist/packem_shared/glob-Cyk1H9ZL-z7dfCruF.js +0 -1
|
@@ -1,12 +1,37 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
`),
|
|
3
|
-
`),
|
|
4
|
-
|
|
5
|
-
`)}
|
|
6
|
-
`)},
|
|
7
|
-
`)
|
|
8
|
-
`)
|
|
9
|
-
`)
|
|
10
|
-
`);return}
|
|
11
|
-
`)
|
|
12
|
-
`)
|
|
1
|
+
import{createRequire as ye}from"node:module";import{b as C,F as g,X as xe,J as ce,q as ke}from"../packem_shared/index.server-Ca_EEVfw.js";import{m as Ie,v as F,U as k,a as _,e as U,z as Re}from"../packem_shared/index-0dnGN3GP.js";import{wholeMatchFingerprint as Ce,fingerprint as V,baselineKeys as J,legacyFingerprint as Fe,GIT_CONFIG_OVERRIDES as Te,DIFF_HARDENING_FLAGS as je,gitleaksIgnoreFingerprint as q,toSarifUri as Ee,CONFIDENCE_LEVELS as Y,DEFAULT_MAX_FILE_SIZE as Ae,MAX_ARCHIVE_DEPTH as De,listRules as le,listRequiredValidators as Ne,scan as Me,scanGitHistoryDetailed as Le,scanDetailed as _e,scanGitStaged as Be,scanFilesDetailed as Ue,inspectRuleset as Oe}from"@visulima/secret-scanner";import{V as p}from"../packem_shared/vis-user-error-DjdeJsEK.js";import{_ as qe,$ as X,p as j}from"./cli-main.js";import{E as Pe,A as Ge}from"../packem_shared/getRandomSpinner-DX11qCB2-CoIsn7ZU.js";import{y as H}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{p as Ye}from"../packem_shared/package-version-C6xroAcI.js";import{e as B,c as Qe}from"../packem_shared/junit-audit-CuJShWCH.js";let be;const Se=e=>(be??=ye(import.meta.url))(e),A=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,L=e=>{if(typeof A<"u"&&A.versions&&A.versions.node){const[t,s]=A.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return A.getBuiltinModule(e)}return Se(e)},{createRequire:Ve}=L("node:module"),{mkdirSync:He,writeFileSync:Z,openSync:ze,fchmodSync:Ke,closeSync:We,realpathSync:Je}=L("node:fs"),{execFileSync:Xe}=L("node:child_process"),{createHash:Ze}=L("node:crypto"),{pathToFileURL:de}=L("node:url");let et;const tt=e=>(et??=Ve(import.meta.url))(e),D=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,st=e=>{if(typeof D<"u"&&D.versions&&D.versions.node){const[t,s]=D.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return D.getBuiltinModule(e)}return tt(e)},{styleText:it}=st("node:util"),rt={error:"✖",info:"ℹ",success:"✓",warning:"⚠"},nt=()=>{const{env:e}=process;return!!e.CI||e.CONTINUOUS_INTEGRATION==="true"||"BUILD_NUMBER"in e||"RUN_ID"in e},ot=/\u001B\[[\d;]*[a-z]/gi,at=e=>[...e.replaceAll(ot,"")].length,ct=e=>{const t=[];return e.bold&&t.push("bold"),e.dim&&t.push("dim"),e.italic&&t.push("italic"),e.underline&&t.push("underline"),e.strikethrough&&t.push("strikethrough"),e.color&&t.push(e.color),e.bgColor&&t.push(e.bgColor),t.length===0?s=>s:s=>it(t,s)};class lt{#n=0;#l;#e=!1;#r="";#o="";#g=0;#d=0;#t;#s;#u="";#a;#m;#i;#y;#h=0;#c;#b;constructor(t={},s){if(t.frames)this.#a=t.frames;else{const i=t.name??"dots",n=Ge(i);if(!n)throw new Error(`Unknown spinner "${i}". Pass a custom \`frames\` set or use one of: ${Pe().join(", ")}.`);this.#a=n}this.#m=t.verbose!==!1,this.#r=t.prefixText??"",this.#t=s,this.#i=t.stream??process.stderr,this.#y=s?!0:this.#i.isTTY&&!nt(),this.#b={...rt,...t.icons},typeof t.style=="function"?this.#c=t.style:t.style&&(this.#c=ct(t.style))}get elapsedTime(){return this.#g===0?0:(this.#d||Date.now())-this.#g}get text(){return this.#o}set text(t){this.#o=t,this.#e&&this.#w()}get prefixText(){return this.#r}set prefixText(t){this.#r=t,this.#e&&this.#w()}get isRunning(){return this.#e}setInteractiveManager(t){this.#t=t}setMultiSpinner(t){this.#s=t}tick(){this.#e&&(this.#n=(this.#n+1)%this.#a.frames.length)}start(t,s){return this.#e?this:this.#m?(this.#e=!0,this.#g=Date.now(),this.#d=0,this.#n=0,this.#u="",t&&(this.#o=t),s?.prefixText&&(this.#r=s.prefixText),this.#s?(this.#s.renderAll(),this):(this.#t?(this.#t.hook(),this.#S(),this.#$()):(this.#x(),this.#$()),this)):this}stop(){if(this.#e){if(this.#p(),this.#e=!1,this.#d=Date.now(),this.#u="",this.#s){this.#s.renderAll();return}this.#t?(this.#t.erase("stdout"),this.#t.unhook(!1)):this.#v()}}stopAndPersist(t){if(!this.#e||(this.#p(),this.#e=!1,this.#d=Date.now(),!this.#m))return;const s=t?.prefixText??this.#r,i=t?.text??this.#o;let n=t?.symbol??"";s&&(n=n?`${s} ${n}`:s),i&&(n=n?`${n} ${i}`:i),this.#k(n)}succeed(t){this.#f("success",t)}failed(t){this.#f("error",t)}warn(t){this.#f("warning",t)}info(t){this.#f("info",t)}pause(){this.#p()}resume(){this.#e&&(this.#p(),this.#s||this.#$())}getFrameOutput(){if(!this.#e&&this.#u)return this.#u;const t=this.#a.frames[this.#n];let s=this.#c?this.#c(t):t;return this.#r&&(s=`${this.#r} ${s}`),this.#o&&(s=`${s} ${this.#o}`),s}#$(){this.#y&&(this.#l=setInterval(()=>{this.#e&&(this.#n=(this.#n+1)%this.#a.frames.length,this.#w())},this.#a.interval),this.#l.unref())}#p(){this.#l&&(clearInterval(this.#l),this.#l=void 0)}#w(){this.#s?this.#s.renderAll():this.#t?this.#S():this.#x()}#S(){this.#t&&this.#t.update("stdout",[this.getFrameOutput()])}#x(){const t=this.getFrameOutput();if(this.#v(),this.#i.isTTY){this.#i.write(t);const s=this.#i.columns||80;this.#h=Math.max(1,Math.ceil(at(t)/s))}else this.#i.write(`${t}
|
|
2
|
+
`),this.#h=0}#v(){if(this.#h>0&&this.#i.isTTY){for(let t=1;t<this.#h;t+=1)this.#i.write("\x1B[1A\x1B[2K");this.#i.write("\r\x1B[K")}this.#h=0}#k(t){this.#u=t,this.#s?this.#s.renderAll():this.#t?(this.#t.update("stdout",[t]),this.#t.unhook(!1)):(this.#v(),this.#i.write(`${t}
|
|
3
|
+
`))}#f(t,s){if(!this.#e||(this.#p(),this.#e=!1,this.#d=Date.now(),!this.#m))return;let i="";const n=this.#b[t];n&&(i=this.#c?this.#c(n):n),this.#r&&(i=`${this.#r} ${i}`),s&&(i=`${i} ${s}`),this.#k(i)}}const ue=(e={})=>{const t=new qe(new X(process.stdout),new X(process.stderr));return new lt(e,t)},Q=384,he=(e,t,s)=>{if(He(Ie(e),{recursive:!0}),!s){Z(e,t);return}const i=ze(e,"w",Q);try{Ke(i,Q),Z(i,t)}finally{We(i)}},dt=(e,t)=>{if(!F(e))return e;const s=_(t,e);return s===""||s.startsWith("..")?e:s},P=e=>{try{return Je(e)}catch{return e}},pe=(e,t)=>{const s=_(e,t);return s===""||s.startsWith("..")||F(s)?t:s},E=(e,t)=>{const s=dt(e.file,t);return s===e.file?e:{...e,file:s}},z=e=>{if(!H(e))return[];try{const t=Ye(e);return Array.isArray(t)?t:[]}catch{return[]}},ee=(e,t,s)=>{const i=F(e.file)?e.file:k(t,e.file),n=pe(P(s),i);return n===e.file?e:{...e,file:n}},ut=(e,t,s)=>{const i=P(t),n=P(s);return z(e).flatMap(r=>{const a=pe(n,F(r.file)?r.file:k(i,r.file));return a===r.file?[r]:[r,{...r,file:a}]})},te=e=>[V({...e,secret:typeof e.secret=="string"?e.secret:""}),Fe(e)],ht=(e,t,s)=>{const i=z(t).map(o=>E(o,s)),n=new Set(i.flatMap(o=>te(o))),r=e.map(o=>E(o,s)),a=new Set(r.flatMap(o=>J(o))),l=o=>J(o).some(c=>n.has(c));return{fresh:r.filter(o=>!l(o)),resolved:i.filter(o=>!te(o).some(c=>a.has(c))),surviving:r.filter(o=>l(o))}},me=(e,t,s,i={})=>{const n=e.map(a=>E(a,s));let r;if(i.replace)r=n;else{const a=new Set(n.filter(c=>c.secret!==c.match).map(c=>Ce(c))),l=z(t).map(c=>E(c,s)).filter(c=>!a.has(V(c))),o=new Set;r=[];for(const c of[...l,...n]){const u=V(c);o.has(u)||(o.add(u),r.push(c))}}return he(t,`${JSON.stringify(r,null,4)}
|
|
4
|
+
`,i.sensitive??!0),r.length},G=(e,t)=>{try{return Xe("git",[...Te,...t],{cwd:e,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}catch{return""}},pt=e=>e.split("\0").filter(Boolean),se=(e,t)=>{if(t.startsWith("-"))throw new p(`--since "${t}" looks like a flag, not a git ref.`);const s=k(e,G(e,["rev-parse","--show-cdup"]).trim()),i=r=>pt(G(e,["diff","-z","--name-only","--diff-filter=ACMR",...je,r,"--"]));let n=i(`${t}...HEAD`);return n.length===0&&(n=i(t)),n.map(r=>F(r)?r:U(s,r))},ie=e=>G(e,["rev-parse","--show-toplevel"]).trim().length>0,mt=/^[\t\r+=@-]/,y=e=>{const t=mt.test(e)?`'${e}`:e;return/[\n\r",]/.test(t)?`"${t.replaceAll('"','""')}"`:t},ft=["RuleID","Commit","File","Secret","Match","StartLine","EndLine","StartColumn","EndColumn","Author","Message","Date","Email","Fingerprint","Tags"],gt=e=>{const t=e.map(s=>[y(s.ruleId),y(s.commit?.sha??""),y(s.file),y(s.secret),y(s.match),String(s.startLine),String(s.endLine),String(s.startColumn),String(s.endColumn),y(s.commit?.authorName??""),y(s.commit?.message??""),y(s.commit?.date??""),y(s.commit?.authorEmail??""),y(q(s)),y(s.tags.join(" "))].join(","));return`${[ft.join(","),...t].join(`\r
|
|
5
|
+
`)}\r
|
|
6
|
+
`},$t=e=>{const t=[...e];return t.length<=6?"******":`${t.slice(0,3).join("")}${"*".repeat(t.length-6)}${t.slice(-3).join("")}`},wt=(e,t={})=>{const s=(t.now??new Date).toISOString().replace(/\.\d{3}Z$/,""),i=String(e.length),n=e.map(r=>{const a=`${r.file}:${String(r.startLine)}:${String(r.startColumn)}`,l=[`Rule: ${r.ruleId}`,`File: ${a}`,...r.commit===void 0?[]:[`Commit: ${r.commit.sha}`,`Author: ${r.commit.authorName} <${r.commit.authorEmail}>`],`Secret: ${$t(r.secret)}`,`Fingerprint: ${q(r)}`].join(`
|
|
7
|
+
`),o=`<failure type="${B(r.ruleId)}" message="${B(r.description||r.ruleId)}">${Qe(l)}</failure>`;return[` <testcase classname="${B(r.file)}" name="${B(`${r.ruleId} at ${a}`)}">`,` ${o}`," </testcase>",""].join(`
|
|
8
|
+
`)}).join("");return['<?xml version="1.0" encoding="UTF-8"?>',`<testsuites name="vis-secrets" tests="${i}" failures="${i}" skipped="0" errors="0" time="0">`,` <testsuite name="secrets" tests="${i}" failures="${i}" skipped="0" errors="0" timestamp="${s}" time="0">`,`${n} </testsuite>`,"</testsuites>",""].join(`
|
|
9
|
+
`)},vt=e=>{const t=e.map(s=>({categories:["Security"],check_name:s.ruleId,description:`${s.ruleId}: ${s.description||"Potential secret"}`,engine_name:"vis-secrets",fingerprint:Ze("sha256").update(`${q(s)}\0${String(s.startColumn)}\0${String(s.endLine)}\0${String(s.endColumn)}`).digest("hex"),location:{lines:{begin:s.startLine,end:s.endLine},path:s.file},severity:"critical",type:"issue"}));return`${JSON.stringify(t,void 0,2)}
|
|
10
|
+
`},re=1,yt=e=>{const t=new Map;for(const s of e){const i=t.get(s.file);i?i.push(s):t.set(s.file,[s])}return t},bt=e=>{try{return Re(e).split(/\r?\n/)}catch{return}},St=(e,t,s)=>{const i=Math.max(1,t);return`${e.slice(0,i-1).replaceAll(/[^\t]/g," ")}${"^".repeat(Math.max(1,s))}`},N=e=>e,fe=e=>e?{cyan:ke,dim:g,green:ce,red:xe,yellow:C}:{cyan:N,dim:N,green:N,red:N,yellow:N},xt=(e,t,s,i={})=>{if(e.length===0)return s?g("No secrets detected."):"No secrets detected.";const n=fe(s),r=[],a=yt(e);for(const[l,o]of a){const c=_(t,l)||l;r.push(n.cyan(c));const u=i.redact?void 0:bt(l);for(const d of o){const $=[d.source,d.confidence].filter(Boolean).join(", "),b=$?` ${n.dim(`(${$})`)}`:"",w=d.alternateMatches&&d.alternateMatches.length>0?` ${n.dim(`also: ${d.alternateMatches.join(", ")}`)}`:"";let f="";switch(d.validation){case"error":{f=` ${n.yellow("! error")}`;break}case"rejected":{f=` ${n.red("✗ rejected")}`;break}case"skipped":{f=` ${n.dim("— unverifiable")}`;break}case"verified":{f=` ${n.green("✓ verified")}`;break}}if(r.push(` ${n.red("✖")} ${n.yellow(`[${d.ruleId}]`)}${b}${f} ${n.dim(`line ${String(d.startLine)}:${String(d.startColumn)}`)}${w}`),u){const m=Math.max(0,d.startLine-1-re),v=Math.min(u.length,d.startLine+re);for(let h=m;h<v;h+=1){const T=String(h+1).padStart(4," "),S=h+1===d.startLine,R=S?n.red("▶"):" ";if(r.push(` ${R} ${n.dim(T)} │ ${u[h]??""}`),S){const I=Math.max(1,(d.endColumn??d.startColumn+1)-d.startColumn),ve=St(u[h]??"",d.startColumn,I);r.push(` ${n.dim(" │ ")}${n.red(ve)}`)}}}r.push("")}}return r.join(`
|
|
11
|
+
`).trimEnd()},kt=(e,t,s={})=>{if(e.length===0)return t?g("No secrets detected in git history."):"No secrets detected in git history.";const i=fe(t),n=new Map;for(const a of e){const l=n.get(a.commit.sha);l?l.push(a):n.set(a.commit.sha,[a])}const r=[];for(const[a,l]of n){const{authorName:o,date:c,message:u}=l[0].commit;r.push(`${i.yellow(a.slice(0,10))} ${u}`),r.push(` ${i.dim(`${o} · ${c}`)}`);for(const d of l){const $=[d.source,d.confidence].filter(Boolean).join(", "),b=$?` ${i.dim(`(${$})`)}`:"",w=s.redact?"":` ${i.dim(d.match)}`;r.push(` ${i.red("✖")} ${i.yellow(`[${d.ruleId}]`)}${b} ${i.cyan(d.file)} ${i.dim(`line ${String(d.startLine)}:${String(d.startColumn)}`)}${w}`)}r.push("")}return r.join(`
|
|
12
|
+
`).trimEnd()},It=(e,t,s,i={})=>{const n=new Map;for(const o of e)n.set(o.reason,(n.get(o.reason)??0)+1);const r=[...n].map(([o,c])=>`${o}: ${String(c)}`).join(", "),a=`${String(e.length)} ${t}(s) not scanned (${r})${i.verbose?"":"; use --verbose to list them"}`,l=[s?C(a):a];if(i.verbose)for(const o of e){const c="sha"in o?` ${o.commit===void 0?"":`${o.commit.slice(0,10)} `}${o.sha.slice(0,10)}`:"",u=` - ${o.path} [${o.reason}]${c}`;l.push(s?g(u):u)}return l.join(`
|
|
13
|
+
`)},Rt=(e,t)=>{if(!F(e))return Ee(e);try{return de(e).toString()}catch{return`file://${k(t,e).replaceAll("\\","/")}`}},Ct=(e,t=100)=>e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`,Ft=(e,t,s=process.cwd(),i=[])=>{const n=new Map(i.map(o=>[o.id,o])),r=new Set;for(const o of e)r.add(o.ruleId);const a=[...new Set([...n.keys(),...r])].sort((o,c)=>o.localeCompare(c)),l=new Map(a.map((o,c)=>[o,c]));return JSON.stringify({$schema:"https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0.json",runs:[{originalUriBaseIds:{SRCROOT:{uri:de(s).toString()}},results:e.map(o=>{const c={};return o.source&&(c.source=o.source),o.confidence&&(c.confidence=o.confidence),o.alternateMatches&&o.alternateMatches.length>0&&(c.alternateRules=o.alternateMatches),o.validation&&(c.validation=o.validation),{level:"error",locations:[{physicalLocation:{artifactLocation:{uri:Rt(o.file,s),uriBaseId:F(o.file)?void 0:"SRCROOT"},region:{endColumn:o.endColumn,endLine:o.endLine,snippet:{text:o.match},startColumn:o.startColumn,startLine:o.startLine}}}],message:{text:o.description||o.ruleId},properties:Object.keys(c).length>0?c:void 0,ruleId:o.ruleId,ruleIndex:l.get(o.ruleId)??-1}}),tool:{driver:{informationUri:"https://visulima.com/packages/secret-scanner",name:"visulima-secret-scanner",rules:a.map(o=>{const c=n.get(o),u=c?.description??`Detected by rule \`${o}\``,d={};return c?.tags&&c.tags.length>0&&(d.tags=c.tags),c?.source&&(d.source=c.source),c?.confidence&&(d.confidence=c.confidence),{defaultConfiguration:{level:"error"},fullDescription:{text:u},helpUri:"https://visulima.com/packages/secret-scanner",id:o,name:o,properties:Object.keys(d).length>0?d:void 0,shortDescription:{text:Ct(u)}}}),version:t}}}],version:"2.1.0"},void 0,2)},K=["text","json","sarif","csv","junit","gitlab-code-quality"],ge=e=>K.includes(e),Tt=e=>{const t=[],s=new Set;for(const i of e){const n=i.indexOf("="),r=n===-1?i:i.slice(0,n),a=n===-1?"":i.slice(n+1);if(!ge(r))throw new p(`--report "${i}": format must be one of ${K.join(", ")}, as <format>=<path> (e.g. sarif=secrets.sarif)`);if(a==="")throw new p(`--report "${i}" needs a file path: ${r}=<path>`);if(s.has(a))throw new p(`--report writes ${a} twice; give each report its own file.`);s.add(a),t.push({format:r,path:a})}return t},ne=(e,t,s)=>{const i=()=>t.map(n=>E(n,s.root));switch(e){case"csv":return gt(i());case"gitlab-code-quality":return vt(i());case"json":return`${JSON.stringify(i(),null,2)}
|
|
14
|
+
`;case"junit":return wt(i());case"sarif":return`${Ft(t,s.toolVersion,s.root,s.ruleMetadata)}
|
|
15
|
+
`;default:return`${s.history?kt(t,s.useColor,{redact:s.redact}):xt(t,s.root,s.useColor,{redact:s.redact})}
|
|
16
|
+
`}},jt=e=>e.kind==="secret"?"<secret-value entry>":e.raw,Et=(e,t,s)=>{const i=`${String(e.length)} unused ${t} entr${e.length===1?"y":"ies"} (no finding matched; remove or update them):`,n=[s?C(i):i];for(const r of e){const a=` - line ${String(r.line)}: ${jt(r)}`;n.push(s?g(a):a)}return n.join(`
|
|
17
|
+
`)},At=(e,t,s)=>{const i=`${String(e.length)} finding(s) suppressed:`,n=[s?C(i):i];for(const r of e){const a=E(r,t),l=r.suppressedByEntry===void 0?"":` line ${String(r.suppressedByEntry.line)}`,o=`${r.suppressedBy}${l}`,c=` - [${r.ruleId}] ${q({...a,commit:r.commit})} (${o})`;n.push(s?g(c):c)}return n.join(`
|
|
18
|
+
`)},Dt=async(e,t)=>{try{return await e.access(t),!0}catch{return!1}},O=e=>e?Array.isArray(e)?e:[e]:[],Nt=e=>{if(e===void 0)return"text";if(!ge(e))throw new p(`--format must be one of: ${K.join(", ")} (got "${e}")`);return e},oe=(e,t,s)=>{if(e!==void 0){if(!Number.isInteger(e)||e<0||s!==void 0&&e>s){const i=s===void 0?"a non-negative integer":`an integer from 0 to ${String(s)}`;throw new p(`${t} must be ${i} (got ${String(e)}).`)}return e}},Mt=e=>{if(e!==void 0&&(!Number.isInteger(e)||e<1))throw new p(`--max-size must be a positive number of bytes (got ${String(e)}; default ${String(Ae)}).`);return e},Lt=e=>{if(e!==void 0){if(!Y.includes(e))throw new p(`--min-confidence must be one of: ${Y.join(", ")} (got "${e}")`);return e}},_t=(e,t,s)=>{const i=t??{},n=h=>h?k(s,h):void 0,r=(h,T)=>{const S=O(h);return S.length>0?S:T},a=(i.config?.presets??[]).map(h=>`tag:preset:${h}`),l=r(e.enableRule,i.rules?.enable)??[],o=[...l,...a.filter(h=>!l.includes(h))],c=o.length>0?o:void 0,u=r(e.excludeRule,i.rules?.exclude),d=r(e.includeRule,i.rules?.include),$=r(e.exclude,i.walk?.excludePatterns),b=O(e.excludeFrom).map(h=>k(s,h)),w=b.length>0?b:i.walk?.excludeFromFiles?.map(h=>k(s,h)),f=n(e.baseline)??n(i.baseline),m=n(e.config)??n(i.config?.path),v=Lt(e.minConfidence??i.config?.minConfidence);return{baseline:f,concurrency:e.concurrency,config:{extendBundled:e.extendBundled===!1?!1:i.config?.extendBundled,inline:i.config?.inline,minConfidence:v,onlyVerified:e.onlyVerified??i.config?.onlyVerified??!1,path:m,validate:e.validate??i.config?.validate??!1},inlineAllow:e.inlineAllow,maxArchiveDepth:oe(e.maxArchiveDepth,"--max-archive-depth",De),maxDecodeDepth:oe(e.maxDecodeDepth,"--max-decode-depth"),redact:e.redact??i.redact,reportSuppressed:e.logIgnored===!0,rules:{enable:c,exclude:u,include:d},verbose:e.verbose??!1,walk:{excludeFromFiles:w,excludePatterns:$,gitignore:e.gitignore===!1?!1:i.walk?.gitignore??!0,includeHidden:e.includeHidden??i.walk?.includeHidden,maxFileSize:Mt(e.maxSize)??i.walk?.maxFileSize}}},$e=e=>[e.history?"--history":void 0,e.staged?"--staged":void 0,e.since===void 0?void 0:"--since",e.affected?"--affected":void 0].filter(t=>t!==void 0),ae=(e,t)=>[e.listRules?"--list-rules":void 0,e.listValidators?"--list-validators":void 0,e.init?"--init":void 0,t&&e.updateBaseline?"--update-baseline":void 0].find(s=>s!==void 0),Bt=e=>{const t=$e(e);if(t.length>1)throw new p(`${t.join(", ")} each pick what to scan and can't be combined. Use one of them.`);if(!e.history){const s=[e.all?"--all":void 0,e.historyRange===void 0?void 0:"--history-range",e.maxCommits===void 0?void 0:"--max-commits"].filter(i=>i!==void 0);if(s.length>0)throw new p(`${s.join(", ")} only applies to git history scans. Did you mean \`vis secrets --history ${s.join(" ")}\`?`);return}if(e.all&&e.historyRange!==void 0)throw new p("--all walks every ref and can't be combined with --history-range. Use one or the other.");if(e.updateBaseline)throw new p("--update-baseline records working-tree findings and can't be combined with --history.");if(e.maxCommits!==void 0&&(!Number.isInteger(e.maxCommits)||e.maxCommits<1))throw new p(`--max-commits must be a positive integer (got ${String(e.maxCommits)}); omit it to walk every commit.`)},Ut=e=>{const t=e.history?"--history":e.staged?"--staged":void 0;if(e.maxArchiveDepth!==void 0&&t!==void 0)throw new p(`--max-archive-depth only applies to working-tree scans; ${t} scans git blobs as text and doesn't open archives. Drop --max-archive-depth or ${t}.`)},we=(e,t)=>[e.staged?"--staged":void 0,e.since===void 0?void 0:"--since",e.affected?"--affected":void 0,e.historyRange===void 0?void 0:"--history-range",e.maxCommits===void 0?void 0:"--max-commits",t?"explicit paths":void 0].filter(s=>s!==void 0),Ot=(e,t)=>{const s=ae(e,!0),i=[O(e.report).length>0?"--report":void 0,e.logIgnored?"--log-ignored":void 0,e.failOnUnreadable?"--fail-on-unreadable":void 0,e.failOnUnusedIgnores?"--fail-on-unused-ignores":void 0].filter(l=>l!==void 0);if(s!==void 0&&i.length>0)throw new p(`${i.join(", ")} only applies to a scan report and can't be combined with ${s}.`);const n=ae(e,!1),r=[...$e(e),...t?["explicit paths"]:[]];if(n!==void 0&&r.length>0)throw new p(`${r.join(", ")} picks what to scan and can't be combined with ${n}.`);if(!e.failOnUnusedIgnores)return;if(e.gitleaksIgnore===!1)throw new p("--fail-on-unused-ignores checks .gitleaksignore, which --no-gitleaks-ignore turns off. Drop one of them.");const a=we(e,t);if(a.length>0)throw new p(`--fail-on-unused-ignores needs a full scan: with ${a.join(", ")}, entries for files outside the scan would be reported as unused. Run it on a full \`vis secrets\` or \`vis secrets --history\` scan.`)},W=".gitleaksignore",x=j.child({stdout:process.stderr}),qt=(e,t)=>{const{flags:s,root:i,useColor:n}=t;s.quiet||(e.skipped.length>0&&process.stderr.write(`${It(e.skipped,e.skippedUnit,n,{verbose:s.verbose})}
|
|
19
|
+
`),t.fullScan&&e.unusedIgnores.length>0&&process.stderr.write(`${Et(e.unusedIgnores,W,n)}
|
|
20
|
+
`)),s.logIgnored&&process.stderr.write(`${At(e.suppressed,i,n)}
|
|
21
|
+
`)},Vt=e=>{process.stderr.write(`${g("baseline diff: ")}${ce(`+${String(e.fresh.length)} new`)} · ${C(`${String(e.surviving.length)} unchanged`)} · ${g(`-${String(e.resolved.length)} resolved`)}
|
|
22
|
+
`)},Pt=async(e,t)=>{const{flags:s,format:i,history:n,reports:r,root:a,scanOptions:l,toolbox:o,toolVersion:c,useColor:u}=t,d=l.redact===!0,b=i==="sarif"||r.some(m=>m.format==="sarif")?await le(l).catch(()=>[]):[],w={history:n,redact:d,root:a,ruleMetadata:b,toolVersion:c},f=!d||n;process.stdout.write(ne(i,e.findings,{...w,useColor:u}));for(const m of r){const v=k(o.process.cwd,m.path);he(v,ne(m.format,e.findings,{...w,useColor:!1}),f),s.quiet||x.info(`Wrote ${m.format} report to ${_(o.process.cwd,v)||v}`)}},Gt=(e,t)=>{if(t.failOnUnreadable){const s=e.skipped.filter(i=>i.reason!=="too-large"&&i.reason!=="binary").length;s>0&&(x.error(`${String(s)} ${e.skippedUnit}(s) could not be read; the scan is incomplete (--fail-on-unreadable).`),process.exitCode=1)}t.failOnUnusedIgnores&&e.unusedIgnores.length>0&&(x.error(`${String(e.unusedIgnores.length)} unused ${W} entr${e.unusedIgnores.length===1?"y":"ies"} (--fail-on-unused-ignores).`),process.exitCode=1)},M=".secrets-baseline.json",Ht=async(e,t)=>{const s=await le(e);process.stdout.write(`${String(s.length)} rules loaded
|
|
23
|
+
|
|
24
|
+
`);for(const i of s){const n=t?C(i.id):i.id,r=i.tags.length>0?` ${t?g(`[${i.tags.join(", ")}]`):`[${i.tags.join(", ")}]`}`:"";if(process.stdout.write(`${n}${r}
|
|
25
|
+
${i.description}
|
|
26
|
+
`),i.keywords.length>0){const a=`keywords: ${i.keywords.slice(0,6).join(", ")}${i.keywords.length>6?", ...":""}`;process.stdout.write(` ${t?g(a):a}
|
|
27
|
+
`)}process.stdout.write(`
|
|
28
|
+
`)}},zt=async(e,t)=>{const s=await Ne(e);if(s.length===0){process.stdout.write(t?`${g("No non-HTTP validators required by the current ruleset.")}
|
|
29
|
+
`:`No non-HTTP validators required by the current ruleset.
|
|
30
|
+
`);return}process.stdout.write(`${String(s.length)} non-HTTP validator type(s) referenced by the current ruleset:
|
|
31
|
+
|
|
32
|
+
`);for(const i of s){const n=t?C(i.displayName):i.displayName,r=`(${i.type}, ${String(i.ruleCount)} rule${i.ruleCount===1?"":"s"})`;process.stdout.write(`${n} ${t?g(r):r}
|
|
33
|
+
`),process.stdout.write(` ${i.summary}
|
|
34
|
+
`);const a=i.packageName?`install: npm add ${i.packageName}`:"no driver — bespoke implementation required";process.stdout.write(` ${t?g(a):a}
|
|
35
|
+
|
|
36
|
+
`)}},Kt=async(e,t,s)=>{const i=U(e,M);if(!s&&H(i)){j.warn(`Detected existing ${M} — refusing to overwrite. Delete it first to re-init.`),process.exitCode=1;return}j.info(s?"[dry-run] Previewing init — no files will be written.":"Scanning workspace to seed baseline…");const n=ue();n.start("scanning");let r;try{r=await Me([e],t),n.succeed()}catch(l){throw n.failed(),l}if(s){j.info(`[dry-run] Would create ${M} with ${String(r.length)} finding(s).`);return}const a=me(r,i,e,{replace:!0,sensitive:t.redact!==!0});j.success(`Wrote ${M} (${String(a)} findings).`),j.notice("Commit it. Use `vis secrets --baseline .secrets-baseline.json` in CI. Add path patterns to .gitignore to exclude directories from scanning.")},Wt=(e,t,s)=>{const i=t.length>0?t.map(r=>k(s,r)):[s],n=e.history?"--history":e.staged?"--staged":e.since===void 0?void 0:"--since";if(n!==void 0&&!ie(s))throw new p(`${n} requires a git working tree, and none was detected.`);return e.history?{kind:"history"}:e.staged?{kind:"staged"}:e.since!==void 0?{files:se(s,e.since),kind:"files"}:e.affected?ie(s)?{files:se(s,process.env.VIS_BASE??"HEAD~1"),kind:"files"}:(x.warn("--affected requires git; falling back to full scan"),{kind:"paths",paths:i}):{kind:"paths",paths:i}},Jt=async(e,t,s,i)=>{if(e.kind==="history")return{...await Le({...s,all:t.all,cwd:i,maxCommits:t.maxCommits,range:t.historyRange}),skippedUnit:"blob"};if(e.kind==="paths")return{...await _e(e.paths,s),skippedUnit:"file"};const n=process.cwd(),r={...s,baseline:typeof s.baseline=="string"?ut(s.baseline,i,n):s.baseline},a=e.kind==="staged"?await Be({...r,cwd:i}):await Ue(e.files,r);return{findings:a.findings.map(l=>ee(l,n,i)),skipped:a.skipped,skippedUnit:e.kind==="staged"?"blob":"file",suppressed:a.suppressed.map(l=>ee(l,n,i)),unusedIgnores:a.unusedIgnores}},Yt=async e=>{const t=await Oe(e);if(t.length>0){x.warn(`${String(t.length)} rule(s) skipped due to invalid regex. First few:`);for(const s of t.slice(0,5))process.stderr.write(` - ${s.ruleId}: ${s.reason}
|
|
37
|
+
`)}},as=async e=>{const{argument:t,options:s,visConfig:i,workspaceRoot:n}=e,r=s,a=t??[],l=n??e.process.cwd,o=!r.quiet&&process.stdout.isTTY,c=i?.secrets,u=_t(r,c,l),d="0.0.0-alpha";Bt(r),Ut(r),Ot(r,a.length>0);const $=Nt(r.format),b=Tt(O(r.report)),w=U(l,W);if(r.gitleaksIgnore!==!1&&await Dt(e.fs,w)&&(u.gitleaksIgnore=w),r.listRules){await Ht(u,o);return}if(r.listValidators){await zt(u,o);return}if(r.init){await Kt(l,u,r.dryRun??!1);return}const f=Wt(r,a,l),m=f.kind==="history";if(f.kind==="files"&&f.files.length===0){r.quiet||x.success("No files to scan.");return}const v=ue({verbose:!r.quiet&&$==="text"});v.start(m?"scanning git history for secrets":"scanning for secrets");let h;try{h=await Jt(f,r,u,l),v.succeed()}catch(I){throw v.failed(),new p(`${m?"git-history secret scan":"secret scan"} failed: ${I instanceof Error?I.message:String(I)}`,{cause:I})}const T={flags:r,format:$,fullScan:we(r,a.length>0).length===0,history:m,reports:b,root:l,scanOptions:u,toolbox:e,toolVersion:d,useColor:o};qt(h,T),r.verbose&&await Yt(u);const{findings:S}=h,R=typeof u.baseline=="string"?u.baseline:U(l,M);if(r.updateBaseline){const I=me(S,R,l,{replace:r.replaceBaseline,sensitive:u.redact!==!0});x.success(`Baseline updated: ${_(l,R)||R} now contains ${String(I)} entries.`);return}await Pt(h,T),$==="text"&&!m&&!r.quiet&&H(R)&&Vt(ht(S,R,l)),S.length>0?(r.quiet||(x.warn(`${String(S.length)} potential secret(s) found${m?" across git history":""}`),x.notice(m?"Findings reference the commit that introduced them — rotate the credential and rewrite history (e.g. git filter-repo) if it is still reachable.":"Suppress individual lines with `gitleaks:allow` / `secret-scanner:allow`, or run `vis secrets --update-baseline`.")),process.exitCode=1):r.quiet||x.success(m?"No secrets detected in git history.":"No secrets detected."),Gt(h,r)};export{as as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as m}from"../packem_shared/affected-shas-CycHU3nr.js";import{r as u}from"../packem_shared/toolchain-
|
|
1
|
+
import{r as m}from"../packem_shared/affected-shas-CycHU3nr.js";import{r as u}from"../packem_shared/toolchain-CbsBoqgN.js";const $=async({argument:h,logger:r,options:e,runtime:s,visConfig:f,workspaceRoot:n})=>{const o=h[0];if(!o)throw new Error("Missing targets. Usage: vis ci <target>[,<target>…]");const l=o.split(",").map(a=>a.trim()).filter(Boolean);if(l.length===0)throw new Error("Missing targets. Usage: vis ci <target>[,<target>…]");if(!n)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=m({defaultBase:f?.defaultBase,workspaceRoot:n}),c=e.base??i.base,d=e.head??i.head;!e.base&&!e.head&&r.info(`▸ Resolved affected refs from ${i.provider} (${i.notes.join("; ")})`),e.skipToolchain||r.info("▸ Toolchain pre-flight"),await u(n,f?.toolchain,{error:a=>{r.error(a)},info:a=>{r.info(a)},warn:a=>{r.warn(a)}},!!e.skipToolchain),e.install?(r.info("▸ Installing dependencies"),await s.runCommand("install",{argv:["--ci","--frozen-lockfile"]})):r.info("▸ Skipping install (--no-install)");for(const a of l){r.info(`▸ Running affected ${a} (base=${c}, head=${d})`);const t=[a,`--base=${c}`,`--head=${d}`,`--upstream=${String(e.upstream??"none")}`,`--downstream=${String(e.downstream??"deep")}`];Number.isFinite(e.parallel)&&t.push(`--parallel=${String(e.parallel)}`),e.partition&&t.push(`--partition=${String(e.partition)}`),e.query&&t.push(`--query=${String(e.query)}`),e.ifPresent&&t.push("--if-present"),await s.runCommand("affected",{argv:t})}r.info("▸ CI pipeline complete")};export{$ as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as Q}from"node:module";import{J as v,j as w,F as g,q as x,b,X as D}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as I,z as se,a as $}from"../packem_shared/index-0dnGN3GP.js";import G from"./index.js";import{y as _}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{U as oe,T as F,l as ne,a0 as ae,a1 as ie,a2 as re,a3 as ce}from"./cli-main.js";import{h as pe,i as z,q as W,u as j,p as L,J as K}from"../packem_shared/registry-
|
|
1
|
+
import{createRequire as Q}from"node:module";import{J as v,j as w,F as g,q as x,b,X as D}from"../packem_shared/index.server-Ca_EEVfw.js";import{e as I,z as se,a as $}from"../packem_shared/index-0dnGN3GP.js";import G from"./index.js";import{y as _}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{U as oe,T as F,l as ne,a0 as ae,a1 as ie,a2 as re,a3 as ce}from"./cli-main.js";import{h as pe,i as z,q as W,u as j,p as L,J as K}from"../packem_shared/registry-B5KGXKED.js";import{p as S}from"../packem_shared/package-version-C6xroAcI.js";import{U as fe}from"../packem_shared/env-BUf_aJzW.js";import{l as le}from"../packem_shared/missing-package-json-BhiqxoDg.js";import{readCatalogs as ue}from"./catalog.js";let Z;const ee=e=>(Z??=Q(import.meta.url))(e),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,te=e=>{if(typeof V<"u"&&V.versions&&V.versions.node){const[a,s]=V.versions.node.split(".").map(Number);if(a>22||a===22&&s>=3||a===20&&s>=16)return V.getBuiltinModule(e)}return ee(e)},{readFileSync:Y,writeFileSync:H}=te("node:fs"),de=e=>/[*?[\]{}!]/.test(e),ge=e=>typeof e=="string"?e:e.reason,me=e=>typeof e=="string"?void 0:e.replacement,q=(e,a)=>e.some(s=>G(s,a)),U=(e,a)=>{if(typeof e=="string")return!0;const s=Array.isArray(e.packages)&&e.packages.length>0,t=Array.isArray(e.paths)&&e.paths.length>0;return!!(!s&&!t||s&&a.packageName!==void 0&&q(e.packages,a.packageName)||t&&q(e.paths,a.packageDir))},he=(e,a)=>{const s=a[e.depName];if(s!==void 0&&U(s,e))return{pattern:e.depName,rule:s};for(const[t,r]of Object.entries(a))if(de(t)&&G(t,e.depName)&&U(r,e))return{pattern:t,rule:r}},ke=(e,a)=>{if(Object.keys(a).length===0)return[];const s=[];for(const t of e){if(t.isInternal)continue;const r=he(t,a);r&&s.push({depName:t.depName,depType:t.depType,matchedPattern:r.pattern,packageDir:t.packageDir,packageJsonPath:t.packageJsonPath,packageName:t.packageName,reason:ge(r.rule),replacement:me(r.rule),specifier:t.specifier})}return s},ye=new Set(["dependencies","devDependencies","peerDependencies"]),Pe=e=>e.startsWith("catalog:"),$e=e=>e.startsWith("workspace:"),we=(e,a)=>{if(!e)return!1;for(const s of e.values())if(s.has(a))return!0;return!1},ve=(e,a={})=>{const s=a.min??3,t=new Set(a.ignoreDeps),r=e.filter(i=>i.isInternal||!ye.has(i.depType)||$e(i.specifier)||a.dep!==void 0&&i.depName!==a.dep?!1:!t.has(i.depName)),n=new Map;for(const i of r){const c=n.get(i.depName);c?c.push(i):n.set(i.depName,[i])}const o=[];for(const[i,c]of n){if(we(a.catalogs,i)||c.some(h=>Pe(h.specifier)))continue;const p=new Map;for(const h of c){let d=p.get(h.specifier);d||(d=new Set,p.set(h.specifier,d)),d.add(h.packageJsonPath)}const m=[...p.entries()].sort((h,d)=>h[1].size!==d[1].size?d[1].size-h[1].size:h[0].localeCompare(d[0]))[0];!m||m[1].size<s||o.push({catalogName:"default",depName:i,instanceCount:m[1].size,specifier:m[0]})}return o.sort((i,c)=>i.depName.localeCompare(c.depName))},De=(e,a)=>{if(a.length===0)return;const s=I(e,"pnpm-workspace.yaml"),r=_(s)?Y(s,"utf8"):"",n=r.includes(`\r
|
|
2
2
|
`)?`\r
|
|
3
3
|
`:`
|
|
4
4
|
`,o=a.filter(d=>d.catalogName==="default").sort((d,u)=>d.depName.localeCompare(u.depName));if(o.length===0)return;const i=r.length>0?r.split(n):[],c=i.findIndex(d=>/^catalog\s*:\s*$/.test(d));if(c===-1){const d=["catalog:"];for(const J of o)d.push(` ${J.depName}: "${J.specifier}"`);let u=0;for(;u<i.length&&(i[u]??"").trim().length===0;)u+=1;const k=[...i.slice(0,u),...d,"",...i.slice(u)].join(n);return H(s,k.endsWith(n)?k:`${k}${n}`),s}let p=i.length;const f=new Set;for(let d=c+1;d<i.length;d+=1){const u=i[d]??"",k=u.trimStart();if(u.length===0)continue;if(u.length-k.length===0&&k.length>0&&!k.startsWith("#")){p=d;break}const P=/^([\w./@-]+)\s*:/.exec(k);P?.[1]&&f.add(P[1])}const m=[];for(const d of o)f.has(d.depName)||m.push(` ${d.depName}: "${d.specifier}"`);if(m.length===0)return;const h=[...i.slice(0,p),...m,...i.slice(p)].join(n);return H(s,h.endsWith(n)?h:`${h}${n}`),s},be=(e,a)=>{if(a.length===0)return"";const s=I(e,"pnpm-workspace.yaml"),r=_(s)?Y(s,"utf8"):"",n=[...a].sort((f,m)=>f.depName.localeCompare(m.depName)),o=["--- pnpm-workspace.yaml","+++ pnpm-workspace.yaml"],i=r.includes(`\r
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as C,z as P,U as pe}from"../packem_shared/index-0dnGN3GP.js";import{L as ge,M as le,N as de,K as me,C as ye,Q as ke,p as m,q as fe}from"./cli-main.js";import{i as ue}from"../packem_shared/index-BjdW45xX.js";import he from"module-replacements/manifests/micro-utilities.json"with{type:"json"};import je from"module-replacements/manifests/native.json"with{type:"json"};import ve from"module-replacements/manifests/preferred.json"with{type:"json"};import{K as be,j as t,X as g,O as c,r as O,R as xe,h as Te,i as W}from"../packem_shared/registry-
|
|
1
|
+
import{e as C,z as P,U as pe}from"../packem_shared/index-0dnGN3GP.js";import{L as ge,M as le,N as de,K as me,C as ye,Q as ke,p as m,q as fe}from"./cli-main.js";import{i as ue}from"../packem_shared/index-BjdW45xX.js";import he from"module-replacements/manifests/micro-utilities.json"with{type:"json"};import je from"module-replacements/manifests/native.json"with{type:"json"};import ve from"module-replacements/manifests/preferred.json"with{type:"json"};import{K as be,j as t,X as g,O as c,r as O,R as xe,h as Te,i as W}from"../packem_shared/registry-B5KGXKED.js";import{a as ee}from"../packem_shared/index--eV4qIz5.js";import{l as Ie}from"./ts-loader.js";import{y as V}from"../packem_shared/isAccessibleSync-DYKTrrvc-CBsMZhj-.js";import{U as D}from"../packem_shared/env-BUf_aJzW.js";import{d as we,n as Me}from"../packem_shared/pm-runner-BXRi4ZM9.js";import{p as re}from"../packem_shared/package-version-C6xroAcI.js";import{l as Se}from"../packem_shared/glob-Cyk1H9ZL-CoX0RPCo.js";const Ce=["dependencies","devDependencies","peerDependencies","peerDependenciesMeta","optionalDependencies","bundleDependencies"],Ee=["overrides","pnpm","resolutions"],$e=["engines","files"],Oe=r=>{const e=ee.coerce(r)?.major;return e!==void 0&&e>=10},De=r=>{const e=C(r,"pnpm-workspace.yaml");if(!V(e))return{overrides:{},source:"pnpm-workspace.yaml"};try{return{overrides:Ie(e)?.overrides??{},source:"pnpm-workspace.yaml"}}catch{return{overrides:{},source:"pnpm-workspace.yaml"}}},Pe=(r,e)=>{let s={};return e==="pnpm"?s=r.pnpm?.overrides??{}:e==="yarn"||e==="bun"?s=r.resolutions??{}:s=r.overrides??{},{overrides:s,source:"package.json"}},Ne=(r,e,s)=>s.name==="pnpm"&&Oe(s.version)?De(r):Pe(e,s.name),Y=(r,e)=>{const s=e;for(const o of Ee){const n=r.indexOf(o);if(n!==-1&&o!==s)return s==="overrides"?n:n+1}let i=-1;for(const o of Ce){const n=r.indexOf(o);n>i&&(i=n)}if(i!==-1)return i+1;for(const o of $e){const n=r.indexOf(o);if(n!==-1)return n}return r.length},Ae=(r,e)=>{const s=C(r,"pnpm-workspace.yaml");if(!V(s))throw new Error(`pnpm-workspace.yaml not found at ${s}. Cannot write overrides for pnpm v10+.`);let i=P(s);const n=`overrides:
|
|
2
2
|
${Object.entries(e).map(([p,d])=>` '${p}': '${d}'`).join(`
|
|
3
3
|
`)}
|
|
4
4
|
`;i=/^overrides:\s*$/m.test(i)||/^overrides:\s*\n/m.test(i)?i.replace(/^overrides:\s*\n(?:(?:[ \t].*)?\n)*/m,n):`${i.trimEnd()}
|