@visulima/cerebro 3.0.0-alpha.30 → 3.0.0-alpha.31
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 +13 -0
- package/dist/commands/completion-command.js +5 -5
- package/dist/commands/help-command.js +1 -1
- package/dist/commands/readme-command.js +17 -17
- package/dist/commands/version-command.js +1 -1
- package/dist/index.js +1 -1
- package/dist/logger/create-pail-logger.js +1 -1
- package/dist/packem_chunks/has-new-version.js +1 -1
- package/dist/packem_shared/Cerebro-ChUYLbTK.js +4 -0
- package/dist/packem_shared/VisulimaError-CVxSPzeQ.js +76 -0
- package/dist/packem_shared/cerebro-error-etNTKvnJ.js +1 -0
- package/dist/packem_shared/constants-CImsldtV-Ces7vzH9.js +1 -0
- package/dist/packem_shared/index-B5zrpT20.js +6 -0
- package/dist/packem_shared/isVisulimaError-jVZgumOU-C67qeq6-.js +1 -0
- package/dist/packem_shared/lazyNamed-DMUm8mZe.js +1 -0
- package/dist/packem_shared/renderError-DJiY-69l-s_7rEsoy.js +25 -0
- package/dist/packem_shared/runtime-process-hJz7FqPN.js +1 -0
- package/dist/plugins/error-handler-plugin.js +1 -1
- package/dist/plugins/runtime-version-check-plugin.js +1 -1
- package/dist/plugins/update-notifier/update-notifier-plugin.js +1 -1
- package/dist/util/general/compile-cache.js +1 -1
- package/dist/util/general/heap-tuning.js +1 -1
- package/package.json +3 -3
- package/dist/packem_shared/Cerebro-BN_nIZ8z.js +0 -4
- package/dist/packem_shared/VisulimaError-WfDZ45Qv.js +0 -76
- package/dist/packem_shared/cerebro-error-BnJTixb2.js +0 -1
- package/dist/packem_shared/constants-DmzZF6_u-BmMwILI_.js +0 -1
- package/dist/packem_shared/index-CkkDAMKi.js +0 -6
- package/dist/packem_shared/isVisulimaError-jVZgumOU-C4fgdbWg.js +0 -1
- package/dist/packem_shared/lazyNamed-DOmefeJM.js +0 -1
- package/dist/packem_shared/renderError-DxgI44AK-DFDWFoCr.js +0 -24
- package/dist/packem_shared/runtime-process-DKHFvYkv.js +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{createRequire as X}from"node:module";import{m as N,y as O,n as L}from"./constants-CImsldtV-Ces7vzH9.js";import{createTable as E}from"@visulima/tabular";import{NO_BORDER as v}from"@visulima/tabular/style";import r1 from"@visulima/colorize/template";import{d as t1}from"./runtime-process-hJz7FqPN.js";import{bold as s1}from"@visulima/colorize";const Z=X(import.meta.url),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,R=e=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[i,r]=b.versions.node.split(".").map(Number);if(i>22||i===22&&r>=3||i===20&&r>=16)return b.getBuiltinModule(e)}return Z(e)},m=b,{execFileSync:e1}=R("node:child_process"),W=R("node:fs"),i1=R("node:tty"),n1=R("node:os"),o1=[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],a1=12288,l1=65510,d1=[12288,12288,65281,65376,65504,65510],u1=8361,c1=65518,h1=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],f1=32,w1=10630,m1=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],p1=4352,g1=262141,V=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],$=(e,i)=>{let r=0,t=Math.floor(e.length/2)-1;for(;r<=t;){const s=Math.floor((r+t)/2),a=s*2;if(i<e[a])t=s-1;else if(i>e[a+1])r=s+1;else return!0}return!1},q=19968,[b1,y1]=N1(V);function N1(e){let i=e[0],r=e[1];for(let t=0;t<e.length;t+=2){const s=e[t],a=e[t+1];if(q>=s&&q<=a)return[s,a];a-s>r-i&&(i=s,r=a)}return[i,r]}const I1=e=>e<161||e>1114109?!1:$(o1,e),W1=e=>e<a1||e>l1?!1:$(d1,e),$1=e=>e<u1||e>c1?!1:$(h1,e),O1=e=>e<f1||e>w1?!1:$(m1,e),x1=e=>e>=b1&&e<=y1?!0:e<p1||e>g1?!1:$(V,e);function E1(e){return I1(e)?"ambiguous":W1(e)?"fullwidth":$1(e)?"halfwidth":O1(e)?"narrow":x1(e)?"wide":"neutral"}function v1(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function Y(e){return v1(e),E1(e)}const z=new Map,x=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,A=e=>e>=32&&e<=126?"latin":e===8203||e===8204||e===8205||e===8288?"zero":e<=31||e>=127&&e<=159?"control":e>=160&&e<=255||e>=9472&&e<=9599?"latin":e>=4352&&e<=4607||e>=11904&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519&&!(e>=65377&&e<=65439)||e>=12352&&e<=12543?"wide":e===8230?"latin":"other",A1=(e,i)=>{const r=Math.floor(e/65536),t=e%65536;let s=z.get(r);if(s||(s=new Map,z.set(r,s)),s.has(t))return s.get(t);let a;if(A(e)==="latin")a=i.width.regular;else if(A(e)==="control")a=i.width.control;else if(A(e)==="wide")a=i.width.wide;else switch(Y(e)){case"ambiguous":{a=i.width.ambiguousIsNarrow?i.width.regular:i.width.wide;break}case"fullwidth":{a=i.width.fullWidth;break}case"wide":{a=i.width.wide;break}default:a=i.width.regular}return s.set(t,a),a},M1=e=>e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=917760&&e<=917999||e>=65024&&e<=65039||e>=3633&&e<=3642||e>=3655&&e<=3662||e>=3761&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2500||e>=2509&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2637||e>=1611&&e<=1631||e>=1648&&e<=1648||e>=1750&&e<=1773||e>=2276&&e<=2302||e>=1425&&e<=1469||e>=1471&&e<=1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e>=1479&&e<=1479||e>=3893&&e<=3893||e>=3895&&e<=3895||e>=3897&&e<=3897||e>=3953&&e<=3966||e>=3968&&e<=3972||e>=3974&&e<=3975?!0:e>=768&&e<=777||e>=803&&e<=803,C=(e,i={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const r={truncation:{countAnsiEscapeCodes:i.countAnsiEscapeCodes??!1,ellipsis:i.ellipsis??"",ellipsisWidth:i.ellipsisWidth??(i.ellipsis?C(i.ellipsis,{...i,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:i.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:i.ambiguousIsNarrow??!1,ansi:i.ansiWidth??0,control:i.controlWidth??0,emoji:i.emojiWidth??2,fullWidth:i.fullWidth??2,halfWidth:i.halfWidth??1,regular:i.regularWidth??1,tab:i.tabWidth??8,wide:i.wideWidth??2}},t=Math.max(0,r.truncation.limit-r.truncation.ellipsisWidth),{length:s}=e,a=s>1e4;let n=0,o=0,l=s,d=!1;const p=e.includes("\x1B")||e.includes("");for(;n<s;){if(p&&(e[n]==="\x1B"||e[n]==="")){if(e.startsWith("\x1B]8;;",n)){const h="\x1B]8;;\x07",w=h.length,S=e.indexOf("\x07",n+5);if(S!==-1){const k=e.indexOf(h,S+1);if(k!==-1){const G=k+w,Q=e.slice(S+1,k).replace(N,""),P=C(Q,{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,t-o),regularWidth:r.width.regular,tabWidth:r.width.tab,wideWidth:r.width.wide}),j=P.width;if(P.truncated)d=!0,l=Math.min(l,n);else if(o+j>t&&(l=Math.min(l,n),d=!0,o+j>r.truncation.limit))break;if(o+=j,n=G,d&&o>=r.truncation.limit)break;continue}}}if(N.lastIndex=n,N.test(e)){const h=N.lastIndex-n,w=r.truncation.countAnsiEscapeCodes?h:r.width.ansi;if(o+w>t&&(l=Math.min(l,n),o+w>r.truncation.limit)){d=!0;break}o+=w,n=N.lastIndex;continue}}const f=e.codePointAt(n);if(f===8203||f===65279||f>=8288&&f<=8292){n+=1;continue}if(f===9){if(o+r.width.tab>t&&(l=Math.min(l,n),o+r.width.tab>r.truncation.limit)){d=!0;break}o+=r.width.tab,n+=1;continue}if(x.lastIndex=n,x.test(e)){const h=(x.lastIndex-n)*r.width.regular;if(o+h>t){const w=Math.floor((t-o)/r.width.regular);if(l=Math.min(l,n+w),o+h>r.truncation.limit){d=!0;break}}o+=h,n=x.lastIndex;continue}if((f<=31||f>=127&&f<=159)&&(O.lastIndex=n,O.test(e))){const h=(O.lastIndex-n)*r.width.control;if(o+h>t&&(l=Math.min(l,n+Math.floor((t-o)/r.width.control)),o+h>r.truncation.limit)){d=!0;break}o+=h,n=O.lastIndex;continue}if(L.lastIndex=n,L.test(e)){if(o+r.width.emoji>t&&(l=Math.min(l,n),o+r.width.emoji>r.truncation.limit)){d=!0;break}o+=r.width.emoji,n=L.lastIndex;continue}const g=e.codePointAt(n)??0;if(M1(g)){n+=g>65535?2:1;continue}let c;if(a)c=A1(g,r);else switch(A(g)){case"control":{c=r.width.control;break}case"latin":{c=r.width.regular;break}case"wide":{c=r.width.wide;break}case"zero":{c=0;break}default:switch(Y(g)){case"ambiguous":{c=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{c=r.width.fullWidth;break}case"wide":{c=r.width.wide;break}default:c=r.width.regular}}if(o+c>t&&(l=Math.min(l,n),o+c>r.truncation.limit)){d=!0;break}o+=c,n+=g>65535?2:1}let y=o,F=!1;return d&&r.truncation.limit>=r.truncation.ellipsisWidth&&(y=r.truncation.limit,F=!0),{ellipsed:F,index:d?l:s,truncated:d,width:y}},_1=(e,i={})=>C(e,{...i,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,D=80,J=24,B=(e,i,{shell:r,env:t}={})=>e1(e,i,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:r,env:t}).trim(),M=(e,i)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(i,10)}),K=(e,i)=>{const{columns:r,rows:t}=M(e,i);if(!(Number.isNaN(r)||Number.isNaN(t))&&!(r===D&&t===J))return{columns:r,rows:t}},R1=()=>{if(m.platform!=="linux")return!0;try{const e=W.readFileSync("/proc/self/stat","utf8"),i=e.lastIndexOf(") ");if(i===-1)return!1;const r=e.slice(i+2).trim().split(/\s+/),t=Number.parseInt(r[2],10),s=Number.parseInt(r[5],10);return Number.isNaN(t)||Number.isNaN(s)||s<=0?!1:t===s}catch{return!1}};function S1(){const{env:e,stdout:i,stderr:r}=m;if(i?.columns&&i?.rows)return M(i.columns,i.rows);if(r?.columns&&r?.rows)return M(r.columns,r.rows);if(e.COLUMNS&&e.LINES)return M(e.COLUMNS,e.LINES);const t={columns:D,rows:J};return m.platform==="win32"?T()??t:m.platform==="darwin"?H()??T()??t:H()??T()??k1()??t}const H=()=>{try{const e=m.platform==="darwin"?W.constants.O_EVTONLY|W.constants.O_NONBLOCK:W.constants.O_NONBLOCK,{columns:i,rows:r}=i1.WriteStream(W.openSync("/dev/tty",e));return{columns:i,rows:r}}catch{}},T=()=>{try{const e=B("tput",["cols"],{env:{TERM:"dumb",...m.env}}),i=B("tput",["lines"],{env:{TERM:"dumb",...m.env}});if(e&&i)return K(e,i)}catch{}},k1=()=>{try{if(!R1())return;const e=B("resize",["-u"]).match(/\d+/g);if(e.length===2)return K(e[0],e[1])}catch{}},I=new Map,j1=500,u=e=>{if(!e||e==="")return"";const i=I.get(e);if(i!==void 0)return i;const r=r1(Object.assign([],{raw:[e]}));if(I.size>=j1){const t=I.keys().next().value;t!==void 0&&I.delete(t)}return I.set(e,r),r},_=()=>{const e=t1().CEREBRO_TERMINAL_WIDTH;if(e===void 0)return;const i=Number.parseInt(e,10);if(!(Number.isNaN(i)||i<=0))return i};let U=class{lines;constructor(){this.lines=[]}add(i){this.lines.push(i)}toString(){return this.lines.join(n1.EOL)}header(i){this.add(s1(i)),this.lines.push("")}};const L1=e=>e!==void 0&&e>0?e:S1().columns,T1=(e,i,r,t)=>{if(e.length===0||e.some(d=>d.length!==2))return;let s=0;for(const d of e){const p=d[0];if(p===void 0)continue;const y=_1(p);y>s&&(s=y)}if(s===0)return;const a=r+t,n=s+a,o=20+a;if(n+o>i)return;const l=i-n;return[n,l]};class C1 extends U{constructor(i){if(super(),i.header&&this.header(u(i.header)),i.content){if(i.raw)if(Array.isArray(i.content)&&i.content.every(r=>typeof r=="string"))i.content.forEach(r=>{Array.isArray(r)?r.forEach(t=>{this.add(u(t))}):this.add(u(r))});else if(typeof i.content=="string")this.add(u(i.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(i.content));this.add("")}}getContentLines(i){if(typeof i=="string"){const r=E({showHeader:!1,style:{border:v,paddingLeft:4,paddingRight:1},terminalWidth:_(),truncateOverflow:!1,wordWrap:!0});return r.addRow([u(i)]),r.toString()}if(Array.isArray(i)&&i.every(r=>typeof r=="string"||Array.isArray(r)&&r.every(t=>typeof t=="string"))){const r=L1(_()),t=o=>Array.isArray(o)?o.map(l=>u(l)):[u(o)],s=i.map(o=>t(o)),a=T1(s,r,4,1),n=E({columnWidths:a,showHeader:!1,style:{border:v,paddingLeft:4,paddingRight:1},terminalWidth:r,truncateOverflow:!1,wordWrap:!0});return s.forEach(o=>{a!==void 0&&o.length===2?n.addRow([{content:o[0],wordWrap:!1},o[1]]):n.addRow(o)}),n.toString()}if(typeof i=="object"){const r=i;if(!r.options||!r.data)throw new Error(`Must have an "options" or "data" property
|
|
2
|
+
${JSON.stringify(i)}`);const t=E({showHeader:!1,style:{border:v,paddingLeft:4,paddingRight:1},terminalWidth:_(),truncateOverflow:!1,wordWrap:!0});return r.data.forEach(s=>{Array.isArray(s)?t.addRow(s.map(a=>u(a))):t.addRow([u(s)])}),t.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
|
|
3
|
+
|
|
4
|
+
${JSON.stringify(i)}`)}}class B1 extends U{constructor(i){super();let r=i.optionList??[];const t=Array.isArray(i.hide)?i.hide:[i.hide].filter(n=>typeof n=="string"),s=Array.isArray(i.group)?i.group:[i.group].filter(n=>typeof n=="string");t.length>0&&(r=r.filter(n=>!t.includes(n.name))),i.header&&this.header(u(i.header)),s.length>0&&(r=r.filter(n=>{const o=n,l=s.includes("_none")&&!o.group,d=o.group,p=this.intersect(Array.isArray(d)?d:[d],s);return l||p?n:void 0}));const a=E({showHeader:!1,style:{border:v,paddingLeft:2,paddingRight:1,...i.tableOptions?.style},terminalWidth:_()??i.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:i.tableOptions?.wordWrap??!0,...i.tableOptions});r.forEach(n=>{const o=n;a.addRow([this.getOptionNames(o,i.reverseNameOrder??!1,i.isArgument??!1),u(o.description)])}),this.add(a.toString()),this.lines.push("")}getOptionNames(i,r,t){if(!i.name)throw new TypeError("Invalid option definition, name is required.");let s=i.type?i.type.name.toLowerCase():"string";const a=i.multiple||i.lazyMultiple?"[]":"";s=u(i.typeLabel??`{underline ${s}${a}}`);let n;if(i.alias)if(i.name){const o=t?i.name:`{yellow --${i.name}}`;n=u(r?`{bold ${o}}, {bold -${i.alias}} ${s}`:`{bold -${i.alias}}, {bold ${o}} ${s}`)}else r?n=u(`{bold -${i.alias}} ${s}`):n=u(`{bold -${i.alias}} ${s}`);else n=u(`{bold ${t?i.name:`{yellow --${i.name}}`}} ${s}`);return n}intersect(i,r){return i.some(t=>r.includes(t))}}const J1=e=>(Array.isArray(e)?e:[e]).length===0?"":`
|
|
5
|
+
${e.map(i=>i.optionList?new B1(i).toString():new C1(i).toString()).join(`
|
|
6
|
+
`)}`;export{u as a,J1 as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var l=Object.defineProperty,s=(e,t)=>l(e,"name",{value:t,configurable:!0}),u=Object.defineProperty,i=s((e,t)=>u(e,"name",{value:t,configurable:!0}),"t");const m=i(e=>e instanceof Error&&e.type==="VisulimaError","isVisulimaError");class E extends Error{static{s(this,"VisulimaError")}static{i(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:t,hint:r,location:a,message:o,name:c,stack:n,title:h}){super(o,{cause:t}),this.title=h,this.name=c,this.stack=n??this.stack,this.loc=a,this.hint=r}setLocation(t){this.loc=t}setName(t){this.name=t}setMessage(t){this.message=t}setHint(t){this.hint=t}}export{E,m as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=(a,t)=>async()=>({default:(await a())[t]});export{e as lazyNamed};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import{createRequire as K}from"node:module";const Y=K(import.meta.url),S=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Q=r=>{if(typeof S<"u"&&S.versions&&S.versions.node){const[e,t]=S.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return S.getBuiltinModule(r)}return Y(r)},{createRequire:X}=Q("node:module");var Z=Object.defineProperty,L=(r,e)=>Z(r,"name",{value:e,configurable:!0}),ee=Object.defineProperty,re=L((r,e)=>ee(r,"name",{value:e,configurable:!0}),"r$1");const te=re(r=>r.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
2
|
+
`),"normalizeLF"),ie=globalThis.process??Object.create(null),M={versions:{}},C=new Proxy(ie,{get(r,e){if(e in r)return r[e];if(e in M)return M[e]}});var ne=Object.defineProperty,oe=L((r,e)=>ne(r,"name",{value:e,configurable:!0}),"b");const se=oe((r,e,t,i)=>{const s={column:0,line:-1,...r.start},n={...s,...r.end},o=s.line,d=s.column,a=n.line,c=n.column;let l=Math.max(o-(t+1),0),p=Math.min(e.length,a+i);o===-1&&(l=0),a===-1&&(p=e.length);const g=a-o,m={};if(g)for(let u=0;u<=g;u++){const $=u+o;if(!d)m[$]=!0;else if(u===0){const h=e[$-1]?.length;m[$]=[d,(h??0)-d+1]}else if(u===g)m[$]=[0,c];else{const h=e[$-u]?.length;m[$]=[0,h]}}else d===c?m[o]=d?[d,0]:!0:m[o]=[d,(c??0)-(d??0)];return{end:p,markerLines:m,start:l}},"getMarkerLines");var ae=Object.defineProperty,k=L((r,e)=>ae(r,"name",{value:e,configurable:!0}),"t");const le=C.platform==="win32"&&!C.env?.WT_SESSION?">":"❯",ce=k((r,e,t)=>{const i={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...t,color:{gutter:k(u=>u,"gutter"),marker:k(u=>u,"marker"),message:k(u=>u,"message"),...t?.color}},s=typeof e.start.column=="number";let n=te(r).split(`
|
|
3
|
+
`);typeof i.tabWidth=="number"&&(n=n.map(u=>u.replaceAll(" "," ".repeat(i.tabWidth))));const{end:o,markerLines:d,start:a}=se(e,n,i.linesAbove,i.linesBelow),c=String(o).length,{gutter:l,marker:p,message:g}=i.color;let m=n.slice(a,o).map((u,$)=>{const h=a+1+$,N=d[h],z=String(h).padStart(c),D=!d[h+1],E=` ${z}${i.showGutter?" |":""}`;if(N){let j="";if(Array.isArray(N)){const U=u.replaceAll(/[^\t]/g," ").slice(0,Math.max(N[0]-1,0)),H=N[1]||1;j=[`
|
|
4
|
+
`,i.prefix+l(E.replaceAll(/\d/g," "))," ",U,p("^").repeat(H)].join(""),D&&i.message&&(j+=` ${g(i.message)}`)}return[i.prefix+p(le),l(E),u.length>0?` ${u}`:"",j].join("")}return`${i.prefix} ${l(E)}${u.length>0?` ${u}`:""}`}).join(`
|
|
5
|
+
`);return i.message&&!s&&(m=`${i.prefix+" ".repeat(c+1)+i.message}
|
|
6
|
+
${m}`),m},"codeFrame");var de=Object.defineProperty,ue=(r,e)=>de(r,"name",{value:e,configurable:!0}),fe=Object.defineProperty,v=ue((r,e)=>fe(r,"name",{value:e,configurable:!0}),"u");const b=v((r,...e)=>{process.env.DEBUG&&process.env.DEBUG==="true"&&console.debug(`error:parse-stacktrace: ${r}`,...e)},"debugLog"),y="<unknown>",me=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,pe=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,ve=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,ge=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,$e=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,he=/in\s(.*)\s\(at\s(.+)\)\sat/,be=/^(?:.*@)?(.*):(\d+):(\d+)$/,ye=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,xe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,we=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,P=/\(error: (.*)\)/,Se=/at\s/,Ne=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,ke=/\S*(?:Error: |AggregateError:)/,_=/^Anonymous function$/,Ee=/^\s*in\s.*/,je=/^.*?\s*at\s.*/,Le=/^.*?\s*@.*|\[native code\]/,T=v((r,e)=>{const t=r.includes("safari-extension"),i=r.includes("safari-web-extension");return t||i?[r.includes("@")?r.split("@")[0]:y,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[r,e]},"extractSafariExtensionDetails"),B=v((r,e)=>{const t=ve.exec(e);t&&(r.file=t[1],r.line=+t[2],r.column=+t[3])},"parseMapped"),Ae=v(r=>{const e=he.exec(r);if(e){b(`parse nested node error stack line: "${r}"`,`found: ${JSON.stringify(e)}`);const i=e[2].split(":");return{column:i[2]?+i[2]:void 0,file:i[0],line:i[1]?+i[1]:void 0,methodName:e[1]??y,raw:r,type:void 0}}const t=$e.exec(r);if(t){b(`parse node error stack line: "${r}"`,`found: ${JSON.stringify(t)}`);const i={column:t[4]?+t[4]:void 0,file:t[2]?t[2].replace(Se,""):void 0,line:t[3]?+t[3]:void 0,methodName:t[1]??y,raw:r,type:r.startsWith("internal")?"internal":void 0};return B(i,`${t[2]}:${t[3]}:${t[4]}`),i}},"parseNode"),Oe=v(r=>{const e=me.exec(r);if(e){b(`parse chrome error stack line: "${r}"`,`found: ${JSON.stringify(e)}`);const t=e[2]?.startsWith("native"),i=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let s,n;if(i){const c=pe.exec(r);if(c){const l=Ne.exec(c[1]);l?(e[2]=l[4]??l[1],e[3]=l[5]??l[2],e[4]=l[3]):c[2]&&(e[2]=c[1]),c[2]&&(s={column:c[4]?+c[4]:void 0,file:c[2],line:c[3]?+c[3]:void 0,methodName:"eval",raw:r,type:"eval"})}else{const l=ge.exec(r);l&&(n={column:l[4]?+l[4]:void 0,file:l[2],line:l[3]?+l[3]:void 0},s={column:l[6]?+l[6]:void 0,file:l[1],line:l[5]?+l[5]:void 0,methodName:"eval",raw:l[0],type:"eval"})}}const[o,d]=T(e[1]?e[1].replace(_,"<anonymous>"):y,e[2]),a={column:e[4]?+e[4]:void 0,evalOrigin:s,file:d,line:e[3]?+e[3]:void 0,methodName:o,raw:r,type:i?"eval":t?"native":void 0};return n?(a.column=n.column,a.file=n.file,a.line=n.line):B(a,`${d}:${e[3]}:${e[4]}`),a}},"parseChromium"),Me=v((r,e)=>{const t=ye.exec(r);if(t){b(`parse gecko error stack line: "${r}"`,`found: ${JSON.stringify(t)}`);const i=t[3]?.includes(" > eval"),s=i&&t[3]&&xe.exec(t[3]);let n;i&&s&&(t[3]=s[1],n={column:t[5]?+t[5]:void 0,file:t[3],line:t[4]?+t[4]:void 0,methodName:"eval",raw:r,type:"eval"},t[4]=s[2]);const[o,d]=T(t[1]?t[1].replace(_,"<anonymous>"):y,t[3]);let a;(e?.type==="safari"||!i&&e?.type==="firefox")&&e.column?a=e.column:!i&&t[5]&&(a=+t[5]);let c;return(e?.type==="safari"||!i&&e?.type==="firefox")&&e.line?c=e.line:t[4]&&(c=+t[4]),{column:a,evalOrigin:n,file:d,line:c,methodName:o,raw:r,type:i?"eval":d.includes("[native code]")?"native":void 0}}},"parseGecko"),Ce=v((r,e)=>{const t=we.exec(r);if(!(t&&t[2].includes(" > eval"))&&t)return b(`parse firefox error stack line: "${r}"`,`found: ${JSON.stringify(t)}`),{column:t[4]?+t[4]:e?.column??void 0,file:t[2],line:t[3]?+t[3]:e?.line??void 0,methodName:t[1]||y,raw:r,type:void 0}},"parseFirefox"),Pe=v(r=>{const e=be.exec(r);if(e)return b(`parse react android native error stack line: "${r}"`,`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:y,raw:r,type:void 0}},"parseReactAndroidNative"),W=v((r,{filter:e,frameLimit:t=50}={})=>{const i=r;let s=(typeof i.stacktrace=="string"?i.stacktrace:r.stack??"").split(`
|
|
7
|
+
`).map(n=>(P.test(n)?n.replace(P,"$1"):n).trim()).filter(n=>!ke.test(n)&&n!=="eval code");return e&&(s=s.filter(n=>e(n))),s=s.slice(0,t),s.reduce((n,o,d)=>{if(!o||o.length>1024)return n;let a;if(Ee.test(o))a=Ae(o);else if(je.test(o))a=Oe(o);else if(Le.test(o)){let c;if(d===0){const l=r,p=l.columnNumber,g=l.lineNumber,m=l.line,u=l.column;p||g?c={column:p,line:g,type:"firefox"}:(m||u)&&(c={column:u,line:m,type:"safari"})}a=Ce(o,c)??Me(o,c)}else a=Pe(o);return a?n.push(a):b(`parse error stack line: "${o}"`,"not parser found"),n},[])},"parseStacktrace");var _e=Object.defineProperty,V=(r,e)=>_e(r,"name",{value:e,configurable:!0});const Te=X(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,A=V(r=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[e,t]=w.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return w.getBuiltinModule(r)}return Te(r)},"__cjs_getBuiltinModule"),{existsSync:Be,readFileSync:We}=A("node:fs"),{relative:Ve}=A("node:path"),{cwd:Re}=w,{fileURLToPath:Ge}=A("node:url");var Ie=Object.defineProperty,f=V((r,e)=>Ie(r,"name",{value:e,configurable:!0}),"o");const x=f((r,e,t)=>t===0?r:e===" "?r+" ".repeat(t):r+" ".repeat(e*t),"getPrefix"),Fe=f((r,e)=>{const t=r.replace("async file:","file:");return Ve(e,t.startsWith("file:")?Ge(t):t)},"getRelativePath"),Je=f((r,e,t)=>{if(e)return t.title(r.message);const i=r.message?`: ${r.message}`:"";return t.title(r.name+i)},"getTitleText"),R=f((r,{color:e,hideErrorTitle:t,indentation:i,prefix:s},n)=>`${x(s,i,n)}${Je(r,t,e)}
|
|
8
|
+
`,"getMessage"),G=f((r,{color:e,indentation:t,prefix:i},s)=>{if(r.hint===void 0)return;const n=x(i,t,s);let o="";if(Array.isArray(r.hint))for(const d of r.hint)o+=`${n+d}
|
|
9
|
+
`;else o+=n+r.hint;return e.hint(o)},"getHint"),O=f((r,{color:e,cwd:t,displayShortPath:i,indentation:s,prefix:n},o=0)=>{const d=i?Fe(r.file,t):r.file,{fileLine:a,method:c}=e;return`${x(n,s,o)}at ${r.methodName?`${c(r.methodName)} `:""}${a(d)}:${a(r.line?.toString()??"")}`},"getMainFrame"),I=f((r,{color:e,indentation:t,linesAbove:i,linesBelow:s,prefix:n,showGutter:o,showLineNumbers:d,tabWidth:a},c)=>{if(r.file===void 0)return;const l=r.file.replace("file://","");if(!Be(l))return;const p=We(l,"utf8");return ce(p,{start:{column:r.column,line:r.line}},{color:e,linesAbove:i,linesBelow:s,prefix:x(n,t,c),showGutter:o,showLineNumbers:d,tabWidth:a})},"getCode"),F=f((r,e,t)=>{if(r.errors.length===0)return;let i=`${x(e.prefix,e.indentation,t)}Errors:
|
|
10
|
+
|
|
11
|
+
`,s=!0;for(const n of r.errors)s?s=!1:i+=`
|
|
12
|
+
|
|
13
|
+
`,i+=q(n,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},t+1);return`
|
|
14
|
+
${i}`},"getErrors"),J=f((r,e,t,i=new Set)=>{i.add(r);let s=`${x(e.prefix,e.indentation,t)}Caused by:
|
|
15
|
+
|
|
16
|
+
`;const n=r.cause;s+=R(n,e,t);const o=W(n).shift(),d=G(n,e,t);if(d&&(s+=`${d}
|
|
17
|
+
`),o&&(s+=O(o,e,t),!e.hideErrorCauseCodeView)){const a=I(o,e,t);a!==void 0&&(s+=`
|
|
18
|
+
${a}`)}if(n instanceof AggregateError){const a=F(n,e,t);a!==void 0&&(s+=`
|
|
19
|
+
${a}`)}return n.cause&&(i.has(n)?s+=`
|
|
20
|
+
${x(e.prefix,e.indentation,t+1)}Caused by: [Circular]`:s+=`
|
|
21
|
+
${J(n,e,t+1,i)}`),`
|
|
22
|
+
${s}`},"getCause"),qe=f((r,e)=>(r.length>0?`
|
|
23
|
+
`:"")+r.map(t=>O(t,e)).join(`
|
|
24
|
+
`),"getStacktrace"),q=f((r,e,t)=>{const i={cwd:Re(),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:f(o=>o,"fileLine"),gutter:f(o=>o,"gutter"),hint:f(o=>o,"hint"),marker:f(o=>o,"marker"),message:f(o=>o,"message"),method:f(o=>o,"method"),title:f(o=>o,"title"),...e.color}},s=W(r,{filter:e.filterStacktrace,frameLimit:i.framesMaxLimit}),n=s.shift();return[e.hideMessage?void 0:R(r,i,t),G(r,i,t),n?O(n,i,t):void 0,n&&!i.hideErrorCodeView?I(n,i,t):void 0,r instanceof AggregateError?F(r,i,t):void 0,r.cause===void 0?void 0:J(r,i,t),s.length>0?qe(s,i):void 0].filter(Boolean).join(`
|
|
25
|
+
`).replaceAll("\\","/")},"internalRenderError"),De=f((r,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return q(r,e,0)},"renderError");export{ce as C,le as O,W as V,De as _};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=s=>"Deno"in s,l=s=>"Bun"in s,i=()=>{if(n(globalThis)){const s=globalThis.Deno,e=s.execPath();let o=e;try{const{importMeta:r}=globalThis;r?.url&&(o=r.url)}catch{}return[e,o,...s.args]}return l(globalThis)?globalThis.Bun.process.argv:process.argv},t=()=>n(globalThis)?globalThis.Deno.cwd():l(globalThis)?globalThis.Bun.process.cwd():process.cwd(),a=()=>{if(n(globalThis)){const s=globalThis.Deno;return new Proxy(s.env.toObject(),{get:(e,o)=>typeof o=="string"?s.env.get(o):e[o],has:(e,o)=>typeof o=="string"?s.env.has(o):o in e,set:(e,o,r)=>typeof o=="string"?(r===void 0||s.env.set(o,r),!0):!1})}return l(globalThis)?globalThis.Bun.process.env:process.env},c=()=>n(globalThis)?[]:l(globalThis)?globalThis.Bun.process.execArgv:process.execArgv,g=()=>n(globalThis)?globalThis.Deno.execPath():l(globalThis)?globalThis.Bun.process.execPath:process.execPath,h=()=>{if(n(globalThis)){const s=globalThis.Deno.build?.os??"unknown";return s==="windows"?"win32":s}return l(globalThis)?globalThis.Bun.platform??"unknown":process.platform},b=()=>{if(n(globalThis)){const s=globalThis.Deno.build?.arch??"unknown";return s==="x86_64"?"x64":s==="aarch64"?"arm64":s}return l(globalThis)?globalThis.Bun.process.arch:process.arch},T=()=>{if(n(globalThis)){const s=globalThis.Deno,e={};return s.version?.deno&&(e.deno=s.version.deno),s.version?.v8&&(e.v8=s.version.v8),s.version?.typescript&&(e.typescript=s.version.typescript),e}if(l(globalThis)){const s=globalThis.Bun,e={...s.process.versions};return s.version&&(e.bun=s.version),e}return process.versions},u=(s=0)=>{if(n(globalThis))throw globalThis.Deno.exit(s),new Error("Deno exit failed");if(l(globalThis))throw globalThis.Bun.process.exit(s),new Error("Bun exit failed");process.exit(s)},p=(s,e)=>{if(n(globalThis))return()=>{};if(l(globalThis)){try{const r=globalThis.Bun;if(r.process?.on)return r.process.on(s,e),()=>{r.process?.removeListener&&r.process.removeListener(s,e)}}catch{}return()=>{}}const o=process;return o.on(s,e),()=>{o.removeListener(s,e)}};export{T as a,h as b,b as c,a as d,u as e,i as f,t as g,g as h,c as i,p as o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{_ as g}from"../packem_shared/renderError-DJiY-69l-s_7rEsoy.js";import{e as m}from"../packem_shared/runtime-process-hJz7FqPN.js";const E=(i={})=>({description:"Enhanced error handling and reporting with beautiful code frames",name:"error-handler",onError:(e,n)=>{const{logger:r,runtime:s}=n,{detailed:t=!1,exitOnError:l=!0,formatter:o,logErrors:a=!0,renderOptions:d={}}=i;if(a)if(o)r.error(o(e));else if(t){const f=s.getCwd(),c=g(e,{cwd:f,hideErrorCodeView:!1,hideErrorTitle:!1,hideMessage:!1,linesAbove:2,linesBelow:3,...d});r.error(c)}else r.error(e);l&&m(1)},version:"1.0.0"});export{E as errorHandlerPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{d as p,e as c,a as v}from"../packem_shared/runtime-process-hJz7FqPN.js";const i=r=>{if(!r||typeof r!="string")return 0;const o=r.split(".");if(o.length===0||!o[0])return 0;const e=Number.parseInt(o[0],10);return Number.isNaN(e)?0:e},a=r=>!r||typeof r!="string"?"":r.replace("v",""),d=()=>{if(typeof Bun<"u"){const e=Bun.version||"";return{major:i(e),type:"bun",version:e}}if(typeof Deno<"u"){const e=Deno.version?.deno||"";return{major:i(e),type:"deno",version:e}}const r=v().node??"",o=a(r);return{major:i(o),type:"node",version:o}},g=(r={})=>({description:"Checks if the current runtime version meets the minimum requirement",init:o=>{const e=d(),m={bun:1,deno:1,node:18};let n;try{const s=p().CEREBRO_MIN_NODE_VERSION,u=s===void 0?void 0:Number.parseInt(s,10);n=Number.isNaN(u)?void 0:u}catch{n=void 0}let t;r.runtimes?.[e.type]?.minVersion!==void 0?t=r.runtimes[e.type].minVersion:e.type==="node"&&n!==void 0?t=n:t=m[e.type],e.major<t&&(o.logger.error(`cerebro requires ${e.type} version ${String(t)} or higher. You have ${e.type} ${e.version}. Read our version support policy: https://github.com/visulima/visulima#supported-runtimes`),c(1)),o.logger.debug(`Runtime version check passed: ${e.type} ${e.version} >= ${String(t)}`)},name:"runtime-version-check",version:"1.0.0"});export{g as runtimeVersionCheckPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{d as S}from"../../packem_shared/runtime-process-hJz7FqPN.js";var R={},c,i;function p(){return i||(i=1,c=[{name:"Agola CI",constant:"AGOLA",env:"AGOLA_GIT_REF",pr:"AGOLA_PULL_REQUEST_ID"},{name:"Alpic",constant:"ALPIC",env:"ALPIC_HOST"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE",pr:{env:"AC_GIT_PR",ne:"false"}},{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN",pr:{env:"CODEBUILD_WEBHOOK_EVENT",any:["PULL_REQUEST_CREATED","PULL_REQUEST_UPDATED","PULL_REQUEST_REOPENED"]}},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"TF_BUILD",pr:{BUILD_REASON:"PullRequest"}},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"Cloudflare Pages",constant:"CLOUDFLARE_PAGES",env:"CF_PAGES"},{name:"Cloudflare Workers",constant:"CLOUDFLARE_WORKERS",env:"WORKERS_CI"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codemagic",constant:"CODEMAGIC",env:"CM_BUILD_ID",pr:"CM_PULL_REQUEST"},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"Earthly",constant:"EARTHLY",env:"EARTHLY_CI"},{name:"Expo Application Services",constant:"EAS",env:"EAS_BUILD"},{name:"Gerrit",constant:"GERRIT",env:"GERRIT_PROJECT"},{name:"Gitea Actions",constant:"GITEA_ACTIONS",env:"GITEA_ACTIONS"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"Google Cloud Build",constant:"GOOGLE_CLOUD_BUILD",env:"BUILDER_OUTPUT"},{name:"Harness CI",constant:"HARNESS",env:"HARNESS_BUILD_ID"},{name:"Heroku",constant:"HEROKU",env:{env:"NODE",includes:"/app/.heroku/node/bin/node"}},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Prow",constant:"PROW",env:"PROW_JOB_ID"},{name:"ReleaseHub",constant:"RELEASEHUB",env:"RELEASE_BUILD_ID"},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Sourcehut",constant:"SOURCEHUT",env:{CI_NAME:"sourcehut"}},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vela",constant:"VELA",env:"VELA",pr:{VELA_PULL_REQUEST:"1"}},{name:"Vercel",constant:"VERCEL",env:{any:["NOW_BUILDER","VERCEL"]},pr:"VERCEL_GIT_PULL_REQUEST_ID"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"},{name:"Woodpecker",constant:"WOODPECKER",env:{CI:"woodpecker"},pr:{CI_BUILD_EVENT:"pull_request"}},{name:"Xcode Cloud",constant:"XCODE_CLOUD",env:"CI_XCODE_PROJECT",pr:"CI_PULL_REQUEST_NUMBER"},{name:"Xcode Server",constant:"XCODE_SERVER",env:"XCS"}]),c}var C;function A(){return C||(C=1,(function(t){const E=p(),e=process.env;Object.defineProperty(t,"_vendors",{value:E.map(function(n){return n.constant})}),t.name=null,t.isPR=null,t.id=null,e.CI!=="false"&&E.forEach(function(n){const a=(Array.isArray(n.env)?n.env:[n.env]).every(function(I){return r(I)});t[n.constant]=a,a&&(t.name=n.name,t.isPR=o(n),t.id=n.constant)}),t.isCI=!!(e.CI!=="false"&&(e.BUILD_ID||e.BUILD_NUMBER||e.CI||e.CI_APP_ID||e.CI_BUILD_ID||e.CI_BUILD_NUMBER||e.CI_NAME||e.CONTINUOUS_INTEGRATION||e.RUN_ID||t.name));function r(n){return typeof n=="string"?!!e[n]:"env"in n?e[n.env]&&e[n.env].includes(n.includes):"any"in n?n.any.some(function(a){return!!e[a]}):Object.keys(n).every(function(a){return e[a]===n[a]})}function o(n){switch(typeof n.pr){case"string":return!!e[n.pr];case"object":return"env"in n.pr?"any"in n.pr?n.pr.any.some(function(a){return e[n.pr.env]===a}):n.pr.env in e&&e[n.pr.env]!==n.pr.ne:"any"in n.pr?n.pr.any.some(function(a){return!!e[a]}):r(n.pr);default:return null}}})(R)),R}var m=A();const P=(t={})=>({beforeCommand:async E=>{const{logger:e,runtime:r}=E,o=r.getPackageName(),n=r.getPackageVersion();if(!o||!n){e.debug("Update notifier: package name or version not provided, skipping...");return}const a=S(),I={alwaysRun:!1,debug:a.CEREBRO_OUTPUT_LEVEL==="256",distTag:"latest",pkg:{name:o,version:n},updateCheckInterval:1e3*60*60*24,...t};if(!(I.alwaysRun||!(a.NO_UPDATE_NOTIFIER||a.NODE_ENV==="test"||E.argv.includes("--no-update-notifier")||m.isCI))){e.debug("Update notifier: skipping check (disabled by environment or flags)");return}(e.raw??e.log)("Checking for updates...");try{const _=await(await import("../../packem_chunks/has-new-version.js").then(s=>s.default))(I);if(_){const[{boxen:s},{dim:U,green:L,reset:v,yellow:T}]=await Promise.all([import("@visulima/boxen"),import("@visulima/colorize")]),u=`Update available ${U(n)}${v(" → ")}${L(_)}`;e.error(s(u,{borderColor:D=>T(D),borderStyle:"round",margin:1,padding:1,textAlignment:"center"}))}}catch(_){e.debug("Update notifier: failed to check for updates",_)}},description:"Checks for package updates and notifies users",name:"update-notifier",version:"1.0.0"});export{P as updateNotifierPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const t=()=>{try{const e=require("node:module");if(typeof e.enableCompileCache=="function"){e.enableCompileCache();return}}catch{}try{require("v8-compile-cache")}catch{}};export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{createRequire as g}from"node:module";import{f as x,h as y,d as b,e as d,i as j}from"../../packem_shared/runtime-process-hJz7FqPN.js";const h=g(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=e=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[o,s]=t.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return t.getBuiltinModule(e)}return h(e)},{execFileSync:_}=u("node:child_process"),{totalmem:v}=u("node:os"),M=/--max-old-space-size=(\d+)/,z=/--max-semi-space-size=(\d+)/,E=e=>Math.floor(v()/1024/1024*e),P=e=>e<=512?4:e<=1024?8:e<=2048?16:e<=4096?32:e<=8192?64:Math.floor(Math.log2(e))*8,l=(e,o)=>{for(const s of o){const i=e.exec(s);if(i)return Number.parseInt(i[1],10)}},q=e=>{const o=e?.maxOldSpacePercent??.75,s=[...j()],i=[...x()],n=l(M,s),c=l(z,s);if(n!==void 0&&c!==void 0)return;const a=n??E(o),f=c??P(a),r=[];if(n===void 0&&r.push(`--max-old-space-size=${String(a)}`),c===void 0&&r.push(`--max-semi-space-size=${String(f)}`),r.length!==0)try{_(y(),[...r,...s,...i.slice(1)],{env:b(),stdio:"inherit"}),d(0)}catch(m){const p=m.status;d(typeof p=="number"?p:1)}};export{q as applyHeapTuning};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/cerebro",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.31",
|
|
4
4
|
"description": "A delightful toolkit for building cross-runtime CLIs for Node.js, Deno, and Bun.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ansi",
|
|
@@ -115,9 +115,9 @@
|
|
|
115
115
|
},
|
|
116
116
|
"peerDependencies": {
|
|
117
117
|
"@bomb.sh/tab": "0.0.15",
|
|
118
|
-
"@visulima/boxen": "3.0.0-alpha.
|
|
118
|
+
"@visulima/boxen": "3.0.0-alpha.13",
|
|
119
119
|
"@visulima/find-cache-dir": "3.0.0-alpha.11",
|
|
120
|
-
"@visulima/pail": "4.0.0-alpha.
|
|
120
|
+
"@visulima/pail": "4.0.0-alpha.21",
|
|
121
121
|
"github-slugger": "2.0.0"
|
|
122
122
|
},
|
|
123
123
|
"peerDependenciesMeta": {
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
var St=Object.defineProperty;var $=(t,e)=>St(t,"name",{value:e,configurable:!0});import{createRequire as Dt}from"node:module";import{VERBOSITY_DEBUG as H,POSITIONALS_KEY as se,VERBOSITY_QUIET as Gt,VERBOSITY_VERBOSE as Kt,VERBOSITY_NORMAL as je}from"./VERBOSITY_QUIET-XPultrIA.js";import{c as P}from"./cerebro-error-BnJTixb2.js";import{d as z,h as ke,e as Y,o as Ue,b as Ht,c as Yt,a as Jt,i as Qt,f as Xt}from"./runtime-process-DKHFvYkv.js";import{p as ue}from"./isVisulimaError-jVZgumOU-C4fgdbWg.js";import{distance as Zt}from"fastest-levenshtein";import{s as en,L as tn,M as ne,E as W,P as G,N as I,C as ye,D as Te,W as nn,U as Me,Q as on,_ as Se,J as De,T as Ve,z as an,K as rn,q as sn,I as ln,V as cn,u as un,r as pn,Y as fn,p as dn,n as hn,Z as mn,i as gn,a as vn,A as wn,X as yn,e as bn,t as Be}from"./constants-DmzZF6_u-BmMwILI_.js";const Vt=Dt(import.meta.url),ee=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,it=$(t=>{if(typeof ee<"u"&&ee.versions&&ee.versions.node){const[e,n]=ee.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return ee.getBuiltinModule(t)}return Vt(t)},"__cjs_getBuiltinModule"),{writeFile:Bt,stat:Rt,rm:zt,readFile:Ie,readdir:Wt,mkdir:Ft,access:qt}=it("node:fs/promises"),{createRequire:$n}=it("node:module"),ae=[{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}];var On=Object.defineProperty,An=$((t,e)=>On(t,"name",{value:e,configurable:!0}),"t$9");let V=class extends P{static{$(this,"a")}static{An(this,"CommandNotFoundError")}commandName;constructor(e,n=[]){const i=`Command "${e}" not found${n.length>0?`. Did you mean: ${n.join(", ")}?`:""}`;super(i,"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(", ")}`)}};var Pn=Object.defineProperty,Cn=$((t,e)=>Pn(t,"name",{value:e,configurable:!0}),"e$7");let at=class extends P{static{$(this,"o")}static{Cn(this,"ConflictingOptionsError")}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}`}};var Nn=Object.defineProperty,_n=$((t,e)=>Nn(t,"name",{value:e,configurable:!0}),"e$6");let kn=class extends P{static{$(this,"o")}static{_n(this,"PluginError")}pluginName;constructor(e,n,i){super(`Plugin "${e}" error: ${n}`,"PLUGIN_ERROR",{originalError:i,pluginName:e}),this.name="PluginError",this.pluginName=e,i&&(this.cause=i)}};var En=Object.defineProperty,Re=$((t,e)=>En(t,"name",{value:e,configurable:!0}),"d$6");let xn=class{static{$(this,"p")}static{Re(this,"PluginManager")}logger;plugins=new Map;initialized=!1;cachedDependencyOrder=void 0;constructor(e){this.logger=e}hasPlugins(){return this.plugins.size>0}register(e){if(this.initialized)throw new Error(`Cannot register plugin "${e.name}" after initialization`);if(this.plugins.has(e.name))throw new Error(`Plugin "${e.name}" is already registered`);z().CEREBRO_OUTPUT_LEVEL===String(H)&&this.logger.debug(`registering plugin: ${e.name}`),this.plugins.set(e.name,e),this.cachedDependencyOrder=void 0}async init(e){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 n=this.getDependencyOrder();this.logger.debug(`initializing ${String(n.length)} plugin(s)...`);for(const i of n)if(typeof i.init=="function"){this.logger.debug(`initializing plugin: ${i.name}`);try{await i.init(e)}catch(r){const o=new kn(i.name,`Failed to initialize: ${r instanceof Error?r.message:String(r)}`,r instanceof Error?r:void 0);throw this.logger.error(o.message),o}}this.initialized=!0}async executeLifecycle(e,n,i){if(!this.initialized)throw new Error("PluginManager not initialized");if(this.plugins.size===0)return;const r=this.getDependencyOrder();for(const o of r){const c=o[e];if(typeof c=="function"){this.logger.debug(`executing ${e} hook for plugin: ${o.name}`);try{await(e==="afterCommand"?c(n,i):c(n))}catch(s){throw this.logger.error(`Error in ${e} hook for plugin "${o.name}":`,s),s}}}}async executeErrorHandlers(e,n){if(!this.initialized||this.plugins.size===0)return;const i=this.getDependencyOrder();for(const r of i)if(typeof r.onError=="function"){this.logger.debug(`executing error handler for plugin: ${r.name}`);try{await r.onError(e,n)}catch(o){this.logger.error(`Error in error handler for plugin "${r.name}":`,o)}}}getDependencyOrder(){if(this.cachedDependencyOrder!==void 0)return this.cachedDependencyOrder;const e=[],n=new Set,i=new Set,r=Re(o=>{if(n.has(o))return;if(i.has(o))throw new Error(`Circular dependency detected involving plugin "${o}"`);const c=this.plugins.get(o);if(!c)throw new Error(`Plugin "${o}" not found`);if(i.add(o),c.dependencies)for(const s of c.dependencies)r(s);i.delete(o),n.add(o),e.push(c)},"visit");for(const o of this.plugins.keys())r(o);return this.cachedDependencyOrder=e,e}validateDependencies(){for(const e of this.plugins.values())if(e.dependencies){for(const n of e.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin "${e.name}" depends on "${n}" which is not registered`)}}};var Ln=Object.defineProperty,In=$((t,e)=>Ln(t,"name",{value:e,configurable:!0}),"n$b");const oe=In(t=>t.type?.name==="Boolean","optionIsBoolean");var jn=Object.defineProperty,rt=$((t,e)=>jn(t,"name",{value:e,configurable:!0}),"p$6");const Un=rt(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},"getTypeLabel"),ze=rt(t=>(oe(t)||(t.typeLabel=t.typeLabel??Un(t),t.defaultOption&&(t.typeLabel=`${t.typeLabel} (D)`),t.required&&(t.typeLabel=`${t.typeLabel} (R)`)),t),"mapOptionTypeLabel");var Tn=Object.defineProperty,st=$((t,e)=>Tn(t,"name",{value:e,configurable:!0}),"e$4");const Mn=new RegExp(/^-([^\d-])$/),Sn=new RegExp(/^--(\S+)/),Dn=new RegExp(/^-([^\d-]{2,})$/),Vn=st(t=>Mn.test(t)||Sn.test(t)||Dn.test(t),"isOption"),Bn=st((t,e)=>{const n=e[0]&&Vn(e[0])||e.length===0?null:e.shift()??null;if(!t.includes(n)){const i=new Error(`Command not recognised: ${String(n)}`);throw i.command=n,i.name="INVALID_COMMAND",i}return{argv:e,command:n}},"commandLineCommands");var Rn=Object.defineProperty,lt=$((t,e)=>Rn(t,"name",{value:e,configurable:!0}),"o$b"),zn=Object.defineProperty,ct=lt((t,e)=>zn(t,"name",{value:e,configurable:!0}),"o"),Wn=Object.defineProperty,Fn=ct((t,e)=>Wn(t,"name",{value:e,configurable:!0}),"i");let qn=class ut extends ue{static{$(this,"a")}static{lt(this,"r")}static{ct(this,"t")}static{Fn(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,ut.prototype)}};var Gn=Object.defineProperty,pt=$((t,e)=>Gn(t,"name",{value:e,configurable:!0}),"t$7"),Kn=Object.defineProperty,ft=pt((t,e)=>Kn(t,"name",{value:e,configurable:!0}),"e"),Hn=Object.defineProperty,Yn=ft((t,e)=>Hn(t,"name",{value:e,configurable:!0}),"e");let We=class dt extends ue{static{$(this,"n")}static{pt(this,"n")}static{ft(this,"o")}static{Yn(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,dt.prototype)}};var Jn=Object.defineProperty,ht=$((t,e)=>Jn(t,"name",{value:e,configurable:!0}),"a$9"),Qn=Object.defineProperty,mt=ht((t,e)=>Qn(t,"name",{value:e,configurable:!0}),"a"),Xn=Object.defineProperty,Zn=mt((t,e)=>Xn(t,"name",{value:e,configurable:!0}),"o");let eo=class gt extends ue{static{$(this,"o")}static{ht(this,"r")}static{mt(this,"e")}static{Zn(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,gt.prototype)}};var to=Object.defineProperty,vt=$((t,e)=>to(t,"name",{value:e,configurable:!0}),"i$8"),no=Object.defineProperty,wt=vt((t,e)=>no(t,"name",{value:e,configurable:!0}),"i"),oo=Object.defineProperty,io=wt((t,e)=>oo(t,"name",{value:e,configurable:!0}),"i");let j=class yt extends ue{static{$(this,"a")}static{vt(this,"o")}static{wt(this,"e")}static{io(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,yt.prototype)}};var ao=Object.defineProperty,ro=$((t,e)=>ao(t,"name",{value:e,configurable:!0}),"E$3"),so=Object.defineProperty,Q=ro((t,e)=>so(t,"name",{value:e,configurable:!0}),"C"),lo=Object.defineProperty,pe=Q((t,e)=>lo(t,"name",{value:e,configurable:!0}),"o");const Fe=pe(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),qe=pe(t=>t===Number||typeof t=="function"&&t.name==="Number","isNumberType"),Ge=pe(t=>t===String||typeof t=="function"&&t.name==="String","isStringType"),co=pe((t,e)=>Array.isArray(t)?Fe(e)?t.map(Boolean):qe(e)?t.map(Number):Ge(e)?t.map(String):t.map(n=>e(String(n))):t===null?null:Fe(e)?!!t:qe(e)?Number(t):Ge(e)?typeof t=="string"?t:String(t):e(typeof t=="string"?t:String(t)),"convertValue");var uo=Object.defineProperty,po=Q((t,e)=>uo(t,"name",{value:e,configurable:!0}),"e");const x=po((t,e,n,...i)=>{t&&console.debug(`[command-line-args:${n}] ${e}`,...i)},"debug");var fo=Object.defineProperty,q=Q((t,e)=>fo(t,"name",{value:e,configurable:!0}),"x$2");const ho=/-([a-z])/g,mo=/^\d+$/,be=q(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),go=q(t=>t.codePointAt(0)===95,"isSpecialKey"),Ke=q((t,e)=>Array.isArray(t)?[...t,...e]:[t,...e],"appendToArrayMultiple"),He=q(t=>t==="__proto__"||t==="constructor"||t==="prototype","isUnsafeKey"),Ye=q((t,e,n,i=!1)=>{t[e]===void 0?t[e]=i?[n]:n:i&&Array.isArray(t[e])?t[e].push(n):t[e]=[t[e],n]},"createOrAppendArray"),vo=q((t,e,n,i,r)=>{let o=e.get(t)??n.get(t);if(!o&&i){const c=t.toLowerCase();o=i.get(c)??r?.get(c)}return o},"getDefinition"),wo=q((t,e,n,i)=>{const r=n.debug??!1;x(r,"resolveArgs called with options:","resolver",{partial:n.partial,stopAtFirstUnknown:n.stopAtFirstUnknown}),x(r,"Starting argument resolution","resolver"),x(r,"Tokens:","resolver",t),x(r,"Definitions:","resolver",e),x(r,"Processing tokens...","resolver");const o=new Map,c=new Map,s=n.caseInsensitive?new Map:void 0,g=n.caseInsensitive?new Map:void 0,a=n.camelCase?new Map:void 0,u=n.camelCase?new Map:void 0;for(const p of e)if(o.set(p.name,p),p.alias&&c.set(p.alias,p),n.caseInsensitive&&s&&(s.set(p.name.toLowerCase(),p),p.alias&&g&&g.set(p.alias.toLowerCase(),p)),n.camelCase&&a&&u){const m=p.name.replaceAll(ho,(v,O)=>O.toUpperCase());a.set(p.name,m),u.set(m,p.name)}const d={},l={},h=[],f=[],y=new Set;let b=!1;const w=e.find(p=>p.defaultOption),C=e.some(p=>p.group),N=e.some(p=>p.type===Number);for(let p=0;p<t.length;p++){const m=t[p];if(m.kind==="option-terminator"){d._unknown=i.slice(m.index),b=!0;break}if(m.kind==="option"&&m.name){let v=vo(m.name,o,c,s,g);if(!v&&m.value===void 0&&N&&mo.test(m.name)){const _=e.find(M=>M.type===Number);_&&(v=_,m.value=m.name,m.name=_.name)}const O=v?v.name:m.name,A=v?.multiple,U=v?.lazyMultiple;if(l[O]!==void 0&&!A&&!U&&!n.partial)throw new qn(O);if(!v&&n.partial){const _=m.rawName??`--${m.name}${m.value!==void 0&&m.inlineValue?`=${m.value}`:""}`;h.push({index:m.index,value:_});continue}if(!v&&n.stopAtFirstUnknown){d._unknown=i.slice(m.index);break}if(!v&&!n.partial)throw new We(m.name);if(m.value===void 0){const _=t[p+1],M=_?.kind==="option"&&!("name"in _)&&_.value!==void 0,L=_&&v&&!(v.type&&be(v.type))&&(_.kind==="positional"||M),Mt=v&&v.defaultOption&&!v.multiple&&!v.lazyMultiple;if(L&&(!v?.defaultOption||Mt))if(A){let S=p+1;const we=[];for(;S<t.length&&(t[S].kind==="positional"||t[S].kind==="option"&&!("name"in t[S])&&t[S].value!==void 0);)we.push(t[S].value),y.add(t[S].index),S++;l[O]=l[O]===void 0?we:Ke(l[O],we),p=S-1}else U?(Ye(l,O,_.value,!0),y.add(_.index),p++):(l[O]=_.value,y.add(_.index),p++);else v?.type&&be(v.type)?Ye(l,O,!0,A):l[O]=A?[]:null}else{let{value:_}=m;if(v?.type&&be(v.type))switch(_){case"":{if(n.partial){l._unknown??=[];const L=`${m.rawName??`--${m.name}`}${m.value?`=${m.value}`:""}`;l._unknown.push(L),f.push({index:m.index,value:L}),_=!0}else throw new We(m.name);break}case"false":{_=!1;break}case"true":{_=!0;break}default:_=!0}const M=[_];if(A){let L=p+1;for(;L<t.length&&t[L].kind==="positional";)M.push(t[L].value),y.add(t[L].index),L++;p=L-1}l[O]===void 0?l[O]=A||U?M:_:A||U?l[O]=Ke(l[O],M):l[O]=_}}else if(m.kind==="positional"&&n.stopAtFirstUnknown&&!y.has(m.index)&&!w){x(r,`Found unconsumed positional token at index ${String(m.index)}, stopping processing`,"resolver"),d._unknown=i.slice(m.index);break}}for(const[p,m]of Object.entries(l)){const v=o.get(p);v&&(v.multiple||v.lazyMultiple)&&!Array.isArray(m)&&(l[p]=[m])}let E=Number.POSITIVE_INFINITY;if(n.stopAtFirstUnknown&&!b){for(const p of t)if(p.kind==="option"&&!o.has(p.name??"")&&!c.has(p.name??"")&&(!n.caseInsensitive||!s?.has(p.name?.toLowerCase()??"")&&!g?.has(p.name?.toLowerCase()??""))){E=p.index;break}}if(w){const p=[],m=[];for(const v of t)v.kind==="positional"&&!y.has(v.index)&&v.index<E&&(p.push(v.value),m.push(v));if(p.length>0){const v=l[w.name],O=w.multiple??w.lazyMultiple;v===void 0?O?(m.forEach(A=>y.add(A.index)),l[w.name]=p):(y.add(m[0].index),l[w.name]=p[0]):O&&(m.forEach(A=>y.add(A.index)),l[w.name]=Array.isArray(v)?[...p,...v]:[...p,v])}}if(!n.partial){for(const p of t)if(p.kind==="positional"&&!y.has(p.index))throw new eo(i[p.index])}if(n.partial&&!n.stopAtFirstUnknown){const p=[...h];if(l._unknown)for(const m of f)p.push({index:m.index,value:m.value});for(const m of t)m.kind==="positional"&&!y.has(m.index)&&p.push({index:m.index,value:i[m.index]});p.length>0&&(p.sort((m,v)=>m.index-v.index),d._unknown=p.map(m=>m.value))}if(n.stopAtFirstUnknown&&!b){const p=t.findIndex(O=>O.kind==="option"&&!o.has(O.name??"")&&!c.has(O.name??"")&&(!n.caseInsensitive||!s?.has(O.name?.toLowerCase()??"")&&!g?.has(O.name?.toLowerCase()??""))),m=t.findIndex(O=>O.kind==="positional"&&!y.has(O.index));let v=-1;if(p!==-1&&m!==-1?v=Math.min(p,m):p!==-1?v=p:m!==-1&&(v=m),v>=0){const O=t[v].index;d._unknown=i.slice(O)}}else h.length>0&&!n.partial&&(d._unknown=h.map(p=>p.value));for(const[p,m]of Object.entries(l)){const v=n.camelCase?a?.get(p)??p:p,O=o.get(p);d[v]=O?.type?co(m,O.type):m===void 0?null:m}for(const p of e){const m=n.camelCase?a?.get(p.name)??p.name:p.name;!(m in d)&&p.defaultValue!==void 0&&(p.multiple??p.lazyMultiple?d[m]=Array.isArray(p.defaultValue)?[...p.defaultValue]:[p.defaultValue]:d[m]=p.defaultValue)}if(C){const p={},m={},v={};for(const A of e)if(A.group){const U=Array.isArray(A.group)?A.group:[A.group];for(const _ of U)He(_)||(p[_]??={})}for(const A of Object.keys(d))if(!go(A)){m[A]=d[A];let U=A;n.camelCase&&(U=u?.get(A)??A);const _=o.get(U);if(_?.group){const M=Array.isArray(_.group)?_.group:[_.group];for(const L of M)He(L)||p[L]&&(p[L][A]=d[A])}else v[A]=d[A]}const O={_all:m};for(const[A,U]of Object.entries(p))O[A]=U;Object.keys(v).length>0&&(O._none=v),d._unknown&&(O._unknown=d._unknown),Object.keys(d).forEach(A=>delete d[A]),Object.assign(d,O)}return x(r,"Final parsed result:","resolver",d),d},"resolveArgs");var yo=Object.defineProperty,X=Q((t,e)=>yo(t,"name",{value:e,configurable:!0}),"l");const J="-".codePointAt(0),F="=",bo=F.codePointAt(0),$o="--",Oo="-",Ao="--",bt=X(t=>t.length>2&&t.startsWith(Ao),"hasLongOptionPrefix"),Po=X(t=>bt(t)&&!t.includes(F,3),"isLongOption"),Co=X(t=>bt(t)&&t.includes(F,3),"isLongOptionAndValue"),No=X(t=>{if(t.length!==2||t.codePointAt(0)!==J||t.codePointAt(1)===J)return!1;const e=t.codePointAt(1);return e!==void 0&&(e<48||e>57)},"isShortOption"),_o=X(t=>!(t.length<=2||t.codePointAt(0)!==J||t.codePointAt(1)===J),"isShortOptionGroup"),ko=X(t=>{const e=[],n=[...t];let i=-1,r=0;for(;n.length>0;){const o=n.shift();if(o===void 0)break;if(r>0?r--:i++,o===$o){e.push({index:i,kind:"option-terminator"});const c=n.map((s,g)=>({index:i+g+1,kind:"positional",value:s}));e.push(...c),i+=n.length;break}if(No(o)){const c=o.charAt(1);e.push({index:i,kind:"option",name:c,rawName:o});continue}if(_o(o)&&!o.includes(F)){const c=[];let s="",g=!1;for(let a=1;a<o.length;a++){const u=o.charAt(a);g?s+=u:u.codePointAt(0)===bo?g=!0:c.push(`${Oo}${u}`)}if(g)if(c.length>0){const a=c.pop();c.push(`${a}=${s}`)}else c.push(s);n.unshift(...c),r=c.length;continue}if(Po(o)){const c=o.slice(2);e.push({index:i,kind:"option",name:c,rawName:o});continue}if(Co(o)){const c=o.indexOf(F),s=o.slice(2,c),g=o.slice(c+1);e.push({index:i,inlineValue:!0,kind:"option",name:s,rawName:o,value:g});continue}if(o.length>2&&o.codePointAt(0)===J&&o.codePointAt(1)!==J&&o.includes(F)){const c=o.indexOf(F),s=o.charAt(1),g=o.slice(c+1);e.push({index:i,inlineValue:!0,kind:"option",name:s,rawName:o,value:g});continue}e.push({index:i,kind:"positional",value:o})}return e},"parseArgsTokens");var Eo=Object.defineProperty,xe=Q((t,e)=>Eo(t,"name",{value:e,configurable:!0}),"d");const xo=/\d/,Lo=xe(t=>t===Boolean||typeof t=="function"&&t.name==="Boolean","isBooleanType"),Io=xe(t=>typeof t=="function","isValidCustomTypeFunction"),jo=xe((t,e,n)=>{const i=n?.debug??!1;x(i,"Validating definitions:","validation",t,"caseInsensitive:",e);const r=new Set,o=new Set,c=new Set,s=new Set;let g=0;for(const a of t){if(x(i,"Checking definition:","validation",a),!a.name)throw x(i,"Validation failed: name is required","validation"),new j("Invalid option definition: name is required");if(typeof a.name!="string")throw new j("Invalid option definition: name must be a string");if(a.name.trim()==="")throw new j("Invalid option definition: name cannot be empty");const u=e?a.name.toLowerCase():"";if(r.has(a.name)||e&&c.has(u))throw new j(`Invalid option definition: duplicate name '${a.name}'`);if(o.has(a.name)||e&&s.has(u))throw new j(`Invalid option definition: name '${a.name}' conflicts with an existing alias`);if(r.add(a.name),e&&c.add(u),a.alias!==void 0){if(typeof a.alias!="string")throw new j("Invalid option definition: alias must be a string");if(a.alias.length!==1)throw new j("Invalid option definition: alias must be a single character");if(xo.test(a.alias))throw new j("Invalid option definition: alias cannot be numeric");if(a.alias==="-")throw new j('Invalid option definition: alias cannot be "-"');const d=e?a.alias.toLowerCase():"";if(o.has(a.alias)||e&&s.has(d))throw new j(`Invalid option definition: duplicate alias '${a.alias}'`);if(r.has(a.alias)||e&&c.has(d))throw new j(`Invalid option definition: alias '${a.alias}' conflicts with an existing option name`);o.add(a.alias),e&&s.add(d)}if(a.defaultOption&&(g++,a.type!==void 0&&Lo(a.type)))throw new j("Invalid option definition: defaultOption cannot be Boolean type");if(a.type!==void 0&&!(a.type===Boolean||a.type===Number||a.type===String||typeof a.type=="function"&&Io(a.type)))throw new j("Invalid option definition: invalid type")}if(g>1)throw x(i,"Validation failed: multiple defaultOptions not allowed","validation"),new j("Invalid option definition: multiple defaultOptions not allowed");x(i,"Validation completed successfully","validation")},"validateDefinitions");var Uo=Object.defineProperty,To=Q((t,e)=>Uo(t,"name",{value:e,configurable:!0}),"O");const Mo=To((t,e={})=>{const n=e.debug??!1;x(n,"Starting command-line-args parsing","index"),x(n,"Options:","index",e);const i={...e};i.stopAtFirstUnknown&&(i.partial=!0);const r=Array.isArray(t)?t:[t];x(n,"Normalized definitions:","index",r),jo(r,i.caseInsensitive,n?i:void 0);let{argv:o}=i;if(!o&&(o=process.argv.slice(2),process.execArgv.length>0)){const a=new Set(process.execArgv);o=o.filter(u=>!a.has(u))}x(n,"Using argv:","index",o);let c=o;i.caseInsensitive&&(c=o.map(a=>{if(a.startsWith("--")){const u=a.indexOf("="),d=(u===-1?a.slice(2):a.slice(2,u)).toLowerCase();return u===-1?`--${d}`:`--${d}${a.slice(u)}`}if(a.startsWith("-")&&!a.startsWith("--")&&a.length>1){const u=a.slice(1).split("=",2),d=u[0],l=u[1];if(!d)return a;const h=d.toLowerCase();return l===void 0?`-${h}`:`-${h}=${l}`}return a}));const s=ko(c.map(String));x(n,"Tokenized arguments:","index",s);const g=wo(s,r,i,o);return x(n,"Command-line-args parsing completed","index"),g},"commandLineArgs");var So=Object.defineProperty,Do=$((t,e)=>So(t,"name",{value:e,configurable:!0}),"b$2");let Vo=class{static{$(this,"m")}static{Do(this,"EmptyToolbox")}result;argv;options;argument;command;commandName;env;logger;console;fs;process;runtime;rawUnknown;constructor(e,n){this.commandName=e,this.command=n}};var Bo=Object.defineProperty,Ro=$((t,e)=>Bo(t,"name",{value:e,configurable:!0}),"n$7");let $e=class extends P{static{$(this,"i")}static{Ro(this,"CommandLoaderError")}commandName;constructor(e,n,i){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.",i!==void 0&&(this.cause=i)}};var zo=Object.defineProperty,Wo=$((t,e)=>zo(t,"name",{value:e,configurable:!0}),"f$5");const Fo=/^-{1,2}(\w+)(=(.+))?$/,$t=Wo((t,e,n,i)=>{const r=Fo.exec(t);if(r===null)return{};const o=r[1];if(!o)return{};const c=n&&i?n.get(o)??i.get(o):e.find(s=>s.name===o||s.alias===o);return c!==void 0?{argName:c.name,argValue:r[3],option:c}:{}},"getParameterOption");var qo=Object.defineProperty,Ee=$((t,e)=>qo(t,"name",{value:e,configurable:!0}),"e$3");const Je=Ee((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)},"convertType"),Go=new Set(["0","1","false","true"]),Ko=Ee((t,e,n,i)=>{if(e.length===0||t.length===0)return{};const r=Ee((o,c)=>{const{argName:s,argValue:g,option:a}=$t(c,e,n,i),{lastOption:u}=o;return a&&oe(a)&&g&&s?o.partial[s]=Je(g,a):o.lastName&&u&&oe(u)&&Go.has(c)&&(o.partial[o.lastName]=Je(c,u)),{lastName:s,lastOption:a,partial:o.partial}},"getBooleanValue");return t.reduce(r,{partial:{}}).partial},"getBooleanValues");var Ho=Object.defineProperty,Qe=$((t,e)=>Ho(t,"name",{value:e,configurable:!0}),"s$9");const Yo=new Set(["0","1","false","true"]),Jo=Qe((t,e,n,i)=>{if(e.length===0||t.length===0)return t;const r=Qe((o,c)=>{const{argValue:s,option:g}=$t(c,e,n,i),{lastOption:a}=o;if(a&&oe(a)&&Yo.has(c)){const{args:u}=o;return{args:u.slice(0,-1)}}return g&&oe(g)&&s?{args:o.args}:{args:[...o.args,c],lastOption:g}},"removeBooleanArguments");return t.reduce(r,{args:[]}).args},"removeBooleanValues");var Qo=Object.defineProperty,Xo=$((t,e)=>Qo(t,"name",{value:e,configurable:!0}),"o$8");const Xe=Xo(t=>{const e=new Map;for(const n of t){const i=e.get(n.name);i?e.set(n.name,{...i,...n}):e.set(n.name,n)}return[...e.values()]},"mergeArguments");var Zo=Object.defineProperty,fe=$((t,e)=>Zo(t,"name",{value:e,configurable:!0}),"o$7");const ei=fe(t=>{if(t===void 0)return;const e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"},"transformBooleanEnv"),ti=fe((t,e)=>{if(!t.type)return e;if(e!==void 0){if(t.type===Boolean||typeof t.type=="function"&&t.type.name==="Boolean")return ei(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)}},"transformEnvValue"),ni=/_./g,oi=/^[A-Z]/,ii=fe(t=>t.toLowerCase().replaceAll(ni,e=>e[1]?.toUpperCase()??e).replace(oi,e=>e.toLowerCase()),"toCamelCase"),ai=fe(t=>{if(!t||t.length===0)return{};const e={},n=z();for(const i of t){const r=n[i.name],o=ti(i,r),c=o===void 0?i.defaultValue:o,s=ii(i.name);e[s]=c}return e},"processEnvVariables");var ri=Object.defineProperty,ie=$((t,e)=>ri(t,"name",{value:e,configurable:!0}),"a$5");const si=ie(t=>{const e=new Map,n=new Map;for(const i of t)if(e.set(i.name,i),i.alias){const r=Array.isArray(i.alias)?i.alias:[i.alias];for(const o of r)n.set(o,i)}return{optionMapByAlias:n,optionMapByName:e}},"buildOptionMaps"),Ot=ie(async t=>{if(typeof t.__resolvedExecute__=="function")return t.__resolvedExecute__;if(typeof t.loader!="function")throw new $e(t.name,"no execute or loader defined");let e;try{e=await t.loader()}catch(i){throw new $e(t.name,i instanceof Error?i.message:String(i),i)}const n=e.default;if(typeof n!="function")throw new $e(t.name,"loader did not return a module with a default-exported handler function");return t.__resolvedExecute__=n,n},"loadLazyHandler"),li=ie((t,e,n,i)=>{const r=new Vo(t.name,t),{_all:o,_unknown:c,positionals:s}=e,g=Object.keys(n).length>0?{...o,...n}:o;se in g&&delete g[se],r.argument=s?.[se]??[],r.rawUnknown=[...c??[]];const a=Object.keys(i).length>0;return r.options=a?{...g,...i}:g,r.env=ai(t.env),r},"prepareToolbox"),ci=ie((t,e,n)=>{const i=t.options??[],r=i.length>0;let o=Xe(r?[...i,...n]:n);if(o.length>0){for(const a of o)if(a.multiple&&a.lazyMultiple)throw new Error(`Argument "${a.name}" cannot have both multiple and lazyMultiple options, please choose one.`)}t.argument&&(o=[{defaultOption:!0,description:t.argument.description,group:"positionals",multiple:!0,name:se,type:t.argument.type,typeLabel:t.argument.typeLabel},...o]);let c,s;if(r){const{optionMapByAlias:a,optionMapByName:u}=si(i);c=Jo(e,i,u,a),s=Ko(e,i,u,a)}else c=e,s={};const g=Mo(o,{argv:c,camelCase:!0,partial:!0,stopAtFirstUnknown:!0});return{arguments_:o,booleanValues:s,parsedArgs:g}},"processCommandArgs"),K=ie(async(t,e,n)=>typeof t.execute=="function"?t.execute(e):(await Ot(t))(e),"executeCommand");var ui=Object.defineProperty,pi=$((t,e)=>ui(t,"name",{value:e,configurable:!0}),"n$6");let fi=class extends P{static{$(this,"s")}static{pi(this,"CommandValidationError")}commandName;missingOptions;constructor(e,n){super(`Command "${e}" is missing required options: ${n.join(", ")}`,"COMMAND_VALIDATION_ERROR",{commandName:e,missingOptions:n}),this.name="CommandValidationError",this.commandName=e,this.missingOptions=n,this.hint=`Provide the following required options: ${n.join(", ")}`}};var di=Object.defineProperty,hi=$((t,e)=>di(t,"name",{value:e,configurable:!0}),"t$5");const Ze=hi((t,e,n=!1)=>{const i=[];for(const r of t)if(!(!n&&!r.required)&&e[r.name]===void 0){if(r.type?.name==="Boolean"){e[r.name]=!1;continue}i.push(r)}return i},"listMissingArguments");var mi=Object.defineProperty,At=$((t,e)=>mi(t,"name",{value:e,configurable:!0}),"n$5");const gi=At((t,e)=>e.includes(t)?!0:Math.abs(t.length-e.length)>t.length/2?!1:Zt(t,e)<=t.length/3,"isSimilar"),R=At((t,e)=>{const n=t.toLowerCase();return e.filter(i=>gi(i.toLowerCase(),n))},"findAlternatives");var vi=Object.defineProperty,de=$((t,e)=>vi(t,"name",{value:e,configurable:!0}),"a$4");const wi=de((t,e)=>{const n=[];if(t._unknown&&t._unknown.forEach(i=>{const r=i.startsWith("--");let o=`Found unknown ${r?"option":"argument"} "${i}"`;if(r){const c=R(i.replace("--",""),(e.options??[]).map(s=>s.name));if(c.length>0){const[s,...g]=c.map(a=>`--${a}`);o+=g.length>0?`, did you mean ${s??""} or ${g.join(", ")}?`:`, did you mean ${s??""}?`}}n.push(o)}),n.length>0)throw new Error(n.join(`
|
|
2
|
-
`))},"validateUnknownOptions"),yi=de((t,e,n)=>{const i=n.__requiredOptions__,r=i?Ze(i,e,!0):Ze(t,e,!1);if(r.length>0)throw new fi(n.name,r.map(o=>o.name));e._unknown&&e._unknown.length>0&&!n.argument&&wi(e,n)},"validateRequiredOptions"),bi=de((t,e,n)=>{const i=n.__conflictingOptions__??t.filter(r=>r.conflicts!==void 0);if(i.length>0){const r=i.find(o=>Array.isArray(o.conflicts)?o.conflicts.some(c=>e[c]!==void 0)&&e[o.name]!==void 0:e[o.conflicts]!==void 0&&e[o.name]!==void 0);if(r)throw new at(r.name,typeof r.conflicts=="string"?r.conflicts:r.conflicts?.[0]??"unknown")}},"validateConflictingOptions"),$i=de(t=>{if(!Array.isArray(t.options))return;const e=new Map,n=new Map;for(const r of t.options){if(r.name){const o=e.get(r.name)??[];o.push(r),e.set(r.name,o)}if(typeof r.alias=="string"&&r.alias.length>0){const o=n.get(r.alias)??[];o.push(r),n.set(r.alias,o)}else if(Array.isArray(r.alias)){for(const o of r.alias)if(o.length>0){const c=n.get(o)??[];c.push(r),n.set(o,c)}}}const i=[];for(const[r,o]of e)o.length>1&&i.push(`Duplicate option name "${r}" in command "${t.name}": ${JSON.stringify(o)}`);for(const[r,o]of n)o.length>1&&i.push(`Duplicate option alias "-${r}" used by options ${o.map(c=>`"${c.name}"`).join(", ")} in command "${t.name}"`);if(i.length>0)throw new Error(i.join(`
|
|
3
|
-
`))},"validateDuplicateOptions");var Oi=Object.defineProperty,Le=$((t,e)=>Oi(t,"name",{value:e,configurable:!0}),"s$5");const Ai=Le((t,e)=>{if(e.length===0)return{argv:[],commandPath:void 0};const n=[];let i;for(let r=1;r<=e.length;r+=1){const o=e[r-1];if(o===void 0||o.startsWith("-"))break;n.push(o);const c=n.join(" ");t.has(c)&&(i={commandPath:[...n],depth:r})}return i?{argv:e.slice(i.depth),commandPath:i.commandPath}:{argv:e,commandPath:void 0}},"parseNestedCommand"),B=Le(t=>t.join(" "),"getCommandPathKey"),et=Le((t,e)=>e&&e.length>0?[...e,t]:[t],"getFullCommandPath");var Pi=Object.defineProperty,Pt=$((t,e)=>Pi(t,"name",{value:e,configurable:!0}),"a$3"),Ci=Object.defineProperty,Ct=Pt((t,e)=>Ci(t,"name",{value:e,configurable:!0}),"a"),Ni=Object.defineProperty,_i=Ct((t,e)=>Ni(t,"name",{value:e,configurable:!0}),"a");let Nt=class{static{$(this,"u")}static{Pt(this,"n")}static{Ct(this,"s")}static{_i(this,"LRUCache")}capacity;cache;constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}has(e){return this.cache.has(e)}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.capacity){const i=this.cache.keys().next().value;i!==void 0&&this.cache.delete(i)}this.cache.set(e,n)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}size(){return this.cache.size}};var ki=Object.defineProperty,Ei=$((t,e)=>ki(t,"name",{value:e,configurable:!0}),"r$5"),xi=Object.defineProperty,Li=Ei((t,e)=>xi(t,"name",{value:e,configurable:!0}),"a"),Ii=Object.defineProperty,ji=Li((t,e)=>Ii(t,"name",{value:e,configurable:!0}),"s");const Ui=ji((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleLowerCase(e.locale):t[0].toLowerCase())+t.slice(1),"lowerFirst");var Ti=Object.defineProperty,Mi=$((t,e)=>Ti(t,"name",{value:e,configurable:!0}),"T"),Si=Object.defineProperty,he=Mi((t,e)=>Si(t,"name",{value:e,configurable:!0}),"j");const Di=$n(import.meta.url),te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Vi=he(t=>{if(typeof te<"u"&&te.versions&&te.versions.node){const[e,n]=te.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return te.getBuiltinModule(t)}return Di(t)},"__cjs_getBuiltinModule"),{stripVTControlCharacters:Bi}=Vi("node:util");var Ri=Object.defineProperty,zi=he((t,e)=>Ri(t,"name",{value:e,configurable:!0}),"a");const Oe=new Nt(1e3),Wi=/[.*+?^${}()|[\]\\]/g,Fi=zi(t=>{const e=t.join("");if(Oe.has(e)){const r=Oe.get(e);return r.lastIndex=0,r}const n=t.map(r=>r.replaceAll(Wi,String.raw`\$&`)).join("|"),i=new RegExp(n,"g");return Oe.set(e,i),i},"getSeparatorsRegex");var qi=Object.defineProperty,Gi=he((t,e)=>qi(t,"name",{value:e,configurable:!0}),"t");const Ki=Gi(t=>{const e=[];let n=0,i;for(W.lastIndex=0;(i=W.exec(t))!==null;)i.index>n&&e.push(t.slice(n,i.index)),e.push(i[0]),n=W.lastIndex;return n<t.length&&e.push(t.slice(n)),e.filter(Boolean)},"splitByEmoji");var Hi=Object.defineProperty,k=he((t,e)=>Hi(t,"name",{value:e,configurable:!0}),"u");const Yi=/[ČŠŽĐ]/i,_t=new Uint8Array(128),kt=new Uint8Array(128),Et=new Uint8Array(128);for(let t=0;t<128;t++)_t[t]=t>=65&&t<=90?1:0,kt[t]=t>=97&&t<=122?1:0,Et[t]=t>=48&&t<=57?1:0;const Ae=k(t=>_t[t],"isUpper"),tt=k(t=>kt[t],"isLower"),Pe=k(t=>Et[t],"isDigit"),D=k((t,e,n,i,r)=>{if(t.length===0)return[];let o=!1;const c=Object.values(e);for(const h of c)if(h(t[0])){o=!0;break}if(!o&&!n)return[t];const s=[...t],g=[];let a=s[0],u="other";const d=Object.entries(e);for(const h of d){const[f,y]=h;if(y(s[0])){u=f;break}}let l=n&&i?s[0]===s[0].toLocaleUpperCase(i):!1;for(let h=1;h<s.length;h++){const f=s[h];let y="other";for(const C of d){const[N,E]=C;if(E(f)){y=N;break}}const b=n&&i?f===f.toLocaleUpperCase(i):!1;let w=!1;r?w=r(u,y,l,b,f,h,s):(u!==y&&u!=="other"&&y!=="other"&&(w=!0),n&&y!=="other"&&!l&&b&&(w=!0)),w?(g.push(a),a=f):a+=f,u=y,n&&(l=b)}return a&&a.length>0&&g.push(a),g.length>0?g:[t]},"handleScriptTransitions"),Ji=k((t,e,n,i)=>{if(n.size===0)return e;for(const r of n)if(t.startsWith(r,e))return i.push(r),e+r.length;return e},"detectAndProcessAcronym"),xt=k((t,e=new Set)=>{if(t.length===0)return[];if(t.toUpperCase()===t)return[t];let n=0;const i=[],r=t.length;for(let o=1;o<r;o++){const c=Ji(t,n,e,i);if(c!==n){n=c,o=n-1;continue}const s=t.codePointAt(o-1),g=t.codePointAt(o),a=s&&s<128&&Ae(s),u=g&&g<128&&Ae(g),d=s&&s<128&&tt(s),l=s&&s<128&&Pe(s),h=g&&g<128&&Pe(g);if(d&&u){i.push(t.slice(n,o)),n=o;continue}if(l&&!h||!l&&h){i.push(t.slice(n,o)),n=o;continue}if(h&&!l){let f=!1,y=!1;if(o+1<r){const b=t.codePointAt(o+1);f=b&&b<128&&Ae(b),y=b&&b<128&&Pe(b)}if(!y&&f){i.push(t.slice(n,o),t.slice(o,o+1)),n=o+1;continue}}if(o+1<r){const f=t.codePointAt(o+1),y=f&&f<128&&tt(f);if(a&&u&&y){const b=t.slice(n,o+1);e.has(b)||(i.push(t.slice(n,o)),n=o)}}}return n<r&&i.push(t.slice(n)),i.filter(o=>o!=="")},"splitCamelCaseFast"),Lt=k((t,e,n)=>{if(t.length===0)return[];const i=t===t.toLocaleUpperCase(e);if(e.startsWith("de")){if(!i&&t.replaceAll("ß","SS")===t.toLocaleUpperCase(e))return[t];const a=[...t],u=a.length,d=[];let l=a[0],h=a[0]===a[0].toLocaleUpperCase(e),f=h,y=h?0:-1;for(let b=1;b<u;b++){const w=a[b],C=w===w.toLocaleUpperCase(e);if(C===h)l+=w;else if(C)l&&l.length>0&&(d.push(l),l=w),f=!0,y=b;else{if(f&&b-y>1){const N=a[b-1],E=l.slice(0,-1);E&&E.length>0&&d.push(E),l=N+w}else l+=w;f=!1,y=-1}h=C}return l&&l.length>0&&d.push(l),d}if(e.startsWith("uk")||e.startsWith("ru")||e.startsWith("bg")||e.startsWith("sr")||e.startsWith("mk")||e.startsWith("be")){if(!G.test(t)&&!I.test(t))return[t];const a=[...t],u=a.length,d=[];let l=a[0];const h=a[0];let f;G.test(h)?f=1:I.test(h)?f=2:f=0;let y=h===h.toLocaleUpperCase(e);for(let w=1;w<u;w++){const C=a[w];let N;G.test(C)?N=1:I.test(C)?N=2:N=0;const E=C===C.toLocaleUpperCase(e);f!==N&&(f===1||f===2)&&(N===1||N===2)||N===f&&!y&&E?(d.push(l),l=C):l+=C,f=N,y=E}l&&l.length>0&&d.push(l);const b=[];for(let w=0;w<d.length;w++)w<d.length-1&&d[w].length===1&&I.test(d[w])&&G.test(d[w+1][0])?(b.push(d[w]+d[w+1]),w+=1):b.push(d[w]);return b}if(e.startsWith("el")){if(!ye.test(t)&&!I.test(t))return[t];const a=[];Te.lastIndex=0;let u;for(;(u=Te.exec(t))!==null;)a.push(u[0]);a.length===0&&a.push(t);const d=[];if(a.length===1){const l=a[0];if(!l||!ye.test(l[0])||l.length===1)return[l??t]}for(const l of a){if(!l)continue;if(!ye.test(l[0])||l.length===1){d.push(l);continue}const h=l.length;let f=l[0],y=l[0]===l[0].toLocaleUpperCase(e);for(let b=1;b<h;b++){const w=l[b],C=w===w.toLocaleUpperCase(e);!y&&C?(d.push(f),f=w):f+=w,y=C}f&&d.push(f)}return d}if(e.startsWith("ja")||e.startsWith("ko")){const a=e.startsWith("ja"),u=a?{hiragana:k(l=>on.test(l),"hiragana"),kanji:k(l=>Me.test(l),"kanji"),katakana:k(l=>nn.test(l),"katakana"),latin:k(l=>I.test(l),"latin")}:{hangul:k(l=>Se.test(l),"hangul"),latin:k(l=>I.test(l),"latin")},d=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(a){const l=D(t,u,!1,e,(f,y)=>f==="hiragana"&&y==="katakana"||f==="katakana"&&y==="hiragana"||f==="hiragana"&&y==="latin"||f==="katakana"&&y==="latin"||f==="kanji"&&y==="latin"||f==="latin"&&(y==="hiragana"||y==="katakana"||y==="kanji")),h=[];for(const f of l){const y=f;y.length===1&&d.has(y)&&h.length>0?h[h.length-1]=h.at(-1)+y:h.push(y)}return h.length>0?h:[t]}return D(t,u,!1,e,(l,h)=>l==="hangul"&&h==="latin"||l==="latin"&&h==="hangul")}if(e.startsWith("sl")){const a=[...t],u=a.length,d=[];let l=a[0],h=a[0]===a[0].toLocaleUpperCase(e);for(let f=1;f<u;f++){const y=a[f],b=y===y.toLocaleUpperCase(e),w=Yi.test(y),C=f<u-1&&a[f+1]===a[f+1].toLocaleUpperCase(e);!h&&b||w&&C?(d.push(l),l=y,w&&C&&(d.push(l),l="")):l+=y,h=b}return l&&l.length>0&&d.push(l),d}if(e.startsWith("zh"))return D(t,{han:k(a=>Me.test(a),"han"),latin:k(a=>I.test(a),"latin")},!1,e);if(["ar","fa","he","ur"].includes(e.split("-")[0])){const a=k(u=>De.test(u)||Ve.test(u),"isRtlChar");return D(t,{latin:k(u=>I.test(u),"latin"),rtl:k(u=>a(u),"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 a=k(u=>an.test(u)||rn.test(u)||sn.test(u)||ln.test(u)||cn.test(u)||un.test(u)||pn.test(u)||fn.test(u)||dn.test(u)||hn.test(u)||mn.test(u)||gn.test(u)||vn.test(u)||wn.test(u)||yn.test(u)||bn.test(u),"isIndicChar");return D(t,{indic:k(u=>a(u),"indic"),latin:k(u=>I.test(u),"latin")},!1,e)}if(["be","bg","ru","sr","uk"].includes(e))return D(t,{cyrillic:k(a=>G.test(a),"cyrillic"),latin:k(a=>I.test(a),"latin")},!0,e);if(["ar","fa","he"].includes(e))return D(t,{latin:k(a=>I.test(a),"latin"),rtl:k(a=>De.test(a)||Ve.test(a),"rtl")},!1,e);if(e.startsWith("ko"))return D(t,{hangul:k(a=>Se.test(a),"hangul"),latin:k(a=>I.test(a),"latin")},!1,e);if(e.startsWith("uz")){if(!G.test(t)&&!I.test(t))return[t];const a=[...t],u=a.length,d=[];let l=a[0],h=a[0]===a[0].toLocaleUpperCase(e);for(let f=1;f<u;f++){const y=a[f],b=y===y.toLocaleUpperCase(e);if(Be.test(y)||Be.test(a[f-1])){l+=y;continue}!h&&b?(d.push(l),l=y):l+=y,h=b}return l&&l.length>0&&d.push(l),d}const r=[...t],o=r.length,c=[];let s=r[0],g=r[0]===r[0].toLocaleUpperCase(e);for(const a of n)if(t.startsWith(a)){c.push(a),s=r[a.length],g=s===s.toLocaleUpperCase(e);break}for(let a=1;a<o;a++){const u=r[a],d=u===u.toLocaleUpperCase(e);let l=0;for(const h of n)if(t.startsWith(h,a)){c.push(s,h),l=h.length,s="";const f=h.at(-1);f&&(g=f===f.toLocaleUpperCase(e));break}if(l>0){a+=l-1;continue}!g&&d?(c.push(s),s=u):s+=u,g=d}return s&&c.push(s),c},"splitCamelCaseLocale"),Qi=k((t,e,n)=>{const i=[],r=ne.test(t)?t.split(ne).filter(Boolean):[t];for(const o of r){const c=o;if(ne.test(c))i.push(c);else{W.lastIndex=0;const s=W.test(c)?Ki(c).filter(Boolean):[c];for(const g of s)if(W.lastIndex=0,W.test(g))i.push(g);else if(e){const a=e.toLowerCase().split("-")[0];i.push(...Lt(g,a,n))}else i.push(...xt(g,n))}}return i},"processTextWithAnsiEmoji"),Xi=k((t,e={})=>{if(!t||typeof t!="string")return[];const{handleAnsi:n=!1,handleEmoji:i=!1,knownAcronyms:r=[],locale:o,normalize:c=!1,separators:s,stripAnsi:g=!1,stripEmoji:a=!1}=e,u=new Set([...r].toSorted((w,C)=>C.length-w.length));let d=t;g&&(d=Bi(d)),a&&(d=en(d));let l;Array.isArray(s)?l=Fi(s):s instanceof RegExp?l=s:l=tn;const h=[];let f=d;const y=l.flags.includes("g")?l:new RegExp(l.source,`${l.flags}g`);for(;f.length>0;){const w=y.exec(f);if(!w){f===".."?h.push(".."):f==="."?h.push("."):f.length>0&&h.push(f);break}const C=w.index,N=w[0],E=N.length,p=f.slice(0,C),m=f.slice(C+E);if(N.startsWith("../"))h.push(".."),f=f.slice(C+3);else if(N.startsWith("./"))h.push("."),f=f.slice(C+2);else if(C===0&&N==="..")h.push(".."),f=f.slice(2);else if(C===0&&N===".")h.push("."),f=f.slice(1);else{p.length>0&&h.push(p);let v=0;for(;(v=N.indexOf("../",v))!==-1;)h.push(".."),v+=3;for(v=0;(v=N.indexOf("./",v))!==-1;)(v===0||N[v-1]!==".")&&h.push("."),v+=2;let O=m;for(;O.startsWith("../");)h.push(".."),O=O.slice(3);for(;O.startsWith("./");)h.push("."),O=O.slice(2);if(O===".."){h.push("..");break}else if(O==="."){h.push(".");break}else f=O}y.lastIndex=0}if(h.length===0){const w=d.split(l).filter(Boolean);h.push(...w)}let b=[];for(const w of h)n||i?b.push(...Qi(w,o,u)):o?b.push(...Lt(w,o,u)):b.push(...xt(w,u));return c&&(b=b.map(w=>u.has(w)?w:o&&w===w.toLocaleUpperCase(o)?w[0]+w.slice(1).toLocaleLowerCase(o):w.toUpperCase()===w&&!u.has(w)?w.slice(0,1)+w.slice(1).toLowerCase():w)),b},"splitByCase");var Zi=Object.defineProperty,ea=$((t,e)=>Zi(t,"name",{value:e,configurable:!0}),"r$4"),ta=Object.defineProperty,na=ea((t,e)=>ta(t,"name",{value:e,configurable:!0}),"o"),oa=Object.defineProperty,ia=na((t,e)=>oa(t,"name",{value:e,configurable:!0}),"s");const aa=ia((t,e)=>typeof t!="string"||t===""?"":(e?.locale?t[0].toLocaleUpperCase(e.locale):t[0].toUpperCase())+t.slice(1),"upperFirst");var ra=Object.defineProperty,sa=$((t,e)=>ra(t,"name",{value:e,configurable:!0}),"r$3"),la=Object.defineProperty,ca=sa((t,e)=>la(t,"name",{value:e,configurable:!0}),"r"),ua=Object.defineProperty,pa=ca((t,e)=>ua(t,"name",{value:e,configurable:!0}),"n");const fa=pa((t,e)=>`${t}::${e?.joiner??""}::${e?.locale??""}::${e?.knownAcronyms?.join(",")??""}::${e?.normalize?"true":"false"}`,"generateCacheKey");var da=Object.defineProperty,ha=$((t,e)=>da(t,"name",{value:e,configurable:!0}),"i$3"),ma=Object.defineProperty,ga=ha((t,e)=>ma(t,"name",{value:e,configurable:!0}),"f"),va=Object.defineProperty,wa=ga((t,e)=>va(t,"name",{value:e,configurable:!0}),"l");const ya=wa((t,e)=>{const{length:n}=t;if(n===0)return"";if(n===1)return t[0];const i=[];let r="",o="";for(let c=0;c<n;c++){const s=t[c];if(ne.test(s)){r?(i.push(r+o+s),r="",o=""):(i.length>0&&i.push(e),r=s);continue}r?(o&&(o+=e),o+=s):(i.length>0&&i.push(e),i.push(s))}return i.join("")},"joinSegments");var ba=Object.defineProperty,$a=$((t,e)=>ba(t,"name",{value:e,configurable:!0}),"r$2"),Oa=Object.defineProperty,Aa=$a((t,e)=>Oa(t,"name",{value:e,configurable:!0}),"a"),Pa=Object.defineProperty,Ca=Aa((t,e)=>Pa(t,"name",{value:e,configurable:!0}),"e");const Na=/(?<![a-zß])SS(?![a-z])/g,_a=Ca(t=>t.replaceAll(Na,"ß"),"normalizeGermanEszett");var ka=Object.defineProperty,Ea=$((t,e)=>ka(t,"name",{value:e,configurable:!0}),"c$2"),xa=Object.defineProperty,La=Ea((t,e)=>xa(t,"name",{value:e,configurable:!0}),"c"),Ia=Object.defineProperty,ja=La((t,e)=>Ia(t,"name",{value:e,configurable:!0}),"o");const Ua=new Nt(1e3),It=ja((t,e)=>{if(typeof t!="string"||!t)return"";const n=e?.cache??!1,i=e?.cacheStore??Ua;let r;if(n&&(r=fa(t,e)),n&&r&&i.has(r))return i.get(r);let o=!0;const c=ya(Xi(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(s=>{if(e?.handleAnsi&&ne.test(s))return s;const g=e?.locale?.startsWith("de")?_a(s):s,a=e?.locale?g.toLocaleLowerCase(e.locale):g.toLowerCase();return o?(o=!1,Ui(a,e)):aa(a,e)}),"");return n&&r&&i.set(r,c),c},"camelCase");var Ta=Object.defineProperty,me=$((t,e)=>Ta(t,"name",{value:e,configurable:!0}),"a$2");const Ma=me(t=>{t.options?.forEach(e=>{e.__camelCaseName__=It(e.name)})},"processOptionNames"),Sa=me(t=>{if(!Array.isArray(t.options)||t.options.length===0)return;const e=new Set;for(const i of t.options)e.add(i.name);const n=[];for(const i of t.options)if(i.name.startsWith("no-")){const r=i.name.replace(/^no-/,"");if(!e.has(r)){if(i.type!==Boolean)throw new Error(`Cannot add negated option "${i.name}" to command "${t.name}" because it is not a boolean.`);const o={...i,defaultValue:i.defaultValue===void 0?!0:!i.defaultValue,name:r};n.push(o),e.add(r)}}n.length>0&&t.options.push(...n)},"addNegatableOptions"),Da=me((t,e)=>{if(!e.options||e.options.length===0)return;const{options:n}=t,i=new Map;for(const o of e.options)if(o.name.startsWith("no-")){const c=It(o.name);i.set(c,o)}const r=Object.keys(n).filter(o=>i.has(o));if(r.length!==0)for(const o of r){const c=o.charAt(2);if(!c)continue;const s=c.toLowerCase()+o.slice(3),g=i.get(o);g&&(g.__negated__=!0),n[s]=!n[o],Reflect.deleteProperty(n,o)}},"mapNegatableOptions"),Va=me((t,e)=>{if(!e.options||e.options.length===0)return;const n=new Map;for(const r of e.options)r.__camelCaseName__&&r.__negated__===void 0&&r.implies!==void 0&&n.set(r.__camelCaseName__,r);if(n.size===0)return;const{options:i}=t;for(const r of Object.keys(i)){const o=n.get(r);if(o?.implies){const{implies:c}=o;for(const[s,g]of Object.entries(c))i[s]===void 0&&(i[s]=g)}}},"mapImpliedOptions");var Ba=Object.defineProperty,ge=$((t,e)=>Ba(t,"name",{value:e,configurable:!0}),"e$2");const Ra=ge(()=>!!process.versions.electron,"isElectronApp"),za=ge(()=>Ra()&&!process.defaultApp,"isBundledElectronApp"),Wa=ge(()=>za()?0:1,"getProcessArgvBinIndex"),Fa=ge(t=>t.slice(Wa()+1),"hideBin");var qa=Object.defineProperty,jt=$((t,e)=>qa(t,"name",{value:e,configurable:!0}),"e$1");const Ga=" ",Ka=jt((t,e)=>t===e?!0:t.length!==e.length?!1:t.every((n,i)=>n===e[i]),"equals"),Ha=jt(t=>{if(typeof t=="string")return t.split(Ga);const e=ke();return Ka(t,e)?Fa(t):t},"parseRawCommand");var Ya=Object.defineProperty,Ce=$((t,e)=>Ya(t,"name",{value:e,configurable:!0}),"r");const Ja=Ce(t=>{const e=Ce(o=>{t.error(`Uncaught exception: ${o.message||o}`),o.stack&&t.error(o.stack),Y(1)},"uncaughtExceptionHandler"),n=Ce((o,c)=>{if(o instanceof Error)t.error(`Promise rejection: ${o.message||o}`),o.stack&&t.error(o.stack);else{let s;if(typeof o=="string")s=o;else try{s=JSON.stringify(o)}catch{s=String(o)}t.error(`Promise rejection: ${s}`)}Y(1)},"unhandledRejectionHandler"),i=Ue("uncaughtException",e),r=Ue("unhandledRejection",n);return()=>{i(),r()}},"registerExceptionHandler");var Qa=Object.defineProperty,Z=$((t,e)=>Qa(t,"name",{value:e,configurable:!0}),"e");const le=100,Ut=/^[a-z][\w-]*$/i,ce=Z((t,e)=>{if(typeof t!="string"||t.trim().length===0)throw new P(`${e} must be a non-empty string`,"INVALID_INPUT",{fieldName:e,value:t});return t.trim()},"validateNonEmptyString"),nt=Z((t,e)=>{if(!Array.isArray(t)||!t.every(n=>typeof n=="string"))throw new P(`${e} must be an array of strings`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateStringArray");Z((t,e)=>{if(typeof t!="function")throw new P(`${e} must be a function`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateFunction");const Ne=Z((t,e)=>{if(typeof t!="object"||t===null)throw new P(`${e} must be an object`,"INVALID_INPUT",{fieldName:e,value:t});return t},"validateObject"),re=Z(t=>{const e=ce(t,"Command name");if(e.length>le)throw new P(`Command name is too long (maximum ${String(le)} characters)`,"INVALID_COMMAND_NAME",{commandName:e,length:e.length});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new P(`Command name "${e}" contains invalid characters`,"INVALID_COMMAND_NAME",{commandName:e});if(!Ut.test(e))throw new P(`Command name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_COMMAND_NAME",{commandName:e});return e},"validateCommandName");Z(t=>{const e=ce(t,"Plugin name");if(e.length>le)throw new P(`Plugin name is too long (maximum ${String(le)} characters)`,"INVALID_PLUGIN_NAME",{length:e.length,pluginName:e});if(e.includes("..")||e.includes("/")||e.includes("\\")||e.includes(";")||e.includes("|")||e.includes("&"))throw new P(`Plugin name "${e}" contains invalid characters`,"INVALID_PLUGIN_NAME",{pluginName:e});if(!Ut.test(e))throw new P(`Plugin name "${e}" must start with a letter and contain only letters, numbers, hyphens, and underscores`,"INVALID_PLUGIN_NAME",{pluginName:e});return e},"validatePluginName");var Xa=Object.defineProperty,ve=$((t,e)=>Xa(t,"name",{value:e,configurable:!0}),"s");const Za=new Set([`
|
|
4
|
-
`,"\r"," ","\0",'"',"$","&","'","(",")",";","<",">","[","\\","]","`","{","|","}"]),er=/^[A-Z]:/i,tr=ve((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(Za.has(n))throw new Error(`Argument contains dangerous character: ${n}`)}return t.trim()},"sanitizeArgument"),ot=ve((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=>tr(n,e))},"sanitizeArguments");ve(t=>{if(typeof t!="string")throw new TypeError("Path must be a string");const e=t.trim();if(e.split(/[/\\]/).includes(".."))throw new Error("Path contains directory traversal sequences");if(e.startsWith("/")||er.test(e))throw new Error("Absolute paths are not allowed");if(e.length>1e3)throw new Error("Path is too long");return e},"validateSafePath");class Ar{static{$(this,"RateLimiter")}static{ve(this,"RateLimiter")}attempts=new Map;maxAttempts;windowMs;constructor(e=5,n=6e4){if(e<=0||n<=0)throw new Error("maxAttempts and windowMs must be positive numbers");this.maxAttempts=e,this.windowMs=n}checkLimit(e){const n=Date.now(),i=this.attempts.get(e);return!i||n>i.resetTime?(this.attempts.set(e,{count:1,resetTime:n+this.windowMs}),this.cleanup(n),!0):i.count>=this.maxAttempts?!1:(i.count+=1,!0)}reset(e){this.attempts.delete(e)}cleanup(e){for(const[n,i]of this.attempts.entries())e>i.resetTime&&this.attempts.delete(n)}}var nr=Object.defineProperty,T=$((t,e)=>nr(t,"name",{value:e,configurable:!0}),"b");const or=/^-([^\d-])$/,ir=/^--(\S+)/,ar=/^-([^\d-]{2,})$/,_e=T(t=>or.test(t)||ir.test(t)||ar.test(t),"isOption"),rr={access:T((t,e)=>qt(t,e),"access"),mkdir:T((t,e)=>Ft(t,e),"mkdir"),readdir:T(t=>Wt(t),"readdir"),readFile:T((async(t,e)=>e===void 0?Ie(t):Ie(t,e)),"readFile"),rm:T((t,e)=>zt(t,e),"rm"),stat:T(t=>Rt(t),"stat"),writeFile:T((t,e,n)=>Bt(t,e,n),"writeFile")};class Tt{static{$(this,"Cli")}static{T(this,"Cli")}#t;#e;#c;#u;#f;#d;#y;#b;#$;#O;#A;#p;#n;#o;#i;#a;#r;#h=!1;#P;#C=!1;#m;#g;#v;#l=[];#x(){return this.#m===void 0&&(this.#m=[...this.#o.keys()]),this.#m}#N(){return this.#g===void 0&&(this.#g=[...this.#n.keys()]),this.#g}#s(){return this.#v===void 0&&(this.#v=[...this.#x(),...this.#N()]),this.#v}#_(){return this.#l.length===0?ae:[...ae,...this.#l]}#k(){this.#m=void 0,this.#g=void 0,this.#v=void 0}#w(){if(this.#c===void 0){const e=Ha(this.#e.argv);this.#c=ot(e,!1),this.#L()}return this.#c}#L(){if(!this.#c)return;const e=z();let n=!1;for(const i of this.#c){if(i==="--quiet"||i==="-q"){e.CEREBRO_OUTPUT_LEVEL=String(Gt),n=!0;break}if(i==="--verbose"||i==="-v"){e.CEREBRO_OUTPUT_LEVEL=String(Kt),n=!0;break}if(i==="--debug"){e.CEREBRO_OUTPUT_LEVEL=String(H),n=!0;break}}n||(e.CEREBRO_OUTPUT_LEVEL=Object.hasOwn(e,"DEBUG")?String(H):String(je))}#I(){this.#C||(this.#P=Ja(this.#t),this.#C=!0)}#j(){return{arch:Yt(),argv:this.#w(),cwd:this.#u,env:this.#O??z(),exit:this.#$??(e=>Y(e??0)),platform:Ht(),stdin:this.#A}}#E(e,n,i,r){this.#t.debug(`command '${r}' found, parsing command args: ${n.join(", ")}`);const{arguments_:o,booleanValues:c,parsedArgs:s}=ci(e,n,this.#_()),g=Object.keys(c).length>0;let a=s;g&&(a={...s,_all:{...s._all,...c}}),yi(o,a,e);const u=li(e,s,c,i);u.runtime=this,u.argv=this.#w(),u.fs=this.#b??rr,u.process=this.#j(),u.console=this.#t;const d=e.options&&e.options.length>0;if(d&&e.options){const l=e.options.filter(h=>h.name.startsWith("no-"));for(const h of l){const f=h.name.replace(/^no-/,""),y=`--${h.name}`,b=`--${f}`,w=n.includes(y),C=n.includes(b);if(w&&C)throw new at(f,h.name)}}return d&&(Da(u,e),Va(u,e)),bi(o,u.options,e),z().CEREBRO_OUTPUT_LEVEL===String(H)&&(this.#t.debug("command options parsed from options:"),this.#t.debug(JSON.stringify(u.options,null,2)),this.#t.debug("command argument parsed from argument:"),this.#t.debug(JSON.stringify(u.argument,null,2))),{arguments_:o,booleanValues:c,commandArgs:a,parsedArgs:s,toolbox:u}}constructor(e,n={}){if(typeof e!="string"||e.trim().length===0)throw new P("CLI name must be a non-empty string","INVALID_INPUT",{cliName:e});this.#f=e.trim();const i=n.argv??ke(),r=n.cwd??Jt();if(this.#e={...n,argv:i,cwd:r},this.#e.argv&&!Array.isArray(this.#e.argv))throw new P("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 P("CLI cwd option must be a string","INVALID_INPUT",{cwd:this.#e.cwd});if(this.#e.packageName&&typeof this.#e.packageName!="string")throw new P("CLI packageName option must be a string","INVALID_INPUT",{packageName:this.#e.packageName});if(this.#e.packageVersion&&typeof this.#e.packageVersion!="string")throw new P("CLI packageVersion option must be a string","INVALID_INPUT",{packageVersion:this.#e.packageVersion});const o=z();if(o.CEREBRO_OUTPUT_LEVEL=String(je),typeof this.#e.logger=="object"){const u=["debug","error","info","log","warn"],d=[],l=this.#e.logger;for(const h of u)typeof l[h]!="function"&&d.push(h);if(d.length>0)throw new P(`Logger object is missing required methods: ${d.join(", ")}`,"INVALID_INPUT",{logger:this.#e.logger,missingMethods:d});this.#t=this.#e.logger}else this.#t={...console,debug:T((...u)=>{o.CEREBRO_OUTPUT_LEVEL===String(H)&&console.debug(...u)},"debug")};this.#d=this.#e.packageVersion,this.#y=this.#e.packageName,this.#u=this.#e.cwd,this.#a="help",this.#r={};const c=n.fs;if(c!==void 0&&(typeof c!="object"||c===null))throw new P("CLI fs option must be an object implementing the CerebroFs interface","INVALID_INPUT",{fs:n.fs});const s=n.exit;if(s!==void 0&&typeof s!="function")throw new P("CLI exit option must be a function","INVALID_INPUT",{exit:n.exit});const g=n.env;if(g!==void 0&&(typeof g!="object"||g===null))throw new P("CLI env option must be a record of string keys","INVALID_INPUT",{env:n.env});const a=n.stdin;if(a!==void 0&&typeof a!="string")throw new P("CLI stdin option must be a string","INVALID_INPUT",{stdin:n.stdin});this.#b=n.fs,this.#$=n.exit,this.#O=n.env,this.#A=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.#f}${this.#d?` v${this.#d}`:""}`),this.#r}setDefaultCommand(e){return this.#a=e,this}get defaultCommand(){return this.#a}addCommand(e){Ne(e,"Command"),re(e.name);const n=typeof e.execute=="function",i=typeof e.loader=="function";if(n&&i)throw new P(`Command "${e.name}" cannot define both "execute" and "loader" — choose one`,"INVALID_COMMAND",{commandName:e.name});if(!n&&!i)throw new P(`Command "${e.name}" must define either "execute" or "loader"`,"INVALID_COMMAND",{commandName:e.name});e.alias&&(typeof e.alias=="string"?re(e.alias):nt(e.alias,"Command alias").forEach(a=>re(a))),e.argument&&Ne(e.argument,"Command argument"),e.options&&Ne(e.options,"Command options"),e.commandPath&&(nt(e.commandPath,"Command commandPath"),e.commandPath.forEach(a=>{re(a)}));const r=et(e.name,e.commandPath),o=B(r);if(this.#o.has(o))throw new P(`Command with path "${o}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name,commandPath:e.commandPath});const c=Array.isArray(e.commandPath)&&e.commandPath.length>0,s=this.#n.get(e.name),g=s!==void 0&&(s.commandPath===void 0||s.commandPath.length===0);if(!c&&g)throw new P(`Command with name "${e.name}" already exists`,"DUPLICATE_COMMAND",{commandName:e.name});if(e.options)for(const a of e.options)ze(a);if($i(e),Sa(e),Ma(e),e.options&&(e.__conflictingOptions__=e.options.filter(a=>a.conflicts!==void 0),e.__requiredOptions__=e.options.filter(a=>a.required===!0)),c&&s!==void 0)this.#n.set(o,e);else{if(!c&&s!==void 0&&!g){const a=et(s.name,s.commandPath);this.#n.set(B(a),s)}this.#n.set(e.name,e)}if(this.#o.set(o,r),this.#i.set(o,e),this.#k(),e.alias!==void 0){const a=typeof e.alias=="string"?[e.alias]:e.alias;for(const u of a){if(z().CEREBRO_OUTPUT_LEVEL===String(H)&&this.#t.debug("adding alias",u),this.#n.has(u))throw new P(`Command alias "${u}" conflicts with existing command`,"DUPLICATE_COMMAND",{alias:u,commandName:e.name});this.#n.set(u,e)}}return this}addGlobalOption(e){const n=e,i=new Set(ae.map(o=>o.name)),r=new Set(ae.map(o=>o.alias).filter(Boolean));if(i.has(n.name))throw new P(`Cannot add global option "--${n.name}": it conflicts with a built-in global option`,"DUPLICATE_OPTION",{optionName:n.name});if(n.alias&&r.has(n.alias))throw new P(`Cannot add global option with alias "-${n.alias}": it conflicts with a built-in global option alias`,"DUPLICATE_OPTION",{alias:n.alias,optionName:n.name});if(new Set(this.#l.map(o=>o.name)).has(n.name))throw new P(`Global option "--${n.name}" has already been added`,"DUPLICATE_OPTION",{optionName:n.name});return n.group="global",ze(n),this.#l.push(n),this}getGlobalOptions(){return this.#_()}addPlugin(e){return this.getPluginManager().register(e),this}getPluginManager(){return this.#p?this.#p:(this.#p=new xn(this.#t),this.#p.register({description:"Attaches the logger to the toolbox",execute:T(e=>{e.logger=this.#t,e.console=e.logger},"execute"),name:"logger"}),this.#p)}getCliName(){return this.#f}getPackageVersion(){return this.#d}getPackageName(){return this.#y}getCommands(){return this.#n}getCwd(){return this.#u}dispose(){this.#P?.()}async run(e={}){const{autoDispose:n=!0,shouldExitProcess:i=!0,...r}=e;if(!this.#n.has("help")){const{default:p}=await import("../commands/help-command.js");this.addCommand(new p(this.#n))}const o=this.#N(),c=this.#o;this.#I();const s=this.#w();let g,a=[...s];const u=Qt(),d=Xt(),l=ke();this.#t.debug(`process.execPath: ${u}`),this.#t.debug(`process.execArgv: ${d.join(" ")}`),this.#t.debug(`process.argv: ${l.join(" ")}`);const h=Ai(c,[...s]);if(h.commandPath)g=h.commandPath,a=h.argv;else{if(s.length>1&&s[0]&&s[1]&&!_e(s[0])&&!_e(s[1])){const m=[];let v=0;for(;v<s.length;){const A=s[v];if(!A||_e(A))break;m.push(A),v+=1}const O=B(m);if(m[0]&&!o.includes(m[0])){const A=this.#s(),U=R(O,A);throw new V(O,U)}}let p;try{p=Bn([null,...o],[...s])}catch(m){if(m instanceof Error&&m.name==="INVALID_COMMAND"&&"command"in m){const v=m.command,O=this.#s(),A=R(v,O);throw new V(v,A)}throw m}p.command&&(g=[p.command],a=p.argv)}if(!g)if(this.#a)g=[this.#a];else{const p=this.#s();throw new V("",p)}const f=B(g),y=this.#o.get(f);let b;if(y){if(b=this.#i.get(f),!b||B(y)!==f){const p=this.#s(),m=R(f,p);throw new V(f,m)}}else{const p=g.at(-1);if(b=p?this.#n.get(p):void 0,!b){const m=this.#s(),v=R(f,m);throw new V(f,v)}}if(typeof b.execute!="function"&&typeof b.loader!="function")return this.#t.error(`Command "${b.name}" has no function to execute.`),i?Y(1):void 0;const w=a;let C,N;try{({commandArgs:C,toolbox:N}=this.#E(b,w,r,f))}catch(p){if(this.#t.error(p),i)return Y(1);throw p}const E=this.getPluginManager();try{!this.#h&&E.hasPlugins()&&(await E.init({cli:this,cwd:this.#u,logger:this.#t}),this.#h=!0),await E.executeLifecycle("execute",N),await E.executeLifecycle("beforeCommand",N);let p;const m=C.global;if(m?.help){const v=this.#n.get("help");if(!v)throw new P("Help command not found","COMMAND_NOT_FOUND");p=await K(v,N,C)}else if(m?.version??m?.V){const v=this.#n.get("version");if(!v)throw new P("Version command not found","COMMAND_NOT_FOUND");p=await K(v,N,C)}else p=await K(b,N,C);return await E.executeLifecycle("afterCommand",N,p),i?Y(0):void 0}catch(p){throw await E.executeErrorHandlers(p,N),p}finally{n&&this.dispose()}}async runCommand(e,n={}){const{argv:i=[],...r}=n;ce(e,"Command name");const o=e.split(" ").filter(Boolean),c=B(o),s=this.#o.get(c)?this.#i.get(c):this.#n.get(e);if(!s){const l=this.#s(),h=R(c||e,l);throw new V(e,h)}if(typeof s.execute!="function"&&typeof s.loader!="function")throw new P(`Command "${s.name}" has no function to execute`,"INVALID_COMMAND",{commandName:s.name});const g=[...ot(i,!1)];this.#t.debug(`running command '${e}' programmatically with args: ${g.join(", ")}`);const{commandArgs:a,toolbox:u}=this.#E(s,g,r,c||e),d=this.getPluginManager();try{!this.#h&&d.hasPlugins()&&(await d.init({cli:this,cwd:this.#u,logger:this.#t}),this.#h=!0),await d.executeLifecycle("execute",u),await d.executeLifecycle("beforeCommand",u);let l;const h=a.global;if(h?.help){const f=this.#n.get("help");if(!f)throw new P("Help command not found","COMMAND_NOT_FOUND");l=await K(f,u,a)}else if(h?.version??h?.V){const f=this.#n.get("version");if(!f)throw new P("Version command not found","COMMAND_NOT_FOUND");l=await K(f,u,a)}else l=await K(s,u,a);return await d.executeLifecycle("afterCommand",u,l),l}catch(l){throw await d.executeErrorHandlers(l,u),l}}clone(e){const n={...this.#e,...e},i=new Tt(this.#f,n);for(const[r,o]of this.#n)i.#n.set(r,o);for(const[r,o]of this.#o)i.#o.set(r,[...o]);for(const[r,o]of this.#i)i.#i.set(r,o);for(const r of this.#l)i.#l.push(r);return i.#a=this.#a,i.#r={...this.#r},i.#k(),i}async getAction(e){ce(e,"Command name");const n=e.split(" ").filter(Boolean),i=B(n),r=this.#o.get(i)?this.#i.get(i):this.#n.get(e);if(!r){const o=this.#s(),c=R(i||e,o);throw new V(e,c)}if(typeof r.execute=="function")return r.execute;if(typeof r.loader=="function")return Ot(r);throw new P(`Command "${r.name}" has no execute or loader defined`,"INVALID_COMMAND",{commandName:r.name})}}export{Tt as Cli};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
var U=Object.defineProperty;var s=(e,r)=>U(e,"name",{value:r,configurable:!0});import{createRequire as q}from"node:module";import{k as Dr,N as Jr,Q as Lr,G as Fr}from"./renderError-DxgI44AK-DFDWFoCr.js";import{p as Mr,V as Vr}from"./isVisulimaError-jVZgumOU-C4fgdbWg.js";const z=q(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=s(e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[r,t]=g.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return g.getBuiltinModule(e)}return z(e)},"__cjs_getBuiltinModule"),{createRequire:K}=B("node:module");var Y=Object.defineProperty,H=s((e,r)=>Y(e,"name",{value:r,configurable:!0}),"s$7"),X=Object.defineProperty,W=H((e,r)=>X(e,"name",{value:r,configurable:!0}),"o"),G=Object.defineProperty,x=W((e,r)=>G(e,"name",{value:r,configurable:!0}),"l");const A=x((e,r)=>{let t=0,n=r.length-2;for(;t<n;){const o=t+(n-t>>1);if(e<r[o])n=o-1;else if(e>=r[o+1])t=o+1;else{t=o;break}}return t},"binarySearch"),Q=/\n|\r(?!\n)/,Z=x(e=>e.split(Q).reduce((r,t)=>(r.push(r.at(-1)+t.length+1),r),[0]),"getLineStartIndexes"),jr=x((e,r,t)=>{const n=t?.skipChecks??!1;if(!n&&(!Array.isArray(e)&&typeof e!="string"||(typeof e=="string"||Array.isArray(e))&&e.length===0))return{column:0,line:0};if(!n&&(typeof r!="number"||typeof e=="string"&&r>=e.length||Array.isArray(e)&&r+1>=e.at(-1)))return{column:0,line:0};if(typeof e=="string"){const a=Z(e),i=A(r,a);return{column:r-a[i]+1,line:i+1}}const o=A(r,e);return{column:r-e[o]+1,line:o+1}},"indexToLineColumn");var ee=Object.defineProperty,re=s((e,r)=>ee(e,"name",{value:r,configurable:!0}),"t$5"),te=Object.defineProperty,ne=re((e,r)=>te(e,"name",{value:r,configurable:!0}),"i"),oe=Object.defineProperty,ae=ne((e,r)=>oe(e,"name",{value:r,configurable:!0}),"t");const Or=ae(({applicationType:e,error:r,file:t})=>`You are a very skilled ${t.language??"unknown"} programmer.
|
|
2
|
-
|
|
3
|
-
${e?`You are working on a ${e} application.`:""}
|
|
4
|
-
|
|
5
|
-
Use the following context to find a possible fix for the exception message at the end. Limit your answer to 4 or 5 sentences. Also include a few links to documentation that might help.
|
|
6
|
-
|
|
7
|
-
Use this format in your answer, make sure links are json:
|
|
8
|
-
|
|
9
|
-
FIX
|
|
10
|
-
insert the possible fix here
|
|
11
|
-
ENDFIX
|
|
12
|
-
LINKS
|
|
13
|
-
{"title": "Title link 1", "url": "URL link 1"}
|
|
14
|
-
{"title": "Title link 2", "url": "URL link 2"}
|
|
15
|
-
ENDLINKS
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
Here comes the context and the exception message:
|
|
19
|
-
|
|
20
|
-
Line: ${String(t.line)}
|
|
21
|
-
|
|
22
|
-
File:
|
|
23
|
-
${t.file}
|
|
24
|
-
|
|
25
|
-
Snippet including line numbers:
|
|
26
|
-
${t.snippet??""}
|
|
27
|
-
|
|
28
|
-
Exception class:
|
|
29
|
-
${r.name}
|
|
30
|
-
|
|
31
|
-
Exception message:
|
|
32
|
-
${r.message}`,"aiPrompt");var ie=Object.defineProperty,se=s((e,r)=>ie(e,"name",{value:r,configurable:!0}),"o$5"),ue=Object.defineProperty,ce=se((e,r)=>ue(e,"name",{value:r,configurable:!0}),"i"),le=Object.defineProperty,C=ce((e,r)=>le(e,"name",{value:r,configurable:!0}),"i");const T=C((e,r,t)=>{const n=t.indexOf(e);if(n===-1)return"";const o=n+e.length,a=t.indexOf(r,o);return a===-1?"":t.slice(o,a).trim()},"between"),Pr=C(e=>{const r=T("FIX","ENDFIX",e);if(!r)return["No solution found.",'Provide this response to the Maintainer of <a href="https://github.com/visulima/visulima/issues/new?assignees=&labels=s%3A+pending+triage%2Cc%3A+bug&projects=&template=bug_report.yml" target="_blank" rel="noopener noreferrer" class="text-blue-500 hover:underline inline-flex items-center text-sm">@visulima/error</a>.',`"${e}"`].join("</br></br>");const t=T("LINKS","ENDLINKS",e).split(`
|
|
33
|
-
`).map(n=>JSON.parse(n));return`${r.replaceAll(/"([^"]*)"(?:\s|\.)/g,"<code>$1</code> ")}
|
|
34
|
-
|
|
35
|
-
## Links
|
|
36
|
-
|
|
37
|
-
${t.map(n=>`- <a href="${n.url}" target="_blank" rel="noopener noreferrer">${n.title}</a>`).join(`
|
|
38
|
-
`)}
|
|
39
|
-
|
|
40
|
-
--------------------
|
|
41
|
-
This solution was generated with the <a href="https://sdk.vercel.ai/" target="_blank" rel="noopener noreferrer">AI SDK</a> and may not be 100% accurate.`},"aiSolutionResponse");var fe=Object.defineProperty,pe=s((e,r)=>fe(e,"name",{value:r,configurable:!0}),"i$4"),me=Object.defineProperty,de=pe((e,r)=>me(e,"name",{value:r,configurable:!0}),"r"),be=Object.defineProperty,ge=de((e,r)=>be(e,"name",{value:r,configurable:!0}),"n");const Er={handle:ge(e=>e.hint===void 0?Promise.resolve(void 0):typeof e.hint=="string"&&e.hint!==""?Promise.resolve({body:e.hint}):typeof e.hint=="object"&&typeof e.hint.body=="string"?Promise.resolve(e.hint):Array.isArray(e.hint)?Promise.resolve({body:e.hint.join(`
|
|
42
|
-
`)}):Promise.resolve(void 0),"handle"),name:"errorHint",priority:1};var ye=Object.defineProperty,ve=s((e,r)=>ye(e,"name",{value:r,configurable:!0}),"m$1"),he=Object.defineProperty,$e=ve((e,r)=>he(e,"name",{value:r,configurable:!0}),"m"),je=Object.defineProperty,u=$e((e,r)=>je(e,"name",{value:r,configurable:!0}),"t");const Oe=u(e=>`\`\`\`
|
|
43
|
-
${e.trim()}
|
|
44
|
-
\`\`\``,"code"),$=u(e=>`\`\`\`bash
|
|
45
|
-
${e.trim()}
|
|
46
|
-
\`\`\``,"bash"),j=u(e=>`\`\`\`ts
|
|
47
|
-
${e.trim()}
|
|
48
|
-
\`\`\``,"ts"),Pe=u(e=>`\`\`\`js
|
|
49
|
-
${e.trim()}
|
|
50
|
-
\`\`\``,"js"),p=u((e,...r)=>{const t=e.toLowerCase();return r.some(n=>t.includes(n.toLowerCase()))},"has"),Ee=[{name:"esm-cjs-interop",test:u(e=>{const{message:r}=e;if(p(r,"err_require_esm","cannot use import statement outside a module","must use import to load es module","require() of es module","does not provide an export named"))return{md:["Your project or a dependency may be mixing CommonJS and ES Modules.","","Try:","- Ensure package.json has the correct `type` (either `module` or `commonjs`).","- Use dynamic `import()` when requiring ESM from CJS.","- Prefer ESM-compatible entrypoints from dependencies.","- In Node, align `module` resolution with your bundler config.","","Check Node resolution:",$(`node -v
|
|
51
|
-
cat package.json | jq .type`),"","Example dynamic import in CJS:",Pe("(async () => { const mod = await import('some-esm'); mod.default(); })();")].join(`
|
|
52
|
-
`),title:"ESM/CJS interop"}},"test")},{name:"missing-default-export",test:u(e=>{const{message:r}=e;if(p(r,"default export not found","has no default export","does not provide an export named 'default'","is not exported from"))return{md:["Verify your import/export shapes.","","Default export example:",j(`export default function Component() {}
|
|
53
|
-
// import Component from './file'`),"","Named export example:",j(`export function Component() {}
|
|
54
|
-
// import { Component } from './file'`)].join(`
|
|
55
|
-
`),title:"Export mismatch (default vs named)"}},"test")},{name:"port-in-use",test:u(e=>{const{message:r}=e;if(p(r,"eaddrinuse","address already in use","listen eaddrinuse"))return{md:["Another process is using the port.","","Change the port or stop the other process.","","On macOS/Linux:",$(`lsof -i :3000
|
|
56
|
-
kill -9 <PID>`),"","On Windows (PowerShell):",$(`netstat -ano | findstr :3000
|
|
57
|
-
taskkill /PID <PID> /F`)].join(`
|
|
58
|
-
`),title:"Port already in use"}},"test")},{name:"file-not-found-or-case",test:u((e,r)=>{const{message:t}=e;if(p(t,"enoent","module not found","cannot find module"))return{md:["Check the import path and filename case (Linux/macOS are case-sensitive).","If using TS path aliases, verify `tsconfig.paths` and bundler aliases.","","Current file:",Oe(`${r.file}:${String(r.line)}`)].join(`
|
|
59
|
-
`),title:"Missing file or path case mismatch"}},"test")},{name:"ts-path-mapping",test:u(e=>{const{message:r}=e;if(p(r,"ts2307","cannot find module")||r.includes("TS2307"))return{md:["If you use path aliases, align TS `paths` with Vite/Webpack resolve aliases.","Ensure file extensions are correct and included in resolver.","","tsconfig.json excerpt:",j(`{
|
|
60
|
-
"compilerOptions": {
|
|
61
|
-
"baseUrl": ".",
|
|
62
|
-
"paths": { "@/*": ["src/*"] }
|
|
63
|
-
}
|
|
64
|
-
}`)].join(`
|
|
65
|
-
`),title:"TypeScript path mapping / resolution"}},"test")},{name:"network-dns-enotfound",test:u(e=>{const{message:r}=e;if(p(r,"enotfound","getaddrinfo enotfound","dns","fetch failed","ecconnrefused","econnrefused"))return{md:["The host may be unreachable or misconfigured.","","Try:","- Verify the hostname and protocol (http/https).","- Check VPN/proxy and firewall.","- Confirm the service is running and listening on the expected port.","",$(`ping <host>
|
|
66
|
-
nslookup <host>
|
|
67
|
-
curl -v http://<host>:<port>`)].join(`
|
|
68
|
-
`),title:"Network/DNS connection issue"}},"test")},{name:"undefined-property",test:u(e=>{const{message:r}=e;if(p(r,"cannot read properties of undefined","reading '"))return{md:["A variable or function returned `undefined`.","","Mitigations:","- Add nullish checks before property access.","- Validate function return values and input props/state.","",j("const value = maybe?.prop; // or: if (maybe) { use(maybe.prop) }")].join(`
|
|
69
|
-
`),title:"Accessing property of undefined"}},"test")}],Sr={handle:u((e,r)=>{try{const t=Ee.map(o=>({match:o.test(e,r),rule:o})).filter(o=>!!o.match);if(t.length===0)return Promise.resolve(void 0);const n=t.toSorted((o,a)=>(o.match.priority??0)-(a.match.priority??0)).map(o=>`#### ${o.match.title}
|
|
70
|
-
|
|
71
|
-
${o.match.md}`).join(`
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
`);return n===""?Promise.resolve(void 0):Promise.resolve({body:n,header:"### Potential fixes detected"})}catch{return Promise.resolve(void 0)}},"handle"),name:"ruleBasedHints",priority:0};var Se=Object.defineProperty,_=s((e,r)=>Se(e,"name",{value:r,configurable:!0}),"t$3"),we=Object.defineProperty,D=_((e,r)=>we(e,"name",{value:r,configurable:!0}),"t"),xe=Object.defineProperty,ke=D((e,r)=>xe(e,"name",{value:r,configurable:!0}),"s");let m=class extends Error{static{s(this,"i")}static{_(this,"c")}static{D(this,"e")}static{ke(this,"NonError")}constructor(r){super(r),this.name="NonError"}};var Ne=Object.defineProperty,Ae=s((e,r)=>Ne(e,"name",{value:r,configurable:!0}),"a$2"),Te=Object.defineProperty,Ie=Ae((e,r)=>Te(e,"name",{value:r,configurable:!0}),"a"),Ce=Object.defineProperty,_e=Ie((e,r)=>Ce(e,"name",{value:r,configurable:!0}),"e");const xr=_e(()=>{if(!Error.captureStackTrace)return;const e=new Error;return Error.captureStackTrace(e),e.stack},"captureRawStackTrace");var De=Object.defineProperty,Je=s((e,r)=>De(e,"name",{value:r,configurable:!0}),"E$1"),Le=Object.defineProperty,Fe=Je((e,r)=>Le(e,"name",{value:r,configurable:!0}),"E"),Re=Object.defineProperty,P=Fe((e,r)=>Re(e,"name",{value:r,configurable:!0}),"n");const v=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&v.set("AggregateError",AggregateError);const kr=P((e,r)=>{let t;try{t=new e}catch(o){throw new Error(`The error constructor "${e.name}" is not compatible`,{cause:o})}const n=r??t.name;if(v.has(n))throw new Error(`The error constructor "${n}" is already known.`);v.set(n,e)},"addKnownErrorConstructor");P(()=>new Map(v),"getKnownErrorConstructors");const J=P(e=>v.get(e),"getErrorConstructor"),E=P(e=>e!==null&&typeof e=="object"&&typeof e.name=="string"&&typeof e.message=="string"&&(J(e.name)!==void 0||e.name==="Error"),"isErrorLike");var Me=Object.defineProperty,Ve=s((e,r)=>Me(e,"name",{value:r,configurable:!0}),"O$1"),Ue=Object.defineProperty,qe=Ve((e,r)=>Ue(e,"name",{value:r,configurable:!0}),"O"),ze=Object.defineProperty,l=qe((e,r)=>ze(e,"name",{value:r,configurable:!0}),"s");const L=l(e=>{if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null},"isPlainObject"),Be={maxDepth:Number.POSITIVE_INFINITY},F=l((e,r,t=0)=>E(e)?k(e,r,t):r.maxDepth!==void 0&&t>=r.maxDepth?new m(JSON.stringify(e)):new m(JSON.stringify(e)),"deserializePlainObject"),Ke=l((e,r,t,n,o)=>{const a=r.map(i=>h(i,n,o+1));return new e(a,t)},"reconstructAggregateError"),k=l((e,r,t)=>{if(r.maxDepth!==void 0&&t>=r.maxDepth)return new m(JSON.stringify(e));const{cause:n,errors:o,message:a,name:i,stack:c,...b}=e,N=J(i)??Error,f=i==="AggregateError"&&Array.isArray(o)?Ke(N,o,a,r,t):new N(a);return!f.name&&i&&(f.name=i),a!==void 0&&(f.message=a),c&&(f.stack=c),Ye(f,b,n,i,r,t),n!==void 0&&(f.cause=h(n,r,t+1)),He(f,e),f},"reconstructError"),h=l((e,r,t)=>{if(L(e)){if(E(e))return F(e,r,t);const n={};for(const[o,a]of Object.entries(e))n[o]=h(a,r,t+1);return n}return Array.isArray(e)?e.map(n=>h(n,r,t)):e},"deserializeValue"),Ye=l((e,r,t,n,o,a)=>{const i=e;for(const[c,b]of Object.entries(r))if(!(c==="cause"&&t!==void 0)){if(c==="errors"&&n==="AggregateError")continue;i[c]=h(b,o,a+1)}},"restoreErrorProperties"),He=l((e,r)=>{const t=new Set(["message","name","stack"]);for(const n of Object.keys(r))t.add(n);for(const n of t)if(n in e){const o=Object.getOwnPropertyDescriptor(e,n);o&&!o.enumerable&&Object.defineProperty(e,n,{...o,enumerable:!0})}},"makePropertiesEnumerable"),I=l(e=>new m(JSON.stringify(e)),"handlePrimitive"),Xe=l(e=>new m(JSON.stringify(e)),"handleArray"),We=l((e,r)=>E(e)?k(e,r,0):F(e,r),"handlePlainObject"),Nr=l((e,r={})=>{const t={...Be,...r};return e instanceof Error?e:e===null?I(null):typeof e=="string"||typeof e=="number"||typeof e=="boolean"?I(e):Array.isArray(e)?Xe(e):E(e)?k(e,t,0):L(e)?We(e,t):new m(JSON.stringify(e))},"deserialize");var Ge=Object.defineProperty,Qe=s((e,r)=>Ge(e,"name",{value:r,configurable:!0}),"a"),Ze=Object.defineProperty,R=Qe((e,r)=>Ze(e,"name",{value:r,configurable:!0}),"n");const er=K(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,rr=R(e=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[r,t]=y.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return y.getBuiltinModule(e)}return er(e)},"__cjs_getBuiltinModule"),{inspect:tr}=rr("node:util");var nr=Object.defineProperty,or=R((e,r)=>nr(e,"name",{value:r,configurable:!0}),"s");const Ar=or(e=>{const r=new Set,t=[];let n=e;for(;n;){if(r.has(n)){console.error(`Circular reference detected in error causes: ${tr(e)}`);break}if(t.push(n),r.add(n),typeof n!="object"||!("cause"in n))break;n=n.cause}return t},"getErrorCauses");var ar=Object.defineProperty,ir=s((e,r)=>ar(e,"name",{value:r,configurable:!0}),"o"),sr=Object.defineProperty,ur=ir((e,r)=>sr(e,"name",{value:r,configurable:!0}),"n"),cr=Object.defineProperty,M=ur((e,r)=>cr(e,"name",{value:r,configurable:!0}),"s");const lr=M(e=>{const r=e.methodName&&e.methodName!=="<unknown>"?`${e.methodName} `:"",t=e.file??"<unknown>",n=String(e.line??0),o=String(e.column??0);return r.trim()?` at ${r}(${t}:${n}:${o})`:` at ${t}:${n}:${o}`},"formatStackFrameLine"),Tr=M((e,r)=>{const t=[];if(r?.header&&(r.header.name||r.header.message)){const n=r.header.name??"Error",o=r.header.message??"";t.push(`${n}${o?": ":""}${o}`)}for(const n of e)t.push(lr(n));return t.join(`
|
|
76
|
-
`)},"formatStacktrace");var fr=Object.defineProperty,pr=s((e,r)=>fr(e,"name",{value:r,configurable:!0}),"f"),mr=Object.defineProperty,dr=pr((e,r)=>mr(e,"name",{value:r,configurable:!0}),"b");const br=Object.create({},{cause:{enumerable:!1,value:void 0,writable:!0},code:{enumerable:!0,value:void 0,writable:!0},errors:{enumerable:!1,value:void 0,writable:!0},message:{enumerable:!1,value:void 0,writable:!0},name:{enumerable:!1,value:void 0,writable:!0},stack:{enumerable:!1,value:void 0,writable:!0}});var gr=Object.defineProperty,d=dr((e,r)=>gr(e,"name",{value:r,configurable:!0}),"i");const yr=d(e=>{if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return r===null||r===Object.prototype||Object.getPrototypeOf(r)===null},"isPlainObject"),S=new WeakSet,V=d(e=>{const r=Object.getOwnPropertyNames(e);for(const t of r){const n=Object.getOwnPropertyDescriptor(e,t);n&&(n.enumerable||Object.defineProperty(e,t,{...n,enumerable:!0}),n.value&&typeof n.value=="object"&&!Array.isArray(n.value)&&(Object.getPrototypeOf(n.value)===Object.prototype||Object.getPrototypeOf(n.value)===null)&&V(n.value))}},"makePropertiesEnumerable"),vr=d(e=>{S.add(e);const r=e.toJSON();return S.delete(e),Object.isExtensible(r)&&V(r),r},"toJSON"),w=d((e,r,t,n)=>{if(e&&e instanceof Uint8Array&&e.constructor.name==="Buffer")return"[object Buffer]";if(e!==null&&typeof e=="object"&&"pipe"in e&&typeof e.pipe=="function")return"[object Stream]";if(e instanceof Error)return r.has(e)?"[Circular]":(t+=1,O(e,n,r,t));if(n.useToJSON&&e!==null&&typeof e=="object"&&"toJSON"in e&&typeof e.toJSON=="function")return e.toJSON();if(e instanceof Date)return e.toISOString();if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(typeof e=="bigint")return`${String(e)}n`;if(yr(e)){if(n.maxDepth!==void 0&&n.maxDepth!==Number.POSITIVE_INFINITY&&t+1>=n.maxDepth)return{};t+=1;const o={};for(const a in e)o[a]=w(e[a],r,t,n);return o}try{return e}catch{return"[Not Available]"}},"serializeValue"),O=d((e,r,t,n)=>{if(t.add(e),r.maxDepth===0)return{};if(r.useToJSON&&typeof e.toJSON=="function"&&!S.has(e))return vr(e);const o=Object.create(br);if(Object.defineProperty(o,"name",{configurable:!0,enumerable:!0,value:Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,writable:!0}),Object.defineProperty(o,"message",{configurable:!0,enumerable:!0,value:e.message,writable:!0}),Object.defineProperty(o,"stack",{configurable:!0,enumerable:!0,value:e.stack,writable:!0}),Array.isArray(e.errors)){const i=[];for(const c of e.errors){if(!(c instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(t.has(c))return Object.defineProperty(o,"errors",{configurable:!0,enumerable:!0,value:[],writable:!0}),o;i.push(O(c,r,t,n))}Object.defineProperty(o,"errors",{configurable:!0,enumerable:!0,value:i,writable:!0})}const a=e.cause;if(a!=null)if(a instanceof Error)t.has(a)?Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:"[Circular]",writable:!0}):Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:O(a,r,t,n),writable:!0});else{const i=w(a,t,n,r);Object.defineProperty(o,"cause",{configurable:!0,enumerable:!0,value:i,writable:!0})}for(const i in e){if(i==="name"||i==="message"||i==="stack"||i==="cause"||i==="errors")continue;const c=e[i],b=w(c,t,n,r);Object.defineProperty(o,i,{configurable:!0,enumerable:!0,value:b,writable:!0})}if(Array.isArray(r.exclude)&&r.exclude.length>0)for(const i of r.exclude)try{delete o[i]}catch{}return o},"_serialize"),Ir=d((e,r={})=>O(e,{exclude:r.exclude??[],maxDepth:r.maxDepth??Number.POSITIVE_INFINITY,useToJSON:r.useToJSON??!1},new Set,0),"serialize");export{Dr as CODE_FRAME_POINTER,m as NonError,Mr as VisulimaError,kr as addKnownErrorConstructor,Or as aiPrompt,Pr as aiSolutionResponse,xr as captureRawStackTrace,Jr as codeFrame,Nr as deserializeError,Er as errorHintFinder,lr as formatStackFrameLine,Tr as formatStacktrace,Ar as getErrorCauses,jr as indexToLineColumn,E as isErrorLike,Vr as isVisulimaError,Lr as parseStacktrace,Fr as renderError,Sr as ruleBasedFinder,Ir as serializeError};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s=Object.defineProperty;var t=(r,e)=>s(r,"name",{value:e,configurable:!0});import{p as a}from"./isVisulimaError-jVZgumOU-C4fgdbWg.js";var i=Object.defineProperty,n=t((r,e)=>i(r,"name",{value:e,configurable:!0}),"e");class u extends a{static{t(this,"c")}static{n(this,"CerebroError")}code;context;constructor(e,o,c){super({message:e,name:"CerebroError"}),this.code=o,this.context=c}}export{u as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var n=Object.defineProperty;var a=(e,p)=>n(e,"name",{value:p,configurable:!0});var t=Object.defineProperty,c=a((e,p)=>t(e,"name",{value:p,configurable:!0}),"p"),g=Object.defineProperty,r=c((e,p)=>g(e,"name",{value:p,configurable:!0}),"e"),E=Object.defineProperty,S=r((e,p)=>E(e,"name",{value:p,configurable:!0}),"E");const i=String.raw,u=i`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,w=S(()=>new RegExp(i`\p{RI}{2}|(?)${u}(?:\u200D${u})*`,"gu"),"default");var R=Object.defineProperty,x=r((e,p)=>R(e,"name",{value:p,configurable:!0}),"p");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 s=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,b=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,l=w(),f=/[-_./\s]+/g,m=/(\u001B\[[0-9;]*[a-z])/i,d=new RegExp("\\p{Script=Arabic}","u"),y=new RegExp("\\p{Script=Bengali}","u"),B=new RegExp("\\p{Script=Cyrillic}","u"),v=new RegExp("\\p{Script=Devanagari}","u"),j=new RegExp("\\p{Script=Ethiopic}","u"),F=new RegExp("\\p{Script=Greek}","u"),O=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),h=new RegExp("\\p{Script=Gujarati}","u"),k=new RegExp("\\p{Script=Gurmukhi}","u"),G=new RegExp("\\p{Script=Hangul}","u"),H=new RegExp("\\p{Script=Hebrew}","u"),L=new RegExp("\\p{Script=Hiragana}","u"),M=new RegExp("\\p{Script=Han}","u"),P=new RegExp("\\p{Script=Kannada}","u"),T=new RegExp("\\p{Script=Katakana}","u"),K=new RegExp("\\p{Script=Khmer}","u"),z=new RegExp("\\p{Script=Lao}","u"),A=new RegExp("\\p{Script=Latin}","u"),C=new RegExp("\\p{Script=Malayalam}","u"),D=new RegExp("\\p{Script=Myanmar}","u"),q=new RegExp("\\p{Script=Oriya}","u"),I=new RegExp("\\p{Script=Sinhala}","u"),Z=new RegExp("\\p{Script=Tamil}","u"),_=new RegExp("\\p{Script=Telugu}","u"),$=new RegExp("\\p{Script=Thai}","u"),J=new RegExp("\\p{Script=Tibetan}","u"),N=/[\u02BB\u02BC\u0027]/u,Q=x(e=>e.replace(l,""),"stripEmoji");export{j as A,F as C,O as D,l as E,b as H,k as I,H as J,y as K,f as L,m as M,A as N,B as P,L as Q,d as T,M as U,P as V,T as W,K as X,C as Y,z as Z,G as _,D as a,q as e,s as h,J as i,$ as n,I as p,h as q,_ as r,Q as s,N as t,Z as u,v as z};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
var ge=Object.defineProperty;var d=(e,r)=>ge(e,"name",{value:r,configurable:!0});import{createRequire as we}from"node:module";import{h as O,H as E,E as U}from"./constants-DmzZF6_u-BmMwILI_.js";import{createTable as P}from"@visulima/tabular";import{NO_BORDER as M}from"@visulima/tabular/style";import $e from"@visulima/colorize/template";import{d as We}from"./runtime-process-DKHFvYkv.js";import{bold as Ne}from"@visulima/colorize";const be=we(import.meta.url),$=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,k=d(e=>{if(typeof $<"u"&&$.versions&&$.versions.node){const[r,t]=$.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return $.getBuiltinModule(e)}return be(e)},"__cjs_getBuiltinModule"),w=$,{execFileSync:ye}=k("node:child_process"),I=k("node:fs"),ve=k("node:tty"),Oe=k("node:os");var Ie=Object.defineProperty,Q=d((e,r)=>Ie(e,"name",{value:r,configurable:!0}),"u$2"),je=Object.defineProperty,L=Q((e,r)=>je(e,"name",{value:r,configurable:!0}),"l");const Ae=[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],xe=12288,Ee=65510,Se=[12288,12288,65281,65376,65504,65510],Pe=8361,Me=65518,Te=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],_e=32,Ce=10630,Re=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],ke=4352,Le=262141,ae=[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];var Fe=Object.defineProperty,Be=L((e,r)=>Fe(e,"name",{value:r,configurable:!0}),"r$1");const j=Be((e,r)=>{let t=0,i=Math.floor(e.length/2)-1;for(;t<=i;){const a=Math.floor((t+i)/2),s=a*2;if(r<e[s])i=a-1;else if(r>e[s+1])t=a+1;else return!0}return!1},"isInRange");var He=Object.defineProperty,b=L((e,r)=>He(e,"name",{value:r,configurable:!0}),"r");const te=19968,[ze,qe]=F(ae);function F(e){let r=e[0],t=e[1];for(let i=0;i<e.length;i+=2){const a=e[i],s=e[i+1];if(te>=a&&te<=s)return[a,s];s-a>t-r&&(r=a,t=s)}return[r,t]}d(F,"c$2");Q(F,"f");L(F,"k");b(F,"findWideFastPathRange");const oe=b(e=>e<161||e>1114109?!1:j(Ae,e),"isAmbiguous"),se=b(e=>e<xe||e>Ee?!1:j(Se,e),"isFullWidth"),Ve=b(e=>e<Pe||e>Me?!1:j(Te,e),"isHalfWidth"),Ye=b(e=>e<_e||e>Ce?!1:j(Re,e),"isNarrow"),le=b(e=>e>=ze&&e<=qe?!0:e<ke||e>Le?!1:j(ae,e),"isWide");function B(e){return oe(e)?"ambiguous":se(e)?"fullwidth":Ve(e)?"halfwidth":Ye(e)?"narrow":le(e)?"wide":"neutral"}d(B,"g$3");Q(B,"S");L(B,"getCategory");b(B,"getCategory");var De=Object.defineProperty,H=d((e,r)=>De(e,"name",{value:r,configurable:!0}),"i$2"),Ue=Object.defineProperty,z=H((e,r)=>Ue(e,"name",{value:r,configurable:!0}),"a"),Je=Object.defineProperty,X=z((e,r)=>Je(e,"name",{value:r,configurable:!0}),"e");function A(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}d(A,"s$1");H(A,"s");z(A,"r");X(A,"validate");function x(e){return A(e),B(e)}d(x,"r$3");H(x,"p");z(x,"eastAsianWidthType");X(x,"eastAsianWidthType");function Z(e,{ambiguousAsWide:r=!1}={}){return A(e),se(e)||le(e)||r&&oe(e)?2:1}d(Z,"o$2");H(Z,"W");z(Z,"eastAsianWidth");X(Z,"eastAsianWidth");var Ke=Object.defineProperty,Ge=d((e,r)=>Ke(e,"name",{value:r,configurable:!0}),"E"),Qe=Object.defineProperty,Xe=Ge((e,r)=>Qe(e,"name",{value:r,configurable:!0}),"A"),Ze=Object.defineProperty,q=Xe((e,r)=>Ze(e,"name",{value:r,configurable:!0}),"d");const ie=new Map,S=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,T=q(e=>e>=32&&e<=126?"latin":e===8203||e===8204||e===8205||e===8288?"zero":e<=31||e>=127&&e<=159?"control":e>=160&&e<=255||e>=9472&&e<=9599?"latin":e>=4352&&e<=4607||e>=11904&&e<=40959||e>=44032&&e<=55215||e>=63744&&e<=64255||e>=65280&&e<=65519&&!(e>=65377&&e<=65439)||e>=12352&&e<=12543?"wide":e===8230?"latin":"other","getCharType"),er=q((e,r)=>{const t=Math.floor(e/65536),i=e%65536;let a=ie.get(t);if(a||(a=new Map,ie.set(t,a)),a.has(i))return a.get(i);let s;if(T(e)==="latin")s=r.width.regular;else if(T(e)==="control")s=r.width.control;else if(T(e)==="wide")s=r.width.wide;else switch(x(e)){case"ambiguous":{s=r.width.ambiguousIsNarrow?r.width.regular:r.width.wide;break}case"fullwidth":{s=r.width.fullWidth;break}case"wide":{s=r.width.wide;break}default:s=r.width.regular}return a.set(i,s),s},"getCachedCharWidth"),rr=q(e=>e>=768&&e<=879||e>=6832&&e<=6911||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071||e>=917760&&e<=917999||e>=65024&&e<=65039||e>=3633&&e<=3642||e>=3655&&e<=3662||e>=3761&&e<=3769||e>=3771&&e<=3772||e>=3784&&e<=3789||e>=2304&&e<=2307||e>=2362&&e<=2383||e>=2385&&e<=2391||e>=2402&&e<=2403||e>=2433&&e<=2435||e>=2492&&e<=2500||e>=2509&&e<=2509||e>=2561&&e<=2563||e>=2620&&e<=2637||e>=1611&&e<=1631||e>=1648&&e<=1648||e>=1750&&e<=1773||e>=2276&&e<=2302||e>=1425&&e<=1469||e>=1471&&e<=1471||e>=1473&&e<=1474||e>=1476&&e<=1477||e>=1479&&e<=1479||e>=3893&&e<=3893||e>=3895&&e<=3895||e>=3897&&e<=3897||e>=3953&&e<=3966||e>=3968&&e<=3972||e>=3974&&e<=3975?!0:e>=768&&e<=777||e>=803&&e<=803,"isCombiningCharacter"),K=q((e,r={})=>{if(!e||e.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const t={truncation:{countAnsiEscapeCodes:r.countAnsiEscapeCodes??!1,ellipsis:r.ellipsis??"",ellipsisWidth:r.ellipsisWidth??(r.ellipsis?K(r.ellipsis,{...r,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:r.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:r.ambiguousIsNarrow??!1,ansi:r.ansiWidth??0,control:r.controlWidth??0,emoji:r.emojiWidth??2,fullWidth:r.fullWidth??2,halfWidth:r.halfWidth??1,regular:r.regularWidth??1,tab:r.tabWidth??8,wide:r.wideWidth??2}},i=Math.max(0,t.truncation.limit-t.truncation.ellipsisWidth),{length:a}=e,s=a>1e4;let n=0,o=0,l=a,u=!1;const y=e.includes("\x1B")||e.includes("");for(;n<a;){if(y&&(e[n]==="\x1B"||e[n]==="")){if(e.startsWith("\x1B]8;;",n)){const h="\x1B]8;;\x07",g=h.length,V=e.indexOf("\x07",n+5);if(V!==-1){const Y=e.indexOf(h,V+1);if(Y!==-1){const me=Y+g,pe=e.slice(V+1,Y).replace(O,""),re=K(pe,{ambiguousIsNarrow:t.width.ambiguousIsNarrow,ansiWidth:t.width.ansi,controlWidth:t.width.control,countAnsiEscapeCodes:!1,ellipsis:t.truncation.ellipsis,ellipsisWidth:t.truncation.ellipsisWidth,emojiWidth:t.width.emoji,fullWidth:t.width.fullWidth,halfWidth:t.width.halfWidth,limit:Math.max(0,i-o),regularWidth:t.width.regular,tabWidth:t.width.tab,wideWidth:t.width.wide}),D=re.width;if(re.truncated)u=!0,l=Math.min(l,n);else if(o+D>i&&(l=Math.min(l,n),u=!0,o+D>t.truncation.limit))break;if(o+=D,n=me,u&&o>=t.truncation.limit)break;continue}}}if(O.lastIndex=n,O.test(e)){const h=O.lastIndex-n,g=t.truncation.countAnsiEscapeCodes?h:t.width.ansi;if(o+g>i&&(l=Math.min(l,n),o+g>t.truncation.limit)){u=!0;break}o+=g,n=O.lastIndex;continue}}const m=e.codePointAt(n);if(m===8203||m===65279||m>=8288&&m<=8292){n+=1;continue}if(m===9){if(o+t.width.tab>i&&(l=Math.min(l,n),o+t.width.tab>t.truncation.limit)){u=!0;break}o+=t.width.tab,n+=1;continue}if(S.lastIndex=n,S.test(e)){const h=(S.lastIndex-n)*t.width.regular;if(o+h>i){const g=Math.floor((i-o)/t.width.regular);if(l=Math.min(l,n+g),o+h>t.truncation.limit){u=!0;break}}o+=h,n=S.lastIndex;continue}if((m<=31||m>=127&&m<=159)&&(E.lastIndex=n,E.test(e))){const h=(E.lastIndex-n)*t.width.control;if(o+h>i&&(l=Math.min(l,n+Math.floor((i-o)/t.width.control)),o+h>t.truncation.limit)){u=!0;break}o+=h,n=E.lastIndex;continue}if(U.lastIndex=n,U.test(e)){if(o+t.width.emoji>i&&(l=Math.min(l,n),o+t.width.emoji>t.truncation.limit)){u=!0;break}o+=t.width.emoji,n=U.lastIndex;continue}const v=e.codePointAt(n)??0;if(rr(v)){n+=v>65535?2:1;continue}let f;if(s)f=er(v,t);else switch(T(v)){case"control":{f=t.width.control;break}case"latin":{f=t.width.regular;break}case"wide":{f=t.width.wide;break}case"zero":{f=0;break}default:switch(x(v)){case"ambiguous":{f=t.width.ambiguousIsNarrow?t.width.regular:t.width.wide;break}case"fullwidth":{f=t.width.fullWidth;break}case"wide":{f=t.width.wide;break}default:f=t.width.regular}}if(o+f>i&&(l=Math.min(l,n),o+f>t.truncation.limit)){u=!0;break}o+=f,n+=v>65535?2:1}let W=o,ee=!1;return u&&t.truncation.limit>=t.truncation.ellipsisWidth&&(W=t.truncation.limit,ee=!0),{ellipsed:ee,index:u?l:a,truncated:u,width:W}},"getStringTruncatedWidth");var tr=Object.defineProperty,ir=d((e,r)=>tr(e,"name",{value:r,configurable:!0}),"i$1"),nr=Object.defineProperty,ar=ir((e,r)=>nr(e,"name",{value:r,configurable:!0}),"e"),or=Object.defineProperty,sr=ar((e,r)=>or(e,"name",{value:r,configurable:!0}),"r");const lr=sr((e,r={})=>K(e,{...r,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width,"getStringWidth");var dr=Object.defineProperty,p=d((e,r)=>dr(e,"name",{value:r,configurable:!0}),"n$1");const de=80,ue=24,G=p((e,r,{shell:t,env:i}={})=>ye(e,r,{encoding:"utf8",stdio:["ignore","pipe","ignore"],timeout:500,shell:t,env:i}).trim(),"exec"),_=p((e,r)=>({columns:Number.parseInt(e,10),rows:Number.parseInt(r,10)}),"create"),ce=p((e,r)=>{const{columns:t,rows:i}=_(e,r);if(!(Number.isNaN(t)||Number.isNaN(i))&&!(t===de&&i===ue))return{columns:t,rows:i}},"createIfNotDefault"),ur=p(()=>{if(w.platform!=="linux")return!0;try{const e=I.readFileSync("/proc/self/stat","utf8"),r=e.lastIndexOf(") ");if(r===-1)return!1;const t=e.slice(r+2).trim().split(/\s+/),i=Number.parseInt(t[2],10),a=Number.parseInt(t[5],10);return Number.isNaN(i)||Number.isNaN(a)||a<=0?!1:i===a}catch{return!1}},"isForegroundProcess");function fe(){const{env:e,stdout:r,stderr:t}=w;if(r?.columns&&r?.rows)return _(r.columns,r.rows);if(t?.columns&&t?.rows)return _(t.columns,t.rows);if(e.COLUMNS&&e.LINES)return _(e.COLUMNS,e.LINES);const i={columns:de,rows:ue};return w.platform==="win32"?J()??i:w.platform==="darwin"?ne()??J()??i:ne()??J()??cr()??i}d(fe,"O$1");p(fe,"terminalSize");const ne=p(()=>{try{const e=w.platform==="darwin"?I.constants.O_EVTONLY|I.constants.O_NONBLOCK:I.constants.O_NONBLOCK,{columns:r,rows:t}=ve.WriteStream(I.openSync("/dev/tty",e));return{columns:r,rows:t}}catch{}},"devTty"),J=p(()=>{try{const e=G("tput",["cols"],{env:{TERM:"dumb",...w.env}}),r=G("tput",["lines"],{env:{TERM:"dumb",...w.env}});if(e&&r)return ce(e,r)}catch{}},"tput"),cr=p(()=>{try{if(!ur())return;const e=G("resize",["-u"]).match(/\d+/g);if(e.length===2)return ce(e[0],e[1])}catch{}},"resize");var fr=Object.defineProperty,hr=d((e,r)=>fr(e,"name",{value:r,configurable:!0}),"s");const N=new Map,mr=500,c=hr(e=>{if(!e||e==="")return"";const r=N.get(e);if(r!==void 0)return r;const t=$e(Object.assign([],{raw:[e]}));if(N.size>=mr){const i=N.keys().next().value;i!==void 0&&N.delete(i)}return N.set(e,t),t},"templateFormat");var pr=Object.defineProperty,gr=d((e,r)=>pr(e,"name",{value:r,configurable:!0}),"t$1");const C=gr(()=>{const e=We().CEREBRO_TERMINAL_WIDTH;if(e===void 0)return;const r=Number.parseInt(e,10);if(!(Number.isNaN(r)||r<=0))return r},"getTerminalWidth");var wr=Object.defineProperty,br=d((e,r)=>wr(e,"name",{value:r,configurable:!0}),"t");class he{static{d(this,"n")}static{br(this,"BaseSection")}lines;constructor(){this.lines=[]}add(r){this.lines.push(r)}toString(){return this.lines.join(Oe.EOL)}header(r){this.add(Ne(r)),this.lines.push("")}}var yr=Object.defineProperty,R=d((e,r)=>yr(e,"name",{value:r,configurable:!0}),"g");const vr=R(e=>e!==void 0&&e>0?e:fe().columns,"resolveTerminalWidth"),$r=R((e,r,t,i)=>{if(e.length===0||e.some(u=>u.length!==2))return;let a=0;for(const u of e){const y=u[0];if(y===void 0)continue;const W=lr(y);W>a&&(a=W)}if(a===0)return;const s=t+i,n=a+s,o=20+s;if(n+o>r)return;const l=r-n;return[n,l]},"computeColumnWidths");class Wr extends he{static{d(this,"S")}static{R(this,"ContentSection")}constructor(r){if(super(),r.header&&this.header(c(r.header)),r.content){if(r.raw)if(Array.isArray(r.content)&&r.content.every(t=>typeof t=="string"))r.content.forEach(t=>{Array.isArray(t)?t.forEach(i=>{this.add(c(i))}):this.add(c(t))});else if(typeof r.content=="string")this.add(c(r.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(r.content));this.add("")}}getContentLines(r){if(typeof r=="string"){const t=P({showHeader:!1,style:{border:M,paddingLeft:4,paddingRight:1},terminalWidth:C(),truncateOverflow:!1,wordWrap:!0});return t.addRow([c(r)]),t.toString()}if(Array.isArray(r)&&r.every(t=>typeof t=="string"||Array.isArray(t)&&t.every(i=>typeof i=="string"))){const t=vr(C()),i=R(o=>Array.isArray(o)?o.map(l=>c(l)):[c(o)],"formatRow"),a=r.map(o=>i(o)),s=$r(a,t,4,1),n=P({columnWidths:s,showHeader:!1,style:{border:M,paddingLeft:4,paddingRight:1},terminalWidth:t,truncateOverflow:!1,wordWrap:!0});return a.forEach(o=>{s!==void 0&&o.length===2?n.addRow([{content:o[0],wordWrap:!1},o[1]]):n.addRow(o)}),n.toString()}if(typeof r=="object"){const t=r;if(!t.options||!t.data)throw new Error(`Must have an "options" or "data" property
|
|
2
|
-
${JSON.stringify(r)}`);const i=P({showHeader:!1,style:{border:M,paddingLeft:4,paddingRight:1},terminalWidth:C(),truncateOverflow:!1,wordWrap:!0});return t.data.forEach(a=>{Array.isArray(a)?i.addRow(a.map(s=>c(s))):i.addRow([c(a)])}),i.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
|
|
3
|
-
|
|
4
|
-
${JSON.stringify(r)}`)}}var Or=Object.defineProperty,Nr=d((e,r)=>Or(e,"name",{value:r,configurable:!0}),"m");class Ir extends he{static{d(this,"O")}static{Nr(this,"OptionListSection")}constructor(r){super();let t=r.optionList??[];const i=Array.isArray(r.hide)?r.hide:[r.hide].filter(n=>typeof n=="string"),a=Array.isArray(r.group)?r.group:[r.group].filter(n=>typeof n=="string");i.length>0&&(t=t.filter(n=>!i.includes(n.name))),r.header&&this.header(c(r.header)),a.length>0&&(t=t.filter(n=>{const o=n,l=a.includes("_none")&&!o.group,u=o.group,y=this.intersect(Array.isArray(u)?u:[u],a);return l||y?n:void 0}));const s=P({showHeader:!1,style:{border:M,paddingLeft:2,paddingRight:1,...r.tableOptions?.style},terminalWidth:C()??r.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:r.tableOptions?.wordWrap??!0,...r.tableOptions});t.forEach(n=>{const o=n;s.addRow([this.getOptionNames(o,r.reverseNameOrder??!1,r.isArgument??!1),c(o.description)])}),this.add(s.toString()),this.lines.push("")}getOptionNames(r,t,i){if(!r.name)throw new TypeError("Invalid option definition, name is required.");let a=r.type?r.type.name.toLowerCase():"string";const s=r.multiple||r.lazyMultiple?"[]":"";a=c(r.typeLabel??`{underline ${a}${s}}`);let n;if(r.alias)if(r.name){const o=i?r.name:`{yellow --${r.name}}`;n=c(t?`{bold ${o}}, {bold -${r.alias}} ${a}`:`{bold -${r.alias}}, {bold ${o}} ${a}`)}else t?n=c(`{bold -${r.alias}} ${a}`):n=c(`{bold -${r.alias}} ${a}`);else n=c(`{bold ${i?r.name:`{yellow --${r.name}}`}} ${a}`);return n}intersect(r,t){return r.some(i=>t.includes(i))}}var jr=Object.defineProperty,Ar=d((e,r)=>jr(e,"name",{value:r,configurable:!0}),"o");const Rr=Ar(e=>(Array.isArray(e)?e:[e]).length===0?"":`
|
|
5
|
-
${e.map(r=>r.optionList?new Ir(r).toString():new Wr(r).toString()).join(`
|
|
6
|
-
`)}`,"commandLineUsage");export{c as f,Rr as p};
|