@visulima/vis 1.0.0-alpha.41 → 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 +41 -0
- package/LICENSE.md +265 -35
- package/dist/bin.js +1 -1
- package/dist/binx.js +2 -2
- package/dist/config/index.d.ts +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 -0
- package/dist/packem_chunks/cli-main.js +1068 -0
- package/dist/packem_chunks/detect.js +3 -3
- package/dist/packem_chunks/devtools.js +1 -78
- package/dist/packem_chunks/dispatch.js +4 -0
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +5 -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 -4
- 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 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +1 -1
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +4 -4
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler33.js +1 -1
- package/dist/packem_chunks/handler4.js +4 -6
- package/dist/packem_chunks/handler40.js +1 -1
- package/dist/packem_chunks/handler5.js +6 -8
- package/dist/packem_chunks/handler50.js +5 -5
- package/dist/packem_chunks/handler51.js +5 -5
- package/dist/packem_chunks/handler52.js +1 -1
- package/dist/packem_chunks/handler53.js +1 -1
- package/dist/packem_chunks/handler54.js +1 -1
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler56.js +1 -1
- package/dist/packem_chunks/handler57.js +5 -7
- package/dist/packem_chunks/handler58.js +11 -5
- package/dist/packem_chunks/handler59.js +3 -11
- package/dist/packem_chunks/handler6.js +8 -1
- 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 -708
- package/dist/packem_chunks/handler66.js +10 -10
- package/dist/packem_chunks/handler67.js +5 -5
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +5 -5
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +7 -7
- package/dist/packem_chunks/handler71.js +15 -15
- package/dist/packem_chunks/handler72.js +708 -48
- package/dist/packem_chunks/handler73.js +48 -27
- package/dist/packem_chunks/handler74.js +27 -3
- package/dist/packem_chunks/handler75.js +3 -190
- package/dist/packem_chunks/handler76.js +189 -37
- package/dist/packem_chunks/handler77.js +38 -0
- 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 +4 -4
- package/dist/packem_chunks/index2.js +2 -2
- package/dist/packem_chunks/index3.js +135 -0
- package/dist/packem_chunks/index4.js +74 -0
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +4 -0
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/loader2.js +1 -1
- package/dist/packem_chunks/orchestrator.js +19 -19
- package/dist/packem_chunks/prompts.js +1 -1
- package/dist/packem_chunks/prune.js +1 -1
- package/dist/packem_chunks/registry.js +2 -2
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/shell-runner.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/tar.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/ts-loader.js +2 -0
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_chunks/version-resolver.js +2 -2
- package/dist/packem_shared/{Table-CcVkyULl-B_ef6zfS.js → Table-CcVkyULl-DLWu6XHL.js} +25 -26
- package/dist/packem_shared/{advisories-DLeO5KMN.js → advisories-CefYKEPe.js} +1 -1
- package/dist/packem_shared/{affected-shas-cVnX8-zs.js → affected-shas-C1XuRlvo.js} +1 -1
- package/dist/packem_shared/{ai-analysis-BUeX2J2H.js → ai-analysis-Co-b15d_.js} +7 -7
- package/dist/packem_shared/{ai-fix-9Vzlp6XU.js → ai-fix-DnJDgPN-.js} +9 -9
- package/dist/packem_shared/augment-8fIWWGSc.js +3 -0
- package/dist/packem_shared/bin-DDq2oszw.js +1 -0
- package/dist/packem_shared/build-scripts-Doxce2VM.js +1 -0
- package/dist/packem_shared/command-runtime-RiCMa2C8.js +1 -0
- package/dist/packem_shared/compile-cache-B_Vf_WxT.js +3 -0
- package/dist/packem_shared/{cyclonedx-Cadls41z.js → cyclonedx-BTBzGCBW.js} +1 -1
- package/dist/packem_shared/dependency-scan-DEv-scN6.js +1 -0
- package/dist/packem_shared/{docker-BMLrNtWm.js → docker-DKlF-gk3.js} +1 -1
- package/dist/packem_shared/env-XJzocuUP.js +27 -0
- package/dist/packem_shared/failure-log-Sp1j-5qo.js +2 -0
- package/dist/packem_shared/{giget-DHY1sQZC.js → giget-DVTFJlbR.js} +2 -2
- package/dist/packem_shared/glob-fqg4KepW-7Bs2kZuM.js +1 -0
- package/dist/packem_shared/index-B0EsgdzO.js +1 -0
- package/dist/packem_shared/{index-DGSsjmpV.js → index-Cg0IHaFI.js} +1 -1
- package/dist/packem_shared/index-CkZnT2Fe.js +1 -0
- package/dist/packem_shared/index-DJAnbLEh.js +28 -0
- package/dist/packem_shared/index-DjTWo3sH.js +1 -0
- package/dist/packem_shared/{index-BDmTbWX1.js → index-OQZQyN5R.js} +1 -1
- package/dist/packem_shared/index.server-J83sowC4.js +2 -0
- package/dist/packem_shared/{lifecycle-4z9hHE5b.js → lifecycle-C4nRsXxc.js} +2 -2
- package/dist/packem_shared/{lockfile-C8Q1_4KK.js → lockfile-DIGyLfmF.js} +1 -1
- package/dist/packem_shared/main-B3juSU5z.js +1 -0
- package/dist/packem_shared/manifests-pLwnVmCN.js +1 -0
- package/dist/packem_shared/{min-release-age-D1alDE3K.js → min-release-age-B23Mr7NO.js} +3 -3
- package/dist/packem_shared/missing-package-json-DdMNbe_j.js +1 -0
- package/dist/packem_shared/{native-config-sync-BEkJW7g3.js → native-config-sync-4K9wWTj5.js} +1 -1
- package/dist/packem_shared/{osv-bloom-B03tUWf3.js → osv-bloom-BsQ-aFiM.js} +1 -1
- package/dist/packem_shared/packument-QjOLAMSk.js +1 -0
- package/dist/packem_shared/{pm-runner-BKZQo7Ts.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/readJsonSync-CvkZyKmL-CY7PZob_.js +4 -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/resolve-runtime-CJSWV-K8.js +1 -0
- package/dist/packem_shared/run-file-B4TqKa0X.js +1 -0
- package/dist/packem_shared/runtime-check-0lUJvgKt.js +1 -0
- package/dist/packem_shared/runtime-process-Dmz0vCJy-DUwTvH1J.js +1 -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/{selectors-GCJIe342.js → selectors-UmnAuc26.js} +1 -1
- package/dist/packem_shared/{signatures-Xpd6HjG_.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/target-options-ChWcK60i.js +1 -0
- package/dist/packem_shared/toolchain-DyCKnGch.js +5 -0
- package/dist/packem_shared/typosquats-hCtH-23t.js +1 -0
- package/dist/packem_shared/use-measured-height-BKUjhm_3.js +1 -0
- package/dist/packem_shared/verify-CVPYlUrF.js +1 -0
- package/dist/packem_shared/vis-update-app-K-qATSeh.js +1 -0
- package/dist/packem_shared/watch-Bkp_AAbc.js +1 -0
- package/dist/packem_shared/watch-loop-WE7nWIEt.js +11 -0
- package/dist/packem_shared/window-ops-DDePlWLV.js +2 -0
- package/dist/runtime/preload.d.ts +1 -0
- package/dist/runtime/preload.js +1 -0
- package/index.d.ts +215 -201
- package/index.js +54 -53
- package/package.json +18 -27
- package/dist/packem_chunks/bin.js +0 -1198
- package/dist/packem_chunks/config.js +0 -21
- package/dist/packem_shared/CONFIG_FILES-BfaR0jKT.js +0 -1
- package/dist/packem_shared/build-scripts-CCCi8U66.js +0 -1
- package/dist/packem_shared/command-runtime-CR70qSUM.js +0 -1
- package/dist/packem_shared/dependency-scan-DnTgYleU.js +0 -1
- package/dist/packem_shared/failure-log-CEWP3bP0.js +0 -2
- package/dist/packem_shared/glob-fqg4KepW-B7EjLRvw.js +0 -1
- package/dist/packem_shared/index-3jMNqQom.js +0 -1
- package/dist/packem_shared/index-Bt521H5J.js +0 -30
- package/dist/packem_shared/manifests-Dj3pRKBT.js +0 -1
- package/dist/packem_shared/missing-package-json-8vNHwbqw.js +0 -1
- package/dist/packem_shared/provenance-BFEwKgI3.js +0 -1
- package/dist/packem_shared/registry-keys-BfFto6vI.js +0 -1
- package/dist/packem_shared/resolve-explicit-C6WM-I2u.js +0 -5
- package/dist/packem_shared/runtime-check-Stc9AI78.js +0 -1
- package/dist/packem_shared/s1ngularity-DCPmPE5M.js +0 -1
- package/dist/packem_shared/scan-progress-CFhc0CMj.js +0 -2
- package/dist/packem_shared/spinner-CV3WVJLv.js +0 -1
- package/dist/packem_shared/tabs-BuTy5gPV.js +0 -1
- package/dist/packem_shared/toolchain-pR7AJ-tB.js +0 -5
- package/dist/packem_shared/typosquats-DN78xx1x.js +0 -1
- package/dist/packem_shared/use-measured-height-_eVGWtWt.js +0 -1
- package/dist/packem_shared/verify-6WCmFmy8.js +0 -1
- package/dist/packem_shared/vis-update-app-k3fDxech.js +0 -1
- package/dist/packem_shared/watch-BvIwLG4N.js +0 -1
- package/dist/packem_shared/watch-loop-DWkvv2tK.js +0 -11
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import{createRequire as Ho}from"node:module";import{d as Do,U as Go,v as jo,L as Po,m as ee,A as uo,f as ye,a as lt,H as ct,O as io}from"../packem_shared/index-BDmTbWX1.js";import{createJiti as ao}from"jiti";import"../packem_shared/otelPlugin-DmKDBaPo.js";import"../packem_shared/definePlugin-DoUcoYSy.js";const Lo=Ho(import.meta.url),Ae=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,wt=e=>{if(typeof Ae<"u"&&Ae.versions&&Ae.versions.node){const[t,o]=Ae.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ae.getBuiltinModule(e)}return Lo(e)},{createHash:so}=wt("node:crypto"),{readdirSync:ro,copyFileSync:Bo,unlinkSync:Mo,readFileSync:Io}=wt("node:fs"),{createRequire:no}=wt("node:module");class Uo extends Error{fileName;codeFrame;name="JSONError";#e;constructor(t){super(),this.#e=t}get message(){return`${this.#e}${this.fileName?` in ${this.fileName}`:""}${this.codeFrame?`
|
|
2
|
-
|
|
3
|
-
${this.codeFrame}
|
|
4
|
-
`:""}`}set message(t){this.#e=t}}const Fo=e=>String.raw`\u{${e.codePointAt(0).toString(16)}}`,Ko=(e,t,o)=>Go(e,{start:t},{tabWidth:!1,...o}),zo=/in JSON at position (\d+)(?: \(line (\d+) column (\d+)\))?$/,Xo=(e,t)=>{const o=zo.exec(t);if(!o)return;const[,r,u,s]=o;if(u&&s)return{column:Number(s),line:Number(u)};let n=Number(r);return n===e.length&&(n=e.length-1),Do(e,n)},Wo=/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,qo=e=>e.replace(Wo,(t,o,r)=>`"${r}"(${Fo(r)})`);function Qo(e,t,o,r){let u;try{return JSON.parse(e,t)}catch(c){u=c.message}let s;e?(s=Xo(e,u),u=qo(u)):u+=" while parsing empty string";const n=new Uo(u);throw n.fileName=o,s&&(n.codeFrame=Ko(e,s,r)),n}function lo(e,t,o){const r=jo(e,{buffer:!0,encoding:void 0});let u=new TextDecoder().decode(r);const{beforeParse:s,color:n}={};return typeof s=="function"&&(u=s(u)),Qo(u,t,Po(e),{color:n})}const Mt="@inherit",Zo=["aliases","dependsOn","inputs","outputs"],Vo=(e,t)=>{if(t===void 0)return e===void 0?void 0:[...e];if(!t.includes(Mt))return[...t];const o=[];for(const r of t){if(r===Mt){e!==void 0&&o.push(...e);continue}o.push(r)}return o},Yo=(e,t)=>{const o={...e,...t};for(const r of Zo){const u=e?.[r],s=t?.[r],n=Vo(u,s);n===void 0?delete o[r]:o[r]=n}return o},Jo=no(import.meta.url),me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,co=e=>{if(typeof me<"u"&&me.versions&&me.versions.node){const[t,o]=me.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return me.getBuiltinModule(e)}return Jo(e)},{homedir:es,tmpdir:gt}=co("node:os"),{env:rt,cwd:ts,platform:It}=me,{createRequire:w}=co("node:module"),os=0,po=2,ss=Symbol("findUpStop"),rs=/^[A-Z]:\//i,ve=(e="")=>e&&e.replaceAll("\\","/").replace(rs,t=>t.toUpperCase()),ns=/^[/\\]{2}/,us=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,fo=/^[A-Z]:$/i,is=/.(\.[^./]+)$/,as=/^[/\\]|^[a-z]:[/\\]/i,ls=/\/$/,cs=()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/",dt="/",ho=(e,t)=>{let o="",r=0,u=-1,s=0,n;for(let c=0;c<=e.length;++c){if(c<e.length)n=e[c];else{if(n==="/")break;n="/"}if(n==="/"){if(!(u===c-1||s===1))if(s===2){if(o.length<2||r!==2||!o.endsWith(".")||o.at(-2)!=="."){if(o.length>2){const f=o.lastIndexOf("/");f===-1?(o="",r=0):(o=o.slice(0,f),r=o.length-1-o.lastIndexOf("/")),u=c,s=0;continue}else if(o.length>0){o="",r=0,u=c,s=0;continue}}t&&(o+=o.length>0?"/..":"..",r=2)}else o.length>0?o+=`/${e.slice(u+1,c)}`:o=e.slice(u+1,c),r=c-u-1;u=c,s=0}else n==="."&&s!==-1?++s:s=-1}return o},be=e=>us.test(e),go=function(e){if(e.length===0)return".";e=ve(e);const t=ns.exec(e),o=be(e),r=e.at(-1)==="/";return e=ho(e,!o),e.length===0?o?"/":r?"./":".":(r&&(e+="/"),fo.test(e)&&(e+="/"),t?o?`//${e}`:`//./${e}`:o&&!be(e)?`/${e}`:e)},se=(...e)=>{let t="";for(const o of e)if(o)if(t.length>0){const r=t.at(-1)==="/",u=o[0]==="/";r&&u?t+=o.slice(1):t+=r||u?o:`/${o}`}else t+=o;return go(t)},bt=function(...e){e=e.map(r=>ve(r));let t="",o=!1;for(let r=e.length-1;r>=-1&&!o;r--){const u=r>=0?e[r]:cs();!u||u.length===0||(t=`${u}/${t}`,o=be(u))}return t=ho(t,!o),o&&!be(t)?`/${t}`:t.length>0?t:"."},ps=function(e){return is.exec(ve(e))?.[1]??""},Ot=e=>{const t=ve(e).replace(ls,""),o=t.lastIndexOf("/");if(o===-1)return be(e)?"/":".";const r=t.slice(0,o);return fo.test(r)?`${r}/`:r||(be(e)?"/":".")},fs=(e,t)=>{const o=ve(e);return o.slice(o.lastIndexOf("/")+1)},hs=function(e){const t=as.exec(e)?.[0]?.replaceAll("\\","/")??"",o=fs(e),r=ps(o);return{base:o,dir:Ot(e),ext:r,name:o.slice(0,o.length-r.length),root:t}},gs=w(import.meta.url),Re=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ds=e=>{if(typeof Re<"u"&&Re.versions&&Re.versions.node){const[t,o]=Re.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Re.getBuiltinModule(e)}return gs(e)},{fileURLToPath:bs}=ds("node:url");function ms(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Dt,Gt;function ys(){return Gt||(Gt=1,Dt=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),Dt}var vs=ys();const As=ms(vs);new Set(As);const at=e=>ve(e instanceof URL?bs(e):e),bo=e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},Rs=w(import.meta.url),Ee=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Es=e=>{if(typeof Ee<"u"&&Ee.versions&&Ee.versions.node){const[t,o]=Ee.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ee.getBuiltinModule(e)}return Rs(e)};Es("node:fs/promises");const Ts=w(import.meta.url),Te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,xs=e=>{if(typeof Te<"u"&&Te.versions&&Te.versions.node){const[t,o]=Te.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Te.getBuiltinModule(e)}return Ts(e)};xs("node:fs");const jt=e=>{if(e.isFile())return"file";if(e.isDirectory())return"dir";if(e.isSymbolicLink())return"symlink"},_s=w(import.meta.url),xe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$s=e=>{if(typeof xe<"u"&&xe.versions&&xe.versions.node){const[t,o]=xe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return xe.getBuiltinModule(e)}return _s(e)};$s("node:fs/promises");const ks=w(import.meta.url),_e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Cs=e=>{if(typeof _e<"u"&&_e.versions&&_e.versions.node){const[t,o]=_e.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return _e.getBuiltinModule(e)}return ks(e)},{lstatSync:Pt,mkdirSync:Ss}=Cs("node:fs"),$e=e=>{bo(e);try{const t=Pt(e);if(!t.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(jt(t))}'`);return}catch(t){if(t.code!=="ENOENT")throw t}try{Ss(e,{recursive:!0})}catch(t){if(t.code!=="EEXIST")throw t;const o=Pt(e);if(!o.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(jt(o))}'`,{cause:t})}},ws=w(import.meta.url),ke=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Os=e=>{if(typeof ke<"u"&&ke.versions&&ke.versions.node){const[t,o]=ke.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return ke.getBuiltinModule(e)}return ws(e)};Os("node:fs/promises");const Ns=w(import.meta.url),Ce=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Hs=e=>{if(typeof Ce<"u"&&Ce.versions&&Ce.versions.node){const[t,o]=Ce.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ce.getBuiltinModule(e)}return Ns(e)};Hs("node:fs");const Ls=w(import.meta.url),Se=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Bs=e=>{if(typeof Se<"u"&&Se.versions&&Se.versions.node){const[t,o]=Se.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Se.getBuiltinModule(e)}return Ls(e)};Bs("node:fs/promises");const Ms=w(import.meta.url),we=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Is=e=>{if(typeof we<"u"&&we.versions&&we.versions.node){const[t,o]=we.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return we.getBuiltinModule(e)}return Ms(e)};Is("node:fs");const Ds=w(import.meta.url),Oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Gs=e=>{if(typeof Oe<"u"&&Oe.versions&&Oe.versions.node){const[t,o]=Oe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Oe.getBuiltinModule(e)}return Ds(e)};Gs("node:fs/promises");const js=w(import.meta.url),Ne=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ps=e=>{if(typeof Ne<"u"&&Ne.versions&&Ne.versions.node){const[t,o]=Ne.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ne.getBuiltinModule(e)}return js(e)};Ps("node:fs");w(import.meta.url);const Us=w(import.meta.url),He=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Fs=e=>{if(typeof He<"u"&&He.versions&&He.versions.node){const[t,o]=He.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return He.getBuiltinModule(e)}return Us(e)};Fs("node:fs/promises");const Ks=w(import.meta.url),Le=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,zs=e=>{if(typeof Le<"u"&&Le.versions&&Le.versions.node){const[t,o]=Le.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Le.getBuiltinModule(e)}return Ks(e)};zs("node:fs");const Xs=w(import.meta.url),Be=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ws=e=>{if(typeof Be<"u"&&Be.versions&&Be.versions.node){const[t,o]=Be.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Be.getBuiltinModule(e)}return Xs(e)};Ws("node:fs/promises");const qs=w(import.meta.url),Me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Qs=e=>{if(typeof Me<"u"&&Me.versions&&Me.versions.node){const[t,o]=Me.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Me.getBuiltinModule(e)}return qs(e)},{statSync:Zs,lstatSync:Vs}=Qs("node:fs"),Ys=(e,t={})=>{const o=t.cwd?at(t.cwd):process.cwd();let r=bt(o);const{root:u}=hs(r),s=at(t.stopAt??u),n=bt(r,s),c=t.type??"file",f=function(h){return[e]};t.allowSymlinks??=!0;const R=t.allowSymlinks?Zs:Vs;for(;r&&r!==n&&r!==u;){for(let h of f()){if(h===ss)return;if(h===void 0)continue;Buffer.isBuffer(h)?h=h.toString():h instanceof URL&&(h=at(h));const A=be(h)?h:bt(r,h);try{const $=R(A);if(c==="file"&&$.isFile()||c==="directory"&&$.isDirectory())return A}catch{}}r=Ot(r)}};function Nt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ut={},mt,Ft;function pt(){if(Ft)return mt;Ft=1;const e="[^\\\\/]",t=Symbol("unignore"),o="\\.",r="\\+",u="\\?",s="\\/",n="(?=.)",c="[^/]",f=`(?:${s}|$)`,R=`(?:^|${s})`,h=`${o}{1,2}${f}`,A=`(?!${o})`,$=`(?!${R}${h})`,x=`(?!${o}{0,1}${f})`,B=`(?!${h})`,oe=`[^.${s}]`,Q=`${c}*?`,z="/",d={DOT_LITERAL:o,PLUS_LITERAL:r,QMARK_LITERAL:u,SLASH_LITERAL:s,ONE_CHAR:n,QMARK:c,END_ANCHOR:f,DOTS_SLASH:h,NO_DOT:A,NO_DOTS:$,NO_DOT_SLASH:x,NO_DOTS_SLASH:B,QMARK_NO_DOT:oe,STAR:Q,START_ANCHOR:R,SEP:z},m={...d,SLASH_LITERAL:"[\\\\/]",QMARK:e,STAR:`${e}*?`,DOTS_SLASH:`${o}{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!${o})`,NO_DOTS:`(?!(?:^|[\\\\/])${o}{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!${o}{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!${o}{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},i={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return mt={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:i,UNIGNORE:t,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(y){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${y.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(y){return y===!0?m:d}},mt}var Kt;function ft(){return Kt||(Kt=1,(function(e){const{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:u}=pt();e.isObject=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),e.hasRegexChars=s=>r.test(s),e.isRegexChar=s=>s.length===1&&e.hasRegexChars(s),e.escapeRegex=s=>s.replace(u,"\\$1"),e.toPosixSlashes=s=>s.replace(t,"/"),e.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const s=navigator.platform.toLowerCase();return s==="win32"||s==="windows"}return process.platform?process.platform==="win32":!1},e.removeBackslashes=s=>s.replace(o,n=>n==="\\"?"":n),e.escapeLast=(s,n,c)=>{const f=s.lastIndexOf(n,c);return f===-1?s:s[f-1]==="\\"?e.escapeLast(s,n,f-1):`${s.slice(0,f)}\\${s.slice(f)}`},e.removePrefix=(s,n={})=>{let c=s;return c.startsWith("./")&&(c=c.slice(2),n.prefix="./"),c},e.wrapOutput=(s,n={},c={})=>{const f=c.contains?"":"^",R=c.contains?"":"$";let h=`${f}(?:${s})${R}`;return n.negated===!0&&(h=`(?:^(?!${h}).*$)`),h},e.basename=(s,{windows:n}={})=>{const c=s.split(n?/[\\/]/:"/"),f=c[c.length-1];return f===""?c[c.length-2]:f}})(Ut)),Ut}var yt,zt;function Js(){if(zt)return yt;zt=1;const e=ft(),{CHAR_ASTERISK:t,CHAR_AT:o,CHAR_BACKWARD_SLASH:r,CHAR_COMMA:u,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:n,CHAR_FORWARD_SLASH:c,CHAR_LEFT_CURLY_BRACE:f,CHAR_LEFT_PARENTHESES:R,CHAR_LEFT_SQUARE_BRACKET:h,CHAR_PLUS:A,CHAR_QUESTION_MARK:$,CHAR_RIGHT_CURLY_BRACE:x,CHAR_RIGHT_PARENTHESES:B,CHAR_RIGHT_SQUARE_BRACKET:oe}=pt(),Q=d=>d===c||d===r,z=d=>{d.isPrefix!==!0&&(d.depth=d.isGlobstar?1/0:1)};return yt=(d,m)=>{const i=m||{},y=d.length-1,E=i.parts===!0||i.scanToEnd===!0,T=[],v=[],O=[];let X=d,Z=-1,P=0,re=0,W=!1,ne=!1,I=!1,ce=!1,ge=!1,ue=!1,L=!1,ie=!1,de=!1,q=!1,K=0,Y,_,S={value:"",depth:0,isGlob:!1};const p=()=>Z>=y,V=()=>X.charCodeAt(Z+1),U=()=>(Y=_,X.charCodeAt(++Z));for(;Z<y;){_=U();let N;if(_===r){L=S.backslashes=!0,_=U(),_===f&&(ue=!0);continue}if(ue===!0||_===f){for(K++;p()!==!0&&(_=U());){if(_===r){L=S.backslashes=!0,U();continue}if(_===f){K++;continue}if(ue!==!0&&_===s&&(_=U())===s){if(W=S.isBrace=!0,I=S.isGlob=!0,q=!0,E===!0)continue;break}if(ue!==!0&&_===u){if(W=S.isBrace=!0,I=S.isGlob=!0,q=!0,E===!0)continue;break}if(_===x&&(K--,K===0)){ue=!1,W=S.isBrace=!0,q=!0;break}}if(E===!0)continue;break}if(_===c){if(T.push(Z),v.push(S),S={value:"",depth:0,isGlob:!1},q===!0)continue;if(Y===s&&Z===P+1){P+=2;continue}re=Z+1;continue}if(i.noext!==!0&&(_===A||_===o||_===t||_===$||_===n)&&V()===R){if(I=S.isGlob=!0,ce=S.isExtglob=!0,q=!0,_===n&&Z===P&&(de=!0),E===!0){for(;p()!==!0&&(_=U());){if(_===r){L=S.backslashes=!0,_=U();continue}if(_===B){I=S.isGlob=!0,q=!0;break}}continue}break}if(_===t){if(Y===t&&(ge=S.isGlobstar=!0),I=S.isGlob=!0,q=!0,E===!0)continue;break}if(_===$){if(I=S.isGlob=!0,q=!0,E===!0)continue;break}if(_===h){for(;p()!==!0&&(N=U());){if(N===r){L=S.backslashes=!0,U();continue}if(N===oe){ne=S.isBracket=!0,I=S.isGlob=!0,q=!0;break}}if(E===!0)continue;break}if(i.nonegate!==!0&&_===n&&Z===P){ie=S.negated=!0,P++;continue}if(i.noparen!==!0&&_===R){if(I=S.isGlob=!0,E===!0){for(;p()!==!0&&(_=U());){if(_===R){L=S.backslashes=!0,_=U();continue}if(_===B){q=!0;break}}continue}break}if(I===!0){if(q=!0,E===!0)continue;break}}i.noext===!0&&(ce=!1,I=!1);let j=X,a="",l="";P>0&&(a=X.slice(0,P),X=X.slice(P),re-=P),j&&I===!0&&re>0?(j=X.slice(0,re),l=X.slice(re)):I===!0?(j="",l=X):j=X,j&&j!==""&&j!=="/"&&j!==X&&Q(j.charCodeAt(j.length-1))&&(j=j.slice(0,-1)),i.unescape===!0&&(l&&(l=e.removeBackslashes(l)),j&&L===!0&&(j=e.removeBackslashes(j)));const te={prefix:a,input:d,start:P,base:j,glob:l,isBrace:W,isBracket:ne,isGlob:I,isExtglob:ce,isGlobstar:ge,negated:ie,negatedExtglob:de};if(i.tokens===!0&&(te.maxDepth=0,Q(_)||v.push(S),te.tokens=v),i.parts===!0||i.tokens===!0){let N;for(let D=0;D<T.length;D++){const pe=N?N+1:P,J=T[D],fe=d.slice(pe,J);i.tokens&&(D===0&&P!==0?(v[D].isPrefix=!0,v[D].value=a):v[D].value=fe,z(v[D]),te.maxDepth+=v[D].depth),(D!==0||fe!=="")&&O.push(fe),N=J}if(N&&N+1<d.length){const D=d.slice(N+1);O.push(D),i.tokens&&(v[v.length-1].value=D,z(v[v.length-1]),te.maxDepth+=v[v.length-1].depth)}te.slashes=T,te.parts=O}return te},yt}var vt,Xt;function er(){if(Xt)return vt;Xt=1;const e=pt(),t=ft(),{MAX_LENGTH:o,POSIX_REGEX_SOURCE:r,REGEX_NON_SPECIAL_CHARS:u,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:n}=e,c=(d,m)=>typeof m.expandRange=="function"?m.expandRange(...d,m):(d.sort(),`[${d.join("-")}]`),f=(d,m)=>`Missing ${d}: "${m}" - use "\\\\${m}" to match literal characters`,R=d=>{const m=[];let i=0,y=0,E=0,T="",v=!1;for(const O of d){if(v===!0){T+=O,v=!1;continue}if(O==="\\"){T+=O,v=!0;continue}if(O==='"'){E=E===1?0:1,T+=O;continue}if(E===0){if(O==="[")i++;else if(O==="]"&&i>0)i--;else if(i===0){if(O==="(")y++;else if(O===")"&&y>0)y--;else if(O==="|"&&y===0){m.push(T),T="";continue}}}T+=O}return m.push(T),m},h=d=>{let m=!1;for(const i of d){if(m===!0){m=!1;continue}if(i==="\\"){m=!0;continue}if(/[?*+@!()[\]{}]/.test(i))return!1}return!0},A=d=>{let m=d.trim(),i=!0;for(;i===!0;)i=!1,/^@\([^\\()[\]{}|]+\)$/.test(m)&&(m=m.slice(2,-1),i=!0);if(h(m))return m.replace(/\\(.)/g,"$1")},$=d=>{const m=d.map(A).filter(Boolean);for(let i=0;i<m.length;i++)for(let y=i+1;y<m.length;y++){const E=m[i],T=m[y],v=E[0];if(!(!v||E!==v.repeat(E.length)||T!==v.repeat(T.length))&&(E===T||E.startsWith(T)||T.startsWith(E)))return!0}return!1},x=(d,m=!0)=>{if(d[0]!=="+"&&d[0]!=="*"||d[1]!=="(")return;let i=0,y=0,E=0,T=!1;for(let v=1;v<d.length;v++){const O=d[v];if(T===!0){T=!1;continue}if(O==="\\"){T=!0;continue}if(O==='"'){E=E===1?0:1;continue}if(E!==1){if(O==="["){i++;continue}if(O==="]"&&i>0){i--;continue}if(!(i>0)){if(O==="("){y++;continue}if(O===")"&&(y--,y===0))return m===!0&&v!==d.length-1?void 0:{type:d[0],body:d.slice(2,v),end:v}}}}},B=d=>{let m=0;const i=[];for(;m<d.length;){const y=x(d.slice(m),!1);if(!y||y.type!=="*")return;const E=R(y.body).map(v=>v.trim());if(E.length!==1)return;const T=A(E[0]);if(!T||T.length!==1)return;i.push(T),m+=y.end+1}return i.length<1?void 0:`${i.length===1?t.escapeRegex(i[0]):`[${i.map(y=>t.escapeRegex(y)).join("")}]`}*`},oe=d=>{let m=0,i=d.trim(),y=x(i);for(;y;)m++,i=y.body.trim(),y=x(i);return m},Q=(d,m)=>{if(m.maxExtglobRecursion===!1)return{risky:!1};const i=typeof m.maxExtglobRecursion=="number"?m.maxExtglobRecursion:e.DEFAULT_MAX_EXTGLOB_RECURSION,y=R(d).map(E=>E.trim());if(y.length>1&&(y.some(E=>E==="")||y.some(E=>/^[*?]+$/.test(E))||$(y)))return{risky:!0};for(const E of y){const T=B(E);if(T)return{risky:!0,safeOutput:T};if(oe(E)>i)return{risky:!0}}return{risky:!1}},z=(d,m)=>{if(typeof d!="string")throw new TypeError("Expected a string");d=n[d]||d;const i={...m},y=typeof i.maxLength=="number"?Math.min(o,i.maxLength):o;let E=d.length;if(E>y)throw new SyntaxError(`Input length: ${E}, exceeds maximum allowed length: ${y}`);const T={type:"bos",value:"",output:i.prepend||""},v=[T],O=i.capture?"":"?:",X=e.globChars(i.windows),Z=e.extglobChars(X),{DOT_LITERAL:P,PLUS_LITERAL:re,SLASH_LITERAL:W,ONE_CHAR:ne,DOTS_SLASH:I,NO_DOT:ce,NO_DOT_SLASH:ge,NO_DOTS_SLASH:ue,QMARK:L,QMARK_NO_DOT:ie,STAR:de,START_ANCHOR:q}=X,K=b=>`(${O}(?:(?!${q}${b.dot?I:P}).)*?)`,Y=i.dot?"":ce,_=i.dot?L:ie;let S=i.bash===!0?K(i):de;i.capture&&(S=`(${S})`),typeof i.noext=="boolean"&&(i.noextglob=i.noext);const p={input:d,index:-1,start:0,dot:i.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:v};d=t.removePrefix(d,p),E=d.length;const V=[],U=[],j=[];let a=T,l;const te=()=>p.index===E-1,N=p.peek=(b=1)=>d[p.index+b],D=p.advance=()=>d[++p.index]||"",pe=()=>d.slice(p.index+1),J=(b="",M=0)=>{p.consumed+=b,p.index+=M},fe=b=>{p.output+=b.output!=null?b.output:b.value,J(b.value)},Oo=()=>{let b=1;for(;N()==="!"&&(N(2)!=="("||N(3)==="?");)D(),p.start++,b++;return b%2===0?!1:(p.negated=!0,p.start++,!0)},ut=b=>{p[b]++,j.push(b)},he=b=>{p[b]--,j.pop()},k=b=>{if(a.type==="globstar"){const M=p.braces>0&&(b.type==="comma"||b.type==="brace"),g=b.extglob===!0||V.length&&(b.type==="pipe"||b.type==="paren");b.type!=="slash"&&b.type!=="paren"&&!M&&!g&&(p.output=p.output.slice(0,-a.output.length),a.type="star",a.value="*",a.output=S,p.output+=a.output)}if(V.length&&b.type!=="paren"&&(V[V.length-1].inner+=b.value),(b.value||b.output)&&fe(b),a&&a.type==="text"&&b.type==="text"){a.output=(a.output||a.value)+b.value,a.value+=b.value;return}b.prev=a,v.push(b),a=b},it=(b,M)=>{const g={...Z[M],conditions:1,inner:""};g.prev=a,g.parens=p.parens,g.output=p.output,g.startIndex=p.index,g.tokensIndex=v.length;const C=(i.capture?"(":"")+g.open;ut("parens"),k({type:b,value:M,output:p.output?"":ne}),k({type:"paren",extglob:!0,value:D(),output:C}),V.push(g)},No=b=>{const M=d.slice(b.startIndex,p.index+1),g=d.slice(b.startIndex+2,p.index),C=Q(g,i);if((b.type==="plus"||b.type==="star")&&C.risky){const H=C.safeOutput?(b.output?"":ne)+(i.capture?`(${C.safeOutput})`:C.safeOutput):void 0,ae=v[b.tokensIndex];ae.type="text",ae.value=M,ae.output=H||t.escapeRegex(M);for(let le=b.tokensIndex+1;le<v.length;le++)v[le].value="",v[le].output="",delete v[le].suffix;p.output=b.output+ae.output,p.backtrack=!0,k({type:"paren",extglob:!0,value:l,output:""}),he("parens");return}let G=b.close+(i.capture?")":""),F;if(b.type==="negate"){let H=S;if(b.inner&&b.inner.length>1&&b.inner.includes("/")&&(H=K(i)),(H!==S||te()||/^\)+$/.test(pe()))&&(G=b.close=`)$))${H}`),b.inner.includes("*")&&(F=pe())&&/^\.[^\\/.]+$/.test(F)){const ae=z(F,{...m,fastpaths:!1}).output;G=b.close=`)${ae})${H})`}b.prev.type==="bos"&&(p.negatedExtglob=!0)}k({type:"paren",extglob:!0,value:l,output:G}),he("parens")};if(i.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(d)){let b=!1,M=d.replace(s,(g,C,G,F,H,ae)=>F==="\\"?(b=!0,g):F==="?"?C?C+F+(H?L.repeat(H.length):""):ae===0?_+(H?L.repeat(H.length):""):L.repeat(G.length):F==="."?P.repeat(G.length):F==="*"?C?C+F+(H?S:""):S:C?g:`\\${g}`);return b===!0&&(i.unescape===!0?M=M.replace(/\\/g,""):M=M.replace(/\\+/g,g=>g.length%2===0?"\\\\":g?"\\":"")),M===d&&i.contains===!0?(p.output=d,p):(p.output=t.wrapOutput(M,p,m),p)}for(;!te();){if(l=D(),l==="\0")continue;if(l==="\\"){const g=N();if(g==="/"&&i.bash!==!0||g==="."||g===";")continue;if(!g){l+="\\",k({type:"text",value:l});continue}const C=/^\\+/.exec(pe());let G=0;if(C&&C[0].length>2&&(G=C[0].length,p.index+=G,G%2!==0&&(l+="\\")),i.unescape===!0?l=D():l+=D(),p.brackets===0){k({type:"text",value:l});continue}}if(p.brackets>0&&(l!=="]"||a.value==="["||a.value==="[^")){if(i.posix!==!1&&l===":"){const g=a.value.slice(1);if(g.includes("[")&&(a.posix=!0,g.includes(":"))){const C=a.value.lastIndexOf("["),G=a.value.slice(0,C),F=a.value.slice(C+2),H=r[F];if(H){a.value=G+H,p.backtrack=!0,D(),!T.output&&v.indexOf(a)===1&&(T.output=ne);continue}}}(l==="["&&N()!==":"||l==="-"&&N()==="]")&&(l=`\\${l}`),l==="]"&&(a.value==="["||a.value==="[^")&&(l=`\\${l}`),i.posix===!0&&l==="!"&&a.value==="["&&(l="^"),a.value+=l,fe({value:l});continue}if(p.quotes===1&&l!=='"'){l=t.escapeRegex(l),a.value+=l,fe({value:l});continue}if(l==='"'){p.quotes=p.quotes===1?0:1,i.keepQuotes===!0&&k({type:"text",value:l});continue}if(l==="("){ut("parens"),k({type:"paren",value:l});continue}if(l===")"){if(p.parens===0&&i.strictBrackets===!0)throw new SyntaxError(f("opening","("));const g=V[V.length-1];if(g&&p.parens===g.parens+1){No(V.pop());continue}k({type:"paren",value:l,output:p.parens?")":"\\)"}),he("parens");continue}if(l==="["){if(i.nobracket===!0||!pe().includes("]")){if(i.nobracket!==!0&&i.strictBrackets===!0)throw new SyntaxError(f("closing","]"));l=`\\${l}`}else ut("brackets");k({type:"bracket",value:l});continue}if(l==="]"){if(i.nobracket===!0||a&&a.type==="bracket"&&a.value.length===1){k({type:"text",value:l,output:`\\${l}`});continue}if(p.brackets===0){if(i.strictBrackets===!0)throw new SyntaxError(f("opening","["));k({type:"text",value:l,output:`\\${l}`});continue}he("brackets");const g=a.value.slice(1);if(a.posix!==!0&&g[0]==="^"&&!g.includes("/")&&(l=`/${l}`),a.value+=l,fe({value:l}),i.literalBrackets===!1||t.hasRegexChars(g))continue;const C=t.escapeRegex(a.value);if(p.output=p.output.slice(0,-a.value.length),i.literalBrackets===!0){p.output+=C,a.value=C;continue}a.value=`(${O}${C}|${a.value})`,p.output+=a.value;continue}if(l==="{"&&i.nobrace!==!0){ut("braces");const g={type:"brace",value:l,output:"(",outputIndex:p.output.length,tokensIndex:p.tokens.length};U.push(g),k(g);continue}if(l==="}"){const g=U[U.length-1];if(i.nobrace===!0||!g){k({type:"text",value:l,output:l});continue}let C=")";if(g.dots===!0){const G=v.slice(),F=[];for(let H=G.length-1;H>=0&&(v.pop(),G[H].type!=="brace");H--)G[H].type!=="dots"&&F.unshift(G[H].value);C=c(F,i),p.backtrack=!0}if(g.comma!==!0&&g.dots!==!0){const G=p.output.slice(0,g.outputIndex),F=p.tokens.slice(g.tokensIndex);g.value=g.output="\\{",l=C="\\}",p.output=G;for(const H of F)p.output+=H.output||H.value}k({type:"brace",value:l,output:C}),he("braces"),U.pop();continue}if(l==="|"){V.length>0&&V[V.length-1].conditions++,k({type:"text",value:l});continue}if(l===","){let g=l;const C=U[U.length-1];C&&j[j.length-1]==="braces"&&(C.comma=!0,g="|"),k({type:"comma",value:l,output:g});continue}if(l==="/"){if(a.type==="dot"&&p.index===p.start+1){p.start=p.index+1,p.consumed="",p.output="",v.pop(),a=T;continue}k({type:"slash",value:l,output:W});continue}if(l==="."){if(p.braces>0&&a.type==="dot"){a.value==="."&&(a.output=P);const g=U[U.length-1];a.type="dots",a.output+=l,a.value+=l,g.dots=!0;continue}if(p.braces+p.parens===0&&a.type!=="bos"&&a.type!=="slash"){k({type:"text",value:l,output:P});continue}k({type:"dot",value:l,output:P});continue}if(l==="?"){if(!(a&&a.value==="(")&&i.noextglob!==!0&&N()==="("&&N(2)!=="?"){it("qmark",l);continue}if(a&&a.type==="paren"){const g=N();let C=l;(a.value==="("&&!/[!=<:]/.test(g)||g==="<"&&!/<([!=]|\w+>)/.test(pe()))&&(C=`\\${l}`),k({type:"text",value:l,output:C});continue}if(i.dot!==!0&&(a.type==="slash"||a.type==="bos")){k({type:"qmark",value:l,output:ie});continue}k({type:"qmark",value:l,output:L});continue}if(l==="!"){if(i.noextglob!==!0&&N()==="("&&(N(2)!=="?"||!/[!=<:]/.test(N(3)))){it("negate",l);continue}if(i.nonegate!==!0&&p.index===0){Oo();continue}}if(l==="+"){if(i.noextglob!==!0&&N()==="("&&N(2)!=="?"){it("plus",l);continue}if(a&&a.value==="("||i.regex===!1){k({type:"plus",value:l,output:re});continue}if(a&&(a.type==="bracket"||a.type==="paren"||a.type==="brace")||p.parens>0){k({type:"plus",value:l});continue}k({type:"plus",value:re});continue}if(l==="@"){if(i.noextglob!==!0&&N()==="("&&N(2)!=="?"){k({type:"at",extglob:!0,value:l,output:""});continue}k({type:"text",value:l});continue}if(l!=="*"){(l==="$"||l==="^")&&(l=`\\${l}`);const g=u.exec(pe());g&&(l+=g[0],p.index+=g[0].length),k({type:"text",value:l});continue}if(a&&(a.type==="globstar"||a.star===!0)){a.type="star",a.star=!0,a.value+=l,a.output=S,p.backtrack=!0,p.globstar=!0,J(l);continue}let b=pe();if(i.noextglob!==!0&&/^\([^?]/.test(b)){it("star",l);continue}if(a.type==="star"){if(i.noglobstar===!0){J(l);continue}const g=a.prev,C=g.prev,G=g.type==="slash"||g.type==="bos",F=C&&(C.type==="star"||C.type==="globstar");if(i.bash===!0&&(!G||b[0]&&b[0]!=="/")){k({type:"star",value:l,output:""});continue}const H=p.braces>0&&(g.type==="comma"||g.type==="brace"),ae=V.length&&(g.type==="pipe"||g.type==="paren");if(!G&&g.type!=="paren"&&!H&&!ae){k({type:"star",value:l,output:""});continue}for(;b.slice(0,3)==="/**";){const le=d[p.index+4];if(le&&le!=="/")break;b=b.slice(3),J("/**",3)}if(g.type==="bos"&&te()){a.type="globstar",a.value+=l,a.output=K(i),p.output=a.output,p.globstar=!0,J(l);continue}if(g.type==="slash"&&g.prev.type!=="bos"&&!F&&te()){p.output=p.output.slice(0,-(g.output+a.output).length),g.output=`(?:${g.output}`,a.type="globstar",a.output=K(i)+(i.strictSlashes?")":"|$)"),a.value+=l,p.globstar=!0,p.output+=g.output+a.output,J(l);continue}if(g.type==="slash"&&g.prev.type!=="bos"&&b[0]==="/"){const le=b[1]!==void 0?"|$":"";p.output=p.output.slice(0,-(g.output+a.output).length),g.output=`(?:${g.output}`,a.type="globstar",a.output=`${K(i)}${W}|${W}${le})`,a.value+=l,p.output+=g.output+a.output,p.globstar=!0,J(l+D()),k({type:"slash",value:"/",output:""});continue}if(g.type==="bos"&&b[0]==="/"){a.type="globstar",a.value+=l,a.output=`(?:^|${W}|${K(i)}${W})`,p.output=a.output,p.globstar=!0,J(l+D()),k({type:"slash",value:"/",output:""});continue}if(H&&b[0]==="/"){a.type="globstar",a.value+=l,a.output=`(?:^|${W}|${K(i)}${W})`,p.output+=a.output,p.globstar=!0,J(l+D()),k({type:"slash",value:"/",output:""});continue}p.output=p.output.slice(0,-a.output.length),a.type="globstar",a.output=K(i),a.value+=l,p.output+=a.output,p.globstar=!0,J(l);continue}const M={type:"star",value:l,output:S};if(i.bash===!0){M.output=".*?",(a.type==="bos"||a.type==="slash")&&(M.output=Y+M.output),k(M);continue}if(a&&(a.type==="bracket"||a.type==="paren")&&i.regex===!0){M.output=l,k(M);continue}(p.index===p.start||a.type==="slash"||a.type==="dot")&&(a.type==="dot"?(p.output+=ge,a.output+=ge):i.dot===!0?(p.output+=ue,a.output+=ue):(p.output+=Y,a.output+=Y),N()!=="*"&&(p.output+=ne,a.output+=ne)),k(M)}for(;p.brackets>0;){if(i.strictBrackets===!0)throw new SyntaxError(f("closing","]"));p.output=t.escapeLast(p.output,"["),he("brackets")}for(;p.parens>0;){if(i.strictBrackets===!0)throw new SyntaxError(f("closing",")"));p.output=t.escapeLast(p.output,"("),he("parens")}for(;p.braces>0;){if(i.strictBrackets===!0)throw new SyntaxError(f("closing","}"));p.output=t.escapeLast(p.output,"{"),he("braces")}if(i.strictSlashes!==!0&&(a.type==="star"||a.type==="bracket")&&k({type:"maybe_slash",value:"",output:`${W}?`}),p.backtrack===!0){p.output="";for(const b of p.tokens)p.output+=b.output!=null?b.output:b.value,b.suffix&&(p.output+=b.suffix)}return p};return z.fastpaths=(d,m)=>{const i={...m},y=typeof i.maxLength=="number"?Math.min(o,i.maxLength):o,E=d.length;if(E>y)throw new SyntaxError(`Input length: ${E}, exceeds maximum allowed length: ${y}`);d=n[d]||d;const{DOT_LITERAL:T,SLASH_LITERAL:v,ONE_CHAR:O,DOTS_SLASH:X,NO_DOT:Z,NO_DOTS:P,NO_DOTS_SLASH:re,STAR:W,START_ANCHOR:ne}=e.globChars(i.windows),I=i.dot?P:Z,ce=i.dot?re:Z,ge=i.capture?"":"?:",ue={negated:!1,prefix:""};let L=i.bash===!0?".*?":W;i.capture&&(L=`(${L})`);const ie=Y=>Y.noglobstar===!0?L:`(${ge}(?:(?!${ne}${Y.dot?X:T}).)*?)`,de=Y=>{switch(Y){case"*":return`${I}${O}${L}`;case".*":return`${T}${O}${L}`;case"*.*":return`${I}${L}${T}${O}${L}`;case"*/*":return`${I}${L}${v}${O}${ce}${L}`;case"**":return I+ie(i);case"**/*":return`(?:${I}${ie(i)}${v})?${ce}${O}${L}`;case"**/*.*":return`(?:${I}${ie(i)}${v})?${ce}${L}${T}${O}${L}`;case"**/.*":return`(?:${I}${ie(i)}${v})?${T}${O}${L}`;default:{const _=/^(.*?)\.(\w+)$/.exec(Y);if(!_)return;const S=de(_[1]);return S?S+T+_[2]:void 0}}},q=t.removePrefix(d,ue);let K=de(q);return K&&i.strictSlashes!==!0&&(K+=`${v}?`),K},vt=z,vt}var At,Wt;function tr(){if(Wt)return At;Wt=1;const e=Js(),t=er(),o=ft(),r=pt(),u=n=>n&&typeof n=="object"&&!Array.isArray(n),s=(n,c,f=!1)=>{if(Array.isArray(n)){const Q=n.map(z=>s(z,c,f));return z=>{for(const d of Q){const m=d(z);if(m)return m}return!1}}const R=u(n)&&n.tokens&&n.input;if(n===""||typeof n!="string"&&!R)throw new TypeError("Expected pattern to be a non-empty string");const h=c||{},A=h.windows,$=R?s.compileRe(n,c):s.makeRe(n,c,!1,!0),x=$.state;delete $.state;let B=()=>!1;if(h.ignore){const Q={...c,ignore:null,onMatch:null,onResult:null};B=s(h.ignore,Q,f)}const oe=(Q,z=!1)=>{const{isMatch:d,match:m,output:i}=s.test(Q,$,c,{glob:n,posix:A}),y={glob:n,state:x,regex:$,posix:A,input:Q,output:i,match:m,isMatch:d};if(typeof h.onResult=="function"&&h.onResult(y),d===!1)return y.isMatch=!1,z?y:!1;e:if(B(Q)){if(typeof h.onIgnore=="function"&&h.onIgnore(y)===r.UNIGNORE){y.isMatch=!0;break e}return y.isMatch=!1,z?y:!1}return typeof h.onMatch=="function"&&h.onMatch(y),z?y:!0};return f&&(oe.state=x),oe};return s.test=(n,c,f,{glob:R,posix:h}={})=>{if(typeof n!="string")throw new TypeError("Expected input to be a string");if(n==="")return{isMatch:!1,output:""};const A=f||{},$=A.format||(h?o.toPosixSlashes:null);let x=n===R,B=x&&$?$(n):n;return x===!1&&(B=$?$(n):n,x=B===R),(x===!1||A.capture===!0)&&(A.matchBase===!0||A.basename===!0?x=s.matchBase(n,c,f,h):x=c.exec(B)),{isMatch:!!x,match:x,output:B}},s.matchBase=(n,c,f)=>(c instanceof RegExp?c:s.makeRe(c,f)).test(o.basename(n)),s.isMatch=(n,c,f)=>s(c,f)(n),s.parse=(n,c)=>Array.isArray(n)?n.map(f=>s.parse(f,c)):t(n,{...c,fastpaths:!1}),s.scan=(n,c)=>e(n,c),s.compileRe=(n,c,f=!1,R=!1)=>{if(f===!0)return n.output;const h=c||{},A=h.contains?"":"^",$=h.contains?"":"$";let x=`${A}(?:${n.output})${$}`;n&&n.negated===!0&&(x=`^(?!${x}).*$`);const B=s.toRegex(x,c);return R===!0&&(B.state=n),B},s.makeRe=(n,c={},f=!1,R=!1)=>{if(!n||typeof n!="string")throw new TypeError("Expected a non-empty string");let h={negated:!1,fastpaths:!0};return c.fastpaths!==!1&&(n[0]==="."||n[0]==="*")&&(h.output=t.fastpaths(n,c)),h.output||(h=t(n,c)),s.compileRe(h,c,f,R)},s.toRegex=(n,c)=>{try{const f=c||{};return new RegExp(n,f.flags||(f.nocase?"i":""))}catch(f){if(c&&c.debug===!0)throw f;return/$^/}},s.constants=r,At=s,At}var Rt,qt;function or(){if(qt)return Rt;qt=1;const e=tr(),t=ft();function o(r,u,s=!1){return u&&(u.windows===null||u.windows===void 0)&&(u={...u,windows:t.isWindows()}),e(r,u,s)}return Object.assign(o,e),Rt=o,Rt}var sr=or();Nt(sr);const rr=w(import.meta.url),Ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,nt=e=>{if(typeof Ie<"u"&&Ie.versions&&Ie.versions.node){const[t,o]=Ie.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ie.getBuiltinModule(e)}return rr(e)};nt("fs");nt("fs");nt("path");nt("url");const{createRequire:nr}=nt("module");var Qt=nr(import.meta.url);try{Qt.resolve("picomatch"),Qt("picomatch")}catch{}var Et,Zt;function ur(){if(Zt)return Et;Zt=1;/*!
|
|
5
|
-
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
8
|
-
* Licensed under the MIT License.
|
|
9
|
-
*/return Et=function(e){if(typeof e!="string"||e==="")return!1;for(var t;t=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(t[2])return!0;e=e.slice(t.index+t[0].length)}return!1},Et}var Tt,Vt;function mo(){if(Vt)return Tt;Vt=1;/*!
|
|
10
|
-
* is-glob <https://github.com/jonschlinkert/is-glob>
|
|
11
|
-
*
|
|
12
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
13
|
-
* Released under the MIT License.
|
|
14
|
-
*/var e=ur(),t={"{":"}","(":")","[":"]"},o=function(u){if(u[0]==="!")return!0;for(var s=0,n=-2,c=-2,f=-2,R=-2,h=-2;s<u.length;){if(u[s]==="*"||u[s+1]==="?"&&/[\].+)]/.test(u[s])||c!==-1&&u[s]==="["&&u[s+1]!=="]"&&(c<s&&(c=u.indexOf("]",s)),c>s&&(h===-1||h>c||(h=u.indexOf("\\",s),h===-1||h>c)))||f!==-1&&u[s]==="{"&&u[s+1]!=="}"&&(f=u.indexOf("}",s),f>s&&(h=u.indexOf("\\",s),h===-1||h>f))||R!==-1&&u[s]==="("&&u[s+1]==="?"&&/[:!=]/.test(u[s+2])&&u[s+3]!==")"&&(R=u.indexOf(")",s),R>s&&(h=u.indexOf("\\",s),h===-1||h>R))||n!==-1&&u[s]==="("&&u[s+1]!=="|"&&(n<s&&(n=u.indexOf("|",s)),n!==-1&&u[n+1]!==")"&&(R=u.indexOf(")",n),R>n&&(h=u.indexOf("\\",n),h===-1||h>R))))return!0;if(u[s]==="\\"){var A=u[s+1];s+=2;var $=t[A];if($){var x=u.indexOf($,s);x!==-1&&(s=x+1)}if(u[s]==="!")return!0}else s++}return!1},r=function(u){if(u[0]==="!")return!0;for(var s=0;s<u.length;){if(/[*?{}()[\]]/.test(u[s]))return!0;if(u[s]==="\\"){var n=u[s+1];s+=2;var c=t[n];if(c){var f=u.indexOf(c,s);f!==-1&&(s=f+1)}if(u[s]==="!")return!0}else s++}return!1};return Tt=function(u,s){if(typeof u!="string"||u==="")return!1;if(e(u))return!0;var n=o;return s&&s.strict===!1&&(n=r),n(u)},Tt}const ir=w(import.meta.url),De=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,yo=e=>{if(typeof De<"u"&&De.versions&&De.versions.node){const[t,o]=De.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return De.getBuiltinModule(e)}return ir(e)},ar=yo("path"),lr=yo("os");var xt,Yt;function cr(){if(Yt)return xt;Yt=1;var e=mo(),t=ar.posix.dirname,o=lr.platform()==="win32",r="/",u=/\\/g,s=/\\([!*?|[\](){}])/g;xt=function(f,R){var h=Object.assign({flipBackslashes:!0},R);h.flipBackslashes&&o&&f.indexOf(r)<0&&(f=f.replace(u,r)),n(f)&&(f+=r),f+="a";do f=t(f);while(c(f));return f.replace(s,"$1")};function n(f){var R=f.slice(-1),h;switch(R){case"}":h="{";break;case"]":h="[";break;default:return!1}var A=f.indexOf(h);return A<0?!1:f.slice(A+1,-1).includes(r)}function c(f){return/\([^()]+$/.test(f)||f[0]==="{"||f[0]==="["||/[^\\][{[]/.test(f)?!0:e(f)}return xt}var pr=cr();Nt(pr);const fr=w(import.meta.url),Ge=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,hr=e=>{if(typeof Ge<"u"&&Ge.versions&&Ge.versions.node){const[t,o]=Ge.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ge.getBuiltinModule(e)}return fr(e)};hr("node:fs/promises");const gr=w(import.meta.url),je=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,dr=e=>{if(typeof je<"u"&&je.versions&&je.versions.node){const[t,o]=je.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return je.getBuiltinModule(e)}return gr(e)},{accessSync:br}=dr("node:fs");function St(e,t=os){bo(e),e=at(e);try{return br(e,t),!0}catch{return!1}}var mr=mo();Nt(mr);const yr=w(import.meta.url),Pe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,vo=e=>{if(typeof Pe<"u"&&Pe.versions&&Pe.versions.node){const[t,o]=Pe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Pe.getBuiltinModule(e)}return yr(e)};vo("node:fs/promises");vo("node:fs");let vr=class extends Error{constructor(e){super(`ENOENT: ${e}`)}get code(){return"ENOENT"}set code(e){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(e){throw new Error("Cannot overwrite name of NotFoundError")}};const Ar=w(import.meta.url),Ue=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ao=e=>{if(typeof Ue<"u"&&Ue.versions&&Ue.versions.node){const[t,o]=Ue.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ue.getBuiltinModule(e)}return Ar(e)};Ao("node:fs/promises");Ao("node:zlib");const Rr=w(import.meta.url),Fe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ro=e=>{if(typeof Fe<"u"&&Fe.versions&&Fe.versions.node){const[t,o]=Fe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Fe.getBuiltinModule(e)}return Rr(e)};Ro("node:fs");Ro("node:zlib");const Er=w(import.meta.url),Ke=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Tr=e=>{if(typeof Ke<"u"&&Ke.versions&&Ke.versions.node){const[t,o]=Ke.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ke.getBuiltinModule(e)}return Er(e)},{createRequire:Eo}=Tr("node:module"),xr=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&xr.set("AggregateError",AggregateError);const _r=Eo(import.meta.url),ze=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$r=e=>{if(typeof ze<"u"&&ze.versions&&ze.versions.node){const[t,o]=ze.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return ze.getBuiltinModule(e)}return _r(e)};$r("node:util");const kr=Eo(import.meta.url),Xe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ht=e=>{if(typeof Xe<"u"&&Xe.versions&&Xe.versions.node){const[t,o]=Xe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Xe.getBuiltinModule(e)}return kr(e)};Ht("node:fs");Ht("node:path");Ht("node:url");const Cr=w(import.meta.url),We=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,To=e=>{if(typeof We<"u"&&We.versions&&We.versions.node){const[t,o]=We.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return We.getBuiltinModule(e)}return Cr(e)};To("node:fs");To("node:fs/promises");const Sr=w(import.meta.url),qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,wr=e=>{if(typeof qe<"u"&&qe.versions&&qe.versions.node){const[t,o]=qe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return qe.getBuiltinModule(e)}return Sr(e)};wr("node:fs");const Or=w(import.meta.url),Qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Nr=e=>{if(typeof Qe<"u"&&Qe.versions&&Qe.versions.node){const[t,o]=Qe.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Qe.getBuiltinModule(e)}return Or(e)};Nr("node:fs/promises");const Hr=w(import.meta.url),Ze=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Lr=e=>{if(typeof Ze<"u"&&Ze.versions&&Ze.versions.node){const[t,o]=Ze.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ze.getBuiltinModule(e)}return Hr(e)};Lr("node:fs");w(import.meta.url);const Br=w(import.meta.url),Ve=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Mr=e=>{if(typeof Ve<"u"&&Ve.versions&&Ve.versions.node){const[t,o]=Ve.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ve.getBuiltinModule(e)}return Br(e)};Mr("node:crypto");new TextEncoder;const Ir=w(import.meta.url),Ye=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Dr=e=>{if(typeof Ye<"u"&&Ye.versions&&Ye.versions.node){const[t,o]=Ye.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Ye.getBuiltinModule(e)}return Ir(e)};Dr("node:fs/promises");const Gr=w(import.meta.url),Je=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,jr=e=>{if(typeof Je<"u"&&Je.versions&&Je.versions.node){const[t,o]=Je.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return Je.getBuiltinModule(e)}return Gr(e)};jr("node:fs");const Pr=w(import.meta.url),et=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ur=e=>{if(typeof et<"u"&&et.versions&&et.versions.node){const[t,o]=et.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return et.getBuiltinModule(e)}return Pr(e)};Ur("node:fs/promises");const Fr=w(import.meta.url),tt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Kr=e=>{if(typeof tt<"u"&&tt.versions&&tt.versions.node){const[t,o]=tt.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return tt.getBuiltinModule(e)}return Fr(e)};Kr("node:fs");const zr=w(import.meta.url),ot=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Lt=e=>{if(typeof ot<"u"&&ot.versions&&ot.versions.node){const[t,o]=ot.versions.node.split(".").map(Number);if(t>22||t===22&&o>=3||t===20&&o>=16)return ot.getBuiltinModule(e)}return zr(e)},Xr=Lt("fs"),Wr=Lt("os"),qr=Lt("path");var _t={},Jt;function Qr(){if(Jt)return _t;Jt=1;var e=Object.defineProperty,t=(h,A)=>e(h,"name",{value:A,configurable:!0}),o=Xr,r=Wr,u=qr;const s=t(h=>{let A="";for(let $=0;$<h.length;$+=1){const x=h[$],B=x.toUpperCase();A+=x===B?x.toLowerCase():B}return A},"invertCase"),n=new Map,c=t((h,A)=>{const $=u.join(h,`.is-fs-case-sensitive-test-${process.pid}`);try{return A.writeFileSync($,""),!A.existsSync(s($))}finally{try{A.unlinkSync($)}catch{}}},"checkDirectoryCaseWithWrite"),f=t((h,A,$)=>{try{return c(h,$)}catch(x){if(A===void 0)return c(r.tmpdir(),$);throw x}},"checkDirectoryCaseWithFallback"),R=t((h,A=o,$=!0)=>{const x=h??process.cwd();if($&&n.has(x))return n.get(x);let B;const oe=s(x);return oe!==x&&A.existsSync(x)?B=!A.existsSync(oe):B=f(x,h,A),$&&n.set(x,B),B},"isFsCaseSensitive");return _t.isFsCaseSensitive=R,_t}Qr();const xo=e=>e instanceof URL?new URL(e).pathname:e,eo=e=>{const t=es();if(It==="win32"){const r=rt.LOCALAPPDATA??(t?se(t,"AppData","Local"):gt());return se(r,e,"Cache")}if(It==="darwin"){const r=t?se(t,"Library","Caches"):gt();return se(r,e)}const o=rt.XDG_CACHE_HOME??(t?se(t,".cache"):gt());return se(o,e)},Zr=e=>{if(e.length===0)return;const t=e.map(s=>go(xo(s)).split(dt));let o=Number.POSITIVE_INFINITY;for(const s of t)s.length<o&&(o=s.length);const r=[];for(let s=0;s<o;s+=1){const n=t[0][s];if(t.every(c=>c[s]===n))r.push(n);else break}const u=r.join(dt);return u===""?dt:u},st=(e,t)=>{if(e!==void 0)return t?(...o)=>se(e,...o):e},Vr=e=>{if(e?.files&&e.files.length>0){const t=Zr(e.files);if(t!==void 0)return t}return e?.cwd??ts()},Yr=e=>new vr(`No package.json found searching upwards from '${xo(e)}'.`),$t=e=>!St(e,po)&&St(e),Jr=(e,t)=>{if(rt.CACHE_DIR&&!["0","1","false","true"].includes(rt.CACHE_DIR)){const c=se(rt.CACHE_DIR,e);return t?.create&&$e(c),st(c,t?.thunk)}const o=Vr(t),r=Ys("package.json",{cwd:o,type:"file"});if(!r){if(t?.useGlobalCacheFallback){const c=eo(e);return t.create&&$e(c),st(c,t.thunk)}if(t?.throwError)throw Yr(o);return}const u=se(Ot(r),"node_modules"),s=se(u,".cache"),n=se(s,e);if(St(n,po))return t?.create&&$e(n),st(n,t?.thunk);if($t(n)||$t(s)||$t(u)){if(t?.useGlobalCacheFallback){const c=eo(e);return t.create&&$e(c),st(c,t.thunk)}return}return t?.create&&$e(n),st(n,t?.thunk)},_o=Jr;class ht extends Error{chain;constructor(t,o,r){super(t,r),this.name=this.constructor.name,this.chain=o}}class en extends ht{constructor(t,o){const r=[...o,`${t} (re-enters)`].join(" → ");super(`Config cycle: ${r}`,o)}}class $o extends ht{filePath;removedKeys;constructor(t,o,r){const u=[`${t} uses removed keys.`,""];for(const s of r){const n=s.location?` (at ${s.location})`:"";u.push(` • ${s.name}${n} → renamed to \`${s.renamedTo}\``);for(const c of s.children??[])u.push(` ↳ ${c.name} → renamed to \`${c.renamedTo}\``)}u.push("","Run `vis migrate self` to auto-rewrite the config (use --dry-run to preview)."),super(u.join(`
|
|
15
|
-
`),o),this.filePath=t,this.removedKeys=r}}class to extends ht{constructor(t,o,r){const u=r instanceof Error?r.message:String(r),s=o.length>0?`
|
|
16
|
-
Chain: ${o.join(" → ")}`:"";super(`Failed to load ${t}: ${u}${s}`,o,{cause:r})}}const tn=e=>e.join(" → ");class kt extends ht{constructor(t,o,r){const u=o.length>0?o[o.length-1]:"<unknown>",s=r.length>0?`
|
|
17
|
-
Tried:
|
|
18
|
-
${r.join(`
|
|
19
|
-
`)}`:"";super(`Cannot resolve "${t}" extended from ${u}.${s}
|
|
20
|
-
Chain: ${tn(o)}`,o)}}const on=e=>{const t=[];if(Object.hasOwn(e,"targetDefaults")&&t.push({name:"targetDefaults",renamedTo:"tasks"}),Object.hasOwn(e,"taskRunnerOptions")&&t.push({name:"taskRunnerOptions",renamedTo:"taskRunner"}),Object.hasOwn(e,"taskDefaults")){const{taskDefaults:o}=e,r=[];if(Array.isArray(o))for(const[u,s]of o.entries())s&&typeof s=="object"&&(Object.hasOwn(s,"scope")&&r.push({location:`taskDefaults[${u}].scope`,name:"scope",renamedTo:"match"}),Object.hasOwn(s,"targets")&&r.push({location:`taskDefaults[${u}].targets`,name:"targets",renamedTo:"tasks"}));t.push({children:r.length>0?r:void 0,name:"taskDefaults",renamedTo:"scopedTasks"})}else if(Array.isArray(e.scopedTasks))for(const[o,r]of e.scopedTasks.entries())r&&typeof r=="object"&&(Object.hasOwn(r,"scope")&&t.push({location:`scopedTasks[${o}].scope`,name:"scope",renamedTo:"match"}),Object.hasOwn(r,"targets")&&t.push({location:`scopedTasks[${o}].targets`,name:"targets",renamedTo:"tasks"}));return t},sn=e=>Object.hasOwn(e,"targets")&&!Object.hasOwn(e,"tasks")?[{name:"targets",renamedTo:"tasks"}]:[],rn=(e,t,o)=>{if(!o||typeof o!="object")return;const r=on(o);if(r.length>0)throw new $o(e,t,r)},nn=(e,t,o)=>{if(!o||typeof o!="object")return;const r=sn(o);if(r.length>0)throw new $o(e,t,r)},ko=["vis.config.ts","vis.config.mts","vis.config.cts","vis.config.js","vis.config.mjs","vis.config.cjs"],un=new Set(ko),Co=["vis.task.ts","vis.task.mts","vis.task.cts","vis.task.js","vis.task.mjs","vis.task.cjs"],an=new Set(Co),Cn=2880,Ct={blockExoticSubdeps:!0,policies:{installScripts:{strict:!0},publisherChange:{ignoreAfter:43200,mode:"no-downgrade"}}},ln=e=>{if(!e)return{...Ct};const t=Ct.policies??{},o=e.policies??{},r={...t,...o};for(const u of Object.keys(t)){const s=t[u],n=o[u];s!==void 0&&n!==void 0&&(r[u]={...s,...n})}return{...Ct,...e,policies:r}},oo=e=>({...e,security:ln(e.security),update:{security:!0,target:"minor",...e.update}}),cn=e=>{let t;try{t=ro(e)}catch{return}const o=new Set(t.filter(r=>un.has(r)));for(const r of ko)if(o.has(r))return ee(e,r)},pn=e=>{let t;try{t=ro(e)}catch{return}const o=new Set(t.filter(r=>an.has(r)));for(const r of Co)if(o.has(r))return ee(e,r)},Bt=e=>so("sha256").update(Io(e)).digest("hex"),fn=e=>{const t=so("sha256"),o=[...e].sort();for(const r of o)t.update(r),t.update(":"),t.update(Bt(r)),t.update(`
|
|
21
|
-
`);return t.digest("hex")},hn=e=>{const t=ee(e,"node_modules");if(ye(t)){const r=ee(t,".cache","vis");return lt(r),ee(r,"vis-config-cache.json")}const o=_o("vis",{create:!0,cwd:e});return o?ee(o,"vis-config-cache.json"):void 0},gn=(e,t)=>{if(ye(e))try{const o=lo(e);if(o.hash===t)return o.config}catch{}},dn=(e,t,o)=>{try{lt(ct(e)),io(e,{config:o,hash:t})}catch{}},bn=e=>e===void 0?[]:Array.isArray(e)?e:[e],mn=(e,t,o)=>{if(uo(e))throw new kt(e,[...o,t],["Absolute paths in `extends` are not supported. Use a relative path or an npm package name."]);const r=[];if(e.startsWith("./")||e.startsWith("../")){const u=ct(t),s=ee(u,e);if(r.push(s),ye(s))return s;throw new kt(e,[...o,t],r)}try{return no(t).resolve(e)}catch{throw r.push(`require.resolve("${e}") from ${t}`),new kt(e,[...o,t],r)}},So=async(e,t,o)=>{const r=Bt(t),u=t.slice(t.lastIndexOf(".")),s=ee(ct(t),`.vis-config-tmp-${r}${u}`);Bo(t,s);let n;try{n=await e.import(s,{default:!0,try:!0})??{}}catch(c){throw new to(t,o,c)}finally{try{Mo(s)}catch{}}try{return(typeof n=="function"?await n()??{}:n)??{}}catch(c){throw new to(t,o,c)}},yn=(e,t)=>{const o={...e,...t};if(e.tasks||t.tasks){const r=new Set([...Object.keys(e.tasks??{}),...Object.keys(t.tasks??{})]),u={};for(const s of r)u[s]=Yo(e.tasks?.[s],t.tasks?.[s]);o.tasks=u}if((e.scopedTasks||t.scopedTasks)&&(o.scopedTasks=[...e.scopedTasks??[],...t.scopedTasks??[]]),(e.fileGroups||t.fileGroups)&&(o.fileGroups={...e.fileGroups,...t.fileGroups}),(e.taskGroups||t.taskGroups)&&(o.taskGroups={...e.taskGroups,...t.taskGroups}),e.security||t.security){const r=e.security?.policies??{},u=t.security?.policies??{},s={...r,...u};for(const n of Object.keys(r)){const c=r[n],f=u[n];c!==void 0&&f!==void 0&&(s[n]={...c,...f})}o.security={...e.security,...t.security,acceptedRisks:{...e.security?.acceptedRisks,...t.security?.acceptedRisks},policies:s}}return(e.update||t.update)&&(o.update={...e.update,...t.update}),(e.taskRunner||t.taskRunner)&&(o.taskRunner={...e.taskRunner,...t.taskRunner}),delete o.extends,o},wo=async(e,t,o,r,u,s)=>{if(r.has(t))throw new en(t,o);if(!u.has(t)){r.add(t);try{const n=await So(e,t,o);rn(t,o,n);const c=bn(n.extends);for(const f of c){const R=mn(f,t,o);await wo(e,R,[...o,t],r,u,s)}u.set(t,n),s.push(t)}finally{r.delete(t)}}},Sn=async(e,t)=>{let o;if(t?.explicitConfigPath){const A=uo(t.explicitConfigPath)?t.explicitConfigPath:ee(e,t.explicitConfigPath);if(!ye(A))throw new Error(`Cannot find config file at ${A}`);o=A}else o=cn(e);if(!o)return oo({});const r=ao(e,{fsCache:!1,moduleCache:!1}),u=new Set,s=new Map,n=[];await wo(r,o,[],u,s,n);const c=fn(n),f=hn(e);if(f){const A=gn(f,c);if(A)return A}let R={};for(const A of n)R=yn(R,s.get(A));const h=oo(R);return f&&dn(f,c,h),h},vn=e=>e.replaceAll(/[^\w.-]+/g,"_"),An=(e,t)=>{const o=ee(e,"node_modules"),r=vn(t);if(ye(o)){const s=ee(o,".cache","vis","task-configs");return lt(s),ee(s,`${r}.json`)}const u=_o("vis",{create:!0,cwd:e});return u?ee(u,"task-configs",`${r}.json`):void 0},Rn=(e,t)=>{if(ye(e))try{const o=lo(e);if(o.hash===t)return o.config}catch{}},En=(e,t,o)=>{try{lt(ct(e)),io(e,{config:o,hash:t})}catch{}},wn=async(e,t,o)=>{const r=pn(t);if(!r)return;const u=Bt(r),s=An(e,o);if(s){const R=Rn(s,u);if(R)return R}const n=ao(t,{fsCache:!1,moduleCache:!1}),c=await So(n,r,[]);nn(r,[],c);const f=c;return s&&En(s,u,f),f},On=e=>e,Nn=e=>e;export{Ct as C,_o as E,Qo as N,Sn as Z,lo as a,cn as b,Yo as c,Co as h,wn as i,pn as j,oo as k,ko as m,On as o,Cn as q,Nn as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as e}from"node:module";import{m as f,q as l,C as _,h as p,k as d,r as u,o as c,b as g,j as m,Z as T,i as C}from"../packem_chunks/config.js";import"./index-BDmTbWX1.js";import"jiti";import{otelPlugin as F}from"./otelPlugin-DmKDBaPo.js";import{definePlugin as S}from"./definePlugin-DoUcoYSy.js";const i=e(import.meta.url),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;export{f as CONFIG_FILES,l as DEFAULT_MIN_RELEASE_AGE_MINUTES,_ as SECURITY_DEFAULTS,p as TASK_CONFIG_FILES,d as applyDefaults,u as defineConfig,S as definePlugin,c as defineTaskConfig,g as findVisConfigFile,m as findVisTaskConfigFile,T as loadVisConfig,C as loadVisTaskConfig,F as otelPlugin};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as j}from"node:module";import{m as h,f as y}from"./index-BDmTbWX1.js";import{a as q}from"../packem_chunks/config.js";const $=j(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[s,n]=g.versions.node.split(".").map(Number);if(s>22||s===22&&n>=3||s===20&&n>=16)return g.getBuiltinModule(e)}return $(e)},{readdirSync:_,statSync:M}=k("node:fs"),w=["preinstall","install","postinstall","prepare"],x=e=>{const s=h(e,"node_modules");if(!y(s))return[];const n=new Map,o=(l,p="")=>{let u;try{u=_(l)}catch{return}for(const r of u){const i=h(l,r);if(r.startsWith("@")){o(i,`${r}/`);continue}if(r===".pnpm"&&p===""){let f;try{f=_(i)}catch{continue}for(const a of f){const c=h(i,a,"node_modules");y(c)&&o(c)}continue}if(r.startsWith("."))continue;const m=p+r,t=h(i,"package.json");try{if(!M(i).isDirectory()||!y(t))continue;const f=q(t),a=f.scripts??{},c=w.filter(v=>a[v]);!a.preinstall&&!a.install&&!a.postinstall&&y(h(i,"binding.gyp"))&&c.push("install (binding.gyp)"),c.length>0&&!n.has(m)&&n.set(m,{directory:i,hooks:c,name:m,version:typeof f.version=="string"?f.version:void 0});const d=h(i,"node_modules");y(d)&&o(d)}catch{}}};return o(s),[...n.values()]},W=e=>{const s=e.startsWith("@"),n=e.indexOf("@",s?1:0);return n===-1?{name:e}:{name:e.slice(0,n),version:e.slice(n+1)}},B=(e,s,n)=>{for(const[o,l]of Object.entries(s)){if(!l)continue;if(o.endsWith("@*")){if(o.slice(0,-2)===e.name)return!0;continue}if(o.endsWith("*")){if(e.name.startsWith(o.slice(0,-1)))return!0;continue}const{name:p,version:u}=W(o);if(p===e.name&&(!n||u===void 0||e.version===u))return!0}return!1},O=(e,s,n={})=>{const o=n.pinVersions===!0,l=x(e),p=[],u=[],r=new Map(l.map(t=>[t.name,t]));for(const t of l)B(t,s,o)?u.push(t):p.push(t);const i=[],m=[];for(const[t,f]of Object.entries(s)){if(!f)continue;if(t.endsWith("@*")){const v=t.slice(0,-2);r.has(v)||i.push(t);continue}if(t.endsWith("*")){const v=t.slice(0,-1);[...r.keys()].some(b=>b.startsWith(v))||i.push(t);continue}const{name:a,version:c}=W(t),d=r.get(a);if(!d){i.push(t);continue}o&&c!==void 0&&c!=="*"&&d.version&&d.version!==c&&m.push({from:t,to:`${a}@${d.version}`})}return{excess:i,installed:u,unapproved:p,versionDrift:m}},S=(e,s)=>O(e,s).unapproved.map(n=>`${n.name} (${n.hooks.join(", ")})`);export{O as W,S as w};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f,m as s,H as k,j as b}from"./index-BDmTbWX1.js";const v={id:"bun",label:"Bun",lockfiles:["bun.lock","bun.lockb"],scriptSource:"package.json"},j={id:"node",label:"Node.js",lockfiles:["pnpm-lock.yaml","yarn.lock","package-lock.json","npm-shrinkwrap.json"],scriptSource:"package.json"},a={bun:v,node:j},l=["node","bun"],d={"deno.lock":"deno"},$=l.flatMap(e=>a[e].lockfiles.map(o=>[o,e])),m="Deno is not supported yet (deferred — see rfc/design-runtime-multitool.md).",u=(e,o)=>{if(e==="node"||e==="bun")return e;throw e in d||e==="deno"?new Error(`${o} requested runtime "${e}", but ${m}`):new Error(`${o} requested unknown runtime "${e}". Supported: ${l.join(", ")}.`)},w=e=>{let o=e;for(;;){for(const[r,t]of $)if(f(s(o,r)))return{runtime:t};for(const r of Object.keys(d))if(f(s(o,r)))return{deferred:d[r]};const n=k(o);if(n===o||b(o).root===o)return{};o=n}},y=(e,o={})=>{const n=o.env??process.env,r=(c,p,g)=>({adapter:a[c],deferredNotice:g,runtime:c,source:p});if(o.flag!==void 0&&o.flag!=="")return r(u(o.flag,"--runtime"),"flag");const t=n.VIS_RUNTIME;if(t!==void 0&&t!=="")return r(u(t,"VIS_RUNTIME"),"env");if(o.config!==void 0)return r(u(o.config,"config runtime:"),"config");const i=w(e);return i.runtime!==void 0?r(i.runtime,"lockfile"):i.deferred!==void 0?r("node","default",`Detected a ${i.deferred} project but ${m} Falling back to node.`):r("node","default")},N=e=>{if(e!==null&&typeof e=="object"&&"runtime"in e){const o=e.runtime;if(typeof o=="string")return o}},I=(e,o)=>{const n=y(o,{config:e.visConfig?.runtime,flag:N(e.options)});return n.deferredNotice!==void 0&&e.logger?.warn?.(n.deferredNotice),n},R=e=>e.runtime==="bun"?"bun":void 0;export{R as a,I as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{v as u,m as l,f as g}from"./index-BDmTbWX1.js";import{D as d,i as D,W as v}from"../packem_chunks/bin.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-BDmTbWX1.js";import{a as F}from"../packem_chunks/bin.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{W as o}from"./index-BDmTbWX1.js";const r=async(s,a)=>await o(s,a);export{r as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as h,g as k,D as $,f as S}from"./provenance-BFEwKgI3.js";import{Z as d,D as N}from"../packem_chunks/bin.js";import{W as R}from"./build-scripts-CCCi8U66.js";import{n as v}from"./license-t5KnNX6v.js";import{A as L,B as D,v as A}from"./index-BDmTbWX1.js";import"./public-api-WqUCiyIe.js";import{L as w}from"./dependency-scan-DnTgYleU.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=S(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},C=[{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)=>C.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=()=>C.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,30 +0,0 @@
|
|
|
1
|
-
import{createRequire as Ut}from"node:module";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
2
|
-
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
3
|
-
const jt=Ut(import.meta.url),oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Vt=t=>{if(typeof oe<"u"&&oe.versions&&oe.versions.node){const[e,n]=oe.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return oe.getBuiltinModule(t)}return jt(t)},{createRequire:_e}=Vt("node:module"),Bt=16,ye=32,Rt=64,V=128,fe="positionals",Wt=_e(import.meta.url),se=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,zt=t=>{if(typeof se<"u"&&se.versions&&se.versions.node){const[e,n]=se.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return se.getBuiltinModule(t)}return Wt(t)},{createRequire:ct}=zt("node:module"),Ft=globalThis.process??Object.create(null),Me={versions:{}},Ee=new Proxy(Ft,{get(t,e){if(e in t)return t[e];if(e in Me)return Me[e]}}),qt=t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
4
|
-
`),Gt=(t,e,n,i)=>{const s={column:0,line:-1,...t.start},o={...s,...t.end},c=s.line,a=s.column,u=o.line,r=o.column;let l=Math.max(c-(n+1),0),d=Math.min(e.length,u+i);c===-1&&(l=0),u===-1&&(d=e.length);const h=u-c,f={};if(h)for(let p=0;p<=h;p++){const g=p+c;if(!a)f[g]=!0;else if(p===0){const $=e[g-1]?.length;f[g]=[a,($??0)-a+1]}else if(p===h)f[g]=[0,r];else{const $=e[g-p]?.length;f[g]=[0,$]}}else a===r?f[c]=a?[a,0]:!0:f[c]=[a,(r??0)-(a??0)];return{end:d,markerLines:f,start:l}},Ht=Ee.platform==="win32"&&!Ee.env?.WT_SESSION?">":"❯",Jt=(t,e,n)=>{const i={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...n,color:{gutter:p=>p,marker:p=>p,message:p=>p,...n?.color}},s=typeof e.start.column=="number";let o=(t.includes("\r")?qt(t):t).split(`
|
|
5
|
-
`);typeof i.tabWidth=="number"&&t.includes(" ")&&(o=o.map(p=>p.replaceAll(" "," ".repeat(i.tabWidth))));const{end:c,markerLines:a,start:u}=Gt(e,o,i.linesAbove,i.linesBelow),r=String(c).length,{gutter:l,marker:d,message:h}=i.color;let f=o.slice(u,c).map((p,g)=>{const $=u+1+g,w=a[$],y=String($).padStart(r),b=!a[$+1],N=` ${y}${i.showGutter?" |":""}`;if(w){let E="";if(Array.isArray(w)){const I=p.replaceAll(/[^\t]/g," ").slice(0,Math.max(w[0]-1,0)),O=w[1]||1;E=[`
|
|
6
|
-
`,i.prefix+l(N.replaceAll(/\d/g," "))," ",I,d("^").repeat(O)].join(""),b&&i.message&&(E+=` ${h(i.message)}`)}return[i.prefix+d(Ht),l(N),p.length>0?` ${p}`:"",E].join("")}return`${i.prefix} ${l(N)}${p.length>0?` ${p}`:""}`}).join(`
|
|
7
|
-
`);return i.message&&!s&&(f=`${i.prefix+" ".repeat(r+1)+i.message}
|
|
8
|
-
${f}`),f},Kt=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&Kt.set("AggregateError",AggregateError);const Yt=ct(import.meta.url),re=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Qt=t=>{if(typeof re<"u"&&re.versions&&re.versions.node){const[e,n]=re.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return re.getBuiltinModule(t)}return Yt(t)};Qt("node:util");const Zt=()=>Ee.env?.DEBUG==="true",Y=(t,...e)=>{if(Zt()){const n=e.map(i=>typeof i=="function"?i():i);console.debug(`error:parse-stacktrace: ${t}`,...n)}},Q="<unknown>",Xt=/^(?:node:internal\/|node:|internal\/)/,en=t=>t!==void 0&&Xt.test(t),tn=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,nn=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,on=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,sn=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,rn=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,an=/in\s(.*)\s\(at\s(.+)\)\sat/,ln=/^(?:.*@)?(.*):(\d+):(\d+)$/,cn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,un=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,hn=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,Pe=/\(error: (.*)\)/,pn=/at\s/,dn=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,fn=/\S*(?:Error: |AggregateError:)/,ut=/^Anonymous function$/,mn=/^\s*in\s.*/,gn=/^.*?\s*at\s.*/,wn=/^.*?\s*@.*|\[native code\]/,ht=(t,e)=>{const n=t.includes("safari-extension"),i=t.includes("safari-web-extension");return n||i?[t.includes("@")?t.split("@")[0]:Q,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},pt=(t,e)=>{const n=on.exec(e);n&&(t.file=n[1],t.line=+n[2],t.column=+n[3])},yn=t=>{const e=an.exec(t);if(e){Y(`parse nested node error stack line: "${t}"`,()=>`found: ${JSON.stringify(e)}`);const i=e[2].split(":");return{column:i[2]?+i[2]:void 0,file:i[0],line:i[1]?+i[1]:void 0,methodName:e[1]??Q,raw:t,type:void 0}}const n=rn.exec(t);if(n){Y(`parse node error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`);const i={column:n[4]?+n[4]:void 0,file:n[2]?n[2].replace(pn,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??Q,raw:t,type:t.startsWith("internal")?"internal":void 0};return pt(i,`${n[2]}:${n[3]}:${n[4]}`),i}},vn=t=>{const e=tn.exec(t);if(e){Y(`parse chrome error stack line: "${t}"`,()=>`found: ${JSON.stringify(e)}`);const n=e[2]?.startsWith("native"),i=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let s,o;if(i){const r=nn.exec(t);if(r){const l=dn.exec(r[1]);l?(e[2]=l[4]??l[1],e[3]=l[5]??l[2],e[4]=l[3]):r[2]&&(e[2]=r[1]),r[2]&&(s={column:r[4]?+r[4]:void 0,file:r[2],line:r[3]?+r[3]:void 0,methodName:"eval",raw:t,type:"eval"})}else{const l=sn.exec(t);l&&(o={column:l[4]?+l[4]:void 0,file:l[2],line:l[3]?+l[3]:void 0},s={column:l[6]?+l[6]:void 0,file:l[1],line:l[5]?+l[5]:void 0,methodName:"eval",raw:l[0],type:"eval"})}}const[c,a]=ht(e[1]?e[1].replace(ut,"<anonymous>"):Q,e[2]),u={column:e[4]?+e[4]:void 0,evalOrigin:s,file:a,line:e[3]?+e[3]:void 0,methodName:c,raw:t,type:i?"eval":n?"native":en(a)?"internal":void 0};return o?(u.column=o.column,u.file=o.file,u.line=o.line):pt(u,`${a}:${e[3]}:${e[4]}`),u}},$n=(t,e)=>{const n=cn.exec(t);if(n){Y(`parse gecko error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`);const i=n[3]?.includes(" > eval"),s=i&&n[3]&&un.exec(n[3]);let o;i&&s&&(n[3]=s[1],o={column:n[5]?+n[5]:void 0,file:n[3],line:n[4]?+n[4]:void 0,methodName:"eval",raw:t,type:"eval"},n[4]=s[2]);const[c,a]=ht(n[1]?n[1].replace(ut,"<anonymous>"):Q,n[3]);let u;(e?.type==="safari"||!i&&e?.type==="firefox")&&e.column?u=e.column:!i&&n[5]&&(u=+n[5]);let r;return(e?.type==="safari"||!i&&e?.type==="firefox")&&e.line?r=e.line:n[4]&&(r=+n[4]),{column:u,evalOrigin:o,file:a,line:r,methodName:c,raw:t,type:i?"eval":a.includes("[native code]")?"native":void 0}}},bn=(t,e)=>{const n=hn.exec(t);if(!(n&&n[2].includes(" > eval"))&&n)return Y(`parse firefox error stack line: "${t}"`,()=>`found: ${JSON.stringify(n)}`),{column:n[4]?+n[4]:e?.column??void 0,file:n[2],line:n[3]?+n[3]:e?.line??void 0,methodName:n[1]||Q,raw:t,type:void 0}},xn=t=>{const e=ln.exec(t);if(e)return Y(`parse react android native error stack line: "${t}"`,()=>`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:Q,raw:t,type:void 0}},dt=(t,{filter:e,frameLimit:n=50}={})=>{const i=t;let s=(typeof i.stacktrace=="string"?i.stacktrace:t.stack??"").split(`
|
|
9
|
-
`).map(o=>(Pe.test(o)?o.replace(Pe,"$1"):o).trim()).filter(o=>!fn.test(o)&&o!=="eval code");return e&&(s=s.filter(o=>e(o))),s=s.slice(0,n),s.reduce((o,c,a)=>{if(!c||c.length>1024)return o;let u;if(mn.test(c))u=yn(c);else if(gn.test(c))u=vn(c);else if(wn.test(c)){let r;if(a===0){const l=t,d=l.columnNumber,h=l.lineNumber,f=l.line,p=l.column;d||h?r={column:d,line:h,type:"firefox"}:(f||p)&&(r={column:p,line:f,type:"safari"})}u=bn(c,r)??$n(c,r)}else u=xn(c);return u?o.push(u):Y(`parse error stack line: "${c}"`,"not parser found"),o},[])},Nn=ct(import.meta.url),te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ie=t=>{if(typeof te<"u"&&te.versions&&te.versions.node){const[e,n]=te.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return te.getBuiltinModule(t)}return Nn(t)},{existsSync:An,readFileSync:kn}=Ie("node:fs"),{relative:En,resolve:De,sep:Cn}=Ie("node:path"),{cwd:On}=te,{fileURLToPath:_n}=Ie("node:url"),Z=(t,e,n)=>n===0?t:e===" "?t+" ".repeat(n):t+" ".repeat(e*n),ft=t=>t.replaceAll("\\","/"),In=(t,e)=>{const n=t.replace("async file:","file:");return ft(En(e,n.startsWith("file:")?_n(n):n))},Ln=(t,e,n)=>{if(e)return n.title(t.message);const i=t.message?`: ${t.message}`:"";return n.title(t.name+i)},mt=(t,{color:e,hideErrorTitle:n,indentation:i,prefix:s},o)=>`${Z(s,i,o)}${Ln(t,n,e)}
|
|
10
|
-
`,gt=(t,{color:e,indentation:n,prefix:i},s)=>{if(t.hint===void 0)return;const o=Z(i,n,s);let c="";if(Array.isArray(t.hint))for(const a of t.hint)c+=`${o+a}
|
|
11
|
-
`;else c+=o+t.hint;return e.hint(c)},wt=(t,e)=>{if(!e||t.file===void 0||t.line===void 0)return{trace:t};try{const n=e({column:t.column,file:t.file,line:t.line});return n?{source:n.source,trace:{...t,column:n.column??t.column,file:n.file??t.file,line:n.line??t.line}}:{trace:t}}catch{return{trace:t}}},Le=(t,e,n=0)=>{const{color:i,cwd:s,displayShortPath:o,indentation:c,prefix:a}=e,{trace:u}=wt(t,e.sourceMap),r=o?In(u.file,s):ft(u.file),{fileLine:l,method:d}=i;return`${Z(a,c,n)}at ${u.methodName?`${d(u.methodName)} `:""}${l(r)}:${l(u.line?.toString()??"")}`},Sn=(t,e)=>{if(e.allowAllFilePaths)return!0;const n=De(e.cwd),i=De(n,t);return i===n||i.startsWith(n+Cn)},yt=(t,e,n)=>{const{color:i,indentation:s,linesAbove:o,linesBelow:c,prefix:a,showGutter:u,showLineNumbers:r,tabWidth:l}=e,{source:d,trace:h}=wt(t,e.sourceMap);if(h.file===void 0)return;let f;if(d===void 0){const p=h.file.replace("file://","");if(!Sn(p,e)||!An(p))return;f=kn(p,"utf8")}else f=d;return Jt(f,{start:{column:h.column,line:h.line}},{color:i,linesAbove:o,linesBelow:c,prefix:Z(a,s,n),showGutter:u,showLineNumbers:r,tabWidth:l})},vt=(t,e,n)=>{if(t.errors.length===0)return;let i=`${Z(e.prefix,e.indentation,n)}Errors:
|
|
12
|
-
|
|
13
|
-
`,s=!0;for(const o of t.errors)s?s=!1:i+=`
|
|
14
|
-
|
|
15
|
-
`,i+=bt(o,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},n+1);return`
|
|
16
|
-
${i}`},$t=(t,e,n,i=new Set)=>{i.add(t);let s=`${Z(e.prefix,e.indentation,n)}Caused by:
|
|
17
|
-
|
|
18
|
-
`;const o=t.cause;s+=mt(o,e,n);const c=dt(o).shift(),a=gt(o,e,n);if(a&&(s+=`${a}
|
|
19
|
-
`),c&&(s+=Le(c,e,n),!e.hideErrorCauseCodeView)){const u=yt(c,e,n);u!==void 0&&(s+=`
|
|
20
|
-
${u}`)}if(o instanceof AggregateError){const u=vt(o,e,n);u!==void 0&&(s+=`
|
|
21
|
-
${u}`)}return o.cause&&(s+=i.has(o)?`
|
|
22
|
-
${Z(e.prefix,e.indentation,n+1)}Caused by: [Circular]`:`
|
|
23
|
-
${$t(o,e,n+1,i)}`),`
|
|
24
|
-
${s}`},Tn=(t,e)=>(t.length>0?`
|
|
25
|
-
`:"")+t.map(n=>Le(n,e)).join(`
|
|
26
|
-
`),bt=(t,e,n)=>{const i={allowAllFilePaths:!1,cwd:On(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...e,color:{fileLine:c=>c,gutter:c=>c,hint:c=>c,marker:c=>c,message:c=>c,method:c=>c,title:c=>c,...e.color}},s=dt(t,{filter:e.filterStacktrace,frameLimit:i.framesMaxLimit}),o=s.shift();return[e.hideMessage?void 0:mt(t,i,n),gt(t,i,n),o?Le(o,i,n):void 0,o&&!i.hideErrorCodeView?yt(o,i,n):void 0,t instanceof AggregateError?vt(t,i,n):void 0,t.cause===void 0?void 0:$t(t,i,n),s.length>0?Tn(s,i):void 0].filter(Boolean).join(`
|
|
27
|
-
`)},Mn=(t,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return bt(t,e,0)};class ie extends Error{loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:i,message:s,name:o,stack:c,title:a}){super(s,{cause:e}),this.title=a,this.name=o,this.stack=c??this.stack,this.loc=i,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}}class k extends ie{code;context;constructor(e,n,i){super({message:e,name:"CerebroError"}),this.code=n,this.context=i}}const R=t=>"Deno"in t,W=t=>"Bun"in t,Ce=()=>{if(R(globalThis)){const t=globalThis.Deno,e=t.execPath();let n=e;try{const{importMeta:i}=globalThis;i?.url&&(n=i.url)}catch{}return[e,n,...t.args]}return W(globalThis)?globalThis.Bun.process.argv:process.argv},Pn=()=>R(globalThis)?globalThis.Deno.cwd():W(globalThis)?globalThis.Bun.process.cwd():process.cwd(),ge=()=>{if(R(globalThis)){const t=globalThis.Deno;return new Proxy(t.env.toObject(),{get:(e,n)=>typeof n=="string"?t.env.get(n):e[n],has:(e,n)=>typeof n=="string"?t.env.has(n):n in e,set:(e,n,i)=>typeof n=="string"?(i===void 0||t.env.set(n,i),!0):!1})}return W(globalThis)?globalThis.Bun.process.env:process.env},Dn=()=>R(globalThis)?[]:W(globalThis)?globalThis.Bun.process.execArgv:process.execArgv,Un=()=>R(globalThis)?globalThis.Deno.execPath():W(globalThis)?globalThis.Bun.process.execPath:process.execPath,jn=()=>{if(R(globalThis)){const t=globalThis.Deno.build?.os??"unknown";return t==="windows"?"win32":t}return W(globalThis)?globalThis.Bun.platform??"unknown":process.platform},Vn=()=>{if(R(globalThis)){const t=globalThis.Deno.build?.arch??"unknown";return t==="x86_64"?"x64":t==="aarch64"?"arm64":t}return W(globalThis)?globalThis.Bun.process.arch:process.arch},J=(t=0)=>{if(R(globalThis))throw globalThis.Deno.exit(t),new Error("Deno exit failed");if(W(globalThis))throw globalThis.Bun.process.exit(t),new Error("Bun exit failed");process.exit(t)},Ue=(t,e)=>{if(R(globalThis))return()=>{};if(W(globalThis)){try{const i=globalThis.Bun;if(i.process?.on)return i.process.on(t,e),()=>{i.process?.removeListener&&i.process.removeListener(t,e)}}catch{}return()=>{}}const n=process;return n.on(t,e),()=>{n.removeListener(t,e)}},B=new Uint32Array(65536),Bn=(t,e)=>{const n=t.length,i=e.length,s=1<<n-1;let o=-1,c=0,a=n,u=n;for(;u--;)B[t.charCodeAt(u)]|=1<<u;for(u=0;u<i;u++){let r=B[e.charCodeAt(u)];const l=r|c;r|=(r&o)+o^o,c|=~(r|o),o&=r,c&s&&a++,o&s&&a--,c=c<<1|1,o=o<<1|~(l|c),c&=l}for(u=n;u--;)B[t.charCodeAt(u)]=0;return a},Rn=(t,e)=>{const n=e.length,i=t.length,s=[],o=[],c=Math.ceil(n/32),a=Math.ceil(i/32);for(let p=0;p<c;p++)o[p]=-1,s[p]=0;let u=0;for(;u<a-1;u++){let p=0,g=-1;const $=u*32,w=Math.min(32,i)+$;for(let y=$;y<w;y++)B[t.charCodeAt(y)]|=1<<y;for(let y=0;y<n;y++){const b=B[e.charCodeAt(y)],N=o[y/32|0]>>>y&1,E=s[y/32|0]>>>y&1,I=b|p,O=((b|E)&g)+g^g|b|E;let m=p|~(O|g),v=g&O;m>>>31^N&&(o[y/32|0]^=1<<y),v>>>31^E&&(s[y/32|0]^=1<<y),m=m<<1|N,v=v<<1|E,g=v|~(I|m),p=m&I}for(let y=$;y<w;y++)B[t.charCodeAt(y)]=0}let r=0,l=-1;const d=u*32,h=Math.min(32,i-d)+d;for(let p=d;p<h;p++)B[t.charCodeAt(p)]|=1<<p;let f=i;for(let p=0;p<n;p++){const g=B[e.charCodeAt(p)],$=o[p/32|0]>>>p&1,w=s[p/32|0]>>>p&1,y=g|r,b=((g|w)&l)+l^l|g|w;let N=r|~(b|l),E=l&b;f+=N>>>i-1&1,f-=E>>>i-1&1,N>>>31^$&&(o[p/32|0]^=1<<p),E>>>31^w&&(s[p/32|0]^=1<<p),N=N<<1|$,E=E<<1|w,l=E|~(y|N),r=N&y}for(let p=d;p<h;p++)B[t.charCodeAt(p)]=0;return f},Wn=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return e.length===0?t.length:t.length<=32?Bn(t,e):Rn(t,e)},zn=_e(import.meta.url),ae=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Fn=t=>{if(typeof ae<"u"&&ae.versions&&ae.versions.node){const[e,n]=ae.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ae.getBuiltinModule(t)}return zn(t)},{createRequire:qn}=Fn("node:module"),xt=String.raw,je=xt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Gn=()=>new RegExp(xt`\p{RI}{2}|(?)${je}(?:\u200D${je})*`,"gu");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]]));const rs=/^[ \t]*(?:\r\n|\r|\n)/,as=/(?:\r\n|\r|\n)[ \t]*$/,ls=/^(?:[\r\n]|$)/,cs=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,us=/^[ \t]*[\r\n][ \t\r\n]*$/,hs=/\r\n|\n|\r/g,ps=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,ds=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,q=Gn(),Hn=/[-_./\s]+/g,me=/(\u001B\[[0-9;]*[a-z])/i,Ve=new RegExp("\\p{Script=Arabic}","u"),Jn=new RegExp("\\p{Script=Bengali}","u"),X=new RegExp("\\p{Script=Cyrillic}","u"),Kn=new RegExp("\\p{Script=Devanagari}","u"),Yn=new RegExp("\\p{Script=Ethiopic}","u"),ve=new RegExp("\\p{Script=Greek}","u"),Be=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),Qn=new RegExp("\\p{Script=Gujarati}","u"),Zn=new RegExp("\\p{Script=Gurmukhi}","u"),Re=new RegExp("\\p{Script=Hangul}","u"),We=new RegExp("\\p{Script=Hebrew}","u"),Xn=new RegExp("\\p{Script=Hiragana}","u"),ze=new RegExp("\\p{Script=Han}","u"),ei=new RegExp("\\p{Script=Kannada}","u"),ti=new RegExp("\\p{Script=Katakana}","u"),ni=new RegExp("\\p{Script=Khmer}","u"),ii=new RegExp("\\p{Script=Lao}","u"),M=new RegExp("\\p{Script=Latin}","u"),oi=new RegExp("\\p{Script=Malayalam}","u"),si=new RegExp("\\p{Script=Myanmar}","u"),ri=new RegExp("\\p{Script=Oriya}","u"),ai=new RegExp("\\p{Script=Sinhala}","u"),li=new RegExp("\\p{Script=Tamil}","u"),ci=new RegExp("\\p{Script=Telugu}","u"),ui=new RegExp("\\p{Script=Thai}","u"),hi=new RegExp("\\p{Script=Tibetan}","u"),Fe=/[\u02BB\u02BC\u0027]/u,pi=t=>t.replace(q,"");let di=class{capacity;cache;constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.capacity){const i=this.cache.keys().next().value;i!==void 0&&this.cache.delete(i)}this.cache.set(e,n)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}size(){return this.cache.size}};const fi=qn(import.meta.url),le=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,mi=t=>{if(typeof le<"u"&&le.versions&&le.versions.node){const[e,n]=le.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return le.getBuiltinModule(t)}return fi(t)},{stripVTControlCharacters:gi}=mi("node:util"),$e=new di(1e3),wi=/[.*+?^${}()|[\]\\]/g,yi=t=>{const e=t.join("");if($e.has(e)){const s=$e.get(e);return s.lastIndex=0,s}const n=t.map(s=>s.replaceAll(wi,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return $e.set(e,i),i},vi=t=>{const e=[];let n=0,i;for(q.lastIndex=0;(i=q.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=q.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},$i=/[ČŠŽĐ]/i,Nt=new Uint8Array(128),At=new Uint8Array(128),kt=new Uint8Array(128);for(let t=0;t<128;t++)Nt[t]=t>=65&&t<=90?1:0,At[t]=t>=97&&t<=122?1:0,kt[t]=t>=48&&t<=57?1:0;const be=t=>Nt[t],qe=t=>At[t],xe=t=>kt[t],z=(t,e,n,i,s)=>{if(t.length===0)return[];let o=!1;const c=Object.values(e);for(const f of c)if(f(t[0])){o=!0;break}if(!o&&!n)return[t];const a=[...t],u=[];let r=a[0],l="other";const d=Object.entries(e);for(const f of d){const[p,g]=f;if(g(a[0])){l=p;break}}let h=n&&i?a[0]===a[0].toLocaleUpperCase(i):!1;for(let f=1;f<a.length;f++){const p=a[f];let g="other";for(const y of d){const[b,N]=y;if(N(p)){g=b;break}}const $=n&&i?p===p.toLocaleUpperCase(i):!1;let w=!1;s?w=s(l,g,h,$,p,f,a):(l!==g&&l!=="other"&&g!=="other"&&(w=!0),n&&g!=="other"&&!h&&$&&(w=!0)),w?(u.push(r),r=p):r+=p,l=g,n&&(h=$)}return r&&r.length>0&&u.push(r),u.length>0?u:[t]},bi=(t,e,n,i)=>{if(n.size===0)return e;for(const s of n)if(t.startsWith(s,e))return i.push(s),e+s.length;return e},Et=(t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const i=[],s=t.length;for(let o=1;o<s;o++){const c=bi(t,n,e,i);if(c!==n){n=c,o=n-1;continue}const a=t.codePointAt(o-1),u=t.codePointAt(o),r=a&&a<128&&be(a),l=u&&u<128&&be(u),d=a&&a<128&&qe(a),h=a&&a<128&&xe(a),f=u&&u<128&&xe(u);if(d&&l){i.push(t.slice(n,o)),n=o;continue}if(h&&!f||!h&&f){i.push(t.slice(n,o)),n=o;continue}if(f&&!h){let p=!1,g=!1;if(o+1<s){const $=t.codePointAt(o+1);p=$&&$<128&&be($),g=$&&$<128&&xe($)}if(!g&&p){i.push(t.slice(n,o),t.slice(o,o+1)),n=o+1;continue}}if(o+1<s){const p=t.codePointAt(o+1),g=p&&p<128&&qe(p);if(r&&l&&g){const $=t.slice(n,o+1);e.has($)||(i.push(t.slice(n,o)),n=o)}}}return n<s&&i.push(t.slice(n)),i.filter(o=>o!=="")},Ct=(t,e,n)=>{if(t.length===0)return[];const i=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!i&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const r=[...t],l=r.length,d=[];let h=r[0],f=r[0]===r[0].toLocaleUpperCase(e),p=f,g=f?0:-1;for(let $=1;$<l;$++){const w=r[$],y=w===w.toLocaleUpperCase(e);if(y===f)h+=w;else if(y)h&&h.length>0&&(d.push(h),h=w),p=!0,g=$;else{if(p&&$-g>1){const b=r[$-1],N=h.slice(0,-1);N&&N.length>0&&d.push(N),h=b+w}else h+=w;p=!1,g=-1}f=y}return h&&h.length>0&&d.push(h),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!X.test(t)&&!M.test(t))return[t];const r=[...t],l=r.length,d=[];let h=r[0];const f=r[0];let p;X.test(f)?p=1:M.test(f)?p=2:p=0;let g=f===f.toLocaleUpperCase(e);for(let w=1;w<l;w++){const y=r[w];let b;X.test(y)?b=1:M.test(y)?b=2:b=0;const N=y===y.toLocaleUpperCase(e);p!==b&&(p===1||p===2)&&(b===1||b===2)||b===p&&!g&&N?(d.push(h),h=y):h+=y,p=b,g=N}h&&h.length>0&&d.push(h);const $=[];for(let w=0;w<d.length;w++)w<d.length-1&&d[w].length===1&&M.test(d[w])&&X.test(d[w+1][0])?($.push(d[w]+d[w+1]),w+=1):$.push(d[w]);return $}if(e.startsWith("el")){if(!ve.test(t)&&!M.test(t))return[t];const r=[];Be.lastIndex=0;let l;for(;(l=Be.exec(t))!==null;)r.push(l[0]);r.length===0&&r.push(t);const d=[];if(r.length===1){const h=r[0];if(!h||!ve.test(h[0])||h.length===1)return[h??t]}for(const h of r){if(!h)continue;if(!ve.test(h[0])||h.length===1){d.push(h);continue}const f=h.length;let p=h[0],g=h[0]===h[0].toLocaleUpperCase(e);for(let $=1;$<f;$++){const w=h[$],y=w===w.toLocaleUpperCase(e);!g&&y?(d.push(p),p=w):p+=w,g=y}p&&d.push(p)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const r=e.startsWith("ja"),l=r?{hiragana:h=>Xn.test(h),kanji:h=>ze.test(h),katakana:h=>ti.test(h),latin:h=>M.test(h)}:{hangul:h=>Re.test(h),latin:h=>M.test(h)},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(r){const h=z(t,l,!1,e,(p,g)=>p==="hiragana"&&g==="katakana"||p==="katakana"&&g==="hiragana"||p==="hiragana"&&g==="latin"||p==="katakana"&&g==="latin"||p==="kanji"&&g==="latin"||p==="latin"&&(g==="hiragana"||g==="katakana"||g==="kanji")),f=[];for(const p of h){const g=p;g.length===1&&d.has(g)&&f.length>0?f[f.length-1]=f.at(-1)+g:f.push(g)}return f.length>0?f:[t]}return z(t,l,!1,e,(h,f)=>h==="hangul"&&f==="latin"||h==="latin"&&f==="hangul")}if(e.startsWith("sl")){const r=[...t],l=r.length,d=[];let h=r[0],f=r[0]===r[0].toLocaleUpperCase(e);for(let p=1;p<l;p++){const g=r[p],$=g===g.toLocaleUpperCase(e),w=$i.test(g),y=p<l-1&&r[p+1]===r[p+1].toLocaleUpperCase(e);!f&&$||w&&y?(d.push(h),h=g,w&&y&&(d.push(h),h="")):h+=g,f=$}return h&&h.length>0&&d.push(h),d}if(e.startsWith("zh"))return z(t,{han:r=>ze.test(r),latin:r=>M.test(r)},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const r=l=>We.test(l)||Ve.test(l);return z(t,{latin:l=>M.test(l),rtl:l=>r(l)},!1,e)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(e.split("-")[0])){const r=l=>Kn.test(l)||Jn.test(l)||Qn.test(l)||Zn.test(l)||ei.test(l)||li.test(l)||ci.test(l)||oi.test(l)||ai.test(l)||ui.test(l)||ii.test(l)||hi.test(l)||si.test(l)||Yn.test(l)||ni.test(l)||ri.test(l);return z(t,{indic:l=>r(l),latin:l=>M.test(l)},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return z(t,{cyrillic:r=>X.test(r),latin:r=>M.test(r)},!0,e);if(["ar","fa","he"].includes(e))return z(t,{latin:r=>M.test(r),rtl:r=>We.test(r)||Ve.test(r)},!1,e);if(e.startsWith("ko"))return z(t,{hangul:r=>Re.test(r),latin:r=>M.test(r)},!1,e);if(e.startsWith("uz")){if(!X.test(t)&&!M.test(t))return[t];const r=[...t],l=r.length,d=[];let h=r[0],f=r[0]===r[0].toLocaleUpperCase(e);for(let p=1;p<l;p++){const g=r[p],$=g===g.toLocaleUpperCase(e);if(Fe.test(g)||Fe.test(r[p-1])){h+=g;continue}!f&&$?(d.push(h),h=g):h+=g,f=$}return h&&h.length>0&&d.push(h),d}const s=[...t],o=s.length,c=[];let a=s[0],u=s[0]===s[0].toLocaleUpperCase(e);for(const r of n)if(t.startsWith(r)){c.push(r),a=s[r.length],u=a===a.toLocaleUpperCase(e);break}for(let r=1;r<o;r++){const l=s[r],d=l===l.toLocaleUpperCase(e);let h=0;for(const f of n)if(t.startsWith(f,r)){c.push(a,f),h=f.length,a="";const p=f.at(-1);p&&(u=p===p.toLocaleUpperCase(e));break}if(h>0){r+=h-1;continue}!u&&d?(c.push(a),a=l):a+=l,u=d}return a&&c.push(a),c},xi=(t,e,n)=>{const i=[],s=me.test(t)?t.split(me).filter(Boolean):[t];for(const o of s){const c=o;if(me.test(c))i.push(c);else{q.lastIndex=0;const a=q.test(c)?vi(c).filter(Boolean):[c];for(const u of a)if(q.lastIndex=0,q.test(u))i.push(u);else if(e){const r=e.toLowerCase().split("-")[0];i.push(...Ct(u,r,n))}else i.push(...Et(u,n))}}return i},Ni=(t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:i=!1,knownAcronyms:s=[],locale:o,normalize:c=!1,separators:a,stripAnsi:u=!1,stripEmoji:r=!1}=e,l=new Set([...s].toSorted((w,y)=>y.length-w.length));let d=t;u&&(d=gi(d)),r&&(d=pi(d));let h;Array.isArray(a)?h=yi(a):a instanceof RegExp?h=a:h=Hn;const f=[];let p=d;const g=h.flags.includes("g")?h:new RegExp(h.source,`${h.flags}g`);for(;p.length>0;){const w=g.exec(p);if(!w){p===".."?f.push(".."):p==="."?f.push("."):p.length>0&&f.push(p);break}const y=w.index,b=w[0],N=b.length,E=p.slice(0,y),I=p.slice(y+N);if(b.startsWith("../"))f.push(".."),p=p.slice(y+3);else if(b.startsWith("./"))f.push("."),p=p.slice(y+2);else if(y===0&&b==="..")f.push(".."),p=p.slice(2);else if(y===0&&b===".")f.push("."),p=p.slice(1);else{E.length>0&&f.push(E);let O=0;for(;(O=b.indexOf("../",O))!==-1;)f.push(".."),O+=3;for(O=0;(O=b.indexOf("./",O))!==-1;)(O===0||b[O-1]!==".")&&f.push("."),O+=2;let m=I;for(;m.startsWith("../");)f.push(".."),m=m.slice(3);for(;m.startsWith("./");)f.push("."),m=m.slice(2);if(m===".."){f.push("..");break}else if(m==="."){f.push(".");break}else p=m}g.lastIndex=0}if(f.length===0){const w=d.split(h).filter(Boolean);f.push(...w)}let $=[];for(const w of f)n||i?$.push(...xi(w,o,l)):o?$.push(...Ct(w,o,l)):$.push(...Et(w,l));return c&&($=$.map(w=>l.has(w)?w:o&&w===w.toLocaleUpperCase(o)?w[0]+w.slice(1).toLocaleLowerCase(o):w.toUpperCase()===w&&!l.has(w)?w.slice(0,1)+w.slice(1).toLowerCase():w)),$},Ai=_e(import.meta.url),ce=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ki=t=>{if(typeof ce<"u"&&ce.versions&&ce.versions.node){const[e,n]=ce.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ce.getBuiltinModule(t)}return Ai(t)},{writeFile:Ei,stat:Ci,rm:Oi,readFile:Ge,readdir:_i,mkdir:Ii,access:Li}=ki("node:fs/promises"),he=[{alias:"v",description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];let G=class extends k{commandName;constructor(t,e=[]){const n=`Command "${t}" not found${e.length>0?`. Did you mean: ${e.join(", ")}?`:""}`;super(n,"COMMAND_NOT_FOUND",{commandName:t,suggestions:e}),this.name="CommandNotFoundError",this.commandName=t,e.length>0&&(this.hint=`Try one of these commands: ${e.join(", ")}`)}},Ot=class extends k{option1;option2;constructor(t,e){super(`Options "${t}" and "${e}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:t,option2:e}),this.name="ConflictingOptionsError",this.option1=t,this.option2=e,this.hint=`Remove either --${t} or --${e}`}},Si=class extends k{unknownOptions;constructor(t,e){const n=t.join(", "),i=`Found unknown ${t.length===1?"option":"options"}: ${n}`;super(i,"UNKNOWN_OPTION",{suggestions:e,unknownOptions:t}),this.name="UnknownOptionError",this.unknownOptions=t,e&&e.length>0&&(this.hint=`Did you mean: ${e.join(", ")}?`)}},Ti=class extends k{pluginName;constructor(t,e,n){super(`Plugin "${t}" error: ${e}`,"PLUGIN_ERROR",{originalError:n,pluginName:t}),this.name="PluginError",this.pluginName=t,n&&(this.cause=n)}},Mi=class{logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(t){this.logger=t}hasPlugins(){return this.plugins.size>0}register(t){if(this.initialized)throw new Error(`Cannot register plugin "${t.name}" after initialization`);if(this.plugins.has(t.name))throw new Error(`Plugin "${t.name}" is already registered`);ge().CEREBRO_OUTPUT_LEVEL===String(V)&&this.logger.debug(`registering plugin: ${t.name}`),this.plugins.set(t.name,t),this.cachedDependencyOrder=void 0}async init(t){if(this.initialized)throw new Error("PluginManager already initialized");if(this.plugins.size===0){this.logger.debug("no plugins registered, skipping initialization"),this.initialized=!0;return}this.validateDependencies();const e=this.getDependencyOrder();this.logger.debug(`initializing ${String(e.length)} plugin(s)...`);for(const n of e)if(typeof n.init=="function"){this.logger.debug(`initializing plugin: ${n.name}`);try{await n.init(t)}catch(i){const s=new Ti(n.name,`Failed to initialize: ${i instanceof Error?i.message:String(i)}`,i instanceof Error?i:void 0);throw this.logger.error(s.message),s}}this.initialized=!0}async executeLifecycle(t,e,n){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const i=this.getDependencyOrder();for(const s of i){const o=s[t];if(typeof o=="function"){this.logger.debug(`executing ${t} hook for plugin: ${s.name}`);try{await(t==="afterCommand"?o(e,n):o(e))}catch(c){throw this.logger.error(`Error in ${t} hook for plugin "${s.name}":`,c),c}}}}async executeErrorHandlers(t,e){if(!this.initialized||this.plugins.size===0)return;const n=this.getDependencyOrder();for(const i of n)if(typeof i.onError=="function"){this.logger.debug(`executing error handler for plugin: ${i.name}`);try{await i.onError(t,e)}catch(s){this.logger.error(`Error in error handler for plugin "${i.name}":`,s)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const t=[],e=new Set,n=new Set,i=s=>{if(e.has(s))return;if(n.has(s))throw new Error(`Circular dependency detected involving plugin "${s}"`);const o=this.plugins.get(s);if(!o)throw new Error(`Plugin "${s}" not found`);if(n.add(s),o.dependencies)for(const c of o.dependencies)i(c);n.delete(s),e.add(s),t.push(o)};for(const s of this.plugins.keys())i(s);return this.cachedDependencyOrder=t,t}validateDependencies(){for(const t of this.plugins.values())if(t.dependencies){for(const e of t.dependencies)if(!this.plugins.has(e))throw new Error(`Plugin "${t.name}" depends on "${e}" which is not registered`)}}};const ue=t=>t.type?.name==="Boolean",Pi=t=>{let e=t.type?t.type.name.toLowerCase():"string";const n=t.multiple??t.lazyMultiple?"[]":"";return e&&(e=e==="boolean"?"":`{underline ${e}${n}}`),e},He=t=>(ue(t)||(t.typeLabel=t.typeLabel??Pi(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),Di=new RegExp(/^-([^\d-])$/),Ui=new RegExp(/^--(\S+)/),ji=new RegExp(/^-([^\d-]{2,})$/),Vi=t=>Di.test(t)||Ui.test(t)||ji.test(t),Bi=(t,e)=>{const n=e[0]&&Vi(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const i=new Error(`Command not recognised: ${String(n)}`);throw i.command=n,i.name="INVALID_COMMAND",i}return{argv:e,command:n}};class Se extends ie{optionName;value;constructor(e,n,i){super({hint:`Pass a valid ${i} value for '${e}'.`,message:`Invalid ${i} value '${n}' for option '${e}'`,name:"INVALID_VALUE",title:"Invalid Value"}),this.optionName=e,this.value=n,Object.setPrototypeOf(this,Se.prototype)}}let Ri=class _t extends ie{optionName;constructor(e){super({cause:void 0,hint:`Remove the duplicate option '${e}' from your command line arguments.`,location:void 0,message:`Option '${e}' is already set`,name:"ALREADY_SET",stack:void 0,title:"Option Already Set"}),this.optionName=e,Object.setPrototypeOf(this,_t.prototype)}},Je=class It extends ie{optionName;constructor(e){super({cause:void 0,hint:`Check your option definitions or remove the unknown option '${e}' from your command line arguments.`,location:void 0,message:`Unknown option: --${e}`,name:"UNKNOWN_OPTION",stack:void 0,title:"Unknown Option"}),this.optionName=`--${e}`,Object.setPrototypeOf(this,It.prototype)}},Wi=class Lt extends ie{value;constructor(e){super({hint:"Use a defined option or add a defaultOption to capture this value.",message:`Unknown value: ${e}`,name:"UNKNOWN_VALUE",title:"Unknown Value"}),this.value=e,Object.setPrototypeOf(this,Lt.prototype)}};class S extends ie{constructor(e,n){super({cause:void 0,hint:n,location:void 0,message:e,name:"INVALID_DEFINITIONS",stack:void 0,title:"Invalid Option Definition"}),Object.setPrototypeOf(this,S.prototype)}}const Ke=(t,e,n)=>{const i=Number(t);if(e&&Number.isNaN(i)&&String(t).trim().toLowerCase()!=="nan")throw new Se(n??"",String(t),"Number");return i},Ye=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",Qe=t=>t===Number||typeof t=="function"&&t.name==="Number",Ze=t=>t===String||typeof t=="function"&&t.name==="String",zi=(t,e,n={})=>{const{optionName:i,strictTypes:s}=n;return Array.isArray(t)?Ye(e)?t.map(Boolean):Qe(e)?t.map(o=>Ke(o,s,i)):Ze(e)?t.map(String):t.map(o=>e(String(o))):t===null?null:Ye(e)?!!t:Qe(e)?Ke(t,s,i):Ze(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t))},_=(t,e,n,...i)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...i)},Fi=/-([a-z])/g,qi=/^\d+$/,pe=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",Gi=t=>t.codePointAt(0)===95,Xe=(t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],et=t=>t==="__proto__"||t==="constructor"||t==="prototype",tt=(t,e,n,i=!1)=>{t[e]===void 0?t[e]=i?[n]:n:i&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},nt=(t,e,n,i,s)=>{let o=e.get(t)??n.get(t);if(!o&&i){const c=t.toLowerCase();o=i.get(c)??s?.get(c)}return o},Hi=(t,e,n,i)=>{const s=n.debug??!1;_(s,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),_(s,"Starting argument resolution","resolver"),_(s,"Tokens:","resolver",t),_(s,"Definitions:","resolver",e),_(s,"Processing tokens...","resolver");const o=new Map,c=new Map,a=n.caseInsensitive?new Map:void 0,u=n.caseInsensitive?new Map:void 0,r=n.camelCase?new Map:void 0,l=n.camelCase?new Map:void 0;for(const m of e)if(o.set(m.name,m),m.alias&&c.set(m.alias,m),n.caseInsensitive&&a&&(a.set(m.name.toLowerCase(),m),m.alias&&u&&u.set(m.alias.toLowerCase(),m)),n.camelCase&&r&&l){const v=m.name.replaceAll(Fi,(x,L)=>L.toUpperCase());r.set(m.name,v),l.set(v,m.name)}const d=Object.create(null),h=Object.create(null),f=[],p=[],g=new Set;let $=!1;const w=e.find(m=>m.defaultOption),y=e.some(m=>m.group),b=e.find(m=>m.type===Number);for(let m=0;m<t.length;m++){const v=t[m];if(v.kind==="option-terminator"){d._unknown=i.slice(v.index),$=!0;break}if(v.kind==="option"&&v.name){let x=nt(v.name,o,c,a,u);!x&&v.value===void 0&&b&&qi.test(v.name)&&(x=b,v.value=v.name,v.name=b.name);let L=!1;if(!x&&n.negation&&v.value===void 0&&v.name.startsWith("no-")){const C=v.name.slice(3),P=nt(C,o,c,a,u);P?.type&&pe(P.type)&&(x=P,L=!0)}const A=x?x.name:v.name,T=x?.multiple,D=x?.lazyMultiple;if(Object.hasOwn(h,A)&&h[A]!==void 0&&!T&&!D&&!n.partial)throw new Ri(A);if(!x&&n.partial){const C=v.rawName??`--${v.name}${v.value!==void 0&&v.inlineValue?`=${v.value}`:""}`;f.push({index:v.index,value:C});continue}if(!x&&n.stopAtFirstUnknown){d._unknown=i.slice(v.index);break}if(!x&&!n.partial)throw new Je(v.name);if(v.value===void 0){const C=t[m+1],P=C?.kind==="option"&&!("name"in C)&&C.value!==void 0,U=C&&x&&!(x.type&&pe(x.type))&&(C.kind==="positional"||P),Dt=x&&x.defaultOption&&!x.multiple&&!x.lazyMultiple;if(U&&(!x?.defaultOption||Dt))if(T){let j=m+1;const we=[];for(;j<t.length&&(t[j].kind==="positional"||t[j].kind==="option"&&!("name"in t[j])&&t[j].value!==void 0);)we.push(t[j].value),g.add(t[j].index),j++;h[A]=h[A]===void 0?we:Xe(h[A],we),m=j-1}else D?(tt(h,A,C.value,!0),g.add(C.index),m++):(h[A]=C.value,g.add(C.index),m++);else x?.type&&pe(x.type)?tt(h,A,!L,T):h[A]=T?[]:null}else{let{value:C}=v;if(x?.type&&pe(x.type))switch(C){case"":{if(n.partial){h._unknown??=[];const U=`${v.rawName??`--${v.name}`}${v.value?`=${v.value}`:""}`;h._unknown.push(U),p.push({index:v.index,value:U}),C=!0}else throw new Je(v.name);break}case"false":{C=!1;break}case"true":{C=!0;break}default:C=!0}const P=[C];if(T){let U=m+1;for(;U<t.length&&t[U].kind==="positional";)P.push(t[U].value),g.add(t[U].index),U++;m=U-1}h[A]===void 0?h[A]=T||D?P:C:T||D?h[A]=Xe(h[A],P):h[A]=C}}else if(v.kind==="positional"&&n.stopAtFirstUnknown&&!g.has(v.index)&&!w){_(s,`Found unconsumed positional token at index ${String(v.index)}, stopping processing`,"resolver"),d._unknown=i.slice(v.index);break}}for(const[m,v]of Object.entries(h)){const x=o.get(m);x&&(x.multiple||x.lazyMultiple)&&!Array.isArray(v)&&(h[m]=[v])}const N=m=>m.kind==="option"&&!o.has(m.name??"")&&!c.has(m.name??"")&&(!n.caseInsensitive||!a?.has(m.name?.toLowerCase()??"")&&!u?.has(m.name?.toLowerCase()??""));let E=-1,I=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!$&&(E=t.findIndex(m=>N(m)),E!==-1&&(I=t[E].index)),w){const m=[],v=[];for(const x of t)x.kind==="positional"&&!g.has(x.index)&&x.index<I&&(m.push(x.value),v.push(x));if(m.length>0){const x=h[w.name],L=w.multiple??w.lazyMultiple;x===void 0?L?(v.forEach(A=>g.add(A.index)),h[w.name]=m):(g.add(v[0].index),h[w.name]=m[0]):L&&(v.forEach(A=>g.add(A.index)),h[w.name]=Array.isArray(x)?[...m,...x]:[...m,x])}}if(!n.partial){for(const m of t)if(m.kind==="positional"&&!g.has(m.index))throw new Wi(i[m.index])}if(n.partial&&!n.stopAtFirstUnknown){const m=[...f];if(h._unknown)for(const v of p)m.push({index:v.index,value:v.value});for(const v of t)v.kind==="positional"&&!g.has(v.index)&&m.push({index:v.index,value:i[v.index]});m.length>0&&(m.sort((v,x)=>v.index-x.index),d._unknown=m.map(v=>v.value))}if(n.stopAtFirstUnknown&&!$){const m=t.findIndex(x=>x.kind==="positional"&&!g.has(x.index));let v=-1;if(E!==-1&&m!==-1?v=Math.min(E,m):E!==-1?v=E:m!==-1&&(v=m),v>=0){const x=t[v].index;d._unknown=i.slice(x)}}else f.length>0&&!n.partial&&(d._unknown=f.map(m=>m.value));for(const[m,v]of Object.entries(h)){const x=n.camelCase?r?.get(m)??m:m,L=o.get(m);L?.type?d[x]=zi(v,L.type,{optionName:L.name,strictTypes:n.strictTypes}):d[x]=v===void 0?null:v}for(const m of e){const v=n.camelCase?r?.get(m.name)??m.name:m.name;!(v in d)&&m.defaultValue!==void 0&&(m.multiple??m.lazyMultiple?d[v]=Array.isArray(m.defaultValue)?[...m.defaultValue]:[m.defaultValue]:d[v]=m.defaultValue)}if(y){const m={},v={},x={};for(const A of e)if(A.group){const T=Array.isArray(A.group)?A.group:[A.group];for(const D of T)et(D)||(m[D]??={})}for(const A of Object.keys(d))if(!Gi(A)){v[A]=d[A];let T=A;n.camelCase&&(T=l?.get(A)??A);const D=o.get(T);if(D?.group){const C=Array.isArray(D.group)?D.group:[D.group];for(const P of C)et(P)||m[P]&&(m[P][A]=d[A])}else x[A]=d[A]}const L={_all:v};for(const[A,T]of Object.entries(m))L[A]=T;Object.keys(x).length>0&&(L._none=x),d._unknown&&(L._unknown=d._unknown),Object.keys(d).forEach(A=>delete d[A]),Object.assign(d,L)}const O=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));return _(s,"Final parsed result:","resolver",O),O},ne="-".codePointAt(0),K="=",Ji=K.codePointAt(0),Ki="--",Yi="-",Qi="--",St=t=>t.length>2&&t.startsWith(Qi),Zi=t=>St(t)&&!t.includes(K,3),Xi=t=>St(t)&&t.includes(K,3),eo=t=>{if(t.length!==2||t.codePointAt(0)!==ne||t.codePointAt(1)===ne)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},to=t=>!(t.length<=2||t.codePointAt(0)!==ne||t.codePointAt(1)===ne),no=t=>{const e=[];let n=0,i=[],s=0,o=-1,c=0;for(;s<i.length||n<t.length;){let a;if(s<i.length?(a=i[s],s++):(a=t[n],n++),c>0?c--:o++,a===Ki){e.push({index:o,kind:"option-terminator"});const u=[...i.slice(s),...t.slice(n)],r=u.map((l,d)=>({index:o+d+1,kind:"positional",value:l}));e.push(...r),o+=u.length;break}if(eo(a)){const u=a.charAt(1);e.push({index:o,kind:"option",name:u,rawName:a});continue}if(to(a)&&!a.includes(K)){const u=[];let r="",l=!1;for(let d=1;d<a.length;d++){const h=a.charAt(d);l?r+=h:h.codePointAt(0)===Ji?l=!0:u.push(`${Yi}${h}`)}if(l)if(u.length>0){const d=u.pop();u.push(`${d}=${r}`)}else u.push(r);i=s<i.length?[...u,...i.slice(s)]:u,s=0,c=u.length;continue}if(Zi(a)){const u=a.slice(2);e.push({index:o,kind:"option",name:u,rawName:a});continue}if(Xi(a)){const u=a.indexOf(K),r=a.slice(2,u),l=a.slice(u+1);e.push({index:o,inlineValue:!0,kind:"option",name:r,rawName:a,value:l});continue}if(a.length>2&&a.codePointAt(0)===ne&&a.codePointAt(1)!==ne&&a.includes(K)){const u=a.indexOf(K),r=a.charAt(1),l=a.slice(u+1);e.push({index:o,inlineValue:!0,kind:"option",name:r,rawName:a,value:l});continue}e.push({index:o,kind:"positional",value:a})}return e},io=/\d/,oo=t=>t===Boolean||typeof t=="function"&&t.name==="Boolean",so=t=>typeof t=="function",ro=(t,e,n)=>{const i=n?.debug??!1;_(i,"Validating definitions:","validation",t,"caseInsensitive:",e);const s=new Set,o=new Set,c=new Set,a=new Set;let u=0;for(const r of t){if(_(i,"Checking definition:","validation",r),!r.name)throw _(i,"Validation failed: name is required","validation"),new S("Invalid option definition: name is required");if(typeof r.name!="string")throw new S("Invalid option definition: name must be a string");if(r.name.trim()==="")throw new S("Invalid option definition: name cannot be empty");const l=e?r.name.toLowerCase():"";if(s.has(r.name)||e&&c.has(l))throw new S(`Invalid option definition: duplicate name '${r.name}'`);if(o.has(r.name)||e&&a.has(l))throw new S(`Invalid option definition: name '${r.name}' conflicts with an existing alias`);if(s.add(r.name),e&&c.add(l),r.alias!==void 0){if(typeof r.alias!="string")throw new S("Invalid option definition: alias must be a string");if(r.alias.length!==1)throw new S("Invalid option definition: alias must be a single character");if(io.test(r.alias))throw new S("Invalid option definition: alias cannot be numeric");if(r.alias==="-")throw new S('Invalid option definition: alias cannot be "-"');const d=e?r.alias.toLowerCase():"";if(o.has(r.alias)||e&&a.has(d))throw new S(`Invalid option definition: duplicate alias '${r.alias}'`);if(s.has(r.alias)||e&&c.has(d))throw new S(`Invalid option definition: alias '${r.alias}' conflicts with an existing option name`);o.add(r.alias),e&&a.add(d)}if(r.defaultOption&&(u++,r.type!==void 0&&oo(r.type)))throw new S("Invalid option definition: defaultOption cannot be Boolean type");if(r.type!==void 0&&!(r.type===Boolean||r.type===Number||r.type===String||typeof r.type=="function"&&so(r.type)))throw new S("Invalid option definition: invalid type")}if(u>1)throw _(i,"Validation failed: multiple defaultOptions not allowed","validation"),new S("Invalid option definition: multiple defaultOptions not allowed");_(i,"Validation completed successfully","validation")};function ao(t,e={}){const n=e.debug??!1;_(n,"Starting command-line-args parsing","index"),_(n,"Options:","index",e);const i={...e};i.stopAtFirstUnknown&&(i.partial=!0);const s=Array.isArray(t)?t:[t];_(n,"Normalized definitions:","index",s),ro(s,i.caseInsensitive,n?i:void 0);let{argv:o}=i;if(!o&&(o=process.argv.slice(2),process.execArgv.length>0)){const r=new Set(process.execArgv);o=o.filter(l=>!r.has(l))}_(n,"Using argv:","index",o);let c=o;i.caseInsensitive&&(c=o.map(r=>{if(r.startsWith("--")){const l=r.indexOf("="),d=(l===-1?r.slice(2):r.slice(2,l)).toLowerCase();return l===-1?`--${d}`:`--${d}${r.slice(l)}`}if(r.startsWith("-")&&!r.startsWith("--")&&r.length>1){const l=r.slice(1).split("=",2),d=l[0],h=l[1];if(!d)return r;const f=d.toLowerCase();return h===void 0?`-${f}`:`-${f}=${h}`}return r}));const a=no(c.map(String));_(n,"Tokenized arguments:","index",a);const u=Hi(a,s,i,o);return _(n,"Command-line-args parsing completed","index"),u}class lo{result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}}let Ne=class extends k{commandName;constructor(t,e,n){super(`Failed to load command "${t}": ${e}`,"COMMAND_LOADER_ERROR",{commandName:t,reason:e}),this.name="CommandLoaderError",this.commandName=t,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",n!==void 0&&(this.cause=n)}};const co=/^-{1,2}(\w+)(=(.+))?$/,Tt=(t,e,n,i)=>{const s=co.exec(t);if(s===null)return{};const o=s[1];if(!o)return{};const c=n&&i?n.get(o)??i.get(o):e.find(a=>a.name===o||a.alias===o);return c!==void 0?{argName:c.name,argValue:s[3],option:c}:{}},it=(t,e)=>{if(e.type===void 0)return t;if(e.type.name==="Boolean"){if(t==="true"||t==="1")return e.type(!0);if(t==="false"||t==="0")return e.type(!1)}return e.type(t)},uo=new Set(["0","1","false","true"]),ho=(t,e,n,i)=>{if(e.length===0||t.length===0)return{};const s=(o,c)=>{const{argName:a,argValue:u,option:r}=Tt(c,e,n,i),{lastOption:l}=o;return r&&ue(r)&&u&&a?o.partial[a]=it(u,r):o.lastName&&l&&ue(l)&&uo.has(c)&&(o.partial[o.lastName]=it(c,l)),{lastName:a,lastOption:r,partial:o.partial}};return t.reduce(s,{partial:{}}).partial},po=new Set(["0","1","false","true"]),fo=(t,e,n,i)=>{if(e.length===0||t.length===0)return t;const s=(o,c)=>{const{argValue:a,option:u}=Tt(c,e,n,i),{lastOption:r}=o;if(r&&ue(r)&&po.has(c)){const{args:l}=o;return{args:l.slice(0,-1)}}return u&&ue(u)&&a?{args:o.args}:{args:[...o.args,c],lastOption:u}};return t.reduce(s,{args:[]}).args},mo=t=>{const e=new Map;for(const n of t){const i=e.get(n.name);i?e.set(n.name,{...i,...n}):e.set(n.name,n)}return[...e.values()]},go=t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},wo=(t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return go(e);if(t.type===Number||typeof t.type=="function"&&t.type.name==="Number"){const n=Number.parseFloat(e);return Number.isNaN(n)?void 0:n}return t.type===String||typeof t.type=="function"&&t.type.name==="String"?e:t.type(e)}},yo=/_./g,vo=/^[A-Z]/,$o=t=>t.toLowerCase().replaceAll(yo,e=>e[1]?.toUpperCase()??e).replace(vo,e=>e.toLowerCase()),bo=t=>{if(!t||t.length===0)return{};const e={},n=ge();for(const i of t){const s=n[i.name],o=wo(i,s),c=o===void 0?i.defaultValue:o,a=$o(i.name);e[a]=c}return e},xo=t=>{const e=new Map,n=new Map;for(const i of t)if(e.set(i.name,i),i.alias){const s=Array.isArray(i.alias)?i.alias:[i.alias];for(const o of s)n.set(o,i)}return{optionMapByAlias:n,optionMapByName:e}},Mt=async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new Ne(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new Ne(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new Ne(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},No=(t,e,n,i)=>{const s=new lo(t.name,t),{_all:o,_unknown:c,positionals:a}=e,u=Object.keys(n).length>0?{...o,...n}:o;fe in u&&delete u[fe],s.argument=a?.[fe]??[],s.rawUnknown=[...c??[]];const r=Object.keys(i).length>0;return s.options=r?{...u,...i}:u,s.env=bo(t.env),s},Ao=(t,e,n)=>{const i=t.options??[],s=i.length>0;let o=mo(s?[...i,...n]:n);if(o.length>0){for(const r of o)if(r.multiple&&r.lazyMultiple)throw new Error(`Argument "${r.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(o=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:fe,type:t.argument.type,typeLabel:t.argument.typeLabel},...o]);let c,a;if(s){const{optionMapByAlias:r,optionMapByName:l}=xo(i);c=fo(e,i,l,r),a=ho(e,i,l,r)}else c=e,a={};const u=ao(o,{argv:c,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:o,booleanValues:a,parsedArgs:u}},ee=async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await Mt(t))(e);let ko=class extends k{commandName;missingOptions;constructor(t,e){super(`Command "${t}" is missing required options: ${e.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:t,missingOptions:e}),this.name="CommandValidationError",this.commandName=t,this.missingOptions=e,this.hint=`Provide the following required options: ${e.join(", ")}`}},Eo=class extends k{choices;option;value;constructor(t,e,n){super(`Invalid value "${e}" for option "${t}". Allowed values: ${n.join(", ")}`,"INVALID_CHOICE",{choices:n,option:t,value:e}),this.name="InvalidChoiceError",this.option=t,this.value=e,this.choices=n,this.hint=`Use one of: ${n.map(i=>`--${t} ${i}`).join(", ")}`}};const ot=(t,e,n=!1)=>{const i=[];for(const s of t)if(!(!n&&!s.required)&&e[s.name]===void 0){if(s.type?.name==="Boolean"){e[s.name]=!1;continue}i.push(s)}return i},Co=(t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Wn(t,e)<=t.length/3,F=(t,e)=>{const n=t.toLowerCase();return e.filter(i=>Co(i.toLowerCase(),n))},Oo=(t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(i=>{const s=i.startsWith("--");let o=`Found unknown ${s?"option":"argument"} "${i}"`;if(s){const c=F(i.replace("--",""),(e.options??[]).map(a=>a.name));if(c.length>0){const[a,...u]=c.map(r=>`--${r}`);o+=u.length>0?`, did you mean ${a??""} or ${u.join(", ")}?`:`, did you mean ${a??""}?`}}n.push(o)}),n.length>0)throw new Error(n.join(`
|
|
28
|
-
`))},_o=(t,e,n)=>{const i=n.__requiredOptions__,s=i?ot(i,e,!0):ot(t,e,!1);if(s.length>0)throw new ko(n.name,s.map(o=>o.name));e._unknown&&e._unknown.length>0&&!n.argument&&Oo(e,n)},Io=(t,e,n)=>{const i=n.__conflictingOptions__??t.filter(s=>s.conflicts!==void 0);if(i.length>0){const s=i.find(o=>Array.isArray(o.conflicts)?o.conflicts.some(c=>e[c]!==void 0)&&e[o.name]!==void 0:e[o.conflicts]!==void 0&&e[o.name]!==void 0);if(s)throw new Ot(s.name,typeof s.conflicts=="string"?s.conflicts:s.conflicts?.[0]??"unknown")}},Lo=(t,e)=>{const n=e.options;if(n)for(const i of n){if(!i.choices||i.choices.length===0)continue;const s=t[i.name];if(s==null)continue;const o=Array.isArray(s)?s:[s];for(const c of o){const a=String(c);if(!i.choices.includes(a))throw new Eo(i.name,a,i.choices)}}},So=t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const s of t.options){if(s.name){const o=e.get(s.name)??[];o.push(s),e.set(s.name,o)}if(typeof s.alias=="string"&&s.alias.length>0){const o=n.get(s.alias)??[];o.push(s),n.set(s.alias,o)}else if(Array.isArray(s.alias)){for(const o of s.alias)if(o.length>0){const c=n.get(o)??[];c.push(s),n.set(o,c)}}}const i=[];for(const[s,o]of e)o.length>1&&i.push(`Duplicate option name "${s}" in command "${t.name}": ${JSON.stringify(o)}`);for(const[s,o]of n)o.length>1&&i.push(`Duplicate option alias "-${s}" used by options ${o.map(c=>`"${c.name}"`).join(", ")} in command "${t.name}"`);if(i.length>0)throw new Error(i.join(`
|
|
29
|
-
`))},To=(t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let i;for(let s=1;s<=e.length;s+=1){const o=e[s-1];if(o===void 0||o.startsWith("-"))break;n.push(o);const c=n.join(" ");t.has(c)&&(i={commandPath:[...n],depth:s})}return i?{argv:e.slice(i.depth),commandPath:i.commandPath}:{argv:e,commandPath:void 0}},H=t=>t.join(" "),st=(t,e)=>e&&e.length>0?[...e,t]:[t],Mo=(t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),Po=(t,e)=>typeof t!="string"||t===""?"":t[0].toUpperCase()+t.slice(1),Do=(t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const i=[];let s="",o="";for(let c=0;c<n;c++){const a=t[c];if(me.test(a)){s?(i.push(s+o+a),s="",o=""):(i.length>0&&i.push(e),s=a);continue}s?(o&&(o+=e),o+=a):(i.length>0&&i.push(e),i.push(a))}return i.join("")},Pt=(t,e)=>{if(typeof t!="string"||!t)return"";let n=!0;return Do(Ni(t,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(i=>{const s=i,o=s.toLowerCase();return n?(n=!1,Mo(o)):Po(o)}),"")},Uo=/^no-/,jo=t=>{t.options?.forEach(e=>{e.__camelCaseName__=Pt(e.name)})},Vo=t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const i of t.options)e.add(i.name);const n=[];for(const i of t.options)if(i.name.startsWith("no-")){const s=i.name.replace(Uo,"");if(!e.has(s)){if(i.type!==Boolean)throw new Error(`Cannot add negated option "${i.name}" to command "${t.name}" because it is not a boolean.`);const o={...i,defaultValue:i.defaultValue===void 0?!0:!i.defaultValue,name:s};n.push(o),e.add(s)}}n.length>0&&t.options.push(...n)},Bo=(t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,i=new Map;for(const o of e.options)if(o.name.startsWith("no-")){const c=Pt(o.name);i.set(c,o)}const s=Object.keys(n).filter(o=>i.has(o));if(s.length!==0)for(const o of s){const c=o.charAt(2);if(!c)continue;const a=c.toLowerCase()+o.slice(3),u=i.get(o);u&&(u.__negated__=!0),n[a]=!n[o],Reflect.deleteProperty(n,o)}},Ro=(t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const s of e.options)s.__camelCaseName__&&s.__negated__===void 0&&s.implies!==void 0&&n.set(s.__camelCaseName__,s);if(n.size===0)return;const{options:i}=t;for(const s of Object.keys(i)){const o=n.get(s);if(o?.implies){const{implies:c}=o;for(const[a,u]of Object.entries(c))i[a]===void 0&&(i[a]=u)}}},Wo=()=>!!process.versions.electron,zo=()=>Wo()&&!process.defaultApp,Fo=()=>zo()?0:1,qo=t=>t.slice(Fo()+1),Go=" ",Ho=(t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),Jo=t=>{if(typeof t=="string")return t.split(Go);const e=Ce();return Ho(t,e)?qo(t):t},Ko=t=>{const e=o=>{t.error(`Uncaught exception: ${o.message||o}`),o.stack&&t.error(o.stack),J(1)},n=(o,c)=>{if(o instanceof Error)t.error(`Promise rejection: ${o.message||o}`),o.stack&&t.error(o.stack);else{let a;if(typeof o=="string")a=o;else try{a=JSON.stringify(o)}catch{a=String(o)}t.error(`Promise rejection: ${a}`)}J(1)},i=Ue("uncaughtException",e),s=Ue("unhandledRejection",n);return()=>{i(),s()}},rt=100,Yo=/^[a-z][\w-]*$/i,Oe=(t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new k(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},at=(t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new k(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},Ae=(t,e)=>{if(typeof t!="object"||t===null)throw new k(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},de=t=>{const e=Oe(t,"Command name");if(e.length>rt)throw new k(`Command name is too long (maximum ${String(rt)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new k(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!Yo.test(e))throw new k(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},Qo=new Set([`
|
|
30
|
-
`,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),Zo=(t,e={})=>{if(typeof t!="string")throw new TypeError("Argument must be a string");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,i=n.maxArgumentLength??1e6;if(Number.isFinite(i)&&i>0&&t.length>i)throw new Error(`Argument is too long (maximum ${String(i)} characters)`);if(n.checkDangerousChars){for(const s of t)if(Qo.has(s))throw new Error(`Argument contains dangerous character: ${s}`)}return n.trim?t.trim():t},lt=(t,e={})=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");const n=typeof e=="boolean"?{checkDangerousChars:e}:e,i=n.maxArguments??1e5;if(Number.isFinite(i)&&i>0&&t.length>i)throw new Error(`Too many arguments (maximum ${String(i)})`);return t.map(s=>Zo(s,n))},Xo=/^-([^\d-])$/,es=/^--(\S+)/,ts=/^-([^\d-]{2,})$/,ke=t=>Xo.test(t)||es.test(t)||ts.test(t),ns={access:(t,e)=>Li(t,e),mkdir:(t,e)=>Ii(t,e),readdir:t=>_i(t),readFile:(async(t,e)=>e===void 0?Ge(t):Ge(t,e)),rm:(t,e)=>Oi(t,e),stat:t=>Ci(t),writeFile:(t,e,n)=>Ei(t,e,n)},is=(t,e,n)=>{const i=e.indexOf("--"),s=i===-1?new Set:new Set(e.slice(i+1)),o=n.filter(u=>u.startsWith("--")&&u!=="--"&&!s.has(u));if(o.length===0)return;const c=(t.options??[]).map(u=>u.name),a=o.flatMap(u=>F(u.slice(2),c).map(r=>`--${r}`));throw new Si(o,a)};class Te{#t;#e;#u;#h;#f;#m;#A;#k;#E;#$;#C;#b;#O;#_=ye;#p;#n;#i;#o;#s;#r;#g=!1;#I;#L=!1;#w;#y;#v;#l=[];#D(){return this.#w===void 0&&(this.#w=[...this.#i.keys()]),this.#w}#S(){return this.#y===void 0&&(this.#y=[...this.#n.keys()]),this.#y}#a(){return this.#v===void 0&&(this.#v=[...this.#D(),...this.#S()]),this.#v}#T(){return this.#l.length===0?he:[...he,...this.#l]}#M(){this.#w=void 0,this.#y=void 0,this.#v=void 0}#x(){if(this.#u===void 0){const e=Jo(this.#e.argv);this.#u=lt(e,{maxArguments:this.#b}),this.#U()}return this.#u}#N(){return this.#$??ge()}#d(e){this.#_=e,this.#N().CEREBRO_OUTPUT_LEVEL=String(e)}#c(){const e=this.#N().CEREBRO_OUTPUT_LEVEL,n=e===void 0?Number.NaN:Number(e);return Number.isNaN(n)?this.#_:n}#U(){if(!this.#u)return;let e=!1;for(const n of this.#u){if(n==="--quiet"||n==="-q"){this.#d(Bt),e=!0;break}if(n==="--verbose"||n==="-v"){this.#d(Rt),e=!0;break}if(n==="--debug"){this.#d(V),e=!0;break}}e||this.#d(Object.hasOwn(this.#N(),"DEBUG")?V:ye)}#j(){this.#L||(this.#I=Ko(this.#t),this.#L=!0)}#V(){return{arch:Vn(),argv:this.#x(),cwd:this.#h,env:this.#$??ge(),exit:this.#E??(e=>J(e??0)),platform:jn(),stdin:this.#C}}#P(e,n,i,s){this.#c()===V&&this.#t.debug(`command '${s}' found, parsing command args: ${n.join(", ")}`);const{arguments_:o,booleanValues:c,parsedArgs:a}=Ao(e,n,this.#T()),u=Object.keys(c).length>0;let r=a;u&&(r={...a,_all:{...a._all,...c}}),_o(o,r,e);const l=No(e,a,c,i);l.runtime=this,l.argv=this.#x(),l.fs=this.#k??ns,l.process=this.#V(),l.console=this.#t;const d=e.options&&e.options.length>0;if(d&&e.options){const h=e.options.filter(f=>f.name.startsWith("no-"));for(const f of h){const p=f.name.slice(3),g=`--${f.name}`,$=`--${p}`,w=n.includes(g),y=n.includes($);if(w&&y)throw new Ot(p,f.name)}}return d&&(Bo(l,e),Ro(l,e)),Io(o,l.options,e),Lo(l.options,e),this.#O&&is(e,n,l.rawUnknown),this.#c()===V&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(l.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(l.argument,null,2))),{arguments_:o,booleanValues:c,commandArgs:r,parsedArgs:a,toolbox:l}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new k("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#f=e.trim();const i=n.argv??Ce(),s=n.cwd??Pn();if(this.#e={...n,argv:i,cwd:s},this.#e.argv&&!Array.isArray(this.#e.argv))throw new k("CLI argv option must be an array of strings","INVALID_INPUT",{argv:this.#e.argv});if(this.#e.cwd&&typeof this.#e.cwd!="string")throw new k("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new k("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new k("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});if(typeof this.#e.logger=="object"){const r=["debug","error","info","log","warn"],l=[],d=this.#e.logger;for(const h of r)typeof d[h]!="function"&&l.push(h);if(l.length>0)throw new k(`Logger object is missing required methods: ${l.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:l});this.#t=this.#e.logger}else this.#t={...console,debug:(...r)=>{this.#c()===V&&console.debug(...r)}};this.#m=this.#e.packageVersion,this.#A=this.#e.packageName,this.#h=this.#e.cwd,this.#s="help",this.#r={};const o=n.fs;if(o!==void 0&&(typeof o!="object"||o===null))throw new k("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const c=n.exit;if(c!==void 0&&typeof c!="function")throw new k("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const a=n.env;if(a!==void 0&&(typeof a!="object"||a===null))throw new k("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const u=n.stdin;if(u!==void 0&&typeof u!="string")throw new k("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#k=n.fs,this.#E=n.exit,this.#$=n.env,this.#C=n.stdin??"",this.#b=n.maxArguments,this.#O=n.strictOptions??!1,this.#d(ye),this.#n=new Map,this.#i=new Map,this.#o=new Map}setCommandSection(e){return this.#r=e,this}getCommandSection(){return this.#r.header||(this.#r.header=`${this.#f}${this.#m?` v${this.#m}`:""}`),this.#r}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){Ae(e,"Command"),de(e.name);const n=typeof e.execute=="function",i=typeof e.loader=="function";if(n&&i)throw new k(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!i)throw new k(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?de(e.alias):at(e.alias,"Command alias").forEach(r=>de(r))),e.argument&&Ae(e.argument,"Command argument"),e.options&&Ae(e.options,"Command options"),e.commandPath&&(at(e.commandPath,"Command commandPath"),e.commandPath.forEach(r=>{de(r)}));const s=st(e.name,e.commandPath),o=H(s);if(this.#i.has(o))throw new k(`Command with path "${o}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const c=Array.isArray(e.commandPath)&&e.commandPath.length>0,a=this.#n.get(e.name),u=a!==void 0&&(a.commandPath===void 0||a.commandPath.length===0);if(!c&&u)throw new k(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const r of e.options)He(r);if(So(e),Vo(e),jo(e),e.options&&(e.__conflictingOptions__=e.options.filter(r=>r.conflicts!==void 0),e.__requiredOptions__=e.options.filter(r=>r.required===!0)),c&&a!==void 0)this.#n.set(o,e);else{if(!c&&a!==void 0&&!u){const r=st(a.name,a.commandPath);this.#n.set(H(r),a)}this.#n.set(e.name,e)}if(this.#i.set(o,s),this.#o.set(o,e),this.#M(),e.alias!==void 0){const r=typeof e.alias=="string"?[e.alias]:e.alias;for(const l of r){if(this.#c()===V&&this.#t.debug("adding alias",l),this.#n.has(l))throw new k(`Command alias "${l}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:l,commandName:e.name});this.#n.set(l,e)}}return this}addGlobalOption(e){const n=e,i=new Set(he.map(o=>o.name)),s=new Set(he.map(o=>o.alias).filter(Boolean));if(i.has(n.name))throw new k(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&s.has(n.alias))throw new k(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#l.map(o=>o.name)).has(n.name))throw new k(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",He(n),this.#l.push(n),this}getGlobalOptions(){return this.#T()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#p?this.#p:(this.#p=new Mi(this.#t),this.#p.register({description:"Attaches the logger to the toolbox",execute:e=>{e.logger=this.#t,e.console=e.logger},name:"logger"}),this.#p)}getCliName(){return this.#f}getPackageVersion(){return this.#m}getPackageName(){return this.#A}getCommands(){return this.#n}getCwd(){return this.#h}dispose(){this.#I?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:i=!0,...s}=e;if(!this.#n.has("help")){const{default:y}=await import("../packem_chunks/help-command.js");this.addCommand(new y(this.#n))}const o=this.#S(),c=this.#i;this.#j();const a=this.#x();let u,r=[...a];this.#c()===V&&(this.#t.debug(`process.execPath: ${Un()}`),this.#t.debug(`process.execArgv: ${Dn().join(" ")}`),this.#t.debug(`process.argv: ${Ce().join(" ")}`));const l=To(c,[...a]);if(l.commandPath)u=l.commandPath,r=l.argv;else{if(a.length>1&&a[0]&&a[1]&&!ke(a[0])&&!ke(a[1])){const b=[];let N=0;for(;N<a.length;){const I=a[N];if(!I||ke(I))break;b.push(I),N+=1}const E=H(b);if(b[0]&&!o.includes(b[0])){const I=this.#a(),O=F(E,I);throw new G(E,O)}}let y;try{y=Bi([null,...o],[...a])}catch(b){if(b instanceof Error&&b.name==="INVALID_COMMAND"&&"command"in b){const N=b.command,E=this.#a(),I=F(N,E);throw new G(N,I)}throw b}y.command&&(u=[y.command],r=y.argv)}if(!u)if(this.#s)u=[this.#s];else{const y=this.#a();throw new G("",y)}const d=H(u),h=this.#i.get(d);let f;if(h){if(f=this.#o.get(d),!f||H(h)!==d){const y=this.#a(),b=F(d,y);throw new G(d,b)}}else{const y=u.at(-1);if(f=y?this.#n.get(y):void 0,!f){const b=this.#a(),N=F(d,b);throw new G(d,N)}}if(typeof f.execute!="function"&&typeof f.loader!="function")return this.#t.error(`Command "${f.name}" has no function to execute.`),i?J(1):void 0;const p=r;let g,$;try{({commandArgs:g,toolbox:$}=this.#P(f,p,s,d))}catch(y){if(this.#t.error(y),i)return J(1);throw y}const w=this.getPluginManager();try{!this.#g&&w.hasPlugins()&&(await w.init({cli:this,cwd:this.#h,logger:this.#t}),this.#g=!0),await w.executeLifecycle("execute",$),await w.executeLifecycle("beforeCommand",$);let y;const b=g.global;if(b?.help){const N=this.#n.get("help");if(!N)throw new k("Help command not found","COMMAND_NOT_FOUND");y=await ee(N,$)}else if(b?.version??b?.V){const N=this.#n.get("version");if(!N)throw new k("Version command not found","COMMAND_NOT_FOUND");y=await ee(N,$)}else y=await ee(f,$);return await w.executeLifecycle("afterCommand",$,y),i?J(0):void 0}catch(y){throw await w.executeErrorHandlers(y,$),y}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...s}=n;Oe(e,"Command name");const o=e.split(" ").filter(Boolean),c=H(o),a=this.#i.get(c)?this.#o.get(c):this.#n.get(e);if(!a){const h=this.#a(),f=F(c||e,h);throw new G(e,f)}if(typeof a.execute!="function"&&typeof a.loader!="function")throw new k(`Command "${a.name}" has no function to execute`,"INVALID_COMMAND",{commandName:a.name});const u=[...lt(i,{maxArguments:this.#b})];this.#c()===V&&this.#t.debug(`running command '${e}' programmatically with args: ${u.join(", ")}`);const{commandArgs:r,toolbox:l}=this.#P(a,u,s,c||e),d=this.getPluginManager();try{!this.#g&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#h,logger:this.#t}),this.#g=!0),await d.executeLifecycle("execute",l),await d.executeLifecycle("beforeCommand",l);let h;const f=r.global;if(f?.help){const p=this.#n.get("help");if(!p)throw new k("Help command not found","COMMAND_NOT_FOUND");h=await ee(p,l)}else if(f?.version??f?.V){const p=this.#n.get("version");if(!p)throw new k("Version command not found","COMMAND_NOT_FOUND");h=await ee(p,l)}else h=await ee(a,l);return await d.executeLifecycle("afterCommand",l,h),h}catch(h){throw await d.executeErrorHandlers(h,l),h}}clone(e){const n={...this.#e,...e},i=new Te(this.#f,n);for(const[s,o]of this.#n)i.#n.set(s,o);for(const[s,o]of this.#i)i.#i.set(s,[...o]);for(const[s,o]of this.#o)i.#o.set(s,o);for(const s of this.#l)i.#l.push(s);return i.#s=this.#s,i.#r={...this.#r},i.#M(),i}async getAction(e){Oe(e,"Command name");const n=e.split(" ").filter(Boolean),i=H(n),s=this.#i.get(i)?this.#o.get(i):this.#n.get(e);if(!s){const o=this.#a(),c=F(i||e,o);throw new G(e,c)}if(typeof s.execute=="function")return s.execute;if(typeof s.loader=="function")return Mt(s);throw new k(`Command "${s.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:s.name})}}const ms=(t,e)=>new Te(t,e),gs=()=>{try{const t=require("node:module");if(typeof t.enableCompileCache=="function"){t.enableCompileCache();return}}catch{}try{require("v8-compile-cache")}catch{}},ws=(t={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:(e,n)=>{const{logger:i,runtime:s}=n,{detailed:o=!1,exitOnError:c=!0,formatter:a,logErrors:u=!0,renderOptions:r={}}=t;if(u)if(a)i.error(a(e));else if(o){const l=s.getCwd(),d=Mn(e,{cwd:l,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...r});i.error(d)}else i.error(e);c&&J(1)},version:"1.0.0"});var os="1.0.0-alpha.40";const ys={version:os},vs={argument:{description:"Package to execute (optionally with @version)",name:"package",type:String},description:"Execute a remote package without permanent installation",examples:[["vis dlx create-vite my-app","Scaffold a new project"],["vis dlx typescript@5.5.4 tsc --version","Run specific version"],["vis dlx -p cowsay -p lolcatjs -c 'echo hi | cowsay | lolcatjs'","Multiple packages with shell"],["vis install && vis dlx --offline typescript tsc --version","Hardened: pre-install + offline (no registry fetch on dlx)"]],group:"Run & Execute",loader:()=>import("../packem_chunks/handler9.js"),name:"dlx",options:[{alias:"p",description:"Additional packages to install (repeatable)",multiple:!0,name:"package",type:String},{alias:"c",defaultValue:!1,description:"Execute within shell environment",name:"shell-mode",type:Boolean},{alias:"s",defaultValue:!1,description:"Suppress output except command results",name:"silent",type:Boolean},{defaultValue:!1,description:"Resolve from local store only — fail rather than fetch from the registry. Pair with `vis install` for hardened npx-style workflows.",name:"offline",type:Boolean}]};export{q as L,ms as V,gs as a,rs as b,ys as c,hs as d,vs as e,k as f,Ce as g,ws as h,us as i,Un as j,J as k,Dn as l,ls as n,ps as o,ds as p,cs as r,as as s,ge as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createRequire as j}from"node:module";import{m as d,f as y}from"./index-BDmTbWX1.js";import{a as A}from"../packem_chunks/config.js";const M=j(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=i=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[e,t]=l.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return l.getBuiltinModule(i)}return M(i)},{readdirSync:_,lstatSync:S}=b("node:fs"),$=/^([^<(]+?)?(?:<([^>]+)>)?\s*(?:\(([^)]+)\))?\s*$/u,q=i=>{const e=i.match($);if(!e)return;const t=e[1]?.trim(),n=e[2]?.trim(),o=e[3]?.trim();if(!(!t&&!n&&!o))return{email:n||void 0,name:t||void 0,url:o||void 0}},w=i=>{if(!Array.isArray(i)||i.length===0)return;const e=[];for(const t of i)if(typeof t=="string"){const n=q(t);n&&e.push(n)}else if(t&&typeof t=="object"){const n=t,o=typeof n.name=="string"?n.name:void 0,r=typeof n.email=="string"?n.email:void 0,f=typeof n.url=="string"?n.url:void 0;(o||r||f)&&e.push({email:r,name:o,url:f})}return e.length>0?e:void 0},D=i=>{const e=d(i,"node_modules");if(!y(e))return new Map;const t=new Map,n=new Set,o=(r,f="")=>{if(n.has(r))return;n.add(r);let v;try{v=_(r)}catch{return}for(const a of v){const c=d(r,a);let m;try{m=S(c)}catch{continue}if(m.isSymbolicLink())continue;if(a.startsWith("@")){m.isDirectory()&&o(c,`${a}/`);continue}if(a===".pnpm"&&f===""){let s;try{s=_(c)}catch{continue}for(const p of s){const u=d(c,p,"node_modules");y(u)&&o(u)}continue}if(a.startsWith(".")||!m.isDirectory())continue;const g=f+a,h=d(c,"package.json");try{if(!y(h))continue;const s=A(h);if(typeof s.version!="string")continue;const p=`${g}@${s.version}`;t.has(p)||t.set(p,{directory:c,license:s.license,licenses:Array.isArray(s.licenses)?s.licenses:void 0,maintainers:w(s.maintainers),name:g,scripts:s.scripts&&typeof s.scripts=="object"?s.scripts:void 0,version:s.version});const u=d(c,"node_modules");y(u)&&o(u)}catch{}}};return o(e),t};export{w as n,D as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as a,m as h,B as l,I as f}from"./index-BDmTbWX1.js";import{i as d,t as $}from"../packem_chunks/bin.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-DGSsjmpV.js";import{f as T,a as R,m as p}from"./index-BDmTbWX1.js";import{g as A,l as M}from"../packem_chunks/bin.js";import{a as P}from"../packem_chunks/config.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/bin.js").then(n=>n.bx),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,x=(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=x(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,x 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-BDmTbWX1.js";import{g as b}from"../packem_chunks/bin.js";import{a as j}from"../packem_chunks/config.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{r as A,l as $,p as m}from"../packem_chunks/bin.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-DCPmPE5M.js";import{m as g,g as w,D as h,r as I}from"./provenance-BFEwKgI3.js";import{r as O}from"./signatures-Xpd6HjG_.js";import{s as B}from"./index-DGSsjmpV.js";import{f as W}from"./utils-Cxree603.js";const R=D(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,M=e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[a,r]=u.versions.node.split(".").map(Number);if(a>22||a===22&&r>=3||a===20&&r>=16)return u.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}},Ne=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"],ue=e=>pe.some(a=>a==="signatures"?e.signatures?.enabled===!0:e[a]?.enabled!==!1),me=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{}})},De=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;ue(s)&&await me(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):m.debug(`resolveLatestVersions: ${o} returned 200 but no version field; dropping.`)}else m.debug(`resolveLatestVersions: ${o} returned ${String(n.status)}; dropping.`)}catch(n){m.debug(`resolveLatestVersions: ${o} fetch failed (${n instanceof Error?n.message:String(n)}); dropping.`)}}))}finally{clearTimeout(c)}return r},Re=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}):m.debug(`resolveExplicitPackages: dropping ${n.name}${n.versionSpec?`@${n.versionSpec}`:""} — neither semver-coerce nor /latest resolved a version.`)}return o};export{De as a,we as b,Ne as p,Re as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as g,f as m,v as h}from"./index-BDmTbWX1.js";import{whichBin as d}from"#native";import{a as k}from"../packem_chunks/config.js";const v=r=>{for(const s of[".nvmrc",".node-version"]){const i=g(r,s);if(m(i))try{return h(i).trim().replace(/^v/,"")}catch{}}},l=(r,s)=>{const i=r.split(/[.\-+]/).map(n=>Number.parseInt(n,10)||0),c=s.split(/[.\-+]/).map(n=>Number.parseInt(n,10)||0),e=Math.max(i.length,c.length);for(let n=0;n<e;n++){const t=i[n]??0,a=c[n]??0;if(t!==a)return t-a}return 0},$=(r,s)=>{const i=s.trim();if(i===""||i==="*")return!0;const c=i.split(/\s+/).filter(Boolean);for(const e of c)if(e.startsWith(">=")){if(l(r,e.slice(2).trim())<0)return!1}else if(e.startsWith("<=")){if(l(r,e.slice(2).trim())>0)return!1}else if(e.startsWith(">")){if(l(r,e.slice(1).trim())<=0)return!1}else if(e.startsWith("<")){if(l(r,e.slice(1).trim())>=0)return!1}else if(/^\d/.test(e)){const n=r.split("."),t=e.split(".");for(const[a,o]of t.entries())if(o!==n[a])return!1}return!0},x=r=>{const s=[],i=g(r,"package.json");let c;try{c=k(i)}catch{return s}const e=process.versions.node;if(c.engines?.node){const t=c.engines.node;$(e,t)||s.push({actual:e,expected:t,kind:"node",message:`package.json engines.node requires ${t}, but the current Node.js is ${e}.`,severity:"error"})}const n=v(r);if(n){const[t,a]=n.split("."),[o,p]=e.split(".");(t!==o||a!==void 0&&a!==p)&&s.push({actual:e,expected:n,kind:"node",message:`.nvmrc pins Node ${n} but the current Node.js is ${e}. Run \`nvm use\` or switch runtimes.`,severity:"warning"})}if(c.packageManager){const[t,a]=c.packageManager.split("@"),o=(process.env.npm_config_user_agent??"").split(" ")[0]??"",[p,u]=o.split("/"),f=t==="aube"&&d("aube")!==null;p&&t&&p!==t?s.push({actual:p,expected:t,kind:"packageManager",message:`package.json packageManager pins ${c.packageManager} but the current invocation is ${o}. Install the correct package manager.`,severity:f?"warning":"error"}):u&&a&&u!==a&&s.push({actual:u,expected:a,kind:"packageManager",message:`package.json packageManager pins ${t}@${a} but the current invocation uses ${t}@${u}.`,severity:"warning"})}return s};export{x as c};
|