@visulima/cerebro 3.0.0-alpha.31 → 3.0.0-alpha.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/LICENSE.md +841 -6
  3. package/README.md +38 -8
  4. package/dist/commands/completion-command.d.ts +1 -1
  5. package/dist/commands/completion-command.js +1 -1
  6. package/dist/commands/help-command.d.ts +1 -1
  7. package/dist/commands/help-command.js +1 -1
  8. package/dist/commands/readme-command.d.ts +1 -1
  9. package/dist/commands/readme-command.js +19 -19
  10. package/dist/commands/version-command.d.ts +1 -1
  11. package/dist/index.d.ts +18 -3
  12. package/dist/index.js +1 -1
  13. package/dist/logger/create-pail-logger.d.ts +29 -4
  14. package/dist/logger/create-pail-logger.js +1 -1
  15. package/dist/packem_chunks/has-new-version.js +1 -1
  16. package/dist/packem_shared/Cerebro-BsroI2VY.js +4 -0
  17. package/dist/packem_shared/VisulimaError-DTMgXonA-CzaryRgZ.js +1 -0
  18. package/dist/packem_shared/VisulimaError-DyMHh9O-.js +76 -0
  19. package/dist/packem_shared/cerebro-error-z8DS5U8c.js +1 -0
  20. package/dist/packem_shared/{plugin-manager.d-BSQtHbWS.d.ts → command.d-DbhtfXF4.d.ts} +235 -216
  21. package/dist/packem_shared/index-BSKOOIL6.js +29 -0
  22. package/dist/packem_shared/{index.d-Br8HpP0A.d.ts → index.d-BL4NtVR3.d.ts} +37 -3
  23. package/dist/packem_shared/renderError-Dqej8k13-BmipVhik.js +25 -0
  24. package/dist/packem_shared/{runtime-process-hJz7FqPN.js → runtime-process-Dmz0vCJy.js} +1 -1
  25. package/dist/packem_shared/split-by-case-C-dbSFCl.js +1 -0
  26. package/dist/plugins/error-handler-plugin.d.ts +2 -2
  27. package/dist/plugins/error-handler-plugin.js +1 -1
  28. package/dist/plugins/runtime-version-check-plugin.d.ts +1 -1
  29. package/dist/plugins/runtime-version-check-plugin.js +1 -1
  30. package/dist/plugins/update-notifier/update-notifier-plugin.d.ts +11 -4
  31. package/dist/plugins/update-notifier/update-notifier-plugin.js +1 -1
  32. package/dist/util/general/heap-tuning.js +1 -1
  33. package/package.json +7 -7
  34. package/dist/packem_shared/Cerebro-ChUYLbTK.js +0 -4
  35. package/dist/packem_shared/VisulimaError-CVxSPzeQ.js +0 -76
  36. package/dist/packem_shared/cerebro-error-etNTKvnJ.js +0 -1
  37. package/dist/packem_shared/constants-CImsldtV-Ces7vzH9.js +0 -1
  38. package/dist/packem_shared/index-B5zrpT20.js +0 -6
  39. package/dist/packem_shared/isVisulimaError-jVZgumOU-C67qeq6-.js +0 -1
  40. package/dist/packem_shared/renderError-DJiY-69l-s_7rEsoy.js +0 -25
  41. /package/dist/packem_shared/{VERBOSITY_QUIET-XPultrIA.js → VERBOSITY_DEBUG-XPultrIA.js} +0 -0
@@ -1,6 +0,0 @@
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};
@@ -1 +0,0 @@
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};
@@ -1,25 +0,0 @@
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 _};