@visulima/vis 1.0.0-alpha.42 → 1.0.0-alpha.43
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 +27 -0
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.js +1 -1
- package/dist/packem_chunks/CONFIG_FILES.js +8 -0
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +113 -0
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +295 -433
- package/dist/packem_chunks/detect.js +3 -3
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +5 -1
- package/dist/packem_chunks/handler11.js +1 -5
- package/dist/packem_chunks/handler12.js +27 -1
- package/dist/packem_chunks/handler13.js +5 -27
- package/dist/packem_chunks/handler14.js +1 -5
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +5 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +2 -5
- package/dist/packem_chunks/handler21.js +2 -2
- package/dist/packem_chunks/handler22.js +5 -2
- package/dist/packem_chunks/handler23.js +1 -5
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +5 -1
- package/dist/packem_chunks/handler27.js +1 -5
- package/dist/packem_chunks/handler28.js +3 -1
- package/dist/packem_chunks/handler29.js +1 -3
- package/dist/packem_chunks/handler3.js +4 -1
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler31.js +2 -1
- package/dist/packem_chunks/handler32.js +2 -2
- package/dist/packem_chunks/handler33.js +2 -2
- package/dist/packem_chunks/handler34.js +3 -2
- package/dist/packem_chunks/handler35.js +6 -3
- package/dist/packem_chunks/handler36.js +1 -6
- package/dist/packem_chunks/handler37.js +42 -1
- package/dist/packem_chunks/handler38.js +8 -42
- package/dist/packem_chunks/handler39.js +9 -8
- package/dist/packem_chunks/handler4.js +4 -4
- package/dist/packem_chunks/handler40.js +75 -9
- package/dist/packem_chunks/handler41.js +5 -75
- package/dist/packem_chunks/handler42.js +4 -5
- package/dist/packem_chunks/handler43.js +3 -4
- package/dist/packem_chunks/handler44.js +2 -3
- package/dist/packem_chunks/handler45.js +1 -2
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler47.js +1 -1
- package/dist/packem_chunks/handler48.js +3 -1
- package/dist/packem_chunks/handler49.js +1 -3
- package/dist/packem_chunks/handler5.js +6 -4
- package/dist/packem_chunks/handler50.js +7 -1
- package/dist/packem_chunks/handler51.js +32 -6
- package/dist/packem_chunks/handler52.js +3 -33
- package/dist/packem_chunks/handler53.js +8 -3
- package/dist/packem_chunks/handler54.js +2 -6
- package/dist/packem_chunks/handler55.js +1 -4
- package/dist/packem_chunks/handler56.js +12 -1
- package/dist/packem_chunks/handler57.js +5 -12
- package/dist/packem_chunks/handler58.js +11 -5
- package/dist/packem_chunks/handler59.js +3 -11
- package/dist/packem_chunks/handler6.js +8 -6
- package/dist/packem_chunks/handler60.js +22 -3
- package/dist/packem_chunks/handler61.js +60 -21
- package/dist/packem_chunks/handler62.js +3 -61
- package/dist/packem_chunks/handler63.js +6 -3
- package/dist/packem_chunks/handler64.js +9 -6
- package/dist/packem_chunks/handler65.js +2 -9
- package/dist/packem_chunks/handler66.js +12 -12
- package/dist/packem_chunks/handler67.js +5 -5
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +4 -4
- package/dist/packem_chunks/handler7.js +1 -8
- package/dist/packem_chunks/handler70.js +7 -7
- package/dist/packem_chunks/handler71.js +12 -12
- package/dist/packem_chunks/handler72.js +5 -5
- package/dist/packem_chunks/handler73.js +7 -7
- package/dist/packem_chunks/handler74.js +3 -3
- package/dist/packem_chunks/handler75.js +3 -3
- package/dist/packem_chunks/handler76.js +31 -31
- package/dist/packem_chunks/handler77.js +1 -1
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +1 -1
- package/dist/packem_chunks/index2.js +2 -2
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/orchestrator.js +19 -19
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_chunks/version-resolver.js +1 -1
- package/dist/packem_shared/{advisories-aiDtubZQ.js → advisories-CefYKEPe.js} +1 -1
- package/dist/packem_shared/{ai-analysis-CubpCxZJ.js → ai-analysis-Co-b15d_.js} +7 -7
- package/dist/packem_shared/{ai-fix-Btd5AnSr.js → ai-fix-DnJDgPN-.js} +9 -9
- package/dist/packem_shared/bin-DDq2oszw.js +1 -0
- package/dist/packem_shared/{cyclonedx-NUJ9R2GQ.js → cyclonedx-BTBzGCBW.js} +1 -1
- package/dist/packem_shared/dependency-scan-DEv-scN6.js +1 -0
- package/dist/packem_shared/env-XJzocuUP.js +27 -0
- package/dist/packem_shared/failure-log-Sp1j-5qo.js +2 -0
- package/dist/packem_shared/index-B0EsgdzO.js +1 -0
- package/dist/packem_shared/{index-Cb4x6lWY.js → index-Cg0IHaFI.js} +1 -1
- package/dist/packem_shared/index-CkZnT2Fe.js +1 -0
- package/dist/packem_shared/{index-CPhv-r4c.js → index-DJAnbLEh.js} +13 -13
- package/dist/packem_shared/{lifecycle-D5roTh0a.js → lifecycle-C4nRsXxc.js} +1 -1
- package/dist/packem_shared/{min-release-age-pUAqTiv3.js → min-release-age-B23Mr7NO.js} +1 -1
- package/dist/packem_shared/missing-package-json-DdMNbe_j.js +1 -0
- package/dist/packem_shared/{osv-bloom-OuTfu_LE.js → osv-bloom-BsQ-aFiM.js} +1 -1
- package/dist/packem_shared/packument-QjOLAMSk.js +1 -0
- package/dist/packem_shared/{pm-runner-Dws_Bw1y.js → pm-runner-CIH0wPh-.js} +1 -1
- package/dist/packem_shared/prompt-DjXHVgYU.js +1 -0
- package/dist/packem_shared/provenance-CilBg0Ee.js +1 -0
- package/dist/packem_shared/registry-keys-BEavOCPz.js +1 -0
- package/dist/packem_shared/resolve-explicit-C4o8_-SE.js +5 -0
- package/dist/packem_shared/s1ngularity-DuG-LLaX.js +1 -0
- package/dist/packem_shared/scan-progress-RTMsE3Z4.js +2 -0
- package/dist/packem_shared/{signatures-BOUhghTv.js → signatures-CYheSqd3.js} +2 -2
- package/dist/packem_shared/spinner-DuJJvFTl.js +1 -0
- package/dist/packem_shared/tabs-CgxCvjCY.js +1 -0
- package/dist/packem_shared/target-merge-DOm6h6tW.js +11 -0
- package/dist/packem_shared/{typosquats-DBOvXwph.js → typosquats-hCtH-23t.js} +1 -1
- package/dist/packem_shared/use-measured-height-BKUjhm_3.js +1 -0
- package/dist/packem_shared/vis-update-app-K-qATSeh.js +1 -0
- package/dist/packem_shared/watch-loop-WE7nWIEt.js +11 -0
- package/dist/packem_shared/window-ops-DDePlWLV.js +2 -0
- package/index.js +52 -52
- package/package.json +10 -10
- package/dist/packem_chunks/config.js +0 -18
- package/dist/packem_shared/CONFIG_FILES-MsOntfYT.js +0 -1
- package/dist/packem_shared/bin-CnDBuLh3.js +0 -2
- package/dist/packem_shared/dependency-scan-B0HV_qeB.js +0 -1
- package/dist/packem_shared/failure-log-C7r6UZLP.js +0 -2
- package/dist/packem_shared/index-BKFEWXU_.js +0 -1
- package/dist/packem_shared/missing-package-json-DhYzuKhD.js +0 -1
- package/dist/packem_shared/provenance-C0P-UYOM.js +0 -1
- package/dist/packem_shared/registry-keys-D4chF-Wj.js +0 -1
- package/dist/packem_shared/resolve-explicit-Cgheka3B.js +0 -5
- package/dist/packem_shared/s1ngularity-Du1NnSFP.js +0 -1
- package/dist/packem_shared/scan-progress-CN9ONR0y.js +0 -2
- package/dist/packem_shared/spinner-lhXugSx3.js +0 -1
- package/dist/packem_shared/tabs-DTiU3usb.js +0 -1
- package/dist/packem_shared/use-measured-height-CK2Co3XI.js +0 -1
- package/dist/packem_shared/vis-update-app-DtHkwBca.js +0 -1
- package/dist/packem_shared/watch-loop-D9zbXzRd.js +0 -11
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as M}from"node:module";import{c as j}from"./compile-cache-B_Vf_WxT.js";import{i as Z,h as G,t as U,p as y,c as k}from"./runtime-process-Dmz0vCJy-DUwTvH1J.js";import"./index.server-J83sowC4.js";import"./index-OQZQyN5R.js";import{a as F}from"./readJsonSync-CvkZyKmL-CY7PZob_.js";const B=M(import.meta.url),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,X=e=>{if(typeof a<"u"&&a.versions&&a.versions.node){const[t,r]=a.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return a.getBuiltinModule(e)}return B(e)},{createRequire:g}=X("node:module"),{env:T}=a,H=g(import.meta.url),_=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=e=>{if(typeof _<"u"&&_.versions&&_.versions.node){const[t,r]=_.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return _.getBuiltinModule(e)}return H(e)},{execFileSync:V}=A("node:child_process"),{totalmem:Y}=A("node:os"),z=/--max-old-space-size=(\d+)/,q=/--max-semi-space-size=(\d+)/,Q=e=>Math.floor(Y()/1024/1024*e),K=e=>e<=512?4:e<=1024?8:e<=2048?16:e<=4096?32:e<=8192?64:Math.floor(Math.log2(e))*8,$=(e,t)=>{for(const r of t){const o=e.exec(r);if(o)return Number.parseInt(o[1],10)}},J=e=>{const r=[...k()],o=[...Z()],n=$(z,r),i=$(q,r);if(n!==void 0&&i!==void 0)return;const s=n??Q(.75),l=i??K(s),I=[];if(n===void 0&&I.push(`--max-old-space-size=${String(s)}`),i===void 0&&I.push(`--max-semi-space-size=${String(l)}`),I.length!==0)try{V(G(),[...I,...r,...o.slice(1)],{env:U(),stdio:"inherit"}),y(0)}catch(C){const W=C.status;y(typeof W=="number"?W:1)}},c="\x1B[",x=";";g(import.meta.url);const ee=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=ee,te=(e,t,r,o)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;const n=Object.getOwnPropertyDescriptor(e,r),i=Object.getOwnPropertyDescriptor(t,r);!re(n,i)&&o||Object.defineProperty(e,r,i)},re=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},oe=(e,t)=>{const r=Object.getPrototypeOf(t);r!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,r)},ne=(e,t)=>`/* Wrapped ${e}*/
|
|
2
|
-
${t}`,ie=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),se=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),ce=(e,t,r)=>{const o=r===""?"":`with ${r.trim()}() `,n=ne.bind(null,o,t.toString());Object.defineProperty(n,"name",se);const{writable:i,enumerable:s,configurable:l}=ie;Object.defineProperty(e,"toString",{value:n,writable:i,enumerable:s,configurable:l})};function le(e,t,{ignoreNonConfigurable:r=!1}={}){const{name:o}=e;for(const n of Reflect.ownKeys(t))te(e,t,n,r);return oe(e,t),ce(e,t,o),e}const S=new WeakMap,D=(e,t={})=>{if(typeof e!="function")throw new TypeError("Expected a function");let r,o=0;const n=e.displayName||e.name||"<anonymous>",i=function(...s){if(S.set(i,++o),o===1)r=e.apply(this,s),e=void 0;else if(t.throw===!0)throw new Error(`Function \`${n}\` can only be called once`);return r};return le(i,e),S.set(i,o),i};D.callCount=e=>{if(!S.has(e))throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`);return S.get(e)};const u=[];u.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&u.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&u.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");const d=e=>!!e&&!0&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",E=Symbol.for("signal-exit emitter"),R=globalThis,ae=Object.defineProperty.bind(Object);let ue=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(R[E])return R[E];ae(R,E,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,r){this.listeners[t].push(r)}removeListener(t,r){const o=this.listeners[t],n=o.indexOf(r);n!==-1&&(n===0&&o.length===1?o.length=0:o.splice(n,1))}emit(t,r,o){if(this.emitted[t])return!1;this.emitted[t]=!0;let n=!1;for(const i of this.listeners[t])n=i(r,o)===!0||n;return t==="exit"&&(n=this.emit("afterExit",r,o)||n),n}};class L{}const _e=e=>({onExit(t,r){return e.onExit(t,r)},load(){return e.load()},unload(){return e.unload()}});let pe=class extends L{onExit(){return()=>{}}load(){}unload(){}},fe=class extends L{#s=m.platform==="win32"?"SIGINT":"SIGHUP";#t=new ue;#e;#n;#i;#o={};#r=!1;constructor(t){super(),this.#e=t,this.#o={};for(const r of u)this.#o[r]=()=>{const o=this.#e.listeners(r);let{count:n}=this.#t;const i=t;if(typeof i.__signal_exit_emitter__=="object"&&typeof i.__signal_exit_emitter__.count=="number"&&(n+=i.__signal_exit_emitter__.count),o.length===n){this.unload();const s=this.#t.emit("exit",null,r),l=r==="SIGHUP"?this.#s:r;s||t.kill(t.pid,l)}};this.#i=t.reallyExit,this.#n=t.emit}onExit(t,r){if(!d(this.#e))return()=>{};this.#r===!1&&this.load();const o=r?.alwaysLast?"afterExit":"exit";return this.#t.on(o,t),()=>{this.#t.removeListener(o,t),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#r){this.#r=!0,this.#t.count+=1;for(const t of u)try{const r=this.#o[t];r&&this.#e.on(t,r)}catch{}this.#e.emit=(t,...r)=>this.#l(t,...r),this.#e.reallyExit=t=>this.#c(t)}}unload(){this.#r&&(this.#r=!1,u.forEach(t=>{const r=this.#o[t];if(!r)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,r)}catch{}}),this.#e.emit=this.#n,this.#e.reallyExit=this.#i,this.#t.count-=1)}#c(t){return d(this.#e)?(this.#e.exitCode=t||0,this.#t.emit("exit",this.#e.exitCode,null),this.#i.call(this.#e,this.#e.exitCode)):0}#l(t,...r){const o=this.#n;if(t==="exit"&&d(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);const n=o.call(this.#e,t,...r);return this.#t.emit("exit",this.#e.exitCode,null),n}else return o.call(this.#e,t,...r)}};const m=globalThis.process,{onExit:Ie}=_e(d(m)?new fe(m):new pe),b=h.stderr.isTTY?h.stderr:h.stdout.isTTY?h.stdout:void 0;b&&D(()=>{Ie(()=>{b.write("\x1B[?25h")},{alwaysLast:!0})});const Ye=(e=1)=>`${c}${String(e)}B`,ze=`${c}?25l`,he=`${c}G`,de=(e=1)=>`${c}${String(e)}G`,qe=(e=1)=>`${c}${String(e)}E`,Qe=`${c}?25h`,Ke=(e,t)=>t===void 0?de(e+1):`${c}${String(t+1)}${x}${String(e+1)}H`,Se=(e=1)=>`${c}${String(e)}A`;var Oe=(e=>(e[e.Default=0]="Default",e[e.BlinkingBlock=1]="BlinkingBlock",e[e.SteadyBlock=2]="SteadyBlock",e[e.BlinkingUnderline=3]="BlinkingUnderline",e[e.SteadyUnderline=4]="SteadyUnderline",e[e.BlinkingBar=5]="BlinkingBar",e[e.SteadyBar=6]="SteadyBar",e))(Oe||{});const Je=e=>`${c}${String(e)} q`;var Te=(e=>(e[e.ToEnd=0]="ToEnd",e[e.ToBeginning=1]="ToBeginning",e[e.EntireScreen=2]="EntireScreen",e[e.EntireScreenAndScrollback=3]="EntireScreenAndScrollback",e))(Te||{});const et=e=>{const t=e>=0&&e<=3?e:0;return`${c}${t===0?"":String(t)}J`};var Ee=(e=>(e[e.ToEnd=0]="ToEnd",e[e.ToBeginning=1]="ToBeginning",e[e.EntireLine=2]="EntireLine",e))(Ee||{});const v=e=>{const t=e>=0&&e<=2?e:0;return`${c}${t===0?"":String(t)}K`},Re=v(2),tt=v(0),rt=e=>{if(e<=0)return"";let t="";for(let r=0;r<e;r+=1)t+=Re,r<e-1&&(t+=Se());return t+=he,t},me=g(import.meta.url),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ge=e=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[t,r]=p.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return p.getBuiltinModule(e)}return me(e)};ge("node:buffer");class Ne{code;isDecMode=!0;constructor(t){this.code=t}}const w=(e,...t)=>{if(t.length===0)return"";const r=e?"l":"h";if(t.length===1){const s=t[0];let l=c;return s.isDecMode&&(l+="?"),l+String(s.code)+r}const o=t.filter(s=>!s.isDecMode).map(s=>s.code),n=t.filter(s=>s.isDecMode).map(s=>s.code);let i="";return o.length>0&&(i+=`${c}${o.join(";")}${r}`),n.length>0&&(i+=`${c}?${n.join(";")}${r}`),i};var We=(e=>(e[e.NotRecognized=0]="NotRecognized",e[e.Set=1]="Set",e[e.Reset=2]="Reset",e[e.PermanentlySet=3]="PermanentlySet",e[e.PermanentlyReset=4]="PermanentlyReset",e))(We||{});const ye=e=>new Ne(e),ot=(...e)=>w(!1,...e),nt=(...e)=>w(!0,...e),it=ye(2004);class $e{constructor(t){this.reportCode=t}reportCode;isDecReport=!1}class be{constructor(t){this.reportCode=t}reportCode;isDecReport=!0}const Pe=e=>new $e(e),N=e=>new be(e),O=(...e)=>{if(e.length===0)return"";const t=e.some(n=>n.isDecReport),r=e.map(n=>n.reportCode.toString());let o=c;return t&&(o+="?"),`${o}${r.join(x)}n`},Ae=Pe(5);O(Ae);const xe=N(15);O(xe);const De=N(25);O(De);const Le=N(26);O(Le);var ve=(e=>(e[e.DEICONIFY_WINDOW=1]="DEICONIFY_WINDOW",e[e.ICONIFY_WINDOW=2]="ICONIFY_WINDOW",e[e.MOVE_WINDOW=3]="MOVE_WINDOW",e[e.RESIZE_TEXT_AREA_CHARS=4]="RESIZE_TEXT_AREA_CHARS",e[e.RAISE_WINDOW=5]="RAISE_WINDOW",e[e.LOWER_WINDOW=6]="LOWER_WINDOW",e[e.REFRESH_WINDOW=7]="REFRESH_WINDOW",e[e.RESIZE_TEXT_AREA_PIXELS=8]="RESIZE_TEXT_AREA_PIXELS",e[e.RESTORE_MAXIMIZED_WINDOW=9]="RESTORE_MAXIMIZED_WINDOW",e[e.MAXIMIZE_WINDOW=10]="MAXIMIZE_WINDOW",e[e.MAXIMIZE_WINDOW_VERTICALLY=10.1]="MAXIMIZE_WINDOW_VERTICALLY",e[e.MAXIMIZE_WINDOW_HORIZONTALLY=10.2]="MAXIMIZE_WINDOW_HORIZONTALLY",e[e.UNDO_FULL_SCREEN_MODE=10.3]="UNDO_FULL_SCREEN_MODE",e[e.REPORT_WINDOW_STATE=11]="REPORT_WINDOW_STATE",e[e.REPORT_WINDOW_POSITION=13]="REPORT_WINDOW_POSITION",e[e.REPORT_TEXT_AREA_SIZE_CHARS=14]="REPORT_TEXT_AREA_SIZE_CHARS",e[e.REQUEST_WINDOW_SIZE_WIN_OP_COMPAT=14]="REQUEST_WINDOW_SIZE_WIN_OP_COMPAT",e[e.REPORT_CELL_SIZE_PIXELS=16]="REPORT_CELL_SIZE_PIXELS",e[e.REPORT_TEXT_AREA_SIZE_PIXELS=18]="REPORT_TEXT_AREA_SIZE_PIXELS",e[e.REPORT_ICON_LABEL=19]="REPORT_ICON_LABEL",e[e.REPORT_WINDOW_TITLE=21]="REPORT_WINDOW_TITLE",e[e.PUSH_WINDOW_TITLE=22]="PUSH_WINDOW_TITLE",e[e.POP_WINDOW_TITLE=23]="POP_WINDOW_TITLE",e[e.RESIZE_SCREEN_AND_TEXT_AREA=24]="RESIZE_SCREEN_AND_TEXT_AREA",e))(ve||{});const P=e=>e in T&&T[e]!=="0"&&T[e]!=="false",we=P("CI")||P("CONTINUOUS_INTEGRATION"),Ce=()=>{if(process.env.VIS_VERSION)return process.env.VIS_VERSION;try{const e=new URL("../../package.json",import.meta.url);return F(e).version}catch{return"0.0.0"}},Me=()=>{process.env.VIS_VERSION=Ce()},st=e=>{!process.stdout.isTTY||we||process.env.TERM==="dumb"||process.stdout.write(`\x1B]0;${e}\x07`)},Be=new Set(["","--help","--version","-h","-v","completion","dlx","exec","x"]),f=process.argv[2]??"";!Be.has(f)&&!process.argv.includes("--help")&&!process.argv.includes("-h")&&J();process.argv.includes("--no-color")&&(process.env.NO_COLOR="1",process.env.FORCE_COLOR="0");Me();j();(async()=>{if(f==="__pm-shim"){const{dispatchShim:t}=await import("../packem_chunks/dispatch.js");t(process.argv[3]??"",process.argv.slice(4));return}if(f==="x"){const{runLeanX:t}=await import("../packem_chunks/lean.js");await t(process.argv.slice(3));return}if(f==="exec"||f==="dlx"){const{runExecCli:t}=await import("../packem_chunks/cli-exec.js");await t();return}const{runCli:e}=await import("../packem_chunks/cli-main.js").then(t=>t.br);await e()})();export{ze as A,Qe as H,we as I,rt as L,Ke as P,it as Q,nt as S,Se as _,ye as a,ot as c,tt as d,et as e,qe as h,Je as j,Te as o,st as s,Ye as v,c as x};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{v as u,m as l,f as g}from"./index-OQZQyN5R.js";import{D as d,i as D,W as v}from"../packem_chunks/cli-main.js";import"./public-api-WqUCiyIe.js";const w={bun:{file:"bun.lock",type:"bun"},npm:{aliases:["npm-shrinkwrap.json"],file:"package-lock.json",type:"npm"},pnpm:{file:"pnpm-lock.yaml",type:"pnpm"},yarn:{file:"yarn.lock",type:"yarn"}},j=o=>{const t=w[o];return t?[...t.aliases??[],t.file].map(e=>({file:e,type:t.type})):[]},m=(o,t)=>{const e=j(t);if(e.length!==0)return e.find(r=>g(l(o,r.file)))??e[e.length-1]},k=o=>{try{return JSON.parse(u(o))}catch{return}},y=o=>{const t=[],e=k(l(o,"package.json"));e&&t.push(e);const r=D(o);let c;if(r?c=r:e?.workspaces&&(Array.isArray(e.workspaces)?c=e.workspaces:e.workspaces.packages&&(c=e.workspaces.packages)),!c)return t;const a=v(o,c);for(const s of a){const n=k(l(o,s,"package.json"));n&&t.push(n)}return t},b=(o,t)=>{const e=new Set,r=[],c=new Map;for(const s of t){const n=c.get(s.name);n?n.push(s):c.set(s.name,[s])}const a=s=>{if(s)for(const n of Object.keys(s))e.has(n)||(e.add(n),r.push(n))};for(const s of y(o))a(s.dependencies),a(s.peerDependencies),a(s.optionalDependencies);for(;r.length>0;){const s=r.shift(),n=c.get(s);if(n){for(const i of n)for(const p of[i.dependencies,i.peerDependencies,i.optionalDependencies])if(p)for(const f of Object.keys(p))e.has(f)||(e.add(f),r.push(f))}}return e},$=(o,t,e={})=>{const r=m(o,t);if(!r)return[];let c;try{c=u(l(o,r.file))}catch{return[]}const a=d(c,r.type);if(a.length===0)return[];const s=e.includeDev??!0?void 0:b(o,a),n=new Set,i=[];for(const p of a){if(s&&!s.has(p.name))continue;const f=`${p.name}@${p.version}`;n.has(f)||(n.add(f),i.push({isDev:!1,name:p.name,version:p.version}))}return i},A=(o,t)=>{const e=m(o,t);if(!e)return[];let r;try{r=u(l(o,e.file))}catch{return[]}const c=d(r,e.type);if(c.length===0)return[];const a=new Map;for(const n of c)a.has(n.name)||a.set(n.name,new Set),a.get(n.name).add(n.version);const s=[];for(const[n,i]of a)i.size<=1||s.push({name:n,versions:[...i]});return s.sort((n,i)=>n.name.localeCompare(i.name))},E=(o,t)=>{const e=m(o,t);if(!e)return;let r;try{r=u(l(o,e.file))}catch{return}const c=d(r,e.type);if(c.length===0)return;const a=[],s=new Set;for(const n of y(o))for(const i of[n.dependencies,n.devDependencies,n.peerDependencies,n.optionalDependencies])if(i)for(const[p,f]of Object.entries(i)){const h=`${p}@${f}`;s.has(h)||(s.add(h),a.push({name:p,version:f}))}return{entries:c,roots:a}};export{w as L,E as a,A as f,$ as l,m as r};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as m}from"node:module";import{m as _}from"./index-OQZQyN5R.js";import{a as F}from"../packem_chunks/cli-main.js";const p=m(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=r=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,e]=o.versions.node.split(".").map(Number);if(t>22||t===22&&e>=3||t===20&&e>=16)return o.getBuiltinModule(r)}return p(r)},{mkdirSync:f,writeFileSync:h,readdirSync:g}=c("node:fs"),{readFile:y}=c("node:fs/promises"),n=r=>F(r),a=(r,t)=>_(n(r),`${encodeURIComponent(t)}.json`);class S{#t;#e;constructor(t,e){this.#t=t,this.#e=e}printTaskTerminalOutput(t,e,s){if(e!=="failure")return;const i=n(this.#t);try{f(i,{recursive:!0})}catch{return}const u=t.overrides.command,d=t.projectRoot,l={command:u,cwd:d,exitCode:void 0,hash:t.hash,runId:this.#e,status:e,taskId:t.id,terminalOutput:s,timestamp:new Date().toISOString()};try{h(a(this.#t,t.id),`${JSON.stringify(l,void 0,2)}
|
|
2
|
-
`,"utf8")}catch{}}}const I=async(r,t)=>{const e=a(r,t);try{const s=await y(e,"utf8");return JSON.parse(s)}catch{return}},O=r=>{const t=n(r);let e;try{e=g(t)}catch{return[]}const s=[];for(const i of e)if(i.endsWith(".json"))try{s.push(decodeURIComponent(i.slice(0,-5)))}catch{}return s};export{S as F,I as a,O as l};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as h,g as k,D as $,f as C}from"./provenance-C0P-UYOM.js";import{S as d,D as N}from"../packem_chunks/cli-main.js";import{W as R}from"./build-scripts-Doxce2VM.js";import{n as v}from"./license-t5KnNX6v.js";import{A as L,B as D,v as A}from"./index-OQZQyN5R.js";import"./public-api-WqUCiyIe.js";import{L as w}from"./dependency-scan-B0HV_qeB.js";const m={CRITICAL:0,HIGH:1,LOW:3,MODERATE:2,UNKNOWN:4},se=(t,e)=>{const n=m[(t.vulnerability.severity??"UNKNOWN").toUpperCase()]??4,s=m[(e.vulnerability.severity??"UNKNOWN").toUpperCase()]??4;return n-s||t.packageName.localeCompare(e.packageName)||t.packageVersion.localeCompare(e.packageVersion)},P=(t,e)=>{const n=m[e.toUpperCase()]??2;return(m[t.toUpperCase()]??4)<=n},b=["firstSeen","installScripts","license","malware","publisherChange","score","unexpectedDeps","vulnerability"],g=6e4,W=(t,e,n)=>{for(const s of n)if(s===t||s===`${t}@${e}`||s.endsWith("*")&&t.startsWith(s.slice(0,-1)))return!0;return!1},x=async(t,e)=>{const n=e.security?.policies?.firstSeen;if(n?.minutes===void 0||n.minutes<=0)return[];const{minutes:s}=n,a=n.exclude??[],r=e.security?.acceptedRisks,c=s*g,i=Date.now();return(await h(t.packages,$,async o=>{if(W(o.name,o.version,a))return;const l=await k(o.name,{workspaceRoot:t.workspaceRoot});if(l===void 0)return;const p=l.time?.[o.version];if(p===void 0)return;const u=Date.parse(p);if(Number.isNaN(u))return;const f=i-u;if(f>=c)return;const y=Math.max(0,Math.floor(f/g));return{acceptedRisk:d(o.name,o.version,r,"firstSeen"),data:{ageMinutes:y,minimumMinutes:s,publishedAt:p},packageName:o.name,policy:"firstSeen",reason:`${o.name}@${o.version} was published ${String(y)} min ago — below the ${String(s)} min firstSeen cooldown.`,severity:"block",version:o.version}})).filter(o=>o!==void 0)},O=(t,e)=>{const n=e.security?.policies?.installScripts;if(!n)return[];const s=n.allow??{},a=n.strict===!0;if(!a&&Object.keys(s).length===0)return[];const r=R(t.workspaceRoot,s,{pinVersions:e.security?.pinVersions===!0});if(r.unapproved.length===0)return[];const c=e.security?.acceptedRisks,i=a?"block":"warn";return r.unapproved.map(o=>({acceptedRisk:d(o.name,o.version??"*",c,"installScripts"),data:{hooks:o.hooks},packageName:o.name,policy:"installScripts",reason:`${o.name}${o.version?`@${o.version}`:""} declares unapproved build script(s): ${o.hooks.join(", ")}`,severity:i,version:o.version??"*"}))},U=new Set(["AND","OR"]),E=t=>{const e=t.replaceAll("("," ").replaceAll(")"," ").split(/\s+/).map(a=>a.trim()).filter(a=>a.length>0),n=[];let s=!1;for(const a of e){const r=a.toUpperCase();if(s){s=!1;continue}if(r==="WITH"){s=!0;continue}if(U.has(r))continue;const c=a.endsWith("+"),i=c?a.slice(0,-1):a,o=v(i)??i;n.push(o),c&&n.push(`${o}-or-later`)}return n},F=t=>{if(typeof t.license=="string"){const e=t.license.trim();return e.length>0?e:void 0}if(t.license&&typeof t.license=="object"&&typeof t.license.type=="string"){const e=t.license.type.trim();if(e.length>0)return e}if(Array.isArray(t.licenses)&&t.licenses.length>0){const e=t.licenses.map(n=>n&&typeof n.type=="string"?n.type.trim():"").filter(n=>n.length>0);if(e.length>0)return e.length===1?e[0]:`(${e.join(" OR ")})`}},I=(t,e)=>{if(e.length===0)return;const n=new Set(e.map(s=>v(s)??s).map(s=>s.toLowerCase()));for(const s of t)if(n.has(s.toLowerCase()))return s},M=(t,e)=>{if(e.length===0)return;const n=new Set(e.map(s=>v(s)??s).map(s=>s.toLowerCase()));for(const s of t)if(!n.has(s.toLowerCase()))return s},V=(t,e)=>{const n=e.security?.policies?.license;if(!n)return[];const s=n.allow??[],a=n.deny??[];if(s.length===0&&a.length===0)return[];const r=e.security?.acceptedRisks,c=[];for(const i of t.packages){const o=t.manifestData?.get(`${i.name}@${i.version}`),l=o?F(o):void 0;if(!l){s.length>0&&c.push({acceptedRisk:d(i.name,i.version,r,"license"),data:{declaredLicense:null},packageName:i.name,policy:"license",reason:`${i.name}@${i.version} declares no license; allow-list mode requires one of: ${s.join(", ")}`,severity:"block",version:i.version});continue}const p=E(l),u=I(p,a);if(u){c.push({acceptedRisk:d(i.name,i.version,r,"license"),data:{declaredLicense:l,deniedLicense:u},packageName:i.name,policy:"license",reason:`${i.name}@${i.version} uses denied license '${u}' (declared: ${l})`,severity:"block",version:i.version});continue}const f=M(p,s);f&&c.push({acceptedRisk:d(i.name,i.version,r,"license"),data:{allowList:s,declaredLicense:l,unallowedLicense:f},packageName:i.name,policy:"license",reason:`${i.name}@${i.version} uses license '${f}' which is not on the allow-list (declared: ${l})`,severity:"block",version:i.version})}return c},j=6e4,_=(t,e,n)=>{for(const s of n)if(s===t||s===`${t}@${e}`||s.endsWith("*")&&t.startsWith(s.slice(0,-1)))return!0;return!1},H=async(t,e)=>{const n=e.security?.policies?.publisherChange;if(n?.mode!=="no-downgrade")return[];const s=n.exclude??[],a=typeof n.ignoreAfter=="number"?n.ignoreAfter*j:void 0,r=e.security?.acceptedRisks,c=Date.now();return(await h(t.packages,$,async i=>{if(_(i.name,i.version,s))return;const o=await k(i.name,{workspaceRoot:t.workspaceRoot});if(o===void 0)return;if(a!==void 0){const p=o.time?.[i.version],u=p===void 0?Number.NaN:Date.parse(p);if(!Number.isNaN(u)&&c-u>a)return}if(o.versions[i.version]?.dist?.attestations?.provenance!==void 0)return;const l=C(o,i.version);if(l!==void 0)return{acceptedRisk:d(i.name,i.version,r,"publisherChange"),data:{priorVersionWithProvenance:l},packageName:i.name,policy:"publisherChange",reason:`${i.name}@${i.version} dropped the provenance attestation that ${i.name}@${l} carried — publisher trust downgrade.`,severity:"block",version:i.version}})).filter(i=>i!==void 0)},T=t=>{for(const e of Object.values(w))for(const n of[e.file,...e.aliases??[]])if(t===n||t.endsWith(`/${n}`)||t.endsWith(`.${n}`))return e.type},K=(t,e,n)=>{const s=L(e)?e:D(t,e);let a;try{a=A(s)}catch{return}const r=T(s)??w[n]?.type;if(!r)return;const c=N(a,r);if(c.length===0)return;const i=new Set;for(const o of c)i.add(`${o.name}@${o.version}`);return i},z=(t,e)=>{for(const n of e)if(n===t||n.endsWith("*")&&t.startsWith(n.slice(0,-1)))return!0;return!1},Y=(t,e)=>{const n=e.security?.policies?.unexpectedDeps;if(!n)return[];const s=n.allow??[],a=n.baselineLockfile;if(s.length===0&&!a)return[];const r=a?K(t.workspaceRoot,a,t.packageManager):void 0,c=e.security?.acceptedRisks,i=[];for(const o of t.packages){const l=s.length===0||z(o.name,s),p=r?r.has(`${o.name}@${o.version}`):!0;if(l&&p)continue;const u=[],f={};l||(u.push(`not on allow-list (${s.length} entr${s.length===1?"y":"ies"})`),f.allowList=s),!p&&r&&(u.push(`not present in baseline lockfile (${a})`),f.baselineLockfile=a),i.push({acceptedRisk:d(o.name,o.version,c,"unexpectedDeps"),data:f,packageName:o.name,policy:"unexpectedDeps",reason:`${o.name}@${o.version} is unexpected: ${u.join("; ")}`,severity:"block",version:o.version})}return i},q=(t,e)=>{if(!t.osvFindings||t.osvFindings.size===0)return[];const n=e.security?.policies?.vulnerability?.failOn,s=e.security?.acceptedRisks,a=[];for(const r of t.packages){const c=t.osvFindings.get(r.name);if(!(!c||c.length===0))for(const i of c){const o=n?P(i.severity,n)?"block":"warn":"info";a.push({acceptedRisk:d(r.name,r.version,s,"vulnerability"),data:{advisoryId:i.id,aliases:i.aliases??[],cvssScore:i.cvssScore,fixedVersions:i.fixedVersions,severity:i.severity,summary:i.summary},packageName:r.name,policy:"vulnerability",reason:`${i.severity} ${i.id} affects ${r.name}@${r.version}: ${i.summary}`,severity:o,version:r.version})}}return a},S=[{evaluate:q,isConfigured:t=>t.security?.policies?.vulnerability!==void 0,name:"vulnerability",offlineSupported:!0,surfaces:["audit","doctor"]},{evaluate:V,isConfigured:t=>{const e=t.security?.policies?.license;return!!(e&&(e.allow&&e.allow.length>0||e.deny&&e.deny.length>0))},name:"license",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:O,isConfigured:t=>{const e=t.security?.policies?.installScripts;return!!(e&&(e.allow&&Object.keys(e.allow).length>0||e.strict===!0))},name:"installScripts",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:Y,isConfigured:t=>{const e=t.security?.policies?.unexpectedDeps;return!!(e&&(e.allow&&e.allow.length>0||typeof e.baselineLockfile=="string"))},name:"unexpectedDeps",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:x,isConfigured:t=>{const e=t.security?.policies?.firstSeen?.minutes;return typeof e=="number"&&e>0},name:"firstSeen",offlineSupported:!1,surfaces:["audit","doctor","install"]},{evaluate:H,isConfigured:t=>t.security?.policies?.publisherChange?.mode==="no-downgrade",name:"publisherChange",offlineSupported:!1,surfaces:["audit","doctor","install"]}],B=(t,e,n)=>S.filter(s=>s.surfaces.includes(t)?n!==void 0?n.has(s.name):s.isConfigured(e):!1),ie=async(t,e,n)=>{const s=B(e,n.visConfig,n.enabledPolicies),a=[];for(const r of s){if(t.offline&&!r.offlineSupported){a.push({packageName:"*",policy:r.name,reason:`policy.${r.name} skipped: requires network (--offline)`,severity:"info",version:"*"});continue}try{const c=await r.evaluate(t,n.visConfig);a.push(...c)}catch(c){const i=c instanceof Error?c.message:String(c);a.push({packageName:"*",policy:r.name,reason:`policy.${r.name} failed: ${i}`,severity:"info",version:"*"})}}return a},G=(()=>{const t=new Map;for(const e of b)t.set(e.toLowerCase(),e);return t})(),oe=()=>S.map(t=>t.name),re=(t,e)=>{if(t===void 0)return;const n=t.trim().toLowerCase();if(n===""||n==="none")return new Set;if(n==="all")return new Set(b);const s=new Set;for(const a of t.split(",").map(r=>r.trim()).filter(r=>r.length>0)){const r=a.replace(/^_+/,"").replaceAll(/_+([a-z])/g,(i,o)=>o.toUpperCase()),c=G.get(r.toLowerCase());c===void 0?e?.(a):s.add(c)}return s};export{se as c,ie as e,oe as g,re as p,P as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as a,m as h,B as l,I as f}from"./index-OQZQyN5R.js";import{i as d,s as $}from"../packem_chunks/cli-main.js";const g=/\/+$/,p=/node_modules/,u=/\.git/,k=/[$()+.?[\\\]^{|}]/g,S=/\/\*\*$|\/\*\/\*$/,W=(i,c)=>{const e=c.replace(g,"");if(e.startsWith("!"))return[];const n=[];if(e.endsWith("/*")){const s=e.slice(0,-2),t=l(i,s);if(!a(t))return[];for(const r of f(t,{includeFiles:!1,includeSymlinks:!1,maxDepth:1,skip:[p,u]}))r.path===t||r.name.startsWith(".")||n.push(h(s,r.name));return n}if(e.endsWith("/**")||e.endsWith("/*/*")){const s=e.replace(S,""),t=l(i,s);if(!a(t))return[];for(const r of f(t,{includeFiles:!1,includeSymlinks:!1,skip:[p,u]})){if(r.path===t)continue;const m=r.path.slice(t.length+1);n.push(`${s}/${m}`)}return n}if(!e.includes("/")&&e.includes("*")){const s=e.replaceAll(k,String.raw`\$&`).replaceAll("*",".*"),t=new RegExp(`^${s}$`);for(const r of f(i,{includeFiles:!1,includeSymlinks:!1,maxDepth:1,skip:[p,u]}))r.path!==i&&t.test(r.name)&&n.push(r.name);return n}const o=l(i,e);return a(o)&&n.push(e),n},y=i=>{const c=d(i)??$(i)??[],e=new Set,n=[];for(const o of c)for(const s of W(i,o))s==="."||e.has(s)||(e.add(s),a(h(i,s,"package.json"))||n.push({packageDir:s}));return n};export{y as l};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as w}from"node:module";import{s as l}from"./index-Cb4x6lWY.js";import{f as T,a as R,m as p}from"./index-OQZQyN5R.js";import{g as A,l as M}from"../packem_chunks/cli-main.js";import{a as P}from"./readJsonSync-CvkZyKmL-CY7PZob_.js";const k=w(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,s]=u.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return u.getBuiltinModule(t)}return k(t)},{rmSync:f,writeFileSync:j}=_("node:fs"),U=8,$=async(t,e,s)=>{if(t.length===0)return[];const o=Math.max(1,Math.min(e,t.length)),a=Array.from({length:t.length});let r=0;const i=async()=>{for(;r<t.length;){const n=r;r+=1;const c=t[n];a[n]=await s(c,n)}};return await Promise.all(Array.from({length:o},()=>i())),a},g=2,C=1800*1e3,S=15e3,v=()=>p(A(),"packuments"),y=t=>p(v(),`${encodeURIComponent(t)}.json`),D=t=>{const e=y(t);if(T(e))try{const s=P(e);if(s.cacheVersion!==g){f(e,{force:!0});return}if(Date.now()-s.createdAt>s.ttlMs){f(e,{force:!0});return}return s.packument}catch{f(e,{force:!0});return}},N=(t,e,s)=>{R(v());const o={cacheVersion:g,createdAt:Date.now(),packument:e,ttlMs:s};j(y(t),JSON.stringify(o),"utf8")},O=t=>{const e={},s=t.versions??{};for(const[a,r]of Object.entries(s)){const i=r.dist,n={version:a};if(r._npmUser!==void 0&&(n._npmUser=r._npmUser),r.maintainers!==void 0&&(n.maintainers=r.maintainers),r.bin!==void 0&&(n.bin=r.bin),i!==void 0){const c={};i.signatures!==void 0&&(c.signatures=i.signatures),i.attestations!==void 0&&(c.attestations=i.attestations),typeof i.integrity=="string"&&(c.integrity=i.integrity),typeof i.tarball=="string"&&(c.tarball=i.tarball),n.dist=c}r.repository!==void 0&&(n.repository=r.repository),r.license!==void 0&&(n.license=r.license),typeof r.readme=="string"&&(n.readme=r.readme),typeof r.readmeFilename=="string"&&(n.readmeFilename=r.readmeFilename),typeof r.private=="boolean"&&(n.private=r.private),typeof r.deprecated=="string"&&(n.deprecated=r.deprecated),r.scripts!==void 0&&typeof r.scripts=="object"&&(n.scripts=r.scripts),e[a]=n}const o={name:typeof t.name=="string"?t.name:"",versions:e};return t["dist-tags"]!==void 0&&(o["dist-tags"]=t["dist-tags"]),t.time!==void 0&&(o.time=t.time),typeof t.readme=="string"&&(o.readme=t.readme),o},E=t=>{const e={Accept:"application/json"};return t!==void 0&&t!==""&&(e.Authorization=`Bearer ${t}`),e},F=async(t,e)=>{if(e.registryUrl!==void 0)return{authToken:e.authToken,url:e.registryUrl};if(e.workspaceRoot!==void 0){const{getRegistryForPackage:s,loadNpmrc:o}=await import("../packem_chunks/cli-main.js").then(n=>n.bq),a=o(e.workspaceRoot),{token:r,url:i}=s(t,a);return{authToken:e.authToken??r,url:i}}return{authToken:e.authToken,url:"https://registry.npmjs.org"}},V=async(t,e={})=>{const s=e.cacheTtlMs??C,o=D(t);if(o!==void 0)return o;const a=await F(t,e),r=`${a.url.endsWith("/")?a.url.slice(0,-1):a.url}/${t.replace("/","%2f")}`,i=new AbortController,n=setTimeout(()=>{i.abort()},S),c=()=>{i.abort()};e.signal?.addEventListener("abort",c,{once:!0});try{const d=await fetch(r,{headers:E(a.authToken),signal:i.signal});if(d.status===404)return;if(!d.ok)throw new Error(`Registry returned ${String(d.status)} for ${t}`);const b=await d.json(),m=O(b);return N(t,m,s),m}finally{clearTimeout(n),e.signal?.removeEventListener("abort",c)}},H=(t,e)=>{const s=Object.keys(t.versions);if(s.length===0)return;if(e===void 0||e===""||e==="latest")return t["dist-tags"]?.latest??s.at(-1);const o=t["dist-tags"]?.[e];return o!==void 0?o:Object.hasOwn(t.versions,e)?e:l.maxSatisfying(s,e)??void 0},h=(t,e)=>t.versions[e]?.dist?.attestations?.provenance!==void 0,L=(t,e)=>l.valid(e)?Object.keys(t.versions).filter(s=>l.valid(s)!==null&&l.lt(s,e)).filter(s=>l.satisfies(s,"*",{includePrerelease:!1})).filter(s=>h(t,s)).sort((s,o)=>l.lt(s,o)?1:-1)[0]:void 0,I=async(t,e={})=>{if(M("provenance"))return[];const s=new Set(e.allowlist),o=e.concurrency??U;return(await $(t,o,async({name:a,version:r})=>{if(s.has(a))return;const i=await V(a,{workspaceRoot:e.workspaceRoot});if(i===void 0||h(i,r))return;const n=L(i,r);if(n!==void 0)return{packageName:a,priorVersionWithProvenance:n,version:r}})).filter(a=>a!==void 0)};export{U as D,H as a,L as f,V as g,$ as m,I as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as g}from"node:module";import{f as l,m,a as v}from"./index-OQZQyN5R.js";import{g as b}from"../packem_chunks/cli-main.js";import{a as j}from"./readJsonSync-CvkZyKmL-CY7PZob_.js";const h=g(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,r]=o.versions.node.split(".").map(Number);if(t>22||t===22&&r>=3||t===20&&r>=16)return o.getBuiltinModule(e)}return h(e)},{rmSync:u,writeFileSync:k}=_("node:fs"),C=1440*60*1e3,R=15e3,w="https://registry.npmjs.org/-/npm/v1/keys",p=()=>m(b(),"registry-keys"),i=()=>m(p(),"npmjs.json"),A=()=>{const e=i();if(l(e))try{const t=j(e),r=Date.now()-t.createdAt>t.ttlMs;return{entry:t,expired:r}}catch{u(e,{force:!0});return}},M=(e,t)=>{v(p());const r={createdAt:Date.now(),keys:e,ttlMs:t};k(i(),JSON.stringify(r),"utf8")},q=async(e={})=>{const t=e.ttlMs??C,r=e.keysUrl??process.env.VIS_NPM_KEYS_URL??w,s=A();if(s!==void 0&&!s.expired&&e.forceRefresh!==!0)return{fromCache:!0,keys:s.entry.keys};const n=new AbortController,d=setTimeout(()=>{n.abort()},R),a=()=>{n.abort()};e.signal?.addEventListener("abort",a,{once:!0});try{const c=await fetch(r,{headers:{Accept:"application/json"},signal:n.signal});if(!c.ok)return s!==void 0?{fromCache:!0,keys:s.entry.keys,stale:!0}:void 0;const y=await c.json(),f=Array.isArray(y.keys)?y.keys:[];return M(f,t),{fromCache:!1,keys:f}}catch{return s!==void 0?{fromCache:!0,keys:s.entry.keys,stale:!0}:void 0}finally{clearTimeout(d),e.signal?.removeEventListener("abort",a)}},x=()=>{const e=i();return l(e)?(u(e,{force:!0}),!0):!1};export{x as c,q as f};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{createRequire as D}from"node:module";import{I as A}from"./bin-CnDBuLh3.js";import{h as S,M as C,r as P,a as E,b as x,c as _,d as j,e as V,f as L}from"./s1ngularity-Du1NnSFP.js";import{m as g,g as w,D as h,r as I}from"./provenance-C0P-UYOM.js";import{l as $,p as u}from"../packem_chunks/cli-main.js";import{r as O}from"./signatures-BOUhghTv.js";import{s as B}from"./index-Cb4x6lWY.js";import{f as W}from"./utils-Cxree603.js";const R=D(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,M=e=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[a,r]=m.versions.node.split(".").map(Number);if(a>22||a===22&&r>=3||a===20&&r>=16)return m.getBuiltinModule(e)}return R(e)},{createInterface:T}=M("node:readline"),U=15,Y=e=>{if(e===void 0)return!1;const a=e.trim().toLowerCase();return a!==""&&a!=="0"&&a!=="false"&&a!=="no"},q=e=>{const a=(e.TERM??"").toLowerCase();return a!=="dumb"&&a!=="unknown"&&a!==""},F=async e=>{const a=T({input:process.stdin,output:process.stdout});try{return await new Promise(r=>{a.question(e,s=>{r(s.trim().toLowerCase())})})}finally{a.close()}},f=async(e,a)=>{const r=await a(e);return r==="y"||r==="yes"},H=async(e,a,r,s)=>new Promise(c=>{if(s?.aborted){c(!1);return}const o=q(r)&&a.isTTY!==!1;let n=e;const i=()=>{o?a.write(`\rContinuing in ${String(n)}s... press Ctrl-C to abort. `):n===e&&a.write(`Warnings present; proceeding in ${String(e)}s.
|
|
2
|
-
`)};i();const d=setInterval(()=>{if(n-=1,n<=0){clearInterval(d),s?.removeEventListener("abort",l),o&&a.write(`\rContinuing now.
|
|
3
|
-
`),c(!0);return}i()},1e3),l=()=>{clearInterval(d),o&&a.write(`\rAborted.
|
|
4
|
-
`),c(!1)};s?.addEventListener("abort",l,{once:!0})}),G=async(e,a={})=>{if(e.length===0)return{proceed:!0};const r=a.env??process.env,s=a.isTty??!!process.stdin.isTTY,c=a.isCi??A,o=a.strict??!1,n=a.readline??F,i=a.output??{isTTY:!!process.stdout.isTTY,write:p=>process.stdout.write(p)},d=Y(r.VIS_DISABLE_AUTO_CONTINUE),l=Number.parseInt(r.VIS_AUTO_CONTINUE_SECONDS??"",10),t=a.countdownSeconds??(Number.isFinite(l)&&l>0?l:U);return e.some(p=>p.severity==="error")?o?{proceed:!1,reason:"errors-present"}:c?{proceed:!1,reason:"errors-present"}:s?await f("Proceed despite errors? [y/N] ",n)?{proceed:!0}:{proceed:!1,reason:"user-aborted"}:{proceed:!1,reason:"non-tty"}:o?{proceed:!1,reason:"ci-strict"}:s?d?await f("Proceed despite warnings? [y/N] ",n)?{proceed:!0}:{proceed:!1,reason:"user-aborted"}:await H(t,i,r,a.signal)?{proceed:!0}:{proceed:!1,reason:"user-aborted"}:{proceed:!0}},De=async(e,a={})=>{if(e.isEmpty())return!0;const r=e.all(),s=a.output??{isTTY:!!process.stdout.isTTY,write:c=>process.stdout.write(c)};for(const c of S(r))s.write(`${c}
|
|
5
|
-
`);return(await G(r,{countdownSeconds:a.countdownSeconds,isCi:a.isCi,isTty:a.isTty,output:s,readline:a.readline,signal:a.signal,strict:a.strict})).proceed},v=300,z=e=>{const a=e.replaceAll(new RegExp("\\p{Cc}","gu")," ").replaceAll(/\s+/gu," ").trim();return a.length>v?`${a.slice(0,v-1)}…`:a},J=e=>{const a=e["dist-tags"]?.latest;return a!==void 0&&Object.hasOwn(e.versions,a)?a:Object.keys(e.versions).at(-1)},K=async(e,a={})=>{if($("deprecation"))return[];const r=new Set(a.allowlist),s=a.concurrency??h;return(await g(e,s,async({name:c,version:o})=>{if(r.has(c))return;const n=await w(c,{workspaceRoot:a.workspaceRoot});if(n===void 0)return;const i=Object.hasOwn(n.versions,o)?o:J(n);if(i===void 0)return;const d=n.versions[i];if(d===void 0)return;const l=typeof d.deprecated=="string"?z(d.deprecated):"";if(l!=="")return{packageName:c,reason:l,version:i}})).filter(c=>c!==void 0)},k={newPackageDays:22,unmaintainedDays:365},b=1440*60*1e3,y=e=>{if(e===void 0)return;const a=Date.parse(e);return Number.isNaN(a)?void 0:a},N=e=>{const a=e.time??{};return Object.entries(a).filter(([r])=>r!=="created"&&r!=="modified").map(([,r])=>y(r)).filter(r=>r!==void 0)},Q=e=>{const a=y(e.time?.created);if(a!==void 0)return a;const r=N(e);return r.length>0?Math.min(...r):void 0},X=e=>{const a=y(e.time?.modified);if(a!==void 0)return a;const r=N(e);return r.length>0?Math.max(...r):void 0},Z=async(e,a={})=>{if($("packageAge"))return[];const r=new Set(a.allowlist),s=a.concurrency??h,c=(a.now??Date.now)(),o=a.thresholds?.newPackageDays??k.newPackageDays,n=a.thresholds?.unmaintainedDays??k.unmaintainedDays;return(await g(e,s,async({name:i})=>{if(r.has(i))return;const d=await w(i,{workspaceRoot:a.workspaceRoot});if(d===void 0)return;const l=Q(d);if(l!==void 0){const p=(c-l)/b;if(p<o)return{days:Math.max(0,Math.floor(p)),kind:"new-package",packageName:i,severity:"error"}}const t=X(d);if(t!==void 0){const p=(c-t)/b;if(p>n)return{days:Math.floor(p),kind:"unmaintained",packageName:i,severity:"warning"}}})).filter(i=>i!==void 0)},ee=e=>({marshall:"author",message:e.message,packageName:e.packageName,severity:e.severity}),ae=e=>({marshall:"provenance",message:`Prior version ${e.priorVersionWithProvenance} had provenance but ${e.version} does not.`,packageName:e.packageName,severity:"error",suggestedAction:`Investigate why ${e.version} dropped sigstore attestations.`}),se=e=>{const a=e.hookChanges.map(r=>`${r.hook} (${r.kind})`).join(", ");return{marshall:"s1ngularity",message:`${e.version} ${e.hookChanges.length===1?"has an":"has"} install-script ${e.hookChanges.length===1?"change":"changes"} [${a}] AND dropped the provenance attestation that ${e.priorVersion} carried — this is the s1ngularity compromised-publish shape.`,packageName:e.packageName,severity:"error",suggestedAction:`Do not install ${e.packageName}@${e.version}. Verify the publish against the project's release CI; pin to ${e.priorVersion} until confirmed. Allowlist via security.marshalls.s1ngularity.allowlist only if the conjunction is explained.`}},re=e=>({marshall:"deprecation",message:`${e.packageName}@${e.version} is deprecated: ${e.reason}`,packageName:e.packageName,severity:"error",suggestedAction:`Migrate off ${e.packageName} or add it to security.marshalls.deprecation.allowlist if the deprecation is acceptable.`}),ne=e=>({marshall:"packageAge",message:e.kind==="new-package"?`Package first published ${String(e.days)} day${e.days===1?"":"s"} ago — brand-new package names are a common typosquat/dependency-confusion signature.`:`No new release in ${String(e.days)} days — package may be unmaintained.`,packageName:e.packageName,severity:e.severity}),te=e=>{const a=e.newBins.map(r=>r.command).join(", ");return{marshall:"newBin",message:`${e.toVersion} adds new bin script${e.newBins.length===1?"":"s"}: ${a} (prior: ${e.fromVersion}).`,packageName:e.packageName,severity:"warning"}},oe=e=>({marshall:"metadata",message:`Missing/invalid metadata: ${e.issues.join(", ")}.`,packageName:e.packageName,severity:"warning"}),ie=e=>e.kind==="no-data"?{marshall:"downloads",message:"npm stats API returned no monthly download data.",packageName:e.packageName,severity:e.severity}:{marshall:"downloads",message:`Only ${String(e.downloadsLastMonth??0)} downloads in the past month.`,packageName:e.packageName,severity:e.severity},ce=e=>({marshall:"expiredDomains",message:e.kind==="expired"?`Maintainer email domain ${e.domain} (${e.maintainer}) is unregistered — potential hijack risk.`:`Could not verify maintainer email domain ${e.domain} (${e.maintainer}).`,packageName:e.packageName,severity:e.severity}),le=e=>({marshall:"signatures",message:e.message,packageName:e.packageName,severity:e.severity}),de=e=>({marshall:"archivedRepo",message:e.kind==="archived"?`Source repo ${e.owner}/${e.repo} is archived${e.archivedAt===void 0?"":` (since ${e.archivedAt})`}.`:`Source repo ${e.owner}/${e.repo} returned 404 from GitHub.`,packageName:e.packageName,severity:"warning"}),pe=["author","provenance","s1ngularity","newBin","metadata","deprecation","packageAge","expiredDomains","signatures","archivedRepo"],me=e=>pe.some(a=>a==="signatures"?e.signatures?.enabled===!0:e[a]?.enabled!==!1),ue=async(e,a,r,s)=>{const c=[...new Set(e.map(o=>o.name))];await g(c,a,async o=>{try{await w(o,{signal:s,workspaceRoot:r})}catch{}})},Re=async(e,a={})=>{const r=new C;if(e.length===0)return r;const s=a.config??{},c=e.map(t=>t.name),o=a.signal,n=a.concurrency??h;me(s)&&await ue(e,n,a.workspaceRoot,o);const i=[],d=[],l=t=>{const p=i.length;i.push([]),d.push((async()=>{try{i[p]=await t()}catch{}})())};s.author?.enabled!==!1&&l(async()=>(await P(e,{allowlist:s.author?.allowlist,concurrency:n,signal:o,thresholds:{dormantErrorDays:s.author?.dormantErrorDays,dormantWarnDays:s.author?.dormantWarnDays,newPublisherWindowDays:s.author?.newPublisherWindowDays,recentVersionErrorDays:s.author?.recentVersionErrorDays,recentVersionWarnDays:s.author?.recentVersionWarnDays},workspaceRoot:a.workspaceRoot})).map(t=>ee(t))),s.provenance?.enabled!==!1&&l(async()=>(await I(e,{allowlist:s.provenance?.allowlist,concurrency:n,workspaceRoot:a.workspaceRoot})).map(t=>ae(t))),s.s1ngularity?.enabled!==!1&&l(async()=>(await E(e,{allowlist:s.s1ngularity?.allowlist,concurrency:n,workspaceRoot:a.workspaceRoot})).map(t=>se(t))),s.newBin?.enabled!==!1&&l(async()=>(await x(e,{allowlist:s.newBin?.allowlist,concurrency:n,workspaceRoot:a.workspaceRoot})).map(t=>te(t))),s.metadata?.enabled!==!1&&l(async()=>(await _(e,{allowlist:s.metadata?.allowlist,checks:s.metadata?.checks,concurrency:n,workspaceRoot:a.workspaceRoot})).map(t=>oe(t))),s.deprecation?.enabled!==!1&&l(async()=>(await K(e,{allowlist:s.deprecation?.allowlist,concurrency:n,workspaceRoot:a.workspaceRoot})).map(t=>re(t))),s.packageAge?.enabled!==!1&&l(async()=>(await Z(e,{allowlist:s.packageAge?.allowlist,concurrency:n,thresholds:{newPackageDays:s.packageAge?.newPackageDays,unmaintainedDays:s.packageAge?.unmaintainedDays},workspaceRoot:a.workspaceRoot})).map(t=>ne(t))),s.downloads?.enabled!==!1&&l(async()=>(await j(c,{allowlist:s.downloads?.allowlist,concurrency:n,errorThreshold:s.downloads?.errorThreshold,signal:o,warnThreshold:s.downloads?.warnThreshold})).map(t=>ie(t))),s.expiredDomains?.enabled!==!1&&l(async()=>(await V(e,{allowDomains:s.expiredDomains?.allowDomains,allowlist:s.expiredDomains?.allowlist,concurrency:n,dnsServers:s.expiredDomains?.dnsServers,perDomainTimeoutMs:s.expiredDomains?.timeoutMs,signal:o,workspaceRoot:a.workspaceRoot})).map(t=>ce(t))),s.signatures?.enabled===!0&&l(async()=>(await O(e,{allowlist:s.signatures?.allowlist,concurrency:n,keysUrl:s.signatures?.keysUrl,signal:o,treatExpiredAs:s.signatures?.treatExpiredAs,workspaceRoot:a.workspaceRoot})).map(t=>le(t))),s.archivedRepo?.enabled!==!1&&l(async()=>(await L(e,{allowlist:s.archivedRepo?.allowlist,concurrency:n,githubToken:s.archivedRepo?.githubToken,signal:o,workspaceRoot:a.workspaceRoot})).map(t=>de(t))),await Promise.all(d);for(const t of i)r.addMany(t);return r},ge=1e4,we=async(e,a=ge)=>{const r=new Map;if(e.length===0)return r;const s=new AbortController,c=setTimeout(()=>{s.abort()},a);try{await Promise.all(e.map(async o=>{try{const n=await fetch(`https://registry.npmjs.org/${o}/latest`,{headers:{Accept:"application/json"},signal:s.signal});if(n.ok){const i=await n.json();i.version?r.set(o,i.version):u.debug(`resolveLatestVersions: ${o} returned 200 but no version field; dropping.`)}else u.debug(`resolveLatestVersions: ${o} returned ${String(n.status)}; dropping.`)}catch(n){u.debug(`resolveLatestVersions: ${o} fetch failed (${n instanceof Error?n.message:String(n)}); dropping.`)}}))}finally{clearTimeout(c)}return r},Me=async e=>{const a=e.map(n=>W(n)),r=new Map;for(const n of a)if(n.versionSpec){const i=B.coerce(n.versionSpec);i&&r.set(n.name,i.version)}const s=a.filter(n=>!r.has(n.name)).map(n=>n.name),c=await we(s),o=[];for(const n of a){const i=r.get(n.name)??c.get(n.name);i?o.push({name:n.name,version:i}):u.debug(`resolveExplicitPackages: dropping ${n.name}${n.versionSpec?`@${n.versionSpec}`:""} — neither semver-coerce nor /latest resolved a version.`)}return o};export{Re as a,we as b,De as p,Me as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as K}from"node:module";import{V,s as A}from"./index.server-J83sowC4.js";import{f as _,a as j,m as $}from"./index-OQZQyN5R.js";import{l as p,g as x}from"../packem_chunks/cli-main.js";import{m as g,g as b,D as w}from"./provenance-C0P-UYOM.js";import{a as O}from"./readJsonSync-CvkZyKmL-CY7PZob_.js";import{s as v}from"./index-Cb4x6lWY.js";const X=K(import.meta.url),M=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,T=r=>{if(typeof M<"u"&&M.versions&&M.versions.node){const[e,t]=M.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return M.getBuiltinModule(r)}return X(r)},{rmSync:k,writeFileSync:E}=T("node:fs"),{createHash:Y}=T("node:crypto"),{Resolver:Q}=T("node:dns/promises");class Ke{entries=[];add(e){this.entries.push(e)}addMany(e){for(const t of e)this.entries.push(t)}all(){return this.entries}errors(){return this.entries.filter(e=>e.severity==="error")}warnings(){return this.entries.filter(e=>e.severity==="warning")}hasErrors(){return this.entries.some(e=>e.severity==="error")}hasWarnings(){return this.entries.some(e=>e.severity==="warning")}isEmpty(){return this.entries.length===0}size(){return this.entries.length}}const Xe=r=>{if(r.length===0)return[];const e=[],t=r.filter(s=>s.severity==="error"),n=r.filter(s=>s.severity==="warning");if(t.length>0){e.push(V(`${String(t.length)} error${t.length===1?"":"s"}:`));for(const s of t)e.push(` ${V("✗")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${A("→")} ${s.suggestedAction}`)}if(n.length>0){t.length>0&&e.push(""),e.push(A(`${String(n.length)} warning${n.length===1?"":"s"}:`));for(const s of n)e.push(` ${A("⚠")} [${s.marshall}] ${s.packageName}: ${s.message}`),s.suggestedAction!==void 0&&e.push(` ${A("→")} ${s.suggestedAction}`)}return e},Ye=r=>({errors:r.filter(e=>e.severity==="error"),findings:[...r],summary:{errorCount:r.filter(e=>e.severity==="error").length,warningCount:r.filter(e=>e.severity==="warning").length},warnings:r.filter(e=>e.severity==="warning")}),Z=1440*60*1e3,ee=15e3,re="https://api.github.com/repos",B=()=>$(x(),"archived-repo"),H=(r,e)=>$(B(),`${encodeURIComponent(r)}__${encodeURIComponent(e)}.json`),te=(r,e)=>{const t=H(r,e);if(_(t))try{const n=O(t);if(Date.now()-n.createdAt>n.ttlMs){k(t,{force:!0});return}return n}catch{k(t,{force:!0});return}},W=(r,e,t,n)=>{j(B());const s={createdAt:Date.now(),ttlMs:n,...t};E(H(r,e),JSON.stringify(s),"utf8")},ne=r=>{if(typeof r!="string"||r.trim()==="")return;const e=r.trim().replace(/^git\+/,""),t=/^git@github\.com:([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(e);if(t)return{owner:t[1],repo:t[2]};const n=/^ssh:\/\/git@github\.com\/([^/]+)\/(.+?)(?:\.git)?\/?$/i.exec(e);if(n)return{owner:n[1],repo:n[2]};const s=/^https?:\/\/(?:www\.)?github\.com\/([^/]+)\/([^/?#]+?)(?:\.git)?\/?$/i.exec(e);if(s)return{owner:s[1],repo:s[2]}},se=async(r,e,t,n)=>{const s=`${re}/${encodeURIComponent(r)}/${encodeURIComponent(e)}`,c=new AbortController,o=setTimeout(()=>{c.abort()},ee),i=()=>{c.abort()};n?.addEventListener("abort",i,{once:!0});const a={Accept:"application/vnd.github+json","User-Agent":"visulima-vis-marshall"};t!==void 0&&t!==""&&(a.Authorization=`Bearer ${t}`);try{const d=await fetch(s,{headers:a,signal:c.signal});if(d.status===404)return{kind:"missing"};if(!d.ok)return{kind:"transient-error"};const l=await d.json(),u=l.archived===!0,f=typeof l.archived_at=="string"?l.archived_at:void 0;return{archived:u,archivedAt:f,kind:"ok"}}catch{return{kind:"transient-error"}}finally{clearTimeout(o),n?.removeEventListener("abort",i)}},ie=(r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),Qe=async(r,e={})=>{if(p("archivedRepo"))return[];const t=new Set(e.allowlist),n=e.cacheTtlMs??Z,s=e.githubToken??process.env.GITHUB_TOKEN,c=e.concurrency??w,o=new Map,i=async(a,d)=>{const l=`${a}/${d}`;let u=o.get(l);return u===void 0&&(u=(async()=>{const f=te(a,d);if(f!==void 0)return f.missing===!0?{archived:!1,kind:"missing"}:{archived:f.archived,archivedAt:f.archivedAt,kind:"ok"};const m=await se(a,d,s,e.signal);return m.kind==="missing"?W(a,d,{archived:!1,missing:!0},n):m.kind==="ok"&&W(a,d,{archived:m.archived===!0,archivedAt:m.archivedAt},n),m})(),o.set(l,u)),u};return(await g(r,c,async({name:a,version:d})=>{if(t.has(a))return;const l=await b(a,{workspaceRoot:e.workspaceRoot});if(l===void 0)return;const u=l.versions[d]??l.versions[ie(Object.keys(l.versions),l["dist-tags"]?.latest)??""];if(u===void 0)return;const f=ne(u.repository?.url);if(f===void 0)return;const m=await i(f.owner,f.repo);if(m.kind!=="transient-error"){if(m.kind==="missing")return{kind:"missing-repo",owner:f.owner,packageName:a,repo:f.repo};if(m.archived===!0)return{...m.archivedAt===void 0?{}:{archivedAt:m.archivedAt},kind:"archived",owner:f.owner,packageName:a,repo:f.repo}}})).filter(a=>a!==void 0)},oe={dormantErrorDays:274,dormantWarnDays:183,newPublisherWindowDays:21,recentVersionErrorDays:7,recentVersionWarnDays:30},ae=1440*60*1e3,U=(r,e)=>(r-e)/ae,R=r=>{if(r!==void 0)return r.email??r.name},ce=(r,e,t,n,s)=>{const c=r.time?.[t];if(c===void 0)return;const o=new Date(c).getTime();if(!Number.isFinite(o))return;const i=U(n,o);if(i<s.recentVersionErrorDays)return{kind:"recent-version",message:`published ${i.toFixed(1)} days ago (error threshold: ${String(s.recentVersionErrorDays)})`,packageName:e,severity:"error",version:t};if(i<s.recentVersionWarnDays)return{kind:"recent-version",message:`published ${i.toFixed(1)} days ago (warn threshold: ${String(s.recentVersionWarnDays)})`,packageName:e,severity:"warning",version:t}},de=(r,e,t,n,s)=>{const c=r.versions[t],o=R(c?._npmUser);if(o===void 0)return;const i=Object.keys(r.versions).filter(u=>v.valid(u)!==null).filter(u=>v.lt(u,t));if(i.length===0||i.some(u=>R(r.versions[u]?._npmUser)===o))return;const a=r.time?.[i[0]??""];if(a===void 0)return;const d=new Date(a).getTime();if(!Number.isFinite(d))return;const l=U(n,d);if(!(l<=s.newPublisherWindowDays))return{kind:"new-publisher",message:`first publish by ${o} on a ${l.toFixed(0)}-day-old package`,packageName:e,severity:"error",version:t}},le=(r,e,t,n,s)=>{const c=r.versions[t],o=R(c?._npmUser);if(o===void 0)return;const i=[];for(const[l,u]of Object.entries(r.versions)){if(l===t||R(u._npmUser)!==o)continue;const f=r.time?.[l];if(f===void 0)continue;const m=new Date(f).getTime();Number.isFinite(m)&&i.push(m)}if(i.length===0)return;const a=Math.max(...i),d=U(n,a);if(d>=s.dormantErrorDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${d.toFixed(0)} days ago (error threshold: ${String(s.dormantErrorDays)})`,packageName:e,severity:"error",version:t};if(d>=s.dormantWarnDays)return{kind:"dormant-maintainer",message:`previous release by ${o} was ${d.toFixed(0)} days ago (warn threshold: ${String(s.dormantWarnDays)})`,packageName:e,severity:"warning",version:t}},Ze=async(r,e={})=>{if(p("author"))return[];const t=new Set(e.allowlist),n={...oe,...e.thresholds},s=e.now??(()=>Date.now()),c=e.concurrency??w;return(await g(r,c,async({name:o,version:i})=>{if(t.has(o))return[];const a=await b(o,{cacheTtlMs:e.cacheTtlMs,signal:e.signal,workspaceRoot:e.workspaceRoot});if(a===void 0)return[];const d=s(),l=[],u=ce(a,o,i,d,n);u!==void 0&&l.push(u);const f=de(a,o,i,d,n);f!==void 0&&l.push(f);const m=le(a,o,i,d,n);return m!==void 0&&l.push(m),l})).flat()},ue=1440*60*1e3,fe=15e3,me=20,he=1e4,ve="https://api.npmjs.org/downloads/point/last-month",J=()=>$(x(),"downloads"),q=r=>$(J(),`${encodeURIComponent(r)}.json`),pe=r=>{const e=q(r);if(_(e))try{const t=O(e);if(Date.now()-t.createdAt>t.ttlMs){k(e,{force:!0});return}return t.downloads}catch{k(e,{force:!0});return}},ge=(r,e,t)=>{j(J());const n={createdAt:Date.now(),downloads:e,observedAt:new Date().toISOString(),ttlMs:t};E(q(r),JSON.stringify(n),"utf8")},we=async(r,e)=>{const t=`${ve}/${encodeURIComponent(r)}`,n=new AbortController,s=setTimeout(()=>{n.abort()},fe),c=()=>{n.abort()};e?.addEventListener("abort",c,{once:!0});try{const o=await fetch(t,{signal:n.signal});if(o.status===404)return{kind:"no-data"};if(!o.ok)return{kind:"error"};const i=await o.json();return typeof i.downloads=="number"?{downloads:i.downloads,kind:"ok"}:{kind:"no-data"}}catch{return{kind:"error"}}finally{clearTimeout(s),e?.removeEventListener("abort",c)}},er=async(r,e={})=>{if(p("downloads"))return[];const t=new Set(e.allowlist),n=e.errorThreshold??me,s=e.warnThreshold??he,c=e.cacheTtlMs??ue,o=e.concurrency??w;return(await g(r,o,async i=>{if(t.has(i))return;let a=pe(i);if(a===void 0){const d=await we(i,e.signal);if(d.kind==="no-data"||d.kind==="error")return{downloadsLastMonth:void 0,kind:"no-data",packageName:i,severity:"warning"};a=d.downloads??0,ge(i,a,c)}if(a<n)return{downloadsLastMonth:a,kind:"below-error",packageName:i,severity:"error"};if(a<s)return{downloadsLastMonth:a,kind:"below-warning",packageName:i,severity:"warning"}})).filter(i=>i!==void 0)},ye=1440*60*1e3,ke=4e3,$e=["1.1.1.1","8.8.8.8"],z=()=>$(x(),"expired-domains"),G=r=>{const e=Y("sha256").update(r).digest("hex").slice(0,12);return $(z(),`${e}.json`)},be=r=>{const e=G(r);if(_(e))try{const t=O(e);if(Date.now()-t.createdAt>t.ttlMs){k(e,{force:!0});return}return t}catch{k(e,{force:!0});return}},Me=(r,e,t)=>{j(z());const n={createdAt:Date.now(),outcome:e,ttlMs:t};E(G(r),JSON.stringify(n),"utf8")},De=r=>{if(typeof r!="string")return;const e=r.lastIndexOf("@");if(e===-1||e===r.length-1)return;const t=r.slice(e+1).trim().toLowerCase();return t===""?void 0:t},Ae=(r,e)=>{const t=[];e!==void 0&&t.push(e);for(const n of r??[])t.push(n);return t},Re=async(r,e)=>{let t;try{return await Promise.race([r,new Promise((n,s)=>{t=setTimeout(()=>{s(new Error("ETIMEDOUT"))},e)})])}finally{t!==void 0&&clearTimeout(t)}},Ne=r=>{if(r===null||typeof r!="object")return!1;const{code:e}=r;return e==="ENOTFOUND"||e==="ENODATA"||e==="NXDOMAIN"},Se=async(r,e,t)=>{try{const n=await Re(r.resolveNs(e),t);return Array.isArray(n)&&n.length>0?{kind:"ok"}:{kind:"expired"}}catch(n){return Ne(n)?{kind:"expired"}:{kind:"transient-error"}}},Te=(r,e)=>e!==void 0&&r.includes(e)?e:r.at(-1),rr=async(r,e={})=>{if(p("expiredDomains"))return[];const t=new Set(e.allowlist),n=new Set((e.allowDomains??[]).map(u=>u.toLowerCase())),s=e.cacheTtlMs??ye,c=e.perDomainTimeoutMs??ke,o=e.dnsServers??$e,i=e.concurrency??w,a=e.createResolver===void 0?new Q:e.createResolver();typeof a.setServers=="function"&&a.setServers(o);const d=new Map,l=async u=>{let f=d.get(u);return f===void 0&&(f=(async()=>{const m=be(u);if(m!==void 0)return{kind:m.outcome==="ok"?"ok":"expired"};const h=await Se(a,u,c);return h.kind!=="transient-error"&&Me(u,h.kind,s),h})(),d.set(u,f)),f};return(await g(r,i,async({name:u,version:f})=>{if(t.has(u))return[];const m=await b(u,{workspaceRoot:e.workspaceRoot});if(m===void 0)return[];const h=m.versions[f]??m.versions[Te(Object.keys(m.versions),m["dist-tags"]?.latest)??""];if(h===void 0)return[];const N=Ae(h.maintainers,h._npmUser),C=new Set,S=[];for(const D of N){const y=De(D.email);if(y===void 0||n.has(y))continue;const F=`${y}:${D.email??""}`;if(C.has(F))continue;C.add(F);const L=await l(y);L.kind==="expired"?S.push({domain:y,kind:"expired",maintainer:D.email??"",packageName:u,severity:"error"}):L.kind==="transient-error"&&S.push({domain:y,kind:"unresolved",maintainer:D.email??"",packageName:u,severity:"warning"})}return S})).flat()},Ee=["readme","license","repo"],_e=["ERROR: No README data found!","# Security holding package"],je=r=>{const e=r.trim();return e===""?!0:_e.some(t=>e.startsWith(t))},xe=(r,e)=>{if(typeof e.readme=="string")return e.readme;if(typeof r.readme=="string")return r.readme},Oe=(r,e)=>{const t=xe(r,e);if(t===void 0)return"missing-readme";if(je(t))return"placeholder-readme"},Ue=r=>{const{license:e}=r;return e===void 0?"missing-license":typeof e=="string"?e.trim()===""?"missing-license":void 0:typeof e.type=="string"&&e.type.trim()!==""?void 0:"missing-license"},Ce=r=>{const{repository:e}=r;if(e===void 0)return"missing-repo";const t=typeof e.url=="string"?e.url.trim():"";if(t==="")return"missing-repo";let n=t.replace(/^git\+/,"");const s=/^git@([^:]+):(.+?)(?:\.git)?$/.exec(n);return s&&(n=`https://${s[1]}/${s[2]}`),URL.canParse(n)?void 0:"invalid-repo-url"},Fe=r=>{const e=r["dist-tags"]?.latest;return e!==void 0&&Object.hasOwn(r.versions,e)?e:Object.keys(r.versions).at(-1)},tr=async(r,e={})=>{if(p("metadata"))return[];const t=new Set(e.allowlist),n=new Set(e.checks??Ee),s=e.concurrency??w;return(await g(r,s,async({name:c,version:o})=>{if(t.has(c))return;const i=await b(c,{workspaceRoot:e.workspaceRoot});if(i===void 0)return;const a=i.versions[o]??i.versions[Fe(i)??""];if(a===void 0||a.private===!0)return;const d=[];if(n.has("readme")){const l=Oe(i,a);l!==void 0&&d.push(l)}if(n.has("license")){const l=Ue(a);l!==void 0&&d.push(l)}if(n.has("repo")){const l=Ce(a);l!==void 0&&d.push(l)}if(d.length!==0)return{issues:d,packageName:c,version:o}})).filter(c=>c!==void 0)},I=(r,e)=>r===void 0?{}:typeof r=="string"?{[e.startsWith("@")?e.split("/").at(1)??e:e]:r}:{...r},Le=(r,e)=>v.valid(e)?Object.keys(r.versions).filter(t=>v.valid(t)!==null&&v.lt(t,e)).sort((t,n)=>v.lt(t,n)?1:-1)[0]:void 0,nr=async(r,e={})=>{if(p("newBin"))return[];const t=new Set(e.allowlist),n=new Set(e.allowBins),s=e.concurrency??w;return(await g(r,s,async({name:c,version:o})=>{if(t.has(c))return;const i=await b(c,{workspaceRoot:e.workspaceRoot});if(i===void 0)return;const a=i.versions[o];if(a===void 0)return;const d=Le(i,o);if(d===void 0)return;const l=i.versions[d];if(l===void 0)return;const u=I(a.bin,c),f=I(l.bin,c),m=Object.entries(u).filter(([h])=>!(h in f)).filter(([h])=>!n.has(h)).map(([h,N])=>({command:N,name:h}));if(m.length!==0)return{fromVersion:d,newBins:m,packageName:c,toVersion:o}})).filter(c=>c!==void 0)},Ve=["preinstall","install","postinstall"],P=(r,e)=>r.versions[e]?.dist?.attestations?.provenance!==void 0,We=(r,e)=>{if(v.valid(e)!==null)return Object.keys(r.versions).filter(t=>v.valid(t)!==null&&v.prerelease(t)===null&&v.lt(t,e)).sort((t,n)=>v.lt(t,n)?1:-1)[0]},Ie=(r,e)=>{const t=r??{},n=e??{},s=[];for(const c of Ve){const o=t[c];if(o===void 0||o==="")continue;const i=n[c];i===void 0||i===""?s.push({command:o,hook:c,kind:"introduced"}):i!==o&&s.push({command:o,hook:c,kind:"changed"})}return s},sr=async(r,e={})=>{if(p("s1ngularity"))return[];const t=new Set(e.allowlist),n=e.concurrency??w;return(await g(r,n,async({name:s,version:c})=>{if(t.has(s))return;const o=await b(s,{workspaceRoot:e.workspaceRoot});if(o?.versions[c]===void 0)return;const i=We(o,c);if(i===void 0||!P(o,i)||P(o,c))return;const a=Ie(o.versions[c]?.scripts,o.versions[i]?.scripts);if(a.length!==0)return{hookChanges:a,packageName:s,priorVersion:i,trustSignal:"provenance-dropped",version:c}})).filter(s=>s!==void 0)};export{Ke as M,sr as a,nr as b,tr as c,er as d,rr as e,Qe as f,Ye as g,Xe as h,Ze as r};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{createRequire as _}from"node:module";import{E as f,s as y,I as $,V as T}from"./index.server-J83sowC4.js";import{a1 as r,a2 as l,m as a,$ as k,d as j,a3 as u}from"../packem_chunks/cli-main.js";import{I as v}from"./bin-CnDBuLh3.js";import{o as C}from"./spinner-lhXugSx3.js";import{D as x,W as R,T as S,C as I}from"./symbols-DPTlrJ3B.js";const B=_(import.meta.url),D=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const b=({rows:i})=>r.jsx(l,{flexDirection:"column",children:i.map(t=>{let s;switch(t.status){case"error":{s=r.jsx(a,{color:"red",children:I});break}case"ok":{s=r.jsx(a,{color:"green",children:S});break}case"running":{s=r.jsx(a,{color:"white",children:r.jsx(C,{type:"dots"})});break}case"warn":{s=r.jsx(a,{color:"yellow",children:R});break}default:{s=r.jsx(a,{dimColor:!0,children:x});break}}return r.jsxs(l,{children:[r.jsx(l,{width:3,children:s}),r.jsx(l,{flexGrow:1,children:r.jsx(a,{children:t.label})}),t.summary?r.jsx(l,{children:r.jsxs(a,{dimColor:!0,children:[x," ",t.summary]})}):null]},t.id)})}),E={error:T(u.failure),ok:$(u.success),pending:f(u.dash),skip:f(u.dash),warn:y(u.warning)},M=(i,t,s)=>{const p=s?`${i} ${f(`— ${s}`)}`:i;return` ${E[t]} ${p}
|
|
2
|
-
`},O=(i,t={})=>{const s=t.stream??process.stderr,p=typeof s.isTTY=="boolean"&&s.isTTY&&!v,w=t.live??p,o=new Map;for(const e of i)o.set(e.id,{id:e.id,label:e.label,status:"pending"});if(!w||i.length===0)return{finish:(e,n,m)=>{const c=o.get(e);c&&(o.set(e,{...c,status:n,summary:m}),s.write(M(c.label,n,m)))},start:e=>{const n=o.get(e);n&&o.set(e,{...n,status:"running"})},stop:()=>{}};const g=()=>i.map(e=>o.get(e.id));let d=k(j.createElement(b,{rows:g()}),{interactive:!0,patchConsole:!1});const h=()=>{d?.rerender(j.createElement(b,{rows:g()}))};return{finish:(e,n,m)=>{const c=o.get(e);c&&(o.set(e,{...c,status:n,summary:m}),h())},start:e=>{const n=o.get(e);n&&(o.set(e,{...n,status:"running"}),h())},stop:()=>{d&&(h(),d.unmount(),d=void 0)}}};export{O as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,a4 as C,a1 as S,m as T}from"../packem_chunks/cli-main.js";import{V as y}from"./MultiSpinner-B9U0-aE3-B-gIXhFk.js";const A=100,j=2147483647,l={delta:0,frame:0,time:0};function k(s){const{interval:i=A,isActive:e=!0}=s??{},t=L(i),{renderThrottleMs:c,subscribe:v}=r.useContext(C),[n,E]=r.useState(0),[I,h]=r.useState(l),o=r.useRef(0),f=r.useRef(0),x=r.useRef({isActive:e,resetKey:n,safeInterval:t}),m=x.current,K=e&&(t!==m.safeInterval||!m.isActive||n!==m.resetKey),b=r.useCallback(()=>{E(u=>u+1)},[]);return r.useLayoutEffect(()=>{if(!e)return;h(l);let u=0;const{startTime:d,unsubscribe:M}=v(a=>{if(c>0&&a<o.current)return;const p=a-u,R=a-f.current;f.current=a,o.current=a+c,h({delta:R,frame:Math.floor(p/t),time:p})},t);return u=d,f.current=d,o.current=u+c,M},[t,e,v,c,n]),r.useLayoutEffect(()=>{x.current={isActive:e,resetKey:n,safeInterval:t}},[e,t,n]),K?{...l,reset:b}:{...I,reset:b}}function L(s){return Number.isFinite(s)?Math.min(j,Math.max(1,s)):A}function D({type:s="dots"}){const i=y(s)??y("dots"),e=i?.frames??[" "],{frame:t}=k({interval:i?.interval??80});return S.jsx(T,{children:e[t%e.length]})}export{D as o};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a1 as u,r as n,ab as K,a2 as y,m as A}from"../packem_chunks/cli-main.js";function G({children:o}){return u.jsx(u.Fragment,{children:o})}const L=/^\d$/u,O=o=>o!=null&&typeof o=="object"&&"props"in o&&"name"in o.props,Y=o=>{const c=[];for(const t of n.Children.toArray(o))O(t)&&c.push(t);return c},V=(o,c)=>o.some(t=>c[t]),Z=(o,c,t)=>o?c?{backgroundColor:t?.activeTab?.backgroundColor??"green",color:t?.activeTab?.color??"black"}:{backgroundColor:"gray",color:"black"}:{backgroundColor:void 0,color:void 0};function P({children:o,colors:c,defaultValue:t,flexDirection:b="row",isFocused:x,keyMap:a,onChange:M,showIndex:q=!0,value:k,width:C}){const l=Y(o),s=l.length,m=n.useRef(l);m.current=l;const i=b==="column"||b==="column-reverse",g=k!==void 0,[z,B]=n.useState(()=>{const r=k??t;if(r==null||s===0)return 0;const e=l.findIndex(d=>d.props.name===r);return e===-1?0:e}),h=g?Math.max(0,l.findIndex(r=>r.props.name===k)):z,H=n.useCallback(()=>{},[]),p=g?H:B,f=n.useRef(M);f.current=M,n.useEffect(()=>{if(g)return;const r=m.current[h];r&&f.current(r.props.name,r)},[]);const R=n.useMemo(()=>a?.previous??[i?"upArrow":"leftArrow"],[a?.previous,i]),E=n.useMemo(()=>a?.next??[i?"downArrow":"rightArrow"],[a?.next,i]),I=a?.useNumbers??!0,D=a?.useTab??!0,v=n.useRef(h);v.current=h;const F=n.useCallback(r=>{p(r);const e=m.current[r];e&&f.current(e.props.name,e)},[p]),w=n.useCallback(()=>{const r=(v.current+1)%s;p(r);const e=m.current[r];e&&f.current(e.props.name,e)},[s,p]),j=n.useCallback(()=>{const r=(v.current-1+s)%s;p(r);const e=m.current[r];e&&f.current(e.props.name,e)},[s,p]);K(n.useCallback((r,e)=>{if(V(R,e)){j();return}if(V(E,e)){w();return}if(e.tab&&D&&x==null){e.shift?j():w();return}if(I&&e.meta&&L.test(r)){const d=r==="0"?9:Number.parseInt(r,10)-1;d<s&&F(d)}},[R,E,D,I,x,j,w,s,F]),{isActive:x!==!1});const N=typeof C=="number"?C:6,J=n.useMemo(()=>i?"─".repeat(N):" | ",[i,N]);return u.jsx(y,{flexDirection:b,width:C,children:l.map((r,e)=>{const{name:d}=r.props,S=Z(h===e,x!==!1,c);let T=null;return q&&(T=u.jsxs(A,{color:"grey",children:[e+1,"."," "]})),u.jsxs(y,{flexDirection:b,children:[e!==0&&u.jsx(A,{color:"dim",children:J}),u.jsxs(y,{children:[T,u.jsx(A,{backgroundColor:S.backgroundColor,color:S.color,children:r})]})]},d)})})}export{P as F,G as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as u}from"node:module";import{r as t,U as c}from"../packem_chunks/cli-main.js";import"./bin-CnDBuLh3.js";const f=u(import.meta.url),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const d=(o,i)=>{const r=t.useRef(null),[s,n]=t.useState(o);return t.useLayoutEffect(()=>{if(!r.current)return;const{height:e}=c(r.current);e>0&&e!==s&&(n(e),i?.(e))}),{measuredHeight:s,ref:r}};export{d as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aA as ae,a1 as e,a2 as l,m as r,aB as je,B as ue,aC as ge,aD as me,r as g,ab as fe,aE as _,aF as ne}from"../packem_chunks/cli-main.js";import{o as ye}from"./spinner-lhXugSx3.js";import{F as we,a as Ce}from"./tabs-DTiU3usb.js";import{u as ke}from"./use-measured-height-CK2Co3XI.js";const Ke=({current:a,total:t})=>{const{columns:i}=ae(),s=i||80,d=t>0?Math.min(1,a/t):0,h=`${String(Math.round(d*100)).padStart(3)}%`,f=`${String(a)}/${String(t)}`,y=Math.max(10,s-2-h.length-1),p=Math.round(y*d),j=y-p;return e.jsxs(l,{flexDirection:"column",paddingX:1,children:[e.jsxs(l,{children:[e.jsx(ye,{type:"dots"}),e.jsx(r,{children:" Checking catalog dependencies "}),e.jsx(r,{dimColor:!0,children:f})]}),e.jsxs(l,{children:[e.jsx(r,{color:"cyan",children:"━".repeat(p)}),e.jsx(r,{dimColor:!0,children:"─".repeat(j)}),e.jsxs(r,{dimColor:!0,children:[" ",h]})]})]})},J=["default","name","updateType","severity"],ce=a=>{const t=a.vulnerabilities?.map(i=>i.severity)??[];return t.includes("CRITICAL")?4:t.includes("HIGH")?3:t.includes("MODERATE")?2:t.includes("LOW")?1:0},de={digest:0,major:3,minor:2,patch:1,pin:0,unknown:0},he=(a,t)=>{if(t==="default")return a;const i=[...a];return t==="name"?i.sort((s,d)=>s.packageName.localeCompare(d.packageName)):t==="updateType"?i.sort((s,d)=>(de[d.updateType]??0)-(de[s.updateType]??0)||s.packageName.localeCompare(d.packageName)):i.sort((s,d)=>ce(d)-ce(s)||s.packageName.localeCompare(d.packageName)),i},Z=a=>`${a.ecosystem}|${a.file}:${String(a.line)}|${a.name}`,A=a=>`${a.catalogName} ${a.packageName}`,Y=a=>{const t=new Map;for(const i of a){const s=t.get(i.catalogName);s?s.push(i):t.set(i.catalogName,[i])}return t},G=(a,t,i)=>{let s=a;if(t!=="all"&&(s=t==="security"?s.filter(d=>d.vulnerabilities&&d.vulnerabilities.length>0||d.socketReport&&d.socketReport.alerts.length>0):s.filter(d=>d.updateType===t)),i){const d=i.toLowerCase();s=s.filter(h=>h.packageName.toLowerCase().includes(d))}return s};class He{#e;#l=new Set;#t;#s;#i=null;constructor(t,i=null,s=[]){this.#t=t,this.#s=s,i&&(this.#i=new Map(i.recommendations.map(d=>[d.package,d]))),this.#e={aiResult:i,allChecked:!0,applyProgress:null,checkedEcosystemKeys:new Set(s.map(d=>Z(d))),checkedEntries:new Set(t.map(d=>A(d))),ecosystemEntries:s,entries:t,error:null,filterActive:!1,filterText:"",filterType:"all",focusedPanel:"list",groupedByCatalog:Y(t),phase:"browsing",selectedIndex:0,sortMode:"default"}}getSnapshot=()=>this.#e;subscribe=t=>(this.#l.add(t),()=>{this.#l.delete(t)});getFilteredEntries(){return he(G(this.#t,this.#e.filterType,this.#e.filterText),this.#e.sortMode)}setSortMode(t){if(t===this.#e.sortMode)return;const i=this.getFilteredEntries()[this.#e.selectedIndex]?.packageName,s=he(G(this.#t,this.#e.filterType,this.#e.filterText),t),d=i?Math.max(0,s.findIndex(h=>h.packageName===i)):0;this.#r({...this.#e,selectedIndex:d,sortMode:t})}cycleSortMode(){const t=J.indexOf(this.#e.sortMode),i=J[(t+1)%J.length]??"default";this.setSortMode(i)}getRecommendation(t){return this.#i?.get(t)}getCheckedEntries(){return this.#t.filter(t=>this.#e.checkedEntries.has(A(t)))}getCheckedEcosystemEntries(){return this.#s.filter(t=>this.#e.checkedEcosystemKeys.has(Z(t)))}toggleEcosystemCheck(t){const i=new Set(this.#e.checkedEcosystemKeys);i.has(t)?i.delete(t):i.add(t),this.#r({...this.#e,checkedEcosystemKeys:i})}checkAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set(this.#s.map(t=>Z(t)))})}uncheckAllEcosystem(){this.#r({...this.#e,checkedEcosystemKeys:new Set})}setSelectedIndex(t){const i=this.getFilteredEntries(),s=Math.max(0,Math.min(t,i.length-1));s!==this.#e.selectedIndex&&this.#r({...this.#e,selectedIndex:s})}setFocusedPanel(t){t!==this.#e.focusedPanel&&this.#r({...this.#e,focusedPanel:t})}setFilterType(t){if(t!==this.#e.filterType){const i=G(this.#t,t,this.#e.filterText);this.#r({...this.#e,entries:i,filterType:t,groupedByCatalog:Y(i),selectedIndex:0})}}setFilter(t){const i=G(this.#t,this.#e.filterType,t);this.#r({...this.#e,entries:i,filterText:t,groupedByCatalog:Y(i),selectedIndex:0})}setFilterActive(t){if(t!==this.#e.filterActive)if(t)this.#r({...this.#e,filterActive:!0});else{const i=G(this.#t,this.#e.filterType,"");this.#r({...this.#e,entries:i,filterActive:!1,filterText:"",groupedByCatalog:Y(i),selectedIndex:0})}}toggleCheck(t){const i=A(t),s=new Set(this.#e.checkedEntries);s.has(i)?s.delete(i):s.add(i),this.#r({...this.#e,allChecked:s.size===this.#t.length,checkedEntries:s})}checkAll(){this.#r({...this.#e,allChecked:!0,checkedEntries:new Set(this.#t.map(t=>A(t)))})}uncheckAll(){this.#r({...this.#e,allChecked:!1,checkedEntries:new Set})}toggleAll(){this.#e.allChecked?this.uncheckAll():this.checkAll()}startApply(){const t=this.getCheckedEntries();this.#r({...this.#e,applyProgress:{current:0,total:t.length},phase:"applying"})}updateApplyProgress(t){this.#e.applyProgress&&this.#r({...this.#e,applyProgress:{...this.#e.applyProgress,current:t}})}markDone(){this.#r({...this.#e,phase:"done"})}setError(t){this.#r({...this.#e,error:t,phase:"error"})}#r(t){this.#e=t;for(const i of this.#l)try{i()}catch{}}}const be={major:"red",minor:"yellow",patch:"green"},Te={CRITICAL:"red",HIGH:"red",LOW:"gray",MODERATE:"yellow",UNKNOWN:"gray"},Se={critical:"red",high:"red",low:"gray",medium:"yellow"},Ee={critical:"red",high:"red",low:"green",medium:"yellow"},ve={defer:"gray",review:"yellow",skip:"red",update:"green"},Re=({changelogUrl:a,entry:t,focused:i,recommendation:s,scrollRef:d})=>{const h=i?"white":"gray";if(!t)return e.jsx(l,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",children:e.jsx(r,{dimColor:!0,children:"No package selected"})});const f=be[t.updateType]??"white",y=t.vulnerabilities&&t.vulnerabilities.length>0,p=t.socketReport?.score.overall??0,j=t.socketReport?ue(p):"gray";return e.jsxs(l,{borderColor:h,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsx(l,{flexShrink:0,paddingTop:1,paddingX:2,children:e.jsx(r,{bold:!0,color:"white",children:t.displayName??t.packageName})}),e.jsxs(je,{flexGrow:1,flexShrink:1,paddingX:2,ref:d,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:[e.jsx(r,{}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Current:"})}),e.jsx(r,{children:t.currentRange})]}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Target:"})}),e.jsx(r,{children:t.newRange}),e.jsxs(r,{bold:!0,color:f,children:[" ","(",t.updateType,")"]})]}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:"Version:"})}),e.jsx(r,{children:t.targetVersion})]}),e.jsxs(l,{children:[e.jsx(l,{width:12,children:e.jsx(r,{dimColor:!0,children:t.kind==="ecosystem"?"Source:":"Catalog:"})}),e.jsx(r,{color:t.kind==="ecosystem"?"cyan":void 0,children:t.catalogName})]}),t.acceptedRisk&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{color:"gray",children:"── "}),e.jsx(r,{bold:!0,color:"gray",children:"ACKNOWLEDGED RISK"}),e.jsxs(l,{flexDirection:"column",paddingLeft:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Reason: "}),e.jsx(r,{children:t.acceptedRisk.reason})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Accepted: "}),e.jsx(r,{children:t.acceptedRisk.acceptedAt.slice(0,10)})]})]})]}),y&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"red",children:"SECURITY"}),e.jsx(r,{}),t.vulnerabilities.map(n=>e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{gap:1,children:[e.jsxs(r,{bold:!0,color:Te[n.severity]??"gray",children:["⚠"," ",n.severity]}),e.jsx(r,{bold:!0,children:n.id})]}),e.jsx(l,{paddingLeft:2,children:e.jsx(r,{children:n.summary})}),e.jsxs(l,{gap:2,paddingLeft:2,children:[n.cvssScore!==void 0&&e.jsxs(r,{dimColor:!0,children:["CVSS:",String(n.cvssScore)]}),n.fixedVersions.length>0&&e.jsxs(r,{dimColor:!0,children:["Fixed in:",n.fixedVersions.join(", ")]})]})]},n.id))]}),t.socketReport&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"cyan",children:"SOCKET.DEV"}),e.jsx(r,{}),e.jsxs(l,{gap:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Overall: "}),e.jsxs(r,{bold:!0,color:j,children:[String(Math.round(p*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Supply Chain: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.supplyChain*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Quality: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.quality*100)),"%"]})]})]}),e.jsxs(l,{gap:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Maintenance: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.maintenance*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Vulnerability: "}),e.jsxs(r,{children:[String(Math.round(t.socketReport.score.vulnerability*100)),"%"]})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"License: "}),e.jsxs(r,{children:[t.socketReport.license||"unknown"," ","(",String(Math.round(t.socketReport.score.license*100)),"%)"]})]})]}),t.socketReport.alerts.length>0&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsxs(r,{bold:!0,color:"yellow",children:["⚠"," ",String(t.socketReport.alerts.length)," ","alert",t.socketReport.alerts.length===1?"":"s",":"]}),t.socketReport.alerts.map(n=>e.jsxs(l,{gap:1,paddingLeft:2,children:[e.jsxs(r,{bold:!0,color:Se[n.severity]??"gray",children:["[",n.severity.toUpperCase(),"]"]}),e.jsx(r,{children:n.type}),e.jsxs(r,{dimColor:!0,children:["(",n.category,")"]})]},n.key))]})]}),s&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"AI ANALYSIS"}),e.jsx(r,{}),e.jsxs(l,{gap:2,children:[e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Action: "}),e.jsx(r,{bold:!0,color:ve[s.action]??"white",children:s.action})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Risk: "}),e.jsx(r,{bold:!0,color:Ee[s.riskLevel]??"white",children:s.riskLevel})]}),e.jsxs(l,{children:[e.jsx(r,{dimColor:!0,children:"Effort: "}),e.jsx(r,{bold:!0,children:s.effort})]})]}),s.reason&&e.jsx(l,{marginTop:1,paddingLeft:2,children:e.jsx(r,{children:s.reason})}),s.breakingChanges.length>0&&e.jsxs(l,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[e.jsx(r,{bold:!0,color:"yellow",children:"Breaking changes:"}),s.breakingChanges.map((n,I)=>e.jsxs(r,{children:[" ","•"," ",n]},String(I)))]})]}),a&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"CHANGELOG"}),e.jsx(l,{marginTop:1,paddingLeft:2,children:e.jsx(r,{color:"cyan",underline:!0,children:a})})]}),e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"LINKS"}),e.jsx(l,{flexDirection:"column",marginTop:1,paddingLeft:2,children:t.kind==="ecosystem"?e.jsx(r,{color:"cyan",underline:!0,children:t.detailUrl??t.displayName??t.packageName}):e.jsxs(r,{color:"cyan",underline:!0,children:["https://npmx.dev/",t.packageName]})})]}),!s&&t.kind!=="ecosystem"&&e.jsxs(l,{flexDirection:"column",marginTop:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"GUIDANCE"}),e.jsxs(l,{flexDirection:"column",marginTop:1,paddingLeft:2,children:[t.updateType==="major"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"red",children:["⚠"," ","Major update — likely contains breaking changes."]}),e.jsx(r,{dimColor:!0,children:" Review the changelog before updating."}),e.jsx(r,{dimColor:!0,children:" Use --changelog to fetch release URLs."})]}),t.updateType==="minor"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"yellow",children:["ℹ"," ","Minor update — new features, backward compatible."]}),e.jsx(r,{dimColor:!0,children:" Generally safe to update."})]}),t.updateType==="patch"&&e.jsxs(e.Fragment,{children:[e.jsxs(r,{color:"green",children:["✓"," ","Patch update — bug fixes only."]}),e.jsx(r,{dimColor:!0,children:" Safe to update."})]}),!s&&e.jsx(r,{dimColor:!0,children:" Use --ai to get AI-powered analysis."})]})]})]})]})},Ae={major:"red",minor:"yellow",patch:"green"},Ie=[{id:"all",label:"All"},{id:"major",label:"Major"},{id:"minor",label:"Minor"},{id:"patch",label:"Patch"},{id:"security",label:"Security"}],De=({checked:a,entry:t,isSelected:i})=>{const s=Ae[t.updateType]??"white",d=t.vulnerabilities&&t.vulnerabilities.length>0,h=t.socketReport&&t.socketReport.alerts.length>0,f=!!t.acceptedRisk,y=a?"☑":"☐",p=t.socketReport?`${String(Math.round(t.socketReport.score.overall*100))}%`:"",j=t.socketReport?ue(t.socketReport.score.overall):"gray";return e.jsxs(l,{flexShrink:0,height:1,children:[e.jsx(r,{children:i?">":" "}),e.jsxs(r,{color:a?"white":"gray",children:[" ",y," "]}),d||h?e.jsx(r,{color:f?"gray":"red",children:f?"✓ ":"⚠ "}):e.jsx(r,{children:" "}),e.jsx(l,{flexGrow:1,children:e.jsxs(r,{bold:i,inverse:i,wrap:"truncate",children:[t.displayName??t.packageName,f?" [ack]":""]})}),p&&e.jsxs(r,{color:j,children:[" ",p]}),e.jsxs(r,{dimColor:!0,children:[" ",t.currentRange]}),e.jsxs(r,{dimColor:!0,children:[" ","→"," "]}),e.jsxs(r,{children:[t.newRange," "]}),e.jsx(r,{bold:!0,color:s,children:t.updateType})]})},Me=({count:a,ecosystem:t=!1,name:i})=>e.jsxs(l,{flexShrink:0,height:1,marginTop:1,children:[e.jsxs(r,{color:t?"cyan":void 0,dimColor:!t,children:[t?"◈":"▼"," "]}),e.jsx(r,{bold:!0,color:t?"cyan":"white",children:i.toUpperCase()}),e.jsxs(r,{dimColor:!0,children:[" ","(",a,")"]}),t&&e.jsxs(r,{color:"cyan",dimColor:!0,children:[" ","ci/cd refs"]})]}),Ne=({checkedEntries:a,entries:t,filterActive:i,filteredOutCount:s,filterText:d,filterType:h,focused:f,groupedByCatalog:y,isDryRun:p,onViewportHeightChange:j,scrollOffset:n,selectedIndex:I,totalCatalogEntries:D,totalChecked:E,totalEntries:H,viewportHeight:L})=>{const F=f?"white":"gray",{measuredHeight:m,ref:v}=ke(L,j);let P=0,S=0,M=0,R=0;for(const x of t)x.updateType==="major"?P++:x.updateType==="minor"?S++:M++,(x.vulnerabilities&&x.vulnerabilities.length>0||x.socketReport&&x.socketReport.alerts.length>0)&&R++;const C=[];P>0&&C.push(`${P} major`),S>0&&C.push(`${S} minor`),M>0&&C.push(`${M} patch`),R>0&&C.push(`${R} vulnerable`);const N=C.length>0?` (${C.join(", ")})`:"",w=t.filter(x=>x.kind==="ecosystem").length,k=t.length-w;let $=0;for(const x of t)a.has(A(x))&&$++;const O=[];let U=0;for(const[x,b]of y){O.push(e.jsx(Me,{count:b.length,ecosystem:b[0]?.kind==="ecosystem",name:x},`hdr-${x}`));for(const T of b){const W=U;O.push(e.jsx(De,{checked:a.has(A(T)),entry:T,isSelected:W===I},A(T))),U++}}let B=0;for(const[,x]of y)B+=2+x.length;const V=B>m&&m>0;return e.jsxs(l,{borderColor:F,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[e.jsxs(l,{flexShrink:0,gap:1,paddingX:1,children:[e.jsx(r,{bold:!0,inverse:!0,children:" VIS "}),e.jsxs(r,{wrap:"truncate",children:[w>0?k:H,E>0?`/${E}`:""," ",w>0?"pkgs":"outdated",N,D>E?` · ${D-E} dupes`:""]}),w>0&&e.jsxs(r,{color:"cyan",children:[" ","◈"," ",w," ","ci/cd"]}),!p&&$>0&&e.jsxs(r,{dimColor:!0,children:[" ","—",$," ","selected"]})]}),e.jsx(l,{flexShrink:0,paddingX:1,paddingY:1,children:e.jsx(we,{isFocused:f,keyMap:{next:[],previous:[],useNumbers:!1,useTab:!1},onChange:()=>{},showIndex:!1,value:h,children:Ie.map(({id:x,label:b})=>e.jsx(Ce,{name:x,children:b},x))})}),i&&e.jsxs(l,{flexShrink:0,paddingX:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/ "}),e.jsx(r,{children:d}),e.jsx(r,{inverse:!0,children:" "})]}),s>0&&e.jsx(l,{flexShrink:0,paddingX:1,children:e.jsxs(r,{color:"yellow",children:["⚠"," ",s," ","package",s===1?"":"s"," ","filtered out by target constraint — press"," ",e.jsx(r,{bold:!0,color:"white",children:"f"})," ","to view"]})}),e.jsxs(l,{flexDirection:"row",flexGrow:1,overflow:"hidden",ref:v,children:[e.jsx(l,{flexDirection:"column",flexGrow:1,overflow:"hidden",paddingLeft:1,children:e.jsx(l,{flexDirection:"column",marginTop:-n,children:O})}),V&&e.jsx(l,{flexShrink:0,marginLeft:1,marginRight:1,children:e.jsx(ge,{contentHeight:B,placement:"inset",scrollOffset:n,style:"block",viewportHeight:m})})]},`list-${h}-${d}`)]})},Be=100,Le=40,Fe=10,Pe=[],K=["all","major","minor","patch","security"],Ve=({autoExitSeconds:a=0,changelogUrls:t,checkedCount:i=0,filteredOutEntries:s=Pe,isDryRun:d,store:h,totalCatalogEntries:f=0})=>{const{exit:y}=me(),{columns:p,rows:j}=ae(),n=g.useSyncExternalStore(h.subscribe,h.getSnapshot),[I,D]=g.useState(!1),[E,H]=g.useState(!1),L=g.useRef(null),F=g.useRef(null),m=g.useRef(null),v=g.useRef(null),[P,S]=g.useState(0),[M,R]=g.useState(!1),[C,N]=g.useState(!1),w=g.useMemo(()=>h.getFilteredEntries(),[n.entries,n.filterType,n.filterText,n.sortMode]),k=w[n.selectedIndex]??null,$=k?h.getRecommendation(k.packageName):void 0,O=k&&t?t.get(k.packageName):void 0,U=g.useCallback(o=>{let c=0,u=0;for(const[,Q]of n.groupedByCatalog){c+=2;for(let oe=0;oe<Q.length;oe++){if(u===o)return c;c+=1,u++}}return c},[n.groupedByCatalog]),B=Math.max(1,j-8-(n.filterActive?1:0)),[V,x]=g.useState(B),b=V>0?V:B,T=g.useCallback(o=>{const c=U(o);S(u=>c>u+b-2?Math.max(0,c-b+2):c<u+1?Math.max(0,c-1):u)},[U,b]);if(g.useEffect(()=>{m.current?.scrollToTop()},[k?.packageName]),fe((o,c)=>{if(o==="c"&&c.ctrl){y();return}if(!C){if(E){c.escape||o==="f"||o==="q"?H(!1):c.downArrow||o==="j"?F.current?.scrollBy(1):(c.upArrow||o==="k")&&F.current?.scrollBy(-1);return}if(M){o==="u"||c.return?(R(!1),h.startApply(),y(h.getCheckedEntries())):c.escape||o==="q"?R(!1):c.downArrow||o==="j"?v.current?.scrollBy(1):c.upArrow||o==="k"?v.current?.scrollBy(-1):c.pageDown?v.current?.scrollBy(5):c.pageUp&&v.current?.scrollBy(-5);return}if(I){c.escape||o==="?"?D(!1):o==="q"?(D(!1),N(!0)):c.downArrow||o==="j"?L.current?.scrollBy(1):(c.upArrow||o==="k")&&L.current?.scrollBy(-1);return}if(o==="?"){D(!0);return}if(o==="q"){N(!0);return}if(c.tab){h.setFocusedPanel(n.focusedPanel==="list"?"detail":"list");return}if(n.focusedPanel==="list"&&(c.leftArrow||c.rightArrow)){const u=K.indexOf(n.filterType),Q=c.rightArrow?(u+1)%K.length:(u-1+K.length)%K.length;S(0),m.current?.scrollToTop(),h.setFilterType(K[Q]);return}if(o==="f"&&s.length>0){H(u=>!u);return}if(n.filterActive){if(c.escape){h.setFilterActive(!1);return}if(c.return){h.setFilterActive(!1);return}if(c.backspace){S(0),h.setFilter(n.filterText.slice(0,-1));return}if(o&&!c.ctrl&&!c.meta){S(0),h.setFilter(n.filterText+o);return}return}if(n.focusedPanel==="list"){if(c.downArrow||o==="j"){const u=Math.min(n.selectedIndex+1,w.length-1);h.setSelectedIndex(u),T(u);return}if(c.upArrow||o==="k"){const u=Math.max(n.selectedIndex-1,0);h.setSelectedIndex(u),T(u);return}if(c.pageDown){const u=Math.min(n.selectedIndex+10,w.length-1);h.setSelectedIndex(u),T(u);return}if(c.pageUp){const u=Math.max(n.selectedIndex-10,0);h.setSelectedIndex(u),T(u);return}if(c.home){h.setSelectedIndex(0),S(0);return}if(c.end){const u=w.length-1;h.setSelectedIndex(u),T(u);return}if(o===" "||c.return){k&&h.toggleCheck(k);return}if(o==="a"){h.toggleAll();return}if(o==="s"){h.cycleSortMode(),T(h.getSnapshot().selectedIndex);return}if(o==="/"){h.setFilterActive(!0);return}if(o==="u"&&!d&&n.checkedEntries.size>0){R(!0);return}if(c.rightArrow){h.setFocusedPanel("detail");return}return}if(n.focusedPanel==="detail"){if(c.escape||c.leftArrow){h.setFocusedPanel("list");return}if(c.downArrow||o==="j"){m.current?.scrollBy(1);return}if(c.upArrow||o==="k"){m.current?.scrollBy(-1);return}if(c.pageDown){m.current?.scrollBy(10);return}if(c.pageUp){m.current?.scrollBy(-10);return}if(c.home){m.current?.scrollToTop();return}c.end&&m.current?.scrollToBottom()}}},{isActive:!0}),p<Le||j<Fe)return e.jsx(l,{alignItems:"center",height:j,justifyContent:"center",width:p,children:e.jsxs(r,{color:"yellow",children:["Terminal too small (",p,"x",j,")"]})});const W=p>=Be,q=[e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"q"}),e.jsx(r,{dimColor:!0,children:"QUIT"})]},"q"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"?"}),e.jsx(r,{dimColor:!0,children:"HELP"})]},"?"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"}),e.jsx(r,{dimColor:!0,children:"NAV"})]},"nav"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Space"}),e.jsx(r,{dimColor:!0,children:"CHECK"})]},"sp"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"a"}),e.jsx(r,{dimColor:!0,children:"ALL"})]},"a")];!d&&n.checkedEntries.size>0&&q.push(e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"green",children:"u"}),e.jsx(r,{dimColor:!0,children:"APPLY"})]},"u")),s.length>0&&q.push(e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"yellow",children:"f"}),e.jsxs(r,{dimColor:!0,children:["FILTERED (",s.length,")"]})]},"fo")),q.push(e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"←→"}),e.jsx(r,{dimColor:!0,children:"FILTER"})]},"lr"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"/"}),e.jsx(r,{dimColor:!0,children:"SEARCH"})]},"f"),e.jsxs(l,{gap:1,children:[e.jsx(r,{bold:!0,color:"white",children:"Tab"}),e.jsx(r,{dimColor:!0,children:"PANEL"})]},"t"));const ee=e.jsx(l,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,children:e.jsx(l,{flexWrap:"wrap",gap:2,paddingX:1,children:q})}),re=e.jsxs(_,{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:L,title:"KEYBOARD SHORTCUTS",visible:I,width:52,children:[e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"NAVIGATION"})]}),e.jsxs(l,{children:[e.jsx(l,{width:24,children:e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↑","/k"]}),e.jsx(r,{dimColor:!0,children:" Move up"})]})}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","↓","/j"]}),e.jsx(r,{dimColor:!0,children:" Move down"})]})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Tab"]}),e.jsx(r,{dimColor:!0,children:" Switch panel"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","→","/","←"]}),e.jsx(r,{dimColor:!0,children:" Focus detail/list"})]})]}),e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"SELECTION"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","Space"]}),e.jsx(r,{dimColor:!0,children:" Toggle check on package"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","a"]}),e.jsx(r,{dimColor:!0,children:" Toggle check all"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","s"]}),e.jsx(r,{dimColor:!0,children:" Cycle sort (default / name / type / severity)"})]})]}),e.jsxs(l,{flexDirection:"column",marginBottom:1,children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"FILTERS"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","←→"]}),e.jsx(r,{dimColor:!0,children:" Switch filter tab"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","/"]}),e.jsx(r,{dimColor:!0,children:" Text filter"})]}),s.length>0&&e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","f"]}),e.jsx(r,{dimColor:!0,children:" View filtered-out packages"})]})]}),e.jsxs(l,{flexDirection:"column",children:[e.jsxs(l,{marginBottom:1,children:[e.jsx(r,{dimColor:!0,children:"── "}),e.jsx(r,{bold:!0,color:"white",children:"ACTIONS"})]}),!d&&e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","u"]}),e.jsx(r,{dimColor:!0,children:" Apply selected updates"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","q"]}),e.jsx(r,{dimColor:!0,children:" Quit"})]}),e.jsxs(r,{children:[e.jsxs(r,{bold:!0,color:"white",children:[" ","?"]}),e.jsx(r,{dimColor:!0,children:" Toggle help"})]})]})]}),X=h.getCheckedEntries(),z=X.filter(o=>o.updateType==="major").length,xe=e.jsxs(l,{alignItems:"center",flexDirection:"column",children:[z>0&&e.jsx(l,{marginBottom:1,marginTop:1,children:e.jsxs(r,{color:"yellow",children:["⚠"," ",z," ","major update",z===1?"":"s"," ","— review breaking changes"]})}),e.jsxs(r,{dimColor:!0,children:["Press"," ",e.jsx(r,{bold:!0,color:"white",children:"u"})," ","or"," ",e.jsx(r,{bold:!0,color:"white",children:"Enter"})," ","to confirm,"," ",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","to cancel"]})]}),te=e.jsx(_,{footer:xe,scrollRef:v,title:`Apply ${X.length} update${X.length===1?"":"s"}?`,visible:M,width:70,children:X.map(o=>e.jsxs(l,{gap:1,children:[e.jsxs(r,{children:[" ",o.displayName??o.packageName]}),e.jsxs(r,{dimColor:!0,children:[o.currentRange," ","→"," ",o.newRange]}),e.jsx(r,{bold:!0,color:o.updateType==="major"?"red":o.updateType==="minor"?"yellow":"green",children:o.updateType})]},o.packageName))}),le=s.length>0?e.jsx(_,{footer:e.jsxs(r,{dimColor:!0,children:[e.jsx(r,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",e.jsx(r,{bold:!0,color:"white",children:"f"}),"/",e.jsx(r,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:F,title:`${s.length} PACKAGE${s.length===1?"":"S"} FILTERED BY TARGET`,visible:E,width:70,children:e.jsxs(l,{flexDirection:"column",children:[e.jsx(l,{marginBottom:1,children:e.jsxs(r,{dimColor:!0,children:["These packages have newer versions available but are excluded by the current target constraint. Use"," ",e.jsx(r,{bold:!0,color:"white",children:"--target latest"})," ","to include them."]})}),s.map(o=>e.jsxs(l,{gap:1,children:[e.jsxs(r,{children:[" ",o.packageName]}),e.jsxs(r,{dimColor:!0,children:[o.currentRange," ","→"," ",o.newRange]}),e.jsx(r,{bold:!0,color:o.updateType==="major"?"red":o.updateType==="minor"?"yellow":"green",children:o.updateType})]},o.packageName))]})}):null,se=e.jsx(Ne,{checkedEntries:n.checkedEntries,entries:w,filterActive:n.filterActive,filteredOutCount:s.length,filterText:n.filterText,filterType:n.filterType,focused:n.focusedPanel==="list",groupedByCatalog:n.groupedByCatalog,isDryRun:d,onViewportHeightChange:x,scrollOffset:P,selectedIndex:n.selectedIndex,totalCatalogEntries:f,totalChecked:i,totalEntries:w.length,viewportHeight:b}),ie=e.jsx(Re,{changelogUrl:O,entry:k,focused:n.focusedPanel==="detail",recommendation:$,scrollRef:m});if(W){const o=Math.floor(p*.35);return e.jsxs(l,{flexDirection:"column",height:j,width:p,children:[e.jsxs(l,{flexDirection:"row",flexGrow:1,children:[e.jsx(l,{flexGrow:1,children:se}),e.jsx(l,{width:o,children:ie})]}),ee,te,le,e.jsx(ne,{autoExitSeconds:a||3,onCancel:()=>{N(!1)},visible:C}),re]})}const pe=Math.floor(j*.55);return e.jsxs(l,{flexDirection:"column",height:j,width:p,children:[e.jsx(l,{height:pe,children:se}),e.jsx(l,{flexGrow:1,children:ie}),ee,te,le,e.jsx(ne,{autoExitSeconds:a||3,onCancel:()=>{N(!1)},visible:C}),re]})};export{He as U,Ve as b,Z as e,Ke as u};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{createRequire as K}from"node:module";import{m as g,f as C,v as H,A as S,B as U,a as Q,H as X}from"./index-OQZQyN5R.js";import{aG as w}from"../packem_chunks/cli-main.js";import{a as ee}from"./readJsonSync-CvkZyKmL-CY7PZob_.js";import{s as le}from"./watch-Bkp_AAbc.js";const G=K(import.meta.url),x=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=e=>{if(typeof x<"u"&&x.versions&&x.versions.node){const[t,s]=x.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return x.getBuiltinModule(e)}return G(e)},{createHash:m}=v("node:crypto"),{fileURLToPath:Y,pathToFileURL:Z}=v("node:url"),{spawnSync:te,spawn:se}=v("node:child_process"),{openSync:ne,writeSync:re,closeSync:oe,statSync:ie,readFileSync:N,mkdirSync:ae,writeFileSync:ce}=v("node:fs"),{availableParallelism:b}=v("node:os"),W=(e,t)=>{for(const s of["dependencies","devDependencies","optionalDependencies","peerDependencies"]){const n=e[s];if(n&&typeof n[t]=="string")return n[t]}},k=(e,t)=>{for(const s of t){const n=g(e,s);if(C(n))return n}},ue=e=>{const t=g(e,"package.json");if(!C(t))return{};try{return ee(t)}catch{return{}}},tt=(e,t)=>{const s=ue(e),n=new Map;for(const o of t){const r=o.detect(e,s);r&&n.set(o.id,r)}return n},de={error:"error",info:"info",information:"info",warning:"warning"},st={argsCheck:(e,t)=>j(e,t,!1),argsFix:(e,t)=>j(e,t,!0),bin:()=>["pnpm","exec","biome"],cacheKey:(e,t)=>{const s=["biome",e.declaredVersion??"unknown",e.configFile??"no-config",t.maxWarnings===void 0?"":`mw=${t.maxWarnings}`,t.quiet?"q":"",...t.extraArgs??[]];return m("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:(e,t)=>{const s=W(t,w.biome.packageNames[0]),n=k(e,w.biome.configFiles);if(!(!s&&!n))return{adapter:"biome",configFile:n,declared:!!s,declaredVersion:s,root:e}},extensions:["astro","cjs","css","cts","js","json","jsonc","jsx","mjs","mts","svelte","ts","tsx","vue"],id:"biome",kind:"both",parse:(e,t)=>{if(!e.stdout.trim())return[];let s;try{s=JSON.parse(e.stdout)}catch{return[{adapter:"biome",file:t.root,fixable:!1,message:`biome output was not valid JSON (exit ${e.exitCode})`,severity:"error"}]}const n=[];for(const o of s.diagnostics??[]){const r=o.location?.start,i=o.location?.end,a=fe(t.root,o.location?.path),c=o.category??"",l=c==="format"||c.startsWith("format/");n.push({adapter:"biome",column:r?.column&&r.column>0?r.column:void 0,endColumn:i?.column&&i.column>0?i.column:void 0,endLine:i?.line&&i.line>0?i.line:void 0,file:a,fixable:!0,line:r?.line&&r.line>0?r.line:void 0,message:l?"Code style issues would be auto-fixed":o.message??"",ruleId:c||void 0,severity:de[o.severity??""]??"warning"})}return n}},j=(e,t,s)=>{const n=["check","--reporter=json"];return s&&n.push("--write"),typeof t.maxWarnings=="number"&&n.push(`--max-diagnostics=${String(t.maxWarnings)}`),t.extraArgs?.length&&n.push(...t.extraArgs),n.push(...e),n},fe=(e,t)=>{const s=typeof t=="string"?t:t?.file;return s?s.startsWith("/")||/^[a-z]:[\\/]/i.test(s)?s:g(e,s):e},B=e=>t=>{const s=k(t,w.deno.configFiles);if(s)return{adapter:e,configFile:s,declared:!1,root:t}},D=e=>e.startsWith("/")||/^[a-z]:[\\/]/i.test(e),nt={argsCheck:(e,t)=>F(e,t,!1),argsFix:(e,t)=>F(e,t,!0),bin:()=>["deno","lint"],cacheKey:(e,t)=>{const s=["deno-lint",e.configFile??"no-config",t.quiet?"q":"",...t.extraArgs??[]];return m("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:B("deno-lint"),extensions:["js","jsx","mjs","mts","ts","tsx"],id:"deno-lint",kind:"lint",parse:(e,t)=>{if(!e.stdout.trim())return[];let s;try{s=JSON.parse(e.stdout)}catch{return[{adapter:"deno-lint",file:t.root,fixable:!1,message:`deno lint output was not valid JSON (exit ${e.exitCode})`,severity:"error"}]}const n=[];for(const o of s.diagnostics??[]){const r=o.range?.start,i=o.range?.end;n.push({adapter:"deno-lint",column:r?.col===void 0?void 0:r.col+1,endColumn:i?.col===void 0?void 0:i.col+1,endLine:i?.line===void 0?void 0:i.line+1,file:pe(o.filename??t.root,t.root),fixable:!1,line:r?.line===void 0?void 0:r.line+1,message:o.message??"",ruleId:o.code,severity:"warning"})}return n}},rt={argsCheck:(e,t)=>I(e,t,!1),argsFix:(e,t)=>I(e,t,!0),bin:()=>["deno","fmt"],cacheKey:(e,t)=>{const s=["deno-fmt",e.configFile??"no-config",t.quiet?"q":"",...t.extraArgs??[]];return m("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:B("deno-fmt"),extensions:["astro","cjs","css","cts","html","ipynb","js","json","jsonc","jsx","less","md","mjs","mts","sass","scss","sql","svelte","ts","tsx","vue","yaml","yml"],id:"deno-fmt",kind:"fmt",parse:(e,t)=>{if(e.exitCode===0)return[];const s=[],n=new Set;for(const o of e.stdout.split(/\r?\n/)){const r=/^from (.+):$/.exec(o);if(!r)continue;const i=r[1];n.has(i)||(n.add(i),s.push({adapter:"deno-fmt",file:D(i)?i:`${t.root}/${i}`,fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"}))}return s}},F=(e,t,s)=>{const n=["--json"];return s&&n.push("--fix"),t.extraArgs?.length&&n.push(...t.extraArgs),n.push(...e),n},I=(e,t,s)=>{const n=[];return s||n.push("--check"),t.quiet&&n.push("--quiet"),t.extraArgs?.length&&n.push(...t.extraArgs),n.push(...e),n},pe=(e,t)=>e.startsWith("file://")?Y(e):D(e)?e:`${t}/${e}`,J="pyproject.toml",ge=/^\[tool\.ruff(?:\.[\w-]+)*\]\s*$/m,he=/^Would reformat:?\s+(.+)$/,me=e=>{const t=g(e,J);if(!C(t))return!1;try{const s=H(t);return ge.test(s)}catch{return!1}},E=e=>(t,s)=>{const n=w.ruff.packageNames.map(a=>W(s,a)).find(a=>a!==void 0),o=k(t,w.ruff.configFiles),r=o?void 0:me(t)?g(t,J):void 0,i=o??r;if(!(!n&&!i))return{adapter:e,configFile:i,declared:!!n,declaredVersion:n,root:t}},ye=e=>e.startsWith("/")||/^[a-z]:[\\/]/i.test(e),P=(e,t)=>e?ye(e)?e:g(t,e):t,xe=e=>he.exec(e)?.[1]?.trim(),ot={argsCheck:(e,t)=>L(e,t,!1),argsFix:(e,t)=>L(e,t,!0),bin:()=>["ruff","check"],cacheKey:(e,t)=>{const s=["ruff-check",e.declaredVersion??"unknown",e.configFile??"no-config",t.maxWarnings===void 0?"":`mw=${t.maxWarnings}`,t.quiet?"q":"",...t.extraArgs??[]];return m("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:E("ruff-check"),extensions:["py","pyi"],id:"ruff-check",kind:"lint",parse:(e,t)=>{if(!e.stdout.trim())return[];let s;try{s=JSON.parse(e.stdout)}catch{return[{adapter:"ruff-check",file:t.root,fixable:!1,message:`ruff check output was not valid JSON (exit ${e.exitCode})`,severity:"error"}]}const n=[];for(const o of s){const r=o.location,i=o.end_location;n.push({adapter:"ruff-check",column:r?.column,endColumn:i?.column,endLine:i?.row,file:P(o.filename,t.root),fixable:!!o.fix,line:r?.row,message:o.message??"",ruleId:o.code,severity:"warning"})}return n}},it={argsCheck:(e,t)=>R(e,t,!1),argsFix:(e,t)=>R(e,t,!0),bin:()=>["ruff","format"],cacheKey:(e,t)=>{const s=["ruff-fmt",e.declaredVersion??"unknown",e.configFile??"no-config",t.quiet?"q":"",...t.extraArgs??[]];return m("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:E("ruff-fmt"),extensions:["py","pyi"],id:"ruff-fmt",kind:"fmt",parse:(e,t)=>{if(e.exitCode===0)return[];const s=[],n=new Set;for(const o of e.stdout.split(/\r?\n/)){const r=xe(o);!r||n.has(r)||(n.add(r),s.push({adapter:"ruff-fmt",file:P(r,t.root),fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"}))}return s}},L=(e,t,s)=>{const n=["--output-format=json"];return s&&n.push("--fix"),t.quiet&&n.push("--quiet"),t.extraArgs?.length&&n.push(...t.extraArgs),n.push(...e),n},R=(e,t,s)=>{const n=[];return s||n.push("--check"),t.quiet&&n.push("--quiet"),t.extraArgs?.length&&n.push(...t.extraArgs),n.push(...e),n},at=(e,t)=>{const s=$(e,["diff","--name-only","--diff-filter=ACMR","-z",`${t}...HEAD`]);if(s===void 0)return;const n=$(e,["diff","--name-only","--diff-filter=ACMR","-z"]),o=$(e,["diff","--name-only","--diff-filter=ACMR","--cached","-z"]),r=$(e,["ls-files","--others","--exclude-standard","-z"]),i=new Set;for(const a of[s,n??"",o??"",r??""])for(const c of a.split("\0"))c.length!==0&&i.add(S(c)?c:g(e,c));return[...i].sort()},ct=e=>{const t=$(e,["diff","--name-only","--diff-filter=ACMR","--cached","-z"]);if(t===void 0)return;const s=new Set;for(const n of t.split("\0"))n.length!==0&&s.add(S(n)?n:g(e,n));return[...s].sort()},$=(e,t)=>{const s=te("git",[...t],{cwd:e,encoding:"utf8",timeout:1e4});if(s.status===0)return s.stdout},lt=(e,t)=>{const s=new Set(t.map(r=>r.toLowerCase())),n=[],o=new Set;for(const r of e){const i=r.lastIndexOf(".");if(i===-1||i===r.length-1)continue;const a=r.slice(i+1).toLowerCase();s.has(a)&&(o.has(r)||(o.add(r),n.push(r)))}return n},$e=new Set(["-","stdout"]),M=e=>({close:()=>{},write:t=>{e.write(t)}}),we=e=>{Q(X(e));const t=ne(e,"w");let s=[];return{close:()=>{s.length>0&&(re(t,s.join("")),s=[]),oe(t)},write:n=>{s.push(n)}}},ut=e=>{const{cwd:t,target:s}=e;if(s===void 0||$e.has(s))return M(process.stdout);if(s==="stderr")return M(process.stderr);const n=S(s)?s:U(t,s);return we(n)},q=["oxlint","oxfmt","biome","eslint","dprint","prettier","stylelint","ruff-check","ruff-fmt","markdownlint","shellcheck","deno-lint","deno-fmt"],dt=(e,t)=>{const s=new Map(e.map(i=>[i.id,i])),n=[],o=new Set,r=t&&t.length>0?t:q;for(const i of r){const a=s.get(i);a&&!o.has(i)&&(n.push(a),o.add(i))}if(t&&t.length>0)for(const i of q){const a=s.get(i);a&&!o.has(i)&&(n.push(a),o.add(i))}for(const i of e)o.has(i.id)||(n.push(i),o.add(i.id));return n},ft=(e,t,s)=>{const n=[];for(const o of t){const r=e.get(o.id);r&&ve(o.kind,s)&&n.push({adapter:o,presence:r})}return n},ve=(e,t)=>e===t||e==="both",pt=(e,t,s={})=>{const n=new Map;for(const o of e){const r=Se(o),i=Ae(r,t,s);if(!i)continue;const a=n.get(i);a?a.push(o):n.set(i,[o])}return n},Se=e=>{const t=e.lastIndexOf(".");return t===-1||t===e.length-1?"":e.slice(t+1).toLowerCase()},Ae=(e,t,s)=>{const n=s[e];if(n&&t.some(o=>o.adapter.id===n))return n;for(const{adapter:o}of t)if(o.extensions.includes(e))return o.id},Ce=e=>e==="error"?"error":e==="warning"?"warning":"notice",V=e=>e.replaceAll("%","%25").replaceAll("\r","%0D").replaceAll(`
|
|
2
|
-
`,"%0A"),T=e=>V(e).replaceAll(",","%2C").replaceAll(":","%3A").replaceAll("=","%3D"),ke=(e,t)=>t&&e.startsWith(`${t}/`)?e.slice(t.length+1):e,be=(e,t)=>e.file!==t.file?e.file<t.file?-1:1:(e.line??0)-(t.line??0)||(e.column??0)-(t.column??0),je=(e,t)=>{const s=Ce(e.severity),n=ke(e.file,t),o=e.ruleId?`${e.adapter}(${e.ruleId})`:e.adapter,r=[`file=${T(n)}`];return e.line!==void 0&&r.push(`line=${String(e.line)}`),e.endLine!==void 0&&r.push(`endLine=${String(e.endLine)}`),e.column!==void 0&&r.push(`col=${String(e.column)}`),e.endColumn!==void 0&&r.push(`endColumn=${String(e.endColumn)}`),r.push(`title=${T(o)}`),`::${s} ${r.join(",")}::${V(e.message)}
|
|
3
|
-
`},gt=e=>e.runs.flatMap(t=>[...t.findings]).sort(be).map(t=>je(t,e.workspaceRoot)).join(""),y=e=>e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'"),Fe=e=>`<![CDATA[${e.replaceAll("]]>","]]]]><![CDATA[>")}]]>`,Ie=(e,t)=>e.file!==t.file?e.file<t.file?-1:1:(e.line??0)-(t.line??0)||(e.column??0)-(t.column??0),Le=e=>e==="error"?"error":e==="warning"?"warning":"info",Re=(e,t)=>{let{file:s}=e;return t&&e.file.startsWith(`${t}/`)&&(s=e.file.slice(t.length+1)),e.line===void 0?s:e.column===void 0?`${s}:${String(e.line)}`:`${s}:${String(e.line)}:${String(e.column)}`},Me=(e,t,s)=>{const n=Re(e,s),o=Le(e.severity),r=e.ruleId?`[${e.ruleId}] ${e.message}`:e.message;return[` <testcase classname="${y(t)}" name="${y(n)}">`,` <failure type="${y(o)}" message="${y(r)}">${Fe(e.message)}</failure>`," </testcase>",""].join(`
|
|
4
|
-
`)},qe=(e,t,s)=>{const n=[...e.findings].sort(Ie),o=n.filter(l=>l.severity==="error").length,r=n.filter(l=>l.severity==="warning").length,i=n.length,a=(e.durationMs/1e3).toFixed(3),c=n.map(l=>Me(l,e.adapter,s)).join("");return` <testsuite ${[`name="${y(e.adapter)}"`,`tests="${String(i)}"`,`failures="${String(o)}"`,'errors="0"',`skipped="${String(r)}"`,`time="${a}"`,`timestamp="${t}"`].join(" ")}>
|
|
5
|
-
${c} </testsuite>
|
|
6
|
-
`},ht=e=>{const t=(e.now??new Date).toISOString(),s=e.suiteName??"vis-lint-fmt",n=e.runs.map(c=>qe(c,t,e.workspaceRoot)).join(""),o=e.runs.reduce((c,l)=>c+l.findings.length,0),r=e.runs.reduce((c,l)=>c+l.findings.filter(p=>p.severity==="error").length,0),i=e.runs.reduce((c,l)=>c+l.findings.filter(p=>p.severity==="warning").length,0),a=(e.runs.reduce((c,l)=>c+l.durationMs,0)/1e3).toFixed(3);return`<?xml version="1.0" encoding="UTF-8"?>
|
|
7
|
-
<testsuites ${[`name="${y(s)}"`,`tests="${String(o)}"`,`failures="${String(r)}"`,'errors="0"',`skipped="${String(i)}"`,`time="${a}"`].join(" ")}>
|
|
8
|
-
${n}</testsuites>
|
|
9
|
-
`},Te="2.1.0",Oe="https://json.schemastore.org/sarif-2.1.0.json",_e=e=>e==="error"?"error":e==="warning"?"warning":"note",Ne=(e,t)=>t&&e.startsWith(`${t}/`)?{uri:e.slice(t.length+1),uriBaseId:"SRCROOT"}:{uri:e},We=e=>{const{href:t}=Z(e);return t.endsWith("/")?t:`${t}/`},Be=(e,t)=>e.file!==t.file?e.file<t.file?-1:1:(e.line??0)-(t.line??0)||(e.column??0)-(t.column??0),De=e=>{const t=new Map;for(const s of e)s.ruleId&&(t.has(s.ruleId)||t.set(s.ruleId,{id:s.ruleId,name:s.ruleId}));return[...t.values()]},Je=(e,t)=>{const{uri:s,uriBaseId:n}=Ne(e.file,t),o={artifactLocation:n?{uri:s,uriBaseId:n}:{uri:s}};if(e.line!==void 0){const i={startLine:e.line};e.column!==void 0&&(i.startColumn=e.column),e.endLine!==void 0&&(i.endLine=e.endLine),e.endColumn!==void 0&&(i.endColumn=e.endColumn),o.region=i}const r={level:_e(e.severity),locations:[{physicalLocation:o}],message:{text:e.message}};return e.ruleId&&(r.ruleId=e.ruleId),r},Ee=(e,t)=>{const s=[...e.findings].sort(Be),n=De(s),o={name:e.adapter,rules:n};e.presence?.declaredVersion&&(o.version=e.presence.declaredVersion);const r={results:s.map(i=>Je(i,t)),tool:{driver:o}};return t&&(r.originalUriBaseIds={SRCROOT:{uri:We(t)}}),r},mt=e=>{const t={$schema:Oe,runs:e.runs.map(s=>Ee(s,e.workspaceRoot)),version:Te};return`${JSON.stringify(t,void 0,2)}
|
|
10
|
-
`},O={error:3,info:1,warning:2},yt=e=>{const t=[],s=[];let n,o=!1;for(const r of e){s.push({adapter:r.adapter,durationMs:r.durationMs,exitCode:r.exitCode,findingCount:r.findings.length}),r.exitCode!==0&&r.exitCode!==null&&r.findings.length===0&&(o=!0);for(const i of r.findings)t.push(i),(!n||O[i.severity]>O[n])&&(n=i.severity)}return{findings:t,hadProcessFailure:o,maxSeverity:n,runs:s}},xt=e=>{const t=new Map;for(const s of e){const n=t.get(s.file);n?n.push(s):t.set(s.file,[s])}return t},$t=e=>e.hadProcessFailure||e.maxSeverity==="error"?1:0,Pe=(e,t)=>{if(t==="fix"||process.env.VIS_NO_CACHE==="1"||e.length===0)return!1;for(const s of e)if(s==="."||s==="./"||s==="..")return!1;return!0},Ve=e=>{try{const t=N(e);return m("sha256").update(t).digest("hex")}catch{return}},ze=(e,t,s,n,o)=>{const r=e.cacheKey(t,n),i=[];for(const c of[...s].sort()){const l=S(c)?c:g(t.root,c);try{ie(l)}catch{return}const p=Ve(l);if(!p)return;i.push({hash:p,path:l})}const a=m("sha256");a.update(e.id),a.update("\0"),a.update(r),a.update("\0"),a.update(o);for(const c of i)a.update("\0"),a.update(c.path),a.update("\0"),a.update(c.hash);return{fileHashes:i,key:a.digest("hex")}},z=(e,t)=>g(e,"lint-fmt",t),Ke=(e,t,s)=>{const n=g(z(e,t.id),`${s}.json`);try{const o=N(n,"utf8"),r=JSON.parse(o);return r.schema!==1?void 0:r}catch{return}},Ge=(e,t,s,n,o)=>{const r=z(e,t.id),i={fileHashes:o,result:n,savedAt:Date.now(),schema:1};try{ae(r,{recursive:!0}),ce(g(r,`${s}.json`),JSON.stringify(i))}catch{}},_=async(e,t,s,n,o)=>{const r=e.bin(t),i=[...r.slice(1),...o==="fix"?e.argsFix(s,n):e.argsCheck(s,n)];return new Promise(a=>{const c=Date.now(),l=se(r[0],i,{cwd:t.root}),p=[],u=[];let h=!1;const f=setTimeout(()=>{h=!0,l.kill("SIGKILL")},6e4);l.stdout.on("data",d=>p.push(d)),l.stderr.on("data",d=>u.push(d)),l.on("error",d=>{clearTimeout(f),a({durationMs:Date.now()-c,exitCode:null,stderr:d.message,stdout:""})}),l.on("close",d=>{clearTimeout(f),a({durationMs:Date.now()-c,exitCode:h?null:d,stderr:Buffer.concat(u).toString("utf8"),stdout:Buffer.concat(p).toString("utf8")})})})},wt=async(e,t,s,n=b())=>{if(e.length===0)return[];const{cacheRoot:o,concurrency:r}=typeof n=="number"?{concurrency:n}:{cacheRoot:n.cacheRoot,concurrency:n.concurrency??b()},i=async u=>{const h=u.options??t;if(o&&Pe(u.files,s)){const f=ze(u.adapter,u.presence,u.files,h,s);if(f){const d=Ke(o,u.adapter,f.key);if(d)return d.result;const A=await _(u.adapter,u.presence,u.files,h,s);return A.exitCode!==null&&Ge(o,u.adapter,f.key,A,f.fileHashes),A}}return _(u.adapter,u.presence,u.files,h,s)};if(process.env.VIS_LINT_FMT_SERIAL==="1"){const u=[];for(const h of e)u.push(await i(h));return u}const a=Math.max(1,Math.min(r,e.length)),c=Array.from({length:e.length});let l=0;const p=async()=>{for(;;){const u=l;if(l+=1,u>=e.length)return;c[u]=await i(e[u])}};return await Promise.all(Array.from({length:a},()=>p())),c},He=e=>{const t=new Set;for(const s of e)t.add(s.toLowerCase());return t},Ue=(e,t)=>{const s=e.lastIndexOf(".");return s===-1||s===e.length-1?!1:t.has(e.slice(s+1).toLowerCase())},vt=async e=>{const{extensions:t,initialFiles:s,label:n,log:o,runCycle:r,workspaceRoot:i}=e,a=o??(f=>{process.stdout.write(`${f}
|
|
11
|
-
`)}),c=He(t);await r(s),a(`▸ ${n}: watching workspace — press Ctrl-C to exit`);let l=new Set,p=!1;const u=async()=>{for(;l.size>0;){const f=[...l];l=new Set;try{await r(f)}catch(d){a(`✗ ${n}: watch cycle failed — ${d.message}`)}}},h=le({debounceMs:200,filter:f=>Ue(f,c),onChange:async f=>{for(const d of f)l.add(S(d)?d:g(i,d));if(!p){p=!0;try{await u()}finally{p=!1}}},paths:[i]});await new Promise(f=>{const d=()=>{h.close(),process.off("SIGINT",d),process.off("SIGTERM",d),f()};process.once("SIGINT",d),process.once("SIGTERM",d)})};export{tt as a,ft as b,at as c,W as d,vt as e,k as f,pt as g,wt as h,yt as i,ut as j,mt as k,ht as l,gt as m,st as n,it as o,rt as p,xt as q,dt as r,ct as s,$t as t,lt as u,ot as v,nt as w};
|