@visulima/cerebro 3.1.3 → 4.0.1

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/LICENSE.md +55 -129
  3. package/MIGRATION-GUIDE.md +29 -7
  4. package/README.md +5 -6
  5. package/dist/commands/completion-command.d.ts +1 -1
  6. package/dist/commands/completion-command.js +4 -4
  7. package/dist/commands/help-command.d.ts +1 -1
  8. package/dist/commands/help-command.js +1 -1
  9. package/dist/commands/readme-command.d.ts +1 -1
  10. package/dist/commands/readme-command.js +1 -1
  11. package/dist/commands/version-command.d.ts +1 -1
  12. package/dist/index.d.ts +2 -2
  13. package/dist/index.js +1 -1
  14. package/dist/logger/create-pail-logger.js +1 -1
  15. package/dist/packem_shared/Cerebro-ggJmXJrF.js +4 -0
  16. package/dist/packem_shared/{command.d-Dz7hkMI0.d.ts → command.d-DNTe-FYX.d.ts} +2 -2
  17. package/dist/packem_shared/constants-BGGeBKGT-C4poKWYI.js +1 -0
  18. package/dist/packem_shared/format-positional-usage-Cm4bukjQ.js +6 -0
  19. package/dist/packem_shared/runtime-process-BLYbrTb0.js +1 -0
  20. package/dist/plugins/error-handler-plugin.d.ts +1 -1
  21. package/dist/plugins/error-handler-plugin.js +1 -1
  22. package/dist/plugins/runtime-version-check-plugin.d.ts +3 -5
  23. package/dist/plugins/runtime-version-check-plugin.js +1 -1
  24. package/dist/plugins/update-notifier/update-notifier-plugin.d.ts +1 -1
  25. package/dist/plugins/update-notifier/update-notifier-plugin.js +1 -1
  26. package/dist/util/general/heap-tuning.d.ts +2 -2
  27. package/dist/util/general/heap-tuning.js +1 -1
  28. package/package.json +6 -6
  29. package/dist/packem_shared/Cerebro-CENsjWZ1.js +0 -4
  30. package/dist/packem_shared/constants-aPzGW29R-Cuf0YlDT.js +0 -1
  31. package/dist/packem_shared/format-positional-usage-O92DKKjW.js +0 -6
  32. package/dist/packem_shared/runtime-process-BN-eTlwy.js +0 -1
@@ -1,6 +0,0 @@
1
- import{createRequire as et}from"node:module";import{w as U,O as v,A as st}from"./constants-aPzGW29R-Cuf0YlDT.js";import{createTable as A}from"@visulima/tabular";import{NO_BORDER as $}from"@visulima/tabular/style";import at from"@visulima/colorize/template";import{c as lt}from"./runtime-process-BN-eTlwy.js";import{bold as M,underline as ut}from"@visulima/colorize";let rt;const nt=t=>(rt??=et(import.meta.url))(t),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:w,S=t=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[e,r]=b.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return b.getBuiltinModule(t)}return nt(t)},w=b,{execFileSync:ot}=S("node:child_process"),W=S("node:fs"),it=S("node:tty"),ct=S("node:os"),dt=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],ft=12288,ht=65510,pt=[12288,12288,65281,65376,65504,65510],mt=8361,wt=65518,gt=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],bt=32,yt=10630,Nt=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],It=4352,Wt=262141,G=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],O=(t,e)=>{let r=0,s=Math.floor(t.length/2)-1;for(;r<=s;){const i=Math.floor((r+s)/2),c=i*2;if(e<t[c])s=i-1;else if(e>t[c+1])r=i+1;else return!0}return!1},z=19968,[Ot,vt]=xt(G);function xt(t){let e=t[0],r=t[1];for(let s=0;s<t.length;s+=2){const i=t[s],c=t[s+1];if(z>=i&&z<=c)return[i,c];c-i>r-e&&(e=i,r=c)}return[e,r]}const Et=t=>t<161||t>1114109?!1:O(dt,t),At=t=>t<ft||t>ht?!1:O(pt,t),$t=t=>t<mt||t>wt?!1:O(gt,t),Mt=t=>t<bt||t>yt?!1:O(Nt,t),Ct=t=>t>=Ot&&t<=vt?!0:t<It||t>Wt?!1:O(G,t);function Rt(t){return Et(t)?"ambiguous":At(t)?"fullwidth":$t(t)?"halfwidth":Mt(t)?"narrow":Ct(t)?"wide":"neutral"}function St(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function V(t){return St(t),Rt(t)}const D=new Map,Tt=t=>[t.ambiguousIsNarrow?1:0,t.control,t.fullWidth,t.regular,t.wide].join("|"),kt=t=>{const e=Tt(t.width);let r=D.get(e);return r||(r=new Map,D.set(e,r)),r},x=new RegExp(U.source,"y"),_=new RegExp(st.source,"uy"),E=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,Y=t=>t>=32&&t<=126?"latin":t===8203||t===8204||t===8205||t===8288?"zero":t<=31||t>=127&&t<=159?"control":t>=160&&t<=255||t>=9472&&t<=9599?"latin":t>=4352&&t<=4607||t>=11904&&t<=40959||t>=44032&&t<=55215||t>=63744&&t<=64255||t>=65280&&t<=65519&&!(t>=65377&&t<=65439)||t>=12352&&t<=12543?"wide":t===8230?"latin":"other",Lt=(t,e)=>{const r=kt(e),s=Math.floor(t/65536),i=t%65536;let c=r.get(s);if(c||(c=new Map,r.set(s,c)),c.has(i))return c.get(i);let n;switch(Y(t)){case"control":{n=e.width.control;break}case"latin":{n=e.width.regular;break}case"wide":{n=e.width.wide;break}case"zero":{n=0;break}default:switch(V(t)){case"ambiguous":{n=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{n=e.width.fullWidth;break}case"wide":{n=e.width.wide;break}default:n=e.width.regular}}return c.set(i,n),n},_t=t=>t>=768&&t<=879||t>=6832&&t<=6911||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071||t>=917760&&t<=917999||t>=65024&&t<=65039||t>=3633&&t<=3642||t>=3655&&t<=3662||t>=3761&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=2304&&t<=2307||t>=2362&&t<=2383||t>=2385&&t<=2391||t>=2402&&t<=2403||t>=2433&&t<=2435||t>=2492&&t<=2500||t>=2509&&t<=2509||t>=2561&&t<=2563||t>=2620&&t<=2637||t>=1611&&t<=1631||t>=1648&&t<=1648||t>=1750&&t<=1773||t>=2276&&t<=2302||t>=1425&&t<=1469||t>=1471&&t<=1471||t>=1473&&t<=1474||t>=1476&&t<=1477||t>=1479&&t<=1479||t>=3893&&t<=3893||t>=3895&&t<=3895||t>=3897&&t<=3897||t>=3953&&t<=3966||t>=3968&&t<=3972||t>=3974&&t<=3975?!0:t>=768&&t<=777||t>=803&&t<=803,F=(t,e={})=>{if(!t||t.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:e.countAnsiEscapeCodes??!1,ellipsis:e.ellipsis??"",ellipsisWidth:e.ellipsisWidth??(e.ellipsis?F(e.ellipsis,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:e.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:e.ambiguousIsNarrow??!1,ansi:e.ansiWidth??0,control:e.controlWidth??0,emoji:e.emojiWidth??2,fullWidth:e.fullWidth??2,halfWidth:e.halfWidth??1,regular:e.regularWidth??1,tab:e.tabWidth??8,wide:e.wideWidth??2}},s=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:i}=t,c=i>1e4;let n=0,o=0,l=i,a=!1;const u=t.includes("\x1B")||t.includes("›");for(;n<i;){if(u&&(t[n]==="\x1B"||t[n]==="›")){if(t.startsWith("\x1B]8;;",n)){const f="\x1B]8;;\x07",p=f.length,T=t.indexOf("\x07",n+5);if(T!==-1){const k=t.indexOf(f,T+1);if(k!==-1){const Q=k+p,tt=t.slice(T+1,k).replace(U,""),B=F(tt,{ambiguousIsNarrow:r.width.ambiguousIsNarrow,ansiWidth:r.width.ansi,controlWidth:r.width.control,countAnsiEscapeCodes:!1,ellipsis:r.truncation.ellipsis,ellipsisWidth:r.truncation.ellipsisWidth,emojiWidth:r.width.emoji,fullWidth:r.width.fullWidth,halfWidth:r.width.halfWidth,limit:Math.max(0,s-o),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),L=B.width;if(B.truncated)a=!0,l=Math.min(l,n);else if(o+L>s&&(l=Math.min(l,n),a=!0,o+L>r.truncation.limit))break;if(o+=L,n=Q,a&&o>=r.truncation.limit)break;continue}}}if(x.lastIndex=n,x.test(t)){const f=x.lastIndex-n,p=r.truncation.countAnsiEscapeCodes?f:r.width.ansi;if(o+p>s&&(l=Math.min(l,n),o+p>r.truncation.limit)){a=!0;break}o+=p,n=x.lastIndex;continue}}const m=t.codePointAt(n);if(m===8203||m===65279||m>=8288&&m<=8292){n+=1;continue}if(m===9){if(o+r.width.tab>s&&(l=Math.min(l,n),o+r.width.tab>r.truncation.limit)){a=!0;break}o+=r.width.tab,n+=1;continue}if(E.lastIndex=n,E.test(t)){const f=(E.lastIndex-n)*r.width.regular;if(o+f>s){const p=r.width.regular>0?Math.floor((s-o)/r.width.regular):0;if(l=Math.min(l,n+p),o+f>r.truncation.limit){a=!0;break}}o+=f,n=E.lastIndex;continue}if((m<=31||m>=127&&m<=159)&&(v.lastIndex=n,v.test(t))){const f=(v.lastIndex-n)*r.width.control;if(o+f>s){const p=r.width.control>0?Math.floor((s-o)/r.width.control):0;if(l=Math.min(l,n+p),o+f>r.truncation.limit){a=!0;break}}o+=f,n=v.lastIndex;continue}if(_.lastIndex=n,_.test(t)){if(o+r.width.emoji>s&&(l=Math.min(l,n),o+r.width.emoji>r.truncation.limit)){a=!0;break}o+=r.width.emoji,n=_.lastIndex;continue}const g=t.codePointAt(n)??0;if(_t(g)){n+=g>65535?2:1;continue}let d;if(c)d=Lt(g,r);else switch(Y(g)){case"control":{d=r.width.control;break}case"latin":{d=r.width.regular;break}case"wide":{d=r.width.wide;break}case"zero":{d=0;break}default:switch(V(g)){case"ambiguous":{d=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{d=r.width.fullWidth;break}case"wide":{d=r.width.wide;break}default:d=r.width.regular}}if(o+d>s&&(l=Math.min(l,n),o+d>r.truncation.limit)){a=!0;break}o+=d,n+=g>65535?2:1}let y=o,N=!1;return a&&r.truncation.limit>=r.truncation.ellipsisWidth&&(y=r.truncation.limit,N=!0),{ellipsed:N,index:a?l:i,truncated:a,width:y}},jt=(t,e={})=>F(t,{...e,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,K=80,J=24,P=(t,e,{shell:r,env:s}={})=>ot(t,e,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:r,env:s}).trim(),C=(t,e)=>({columns:Number.parseInt(t,10),rows:Number.parseInt(e,10)}),X=(t,e)=>{const{columns:r,rows:s}=C(t,e);if(!(Number.isNaN(r)||Number.isNaN(s))&&!(r===K&&s===J))return{columns:r,rows:s}},Ft=()=>{if(w.platform!=="linux")return!0;try{const t=W.readFileSync("/proc/self/stat","utf8"),e=t.lastIndexOf(") ");if(e===-1)return!1;const r=t.slice(e+2).trim().split(/\s+/),s=Number.parseInt(r[2],10),i=Number.parseInt(r[5],10);return Number.isNaN(s)||Number.isNaN(i)||i<=0?!1:s===i}catch{return!1}};function Pt(){const{env:t,stdout:e,stderr:r}=w;if(e?.columns&&e?.rows)return C(e.columns,e.rows);if(r?.columns&&r?.rows)return C(r.columns,r.rows);if(t.COLUMNS&&t.LINES)return C(t.COLUMNS,t.LINES);const s={columns:K,rows:J};return w.platform==="win32"?j()??s:w.platform==="darwin"?q()??j()??s:q()??j()??Bt()??s}const q=()=>{try{const t=w.platform==="darwin"?W.constants.O_EVTONLY|W.constants.O_NONBLOCK:W.constants.O_NONBLOCK,{columns:e,rows:r}=it.WriteStream(W.openSync("/dev/tty",t));return{columns:e,rows:r}}catch{}},j=()=>{try{const t=P("tput",["cols"],{env:{TERM:"dumb",...w.env}}),e=P("tput",["lines"],{env:{TERM:"dumb",...w.env}});if(t&&e)return X(t,e)}catch{}},Bt=()=>{try{if(!Ft())return;const t=P("resize",["-u"]).match(/\d+/g);if(t.length===2)return X(t[0],t[1])}catch{}},I=new Map,zt=500,h=t=>{if(!t||t==="")return"";const e=I.get(t);if(e!==void 0)return e;let r;try{r=at(Object.assign([],{raw:[t]}))}catch{r=t}if(I.size>=zt){const s=I.keys().next().value;s!==void 0&&I.delete(s)}return I.set(t,r),r},R=()=>{const e=lt().CEREBRO_TERMINAL_WIDTH;if(e===void 0)return;const r=Number.parseInt(e,10);if(!(Number.isNaN(r)||r<=0))return r};class Z{lines;constructor(){this.lines=[]}add(e){this.lines.push(e)}toString(){return this.lines.join(ct.EOL)}header(e){this.add(M(e)),this.lines.push("")}}const Dt=t=>t!==void 0&&t>0?t:Pt().columns,qt=(t,e,r,s)=>{if(t.length===0||t.some(u=>u.length!==2))return;let i=0;for(const u of t){const y=u[0];if(y===void 0)continue;const N=jt(y);N>i&&(i=N)}if(i===0)return;const c=r+s,n=i+c,l=20+c;if(n+l>e)return;const a=e-n;return[n,a]};class Ht extends Z{constructor(e){if(super(),e.header&&this.header(h(e.header)),e.content){if(e.raw)if(Array.isArray(e.content)&&e.content.every(r=>typeof r=="string"))e.content.forEach(r=>{Array.isArray(r)?r.forEach(s=>{this.add(h(s))}):this.add(h(r))});else if(typeof e.content=="string")this.add(h(e.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(e.content));this.add("")}}getContentLines(e){if(typeof e=="string"){const r=A({showHeader:!1,style:{border:$,paddingLeft:4,paddingRight:1},terminalWidth:R(),truncateOverflow:!1,wordWrap:!0});return r.addRow([h(e)]),r.toString()}if(Array.isArray(e)&&e.every(r=>typeof r=="string"||Array.isArray(r)&&r.every(s=>typeof s=="string"))){const i=Dt(R()),c=a=>Array.isArray(a)?a.map(u=>h(u)):[h(a)],n=e.map(a=>c(a)),o=qt(n,i,4,1),l=A({columnWidths:o,showHeader:!1,style:{border:$,paddingLeft:4,paddingRight:1},terminalWidth:i,truncateOverflow:!1,wordWrap:!0});return n.forEach(a=>{o!==void 0&&a.length===2?l.addRow([{content:a[0],wordWrap:!1},a[1]]):l.addRow(a)}),l.toString()}if(typeof e=="object"){const r=e;if(!r.options||!r.data)throw new Error(`Must have an "options" or "data" property
2
- ${JSON.stringify(e)}`);const s=A({showHeader:!1,style:{border:$,paddingLeft:4,paddingRight:1},terminalWidth:R(),truncateOverflow:!1,wordWrap:!0});return r.data.forEach(i=>{Array.isArray(i)?s.addRow(i.map(c=>h(c))):s.addRow([h(i)])}),s.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
3
-
4
- ${JSON.stringify(e)}`)}}class Ut extends Z{constructor(e){super();let r=e.optionList??[];const s=Array.isArray(e.hide)?e.hide:[e.hide].filter(n=>typeof n=="string"),i=Array.isArray(e.group)?e.group:[e.group].filter(n=>typeof n=="string");s.length>0&&(r=r.filter(n=>!s.includes(n.name))),e.header&&this.header(h(e.header)),i.length>0&&(r=r.filter(n=>{const o=n,l=i.includes("_none")&&!o.group,a=o.group,u=this.intersect(Array.isArray(a)?a:[a],i);return l||u?n:void 0}));const c=A({showHeader:!1,style:{border:$,paddingLeft:2,paddingRight:1,...e.tableOptions?.style},terminalWidth:R()??e.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:e.tableOptions?.wordWrap??!0,...e.tableOptions});r.forEach(n=>{const o=n;c.addRow([this.getOptionNames(o,e.reverseNameOrder??!1,e.isArgument??!1),h(o.description)])}),this.add(c.toString()),this.lines.push("")}getOptionNames(e,r,s){if(!e.name)throw new TypeError("Invalid option definition, name is required.");const i=e.type?e.type.name.toLowerCase():"string",{lazyMultiple:c}=e,n=e.multiple||c?"[]":"",o=e.typeLabel===void 0?ut(`${i}${n}`):h(e.typeLabel),l=s?M(e.name):M.yellow(`--${e.name}`),a=e.alias;if(a){const u=M(`-${a}`);return r?`${l}, ${u} ${o}`:`${u}, ${l} ${o}`}return`${l} ${o}`}intersect(e,r){return e.some(s=>r.includes(s))}}const Qt=t=>(Array.isArray(t)?t:[t]).length===0?"":`
5
- ${t.map(r=>r.optionList?new Ut(r).toString():new Ht(r).toString()).join(`
6
- `)}`,H=(t,e)=>{const s=`${e==="readme"?t.name.toUpperCase():t.name}${t.multiple===!0?"...":""}`;return t.required===!0?e==="readme"?s:`<${s}>`:`[${s}]`},te=(t,e="help")=>t.argument?t.argument.hidden?"":e==="readme"?` ${H(t.argument,e)}`:" [positional arguments]":!t.arguments||t.arguments.length===0?"":t.arguments.filter(r=>!r.hidden).map(r=>` ${H(r,e)}`).join("");export{Qt as c,te as f,h as t};
@@ -1 +0,0 @@
1
- const o=e=>"Deno"in e,t=e=>"Bun"in e,i=()=>{if(o(globalThis)){const e=globalThis.Deno,n=e.execPath();let s=n;try{const{importMeta:r}=globalThis;r?.url&&(s=r.url)}catch{}return[n,s,...e.args]}return process.argv},c=()=>o(globalThis)?globalThis.Deno.cwd():process.cwd(),a=()=>{if(o(globalThis)){const e=globalThis.Deno;return new Proxy(e.env.toObject(),{get:(n,s)=>typeof s=="string"?e.env.get(s):n[s],has:(n,s)=>typeof s=="string"?e.env.has(s):s in n,set:(n,s,r)=>typeof s=="string"?(r===void 0||e.env.set(s,r),!0):!1})}return process.env},l=()=>o(globalThis)?[]:process.execArgv,g=()=>o(globalThis)?globalThis.Deno.execPath():process.execPath,u=()=>{if(o(globalThis)){const n=globalThis.Deno.build?.os??"unknown";return n==="windows"?"win32":n}return process.platform},h=()=>{if(o(globalThis)){const n=globalThis.Deno.build?.arch??"unknown";return n==="x86_64"?"x64":n==="aarch64"?"arm64":n}return process.arch},f=()=>{if(o(globalThis)){const e=globalThis.Deno,n={};return e.version?.deno&&(n.deno=e.version.deno),e.version?.v8&&(n.v8=e.version.v8),e.version?.typescript&&(n.typescript=e.version.typescript),n}if(t(globalThis)){const e=globalThis.Bun,n={...process.versions};return e.version&&(n.bun=e.version),n}return process.versions},b=(e=0)=>{if(o(globalThis))throw globalThis.Deno.exit(e),new Error("Deno exit failed");process.exit(e)},d=(e,n)=>{if(o(globalThis))return()=>{};const s=process;return s.on(e,n),()=>{s.removeListener(e,n)}};export{u as a,h as b,a as c,i as d,b as e,c as f,f as g,g as h,l as i,d as o};