@visulima/error 4.6.2 → 5.0.0

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 +21 -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-UDgN90WO.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 +16 -86
  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
package/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## @visulima/error [5.0.0](https://github.com/visulima/visulima/compare/@visulima/error@4.6.2...@visulima/error@5.0.0) (2025-10-15)
2
+
3
+ ### ⚠ BREAKING CHANGES
4
+
5
+ * Adjusted the node engine requirement to support versions 20.19 and above
6
+
7
+ ### Bug Fixes
8
+
9
+ * Adjusted the node engine requirement to support versions 20.19 and above ([92fb543](https://github.com/visulima/visulima/commit/92fb543b04652a46e108e3d831ccf3f7c0957293))
10
+ * update @visulima/packem to 2.0.0-alpha.30 across multiple packages for improved compatibility ([27b346e](https://github.com/visulima/visulima/commit/27b346eaa1c0fb0e420d9a9824482028307f4249))
11
+ * update ESLint configuration and enhance package dependencies for improved performance ([5b5196f](https://github.com/visulima/visulima/commit/5b5196f85f93ad4219967331c8965d2e2a39d72a))
12
+
13
+ ### Miscellaneous Chores
14
+
15
+ * update package dependencies across multiple packages for improved compatibility and performance ([9567591](https://github.com/visulima/visulima/commit/9567591c415da3002f3a4fe08f8caf7ce01ca5f7))
16
+
17
+
18
+ ### Dependencies
19
+
20
+ * **@visulima/path:** upgraded to 2.0.0
21
+
1
22
  ## @visulima/error [4.6.2](https://github.com/visulima/visulima/compare/@visulima/error@4.6.1...@visulima/error@4.6.2) (2025-09-23)
2
23
 
3
24
  ### Bug Fixes
@@ -92,4 +92,5 @@ type Options = {
92
92
  };
93
93
  declare const serialize: (error: AggregateError | Error | JsonError, options?: Options) => SerializedError;
94
94
 
95
- export { type ErrorHint, type ErrorLocation, type ErrorProperties, type Options as ErrorWithCauseSerializerOptions, NonError, type Options$1 as RenderErrorOptions, type SerializedError, VisulimaError, addKnownErrorConstructor, captureRawStackTrace, deserialize as deserializeError, getErrorCauses, isErrorLike, isVisulimaError, renderError, serialize as serializeError };
95
+ export { NonError, VisulimaError, addKnownErrorConstructor, captureRawStackTrace, deserialize as deserializeError, getErrorCauses, isErrorLike, isVisulimaError, renderError, serialize as serializeError };
96
+ export type { ErrorHint, ErrorLocation, ErrorProperties, Options as ErrorWithCauseSerializerOptions, Options$1 as RenderErrorOptions, SerializedError };
@@ -0,0 +1 @@
1
+ import{default as e}from"../packem_shared/captureRawStackTrace-CQPNHvBG.js";import{default as t}from"../packem_shared/getErrorCauses-geeK5cwE.js";import{renderError as i}from"../packem_shared/renderError-ZMlMvw1N.js";import{default as m}from"../packem_shared/deserializeError-BJM8Kd6G.js";import{addKnownErrorConstructor as p,isErrorLike as u}from"../packem_shared/addKnownErrorConstructor-BqqnTSZp.js";import{default as d}from"../packem_shared/NonError-CS10kwil.js";import{serialize as n}from"../packem_shared/serializeError-CTpDr3CL.js";import{VisulimaError as z,isVisulimaError as k}from"../packem_shared/isVisulimaError-jVZgumOU.js";export{d as NonError,z as VisulimaError,p as addKnownErrorConstructor,e as captureRawStackTrace,m as deserializeError,t as getErrorCauses,u as isErrorLike,k as isVisulimaError,i as renderError,n as serializeError};
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ import{CODE_FRAME_POINTER as o,codeFrame as a}from"./code-frame/index.js";import{default as f}from"./packem_shared/indexToLineColumn-B1F7aNZh.js";import{addKnownErrorConstructor as m,isErrorLike as i}from"./packem_shared/addKnownErrorConstructor-BqqnTSZp.js";import{default as d}from"./packem_shared/captureRawStackTrace-CQPNHvBG.js";import{default as u}from"./packem_shared/deserializeError-BJM8Kd6G.js";import{default as n}from"./packem_shared/getErrorCauses-geeK5cwE.js";import{VisulimaError as c,isVisulimaError as k}from"./packem_shared/isVisulimaError-jVZgumOU.js";import{default as S}from"./packem_shared/NonError-CS10kwil.js";import{renderError as R}from"./packem_shared/renderError-ZMlMvw1N.js";import{serialize as L}from"./packem_shared/serializeError-CTpDr3CL.js";import{default as w}from"./solution/ai/ai-prompt.js";import{default as O}from"./packem_shared/aiSolutionResponse-RD0AK1jh.js";import{default as V}from"./packem_shared/errorHintFinder-C_g0nvml.js";import{default as g}from"./packem_shared/ruleBasedFinder-P88d0gpK.js";import{formatStackFrameLine as B,formatStacktrace as D}from"./packem_shared/formatStackFrameLine-iU54KA81.js";import{default as I}from"./packem_shared/parseStacktrace-Dnxnc4PL.js";export{o as CODE_FRAME_POINTER,S as NonError,c as VisulimaError,m as addKnownErrorConstructor,w as aiPrompt,O as aiSolutionResponse,d as captureRawStackTrace,a as codeFrame,u as deserializeError,V as errorHintFinder,B as formatStackFrameLine,D as formatStacktrace,n as getErrorCauses,f as indexToLineColumn,i as isErrorLike,k as isVisulimaError,I as parseStacktrace,R as renderError,g as ruleBasedFinder,L as serializeError};
@@ -0,0 +1 @@
1
+ var Zt=Object.defineProperty;var N=(n,o)=>Zt(n,"name",{value:o,configurable:!0});import{createRequire as Tt}from"node:module";import qt from"../solution/ai/ai-prompt.js";import J from"./aiSolutionResponse-RD0AK1jh.js";const $e=Tt(import.meta.url),Z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Y=N(n=>{if(typeof Z<"u"&&Z.versions&&Z.versions.node){const[o,i]=Z.versions.node.split(".").map(Number);if(o>22||o===22&&i>=3||o===20&&i>=16)return Z.getBuiltinModule(n)}return $e(n)},"__cjs_getBuiltinModule"),{createHash:Bt}=Y("node:crypto"),{existsSync:be,readFileSync:Dt,mkdirSync:Et,writeFileSync:Nt}=Y("node:fs"),{tmpdir:Rt}=Y("node:os"),{generateText:Ft}=$e("ai");var Wt=Object.defineProperty,Q=N((n,o)=>Wt(n,"name",{value:o,configurable:!0}),"I"),Jt=Object.defineProperty,u=Q((n,o)=>Jt(n,"name",{value:o,configurable:!0}),"__name$2");let ge=u(()=>{var n=(()=>{var o=Object.defineProperty,i=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,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of l(t))!d.call(e,s)&&s!==r&&o(e,s,{get:u(()=>t[s],"get"),enumerable:!(a=i(t,s))||a.enumerable});return e},"T"),g=u(e=>b(o({},"__esModule",{value:!0}),e),"W"),k={};m(k,{zeptomatch:u(()=>kt,"zeptomatch")});var j=u(e=>Array.isArray(e),"k"),x=u(e=>typeof e=="function","x"),A=u(e=>e.length===0,"K"),S=(()=>{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))})(),Ae=u(e=>typeof e=="number","Y"),Me=u(e=>typeof e=="object"&&e!==null,"rr"),Oe=u(e=>e instanceof RegExp,"er"),ze=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),ke=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),V=u(e=>typeof e=="string","M"),M=u(e=>e===void 0,"f"),Ce=u(e=>{const t=new Map;return r=>{const a=t.get(r);if(a!==void 0)return a;const s=e(r);return t.set(r,s),s}},"ar"),Pe=u((e,t,r={})=>{const a={cache:{},input:e,index:0,indexBacktrackMax:0,options:r,output:[]},s=O(t)(a),f=Math.max(a.index,a.indexBacktrackMax);if(s&&a.index===e.length)return a.output;throw new Error(`Failed to parse at index ${f}`)},"or"),c=u((e,t)=>j(e)?Se(e,t):V(e)?X(e,t):Ie(e,t),"o"),Se=u((e,t)=>{const r={};for(const a of e){if(a.length!==1)throw new Error(`Invalid character: "${a}"`);const s=a.charCodeAt(0);r[s]=!0}return a=>{const s=a.input;let f=a.index,p=f;for(;p<s.length&&s.charCodeAt(p)in r;)p+=1;if(p>f){if(!M(t)&&!a.options.silent){const h=s.slice(f,p),$=x(t)?t(h,s,`${f}`):t;M($)||a.output.push($)}a.index=p}return!0}},"ir"),Ie=u((e,t)=>{if(ke(e))return X(e.source,t);{const r=e.source,a=e.flags.replace(/y|$/,"y"),s=new RegExp(r,a);return ze(e)&&x(t)&&!S(t)?Ze(s,t):Te(s,t)}},"ur"),Ze=u((e,t)=>r=>{const a=r.index,s=r.input;e.lastIndex=a;const f=e.exec(s);if(f){const p=e.lastIndex;if(!r.options.silent){const h=t(...f,s,`${a}`);M(h)||r.output.push(h)}return r.index=p,!0}else return!1},"sr"),Te=u((e,t)=>r=>{const a=r.index,s=r.input;if(e.lastIndex=a,e.test(s)){const f=e.lastIndex;if(!M(t)&&!r.options.silent){const p=x(t)?t(s.slice(a,f),s,`${a}`):t;M(p)||r.output.push(p)}return r.index=f,!0}else return!1},"cr"),X=u((e,t)=>r=>{const a=r.index,s=r.input;if(s.startsWith(e,a)){if(!M(t)&&!r.options.silent){const f=x(t)?t(e,s,`${a}`):t;M(f)||r.output.push(f)}return r.index+=e.length,!0}else return!1},"R"),ee=u((e,t,r,a)=>{const s=O(e),f=t>1;return F(R(te(p=>{let h=0;for(;h<r;){const $=p.index;if(!s(p)||(h+=1,p.index===$))break}return h>=t},f),a))},"O"),Be=u((e,t)=>ee(e,0,1,t),"lr"),B=u((e,t)=>ee(e,0,1/0,t),"m"),D=u((e,t)=>{const r=e.map(O);return F(R(te(a=>{for(let s=0,f=r.length;s<f;s++)if(!r[s](a))return!1;return!0}),t))},"_"),w=u((e,t)=>{const r=e.map(O);return F(R(a=>{for(let s=0,f=r.length;s<f;s++)if(r[s](a))return!0;return!1},t))},"p"),te=u((e,t=!0,r=!1)=>{const a=O(e);return t?s=>{const f=s.index,p=s.output.length,h=a(s);return!h&&!r&&(s.indexBacktrackMax=Math.max(s.indexBacktrackMax,s.index)),(!h||r)&&(s.index=f,s.output.length!==p&&(s.output.length=p)),h}:a},"P"),R=u((e,t)=>{const r=O(e);return t?a=>{if(a.options.silent)return r(a);const s=a.output.length;if(r(a)){const f=a.output.splice(s,1/0),p=t(f);return M(p)||a.output.push(p),!0}else return!1}:r},"C"),F=(()=>{let e=0;return t=>{const r=O(t),a=e+=1;return s=>{var f;if(s.options.memoization===!1)return r(s);const p=s.index,h=(f=s.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 P=0,Pt=$.length;P<Pt;P+=2){const St=$[P*2],It=$[P*2+1];I.set(St,It)}$.length=0}const v=I.get(p);if(v===!1)return!1;if(Ae(v))return s.index=v,!0;if(v)return s.index=v.index,v.output?.length&&s.output.push(...v.output),!0}const he=s.output.length,Ct=r(s);if(h.indexMax=Math.max(h.indexMax,p),Ct){const I=s.index,v=s.output.length;if(v>he){const P=s.output.slice(he,v);$.push(p,{index:I,output:P})}else $.push(p,I);return!0}else return $.push(p,!1),!1}}})(),ne=u(e=>{let t;return r=>(t||(t=O(e())),t(r))},"A"),O=Ce(e=>{if(x(e))return A(e)?ne(e):e;if(V(e)||Oe(e))return c(e);if(j(e))return D(e);if(Me(e))return w(Object.values(e));throw new Error("Invalid rule")}),_=u(e=>e,"v"),re=u(e=>t=>Pe(t,e,{memoization:!1}).join(""),"z"),De=u(e=>{const t={};return r=>t[r]??(t[r]=e(r))},"pr"),oe="abcdefghijklmnopqrstuvwxyz",Ee=u(e=>{let t="";for(;e>0;){const r=(e-1)%26;t=oe[r]+t,e=Math.floor((e-1)/26)}return t},"vr"),ie=u(e=>{let t=0;for(let r=0,a=e.length;r<a;r++)t=t*26+oe.indexOf(e[r])+1;return t},"N"),q=u((e,t)=>{if(t<e)return q(t,e);const r=[];for(;e<=t;)r.push(e++);return r},"$"),Ne=u((e,t,r)=>q(e,t).map(a=>String(a).padStart(r,"0")),"fr"),se=u((e,t)=>q(ie(e),ie(t)).map(Ee),"j"),W=c(/\\./,_),Re=c(/[$.*+?^(){}[\]\|]/,e=>`\\${e}`),Fe=c(/./,_),qe=c(/^(?:!!)*!(.*)$/,(e,t)=>`(?!^${de(t)}$).*?`),We=c(/^(!!)+/,""),Je=w([qe,We]),Le=c(/\/(\*\*\/)+/,"(?:[\\\\/].+[\\\\/]|[\\\\/])"),Ke=c(/^(\*\*\/)+/,"(?:^|.*[\\\\/])"),Ue=c(/\/(\*\*)$/,"(?:[\\\\/].*|$)"),Ge=c(/\*\*/,".*"),ae=w([Le,Ke,Ue,Ge]),He=c(/\*\/(?!\*\*\/|\*$)/,"[^\\\\/]*[\\\\/]"),Ye=c(/\*/,"[^\\\\/]*"),le=w([He,Ye]),ue=c("?","[^\\\\/]"),Qe=c("[",_),Ve=c("]",_),Xe=c(/[!^]/,"^\\\\/"),et=c(/[a-z]-[a-z]|[0-9]-[0-9]/i,_),tt=c(/[$.*+?^(){}[\|]/,e=>`\\${e}`),nt=c(/[^\]]/,_),rt=w([W,tt,et,nt]),ce=D([Qe,Be(Xe),B(rt),Ve]),ot=c("{","(?:"),it=c("}",")"),st=c(/(\d+)\.\.(\d+)/,(e,t,r)=>Ne(+t,+r,Math.min(t.length,r.length)).join("|")),at=c(/([a-z]+)\.\.([a-z]+)/,(e,t,r)=>se(t,r).join("|")),lt=c(/([A-Z]+)\.\.([A-Z]+)/,(e,t,r)=>se(t.toLowerCase(),r.toLowerCase()).join("|").toUpperCase()),ut=w([st,at,lt]),fe=D([ot,ut,it]),ct=c("{","(?:"),ft=c("}",")"),pt=c(",","|"),dt=c(/[$.*+?^(){[\]\|]/,e=>`\\${e}`),ht=c(/[^}]/,_),gt=ne(()=>pe),mt=w([ae,le,ue,ce,fe,gt,W,dt,pt,ht]),pe=D([ct,B(mt),ft]),xt=B(w([Je,ae,le,ue,ce,fe,pe,W,Re,Fe])),yt=xt,$t=re(yt),de=$t,bt=c(/\\./,_),vt=c(/./,_),jt=c(/\*\*\*+/,"*"),wt=c(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),_t=c(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),At=B(w([bt,jt,wt,_t,vt])),Mt=At,Ot=re(Mt),zt=Ot,E=u((e,t)=>Array.isArray(e)?e.map(E.compile).some(r=>r.test(t)):E.compile(e).test(t),"S");E.compile=De(e=>new RegExp(`^${de(zt(e))}[\\\\/]?$`,"s"));var kt=E;return g(k)})();return n.default||n},"_lazyMatch"),L;const Lt=u((n,o)=>(L||(L=ge(),ge=null),L(n,o)),"default");var Kt=Object.defineProperty,Ut=Q((n,o)=>Kt(n,"name",{value:o,configurable:!0}),"__name$1");const Gt=/^[A-Z]:\//i,C=Ut((n="")=>n&&n.replaceAll("\\","/").replace(Gt,o=>o.toUpperCase()),"normalizeWindowsPath");var Ht=Object.defineProperty,y=Q((n,o)=>Ht(n,"name",{value:o,configurable:!0}),"__name");const Yt=/^[/\\]{2}/,Qt=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ve=/^[A-Z]:$/i,me=/^\/([A-Z]:)?$/i,Vt=/.(\.[^./]+)$/,Xt=/^[/\\]|^[a-z]:[/\\]/i,en=y(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),je=y((n,o)=>{let i="",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(i.length<2||l!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const k=i.lastIndexOf("/");k===-1?(i="",l=0):(i=i.slice(0,k),l=i.length-1-i.lastIndexOf("/")),d=g,m=0;continue}else if(i.length>0){i="",l=0,d=g,m=0;continue}}o&&(i+=i.length>0?"/..":"..",l=2)}else i.length>0?i+=`/${n.slice(d+1,g)}`:i=n.slice(d+1,g),l=g-d-1;d=g,m=0}else b==="."&&m!==-1?++m:m=-1}return i},"normalizeString"),T=y(n=>Qt.test(n),"isAbsolute"),we=y(function(n){if(n.length===0)return".";n=C(n);const o=Yt.exec(n),i=T(n),l=n.at(-1)==="/";return n=je(n,!i),n.length===0?i?"/":l?"./":".":(l&&(n+="/"),ve.test(n)&&(n+="/"),o?i?`//${n}`:`//./${n}`:i&&!T(n)?`/${n}`:n)},"normalize"),_e=y((...n)=>{let o="";for(const i of n)if(i)if(o.length>0){const l=o[o.length-1]==="/",d=i[0]==="/";l&&d?o+=i.slice(1):o+=l||d?i:`/${i}`}else o+=i;return we(o)},"join"),H=y(function(...n){n=n.map(l=>C(l));let o="",i=!1;for(let l=n.length-1;l>=-1&&!i;l--){const d=l>=0?n[l]:en();!d||d.length===0||(o=`${d}/${o}`,i=T(d))}return o=je(o,!i),i&&!T(o)?`/${o}`:o.length>0?o:"."},"resolve");y(function(n){return C(n)},"toNamespacedPath");const tn=y(function(n){return Vt.exec(C(n))?.[1]??""},"extname");y(function(n,o){const i=H(n).replace(me,"$1").split("/"),l=H(o).replace(me,"$1").split("/");if(l[0][1]===":"&&i[0][1]===":"&&i[0]!==l[0])return l.join("/");const d=[...i];for(const m of d){if(l[0]!==m)break;i.shift(),l.shift()}return[...i.map(()=>".."),...l].join("/")},"relative");const nn=y(n=>{const o=C(n).replace(/\/$/,"").split("/").slice(0,-1);return o.length===1&&ve.test(o[0])&&(o[0]+="/"),o.join("/")||(T(n)?"/":".")},"dirname");y(function(n){const o=[n.root,n.dir,n.base??n.name+n.ext].filter(Boolean);return C(n.root?H(...o):o.join("/"))},"format");const rn=y((n,o)=>{const i=C(n).split("/").pop();return o&&i.endsWith(o)?i.slice(0,-o.length):i},"basename");y(function(n){const o=Xt.exec(n)?.[0]?.replace(/\\/g,"/")??"",i=rn(n),l=tn(i);return{base:i,dir:nn(n),ext:l,name:i.slice(0,i.length-l.length),root:o}},"parse");y((n,o)=>Lt(o,we(n)),"matchesGlob");var on=Object.defineProperty,z=N((n,o)=>on(n,"name",{value:o,configurable:!0}),"i");const K="## Ai Generated Solution",xe="Creation of a AI solution failed.",U=z((n,o,i)=>{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:i};return Bt("sha256").update(JSON.stringify(l)).digest("hex")},"generateCacheKey"),sn=z(n=>n||_e(Rt(),"visulima-error-cache"),"getCacheDirectory"),an=z(n=>{be(n)||Et(n,{recursive:!0})},"ensureCacheDirectory"),G=z((n,o)=>_e(n,`${o}.json`),"getCacheFilePath"),ln=z((n,o)=>{try{if(!be(n))return;const i=Dt(n,"utf8"),l=JSON.parse(i);return Date.now()-l.timestamp>o?void 0:l.solution}catch{return}},"readFromCache"),ye=z((n,o,i)=>{try{const l={solution:o,timestamp:Date.now(),ttl:i};Nt(n,JSON.stringify(l,null,2),"utf8")}catch{}},"writeToCache"),dn=z((n,o)=>({handle:z(async(i,l)=>{const d=o?.cache,m=o?.temperature??0,b=d?.ttl??1440*60*1e3,g=sn(d?.directory);if(d?.enabled!==!1){const j=U(i,l,m),x=G(g,j),A=ln(x,b);if(A)return A;an(g)}const k=qt({applicationType:void 0,error:i,file:l});try{const j=(await Ft({model:n,prompt:k,temperature:m})).text;let x;if(j?x={body:J(j),header:K}:x={body:J(xe),header:K},d?.enabled!==!1){const A=U(i,l,m),S=G(g,A);ye(S,x,b)}return x}catch(j){console.error(j);const x={body:J(xe),header:K};if(d?.enabled!==!1){const A=U(i,l,m),S=G(g,A);ye(S,x,b)}return x}},"handle"),name:"AI SDK",priority:99}),"aiFinder");export{dn as default};
@@ -0,0 +1 @@
1
+ var w=Object.defineProperty;var p=(e,r)=>w(e,"name",{value:r,configurable:!0});import{r as b}from"./index-CLFYRLyq.js";import{isErrorLike as g,getErrorConstructor as A}from"./addKnownErrorConstructor-BqqnTSZp.js";import f from"./NonError-CS10kwil.js";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};
@@ -0,0 +1 @@
1
+ var i=Object.defineProperty;var n=(r,e)=>i(r,"name",{value:e,configurable:!0});import{createRequire as c}from"node:module";const a=c(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=n(r=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,o]=t.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return t.getBuiltinModule(r)}return a(r)},"__cjs_getBuiltinModule"),{inspect:l}=u("node:util");var d=Object.defineProperty,f=n((r,e)=>d(r,"name",{value:e,configurable:!0}),"a");const b=f(r=>{const e=new Set,o=[];let s=r;for(;s;){if(e.has(s)){console.error(`Circular reference detected in error causes: ${l(r)}`);break}if(o.push(s),e.add(s),!s.cause)break;s=s.cause}return o},"getErrorCauses");export{b as default};
@@ -0,0 +1,18 @@
1
+ var M=Object.defineProperty;var m=(e,r)=>M(e,"name",{value:r,configurable:!0});import{createRequire as _}from"node:module";import{codeFrame as V}from"../code-frame/index.js";import v from"./parseStacktrace-Dnxnc4PL.js";const y=_(import.meta.url),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=m(e=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[r,i]=f.versions.node.split(".").map(Number);if(r>22||r===22&&i>=3||r===20&&i>=16)return f.getBuiltinModule(e)}return y(e)},"__cjs_getBuiltinModule"),{existsSync:S,readFileSync:T}=h("node:fs"),{relative:A}=h("node:path"),{cwd:N}=f,{fileURLToPath:P}=h("node:url");var j=Object.defineProperty,a=m((e,r)=>j(e,"name",{value:r,configurable:!0}),"o");const d=a((e,r,i)=>i===0?e.toString():r===" "?e+" ".repeat(i):e+" ".repeat(r*i),"getPrefix"),B=a((e,r)=>{const i=e.replace("async file:","file:");return A(r,i.startsWith("file:")?P(i):i)},"getRelativePath"),R=a((e,r,i)=>{if(r)return i.title(e.message);const t=e.message?`: ${e.message}`:"";return i.title(e.name+t)},"getTitleText"),w=a((e,{color:r,hideErrorTitle:i,indentation:t,prefix:n},s)=>`${d(n,t,s)}${R(e,i,r)}
2
+ `,"getMessage"),E=a((e,{color:r,indentation:i,prefix:t},n)=>{if(e.hint===void 0)return;const s=d(t,i,n);let o="";if(Array.isArray(e.hint))for(const l of e.hint)o+=`${(s+l).toString()}
3
+ `;else o+=s+e.hint;return r.hint(o)},"getHint"),g=a((e,{color:r,cwd:i,displayShortPath:t,indentation:n,prefix:s},o=0)=>{const l=t?B(e.file,i):e.file,{fileLine:c,method:u}=r;return`${d(s,n,o)}at ${e.methodName?`${u(e.methodName)} `:""}${c(l)}:${c(e.line?.toString()??"")}`.toString()},"getMainFrame"),b=a((e,{color:r,indentation:i,linesAbove:t,linesBelow:n,prefix:s,showGutter:o,showLineNumbers:l,tabWidth:c},u)=>{if(e.file===void 0)return;const p=e.file.replace("file://","");if(!S(p))return;const C=T(p,"utf8");return V(C,{start:{column:e.column,line:e.line}},{color:r,linesAbove:t,linesBelow:n,prefix:d(s,i,u),showGutter:o,showLineNumbers:l,tabWidth:c})},"getCode"),x=a((e,r,i)=>{if(e.errors.length===0)return;let t=`${d(r.prefix,r.indentation,i)}Errors:
4
+
5
+ `,n=!0;for(const s of e.errors)n?n=!1:t+=`
6
+
7
+ `,t+=L(s,{...r,framesMaxLimit:1,hideErrorCodeView:r.hideErrorErrorsCodeView},i+1);return`
8
+ ${t}`},"getErrors"),$=a((e,r,i)=>{let t=`${d(r.prefix,r.indentation,i)}Caused by:
9
+
10
+ `;const n=e.cause;t+=w(n,r,i);const s=v(n).shift(),o=E(n,r,i);if(o&&(t+=`${o}
11
+ `),s&&(t+=g(s,r,i),!r.hideErrorCauseCodeView)){const l=b(s,r,i);l!==void 0&&(t+=`
12
+ ${l}`)}if(n.cause)t+=`
13
+ ${$(n,r,i+1)}`;else if(n instanceof AggregateError){const l=x(n,r,i);l!==void 0&&(t+=`
14
+ ${l}`)}return`
15
+ ${t}`},"getCause"),k=a((e,r)=>(e.length>0?`
16
+ `:"")+e.map(i=>g(i,r)).join(`
17
+ `),"getStacktrace"),L=a((e,r,i)=>{const t={cwd:N(),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:a(o=>o,"fileLine"),gutter:a(o=>o,"gutter"),hint:a(o=>o,"hint"),marker:a(o=>o,"marker"),message:a(o=>o,"message"),method:a(o=>o,"method"),title:a(o=>o,"title"),...r.color}},n=v(e,{filter:r.filterStacktrace,frameLimit:t.framesMaxLimit}),s=n.shift();return[r.hideMessage?void 0:w(e,t,i),E(e,t,i),s?g(s,t,i):void 0,s&&!t.hideErrorCodeView?b(s,t,i):void 0,e instanceof AggregateError?x(e,t,i):void 0,e.cause===void 0?void 0:$(e,t,i),n.length>0?k(n,t):void 0].filter(Boolean).join(`
18
+ `).replaceAll("\\","/")},"internalRenderError"),G=a((e,r={})=>{if(r.framesMaxLimit!==void 0&&r.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return L(e,r,0)},"renderError");export{G as renderError};
@@ -0,0 +1 @@
1
+ var m=Object.defineProperty;var f=(e,t)=>m(e,"name",{value:t,configurable:!0});import{r as b}from"./index-CLFYRLyq.js";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};
@@ -6,4 +6,4 @@ declare const aiPrompt: ({ applicationType, error, file, }: {
6
6
  file: SolutionFinderFile;
7
7
  }) => string;
8
8
 
9
- export = aiPrompt;
9
+ export { aiPrompt as default };
@@ -0,0 +1 @@
1
+ import{default as e}from"../../packem_shared/aiFinder-UDgN90WO.js";import{default as t}from"./ai-prompt.js";import{default as i}from"../../packem_shared/aiSolutionResponse-RD0AK1jh.js";export{e as aiFinder,t as aiPrompt,i as aiSolutionResponse};
@@ -0,0 +1 @@
1
+ import{default as a}from"../packem_shared/errorHintFinder-C_g0nvml.js";import{default as o}from"../packem_shared/ruleBasedFinder-P88d0gpK.js";export{a as errorHintFinder,o as ruleBasedFinder};
@@ -22,4 +22,5 @@ declare const formatStacktrace: (frames: Trace[], options?: {
22
22
  };
23
23
  }) => string;
24
24
 
25
- export { type Trace, type TraceType, formatStackFrameLine, formatStacktrace, parseStacktrace };
25
+ export { formatStackFrameLine, formatStacktrace, parseStacktrace };
26
+ export type { Trace, TraceType };
@@ -0,0 +1 @@
1
+ import{default as t}from"../packem_shared/parseStacktrace-Dnxnc4PL.js";import{formatStackFrameLine as o,formatStacktrace as c}from"../packem_shared/formatStackFrameLine-iU54KA81.js";export{o as formatStackFrameLine,c as formatStacktrace,t as parseStacktrace};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/error",
3
- "version": "4.6.2",
3
+ "version": "5.0.0",
4
4
  "description": "Error with more than just a message, stacktrace parsing.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -64,105 +64,35 @@
64
64
  "type": "module",
65
65
  "exports": {
66
66
  ".": {
67
- "import": {
68
- "types": "./dist/index.d.mts",
69
- "default": "./dist/index.mjs"
70
- },
71
- "require": {
72
- "types": "./dist/index.d.cts",
73
- "default": "./dist/index.cjs"
74
- }
67
+ "types": "./dist/index.d.ts",
68
+ "default": "./dist/index.js"
75
69
  },
76
70
  "./code-frame": {
77
- "import": {
78
- "types": "./dist/code-frame/index.d.mts",
79
- "default": "./dist/code-frame/index.mjs"
80
- },
81
- "require": {
82
- "types": "./dist/code-frame/index.d.cts",
83
- "default": "./dist/code-frame/index.cjs"
84
- }
71
+ "types": "./dist/code-frame/index.d.ts",
72
+ "default": "./dist/code-frame/index.js"
85
73
  },
86
74
  "./error": {
87
- "import": {
88
- "types": "./dist/error/index.d.mts",
89
- "default": "./dist/error/index.mjs"
90
- },
91
- "require": {
92
- "types": "./dist/error/index.d.cts",
93
- "default": "./dist/error/index.cjs"
94
- }
75
+ "types": "./dist/error/index.d.ts",
76
+ "default": "./dist/error/index.js"
95
77
  },
96
78
  "./stacktrace": {
97
- "import": {
98
- "types": "./dist/stacktrace/index.d.mts",
99
- "default": "./dist/stacktrace/index.mjs"
100
- },
101
- "require": {
102
- "types": "./dist/stacktrace/index.d.cts",
103
- "default": "./dist/stacktrace/index.cjs"
104
- }
79
+ "types": "./dist/stacktrace/index.d.ts",
80
+ "default": "./dist/stacktrace/index.js"
105
81
  },
106
82
  "./solution": {
107
- "import": {
108
- "types": "./dist/solution/index.d.mts",
109
- "default": "./dist/solution/index.mjs"
110
- },
111
- "require": {
112
- "types": "./dist/solution/index.d.cts",
113
- "default": "./dist/solution/index.cjs"
114
- }
83
+ "types": "./dist/solution/index.d.ts",
84
+ "default": "./dist/solution/index.js"
115
85
  },
116
86
  "./solution/ai": {
117
- "import": {
118
- "types": "./dist/solution/ai/index.d.mts",
119
- "default": "./dist/solution/ai/index.mjs"
120
- },
121
- "require": {
122
- "types": "./dist/solution/ai/index.d.cts",
123
- "default": "./dist/solution/ai/index.cjs"
124
- }
87
+ "types": "./dist/solution/ai/index.d.ts",
88
+ "default": "./dist/solution/ai/index.js"
125
89
  },
126
90
  "./solution/ai/prompt": {
127
- "import": {
128
- "types": "./dist/solution/ai/ai-prompt.d.mts",
129
- "default": "./dist/solution/ai/ai-prompt.mjs"
130
- },
131
- "require": {
132
- "types": "./dist/solution/ai/ai-prompt.d.cts",
133
- "default": "./dist/solution/ai/ai-prompt.cjs"
134
- }
91
+ "types": "./dist/solution/ai/ai-prompt.d.ts",
92
+ "default": "./dist/solution/ai/ai-prompt.js"
135
93
  },
136
94
  "./package.json": "./package.json"
137
95
  },
138
- "main": "dist/index.cjs",
139
- "module": "dist/index.mjs",
140
- "types": "dist/index.d.ts",
141
- "typesVersions": {
142
- ">=5.0": {
143
- ".": [
144
- "./dist/index.d.ts"
145
- ],
146
- "code-frame": [
147
- "./dist/code-frame/index.d.ts"
148
- ],
149
- "error": [
150
- "./dist/error/index.d.ts"
151
- ],
152
- "stacktrace": [
153
- "./dist/stacktrace/index.d.ts"
154
- ],
155
- "solution": [
156
- "./dist/solution/index.d.ts"
157
- ],
158
- "solution/ai": [
159
- "./dist/solution/ai/index.d.ts"
160
- ],
161
- "solution/ai/prompt": [
162
- "./dist/solution/ai/ai-prompt.d.ts"
163
- ]
164
- }
165
- },
166
96
  "files": [
167
97
  "dist",
168
98
  "README.md",
@@ -178,7 +108,7 @@
178
108
  }
179
109
  },
180
110
  "engines": {
181
- "node": ">=18.0.0 <=24.x"
111
+ "node": ">=20.19 <=24.x"
182
112
  },
183
113
  "os": [
184
114
  "darwin",
@@ -1,6 +0,0 @@
1
- "use strict";var P=Object.defineProperty;var v=(t,e)=>P(t,"name",{value:e,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var _=Object.defineProperty,w=v((t,e)=>_(t,"name",{value:e,configurable:!0}),"r$1");const L=w(t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
2
- `),"normalizeLF"),S=globalThis.process||Object.create(null),O={versions:{}},x=new Proxy(S,{get(t,e){if(e in t)return t[e];if(e in O)return O[e]}});var T=Object.defineProperty,R=v((t,e)=>T(t,"name",{value:e,configurable:!0}),"b");const W=R((t,e,d,n)=>{const f={column:0,line:-1,...t.start},i={...f,...t.end},o=f.line,l=f.column,u=i.line,m=i.column;let g=Math.max(o-(d+1),0),p=Math.min(e.length,u+n);o===-1&&(g=0),u===-1&&(p=e.length);const b=u-o,a={};if(b)for(let r=0;r<=b;r++){const s=r+o;if(!l)a[s]=!0;else if(r===0){const c=e[s-1]?.length;a[s]=[l,(c??0)-l+1]}else if(r===b)a[s]=[0,m];else{const c=e[s-r]?.length;a[s]=[0,c]}}else l===m?a[o]=l?[l,0]:!0:a[o]=[l,(m??0)-(l??0)];return{end:p,markerLines:a,start:g}},"getMarkerLines");var C=Object.defineProperty,$=v((t,e)=>C(t,"name",{value:e,configurable:!0}),"o");const M=x.platform==="win32"&&!x.env?.WT_SESSION?">":"❯",I=$((t,e,d)=>{const n={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...d,color:{gutter:$(r=>r,"gutter"),marker:$(r=>r,"marker"),message:$(r=>r,"message"),...d?.color}},f=e.start&&typeof e.start.column=="number";let i=L(t).split(`
3
- `);typeof n?.tabWidth=="number"&&(i=i.map(r=>r.replaceAll(" "," ".repeat(n.tabWidth))));const{end:o,markerLines:l,start:u}=W(e,i,n.linesAbove,n.linesBelow),m=String(o).length,{gutter:g,marker:p,message:b}=n.color;let a=i.slice(u,o).map((r,s)=>{const c=u+1+s,h=l[c],j=` ${c}`.slice(-m),k=!l[c+1],A=` ${j}${n.showGutter?" |":""}`;if(h){let y="";if(Array.isArray(h)){const E=r.replaceAll(/[^\t]/g," ").slice(0,Math.max(h[0]-1,0)),F=h[1]||1;y=[`
4
- `,n.prefix+g(A.replaceAll(/\d/g," "))," ",E,p("^").repeat(F)].join(""),k&&n.message&&(y+=` ${b(n.message)}`)}return[n.prefix+p(M),g(A),r.length>0?` ${r}`:"",y].join("")}return`${n.prefix} ${g(A)}${r.length>0?` ${r}`:""}`}).join(`
5
- `);return n.message&&!f&&(a=`${n.prefix+" ".repeat(m+1)+n.message}
6
- ${a}`),a},"codeFrame");exports.CODE_FRAME_POINTER=M;exports.codeFrame=I;
@@ -1,7 +0,0 @@
1
- import { a as CodeFrameNodeLocation, b as CodeFrameOptions } from '../packem_shared/types-CrVmNoPV.cjs';
2
- export { C as CodeFrameLocation, c as ColorizeMethod } from '../packem_shared/types-CrVmNoPV.cjs';
3
-
4
- declare const CODE_FRAME_POINTER: string;
5
- declare const codeFrame: (source: string, loc: CodeFrameNodeLocation, options?: CodeFrameOptions) => string;
6
-
7
- export { CODE_FRAME_POINTER, CodeFrameNodeLocation, CodeFrameOptions, codeFrame };
@@ -1,7 +0,0 @@
1
- import { a as CodeFrameNodeLocation, b as CodeFrameOptions } from '../packem_shared/types-CrVmNoPV.mjs';
2
- export { C as CodeFrameLocation, c as ColorizeMethod } from '../packem_shared/types-CrVmNoPV.mjs';
3
-
4
- declare const CODE_FRAME_POINTER: string;
5
- declare const codeFrame: (source: string, loc: CodeFrameNodeLocation, options?: CodeFrameOptions) => string;
6
-
7
- export { CODE_FRAME_POINTER, CodeFrameNodeLocation, CodeFrameOptions, codeFrame };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../packem_shared/captureRawStackTrace-B9d1821F.cjs"),o=require("../packem_shared/getErrorCauses-B7_Z_gEF.cjs"),s=require("../packem_shared/renderError-D8XJnkIF.cjs"),a=require("../packem_shared/deserializeError-2C6o7QF7.cjs"),r=require("../packem_shared/addKnownErrorConstructor-B5dNFGsR.cjs"),u=require("../packem_shared/NonError-CQn4sdxd.cjs"),E=require("../packem_shared/serializeError-7S1IG6zs.cjs"),e=require("../packem_shared/isVisulimaError-CrvBm0kw.cjs");exports.captureRawStackTrace=i;exports.getErrorCauses=o;exports.renderError=s.renderError;exports.deserializeError=a;exports.addKnownErrorConstructor=r.addKnownErrorConstructor;exports.isErrorLike=r.isErrorLike;exports.NonError=u;exports.serializeError=E.serialize;exports.VisulimaError=e.VisulimaError;exports.isVisulimaError=e.isVisulimaError;
@@ -1,95 +0,0 @@
1
- import { b as CodeFrameOptions, c as ColorizeMethod } from '../packem_shared/types-CrVmNoPV.cjs';
2
-
3
- declare const captureRawStackTrace: () => string | undefined;
4
-
5
- interface ErrorProperties {
6
- cause?: Error | unknown;
7
- hint?: ErrorHint;
8
- location?: ErrorLocation;
9
- message?: string;
10
- name: string;
11
- stack?: string;
12
- title?: string;
13
- }
14
- interface ErrorLocation {
15
- column?: number;
16
- file?: string;
17
- line?: number;
18
- }
19
- type ErrorHint = string[] | string;
20
-
21
- declare const isVisulimaError: (error: unknown) => error is VisulimaError;
22
- declare class VisulimaError extends Error {
23
- loc: ErrorLocation | undefined;
24
- title: string | undefined;
25
- hint: ErrorHint | undefined;
26
- type: string;
27
- constructor({ cause, hint, location, message, name, stack, title }: ErrorProperties);
28
- setLocation(location: ErrorLocation): void;
29
- setName(name: string): void;
30
- setMessage(message: string): void;
31
- setHint(hint: ErrorHint): void;
32
- }
33
-
34
- declare const getErrorCauses: <E = Error | VisulimaError | unknown>(error: E) => E[];
35
-
36
- type Options$1 = Omit<CodeFrameOptions, "message | prefix"> & {
37
- color: CodeFrameOptions["color"] & {
38
- fileLine: ColorizeMethod;
39
- hint: ColorizeMethod;
40
- method: ColorizeMethod;
41
- title: ColorizeMethod;
42
- };
43
- cwd: string;
44
- displayShortPath: boolean;
45
- filterStacktrace: ((line: string) => boolean) | undefined;
46
- framesMaxLimit: number;
47
- hideErrorCauseCodeView: boolean;
48
- hideErrorCodeView: boolean;
49
- hideErrorErrorsCodeView: boolean;
50
- hideErrorTitle: boolean;
51
- hideMessage: boolean;
52
- indentation: number | "\t";
53
- prefix: string;
54
- };
55
- declare const renderError: (error: AggregateError | Error | VisulimaError, options?: Partial<Options$1>) => string;
56
-
57
- interface DeserializeOptions {
58
- maxDepth?: number;
59
- }
60
- type DeserializeOptionsType = DeserializeOptions;
61
- declare const deserialize: (value: unknown, options?: DeserializeOptionsType) => Error;
62
-
63
- type ErrorConstructor = new (...arguments_: any[]) => Error;
64
- declare const addKnownErrorConstructor: (constructor: ErrorConstructor, name?: string) => void;
65
- declare const isErrorLike: (value: unknown) => value is {
66
- message?: string;
67
- name?: string;
68
- stack?: string;
69
- };
70
-
71
- type SerializedError<ErrorType = Error> = Record<PropertyKey, unknown> & {
72
- aggregateErrors?: SerializedError<ErrorType>[];
73
- cause?: unknown;
74
- code?: string;
75
- message: string;
76
- name: string;
77
- raw?: ErrorType;
78
- stack?: string;
79
- };
80
-
81
- declare class NonError extends Error {
82
- constructor(message: string);
83
- }
84
-
85
- interface JsonError extends Error {
86
- toJSON: () => SerializedError;
87
- }
88
- type Options = {
89
- exclude?: string[];
90
- maxDepth?: number;
91
- useToJSON?: boolean;
92
- };
93
- declare const serialize: (error: AggregateError | Error | JsonError, options?: Options) => SerializedError;
94
-
95
- export { type ErrorHint, type ErrorLocation, type ErrorProperties, type Options as ErrorWithCauseSerializerOptions, NonError, type Options$1 as RenderErrorOptions, type SerializedError, VisulimaError, addKnownErrorConstructor, captureRawStackTrace, deserialize as deserializeError, getErrorCauses, isErrorLike, isVisulimaError, renderError, serialize as serializeError };
@@ -1,95 +0,0 @@
1
- import { b as CodeFrameOptions, c as ColorizeMethod } from '../packem_shared/types-CrVmNoPV.mjs';
2
-
3
- declare const captureRawStackTrace: () => string | undefined;
4
-
5
- interface ErrorProperties {
6
- cause?: Error | unknown;
7
- hint?: ErrorHint;
8
- location?: ErrorLocation;
9
- message?: string;
10
- name: string;
11
- stack?: string;
12
- title?: string;
13
- }
14
- interface ErrorLocation {
15
- column?: number;
16
- file?: string;
17
- line?: number;
18
- }
19
- type ErrorHint = string[] | string;
20
-
21
- declare const isVisulimaError: (error: unknown) => error is VisulimaError;
22
- declare class VisulimaError extends Error {
23
- loc: ErrorLocation | undefined;
24
- title: string | undefined;
25
- hint: ErrorHint | undefined;
26
- type: string;
27
- constructor({ cause, hint, location, message, name, stack, title }: ErrorProperties);
28
- setLocation(location: ErrorLocation): void;
29
- setName(name: string): void;
30
- setMessage(message: string): void;
31
- setHint(hint: ErrorHint): void;
32
- }
33
-
34
- declare const getErrorCauses: <E = Error | VisulimaError | unknown>(error: E) => E[];
35
-
36
- type Options$1 = Omit<CodeFrameOptions, "message | prefix"> & {
37
- color: CodeFrameOptions["color"] & {
38
- fileLine: ColorizeMethod;
39
- hint: ColorizeMethod;
40
- method: ColorizeMethod;
41
- title: ColorizeMethod;
42
- };
43
- cwd: string;
44
- displayShortPath: boolean;
45
- filterStacktrace: ((line: string) => boolean) | undefined;
46
- framesMaxLimit: number;
47
- hideErrorCauseCodeView: boolean;
48
- hideErrorCodeView: boolean;
49
- hideErrorErrorsCodeView: boolean;
50
- hideErrorTitle: boolean;
51
- hideMessage: boolean;
52
- indentation: number | "\t";
53
- prefix: string;
54
- };
55
- declare const renderError: (error: AggregateError | Error | VisulimaError, options?: Partial<Options$1>) => string;
56
-
57
- interface DeserializeOptions {
58
- maxDepth?: number;
59
- }
60
- type DeserializeOptionsType = DeserializeOptions;
61
- declare const deserialize: (value: unknown, options?: DeserializeOptionsType) => Error;
62
-
63
- type ErrorConstructor = new (...arguments_: any[]) => Error;
64
- declare const addKnownErrorConstructor: (constructor: ErrorConstructor, name?: string) => void;
65
- declare const isErrorLike: (value: unknown) => value is {
66
- message?: string;
67
- name?: string;
68
- stack?: string;
69
- };
70
-
71
- type SerializedError<ErrorType = Error> = Record<PropertyKey, unknown> & {
72
- aggregateErrors?: SerializedError<ErrorType>[];
73
- cause?: unknown;
74
- code?: string;
75
- message: string;
76
- name: string;
77
- raw?: ErrorType;
78
- stack?: string;
79
- };
80
-
81
- declare class NonError extends Error {
82
- constructor(message: string);
83
- }
84
-
85
- interface JsonError extends Error {
86
- toJSON: () => SerializedError;
87
- }
88
- type Options = {
89
- exclude?: string[];
90
- maxDepth?: number;
91
- useToJSON?: boolean;
92
- };
93
- declare const serialize: (error: AggregateError | Error | JsonError, options?: Options) => SerializedError;
94
-
95
- export { type ErrorHint, type ErrorLocation, type ErrorProperties, type Options as ErrorWithCauseSerializerOptions, NonError, type Options$1 as RenderErrorOptions, type SerializedError, VisulimaError, addKnownErrorConstructor, captureRawStackTrace, deserialize as deserializeError, getErrorCauses, isErrorLike, isVisulimaError, renderError, serialize as serializeError };
@@ -1 +0,0 @@
1
- import{default as e}from"../packem_shared/captureRawStackTrace-CQPNHvBG.mjs";import{default as t}from"../packem_shared/getErrorCauses-D025FGyO.mjs";import{renderError as i}from"../packem_shared/renderError-D7R71d_7.mjs";import{default as m}from"../packem_shared/deserializeError-tzZhIV70.mjs";import{addKnownErrorConstructor as p,isErrorLike as u}from"../packem_shared/addKnownErrorConstructor-BqqnTSZp.mjs";import{default as d}from"../packem_shared/NonError-CS10kwil.mjs";import{serialize as n}from"../packem_shared/serializeError-Bc-QciX0.mjs";import{VisulimaError as z,isVisulimaError as k}from"../packem_shared/isVisulimaError-jVZgumOU.mjs";export{d as NonError,z as VisulimaError,p as addKnownErrorConstructor,e as captureRawStackTrace,m as deserializeError,t as getErrorCauses,u as isErrorLike,k as isVisulimaError,i as renderError,n as serializeError};
package/dist/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./code-frame/index.cjs"),a=require("./packem_shared/indexToLineColumn-C_v57REF.cjs"),t=require("./solution/ai/ai-prompt.cjs"),u=require("./packem_shared/aiSolutionResponse-C5apAmTu.cjs"),n=require("./packem_shared/errorHintFinder-DRCn1Ysx.cjs"),s=require("./packem_shared/ruleBasedFinder-B1jRHBM_.cjs"),E=require("./packem_shared/captureRawStackTrace-B9d1821F.cjs"),c=require("./packem_shared/deserializeError-2C6o7QF7.cjs"),d=require("./packem_shared/getErrorCauses-B7_Z_gEF.cjs"),l=require("./packem_shared/NonError-CQn4sdxd.cjs"),m=require("./packem_shared/parseStacktrace-MW4-SLXl.cjs"),e=require("./packem_shared/addKnownErrorConstructor-B5dNFGsR.cjs"),i=require("./packem_shared/isVisulimaError-CrvBm0kw.cjs"),q=require("./packem_shared/renderError-D8XJnkIF.cjs"),S=require("./packem_shared/serializeError-7S1IG6zs.cjs"),o=require("./packem_shared/formatStackFrameLine-DD2DUdW0.cjs");exports.CODE_FRAME_POINTER=r.CODE_FRAME_POINTER;exports.codeFrame=r.codeFrame;exports.indexToLineColumn=a;exports.aiPrompt=t;exports.aiSolutionResponse=u;exports.errorHintFinder=n;exports.ruleBasedFinder=s;exports.captureRawStackTrace=E;exports.deserializeError=c;exports.getErrorCauses=d;exports.NonError=l;exports.parseStacktrace=m;exports.addKnownErrorConstructor=e.addKnownErrorConstructor;exports.isErrorLike=e.isErrorLike;exports.VisulimaError=i.VisulimaError;exports.isVisulimaError=i.isVisulimaError;exports.renderError=q.renderError;exports.serializeError=S.serialize;exports.formatStackFrameLine=o.formatStackFrameLine;exports.formatStacktrace=o.formatStacktrace;
package/dist/index.d.cts DELETED
@@ -1,17 +0,0 @@
1
- export { CODE_FRAME_POINTER, codeFrame } from './code-frame/index.cjs';
2
- export { default as aiPrompt } from './solution/ai/ai-prompt.cjs';
3
- export { a as aiSolutionResponse } from './packem_shared/ai-solution-response-BuaDQAEU.cjs';
4
- export { errorHintFinder, ruleBasedFinder } from './solution/index.cjs';
5
- export { S as Solution, a as SolutionError, b as SolutionFinder, c as SolutionFinderFile } from './packem_shared/types-BtQS7FHG.cjs';
6
- export { ErrorHint, ErrorLocation, ErrorProperties, ErrorWithCauseSerializerOptions, NonError, RenderErrorOptions, SerializedError, VisulimaError, addKnownErrorConstructor, captureRawStackTrace, deserializeError, getErrorCauses, isErrorLike, isVisulimaError, renderError, serializeError } from './error/index.cjs';
7
- export { Trace, TraceType, formatStackFrameLine, formatStacktrace, parseStacktrace } from './stacktrace/index.cjs';
8
- export { C as CodeFrameLocation, a as CodeFrameNodeLocation, b as CodeFrameOptions, c as ColorizeMethod } from './packem_shared/types-CrVmNoPV.cjs';
9
-
10
- declare const indexToLineColumn: (input: number[] | string, index: number, options?: {
11
- skipChecks: boolean;
12
- }) => {
13
- column: number;
14
- line: number;
15
- };
16
-
17
- export { indexToLineColumn };
package/dist/index.d.mts DELETED
@@ -1,17 +0,0 @@
1
- export { CODE_FRAME_POINTER, codeFrame } from './code-frame/index.mjs';
2
- export { default as aiPrompt } from './solution/ai/ai-prompt.mjs';
3
- export { a as aiSolutionResponse } from './packem_shared/ai-solution-response-BuaDQAEU.mjs';
4
- export { errorHintFinder, ruleBasedFinder } from './solution/index.mjs';
5
- export { S as Solution, a as SolutionError, b as SolutionFinder, c as SolutionFinderFile } from './packem_shared/types-BtQS7FHG.mjs';
6
- export { ErrorHint, ErrorLocation, ErrorProperties, ErrorWithCauseSerializerOptions, NonError, RenderErrorOptions, SerializedError, VisulimaError, addKnownErrorConstructor, captureRawStackTrace, deserializeError, getErrorCauses, isErrorLike, isVisulimaError, renderError, serializeError } from './error/index.mjs';
7
- export { Trace, TraceType, formatStackFrameLine, formatStacktrace, parseStacktrace } from './stacktrace/index.mjs';
8
- export { C as CodeFrameLocation, a as CodeFrameNodeLocation, b as CodeFrameOptions, c as ColorizeMethod } from './packem_shared/types-CrVmNoPV.mjs';
9
-
10
- declare const indexToLineColumn: (input: number[] | string, index: number, options?: {
11
- skipChecks: boolean;
12
- }) => {
13
- column: number;
14
- line: number;
15
- };
16
-
17
- export { indexToLineColumn };
package/dist/index.mjs DELETED
@@ -1 +0,0 @@
1
- import{CODE_FRAME_POINTER as o,codeFrame as a}from"./code-frame/index.mjs";import{default as f}from"./packem_shared/indexToLineColumn-B1F7aNZh.mjs";import{default as m}from"./solution/ai/ai-prompt.mjs";import{default as p}from"./packem_shared/aiSolutionResponse-RD0AK1jh.mjs";import{default as l}from"./packem_shared/errorHintFinder-C_g0nvml.mjs";import{default as x}from"./packem_shared/ruleBasedFinder-P88d0gpK.mjs";import{default as E}from"./packem_shared/captureRawStackTrace-CQPNHvBG.mjs";import{default as k}from"./packem_shared/deserializeError-tzZhIV70.mjs";import{default as S}from"./packem_shared/getErrorCauses-D025FGyO.mjs";import{default as R}from"./packem_shared/NonError-CS10kwil.mjs";import{default as L}from"./packem_shared/parseStacktrace-Dnxnc4PL.mjs";import{addKnownErrorConstructor as w,isErrorLike as N}from"./packem_shared/addKnownErrorConstructor-BqqnTSZp.mjs";import{VisulimaError as P,isVisulimaError as V}from"./packem_shared/isVisulimaError-jVZgumOU.mjs";import{renderError as g}from"./packem_shared/renderError-D7R71d_7.mjs";import{serialize as B}from"./packem_shared/serializeError-Bc-QciX0.mjs";import{formatStackFrameLine as H,formatStacktrace as I}from"./packem_shared/formatStackFrameLine-iU54KA81.mjs";export{o as CODE_FRAME_POINTER,R as NonError,P as VisulimaError,w as addKnownErrorConstructor,m as aiPrompt,p as aiSolutionResponse,E as captureRawStackTrace,a as codeFrame,k as deserializeError,l as errorHintFinder,H as formatStackFrameLine,I as formatStacktrace,S as getErrorCauses,f as indexToLineColumn,N as isErrorLike,V as isVisulimaError,L as parseStacktrace,g as renderError,x as ruleBasedFinder,B as serializeError};
@@ -1 +0,0 @@
1
- "use strict";var s=Object.defineProperty;var t=(e,r)=>s(e,"name",{value:r,configurable:!0});var o=Object.defineProperty,a=t((e,r)=>o(e,"name",{value:r,configurable:!0}),"s");class n extends Error{static{t(this,"e")}static{a(this,"NonError")}constructor(r){super(r),this.name="NonError"}}module.exports=n;
@@ -1 +0,0 @@
1
- "use strict";var g=Object.defineProperty;var s=(r,o)=>g(r,"name",{value:o,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var u=Object.defineProperty,t=s((r,o)=>u(r,"name",{value:o,configurable:!0}),"n");const e=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&e.set("AggregateError",AggregateError);const i=t((r,o)=>{let a;try{a=new r}catch(c){throw new Error(`The error constructor "${r.name}" is not compatible`,{cause:c})}const n=o??a.name;if(e.has(n))throw new Error(`The error constructor "${n}" is already known.`);e.set(n,r)},"addKnownErrorConstructor"),l=t(()=>new Map(e),"getKnownErrorConstructors"),E=t(r=>e.get(r),"getErrorConstructor"),w=t(r=>r!==null&&typeof r=="object"&&typeof r.name=="string"&&typeof r.message=="string"&&(E(r.name)!==void 0||r.name==="Error"),"isErrorLike");exports.addKnownErrorConstructor=i;exports.getErrorConstructor=E;exports.getKnownErrorConstructors=l;exports.isErrorLike=w;
@@ -1,3 +0,0 @@
1
- declare const aiSolutionResponse: (rawText: string) => string;
2
-
3
- export { aiSolutionResponse as a };
@@ -1,3 +0,0 @@
1
- declare const aiSolutionResponse: (rawText: string) => string;
2
-
3
- export { aiSolutionResponse as a };
@@ -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};