@visulima/error 4.6.2 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/error/index.d.ts +2 -1
  3. package/dist/error/index.js +1 -0
  4. package/dist/index.js +1 -0
  5. package/dist/packem_shared/aiFinder-McmYwPGR.js +1 -0
  6. package/dist/packem_shared/deserializeError-BJM8Kd6G.js +1 -0
  7. package/dist/packem_shared/getErrorCauses-geeK5cwE.js +1 -0
  8. package/dist/packem_shared/renderError-ZMlMvw1N.js +18 -0
  9. package/dist/packem_shared/serializeError-CTpDr3CL.js +1 -0
  10. package/dist/solution/ai/ai-prompt.d.ts +1 -1
  11. package/dist/solution/ai/index.js +1 -0
  12. package/dist/solution/index.js +1 -0
  13. package/dist/stacktrace/index.d.ts +2 -1
  14. package/dist/stacktrace/index.js +1 -0
  15. package/package.json +17 -87
  16. package/dist/code-frame/index.cjs +0 -6
  17. package/dist/code-frame/index.d.cts +0 -7
  18. package/dist/code-frame/index.d.mts +0 -7
  19. package/dist/error/index.cjs +0 -1
  20. package/dist/error/index.d.cts +0 -95
  21. package/dist/error/index.d.mts +0 -95
  22. package/dist/error/index.mjs +0 -1
  23. package/dist/index.cjs +0 -1
  24. package/dist/index.d.cts +0 -17
  25. package/dist/index.d.mts +0 -17
  26. package/dist/index.mjs +0 -1
  27. package/dist/packem_shared/NonError-CQn4sdxd.cjs +0 -1
  28. package/dist/packem_shared/addKnownErrorConstructor-B5dNFGsR.cjs +0 -1
  29. package/dist/packem_shared/ai-solution-response-BuaDQAEU.d.cts +0 -3
  30. package/dist/packem_shared/ai-solution-response-BuaDQAEU.d.mts +0 -3
  31. package/dist/packem_shared/aiFinder-Be-xHFVO.mjs +0 -1
  32. package/dist/packem_shared/aiFinder-CN0pneE2.cjs +0 -1
  33. package/dist/packem_shared/aiSolutionResponse-C5apAmTu.cjs +0 -10
  34. package/dist/packem_shared/captureRawStackTrace-B9d1821F.cjs +0 -1
  35. package/dist/packem_shared/deserializeError-2C6o7QF7.cjs +0 -1
  36. package/dist/packem_shared/deserializeError-tzZhIV70.mjs +0 -1
  37. package/dist/packem_shared/errorHintFinder-DRCn1Ysx.cjs +0 -2
  38. package/dist/packem_shared/formatStackFrameLine-DD2DUdW0.cjs +0 -2
  39. package/dist/packem_shared/getErrorCauses-B7_Z_gEF.cjs +0 -1
  40. package/dist/packem_shared/getErrorCauses-D025FGyO.mjs +0 -1
  41. package/dist/packem_shared/index-CqSGigts.cjs +0 -1
  42. package/dist/packem_shared/indexToLineColumn-C_v57REF.cjs +0 -1
  43. package/dist/packem_shared/isVisulimaError-CrvBm0kw.cjs +0 -1
  44. package/dist/packem_shared/parseStacktrace-MW4-SLXl.cjs +0 -2
  45. package/dist/packem_shared/renderError-D7R71d_7.mjs +0 -18
  46. package/dist/packem_shared/renderError-D8XJnkIF.cjs +0 -18
  47. package/dist/packem_shared/ruleBasedFinder-B1jRHBM_.cjs +0 -34
  48. package/dist/packem_shared/serializeError-7S1IG6zs.cjs +0 -1
  49. package/dist/packem_shared/serializeError-Bc-QciX0.mjs +0 -1
  50. package/dist/packem_shared/types-BtQS7FHG.d.cts +0 -20
  51. package/dist/packem_shared/types-BtQS7FHG.d.mts +0 -20
  52. package/dist/packem_shared/types-CrVmNoPV.d.cts +0 -25
  53. package/dist/packem_shared/types-CrVmNoPV.d.mts +0 -25
  54. package/dist/solution/ai/ai-prompt.cjs +0 -32
  55. package/dist/solution/ai/ai-prompt.d.cts +0 -9
  56. package/dist/solution/ai/ai-prompt.d.mts +0 -9
  57. package/dist/solution/ai/index.cjs +0 -1
  58. package/dist/solution/ai/index.d.cts +0 -16
  59. package/dist/solution/ai/index.d.mts +0 -16
  60. package/dist/solution/ai/index.mjs +0 -1
  61. package/dist/solution/index.cjs +0 -1
  62. package/dist/solution/index.d.cts +0 -8
  63. package/dist/solution/index.d.mts +0 -8
  64. package/dist/solution/index.mjs +0 -1
  65. package/dist/stacktrace/index.cjs +0 -1
  66. package/dist/stacktrace/index.d.cts +0 -25
  67. package/dist/stacktrace/index.d.mts +0 -25
  68. package/dist/stacktrace/index.mjs +0 -1
  69. /package/dist/code-frame/{index.mjs → index.js} +0 -0
  70. /package/dist/packem_shared/{NonError-CS10kwil.mjs → NonError-CS10kwil.js} +0 -0
  71. /package/dist/packem_shared/{addKnownErrorConstructor-BqqnTSZp.mjs → addKnownErrorConstructor-BqqnTSZp.js} +0 -0
  72. /package/dist/packem_shared/{aiSolutionResponse-RD0AK1jh.mjs → aiSolutionResponse-RD0AK1jh.js} +0 -0
  73. /package/dist/packem_shared/{captureRawStackTrace-CQPNHvBG.mjs → captureRawStackTrace-CQPNHvBG.js} +0 -0
  74. /package/dist/packem_shared/{errorHintFinder-C_g0nvml.mjs → errorHintFinder-C_g0nvml.js} +0 -0
  75. /package/dist/packem_shared/{formatStackFrameLine-iU54KA81.mjs → formatStackFrameLine-iU54KA81.js} +0 -0
  76. /package/dist/packem_shared/{index-CLFYRLyq.mjs → index-CLFYRLyq.js} +0 -0
  77. /package/dist/packem_shared/{indexToLineColumn-B1F7aNZh.mjs → indexToLineColumn-B1F7aNZh.js} +0 -0
  78. /package/dist/packem_shared/{isVisulimaError-jVZgumOU.mjs → isVisulimaError-jVZgumOU.js} +0 -0
  79. /package/dist/packem_shared/{parseStacktrace-Dnxnc4PL.mjs → parseStacktrace-Dnxnc4PL.js} +0 -0
  80. /package/dist/packem_shared/{ruleBasedFinder-P88d0gpK.mjs → ruleBasedFinder-P88d0gpK.js} +0 -0
  81. /package/dist/solution/ai/{ai-prompt.mjs → ai-prompt.js} +0 -0
@@ -1 +0,0 @@
1
- var Pt=Object.defineProperty;var W=(n,o)=>Pt(n,"name",{value:o,configurable:!0});import{createHash as _t}from"node:crypto";import{existsSync as xe,readFileSync as It,mkdirSync as Zt,writeFileSync as Dt}from"node:fs";import{tmpdir as Et}from"node:os";import{generateText as Ft}from"ai";import Nt from"../solution/ai/ai-prompt.mjs";import J from"./aiSolutionResponse-RD0AK1jh.mjs";var Bt=Object.defineProperty,H=W((n,o)=>Bt(n,"name",{value:o,configurable:!0}),"I"),Rt=Object.defineProperty,u=H((n,o)=>Rt(n,"name",{value:o,configurable:!0}),"__name$2");let de=u(()=>{var n=(()=>{var o=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,m=u((e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})},"J"),b=u((e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of l(t))!d.call(e,i)&&i!==r&&o(e,i,{get:u(()=>t[i],"get"),enumerable:!(s=a(t,i))||s.enumerable});return e},"T"),g=u(e=>b(o({},"__esModule",{value:!0}),e),"W"),C={};m(C,{zeptomatch:u(()=>Mt,"zeptomatch")});var w=u(e=>Array.isArray(e),"k"),x=u(e=>typeof e=="function","x"),O=u(e=>e.length===0,"K"),_=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return r=>(r.length===0||r.length===1)&&t.test(e.call(r))})(),we=u(e=>typeof e=="number","Y"),je=u(e=>typeof e=="object"&&e!==null,"rr"),Ae=u(e=>e instanceof RegExp,"er"),Oe=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Me=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),Y=u(e=>typeof e=="string","M"),M=u(e=>e===void 0,"f"),ze=u(e=>{const t=new Map;return r=>{const s=t.get(r);if(s!==void 0)return s;const i=e(r);return t.set(r,i),i}},"ar"),ke=u((e,t,r={})=>{const s={cache:{},input:e,index:0,indexBacktrackMax:0,options:r,output:[]},i=z(t)(s),f=Math.max(s.index,s.indexBacktrackMax);if(i&&s.index===e.length)return s.output;throw new Error(`Failed to parse at index ${f}`)},"or"),c=u((e,t)=>w(e)?Ce(e,t):Y(e)?Q(e,t):Se(e,t),"o"),Ce=u((e,t)=>{const r={};for(const s of e){if(s.length!==1)throw new Error(`Invalid character: "${s}"`);const i=s.charCodeAt(0);r[i]=!0}return s=>{const i=s.input;let f=s.index,p=f;for(;p<i.length&&i.charCodeAt(p)in r;)p+=1;if(p>f){if(!M(t)&&!s.options.silent){const h=i.slice(f,p),y=x(t)?t(h,i,`${f}`):t;M(y)||s.output.push(y)}s.index=p}return!0}},"ir"),Se=u((e,t)=>{if(Me(e))return Q(e.source,t);{const r=e.source,s=e.flags.replace(/y|$/,"y"),i=new RegExp(r,s);return Oe(e)&&x(t)&&!_(t)?Pe(i,t):_e(i,t)}},"ur"),Pe=u((e,t)=>r=>{const s=r.index,i=r.input;e.lastIndex=s;const f=e.exec(i);if(f){const p=e.lastIndex;if(!r.options.silent){const h=t(...f,i,`${s}`);M(h)||r.output.push(h)}return r.index=p,!0}else return!1},"sr"),_e=u((e,t)=>r=>{const s=r.index,i=r.input;if(e.lastIndex=s,e.test(i)){const f=e.lastIndex;if(!M(t)&&!r.options.silent){const p=x(t)?t(i.slice(s,f),i,`${s}`):t;M(p)||r.output.push(p)}return r.index=f,!0}else return!1},"cr"),Q=u((e,t)=>r=>{const s=r.index,i=r.input;if(i.startsWith(e,s)){if(!M(t)&&!r.options.silent){const f=x(t)?t(e,i,`${s}`):t;M(f)||r.output.push(f)}return r.index+=e.length,!0}else return!1},"R"),V=u((e,t,r,s)=>{const i=z(e),f=t>1;return B(N(X(p=>{let h=0;for(;h<r;){const y=p.index;if(!i(p)||(h+=1,p.index===y))break}return h>=t},f),s))},"O"),Ie=u((e,t)=>V(e,0,1,t),"lr"),D=u((e,t)=>V(e,0,1/0,t),"m"),E=u((e,t)=>{const r=e.map(z);return B(N(X(s=>{for(let i=0,f=r.length;i<f;i++)if(!r[i](s))return!1;return!0}),t))},"_"),j=u((e,t)=>{const r=e.map(z);return B(N(s=>{for(let i=0,f=r.length;i<f;i++)if(r[i](s))return!0;return!1},t))},"p"),X=u((e,t=!0,r=!1)=>{const s=z(e);return t?i=>{const f=i.index,p=i.output.length,h=s(i);return!h&&!r&&(i.indexBacktrackMax=Math.max(i.indexBacktrackMax,i.index)),(!h||r)&&(i.index=f,i.output.length!==p&&(i.output.length=p)),h}:s},"P"),N=u((e,t)=>{const r=z(e);return t?s=>{if(s.options.silent)return r(s);const i=s.output.length;if(r(s)){const f=s.output.splice(i,1/0),p=t(f);return M(p)||s.output.push(p),!0}else return!1}:r},"C"),B=(()=>{let e=0;return t=>{const r=z(t),s=e+=1;return i=>{var f;if(i.options.memoization===!1)return r(i);const p=i.index,h=(f=i.cache)[s]||(f[s]={indexMax:-1,queue:[]}),y=h.queue;if(p<=h.indexMax){const I=h.store||(h.store=new Map);if(y.length){for(let P=0,kt=y.length;P<kt;P+=2){const Ct=y[P*2],St=y[P*2+1];I.set(Ct,St)}y.length=0}const v=I.get(p);if(v===!1)return!1;if(we(v))return i.index=v,!0;if(v)return i.index=v.index,v.output?.length&&i.output.push(...v.output),!0}const pe=i.output.length,zt=r(i);if(h.indexMax=Math.max(h.indexMax,p),zt){const I=i.index,v=i.output.length;if(v>pe){const P=i.output.slice(pe,v);y.push(p,{index:I,output:P})}else y.push(p,I);return!0}else return y.push(p,!1),!1}}})(),ee=u(e=>{let t;return r=>(t||(t=z(e())),t(r))},"A"),z=ze(e=>{if(x(e))return O(e)?ee(e):e;if(Y(e)||Ae(e))return c(e);if(w(e))return E(e);if(je(e))return j(Object.values(e));throw new Error("Invalid rule")}),A=u(e=>e,"v"),te=u(e=>t=>ke(t,e,{memoization:!1}).join(""),"z"),Ze=u(e=>{const t={};return r=>t[r]??(t[r]=e(r))},"pr"),ne="abcdefghijklmnopqrstuvwxyz",De=u(e=>{let t="";for(;e>0;){const r=(e-1)%26;t=ne[r]+t,e=Math.floor((e-1)/26)}return t},"vr"),re=u(e=>{let t=0;for(let r=0,s=e.length;r<s;r++)t=t*26+ne.indexOf(e[r])+1;return t},"N"),R=u((e,t)=>{if(t<e)return R(t,e);const r=[];for(;e<=t;)r.push(e++);return r},"$"),Ee=u((e,t,r)=>R(e,t).map(s=>String(s).padStart(r,"0")),"fr"),oe=u((e,t)=>R(re(e),re(t)).map(De),"j"),T=c(/\\./,A),Fe=c(/[$.*+?^(){}[\]\|]/,e=>`\\${e}`),Ne=c(/./,A),Be=c(/^(?:!!)*!(.*)$/,(e,t)=>`(?!^${fe(t)}$).*?`),Re=c(/^(!!)+/,""),Te=j([Be,Re]),We=c(/\/(\*\*\/)+/,"(?:[\\\\/].+[\\\\/]|[\\\\/])"),Je=c(/^(\*\*\/)+/,"(?:^|.*[\\\\/])"),Le=c(/\/(\*\*)$/,"(?:[\\\\/].*|$)"),qe=c(/\*\*/,".*"),ie=j([We,Je,Le,qe]),Ke=c(/\*\/(?!\*\*\/|\*$)/,"[^\\\\/]*[\\\\/]"),Ue=c(/\*/,"[^\\\\/]*"),ae=j([Ke,Ue]),se=c("?","[^\\\\/]"),Ge=c("[",A),He=c("]",A),Ye=c(/[!^]/,"^\\\\/"),Qe=c(/[a-z]-[a-z]|[0-9]-[0-9]/i,A),Ve=c(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Xe=c(/[^\]]/,A),et=j([T,Ve,Qe,Xe]),le=E([Ge,Ie(Ye),D(et),He]),tt=c("{","(?:"),nt=c("}",")"),rt=c(/(\d+)\.\.(\d+)/,(e,t,r)=>Ee(+t,+r,Math.min(t.length,r.length)).join("|")),ot=c(/([a-z]+)\.\.([a-z]+)/,(e,t,r)=>oe(t,r).join("|")),it=c(/([A-Z]+)\.\.([A-Z]+)/,(e,t,r)=>oe(t.toLowerCase(),r.toLowerCase()).join("|").toUpperCase()),at=j([rt,ot,it]),ue=E([tt,at,nt]),st=c("{","(?:"),lt=c("}",")"),ut=c(",","|"),ct=c(/[$.*+?^(){[\]\|]/,e=>`\\${e}`),ft=c(/[^}]/,A),pt=ee(()=>ce),dt=j([ie,ae,se,le,ue,pt,T,ct,ut,ft]),ce=E([st,D(dt),lt]),ht=D(j([Te,ie,ae,se,le,ue,ce,T,Fe,Ne])),gt=ht,mt=te(gt),fe=mt,xt=c(/\\./,A),$t=c(/./,A),yt=c(/\*\*\*+/,"*"),bt=c(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),vt=c(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),wt=D(j([xt,yt,bt,vt,$t])),jt=wt,At=te(jt),Ot=At,F=u((e,t)=>Array.isArray(e)?e.map(F.compile).some(r=>r.test(t)):F.compile(e).test(t),"S");F.compile=Ze(e=>new RegExp(`^${fe(Ot(e))}[\\\\/]?$`,"s"));var Mt=F;return g(C)})();return n.default||n},"_lazyMatch"),L;const Tt=u((n,o)=>(L||(L=de(),de=null),L(n,o)),"default");var Wt=Object.defineProperty,Jt=H((n,o)=>Wt(n,"name",{value:o,configurable:!0}),"__name$1");const Lt=/^[A-Z]:\//i,S=Jt((n="")=>n&&n.replaceAll("\\","/").replace(Lt,o=>o.toUpperCase()),"normalizeWindowsPath");var qt=Object.defineProperty,$=H((n,o)=>qt(n,"name",{value:o,configurable:!0}),"__name");const Kt=/^[/\\]{2}/,Ut=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,$e=/^[A-Z]:$/i,he=/^\/([A-Z]:)?$/i,Gt=/.(\.[^./]+)$/,Ht=/^[/\\]|^[a-z]:[/\\]/i,Yt=$(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),ye=$((n,o)=>{let a="",l=0,d=-1,m=0,b=null;for(let g=0;g<=n.length;++g){if(g<n.length)b=n[g];else{if(b==="/")break;b="/"}if(b==="/"){if(!(d===g-1||m===1))if(m===2){if(a.length<2||l!==2||!a.endsWith(".")||a.at(-2)!=="."){if(a.length>2){const C=a.lastIndexOf("/");C===-1?(a="",l=0):(a=a.slice(0,C),l=a.length-1-a.lastIndexOf("/")),d=g,m=0;continue}else if(a.length>0){a="",l=0,d=g,m=0;continue}}o&&(a+=a.length>0?"/..":"..",l=2)}else a.length>0?a+=`/${n.slice(d+1,g)}`:a=n.slice(d+1,g),l=g-d-1;d=g,m=0}else b==="."&&m!==-1?++m:m=-1}return a},"normalizeString"),Z=$(n=>Ut.test(n),"isAbsolute"),be=$(function(n){if(n.length===0)return".";n=S(n);const o=Kt.exec(n),a=Z(n),l=n.at(-1)==="/";return n=ye(n,!a),n.length===0?a?"/":l?"./":".":(l&&(n+="/"),$e.test(n)&&(n+="/"),o?a?`//${n}`:`//./${n}`:a&&!Z(n)?`/${n}`:n)},"normalize"),ve=$((...n)=>{let o="";for(const a of n)if(a)if(o.length>0){const l=o[o.length-1]==="/",d=a[0]==="/";l&&d?o+=a.slice(1):o+=l||d?a:`/${a}`}else o+=a;return be(o)},"join"),G=$(function(...n){n=n.map(l=>S(l));let o="",a=!1;for(let l=n.length-1;l>=-1&&!a;l--){const d=l>=0?n[l]:Yt();!d||d.length===0||(o=`${d}/${o}`,a=Z(d))}return o=ye(o,!a),a&&!Z(o)?`/${o}`:o.length>0?o:"."},"resolve");$(function(n){return S(n)},"toNamespacedPath");const Qt=$(function(n){return Gt.exec(S(n))?.[1]??""},"extname");$(function(n,o){const a=G(n).replace(he,"$1").split("/"),l=G(o).replace(he,"$1").split("/");if(l[0][1]===":"&&a[0][1]===":"&&a[0]!==l[0])return l.join("/");const d=[...a];for(const m of d){if(l[0]!==m)break;a.shift(),l.shift()}return[...a.map(()=>".."),...l].join("/")},"relative");const Vt=$(n=>{const o=S(n).replace(/\/$/,"").split("/").slice(0,-1);return o.length===1&&$e.test(o[0])&&(o[0]+="/"),o.join("/")||(Z(n)?"/":".")},"dirname");$(function(n){const o=[n.root,n.dir,n.base??n.name+n.ext].filter(Boolean);return S(n.root?G(...o):o.join("/"))},"format");const Xt=$((n,o)=>{const a=S(n).split("/").pop();return o&&a.endsWith(o)?a.slice(0,-o.length):a},"basename");$(function(n){const o=Ht.exec(n)?.[0]?.replace(/\\/g,"/")??"",a=Xt(n),l=Qt(a);return{base:a,dir:Vt(n),ext:l,name:a.slice(0,a.length-l.length),root:o}},"parse");$((n,o)=>Tt(o,be(n)),"matchesGlob");var en=Object.defineProperty,k=W((n,o)=>en(n,"name",{value:o,configurable:!0}),"i");const q="## Ai Generated Solution",ge="Creation of a AI solution failed.",K=k((n,o,a)=>{const l={error:{message:n.message,name:n.name,stack:n.stack},file:{file:o.file,language:o.language,line:o.line,snippet:o.snippet},temperature:a};return _t("sha256").update(JSON.stringify(l)).digest("hex")},"generateCacheKey"),tn=k(n=>n||ve(Et(),"visulima-error-cache"),"getCacheDirectory"),nn=k(n=>{xe(n)||Zt(n,{recursive:!0})},"ensureCacheDirectory"),U=k((n,o)=>ve(n,`${o}.json`),"getCacheFilePath"),rn=k((n,o)=>{try{if(!xe(n))return;const a=It(n,"utf8"),l=JSON.parse(a);return Date.now()-l.timestamp>o?void 0:l.solution}catch{return}},"readFromCache"),me=k((n,o,a)=>{try{const l={solution:o,timestamp:Date.now(),ttl:a};Dt(n,JSON.stringify(l,null,2),"utf8")}catch{}},"writeToCache"),pn=k((n,o)=>({handle:k(async(a,l)=>{const d=o?.cache,m=o?.temperature??0,b=d?.ttl??1440*60*1e3,g=tn(d?.directory);if(d?.enabled!==!1){const w=K(a,l,m),x=U(g,w),O=rn(x,b);if(O)return O;nn(g)}const C=Nt({applicationType:void 0,error:a,file:l});try{const w=(await Ft({model:n,prompt:C,temperature:m})).text;let x;if(w?x={body:J(w),header:q}:x={body:J(ge),header:q},d?.enabled!==!1){const O=K(a,l,m),_=U(g,O);me(_,x,b)}return x}catch(w){console.error(w);const x={body:J(ge),header:q};if(d?.enabled!==!1){const O=K(a,l,m),_=U(g,O);me(_,x,b)}return x}},"handle"),name:"AI SDK",priority:99}),"aiFinder");export{pn as default};
@@ -1 +0,0 @@
1
- "use strict";var Ct=Object.defineProperty;var W=(n,o)=>Ct(n,"name",{value:o,configurable:!0});const Pt=require("node:crypto"),Z=require("node:fs"),It=require("node:os"),Zt=require("ai"),qt=require("../solution/ai/ai-prompt.cjs"),J=require("./aiSolutionResponse-C5apAmTu.cjs");var Dt=Object.defineProperty,Y=W((n,o)=>Dt(n,"name",{value:o,configurable:!0}),"I"),Et=Object.defineProperty,l=Y((n,o)=>Et(n,"name",{value:o,configurable:!0}),"__name$2");let he=l(()=>{var n=(()=>{var o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,m=l((e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})},"J"),b=l((e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of u(t))!d.call(e,i)&&i!==r&&o(e,i,{get:l(()=>t[i],"get"),enumerable:!(a=s(t,i))||a.enumerable});return e},"T"),g=l(e=>b(o({},"__esModule",{value:!0}),e),"W"),k={};m(k,{zeptomatch:l(()=>Mt,"zeptomatch")});var w=l(e=>Array.isArray(e),"k"),x=l(e=>typeof e=="function","x"),O=l(e=>e.length===0,"K"),P=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return r=>(r.length===0||r.length===1)&&t.test(e.call(r))})(),we=l(e=>typeof e=="number","Y"),je=l(e=>typeof e=="object"&&e!==null,"rr"),Ae=l(e=>e instanceof RegExp,"er"),Oe=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Me=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),Q=l(e=>typeof e=="string","M"),M=l(e=>e===void 0,"f"),ze=l(e=>{const t=new Map;return r=>{const a=t.get(r);if(a!==void 0)return a;const i=e(r);return t.set(r,i),i}},"ar"),_e=l((e,t,r={})=>{const a={cache:{},input:e,index:0,indexBacktrackMax:0,options:r,output:[]},i=z(t)(a),f=Math.max(a.index,a.indexBacktrackMax);if(i&&a.index===e.length)return a.output;throw new Error(`Failed to parse at index ${f}`)},"or"),c=l((e,t)=>w(e)?ke(e,t):Q(e)?V(e,t):Se(e,t),"o"),ke=l((e,t)=>{const r={};for(const a of e){if(a.length!==1)throw new Error(`Invalid character: "${a}"`);const i=a.charCodeAt(0);r[i]=!0}return a=>{const i=a.input;let f=a.index,p=f;for(;p<i.length&&i.charCodeAt(p)in r;)p+=1;if(p>f){if(!M(t)&&!a.options.silent){const h=i.slice(f,p),$=x(t)?t(h,i,`${f}`):t;M($)||a.output.push($)}a.index=p}return!0}},"ir"),Se=l((e,t)=>{if(Me(e))return V(e.source,t);{const r=e.source,a=e.flags.replace(/y|$/,"y"),i=new RegExp(r,a);return Oe(e)&&x(t)&&!P(t)?Ce(i,t):Pe(i,t)}},"ur"),Ce=l((e,t)=>r=>{const a=r.index,i=r.input;e.lastIndex=a;const f=e.exec(i);if(f){const p=e.lastIndex;if(!r.options.silent){const h=t(...f,i,`${a}`);M(h)||r.output.push(h)}return r.index=p,!0}else return!1},"sr"),Pe=l((e,t)=>r=>{const a=r.index,i=r.input;if(e.lastIndex=a,e.test(i)){const f=e.lastIndex;if(!M(t)&&!r.options.silent){const p=x(t)?t(i.slice(a,f),i,`${a}`):t;M(p)||r.output.push(p)}return r.index=f,!0}else return!1},"cr"),V=l((e,t)=>r=>{const a=r.index,i=r.input;if(i.startsWith(e,a)){if(!M(t)&&!r.options.silent){const f=x(t)?t(e,i,`${a}`):t;M(f)||r.output.push(f)}return r.index+=e.length,!0}else return!1},"R"),X=l((e,t,r,a)=>{const i=z(e),f=t>1;return R(N(ee(p=>{let h=0;for(;h<r;){const $=p.index;if(!i(p)||(h+=1,p.index===$))break}return h>=t},f),a))},"O"),Ie=l((e,t)=>X(e,0,1,t),"lr"),D=l((e,t)=>X(e,0,1/0,t),"m"),E=l((e,t)=>{const r=e.map(z);return R(N(ee(a=>{for(let i=0,f=r.length;i<f;i++)if(!r[i](a))return!1;return!0}),t))},"_"),j=l((e,t)=>{const r=e.map(z);return R(N(a=>{for(let i=0,f=r.length;i<f;i++)if(r[i](a))return!0;return!1},t))},"p"),ee=l((e,t=!0,r=!1)=>{const a=z(e);return t?i=>{const f=i.index,p=i.output.length,h=a(i);return!h&&!r&&(i.indexBacktrackMax=Math.max(i.indexBacktrackMax,i.index)),(!h||r)&&(i.index=f,i.output.length!==p&&(i.output.length=p)),h}:a},"P"),N=l((e,t)=>{const r=z(e);return t?a=>{if(a.options.silent)return r(a);const i=a.output.length;if(r(a)){const f=a.output.splice(i,1/0),p=t(f);return M(p)||a.output.push(p),!0}else return!1}:r},"C"),R=(()=>{let e=0;return t=>{const r=z(t),a=e+=1;return i=>{var f;if(i.options.memoization===!1)return r(i);const p=i.index,h=(f=i.cache)[a]||(f[a]={indexMax:-1,queue:[]}),$=h.queue;if(p<=h.indexMax){const I=h.store||(h.store=new Map);if($.length){for(let C=0,_t=$.length;C<_t;C+=2){const kt=$[C*2],St=$[C*2+1];I.set(kt,St)}$.length=0}const v=I.get(p);if(v===!1)return!1;if(we(v))return i.index=v,!0;if(v)return i.index=v.index,v.output?.length&&i.output.push(...v.output),!0}const de=i.output.length,zt=r(i);if(h.indexMax=Math.max(h.indexMax,p),zt){const I=i.index,v=i.output.length;if(v>de){const C=i.output.slice(de,v);$.push(p,{index:I,output:C})}else $.push(p,I);return!0}else return $.push(p,!1),!1}}})(),te=l(e=>{let t;return r=>(t||(t=z(e())),t(r))},"A"),z=ze(e=>{if(x(e))return O(e)?te(e):e;if(Q(e)||Ae(e))return c(e);if(w(e))return E(e);if(je(e))return j(Object.values(e));throw new Error("Invalid rule")}),A=l(e=>e,"v"),ne=l(e=>t=>_e(t,e,{memoization:!1}).join(""),"z"),Ze=l(e=>{const t={};return r=>t[r]??(t[r]=e(r))},"pr"),re="abcdefghijklmnopqrstuvwxyz",qe=l(e=>{let t="";for(;e>0;){const r=(e-1)%26;t=re[r]+t,e=Math.floor((e-1)/26)}return t},"vr"),oe=l(e=>{let t=0;for(let r=0,a=e.length;r<a;r++)t=t*26+re.indexOf(e[r])+1;return t},"N"),B=l((e,t)=>{if(t<e)return B(t,e);const r=[];for(;e<=t;)r.push(e++);return r},"$"),De=l((e,t,r)=>B(e,t).map(a=>String(a).padStart(r,"0")),"fr"),ie=l((e,t)=>B(oe(e),oe(t)).map(qe),"j"),T=c(/\\./,A),Ee=c(/[$.*+?^(){}[\]\|]/,e=>`\\${e}`),Fe=c(/./,A),Ne=c(/^(?:!!)*!(.*)$/,(e,t)=>`(?!^${pe(t)}$).*?`),Re=c(/^(!!)+/,""),Be=j([Ne,Re]),Te=c(/\/(\*\*\/)+/,"(?:[\\\\/].+[\\\\/]|[\\\\/])"),We=c(/^(\*\*\/)+/,"(?:^|.*[\\\\/])"),Je=c(/\/(\*\*)$/,"(?:[\\\\/].*|$)"),Le=c(/\*\*/,".*"),se=j([Te,We,Je,Le]),Ke=c(/\*\/(?!\*\*\/|\*$)/,"[^\\\\/]*[\\\\/]"),Ue=c(/\*/,"[^\\\\/]*"),ae=j([Ke,Ue]),ue=c("?","[^\\\\/]"),Ge=c("[",A),He=c("]",A),Ye=c(/[!^]/,"^\\\\/"),Qe=c(/[a-z]-[a-z]|[0-9]-[0-9]/i,A),Ve=c(/[$.*+?^(){}[\|]/,e=>`\\${e}`),Xe=c(/[^\]]/,A),et=j([T,Ve,Qe,Xe]),le=E([Ge,Ie(Ye),D(et),He]),tt=c("{","(?:"),nt=c("}",")"),rt=c(/(\d+)\.\.(\d+)/,(e,t,r)=>De(+t,+r,Math.min(t.length,r.length)).join("|")),ot=c(/([a-z]+)\.\.([a-z]+)/,(e,t,r)=>ie(t,r).join("|")),it=c(/([A-Z]+)\.\.([A-Z]+)/,(e,t,r)=>ie(t.toLowerCase(),r.toLowerCase()).join("|").toUpperCase()),st=j([rt,ot,it]),ce=E([tt,st,nt]),at=c("{","(?:"),ut=c("}",")"),lt=c(",","|"),ct=c(/[$.*+?^(){[\]\|]/,e=>`\\${e}`),ft=c(/[^}]/,A),pt=te(()=>fe),dt=j([se,ae,ue,le,ce,pt,T,ct,lt,ft]),fe=E([at,D(dt),ut]),ht=D(j([Be,se,ae,ue,le,ce,fe,T,Ee,Fe])),gt=ht,mt=ne(gt),pe=mt,xt=c(/\\./,A),yt=c(/./,A),$t=c(/\*\*\*+/,"*"),bt=c(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),vt=c(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),wt=D(j([xt,$t,bt,vt,yt])),jt=wt,At=ne(jt),Ot=At,F=l((e,t)=>Array.isArray(e)?e.map(F.compile).some(r=>r.test(t)):F.compile(e).test(t),"S");F.compile=Ze(e=>new RegExp(`^${pe(Ot(e))}[\\\\/]?$`,"s"));var Mt=F;return g(k)})();return n.default||n},"_lazyMatch"),L;const Ft=l((n,o)=>(L||(L=he(),he=null),L(n,o)),"default");var Nt=Object.defineProperty,Rt=Y((n,o)=>Nt(n,"name",{value:o,configurable:!0}),"__name$1");const Bt=/^[A-Z]:\//i,S=Rt((n="")=>n&&n.replaceAll("\\","/").replace(Bt,o=>o.toUpperCase()),"normalizeWindowsPath");var Tt=Object.defineProperty,y=Y((n,o)=>Tt(n,"name",{value:o,configurable:!0}),"__name");const Wt=/^[/\\]{2}/,Jt=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ye=/^[A-Z]:$/i,ge=/^\/([A-Z]:)?$/i,Lt=/.(\.[^./]+)$/,Kt=/^[/\\]|^[a-z]:[/\\]/i,Ut=y(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),$e=y((n,o)=>{let s="",u=0,d=-1,m=0,b=null;for(let g=0;g<=n.length;++g){if(g<n.length)b=n[g];else{if(b==="/")break;b="/"}if(b==="/"){if(!(d===g-1||m===1))if(m===2){if(s.length<2||u!==2||!s.endsWith(".")||s.at(-2)!=="."){if(s.length>2){const k=s.lastIndexOf("/");k===-1?(s="",u=0):(s=s.slice(0,k),u=s.length-1-s.lastIndexOf("/")),d=g,m=0;continue}else if(s.length>0){s="",u=0,d=g,m=0;continue}}o&&(s+=s.length>0?"/..":"..",u=2)}else s.length>0?s+=`/${n.slice(d+1,g)}`:s=n.slice(d+1,g),u=g-d-1;d=g,m=0}else b==="."&&m!==-1?++m:m=-1}return s},"normalizeString"),q=y(n=>Jt.test(n),"isAbsolute"),be=y(function(n){if(n.length===0)return".";n=S(n);const o=Wt.exec(n),s=q(n),u=n.at(-1)==="/";return n=$e(n,!s),n.length===0?s?"/":u?"./":".":(u&&(n+="/"),ye.test(n)&&(n+="/"),o?s?`//${n}`:`//./${n}`:s&&!q(n)?`/${n}`:n)},"normalize"),ve=y((...n)=>{let o="";for(const s of n)if(s)if(o.length>0){const u=o[o.length-1]==="/",d=s[0]==="/";u&&d?o+=s.slice(1):o+=u||d?s:`/${s}`}else o+=s;return be(o)},"join"),H=y(function(...n){n=n.map(u=>S(u));let o="",s=!1;for(let u=n.length-1;u>=-1&&!s;u--){const d=u>=0?n[u]:Ut();!d||d.length===0||(o=`${d}/${o}`,s=q(d))}return o=$e(o,!s),s&&!q(o)?`/${o}`:o.length>0?o:"."},"resolve");y(function(n){return S(n)},"toNamespacedPath");const Gt=y(function(n){return Lt.exec(S(n))?.[1]??""},"extname");y(function(n,o){const s=H(n).replace(ge,"$1").split("/"),u=H(o).replace(ge,"$1").split("/");if(u[0][1]===":"&&s[0][1]===":"&&s[0]!==u[0])return u.join("/");const d=[...s];for(const m of d){if(u[0]!==m)break;s.shift(),u.shift()}return[...s.map(()=>".."),...u].join("/")},"relative");const Ht=y(n=>{const o=S(n).replace(/\/$/,"").split("/").slice(0,-1);return o.length===1&&ye.test(o[0])&&(o[0]+="/"),o.join("/")||(q(n)?"/":".")},"dirname");y(function(n){const o=[n.root,n.dir,n.base??n.name+n.ext].filter(Boolean);return S(n.root?H(...o):o.join("/"))},"format");const Yt=y((n,o)=>{const s=S(n).split("/").pop();return o&&s.endsWith(o)?s.slice(0,-o.length):s},"basename");y(function(n){const o=Kt.exec(n)?.[0]?.replace(/\\/g,"/")??"",s=Yt(n),u=Gt(s);return{base:s,dir:Ht(n),ext:u,name:s.slice(0,s.length-u.length),root:o}},"parse");y((n,o)=>Ft(o,be(n)),"matchesGlob");var Qt=Object.defineProperty,_=W((n,o)=>Qt(n,"name",{value:o,configurable:!0}),"i");const K="## Ai Generated Solution",me="Creation of a AI solution failed.",U=_((n,o,s)=>{const u={error:{message:n.message,name:n.name,stack:n.stack},file:{file:o.file,language:o.language,line:o.line,snippet:o.snippet},temperature:s};return Pt.createHash("sha256").update(JSON.stringify(u)).digest("hex")},"generateCacheKey"),Vt=_(n=>n||ve(It.tmpdir(),"visulima-error-cache"),"getCacheDirectory"),Xt=_(n=>{Z.existsSync(n)||Z.mkdirSync(n,{recursive:!0})},"ensureCacheDirectory"),G=_((n,o)=>ve(n,`${o}.json`),"getCacheFilePath"),en=_((n,o)=>{try{if(!Z.existsSync(n))return;const s=Z.readFileSync(n,"utf8"),u=JSON.parse(s);return Date.now()-u.timestamp>o?void 0:u.solution}catch{return}},"readFromCache"),xe=_((n,o,s)=>{try{const u={solution:o,timestamp:Date.now(),ttl:s};Z.writeFileSync(n,JSON.stringify(u,null,2),"utf8")}catch{}},"writeToCache"),tn=_((n,o)=>({handle:_(async(s,u)=>{const d=o?.cache,m=o?.temperature??0,b=d?.ttl??1440*60*1e3,g=Vt(d?.directory);if(d?.enabled!==!1){const w=U(s,u,m),x=G(g,w),O=en(x,b);if(O)return O;Xt(g)}const k=qt({applicationType:void 0,error:s,file:u});try{const w=(await Zt.generateText({model:n,prompt:k,temperature:m})).text;let x;if(w?x={body:J(w),header:K}:x={body:J(me),header:K},d?.enabled!==!1){const O=U(s,u,m),P=G(g,O);xe(P,x,b)}return x}catch(w){console.error(w);const x={body:J(me),header:K};if(d?.enabled!==!1){const O=U(s,u,m),P=G(g,O);xe(P,x,b)}return x}},"handle"),name:"AI SDK",priority:99}),"aiFinder");module.exports=tn;
@@ -1,10 +0,0 @@
1
- "use strict";var u=Object.defineProperty;var o=(e,r)=>u(e,"name",{value:r,configurable:!0});var c=Object.defineProperty,l=o((e,r)=>c(e,"name",{value:r,configurable:!0}),"i");const a=l((e,r,n)=>{const t=n.indexOf(e);if(t===-1)return"";const s=t+e.length,i=n.indexOf(r,s);return i===-1?"":n.slice(s,i).trim()},"between"),p=l(e=>{const r=a("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 n=a("LINKS","ENDLINKS",e).split(`
2
- `).map(t=>JSON.parse(t));return`${r.replaceAll(/"([^"]*)"(\s|\.)/g,"<code>$1</code> ")}
3
-
4
- ## Links
5
-
6
- ${n.map(t=>`- <a href="${t.url}" target="_blank" rel="noopener noreferrer">${t.title}</a>`).join(`
7
- `)}
8
-
9
- --------------------
10
- 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");module.exports=p;
@@ -1 +0,0 @@
1
- "use strict";var t=Object.defineProperty;var a=(r,e)=>t(r,"name",{value:e,configurable:!0});var c=Object.defineProperty,u=a((r,e)=>c(r,"name",{value:e,configurable:!0}),"e");const n=u(()=>{if(!Error.captureStackTrace)return;const r=new Error;return Error.captureStackTrace(r),r.stack},"captureRawStackTrace");module.exports=n;
@@ -1 +0,0 @@
1
- "use strict";var w=Object.defineProperty;var p=(e,r)=>w(e,"name",{value:r,configurable:!0});const O=require("./index-CqSGigts.cjs"),m=require("./addKnownErrorConstructor-B5dNFGsR.cjs"),d=require("./NonError-CQn4sdxd.cjs");var A=Object.defineProperty,n=p((e,r)=>A(e,"name",{value:r,configurable:!0}),"o");const N={maxDepth:Number.POSITIVE_INFINITY},b=n((e,r,t=0)=>m.isErrorLike(e)?y(e,r,t):r.maxDepth!==void 0&&t>=r.maxDepth?new d(JSON.stringify(e)):new d(JSON.stringify(e)),"deserializePlainObject"),P=n((e,r,t,o,i)=>{const s=r.map(a=>f(a,o,i+1));return new e(s,t)},"reconstructAggregateError"),y=n((e,r,t)=>{if(r.maxDepth!==void 0&&t>=r.maxDepth)return new d(JSON.stringify(e));const{cause:o,errors:i,message:s,name:a,stack:u,...g}=e,l=m.getErrorConstructor(a)||Error,c=a==="AggregateError"&&Array.isArray(i)?P(l,i,s,r,t):new l(s);return!c.name&&a&&(c.name=a),s!==void 0&&(c.message=s),u&&(c.stack=u),v(c,g,o,a,r,t),o!==void 0&&(c.cause=f(o,r,t+1)),h(c,e),c},"reconstructError"),f=n((e,r,t)=>O.r(e)?b(e,r,t):Array.isArray(e)?e.map(o=>f(o,r,t)):e,"deserializeValue"),v=n((e,r,t,o,i,s)=>{const a=e;for(const[u,g]of Object.entries(r))if(!(u==="cause"&&t!==void 0)){if(u==="errors"&&o==="AggregateError")continue;a[u]=f(g,i,s+1)}},"restoreErrorProperties"),h=n((e,r)=>{const t=new Set;t.add("name"),t.add("message"),t.add("stack");for(const o of Object.keys(r))t.add(o);for(const o of t)if(o in e){const i=Object.getOwnPropertyDescriptor(e,o);i&&!i.enumerable&&Object.defineProperty(e,o,{...i,enumerable:!0})}},"makePropertiesEnumerable"),E=n(e=>new d(JSON.stringify(e)),"handlePrimitive"),k=n(e=>new d(JSON.stringify(e)),"handleArray"),S=n((e,r)=>m.isErrorLike(e)?y(e,r,0):b(e,r),"handlePlainObject"),j=n((e,r={})=>{const t={...N,...r};return e instanceof Error?e:e===null?E(null):typeof e=="string"||typeof e=="number"||typeof e=="boolean"?E(e):Array.isArray(e)?k(e):m.isErrorLike(e)?y(e,t,0):O.r(e)?S(e,t):new d(JSON.stringify(e))},"deserialize");module.exports=j;
@@ -1 +0,0 @@
1
- var w=Object.defineProperty;var p=(e,r)=>w(e,"name",{value:r,configurable:!0});import{r as b}from"./index-CLFYRLyq.mjs";import{isErrorLike as g,getErrorConstructor as A}from"./addKnownErrorConstructor-BqqnTSZp.mjs";import f from"./NonError-CS10kwil.mjs";var N=Object.defineProperty,i=p((e,r)=>N(e,"name",{value:r,configurable:!0}),"o");const P={maxDepth:Number.POSITIVE_INFINITY},E=i((e,r,t=0)=>g(e)?l(e,r,t):r.maxDepth!==void 0&&t>=r.maxDepth?new f(JSON.stringify(e)):new f(JSON.stringify(e)),"deserializePlainObject"),v=i((e,r,t,o,a)=>{const s=r.map(n=>u(n,o,a+1));return new e(s,t)},"reconstructAggregateError"),l=i((e,r,t)=>{if(r.maxDepth!==void 0&&t>=r.maxDepth)return new f(JSON.stringify(e));const{cause:o,errors:a,message:s,name:n,stack:m,...d}=e,y=A(n)||Error,c=n==="AggregateError"&&Array.isArray(a)?v(y,a,s,r,t):new y(s);return!c.name&&n&&(c.name=n),s!==void 0&&(c.message=s),m&&(c.stack=m),h(c,d,o,n,r,t),o!==void 0&&(c.cause=u(o,r,t+1)),S(c,e),c},"reconstructError"),u=i((e,r,t)=>b(e)?E(e,r,t):Array.isArray(e)?e.map(o=>u(o,r,t)):e,"deserializeValue"),h=i((e,r,t,o,a,s)=>{const n=e;for(const[m,d]of Object.entries(r))if(!(m==="cause"&&t!==void 0)){if(m==="errors"&&o==="AggregateError")continue;n[m]=u(d,a,s+1)}},"restoreErrorProperties"),S=i((e,r)=>{const t=new Set;t.add("name"),t.add("message"),t.add("stack");for(const o of Object.keys(r))t.add(o);for(const o of t)if(o in e){const a=Object.getOwnPropertyDescriptor(e,o);a&&!a.enumerable&&Object.defineProperty(e,o,{...a,enumerable:!0})}},"makePropertiesEnumerable"),O=i(e=>new f(JSON.stringify(e)),"handlePrimitive"),j=i(e=>new f(JSON.stringify(e)),"handleArray"),D=i((e,r)=>g(e)?l(e,r,0):E(e,r),"handlePlainObject"),z=i((e,r={})=>{const t={...P,...r};return e instanceof Error?e:e===null?O(null):typeof e=="string"||typeof e=="number"||typeof e=="boolean"?O(e):Array.isArray(e)?j(e):g(e)?l(e,t,0):b(e)?D(e,t):new f(JSON.stringify(e))},"deserialize");export{z as default};
@@ -1,2 +0,0 @@
1
- "use strict";var e=Object.defineProperty;var r=(t,i)=>e(t,"name",{value:i,configurable:!0});var n=Object.defineProperty,o=r((t,i)=>n(t,"name",{value:i,configurable:!0}),"i");const h={handle:o(async t=>{if(!(t.hint===void 0||t.hint===null)){if(typeof t.hint=="string"&&t.hint!=="")return{body:t.hint};if(typeof t.hint=="object"&&typeof t.hint.body=="string")return t.hint;if(Array.isArray(t.hint))return{body:t.hint.join(`
2
- `)}}},"handle"),name:"errorHint",priority:1};module.exports=h;
@@ -1,2 +0,0 @@
1
- "use strict";var i=Object.defineProperty;var n=(e,t)=>i(e,"name",{value:t,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var s=Object.defineProperty,m=n((e,t)=>s(e,"name",{value:t,configurable:!0}),"s");const c=m(e=>{const t=e.methodName&&e.methodName!=="<unknown>"?`${e.methodName} `:"",a=e.file??"<unknown>",r=e.line??0,o=e.column??0;return t.trim()?` at ${t}(${a}:${r}:${o})`:` at ${a}:${r}:${o}`},"formatStackFrameLine"),u=m((e,t)=>{const a=[];if(t?.header&&(t.header.name||t.header.message)){const r=String(t.header.name||"Error"),o=String(t.header.message||"");a.push(`${r}${o?": ":""}${o}`)}for(const r of e)a.push(c(r));return a.join(`
2
- `)},"formatStacktrace");exports.formatStackFrameLine=c;exports.formatStacktrace=u;
@@ -1 +0,0 @@
1
- "use strict";var c=Object.defineProperty;var a=(r,t)=>c(r,"name",{value:t,configurable:!0});const o=require("node:util");var n=Object.defineProperty,u=a((r,t)=>n(r,"name",{value:t,configurable:!0}),"a");const i=u(r=>{const t=new Set,s=[];let e=r;for(;e;){if(t.has(e)){console.error(`Circular reference detected in error causes: ${o.inspect(r)}`);break}if(s.push(e),t.add(e),!e.cause)break;e=e.cause}return s},"getErrorCauses");module.exports=i;
@@ -1 +0,0 @@
1
- var s=Object.defineProperty;var o=(r,a)=>s(r,"name",{value:a,configurable:!0});import{inspect as c}from"node:util";var n=Object.defineProperty,u=o((r,a)=>n(r,"name",{value:a,configurable:!0}),"a");const d=u(r=>{const a=new Set,t=[];let e=r;for(;e;){if(a.has(e)){console.error(`Circular reference detected in error causes: ${c(r)}`);break}if(t.push(e),a.add(e),!e.cause)break;e=e.cause}return t},"getErrorCauses");export{d as default};
@@ -1 +0,0 @@
1
- "use strict";var n=Object.defineProperty;var r=(e,t)=>n(e,"name",{value:t,configurable:!0});var l=Object.defineProperty,i=r((e,t)=>l(e,"name",{value:t,configurable:!0}),"e");function o(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}r(o,"r");i(o,"isPlainObject");exports.r=o;
@@ -1 +0,0 @@
1
- "use strict";var c=Object.defineProperty;var a=(n,t)=>c(n,"name",{value:t,configurable:!0});var f=Object.defineProperty,s=a((n,t)=>f(n,"name",{value:t,configurable:!0}),"l");const u=s((n,t)=>{let e=0,i=t.length-2;for(;e<i;){const r=e+(i-e>>1);if(n<t[r])i=r-1;else if(n>=t[r+1])e=r+1;else{e=r;break}}return e},"binarySearch"),y=s(n=>n.split(/\n|\r(?!\n)/).reduce((t,e)=>(t.push(t.at(-1)+e.length+1),t),[0]),"getLineStartIndexes"),g=s((n,t,e)=>{const i=e?.skipChecks??!1;if(!i&&(!Array.isArray(n)&&typeof n!="string"||(typeof n=="string"||Array.isArray(n))&&n.length===0))return{column:0,line:0};if(!i&&(typeof t!="number"||typeof n=="string"&&t>=n.length||Array.isArray(n)&&t+1>=n.at(-1)))return{column:0,line:0};if(typeof n=="string"){const l=y(n),o=u(t,l);return{column:t-l[o]+1,line:o+1}}const r=u(t,n);return{column:t-n[r]+1,line:r+1}},"indexToLineColumn");module.exports=g;
@@ -1 +0,0 @@
1
- "use strict";var n=Object.defineProperty;var i=(s,t)=>n(s,"name",{value:t,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var m=Object.defineProperty,e=i((s,t)=>m(s,"name",{value:t,configurable:!0}),"t");const h=e(s=>s instanceof Error&&s.type==="VisulimaError","isVisulimaError");class E extends Error{static{i(this,"VisulimaError")}static{e(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:t,hint:r,location:a,message:o,name:l,stack:u,title:c}){super(o,{cause:t}),this.title=c,this.name=l,this.stack=u??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}}exports.VisulimaError=E;exports.isVisulimaError=h;
@@ -1,2 +0,0 @@
1
- "use strict";var x=Object.defineProperty;var v=(i,e)=>x(i,"name",{value:e,configurable:!0});var N=Object.defineProperty,d=v((i,e)=>N(i,"name",{value:e,configurable:!0}),"u");const u=d((i,...e)=>{process.env.DEBUG&&String(process.env.DEBUG)==="true"&&console.debug(`error:parse-stacktrace: ${i}`,...e)},"debugLog"),f="<unknown>",g=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,h=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,S=/(.*?):(\d+):(\d+)(\s<-\s(.+):(\d+):(\d+))?/,k=/(eval)\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*(<anonymous>)?:(\d+)?:(\d+)/,w=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,b=/in\s(.*)\s\(at\s(.+)\)\sat/,O=/^(?:.*@)?(.*):(\d+):(\d+)$/,E=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,J=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,A=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,p=/\(error: (.*)\)/,$=d((i,e)=>{const n=i.includes("safari-extension"),t=i.includes("safari-web-extension");return n||t?[i.includes("@")?i.split("@")[0]:f,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[i,e]},"extractSafariExtensionDetails"),y=d((i,e)=>{const n=S.exec(e);n&&(i.file=n[1],i.line=+n[2],i.column=+n[3])},"parseMapped"),G=d(i=>{const e=b.exec(i);if(e){u(`parse nested node error stack line: "${i}"`,`found: ${JSON.stringify(e)}`);const t=e[2].split(":");return{column:t[2]?+t[2]:void 0,file:t[0],line:t[1]?+t[1]:void 0,methodName:e[1]||f,raw:i,type:void 0}}const n=w.exec(i);if(n){u(`parse node error stack line: "${i}"`,`found: ${JSON.stringify(n)}`);const t={column:n[4]?+n[4]:void 0,file:n[2]?n[2].replace(/at\s/,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]||f,raw:i,type:i.startsWith("internal")?"internal":void 0};return y(t,`${n[2]}:${n[3]}:${n[4]}`),t}},"parseNode"),W=d(i=>{const e=g.exec(i);if(e){u(`parse chrome error stack line: "${i}"`,`found: ${JSON.stringify(e)}`);const n=e[2]?.startsWith("native"),t=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let o,a;if(t){const s=h.exec(i);if(s){const r=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/.exec(s[1]);r?(e[2]=r[4]??r[1],e[3]=r[5]??r[2],e[4]=r[3]):s[2]&&(e[2]=s[1]),s[2]&&(o={column:s[4]?+s[4]:void 0,file:s[2],line:s[3]?+s[3]:void 0,methodName:"eval",raw:i,type:"eval"})}else{const r=k.exec(i);r&&(a={column:r[5]?+r[5]:void 0,file:r[3],line:r[4]?+r[4]:void 0},o={column:r[8]?+r[8]:void 0,file:r[2],line:r[7]?+r[7]:void 0,methodName:"eval",raw:r[0],type:"eval"})}}const[m,c]=$(e[1]?e[1].replace(/^Anonymous function$/,"<anonymous>"):f,e[2]),l={column:e[4]?+e[4]:void 0,evalOrigin:o,file:c,line:e[3]?+e[3]:void 0,methodName:m,raw:i,type:t?"eval":n?"native":void 0};return a?(l.column=a.column,l.file=a.file,l.line=a.line):y(l,`${c}:${e[3]}:${e[4]}`),l}},"parseChromium"),D=d((i,e)=>{const n=E.exec(i);if(n){u(`parse gecko error stack line: "${i}"`,`found: ${JSON.stringify(n)}`);const t=n[3]?.includes(" > eval"),o=t&&n[3]&&J.exec(n[3]);let a;t&&o&&(n[3]=o[1],a={column:n[5]?+n[5]:void 0,file:n[3],line:n[4]?+n[4]:void 0,methodName:"eval",raw:i,type:"eval"},n[4]=o[2]);const[m,c]=$(n[1]?n[1].replace(/^Anonymous function$/,"<anonymous>"):f,n[3]);let l;(e?.type==="safari"||!t&&e?.type==="firefox")&&e.column?l=e.column:!t&&n[5]&&(l=+n[5]);let s;return(e?.type==="safari"||!t&&e?.type==="firefox")&&e.line?s=e.line:n[4]&&(s=+n[4]),{column:l,evalOrigin:a,file:c,line:s,methodName:m,raw:i,type:t?"eval":c.includes("[native code]")?"native":void 0}}},"parseGecko"),j=d((i,e)=>{const n=A.exec(i);if(!(n&&n[2].includes(" > eval"))&&n)return u(`parse firefox error stack line: "${i}"`,`found: ${JSON.stringify(n)}`),{column:n[4]?+n[4]:e?.column??void 0,file:n[2],line:n[3]?+n[3]:e?.line??void 0,methodName:n[1]||f,raw:i,type:void 0}},"parseFirefox"),z=d(i=>{const e=O.exec(i);if(e)return u(`parse react android native error stack line: "${i}"`,`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:f,raw:i,type:void 0}},"parseReactAndroidNative"),B=d((i,{filter:e,frameLimit:n=50}={})=>{let t=(i.stacktrace??i.stack??"").split(`
2
- `).map(o=>(p.test(o)?o.replace(p,"$1"):o).replace(/^\s+|\s+$/g,"")).filter(o=>!/\S*(?:Error: |AggregateError:)/.test(o)&&o!=="eval code");return e&&(t=t.filter(o=>e(o))),t=t.slice(0,n),t.reduce((o,a,m)=>{if(!a||a.length>1024)return o;let c;if(/^\s*in\s.*/.test(a))c=G(a);else if(/^.*?\s*at\s.*/.test(a))c=W(a);else if(/^.*?\s*@.*|\[native code\]/.test(a)){let l;m===0&&(i.columnNumber||i.lineNumber?l={column:i.columnNumber,line:i.lineNumber,type:"firefox"}:(i.line||i.column)&&(l={column:i.column,line:i.line,type:"safari"})),c=j(a,l)||D(a,l)}else c=z(a);return c?o.push(c):u(`parse error stack line: "${a}"`,"not parser found"),o},[])},"parseStacktrace");module.exports=B;
@@ -1,18 +0,0 @@
1
- var L=Object.defineProperty;var u=(e,r)=>L(e,"name",{value:r,configurable:!0});import{existsSync as C,readFileSync as S}from"node:fs";import{relative as M}from"node:path";import{cwd as y}from"node:process";import{fileURLToPath as A}from"node:url";import{codeFrame as T}from"../code-frame/index.mjs";import g from"./parseStacktrace-Dnxnc4PL.mjs";var V=Object.defineProperty,s=u((e,r)=>V(e,"name",{value:r,configurable:!0}),"o");const f=s((e,r,i)=>i===0?e.toString():r===" "?e+" ".repeat(i):e+" ".repeat(r*i),"getPrefix"),N=s((e,r)=>{const i=e.replace("async file:","file:");return M(r,i.startsWith("file:")?A(i):i)},"getRelativePath"),P=s((e,r,i)=>{if(r)return i.title(e.message);const t=e.message?`: ${e.message}`:"";return i.title(e.name+t)},"getTitleText"),p=s((e,{color:r,hideErrorTitle:i,indentation:t,prefix:n},a)=>`${f(n,t,a)}${P(e,i,r)}
2
- `,"getMessage"),v=s((e,{color:r,indentation:i,prefix:t},n)=>{if(e.hint===void 0)return;const a=f(t,i,n);let o="";if(Array.isArray(e.hint))for(const l of e.hint)o+=`${(a+l).toString()}
3
- `;else o+=a+e.hint;return r.hint(o)},"getHint"),c=s((e,{color:r,cwd:i,displayShortPath:t,indentation:n,prefix:a},o=0)=>{const l=t?N(e.file,i):e.file,{fileLine:d,method:m}=r;return`${f(a,n,o)}at ${e.methodName?`${m(e.methodName)} `:""}${d(l)}:${d(e.line?.toString()??"")}`.toString()},"getMainFrame"),w=s((e,{color:r,indentation:i,linesAbove:t,linesBelow:n,prefix:a,showGutter:o,showLineNumbers:l,tabWidth:d},m)=>{if(e.file===void 0)return;const h=e.file.replace("file://","");if(!C(h))return;const b=S(h,"utf8");return T(b,{start:{column:e.column,line:e.line}},{color:r,linesAbove:t,linesBelow:n,prefix:f(a,i,m),showGutter:o,showLineNumbers:l,tabWidth:d})},"getCode"),E=s((e,r,i)=>{if(e.errors.length===0)return;let t=`${f(r.prefix,r.indentation,i)}Errors:
4
-
5
- `,n=!0;for(const a of e.errors)n?n=!1:t+=`
6
-
7
- `,t+=$(a,{...r,framesMaxLimit:1,hideErrorCodeView:r.hideErrorErrorsCodeView},i+1);return`
8
- ${t}`},"getErrors"),x=s((e,r,i)=>{let t=`${f(r.prefix,r.indentation,i)}Caused by:
9
-
10
- `;const n=e.cause;t+=p(n,r,i);const a=g(n).shift(),o=v(n,r,i);if(o&&(t+=`${o}
11
- `),a&&(t+=c(a,r,i),!r.hideErrorCauseCodeView)){const l=w(a,r,i);l!==void 0&&(t+=`
12
- ${l}`)}if(n.cause)t+=`
13
- ${x(n,r,i+1)}`;else if(n instanceof AggregateError){const l=E(n,r,i);l!==void 0&&(t+=`
14
- ${l}`)}return`
15
- ${t}`},"getCause"),k=s((e,r)=>(e.length>0?`
16
- `:"")+e.map(i=>c(i,r)).join(`
17
- `),"getStacktrace"),$=s((e,r,i)=>{const t={cwd:y(),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,...r,color:{fileLine:s(o=>o,"fileLine"),gutter:s(o=>o,"gutter"),hint:s(o=>o,"hint"),marker:s(o=>o,"marker"),message:s(o=>o,"message"),method:s(o=>o,"method"),title:s(o=>o,"title"),...r.color}},n=g(e,{filter:r.filterStacktrace,frameLimit:t.framesMaxLimit}),a=n.shift();return[r.hideMessage?void 0:p(e,t,i),v(e,t,i),a?c(a,t,i):void 0,a&&!t.hideErrorCodeView?w(a,t,i):void 0,e instanceof AggregateError?E(e,t,i):void 0,e.cause===void 0?void 0:x(e,t,i),n.length>0?k(n,t):void 0].filter(Boolean).join(`
18
- `).replaceAll("\\","/")},"internalRenderError"),O=s((e,r={})=>{if(r.framesMaxLimit!==void 0&&r.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return $(e,r,0)},"renderError");export{O as renderError};
@@ -1,18 +0,0 @@
1
- "use strict";var L=Object.defineProperty;var m=(e,r)=>L(e,"name",{value:r,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("node:fs"),C=require("node:path"),M=require("node:process"),y=require("node:url"),T=require("../code-frame/index.cjs"),p=require("./parseStacktrace-MW4-SLXl.cjs");var A=Object.defineProperty,s=m((e,r)=>A(e,"name",{value:r,configurable:!0}),"o");const d=s((e,r,i)=>i===0?e.toString():r===" "?e+" ".repeat(i):e+" ".repeat(r*i),"getPrefix"),P=s((e,r)=>{const i=e.replace("async file:","file:");return C.relative(r,i.startsWith("file:")?y.fileURLToPath(i):i)},"getRelativePath"),V=s((e,r,i)=>{if(r)return i.title(e.message);const t=e.message?`: ${e.message}`:"";return i.title(e.name+t)},"getTitleText"),v=s((e,{color:r,hideErrorTitle:i,indentation:t,prefix:n},a)=>`${d(n,t,a)}${V(e,i,r)}
2
- `,"getMessage"),w=s((e,{color:r,indentation:i,prefix:t},n)=>{if(e.hint===void 0)return;const a=d(t,i,n);let o="";if(Array.isArray(e.hint))for(const l of e.hint)o+=`${(a+l).toString()}
3
- `;else o+=a+e.hint;return r.hint(o)},"getHint"),c=s((e,{color:r,cwd:i,displayShortPath:t,indentation:n,prefix:a},o=0)=>{const l=t?P(e.file,i):e.file,{fileLine:f,method:u}=r;return`${d(a,n,o)}at ${e.methodName?`${u(e.methodName)} `:""}${f(l)}:${f(e.line?.toString()??"")}`.toString()},"getMainFrame"),E=s((e,{color:r,indentation:i,linesAbove:t,linesBelow:n,prefix:a,showGutter:o,showLineNumbers:l,tabWidth:f},u)=>{if(e.file===void 0)return;const h=e.file.replace("file://","");if(!g.existsSync(h))return;const S=g.readFileSync(h,"utf8");return T.codeFrame(S,{start:{column:e.column,line:e.line}},{color:r,linesAbove:t,linesBelow:n,prefix:d(a,i,u),showGutter:o,showLineNumbers:l,tabWidth:f})},"getCode"),b=s((e,r,i)=>{if(e.errors.length===0)return;let t=`${d(r.prefix,r.indentation,i)}Errors:
4
-
5
- `,n=!0;for(const a of e.errors)n?n=!1:t+=`
6
-
7
- `,t+=$(a,{...r,framesMaxLimit:1,hideErrorCodeView:r.hideErrorErrorsCodeView},i+1);return`
8
- ${t}`},"getErrors"),x=s((e,r,i)=>{let t=`${d(r.prefix,r.indentation,i)}Caused by:
9
-
10
- `;const n=e.cause;t+=v(n,r,i);const a=p(n).shift(),o=w(n,r,i);if(o&&(t+=`${o}
11
- `),a&&(t+=c(a,r,i),!r.hideErrorCauseCodeView)){const l=E(a,r,i);l!==void 0&&(t+=`
12
- ${l}`)}if(n.cause)t+=`
13
- ${x(n,r,i+1)}`;else if(n instanceof AggregateError){const l=b(n,r,i);l!==void 0&&(t+=`
14
- ${l}`)}return`
15
- ${t}`},"getCause"),N=s((e,r)=>(e.length>0?`
16
- `:"")+e.map(i=>c(i,r)).join(`
17
- `),"getStacktrace"),$=s((e,r,i)=>{const t={cwd:M.cwd(),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,...r,color:{fileLine:s(o=>o,"fileLine"),gutter:s(o=>o,"gutter"),hint:s(o=>o,"hint"),marker:s(o=>o,"marker"),message:s(o=>o,"message"),method:s(o=>o,"method"),title:s(o=>o,"title"),...r.color}},n=p(e,{filter:r.filterStacktrace,frameLimit:t.framesMaxLimit}),a=n.shift();return[r.hideMessage?void 0:v(e,t,i),w(e,t,i),a?c(a,t,i):void 0,a&&!t.hideErrorCodeView?E(a,t,i):void 0,e instanceof AggregateError?b(e,t,i):void 0,e.cause===void 0?void 0:x(e,t,i),n.length>0?N(n,t):void 0].filter(Boolean).join(`
18
- `).replaceAll("\\","/")},"internalRenderError"),_=s((e,r={})=>{if(r.framesMaxLimit!==void 0&&r.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return $(e,r,0)},"renderError");exports.renderError=_;
@@ -1,34 +0,0 @@
1
- "use strict";var u=Object.defineProperty;var m=(e,t)=>u(e,"name",{value:t,configurable:!0});var c=Object.defineProperty,n=m((e,t)=>c(e,"name",{value:t,configurable:!0}),"t");const l=n(e=>`\`\`\`
2
- ${e.trim()}
3
- \`\`\``,"code"),a=n(e=>`\`\`\`bash
4
- ${e.trim()}
5
- \`\`\``,"bash"),d=n(e=>`\`\`\`ts
6
- ${e.trim()}
7
- \`\`\``,"ts"),f=n(e=>`\`\`\`js
8
- ${e.trim()}
9
- \`\`\``,"js"),r=n((e,...t)=>{const i=e.toLowerCase();return t.some(s=>i.includes(s.toLowerCase()))},"has"),h=[{name:"esm-cjs-interop",test:n(e=>{const t=(e?.message||String(e||"")).toString();if(r(t,"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:",a(`node -v
10
- cat package.json | jq .type`),"","Example dynamic import in CJS:",f("(async () => { const mod = await import('some-esm'); mod.default(); })();")].join(`
11
- `),title:"ESM/CJS interop"}},"test")},{name:"missing-default-export",test:n(e=>{const t=(e?.message||String(e||"")).toString();if(r(t,"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:",d(`export default function Component() {}
12
- // import Component from './file'`),"","Named export example:",d(`export function Component() {}
13
- // import { Component } from './file'`)].join(`
14
- `),title:"Export mismatch (default vs named)"}},"test")},{name:"port-in-use",test:n(e=>{const t=(e?.message||String(e||"")).toString();if(r(t,"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:",a(`lsof -i :3000
15
- kill -9 <PID>`),"","On Windows (PowerShell):",a(`netstat -ano | findstr :3000
16
- taskkill /PID <PID> /F`)].join(`
17
- `),title:"Port already in use"}},"test")},{name:"file-not-found-or-case",test:n((e,t)=>{const i=(e?.message||String(e||"")).toString();if(r(i,"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:",l(`${t.file}:${t.line}`)].join(`
18
- `),title:"Missing file or path case mismatch"}},"test")},{name:"ts-path-mapping",test:n(e=>{const t=(e?.message||String(e||"")).toString();if(r(t,"ts2307","cannot find module")||t.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:",d(`{
19
- "compilerOptions": {
20
- "baseUrl": ".",
21
- "paths": { "@/*": ["src/*"] }
22
- }
23
- }`)].join(`
24
- `),title:"TypeScript path mapping / resolution"}},"test")},{name:"network-dns-enotfound",test:n(e=>{const t=(e?.message||String(e||"")).toString();if(r(t,"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.","",a(`ping <host>
25
- nslookup <host>
26
- curl -v http://<host>:<port>`)].join(`
27
- `),title:"Network/DNS connection issue"}},"test")},{name:"undefined-property",test:n(e=>{const t=(e?.message||String(e||"")).toString();if(r(t,"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.","",d("const value = maybe?.prop; // or: if (maybe) { use(maybe.prop) }")].join(`
28
- `),title:"Accessing property of undefined"}},"test")}],g={handle:n(async(e,t)=>{try{const i=h.map(o=>({match:o.test(e,t),rule:o})).filter(o=>!!o.match);if(i.length===0)return;const s=i.toSorted((o,p)=>(o.match.priority||0)-(p.match.priority||0)).map(o=>`#### ${o.match.title}
29
-
30
- ${o.match.md}`).join(`
31
-
32
- ---
33
-
34
- `);return s===""?void 0:{body:s,header:"### Potential fixes detected"}}catch{return}},"handle"),name:"ruleBasedHints",priority:0};module.exports=g;
@@ -1 +0,0 @@
1
- "use strict";var b=Object.defineProperty;var l=(e,t)=>b(e,"name",{value:t,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const m=require("./index-CqSGigts.cjs"),d=Object.create({},{cause:{enumerable:!0,value:void 0,writable:!0},code:{enumerable:!0,value:void 0,writable:!0},errors:{enumerable:!0,value:void 0,writable:!0},message:{enumerable:!0,value:void 0,writable:!0},name:{enumerable:!0,value:void 0,writable:!0},stack:{enumerable:!0,value:void 0,writable:!0}});var p=Object.defineProperty,s=l((e,t)=>p(e,"name",{value:t,configurable:!0}),"c");const c=new WeakSet,v=s(e=>{c.add(e);const t=e.toJSON();return c.delete(e),t},"toJSON"),f=s((e,t,n,u)=>{if(e&&e instanceof Uint8Array&&e.constructor.name==="Buffer")return"[object Buffer]";if(e!==null&&typeof e=="object"&&typeof e.pipe=="function")return"[object Stream]";if(e instanceof Error)return t.includes(e)?"[Circular]":(n+=1,i(e,u,t,n));if(u.useToJSON&&typeof e.toJSON=="function")return e.toJSON();if(typeof e=="object"&&e instanceof Date)return e.toISOString();if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(m.r(e)){if(n+=1,u.maxDepth&&n>=u.maxDepth)return{};const r={};for(const o in e)r[o]=f(e[o],t,n,u);return r}try{return e}catch{return"[Not Available]"}},"serializeValue"),i=s((e,t,n,u)=>{if(n.push(e),t.maxDepth===0)return{};if(t.useToJSON&&typeof e.toJSON=="function"&&!c.has(e))return v(e);const r=Object.create(d);if(r.name=Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,r.message=e.message,r.stack=e.stack,Array.isArray(e.errors)){const o=[];for(const a of e.errors){if(!(a instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(n.includes(a))return r.errors=[],r;o.push(i(a,t,n,u))}r.errors=o}e.cause instanceof Error&&!n.includes(e.cause)&&(r.cause=i(e.cause,t,n,u));for(const o in e)if(r[o]===void 0){const a=e[o];r[o]=f(a,n,u,t)}if(Array.isArray(t.exclude)&&t.exclude.length>0)for(const o of t.exclude)try{delete r[o]}catch{}return r},"_serialize"),y=s((e,t={})=>i(e,{exclude:t.exclude??[],maxDepth:t.maxDepth??Number.POSITIVE_INFINITY,useToJSON:t.useToJSON??!1},[],0),"serialize");exports.serialize=y;
@@ -1 +0,0 @@
1
- var m=Object.defineProperty;var f=(e,t)=>m(e,"name",{value:t,configurable:!0});import{r as b}from"./index-CLFYRLyq.mjs";const p=Object.create({},{cause:{enumerable:!0,value:void 0,writable:!0},code:{enumerable:!0,value:void 0,writable:!0},errors:{enumerable:!0,value:void 0,writable:!0},message:{enumerable:!0,value:void 0,writable:!0},name:{enumerable:!0,value:void 0,writable:!0},stack:{enumerable:!0,value:void 0,writable:!0}});var d=Object.defineProperty,i=f((e,t)=>d(e,"name",{value:t,configurable:!0}),"c");const s=new WeakSet,y=i(e=>{s.add(e);const t=e.toJSON();return s.delete(e),t},"toJSON"),l=i((e,t,n,u)=>{if(e&&e instanceof Uint8Array&&e.constructor.name==="Buffer")return"[object Buffer]";if(e!==null&&typeof e=="object"&&typeof e.pipe=="function")return"[object Stream]";if(e instanceof Error)return t.includes(e)?"[Circular]":(n+=1,c(e,u,t,n));if(u.useToJSON&&typeof e.toJSON=="function")return e.toJSON();if(typeof e=="object"&&e instanceof Date)return e.toISOString();if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(b(e)){if(n+=1,u.maxDepth&&n>=u.maxDepth)return{};const r={};for(const o in e)r[o]=l(e[o],t,n,u);return r}try{return e}catch{return"[Not Available]"}},"serializeValue"),c=i((e,t,n,u)=>{if(n.push(e),t.maxDepth===0)return{};if(t.useToJSON&&typeof e.toJSON=="function"&&!s.has(e))return y(e);const r=Object.create(p);if(r.name=Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,r.message=e.message,r.stack=e.stack,Array.isArray(e.errors)){const o=[];for(const a of e.errors){if(!(a instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(n.includes(a))return r.errors=[],r;o.push(c(a,t,n,u))}r.errors=o}e.cause instanceof Error&&!n.includes(e.cause)&&(r.cause=c(e.cause,t,n,u));for(const o in e)if(r[o]===void 0){const a=e[o];r[o]=l(a,n,u,t)}if(Array.isArray(t.exclude)&&t.exclude.length>0)for(const o of t.exclude)try{delete r[o]}catch{}return r},"_serialize"),S=i((e,t={})=>c(e,{exclude:t.exclude??[],maxDepth:t.maxDepth??Number.POSITIVE_INFINITY,useToJSON:t.useToJSON??!1},[],0),"serialize");export{S as serialize};
@@ -1,20 +0,0 @@
1
- type Solution = {
2
- body: string;
3
- header?: string;
4
- };
5
- type SolutionFinderFile = {
6
- file: string;
7
- language?: string;
8
- line: number;
9
- snippet?: string | undefined;
10
- };
11
- type SolutionFinder = {
12
- handle: (error: any, file: SolutionFinderFile) => Promise<Solution | undefined>;
13
- name: string;
14
- priority: number;
15
- };
16
- type SolutionError = Error & {
17
- hint?: Solution;
18
- };
19
-
20
- export type { Solution as S, SolutionError as a, SolutionFinder as b, SolutionFinderFile as c };
@@ -1,20 +0,0 @@
1
- type Solution = {
2
- body: string;
3
- header?: string;
4
- };
5
- type SolutionFinderFile = {
6
- file: string;
7
- language?: string;
8
- line: number;
9
- snippet?: string | undefined;
10
- };
11
- type SolutionFinder = {
12
- handle: (error: any, file: SolutionFinderFile) => Promise<Solution | undefined>;
13
- name: string;
14
- priority: number;
15
- };
16
- type SolutionError = Error & {
17
- hint?: Solution;
18
- };
19
-
20
- export type { Solution as S, SolutionError as a, SolutionFinder as b, SolutionFinderFile as c };
@@ -1,25 +0,0 @@
1
- type CodeFrameLocation = {
2
- column?: number;
3
- line: number;
4
- };
5
- type CodeFrameNodeLocation = {
6
- end?: CodeFrameLocation;
7
- start: CodeFrameLocation;
8
- };
9
- type ColorizeMethod = (value: string) => string;
10
- type CodeFrameOptions = {
11
- color?: {
12
- gutter?: ColorizeMethod;
13
- marker?: ColorizeMethod;
14
- message?: ColorizeMethod;
15
- };
16
- linesAbove?: number;
17
- linesBelow?: number;
18
- message?: string;
19
- prefix?: string;
20
- showGutter?: boolean;
21
- showLineNumbers?: boolean;
22
- tabWidth?: number | false;
23
- };
24
-
25
- export type { CodeFrameLocation as C, CodeFrameNodeLocation as a, CodeFrameOptions as b, ColorizeMethod as c };
@@ -1,25 +0,0 @@
1
- type CodeFrameLocation = {
2
- column?: number;
3
- line: number;
4
- };
5
- type CodeFrameNodeLocation = {
6
- end?: CodeFrameLocation;
7
- start: CodeFrameLocation;
8
- };
9
- type ColorizeMethod = (value: string) => string;
10
- type CodeFrameOptions = {
11
- color?: {
12
- gutter?: ColorizeMethod;
13
- marker?: ColorizeMethod;
14
- message?: ColorizeMethod;
15
- };
16
- linesAbove?: number;
17
- linesBelow?: number;
18
- message?: string;
19
- prefix?: string;
20
- showGutter?: boolean;
21
- showLineNumbers?: boolean;
22
- tabWidth?: number | false;
23
- };
24
-
25
- export type { CodeFrameLocation as C, CodeFrameNodeLocation as a, CodeFrameOptions as b, ColorizeMethod as c };
@@ -1,32 +0,0 @@
1
- "use strict";var o=Object.defineProperty;var n=(e,i)=>o(e,"name",{value:i,configurable:!0});var s=Object.defineProperty,a=n((e,i)=>s(e,"name",{value:i,configurable:!0}),"t");const r=a(({applicationType:e,error:i,file:t})=>`You are a very skilled ${t.language} 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: ${t.line}
21
-
22
- File:
23
- ${t.file}
24
-
25
- Snippet including line numbers:
26
- ${t.snippet}
27
-
28
- Exception class:
29
- ${i.name}
30
-
31
- Exception message:
32
- ${i.message}`,"aiPrompt");module.exports=r;
@@ -1,9 +0,0 @@
1
- import { c as SolutionFinderFile } from '../../packem_shared/types-BtQS7FHG.cjs';
2
-
3
- declare const aiPrompt: ({ applicationType, error, file, }: {
4
- applicationType: string | undefined;
5
- error: Error;
6
- file: SolutionFinderFile;
7
- }) => string;
8
-
9
- export = aiPrompt;
@@ -1,9 +0,0 @@
1
- import { c as SolutionFinderFile } from '../../packem_shared/types-BtQS7FHG.mjs';
2
-
3
- declare const aiPrompt: ({ applicationType, error, file, }: {
4
- applicationType: string | undefined;
5
- error: Error;
6
- file: SolutionFinderFile;
7
- }) => string;
8
-
9
- export { aiPrompt as default };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../../packem_shared/aiFinder-CN0pneE2.cjs"),i=require("./ai-prompt.cjs"),o=require("../../packem_shared/aiSolutionResponse-C5apAmTu.cjs");exports.aiFinder=e;exports.aiPrompt=i;exports.aiSolutionResponse=o;
@@ -1,16 +0,0 @@
1
- import { LanguageModel } from 'ai';
2
- import { b as SolutionFinder } from '../../packem_shared/types-BtQS7FHG.cjs';
3
- export { default as aiPrompt } from './ai-prompt.cjs';
4
- export { a as aiSolutionResponse } from '../../packem_shared/ai-solution-response-BuaDQAEU.cjs';
5
-
6
- interface CacheOptions {
7
- directory?: string;
8
- enabled?: boolean;
9
- ttl?: number;
10
- }
11
- declare const aiFinder: (model: LanguageModel, options?: {
12
- cache?: CacheOptions;
13
- temperature?: number;
14
- }) => SolutionFinder;
15
-
16
- export { aiFinder };
@@ -1,16 +0,0 @@
1
- import { LanguageModel } from 'ai';
2
- import { b as SolutionFinder } from '../../packem_shared/types-BtQS7FHG.mjs';
3
- export { default as aiPrompt } from './ai-prompt.mjs';
4
- export { a as aiSolutionResponse } from '../../packem_shared/ai-solution-response-BuaDQAEU.mjs';
5
-
6
- interface CacheOptions {
7
- directory?: string;
8
- enabled?: boolean;
9
- ttl?: number;
10
- }
11
- declare const aiFinder: (model: LanguageModel, options?: {
12
- cache?: CacheOptions;
13
- temperature?: number;
14
- }) => SolutionFinder;
15
-
16
- export { aiFinder };
@@ -1 +0,0 @@
1
- import{default as e}from"../../packem_shared/aiFinder-Be-xHFVO.mjs";import{default as t}from"./ai-prompt.mjs";import{default as i}from"../../packem_shared/aiSolutionResponse-RD0AK1jh.mjs";export{e as aiFinder,t as aiPrompt,i as aiSolutionResponse};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../packem_shared/errorHintFinder-DRCn1Ysx.cjs"),r=require("../packem_shared/ruleBasedFinder-B1jRHBM_.cjs");exports.errorHintFinder=e;exports.ruleBasedFinder=r;
@@ -1,8 +0,0 @@
1
- import { b as SolutionFinder } from '../packem_shared/types-BtQS7FHG.cjs';
2
- export { S as Solution, a as SolutionError, c as SolutionFinderFile } from '../packem_shared/types-BtQS7FHG.cjs';
3
-
4
- declare const errorHintFinder: SolutionFinder;
5
-
6
- declare const ruleBasedFinder: SolutionFinder;
7
-
8
- export { SolutionFinder, errorHintFinder, ruleBasedFinder };
@@ -1,8 +0,0 @@
1
- import { b as SolutionFinder } from '../packem_shared/types-BtQS7FHG.mjs';
2
- export { S as Solution, a as SolutionError, c as SolutionFinderFile } from '../packem_shared/types-BtQS7FHG.mjs';
3
-
4
- declare const errorHintFinder: SolutionFinder;
5
-
6
- declare const ruleBasedFinder: SolutionFinder;
7
-
8
- export { SolutionFinder, errorHintFinder, ruleBasedFinder };
@@ -1 +0,0 @@
1
- import{default as a}from"../packem_shared/errorHintFinder-C_g0nvml.mjs";import{default as o}from"../packem_shared/ruleBasedFinder-P88d0gpK.mjs";export{a as errorHintFinder,o as ruleBasedFinder};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../packem_shared/parseStacktrace-MW4-SLXl.cjs"),e=require("../packem_shared/formatStackFrameLine-DD2DUdW0.cjs");exports.parseStacktrace=a;exports.formatStackFrameLine=e.formatStackFrameLine;exports.formatStacktrace=e.formatStacktrace;
@@ -1,25 +0,0 @@
1
- type TraceType = "eval" | "internal" | "native" | undefined;
2
- interface Trace {
3
- column: number | undefined;
4
- evalOrigin?: Trace | undefined;
5
- file: string | undefined;
6
- line: number | undefined;
7
- methodName: string | undefined;
8
- raw: string;
9
- type?: TraceType | undefined;
10
- }
11
-
12
- declare const parseStacktrace: (error: Error, { filter, frameLimit }?: Partial<{
13
- filter?: (line: string) => boolean;
14
- frameLimit: number;
15
- }>) => Trace[];
16
-
17
- declare const formatStackFrameLine: (frame: Trace) => string;
18
- declare const formatStacktrace: (frames: Trace[], options?: {
19
- header?: {
20
- message?: string;
21
- name?: string;
22
- };
23
- }) => string;
24
-
25
- export { type Trace, type TraceType, formatStackFrameLine, formatStacktrace, parseStacktrace };
@@ -1,25 +0,0 @@
1
- type TraceType = "eval" | "internal" | "native" | undefined;
2
- interface Trace {
3
- column: number | undefined;
4
- evalOrigin?: Trace | undefined;
5
- file: string | undefined;
6
- line: number | undefined;
7
- methodName: string | undefined;
8
- raw: string;
9
- type?: TraceType | undefined;
10
- }
11
-
12
- declare const parseStacktrace: (error: Error, { filter, frameLimit }?: Partial<{
13
- filter?: (line: string) => boolean;
14
- frameLimit: number;
15
- }>) => Trace[];
16
-
17
- declare const formatStackFrameLine: (frame: Trace) => string;
18
- declare const formatStacktrace: (frames: Trace[], options?: {
19
- header?: {
20
- message?: string;
21
- name?: string;
22
- };
23
- }) => string;
24
-
25
- export { type Trace, type TraceType, formatStackFrameLine, formatStacktrace, parseStacktrace };
@@ -1 +0,0 @@
1
- import{default as t}from"../packem_shared/parseStacktrace-Dnxnc4PL.mjs";import{formatStackFrameLine as o,formatStacktrace as c}from"../packem_shared/formatStackFrameLine-iU54KA81.mjs";export{o as formatStackFrameLine,c as formatStacktrace,t as parseStacktrace};
File without changes