Lines 1-24javascript
3var Xc=Object.defineProperty;var dc=(b)=>b;function Mc(b,$){this[b]=dc.bind(null,$)}var B$=(b,$)=>{for(var c in $)Xc(b,c,{get:$[c],enumerable:!0,configurable:!0,set:Mc.bind($,c)})};var Cb=(b,$)=>()=>(b&&($=b(b=0)),$);var Gb=import.meta.require;import{createInterface as Yc}from"readline";class Fb{timer=null;frames=process.platform==="win32"?["-"]:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];frameIndex=0;text;isWindows=process.platform==="win32";constructor(b){this.text=b}start(b){if(b)this.text=b;if(this.timer)return;if(this.isWindows){process.stdo ...
4`);return}this.timer=setInterval(()=>{process.stdout.write(`\r\x1B[K${w.cyan(this.frames[this.frameIndex])} ${this.text}`),this.frameIndex=(this.frameIndex+1)%this.frames.length},80)}stop(){
5`)}render(b){let $=Math.min(1,this.current/this.total),c=Math.round(this.width*$),f=this.width-c,u=process.platform==="win32",y=u?"=":"\u2588",_=u?"-":"\u2591",m=w.green(y.repeat(c))+w.gray(_.repeat(f)),v=($*100).toFixed(0).padStart(3," "),B=(this.current/1048576).toFixed(1),J=(this.total/1048576).toFixed(1),O=b?` ${b.speed}KB/s`:"";process.stdout.write(`\r\x1B[2K ${m} ${v}% | ${B}/${J}MB${O}`)}}async function q$(b){let $=Yc({input:process.stdin,output:process.stdout});return new Promise((c)=>{$.question(`${w.yellow("?")} ${b} (Y/n) `,(f)=>{$.close(),c(f.toLowerCase()!=="n")})})}var Ac,kc=(b)= ...
6`)){let y=u.match(/refs\/tags\/bun-v?(\d+\.\d+\.\d+.*)$/);if(y)f.push(y[1])}return f}async function M$(){if(W())return[...Zb];try{let $=(await ec()).filter((c)=>l(c)).map((c)=>({v:c,parsed:Bb(c)}));return $.sort((c,f)=>Pb(f.parsed,c.parsed)),$.map((c)=>c.v)}catch(b){try{let $=await bf();if($.length>0)return Array.from(new Set($.filter((f)=>l(f)))).sort
7${w.gray("Update available:")} ${w.green(`v${f.latestVersion}`)} ${w.dim(`(current: v${b})`)}
8${w.gray("Run")} ${w.cyan("bvm upgrade")} ${w.gray("to update.")}`}}catch(c){}return null}class tb{name;versionStr;commands={};helpEntries=[];optionDefinitions={help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"},silent:{type:"boolean",short:"s"}};constructor(b,$){this.name=b;this.versionStr=$}command(b,$,c={}){let f=b.split(" ")[0],u={description:$,usage:`${this.name} ${b}`,action:async()=>{},aliases:c.aliases,optionNames:new Set};this.commands[f]=u,this.helpEntries.push(` ${b.padEnd(35)} ${$}`),c.aliases?.forEach((_)=>{this.commands[_]=u});let y={action:(_)=>{return u.action= ...
9`),console.log("Usage:"),console.log(` ${this.name} <command> [flags]
10`),console.log("Commands:"),console.log(this.helpEntries.join(`
12Global Flags:`),console.log(" --help, -h Show this help message"),console.log(" --version, -v Show version number"),console.log(`
13Examples:`),console.log(" bvm install 1.0.0"),console.log(" bvm use 1.0.0"),console.log(" bvm run 1.0.0 index.ts")}}I();d();import{join as T,basename as nf}from"path";M();M();async function fb(b,$={}){let{cwd:c,env:f,prependPath:u,stdin:y="inherit",stdout:_="inherit",stderr:m="inherit"}=$,v={...process.env,...f};if(u){let O=v.PATH||"",Z=process.platform==="win32"?";":":";v.PATH
14
MediumInstall Persistence
Source writes installer persistence such as shell profile or service configuration.
dist/index.jsView on unpkg · L2 15# bvm-init.sh: Initializes bvm default version on shell startup
17# Check if BVM_DIR is set
18if [ -z "\${BVM_DIR}" ]; then
19 echo "[bvm:init] initialization failed: BVM_DIR is not set. Run 'bvm setup'." >&2
23if [ ! -x "\${BVM_DIR}/bin/bvm" ]; then
24 echo "[bvm:init] initialization failed: \${BVM_DIR}/bin/bvm not found. Run 'bvm setup'." >&2
Long lines were clipped for display.