@visulima/error 5.0.1 → 5.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,35 @@
1
+ ## @visulima/error [5.0.3](https://github.com/visulima/visulima/compare/@visulima/error@5.0.2...@visulima/error@5.0.3) (2025-11-05)
2
+
3
+ ### Bug Fixes
4
+
5
+ * update dependencies across multiple packages ([36a47f2](https://github.com/visulima/visulima/commit/36a47f26d65d25a7b4d8371186710e7d0ab61a2b))
6
+
7
+ ### Miscellaneous Chores
8
+
9
+ * update dependencies across multiple packages ([c526462](https://github.com/visulima/visulima/commit/c52646260c2ae8bbf85692e642f305f47a158d4e))
10
+ * update package dependencies and configurations ([7bfe7e7](https://github.com/visulima/visulima/commit/7bfe7e71869580900aab50efb064b4293994ed9a))
11
+
12
+
13
+ ### Dependencies
14
+
15
+ * **@visulima/path:** upgraded to 2.0.2
16
+
17
+ ## @visulima/error [5.0.2](https://github.com/visulima/visulima/compare/@visulima/error@5.0.1...@visulima/error@5.0.2) (2025-10-21)
18
+
19
+ ### Bug Fixes
20
+
21
+ * allow node v25 and updated dev deps ([8158cc5](https://github.com/visulima/visulima/commit/8158cc53ec92bd0331e8c6bd0fcbc8ab61b9320f))
22
+
23
+ ### Miscellaneous Chores
24
+
25
+ * update copyright year in LICENSE.md files ([c46a28d](https://github.com/visulima/visulima/commit/c46a28d2afb4cc7d73a7edde9a271a7156f87eae))
26
+ * update license years and add validation rules ([b97811e](https://github.com/visulima/visulima/commit/b97811ed2d253d908c0d86b4579a0a6bc33673a8))
27
+
28
+
29
+ ### Dependencies
30
+
31
+ * **@visulima/path:** upgraded to 2.0.1
32
+
1
33
  ## @visulima/error [5.0.1](https://github.com/visulima/visulima/compare/@visulima/error@5.0.0...@visulima/error@5.0.1) (2025-10-20)
2
34
 
3
35
  ### Bug Fixes
@@ -18,7 +50,7 @@
18
50
  ### Bug Fixes
19
51
 
20
52
  * Adjusted the node engine requirement to support versions 20.19 and above ([92fb543](https://github.com/visulima/visulima/commit/92fb543b04652a46e108e3d831ccf3f7c0957293))
21
- * update @visulima/packem to 2.0.0-alpha.30 across multiple packages for improved compatibility ([27b346e](https://github.com/visulima/visulima/commit/27b346eaa1c0fb0e420d9a9824482028307f4249))
53
+ * update @visulima/packem to 2.0.0-alpha.32 across multiple packages for improved compatibility ([27b346e](https://github.com/visulima/visulima/commit/27b346eaa1c0fb0e420d9a9824482028307f4249))
22
54
  * update ESLint configuration and enhance package dependencies for improved performance ([5b5196f](https://github.com/visulima/visulima/commit/5b5196f85f93ad4219967331c8965d2e2a39d72a))
23
55
 
24
56
  ### Miscellaneous Chores
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 visulima
3
+ Copyright (c) 2025 visulima
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -34,7 +34,7 @@ Repository: git+https://github.com/visulima/visulima.git
34
34
 
35
35
  > MIT License
36
36
  >
37
- > Copyright (c) 2024 visulima
37
+ > Copyright (c) 2025 visulima
38
38
  >
39
39
  > Permission is hereby granted, free of charge, to any person obtaining a copy
40
40
  > of this software and associated documentation files (the "Software"), to deal
package/dist/index.js CHANGED
@@ -1 +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};
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{default as m}from"./solution/ai/ai-prompt.js";import{default as p}from"./packem_shared/aiSolutionResponse-RD0AK1jh.js";import{default as l}from"./packem_shared/errorHintFinder-C_g0nvml.js";import{default as x}from"./packem_shared/ruleBasedFinder-P88d0gpK.js";import{default as E}from"./packem_shared/captureRawStackTrace-CQPNHvBG.js";import{default as k}from"./packem_shared/deserializeError-BJM8Kd6G.js";import{default as S}from"./packem_shared/getErrorCauses-geeK5cwE.js";import{default as R}from"./packem_shared/NonError-CS10kwil.js";import{default as L}from"./packem_shared/parseStacktrace-Dnxnc4PL.js";import{addKnownErrorConstructor as w,isErrorLike as N}from"./packem_shared/addKnownErrorConstructor-BqqnTSZp.js";import{VisulimaError as P,isVisulimaError as V}from"./packem_shared/isVisulimaError-jVZgumOU.js";import{renderError as g}from"./packem_shared/renderError-ZMlMvw1N.js";import{serialize as B}from"./packem_shared/serializeError-CTpDr3CL.js";import{formatStackFrameLine as H,formatStacktrace as I}from"./packem_shared/formatStackFrameLine-iU54KA81.js";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};
@@ -0,0 +1 @@
1
+ var rn=Object.defineProperty;var L=(o,a)=>rn(o,"name",{value:a,configurable:!0});import{createRequire as on}from"node:module";import{generateText as pn}from"ai";import hn from"../solution/ai/ai-prompt.js";import Q from"./aiSolutionResponse-RD0AK1jh.js";const sn=on(import.meta.url),D=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,re=L(o=>{if(typeof D<"u"&&D.versions&&D.versions.node){const[a,i]=D.versions.node.split(".").map(Number);if(a>22||a===22&&i>=3||a===20&&i>=16)return D.getBuiltinModule(o)}return sn(o)},"__cjs_getBuiltinModule"),{createHash:an}=re("node:crypto"),{existsSync:Oe,readFileSync:ln,mkdirSync:cn,writeFileSync:un}=re("node:fs"),{tmpdir:fn}=re("node:os");var dn=Object.defineProperty,gn=L((o,a)=>dn(o,"name",{value:a,configurable:!0}),"$e"),mn=Object.defineProperty,oe=gn((o,a)=>mn(o,"name",{value:a,configurable:!0}),"W"),xn=Object.defineProperty,c=oe((o,a)=>xn(o,"name",{value:a,configurable:!0}),"u$1");let je=c(()=>{var o=(()=>{var a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,x=c((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},"ne"),b=c((e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of f(t))!d.call(e,r)&&r!==n&&a(e,r,{get:c(()=>t[r],"get"),enumerable:!(s=i(t,r))||s.enumerable});return e},"ae"),m=c(e=>b(a({},"__esModule",{value:!0}),e),"oe"),S={};x(S,{zeptomatch:c(()=>we,"zeptomatch")});var A=c(e=>{const t=new Set,n=[e];for(let s=0;s<n.length;s++){const r=n[s];if(t.has(r))continue;t.add(r);const{children:l}=r;if(l?.length)for(let u=0,h=l.length;u<h;u++)n.push(l[u])}return Array.from(t)},"M"),v=c(e=>{let t="";const n=A(e);for(let s=0,r=n.length;s<r;s++){const l=n[s];if(!l.regex)continue;const u=l.regex.flags;if(t||(t=u),t!==u)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${u}"`)}return t},"se"),M=c((e,t,n)=>{const s=n.get(e);if(s!==void 0)return s;const r=e.partial??t;let l="";if(e.regex&&(l+=r?"(?:$|":"",l+=e.regex.source),e.children?.length){const u=Ee(e.children.map(h=>M(h,t,n)).filter(Boolean));if(u?.length){const h=e.children.some(W=>!W.regex||!(W.partial??t)),$=u.length>1||r&&(!l.length||h);l+=$?r?"(?:$|":"(?:":"",l+=u.join("|"),l+=$?")":""}}return e.regex&&(l+=r?")":""),n.set(e,l),l},"O"),B=c((e,t)=>{const n=new Map,s=A(e);for(let r=s.length-1;r>=0;r--){const l=M(s[r],t,n);if(!(r>0))return l}return""},"ie"),Ee=c(e=>Array.from(new Set(e)),"ue"),G=c((e,t,n)=>G.compile(e,n).test(t),"R");G.compile=(e,t)=>{const n=t?.partial??!1,s=B(e,n),r=v(e);return new RegExp(`^(?:${s})$`,r)};var Ie=G,Pe=c((e,t)=>{const n=Ie.compile(e,t),s=`${n.source.slice(0,-1)}[\\\\/]?$`,r=n.flags;return new RegExp(s,r)},"le"),Re=Pe,Be=c(e=>{const t=e.map(s=>s.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),qe=Be,se=c(e=>Array.isArray(e),"j"),q=c(e=>typeof e=="function","_"),Fe=c(e=>e.length===0,"he"),We=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),Ze=c(e=>typeof e=="number","de"),De=c(e=>typeof e=="object"&&e!==null,"xe"),Ne=c(e=>e instanceof RegExp,"me"),Te=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Le=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),ae=c(e=>typeof e=="string","A"),k=c(e=>e===void 0,"f"),Ge=c(e=>{const t=new Map;return n=>{const s=t.get(n);if(s!==void 0)return s;const r=e(n);return t.set(n,r),r}},"ye"),ie=c((e,t,n={})=>{const s={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},r=O(t)(s),l=Math.max(s.index,s.indexBacktrackMax);if(r&&s.index===e.length)return s.output;throw new Error(`Failed to parse at index ${l}`)},"I"),p=c((e,t)=>se(e)?Je(e,t):ae(e)?le(e,t):Ke(e,t),"i"),Je=c((e,t)=>{const n={};for(const s of e){if(s.length!==1)throw new Error(`Invalid character: "${s}"`);const r=s.charCodeAt(0);n[r]=!0}return s=>{const r=s.input;let l=s.index,u=l;for(;u<r.length&&r.charCodeAt(u)in n;)u+=1;if(u>l){if(!k(t)&&!s.options.silent){const h=r.slice(l,u),$=q(t)?t(h,r,`${l}`):t;k($)||s.output.push($)}s.index=u}return!0}},"we"),Ke=c((e,t)=>{if(Le(e))return le(e.source,t);{const n=e.source,s=e.flags.replace(/y|$/,"y"),r=new RegExp(n,s);return Te(e)&&q(t)&&!We(t)?Ue(r,t):He(r,t)}},"$e"),Ue=c((e,t)=>n=>{const s=n.index,r=n.input;e.lastIndex=s;const l=e.exec(r);if(l){const u=e.lastIndex;if(!n.options.silent){const h=t(...l,r,`${s}`);k(h)||n.output.push(h)}return n.index=u,!0}else return!1},"Ee"),He=c((e,t)=>n=>{const s=n.index,r=n.input;if(e.lastIndex=s,e.test(r)){const l=e.lastIndex;if(!k(t)&&!n.options.silent){const u=q(t)?t(r.slice(s,l),r,`${s}`):t;k(u)||n.output.push(u)}return n.index=l,!0}else return!1},"Ce"),le=c((e,t)=>n=>{const s=n.index,r=n.input;if(r.startsWith(e,s)){if(!k(t)&&!n.options.silent){const l=q(t)?t(e,r,`${s}`):t;k(l)||n.output.push(l)}return n.index+=e.length,!0}else return!1},"F"),J=c((e,t,n,s)=>{const r=O(e),l=t>1;return U(K(ue(u=>{let h=0;for(;h<n;){const $=u.index;if(!r(u)||(h+=1,u.index===$))break}return h>=t},l),s))},"k"),ce=c((e,t)=>J(e,0,1,t),"L"),T=c((e,t)=>J(e,0,1/0,t),"$"),Ve=c((e,t)=>J(e,1,1/0,t),"Re"),I=c((e,t)=>{const n=e.map(O);return U(K(ue(s=>{for(let r=0,l=n.length;r<l;r++)if(!n[r](s))return!1;return!0}),t))},"x"),w=c((e,t)=>{const n=e.map(O);return U(K(s=>{for(let r=0,l=n.length;r<l;r++)if(n[r](s))return!0;return!1},t))},"p"),ue=c((e,t=!0,n=!1)=>{const s=O(e);return t?r=>{const l=r.index,u=r.output.length,h=s(r);return!h&&!n&&(r.indexBacktrackMax=Math.max(r.indexBacktrackMax,r.index)),(!h||n)&&(r.index=l,r.output.length!==u&&(r.output.length=u)),h}:s},"q"),K=c((e,t)=>{const n=O(e);return t?s=>{if(s.options.silent)return n(s);const r=s.output.length;if(n(s)){const l=s.output.splice(r,1/0),u=t(l);return k(u)||s.output.push(u),!0}else return!1}:n},"B"),U=(()=>{let e=0;return t=>{const n=O(t),s=e+=1;return r=>{var l;if(r.options.memoization===!1)return n(r);const u=r.index,h=(l=r.cache)[s]||(l[s]={indexMax:-1,queue:[]}),$=h.queue;if(u<=h.indexMax){const Z=h.store||(h.store=new Map);if($.length){for(let R=0,en=$.length;R<en;R+=2){const tn=$[R*2],nn=$[R*2+1];Z.set(tn,nn)}$.length=0}const j=Z.get(u);if(j===!1)return!1;if(Ze(j))return r.index=j,!0;if(j)return r.index=j.index,j.output?.length&&r.output.push(...j.output),!0}const W=r.output.length,Yt=n(r);if(h.indexMax=Math.max(h.indexMax,u),Yt){const Z=r.index,j=r.output.length;if(j>W){const R=r.output.slice(W,j);$.push(u,{index:Z,output:R})}else $.push(u,Z);return!0}else return $.push(u,!1),!1}}})(),fe=c(e=>{let t;return n=>(t||(t=O(e())),t(n))},"G"),O=Ge(e=>{if(q(e))return Fe(e)?fe(e):e;if(ae(e)||Ne(e))return p(e);if(se(e))return I(e);if(De(e))return w(Object.values(e));throw new Error("Invalid rule")}),C=c(e=>e,"d"),Qe=c(e=>typeof e=="string","ke"),Xe=c(e=>{const t=new WeakMap,n=new WeakMap;return(s,r)=>{const l=r?.partial?n:t,u=l.get(s);if(u!==void 0)return u;const h=e(s,r);return l.set(s,h),h}},"Be"),Ye=c(e=>{const t={},n={};return(s,r)=>{const l=r?.partial?n:t;return l[s]??(l[s]=e(s,r))}},"Pe"),et=p(/\\./,C),tt=p(/./,C),nt=p(/\*\*\*+/,"*"),rt=p(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),ot=p(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),st=T(w([et,nt,rt,ot,tt])),at=st,it=c(e=>ie(e,at,{memoization:!1}).join(""),"Ie"),lt=it,pe="abcdefghijklmnopqrstuvwxyz",ct=c(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=pe[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),he=c(e=>{let t=0;for(let n=0,s=e.length;n<s;n++)t=t*26+pe.indexOf(e[n])+1;return t},"V"),H=c((e,t)=>{if(t<e)return H(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),ut=c((e,t,n)=>H(e,t).map(s=>String(s).padStart(n,"0")),"qe"),de=c((e,t)=>H(he(e),he(t)).map(ct),"W"),g=c(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),F=c(e=>({children:e}),"y"),P=(()=>{const e=c((t,n,s)=>{if(s.has(t))return;s.add(t);const{children:r}=t;if(!r.length)r.push(n);else for(let l=0,u=r.length;l<u;l++)e(r[l],n,s)},"e");return t=>{if(!t.length)return F([]);for(let n=t.length-1;n>=1;n--){const s=new Set,r=t[n-1],l=t[n];e(r,l,s)}return t[0]}})(),_=c(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),ft=p(/\\./,g),pt=p(/[$.*+?^(){}[\]\|]/,e=>g(`\\${e}`)),ht=p(/[\\\/]/,_),dt=p(/[^$.*+?^(){}[\]\|\\\/]+/,g),gt=p(/^(?:!!)*!(.*)$/,(e,t)=>g(`(?!^${we.compile(t).source}$).*?`)),mt=p(/^(!!)+/),xt=w([gt,mt]),$t=p(/\/(\*\*\/)+/,()=>F([P([_(),g(".+?"),_()]),_()])),yt=p(/^(\*\*\/)+/,()=>F([g("^"),P([g(".*?"),_()])])),bt=p(/\/(\*\*)$/,()=>F([P([_(),g(".*?")]),g("$")])),vt=p(/\*\*/,()=>g(".*?")),ge=w([$t,yt,bt,vt]),wt=p(/\*\/(?!\*\*\/|\*$)/,()=>P([g("[^\\\\/]*?"),_()])),jt=p(/\*/,()=>g("[^\\\\/]*")),me=w([wt,jt]),xe=p("?",()=>g("[^\\\\/]")),At=p("[",C),Mt=p("]",C),kt=p(/[!^]/,"^\\\\/"),Ot=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,C),_t=p(/\\./,C),zt=p(/[$.*+?^(){}[\|]/,e=>`\\${e}`),St=p(/[\\\/]/,"\\\\/"),Ct=p(/[^$.*+?^(){}[\]\|\\\/]+/,C),Et=w([_t,zt,St,Ot,Ct]),$e=I([At,ce(kt),T(Et),Mt],e=>g(e.join(""))),It=p("{","(?:"),Pt=p("}",")"),Rt=p(/(\d+)\.\.(\d+)/,(e,t,n)=>ut(+t,+n,Math.min(t.length,n.length)).join("|")),Bt=p(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>de(t,n).join("|")),qt=p(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>de(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),Ft=w([Rt,Bt,qt]),ye=I([It,Ft,Pt],e=>g(e.join(""))),Wt=p("{"),Zt=p("}"),Dt=p(","),Nt=p(/\\./,g),Tt=p(/[$.*+?^(){[\]\|]/,e=>g(`\\${e}`)),Lt=p(/[\\\/]/,_),Gt=p(/[^$.*+?^(){}[\]\|\\\/,]+/,g),Jt=fe(()=>ve),Kt=p("",()=>g("(?:)")),Ut=Ve(w([ge,me,xe,$e,ye,Jt,Nt,Tt,Lt,Gt]),P),be=w([Ut,Kt]),ve=I([Wt,ce(I([be,T(I([Dt,be]))])),Zt],F),Ht=T(w([xt,ge,me,xe,$e,ye,ve,ft,pt,ht,dt]),P),Vt=Ht,Qt=c(e=>ie(e,Vt,{memoization:!1})[0],"kr"),Xt=Qt,V=c((e,t,n)=>V.compile(e,n).test(t),"N");V.compile=(()=>{const e=Ye((n,s)=>Re(Xt(lt(n)),s)),t=Xe((n,s)=>qe(n.map(r=>e(r,s))));return(n,s)=>Qe(n)?e(n,s):t(n,s)})();var we=V;return m(S)})();return o.default||o},"_lazyMatch"),X;const $n=c((o,a)=>(X||(X=je(),je=null),X(o,a)),"default");var yn=Object.defineProperty,bn=oe((o,a)=>yn(o,"name",{value:a,configurable:!0}),"t");const vn=/^[A-Z]:\//i,E=bn((o="")=>o&&o.replaceAll("\\","/").replace(vn,a=>a.toUpperCase()),"normalizeWindowsPath");var wn=Object.defineProperty,y=oe((o,a)=>wn(o,"name",{value:a,configurable:!0}),"r");const jn=/^[/\\]{2}/,An=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,_e=/^[A-Z]:$/i,Ae=/^\/([A-Z]:)?$/i,Mn=/.(\.[^./]+)$/,kn=/^[/\\]|^[a-z]:[/\\]/i,On=y(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),ze=y((o,a)=>{let i="",f=0,d=-1,x=0,b;for(let m=0;m<=o.length;++m){if(m<o.length)b=o[m];else{if(b==="/")break;b="/"}if(b==="/"){if(!(d===m-1||x===1))if(x===2){if(i.length<2||f!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const S=i.lastIndexOf("/");S===-1?(i="",f=0):(i=i.slice(0,S),f=i.length-1-i.lastIndexOf("/")),d=m,x=0;continue}else if(i.length>0){i="",f=0,d=m,x=0;continue}}a&&(i+=i.length>0?"/..":"..",f=2)}else i.length>0?i+=`/${o.slice(d+1,m)}`:i=o.slice(d+1,m),f=m-d-1;d=m,x=0}else b==="."&&x!==-1?++x:x=-1}return i},"normalizeString"),N=y(o=>An.test(o),"isAbsolute"),Se=y(function(o){if(o.length===0)return".";o=E(o);const a=jn.exec(o),i=N(o),f=o.at(-1)==="/";return o=ze(o,!i),o.length===0?i?"/":f?"./":".":(f&&(o+="/"),_e.test(o)&&(o+="/"),a?i?`//${o}`:`//./${o}`:i&&!N(o)?`/${o}`:o)},"normalize"),Ce=y((...o)=>{let a="";for(const i of o)if(i)if(a.length>0){const f=a[a.length-1]==="/",d=i[0]==="/";f&&d?a+=i.slice(1):a+=f||d?i:`/${i}`}else a+=i;return Se(a)},"join"),ne=y(function(...o){o=o.map(f=>E(f));let a="",i=!1;for(let f=o.length-1;f>=-1&&!i;f--){const d=f>=0?o[f]:On();!d||d.length===0||(a=`${d}/${a}`,i=N(d))}return a=ze(a,!i),i&&!N(a)?`/${a}`:a.length>0?a:"."},"resolve");y(function(o){return E(o)},"toNamespacedPath");const _n=y(function(o){return Mn.exec(E(o))?.[1]??""},"extname");y(function(o,a){const i=ne(o).replace(Ae,"$1").split("/"),f=ne(a).replace(Ae,"$1").split("/");if(f[0][1]===":"&&i[0][1]===":"&&i[0]!==f[0])return f.join("/");const d=[...i];for(const x of d){if(f[0]!==x)break;i.shift(),f.shift()}return[...i.map(()=>".."),...f].join("/")},"relative");const zn=y(o=>{const a=E(o).replace(/\/$/,"").split("/").slice(0,-1);return a.length===1&&_e.test(a[0])&&(a[0]+="/"),a.join("/")||(N(o)?"/":".")},"dirname");y(function(o){const a=[o.root,o.dir,o.base??o.name+o.ext].filter(Boolean);return E(o.root?ne(...a):a.join("/"))},"format");const Sn=y((o,a)=>{const i=E(o).split("/").pop();return a&&i.endsWith(a)?i.slice(0,-a.length):i},"basename");y(function(o){const a=kn.exec(o)?.[0]?.replaceAll("\\","/")??"",i=Sn(o),f=_n(i);return{base:i,dir:zn(o),ext:f,name:i.slice(0,i.length-f.length),root:a}},"parse");y((o,a)=>$n(a,Se(o)),"matchesGlob");var Cn=Object.defineProperty,z=L((o,a)=>Cn(o,"name",{value:a,configurable:!0}),"i");const Y="## Ai Generated Solution",Me="Creation of a AI solution failed.",ee=z((o,a,i)=>{const f={error:{message:o.message,name:o.name,stack:o.stack},file:{file:a.file,language:a.language,line:a.line,snippet:a.snippet},temperature:i};return an("sha256").update(JSON.stringify(f)).digest("hex")},"generateCacheKey"),En=z(o=>o||Ce(fn(),"visulima-error-cache"),"getCacheDirectory"),In=z(o=>{Oe(o)||cn(o,{recursive:!0})},"ensureCacheDirectory"),te=z((o,a)=>Ce(o,`${a}.json`),"getCacheFilePath"),Pn=z((o,a)=>{try{if(!Oe(o))return;const i=ln(o,"utf8"),f=JSON.parse(i);return Date.now()-f.timestamp>a?void 0:f.solution}catch{return}},"readFromCache"),ke=z((o,a,i)=>{try{const f={solution:a,timestamp:Date.now(),ttl:i};un(o,JSON.stringify(f,null,2),"utf8")}catch{}},"writeToCache"),Zn=z((o,a)=>({handle:z(async(i,f)=>{const d=a?.cache,x=a?.temperature??0,b=d?.ttl??1440*60*1e3,m=En(d?.directory);if(d?.enabled!==!1){const A=ee(i,f,x),v=te(m,A),M=Pn(v,b);if(M)return M;In(m)}const S=hn({applicationType:void 0,error:i,file:f});try{const A=(await pn({model:o,prompt:S,temperature:x})).text;let v;if(A?v={body:Q(A),header:Y}:v={body:Q(Me),header:Y},d?.enabled!==!1){const M=ee(i,f,x),B=te(m,M);ke(B,v,b)}return v}catch(A){console.error(A);const v={body:Q(Me),header:Y};if(d?.enabled!==!1){const M=ee(i,f,x),B=te(m,M);ke(B,v,b)}return v}},"handle"),name:"AI SDK",priority:99}),"aiFinder");export{Zn as default};
@@ -1 +1 @@
1
- import{default as e}from"../../packem_shared/aiFinder-McmYwPGR.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};
1
+ import{default as e}from"../../packem_shared/aiFinder-DPoqj12B.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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/error",
3
- "version": "5.0.1",
3
+ "version": "5.0.3",
4
4
  "description": "Error with more than just a message, stacktrace parsing.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -108,7 +108,7 @@
108
108
  }
109
109
  },
110
110
  "engines": {
111
- "node": ">=20.19 <=24.x"
111
+ "node": ">=20.19 <=25.x"
112
112
  },
113
113
  "os": [
114
114
  "darwin",
@@ -1 +0,0 @@
1
- var Tt=Object.defineProperty;var F=(n,o)=>Tt(n,"name",{value:o,configurable:!0});import{createRequire as Bt}from"node:module";import Wt from"../solution/ai/ai-prompt.js";import J from"./aiSolutionResponse-RD0AK1jh.js";const $e=Bt(import.meta.url),Z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Y=F(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:Dt}=Y("node:crypto"),{existsSync:be,readFileSync:Et,mkdirSync:Ft,writeFileSync:Nt}=Y("node:fs"),{tmpdir:qt}=Y("node:os"),{generateText:Rt}=$e("ai");var Jt=Object.defineProperty,Lt=F((n,o)=>Jt(n,"name",{value:o,configurable:!0}),"ce"),Gt=Object.defineProperty,Q=Lt((n,o)=>Gt(n,"name",{value:o,configurable:!0}),"C"),Kt=Object.defineProperty,c=Q((n,o)=>Kt(n,"name",{value:o,configurable:!0}),"u$1");let ge=c(()=>{var n=(()=>{var o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,m=c((e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})},"J"),b=c((e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of u(t))!d.call(e,s)&&s!==r&&o(e,s,{get:c(()=>t[s],"get"),enumerable:!(a=i(t,s))||a.enumerable});return e},"T"),g=c(e=>b(o({},"__esModule",{value:!0}),e),"W"),k={};m(k,{zeptomatch:c(()=>Ct,"zeptomatch")});var j=c(e=>Array.isArray(e),"k"),x=c(e=>typeof e=="function","x"),O=c(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))})(),Oe=c(e=>typeof e=="number","Y"),Me=c(e=>typeof e=="object"&&e!==null,"rr"),_e=c(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=c(e=>typeof e=="string","M"),M=c(e=>e===void 0,"f"),Ce=c(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=c((e,t,r={})=>{const a={cache:{},input:e,index:0,indexBacktrackMax:0,options:r,output:[]},s=_(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"),l=c((e,t)=>j(e)?Se(e,t):V(e)?X(e,t):Ie(e,t),"o"),Se=c((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=c((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=c((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=c((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=c((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=c((e,t,r,a)=>{const s=_(e),f=t>1;return q(N(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=c((e,t)=>ee(e,0,1,t),"lr"),B=c((e,t)=>ee(e,0,1/0,t),"m"),D=c((e,t)=>{const r=e.map(_);return q(N(te(a=>{for(let s=0,f=r.length;s<f;s++)if(!r[s](a))return!1;return!0}),t))},"S"),w=c((e,t)=>{const r=e.map(_);return q(N(a=>{for(let s=0,f=r.length;s<f;s++)if(r[s](a))return!0;return!1},t))},"p"),te=c((e,t=!0,r=!1)=>{const a=_(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"),N=c((e,t)=>{const r=_(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"),q=(()=>{let e=0;return t=>{const r=_(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,St=$.length;P<St;P+=2){const It=$[P*2],Zt=$[P*2+1];I.set(It,Zt)}$.length=0}const v=I.get(p);if(v===!1)return!1;if(Oe(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,Pt=r(s);if(h.indexMax=Math.max(h.indexMax,p),Pt){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=c(e=>{let t;return r=>(t||(t=_(e())),t(r))},"A"),_=Ce(e=>{if(x(e))return O(e)?ne(e):e;if(V(e)||_e(e))return l(e);if(j(e))return D(e);if(Me(e))return w(Object.values(e));throw new Error("Invalid rule")}),A=c(e=>e,"v"),re=c(e=>t=>Pe(t,e,{memoization:!1}).join(""),"z"),De=c(e=>{const t={};return r=>t[r]??(t[r]=e(r))},"pr"),oe="abcdefghijklmnopqrstuvwxyz",Ee=c(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=c(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"),R=c((e,t)=>{if(t<e)return R(t,e);const r=[];for(;e<=t;)r.push(e++);return r},"$"),Fe=c((e,t,r)=>R(e,t).map(a=>String(a).padStart(r,"0")),"fr"),se=c((e,t)=>R(ie(e),ie(t)).map(Ee),"j"),W=l(/\\./,A),Ne=l(/[$.*+?^(){}[\]\|]/,e=>`\\${e}`),qe=l(/[\\/]/,"[\\\\/]"),Re=l(/./,A),We=l(/^(?:!!)*!(.*)$/,(e,t)=>`(?!^${de(t)}$).*?`),Je=l(/^(!!)+/,""),Le=w([We,Je]),Ge=l(/\/(\*\*\/)+/,"(?:[\\\\/].+[\\\\/]|[\\\\/])"),Ke=l(/^(\*\*\/)+/,"(?:^|.*[\\\\/])"),Ue=l(/\/(\*\*)$/,"(?:[\\\\/].*|$)"),He=l(/\*\*/,".*"),ae=w([Ge,Ke,Ue,He]),Ye=l(/\*\/(?!\*\*\/|\*$)/,"[^\\\\/]*[\\\\/]"),Qe=l(/\*/,"[^\\\\/]*"),ue=w([Ye,Qe]),ce=l("?","[^\\\\/]"),Ve=l("[",A),Xe=l("]",A),et=l(/[!^]/,"^\\\\/"),tt=l(/[a-z]-[a-z]|[0-9]-[0-9]/i,A),nt=l(/[$.*+?^(){}[\|]/,e=>`\\${e}`),rt=l(/[^\]]/,A),ot=w([W,nt,tt,rt]),le=D([Ve,Be(et),B(ot),Xe]),it=l("{","(?:"),st=l("}",")"),at=l(/(\d+)\.\.(\d+)/,(e,t,r)=>Fe(+t,+r,Math.min(t.length,r.length)).join("|")),ut=l(/([a-z]+)\.\.([a-z]+)/,(e,t,r)=>se(t,r).join("|")),ct=l(/([A-Z]+)\.\.([A-Z]+)/,(e,t,r)=>se(t.toLowerCase(),r.toLowerCase()).join("|").toUpperCase()),lt=w([at,ut,ct]),fe=D([it,lt,st]),ft=l("{","(?:"),pt=l("}",")"),dt=l(",","|"),ht=l(/[$.*+?^(){[\]\|]/,e=>`\\${e}`),gt=l(/[^}]/,A),mt=ne(()=>pe),xt=w([ae,ue,ce,le,fe,mt,W,ht,dt,gt]),pe=D([ft,B(xt),pt]),yt=B(w([Le,ae,ue,ce,le,fe,pe,W,Ne,qe,Re])),$t=yt,bt=re($t),de=bt,vt=l(/\\./,A),jt=l(/./,A),wt=l(/\*\*\*+/,"*"),At=l(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),Ot=l(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),Mt=B(w([vt,wt,At,Ot,jt])),_t=Mt,zt=re(_t),kt=zt,E=c((e,t)=>Array.isArray(e)?e.map(E.compile).some(r=>r.test(t)):E.compile(e).test(t),"_");E.compile=De(e=>new RegExp(`^${de(kt(e))}[\\\\/]?$`,"s"));var Ct=E;return g(k)})();return n.default||n},"_lazyMatch"),L;const Ut=c((n,o)=>(L||(L=ge(),ge=null),L(n,o)),"default");var Ht=Object.defineProperty,Yt=Q((n,o)=>Ht(n,"name",{value:o,configurable:!0}),"t");const Qt=/^[A-Z]:\//i,C=Yt((n="")=>n&&n.replaceAll("\\","/").replace(Qt,o=>o.toUpperCase()),"normalizeWindowsPath");var Vt=Object.defineProperty,y=Q((n,o)=>Vt(n,"name",{value:o,configurable:!0}),"r");const Xt=/^[/\\]{2}/,en=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ve=/^[A-Z]:$/i,me=/^\/([A-Z]:)?$/i,tn=/.(\.[^./]+)$/,nn=/^[/\\]|^[a-z]:[/\\]/i,rn=y(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),je=y((n,o)=>{let i="",u=0,d=-1,m=0,b;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||u!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const k=i.lastIndexOf("/");k===-1?(i="",u=0):(i=i.slice(0,k),u=i.length-1-i.lastIndexOf("/")),d=g,m=0;continue}else if(i.length>0){i="",u=0,d=g,m=0;continue}}o&&(i+=i.length>0?"/..":"..",u=2)}else i.length>0?i+=`/${n.slice(d+1,g)}`:i=n.slice(d+1,g),u=g-d-1;d=g,m=0}else b==="."&&m!==-1?++m:m=-1}return i},"normalizeString"),T=y(n=>en.test(n),"isAbsolute"),we=y(function(n){if(n.length===0)return".";n=C(n);const o=Xt.exec(n),i=T(n),u=n.at(-1)==="/";return n=je(n,!i),n.length===0?i?"/":u?"./":".":(u&&(n+="/"),ve.test(n)&&(n+="/"),o?i?`//${n}`:`//./${n}`:i&&!T(n)?`/${n}`:n)},"normalize"),Ae=y((...n)=>{let o="";for(const i of n)if(i)if(o.length>0){const u=o[o.length-1]==="/",d=i[0]==="/";u&&d?o+=i.slice(1):o+=u||d?i:`/${i}`}else o+=i;return we(o)},"join"),H=y(function(...n){n=n.map(u=>C(u));let o="",i=!1;for(let u=n.length-1;u>=-1&&!i;u--){const d=u>=0?n[u]:rn();!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 on=y(function(n){return tn.exec(C(n))?.[1]??""},"extname");y(function(n,o){const i=H(n).replace(me,"$1").split("/"),u=H(o).replace(me,"$1").split("/");if(u[0][1]===":"&&i[0][1]===":"&&i[0]!==u[0])return u.join("/");const d=[...i];for(const m of d){if(u[0]!==m)break;i.shift(),u.shift()}return[...i.map(()=>".."),...u].join("/")},"relative");const sn=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 an=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=nn.exec(n)?.[0]?.replaceAll("\\","/")??"",i=an(n),u=on(i);return{base:i,dir:sn(n),ext:u,name:i.slice(0,i.length-u.length),root:o}},"parse");y((n,o)=>Ut(o,we(n)),"matchesGlob");var un=Object.defineProperty,z=F((n,o)=>un(n,"name",{value:o,configurable:!0}),"i");const G="## Ai Generated Solution",xe="Creation of a AI solution failed.",K=z((n,o,i)=>{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:i};return Dt("sha256").update(JSON.stringify(u)).digest("hex")},"generateCacheKey"),cn=z(n=>n||Ae(qt(),"visulima-error-cache"),"getCacheDirectory"),ln=z(n=>{be(n)||Ft(n,{recursive:!0})},"ensureCacheDirectory"),U=z((n,o)=>Ae(n,`${o}.json`),"getCacheFilePath"),fn=z((n,o)=>{try{if(!be(n))return;const i=Et(n,"utf8"),u=JSON.parse(i);return Date.now()-u.timestamp>o?void 0:u.solution}catch{return}},"readFromCache"),ye=z((n,o,i)=>{try{const u={solution:o,timestamp:Date.now(),ttl:i};Nt(n,JSON.stringify(u,null,2),"utf8")}catch{}},"writeToCache"),mn=z((n,o)=>({handle:z(async(i,u)=>{const d=o?.cache,m=o?.temperature??0,b=d?.ttl??1440*60*1e3,g=cn(d?.directory);if(d?.enabled!==!1){const j=K(i,u,m),x=U(g,j),O=fn(x,b);if(O)return O;ln(g)}const k=Wt({applicationType:void 0,error:i,file:u});try{const j=(await Rt({model:n,prompt:k,temperature:m})).text;let x;if(j?x={body:J(j),header:G}:x={body:J(xe),header:G},d?.enabled!==!1){const O=K(i,u,m),S=U(g,O);ye(S,x,b)}return x}catch(j){console.error(j);const x={body:J(xe),header:G};if(d?.enabled!==!1){const O=K(i,u,m),S=U(g,O);ye(S,x,b)}return x}},"handle"),name:"AI SDK",priority:99}),"aiFinder");export{mn as default};