@visulima/vis 1.0.0-alpha.3 → 1.0.0-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1117 -24
- package/LICENSE.md +11958 -0
- package/README.md +344 -20
- package/dashboard/dist/index.html +152 -0
- package/dist/bin.js +1 -146
- package/dist/binx.js +3 -0
- package/dist/config/index.d.ts +3154 -0
- package/dist/config/index.js +1 -0
- package/dist/generate/index.d.ts +157 -0
- package/dist/generate/index.js +1 -0
- package/dist/packem_chunks/bin.js +1415 -0
- package/dist/packem_chunks/bloom-status.js +2 -0
- package/dist/packem_chunks/bloom-sync.js +2 -0
- package/dist/packem_chunks/cache-attestation.js +1 -0
- package/dist/packem_chunks/config.js +19 -0
- package/dist/packem_chunks/devtools.js +82 -0
- package/dist/packem_chunks/doctor-probe.js +2 -0
- package/dist/packem_chunks/fix.js +11 -0
- package/dist/packem_chunks/handler.js +1 -0
- package/dist/packem_chunks/handler10.js +1 -0
- package/dist/packem_chunks/handler11.js +5 -0
- package/dist/packem_chunks/handler12.js +1 -0
- package/dist/packem_chunks/handler13.js +27 -0
- package/dist/packem_chunks/handler14.js +5 -0
- package/dist/packem_chunks/handler15.js +1 -0
- package/dist/packem_chunks/handler16.js +1 -0
- package/dist/packem_chunks/handler17.js +1 -0
- package/dist/packem_chunks/handler18.js +1 -0
- package/dist/packem_chunks/handler19.js +1 -0
- package/dist/packem_chunks/handler2.js +4 -0
- package/dist/packem_chunks/handler20.js +5 -0
- package/dist/packem_chunks/handler21.js +2 -0
- package/dist/packem_chunks/handler22.js +2 -0
- package/dist/packem_chunks/handler23.js +1 -0
- package/dist/packem_chunks/handler24.js +1 -0
- package/dist/packem_chunks/handler25.js +5 -0
- package/dist/packem_chunks/handler26.js +1 -0
- package/dist/packem_chunks/handler27.js +3 -0
- package/dist/packem_chunks/handler28.js +1 -0
- package/dist/packem_chunks/handler29.js +7 -0
- package/dist/packem_chunks/handler3.js +4 -0
- package/dist/packem_chunks/handler30.js +33 -0
- package/dist/packem_chunks/handler31.js +3 -0
- package/dist/packem_chunks/handler32.js +8 -0
- package/dist/packem_chunks/handler33.js +1 -0
- package/dist/packem_chunks/handler34.js +5 -0
- package/dist/packem_chunks/handler35.js +11 -0
- package/dist/packem_chunks/handler36.js +3 -0
- package/dist/packem_chunks/handler37.js +22 -0
- package/dist/packem_chunks/handler38.js +61 -0
- package/dist/packem_chunks/handler39.js +3 -0
- package/dist/packem_chunks/handler4.js +6 -0
- package/dist/packem_chunks/handler40.js +6 -0
- package/dist/packem_chunks/handler41.js +24 -0
- package/dist/packem_chunks/handler42.js +153 -0
- package/dist/packem_chunks/handler43.js +25 -0
- package/dist/packem_chunks/handler44.js +10 -0
- package/dist/packem_chunks/handler45.js +708 -0
- package/dist/packem_chunks/handler46.js +24 -0
- package/dist/packem_chunks/handler47.js +322 -0
- package/dist/packem_chunks/handler48.js +48 -0
- package/dist/packem_chunks/handler49.js +3 -0
- package/dist/packem_chunks/handler5.js +8 -0
- package/dist/packem_chunks/handler50.js +27 -0
- package/dist/packem_chunks/handler51.js +195 -0
- package/dist/packem_chunks/handler52.js +34 -0
- package/dist/packem_chunks/handler6.js +1 -0
- package/dist/packem_chunks/handler7.js +1 -0
- package/dist/packem_chunks/handler8.js +1 -0
- package/dist/packem_chunks/handler9.js +1 -0
- package/dist/packem_chunks/heal-accept.js +10 -0
- package/dist/packem_chunks/heal.js +14 -0
- package/dist/packem_chunks/help-command.js +8 -0
- package/dist/packem_chunks/index.js +7 -0
- package/dist/packem_chunks/keys-refresh.js +4 -0
- package/dist/packem_chunks/list.js +3 -0
- package/dist/packem_chunks/loader.js +4 -0
- package/dist/packem_chunks/loader2.js +1 -0
- package/dist/packem_chunks/prune.js +3 -0
- package/dist/packem_chunks/run.js +1 -0
- package/dist/packem_chunks/status.js +2 -0
- package/dist/packem_chunks/sync.js +2 -0
- package/dist/packem_chunks/sync2.js +2 -0
- package/dist/packem_chunks/tar.js +3 -0
- package/dist/packem_chunks/tripwire.js +2 -0
- package/dist/packem_chunks/verify-lockfile.js +2 -0
- package/dist/packem_shared/Table-DoSoazT6-DwnyTUsA.js +12 -0
- package/dist/packem_shared/_commonjsHelpers-CLblCigl.js +1 -0
- package/dist/packem_shared/advisories-BxXiKFbL.js +1 -0
- package/dist/packem_shared/affected-shas-BdnlfiV1.js +1 -0
- package/dist/packem_shared/ai-analysis-KP8b5lc0.js +68 -0
- package/dist/packem_shared/ai-fix-BkPUHA0z.js +43 -0
- package/dist/packem_shared/anolilab-text-CAM_E6uK.js +13 -0
- package/dist/packem_shared/applyDefaults-BogleaFi.js +1 -0
- package/dist/packem_shared/build-scripts-DE6U8jVq.js +1 -0
- package/dist/packem_shared/cyclonedx-BpGVHqSW.js +4 -0
- package/dist/packem_shared/definePlugin-CWm4Dv_t.js +1 -0
- package/dist/packem_shared/dependency-scan-BUbOcMwX.js +1 -0
- package/dist/packem_shared/docker-CTE3s4LW.js +60 -0
- package/dist/packem_shared/failure-log-34Wl3npC.js +2 -0
- package/dist/packem_shared/giget-CcEy_Elm.js +2 -0
- package/dist/packem_shared/glob-D_7bct6p-D8itOHsr.js +1 -0
- package/dist/packem_shared/index-D1xC1Y_R.js +1 -0
- package/dist/packem_shared/index-DH-5hsrC.js +1 -0
- package/dist/packem_shared/index-hoWfZmNo.js +30 -0
- package/dist/packem_shared/license-zZU7aavK.js +1 -0
- package/dist/packem_shared/lifecycle-CXaqPGAQ.js +2 -0
- package/dist/packem_shared/lockfile-CrT86D6d.js +1 -0
- package/dist/packem_shared/lockfile-Cu2BH6bl.js +1 -0
- package/dist/packem_shared/manifests-BzWpKW8F.js +1 -0
- package/dist/packem_shared/min-release-age-BPVXwPUg.js +34 -0
- package/dist/packem_shared/native-config-sync-BRZZetn3.js +21 -0
- package/dist/packem_shared/osv-bloom-DSZcHLsM.js +2 -0
- package/dist/packem_shared/otelPlugin-CJR2T_lk.js +1 -0
- package/dist/packem_shared/peer-warnings-EvSJ18gE.js +1 -0
- package/dist/packem_shared/pm-runner-DmKT2FqF.js +1 -0
- package/dist/packem_shared/provenance-DkCA8BrN.js +1 -0
- package/dist/packem_shared/readFileSync-DseCu8sg-DEq4Fn3a.js +1 -0
- package/dist/packem_shared/registry-keys-Mixm4eAY.js +1 -0
- package/dist/packem_shared/resolve-explicit-D5E72FfN.js +5 -0
- package/dist/packem_shared/runtime-check-CilFOqUU.js +1 -0
- package/dist/packem_shared/s1ngularity-Qxc6tRRI.js +1 -0
- package/dist/packem_shared/scan-progress-DVtCtI2z.js +2 -0
- package/dist/packem_shared/selectors-DkgYFzdq.js +3 -0
- package/dist/packem_shared/signatures-byuFrtAH.js +2 -0
- package/dist/packem_shared/spinner-C8xs6QZv.js +1 -0
- package/dist/packem_shared/spinners-f91Rbo99-Bjf3NcO0.js +1 -0
- package/dist/packem_shared/symbols-CQmER5MT.js +1 -0
- package/dist/packem_shared/tabs-xZkm6Y_J.js +1 -0
- package/dist/packem_shared/toolchain-DoG6b_G_.js +5 -0
- package/dist/packem_shared/typosquats-BiDxQj7R.js +1 -0
- package/dist/packem_shared/use-measured-height-Lea6TCVD.js +1 -0
- package/dist/packem_shared/utils-DrNg0XTR.js +1 -0
- package/dist/packem_shared/verify-cLcZwKqe.js +1 -0
- package/dist/packem_shared/vis-update-app-BCKzlqj8.js +1 -0
- package/dist/packem_shared/watch-DEL0yol9.js +1 -0
- package/dist/packem_shared/watch-loop-C31Ar7BX.js +11 -0
- package/index.d.ts +436 -0
- package/index.js +613 -0
- package/package.json +71 -26
- package/schemas/project.schema.json +991 -0
- package/schemas/vis-config.schema.json +4958 -0
- package/skills/vis/SKILL.md +96 -0
- package/templates/buildkite-ci/.buildkite/pipeline.yml.tera +85 -0
- package/templates/buildkite-ci/template.yml +20 -0
- package/dist/ai-analysis.d.ts +0 -40
- package/dist/ai-cache.d.ts +0 -21
- package/dist/bin.d.ts +0 -1
- package/dist/catalog.d.ts +0 -110
- package/dist/commands/affected.d.ts +0 -3
- package/dist/commands/ai.d.ts +0 -3
- package/dist/commands/analyze.d.ts +0 -3
- package/dist/commands/check.d.ts +0 -3
- package/dist/commands/graph.d.ts +0 -3
- package/dist/commands/hook/constants.d.ts +0 -8
- package/dist/commands/hook/index.d.ts +0 -3
- package/dist/commands/hook/install.d.ts +0 -7
- package/dist/commands/hook/migrate.d.ts +0 -27
- package/dist/commands/hook/uninstall.d.ts +0 -3
- package/dist/commands/migrate/constants.d.ts +0 -12
- package/dist/commands/migrate/deps.d.ts +0 -32
- package/dist/commands/migrate/index.d.ts +0 -3
- package/dist/commands/migrate/json.d.ts +0 -20
- package/dist/commands/migrate/lint-staged.d.ts +0 -62
- package/dist/commands/migrate/types.d.ts +0 -20
- package/dist/commands/run.d.ts +0 -3
- package/dist/commands/staged.d.ts +0 -3
- package/dist/commands/update.d.ts +0 -3
- package/dist/config.d.ts +0 -40
- package/dist/config.js +0 -1
- package/dist/package-manager.d.ts +0 -23
- package/dist/workspace.d.ts +0 -58
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var De=Object.defineProperty;var f=(r,e)=>De(r,"name",{value:e,configurable:!0});import{createRequire as Fe}from"node:module";const Ne=Fe(import.meta.url),z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=f(r=>{if(typeof z<"u"&&z.versions&&z.versions.node){const[e,t]=z.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return z.getBuiltinModule(r)}return Ne(r)},"__cjs_getBuiltinModule"),{createRequire:Me}=k("node:module"),{existsSync:x,createWriteStream:se,readdirSync:Ge,renameSync:He}=k("node:fs"),{readFile:ie,mkdir:H,rm:M,writeFile:Be,mkdtemp:Le}=k("node:fs/promises"),{PassThrough:ae,Readable:q,pipeline:Re}=k("node:stream"),{spawn:ce,spawnSync:Ue}=k("node:child_process"),{delimiter:J,resolve:We,dirname:Xe,normalize:qe,join:Y}=k("node:path"),{cwd:Je}=z,Ye=k("node:readline"),{pipeline:Ze}=k("node:stream/promises"),{homedir:Ve,tmpdir:le}=k("node:os"),{promisify:Ke}=k("node:util");var Qe=Object.defineProperty,et=f((r,e)=>Qe(r,"name",{value:e,configurable:!0}),"a$1"),Z=Object.defineProperty,tt=et((r,e)=>{let t={};for(var n in r)Z(t,n,{get:r[n],enumerable:!0});return e||Z(t,Symbol.toStringTag,{value:"Module"}),t},"__exportAll"),rt=Object.defineProperty,p=f((r,e)=>rt(r,"name",{value:e,configurable:!0}),"a");const nt=/^[A-Za-z]:\//;function F(r=""){return r&&r.replace(/\\/g,"/").replace(nt,e=>e.toUpperCase())}f(F,"P");p(F,"p");const ot=/^[/\\]{2}/,st=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,ue=/^[A-Za-z]:$/,V=/^\/([A-Za-z]:)?$/,pe=p(function(r){if(r.length===0)return".";r=F(r);let e=r.match(ot),t=D(r),n=r[r.length-1]==="/";return r=R(r,!t),r.length===0?t?"/":n?"./":".":(n&&(r+="/"),ue.test(r)&&(r+="/"),e?t?`//${r}`:`//./${r}`:t&&!D(r)?`/${r}`:r)},"g"),K=p(function(...r){let e="";for(let t of r)if(t)if(e.length>0){let n=e[e.length-1]==="/",o=t[0]==="/";n&&o?e+=t.slice(1):e+=n||o?t:`/${t}`}else e+=t;return pe(e)},"_");function de(){return typeof process.cwd=="function"?process.cwd().replace(/\\/g,"/"):"/"}f(de,"st");p(de,"v");const $=p(function(...r){r=r.map(n=>F(n));let e="",t=!1;for(let n=r.length-1;n>=-1&&!t;n--){let o=n>=0?r[n]:de();!o||o.length===0||(e=`${o}/${e}`,t=D(o))}return e=R(e,!t),t&&!D(e)?`/${e}`:e.length>0?e:"."},"y");function R(r,e){let t="",n=0,o=-1,i=0,c=null;for(let s=0;s<=r.length;++s){if(s<r.length)c=r[s];else{if(c==="/")break;c="/"}if(c==="/"){if(!(o===s-1||i===1))if(i===2){if(t.length<2||n!==2||t[t.length-1]!=="."||t[t.length-2]!=="."){if(t.length>2){let a=t.lastIndexOf("/");a===-1?(t="",n=0):(t=t.slice(0,a),n=t.length-1-t.lastIndexOf("/")),o=s,i=0;continue}else if(t.length>0){t="",n=0,o=s,i=0;continue}}e&&(t+=t.length>0?"/..":"..",n=2)}else t.length>0?t+=`/${r.slice(o+1,s)}`:t=r.slice(o+1,s),n=s-o-1;o=s,i=0}else c==="."&&i!==-1?++i:i=-1}return t}f(R,"W");p(R,"b");const D=p(function(r){return st.test(r)},"x"),he=p(function(r,e){let t=$(r).replace(V,"$1").split("/"),n=$(e).replace(V,"$1").split("/");if(n[0][1]===":"&&t[0][1]===":"&&t[0]!==n[0])return n.join("/");let o=[...t];for(let i of o){if(n[0]!==i)break;t.shift(),n.shift()}return[...t.map(()=>".."),...n].join("/")},"S"),fe=p(function(r){let e=F(r).replace(/\/$/,"").split("/").slice(0,-1);return e.length===1&&ue.test(e[0])&&(e[0]+="/"),e.join("/")||(D(r)?"/":".")},"C"),me=p(function(r,e){let t=F(r).split("/"),n="";for(let o=t.length-1;o>=0;o--){let i=t[o];if(i){n=i;break}}return e&&n.endsWith(e)?n.slice(0,-e.length):n},"ne");var _=p((r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),"w"),O=Me(import.meta.url);const it=/^path$/i,Q={key:"PATH",value:""};function ge(r){for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e)||!it.test(e))continue;let t=r[e];return t?{key:e,value:t}:Q}return Q}f(ge,"pt");p(ge,"D");function we(r,e){let t=e.value.split(J),n=[],o=r,i;do n.push(We(o,"node_modules",".bin")),i=o,o=Xe(o);while(o!==i);let c=n.concat(t).join(J);return{key:e.key,value:c}}f(we,"ut");p(we,"O");function ve(r,e){let t={...process.env,...e},n=we(r,ge(t));return t[n.key]=n.value,t}f(ve,"ft");p(ve,"k");const at=p(r=>{let e=r.length,t=new ae,n=p(()=>{--e===0&&t.emit("end")},"r");for(let o of r)o.pipe(t,{end:!1}),o.on("end",n);return t},"A");var ct=_(((r,e)=>{e.exports=i,i.sync=c;var t=O("fs");function n(s,a){var l=a.pathExt===void 0?process.env.PATHEXT:a.pathExt;if(!l||(l=l.split(";"),l.indexOf("")!==-1))return!0;for(var u=0;u<l.length;u++){var h=l[u].toLowerCase();if(h&&s.substr(-h.length).toLowerCase()===h)return!0}return!1}f(n,"n"),p(n,"r");function o(s,a,l){return!s.isSymbolicLink()&&!s.isFile()?!1:n(a,l)}f(o,"s"),p(o,"i");function i(s,a,l){t.stat(s,function(u,h){l(u,u?!1:o(h,s,a))})}f(i,"i"),p(i,"a");function c(s,a){return o(t.statSync(s),s,a)}f(c,"c"),p(c,"o")})),lt=_(((r,e)=>{e.exports=n,n.sync=o;var t=O("fs");function n(s,a,l){t.stat(s,function(u,h){l(u,u?!1:i(h,a))})}f(n,"n"),p(n,"r");function o(s,a){return i(t.statSync(s),a)}f(o,"s"),p(o,"i");function i(s,a){return s.isFile()&&c(s,a)}f(i,"i"),p(i,"a");function c(s,a){var l=s.mode,u=s.uid,h=s.gid,d=a.uid===void 0?process.getuid&&process.getuid():a.uid,m=a.gid===void 0?process.getgid&&process.getgid():a.gid,g=64,v=8,E=1,S=g|v;return l&E||l&v&&h===m||l&g&&u===d||l&S&&d===0}f(c,"c"),p(c,"o")})),ut=_(((r,e)=>{O("fs");var t=process.platform==="win32"||global.TESTING_WINDOWS?ct():lt();e.exports=n,n.sync=o;function n(i,c,s){if(typeof c=="function"&&(s=c,c={}),!s){if(typeof Promise!="function")throw TypeError("callback not provided");return new Promise(function(a,l){n(i,c||{},function(u,h){u?l(u):a(h)})})}t(i,c||{},function(a,l){a&&(a.code==="EACCES"||c&&c.ignoreErrors)&&(a=null,l=!1),s(a,l)})}f(n,"n"),p(n,"r");function o(i,c){try{return t.sync(i,c||{})}catch(s){if(c&&c.ignoreErrors||s.code==="EACCES")return!1;throw s}}f(o,"s"),p(o,"i")})),pt=_(((r,e)=>{let t=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",n=O("path"),o=t?";":":",i=ut(),c=p(l=>Object.assign(Error(`not found: ${l}`),{code:"ENOENT"}),"o"),s=p((l,u)=>{let h=u.colon||o,d=l.match(/\//)||t&&l.match(/\\/)?[""]:[...t?[process.cwd()]:[],...(u.path||process.env.PATH||"").split(h)],m=t?u.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",g=t?m.split(h):[""];return t&&l.indexOf(".")!==-1&&g[0]!==""&&g.unshift(""),{pathEnv:d,pathExt:g,pathExtExe:m}},"s"),a=p((l,u,h)=>{typeof u=="function"&&(h=u,u={}),u||={};let{pathEnv:d,pathExt:m,pathExtExe:g}=s(l,u),v=[],E=p(b=>new Promise((A,T)=>{if(b===d.length)return u.all&&v.length?A(v):T(c(l));let y=d[b],G=/^".*"$/.test(y)?y.slice(1,-1):y,P=n.join(G,l);A(S(!G&&/^\.[\\\/]/.test(l)?l.slice(0,2)+P:P,b,0))}),"d"),S=p((b,A,T)=>new Promise((y,G)=>{if(T===m.length)return y(E(A+1));let P=m[T];i(b+P,{pathExt:g},(ze,Ie)=>{if(!ze&&Ie)if(u.all)v.push(b+P);else return y(b+P);return y(S(b,A,T+1))})}),"f");return h?E(0).then(b=>h(null,b),h):E(0)},"c");e.exports=a,a.sync=(l,u)=>{u||={};let{pathEnv:h,pathExt:d,pathExtExe:m}=s(l,u),g=[];for(let v=0;v<h.length;v++){let E=h[v],S=/^".*"$/.test(E)?E.slice(1,-1):E,b=n.join(S,l),A=!S&&/^\.[\\\/]/.test(l)?l.slice(0,2)+b:b;for(let T=0;T<d.length;T++){let y=A+d[T];try{if(i.sync(y,{pathExt:m}))if(u.all)g.push(y);else return y}catch{}}}if(u.all&&g.length)return g;if(u.nothrow)return null;throw c(l)}})),dt=_(((r,e)=>{let t=p((n={})=>{let o=n.env||process.env;return(n.platform||process.platform)==="win32"?Object.keys(o).reverse().find(i=>i.toUpperCase()==="PATH")||"Path":"PATH"},"n");e.exports=t,e.exports.default=t})),ht=_(((r,e)=>{let t=O("path"),n=pt(),o=dt();function i(s,a){let l=s.options.env||process.env,u=process.cwd(),h=s.options.cwd!=null,d=h&&process.chdir!==void 0&&!process.chdir.disabled;if(d)try{process.chdir(s.options.cwd)}catch{}let m;try{m=n.sync(s.command,{path:l[o({env:l})],pathExt:a?t.delimiter:void 0})}catch{}finally{d&&process.chdir(u)}return m&&=t.resolve(h?s.options.cwd:"",m),m}f(i,"i"),p(i,"a");function c(s){return i(s)||i(s,!0)}f(c,"c"),p(c,"o"),e.exports=c})),ft=_(((r,e)=>{let t=/([()\][%!^"`<>&|;, *?])/g;function n(i){return i=i.replace(t,"^$1"),i}f(n,"n"),p(n,"r");function o(i,c){return i=`${i}`,i=i.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),i=i.replace(/(?=(\\+?)?)\1$/,"$1$1"),i=`"${i}"`,i=i.replace(t,"^$1"),c&&(i=i.replace(t,"^$1")),i}f(o,"s"),p(o,"i"),e.exports.command=n,e.exports.argument=o})),mt=_(((r,e)=>{e.exports=/^#!(.*)/})),gt=_(((r,e)=>{let t=mt();e.exports=(n="")=>{let o=n.match(t);if(!o)return null;let[i,c]=o[0].replace(/#! ?/,"").split(" "),s=i.split("/").pop();return s==="env"?c:c?`${s} ${c}`:s}})),wt=_(((r,e)=>{let t=O("fs"),n=gt();function o(i){let c=Buffer.alloc(150),s;try{s=t.openSync(i,"r"),t.readSync(s,c,0,150,0),t.closeSync(s)}catch{}return n(c.toString())}f(o,"s"),p(o,"i"),e.exports=o})),vt=_(((r,e)=>{let t=O("path"),n=ht(),o=ft(),i=wt(),c=process.platform==="win32",s=/\.(?:com|exe)$/i,a=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function l(d){d.file=n(d);let m=d.file&&i(d.file);return m?(d.args.unshift(d.file),d.command=m,n(d)):d.file}f(l,"p"),p(l,"l");function u(d){if(!c)return d;let m=l(d),g=!s.test(m);if(d.options.forceShell||g){let v=a.test(m);d.command=t.normalize(d.command),d.command=o.command(d.command),d.args=d.args.map(E=>o.argument(E,v)),d.args=["/d","/s","/c",`"${[d.command].concat(d.args).join(" ")}"`],d.command=process.env.comspec||"cmd.exe",d.options.windowsVerbatimArguments=!0}return d}f(u,"u"),p(u,"u");function h(d,m,g){m&&!Array.isArray(m)&&(g=m,m=null),m=m?m.slice(0):[],g=Object.assign({},g);let v={command:d,args:m,options:g,file:void 0,original:{command:d,args:m}};return g.shell?v:u(v)}f(h,"d"),p(h,"d"),e.exports=h})),$t=_(((r,e)=>{let t=process.platform==="win32";function n(s,a){return Object.assign(Error(`${a} ${s.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${a} ${s.command}`,path:s.command,spawnargs:s.args})}f(n,"n"),p(n,"r");function o(s,a){if(!t)return;let l=s.emit;s.emit=function(u,h){if(u==="exit"){let d=i(h,a);if(d)return l.call(s,"error",d)}return l.apply(s,arguments)}}f(o,"s"),p(o,"i");function i(s,a){return t&&s===1&&!a.file?n(a.original,"spawn"):null}f(i,"i"),p(i,"a");function c(s,a){return t&&s===1&&!a.file?n(a.original,"spawnSync"):null}f(c,"c"),p(c,"o"),e.exports={hookChildProcess:o,verifyENOENT:i,verifyENOENTSync:c,notFoundError:n}})),bt=_(((r,e)=>{let t=O("child_process"),n=vt(),o=$t();function i(s,a,l){let u=n(s,a,l),h=t.spawn(u.command,u.args,u.options);return o.hookChildProcess(h,u),h}f(i,"i"),p(i,"a");function c(s,a,l){let u=n(s,a,l),h=t.spawnSync(u.command,u.args,u.options);return h.error=h.error||o.verifyENOENTSync(h.status,u),h}f(c,"c"),p(c,"o"),e.exports=i,e.exports.spawn=i,e.exports.sync=c,e.exports._parse=n,e.exports._enoent=o}))(),ee=class extends Error{static{f(this,"L")}static{p(this,"U")}result;output;get exitCode(){if(this.result.exitCode!==null)return this.result.exitCode}constructor(r,e){super(`Process exited with non-zero status (${r.exitCode})`),this.result=r,this.output=e}};const _t={timeout:void 0,persist:!1},Et={windowsHide:!0};function $e(r,e){return{command:qe(r),args:e??[]}}f($e,"Pt");p($e,"K");function be(r){let e=new AbortController;for(let t of r){if(t.aborted)return e.abort(),t;t.addEventListener("abort",()=>{e.abort(t.reason)},{signal:e.signal})}return e.signal}f(be,"Tt");p(be,"q");async function B(r){let e="";for await(let t of r)e+=t.toString();return e}f(B,"H");p(B,"J");var yt=class{static{f(this,"At")}static{p(this,"Y")}_process;_aborted=!1;_options;_command;_args;_resolveClose;_processClosed;_thrownError;get process(){return this._process}get pid(){return this._process?.pid}get exitCode(){if(this._process&&this._process.exitCode!==null)return this._process.exitCode}constructor(r,e,t){this._options={..._t,...t},this._command=r,this._args=e??[],this._processClosed=new Promise(n=>{this._resolveClose=n})}kill(r){return this._process?.kill(r)===!0}get aborted(){return this._aborted}get killed(){return this._process?.killed===!0}pipe(r,e,t){return xt(r,e,{...t,stdin:this})}async*[Symbol.asyncIterator](){let r=this._process;if(!r)return;let e=[];this._streamErr&&e.push(this._streamErr),this._streamOut&&e.push(this._streamOut);let t=at(e),n=Ye.createInterface({input:t});for await(let o of n)yield o.toString();if(await this._processClosed,r.removeAllListeners(),this._thrownError)throw this._thrownError;if(this._options?.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new ee(this)}async _waitForOutput(){let r=this._process;if(!r)throw Error("No process was started");let[e,t]=await Promise.all([this._streamOut?B(this._streamOut):"",this._streamErr?B(this._streamErr):""]);if(await this._processClosed,this._options?.stdin&&await this._options.stdin,r.removeAllListeners(),this._thrownError)throw this._thrownError;let n={stderr:t,stdout:e,exitCode:this.exitCode};if(this._options.throwOnError&&this.exitCode!==0&&this.exitCode!==void 0)throw new ee(this,n);return n}then(r,e){return this._waitForOutput().then(r,e)}_streamOut;_streamErr;spawn(){let r=Je(),e=this._options,t={...Et,...e.nodeOptions},n=[];this._resetState(),e.timeout!==void 0&&n.push(AbortSignal.timeout(e.timeout)),e.signal!==void 0&&n.push(e.signal),e.persist===!0&&(t.detached=!0),n.length>0&&(t.signal=be(n)),t.env=ve(r,t.env);let{command:o,args:i}=$e(this._command,this._args),c=(0,bt._parse)(o,i,t),s=ce(c.command,c.args,c.options);if(s.stderr&&(this._streamErr=s.stderr),s.stdout&&(this._streamOut=s.stdout),this._process=s,s.once("error",this._onError),s.once("close",this._onClose),e.stdin!==void 0&&s.stdin&&e.stdin.process){let{stdout:a}=e.stdin.process;a&&a.pipe(s.stdin)}}_resetState(){this._aborted=!1,this._processClosed=new Promise(r=>{this._resolveClose=r}),this._thrownError=void 0}_onError=p(r=>{if(r.name==="AbortError"&&(!(r.cause instanceof Error)||r.cause.name!=="TimeoutError")){this._aborted=!0;return}this._thrownError=r},"_onError");_onClose=p(()=>{this._resolveClose&&this._resolveClose()},"_onClose")};const U=p((r,e,t)=>{let n=new yt(r,e,t);return n.spawn(),n},"X"),xt=U;var kt=tt({detectPackageManager:p(()=>W,"detectPackageManager"),installDependencies:p(()=>Te,"installDependencies"),packageManagers:p(()=>j,"packageManagers")});async function _e(r,e,t={}){let n=pe(r).split("/");for(;n.length>0;){let o=await e(n.join("/")||"/");if(o||!t.includeParentDirs)return o;n.pop()}}f(_e,"Mt");p(_e,"se");function Ee(r){let e;return()=>(e===void 0&&(e=r().then(t=>(e=t,e))),e)}f(Ee,"zt");p(Ee,"ce");const Tt=Ee(async()=>{if(globalThis.process?.versions?.webcontainer)return!1;try{let{exitCode:r}=await U("corepack",["--version"]);return r===0}catch{return!1}});async function ye(r,e,t={}){let n=r!=="npm"&&r!=="bun"&&r!=="deno"&&t.corepack!==!1&&await Tt()?["corepack",[r,...e]]:[r,e],{exitCode:o,stdout:i,stderr:c}=await U(n[0],n[1],{nodeOptions:{cwd:$(t.cwd||process.cwd()),env:t.env,stdio:t.silent?"pipe":"inherit"}});if(o!==0)throw Error(`\`${n.flat().join(" ")}\` failed.${t.silent?["",i,c].join(`
|
|
2
|
+
`):""}`)}f(ye,"Lt");p(ye,"le");async function xe(r={}){let e=r.cwd||process.cwd(),t={...process.env,...r.env},n=(typeof r.packageManager=="string"?j.find(o=>o.name===r.packageManager):r.packageManager)||await W(r.cwd||process.cwd());if(!n)throw Error("No package manager auto-detected.");return{cwd:e,env:t,silent:r.silent??!1,packageManager:n,dev:r.dev??!1,workspace:r.workspace,global:r.global??!1,dry:r.dry??!1,corepack:r.corepack??!0}}f(xe,"Ht");p(xe,"ue");function ke(r){let[e,t]=(r||"").split("@"),[n,o]=t?.split("+")||[];if(e&&e!=="-"&&/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(e))return{name:e,version:n,buildMeta:o};let i=(e||"").replace(/\W+/g,"");return{name:i,version:n,buildMeta:o,warnings:[`Abnormal characters found in \`packageManager\` field, sanitizing from \`${e}\` to \`${i}\``]}}f(ke,"Dt");p(ke,"de");const j=[{name:"npm",command:"npm",lockFile:"package-lock.json"},{name:"pnpm",command:"pnpm",lockFile:"pnpm-lock.yaml",files:["pnpm-workspace.yaml"]},{name:"bun",command:"bun",lockFile:["bun.lockb","bun.lock"]},{name:"yarn",command:"yarn",lockFile:"yarn.lock",files:[".yarnrc.yml"]},{name:"deno",command:"deno",lockFile:"deno.lock",files:["deno.json"]}];async function W(r,e={}){let t=await _e($(r||"."),async n=>{if(!e.ignorePackageJSON){let o=K(n,"package.json");if(x(o)){let i=JSON.parse(await ie(o,"utf8"));if(i?.packageManager){let{name:c,version:s="0.0.0",buildMeta:a,warnings:l}=ke(i.packageManager);if(c){let u=s.split(".")[0],h=j.find(d=>d.name===c&&d.majorVersion===u)||j.find(d=>d.name===c);return{name:c,command:c,version:s,majorVersion:u,buildMeta:a,warnings:l,files:h?.files,lockFile:h?.lockFile}}}}if(x(K(n,"deno.json")))return j.find(i=>i.name==="deno")}if(!e.ignoreLockFile){for(let o of j)if([o.lockFile,o.files].flat().filter(Boolean).some(i=>x($(n,i))))return{...o}}},{includeParentDirs:e.includeParentDirs??!0});if(!t&&!e.ignoreArgv){let n=process.argv[1];if(n){for(let o of j)if(RegExp(`[/\\\\]\\.?${o.command}`).test(n))return o}}return t}f(W,"Z$1");p(W,"$");async function Te(r={}){let e=await xe(r),t=r.frozenLockFile?{npm:["ci"],yarn:["install","--immutable"],bun:["install","--frozen-lockfile"],pnpm:["install","--frozen-lockfile"],deno:["install","--frozen"]}[e.packageManager.name]:["install"];return r.ignoreWorkspace&&e.packageManager.name==="pnpm"&&t.push("--ignore-workspace"),e.dry||await ye(e.packageManager.command,t,{cwd:e.cwd,silent:e.silent,corepack:e.corepack}),{exec:{command:e.packageManager.command,args:t}}}f(Te,"It");p(Te,"fe");const Ct=Object.defineProperty({__proto__:null,a:$,i:he,n:me,r:fe,t:kt},Symbol.toStringTag,{value:"Module"});var Ot=Object.defineProperty,w=f((r,e)=>Ot(r,"name",{value:e,configurable:!0}),"o");async function Ce(r,e,t={}){const n=e+".json",o=JSON.parse(await ie(n,"utf8").catch(()=>"{}")),i=(await I(r,{method:"HEAD",headers:t.headers}).catch(()=>{}))?.headers.get("etag");if(o.etag===i&&x(e))return;typeof i=="string"&&(o.etag=i);const c=await I(r,{headers:t.headers});if(c.status>=400)throw new Error(`Failed to download ${r}: ${c.status} ${c.statusText}`);const s=se(e);await Ke(Re)(c.body,s),await Be(n,JSON.stringify(o),"utf8")}f(Ce,"q");w(Ce,"download");const St=/^(?<repo>[-\w.]+\/[-\w.]+)(?<subdir>[^#]+)?(?<ref>#[-\w./@]+)?/,At=/^(?<repo>[-\w.]+(?:\/[-\w.]+)+?)(?:::(?<subdir>[^#]*))?(?<ref>#[-\w./@]+)?$/;function N(r,e){const t=e?.expandRepo||r.includes("::"),n=r.match(t?At:St)?.groups||{},o=t?n.subdir?"/"+n.subdir:"/":n.subdir||"/";return{repo:n.repo||"",subdir:o,ref:n.ref?n.ref.slice(1):"main"}}f(N,"x");w(N,"parseGitURI");function C(...r){process.env.DEBUG&&console.debug("[giget]",...r)}f(C,"$");w(C,"debug");async function I(r,e={}){e.headers?.["sec-fetch-mode"]&&(e.mode=e.headers["sec-fetch-mode"]);const t=await fetch(r,{...e,headers:X(e.headers)}).catch(n=>{throw new Error(`Failed to download ${r}: ${n}`,{cause:n})});if(e.validateStatus&&t.status>=400)throw new Error(`Failed to fetch ${r}: ${t.status} ${t.statusText}`);return t}f(I,"v");w(I,"sendFetch");function Oe(){const r=process.env.XDG_CACHE_HOME?$(process.env.XDG_CACHE_HOME,"giget"):$(Ve(),".cache/giget");if(process.platform==="win32"){const e=$(le(),"giget");if(!x(e)&&x(r))try{He(r,e)}catch{}return e}return r}f(Oe,"ee");w(Oe,"cacheDirectory");function X(r={}){const e={};for(const[t,n]of Object.entries(r))n&&(e[t.toLowerCase()]=n);return e}f(X,"F");w(X,"normalizeHeaders");function Se(){return process.env.SHELL?process.env.SHELL:process.platform==="win32"?"cmd.exe":"/bin/bash"}f(Se,"te");w(Se,"currentShell");function jt(r){r=$(r);const e=Se();console.info(`(experimental) Opening shell in ${he(process.cwd(),r)}...`),Ue(e,[],{cwd:r,shell:!0,stdio:"inherit"})}f(jt,"re");w(jt,"startShell");const Pt=w((r,e)=>{const t=Ae(r);return{name:t.name,version:t.subdir?`${t.version||"default"}-${t.subdir.replaceAll("/","-")}`:t.version,tar:w(({auth:n}={})=>je(t,n??e.auth),"tar")}},"git");function Ae(r,e={}){const t=e.cwd??process.cwd();let n=r.replace(/#.*$/,""),o;if(/^[./]/.test(r))n=$(t,n);else if(/^https?:\/\//.test(n)){const u=/^(https?:\/\/[^/]+)\/([\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(u){const[,h,d,m]=u;n=`${h}/${d}`,m&&(o=m)}}else if(n.includes("@")){const u=/^(.*?:[\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(u){const[,h,d]=u;n=h,d&&(o=d)}}else{const u={"github:":"https://github.com/","gh:":"https://github.com/","gitlab:":"https://gitlab.com/","bitbucket:":"https://bitbucket.org/","sourcehut:":"https://git.sr.ht/~"},h=/^(.+?:)/.exec(n)?.at(1);h&&u[h]?n=n.replace(h,u[h]):h||(n=`${(process.env.GIGET_GIT_HOST||"https://github.com/").replace(/\/$/,"")}/${n}`);const d=/^(https?:\/\/[^/]+\/~?[\w.-]+\/[\w.-]+?)(?:\.git)?(?:\/(.+))?$/.exec(n);if(d){const[,m,g]=d;n=m,g&&(o=g)}}const i=n.replace(/^https?:\/\//,"").replace(/^.+@/,"").replace(/(\.git)?(#.*)?$/,"").replace(/^\W+/,"").replaceAll(/[:/]/g,"-"),[c,s]=/#(.+)$/.exec(r)?.at(1)?.split(":")??[],a=c||void 0,l=s||o;return{uri:n,name:i,...a&&{version:a},...l&&{subdir:l}}}f(Ae,"ie");w(Ae,"parseGitCloneURI");async function je(r,e){const t=await Le(Y(le(),"giget-git-"));if(e&&/[\r\n]/.test(e))throw new Error("Auth token must not contain newline characters");const n={...process.env,GIT_TERMINAL_PROMPT:"0"};e&&(n.GIT_CONFIG_COUNT="1",n.GIT_CONFIG_KEY_0="http.extraHeader",n.GIT_CONFIG_VALUE_0=`Authorization: Bearer ${e}`);const o={env:n,timeout:6e4},i=Pe(),c=w(a=>L(a,o,i),"gitExec"),s=w(a=>L(a,{...o,cwd:t},i),"gitExecIn");try{const a=["clone","--progress","--depth","1"];r.subdir&&a.push("--filter=blob:none","--sparse","--no-checkout"),r.version&&a.push("--branch",r.version),a.push("--",r.uri,t);try{i.update("Cloning..."),await c(a),i.update("Cloned.")}catch(g){if(!r.version)throw g;C("Shallow clone failed, falling back to full clone:",g),i.update("Shallow clone failed, cloning..."),await M(t,{recursive:!0,force:!0}),await H(t,{recursive:!0}),await s(["init"]),await s(["remote","add","origin",r.uri]),await s(["fetch","origin"]),await s(["checkout",r.version]),i.update("Fetched.")}r.subdir&&(i.update(`Sparse checkout ${r.subdir}...`),await s(["sparse-checkout","set",r.subdir]),await s(["checkout"])),i.update("Packing...");const l=r.subdir?Y(t,r.subdir):t,{create:u}=await import("../packem_chunks/tar.js").then(g=>g.t);i.done();const h=u({gzip:!0,cwd:l,filter:w(g=>!g.startsWith(".git/")&&g!==".git"&&!g.startsWith("./.git/")&&g!=="./.git","filter")},["."]).pipe(new ae);let d=!1;const m=w(()=>{d||(d=!0,M(t,{recursive:!0,force:!0}))},"cleanup");return h.on("end",m),h.on("error",m),h.on("close",m),h}catch(a){throw i.done(),await M(t,{recursive:!0,force:!0}),a}}f(je,"se");w(je,"_cloneAndTar");const te=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"];function L(r,e,t){return new Promise((n,o)=>{const i=ce("git",r,{...e,stdio:["ignore","pipe","pipe"]});i.stdout.resume();let c="";i.stderr?.on("data",s=>{const a=s.toString();for(const l of a.split(/[\r\n]/)){const u=l.trim();u&&(c=u)}t&&t.update(c)}),i.on("close",s=>{s===0?n(c):o(new Error(`git ${r[0]} exited with code ${s}. Is git installed?`))}),i.on("error",s=>{s.code==="ENOENT"?o(new Error("git is not installed or not found in PATH")):o(s)})})}f(L,"G");w(L,"_gitSpawn");function Pe(){if(!process.stderr.isTTY)return{update(o){},done(){}};let r="",e=0;const t=w(()=>{const o=te[e%te.length];e++,process.stderr.write(`\x1B[2K\r\x1B[2m${o} ${r}\x1B[0m`)},"render"),n=setInterval(t,80);return{update(o){r=o,t()},done(){clearInterval(n),process.stderr.write("\x1B[2K\r")}}}f(Pe,"ne");w(Pe,"_createStatus");const re=w(async(r,e)=>{if(r.endsWith(".json"))return await ne(r,e);const t=new URL(r);let n=me(t.pathname);try{const o=await I(t.href,{method:"HEAD",validateStatus:!0,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}});if((o.headers.get("content-type")||"").includes("application/json"))return await ne(r,e);const i=o.headers.get("content-disposition")?.match(/filename="?(.+)"?/)?.[1];i&&(n=i.split(".")[0])}catch(o){C(`Failed to fetch HEAD for ${t.href}:`,o)}return{name:`${n}-${t.href.slice(0,8)}`,version:"",subdir:"",tar:t.href,defaultDir:n,headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0}}},"http"),ne=w(async(r,e)=>{const t=await(await I(r,{validateStatus:!0,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}})).json();if(!t.tar||!t.name)throw new Error(`Invalid template info from ${r}. name or tar fields are missing!`);return t},"_httpJSON"),oe=w((r,e)=>{const t=N(r),n=process.env.GIGET_GITHUB_URL||"https://api.github.com";return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0,Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"},url:`${n.replace("api.github.com","github.com")}/${t.repo}/tree/${t.ref}${t.subdir}`,tar:`${n}/repos/${t.repo}/tarball/${t.ref}`}},"github"),zt=w((r,e)=>{const t=N(r,{expandRepo:!0}),n=process.env.GIGET_GITLAB_URL||"https://gitlab.com";return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0,"sec-fetch-mode":"same-origin"},url:`${n}/${t.repo}/tree/${t.ref}${t.subdir}`,tar:`${n}/${t.repo}/-/archive/${t.ref}.tar.gz`}},"gitlab"),It=w((r,e)=>{const t=N(r);return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0},url:`https://bitbucket.com/${t.repo}/src/${t.ref}${t.subdir}`,tar:`https://bitbucket.org/${t.repo}/get/${t.ref}.tar.gz`}},"bitbucket"),Dt=w((r,e)=>{const t=N(r);return{name:t.repo.replace("/","-"),version:t.ref,subdir:t.subdir,headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0},url:`https://git.sr.ht/~${t.repo}/tree/${t.ref}/item${t.subdir}`,tar:`https://git.sr.ht/~${t.repo}/archive/${t.ref}.tar.gz`}},"sourcehut"),Ft={http:re,https:re,git:Pt,github:oe,gh:oe,gitlab:zt,bitbucket:It,sourcehut:Dt},Nt="https://raw.githubusercontent.com/unjs/giget/main/templates",Mt=w((r=Nt,e={})=>(async t=>{const n=Date.now(),o=`${r}/${t}.json`,i=await I(o,{headers:{authorization:e.auth?`Bearer ${e.auth}`:void 0}});if(i.status>=400)throw new Error(`Failed to download ${t} template info from ${o}: ${i.status} ${i.statusText}`);const c=await i.json();if(!c.tar||!c.name)throw new Error(`Invalid template info from ${o}. name or tar fields are missing!`);return C(`Fetched ${t} template info from ${o} in ${Date.now()-n}ms`),c}),"registryProvider"),Gt=/^([\w+-.]+):/;async function Ht(r,e={}){e.registry=process.env.GIGET_REGISTRY??e.registry,e.auth=process.env.GIGET_AUTH??e.auth;const t=e.registry===!1?void 0:Mt(e.registry,{auth:e.auth});let n=e.provider||(t?"registry":"github"),o=r;const i=r.match(Gt);i&&(n=i[1],o=r.slice(i[0].length),(n==="http"||n==="https")&&(o=r)),n.endsWith("+git")&&(o=`${n.slice(0,-4)}:${o}`,n="git");const c=e.providers?.[n]||Ft[n]||t;if(!c)throw new Error(`Unsupported provider: ${n}`);const s=await Promise.resolve().then(()=>c(o,{auth:e.auth})).catch(m=>{throw new Error(`Failed to download template from ${n}: ${m.message}`)});if(!s)throw new Error(`Failed to resolve template from ${n}`);s.name=(s.name||"template").replace(/[^\da-z-]/gi,"-"),s.defaultDir=(s.defaultDir||s.name).replace(/[^\da-z-]/gi,"-");const a=$($(Oe(),n,s.name),(s.version||s.name)+".tar.gz");if(e.preferOffline&&x(a)&&(e.offline=!0),!e.offline){await H(fe(a),{recursive:!0});const m=Date.now();if(typeof s.tar=="function"){const g=s.tar;await(async()=>{const v=await g({auth:e.auth});await Ze(v instanceof q?v:q.fromWeb(v),se(a))})().catch(v=>{if(!x(a))throw v;C("Download error. Using cached version:",v),e.offline=!0})}else await Ce(s.tar,a,{headers:{Authorization:e.auth?`Bearer ${e.auth}`:void 0,...X(s.headers)}}).catch(g=>{if(!x(a))throw g;C("Download error. Using cached version:",g),e.offline=!0});C(`Downloaded to ${a} in ${Date.now()-m}ms`)}if(!x(a))throw new Error(`Tarball not found: ${a} (offline: ${e.offline})`);const l=$($(e.cwd||"."),e.dir||s.defaultDir);if(e.forceClean&&await M(l,{recursive:!0,force:!0}),!e.force&&x(l)&&Ge(l).length>0)throw new Error(`Destination ${l} already exists.`);await H(l,{recursive:!0});const u=Date.now(),h=s.subdir?.replace(/^\//,"")||"",{extract:d}=await import("../packem_chunks/tar.js").then(m=>m.t);if(await d({file:a,cwd:l,onReadEntry(m){m.path=m.path.split("/").splice(1).join("/"),h&&(m.path.startsWith(h+"/")?m.path=m.path.slice(h.length):m.path="")}}),C(`Extracted to ${l} in ${Date.now()-u}ms`),e.install){C("Installing dependencies...");const{installDependencies:m}=await Promise.resolve().then(()=>Ct).then(g=>g.t);await m({cwd:l,silent:e.silent,...typeof e.install=="object"?e.install:{}})}return{...s,source:o,dir:l}}f(Ht,"fe");w(Ht,"downloadTemplate");export{Ht as f,tt as p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var Me=Object.defineProperty;var _=(t,e)=>Me(t,"name",{value:e,configurable:!0});import{createRequire as Fe}from"node:module";const Ge=Fe(import.meta.url),bt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ue=_(t=>{if(typeof bt<"u"&&bt.versions&&bt.versions.node){const[e,n]=bt.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return bt.getBuiltinModule(t)}return Ge(t)},"__cjs_getBuiltinModule"),{createRequire:qe}=Ue("node:module");var Xe=Object.defineProperty,Ke=_((t,e)=>Xe(t,"name",{value:e,configurable:!0}),"o");function ee(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}_(ee,"l");Ke(ee,"o");var We=Object.defineProperty,$=_((t,e)=>We(t,"name",{value:e,configurable:!0}),"E$1"),Kt={},Ot,Wt;function Et(){if(Wt)return Ot;Wt=1;const t="[^\\\\/]",e=Symbol("unignore"),n="\\.",l="\\+",c="\\?",o="\\/",r="(?=.)",h="[^/]",y=`(?:${o}|$)`,k=`(?:^|${o})`,S=`${n}{1,2}${y}`,H=`(?!${n})`,N=`(?!${k}${S})`,E=`(?!${n}{0,1}${y})`,L=`(?!${S})`,I=`[^.${o}]`,O=`${h}*?`,Q="/",p={DOT_LITERAL:n,PLUS_LITERAL:l,QMARK_LITERAL:c,SLASH_LITERAL:o,ONE_CHAR:r,QMARK:h,END_ANCHOR:y,DOTS_SLASH:S,NO_DOT:H,NO_DOTS:N,NO_DOT_SLASH:E,NO_DOTS_SLASH:L,QMARK_NO_DOT:I,STAR:O,START_ANCHOR:k,SEP:Q},A={...p,SLASH_LITERAL:"[\\\\/]",QMARK:t,STAR:`${t}*?`,DOTS_SLASH:`${n}{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!${n})`,NO_DOTS:`(?!(?:^|[\\\\/])${n}{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!${n}{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!${n}{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},s={__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 Ot={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:s,UNIGNORE:e,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(b){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${b.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(b){return b===!0?A:p}},Ot}_(Et,"Et$1");$(Et,"ht");var jt;function vt(){return jt||(jt=1,(function(t){const{REGEX_BACKSLASH:e,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:l,REGEX_SPECIAL_CHARS_GLOBAL:c}=Et();t.isObject=o=>o!==null&&typeof o=="object"&&!Array.isArray(o),t.hasRegexChars=o=>l.test(o),t.isRegexChar=o=>o.length===1&&t.hasRegexChars(o),t.escapeRegex=o=>o.replace(c,"\\$1"),t.toPosixSlashes=o=>o.replace(e,"/"),t.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const o=navigator.platform.toLowerCase();return o==="win32"||o==="windows"}return process.platform?process.platform==="win32":!1},t.removeBackslashes=o=>o.replace(n,r=>r==="\\"?"":r),t.escapeLast=(o,r,h)=>{const y=o.lastIndexOf(r,h);return y===-1?o:o[y-1]==="\\"?t.escapeLast(o,r,y-1):`${o.slice(0,y)}\\${o.slice(y)}`},t.removePrefix=(o,r={})=>{let h=o;return h.startsWith("./")&&(h=h.slice(2),r.prefix="./"),h},t.wrapOutput=(o,r={},h={})=>{const y=h.contains?"":"^",k=h.contains?"":"$";let S=`${y}(?:${o})${k}`;return r.negated===!0&&(S=`(?:^(?!${S}).*$)`),S},t.basename=(o,{windows:r}={})=>{const h=o.split(r?/[\\/]/:"/"),y=h[h.length-1];return y===""?h[h.length-2]:y}})(Kt)),Kt}_(vt,"ht$1");$(vt,"gt");var wt,Qt;function ne(){if(Qt)return wt;Qt=1;const t=vt(),{CHAR_ASTERISK:e,CHAR_AT:n,CHAR_BACKWARD_SLASH:l,CHAR_COMMA:c,CHAR_DOT:o,CHAR_EXCLAMATION_MARK:r,CHAR_FORWARD_SLASH:h,CHAR_LEFT_CURLY_BRACE:y,CHAR_LEFT_PARENTHESES:k,CHAR_LEFT_SQUARE_BRACKET:S,CHAR_PLUS:H,CHAR_QUESTION_MARK:N,CHAR_RIGHT_CURLY_BRACE:E,CHAR_RIGHT_PARENTHESES:L,CHAR_RIGHT_SQUARE_BRACKET:I}=Et(),O=$(p=>p===h||p===l,"j"),Q=$(p=>{p.isPrefix!==!0&&(p.depth=p.isGlobstar?1/0:1)},"q");return wt=$((p,A)=>{const s=A||{},b=p.length-1,v=s.parts===!0||s.scanToEnd===!0,x=[],R=[],m=[];let G=p,B=-1,q=0,st=0,V=!1,ot=!1,X=!1,ct=!1,gt=!1,ut=!1,F=!1,it=!1,dt=!1,J=!1,Z=0,et,C,P={value:"",depth:0,isGlob:!1};const a=$(()=>B>=b,"M"),tt=$(()=>G.charCodeAt(B+1),"et"),z=$(()=>(et=C,G.charCodeAt(++B)),"W");for(;B<b;){C=z();let D;if(C===l){F=P.backslashes=!0,C=z(),C===y&&(ut=!0);continue}if(ut===!0||C===y){for(Z++;a()!==!0&&(C=z());){if(C===l){F=P.backslashes=!0,z();continue}if(C===y){Z++;continue}if(ut!==!0&&C===o&&(C=z())===o){if(V=P.isBrace=!0,X=P.isGlob=!0,J=!0,v===!0)continue;break}if(ut!==!0&&C===c){if(V=P.isBrace=!0,X=P.isGlob=!0,J=!0,v===!0)continue;break}if(C===E&&(Z--,Z===0)){ut=!1,V=P.isBrace=!0,J=!0;break}}if(v===!0)continue;break}if(C===h){if(x.push(B),R.push(P),P={value:"",depth:0,isGlob:!1},J===!0)continue;if(et===o&&B===q+1){q+=2;continue}st=B+1;continue}if(s.noext!==!0&&(C===H||C===n||C===e||C===N||C===r)&&tt()===k){if(X=P.isGlob=!0,ct=P.isExtglob=!0,J=!0,C===r&&B===q&&(dt=!0),v===!0){for(;a()!==!0&&(C=z());){if(C===l){F=P.backslashes=!0,C=z();continue}if(C===L){X=P.isGlob=!0,J=!0;break}}continue}break}if(C===e){if(et===e&&(gt=P.isGlobstar=!0),X=P.isGlob=!0,J=!0,v===!0)continue;break}if(C===N){if(X=P.isGlob=!0,J=!0,v===!0)continue;break}if(C===S){for(;a()!==!0&&(D=z());){if(D===l){F=P.backslashes=!0,z();continue}if(D===I){ot=P.isBracket=!0,X=P.isGlob=!0,J=!0;break}}if(v===!0)continue;break}if(s.nonegate!==!0&&C===r&&B===q){it=P.negated=!0,q++;continue}if(s.noparen!==!0&&C===k){if(X=P.isGlob=!0,v===!0){for(;a()!==!0&&(C=z());){if(C===k){F=P.backslashes=!0,C=z();continue}if(C===L){J=!0;break}}continue}break}if(X===!0){if(J=!0,v===!0)continue;break}}s.noext===!0&&(ct=!1,X=!1);let j=G,u="",i="";q>0&&(u=G.slice(0,q),G=G.slice(q),st-=q),j&&X===!0&&st>0?(j=G.slice(0,st),i=G.slice(st)):X===!0?(j="",i=G):j=G,j&&j!==""&&j!=="/"&&j!==G&&O(j.charCodeAt(j.length-1))&&(j=j.slice(0,-1)),s.unescape===!0&&(i&&(i=t.removeBackslashes(i)),j&&F===!0&&(j=t.removeBackslashes(j)));const rt={prefix:u,input:p,start:q,base:j,glob:i,isBrace:V,isBracket:ot,isGlob:X,isExtglob:ct,isGlobstar:gt,negated:it,negatedExtglob:dt};if(s.tokens===!0&&(rt.maxDepth=0,O(C)||R.push(P),rt.tokens=R),s.parts===!0||s.tokens===!0){let D;for(let K=0;K<x.length;K++){const pt=D?D+1:q,nt=x[K],ht=p.slice(pt,nt);s.tokens&&(K===0&&q!==0?(R[K].isPrefix=!0,R[K].value=u):R[K].value=ht,Q(R[K]),rt.maxDepth+=R[K].depth),(K!==0||ht!=="")&&m.push(ht),D=nt}if(D&&D+1<p.length){const K=p.slice(D+1);m.push(K),s.tokens&&(R[R.length-1].value=K,Q(R[R.length-1]),rt.maxDepth+=R[R.length-1].depth)}rt.slashes=x,rt.parts=m}return rt},"yt"),wt}_(ne,"It$1");$(ne,"kt");var Ht,zt;function re(){if(zt)return Ht;zt=1;const t=Et(),e=vt(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:l,REGEX_NON_SPECIAL_CHARS:c,REGEX_SPECIAL_CHARS_BACKREF:o,REPLACEMENTS:r}=t,h=$((p,A)=>typeof A.expandRange=="function"?A.expandRange(...p,A):(p.sort(),`[${p.join("-")}]`),"c"),y=$((p,A)=>`Missing ${p}: "${A}" - use "\\\\${A}" to match literal characters`,"f"),k=$(p=>{const A=[];let s=0,b=0,v=0,x="",R=!1;for(const m of p){if(R===!0){x+=m,R=!1;continue}if(m==="\\"){x+=m,R=!0;continue}if(m==='"'){v=v===1?0:1,x+=m;continue}if(v===0){if(m==="[")s++;else if(m==="]"&&s>0)s--;else if(s===0){if(m==="(")b++;else if(m===")"&&b>0)b--;else if(m==="|"&&b===0){A.push(x),x="";continue}}}x+=m}return A.push(x),A},"m"),S=$(p=>{let A=!1;for(const s of p){if(A===!0){A=!1;continue}if(s==="\\"){A=!0;continue}if(/[?*+@!()[\]{}]/.test(s))return!1}return!0},"y"),H=$(p=>{let A=p.trim(),s=!0;for(;s===!0;)s=!1,/^@\([^\\()[\]{}|]+\)$/.test(A)&&(A=A.slice(2,-1),s=!0);if(S(A))return A.replace(/\\(.)/g,"$1")},"X"),N=$(p=>{const A=p.map(H).filter(Boolean);for(let s=0;s<A.length;s++)for(let b=s+1;b<A.length;b++){const v=A[s],x=A[b],R=v[0];if(!(!R||v!==R.repeat(v.length)||x!==R.repeat(x.length))&&(v===x||v.startsWith(x)||x.startsWith(v)))return!0}return!1},"B"),E=$((p,A=!0)=>{if(p[0]!=="+"&&p[0]!=="*"||p[1]!=="(")return;let s=0,b=0,v=0,x=!1;for(let R=1;R<p.length;R++){const m=p[R];if(x===!0){x=!1;continue}if(m==="\\"){x=!0;continue}if(m==='"'){v=v===1?0:1;continue}if(v!==1){if(m==="["){s++;continue}if(m==="]"&&s>0){s--;continue}if(!(s>0)){if(m==="("){b++;continue}if(m===")"&&(b--,b===0))return A===!0&&R!==p.length-1?void 0:{type:p[0],body:p.slice(2,R),end:R}}}}},"T"),L=$(p=>{let A=0;const s=[];for(;A<p.length;){const b=E(p.slice(A),!1);if(!b||b.type!=="*")return;const v=k(b.body).map(R=>R.trim());if(v.length!==1)return;const x=H(v[0]);if(!x||x.length!==1)return;s.push(x),A+=b.end+1}return s.length<1?void 0:`${s.length===1?e.escapeRegex(s[0]):`[${s.map(b=>e.escapeRegex(b)).join("")}]`}*`},"G"),I=$(p=>{let A=0,s=p.trim(),b=E(s);for(;b;)A++,s=b.body.trim(),b=E(s);return A},"ot"),O=$((p,A)=>{if(A.maxExtglobRecursion===!1)return{risky:!1};const s=typeof A.maxExtglobRecursion=="number"?A.maxExtglobRecursion:t.DEFAULT_MAX_EXTGLOB_RECURSION,b=k(p).map(v=>v.trim());if(b.length>1&&(b.some(v=>v==="")||b.some(v=>/^[*?]+$/.test(v))||N(b)))return{risky:!0};for(const v of b){const x=L(v);if(x)return{risky:!0,safeOutput:x};if(I(v)>s)return{risky:!0}}return{risky:!1}},"j"),Q=$((p,A)=>{if(typeof p!="string")throw new TypeError("Expected a string");p=r[p]||p;const s={...A},b=typeof s.maxLength=="number"?Math.min(n,s.maxLength):n;let v=p.length;if(v>b)throw new SyntaxError(`Input length: ${v}, exceeds maximum allowed length: ${b}`);const x={type:"bos",value:"",output:s.prepend||""},R=[x],m=s.capture?"":"?:",G=t.globChars(s.windows),B=t.extglobChars(G),{DOT_LITERAL:q,PLUS_LITERAL:st,SLASH_LITERAL:V,ONE_CHAR:ot,DOTS_SLASH:X,NO_DOT:ct,NO_DOT_SLASH:gt,NO_DOTS_SLASH:ut,QMARK:F,QMARK_NO_DOT:it,STAR:dt,START_ANCHOR:J}=G,Z=$(g=>`(${m}(?:(?!${J}${g.dot?X:q}).)*?)`,"H"),et=s.dot?"":ct,C=s.dot?F:it;let P=s.bash===!0?Z(s):dt;s.capture&&(P=`(${P})`),typeof s.noext=="boolean"&&(s.noextglob=s.noext);const a={input:p,index:-1,start:0,dot:s.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:R};p=e.removePrefix(p,a),v=p.length;const tt=[],z=[],j=[];let u=x,i;const rt=$(()=>a.index===v-1,"tt"),D=a.peek=(g=1)=>p[a.index+g],K=a.advance=()=>p[++a.index]||"",pt=$(()=>p.slice(a.index+1),"k"),nt=$((g="",U=0)=>{a.consumed+=g,a.index+=U},"J"),ht=$(g=>{a.output+=g.output!=null?g.output:g.value,nt(g.value)},"ct"),De=$(()=>{let g=1;for(;D()==="!"&&(D(2)!=="("||D(3)==="?");)K(),a.start++,g++;return g%2===0?!1:(a.negated=!0,a.start++,!0)},"Rt"),mt=$(g=>{a[g]++,j.push(g)},"At"),ft=$(g=>{a[g]--,j.pop()},"it"),w=$(g=>{if(u.type==="globstar"){const U=a.braces>0&&(g.type==="comma"||g.type==="brace"),f=g.extglob===!0||tt.length&&(g.type==="pipe"||g.type==="paren");g.type!=="slash"&&g.type!=="paren"&&!U&&!f&&(a.output=a.output.slice(0,-u.output.length),u.type="star",u.value="*",u.output=P,a.output+=u.output)}if(tt.length&&g.type!=="paren"&&(tt[tt.length-1].inner+=g.value),(g.value||g.output)&&ht(g),u&&u.type==="text"&&g.type==="text"){u.output=(u.output||u.value)+g.value,u.value+=g.value;return}g.prev=u,R.push(g),u=g},"g"),$t=$((g,U)=>{const f={...B[U],conditions:1,inner:""};f.prev=u,f.parens=a.parens,f.output=a.output,f.startIndex=a.index,f.tokensIndex=R.length;const T=(s.capture?"(":"")+f.open;mt("parens"),w({type:g,value:U,output:a.output?"":ot}),w({type:"paren",extglob:!0,value:K(),output:T}),tt.push(f)},"_t"),Be=$(g=>{const U=p.slice(g.startIndex,a.index+1),f=p.slice(g.startIndex+2,a.index),T=O(f,s);if((g.type==="plus"||g.type==="star")&&T.risky){const M=T.safeOutput?(g.output?"":ot)+(s.capture?`(${T.safeOutput})`:T.safeOutput):void 0,at=R[g.tokensIndex];at.type="text",at.value=U,at.output=M||e.escapeRegex(U);for(let lt=g.tokensIndex+1;lt<R.length;lt++)R[lt].value="",R[lt].output="",delete R[lt].suffix;a.output=g.output+at.output,a.backtrack=!0,w({type:"paren",extglob:!0,value:i,output:""}),ft("parens");return}let W=g.close+(s.capture?")":""),Y;if(g.type==="negate"){let M=P;if(g.inner&&g.inner.length>1&&g.inner.includes("/")&&(M=Z(s)),(M!==P||rt()||/^\)+$/.test(pt()))&&(W=g.close=`)$))${M}`),g.inner.includes("*")&&(Y=pt())&&/^\.[^\\/.]+$/.test(Y)){const at=Q(Y,{...A,fastpaths:!1}).output;W=g.close=`)${at})${M})`}g.prev.type==="bos"&&(a.negatedExtglob=!0)}w({type:"paren",extglob:!0,value:i,output:W}),ft("parens")},"Lt");if(s.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(p)){let g=!1,U=p.replace(o,(f,T,W,Y,M,at)=>Y==="\\"?(g=!0,f):Y==="?"?T?T+Y+(M?F.repeat(M.length):""):at===0?C+(M?F.repeat(M.length):""):F.repeat(W.length):Y==="."?q.repeat(W.length):Y==="*"?T?T+Y+(M?P:""):P:T?f:`\\${f}`);return g===!0&&(s.unescape===!0?U=U.replace(/\\/g,""):U=U.replace(/\\+/g,f=>f.length%2===0?"\\\\":f?"\\":"")),U===p&&s.contains===!0?(a.output=p,a):(a.output=e.wrapOutput(U,a,A),a)}for(;!rt();){if(i=K(),i==="\0")continue;if(i==="\\"){const f=D();if(f==="/"&&s.bash!==!0||f==="."||f===";")continue;if(!f){i+="\\",w({type:"text",value:i});continue}const T=/^\\+/.exec(pt());let W=0;if(T&&T[0].length>2&&(W=T[0].length,a.index+=W,W%2!==0&&(i+="\\")),s.unescape===!0?i=K():i+=K(),a.brackets===0){w({type:"text",value:i});continue}}if(a.brackets>0&&(i!=="]"||u.value==="["||u.value==="[^")){if(s.posix!==!1&&i===":"){const f=u.value.slice(1);if(f.includes("[")&&(u.posix=!0,f.includes(":"))){const T=u.value.lastIndexOf("["),W=u.value.slice(0,T),Y=u.value.slice(T+2),M=l[Y];if(M){u.value=W+M,a.backtrack=!0,K(),!x.output&&R.indexOf(u)===1&&(x.output=ot);continue}}}(i==="["&&D()!==":"||i==="-"&&D()==="]")&&(i=`\\${i}`),i==="]"&&(u.value==="["||u.value==="[^")&&(i=`\\${i}`),s.posix===!0&&i==="!"&&u.value==="["&&(i="^"),u.value+=i,ht({value:i});continue}if(a.quotes===1&&i!=='"'){i=e.escapeRegex(i),u.value+=i,ht({value:i});continue}if(i==='"'){a.quotes=a.quotes===1?0:1,s.keepQuotes===!0&&w({type:"text",value:i});continue}if(i==="("){mt("parens"),w({type:"paren",value:i});continue}if(i===")"){if(a.parens===0&&s.strictBrackets===!0)throw new SyntaxError(y("opening","("));const f=tt[tt.length-1];if(f&&a.parens===f.parens+1){Be(tt.pop());continue}w({type:"paren",value:i,output:a.parens?")":"\\)"}),ft("parens");continue}if(i==="["){if(s.nobracket===!0||!pt().includes("]")){if(s.nobracket!==!0&&s.strictBrackets===!0)throw new SyntaxError(y("closing","]"));i=`\\${i}`}else mt("brackets");w({type:"bracket",value:i});continue}if(i==="]"){if(s.nobracket===!0||u&&u.type==="bracket"&&u.value.length===1){w({type:"text",value:i,output:`\\${i}`});continue}if(a.brackets===0){if(s.strictBrackets===!0)throw new SyntaxError(y("opening","["));w({type:"text",value:i,output:`\\${i}`});continue}ft("brackets");const f=u.value.slice(1);if(u.posix!==!0&&f[0]==="^"&&!f.includes("/")&&(i=`/${i}`),u.value+=i,ht({value:i}),s.literalBrackets===!1||e.hasRegexChars(f))continue;const T=e.escapeRegex(u.value);if(a.output=a.output.slice(0,-u.value.length),s.literalBrackets===!0){a.output+=T,u.value=T;continue}u.value=`(${m}${T}|${u.value})`,a.output+=u.value;continue}if(i==="{"&&s.nobrace!==!0){mt("braces");const f={type:"brace",value:i,output:"(",outputIndex:a.output.length,tokensIndex:a.tokens.length};z.push(f),w(f);continue}if(i==="}"){const f=z[z.length-1];if(s.nobrace===!0||!f){w({type:"text",value:i,output:i});continue}let T=")";if(f.dots===!0){const W=R.slice(),Y=[];for(let M=W.length-1;M>=0&&(R.pop(),W[M].type!=="brace");M--)W[M].type!=="dots"&&Y.unshift(W[M].value);T=h(Y,s),a.backtrack=!0}if(f.comma!==!0&&f.dots!==!0){const W=a.output.slice(0,f.outputIndex),Y=a.tokens.slice(f.tokensIndex);f.value=f.output="\\{",i=T="\\}",a.output=W;for(const M of Y)a.output+=M.output||M.value}w({type:"brace",value:i,output:T}),ft("braces"),z.pop();continue}if(i==="|"){tt.length>0&&tt[tt.length-1].conditions++,w({type:"text",value:i});continue}if(i===","){let f=i;const T=z[z.length-1];T&&j[j.length-1]==="braces"&&(T.comma=!0,f="|"),w({type:"comma",value:i,output:f});continue}if(i==="/"){if(u.type==="dot"&&a.index===a.start+1){a.start=a.index+1,a.consumed="",a.output="",R.pop(),u=x;continue}w({type:"slash",value:i,output:V});continue}if(i==="."){if(a.braces>0&&u.type==="dot"){u.value==="."&&(u.output=q);const f=z[z.length-1];u.type="dots",u.output+=i,u.value+=i,f.dots=!0;continue}if(a.braces+a.parens===0&&u.type!=="bos"&&u.type!=="slash"){w({type:"text",value:i,output:q});continue}w({type:"dot",value:i,output:q});continue}if(i==="?"){if(!(u&&u.value==="(")&&s.noextglob!==!0&&D()==="("&&D(2)!=="?"){$t("qmark",i);continue}if(u&&u.type==="paren"){const f=D();let T=i;(u.value==="("&&!/[!=<:]/.test(f)||f==="<"&&!/<([!=]|\w+>)/.test(pt()))&&(T=`\\${i}`),w({type:"text",value:i,output:T});continue}if(s.dot!==!0&&(u.type==="slash"||u.type==="bos")){w({type:"qmark",value:i,output:it});continue}w({type:"qmark",value:i,output:F});continue}if(i==="!"){if(s.noextglob!==!0&&D()==="("&&(D(2)!=="?"||!/[!=<:]/.test(D(3)))){$t("negate",i);continue}if(s.nonegate!==!0&&a.index===0){De();continue}}if(i==="+"){if(s.noextglob!==!0&&D()==="("&&D(2)!=="?"){$t("plus",i);continue}if(u&&u.value==="("||s.regex===!1){w({type:"plus",value:i,output:st});continue}if(u&&(u.type==="bracket"||u.type==="paren"||u.type==="brace")||a.parens>0){w({type:"plus",value:i});continue}w({type:"plus",value:st});continue}if(i==="@"){if(s.noextglob!==!0&&D()==="("&&D(2)!=="?"){w({type:"at",extglob:!0,value:i,output:""});continue}w({type:"text",value:i});continue}if(i!=="*"){(i==="$"||i==="^")&&(i=`\\${i}`);const f=c.exec(pt());f&&(i+=f[0],a.index+=f[0].length),w({type:"text",value:i});continue}if(u&&(u.type==="globstar"||u.star===!0)){u.type="star",u.star=!0,u.value+=i,u.output=P,a.backtrack=!0,a.globstar=!0,nt(i);continue}let g=pt();if(s.noextglob!==!0&&/^\([^?]/.test(g)){$t("star",i);continue}if(u.type==="star"){if(s.noglobstar===!0){nt(i);continue}const f=u.prev,T=f.prev,W=f.type==="slash"||f.type==="bos",Y=T&&(T.type==="star"||T.type==="globstar");if(s.bash===!0&&(!W||g[0]&&g[0]!=="/")){w({type:"star",value:i,output:""});continue}const M=a.braces>0&&(f.type==="comma"||f.type==="brace"),at=tt.length&&(f.type==="pipe"||f.type==="paren");if(!W&&f.type!=="paren"&&!M&&!at){w({type:"star",value:i,output:""});continue}for(;g.slice(0,3)==="/**";){const lt=p[a.index+4];if(lt&<!=="/")break;g=g.slice(3),nt("/**",3)}if(f.type==="bos"&&rt()){u.type="globstar",u.value+=i,u.output=Z(s),a.output=u.output,a.globstar=!0,nt(i);continue}if(f.type==="slash"&&f.prev.type!=="bos"&&!Y&&rt()){a.output=a.output.slice(0,-(f.output+u.output).length),f.output=`(?:${f.output}`,u.type="globstar",u.output=Z(s)+(s.strictSlashes?")":"|$)"),u.value+=i,a.globstar=!0,a.output+=f.output+u.output,nt(i);continue}if(f.type==="slash"&&f.prev.type!=="bos"&&g[0]==="/"){const lt=g[1]!==void 0?"|$":"";a.output=a.output.slice(0,-(f.output+u.output).length),f.output=`(?:${f.output}`,u.type="globstar",u.output=`${Z(s)}${V}|${V}${lt})`,u.value+=i,a.output+=f.output+u.output,a.globstar=!0,nt(i+K()),w({type:"slash",value:"/",output:""});continue}if(f.type==="bos"&&g[0]==="/"){u.type="globstar",u.value+=i,u.output=`(?:^|${V}|${Z(s)}${V})`,a.output=u.output,a.globstar=!0,nt(i+K()),w({type:"slash",value:"/",output:""});continue}if(M&&g[0]==="/"){u.type="globstar",u.value+=i,u.output=`(?:^|${V}|${Z(s)}${V})`,a.output+=u.output,a.globstar=!0,nt(i+K()),w({type:"slash",value:"/",output:""});continue}a.output=a.output.slice(0,-u.output.length),u.type="globstar",u.output=Z(s),u.value+=i,a.output+=u.output,a.globstar=!0,nt(i);continue}const U={type:"star",value:i,output:P};if(s.bash===!0){U.output=".*?",(u.type==="bos"||u.type==="slash")&&(U.output=et+U.output),w(U);continue}if(u&&(u.type==="bracket"||u.type==="paren")&&s.regex===!0){U.output=i,w(U);continue}(a.index===a.start||u.type==="slash"||u.type==="dot")&&(u.type==="dot"?(a.output+=gt,u.output+=gt):s.dot===!0?(a.output+=ut,u.output+=ut):(a.output+=et,u.output+=et),D()!=="*"&&(a.output+=ot,u.output+=ot)),w(U)}for(;a.brackets>0;){if(s.strictBrackets===!0)throw new SyntaxError(y("closing","]"));a.output=e.escapeLast(a.output,"["),ft("brackets")}for(;a.parens>0;){if(s.strictBrackets===!0)throw new SyntaxError(y("closing",")"));a.output=e.escapeLast(a.output,"("),ft("parens")}for(;a.braces>0;){if(s.strictBrackets===!0)throw new SyntaxError(y("closing","}"));a.output=e.escapeLast(a.output,"{"),ft("braces")}if(s.strictSlashes!==!0&&(u.type==="star"||u.type==="bracket")&&w({type:"maybe_slash",value:"",output:`${V}?`}),a.backtrack===!0){a.output="";for(const g of a.tokens)a.output+=g.output!=null?g.output:g.value,g.suffix&&(a.output+=g.suffix)}return a},"q");return Q.fastpaths=(p,A)=>{const s={...A},b=typeof s.maxLength=="number"?Math.min(n,s.maxLength):n,v=p.length;if(v>b)throw new SyntaxError(`Input length: ${v}, exceeds maximum allowed length: ${b}`);p=r[p]||p;const{DOT_LITERAL:x,SLASH_LITERAL:R,ONE_CHAR:m,DOTS_SLASH:G,NO_DOT:B,NO_DOTS:q,NO_DOTS_SLASH:st,STAR:V,START_ANCHOR:ot}=t.globChars(s.windows),X=s.dot?q:B,ct=s.dot?st:B,gt=s.capture?"":"?:",ut={negated:!1,prefix:""};let F=s.bash===!0?".*?":V;s.capture&&(F=`(${F})`);const it=$(et=>et.noglobstar===!0?F:`(${gt}(?:(?!${ot}${et.dot?G:x}).)*?)`,"z"),dt=$(et=>{switch(et){case"*":return`${X}${m}${F}`;case".*":return`${x}${m}${F}`;case"*.*":return`${X}${F}${x}${m}${F}`;case"*/*":return`${X}${F}${R}${m}${ct}${F}`;case"**":return X+it(s);case"**/*":return`(?:${X}${it(s)}${R})?${ct}${m}${F}`;case"**/*.*":return`(?:${X}${it(s)}${R})?${ct}${F}${x}${m}${F}`;case"**/.*":return`(?:${X}${it(s)}${R})?${x}${m}${F}`;default:{const C=/^(.*?)\.(\w+)$/.exec(et);if(!C)return;const P=dt(C[1]);return P?P+x+C[2]:void 0}}},"lt"),J=e.removePrefix(p,ut);let Z=dt(J);return Z&&s.strictSlashes!==!0&&(Z+=`${R}?`),Z},Ht=Q,Ht}_(re,"wt$1");$(re,"Nt");var Tt,Yt;function se(){if(Yt)return Tt;Yt=1;const t=ne(),e=re(),n=vt(),l=Et(),c=$(r=>r&&typeof r=="object"&&!Array.isArray(r),"K"),o=$((r,h,y=!1)=>{if(Array.isArray(r)){const O=r.map(Q=>o(Q,h,y));return Q=>{for(const p of O){const A=p(Q);if(A)return A}return!1}}const k=c(r)&&r.tokens&&r.input;if(r===""||typeof r!="string"&&!k)throw new TypeError("Expected pattern to be a non-empty string");const S=h||{},H=S.windows,N=k?o.compileRe(r,h):o.makeRe(r,h,!1,!0),E=N.state;delete N.state;let L=$(()=>!1,"G");if(S.ignore){const O={...h,ignore:null,onMatch:null,onResult:null};L=o(S.ignore,O,y)}const I=$((O,Q=!1)=>{const{isMatch:p,match:A,output:s}=o.test(O,N,h,{glob:r,posix:H}),b={glob:r,state:E,regex:N,posix:H,input:O,output:s,match:A,isMatch:p};if(typeof S.onResult=="function"&&S.onResult(b),p===!1)return b.isMatch=!1,Q?b:!1;t:if(L(O)){if(typeof S.onIgnore=="function"&&S.onIgnore(b)===l.UNIGNORE){b.isMatch=!0;break t}return b.isMatch=!1,Q?b:!1}return typeof S.onMatch=="function"&&S.onMatch(b),Q?b:!0},"ot");return y&&(I.state=E),I},"s");return o.test=(r,h,y,{glob:k,posix:S}={})=>{if(typeof r!="string")throw new TypeError("Expected input to be a string");if(r==="")return{isMatch:!1,output:""};const H=y||{},N=H.format||(S?n.toPosixSlashes:null);let E=r===k,L=E&&N?N(r):r;return E===!1&&(L=N?N(r):r,E=L===k),(E===!1||H.capture===!0)&&(H.matchBase===!0||H.basename===!0?E=o.matchBase(r,h,y,S):E=h.exec(L)),{isMatch:!!E,match:E,output:L}},o.matchBase=(r,h,y)=>(h instanceof RegExp?h:o.makeRe(h,y)).test(n.basename(r)),o.isMatch=(r,h,y)=>o(h,y)(r),o.parse=(r,h)=>Array.isArray(r)?r.map(y=>o.parse(y,h)):e(r,{...h,fastpaths:!1}),o.scan=(r,h)=>t(r,h),o.compileRe=(r,h,y=!1,k=!1)=>{if(y===!0)return r.output;const S=h||{},H=S.contains?"":"^",N=S.contains?"":"$";let E=`${H}(?:${r.output})${N}`;r&&r.negated===!0&&(E=`^(?!${E}).*$`);const L=o.toRegex(E,h);return k===!0&&(L.state=r),L},o.makeRe=(r,h={},y=!1,k=!1)=>{if(!r||typeof r!="string")throw new TypeError("Expected a non-empty string");let S={negated:!1,fastpaths:!0};return h.fastpaths!==!1&&(r[0]==="."||r[0]==="*")&&(S.output=e.fastpaths(r,h)),S.output||(S=e(r,h)),o.compileRe(S,h,y,k)},o.toRegex=(r,h)=>{try{const y=h||{};return new RegExp(r,y.flags||(y.nocase?"i":""))}catch(y){if(h&&h.debug===!0)throw y;return/$^/}},o.constants=l,Tt=o,Tt}_(se,"Bt$1");$(se,"It");var Lt,Zt;function oe(){if(Zt)return Lt;Zt=1;const t=se(),e=vt();function n(l,c,o=!1){return c&&(c.windows===null||c.windows===void 0)&&(c={...c,windows:e.isWindows()}),t(l,c,o)}return _(n,"T"),$(n,"$"),Object.assign(n,t),Lt=n,Lt}_(oe,"Gt$1");$(oe,"wt");var je=oe();const yt=ee(je);var Qe=Object.defineProperty,d=_((t,e)=>Qe(t,"name",{value:e,configurable:!0}),"i");const ze=qe(import.meta.url),Rt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,St=d(t=>{if(typeof Rt<"u"&&Rt.versions&&Rt.versions.node){const[e,n]=Rt.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return Rt.getBuiltinModule(t)}return ze(t)},"D"),Vt=St("fs"),Ye={...Vt,default:Vt},{statSync:Ze,stat:Ve,realpathSync:Je,realpath:tn,readdirSync:en,readdir:nn}=St("fs"),{sep:ue,basename:rn,dirname:Pt,resolve:ie,normalize:sn,relative:on,posix:At,isAbsolute:un}=St("path"),{fileURLToPath:an}=St("url"),{createRequire:ln}=St("module");var Jt=ln(import.meta.url);function ae(t){let e=sn(t);return e.length>1&&e[e.length-1]===ue&&(e=e.substring(0,e.length-1)),e}_(ae,"St");d(ae,"bt");const cn=/[\\/]/g;function Dt(t,e){return t.replace(cn,e)}_(Dt,"N");d(Dt,"N");const pn=/^[a-z]:[\\/]$/i;function le(t){return t==="/"||pn.test(t)}_(le,"xt");d(le,"$t");function Ct(t,e){const{resolvePaths:n,normalizePath:l,pathSeparator:c}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(n&&(t=ie(t)),(l||o)&&(t=ae(t)),t===".")return"";const r=t[t.length-1]!==c;return Dt(r?t+c:t,c)}_(Ct,"W");d(Ct,"R");function Bt(t,e){return e+t}_(Bt,"Q");d(Bt,"U");function ce(t,e){return function(n,l){return l.startsWith(t)?l.slice(t.length)+n:Dt(on(t,l),e.pathSeparator)+e.pathSeparator+n}}_(ce,"Dt");d(ce,"kt");function pe(t){return t}_(pe,"Ft");d(pe,"Pt");function he(t,e,n){return e+t+n}_(he,"Et");d(he,"xt");function fe(t,e){const{relativePaths:n,includeBasePath:l}=e;return n&&t?ce(t,e):l?Bt:pe}_(fe,"qt");d(fe,"Dt");function ge(t){return function(e,n){n.push(e.substring(t.length)||".")}}_(ge,"$t");d(ge,"Ft");function de(t){return function(e,n,l){const c=e.substring(t.length)||".";l.every(o=>o(c,!0))&&n.push(c)}}_(de,"Ot");d(de,"_t");const hn=d((t,e)=>{e.push(t||".")},"qt"),fn=d((t,e,n)=>{const l=t||".";n.every(c=>c(l,!0))&&e.push(l)},"Et"),gn=d(()=>{},"jt");function ye(t,e){const{includeDirs:n,filters:l,relativePaths:c}=e;return n?c?l&&l.length?de(t):ge(t):l&&l.length?fn:hn:gn}_(ye,"Ct");d(ye,"Rt");const dn=d((t,e,n,l)=>{l.every(c=>c(t,!1))&&n.files++},"Wt"),yn=d((t,e,n,l)=>{l.every(c=>c(t,!1))&&e.push(t)},"At"),An=d((t,e,n,l)=>{n.files++},"Bt"),_n=d((t,e)=>{e.push(t)},"Ot"),bn=d(()=>{},"Ct");function Ae(t){const{excludeFiles:e,filters:n,onlyCounts:l}=t;return e?bn:n&&n.length?l?dn:yn:l?An:_n}_(Ae,"Lt");d(Ae,"Mt");const Rn=d(t=>t,"Lt"),En=d(()=>[""].slice(0,0),"It");function _e(t){return t.group?En:Rn}_(_e,"Gt");d(_e,"Tt");const vn=d((t,e,n)=>{t.push({directory:e,files:n,dir:e})},"Gt"),Sn=d(()=>{},"zt");function be(t){return t.group?vn:Sn}_(be,"Ut");d(be,"Nt");const xn=d(function(t,e,n){const{queue:l,fs:c,options:{suppressErrors:o}}=e;l.enqueue(),c.realpath(t,(r,h)=>{if(r)return l.dequeue(o?null:r,e);c.stat(h,(y,k)=>{if(y)return l.dequeue(o?null:y,e);if(k.isDirectory()&&Mt(t,h,e))return l.dequeue(null,e);n(k,h),l.dequeue(null,e)})})},"Ut"),mn=d(function(t,e,n){const{queue:l,fs:c,options:{suppressErrors:o}}=e;l.enqueue();try{const r=c.realpathSync(t),h=c.statSync(r);if(h.isDirectory()&&Mt(t,r,e))return;n(h,r)}catch(r){if(!o)throw r}},"Qt");function Re(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?mn:xn}_(Re,"Ht");d(Re,"Yt");function Mt(t,e,n){if(n.options.useRealPaths)return Ee(e,n);let l=Pt(t),c=1;for(;l!==n.root&&c<2;){const o=n.symlinks.get(l);o&&(o===e||o.startsWith(e)||e.startsWith(o))?c++:l=Pt(l)}return n.symlinks.set(t,e),c>1}_(Mt,"U");d(Mt,"Q");function Ee(t,e){return e.visited.includes(t+e.options.pathSeparator)}_(Ee,"Jt");d(Ee,"Zt");const $n=d(t=>t.counts,"Ht"),Cn=d(t=>t.groups,"Jt"),kn=d(t=>t.paths,"Kt"),On=d(t=>t.paths.slice(0,t.options.maxFiles),"Vt"),wn=d((t,e,n)=>(xt(e,n,t.counts,t.options.suppressErrors),null),"Xt"),Hn=d((t,e,n)=>(xt(e,n,t.paths,t.options.suppressErrors),null),"te"),Tn=d((t,e,n)=>(xt(e,n,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),"ee"),Ln=d((t,e,n)=>(xt(e,n,t.groups,t.options.suppressErrors),null),"se");function xt(t,e,n,l){e(t&&!l?t:null,n)}_(xt,"q");d(xt,"F");function ve(t,e){const{onlyCounts:n,group:l,maxFiles:c}=t;return n?e?$n:wn:l?e?Cn:Ln:c?e?On:Tn:e?kn:Hn}_(ve,"is");d(ve,"re");const Se={withFileTypes:!0},Pn=d((t,e,n,l,c)=>{if(t.queue.enqueue(),l<0)return t.queue.dequeue(null,t);const{fs:o}=t;t.visited.push(e),t.counts.directories++,o.readdir(e||".",Se,(r,h=[])=>{c(h,n,l),t.queue.dequeue(t.options.suppressErrors?null:r,t)})},"ne"),Nn=d((t,e,n,l,c)=>{const{fs:o}=t;if(l<0)return;t.visited.push(e),t.counts.directories++;let r=[];try{r=o.readdirSync(e||".",Se)}catch(h){if(!t.options.suppressErrors)throw h}c(r,n,l)},"oe");function xe(t){return t?Nn:Pn}_(xe,"us");d(xe,"ie");var In=class{static{_(this,"hs")}static{d(this,"ue")}count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},Dn=class{static{_(this,"cs")}static{d(this,"le")}_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},Bn=class{static{_(this,"as")}static{d(this,"ce")}aborted=!1;abort(){this.aborted=!0}},me=class{static{_(this,"Z")}static{d(this,"Z")}root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,n){this.isSynchronous=!n,this.callbackInvoker=ve(e,this.isSynchronous),this.root=Ct(t,e),this.state={root:le(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new Dn,options:e,queue:new In((l,c)=>this.callbackInvoker(c,l,n)),symlinks:new Map,visited:[""].slice(0,0),controller:new Bn,fs:e.fs||Ye},this.joinPath=fe(this.root,e),this.pushDirectory=ye(this.root,e),this.pushFile=Ae(e),this.getArray=_e(e),this.groupFiles=be(e),this.resolveSymlink=Re(e,this.isSynchronous),this.walkDirectory=xe(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=d((t,e,n)=>{const{paths:l,options:{filters:c,resolveSymlinks:o,excludeSymlinks:r,exclude:h,maxFiles:y,signal:k,useRealPaths:S,pathSeparator:H},controller:N}=this.state;if(N.aborted||k&&k.aborted||y&&l.length>y)return;const E=this.getArray(this.state.paths);for(let L=0;L<t.length;++L){const I=t[L];if(I.isFile()||I.isSymbolicLink()&&!o&&!r){const O=this.joinPath(I.name,e);this.pushFile(O,E,this.state.counts,c)}else if(I.isDirectory()){let O=he(I.name,e,this.state.options.pathSeparator);if(h&&h(I.name,O))continue;this.pushDirectory(O,l,c),this.walkDirectory(this.state,O,O,n-1,this.walk)}else if(this.resolveSymlink&&I.isSymbolicLink()){let O=Bt(I.name,e);this.resolveSymlink(O,this.state,(Q,p)=>{if(Q.isDirectory()){if(p=Ct(p,this.state.options),h&&h(I.name,S?p:O+H))return;this.walkDirectory(this.state,p,S?p:O+H,n-1,this.walk)}else{p=S?p:O;const A=rn(p),s=Ct(Pt(p),this.state.options);p=this.joinPath(A,s),this.pushFile(p,E,this.state.counts,c)}})}}this.groupFiles(this.state.groups,e,E)},"walk")};function $e(t,e){return new Promise((n,l)=>{Ft(t,e,(c,o)=>{if(c)return l(c);n(o)})})}_($e,"ps");d($e,"ae");function Ft(t,e,n){new me(t,e,n).start()}_(Ft,"H");d(Ft,"H");function Ce(t,e){return new me(t,e).start()}_(Ce,"fs");d(Ce,"he");var te=class{static{_(this,"I")}static{d(this,"L")}constructor(t,e){this.root=t,this.options=e}withPromise(){return $e(this.root,this.options)}withCallback(t){Ft(this.root,this.options,t)}sync(){return Ce(this.root,this.options)}};let ke=null;try{Jt.resolve("picomatch"),ke=Jt("picomatch")}catch{}var Mn=class{static{_(this,"gs")}static{d(this,"pe")}globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:ue,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new te(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new te(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){const n=this.globFunction||ke;if(!n)throw new Error("Please specify a glob function to use glob matching.");var l=this.globCache[t.join("\0")];return l||(l=n(t,...e),this.globCache[t.join("\0")]=l),this.options.filters.push(c=>l(c)),this}};const Fn=Array.isArray,Oe=/\\/g,we=process.platform==="win32",Gn=/^(\/?\.\.)+$/;function Nt(t,e={}){const n=t.length,l=Array(n),c=Array(n);let o,r;for(o=0;o<n;o++){const h=Gt(t[o]);l[o]=h;const y=h.length,k=Array(y);for(r=0;r<y;r++)k[r]=yt(h[r],e);c[o]=k}return h=>{const y=h.split("/");if(y[0]===".."&&Gn.test(h))return!0;for(o=0;o<n;o++){const k=l[o],S=c[o],H=y.length,N=Math.min(H,k.length);for(r=0;r<N;){const E=k[r];if(E.includes("/"))return!0;if(!S[r](y[r]))break;if(!e.noglobstar&&E==="**")return!0;r++}if(r===H)return!0}return!1}}_(Nt,"L");d(Nt,"I");const Un=/^[A-Z]:\/$/i,qn=we?t=>Un.test(t):t=>t==="/";function It(t,e,n){if(t===e||e.startsWith(`${t}/`)){if(n){const c=t.length+ +!qn(t);return(o,r)=>o.slice(c,r?-1:void 0)||"."}const l=e.slice(t.length+1);return l?(c,o)=>{if(c===".")return l;const r=`${l}/${c}`;return o?r.slice(0,-1):r}:(c,o)=>o&&c!=="."?c.slice(0,-1):c}return n?l=>At.relative(t,l)||".":l=>At.relative(t,`${e}/${l}`)||"."}_(It,"T");d(It,"T");function He(t,e){if(e.startsWith(`${t}/`)){const n=e.slice(t.length+1);return l=>`${n}/${l}`}return n=>{const l=At.relative(t,`${e}/${n}`);return n[n.length-1]==="/"&&l!==""?`${l}/`:l||"."}}_(He,"bs");d(He,"me");const Xn={parts:!0};function Gt(t){var e;const n=yt.scan(t,Xn);return!((e=n.parts)===null||e===void 0)&&e.length?n.parts:[t]}_(Gt,"X");d(Gt,"X");const Kn=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Wn=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,jn=d(t=>t.replace(Kn,"\\$&"),"Se"),Qn=d(t=>t.replace(Wn,"\\$&"),"$e"),zn=we?Qn:jn;function Te(t,e){const n=yt.scan(t);return n.isGlob||n.negated}_(Te,"Fs");d(Te,"Pe");function _t(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}_(_t,"F");d(_t,"x");function Ut(t){return typeof t=="string"?[t]:t??[]}_(Ut,"tt");d(Ut,"tt");const Yn=/^(\/?\.\.)+/,Zn=/\\(?=[()[\]{}!*+?@|])/g;function kt(t,e,n,l){var c;const o=e.cwd;let r=t;t[t.length-1]==="/"&&(r=t.slice(0,-1));const h=r.lastIndexOf("/"),y=(h===-1?r:r.slice(h+1)).startsWith("!(");r[r.length-1]!=="*"&&!y&&e.expandDirectories&&(r+="/**");const k=zn(o);r=un(r.replace(Zn,""))?At.relative(k,r):At.normalize(r);const S=(c=Yn.exec(r))===null||c===void 0?void 0:c[0],H=Gt(r);if(S){const E=(S.length+1)/3;let L=0;const I=k.split("/");for(;L<E&&H[L+E]===I[I.length+L-E];)r=r.slice(0,(E-L-1)*3)+r.slice((E-L)*3+H[L+E].length+1)||".",L++;const O=At.join(o,S.slice(L*3));O[0]!=="."&&n.root.length>O.length&&(n.root=O,n.depthOffset=-E+L)}if(!l&&n.depthOffset>=0){var N;(N=n.commonPath)!==null&&N!==void 0||(n.commonPath=H);const E=[],L=Math.min(n.commonPath.length,H.length);for(let I=0;I<L;I++){const O=H[I];if(O==="**"&&!H[I+1]){E.pop();break}if(I===H.length-1||O!==n.commonPath[I]||Te(O))break;E.push(O)}n.depthOffset=E.length,n.commonPath=E,n.root=E.length>0?At.join(o,...E):o}return r}_(kt,"B");d(kt,"W");function Le(t,e,n){const l=[],c=[],o=[];for(const r of t.ignore)r&&(r[0]!=="!"||r[1]==="("?c.push(kt(r,t,n,!0)):o.push(r.slice(1)));for(const r of e)r&&(r[0]!=="!"||r[1]==="("?l.push(kt(r,t,n,!1)):(r[1]!=="!"||r[2]==="(")&&c.push(kt(r.slice(1),t,n,!0)));return{match:l,ignore:c,unignore:o}}_(Le,"$s");d(Le,"Fe");function Pe(t,e){const n=t.cwd,l={root:n,depthOffset:0},c=Le(t,e,l);t.debug&&_t("internal processing patterns:",c);const{absolute:o,caseSensitiveMatch:r,debug:h,dot:y,followSymbolicLinks:k,onlyDirectories:S}=t,H=l.root.replace(Oe,""),N={dot:y,nobrace:t.braceExpansion===!1,nocase:!r,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},E=c.unignore.length>0,L=E?yt(c.unignore,N):void 0,I=E?Nt(c.unignore,N):void 0,O=yt(c.match,{...N,ignore:c.ignore,onIgnore:L?m=>L(m.output)&&yt.constants.UNIGNORE:void 0}),Q=yt(c.ignore,N),p=Nt(c.match,N),A=It(n,H,o),s=o?A:It(n,H,!0),b=c.match.length>0&&c.match.every(m=>m==="**"||m==="**/*"),v=c.ignore.length>0||E||!b?(m,G)=>{const B=s(G,!0);return B==="."||I&&I(B)?!1:!p(B)||Q(B)}:void 0;let x;t.deep!==void 0&&(x=Math.round(t.deep-l.depthOffset));const R=new Mn({filters:[h?(m,G)=>{const B=A(m,G),q=O(B);return q&&_t(`matched ${B}`),q}:(m,G)=>{const B=A(m,G);return O(B)}],exclude:h&&v?(m,G)=>{const B=v(m,G);return _t(`${B?"skipped":"crawling"} ${G}`),B}:v,fs:t.fs,pathSeparator:"/",relativePaths:!o,resolvePaths:o,includeBasePath:o,resolveSymlinks:k,excludeSymlinks:!k,excludeFiles:S,includeDirs:S||!t.onlyFiles,maxDepth:x,signal:t.signal}).crawl(H);return t.debug&&_t("internal properties:",{...l,root:H}),[R,n!==H&&!o&&He(n,H)]}_(Pe,"Os");d(Pe,"_e");function qt(t,e){if(e)for(let n=t.length-1;n>=0;n--)t[n]=e(t[n]);return t}_(qt,"st");d(qt,"et");const Vn={caseSensitiveMatch:!0,cwd:process.cwd(),debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Ne(t){const e={...Vn,...t};return e.cwd=(e.cwd instanceof URL?an(e.cwd):ie(e.cwd)).replace(Oe,"/"),e.ignore=Ut(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||nn,readdirSync:e.fs.readdirSync||en,realpath:e.fs.realpath||tn,realpathSync:e.fs.realpathSync||Je,stat:e.fs.stat||Ve,statSync:e.fs.statSync||Ze}),e.debug&&_t("globbing with options:",e),e}_(Ne,"Ws");d(Ne,"Ee");function Xt(t,e={}){var n;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");const l=Fn(t)||typeof t=="string",c=Ut((n=l?t:t.patterns)!==null&&n!==void 0?n:"**/*"),o=Ne(l?e:t);return c.length>0?Pe(o,c):[]}_(Xt,"et");d(Xt,"st");async function Ie(t,e){const[n,l]=Xt(t,e);return n?qt(await n.withPromise(),l):[]}_(Ie,"Bs");d(Ie,"Be");function Jn(t,e){const[n,l]=Xt(t,e);return n?qt(n.sync(),l):[]}_(Jn,"Cs");d(Jn,"Oe");var tr=Object.defineProperty,er=_((t,e)=>tr(t,"name",{value:e,configurable:!0}),"t");const sr=er(async(t,e)=>await Ie(t,e),"i");export{sr as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var D=Object.defineProperty;var v=(t,e)=>D(t,"name",{value:e,configurable:!0});import{m as w,D as C,g as S,f as A}from"./provenance-DkCA8BrN.js";import{$ as m}from"../packem_chunks/bin.js";import{x as W}from"./build-scripts-DE6U8jVq.js";import{n as b}from"./license-zZU7aavK.js";import{a as j,C as F,B as U}from"./readFileSync-DseCu8sg-DEq4Fn3a.js";import{S as E}from"./lockfile-CrT86D6d.js";import{L as N}from"./dependency-scan-BUbOcMwX.js";var I=Object.defineProperty,L=v((t,e)=>I(t,"name",{value:e,configurable:!0}),"i");const g={CRITICAL:0,HIGH:1,LOW:3,MODERATE:2,UNKNOWN:4},we=L((t,e)=>{const i=g[(t.vulnerability.severity??"UNKNOWN").toUpperCase()]??4,n=g[(e.vulnerability.severity??"UNKNOWN").toUpperCase()]??4;return i-n||t.packageName.localeCompare(e.packageName)||t.packageVersion.localeCompare(e.packageVersion)},"compareFindingsForDisplay"),M=L((t,e)=>{const i=g[e.toUpperCase()]??2;return(g[t.toUpperCase()]??4)<=i},"severityPassesFilter"),P=["firstSeen","installScripts","license","malware","publisherChange","score","unexpectedDeps","vulnerability"];var V=Object.defineProperty,R=v((t,e)=>V(t,"name",{value:e,configurable:!0}),"r");const $=6e4,_=R((t,e,i)=>{for(const n of i)if(n===t||n===`${t}@${e}`||n.endsWith("*")&&t.startsWith(n.slice(0,-1)))return!0;return!1},"isExcluded"),T=R(async(t,e)=>{const i=e.security?.policies?.firstSeen;if(i?.minutes===void 0||i.minutes<=0)return[];const{minutes:n}=i,a=i.exclude??[],o=e.security?.acceptedRisks,c=n*$,s=Date.now();return(await w(t.packages,C,async r=>{if(_(r.name,r.version,a))return;const l=await S(r.name,{workspaceRoot:t.workspaceRoot});if(l===void 0)return;const p=l.time?.[r.version];if(p===void 0)return;const u=Date.parse(p);if(Number.isNaN(u))return;const f=s-u;if(f>=c)return;const k=Math.max(0,Math.floor(f/$));return{acceptedRisk:m(r.name,r.version,o,"firstSeen"),data:{ageMinutes:k,minimumMinutes:n,publishedAt:p},packageName:r.name,policy:"firstSeen",reason:`${r.name}@${r.version} was published ${String(k)} min ago — below the ${String(n)} min firstSeen cooldown.`,severity:"block",version:r.version}})).filter(r=>r!==void 0)},"evaluateFirstSeenPolicy");var K=Object.defineProperty,H=v((t,e)=>K(t,"name",{value:e,configurable:!0}),"n");const q=H((t,e)=>{const i=e.security?.policies?.installScripts;if(!i)return[];const n=i.allow??{},a=i.strict===!0;if(!a&&Object.keys(n).length===0)return[];const o=W(t.workspaceRoot,n,{pinVersions:e.security?.pinVersions===!0});if(o.unapproved.length===0)return[];const c=e.security?.acceptedRisks,s=a?"block":"warn";return o.unapproved.map(r=>({acceptedRisk:m(r.name,r.version??"*",c,"installScripts"),data:{hooks:r.hooks},packageName:r.name,policy:"installScripts",reason:`${r.name}${r.version?`@${r.version}`:""} declares unapproved build script(s): ${r.hooks.join(", ")}`,severity:s,version:r.version??"*"}))},"evaluateInstallScriptsPolicy");var z=Object.defineProperty,y=v((t,e)=>z(t,"name",{value:e,configurable:!0}),"a");const Y=new Set(["AND","OR"]),B=y(t=>{const e=t.replaceAll("("," ").replaceAll(")"," ").split(/\s+/).map(a=>a.trim()).filter(a=>a.length>0),i=[];let n=!1;for(const a of e){const o=a.toUpperCase();if(n){n=!1;continue}if(o==="WITH"){n=!0;continue}if(Y.has(o))continue;const c=a.endsWith("+"),s=c?a.slice(0,-1):a,r=b(s)??s;i.push(r),c&&i.push(`${r}-or-later`)}return i},"extractSpdxLeaves"),G=y(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(i=>i&&typeof i.type=="string"?i.type.trim():"").filter(i=>i.length>0);if(e.length>0)return e.length===1?e[0]:`(${e.join(" OR ")})`}},"declaredLicense"),J=y((t,e)=>{if(e.length===0)return;const i=new Set(e.map(n=>b(n)??n).map(n=>n.toLowerCase()));for(const n of t)if(i.has(n.toLowerCase()))return n},"findDeniedLeaf"),Q=y((t,e)=>{if(e.length===0)return;const i=new Set(e.map(n=>b(n)??n).map(n=>n.toLowerCase()));for(const n of t)if(!i.has(n.toLowerCase()))return n},"findUnallowedLeaf"),X=y((t,e)=>{const i=e.security?.policies?.license;if(!i)return[];const n=i.allow??[],a=i.deny??[];if(n.length===0&&a.length===0)return[];const o=e.security?.acceptedRisks,c=[];for(const s of t.packages){const r=t.manifestData?.get(`${s.name}@${s.version}`),l=r?G(r):void 0;if(!l){n.length>0&&c.push({acceptedRisk:m(s.name,s.version,o,"license"),data:{declaredLicense:null},packageName:s.name,policy:"license",reason:`${s.name}@${s.version} declares no license; allow-list mode requires one of: ${n.join(", ")}`,severity:"block",version:s.version});continue}const p=B(l),u=J(p,a);if(u){c.push({acceptedRisk:m(s.name,s.version,o,"license"),data:{declaredLicense:l,deniedLicense:u},packageName:s.name,policy:"license",reason:`${s.name}@${s.version} uses denied license '${u}' (declared: ${l})`,severity:"block",version:s.version});continue}const f=Q(p,n);f&&c.push({acceptedRisk:m(s.name,s.version,o,"license"),data:{allowList:n,declaredLicense:l,unallowedLicense:f},packageName:s.name,policy:"license",reason:`${s.name}@${s.version} uses license '${f}' which is not on the allow-list (declared: ${l})`,severity:"block",version:s.version})}return c},"evaluateLicensePolicy");var Z=Object.defineProperty,O=v((t,e)=>Z(t,"name",{value:e,configurable:!0}),"c$1");const ee=6e4,te=O((t,e,i)=>{for(const n of i)if(n===t||n===`${t}@${e}`||n.endsWith("*")&&t.startsWith(n.slice(0,-1)))return!0;return!1},"isExcluded"),ie=O(async(t,e)=>{const i=e.security?.policies?.publisherChange;if(i?.mode!=="no-downgrade")return[];const n=i.exclude??[],a=typeof i.ignoreAfter=="number"?i.ignoreAfter*ee:void 0,o=e.security?.acceptedRisks,c=Date.now();return(await w(t.packages,C,async s=>{if(te(s.name,s.version,n))return;const r=await S(s.name,{workspaceRoot:t.workspaceRoot});if(r===void 0)return;if(a!==void 0){const p=r.time?.[s.version],u=p===void 0?Number.NaN:Date.parse(p);if(!Number.isNaN(u)&&c-u>a)return}if(r.versions[s.version]?.dist?.attestations?.provenance!==void 0)return;const l=A(r,s.version);if(l!==void 0)return{acceptedRisk:m(s.name,s.version,o,"publisherChange"),data:{priorVersionWithProvenance:l},packageName:s.name,policy:"publisherChange",reason:`${s.name}@${s.version} dropped the provenance attestation that ${s.name}@${l} carried — publisher trust downgrade.`,severity:"block",version:s.version}})).filter(s=>s!==void 0)},"evaluatePublisherChangePolicy");var ne=Object.defineProperty,h=v((t,e)=>ne(t,"name",{value:e,configurable:!0}),"l$1");const se=h(t=>{for(const e of Object.values(N))for(const i of[e.file,...e.aliases??[]])if(t===i||t.endsWith(`/${i}`)||t.endsWith(`.${i}`))return e.type},"detectLockfileType"),re=h((t,e,i)=>{const n=j(e)?e:F(t,e);let a;try{a=U(n)}catch{return}const o=se(n)??N[i]?.type;if(!o)return;const c=E(a,o);if(c.length===0)return;const s=new Set;for(const r of c)s.add(`${r.name}@${r.version}`);return s},"loadBaselineKeys"),oe=h((t,e)=>{for(const i of e)if(i===t||i.endsWith("*")&&t.startsWith(i.slice(0,-1)))return!0;return!1},"matchesAllowList"),ae=h((t,e)=>{const i=e.security?.policies?.unexpectedDeps;if(!i)return[];const n=i.allow??[],a=i.baselineLockfile;if(n.length===0&&!a)return[];const o=a?re(t.workspaceRoot,a,t.packageManager):void 0,c=e.security?.acceptedRisks,s=[];for(const r of t.packages){const l=n.length===0||oe(r.name,n),p=o?o.has(`${r.name}@${r.version}`):!0;if(l&&p)continue;const u=[],f={};l||(u.push(`not on allow-list (${n.length} entr${n.length===1?"y":"ies"})`),f.allowList=n),!p&&o&&(u.push(`not present in baseline lockfile (${a})`),f.baselineLockfile=a),s.push({acceptedRisk:m(r.name,r.version,c,"unexpectedDeps"),data:f,packageName:r.name,policy:"unexpectedDeps",reason:`${r.name}@${r.version} is unexpected: ${u.join("; ")}`,severity:"block",version:r.version})}return s},"evaluateUnexpectedDepsPolicy");var ce=Object.defineProperty,le=v((t,e)=>ce(t,"name",{value:e,configurable:!0}),"c");const ue=le((t,e)=>{if(!t.osvFindings||t.osvFindings.size===0)return[];const i=e.security?.policies?.vulnerability?.failOn,n=e.security?.acceptedRisks,a=[];for(const o of t.packages){const c=t.osvFindings.get(o.name);if(!(!c||c.length===0))for(const s of c){const r=i?M(s.severity,i)?"block":"warn":"info";a.push({acceptedRisk:m(o.name,o.version,n,"vulnerability"),data:{advisoryId:s.id,aliases:s.aliases??[],cvssScore:s.cvssScore,fixedVersions:s.fixedVersions,severity:s.severity,summary:s.summary},packageName:o.name,policy:"vulnerability",reason:`${s.severity} ${s.id} affects ${o.name}@${o.version}: ${s.summary}`,severity:r,version:o.version})}}return a},"evaluateVulnerabilityPolicy");var pe=Object.defineProperty,d=v((t,e)=>pe(t,"name",{value:e,configurable:!0}),"t");const x=[{evaluate:ue,isConfigured:d(t=>t.security?.policies?.vulnerability!==void 0,"isConfigured"),name:"vulnerability",offlineSupported:!0,surfaces:["audit","doctor"]},{evaluate:X,isConfigured:d(t=>{const e=t.security?.policies?.license;return!!(e&&(e.allow&&e.allow.length>0||e.deny&&e.deny.length>0))},"isConfigured"),name:"license",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:q,isConfigured:d(t=>{const e=t.security?.policies?.installScripts;return!!(e&&(e.allow&&Object.keys(e.allow).length>0||e.strict===!0))},"isConfigured"),name:"installScripts",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:ae,isConfigured:d(t=>{const e=t.security?.policies?.unexpectedDeps;return!!(e&&(e.allow&&e.allow.length>0||typeof e.baselineLockfile=="string"))},"isConfigured"),name:"unexpectedDeps",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:T,isConfigured:d(t=>{const e=t.security?.policies?.firstSeen?.minutes;return typeof e=="number"&&e>0},"isConfigured"),name:"firstSeen",offlineSupported:!1,surfaces:["audit","doctor","install"]},{evaluate:ie,isConfigured:d(t=>t.security?.policies?.publisherChange?.mode==="no-downgrade","isConfigured"),name:"publisherChange",offlineSupported:!1,surfaces:["audit","doctor","install"]}],fe=d((t,e,i)=>x.filter(n=>n.surfaces.includes(t)?i!==void 0?i.has(n.name):n.isConfigured(e):!1),"selectModules"),Ce=d(async(t,e,i)=>{const n=fe(e,i.visConfig,i.enabledPolicies),a=[];for(const o of n){if(t.offline&&!o.offlineSupported){a.push({packageName:"*",policy:o.name,reason:`policy.${o.name} skipped: requires network (--offline)`,severity:"info",version:"*"});continue}try{const c=await o.evaluate(t,i.visConfig);a.push(...c)}catch(c){const s=c instanceof Error?c.message:String(c);a.push({packageName:"*",policy:o.name,reason:`policy.${o.name} failed: ${s}`,severity:"info",version:"*"})}}return a},"evaluatePolicies"),de=(()=>{const t=new Map;for(const e of P)t.set(e.toLowerCase(),e);return t})(),Se=d(()=>x.map(t=>t.name),"getRegisteredPolicyNames"),Ne=d((t,e)=>{if(t===void 0)return;const i=t.trim().toLowerCase();if(i===""||i==="none")return new Set;if(i==="all")return new Set(P);const n=new Set;for(const a of t.split(",").map(o=>o.trim()).filter(o=>o.length>0)){const o=a.replace(/^_+/,"").replaceAll(/_+([a-z])/g,(s,r)=>r.toUpperCase()),c=de.get(o.toLowerCase());c===void 0?e?.(a):n.add(c)}return n},"parsePoliciesFlag");export{we as c,Ce as e,Se as g,Ne as p,M as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var ce=Object.defineProperty;var f=(e,t)=>ce(e,"name",{value:t,configurable:!0});var le=Object.defineProperty,M=f((e,t)=>le(e,"name",{value:t,configurable:!0}),"i$6");const U=M(e=>{const t=new Set,n=[e];for(let r=0;r<n.length;r++){const o=n[r];if(t.has(o))continue;t.add(o);const{children:a}=o;if(a?.length)for(let i=0,u=a.length;i<u;i++)n.push(a[i])}return Array.from(t)},"getNodes"),pe=M(e=>{let t="";const n=U(e);for(let r=0,o=n.length;r<o;r++){const a=n[r];if(!a.regex)continue;const i=a.regex.flags;if(t||(t=i),t!==i)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${i}"`)}return t},"getNodeFlags"),T=M((e,t,n)=>{const r=n.get(e);if(r!==void 0)return r;const o=e.partial??t;let a="";if(e.regex&&(a+=o?"(?:$|":"",a+=e.regex.source),e.children?.length){const i=$e(e.children.map(u=>T(u,t,n)).filter(Boolean));if(i?.length){const u=e.children.some(w=>!w.regex||!(w.partial??t)),p=i.length>1||o&&(!a.length||u);a+=p?o?"(?:$|":"(?:":"",a+=i.join("|"),a+=p?")":""}}return e.regex&&(a+=o?")":""),n.set(e,a),a},"getNodeSourceWithCache"),fe=M((e,t)=>{const n=new Map,r=U(e);for(let o=r.length-1;o>=0;o--){const a=T(r[o],t,n);if(!(o>0))return a}return""},"getNodeSource"),$e=M(e=>Array.from(new Set(e)),"uniq");var ge=Object.defineProperty,de=f((e,t)=>ge(e,"name",{value:t,configurable:!0}),"a$6");const B=de((e,t,n)=>B.compile(e,n).test(t),"graphmatch");B.compile=(e,t)=>{const n=t?.partial??!1,r=fe(e,n),o=pe(e);return new RegExp(`^(?:${r})$`,o)};var he=Object.defineProperty,xe=f((e,t)=>he(e,"name",{value:t,configurable:!0}),"r$2");const me=xe((e,t)=>{const n=B.compile(e,t),r=`${n.source.slice(0,-1)}[\\\\/]?$`,o=n.flags;return new RegExp(r,o)},"compile");var ve=Object.defineProperty,be=f((e,t)=>ve(e,"name",{value:t,configurable:!0}),"n$1");const ye=be(e=>{const t=e.map(r=>r.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"merge");var je=Object.defineProperty,h=f((e,t)=>je(e,"name",{value:t,configurable:!0}),"e$1");const X=h(e=>Array.isArray(e),"isArray"),z=h(e=>typeof e=="function","isFunction"),we=h(e=>e.length===0,"isFunctionNullary"),ke=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),Me=h(e=>typeof e=="number","isNumber"),ze=h(e=>typeof e=="object"&&e!==null,"isObject"),Oe=h(e=>e instanceof RegExp,"isRegExp"),Pe=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Ae=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),Y=h(e=>typeof e=="string","isString"),m=h(e=>e===void 0,"isUndefined"),Ee=h(e=>{const t=new Map;return n=>{const r=t.get(n);if(r!==void 0)return r;const o=e(n);return t.set(n,o),o}},"memoize");var Re=Object.defineProperty,c=f((e,t)=>Re(e,"name",{value:t,configurable:!0}),"s");const D=c((e,t,n={})=>{const r={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},o=g(t)(r),a=Math.max(r.index,r.indexBacktrackMax);if(o&&r.index===e.length)return r.output;throw new Error(`Failed to parse at index ${a}`)},"parse");c((e,t,n={})=>{const r={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]};return g(t)(r)&&r.index===e.length},"validate");const s=c((e,t)=>X(e)?Ie(e,t):Y(e)?G(e,t):Se(e,t),"match"),Ie=c((e,t)=>{const n={};for(const r of e){if(r.length!==1)throw new Error(`Invalid character: "${r}"`);const o=r.charCodeAt(0);n[o]=!0}return r=>{const o=r.input;let a=r.index,i=a;for(;i<o.length&&o.charCodeAt(i)in n;)i+=1;if(i>a){if(!m(t)&&!r.options.silent){const u=o.slice(a,i),p=z(t)?t(u,o,`${a}`):t;m(p)||r.output.push(p)}r.index=i}return!0}},"chars"),Se=c((e,t)=>{if(Ae(e))return G(e.source,t);{const n=e.source,r=e.flags.replace(/y|$/,"y"),o=new RegExp(n,r);return Pe(e)&&z(t)&&!ke(t)?Be(o,t):Ce(o,t)}},"regex"),Be=c((e,t)=>n=>{const r=n.index,o=n.input;e.lastIndex=r;const a=e.exec(o);if(a){const i=e.lastIndex;if(!n.options.silent){const u=t(...a,o,`${r}`);m(u)||n.output.push(u)}return n.index=i,!0}else return!1},"regexCapturing"),Ce=c((e,t)=>n=>{const r=n.index,o=n.input;if(e.lastIndex=r,e.test(o)){const a=e.lastIndex;if(!m(t)&&!n.options.silent){const i=z(t)?t(o.slice(r,a),o,`${r}`):t;m(i)||n.output.push(i)}return n.index=a,!0}else return!1},"regexNonCapturing"),G=c((e,t)=>n=>{const r=n.index,o=n.input;if(o.startsWith(e,r)){if(!m(t)&&!n.options.silent){const a=z(t)?t(e,o,`${r}`):t;m(a)||n.output.push(a)}return n.index+=e.length,!0}else return!1},"string"),E=c((e,t,n,r)=>{const o=g(e),a=t>1;return F(R(N(i=>{let u=0;for(;u<n;){const p=i.index;if(!o(i)||(u+=1,i.index===p))break}return u>=t},a),r))},"repeat"),C=c((e,t)=>E(e,0,1,t),"optional"),O=c((e,t)=>E(e,0,1/0,t),"star"),H=c((e,t)=>E(e,1,1/0,t),"plus"),v=c((e,t)=>{const n=e.map(g);return F(R(N(r=>{for(let o=0,a=n.length;o<a;o++)if(!n[o](r))return!1;return!0}),t))},"and"),$=c((e,t)=>{const n=e.map(g);return F(R(r=>{for(let o=0,a=n.length;o<a;o++)if(n[o](r))return!0;return!1},t))},"or"),Ne=c((e,t)=>{const n={};for(const r in e){if(r.length!==1&&r!=="default")throw new Error(`Invalid jump character: "${r}"`);n[r]=g(e[r])}return R(r=>{const o=r.input[r.index],a=n[o]||n.default;return a?a(r):!1},t)},"jump"),J=c((e,t)=>{const n=g(e);return N(r=>n(r)===t,!0,!0)},"lookahead"),Fe=c(e=>J(e,!1),"negative"),Ze=c(e=>J(e,!0),"positive"),N=c((e,t=!0,n=!1)=>{const r=g(e);return t?o=>{const a=o.index,i=o.output.length,u=r(o);return!u&&!n&&(o.indexBacktrackMax=Math.max(o.indexBacktrackMax,o.index)),(!u||n)&&(o.index=a,o.output.length!==i&&(o.output.length=i)),u}:r},"backtrackable"),R=c((e,t)=>{const n=g(e);return t?r=>{if(r.options.silent)return n(r);const o=r.output.length;if(n(r)){const a=r.output.splice(o,1/0),i=t(a);return m(i)||r.output.push(i),!0}else return!1}:n},"handleable"),F=(()=>{let e=0;return t=>{const n=g(t),r=e+=1;return o=>{var a;if(o.options.memoization===!1)return n(o);const i=o.index,u=(a=o.cache)[r]||(a[r]={indexMax:-1,queue:[]}),p=u.queue;if(i<=u.indexMax){const k=u.store||(u.store=new Map);if(p.length){for(let y=0,ie=p.length;y<ie;y+=2){const se=p[y*2],ue=p[y*2+1];k.set(se,ue)}p.length=0}const d=k.get(i);if(d===!1)return!1;if(Me(d))return o.index=d,!0;if(d)return o.index=d.index,d.output?.length&&o.output.push(...d.output),!0}const w=o.output.length,ae=n(o);if(u.indexMax=Math.max(u.indexMax,i),ae){const k=o.index,d=o.output.length;if(d>w){const y=o.output.slice(w,d);p.push(i,{index:k,output:y})}else p.push(i,k);return!0}else return p.push(i,!1),!1}}})();c(e=>e({match:s,repeat:E,optional:C,star:O,plus:H,and:v,or:$,jump:Ne,negative:Fe,positive:Ze,lazy:Z}),"grammar");const Z=c(e=>{let t;return n=>(t||(t=g(e())),t(n))},"lazy"),g=Ee(e=>{if(z(e))return we(e)?Z(e):e;if(Y(e)||Oe(e))return s(e);if(X(e))return v(e);if(ze(e))return $(Object.values(e));throw new Error("Invalid rule")});var qe=Object.defineProperty,I=f((e,t)=>qe(e,"name",{value:t,configurable:!0}),"a$3");const b=I(e=>e,"identity"),_e=I(e=>typeof e=="string","isString"),We=I(e=>{const t=new WeakMap,n=new WeakMap;return(r,o)=>{const a=o?.partial?n:t,i=a.get(r);if(i!==void 0)return i;const u=e(r,o);return a.set(r,u),u}},"memoizeByObject"),Le=I(e=>{const t={},n={};return(r,o)=>{const a=o?.partial?n:t;return a[r]??(a[r]=e(r,o))}},"memoizeByPrimitive"),Ue=s(/\\./,b),Te=s(/./,b),Xe=s(/\*\*\*+/,"*"),Ye=s(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),De=s(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),Ge=O($([Ue,Xe,Ye,De,Te]));var He=Object.defineProperty,Je=f((e,t)=>He(e,"name",{value:t,configurable:!0}),"o$3");const Ke=Je(e=>D(e,Ge,{memoization:!1}).join(""),"normalize");var Qe=Object.defineProperty,P=f((e,t)=>Qe(e,"name",{value:t,configurable:!0}),"a$1");const K="abcdefghijklmnopqrstuvwxyz",Ve=P(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=K[n]+t,e=Math.floor((e-1)/26)}return t},"int2alpha"),W=P(e=>{let t=0;for(let n=0,r=e.length;n<r;n++)t=t*26+K.indexOf(e[n])+1;return t},"alpha2int"),q=P((e,t)=>{if(t<e)return q(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"makeRangeInt"),et=P((e,t,n)=>q(e,t).map(r=>String(r).padStart(n,"0")),"makeRangePaddedInt"),Q=P((e,t)=>q(W(e),W(t)).map(Ve),"makeRangeAlpha");var tt=Object.defineProperty,S=f((e,t)=>tt(e,"name",{value:t,configurable:!0}),"l");const l=S(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"regex"),A=S(e=>({children:e}),"alternation"),j=(()=>{const e=S((t,n,r)=>{if(r.has(t))return;r.add(t);const{children:o}=t;if(!o.length)o.push(n);else for(let a=0,i=o.length;a<i;a++)e(o[a],n,r)},"pushToLeaves");return t=>{if(!t.length)return A([]);for(let n=t.length-1;n>=1;n--){const r=new Set,o=t[n-1],a=t[n];e(o,a,r)}return t[0]}})(),x=S(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"slash"),nt=s(/\\./,l),rt=s(/[$.*+?^(){}[\]\|]/,e=>l(`\\${e}`)),ot=s(/[\\\/]/,x),at=s(/[^$.*+?^(){}[\]\|\\\/]+/,l),it=s(/^(?:!!)*!(.*)$/,(e,t)=>l(`(?!^${_.compile(t).source}$).*?`)),st=s(/^(!!)+/),ut=$([it,st]),ct=s(/\/(\*\*\/)+/,()=>A([j([x(),l(".+?"),x()]),x()])),lt=s(/^(\*\*\/)+/,()=>A([l("^"),j([l(".*?"),x()])])),pt=s(/\/(\*\*)$/,()=>A([j([x(),l(".*?")]),l("$")])),ft=s(/\*\*/,()=>l(".*?")),V=$([ct,lt,pt,ft]),$t=s(/\*\/(?!\*\*\/|\*$)/,()=>j([l("[^\\\\/]*?"),x()])),gt=s(/\*/,()=>l("[^\\\\/]*")),ee=$([$t,gt]),te=s("?",()=>l("[^\\\\/]")),dt=s("[",b),ht=s("]",b),xt=s(/[!^]/,"^\\\\/"),mt=s(/[a-z]-[a-z]|[0-9]-[0-9]/i,b),vt=s(/\\./,b),bt=s(/[$.*+?^(){}[\|]/,e=>`\\${e}`),yt=s(/[\\\/]/,"\\\\/"),jt=s(/[^$.*+?^(){}[\]\|\\\/]+/,b),wt=$([vt,bt,yt,mt,jt]),ne=v([dt,C(xt),O(wt),ht],e=>l(e.join(""))),kt=s("{","(?:"),Mt=s("}",")"),zt=s(/(\d+)\.\.(\d+)/,(e,t,n)=>et(+t,+n,Math.min(t.length,n.length)).join("|")),Ot=s(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>Q(t,n).join("|")),Pt=s(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>Q(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),At=$([zt,Ot,Pt]),re=v([kt,At,Mt],e=>l(e.join(""))),Et=s("{"),Rt=s("}"),It=s(","),St=s(/\\./,l),Bt=s(/[$.*+?^(){[\]\|]/,e=>l(`\\${e}`)),Ct=s(/[\\\/]/,x),Nt=s(/[^$.*+?^(){}[\]\|\\\/,]+/,l),Ft=Z(()=>oe),Zt=s("",()=>l("(?:)")),qt=H($([V,ee,te,ne,re,Ft,St,Bt,Ct,Nt]),j),L=$([qt,Zt]),oe=v([Et,C(v([L,O(v([It,L]))])),Rt],A),_t=O($([ut,V,ee,te,ne,re,oe,nt,rt,ot,at]),j);var Wt=Object.defineProperty,Lt=f((e,t)=>Wt(e,"name",{value:t,configurable:!0}),"m");const Ut=Lt(e=>D(e,_t,{memoization:!1})[0],"_parse");var Tt=Object.defineProperty,Xt=f((e,t)=>Tt(e,"name",{value:t,configurable:!0}),"i");const _=Xt((e,t,n)=>_.compile(e,n).test(t),"zeptomatch");_.compile=(()=>{const e=Le((n,r)=>me(Ut(Ke(n)),r)),t=We((n,r)=>ye(n.map(o=>e(o,r))));return(n,r)=>_e(n)?e(n,r):t(n,r)})();export{_ as o};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var on=Object.defineProperty;var _=(t,e)=>on(t,"name",{value:e,configurable:!0});import{createRequire as sn}from"node:module";import"./_commonjsHelpers-CLblCigl.js";import __cjs_mod__ from "node:module"; // -- packem CommonJS require shim --
|
|
2
|
+
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
3
|
+
const rn=sn(import.meta.url),le=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,an=_(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 rn(t)},"__cjs_getBuiltinModule"),{createRequire:Me}=an("node:module"),ln=16,Be=32,cn=64,oe=128,ye="positionals";var un=Object.defineProperty,gt=_((t,e)=>un(t,"name",{value:e,configurable:!0}),"i$5"),pn=Object.defineProperty,wt=gt((t,e)=>pn(t,"name",{value:e,configurable:!0}),"s"),hn=Object.defineProperty,vt=wt((t,e)=>hn(t,"name",{value:e,configurable:!0}),"t");vt(t=>t instanceof Error&&t.type==="VisulimaError","isVisulimaError");let de=class extends Error{static{_(this,"f")}static{gt(this,"E")}static{wt(this,"VisulimaError")}static{vt(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:e,hint:n,location:o,message:s,name:i,stack:a,title:l}){super(s,{cause:e}),this.title=l,this.name=i,this.stack=a??this.stack,this.loc=o,this.hint=n}setLocation(e){this.loc=e}setName(e){this.name=e}setMessage(e){this.message=e}setHint(e){this.hint=e}};var fn=Object.defineProperty,dn=_((t,e)=>fn(t,"name",{value:e,configurable:!0}),"t$3");let k=class extends de{static{_(this,"a")}static{dn(this,"n")}code;context;constructor(e,n,o){super({message:e,name:"CerebroError"}),this.code=n,this.context=o}};var mn=Object.defineProperty,S=_((t,e)=>mn(t,"name",{value:e,configurable:!0}),"r$1");const U=S(t=>"Deno"in t,"n"),D=S(t=>"Bun"in t,"l"),$e=S(()=>{if(U(globalThis)){const t=globalThis.Deno,e=t.execPath();let n=e;try{const{importMeta:o}=globalThis;o?.url&&(n=o.url)}catch{}return[e,n,...t.args]}return D(globalThis)?globalThis.Bun.process.argv:process.argv},"i"),gn=S(()=>U(globalThis)?globalThis.Deno.cwd():D(globalThis)?globalThis.Bun.process.cwd():process.cwd(),"t"),q=S(()=>{if(U(globalThis)){const t=globalThis.Deno;return new Proxy(t.env.toObject(),{get:S((e,n)=>typeof n=="string"?t.env.get(n):e[n],"get"),has:S((e,n)=>typeof n=="string"?t.env.has(n):n in e,"has"),set:S((e,n,o)=>typeof n=="string"?(o===void 0||t.env.set(n,o),!0):!1,"set")})}return D(globalThis)?globalThis.Bun.process.env:process.env},"a"),yt=S(()=>U(globalThis)?[]:D(globalThis)?globalThis.Bun.process.execArgv:process.execArgv,"c"),bt=S(()=>U(globalThis)?globalThis.Deno.execPath():D(globalThis)?globalThis.Bun.process.execPath:process.execPath,"g"),wn=S(()=>{if(U(globalThis)){const t=globalThis.Deno.build?.os??"unknown";return t==="windows"?"win32":t}return D(globalThis)?globalThis.Bun.platform??"unknown":process.platform},"h"),vn=S(()=>{if(U(globalThis)){const t=globalThis.Deno.build?.arch??"unknown";return t==="x86_64"?"x64":t==="aarch64"?"arm64":t}return D(globalThis)?globalThis.Bun.process.arch:process.arch},"b");S(()=>{if(U(globalThis)){const t=globalThis.Deno,e={};return t.version?.deno&&(e.deno=t.version.deno),t.version?.v8&&(e.v8=t.version.v8),t.version?.typescript&&(e.typescript=t.version.typescript),e}if(D(globalThis)){const t=globalThis.Bun,e={...t.process.versions};return t.version&&(e.bun=t.version),e}return process.versions},"T");const z=S((t=0)=>{if(U(globalThis))throw globalThis.Deno.exit(t),new Error("Deno exit failed");if(D(globalThis))throw globalThis.Bun.process.exit(t),new Error("Bun exit failed");process.exit(t)},"u"),Re=S((t,e)=>{if(U(globalThis))return()=>{};if(D(globalThis)){try{const o=globalThis.Bun;if(o.process?.on)return o.process.on(t,e),()=>{o.process?.removeListener&&o.process.removeListener(t,e)}}catch{}return()=>{}}const n=process;return n.on(t,e),()=>{n.removeListener(t,e)}},"p");var yn=Object.defineProperty,xe=_((t,e)=>yn(t,"name",{value:e,configurable:!0}),"k$1");const R=new Uint32Array(65536),bn=xe((t,e)=>{const n=t.length,o=e.length,s=1<<n-1;let i=-1,a=0,l=n,h=n;for(;h--;)R[t.charCodeAt(h)]|=1<<h;for(h=0;h<o;h++){let r=R[e.charCodeAt(h)];const c=r|a;r|=(r&i)+i^i,a|=~(r|i),i&=r,a&s&&l++,i&s&&l--,a=a<<1|1,i=i<<1|~(c|a),a&=c}for(h=n;h--;)R[t.charCodeAt(h)]=0;return l},"myers_32"),$n=xe((t,e)=>{const n=e.length,o=t.length,s=[],i=[],a=Math.ceil(n/32),l=Math.ceil(o/32);for(let u=0;u<a;u++)i[u]=-1,s[u]=0;let h=0;for(;h<l-1;h++){let u=0,v=-1;const $=h*32,y=Math.min(32,o)+$;for(let x=$;x<y;x++)R[t.charCodeAt(x)]|=1<<x;for(let x=0;x<n;x++){const E=R[e.charCodeAt(x)],O=i[x/32|0]>>>x&1,f=s[x/32|0]>>>x&1,w=E|u,b=((E|f)&v)+v^v|E|f;let N=u|~(b|v),A=v&b;N>>>31^O&&(i[x/32|0]^=1<<x),A>>>31^f&&(s[x/32|0]^=1<<x),N=N<<1|O,A=A<<1|f,v=A|~(w|N),u=N&w}for(let x=$;x<y;x++)R[t.charCodeAt(x)]=0}let r=0,c=-1;const m=h*32,p=Math.min(32,o-m)+m;for(let u=m;u<p;u++)R[t.charCodeAt(u)]|=1<<u;let g=o;for(let u=0;u<n;u++){const v=R[e.charCodeAt(u)],$=i[u/32|0]>>>u&1,y=s[u/32|0]>>>u&1,x=v|r,E=((v|y)&c)+c^c|v|y;let O=r|~(E|c),f=c&E;g+=O>>>o-1&1,g-=f>>>o-1&1,O>>>31^$&&(i[u/32|0]^=1<<u),f>>>31^y&&(s[u/32|0]^=1<<u),O=O<<1|$,f=f<<1|y,c=f|~(x|O),r=O&x}for(let u=m;u<p;u++)R[t.charCodeAt(u)]=0;return g},"myers_x"),$t=xe((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):$n(t,e)},"distance");xe((t,e)=>{let n=1/0,o=0;for(let s=0;s<e.length;s++){const i=$t(t,e[s]);i<n&&(n=i,o=s)}return e[o]},"closest");var xn=Object.defineProperty,xt=_((t,e)=>xn(t,"name",{value:e,configurable:!0}),"e$1");const Nt=String.raw,ze=Nt`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,Nn=xt(()=>new RegExp(Nt`\p{RI}{2}|(?)${ze}(?:\u200D${ze})*`,"gu"),"i");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 vr=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,yr=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,G=Nn(),An=/[-_./\s]+/g,be=/(\u001B\[[0-9;]*[a-z])/i,Fe=new RegExp("\\p{Script=Arabic}","u"),En=new RegExp("\\p{Script=Bengali}","u"),te=new RegExp("\\p{Script=Cyrillic}","u"),kn=new RegExp("\\p{Script=Devanagari}","u"),On=new RegExp("\\p{Script=Ethiopic}","u"),ke=new RegExp("\\p{Script=Greek}","u"),We=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),Cn=new RegExp("\\p{Script=Gujarati}","u"),_n=new RegExp("\\p{Script=Gurmukhi}","u"),qe=new RegExp("\\p{Script=Hangul}","u"),Ge=new RegExp("\\p{Script=Hebrew}","u"),Ln=new RegExp("\\p{Script=Hiragana}","u"),He=new RegExp("\\p{Script=Han}","u"),Pn=new RegExp("\\p{Script=Kannada}","u"),Tn=new RegExp("\\p{Script=Katakana}","u"),Sn=new RegExp("\\p{Script=Khmer}","u"),In=new RegExp("\\p{Script=Lao}","u"),I=new RegExp("\\p{Script=Latin}","u"),Mn=new RegExp("\\p{Script=Malayalam}","u"),jn=new RegExp("\\p{Script=Myanmar}","u"),Un=new RegExp("\\p{Script=Oriya}","u"),Dn=new RegExp("\\p{Script=Sinhala}","u"),Vn=new RegExp("\\p{Script=Tamil}","u"),Bn=new RegExp("\\p{Script=Telugu}","u"),Rn=new RegExp("\\p{Script=Thai}","u"),zn=new RegExp("\\p{Script=Tibetan}","u"),Je=/[\u02BB\u02BC\u0027]/u,Fn=xt(t=>t.replace(G,""),"A");var Wn=Object.defineProperty,d=_((t,e)=>Wn(t,"name",{value:e,configurable:!0}),"u$2");const qn=Me(import.meta.url),ce=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,At=d(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 qn(t)},"ze"),{writeFile:Gn,stat:Hn,rm:Jn,readFile:Ke,readdir:Kn,mkdir:Yn,access:Zn}=At("node:fs/promises"),{createRequire:Qn}=At("node:module"),ge=[{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 H=class extends k{static{_(this,"V")}static{d(this,"T")}commandName;constructor(e,n=[]){const o=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(o,"COMMAND_NOT_FOUND",{commandName:e,suggestions:n}),this.name="CommandNotFoundError",this.commandName=e,n.length>0&&(this.hint=`Try one of these commands: ${n.join(", ")}`)}},Et=class extends k{static{_(this,"Fe")}static{d(this,"We")}option1;option2;constructor(e,n){super(`Options "${e}" and "${n}" cannot be used together`,"CONFLICTING_OPTIONS",{option1:e,option2:n}),this.name="ConflictingOptionsError",this.option1=e,this.option2=n,this.hint=`Remove either --${e} or --${n}`}},Xn=class extends k{static{_(this,"Gt")}static{d(this,"qt")}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)}},eo=class{static{_(this,"Yt")}static{d(this,"Gt")}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`);q().CEREBRO_OUTPUT_LEVEL===String(oe)&&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(o){const s=new Xn(n.name,`Failed to initialize: ${o instanceof Error?o.message:String(o)}`,o instanceof Error?o: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 o=this.getDependencyOrder();for(const s of o){const i=s[t];if(typeof i=="function"){this.logger.debug(`executing ${t} hook for plugin: ${s.name}`);try{await(t==="afterCommand"?i(e,n):i(e))}catch(a){throw this.logger.error(`Error in ${t} hook for plugin "${s.name}":`,a),a}}}}async executeErrorHandlers(t,e){if(!this.initialized||this.plugins.size===0)return;const n=this.getDependencyOrder();for(const o of n)if(typeof o.onError=="function"){this.logger.debug(`executing error handler for plugin: ${o.name}`);try{await o.onError(t,e)}catch(s){this.logger.error(`Error in error handler for plugin "${o.name}":`,s)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const t=[],e=new Set,n=new Set,o=d(s=>{if(e.has(s))return;if(n.has(s))throw new Error(`Circular dependency detected involving plugin "${s}"`);const i=this.plugins.get(s);if(!i)throw new Error(`Plugin "${s}" not found`);if(n.add(s),i.dependencies)for(const a of i.dependencies)o(a);n.delete(s),e.add(s),t.push(i)},"s");for(const s of this.plugins.keys())o(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 fe=d(t=>t.type?.name==="Boolean","Z"),to=d(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},"Kt"),Ye=d(t=>(fe(t)||(t.typeLabel=t.typeLabel??to(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),"ke"),no=new RegExp(/^-([^\d-])$/),oo=new RegExp(/^--(\S+)/),io=new RegExp(/^-([^\d-]{2,})$/),so=d(t=>no.test(t)||oo.test(t)||io.test(t),"Qt"),ro=d((t,e)=>{const n=e[0]&&so(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const o=new Error(`Command not recognised: ${String(n)}`);throw o.command=n,o.name="INVALID_COMMAND",o}return{argv:e,command:n}},"Zt");var ao=Object.defineProperty,kt=d((t,e)=>ao(t,"name",{value:e,configurable:!0}),"Fe"),lo=Object.defineProperty,co=kt((t,e)=>lo(t,"name",{value:e,configurable:!0}),"i");let uo=class Ot extends de{static{_(this,"Ge")}static{d(this,"qe")}static{kt(this,"t")}static{co(this,"AlreadySetError")}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,Ot.prototype)}};var po=Object.defineProperty,Ct=d((t,e)=>po(t,"name",{value:e,configurable:!0}),"Ge"),ho=Object.defineProperty,fo=Ct((t,e)=>ho(t,"name",{value:e,configurable:!0}),"e");let Ze=class _t extends de{static{_(this,"ie")}static{d(this,"oe")}static{Ct(this,"o")}static{fo(this,"UnknownOptionError")}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,_t.prototype)}};var mo=Object.defineProperty,Lt=d((t,e)=>mo(t,"name",{value:e,configurable:!0}),"Ke"),go=Object.defineProperty,wo=Lt((t,e)=>go(t,"name",{value:e,configurable:!0}),"o");let vo=class Pt extends de{static{_(this,"Ke")}static{d(this,"He")}static{Lt(this,"e")}static{wo(this,"UnknownValueError")}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,Pt.prototype)}};var yo=Object.defineProperty,Tt=d((t,e)=>yo(t,"name",{value:e,configurable:!0}),"Ye"),bo=Object.defineProperty,$o=Tt((t,e)=>bo(t,"name",{value:e,configurable:!0}),"i");let M=class St extends de{static{_(this,"Qe")}static{d(this,"Je")}static{Tt(this,"e")}static{$o(this,"InvalidDefinitionsError")}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,St.prototype)}};var xo=Object.defineProperty,re=d((t,e)=>xo(t,"name",{value:e,configurable:!0}),"H"),No=Object.defineProperty,Ne=re((t,e)=>No(t,"name",{value:e,configurable:!0}),"o");const Qe=Ne(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),Xe=Ne(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),et=Ne(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),Ao=Ne((t,e)=>Array.isArray(t)?Qe(e)?t.map(Boolean):Xe(e)?t.map(Number):et(e)?t.map(String):t.map(n=>e(String(n))):t===null?null:Qe(e)?!!t:Xe(e)?Number(t):et(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t)),"convertValue");var Eo=Object.defineProperty,ko=re((t,e)=>Eo(t,"name",{value:e,configurable:!0}),"e");const P=ko((t,e,n,...o)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...o)},"debug");var Oo=Object.defineProperty,ee=re((t,e)=>Oo(t,"name",{value:e,configurable:!0}),"x$2");const Co=/-([a-z])/g,_o=/^\d+$/,Oe=ee(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),Lo=ee(t=>t.codePointAt(0)===95,"isSpecialKey"),tt=ee((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),nt=ee(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),ot=ee((t,e,n,o=!1)=>{t[e]===void 0?t[e]=o?[n]:n:o&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},"createOrAppendArray"),Po=ee((t,e,n,o,s)=>{let i=e.get(t)??n.get(t);if(!i&&o){const a=t.toLowerCase();i=o.get(a)??s?.get(a)}return i},"getDefinition"),To=ee((t,e,n,o)=>{const s=n.debug??!1;P(s,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),P(s,"Starting argument resolution","resolver"),P(s,"Tokens:","resolver",t),P(s,"Definitions:","resolver",e),P(s,"Processing tokens...","resolver");const i=new Map,a=new Map,l=n.caseInsensitive?new Map:void 0,h=n.caseInsensitive?new Map:void 0,r=n.camelCase?new Map:void 0,c=n.camelCase?new Map:void 0;for(const f of e)if(i.set(f.name,f),f.alias&&a.set(f.alias,f),n.caseInsensitive&&l&&(l.set(f.name.toLowerCase(),f),f.alias&&h&&h.set(f.alias.toLowerCase(),f)),n.camelCase&&r&&c){const w=f.name.replaceAll(Co,(b,N)=>N.toUpperCase());r.set(f.name,w),c.set(w,f.name)}const m={},p={},g=[],u=[],v=new Set;let $=!1;const y=e.find(f=>f.defaultOption),x=e.some(f=>f.group),E=e.some(f=>f.type===Number);for(let f=0;f<t.length;f++){const w=t[f];if(w.kind==="option-terminator"){m._unknown=o.slice(w.index),$=!0;break}if(w.kind==="option"&&w.name){let b=Po(w.name,i,a,l,h);if(!b&&w.value===void 0&&E&&_o.test(w.name)){const C=e.find(V=>V.type===Number);C&&(b=C,w.value=w.name,w.name=C.name)}const N=b?b.name:w.name,A=b?.multiple,j=b?.lazyMultiple;if(p[N]!==void 0&&!A&&!j&&!n.partial)throw new uo(N);if(!b&&n.partial){const C=w.rawName??`--${w.name}${w.value!==void 0&&w.inlineValue?`=${w.value}`:""}`;g.push({index:w.index,value:C});continue}if(!b&&n.stopAtFirstUnknown){m._unknown=o.slice(w.index);break}if(!b&&!n.partial)throw new Ze(w.name);if(w.value===void 0){const C=t[f+1],V=C?.kind==="option"&&!("name"in C)&&C.value!==void 0,T=C&&b&&!(b.type&&Oe(b.type))&&(C.kind==="positional"||V),nn=b&&b.defaultOption&&!b.multiple&&!b.lazyMultiple;if(T&&(!b?.defaultOption||nn))if(A){let B=f+1;const Ee=[];for(;B<t.length&&(t[B].kind==="positional"||t[B].kind==="option"&&!("name"in t[B])&&t[B].value!==void 0);)Ee.push(t[B].value),v.add(t[B].index),B++;p[N]=p[N]===void 0?Ee:tt(p[N],Ee),f=B-1}else j?(ot(p,N,C.value,!0),v.add(C.index),f++):(p[N]=C.value,v.add(C.index),f++);else b?.type&&Oe(b.type)?ot(p,N,!0,A):p[N]=A?[]:null}else{let{value:C}=w;if(b?.type&&Oe(b.type))switch(C){case"":{if(n.partial){p._unknown??=[];const T=`${w.rawName??`--${w.name}`}${w.value?`=${w.value}`:""}`;p._unknown.push(T),u.push({index:w.index,value:T}),C=!0}else throw new Ze(w.name);break}case"false":{C=!1;break}case"true":{C=!0;break}default:C=!0}const V=[C];if(A){let T=f+1;for(;T<t.length&&t[T].kind==="positional";)V.push(t[T].value),v.add(t[T].index),T++;f=T-1}p[N]===void 0?p[N]=A||j?V:C:A||j?p[N]=tt(p[N],V):p[N]=C}}else if(w.kind==="positional"&&n.stopAtFirstUnknown&&!v.has(w.index)&&!y){P(s,`Found unconsumed positional token at index ${String(w.index)}, stopping processing`,"resolver"),m._unknown=o.slice(w.index);break}}for(const[f,w]of Object.entries(p)){const b=i.get(f);b&&(b.multiple||b.lazyMultiple)&&!Array.isArray(w)&&(p[f]=[w])}let O=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!$){for(const f of t)if(f.kind==="option"&&!i.has(f.name??"")&&!a.has(f.name??"")&&(!n.caseInsensitive||!l?.has(f.name?.toLowerCase()??"")&&!h?.has(f.name?.toLowerCase()??""))){O=f.index;break}}if(y){const f=[],w=[];for(const b of t)b.kind==="positional"&&!v.has(b.index)&&b.index<O&&(f.push(b.value),w.push(b));if(f.length>0){const b=p[y.name],N=y.multiple??y.lazyMultiple;b===void 0?N?(w.forEach(A=>v.add(A.index)),p[y.name]=f):(v.add(w[0].index),p[y.name]=f[0]):N&&(w.forEach(A=>v.add(A.index)),p[y.name]=Array.isArray(b)?[...f,...b]:[...f,b])}}if(!n.partial){for(const f of t)if(f.kind==="positional"&&!v.has(f.index))throw new vo(o[f.index])}if(n.partial&&!n.stopAtFirstUnknown){const f=[...g];if(p._unknown)for(const w of u)f.push({index:w.index,value:w.value});for(const w of t)w.kind==="positional"&&!v.has(w.index)&&f.push({index:w.index,value:o[w.index]});f.length>0&&(f.sort((w,b)=>w.index-b.index),m._unknown=f.map(w=>w.value))}if(n.stopAtFirstUnknown&&!$){const f=t.findIndex(N=>N.kind==="option"&&!i.has(N.name??"")&&!a.has(N.name??"")&&(!n.caseInsensitive||!l?.has(N.name?.toLowerCase()??"")&&!h?.has(N.name?.toLowerCase()??""))),w=t.findIndex(N=>N.kind==="positional"&&!v.has(N.index));let b=-1;if(f!==-1&&w!==-1?b=Math.min(f,w):f!==-1?b=f:w!==-1&&(b=w),b>=0){const N=t[b].index;m._unknown=o.slice(N)}}else g.length>0&&!n.partial&&(m._unknown=g.map(f=>f.value));for(const[f,w]of Object.entries(p)){const b=n.camelCase?r?.get(f)??f:f,N=i.get(f);m[b]=N?.type?Ao(w,N.type):w===void 0?null:w}for(const f of e){const w=n.camelCase?r?.get(f.name)??f.name:f.name;!(w in m)&&f.defaultValue!==void 0&&(f.multiple??f.lazyMultiple?m[w]=Array.isArray(f.defaultValue)?[...f.defaultValue]:[f.defaultValue]:m[w]=f.defaultValue)}if(x){const f={},w={},b={};for(const A of e)if(A.group){const j=Array.isArray(A.group)?A.group:[A.group];for(const C of j)nt(C)||(f[C]??={})}for(const A of Object.keys(m))if(!Lo(A)){w[A]=m[A];let j=A;n.camelCase&&(j=c?.get(A)??A);const C=i.get(j);if(C?.group){const V=Array.isArray(C.group)?C.group:[C.group];for(const T of V)nt(T)||f[T]&&(f[T][A]=m[A])}else b[A]=m[A]}const N={_all:w};for(const[A,j]of Object.entries(f))N[A]=j;Object.keys(b).length>0&&(N._none=b),m._unknown&&(N._unknown=m._unknown),Object.keys(m).forEach(A=>delete m[A]),Object.assign(m,N)}return P(s,"Final parsed result:","resolver",m),m},"resolveArgs");var So=Object.defineProperty,ae=re((t,e)=>So(t,"name",{value:e,configurable:!0}),"l");const se="-".codePointAt(0),Y="=",Io=Y.codePointAt(0),Mo="--",jo="-",Uo="--",It=ae(t=>t.length>2&&t.startsWith(Uo),"hasLongOptionPrefix"),Do=ae(t=>It(t)&&!t.includes(Y,3),"isLongOption"),Vo=ae(t=>It(t)&&t.includes(Y,3),"isLongOptionAndValue"),Bo=ae(t=>{if(t.length!==2||t.codePointAt(0)!==se||t.codePointAt(1)===se)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),Ro=ae(t=>!(t.length<=2||t.codePointAt(0)!==se||t.codePointAt(1)===se),"isShortOptionGroup"),zo=ae(t=>{const e=[],n=[...t];let o=-1,s=0;for(;n.length>0;){const i=n.shift();if(i===void 0)break;if(s>0?s--:o++,i===Mo){e.push({index:o,kind:"option-terminator"});const a=n.map((l,h)=>({index:o+h+1,kind:"positional",value:l}));e.push(...a),o+=n.length;break}if(Bo(i)){const a=i.charAt(1);e.push({index:o,kind:"option",name:a,rawName:i});continue}if(Ro(i)&&!i.includes(Y)){const a=[];let l="",h=!1;for(let r=1;r<i.length;r++){const c=i.charAt(r);h?l+=c:c.codePointAt(0)===Io?h=!0:a.push(`${jo}${c}`)}if(h)if(a.length>0){const r=a.pop();a.push(`${r}=${l}`)}else a.push(l);n.unshift(...a),s=a.length;continue}if(Do(i)){const a=i.slice(2);e.push({index:o,kind:"option",name:a,rawName:i});continue}if(Vo(i)){const a=i.indexOf(Y),l=i.slice(2,a),h=i.slice(a+1);e.push({index:o,inlineValue:!0,kind:"option",name:l,rawName:i,value:h});continue}if(i.length>2&&i.codePointAt(0)===se&&i.codePointAt(1)!==se&&i.includes(Y)){const a=i.indexOf(Y),l=i.charAt(1),h=i.slice(a+1);e.push({index:o,inlineValue:!0,kind:"option",name:l,rawName:i,value:h});continue}e.push({index:o,kind:"positional",value:i})}return e},"parseArgsTokens");var Fo=Object.defineProperty,je=re((t,e)=>Fo(t,"name",{value:e,configurable:!0}),"d");const Wo=/\d/,qo=je(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),Go=je(t=>typeof t=="function","isValidCustomTypeFunction"),Ho=je((t,e,n)=>{const o=n?.debug??!1;P(o,"Validating definitions:","validation",t,"caseInsensitive:",e);const s=new Set,i=new Set,a=new Set,l=new Set;let h=0;for(const r of t){if(P(o,"Checking definition:","validation",r),!r.name)throw P(o,"Validation failed: name is required","validation"),new M("Invalid option definition: name is required");if(typeof r.name!="string")throw new M("Invalid option definition: name must be a string");if(r.name.trim()==="")throw new M("Invalid option definition: name cannot be empty");const c=e?r.name.toLowerCase():"";if(s.has(r.name)||e&&a.has(c))throw new M(`Invalid option definition: duplicate name '${r.name}'`);if(i.has(r.name)||e&&l.has(c))throw new M(`Invalid option definition: name '${r.name}' conflicts with an existing alias`);if(s.add(r.name),e&&a.add(c),r.alias!==void 0){if(typeof r.alias!="string")throw new M("Invalid option definition: alias must be a string");if(r.alias.length!==1)throw new M("Invalid option definition: alias must be a single character");if(Wo.test(r.alias))throw new M("Invalid option definition: alias cannot be numeric");if(r.alias==="-")throw new M('Invalid option definition: alias cannot be "-"');const m=e?r.alias.toLowerCase():"";if(i.has(r.alias)||e&&l.has(m))throw new M(`Invalid option definition: duplicate alias '${r.alias}'`);if(s.has(r.alias)||e&&a.has(m))throw new M(`Invalid option definition: alias '${r.alias}' conflicts with an existing option name`);i.add(r.alias),e&&l.add(m)}if(r.defaultOption&&(h++,r.type!==void 0&&qo(r.type)))throw new M("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"&&Go(r.type)))throw new M("Invalid option definition: invalid type")}if(h>1)throw P(o,"Validation failed: multiple defaultOptions not allowed","validation"),new M("Invalid option definition: multiple defaultOptions not allowed");P(o,"Validation completed successfully","validation")},"validateDefinitions");var Jo=Object.defineProperty,Ko=re((t,e)=>Jo(t,"name",{value:e,configurable:!0}),"O");const Yo=Ko((t,e={})=>{const n=e.debug??!1;P(n,"Starting command-line-args parsing","index"),P(n,"Options:","index",e);const o={...e};o.stopAtFirstUnknown&&(o.partial=!0);const s=Array.isArray(t)?t:[t];P(n,"Normalized definitions:","index",s),Ho(s,o.caseInsensitive,n?o:void 0);let{argv:i}=o;if(!i&&(i=process.argv.slice(2),process.execArgv.length>0)){const r=new Set(process.execArgv);i=i.filter(c=>!r.has(c))}P(n,"Using argv:","index",i);let a=i;o.caseInsensitive&&(a=i.map(r=>{if(r.startsWith("--")){const c=r.indexOf("="),m=(c===-1?r.slice(2):r.slice(2,c)).toLowerCase();return c===-1?`--${m}`:`--${m}${r.slice(c)}`}if(r.startsWith("-")&&!r.startsWith("--")&&r.length>1){const c=r.slice(1).split("=",2),m=c[0],p=c[1];if(!m)return r;const g=m.toLowerCase();return p===void 0?`-${g}`:`-${g}=${p}`}return r}));const l=zo(a.map(String));P(n,"Tokenized arguments:","index",l);const h=To(l,s,o,i);return P(n,"Command-line-args parsing completed","index"),h},"commandLineArgs");class Zo{static{_(this,"Fn")}static{d(this,"Wn")}result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}}let Ce=class extends k{static{_(this,"he")}static{d(this,"ce")}commandName;constructor(e,n,o){super(`Failed to load command "${e}": ${n}`,"COMMAND_LOADER_ERROR",{commandName:e,reason:n}),this.name="CommandLoaderError",this.commandName=e,this.hint="Ensure the loader resolves to a module with a default export that is the command handler function.",o!==void 0&&(this.cause=o)}};const Qo=/^-{1,2}(\w+)(=(.+))?$/,Mt=d((t,e,n,o)=>{const s=Qo.exec(t);if(s===null)return{};const i=s[1];if(!i)return{};const a=n&&o?n.get(i)??o.get(i):e.find(l=>l.name===i||l.alias===i);return a!==void 0?{argName:a.name,argValue:s[3],option:a}:{}},"Ze"),it=d((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)},"Me"),Xo=new Set(["0","1","false","true"]),ei=d((t,e,n,o)=>{if(e.length===0||t.length===0)return{};const s=d((i,a)=>{const{argName:l,argValue:h,option:r}=Mt(a,e,n,o),{lastOption:c}=i;return r&&fe(r)&&h&&l?i.partial[l]=it(h,r):i.lastName&&c&&fe(c)&&Xo.has(a)&&(i.partial[i.lastName]=it(a,c)),{lastName:l,lastOption:r,partial:i.partial}},"s");return t.reduce(s,{partial:{}}).partial},"Gn"),ti=new Set(["0","1","false","true"]),ni=d((t,e,n,o)=>{if(e.length===0||t.length===0)return t;const s=d((i,a)=>{const{argValue:l,option:h}=Mt(a,e,n,o),{lastOption:r}=i;if(r&&fe(r)&&ti.has(a)){const{args:c}=i;return{args:c.slice(0,-1)}}return h&&fe(h)&&l?{args:i.args}:{args:[...i.args,a],lastOption:h}},"s");return t.reduce(s,{args:[]}).args},"Hn"),oi=d(t=>{const e=new Map;for(const n of t){const o=e.get(n.name);o?e.set(n.name,{...o,...n}):e.set(n.name,n)}return[...e.values()]},"De"),ii=d(t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},"Yn"),si=d((t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return ii(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)}},"Jn"),ri=/_./g,ai=/^[A-Z]/,li=d(t=>t.toLowerCase().replaceAll(ri,e=>e[1]?.toUpperCase()??e).replace(ai,e=>e.toLowerCase()),"Xn"),ci=d(t=>{if(!t||t.length===0)return{};const e={},n=q();for(const o of t){const s=n[o.name],i=si(o,s),a=i===void 0?o.defaultValue:i,l=li(o.name);e[l]=a}return e},"eo"),ui=d(t=>{const e=new Map,n=new Map;for(const o of t)if(e.set(o.name,o),o.alias){const s=Array.isArray(o.alias)?o.alias:[o.alias];for(const i of s)n.set(i,o)}return{optionMapByAlias:n,optionMapByName:e}},"to"),jt=d(async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new Ce(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(o){throw new Ce(t.name,o instanceof Error?o.message:String(o),o)}const n=e.default;if(typeof n!="function")throw new Ce(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},"Xe"),pi=d((t,e,n,o)=>{const s=new Zo(t.name,t),{_all:i,_unknown:a,positionals:l}=e,h=Object.keys(n).length>0?{...i,...n}:i;ye in h&&delete h[ye],s.argument=l?.[ye]??[],s.rawUnknown=[...a??[]];const r=Object.keys(o).length>0;return s.options=r?{...h,...o}:h,s.env=ci(t.env),s},"no"),hi=d((t,e,n)=>{const o=t.options??[],s=o.length>0;let i=oi(s?[...o,...n]:n);if(i.length>0){for(const r of i)if(r.multiple&&r.lazyMultiple)throw new Error(`Argument "${r.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(i=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:ye,type:t.argument.type,typeLabel:t.argument.typeLabel},...i]);let a,l;if(s){const{optionMapByAlias:r,optionMapByName:c}=ui(o);a=ni(e,o,c,r),l=ei(e,o,c,r)}else a=e,l={};const h=Yo(i,{argv:a,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:i,booleanValues:l,parsedArgs:h}},"oo"),ne=d(async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await jt(t))(e),"F");let fi=class extends k{static{_(this,"ao")}static{d(this,"io")}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(", ")}`}};const st=d((t,e,n=!1)=>{const o=[];for(const s of t)if(!(!n&&!s.required)&&e[s.name]===void 0){if(s.type?.name==="Boolean"){e[s.name]=!1;continue}o.push(s)}return o},"Te"),di=d((t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:$t(t,e)<=t.length/3,"so"),K=d((t,e)=>{const n=t.toLowerCase();return e.filter(o=>di(o.toLowerCase(),n))},"S"),mi=d((t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(o=>{const s=o.startsWith("--");let i=`Found unknown ${s?"option":"argument"} "${o}"`;if(s){const a=K(o.replace("--",""),(e.options??[]).map(l=>l.name));if(a.length>0){const[l,...h]=a.map(r=>`--${r}`);i+=h.length>0?`, did you mean ${l??""} or ${h.join(", ")}?`:`, did you mean ${l??""}?`}}n.push(i)}),n.length>0)throw new Error(n.join(`
|
|
4
|
+
`))},"ao"),gi=d((t,e,n)=>{const o=n.__requiredOptions__,s=o?st(o,e,!0):st(t,e,!1);if(s.length>0)throw new fi(n.name,s.map(i=>i.name));e._unknown&&e._unknown.length>0&&!n.argument&&mi(e,n)},"ro"),wi=d((t,e,n)=>{const o=n.__conflictingOptions__??t.filter(s=>s.conflicts!==void 0);if(o.length>0){const s=o.find(i=>Array.isArray(i.conflicts)?i.conflicts.some(a=>e[a]!==void 0)&&e[i.name]!==void 0:e[i.conflicts]!==void 0&&e[i.name]!==void 0);if(s)throw new Et(s.name,typeof s.conflicts=="string"?s.conflicts:s.conflicts?.[0]??"unknown")}},"lo"),vi=d(t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const s of t.options){if(s.name){const i=e.get(s.name)??[];i.push(s),e.set(s.name,i)}if(typeof s.alias=="string"&&s.alias.length>0){const i=n.get(s.alias)??[];i.push(s),n.set(s.alias,i)}else if(Array.isArray(s.alias)){for(const i of s.alias)if(i.length>0){const a=n.get(i)??[];a.push(s),n.set(i,a)}}}const o=[];for(const[s,i]of e)i.length>1&&o.push(`Duplicate option name "${s}" in command "${t.name}": ${JSON.stringify(i)}`);for(const[s,i]of n)i.length>1&&o.push(`Duplicate option alias "-${s}" used by options ${i.map(a=>`"${a.name}"`).join(", ")} in command "${t.name}"`);if(o.length>0)throw new Error(o.join(`
|
|
5
|
+
`))},"co"),yi=d((t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let o;for(let s=1;s<=e.length;s+=1){const i=e[s-1];if(i===void 0||i.startsWith("-"))break;n.push(i);const a=n.join(" ");t.has(a)&&(o={commandPath:[...n],depth:s})}return o?{argv:e.slice(o.depth),commandPath:o.commandPath}:{argv:e,commandPath:void 0}},"uo"),J=d(t=>t.join(" "),"V"),rt=d((t,e)=>e&&e.length>0?[...e,t]:[t],"Ve");class bi{static{_(this,"fo")}static{d(this,"ho")}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 o=this.cache.keys().next().value;o!==void 0&&this.cache.delete(o)}this.cache.set(e,n)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}size(){return this.cache.size}}const $i=d((t,e)=>typeof t!="string"||t===""?"":t[0].toLowerCase()+t.slice(1),"po"),xi=Qn(import.meta.url),ue=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ni=d(t=>{if(typeof ue<"u"&&ue.versions&&ue.versions.node){const[e,n]=ue.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ue.getBuiltinModule(t)}return xi(t)},"mo"),{stripVTControlCharacters:Ai}=Ni("node:util"),_e=new bi(1e3),Ei=/[.*+?^${}()|[\]\\]/g,ki=d(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(Ei,String.raw`\$&`)).join("|"),o=new RegExp(n,"g");return _e.set(e,o),o},"yo"),Oi=d(t=>{const e=[];let n=0,o;for(G.lastIndex=0;(o=G.exec(t))!==null;)o.index>n&&e.push(t.slice(n,o.index)),e.push(o[0]),n=G.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},"vo"),Ci=/[ČŠŽĐ]/i,Ut=new Uint8Array(128),Dt=new Uint8Array(128),Vt=new Uint8Array(128);for(let t=0;t<128;t++)Ut[t]=t>=65&&t<=90?1:0,Dt[t]=t>=97&&t<=122?1:0,Vt[t]=t>=48&&t<=57?1:0;const Le=d(t=>Ut[t],"he"),at=d(t=>Dt[t],"Se"),Pe=d(t=>Vt[t],"pe"),W=d((t,e,n,o,s)=>{if(t.length===0)return[];let i=!1;const a=Object.values(e);for(const g of a)if(g(t[0])){i=!0;break}if(!i&&!n)return[t];const l=[...t],h=[];let r=l[0],c="other";const m=Object.entries(e);for(const g of m){const[u,v]=g;if(v(l[0])){c=u;break}}let p=n&&o?l[0]===l[0].toLocaleUpperCase(o):!1;for(let g=1;g<l.length;g++){const u=l[g];let v="other";for(const x of m){const[E,O]=x;if(O(u)){v=E;break}}const $=n&&o?u===u.toLocaleUpperCase(o):!1;let y=!1;s?y=s(c,v,p,$,u,g,l):(c!==v&&c!=="other"&&v!=="other"&&(y=!0),n&&v!=="other"&&!p&&$&&(y=!0)),y?(h.push(r),r=u):r+=u,c=v,n&&(p=$)}return r&&r.length>0&&h.push(r),h.length>0?h:[t]},"D"),_i=d((t,e,n,o)=>{if(n.size===0)return e;for(const s of n)if(t.startsWith(s,e))return o.push(s),e+s.length;return e},"$o"),Bt=d((t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const o=[],s=t.length;for(let i=1;i<s;i++){const a=_i(t,n,e,o);if(a!==n){n=a,i=n-1;continue}const l=t.codePointAt(i-1),h=t.codePointAt(i),r=l&&l<128&&Le(l),c=h&&h<128&&Le(h),m=l&&l<128&&at(l),p=l&&l<128&&Pe(l),g=h&&h<128&&Pe(h);if(m&&c){o.push(t.slice(n,i)),n=i;continue}if(p&&!g||!p&&g){o.push(t.slice(n,i)),n=i;continue}if(g&&!p){let u=!1,v=!1;if(i+1<s){const $=t.codePointAt(i+1);u=$&&$<128&&Le($),v=$&&$<128&&Pe($)}if(!v&&u){o.push(t.slice(n,i),t.slice(i,i+1)),n=i+1;continue}}if(i+1<s){const u=t.codePointAt(i+1),v=u&&u<128&&at(u);if(r&&c&&v){const $=t.slice(n,i+1);e.has($)||(o.push(t.slice(n,i)),n=i)}}}return n<s&&o.push(t.slice(n)),o.filter(i=>i!=="")},"ot"),Rt=d((t,e,n)=>{if(t.length===0)return[];const o=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!o&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const r=[...t],c=r.length,m=[];let p=r[0],g=r[0]===r[0].toLocaleUpperCase(e),u=g,v=g?0:-1;for(let $=1;$<c;$++){const y=r[$],x=y===y.toLocaleUpperCase(e);if(x===g)p+=y;else if(x)p&&p.length>0&&(m.push(p),p=y),u=!0,v=$;else{if(u&&$-v>1){const E=r[$-1],O=p.slice(0,-1);O&&O.length>0&&m.push(O),p=E+y}else p+=y;u=!1,v=-1}g=x}return p&&p.length>0&&m.push(p),m}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!te.test(t)&&!I.test(t))return[t];const r=[...t],c=r.length,m=[];let p=r[0];const g=r[0];let u;te.test(g)?u=1:I.test(g)?u=2:u=0;let v=g===g.toLocaleUpperCase(e);for(let y=1;y<c;y++){const x=r[y];let E;te.test(x)?E=1:I.test(x)?E=2:E=0;const O=x===x.toLocaleUpperCase(e);u!==E&&(u===1||u===2)&&(E===1||E===2)||E===u&&!v&&O?(m.push(p),p=x):p+=x,u=E,v=O}p&&p.length>0&&m.push(p);const $=[];for(let y=0;y<m.length;y++)y<m.length-1&&m[y].length===1&&I.test(m[y])&&te.test(m[y+1][0])?($.push(m[y]+m[y+1]),y+=1):$.push(m[y]);return $}if(e.startsWith("el")){if(!ke.test(t)&&!I.test(t))return[t];const r=[];We.lastIndex=0;let c;for(;(c=We.exec(t))!==null;)r.push(c[0]);r.length===0&&r.push(t);const m=[];if(r.length===1){const p=r[0];if(!p||!ke.test(p[0])||p.length===1)return[p??t]}for(const p of r){if(!p)continue;if(!ke.test(p[0])||p.length===1){m.push(p);continue}const g=p.length;let u=p[0],v=p[0]===p[0].toLocaleUpperCase(e);for(let $=1;$<g;$++){const y=p[$],x=y===y.toLocaleUpperCase(e);!v&&x?(m.push(u),u=y):u+=y,v=x}u&&m.push(u)}return m}if(e.startsWith("ja")||e.startsWith("ko")){const r=e.startsWith("ja"),c=r?{hiragana:d(p=>Ln.test(p),"hiragana"),kanji:d(p=>He.test(p),"kanji"),katakana:d(p=>Tn.test(p),"katakana"),latin:d(p=>I.test(p),"latin")}:{hangul:d(p=>qe.test(p),"hangul"),latin:d(p=>I.test(p),"latin")},m=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(r){const p=W(t,c,!1,e,(u,v)=>u==="hiragana"&&v==="katakana"||u==="katakana"&&v==="hiragana"||u==="hiragana"&&v==="latin"||u==="katakana"&&v==="latin"||u==="kanji"&&v==="latin"||u==="latin"&&(v==="hiragana"||v==="katakana"||v==="kanji")),g=[];for(const u of p){const v=u;v.length===1&&m.has(v)&&g.length>0?g[g.length-1]=g.at(-1)+v:g.push(v)}return g.length>0?g:[t]}return W(t,c,!1,e,(p,g)=>p==="hangul"&&g==="latin"||p==="latin"&&g==="hangul")}if(e.startsWith("sl")){const r=[...t],c=r.length,m=[];let p=r[0],g=r[0]===r[0].toLocaleUpperCase(e);for(let u=1;u<c;u++){const v=r[u],$=v===v.toLocaleUpperCase(e),y=Ci.test(v),x=u<c-1&&r[u+1]===r[u+1].toLocaleUpperCase(e);!g&&$||y&&x?(m.push(p),p=v,y&&x&&(m.push(p),p="")):p+=v,g=$}return p&&p.length>0&&m.push(p),m}if(e.startsWith("zh"))return W(t,{han:d(r=>He.test(r),"han"),latin:d(r=>I.test(r),"latin")},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const r=d(c=>Ge.test(c)||Fe.test(c),"a");return W(t,{latin:d(c=>I.test(c),"latin"),rtl:d(c=>r(c),"rtl")},!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=d(c=>kn.test(c)||En.test(c)||Cn.test(c)||_n.test(c)||Pn.test(c)||Vn.test(c)||Bn.test(c)||Mn.test(c)||Dn.test(c)||Rn.test(c)||In.test(c)||zn.test(c)||jn.test(c)||On.test(c)||Sn.test(c)||Un.test(c),"a");return W(t,{indic:d(c=>r(c),"indic"),latin:d(c=>I.test(c),"latin")},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return W(t,{cyrillic:d(r=>te.test(r),"cyrillic"),latin:d(r=>I.test(r),"latin")},!0,e);if(["ar","fa","he"].includes(e))return W(t,{latin:d(r=>I.test(r),"latin"),rtl:d(r=>Ge.test(r)||Fe.test(r),"rtl")},!1,e);if(e.startsWith("ko"))return W(t,{hangul:d(r=>qe.test(r),"hangul"),latin:d(r=>I.test(r),"latin")},!1,e);if(e.startsWith("uz")){if(!te.test(t)&&!I.test(t))return[t];const r=[...t],c=r.length,m=[];let p=r[0],g=r[0]===r[0].toLocaleUpperCase(e);for(let u=1;u<c;u++){const v=r[u],$=v===v.toLocaleUpperCase(e);if(Je.test(v)||Je.test(r[u-1])){p+=v;continue}!g&&$?(m.push(p),p=v):p+=v,g=$}return p&&p.length>0&&m.push(p),m}const s=[...t],i=s.length,a=[];let l=s[0],h=s[0]===s[0].toLocaleUpperCase(e);for(const r of n)if(t.startsWith(r)){a.push(r),l=s[r.length],h=l===l.toLocaleUpperCase(e);break}for(let r=1;r<i;r++){const c=s[r],m=c===c.toLocaleUpperCase(e);let p=0;for(const g of n)if(t.startsWith(g,r)){a.push(l,g),p=g.length,l="";const u=g.at(-1);u&&(h=u===u.toLocaleUpperCase(e));break}if(p>0){r+=p-1;continue}!h&&m?(a.push(l),l=c):l+=c,h=m}return l&&a.push(l),a},"it"),Li=d((t,e,n)=>{const o=[],s=be.test(t)?t.split(be).filter(Boolean):[t];for(const i of s){const a=i;if(be.test(a))o.push(a);else{G.lastIndex=0;const l=G.test(a)?Oi(a).filter(Boolean):[a];for(const h of l)if(G.lastIndex=0,G.test(h))o.push(h);else if(e){const r=e.toLowerCase().split("-")[0];o.push(...Rt(h,r,n))}else o.push(...Bt(h,n))}}return o},"Oo"),Pi=d((t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:o=!1,knownAcronyms:s=[],locale:i,normalize:a=!1,separators:l,stripAnsi:h=!1,stripEmoji:r=!1}=e,c=new Set([...s].toSorted((y,x)=>x.length-y.length));let m=t;h&&(m=Ai(m)),r&&(m=Fn(m));let p;Array.isArray(l)?p=ki(l):l instanceof RegExp?p=l:p=An;const g=[];let u=m;const v=p.flags.includes("g")?p:new RegExp(p.source,`${p.flags}g`);for(;u.length>0;){const y=v.exec(u);if(!y){u===".."?g.push(".."):u==="."?g.push("."):u.length>0&&g.push(u);break}const x=y.index,E=y[0],O=E.length,f=u.slice(0,x),w=u.slice(x+O);if(E.startsWith("../"))g.push(".."),u=u.slice(x+3);else if(E.startsWith("./"))g.push("."),u=u.slice(x+2);else if(x===0&&E==="..")g.push(".."),u=u.slice(2);else if(x===0&&E===".")g.push("."),u=u.slice(1);else{f.length>0&&g.push(f);let b=0;for(;(b=E.indexOf("../",b))!==-1;)g.push(".."),b+=3;for(b=0;(b=E.indexOf("./",b))!==-1;)(b===0||E[b-1]!==".")&&g.push("."),b+=2;let N=w;for(;N.startsWith("../");)g.push(".."),N=N.slice(3);for(;N.startsWith("./");)g.push("."),N=N.slice(2);if(N===".."){g.push("..");break}else if(N==="."){g.push(".");break}else u=N}v.lastIndex=0}if(g.length===0){const y=m.split(p).filter(Boolean);g.push(...y)}let $=[];for(const y of g)n||o?$.push(...Li(y,i,c)):i?$.push(...Rt(y,i,c)):$.push(...Bt(y,c));return a&&($=$.map(y=>c.has(y)?y:i&&y===y.toLocaleUpperCase(i)?y[0]+y.slice(1).toLocaleLowerCase(i):y.toUpperCase()===y&&!c.has(y)?y.slice(0,1)+y.slice(1).toLowerCase():y)),$},"Ao"),Ti=d((t,e)=>typeof t!="string"||t===""?"":t[0].toUpperCase()+t.slice(1),"No"),Si=d((t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const o=[];let s="",i="";for(let a=0;a<n;a++){const l=t[a];if(be.test(l)){s?(o.push(s+i+l),s="",i=""):(o.length>0&&o.push(e),s=l);continue}s?(i&&(i+=e),i+=l):(o.length>0&&o.push(e),o.push(l))}return o.join("")},"Co"),zt=d((t,e)=>{if(typeof t!="string"||!t)return"";let n=!0;return Si(Pi(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(o=>{const s=o,i=s.toLowerCase();return n?(n=!1,$i(i)):Ti(i)}),"")},"st"),Ii=d(t=>{t.options?.forEach(e=>{e.__camelCaseName__=zt(e.name)})},"_o"),Mi=d(t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const o of t.options)e.add(o.name);const n=[];for(const o of t.options)if(o.name.startsWith("no-")){const s=o.name.replace(/^no-/,"");if(!e.has(s)){if(o.type!==Boolean)throw new Error(`Cannot add negated option "${o.name}" to command "${t.name}" because it is not a boolean.`);const i={...o,defaultValue:o.defaultValue===void 0?!0:!o.defaultValue,name:s};n.push(i),e.add(s)}}n.length>0&&t.options.push(...n)},"ko"),ji=d((t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,o=new Map;for(const i of e.options)if(i.name.startsWith("no-")){const a=zt(i.name);o.set(a,i)}const s=Object.keys(n).filter(i=>o.has(i));if(s.length!==0)for(const i of s){const a=i.charAt(2);if(!a)continue;const l=a.toLowerCase()+i.slice(3),h=o.get(i);h&&(h.__negated__=!0),n[l]=!n[i],Reflect.deleteProperty(n,i)}},"xo"),Ui=d((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:o}=t;for(const s of Object.keys(o)){const i=n.get(s);if(i?.implies){const{implies:a}=i;for(const[l,h]of Object.entries(a))o[l]===void 0&&(o[l]=h)}}},"Io"),Di=d(()=>!!process.versions.electron,"Lo"),Vi=d(()=>Di()&&!process.defaultApp,"Eo"),Bi=d(()=>Vi()?0:1,"Po"),Ri=d(t=>t.slice(Bi()+1),"Uo"),zi=" ",Fi=d((t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,o)=>n===e[o]),"Do"),Wi=d(t=>{if(typeof t=="string")return t.split(zi);const e=$e();return Fi(t,e)?Ri(t):t},"To"),qi=d(t=>{const e=d(i=>{t.error(`Uncaught exception: ${i.message||i}`),i.stack&&t.error(i.stack),z(1)},"e"),n=d((i,a)=>{if(i instanceof Error)t.error(`Promise rejection: ${i.message||i}`),i.stack&&t.error(i.stack);else{let l;if(typeof i=="string")l=i;else try{l=JSON.stringify(i)}catch{l=String(i)}t.error(`Promise rejection: ${l}`)}z(1)},"n"),o=Re("uncaughtException",e),s=Re("unhandledRejection",n);return()=>{o(),s()}},"Vo"),lt=100,Gi=/^[a-z][\w-]*$/i,Ie=d((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()},"ge"),ct=d((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},"Be"),Te=d((t,e)=>{if(typeof t!="object"||t===null)throw new k(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},"fe"),we=d(t=>{const e=Ie(t,"Command name");if(e.length>lt)throw new k(`Command name is too long (maximum ${String(lt)} 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(!Gi.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},"ee"),Hi=new Set([`
|
|
6
|
+
`,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),Ji=d((t,e=!0)=>{if(typeof t!="string")throw new TypeError("Argument must be a string");if(t.length>1e4)throw new Error(`Argument is too long (maximum ${String(1e4)} characters)`);if(e){for(const n of t)if(Hi.has(n))throw new Error(`Argument contains dangerous character: ${n}`)}return t.trim()},"Bo"),ut=d((t,e=!0)=>{if(!Array.isArray(t))throw new TypeError("Arguments must be an array");if(t.length>100)throw new Error(`Too many arguments (maximum ${String(100)})`);return t.map(n=>Ji(n,e))},"Re"),Ki=/^-([^\d-])$/,Yi=/^--(\S+)/,Zi=/^-([^\d-]{2,})$/,Se=d(t=>Ki.test(t)||Yi.test(t)||Zi.test(t),"de"),Qi={access:d((t,e)=>Zn(t,e),"access"),mkdir:d((t,e)=>Yn(t,e),"mkdir"),readdir:d(t=>Kn(t),"readdir"),readFile:d((async(t,e)=>e===void 0?Ke(t):Ke(t,e)),"readFile"),rm:d((t,e)=>Jn(t,e),"rm"),stat:d(t=>Hn(t),"stat"),writeFile:d((t,e,n)=>Gn(t,e,n),"writeFile")};let Xi=class Ft{static{_(this,"ve")}static{d(this,"at")}#t;#e;#c;#u;#h;#f;#y;#b;#$;#x;#N;#p;#n;#o;#i;#s;#r;#d=!1;#A;#E=!1;#m;#g;#w;#l=[];#L(){return this.#m===void 0&&(this.#m=[...this.#o.keys()]),this.#m}#k(){return this.#g===void 0&&(this.#g=[...this.#n.keys()]),this.#g}#a(){return this.#w===void 0&&(this.#w=[...this.#L(),...this.#k()]),this.#w}#O(){return this.#l.length===0?ge:[...ge,...this.#l]}#C(){this.#m=void 0,this.#g=void 0,this.#w=void 0}#v(){if(this.#c===void 0){const e=Wi(this.#e.argv);this.#c=ut(e,!1),this.#P()}return this.#c}#P(){if(!this.#c)return;const e=q();let n=!1;for(const o of this.#c){if(o==="--quiet"||o==="-q"){e.CEREBRO_OUTPUT_LEVEL=String(ln),n=!0;break}if(o==="--verbose"||o==="-v"){e.CEREBRO_OUTPUT_LEVEL=String(cn),n=!0;break}if(o==="--debug"){e.CEREBRO_OUTPUT_LEVEL=String(oe),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(oe):String(Be))}#T(){this.#E||(this.#A=qi(this.#t),this.#E=!0)}#S(){return{arch:vn(),argv:this.#v(),cwd:this.#u,env:this.#x??q(),exit:this.#$??(e=>z(e??0)),platform:wn(),stdin:this.#N}}#_(e,n,o,s){this.#t.debug(`command '${s}' found, parsing command args: ${n.join(", ")}`);const{arguments_:i,booleanValues:a,parsedArgs:l}=hi(e,n,this.#O()),h=Object.keys(a).length>0;let r=l;h&&(r={...l,_all:{...l._all,...a}}),gi(i,r,e);const c=pi(e,l,a,o);c.runtime=this,c.argv=this.#v(),c.fs=this.#b??Qi,c.process=this.#S(),c.console=this.#t;const m=e.options&&e.options.length>0;if(m&&e.options){const p=e.options.filter(g=>g.name.startsWith("no-"));for(const g of p){const u=g.name.replace(/^no-/,""),v=`--${g.name}`,$=`--${u}`,y=n.includes(v),x=n.includes($);if(y&&x)throw new Et(u,g.name)}}return m&&(ji(c,e),Ui(c,e)),wi(i,c.options,e),q().CEREBRO_OUTPUT_LEVEL===String(oe)&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(c.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(c.argument,null,2))),{arguments_:i,booleanValues:a,commandArgs:r,parsedArgs:l,toolbox:c}}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.#h=e.trim();const o=n.argv??$e(),s=n.cwd??gn();if(this.#e={...n,argv:o,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});const i=q();if(i.CEREBRO_OUTPUT_LEVEL=String(Be),typeof this.#e.logger=="object"){const c=["debug","error","info","log","warn"],m=[],p=this.#e.logger;for(const g of c)typeof p[g]!="function"&&m.push(g);if(m.length>0)throw new k(`Logger object is missing required methods: ${m.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:m});this.#t=this.#e.logger}else this.#t={...console,debug:d((...c)=>{i.CEREBRO_OUTPUT_LEVEL===String(oe)&&console.debug(...c)},"debug")};this.#f=this.#e.packageVersion,this.#y=this.#e.packageName,this.#u=this.#e.cwd,this.#s="help",this.#r={};const a=n.fs;if(a!==void 0&&(typeof a!="object"||a===null))throw new k("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const l=n.exit;if(l!==void 0&&typeof l!="function")throw new k("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const h=n.env;if(h!==void 0&&(typeof h!="object"||h===null))throw new k("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const r=n.stdin;if(r!==void 0&&typeof r!="string")throw new k("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#b=n.fs,this.#$=n.exit,this.#x=n.env,this.#N=n.stdin??"",this.#n=new Map,this.#o=new Map,this.#i=new Map}setCommandSection(e){return this.#r=e,this}getCommandSection(){return this.#r.header||(this.#r.header=`${this.#h}${this.#f?` v${this.#f}`:""}`),this.#r}setDefaultCommand(e){return this.#s=e,this}get defaultCommand(){return this.#s}addCommand(e){Te(e,"Command"),we(e.name);const n=typeof e.execute=="function",o=typeof e.loader=="function";if(n&&o)throw new k(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!o)throw new k(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?we(e.alias):ct(e.alias,"Command alias").forEach(r=>we(r))),e.argument&&Te(e.argument,"Command argument"),e.options&&Te(e.options,"Command options"),e.commandPath&&(ct(e.commandPath,"Command commandPath"),e.commandPath.forEach(r=>{we(r)}));const s=rt(e.name,e.commandPath),i=J(s);if(this.#o.has(i))throw new k(`Command with path "${i}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const a=Array.isArray(e.commandPath)&&e.commandPath.length>0,l=this.#n.get(e.name),h=l!==void 0&&(l.commandPath===void 0||l.commandPath.length===0);if(!a&&h)throw new k(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const r of e.options)Ye(r);if(vi(e),Mi(e),Ii(e),e.options&&(e.__conflictingOptions__=e.options.filter(r=>r.conflicts!==void 0),e.__requiredOptions__=e.options.filter(r=>r.required===!0)),a&&l!==void 0)this.#n.set(i,e);else{if(!a&&l!==void 0&&!h){const r=rt(l.name,l.commandPath);this.#n.set(J(r),l)}this.#n.set(e.name,e)}if(this.#o.set(i,s),this.#i.set(i,e),this.#C(),e.alias!==void 0){const r=typeof e.alias=="string"?[e.alias]:e.alias;for(const c of r){if(q().CEREBRO_OUTPUT_LEVEL===String(oe)&&this.#t.debug("adding alias",c),this.#n.has(c))throw new k(`Command alias "${c}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:c,commandName:e.name});this.#n.set(c,e)}}return this}addGlobalOption(e){const n=e,o=new Set(ge.map(i=>i.name)),s=new Set(ge.map(i=>i.alias).filter(Boolean));if(o.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(i=>i.name)).has(n.name))throw new k(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",Ye(n),this.#l.push(n),this}getGlobalOptions(){return this.#O()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#p?this.#p:(this.#p=new eo(this.#t),this.#p.register({description:"Attaches the logger to the toolbox",execute:d(e=>{e.logger=this.#t,e.console=e.logger},"execute"),name:"logger"}),this.#p)}getCliName(){return this.#h}getPackageVersion(){return this.#f}getPackageName(){return this.#y}getCommands(){return this.#n}getCwd(){return this.#u}dispose(){this.#A?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:o=!0,...s}=e;if(!this.#n.has("help")){const{default:f}=await import("../packem_chunks/help-command.js");this.addCommand(new f(this.#n))}const i=this.#k(),a=this.#o;this.#T();const l=this.#v();let h,r=[...l];const c=bt(),m=yt(),p=$e();this.#t.debug(`process.execPath: ${c}`),this.#t.debug(`process.execArgv: ${m.join(" ")}`),this.#t.debug(`process.argv: ${p.join(" ")}`);const g=yi(a,[...l]);if(g.commandPath)h=g.commandPath,r=g.argv;else{if(l.length>1&&l[0]&&l[1]&&!Se(l[0])&&!Se(l[1])){const w=[];let b=0;for(;b<l.length;){const A=l[b];if(!A||Se(A))break;w.push(A),b+=1}const N=J(w);if(w[0]&&!i.includes(w[0])){const A=this.#a(),j=K(N,A);throw new H(N,j)}}let f;try{f=ro([null,...i],[...l])}catch(w){if(w instanceof Error&&w.name==="INVALID_COMMAND"&&"command"in w){const b=w.command,N=this.#a(),A=K(b,N);throw new H(b,A)}throw w}f.command&&(h=[f.command],r=f.argv)}if(!h)if(this.#s)h=[this.#s];else{const f=this.#a();throw new H("",f)}const u=J(h),v=this.#o.get(u);let $;if(v){if($=this.#i.get(u),!$||J(v)!==u){const f=this.#a(),w=K(u,f);throw new H(u,w)}}else{const f=h.at(-1);if($=f?this.#n.get(f):void 0,!$){const w=this.#a(),b=K(u,w);throw new H(u,b)}}if(typeof $.execute!="function"&&typeof $.loader!="function")return this.#t.error(`Command "${$.name}" has no function to execute.`),o?z(1):void 0;const y=r;let x,E;try{({commandArgs:x,toolbox:E}=this.#_($,y,s,u))}catch(f){if(this.#t.error(f),o)return z(1);throw f}const O=this.getPluginManager();try{!this.#d&&O.hasPlugins()&&(await O.init({cli:this,cwd:this.#u,logger:this.#t}),this.#d=!0),await O.executeLifecycle("execute",E),await O.executeLifecycle("beforeCommand",E);let f;const w=x.global;if(w?.help){const b=this.#n.get("help");if(!b)throw new k("Help command not found","COMMAND_NOT_FOUND");f=await ne(b,E)}else if(w?.version??w?.V){const b=this.#n.get("version");if(!b)throw new k("Version command not found","COMMAND_NOT_FOUND");f=await ne(b,E)}else f=await ne($,E);return await O.executeLifecycle("afterCommand",E,f),o?z(0):void 0}catch(f){throw await O.executeErrorHandlers(f,E),f}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:o=[],...s}=n;Ie(e,"Command name");const i=e.split(" ").filter(Boolean),a=J(i),l=this.#o.get(a)?this.#i.get(a):this.#n.get(e);if(!l){const p=this.#a(),g=K(a||e,p);throw new H(e,g)}if(typeof l.execute!="function"&&typeof l.loader!="function")throw new k(`Command "${l.name}" has no function to execute`,"INVALID_COMMAND",{commandName:l.name});const h=[...ut(o,!1)];this.#t.debug(`running command '${e}' programmatically with args: ${h.join(", ")}`);const{commandArgs:r,toolbox:c}=this.#_(l,h,s,a||e),m=this.getPluginManager();try{!this.#d&&m.hasPlugins()&&(await m.init({cli:this,cwd:this.#u,logger:this.#t}),this.#d=!0),await m.executeLifecycle("execute",c),await m.executeLifecycle("beforeCommand",c);let p;const g=r.global;if(g?.help){const u=this.#n.get("help");if(!u)throw new k("Help command not found","COMMAND_NOT_FOUND");p=await ne(u,c)}else if(g?.version??g?.V){const u=this.#n.get("version");if(!u)throw new k("Version command not found","COMMAND_NOT_FOUND");p=await ne(u,c)}else p=await ne(l,c);return await m.executeLifecycle("afterCommand",c,p),p}catch(p){throw await m.executeErrorHandlers(p,c),p}}clone(e){const n={...this.#e,...e},o=new Ft(this.#h,n);for(const[s,i]of this.#n)o.#n.set(s,i);for(const[s,i]of this.#o)o.#o.set(s,[...i]);for(const[s,i]of this.#i)o.#i.set(s,i);for(const s of this.#l)o.#l.push(s);return o.#s=this.#s,o.#r={...this.#r},o.#C(),o}async getAction(e){Ie(e,"Command name");const n=e.split(" ").filter(Boolean),o=J(n),s=this.#o.get(o)?this.#i.get(o):this.#n.get(e);if(!s){const i=this.#a(),a=K(o||e,i);throw new H(e,a)}if(typeof s.execute=="function")return s.execute;if(typeof s.loader=="function")return jt(s);throw new k(`Command "${s.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:s.name})}};var es=Object.defineProperty,ts=_((t,e)=>es(t,"name",{value:e,configurable:!0}),"r");const Nr=ts((t,e)=>new Xi(t,e),"m");var ns=Object.defineProperty,os=_((t,e)=>ns(t,"name",{value:e,configurable:!0}),"c$1");const Ar=os(()=>{try{const t=require("node:module");if(typeof t.enableCompileCache=="function"){t.enableCompileCache();return}}catch{}try{require("v8-compile-cache")}catch{}},"t");var is=Object.defineProperty,me=_((t,e)=>is(t,"name",{value:e,configurable:!0}),"t");const ss=Me(import.meta.url),pe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Wt=me(t=>{if(typeof pe<"u"&&pe.versions&&pe.versions.node){const[e,n]=pe.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return pe.getBuiltinModule(t)}return ss(t)},"u"),{execFileSync:rs}=Wt("node:child_process"),{totalmem:as}=Wt("node:os"),ls=/--max-old-space-size=(\d+)/,cs=/--max-semi-space-size=(\d+)/,us=me(t=>Math.floor(as()/1024/1024*t),"E"),ps=me(t=>t<=512?4:t<=1024?8:t<=2048?16:t<=4096?32:t<=8192?64:Math.floor(Math.log2(t))*8,"P"),pt=me((t,e)=>{for(const n of e){const o=t.exec(n);if(o)return Number.parseInt(o[1],10)}},"l"),Er=me(t=>{const e=t?.maxOldSpacePercent??.75,n=[...yt()],o=[...$e()],s=pt(ls,n),i=pt(cs,n);if(s!==void 0&&i!==void 0)return;const a=s??us(e),l=i??ps(a),h=[];if(s===void 0&&h.push(`--max-old-space-size=${String(a)}`),i===void 0&&h.push(`--max-semi-space-size=${String(l)}`),h.length!==0)try{rs(bt(),[...h,...n,...o.slice(1)],{env:q(),stdio:"inherit"}),z(0)}catch(r){const c=r.status;z(typeof c=="number"?c:1)}},"q");var hs=Object.defineProperty,Ae=_((t,e)=>hs(t,"name",{value:e,configurable:!0}),"S");const fs=Me(import.meta.url),he=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ds=Ae(t=>{if(typeof he<"u"&&he.versions&&he.versions.node){const[e,n]=he.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return he.getBuiltinModule(t)}return fs(t)},"Q"),{createRequire:ms}=ds("node:module");var gs=Object.defineProperty,Ue=Ae((t,e)=>gs(t,"name",{value:e,configurable:!0}),"L"),ws=Object.defineProperty,vs=Ue((t,e)=>ws(t,"name",{value:e,configurable:!0}),"r$1");const ys=vs(t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
7
|
+
`),"normalizeLF"),bs=globalThis.process??Object.create(null),ht={versions:{}},ft=new Proxy(bs,{get(t,e){if(e in t)return t[e];if(e in ht)return ht[e]}});var $s=Object.defineProperty,xs=Ue((t,e)=>$s(t,"name",{value:e,configurable:!0}),"b");const Ns=xs((t,e,n,o)=>{const s={column:0,line:-1,...t.start},i={...s,...t.end},a=s.line,l=s.column,h=i.line,r=i.column;let c=Math.max(a-(n+1),0),m=Math.min(e.length,h+o);a===-1&&(c=0),h===-1&&(m=e.length);const p=h-a,g={};if(p)for(let u=0;u<=p;u++){const v=u+a;if(!l)g[v]=!0;else if(u===0){const $=e[v-1]?.length;g[v]=[l,($??0)-l+1]}else if(u===p)g[v]=[0,r];else{const $=e[v-u]?.length;g[v]=[0,$]}}else l===r?g[a]=l?[l,0]:!0:g[a]=[l,(r??0)-(l??0)];return{end:m,markerLines:g,start:c}},"getMarkerLines");var As=Object.defineProperty,ve=Ue((t,e)=>As(t,"name",{value:e,configurable:!0}),"t");const Es=ft.platform==="win32"&&!ft.env?.WT_SESSION?">":"❯",ks=ve((t,e,n)=>{const o={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...n,color:{gutter:ve(u=>u,"gutter"),marker:ve(u=>u,"marker"),message:ve(u=>u,"message"),...n?.color}},s=typeof e.start.column=="number";let i=ys(t).split(`
|
|
8
|
+
`);typeof o.tabWidth=="number"&&(i=i.map(u=>u.replaceAll(" "," ".repeat(o.tabWidth))));const{end:a,markerLines:l,start:h}=Ns(e,i,o.linesAbove,o.linesBelow),r=String(a).length,{gutter:c,marker:m,message:p}=o.color;let g=i.slice(h,a).map((u,v)=>{const $=h+1+v,y=l[$],x=String($).padStart(r),E=!l[$+1],O=` ${x}${o.showGutter?" |":""}`;if(y){let f="";if(Array.isArray(y)){const w=u.replaceAll(/[^\t]/g," ").slice(0,Math.max(y[0]-1,0)),b=y[1]||1;f=[`
|
|
9
|
+
`,o.prefix+c(O.replaceAll(/\d/g," "))," ",w,m("^").repeat(b)].join(""),E&&o.message&&(f+=` ${p(o.message)}`)}return[o.prefix+m(Es),c(O),u.length>0?` ${u}`:"",f].join("")}return`${o.prefix} ${c(O)}${u.length>0?` ${u}`:""}`}).join(`
|
|
10
|
+
`);return o.message&&!s&&(g=`${o.prefix+" ".repeat(r+1)+o.message}
|
|
11
|
+
${g}`),g},"codeFrame");var Os=Object.defineProperty,Cs=Ae((t,e)=>Os(t,"name",{value:e,configurable:!0}),"ue"),_s=Object.defineProperty,F=Cs((t,e)=>_s(t,"name",{value:e,configurable:!0}),"u");const Z=F((t,...e)=>{process.env.DEBUG&&process.env.DEBUG==="true"&&console.debug(`error:parse-stacktrace: ${t}`,...e)},"debugLog"),Q="<unknown>",Ls=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ps=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,Ts=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,Ss=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,Is=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,Ms=/in\s(.*)\s\(at\s(.+)\)\sat/,js=/^(?:.*@)?(.*):(\d+):(\d+)$/,Us=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ds=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Vs=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,dt=/\(error: (.*)\)/,Bs=/at\s/,Rs=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,zs=/\S*(?:Error: |AggregateError:)/,qt=/^Anonymous function$/,Fs=/^\s*in\s.*/,Ws=/^.*?\s*at\s.*/,qs=/^.*?\s*@.*|\[native code\]/,Gt=F((t,e)=>{const n=t.includes("safari-extension"),o=t.includes("safari-web-extension");return n||o?[t.includes("@")?t.split("@")[0]:Q,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},"extractSafariExtensionDetails"),Ht=F((t,e)=>{const n=Ts.exec(e);n&&(t.file=n[1],t.line=+n[2],t.column=+n[3])},"parseMapped"),Gs=F(t=>{const e=Ms.exec(t);if(e){Z(`parse nested node error stack line: "${t}"`,`found: ${JSON.stringify(e)}`);const o=e[2].split(":");return{column:o[2]?+o[2]:void 0,file:o[0],line:o[1]?+o[1]:void 0,methodName:e[1]??Q,raw:t,type:void 0}}const n=Is.exec(t);if(n){Z(`parse node error stack line: "${t}"`,`found: ${JSON.stringify(n)}`);const o={column:n[4]?+n[4]:void 0,file:n[2]?n[2].replace(Bs,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]??Q,raw:t,type:t.startsWith("internal")?"internal":void 0};return Ht(o,`${n[2]}:${n[3]}:${n[4]}`),o}},"parseNode"),Hs=F(t=>{const e=Ls.exec(t);if(e){Z(`parse chrome error stack line: "${t}"`,`found: ${JSON.stringify(e)}`);const n=e[2]?.startsWith("native"),o=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let s,i;if(o){const r=Ps.exec(t);if(r){const c=Rs.exec(r[1]);c?(e[2]=c[4]??c[1],e[3]=c[5]??c[2],e[4]=c[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 c=Ss.exec(t);c&&(i={column:c[4]?+c[4]:void 0,file:c[2],line:c[3]?+c[3]:void 0},s={column:c[6]?+c[6]:void 0,file:c[1],line:c[5]?+c[5]:void 0,methodName:"eval",raw:c[0],type:"eval"})}}const[a,l]=Gt(e[1]?e[1].replace(qt,"<anonymous>"):Q,e[2]),h={column:e[4]?+e[4]:void 0,evalOrigin:s,file:l,line:e[3]?+e[3]:void 0,methodName:a,raw:t,type:o?"eval":n?"native":void 0};return i?(h.column=i.column,h.file=i.file,h.line=i.line):Ht(h,`${l}:${e[3]}:${e[4]}`),h}},"parseChromium"),Js=F((t,e)=>{const n=Us.exec(t);if(n){Z(`parse gecko error stack line: "${t}"`,`found: ${JSON.stringify(n)}`);const o=n[3]?.includes(" > eval"),s=o&&n[3]&&Ds.exec(n[3]);let i;o&&s&&(n[3]=s[1],i={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[a,l]=Gt(n[1]?n[1].replace(qt,"<anonymous>"):Q,n[3]);let h;(e?.type==="safari"||!o&&e?.type==="firefox")&&e.column?h=e.column:!o&&n[5]&&(h=+n[5]);let r;return(e?.type==="safari"||!o&&e?.type==="firefox")&&e.line?r=e.line:n[4]&&(r=+n[4]),{column:h,evalOrigin:i,file:l,line:r,methodName:a,raw:t,type:o?"eval":l.includes("[native code]")?"native":void 0}}},"parseGecko"),Ks=F((t,e)=>{const n=Vs.exec(t);if(!(n&&n[2].includes(" > eval"))&&n)return Z(`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}},"parseFirefox"),Ys=F(t=>{const e=js.exec(t);if(e)return Z(`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}},"parseReactAndroidNative"),Jt=F((t,{filter:e,frameLimit:n=50}={})=>{const o=t;let s=(typeof o.stacktrace=="string"?o.stacktrace:t.stack??"").split(`
|
|
12
|
+
`).map(i=>(dt.test(i)?i.replace(dt,"$1"):i).trim()).filter(i=>!zs.test(i)&&i!=="eval code");return e&&(s=s.filter(i=>e(i))),s=s.slice(0,n),s.reduce((i,a,l)=>{if(!a||a.length>1024)return i;let h;if(Fs.test(a))h=Gs(a);else if(Ws.test(a))h=Hs(a);else if(qs.test(a)){let r;if(l===0){const c=t,m=c.columnNumber,p=c.lineNumber,g=c.line,u=c.column;m||p?r={column:m,line:p,type:"firefox"}:(g||u)&&(r={column:u,line:g,type:"safari"})}h=Ks(a,r)??Js(a,r)}else h=Ys(a);return h?i.push(h):Z(`parse error stack line: "${a}"`,"not parser found"),i},[])},"parseStacktrace");var Zs=Object.defineProperty,Kt=Ae((t,e)=>Zs(t,"name",{value:e,configurable:!0}),"V");const Qs=ms(import.meta.url),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,De=Kt(t=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[e,n]=ie.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ie.getBuiltinModule(t)}return Qs(t)},"__cjs_getBuiltinModule"),{existsSync:Xs,readFileSync:er}=De("node:fs"),{relative:tr}=De("node:path"),{cwd:nr}=ie,{fileURLToPath:or}=De("node:url");var ir=Object.defineProperty,L=Kt((t,e)=>ir(t,"name",{value:e,configurable:!0}),"o");const X=L((t,e,n)=>n===0?t:e===" "?t+" ".repeat(n):t+" ".repeat(e*n),"getPrefix"),sr=L((t,e)=>{const n=t.replace("async file:","file:");return tr(e,n.startsWith("file:")?or(n):n)},"getRelativePath"),rr=L((t,e,n)=>{if(e)return n.title(t.message);const o=t.message?`: ${t.message}`:"";return n.title(t.name+o)},"getTitleText"),Yt=L((t,{color:e,hideErrorTitle:n,indentation:o,prefix:s},i)=>`${X(s,o,i)}${rr(t,n,e)}
|
|
13
|
+
`,"getMessage"),Zt=L((t,{color:e,indentation:n,prefix:o},s)=>{if(t.hint===void 0)return;const i=X(o,n,s);let a="";if(Array.isArray(t.hint))for(const l of t.hint)a+=`${i+l}
|
|
14
|
+
`;else a+=i+t.hint;return e.hint(a)},"getHint"),Ve=L((t,{color:e,cwd:n,displayShortPath:o,indentation:s,prefix:i},a=0)=>{const l=o?sr(t.file,n):t.file,{fileLine:h,method:r}=e;return`${X(i,s,a)}at ${t.methodName?`${r(t.methodName)} `:""}${h(l)}:${h(t.line?.toString()??"")}`},"getMainFrame"),Qt=L((t,{color:e,indentation:n,linesAbove:o,linesBelow:s,prefix:i,showGutter:a,showLineNumbers:l,tabWidth:h},r)=>{if(t.file===void 0)return;const c=t.file.replace("file://","");if(!Xs(c))return;const m=er(c,"utf8");return ks(m,{start:{column:t.column,line:t.line}},{color:e,linesAbove:o,linesBelow:s,prefix:X(i,n,r),showGutter:a,showLineNumbers:l,tabWidth:h})},"getCode"),Xt=L((t,e,n)=>{if(t.errors.length===0)return;let o=`${X(e.prefix,e.indentation,n)}Errors:
|
|
15
|
+
|
|
16
|
+
`,s=!0;for(const i of t.errors)s?s=!1:o+=`
|
|
17
|
+
|
|
18
|
+
`,o+=tn(i,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},n+1);return`
|
|
19
|
+
${o}`},"getErrors"),en=L((t,e,n,o=new Set)=>{o.add(t);let s=`${X(e.prefix,e.indentation,n)}Caused by:
|
|
20
|
+
|
|
21
|
+
`;const i=t.cause;s+=Yt(i,e,n);const a=Jt(i).shift(),l=Zt(i,e,n);if(l&&(s+=`${l}
|
|
22
|
+
`),a&&(s+=Ve(a,e,n),!e.hideErrorCauseCodeView)){const h=Qt(a,e,n);h!==void 0&&(s+=`
|
|
23
|
+
${h}`)}if(i instanceof AggregateError){const h=Xt(i,e,n);h!==void 0&&(s+=`
|
|
24
|
+
${h}`)}return i.cause&&(o.has(i)?s+=`
|
|
25
|
+
${X(e.prefix,e.indentation,n+1)}Caused by: [Circular]`:s+=`
|
|
26
|
+
${en(i,e,n+1,o)}`),`
|
|
27
|
+
${s}`},"getCause"),ar=L((t,e)=>(t.length>0?`
|
|
28
|
+
`:"")+t.map(n=>Ve(n,e)).join(`
|
|
29
|
+
`),"getStacktrace"),tn=L((t,e,n)=>{const o={cwd:nr(),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:L(a=>a,"fileLine"),gutter:L(a=>a,"gutter"),hint:L(a=>a,"hint"),marker:L(a=>a,"marker"),message:L(a=>a,"message"),method:L(a=>a,"method"),title:L(a=>a,"title"),...e.color}},s=Jt(t,{filter:e.filterStacktrace,frameLimit:o.framesMaxLimit}),i=s.shift();return[e.hideMessage?void 0:Yt(t,o,n),Zt(t,o,n),i?Ve(i,o,n):void 0,i&&!o.hideErrorCodeView?Qt(i,o,n):void 0,t instanceof AggregateError?Xt(t,o,n):void 0,t.cause===void 0?void 0:en(t,o,n),s.length>0?ar(s,o):void 0].filter(Boolean).join(`
|
|
30
|
+
`).replaceAll("\\","/")},"internalRenderError"),lr=L((t,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return tn(t,e,0)},"renderError");var cr=Object.defineProperty,mt=_((t,e)=>cr(t,"name",{value:e,configurable:!0}),"i$1");const kr=mt((t={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:mt((e,n)=>{const{logger:o,runtime:s}=n,{detailed:i=!1,exitOnError:a=!0,formatter:l,logErrors:h=!0,renderOptions:r={}}=t;if(h)if(l)o.error(l(e));else if(i){const c=s.getCwd(),m=lr(e,{cwd:c,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...r});o.error(m)}else o.error(e);a&&z(1)},"onError"),version:"1.0.0"}),"E");var ur="1.0.0-alpha.29";const Or={version:ur};var pr=Object.defineProperty,hr=_((t,e)=>pr(t,"name",{value:e,configurable:!0}),"e");const Cr={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:hr(()=>import("../packem_chunks/handler9.js"),"loader"),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{Er as $,vr as E,Nr as I,Ar as a,G as b,yr as c,k as d,q as h,Cr as i,Or as m,kr as p};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=Object.defineProperty;var r=(e,n)=>o(e,"name",{value:n,configurable:!0});var a=Object.defineProperty,c=r((e,n)=>a(e,"name",{value:n,configurable:!0}),"i");const l=new Set(["0BSD","AGPL-3.0","AGPL-3.0-only","AGPL-3.0-or-later","Apache-1.1","Apache-2.0","Artistic-2.0","BlueOak-1.0.0","BSD-2-Clause","BSD-3-Clause","BSL-1.0","CC0-1.0","CC-BY-3.0","CC-BY-4.0","CDDL-1.0","CDDL-1.1","EPL-1.0","EPL-2.0","GPL-2.0","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0","GPL-3.0-only","GPL-3.0-or-later","ISC","LGPL-2.0","LGPL-2.1","LGPL-3.0","MIT","MIT-0","MPL-1.1","MPL-2.0","Python-2.0","Unlicense","WTFPL","Zlib"]),L={apache2:"Apache-2.0","apache 2.0":"Apache-2.0",bsd:"BSD-3-Clause","bsd-2":"BSD-2-Clause","bsd-3":"BSD-3-Clause",mit:"MIT",public:"Unlicense","public domain":"Unlicense"},p=(()=>{const e=new Map;for(const n of l)e.set(n.toLowerCase(),n);for(const[n,t]of Object.entries(L))e.set(n,t);return e})(),P=c(e=>{const n=e.trim();if(n.length!==0)return l.has(n)?n:p.get(n.toLowerCase())},"normalizeSpdxId"),f=c(e=>{let n;if(typeof e.license=="string")n=e.license;else if(e.license&&typeof e.license=="object"&&typeof e.license.type=="string")n=e.license.type;else if(Array.isArray(e.licenses)&&e.licenses.length>0){const s=e.licenses[0];s&&typeof s.type=="string"&&(n=s.type)}if(!n)return;const t=n.trim();if(t.length===0)return;if(/[()]|\b(?:and|or|with)\b/i.test(t))return[{expression:t}];const i=P(t);return i?[{license:{id:i}}]:[{license:{name:t}}]},"extractLicenseChoice");export{f as e,P as n};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var z=Object.defineProperty;var n=(t,e)=>z(t,"name",{value:e,configurable:!0});import{createRequire as Q}from"node:module";import{n as tt,M as w}from"./readFileSync-DseCu8sg-DEq4Fn3a.js";import{g as j}from"../packem_chunks/config.js";import{aT as ht,U as dt,aU as L}from"../packem_chunks/bin.js";import{withEnhancedPath as wt}from"@visulima/task-runner";const Z=Q(import.meta.url),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,p=n(t=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[e,o]=m.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return m.getBuiltinModule(t)}return Z(t)},"__cjs_getBuiltinModule"),{Socket:et}=p("node:net"),{randomBytes:ot}=p("node:crypto"),{readdir:st,writeFile:rt,rm:T,rename:it,open:nt,readFile:at,stat:ct,unlink:O}=p("node:fs/promises"),{createRequire:lt}=p("node:module"),{spawn:ft}=p("node:child_process"),{openSync:ut,closeSync:pt}=p("node:fs");var kt=Object.defineProperty,W=n((t,e)=>kt(t,"name",{value:e,configurable:!0}),"s$2");const mt=lt(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,yt=W(t=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[e,o]=y.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return y.getBuiltinModule(t)}return mt(t)},"a"),{lstat:x,mkdir:gt}=yt("node:fs/promises"),vt=W(async t=>{tt(t);try{const e=await x(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(j(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{await gt(t,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const o=await x(t);if(!o.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(j(o))}'`,{cause:e})}},"m");var _t=Object.defineProperty,f=n((t,e)=>_t(t,"name",{value:e,configurable:!0}),"s$1");const bt=3e4,N=100;class Et extends Error{static{n(this,"ServiceReadinessError")}constructor(e,o){super(e),this.elapsedMs=o,this.name="ServiceReadinessError"}elapsedMs;static{f(this,"ServiceReadinessError")}}const $t=f(async t=>{const e=t.host??"127.0.0.1",{port:o}=t,s=t.timeoutMs??bt,r=Date.now();for(;Date.now()-r<s;){if(await St(e,o))return;await Ht(N)}throw new Et(`Timed out waiting for ${e}:${String(o)} to accept TCP connections (${String(s)}ms)`,Date.now()-r)},"waitForTcp"),St=f((t,e)=>new Promise(o=>{const s=new et,r=f(i=>{s.removeAllListeners(),s.destroy(),o(i)},"onDone");s.once("connect",()=>{r(!0)}),s.once("error",()=>{r(!1)}),s.setTimeout(N,()=>{r(!1)});try{s.connect(e,t)}catch{r(!1)}}),"tryConnect"),Ht=f(t=>new Promise(e=>{setTimeout(e,t)}),"delay"),Pt=f(async(t,e)=>{const o=t.readiness??(t.port===void 0?void 0:{tcp:{port:t.port}});o&&await $t({host:o.tcp.host,port:o.tcp.port,timeoutMs:e?.timeoutMs??o.tcp.timeoutMs})},"runReadiness");var Tt=Object.defineProperty,h=n((t,e)=>Tt(t,"name",{value:e,configurable:!0}),"o");const R=384,C=5e3,Rt=50,Mt=3e4,k=h(async t=>{const e=w(ht(t),"services");try{await vt(e)}catch(o){throw o.code==="ENOTDIR"?new Error(`Service registry path ${e} exists but is not a directory. Remove it or move the conflicting file before running \`vis service\`.`,{cause:o}):o}return e},"getRegistryDir"),M=h(t=>t.replaceAll("/","_").replaceAll(":","__"),"slugify"),D=h((t,e)=>w(t,`${M(e)}.json`),"entryPath"),Dt=h((t,e)=>w(t,`${M(e)}.lock`),"lockPath"),b=h(async(t,e)=>{const o=await k(t),s=D(o,e);if(await dt(s))try{return await L(s)}catch{return}},"readEntry"),Ot=h(async t=>{const e=await k(t);let o;try{o=await st(e)}catch{return[]}const s=[];for(const r of o)if(r.endsWith(".json"))try{const i=await L(w(e,r));s.push(i)}catch{}return s},"readAllEntries"),jt=h(async(t,e)=>{const o=await k(t),s=D(o,e.id),r=w(o,`.${ot(8).toString("hex")}.tmp`);await rt(r,`${JSON.stringify(e,void 0,2)}
|
|
2
|
+
`,{mode:R});try{await It(r,s)}catch(i){throw await T(r,{force:!0}).catch(()=>{}),i}},"writeEntry"),xt=new Set(["EACCES","EBUSY","EPERM"]),Ct=8,At=20,It=h(async(t,e)=>{let o=0;for(;;)try{await it(t,e);return}catch(s){const{code:r}=s;if(!(r!==void 0&&xt.has(r))||o>=Ct)throw s;const i=At*2**o;await new Promise(c=>{setTimeout(c,i)}),o+=1}},"renameWithRetry"),g=h(async(t,e,o)=>{const s=await k(t),r=o??await b(t,e);await T(D(s,e),{force:!0}),r&&await T(r.logFile,{force:!0}).catch(()=>{})},"deleteEntry"),u=h(t=>{try{return process.kill(t,0),!0}catch{return!1}},"isAlive"),ie=h(async t=>{const e=await Ot(t),o=[],s=[];for(const r of e){if(u(r.pid)){s.push(r);continue}const i=await b(t,r.id);if(i&&i.pid!==r.pid){s.push(i);continue}await g(t,r.id,r).catch(()=>{}),o.push(r.id)}return{pruned:o,surviving:s}},"pruneDead"),Ft=h(t=>new Promise(e=>{setTimeout(e,t)}),"sleep"),Lt=h(async t=>{try{const e=await nt(t,"wx",R);try{await e.writeFile(String(process.pid))}finally{await e.close().catch(()=>{})}return!0}catch(e){if(e.code==="EEXIST")return!1;throw e}},"tryClaimLock"),Wt=h(async t=>{let e;try{const o=await at(t,"utf8"),s=Number.parseInt(o.trim(),10);e=Number.isFinite(s)?s:void 0}catch{return!0}if(e!==void 0&&!u(e))return!0;try{const o=await ct(t);return Date.now()-o.mtimeMs>Mt}catch{return!0}},"isLockStale"),B=h(async(t,e,o)=>{const s=await k(t),r=Dt(s,e),i=Date.now();for(;!await Lt(r);){if(await Wt(r)){await O(r).catch(()=>{});continue}if(Date.now()-i>=C)throw new Error(`Could not acquire service lock for ${e} within ${String(C)}ms — another \`vis service\` invocation appears to be holding it.`);await Ft(Rt)}try{return await o()}finally{await O(r).catch(()=>{})}},"withServiceLock");var Nt=Object.defineProperty,l=n((t,e)=>Nt(t,"name",{value:e,configurable:!0}),"r");function v(t,e={},o){for(const s in t){const r=t[s],i=o?`${o}:${s}`:s;typeof r=="object"&&r!==null?v(r,e,i):typeof r=="function"&&(e[i]=r)}return e}n(v,"c");l(v,"flatHooks");function Bt(...t){const e={};for(const o of t){const s=v(o);for(const r in s)e[r]?e[r].push(s[r]):e[r]=[s[r]]}for(const o in e)if(e[o].length>1){const s=e[o];e[o]=(...r)=>G(s,i=>i(...r))}else e[o]=e[o][0];return e}n(Bt,"v");l(Bt,"mergeHooks");function G(t,e){return t.reduce((o,s)=>o.then(()=>e(s)),Promise.resolve())}n(G,"d$1");l(G,"serial");const V=(()=>{if(console.createTask)return console.createTask;const t={run:l(e=>e(),"run")};return()=>t})();function E(t,e,o,s){for(let r=o;r<t.length;r+=1)try{const i=s?s.run(()=>t[r](...e)):t[r](...e);if(i&&typeof i.then=="function")return Promise.resolve(i).then(()=>E(t,e,r+1,s))}catch(i){return Promise.reject(i)}}n(E,"k");l(E,"callHooks");function q(t,e,o){if(t.length>0)return E(t,e,0,V(o))}n(q,"y");l(q,"serialTaskCaller");function U(t,e,o){if(t.length>0){const s=V(o);return Promise.all(t.map(r=>s.run(()=>r(...e))))}}n(U,"m");l(U,"parallelTaskCaller");function Gt(t,e){return t.reduce((o,s)=>o.then(()=>s(...e||[])),Promise.resolve())}n(Gt,"x");l(Gt,"serialCaller");function Vt(t,e){return Promise.all(t.map(o=>o(...e||[])))}n(Vt,"P");l(Vt,"parallelCaller");function _(t,e){for(const o of[...t])o(e)}n(_,"a");l(_,"callEachWith");var qt=class{static{n(this,"p")}static{l(this,"Hookable")}_hooks;_before;_after;_deprecatedHooks;_deprecatedMessages;constructor(){this._hooks={},this._before=void 0,this._after=void 0,this._deprecatedMessages=void 0,this._deprecatedHooks={},this.hook=this.hook.bind(this),this.callHook=this.callHook.bind(this),this.callHookWith=this.callHookWith.bind(this)}hook(t,e,o={}){if(!t||typeof e!="function")return()=>{};const s=t;let r;for(;this._deprecatedHooks[t];)r=this._deprecatedHooks[t],t=r.to;if(r&&!o.allowDeprecated){let i=r.message;i||(i=`${s} hook has been deprecated`+(r.to?`, please use ${r.to}`:"")),this._deprecatedMessages||(this._deprecatedMessages=new Set),this._deprecatedMessages.has(i)||(console.warn(i),this._deprecatedMessages.add(i))}if(!e.name)try{Object.defineProperty(e,"name",{get:l(()=>"_"+t.replace(/\W+/g,"_")+"_hook_cb","get"),configurable:!0})}catch{}return this._hooks[t]=this._hooks[t]||[],this._hooks[t].push(e),()=>{e&&(this.removeHook(t,e),e=void 0)}}hookOnce(t,e){let o,s=l((...r)=>(typeof o=="function"&&o(),o=void 0,s=void 0,e(...r)),"_function");return o=this.hook(t,s),o}removeHook(t,e){const o=this._hooks[t];if(o){const s=o.indexOf(e);s!==-1&&o.splice(s,1),o.length===0&&(this._hooks[t]=void 0)}}clearHook(t){this._hooks[t]=void 0}deprecateHook(t,e){this._deprecatedHooks[t]=typeof e=="string"?{to:e}:e;const o=this._hooks[t]||[];this._hooks[t]=void 0;for(const s of o)this.hook(t,s)}deprecateHooks(t){for(const e in t)this.deprecateHook(e,t[e])}addHooks(t){const e=v(t),o=Object.keys(e).map(s=>this.hook(s,e[s]));return()=>{for(const s of o)s();o.length=0}}removeHooks(t){const e=v(t);for(const o in e)this.removeHook(o,e[o])}removeAllHooks(){this._hooks={}}callHook(t,...e){return this.callHookWith(q,t,e)}callHookParallel(t,...e){return this.callHookWith(U,t,e)}callHookWith(t,e,o){const s=this._before||this._after?{name:e,args:o,context:{}}:void 0;this._before&&_(this._before,s);const r=t(this._hooks[e]?[...this._hooks[e]]:[],o,e);return r instanceof Promise?r.finally(()=>{this._after&&s&&_(this._after,s)}):(this._after&&s&&_(this._after,s),r)}beforeEach(t){return this._before=this._before||[],this._before.push(t),()=>{if(this._before!==void 0){const e=this._before.indexOf(t);e!==-1&&this._before.splice(e,1)}}}afterEach(t){return this._after=this._after||[],this._after.push(t),()=>{if(this._after!==void 0){const e=this._after.indexOf(t);e!==-1&&this._after.splice(e,1)}}}};function X(){return new qt}n(X,"w$1");l(X,"createHooks");(class{static{l(this,"HookableCore")}_hooks;constructor(){this._hooks={}}hook(t,e){return!t||typeof e!="function"?()=>{}:(this._hooks[t]=this._hooks[t]||[],this._hooks[t].push(e),()=>{e&&(this.removeHook(t,e),e=void 0)})}removeHook(t,e){const o=this._hooks[t];if(o){const s=o.indexOf(e);s!==-1&&o.splice(s,1),o.length===0&&(this._hooks[t]=void 0)}}callHook(t,...e){const o=this._hooks[t];if(!(!o||o.length===0))return E(o,e,0)}});const A=typeof window<"u";function Ut(t,e={}){const o={inspect:A,group:A,filter:l(()=>!0,"filter"),...e},s=o.filter,r=typeof s=="string"?a=>a.startsWith(s):s,i=o.tag?`[${o.tag}] `:"",c=l(a=>i+a.name+"".padEnd(a._id,"\0"),"logPrefix"),d={},H=t.beforeEach(a=>{r!==void 0&&!r(a.name)||(d[a.name]=d[a.name]||0,a._id=d[a.name]++,console.time(c(a)))}),P=t.afterEach(a=>{r!==void 0&&!r(a.name)||(o.group&&console.groupCollapsed(a.name),o.inspect?console.timeLog(c(a),a.args):console.timeEnd(c(a)),o.group&&console.groupEnd(),d[a.name]--)});return{close:l(()=>{H(),P()},"close")}}n(Ut,"W");l(Ut,"createDebugger");var Xt=Object.defineProperty,$=n((t,e)=>Xt(t,"name",{value:e,configurable:!0}),"t$1");const ne=$(()=>X(),"createVisHooks"),ae=$(async(t,e)=>{if(!(!e||e.length===0))for(const o of e){if(o.hooks)for(const[s,r]of Object.entries(o.hooks)){const i=Array.isArray(r)?r:[r];for(const c of i)t.hook(s,c)}o.setup&&await o.setup(t)}},"registerPlugins");class ce{static{n(this,"HookableLifeCycle")}static{$(this,"HookableLifeCycle")}#o;#e;#s=new Map;constructor(e,o){this.#o=e,this.#e=o}startTasks(e){for(const o of e)this.#s.set(o.id,o),this.#t("task:before",o)}endTasks(e){for(const o of e)this.#s.delete(o.task.id),this.#t("task:after",o.task,o),o.status==="failure"?this.#t("task:failure",o.task,o):Yt(o.status)&&this.#t("task:cacheHit",o.task,o)}printCacheMiss(e,o){this.#t("task:cacheMiss",e,o)}onTaskStdout(e,o){this.#t("task:stdout",e,o)}onTaskStderr(e,o){this.#t("task:stderr",e,o)}#t(e,...o){Promise.resolve(this.#o.callHook(e,...o)).catch(s=>{if(this.#e)try{this.#e(e,s)}catch{}})}}const Yt=$(t=>t==="local-cache"||t==="local-cache-kept-existing"||t==="remote-cache","isCacheStatus");var Jt=Object.defineProperty,Kt=n((t,e)=>Jt(t,"name",{value:e,configurable:!0}),"i");const I=process.platform==="win32",zt=Kt(async t=>{const{command:e,cwd:o,env:s,logFile:r}=t,i=ut(r,"a",R);let c;const d=I?"cmd":"/bin/sh",H=I?["/d","/s","/c",e]:["-c",e];try{c=ft(d,H,{cwd:o,detached:!0,env:wt({...process.env,...s},o),stdio:["ignore",i,i],windowsHide:!0})}finally{pt(i)}if(c.pid===void 0&&await new Promise((P,a)=>{c.once("spawn",()=>{P()}),c.once("error",K=>{a(K)})}),c.pid===void 0)throw new Error(`Failed to spawn detached process for command: ${e}`);return c.unref(),{pid:c.pid}},"spawnDetached");var Qt=Object.defineProperty,S=n((t,e)=>Qt(t,"name",{value:e,configurable:!0}),"t");const Y=5e3,le=S(async t=>B(t.workspaceRoot,t.id,async()=>{const e=await b(t.workspaceRoot,t.id);if(e&&u(e.pid))throw new Error(`Service ${t.id} is already running (pid ${String(e.pid)})`);e&&await g(t.workspaceRoot,t.id,e);const o=await k(t.workspaceRoot),s=M(t.id),r=w(o,`${s}.log`),{pid:i}=await zt({command:t.command,cwd:t.cwd,env:t.env,logFile:r}),c={command:t.command,config:t.config,cwd:t.cwd,env:t.config.env??{},id:t.id,logFile:r,pid:i,slug:s,startedAt:new Date().toISOString(),visVersion:process.env.VIS_VERSION??"0.0.0"};if(await jt(t.workspaceRoot,c),t.skipReadiness!==!0)try{await Pt(t.config,{timeoutMs:t.readinessTimeoutMs})}catch(d){throw await J(i,t.config.killGracePeriodMs??Y).catch(()=>{}),await g(t.workspaceRoot,t.id,c).catch(()=>{}),d}return{entry:c}}),"startService"),he=S(async t=>B(t.workspaceRoot,t.id,async()=>{const e=await b(t.workspaceRoot,t.id);if(!e)return{stopped:!1};if(!u(e.pid))return await g(t.workspaceRoot,t.id,e),{stopped:!1};const o=t.graceMs??e.config.killGracePeriodMs??Y;return await J(e.pid,o),await g(t.workspaceRoot,t.id,e),{stopped:!0}}),"stopService"),J=S(async(t,e)=>{F(t,"SIGTERM");const o=Date.now();for(;Date.now()-o<e;){if(!u(t))return;await new Promise(s=>{setTimeout(s,100)})}u(t)&&F(t,"SIGKILL")},"stopServiceByPid"),F=S((t,e)=>{try{process.platform==="win32"?process.kill(t,e):process.kill(-t,e)}catch(o){if(o.code==="ESRCH")return;throw o}},"sendSignalToServiceGroup");export{ce as H,Et as S,b as a,he as b,ne as c,Ot as d,Pt as e,g as f,u as i,ie as p,ae as r,le as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var T=Object.defineProperty;var j=(n,e)=>T(n,"name",{value:e,configurable:!0});import{createRequire as B}from"node:module";import{D as R,u as C}from"../packem_chunks/bin.js";const q=B(import.meta.url),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=j(n=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[e,t]=h.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return h.getBuiltinModule(n)}return q(n)},"__cjs_getBuiltinModule"),{createRequire:N}=A("node:module");var U=Object.defineProperty,z=j((n,e)=>U(n,"name",{value:e,configurable:!0}),"L"),I=Object.defineProperty,_=z((n,e)=>I(n,"name",{value:e,configurable:!0}),"b");const J=N(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,S=_(n=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[e,t]=y.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return y.getBuiltinModule(n)}return J(n)},"__cjs_getBuiltinModule"),{readFileSync:Y}=S("node:fs"),{readFile:Z}=S("node:fs/promises");var K=Object.defineProperty,l=_((n,e)=>K(n,"name",{value:e,configurable:!0}),"g");const G={sha256:"sha256",sha384:"sha384",sha512:"sha512"},H=1024,Q=/^[A-Z0-9+/]+={0,2}$/i,V=/.*node_modules\/((?:@[^/]+\/)?[^/]+)$/,k=/^['"]/,v=/['"]$/,X=/^[a-z][a-zA-Z0-9]*:\s*$/m,ee=/resolution:\s*\{[^}]*integrity:\s*([^,}\s]+)/,ne=/^["']?((?:@[^/@"']+\/)?[^@"'\n]+)@[^\n]+\n((?:[\t ][^\n]*(?:\n|$))+)/gm,te=/^\s+version:?\s+"?([^"\n]+)"?/m,se=/^\s+integrity[\s:]+"?([^"\s]+)"?/m,x=l(n=>{if(n.length>H)return;const e=n.indexOf("-");if(e<=0)return;const t=G[n.slice(0,e).toLowerCase()];if(!t)return;const s=n.slice(e+1);if(Q.test(s))try{const i=Buffer.from(s,"base64");return i.length===0?void 0:{algorithm:t,hex:i.toString("hex")}}catch{return}},"decodeSriIntegrity"),w=l((n,e,t)=>{const s=`${t.name}@${t.version}`;e.has(s)||(e.add(s),n.push(t))},"pushUniqueEntry"),m=l((n,e,t)=>{t&&Object.keys(t).length>0&&(n[e]={...t})},"copyDepMap"),g=l(n=>{if(!n)return;const e={};for(const[t,s]of Object.entries(n))e[t]=[s];return Object.keys(e).length>0?e:void 0},"liftDepMap"),re=l(n=>{const e=[],t=new Set;let s;try{s=JSON.parse(n)}catch{return e}if(!s.packages)return e;for(const[i,r]of Object.entries(s.packages)){if(!i||!r.version)continue;const p=V.exec(i);if(!p?.[1])continue;const c=r.name??p[1];if(c.startsWith("."))continue;const o={name:c,version:r.version};if(r.integrity){const a=x(r.integrity);a&&(o.integrity=a)}m(o,"dependencies",g(r.dependencies)),m(o,"peerDependencies",g(r.peerDependencies)),m(o,"optionalDependencies",g(r.optionalDependencies)),w(e,t,o)}return e},"parseNpmLockFile"),W=l(n=>{let e=n.trim();e.startsWith("/")&&(e=e.slice(1)),e=e.replace(k,"").replace(v,"");const t=e.indexOf("(");t>0&&(e=e.slice(0,t));const s=e.lastIndexOf("@");if(s<=0)return;const i=e.slice(0,s),r=e.slice(s+1);if(!(!i||!r||r.startsWith("link:")||r.startsWith("workspace:")||r.startsWith("file:")))return{name:i,version:r}},"splitPnpmPackageKey"),F=l((n,e)=>{const t=new RegExp(String.raw`^${e}:\s*$`,"m").exec(n);if(!t)return;const s=t.index+t[0].length,i=X.exec(n.slice(s));return n.slice(s,i?s+i.index:n.length)},"sliceTopLevelSection"),oe=l(n=>{const e=new Map,t=F(n,"snapshots");if(!t)return e;const s=/^ {2}(['"]?[^\s:][^:\n]*?['"]?):\s*\n((?: {4}[^\n]*\n?)+)/gm;let i;for(;(i=s.exec(t)??void 0)!==void 0;){const r=W(i[1]);if(!r)continue;const p=`${r.name}@${r.version}`,c=i[2],o=e.get(p)??{};for(const a of["dependencies","peerDependencies","optionalDependencies"]){const u=b(c,a);if(!u)continue;const d=o[a]??{};for(const[f,P]of Object.entries(u)){const D=d[f]??[];for(const $ of P)D.includes($)||D.push($);d[f]=D}o[a]=d}e.set(p,o)}return e},"parsePnpmSnapshotEdges"),ie=l(n=>{const e=[],t=new Set,s=F(n,"packages");if(!s)return e;const i=oe(n),r=/^ {2}(['"]?[^\s:][^:\n]*?['"]?):\s*\n((?: {4}[^\n]*\n?)+)/gm;let p;for(;(p=r.exec(s)??void 0)!==void 0;){const c=W(p[1]);if(!c)continue;const o=p[2],a=ee.exec(o),u={name:c.name,version:c.version};if(a?.[1]){const f=x(a[1]);f&&(u.integrity=f)}const d=i.get(`${c.name}@${c.version}`);m(u,"dependencies",d?.dependencies??b(o,"dependencies")),m(u,"peerDependencies",d?.peerDependencies??b(o,"peerDependencies")),m(u,"optionalDependencies",d?.optionalDependencies??b(o,"optionalDependencies")),w(e,t,u)}return e},"parsePnpmLockFile"),b=l((n,e)=>{const t=new RegExp(String.raw`^ {4}${e}:\s*\n((?: {6,}[^\n]*\n?)+)`,"m").exec(n);if(!t?.[1])return;const s={},i=/^ {6}([^\s:]+):\s*([^\n]+)/gm;let r;for(;(r=i.exec(t[1])??void 0)!==void 0;){const p=r[1].replace(k,"").replace(v,"");let c=r[2].trim();c=c.replace(k,"").replace(v,"");const o=c.indexOf("(");if(o>0&&(c=c.slice(0,o).trim()),!p||!c)continue;const a=s[p]??[];a.includes(c)||a.push(c),s[p]=a}return Object.keys(s).length>0?s:void 0},"extractPnpmDependencyMap"),ce=l(n=>{const e=[],t=new Set,s=ne;s.lastIndex=0;let i;for(;(i=s.exec(n)??void 0)!==void 0;){const r=i[1].replace(k,"").replace(v,"");if(!r)continue;const p=i[2],c=te.exec(p);if(!c?.[1])continue;const o={name:r,version:c[1].trim()},a=se.exec(p);if(a?.[1]){const u=x(a[1]);u&&(o.integrity=u)}m(o,"dependencies",O(p,"dependencies")),m(o,"peerDependencies",O(p,"peerDependencies")),m(o,"optionalDependencies",O(p,"optionalDependencies")),w(e,t,o)}return e},"parseYarnLockFile"),O=l((n,e)=>{const t=new RegExp(String.raw`^ {2}${e}:\s*\n((?: {4,}[^\n]*\n?)+)`,"m").exec(n);if(!t?.[1])return;const s={},i=/^ {4}(['"]?[^\s:'"]+['"]?)\s*(?::\s*)?['"]([^'"\n]+)['"]/gm;let r;for(;(r=i.exec(t[1])??void 0)!==void 0;){const p=r[1].replace(k,"").replace(v,""),c=r[2];if(p&&c){const o=s[p]??[];o.includes(c)||o.push(c),s[p]=o}}return Object.keys(s).length>0?s:void 0},"extractYarnDependencyMap"),pe=/,(?=\s*[}\]])/g,ae=l(n=>{const e=[],t=new Set;let s;try{s=JSON.parse(n.replaceAll(pe,""))}catch{return e}if(!s.packages)return e;for(const i of Object.values(s.packages)){const r=i[0];if(typeof r!="string")continue;const p=r.indexOf("@",1);if(p<=0)continue;const c=r.slice(0,p),o=r.slice(p+1);if(!c||!o||o.startsWith("workspace:")||o.startsWith("link:")||o.startsWith("file:"))continue;const a={name:c,version:o},u=i[3];if(typeof u=="string"&&u.length>0){const f=x(u);f&&(a.integrity=f)}const d=i[2];if(d&&typeof d=="object"&&!Array.isArray(d)){const f=d;m(a,"dependencies",g(f.dependencies)),m(a,"peerDependencies",g(f.peerDependencies)),m(a,"optionalDependencies",g(f.optionalDependencies))}w(e,t,a)}return e},"parseBunLockFile"),L=l(n=>{if(n.endsWith("pnpm-lock.yaml"))return"pnpm";if(n.endsWith("package-lock.json"))return"npm";if(n.endsWith("yarn.lock"))return"yarn";if(n.endsWith("bun.lock"))return"bun"},"inferLockFileType"),E=l((n,e)=>{switch(e){case"bun":return ae(n);case"npm":return re(n);case"pnpm":return ie(n);case"yarn":return ce(n);default:return[]}},"parseLockFileContent"),M=["pnpm-lock.yaml","package-lock.json","yarn.lock","bun.lock"];l(async n=>{const e=await R(M,{type:"file",...n&&{cwd:n}});if(!e)throw new Error("Could not find a supported lock file (pnpm-lock.yaml, package-lock.json, yarn.lock, bun.lock)");const t=L(e);if(!t)throw new Error(`Unsupported lock file: ${e}`);const s=await Z(e,"utf8");return{entries:E(s,t),path:e,type:t}},"parseLockFile");l(n=>{const e=C(M,{type:"file",...n&&{cwd:n}});if(!e)throw new Error("Could not find a supported lock file (pnpm-lock.yaml, package-lock.json, yarn.lock, bun.lock)");const t=L(e);if(!t)throw new Error(`Unsupported lock file: ${e}`);return{entries:E(Y(e,"utf8"),t),path:e,type:t}},"parseLockFileSync");export{E as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var k=Object.defineProperty;var u=(e,n)=>k(e,"name",{value:n,configurable:!0});import{createRequire as g}from"node:module";import{M as m}from"./readFileSync-DseCu8sg-DEq4Fn3a.js";const b=g(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=u(e=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[n,s]=l.versions.node.split(".").map(Number);if(n>22||n===22&&s>=3||n===20&&s>=16)return l.getBuiltinModule(e)}return b(e)},"__cjs_getBuiltinModule"),{existsSync:f,statSync:p}=h("node:fs");var y=Object.defineProperty,i=u((e,n)=>y(e,"name",{value:n,configurable:!0}),"s");const M={aube:["aube-lock.yaml"],bun:["bun.lock","bun.lockb"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]},_={aube:["node_modules/.aube-state","node_modules/.modules.yaml"],bun:["node_modules/.bun-tag"],npm:["node_modules/.package-lock.json"],pnpm:["node_modules/.modules.yaml","node_modules/.pnpm/lock.yaml"],yarn:["node_modules/.yarn-integrity","node_modules/.yarn-state.yml",".yarn/install-state.gz"]},j={ci:{aube:"aube ci",bun:"bun install --frozen-lockfile",npm:"npm ci",pnpm:"pnpm install --frozen-lockfile",yarn:"yarn install --immutable"},tty:{aube:"aube install",bun:"bun install",npm:"npm install",pnpm:"pnpm install",yarn:"yarn install"}},v=1e3,P=i(e=>{for(const[n,s]of Object.entries(M))for(const t of s)if(f(m(e,t)))return{lockfileFile:t,manager:n}},"detectPackageManager"),C=i((e,n)=>{let s;for(const t of _[n]){const o=m(e,t);if(!f(o))continue;const{mtimeMs:a}=p(o);(!s||a>s.mtimeMs)&&(s={mtimeMs:a,path:t})}return s},"findFreshestMarker"),F=i((e,n={})=>{const s=P(e);if(!s)return{checked:!1};const{lockfileFile:t,manager:o}=s,a=p(m(e,t)).mtimeMs,r=C(e,o),d=j[n.inCi?"ci":"tty"][o],c={installMarkerMtimeMs:r?.mtimeMs,lockfileMtimeMs:a,lockfilePath:t,marker:r?.path,packageManager:o};return r?a>r.mtimeMs+v?{checked:!0,detail:c,failure:"stale-install",message:`${t} is newer than node_modules (${r.path}) — run \`${d}\` to sync.`}:{checked:!0,detail:c}:{checked:!0,detail:c,failure:"missing-install",message:`lockfile detected but node_modules looks uninitialised — run \`${d}\` before \`vis run\`.`}},"checkLockfileFreshness"),w=i((e,n,s,t={})=>{if(t.skip)return{checked:!1,shouldContinue:!0};const o=F(e,{inCi:n});if(!o.failure)return{...o,shouldContinue:!0};const a=`preflight: ${o.message??"lockfile drift detected"}`;return n&&!t.ciAsWarning?{...o,formattedMessage:a,shouldContinue:!1}:(s.warn(a),{...o,formattedMessage:a,shouldContinue:!0})},"runLockfilePreflight");export{P as d,w as r};
|