@visulima/vis 3.0.2 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/LICENSE.md +2 -260
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/packem_chunks/CONFIG_FILES.js +1 -1
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +1 -1
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +158 -160
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +1 -1
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +3 -3
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +5 -5
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler21.js +2 -2
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler33.js +2 -2
- package/dist/packem_chunks/handler34.js +1 -1
- package/dist/packem_chunks/handler45.js +1 -1
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler48.js +3 -3
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +6 -6
- package/dist/packem_chunks/handler51.js +1 -1
- package/dist/packem_chunks/handler54.js +2 -2
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler57.js +1 -1
- package/dist/packem_chunks/handler58.js +2 -2
- package/dist/packem_chunks/handler59.js +2 -2
- package/dist/packem_chunks/handler6.js +7 -7
- package/dist/packem_chunks/handler62.js +2 -2
- package/dist/packem_chunks/handler64.js +3 -3
- package/dist/packem_chunks/handler66.js +2 -2
- package/dist/packem_chunks/handler67.js +1 -1
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +2 -2
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +1 -1
- package/dist/packem_chunks/handler72.js +2 -2
- package/dist/packem_chunks/handler73.js +1 -1
- package/dist/packem_chunks/handler74.js +1 -1
- package/dist/packem_chunks/handler75.js +1 -1
- package/dist/packem_chunks/handler76.js +1 -1
- package/dist/packem_chunks/handler77.js +40 -40
- 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 +7 -7
- package/dist/packem_chunks/index5.js +1 -1
- 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/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_shared/{advisories-DZd1uGqa.js → advisories-0ScpWAHV.js} +1 -1
- package/dist/packem_shared/{affected-selection-CoRXp5H4.js → affected-selection-DZLa0Hfn.js} +1 -1
- package/dist/packem_shared/{ai-fix-6nXZbecQ.js → ai-fix-CyUx_ZAB.js} +1 -1
- package/dist/packem_shared/{bin-C2eYtJ_N.js → bin-BWrnjd6M.js} +1 -1
- package/dist/packem_shared/{failure-log-D92tM0ie.js → failure-log-DE_MJCzB.js} +1 -1
- package/dist/packem_shared/{formatBytes-BHAzNIrn-DFIppnY0.js → formatBytes-BHAzNIrn-Bkk_uRS-.js} +1 -1
- package/dist/packem_shared/{index-DXPSWMbG.js → index-CIIKPX4H.js} +1 -1
- package/dist/packem_shared/index-QChhI1AU.js +1 -0
- package/dist/packem_shared/{lifecycle-CfTZQHOG.js → lifecycle-DW8KRF5d.js} +1 -1
- package/dist/packem_shared/{osv-bloom-1JS__1or.js → osv-bloom-JYIWcH3F.js} +1 -1
- package/dist/packem_shared/{package-version-Bb7KGF36.js → package-version-cRcuUsLC.js} +3 -3
- package/dist/packem_shared/{packument-C55kVxcQ.js → packument-CHdDsn0O.js} +1 -1
- package/dist/packem_shared/{pm-runner-de-jCq8q.js → pm-runner-d93_73O6.js} +1 -1
- package/dist/packem_shared/{project-name-filter-DYaIbrXa.js → project-name-filter-D4q4JaLN.js} +1 -1
- package/dist/packem_shared/{provenance-CvfQEJPQ.js → provenance-w-NIPtim.js} +1 -1
- package/dist/packem_shared/{registry-keys-DmBrAlhg.js → registry-keys-_IKDLSbu.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-DYaHAVDg.js → resolve-explicit-ZZEPWdpP.js} +1 -1
- package/dist/packem_shared/{s1ngularity-C8sva2SO.js → s1ngularity-R-zLjQjp.js} +1 -1
- package/dist/packem_shared/{scan-progress-aVHGZYWf.js → scan-progress-5uTRdC1G.js} +2 -2
- package/dist/packem_shared/{signatures-oZ_2IneN.js → signatures-ijwqxAtF.js} +1 -1
- package/dist/packem_shared/{spinner-CbJfWYwB.js → spinner-BM_0Bj6x.js} +1 -1
- package/dist/packem_shared/{tabs-BilwonkM.js → tabs-UDYQ3tqt.js} +1 -1
- package/dist/packem_shared/target-merge-B4No-LHM.js +4 -0
- package/dist/packem_shared/{vis-update-app-ngwL2mRv.js → vis-update-app-DNeU8RBQ.js} +1 -1
- package/dist/packem_shared/vis-user-error-DZSnp0Uj.js +30 -0
- package/index.js +26 -26
- package/package.json +11 -11
- package/dist/packem_shared/index-DjTWo3sH.js +0 -1
- package/dist/packem_shared/target-merge-DCGow6Kw.js +0 -4
- package/dist/packem_shared/vis-user-error-CAu9wIbe.js +0 -30
package/dist/packem_shared/{formatBytes-BHAzNIrn-DFIppnY0.js → formatBytes-BHAzNIrn-Bkk_uRS-.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createRequire as st}from"node:module";import{e as f}from"./index-DHD8wb6Z.js";import{y as G}from"./isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{p as ht}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";import{h as dt}from"./writeFileSync-DJoHk3Ks-CgQ-VNNT.js";let nt;const ot=t=>(nt??=st(import.meta.url))(t),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=t=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[s,e]=E.versions.node.split(".").map(Number);if(s>22||s===22&&e>=3||s===20&&e>=16)return E.getBuiltinModule(t)}return ot(t)},{existsSync:it,readdirSync:z,statSync:rt,rmSync:Y,writeFileSync:at}=I("node:fs"),{spawn:F}=I("node:child_process"),{createHash:ct}=I("node:crypto"),{platform:lt,homedir:ut}=I("node:os"),pt=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],ft=12288,gt=65510,mt=[12288,12288,65281,65376,65504,65510],wt=8361,bt=65518,yt=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],$t=32,St=10630,Et=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],xt=4352,Mt=262141,V=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],x=(t,s)=>{let e=0,n=Math.floor(t.length/2)-1;for(;e<=n;){const r=Math.floor((e+n)/2),c=r*2;if(s<t[c])n=r-1;else if(s>t[c+1])e=r+1;else return!0}return!1},j=19968,[kt,vt]=Bt(V);function Bt(t){let s=t[0],e=t[1];for(let n=0;n<t.length;n+=2){const r=t[n],c=t[n+1];if(j>=r&&j<=c)return[r,c];c-r>e-s&&(s=r,e=c)}return[s,e]}const Rt=t=>t<161||t>1114109?!1:x(pt,t),Tt=t=>t<ft||t>gt?!1:x(mt,t),It=t=>t<wt||t>bt?!1:x(yt,t),Wt=t=>t<$t||t>St?!1:x(Et,t),_t=t=>t>=kt&&t<=vt?!0:t<xt||t>Mt?!1:x(V,t);function Ct(t){return Rt(t)?"ambiguous":Tt(t)?"fullwidth":It(t)?"halfwidth":Wt(t)?"narrow":_t(t)?"wide":"neutral"}function At(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function Z(t){return At(t),Ct(t)}const H=String.raw,D=H`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Nt=()=>new RegExp(H`\p{RI}{2}|(?)${D}(?:\u200D${D})*`,"gu"),fe=new Set(["\x1B",""]),Ft="\x07",jt="[",ge="m",Dt="]8;;",me=39,we=/[\u200B\uFEFF\u2060-\u2064]/g,be=new RegExp(`(?:\\${jt}(?<code>\\d+)m|\\${Dt}(?<uri>.*)${Ft})`),ye=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),U=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,$e=/\u001B\[[\d;]*m[^\u001B]*(?:\u001B\[[\d;]*m|$)/g,Se=/\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)[^\u001B]*\u001B\]8;;(?:\u0007|\u001B\\)/g,B=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,q=Nt(),Ee=/[-_./\s]+/g,xe=/(\u001B\[[0-9;]*[a-z])/i,Me=new RegExp("\\p{Script=Arabic}","u"),ke=new RegExp("\\p{Script=Bengali}","u"),ve=new RegExp("\\p{Script=Cyrillic}","u"),Be=new RegExp("\\p{Script=Devanagari}","u"),Re=new RegExp("\\p{Script=Ethiopic}","u"),Te=new RegExp("\\p{Script=Greek}","u"),Ie=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),We=new RegExp("\\p{Script=Gujarati}","u"),_e=new RegExp("\\p{Script=Gurmukhi}","u"),Ce=new RegExp("\\p{Script=Hangul}","u"),Ae=new RegExp("\\p{Script=Hebrew}","u"),Ne=new RegExp("\\p{Script=Hiragana}","u"),Fe=new RegExp("\\p{Script=Han}","u"),je=new RegExp("\\p{Script=Kannada}","u"),De=new RegExp("\\p{Script=Katakana}","u"),Oe=new RegExp("\\p{Script=Khmer}","u"),Pe=new RegExp("\\p{Script=Lao}","u"),Ke=new RegExp("\\p{Script=Latin}","u"),Le=new RegExp("\\p{Script=Malayalam}","u"),ze=new RegExp("\\p{Script=Myanmar}","u"),Ye=new RegExp("\\p{Script=Oriya}","u"),Ge=new RegExp("\\p{Script=Sinhala}","u"),Ve=new RegExp("\\p{Script=Tamil}","u"),Ze=new RegExp("\\p{Script=Telugu}","u"),He=new RegExp("\\p{Script=Thai}","u"),Ue=new RegExp("\\p{Script=Tibetan}","u"),qe=/[\u02BB\u02BC\u0027]/u,Je=t=>t.replace(q,""),O=new Map,Ot=t=>[t.ambiguousIsNarrow?1:0,t.control,t.fullWidth,t.regular,t.wide].join("|"),Pt=t=>{const s=Ot(t.width);let e=O.get(s);return e||(e=new Map,O.set(s,e)),e},R=new RegExp(U.source,"y"),_=new RegExp(q.source,"uy"),T=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,J=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",Kt=(t,s)=>{const e=Pt(s),n=Math.floor(t/65536),r=t%65536;let c=e.get(n);if(c||(c=new Map,e.set(n,c)),c.has(r))return c.get(r);let o;switch(J(t)){case"control":{o=s.width.control;break}case"latin":{o=s.width.regular;break}case"wide":{o=s.width.wide;break}case"zero":{o=0;break}default:switch(Z(t)){case"ambiguous":{o=s.width.ambiguousIsNarrow?s.width.regular:s.width.wide;break}case"fullwidth":{o=s.width.fullWidth;break}case"wide":{o=s.width.wide;break}default:o=s.width.regular}}return c.set(r,o),o},Lt=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,C=(t,s={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const e={truncation:{countAnsiEscapeCodes:s.countAnsiEscapeCodes??!1,ellipsis:s.ellipsis??"",ellipsisWidth:s.ellipsisWidth??(s.ellipsis?C(s.ellipsis,{...s,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:s.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:s.ambiguousIsNarrow??!1,ansi:s.ansiWidth??0,control:s.controlWidth??0,emoji:s.emojiWidth??2,fullWidth:s.fullWidth??2,halfWidth:s.halfWidth??1,regular:s.regularWidth??1,tab:s.tabWidth??8,wide:s.wideWidth??2}},n=Math.max(0,e.truncation.limit-e.truncation.ellipsisWidth),{length:r}=t,c=r>1e4;let o=0,i=0,a=r,l=!1;const p=t.includes("\x1B")||t.includes("");for(;o<r;){if(p&&(t[o]==="\x1B"||t[o]==="")){if(t.startsWith("\x1B]8;;",o)){const d="\x1B]8;;\x07",w=d.length,y=t.indexOf("\x07",o+5);if(y!==-1){const $=t.indexOf(d,y+1);if($!==-1){const k=$+w,W=t.slice(y+1,$).replace(U,""),v=C(W,{ambiguousIsNarrow:e.width.ambiguousIsNarrow,ansiWidth:e.width.ansi,controlWidth:e.width.control,countAnsiEscapeCodes:!1,ellipsis:e.truncation.ellipsis,ellipsisWidth:e.truncation.ellipsisWidth,emojiWidth:e.width.emoji,fullWidth:e.width.fullWidth,halfWidth:e.width.halfWidth,limit:Math.max(0,n-i),regularWidth:e.width.regular,tabWidth:e.width.tab,wideWidth:e.width.wide}),S=v.width;if(v.truncated)l=!0,a=Math.min(a,o);else if(i+S>n&&(a=Math.min(a,o),l=!0,i+S>e.truncation.limit))break;if(i+=S,o=k,l&&i>=e.truncation.limit)break;continue}}}if(R.lastIndex=o,R.test(t)){const d=R.lastIndex-o,w=e.truncation.countAnsiEscapeCodes?d:e.width.ansi;if(i+w>n&&(a=Math.min(a,o),i+w>e.truncation.limit)){l=!0;break}i+=w,o=R.lastIndex;continue}}const u=t.codePointAt(o);if(u===8203||u===65279||u>=8288&&u<=8292){o+=1;continue}if(u===9){if(i+e.width.tab>n&&(a=Math.min(a,o),i+e.width.tab>e.truncation.limit)){l=!0;break}i+=e.width.tab,o+=1;continue}if(T.lastIndex=o,T.test(t)){const d=(T.lastIndex-o)*e.width.regular;if(i+d>n){const w=e.width.regular>0?Math.floor((n-i)/e.width.regular):0;if(a=Math.min(a,o+w),i+d>e.truncation.limit){l=!0;break}}i+=d,o=T.lastIndex;continue}if((u<=31||u>=127&&u<=159)&&(B.lastIndex=o,B.test(t))){const d=(B.lastIndex-o)*e.width.control;if(i+d>n){const w=e.width.control>0?Math.floor((n-i)/e.width.control):0;if(a=Math.min(a,o+w),i+d>e.truncation.limit){l=!0;break}}i+=d,o=B.lastIndex;continue}if(_.lastIndex=o,_.test(t)){if(i+e.width.emoji>n&&(a=Math.min(a,o),i+e.width.emoji>e.truncation.limit)){l=!0;break}i+=e.width.emoji,o=_.lastIndex;continue}const m=t.codePointAt(o)??0;if(Lt(m)){o+=m>65535?2:1;continue}let h;if(c)h=Kt(m,e);else switch(J(m)){case"control":{h=e.width.control;break}case"latin":{h=e.width.regular;break}case"wide":{h=e.width.wide;break}case"zero":{h=0;break}default:switch(Z(m)){case"ambiguous":{h=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{h=e.width.fullWidth;break}case"wide":{h=e.width.wide;break}default:h=e.width.regular}}if(i+h>n&&(a=Math.min(a,o),i+h>e.truncation.limit)){l=!0;break}i+=h,o+=m>65535?2:1}let g=i,b=!1;return l&&e.truncation.limit>=e.truncation.ellipsisWidth&&(g=e.truncation.limit,b=!0),{ellipsed:b,index:l?a:r,truncated:l,width:g}},Xe=(t,s={})=>C(t,{...s,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,A=()=>f(ut(),".vis"),zt=()=>f(A(),"cache"),Qe=()=>f(A(),"state"),Yt=t=>ct("sha256").update(t).digest("hex").slice(0,12),ts=t=>f(A(),"workspaces",Yt(t)),Gt=".vis",N=t=>f(t,Gt),es="node_modules/.cache/vis",ss=t=>f(N(t),"runs"),ns=t=>f(N(t),"last-summary.json"),os=t=>f(N(t),"last-failures"),is=t=>{const s=lt()==="win32";for(const e of[".task-runner",".task-runner-cache"]){const n=f(t,e);if(it(n))try{const r=s?F("cmd.exe",["/c","rmdir","/s","/q",n],{detached:!0,stdio:"ignore"}):F("rm",["-rf",n],{detached:!0,stdio:"ignore"});r.on("error",()=>{}),r.unref()}catch{}}},Vt="https://api.socket.dev/v0/purl?alerts=true",M=()=>f(zt(),"socket-security"),Zt=3600*1e3,X=.4,P=100,Ht=t=>typeof t=="object"&&t!==null&&"id"in t&&"type"in t&&"name"in t&&"version"in t&&"alerts"in t&&"score"in t&&t.type==="npm",Ut=()=>{dt(M())},Q=(t,s)=>`${encodeURIComponent(t)}@${encodeURIComponent(s)}`,qt=(t,s)=>{const e=Q(t,s),n=f(M(),`${e}.json`);try{const r=ht(n);if(Date.now()-r.createdAt>r.ttlMs){Y(n,{force:!0});return}return r.report}catch{return}},Jt=(t,s,e,n)=>{const r=Q(t,s),c={createdAt:Date.now(),report:e,ttlMs:n};at(f(M(),`${r}.json`),JSON.stringify(c),"utf8")},Xt=t=>{const s=[t.license,t.maintenance,t.quality,t.supplyChain,t.vulnerability];return Number((s.reduce((e,n)=>e+n,0)/s.length).toFixed(2))},Qt=async(t,s={})=>{const{apiToken:e,cacheTtlMs:n=Zt,timeoutMs:r=15e3}=s,c=new Map;if(t.length===0||!e)return c;const o=[];for(const l of t){const p=qt(l.name,l.version);p?c.set(`${l.name}@${l.version}`,p):o.push(l)}if(o.length===0)return c;const i=`Basic ${Buffer.from(`${e}:`).toString("base64")}`;Ut();const a=[];for(let l=0;l<o.length;l+=P)a.push(o.slice(l,l+P));for(const l of a){const p=l.map(u=>({purl:`pkg:npm/${u.name}@${u.version}`})),g=new AbortController,b=setTimeout(()=>{g.abort()},r);try{const u=await fetch(Vt,{body:JSON.stringify({components:p}),headers:{Authorization:i,"Content-Type":"application/json","User-Agent":"@visulima/vis"},method:"POST",signal:g.signal});if(!u.ok)continue;const m=await u.text();te(m,l,c,n)}catch{}finally{clearTimeout(b)}}return c},te=(t,s,e,n)=>{const r=new Map;for(const o of s)r.set(`${o.name}@${o.version}`,o);const c=t.split(`}
|
|
1
|
+
import{createRequire as st}from"node:module";import{e as f}from"./index-DHD8wb6Z.js";import{y as G}from"./isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{p as ht}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";import{h as dt}from"./writeFileSync-DJoHk3Ks-CgQ-VNNT.js";let nt;const ot=t=>(nt??=st(import.meta.url))(t),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,I=t=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[s,e]=E.versions.node.split(".").map(Number);if(s>22||s===22&&e>=3||s===20&&e>=16)return E.getBuiltinModule(t)}return ot(t)},{existsSync:it,readdirSync:z,statSync:rt,rmSync:Y,writeFileSync:at}=I("node:fs"),{spawn:F}=I("node:child_process"),{createHash:ct}=I("node:crypto"),{homedir:lt,platform:ut}=I("node:os"),pt=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],ft=12288,gt=65510,mt=[12288,12288,65281,65376,65504,65510],wt=8361,bt=65518,yt=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],$t=32,St=10630,Et=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],xt=4352,Mt=262141,V=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],x=(t,s)=>{let e=0,n=Math.floor(t.length/2)-1;for(;e<=n;){const r=Math.floor((e+n)/2),c=r*2;if(s<t[c])n=r-1;else if(s>t[c+1])e=r+1;else return!0}return!1},j=19968,[kt,vt]=Bt(V);function Bt(t){let s=t[0],e=t[1];for(let n=0;n<t.length;n+=2){const r=t[n],c=t[n+1];if(j>=r&&j<=c)return[r,c];c-r>e-s&&(s=r,e=c)}return[s,e]}const Rt=t=>t<161||t>1114109?!1:x(pt,t),Tt=t=>t<ft||t>gt?!1:x(mt,t),It=t=>t<wt||t>bt?!1:x(yt,t),Wt=t=>t<$t||t>St?!1:x(Et,t),_t=t=>t>=kt&&t<=vt?!0:t<xt||t>Mt?!1:x(V,t);function Ct(t){return Rt(t)?"ambiguous":Tt(t)?"fullwidth":It(t)?"halfwidth":Wt(t)?"narrow":_t(t)?"wide":"neutral"}function At(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function Z(t){return At(t),Ct(t)}const H=String.raw,D=H`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Nt=()=>new RegExp(H`\p{RI}{2}|(?)${D}(?:\u200D${D})*`,"gu"),fe=new Set(["\x1B",""]),Ft="\x07",jt="[",ge="m",Dt="]8;;",me=39,we=/[\u200B\uFEFF\u2060-\u2064]/g,be=new RegExp(`(?:\\${jt}(?<code>\\d+)m|\\${Dt}(?<uri>.*)${Ft})`),ye=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),U=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,$e=/\u001B\[[\d;]*m[^\u001B]*(?:\u001B\[[\d;]*m|$)/g,Se=/\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)[^\u001B]*\u001B\]8;;(?:\u0007|\u001B\\)/g,B=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,q=Nt(),Ee=/[-_./\s]+/g,xe=/(\u001B\[[0-9;]*[a-z])/i,Me=new RegExp("\\p{Script=Arabic}","u"),ke=new RegExp("\\p{Script=Bengali}","u"),ve=new RegExp("\\p{Script=Cyrillic}","u"),Be=new RegExp("\\p{Script=Devanagari}","u"),Re=new RegExp("\\p{Script=Ethiopic}","u"),Te=new RegExp("\\p{Script=Greek}","u"),Ie=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),We=new RegExp("\\p{Script=Gujarati}","u"),_e=new RegExp("\\p{Script=Gurmukhi}","u"),Ce=new RegExp("\\p{Script=Hangul}","u"),Ae=new RegExp("\\p{Script=Hebrew}","u"),Ne=new RegExp("\\p{Script=Hiragana}","u"),Fe=new RegExp("\\p{Script=Han}","u"),je=new RegExp("\\p{Script=Kannada}","u"),De=new RegExp("\\p{Script=Katakana}","u"),Oe=new RegExp("\\p{Script=Khmer}","u"),Pe=new RegExp("\\p{Script=Lao}","u"),Ke=new RegExp("\\p{Script=Latin}","u"),Le=new RegExp("\\p{Script=Malayalam}","u"),ze=new RegExp("\\p{Script=Myanmar}","u"),Ye=new RegExp("\\p{Script=Oriya}","u"),Ge=new RegExp("\\p{Script=Sinhala}","u"),Ve=new RegExp("\\p{Script=Tamil}","u"),Ze=new RegExp("\\p{Script=Telugu}","u"),He=new RegExp("\\p{Script=Thai}","u"),Ue=new RegExp("\\p{Script=Tibetan}","u"),qe=/[\u02BB\u02BC\u0027]/u,Je=t=>t.replace(q,""),O=new Map,Ot=t=>[t.ambiguousIsNarrow?1:0,t.control,t.fullWidth,t.regular,t.wide].join("|"),Pt=t=>{const s=Ot(t.width);let e=O.get(s);return e||(e=new Map,O.set(s,e)),e},R=new RegExp(U.source,"y"),_=new RegExp(q.source,"uy"),T=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,J=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",Kt=(t,s)=>{const e=Pt(s),n=Math.floor(t/65536),r=t%65536;let c=e.get(n);if(c||(c=new Map,e.set(n,c)),c.has(r))return c.get(r);let o;switch(J(t)){case"control":{o=s.width.control;break}case"latin":{o=s.width.regular;break}case"wide":{o=s.width.wide;break}case"zero":{o=0;break}default:switch(Z(t)){case"ambiguous":{o=s.width.ambiguousIsNarrow?s.width.regular:s.width.wide;break}case"fullwidth":{o=s.width.fullWidth;break}case"wide":{o=s.width.wide;break}default:o=s.width.regular}}return c.set(r,o),o},Lt=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,C=(t,s={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const e={truncation:{countAnsiEscapeCodes:s.countAnsiEscapeCodes??!1,ellipsis:s.ellipsis??"",ellipsisWidth:s.ellipsisWidth??(s.ellipsis?C(s.ellipsis,{...s,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:s.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:s.ambiguousIsNarrow??!1,ansi:s.ansiWidth??0,control:s.controlWidth??0,emoji:s.emojiWidth??2,fullWidth:s.fullWidth??2,halfWidth:s.halfWidth??1,regular:s.regularWidth??1,tab:s.tabWidth??8,wide:s.wideWidth??2}},n=Math.max(0,e.truncation.limit-e.truncation.ellipsisWidth),{length:r}=t,c=r>1e4;let o=0,i=0,a=r,l=!1;const p=t.includes("\x1B")||t.includes("");for(;o<r;){if(p&&(t[o]==="\x1B"||t[o]==="")){if(t.startsWith("\x1B]8;;",o)){const d="\x1B]8;;\x07",w=d.length,y=t.indexOf("\x07",o+5);if(y!==-1){const $=t.indexOf(d,y+1);if($!==-1){const k=$+w,W=t.slice(y+1,$).replace(U,""),v=C(W,{ambiguousIsNarrow:e.width.ambiguousIsNarrow,ansiWidth:e.width.ansi,controlWidth:e.width.control,countAnsiEscapeCodes:!1,ellipsis:e.truncation.ellipsis,ellipsisWidth:e.truncation.ellipsisWidth,emojiWidth:e.width.emoji,fullWidth:e.width.fullWidth,halfWidth:e.width.halfWidth,limit:Math.max(0,n-i),regularWidth:e.width.regular,tabWidth:e.width.tab,wideWidth:e.width.wide}),S=v.width;if(v.truncated)l=!0,a=Math.min(a,o);else if(i+S>n&&(a=Math.min(a,o),l=!0,i+S>e.truncation.limit))break;if(i+=S,o=k,l&&i>=e.truncation.limit)break;continue}}}if(R.lastIndex=o,R.test(t)){const d=R.lastIndex-o,w=e.truncation.countAnsiEscapeCodes?d:e.width.ansi;if(i+w>n&&(a=Math.min(a,o),i+w>e.truncation.limit)){l=!0;break}i+=w,o=R.lastIndex;continue}}const u=t.codePointAt(o);if(u===8203||u===65279||u>=8288&&u<=8292){o+=1;continue}if(u===9){if(i+e.width.tab>n&&(a=Math.min(a,o),i+e.width.tab>e.truncation.limit)){l=!0;break}i+=e.width.tab,o+=1;continue}if(T.lastIndex=o,T.test(t)){const d=(T.lastIndex-o)*e.width.regular;if(i+d>n){const w=e.width.regular>0?Math.floor((n-i)/e.width.regular):0;if(a=Math.min(a,o+w),i+d>e.truncation.limit){l=!0;break}}i+=d,o=T.lastIndex;continue}if((u<=31||u>=127&&u<=159)&&(B.lastIndex=o,B.test(t))){const d=(B.lastIndex-o)*e.width.control;if(i+d>n){const w=e.width.control>0?Math.floor((n-i)/e.width.control):0;if(a=Math.min(a,o+w),i+d>e.truncation.limit){l=!0;break}}i+=d,o=B.lastIndex;continue}if(_.lastIndex=o,_.test(t)){if(i+e.width.emoji>n&&(a=Math.min(a,o),i+e.width.emoji>e.truncation.limit)){l=!0;break}i+=e.width.emoji,o=_.lastIndex;continue}const m=t.codePointAt(o)??0;if(Lt(m)){o+=m>65535?2:1;continue}let h;if(c)h=Kt(m,e);else switch(J(m)){case"control":{h=e.width.control;break}case"latin":{h=e.width.regular;break}case"wide":{h=e.width.wide;break}case"zero":{h=0;break}default:switch(Z(m)){case"ambiguous":{h=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{h=e.width.fullWidth;break}case"wide":{h=e.width.wide;break}default:h=e.width.regular}}if(i+h>n&&(a=Math.min(a,o),i+h>e.truncation.limit)){l=!0;break}i+=h,o+=m>65535?2:1}let g=i,b=!1;return l&&e.truncation.limit>=e.truncation.ellipsisWidth&&(g=e.truncation.limit,b=!0),{ellipsed:b,index:l?a:r,truncated:l,width:g}},Xe=(t,s={})=>C(t,{...s,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,A=()=>f(lt(),".vis"),zt=()=>f(A(),"cache"),Qe=()=>f(A(),"state"),Yt=t=>ct("sha256").update(t).digest("hex").slice(0,12),ts=t=>f(A(),"workspaces",Yt(t)),Gt=".vis",N=t=>f(t,Gt),es="node_modules/.cache/vis",ss=t=>f(N(t),"runs"),ns=t=>f(N(t),"last-summary.json"),os=t=>f(N(t),"last-failures"),is=t=>{const s=ut()==="win32";for(const e of[".task-runner",".task-runner-cache"]){const n=f(t,e);if(it(n))try{const r=s?F("cmd.exe",["/c","rmdir","/s","/q",n],{detached:!0,stdio:"ignore"}):F("rm",["-rf",n],{detached:!0,stdio:"ignore"});r.on("error",()=>{}),r.unref()}catch{}}},Vt="https://api.socket.dev/v0/purl?alerts=true",M=()=>f(zt(),"socket-security"),Zt=3600*1e3,X=.4,P=100,Ht=t=>typeof t=="object"&&t!==null&&"id"in t&&"type"in t&&"name"in t&&"version"in t&&"alerts"in t&&"score"in t&&t.type==="npm",Ut=()=>{dt(M())},Q=(t,s)=>`${encodeURIComponent(t)}@${encodeURIComponent(s)}`,qt=(t,s)=>{const e=Q(t,s),n=f(M(),`${e}.json`);try{const r=ht(n);if(Date.now()-r.createdAt>r.ttlMs){Y(n,{force:!0});return}return r.report}catch{return}},Jt=(t,s,e,n)=>{const r=Q(t,s),c={createdAt:Date.now(),report:e,ttlMs:n};at(f(M(),`${r}.json`),JSON.stringify(c),"utf8")},Xt=t=>{const s=[t.license,t.maintenance,t.quality,t.supplyChain,t.vulnerability];return Number((s.reduce((e,n)=>e+n,0)/s.length).toFixed(2))},Qt=async(t,s={})=>{const{apiToken:e,cacheTtlMs:n=Zt,timeoutMs:r=15e3}=s,c=new Map;if(t.length===0||!e)return c;const o=[];for(const l of t){const p=qt(l.name,l.version);p?c.set(`${l.name}@${l.version}`,p):o.push(l)}if(o.length===0)return c;const i=`Basic ${Buffer.from(`${e}:`).toString("base64")}`;Ut();const a=[];for(let l=0;l<o.length;l+=P)a.push(o.slice(l,l+P));for(const l of a){const p=l.map(u=>({purl:`pkg:npm/${u.name}@${u.version}`})),g=new AbortController,b=setTimeout(()=>{g.abort()},r);try{const u=await fetch(Vt,{body:JSON.stringify({components:p}),headers:{Authorization:i,"Content-Type":"application/json","User-Agent":"@visulima/vis"},method:"POST",signal:g.signal});if(!u.ok)continue;const m=await u.text();te(m,l,c,n)}catch{}finally{clearTimeout(b)}}return c},te=(t,s,e,n)=>{const r=new Map;for(const o of s)r.set(`${o.name}@${o.version}`,o);const c=t.split(`}
|
|
2
2
|
`);for(const o of c){const i=o.trim();if(i)try{const a=JSON.parse(i.endsWith("}")?i:`${i}}`),p=`${a.namespace?`${a.namespace}/`:""}${a.name}`,g=`${p}@${a.version}`;if(!r.has(g))continue;const b=a.score.overall??Xt(a.score),u={alerts:a.alerts,author:a.author,id:a.id,license:a.license,name:a.name,score:{...a.score,overall:b},size:a.size,type:"npm",version:a.version};a.namespace&&(u.namespace=a.namespace),Ht(u)&&(e.set(g,u),Jt(p,a.version,u,n))}catch{}}},ee=t=>t.namespace?`${t.namespace}/${t.name}`:t.name,rs=t=>t>=.8?"excellent":t>=.6?"good":t>=.4?"fair":t>=.2?"poor":"critical",as=t=>t>=.6?"green":t>=.4?"yellow":"red",cs=t=>{const s=ee(t),e=`score: ${String(Math.round(t.score.overall*100))}%`,n=t.alerts.length,r=n>0?`${String(n)} alert${n===1?"":"s"}`:"no alerts";return`${s}@${t.version} (${e}, ${r})`},ls=(t,s=X)=>{if(t.size===0)return"";let e=0,n=0,r=0,c=0,o=0,i=0;for(const l of t.values()){for(const p of l.alerts)switch(e++,p.severity){case"critical":{n++;break}case"high":{r++;break}case"medium":{c++;break}default:o++}l.score.overall<s&&i++}const a=[`Socket.dev: scanned ${String(t.size)} package${t.size===1?"":"s"}`];if(e>0){const l=[];n>0&&l.push(`${String(n)} critical`),r>0&&l.push(`${String(r)} high`),c>0&&l.push(`${String(c)} medium`),o>0&&l.push(`${String(o)} low`),a.push(` Alerts: ${String(e)} total (${l.join(", ")})`)}else a.push(" No security alerts found.");if(i>0){const l=Math.round(s*100);a.push(` ${String(i)} package${i===1?"":"s"} with low security score (<${String(l)}%)`)}return a.join(`
|
|
3
3
|
`)},se=()=>{const t=M();if(!G(t))return 0;const s=z(t).filter(e=>e.endsWith(".json"));for(const e of s)Y(f(t,e),{force:!0});return s.length},ne=()=>{const t=M();if(!G(t))return{entries:0,newestEntry:void 0,oldestEntry:void 0,totalSizeBytes:0};const s=z(t).filter(c=>c.endsWith(".json"));let e=0,n,r;for(const c of s){const o=rt(f(t,c));e+=o.size;const{mtimeMs:i}=o;(n===void 0||i<n)&&(n=i),(r===void 0||i>r)&&(r=i)}return{entries:s.length,newestEntry:r,oldestEntry:n,totalSizeBytes:e}},oe=(t,s)=>t?.enabled?{apiToken:t.apiToken??process.env.VIS_SOCKET_TOKEN,cacheTtlMs:t.cacheTtlMs,minimumScore:s??X,timeoutMs:t.timeoutMs}:void 0,us=(t,s,e,n)=>{if(!e)return;const r=Date.now(),c=i=>{if(i.expiresAt){const a=Date.parse(i.expiresAt);if(!Number.isNaN(a)&&a<r)return!1}return!(n&&i.policies&&!i.policies.includes(n))},o=`${t}@${s}`;if(e[o]&&c(e[o]))return e[o];if(e[t]&&c(e[t]))return e[t];for(const[i,a]of Object.entries(e))if(i.endsWith("*")&&t.startsWith(i.slice(0,-1))&&c(a))return a},hs=(t,s,e,n)=>[" // Add to security.acceptedRisks in vis.config.ts:",` ${`"${t}"`}: {`,` reason: "${n}",`,` acceptedAt: "${new Date().toISOString()}",`,` acceptedScore: ${String(e)},`,' policies: ["score"],'," },"].join(`
|
|
4
4
|
`),ds=(t,s={})=>{const e=oe(t,s.minimumScore);if(e)return{clearCache:se,displayName:"Socket.dev",fetchReports:n=>Qt(n,e),getCacheStats:ne,id:"socket"}},ps=t=>{if(t===void 0)return!1;const s=t.trim().toLowerCase();return s!==""&&s!=="0"&&s!=="false"&&s!=="no"},tt={iec:[{long:"Bytes",short:"B"},{long:"Kibibytes",short:"KiB"},{long:"Mebibytes",short:"MiB"},{long:"Gibibytes",short:"GiB"},{long:"Tebibytes",short:"TiB"},{long:"Pebibytes",short:"PiB"},{long:"Exbibytes",short:"EiB"},{long:"Zebibytes",short:"ZiB"},{long:"Yobibytes",short:"YiB"}],iec_octet:[{long:"Octets",short:"o"},{long:"Kibioctets",short:"Kio"},{long:"Mebioctets",short:"Mio"},{long:"Gibioctets",short:"Gio"},{long:"Tebioctets",short:"Tio"},{long:"Pebioctets",short:"Pio"},{long:"Exbioctets",short:"Eio"},{long:"Zebioctets",short:"Zio"},{long:"Yobioctets",short:"Yio"}],metric:[{long:"Bytes",short:"Bytes"},{long:"Kilobytes",short:"KB"},{long:"Megabytes",short:"MB"},{long:"Gigabytes",short:"GB"},{long:"Terabytes",short:"TB"},{long:"Petabytes",short:"PB"},{long:"Exabytes",short:"EB"},{long:"Zettabytes",short:"ZB"},{long:"Yottabytes",short:"YB"}],metric_octet:[{long:"Octets",short:"o"},{long:"Kilo-octets",short:"ko"},{long:"Mega-octets",short:"Mo"},{long:"Giga-octets",short:"Go"},{long:"Tera-octets",short:"To"},{long:"Peta-octets",short:"Po"},{long:"Exa-octets",short:"Eo"},{long:"Zetta-octets",short:"Zo"},{long:"Yotta-octets",short:"Yo"}]},ie=[{long:"bits",short:"bit"},{long:"Kilobits",short:"kbit"},{long:"Megabits",short:"Mbit"},{long:"Gigabits",short:"Gbit"},{long:"Terabits",short:"Tbit"},{long:"Petabits",short:"Pbit"},{long:"Exabits",short:"Ebit"},{long:"Zettabits",short:"Zbit"},{long:"Yottabits",short:"Ybit"}],K=new Map,L=(t,s)=>{const e=`${t}\0${JSON.stringify(s)}`;let n=K.get(e);return n===void 0&&(n=new Intl.NumberFormat(t,s),K.set(e,n)),n},re=t=>{switch(t){case 2:return 1024;case 10:return 1e3;default:throw new Error("Unsupported base.")}},ae=(t,s,e)=>({maximumFractionDigits:t,minimumFractionDigits:t,...s,...e}),ce=(t,s,e,n)=>{if(t===void 0)return-1;const r=s.findIndex(c=>c.short===t);return r===-1&&n?tt[e].findIndex(c=>c.short===t):r},fs=(t,s)=>{if(typeof t!="number"||!Number.isFinite(t))throw new TypeError("Bytesize is not a number.");const{base:e,bits:n,decimals:r,locale:c,long:o,signed:i,unit:a,units:l,...p}={base:2,bits:!1,decimals:0,locale:"en-US",long:!1,signed:!1,units:"metric",...s},g=re(e),b=n?t*8:t,u=Math.abs(b),m=s?.space??!0?" ":"",h=n?ie:tt[l],d=ce(a,h,l,n),w=r<0?void 0:r,y=i?{signDisplay:"exceptZero"}:{};if(b===0){const S=d===-1?0:Math.min(d,h.length-1),et=h[S][o?"long":"short"];return L(c,{...y,...p}).format(0)+m+et}const $=Math.max(0,Math.min(Math.floor(Math.log(u)/Math.log(g)),h.length-1)),k=d===-1?$:d,W=h[k][o?"long":"short"],v=b/g**k;return L(c,ae(w,y,p)).format(v)+m+W};export{fs as $,Le as A,Ge as B,Me as C,X as D,He as E,Te as F,ke as G,xe as H,Pe as I,Ue as J,ze as K,Re as L,ve as M,Oe as N,Ee as O,We as P,qe as Q,is as R,$e as S,Se as T,Fe as U,Ye as V,Ce as W,Je as X,De as Y,Ze as Z,U as _,os as a,C as a0,Tt as a1,_t as a2,we as a3,fe as a4,Dt as a5,Ft as a6,ge as a7,be as a8,ye as a9,jt as aa,me as ab,ds as ac,ls as ad,es as ae,ne as af,se as ag,ns as ah,A as b,N as c,ss as d,ee as e,us as f,zt as g,cs as h,rs as i,hs as j,ps as k,Qe as l,Xt as m,Qt as n,Xe as o,ts as p,q,Ke as r,as as s,Ie as t,Ne as u,Ae as v,Be as w,_e as x,je as y,Ve as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as k,D as S,f as L}from"./provenance-
|
|
1
|
+
import{m as k,D as S,f as L}from"./provenance-w-NIPtim.js";import{g as $}from"./packument-CHdDsn0O.js";import{f}from"./formatBytes-BHAzNIrn-Bkk_uRS-.js";import{a as E}from"./build-scripts-pdVmqXRm.js";import{n as h}from"./license-DvlYdo6T.js";import{v as A,U as P,z as x}from"./index-DHD8wb6Z.js";import{S as O}from"./lockfile-DhHAaHN5.js";import{L as b}from"./dependency-scan-DBH2Qo4I.js";const C=2,m=4,y={CRITICAL:0,HIGH:1,LOW:3,MODERATE:C,UNKNOWN:m},ae=(s,e)=>{const n=y[(s.vulnerability.severity??"UNKNOWN").toUpperCase()]??m,t=y[(e.vulnerability.severity??"UNKNOWN").toUpperCase()]??m;return n-t||s.packageName.localeCompare(e.packageName)||s.packageVersion.localeCompare(e.packageVersion)},M=(s,e)=>{const n=y[e.toUpperCase()]??C;return(y[s.toUpperCase()]??m)<=n},R=["firstSeen","installScripts","license","malware","publisherChange","score","unexpectedDeps","vulnerability"],w=6e4,D=(s,e,n)=>{for(const t of n)if(t===s||t===`${s}@${e}`||t.endsWith("*")&&s.startsWith(t.slice(0,-1)))return!0;return!1},W=async(s,e)=>{const n=e.security?.policies?.firstSeen;if(n?.minutes===void 0||n.minutes<=0)return[];const{minutes:t}=n,r=n.exclude??[],a=e.security?.acceptedRisks,c=t*w,o=Date.now();return(await k(s.packages,S,async l=>{if(D(l.name,l.version,r))return;const p=await $(l.name,{workspaceRoot:s.workspaceRoot});if(p===void 0)return;const u=p.time?.[l.version];if(u===void 0)return;const d=Date.parse(u);if(Number.isNaN(d))return;const v=o-d;if(v>=c)return;const g=Math.max(0,Math.floor(v/w));return{acceptedRisk:f(l.name,l.version,a,"firstSeen"),data:{ageMinutes:g,minimumMinutes:t,publishedAt:u},packageName:l.name,policy:"firstSeen",reason:`${l.name}@${l.version} was published ${String(g)} min ago — below the ${String(t)} min firstSeen cooldown.`,severity:"block",version:l.version}})).filter(l=>l!==void 0)},U=(s,e)=>{const n=e.security?.policies?.installScripts;if(!n)return[];const t=n.allow??{},r=n.strict===!0;if(!r&&Object.keys(t).length===0)return[];const a=E(s.workspaceRoot,t,{pinVersions:e.security?.pinVersions===!0});if(a.unapproved.length===0)return[];const c=e.security?.acceptedRisks,o=r?"block":"warn";return a.unapproved.map(i=>({acceptedRisk:f(i.name,i.version??"*",c,"installScripts"),data:{hooks:i.hooks},packageName:i.name,policy:"installScripts",reason:`${i.name}${i.version?`@${i.version}`:""} declares unapproved build script(s): ${i.hooks.join(", ")}`,severity:o,version:i.version??"*"}))},_=new Set(["AND","OR"]),I=s=>{const e=s.replaceAll("("," ").replaceAll(")"," ").split(/\s+/).map(r=>r.trim()).filter(r=>r.length>0),n=[];let t=!1;for(const r of e){const a=r.toUpperCase();if(t){t=!1;continue}if(a==="WITH"){t=!0;continue}if(_.has(a))continue;const c=r.endsWith("+"),o=c?r.slice(0,-1):r,i=h(o)??o;n.push(i),c&&n.push(`${i}-or-later`)}return n},T=s=>{if(typeof s.license=="string"){const e=s.license.trim();return e.length>0?e:void 0}if(s.license&&typeof s.license=="object"&&typeof s.license.type=="string"){const e=s.license.type.trim();if(e.length>0)return e}if(Array.isArray(s.licenses)&&s.licenses.length>0){const e=s.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 ")})`}},V=(s,e)=>{if(e.length===0)return;const n=new Set(e.map(t=>h(t)??t).map(t=>t.toLowerCase()));for(const t of s)if(n.has(t.toLowerCase()))return t},F=(s,e)=>{if(e.length===0)return;const n=new Set(e.map(t=>h(t)??t).map(t=>t.toLowerCase()));for(const t of s)if(!n.has(t.toLowerCase()))return t},j=(s,e)=>{const n=e.security?.policies?.license;if(!n)return[];const t=n.allow??[],r=n.deny??[];if(t.length===0&&r.length===0)return[];const a=e.security?.acceptedRisks,c=[];for(const o of s.packages){const i=s.manifestData?.get(`${o.name}@${o.version}`),l=i?T(i):void 0;if(!l){t.length>0&&c.push({acceptedRisk:f(o.name,o.version,a,"license"),data:{declaredLicense:null},packageName:o.name,policy:"license",reason:`${o.name}@${o.version} declares no license; allow-list mode requires one of: ${t.join(", ")}`,severity:"block",version:o.version});continue}const p=I(l),u=V(p,r);if(u){c.push({acceptedRisk:f(o.name,o.version,a,"license"),data:{declaredLicense:l,deniedLicense:u},packageName:o.name,policy:"license",reason:`${o.name}@${o.version} uses denied license '${u}' (declared: ${l})`,severity:"block",version:o.version});continue}const d=F(p,t);d&&c.push({acceptedRisk:f(o.name,o.version,a,"license"),data:{allowList:t,declaredLicense:l,unallowedLicense:d},packageName:o.name,policy:"license",reason:`${o.name}@${o.version} uses license '${d}' which is not on the allow-list (declared: ${l})`,severity:"block",version:o.version})}return c},K=6e4,z=(s,e,n)=>{for(const t of n)if(t===s||t===`${s}@${e}`||t.endsWith("*")&&s.startsWith(t.slice(0,-1)))return!0;return!1},B=async(s,e)=>{const n=e.security?.policies?.publisherChange;if(n?.mode!=="no-downgrade")return[];const t=n.exclude??[],r=typeof n.ignoreAfter=="number"?n.ignoreAfter*K:void 0,a=e.security?.acceptedRisks,c=Date.now();return(await k(s.packages,S,async i=>{if(z(i.name,i.version,t))return;const l=await $(i.name,{workspaceRoot:s.workspaceRoot});if(l===void 0)return;if(r!==void 0){const d=l.time?.[i.version],v=d===void 0?Number.NaN:Date.parse(d);if(!Number.isNaN(v)&&c-v>r)return}if(l.versions[i.version]?.dist?.attestations?.provenance!==void 0)return;const u=L(l,i.version);if(u!==void 0)return{acceptedRisk:f(i.name,i.version,a,"publisherChange"),data:{priorVersionWithProvenance:u},packageName:i.name,policy:"publisherChange",reason:`${i.name}@${i.version} dropped the provenance attestation that ${i.name}@${u} carried — publisher trust downgrade.`,severity:"block",version:i.version}})).filter(i=>i!==void 0)},Y=s=>{for(const e of Object.values(b))for(const n of[e.file,...e.aliases??[]])if(s===n||s.endsWith(`/${n}`)||s.endsWith(`.${n}`))return e.type},H=(s,e,n)=>{const t=A(e)?e:P(s,e);let r;try{r=x(t)}catch{return}const a=Y(t)??b[n]?.type;if(!a)return;const c=O(r,a);if(c.length===0)return;const o=new Set;for(const i of c)o.add(`${i.name}@${i.version}`);return o},q=(s,e)=>{for(const n of e)if(n===s||n.endsWith("*")&&s.startsWith(n.slice(0,-1)))return!0;return!1},G=(s,e)=>{const n=e.security?.policies?.unexpectedDeps;if(!n)return[];const t=n.allow??[],r=n.baselineLockfile;if(t.length===0&&!r)return[];const a=r?H(s.workspaceRoot,r,s.packageManager):void 0,c=e.security?.acceptedRisks,o=[];for(const i of s.packages){const l=t.length===0||q(i.name,t),p=a?a.has(`${i.name}@${i.version}`):!0;if(l&&p)continue;const u=[],d={};l||(u.push(`not on allow-list (${t.length} entr${t.length===1?"y":"ies"})`),d.allowList=t),!p&&a&&(u.push(`not present in baseline lockfile (${r})`),d.baselineLockfile=r),o.push({acceptedRisk:f(i.name,i.version,c,"unexpectedDeps"),data:d,packageName:i.name,policy:"unexpectedDeps",reason:`${i.name}@${i.version} is unexpected: ${u.join("; ")}`,severity:"block",version:i.version})}return o},X=(s,e)=>{if(!s.osvFindings||s.osvFindings.size===0)return[];const t=e.security?.policies?.vulnerability?.failOn,r=e.security?.acceptedRisks,a=[];for(const c of s.packages){const o=s.osvFindings.get(c.name);if(!(!o||o.length===0))for(const i of o){const l=t?M(i.severity,t)?"block":"warn":"info";a.push({acceptedRisk:f(c.name,c.version,r,"vulnerability"),data:{advisoryId:i.id,aliases:i.aliases??[],cvssScore:i.cvssScore,fixedVersions:i.fixedVersions,severity:i.severity,summary:i.summary},packageName:c.name,policy:"vulnerability",reason:`${i.severity} ${i.id} affects ${c.name}@${c.version}: ${i.summary}`,severity:l,version:c.version})}}return a},N=[{evaluate:X,isConfigured:s=>s.security?.policies?.vulnerability!==void 0,name:"vulnerability",offlineSupported:!0,surfaces:["audit","doctor"]},{evaluate:j,isConfigured:s=>{const e=s.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:U,isConfigured:s=>{const e=s.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:G,isConfigured:s=>{const e=s.security?.policies?.unexpectedDeps;return!!(e&&(e.allow&&e.allow.length>0||typeof e.baselineLockfile=="string"))},name:"unexpectedDeps",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:W,isConfigured:s=>{const e=s.security?.policies?.firstSeen?.minutes;return typeof e=="number"&&e>0},name:"firstSeen",offlineSupported:!1,surfaces:["audit","doctor","install"]},{evaluate:B,isConfigured:s=>s.security?.policies?.publisherChange?.mode==="no-downgrade",name:"publisherChange",offlineSupported:!1,surfaces:["audit","doctor","install"]}],J=(s,e,n)=>N.filter(t=>t.surfaces.includes(s)?n!==void 0?n.has(t.name):t.isConfigured(e):!1),ce=async(s,e,n)=>{const t=J(e,n.visConfig,n.enabledPolicies),r=[];for(const a of t){if(s.offline&&!a.offlineSupported){r.push({packageName:"*",policy:a.name,reason:`policy.${a.name} skipped: requires network (--offline)`,severity:"info",version:"*"});continue}try{const c=await a.evaluate(s,n.visConfig);r.push(...c)}catch(c){const o=c instanceof Error?c.message:String(c);r.push({packageName:"*",policy:a.name,reason:`policy.${a.name} failed: ${o}`,severity:"info",version:"*"})}}return r},Q=(()=>{const s=new Map;for(const e of R)s.set(e.toLowerCase(),e);return s})(),le=()=>N.map(s=>s.name),ue=(s,e)=>{if(s===void 0)return;const n=s.trim().toLowerCase();if(n===""||n==="none")return new Set;if(n==="all")return new Set(R);const t=new Set;for(const r of s.split(",").map(a=>a.trim()).filter(a=>a.length>0)){const a=r.replace(/^_+/,"").replaceAll(/_+([a-z])/g,(o,i)=>i.toUpperCase()),c=Q.get(a.toLowerCase());c===void 0?e?.(r):t.add(c)}return t};export{ae as c,ce as e,le as g,ue as p,M as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as e}from"./vis-user-error-DZSnp0Uj.js";const o={filter:{alias:"F",description:"Filter packages by name pattern",multiple:!0,type:String},parallel:{defaultValue:!1,description:"Run concurrently without topological ordering",type:Boolean},recursive:{alias:"r",defaultValue:!1,description:"Run in every workspace package",type:Boolean},reverse:{defaultValue:!1,description:"Reverse topological execution order",type:Boolean},"shell-mode":{alias:"c",defaultValue:!1,description:"Execute within shell environment",type:Boolean},"workspace-root":{alias:"w",defaultValue:!1,description:"Run on workspace root only",type:Boolean}},l=e({argument:{description:"Command to execute followed by arguments",name:"command",type:String},description:"Execute a local node_modules/.bin command (no remote fallback)",examples:[["vis exec eslint .","Run local eslint"],["vis exec tsc --noEmit","Run local TypeScript check"],["vis exec -r -- eslint .","Run in all workspace packages"],["vis exec -c 'echo $PATH'","Shell mode"]],group:"Run & Execute",loader:()=>import("../packem_chunks/handler.js"),name:"exec",options:o});export{l as e};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as K}from"node:module";import{n as E,o as z,C as S,f as X,e as h}from"./index-DHD8wb6Z.js";import{p as rt}from"./formatBytes-BHAzNIrn-
|
|
1
|
+
import{createRequire as K}from"node:module";import{n as E,o as z,C as S,f as X,e as h}from"./index-DHD8wb6Z.js";import{p as rt}from"./formatBytes-BHAzNIrn-Bkk_uRS-.js";import{N as it}from"./readJsonSync-CbryXYxN-B2aSeDpC.js";import{r as D}from"./writeFileSync-DJoHk3Ks-CgQ-VNNT.js";import{withEnhancedPath as lt}from"@visulima/task-runner";let V;const U=t=>(V??=K(import.meta.url))(t),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=t=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[e,o]=f.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return f.getBuiltinModule(t)}return U(t)},{Socket:Y}=l("node:net"),{randomBytes:J}=l("node:crypto"),{readdir:Q,rm:b,unlink:$,open:Z,readFile:tt,stat:et,writeFile:ot,rename:st}=l("node:fs/promises"),{createRequire:M}=l("node:module"),{spawn:nt}=l("node:child_process"),{openSync:ct,closeSync:at}=l("node:fs");let ht;const dt=t=>(ht??=M(import.meta.url))(t),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ft=t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,o]=u.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return u.getBuiltinModule(t)}return dt(t)},{lstat:A,mkdir:ut}=ft("node:fs/promises"),pt=async t=>{E(t);try{const e=await A(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(D(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{await ut(t,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const o=await A(t);if(!o.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(D(o))}'`,{cause:e})}};let wt;const yt=t=>(wt??=M(import.meta.url))(t),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kt=t=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[e,o]=p.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return p.getBuiltinModule(t)}return yt(t)},{access:mt}=kt("node:fs/promises");async function _t(t,e=z){E(t),t=S(t);try{return await mt(t,e),!0}catch{return!1}}let gt;const vt=t=>(gt??=M(import.meta.url))(t),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=t=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[e,o]=w.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return w.getBuiltinModule(t)}return vt(t)},{readFile:bt}=x("node:fs/promises"),{unzip:Tt,brotliDecompress:Et}=x("node:zlib"),St={brotli:Et,gzip:Tt,none:(t,e)=>{e(null,t)}},Mt=async(t,e)=>{E(t),t=S(t);const{buffer:o,compression:s,encoding:r,flag:i}=e??{};let n;try{n=await bt(t,i?{flag:i}:{})}catch(c){throw X(c,t)}return await new Promise((c,g)=>{St[s??"none"](n,(k,m)=>{k?g(k):c(o?m:m.toString(r??"utf8"))})})};async function C(t,e,o){const s=await Mt(t,{buffer:!0,encoding:void 0});let r=new TextDecoder().decode(s);const{beforeParse:i,color:n}={};return typeof i=="function"&&(r=i(r)),it(r,e,S(t),{color:n})}const Ht=3e4,N=100;class Rt extends Error{constructor(e,o){super(e),this.elapsedMs=o,this.name="ServiceReadinessError"}elapsedMs}const Pt=async t=>{const e=t.host??"127.0.0.1",{port:o}=t,s=t.timeoutMs??Ht,r=Date.now();for(;Date.now()-r<s;){if(await $t(e,o))return;await Dt(N)}throw new Rt(`Timed out waiting for ${e}:${String(o)} to accept TCP connections (${String(s)}ms)`,Date.now()-r)},$t=(t,e)=>new Promise(o=>{const s=new Y,r=i=>{s.removeAllListeners(),s.destroy(),o(i)};s.once("connect",()=>{r(!0)}),s.once("error",()=>{r(!1)}),s.setTimeout(N,()=>{r(!1)});try{s.connect(e,t)}catch{r(!1)}}),Dt=t=>new Promise(e=>{setTimeout(e,t)}),At=async(t,e)=>{const o=t.readiness??(t.port===void 0?void 0:{tcp:{port:t.port}});o&&await Pt({host:o.tcp.host,port:o.tcp.port,timeoutMs:e?.timeoutMs??o.tcp.timeoutMs})},H=384,L=5e3,Lt=50,Ot=3e4,d=async t=>{const e=h(rt(t),"services");try{await pt(e)}catch(o){throw o.code==="ENOTDIR"?new Error(`Service registry path ${e} exists but is not a directory. Remove it or move the conflicting file before running \`vis service\`.`,{cause:o}):o}return e},R=t=>t.replaceAll("/","_").replaceAll(":","__"),P=(t,e)=>h(t,`${R(e)}.json`),It=(t,e)=>h(t,`${R(e)}.lock`),_=async(t,e)=>{const o=await d(t),s=P(o,e);if(await _t(s))try{return await C(s)}catch{return}},xt=async t=>{const e=await d(t);let o;try{o=await Q(e)}catch{return[]}const s=[];for(const r of o)if(r.endsWith(".json"))try{const i=await C(h(e,r));s.push(i)}catch{}return s},Ct=async(t,e)=>{const o=await d(t),s=P(o,e.id),r=h(o,`.${J(8).toString("hex")}.tmp`);await ot(r,`${JSON.stringify(e,void 0,2)}
|
|
2
2
|
`,{mode:H});try{await Wt(r,s)}catch(i){throw await b(r,{force:!0}).catch(()=>{}),i}},Nt=new Set(["EACCES","EBUSY","EPERM"]),Ft=8,jt=20,Wt=async(t,e)=>{let o=0;for(;;)try{await st(t,e);return}catch(s){const{code:r}=s;if(!(r!==void 0&&Nt.has(r))||o>=Ft)throw s;const n=jt*2**o;await new Promise(c=>{setTimeout(c,n)}),o+=1}},y=async(t,e,o)=>{const s=await d(t),r=o??await _(t,e);await b(P(s,e),{force:!0}),r&&await b(r.logFile,{force:!0}).catch(()=>{})},a=t=>{try{return process.kill(t,0),!0}catch{return!1}},se=async t=>{const e=await xt(t),o=[],s=[];for(const r of e){if(a(r.pid)){s.push(r);continue}const i=await _(t,r.id);if(i&&i.pid!==r.pid){s.push(i);continue}await y(t,r.id,r).catch(()=>{}),o.push(r.id)}return{pruned:o,surviving:s}},Bt=t=>new Promise(e=>{setTimeout(e,t)}),Gt=async t=>{try{const e=await Z(t,"wx",H);try{await e.writeFile(String(process.pid))}finally{await e.close().catch(()=>{})}return!0}catch(e){if(e.code==="EEXIST")return!1;throw e}},qt=async t=>{let e;try{const o=await tt(t,"utf8"),s=Number.parseInt(o.trim(),10);e=Number.isFinite(s)?s:void 0}catch{return!0}if(e!==void 0&&!a(e))return!0;try{const o=await et(t);return Date.now()-o.mtimeMs>Ot}catch{return!0}},F=async(t,e,o)=>{const s=await d(t),r=It(s,e),i=Date.now();for(;!await Gt(r);){if(await qt(r)){await $(r).catch(()=>{});continue}if(Date.now()-i>=L)throw new Error(`Could not acquire service lock for ${e} within ${String(L)}ms — another \`vis service\` invocation appears to be holding it.`);await Bt(Lt)}try{return await o()}finally{await $(r).catch(()=>{})}};function T(t,e={},o){for(const s in t){const r=t[s],i=o?`${o}:${s}`:s;typeof r=="object"&&r!==null?T(r,e,i):typeof r=="function"&&(e[i]=r)}return e}const j=(()=>{if(console.createTask)return console.createTask;const t={run:e=>e()};return()=>t})();function W(t,e,o,s){for(let r=o;r<t.length;r+=1)try{const i=s?s.run(()=>t[r](...e)):t[r](...e);if(i&&typeof i.then=="function")return Promise.resolve(i).then(()=>W(t,e,r+1,s))}catch(i){return Promise.reject(i)}}function Kt(t,e,o){if(t.length>0)return W(t,e,0,j(o))}function Vt(t,e,o){if(t.length>0){const s=j(o);return Promise.all(t.map(r=>s.run(()=>r(...e))))}}function v(t,e){for(const o of[...t])o(e)}var Ut=class{_hooks;_before;_after;_deprecatedHooks;_deprecatedMessages;constructor(){this._hooks={},this._before=void 0,this._after=void 0,this._deprecatedMessages=void 0,this._deprecatedHooks={},this.hook=this.hook.bind(this),this.callHook=this.callHook.bind(this),this.callHookWith=this.callHookWith.bind(this)}hook(t,e,o={}){if(!t||typeof e!="function")return()=>{};const s=t;let r;for(;this._deprecatedHooks[t];)r=this._deprecatedHooks[t],t=r.to;if(r&&!o.allowDeprecated){let i=r.message;i||(i=`${s} hook has been deprecated`+(r.to?`, please use ${r.to}`:"")),this._deprecatedMessages||(this._deprecatedMessages=new Set),this._deprecatedMessages.has(i)||(console.warn(i),this._deprecatedMessages.add(i))}if(!e.name)try{Object.defineProperty(e,"name",{get:()=>"_"+t.replace(/\W+/g,"_")+"_hook_cb",configurable:!0})}catch{}return this._hooks[t]=this._hooks[t]||[],this._hooks[t].push(e),()=>{e&&(this.removeHook(t,e),e=void 0)}}hookOnce(t,e){let o,s=(...r)=>(typeof o=="function"&&o(),o=void 0,s=void 0,e(...r));return o=this.hook(t,s),o}removeHook(t,e){const o=this._hooks[t];if(o){const s=o.indexOf(e);s!==-1&&o.splice(s,1),o.length===0&&(this._hooks[t]=void 0)}}clearHook(t){this._hooks[t]=void 0}deprecateHook(t,e){this._deprecatedHooks[t]=typeof e=="string"?{to:e}:e;const o=this._hooks[t]||[];this._hooks[t]=void 0;for(const s of o)this.hook(t,s)}deprecateHooks(t){for(const e in t)this.deprecateHook(e,t[e])}addHooks(t){const e=T(t),o=Object.keys(e).map(s=>this.hook(s,e[s]));return()=>{for(const s of o)s();o.length=0}}removeHooks(t){const e=T(t);for(const o in e)this.removeHook(o,e[o])}removeAllHooks(){this._hooks={}}callHook(t,...e){return this.callHookWith(Kt,t,e)}callHookParallel(t,...e){return this.callHookWith(Vt,t,e)}callHookWith(t,e,o){const s=this._before||this._after?{name:e,args:o,context:{}}:void 0;this._before&&v(this._before,s);const r=t(this._hooks[e]?[...this._hooks[e]]:[],o,e);return r instanceof Promise?r.finally(()=>{this._after&&s&&v(this._after,s)}):(this._after&&s&&v(this._after,s),r)}beforeEach(t){return this._before=this._before||[],this._before.push(t),()=>{if(this._before!==void 0){const e=this._before.indexOf(t);e!==-1&&this._before.splice(e,1)}}}afterEach(t){return this._after=this._after||[],this._after.push(t),()=>{if(this._after!==void 0){const e=this._after.indexOf(t);e!==-1&&this._after.splice(e,1)}}}};function zt(){return new Ut}const re=()=>zt(),ie=async(t,e)=>{if(!(!e||e.length===0))for(const o of e){if(o.hooks)for(const[s,r]of Object.entries(o.hooks)){const i=Array.isArray(r)?r:[r];for(const n of i)t.hook(s,n)}o.setup&&await o.setup(t)}};class ne{#o;#e;#s=new Map;constructor(e,o){this.#o=e,this.#e=o}startTasks(e){for(const o of e)this.#s.set(o.id,o),this.#t("task:before",o)}endTasks(e){for(const o of e)this.#s.delete(o.task.id),this.#t("task:after",o.task,o),o.status==="failure"?this.#t("task:failure",o.task,o):Xt(o.status)&&this.#t("task:cacheHit",o.task,o)}printCacheMiss(e,o){this.#t("task:cacheMiss",e,o)}onTaskStdout(e,o){this.#t("task:stdout",e,o)}onTaskStderr(e,o){this.#t("task:stderr",e,o)}#t(e,...o){Promise.resolve(this.#o.callHook(e,...o)).catch(s=>{if(this.#e)try{this.#e(e,s)}catch{}})}}const Xt=t=>t==="local-cache"||t==="local-cache-kept-existing"||t==="remote-cache",O=process.platform==="win32",Yt=async t=>{const{command:e,cwd:o,env:s,logFile:r}=t,i=ct(r,"a",H);let n;const c=O?"cmd":"/bin/sh",g=O?["/d","/s","/c",e]:["-c",e];try{n=nt(c,g,{cwd:o,detached:!0,env:lt({...process.env,...s},o),stdio:["ignore",i,i],windowsHide:!0})}finally{at(i)}if(n.pid===void 0&&await new Promise((k,m)=>{n.once("spawn",()=>{k()}),n.once("error",q=>{m(q)})}),n.pid===void 0)throw new Error(`Failed to spawn detached process for command: ${e}`);return n.unref(),{pid:n.pid}},B=5e3,ce=async t=>F(t.workspaceRoot,t.id,async()=>{const e=await _(t.workspaceRoot,t.id);if(e&&a(e.pid))throw new Error(`Service ${t.id} is already running (pid ${String(e.pid)})`);e&&await y(t.workspaceRoot,t.id,e);const o=await d(t.workspaceRoot),s=R(t.id),r=h(o,`${s}.log`),{pid:i}=await Yt({command:t.command,cwd:t.cwd,env:t.env,logFile:r}),n={command:t.command,config:t.config,cwd:t.cwd,env:t.config.env??{},id:t.id,logFile:r,pid:i,slug:s,startedAt:new Date().toISOString(),visVersion:process.env.VIS_VERSION??"0.0.0"};if(await Ct(t.workspaceRoot,n),t.skipReadiness!==!0)try{await At(t.config,{timeoutMs:t.readinessTimeoutMs})}catch(c){throw await G(i,t.config.killGracePeriodMs??B).catch(()=>{}),await y(t.workspaceRoot,t.id,n).catch(()=>{}),c}return{entry:n}}),ae=async t=>F(t.workspaceRoot,t.id,async()=>{const e=await _(t.workspaceRoot,t.id);if(!e)return{stopped:!1};if(!a(e.pid))return await y(t.workspaceRoot,t.id,e),{stopped:!1};const o=t.graceMs??e.config.killGracePeriodMs??B;return await G(e.pid,o),await y(t.workspaceRoot,t.id,e),{stopped:!0}}),G=async(t,e)=>{I(t,"SIGTERM");const o=Date.now();for(;Date.now()-o<e;){if(!a(t))return;await new Promise(s=>{setTimeout(s,100)})}a(t)&&I(t,"SIGKILL")},I=(t,e)=>{try{process.platform==="win32"?process.kill(t,e):process.kill(-t,e)}catch(o){if(o.code==="ESRCH")return;throw o}};export{ne as H,Rt as S,ce as a,At as b,xt as c,re as d,ie as e,y as f,_t as g,a as i,se as p,_ as r,ae as s};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as j}from"node:module";import{
|
|
1
|
+
import{createRequire as j}from"node:module";import{L as J}from"./target-merge-B4No-LHM.js";import{osvBloomDecode as z,osvBloomProbeBatch as K,NATIVE_BINDING_VERSION as D}from"#native";let k;const V=e=>(k??=j(import.meta.url))(e),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[s,t]=h.versions.node.split(".").map(Number);if(s>22||s===22&&t>=3||s===20&&t>=16)return h.getBuiltinModule(e)}return V(e)},{createHash:H,randomUUID:P}=v("node:crypto"),{existsSync:g}=v("node:fs"),{readFile:O,mkdir:T,stat:B,writeFile:F,rename:q,unlink:G}=v("node:fs/promises"),{join:d,dirname:W}=v("node:path"),I=6;if(D!==I)throw new Error(`vis native binding ABI mismatch in osv-bloom: expected ${I}, got ${D}. Rebuild via \`pnpm --filter @visulima/vis run build:native\` or reinstall the platform binding package.`);const nt="https://endevco.github.io/osv-bloom",X=new Set(["endevco.github.io"]);class w extends Error{cause="OSV_BLOOM_SOURCE_NOT_ALLOWED";constructor(s){super(`osv-bloom source host '${s}' is not in the built-in allowlist. Add it to \`security.audit.advisories.bloom.allowedHosts\` if intentional.`),this.name="OsvBloomSourceNotAllowedError"}}class b extends Error{cause="OSV_BLOOM_NETWORK";constructor(s,t){super(`osv-bloom fetch failed for ${s}: ${t}. Check connectivity, proxy env vars, or --source.`),this.name="OsvBloomNetworkError"}}class Y extends Error{cause="OSV_BLOOM_INTEGRITY";constructor(s,t){super(`osv-bloom filter.bin sha256 mismatch (expected ${s}, got ${t}). Refusing to install a corrupted filter.`),this.name="OsvBloomIntegrityError"}}class m extends Error{cause="OSV_BLOOM_MANIFEST";constructor(s){super(`osv-bloom manifest invalid: ${s}`),this.name="OsvBloomManifestError"}}class Q extends Error{cause="OSV_BLOOM_CACHE_MISS";constructor(s){super(`No osv-bloom cache at ${s}. Run 'vis advisories bloom sync' first.`),this.name="OsvBloomCacheMissError"}}const p=e=>{const t=J("vis",{create:!0,cwd:e})??d(e,"node_modules",".cache","vis");return d(t,"osv-bloom")},l=e=>d(e,"filter.bin"),L=e=>d(e,"manifest.json"),$=e=>d(e,"state.json"),Z=(e,s)=>{let t;try{t=new URL(e)}catch{throw new w(e)}if(!t.host)throw new w(e);if(t.protocol!=="https:")throw new w(`${t.protocol}//${t.host}`);if(!new Set([...X,...s??[]]).has(t.host))throw new w(t.host);return t},at=async e=>{const s=Date.now(),t=e.cacheDir??p(e.workspaceRoot);await T(t,{recursive:!0});const r=Z(e.source,e.allowedHosts),n=new URL("manifest.json",M(r.toString())),o=new URL("filter.bin",M(r.toString())),a=await A(n,{method:"GET"});if(!a.ok)throw new b(n.toString(),a.status);const _=await a.text(),i=R(_),u=await x(t);if(!e.force&&u?.setDigestSha256===i.setDigestSha256&&g(l(t)))return{bytesOnDisk:(await B(l(t))).size,cacheDir:t,durationMs:Date.now()-s,manifest:i,upToDate:!0};const E={};!e.force&&u?.filterEtag&&(E.headers={"if-none-match":u.filterEtag});const f=await A(o,{...E,method:"GET"});if(f.status===304&&u&&g(l(t)))return await N(t,_,{fetchedAtIso:new Date().toISOString(),filterEtag:u.filterEtag,setDigestSha256:i.setDigestSha256}),{bytesOnDisk:(await B(l(t))).size,cacheDir:t,durationMs:Date.now()-s,manifest:i,upToDate:!0};if(!f.ok||!f.body)throw new b(o.toString(),f.status);const c=Buffer.from(await f.arrayBuffer());e.onProgress&&e.onProgress(c.length,c.length);const y=tt(c);if(y!==i.filterSha256)throw new Y(i.filterSha256,y);if(c.length!==i.bloomByteLen)throw new m(`filter.bin length ${c.length} does not match manifest.bloom_byte_len ${i.bloomByteLen}`);const U=f.headers.get("etag")??void 0;return await S(l(t),c),await N(t,_,{fetchedAtIso:new Date().toISOString(),filterEtag:U,setDigestSha256:i.setDigestSha256}),{bytesOnDisk:c.length,cacheDir:t,durationMs:Date.now()-s,manifest:i,upToDate:!1}},it=async(e,s)=>{const t=s?.cacheDir??p(e),r=l(t);if(!g(r)){if(s?.softFail)return null;throw new Q(t)}const n=await O(r);return z(n)},ct=(e,s)=>K(e,s),lt=async(e,s)=>{const t=s??p(e);if(!g(l(t)))return{cacheDir:t,present:!1};let n,o;try{n=R(await O(L(t),"utf8"))}catch{}try{o=await x(t)}catch{}return{cacheDir:t,fetchedAtIso:o?.fetchedAtIso,manifest:n,present:!0}},R=e=>{let s;try{s=JSON.parse(e)}catch(o){throw new m(o instanceof Error?o.message:String(o))}const t=o=>{const a=s[o];if(typeof a!="number"||Number.isNaN(a))throw new m(`field '${o}' missing or non-numeric`);return a},r=o=>{const a=s[o];if(typeof a!="string"||a.length===0)throw new m(`field '${o}' missing or empty`);return a},n=t("format_version");if(n!==1)throw new m(`unsupported format_version ${n} (this build expects v1)`);return{advisoryCount:t("advisory_count"),bloomByteLen:t("bloom_byte_len"),bloomKHashes:t("bloom_k_hashes"),bloomMBits:t("bloom_m_bits"),builtAtRfc3339:r("built_at_rfc3339"),builtAtUnix:t("built_at_unix"),entryCount:t("entry_count"),filterSha256:r("filter_sha256"),formatVersion:n,setDigestSha256:r("set_digest_sha256"),sourceUrl:r("source_url"),targetFpr:t("target_fpr")}},x=async e=>{try{const s=await O($(e),"utf8"),t=JSON.parse(s);return typeof t.setDigestSha256!="string"||typeof t.fetchedAtIso!="string"?void 0:{fetchedAtIso:t.fetchedAtIso,filterEtag:typeof t.filterEtag=="string"?t.filterEtag:void 0,setDigestSha256:t.setDigestSha256}}catch{return}},N=async(e,s,t)=>{await S(L(e),Buffer.from(s,"utf8")),await S($(e),Buffer.from(`${JSON.stringify(t,void 0,2)}
|
|
2
2
|
`,"utf8"))},S=async(e,s)=>{await T(W(e),{recursive:!0});const t=`${e}.${process.pid}.${P()}.tmp`;try{await F(t,s),await q(t,e)}catch(r){throw await G(t).catch(()=>{}),r}},tt=e=>H("sha256").update(e).digest("hex"),M=e=>e.endsWith("/")?e:`${e}/`,et=3e4,A=async(e,s)=>{try{return await fetch(e,{...s,signal:AbortSignal.timeout(et)})}catch(t){throw new b(e.toString(),t instanceof Error?t.message:String(t))}};export{nt as D,Q as O,lt as g,it as l,ct as p,at as s};
|