@visulima/error 4.2.0 → 4.3.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.
- package/CHANGELOG.md +15 -0
- package/README.md +24 -0
- package/dist/code-frame/index.cjs +6 -6
- package/dist/code-frame/index.mjs +6 -6
- package/dist/error/index.cjs +1 -1
- package/dist/error/index.d.cts +2 -0
- package/dist/error/index.d.mts +2 -0
- package/dist/error/index.d.ts +2 -0
- package/dist/error/index.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/error.CylOaVUk.cjs +18 -0
- package/dist/shared/error.rD6X6s7e.mjs +18 -0
- package/dist/stacktrace/index.cjs +2 -2
- package/dist/stacktrace/index.d.cts +2 -1
- package/dist/stacktrace/index.d.mts +2 -1
- package/dist/stacktrace/index.d.ts +2 -1
- package/dist/stacktrace/index.mjs +2 -2
- package/package.json +2 -2
- package/dist/shared/error.B5KA_10i.cjs +0 -18
- package/dist/shared/error.BoX3yBJ9.mjs +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## @visulima/error [4.3.0](https://github.com/visulima/visulima/compare/@visulima/error@4.2.0...@visulima/error@4.3.0) (2024-07-02)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* **error:** added a prefix option to renderError ([e164d52](https://github.com/visulima/visulima/commit/e164d528dfef4195a7cbd9f8843f58148dfc5e08))
|
|
6
|
+
* **error:** added stackFilter to parseStacktrace, fixed parsing AggregateError stack, added filterStacktrace to renderError ([bb4b4f7](https://github.com/visulima/visulima/commit/bb4b4f72ab00c63bf0ac5e9e6a9a01110c102a1c))
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **error:** renamed stackFilter to filter and changed interface for filterStacktrace ([b95dfb6](https://github.com/visulima/visulima/commit/b95dfb640b0d243122bff2ddf2e32a79101652e1))
|
|
11
|
+
|
|
12
|
+
### Miscellaneous Chores
|
|
13
|
+
|
|
14
|
+
* changed typescript version back to 5.4.5 ([55d28bb](https://github.com/visulima/visulima/commit/55d28bbdc103718d19f844034b38a0e8e5af798a))
|
|
15
|
+
|
|
1
16
|
## @visulima/error [4.2.0](https://github.com/visulima/visulima/compare/@visulima/error@4.1.0...@visulima/error@4.2.0) (2024-07-02)
|
|
2
17
|
|
|
3
18
|
### Features
|
package/README.md
CHANGED
|
@@ -228,6 +228,30 @@ console.log(stack);
|
|
|
228
228
|
// ];
|
|
229
229
|
```
|
|
230
230
|
|
|
231
|
+
### API
|
|
232
|
+
|
|
233
|
+
#### error
|
|
234
|
+
|
|
235
|
+
Type: `Error`
|
|
236
|
+
|
|
237
|
+
The error to parse.
|
|
238
|
+
|
|
239
|
+
#### options
|
|
240
|
+
|
|
241
|
+
Type: `object`
|
|
242
|
+
|
|
243
|
+
##### options.filter
|
|
244
|
+
|
|
245
|
+
Type: `Function`
|
|
246
|
+
|
|
247
|
+
A function to filter the stack frames.
|
|
248
|
+
|
|
249
|
+
##### options.frameLimit
|
|
250
|
+
|
|
251
|
+
Type: `number`
|
|
252
|
+
|
|
253
|
+
The maximum number of frames to parse.
|
|
254
|
+
|
|
231
255
|
## `serialize` an error object
|
|
232
256
|
|
|
233
257
|
- Ensures errors are safe to serialize with JSON
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`),"normalizeLF"),T=globalThis.process||Object.create(null),
|
|
3
|
-
`);typeof n?.tabWidth=="number"&&(i=i.map(r=>r.replaceAll(" "," ".repeat(n.tabWidth))));const{end:o,markerLines:l,start:m}=R(e,i,n.linesAbove,n.linesBelow),u=String(o).length,{gutter:g,marker:p,message:b}=n.color;let a=i.slice(m,o).map((r,s)=>{const c=m+1+s,h=l[c],k
|
|
4
|
-
`,n.prefix+g(
|
|
5
|
-
`);return n.message&&!f&&(a=n.prefix
|
|
6
|
-
|
|
1
|
+
"use strict";var P=Object.defineProperty;var v=(t,e)=>P(t,"name",{value:e,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var F=Object.defineProperty,S=v((t,e)=>F(t,"name",{value:e,configurable:!0}),"r$1");const N=S(t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
2
|
+
`),"normalizeLF"),T=globalThis.process||Object.create(null),x={versions:{}},j=new Proxy(T,{get(t,e){if(e in t)return t[e];if(e in x)return x[e]}});var _=Object.defineProperty,C=v((t,e)=>_(t,"name",{value:e,configurable:!0}),"b");const R=C((t,e,d,n)=>{const f={column:0,line:-1,...t.start},i={...f,...t.end},o=f.line,l=f.column,m=i.line,u=i.column;let g=Math.max(o-(d+1),0),p=Math.min(e.length,m+n);o===-1&&(g=0),m===-1&&(p=e.length);const b=m-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,u];else{const c=e[s-r]?.length;a[s]=[0,c]}}else l===u?a[o]=l?[l,0]:!0:a[o]=[l,(u??0)-(l??0)];return{end:p,markerLines:a,start:g}},"getMarkerLines");var W=Object.defineProperty,y=v((t,e)=>W(t,"name",{value:e,configurable:!0}),"o");const M=j.platform==="win32"&&!j.env?.WT_SESSION?">":"❯",I=y((t,e,d)=>{const n={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...d,color:{gutter:y(r=>r,"gutter"),marker:y(r=>r,"marker"),message:y(r=>r,"message"),...d?.color}},f=e.start&&typeof e.start.column=="number";let i=N(t).split(`
|
|
3
|
+
`);typeof n?.tabWidth=="number"&&(i=i.map(r=>r.replaceAll(" "," ".repeat(n.tabWidth))));const{end:o,markerLines:l,start:m}=R(e,i,n.linesAbove,n.linesBelow),u=String(o).length,{gutter:g,marker:p,message:b}=n.color;let a=i.slice(m,o).map((r,s)=>{const c=m+1+s,h=l[c],k=(" "+c).slice(-u),w=!l[c+1],A=" "+k+(n.showGutter?" |":"");if(h){let O="";if(Array.isArray(h)){const E=r.replaceAll(/[^\t]/g," ").slice(0,Math.max(h[0]-1,0)),L=h[1]||1;O=[`
|
|
4
|
+
`,n.prefix+g(A.replaceAll(/\d/g," "))," ",E,p("^").repeat(L)].join(""),w&&n.message&&(O+=` ${b(n.message)}`)}return[n.prefix+p(M),g(A),r.length>0?" "+r:"",O].join("")}return n.prefix+" "+g(A)+(r.length>0?" "+r:"")}).join(`
|
|
5
|
+
`);return n.message&&!f&&(a=n.prefix+" ".repeat(u+1)+n.message+`
|
|
6
|
+
`+a),a},"codeFrame");exports.CODE_FRAME_POINTER=M;exports.codeFrame=I;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),"normalizeLF"),S=globalThis.process||Object.create(null),
|
|
3
|
-
`);typeof n?.tabWidth=="number"&&(i=i.map(r=>r.replaceAll(" "," ".repeat(n.tabWidth))));const{end:o,markerLines:l,start:m}=T(e,i,n.linesAbove,n.linesBelow),u=String(o).length,{gutter:g,marker:p,message:b}=n.color;let a=i.slice(m,o).map((r,s)=>{const c=m+1+s,d=l[c],
|
|
4
|
-
`,n.prefix+g(
|
|
5
|
-
`);return n.message&&!f&&(a=n.prefix
|
|
6
|
-
|
|
1
|
+
var P=Object.defineProperty;var v=(t,e)=>P(t,"name",{value:e,configurable:!0});var E=Object.defineProperty,F=v((t,e)=>E(t,"name",{value:e,configurable:!0}),"r$1");const N=F(t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
2
|
+
`),"normalizeLF"),S=globalThis.process||Object.create(null),j={versions:{}},k=new Proxy(S,{get(t,e){if(e in t)return t[e];if(e in j)return j[e]}});var W=Object.defineProperty,C=v((t,e)=>W(t,"name",{value:e,configurable:!0}),"b");const T=C((t,e,h,n)=>{const f={column:0,line:-1,...t.start},i={...f,...t.end},o=f.line,l=f.column,m=i.line,u=i.column;let g=Math.max(o-(h+1),0),p=Math.min(e.length,m+n);o===-1&&(g=0),m===-1&&(p=e.length);const b=m-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,u];else{const c=e[s-r]?.length;a[s]=[0,c]}}else l===u?a[o]=l?[l,0]:!0:a[o]=[l,(u??0)-(l??0)];return{end:p,markerLines:a,start:g}},"getMarkerLines");var _=Object.defineProperty,x=v((t,e)=>_(t,"name",{value:e,configurable:!0}),"o");const B=k.platform==="win32"&&!k.env?.WT_SESSION?">":"❯",I=x((t,e,h)=>{const n={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...h,color:{gutter:x(r=>r,"gutter"),marker:x(r=>r,"marker"),message:x(r=>r,"message"),...h?.color}},f=e.start&&typeof e.start.column=="number";let i=N(t).split(`
|
|
3
|
+
`);typeof n?.tabWidth=="number"&&(i=i.map(r=>r.replaceAll(" "," ".repeat(n.tabWidth))));const{end:o,markerLines:l,start:m}=T(e,i,n.linesAbove,n.linesBelow),u=String(o).length,{gutter:g,marker:p,message:b}=n.color;let a=i.slice(m,o).map((r,s)=>{const c=m+1+s,d=l[c],w=(" "+c).slice(-u),L=!l[c+1],A=" "+w+(n.showGutter?" |":"");if(d){let y="";if(Array.isArray(d)){const O=r.replaceAll(/[^\t]/g," ").slice(0,Math.max(d[0]-1,0)),M=d[1]||1;y=[`
|
|
4
|
+
`,n.prefix+g(A.replaceAll(/\d/g," "))," ",O,p("^").repeat(M)].join(""),L&&n.message&&(y+=` ${b(n.message)}`)}return[n.prefix+p(B),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(u+1)+n.message+`
|
|
6
|
+
`+a),a},"codeFrame");export{B as CODE_FRAME_POINTER,I as codeFrame};
|
package/dist/error/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../shared/error.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../shared/error.CylOaVUk.cjs");exports.VisulimaError=r.VisulimaError;exports.getErrorCauses=r.i;exports.isVisulimaError=r.isVisulimaError;exports.renderError=r.renderError;exports.serializeError=r.serialize;
|
package/dist/error/index.d.cts
CHANGED
|
@@ -40,6 +40,7 @@ type Options$1 = Omit<CodeFrameOptions, "message | prefix"> & {
|
|
|
40
40
|
};
|
|
41
41
|
cwd: string;
|
|
42
42
|
displayShortPath: boolean;
|
|
43
|
+
filterStacktrace: ((line: string) => boolean) | undefined;
|
|
43
44
|
framesMaxLimit: number;
|
|
44
45
|
hideErrorCauseCodeView: boolean;
|
|
45
46
|
hideErrorCodeView: boolean;
|
|
@@ -47,6 +48,7 @@ type Options$1 = Omit<CodeFrameOptions, "message | prefix"> & {
|
|
|
47
48
|
hideErrorTitle: boolean;
|
|
48
49
|
hideMessage: boolean;
|
|
49
50
|
indentation: number | "\t";
|
|
51
|
+
prefix: string;
|
|
50
52
|
};
|
|
51
53
|
declare const renderError: (error: AggregateError | Error | VisulimaError, options?: Partial<Options$1>) => string;
|
|
52
54
|
|
package/dist/error/index.d.mts
CHANGED
|
@@ -40,6 +40,7 @@ type Options$1 = Omit<CodeFrameOptions, "message | prefix"> & {
|
|
|
40
40
|
};
|
|
41
41
|
cwd: string;
|
|
42
42
|
displayShortPath: boolean;
|
|
43
|
+
filterStacktrace: ((line: string) => boolean) | undefined;
|
|
43
44
|
framesMaxLimit: number;
|
|
44
45
|
hideErrorCauseCodeView: boolean;
|
|
45
46
|
hideErrorCodeView: boolean;
|
|
@@ -47,6 +48,7 @@ type Options$1 = Omit<CodeFrameOptions, "message | prefix"> & {
|
|
|
47
48
|
hideErrorTitle: boolean;
|
|
48
49
|
hideMessage: boolean;
|
|
49
50
|
indentation: number | "\t";
|
|
51
|
+
prefix: string;
|
|
50
52
|
};
|
|
51
53
|
declare const renderError: (error: AggregateError | Error | VisulimaError, options?: Partial<Options$1>) => string;
|
|
52
54
|
|
package/dist/error/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ type Options$1 = Omit<CodeFrameOptions, "message | prefix"> & {
|
|
|
40
40
|
};
|
|
41
41
|
cwd: string;
|
|
42
42
|
displayShortPath: boolean;
|
|
43
|
+
filterStacktrace: ((line: string) => boolean) | undefined;
|
|
43
44
|
framesMaxLimit: number;
|
|
44
45
|
hideErrorCauseCodeView: boolean;
|
|
45
46
|
hideErrorCodeView: boolean;
|
|
@@ -47,6 +48,7 @@ type Options$1 = Omit<CodeFrameOptions, "message | prefix"> & {
|
|
|
47
48
|
hideErrorTitle: boolean;
|
|
48
49
|
hideMessage: boolean;
|
|
49
50
|
indentation: number | "\t";
|
|
51
|
+
prefix: string;
|
|
50
52
|
};
|
|
51
53
|
declare const renderError: (error: AggregateError | Error | VisulimaError, options?: Partial<Options$1>) => string;
|
|
52
54
|
|
package/dist/error/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{V as a,i,a as e,r as o,s as E}from"../shared/error.
|
|
1
|
+
import{V as a,i,a as e,r as o,s as E}from"../shared/error.rD6X6s7e.mjs";export{a as VisulimaError,i as getErrorCauses,e as isVisulimaError,o as renderError,E as serializeError};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var c=(r,e)=>y(r,"name",{value:e,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./code-frame/index.cjs"),o=require("./shared/error.
|
|
1
|
+
"use strict";var y=Object.defineProperty;var c=(r,e)=>y(r,"name",{value:e,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./code-frame/index.cjs"),o=require("./shared/error.CylOaVUk.cjs"),E=require("./stacktrace/index.cjs");var d=Object.defineProperty,s=c((r,e)=>d(r,"name",{value:e,configurable:!0}),"l");const u=s((r,e)=>{let n=0,t=e.length-2;for(;n<t;){const i=n+(t-n>>1);if(r<e[i])t=i-1;else if(r>=e[i+1])n=i+1;else{n=i;break}}return n},"binarySearch"),f=s(r=>r.split(/\n|\r(?!\n)/).reduce((e,n)=>(e.push(e.at(-1)+n.length+1),e),[0]),"getLineStartIndexes"),g=s((r,e,n)=>{const t=n?.skipChecks??!1;if(!t&&(!Array.isArray(r)&&typeof r!="string"||(typeof r=="string"||Array.isArray(r))&&r.length===0))return{column:0,line:0};if(!t&&(typeof e!="number"||typeof r=="string"&&e>=r.length||Array.isArray(r)&&e+1>=r.at(-1)))return{column:0,line:0};if(typeof r=="string"){const a=f(r),l=u(e,a);return{column:e-a[l]+1,line:l+1}}const i=u(e,r);return{column:e-r[i]+1,line:i+1}},"indexToLineColumn"),p=g;exports.CODE_FRAME_POINTER=m.CODE_FRAME_POINTER;exports.codeFrame=m.codeFrame;exports.VisulimaError=o.VisulimaError;exports.getErrorCauses=o.i;exports.isVisulimaError=o.isVisulimaError;exports.renderError=o.renderError;exports.serializeError=o.serialize;exports.parseStacktrace=E.parseStacktrace;exports.indexToLineColumn=p;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=Object.defineProperty;var l=(r,e)=>c(r,"name",{value:e,configurable:!0});import{CODE_FRAME_POINTER as h,codeFrame as x}from"./code-frame/index.mjs";import{V as b,i as C,a as k,r as v,s as L}from"./shared/error.
|
|
1
|
+
var c=Object.defineProperty;var l=(r,e)=>c(r,"name",{value:e,configurable:!0});import{CODE_FRAME_POINTER as h,codeFrame as x}from"./code-frame/index.mjs";import{V as b,i as C,a as k,r as v,s as L}from"./shared/error.rD6X6s7e.mjs";import{parseStacktrace as S}from"./stacktrace/index.mjs";var f=Object.defineProperty,s=l((r,e)=>f(r,"name",{value:e,configurable:!0}),"l");const u=s((r,e)=>{let n=0,o=e.length-2;for(;n<o;){const t=n+(o-n>>1);if(r<e[t])o=t-1;else if(r>=e[t+1])n=t+1;else{n=t;break}}return n},"binarySearch"),m=s(r=>r.split(/\n|\r(?!\n)/).reduce((e,n)=>(e.push(e.at(-1)+n.length+1),e),[0]),"getLineStartIndexes"),p=s((r,e,n)=>{const o=n?.skipChecks??!1;if(!o&&(!Array.isArray(r)&&typeof r!="string"||(typeof r=="string"||Array.isArray(r))&&r.length===0))return{column:0,line:0};if(!o&&(typeof e!="number"||typeof r=="string"&&e>=r.length||Array.isArray(r)&&e+1>=r.at(-1)))return{column:0,line:0};if(typeof r=="string"){const i=m(r),a=u(e,i);return{column:e-i[a]+1,line:a+1}}const t=u(e,r);return{column:e-r[t]+1,line:t+1}},"indexToLineColumn"),g=p;export{h as CODE_FRAME_POINTER,b as VisulimaError,x as codeFrame,C as getErrorCauses,g as indexToLineColumn,k as isVisulimaError,S as parseStacktrace,v as renderError,L as serializeError};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";var C=Object.defineProperty;var l=(e,t)=>C(e,"name",{value:t,configurable:!0});const P=require("node:util"),E=require("node:fs"),L=require("node:path"),T=require("node:process"),A=require("node:url"),M=require("../code-frame/index.cjs"),v=require("../stacktrace/index.cjs");var I=Object.defineProperty,_=l((e,t)=>I(e,"name",{value:t,configurable:!0}),"a");const J=_(e=>{const t=new Set,r=[];let i=e;for(;i;){if(t.has(i)){console.error(`Circular reference detected in error causes: ${P.inspect(e)}`);break}if(r.push(i),t.add(i),!i.cause)break;i=i.cause}return r},"getErrorCauses"),F=J;var q=Object.defineProperty,a=l((e,t)=>q(e,"name",{value:t,configurable:!0}),"o");const u=a((e,t,r)=>r===0?e+"":t===" "?e+" ".repeat(r):e+" ".repeat(t*r),"getPrefix"),$=a((e,t)=>{const r=e.replace("async file:","file:");return L.relative(t,r.startsWith("file:")?A.fileURLToPath(r):r)},"getRelativePath"),y=a((e,{color:t,hideErrorTitle:r,indentation:i,prefix:o},n)=>u(o,i,n)+(r?t.title(e.message):t.title(e.name+(e.message?": "+e.message:"")))+`
|
|
2
|
+
`,"getMessage"),w=a((e,{color:t,indentation:r,prefix:i},o)=>{if(e.hint===void 0)return;const n=u(i,r,o);let s="";if(Array.isArray(e.hint))for(const c of e.hint)s+=n+c+`
|
|
3
|
+
`;else s+=n+e.hint;return t.hint(s)},"getHint"),b=a((e,{color:t,cwd:r,displayShortPath:i,indentation:o,prefix:n},s=0)=>{const c=i?$(e.file,r):e.file,{fileLine:f,method:h}=t;return u(n,o,s)+"at "+(e.methodName?h(e.methodName)+" ":"")+f(c)+":"+f(e.line+"")},"getMainFrame"),S=a((e,{color:t,indentation:r,linesAbove:i,linesBelow:o,prefix:n,showGutter:s,showLineNumbers:c,tabWidth:f},h)=>{if(e.file===void 0)return;const g=e.file.replace("file://","");if(!E.existsSync(g))return;const k=E.readFileSync(g,"utf8");return M.codeFrame(k,{start:{column:e.column,line:e.line}},{color:t,linesAbove:i,linesBelow:o,prefix:u(n,r,h),showGutter:s,showLineNumbers:c,tabWidth:f})},"getCode"),x=a((e,t,r)=>{if(e.errors.length===0)return;let i=u(t.prefix,t.indentation,r)+`Errors:
|
|
4
|
+
|
|
5
|
+
`,o=!0;for(const n of e.errors)o?o=!1:i+=`
|
|
6
|
+
|
|
7
|
+
`,i+=N(n,{...t,framesMaxLimit:1,hideErrorCodeView:t.hideErrorErrorsCodeView},r+1);return`
|
|
8
|
+
`+i},"getErrors"),O=a((e,t,r)=>{let i=u(t.prefix,t.indentation,r)+`Caused by:
|
|
9
|
+
|
|
10
|
+
`;const o=e.cause;i+=y(o,t,r);const n=v.parseStacktrace(o).shift(),s=w(o,t,r);if(s&&(i+=s+`
|
|
11
|
+
`),i+=b(n,t,r),!t.hideErrorCauseCodeView){const c=S(n,t,r);c!==void 0&&(i+=`
|
|
12
|
+
`+c)}if(o.cause)i+=`
|
|
13
|
+
`+O(o,t,r+1);else if(o instanceof AggregateError){const c=x(o,t,r);c!==void 0&&(i+=`
|
|
14
|
+
`+c)}return`
|
|
15
|
+
`+i},"getCause"),B=a((e,t)=>(e.length>0?`
|
|
16
|
+
`:"")+e.map(r=>b(r,t)).join(`
|
|
17
|
+
`),"getStacktrace"),N=a((e,t,r)=>{const i={cwd:T.cwd(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...t,color:{fileLine:a(s=>s,"fileLine"),gutter:a(s=>s,"gutter"),hint:a(s=>s,"hint"),marker:a(s=>s,"marker"),message:a(s=>s,"message"),method:a(s=>s,"method"),title:a(s=>s,"title"),...t.color}},o=v.parseStacktrace(e,{filter:t.filterStacktrace,frameLimit:i.framesMaxLimit}),n=o.shift();return[t.hideMessage?void 0:y(e,i,r),w(e,i,r),n?b(n,i,r):void 0,n&&!i.hideErrorCodeView?S(n,i,r):void 0,e instanceof AggregateError?x(e,i,r):void 0,e.cause===void 0?void 0:O(e,i,r),o.length>0?B(o,i):void 0].filter(Boolean).join(`
|
|
18
|
+
`)},"internalRenderError"),D=a((e,t={})=>{if(t.framesMaxLimit!==void 0&&t.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return N(e,t,0)},"renderError");function z(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}l(z,"isPlainObject");const W=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 R=Object.defineProperty,m=l((e,t)=>R(e,"name",{value:t,configurable:!0}),"c");const p=new WeakSet,G=m(e=>{p.add(e);const t=e.toJSON();return p.delete(e),t},"toJSON"),j=m((e,t,r,i)=>{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]":(r+=1,d(e,i,t,r));if(i.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(z(e)){if(r+=1,i.maxDepth&&r>=i.maxDepth)return{};const o={};for(const n in e)o[n]=j(e[n],t,r,i);return o}try{return e}catch{return"[Not Available]"}},"serializeValue"),d=m((e,t,r,i)=>{if(r.push(e),t.maxDepth===0)return{};if(t.useToJSON&&typeof e.toJSON=="function"&&!p.has(e))return G(e);const o=Object.create(W);if(o.name=Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,o.message=e.message,o.stack=e.stack,Array.isArray(e.errors)){const n=[];for(const s of e.errors){if(!(s instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(r.includes(s))return o.errors=[],o;n.push(d(s,t,r,i))}o.errors=n}e.cause instanceof Error&&!r.includes(e.cause)&&(o.cause=d(e.cause,t,r,i));for(const n in e)if(o[n]===void 0){const s=e[n];o[n]=j(s,r,i,t)}if(Array.isArray(t.exclude)&&t.exclude.length>0)for(const n of t.exclude)try{delete o[n]}catch{}return o},"_serialize"),H=m((e,t={})=>d(e,{exclude:t.exclude??[],maxDepth:t.maxDepth??Number.POSITIVE_INFINITY,useToJSON:t.useToJSON??!1},[],0),"serialize");var U=Object.defineProperty,V=l((e,t)=>U(e,"name",{value:t,configurable:!0}),"t");const Y=V(e=>e instanceof Error&&e.type==="VisulimaError","isVisulimaError");class K extends Error{static{l(this,"VisulimaError")}static{V(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:t,hint:r,location:i,message:o,name:n,stack:s,title:c}){super(o,{cause:t}),this.title=c,this.name=n,this.stack=s??this.stack,this.loc=i,this.hint=r,Error.captureStackTrace(this,this.constructor)}setLocation(t){this.loc=t}setName(t){this.name=t}setMessage(t){this.message=t}setHint(t){this.hint=t}}exports.VisulimaError=K;exports.i=F;exports.isVisulimaError=Y;exports.renderError=D;exports.serialize=H;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var k=Object.defineProperty;var l=(e,t)=>k(e,"name",{value:t,configurable:!0});import{inspect as C}from"node:util";import{existsSync as P,readFileSync as L}from"node:fs";import{relative as T}from"node:path";import{cwd as A}from"node:process";import{fileURLToPath as M}from"node:url";import{codeFrame as I}from"../code-frame/index.mjs";import{parseStacktrace as v}from"../stacktrace/index.mjs";var J=Object.defineProperty,$=l((e,t)=>J(e,"name",{value:t,configurable:!0}),"a");const F=$(e=>{const t=new Set,r=[];let o=e;for(;o;){if(t.has(o)){console.error(`Circular reference detected in error causes: ${C(e)}`);break}if(r.push(o),t.add(o),!o.cause)break;o=o.cause}return r},"getErrorCauses"),te=F;var B=Object.defineProperty,a=l((e,t)=>B(e,"name",{value:t,configurable:!0}),"o");const u=a((e,t,r)=>r===0?e+"":t===" "?e+" ".repeat(r):e+" ".repeat(t*r),"getPrefix"),D=a((e,t)=>{const r=e.replace("async file:","file:");return T(t,r.startsWith("file:")?M(r):r)},"getRelativePath"),E=a((e,{color:t,hideErrorTitle:r,indentation:o,prefix:i},n)=>u(i,o,n)+(r?t.title(e.message):t.title(e.name+(e.message?": "+e.message:"")))+`
|
|
2
|
+
`,"getMessage"),y=a((e,{color:t,indentation:r,prefix:o},i)=>{if(e.hint===void 0)return;const n=u(o,r,i);let s="";if(Array.isArray(e.hint))for(const c of e.hint)s+=n+c+`
|
|
3
|
+
`;else s+=n+e.hint;return t.hint(s)},"getHint"),b=a((e,{color:t,cwd:r,displayShortPath:o,indentation:i,prefix:n},s=0)=>{const c=o?D(e.file,r):e.file,{fileLine:f,method:h}=t;return u(n,i,s)+"at "+(e.methodName?h(e.methodName)+" ":"")+f(c)+":"+f(e.line+"")},"getMainFrame"),w=a((e,{color:t,indentation:r,linesAbove:o,linesBelow:i,prefix:n,showGutter:s,showLineNumbers:c,tabWidth:f},h)=>{if(e.file===void 0)return;const g=e.file.replace("file://","");if(!P(g))return;const V=L(g,"utf8");return I(V,{start:{column:e.column,line:e.line}},{color:t,linesAbove:o,linesBelow:i,prefix:u(n,r,h),showGutter:s,showLineNumbers:c,tabWidth:f})},"getCode"),S=a((e,t,r)=>{if(e.errors.length===0)return;let o=u(t.prefix,t.indentation,r)+`Errors:
|
|
4
|
+
|
|
5
|
+
`,i=!0;for(const n of e.errors)i?i=!1:o+=`
|
|
6
|
+
|
|
7
|
+
`,o+=O(n,{...t,framesMaxLimit:1,hideErrorCodeView:t.hideErrorErrorsCodeView},r+1);return`
|
|
8
|
+
`+o},"getErrors"),x=a((e,t,r)=>{let o=u(t.prefix,t.indentation,r)+`Caused by:
|
|
9
|
+
|
|
10
|
+
`;const i=e.cause;o+=E(i,t,r);const n=v(i).shift(),s=y(i,t,r);if(s&&(o+=s+`
|
|
11
|
+
`),o+=b(n,t,r),!t.hideErrorCauseCodeView){const c=w(n,t,r);c!==void 0&&(o+=`
|
|
12
|
+
`+c)}if(i.cause)o+=`
|
|
13
|
+
`+x(i,t,r+1);else if(i instanceof AggregateError){const c=S(i,t,r);c!==void 0&&(o+=`
|
|
14
|
+
`+c)}return`
|
|
15
|
+
`+o},"getCause"),W=a((e,t)=>(e.length>0?`
|
|
16
|
+
`:"")+e.map(r=>b(r,t)).join(`
|
|
17
|
+
`),"getStacktrace"),O=a((e,t,r)=>{const o={cwd:A(),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,...t,color:{fileLine:a(s=>s,"fileLine"),gutter:a(s=>s,"gutter"),hint:a(s=>s,"hint"),marker:a(s=>s,"marker"),message:a(s=>s,"message"),method:a(s=>s,"method"),title:a(s=>s,"title"),...t.color}},i=v(e,{filter:t.filterStacktrace,frameLimit:o.framesMaxLimit}),n=i.shift();return[t.hideMessage?void 0:E(e,o,r),y(e,o,r),n?b(n,o,r):void 0,n&&!o.hideErrorCodeView?w(n,o,r):void 0,e instanceof AggregateError?S(e,o,r):void 0,e.cause===void 0?void 0:x(e,o,r),i.length>0?W(i,o):void 0].filter(Boolean).join(`
|
|
18
|
+
`)},"internalRenderError"),re=a((e,t={})=>{if(t.framesMaxLimit!==void 0&&t.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return O(e,t,0)},"renderError");function z(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}l(z,"isPlainObject");const R=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 G=Object.defineProperty,d=l((e,t)=>G(e,"name",{value:t,configurable:!0}),"c");const p=new WeakSet,_=d(e=>{p.add(e);const t=e.toJSON();return p.delete(e),t},"toJSON"),N=d((e,t,r,o)=>{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]":(r+=1,m(e,o,t,r));if(o.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(z(e)){if(r+=1,o.maxDepth&&r>=o.maxDepth)return{};const i={};for(const n in e)i[n]=N(e[n],t,r,o);return i}try{return e}catch{return"[Not Available]"}},"serializeValue"),m=d((e,t,r,o)=>{if(r.push(e),t.maxDepth===0)return{};if(t.useToJSON&&typeof e.toJSON=="function"&&!p.has(e))return _(e);const i=Object.create(R);if(i.name=Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,i.message=e.message,i.stack=e.stack,Array.isArray(e.errors)){const n=[];for(const s of e.errors){if(!(s instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(r.includes(s))return i.errors=[],i;n.push(m(s,t,r,o))}i.errors=n}e.cause instanceof Error&&!r.includes(e.cause)&&(i.cause=m(e.cause,t,r,o));for(const n in e)if(i[n]===void 0){const s=e[n];i[n]=N(s,r,o,t)}if(Array.isArray(t.exclude)&&t.exclude.length>0)for(const n of t.exclude)try{delete i[n]}catch{}return i},"_serialize"),oe=d((e,t={})=>m(e,{exclude:t.exclude??[],maxDepth:t.maxDepth??Number.POSITIVE_INFINITY,useToJSON:t.useToJSON??!1},[],0),"serialize");var H=Object.defineProperty,j=l((e,t)=>H(e,"name",{value:t,configurable:!0}),"t");const ie=j(e=>e instanceof Error&&e.type==="VisulimaError","isVisulimaError");class ne extends Error{static{l(this,"VisulimaError")}static{j(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:t,hint:r,location:o,message:i,name:n,stack:s,title:c}){super(i,{cause:t}),this.title=c,this.name=n,this.stack=s??this.stack,this.loc=o,this.hint=r,Error.captureStackTrace(this,this.constructor)}setLocation(t){this.loc=t}setName(t){this.name=t}setMessage(t){this.message=t}setHint(t){this.hint=t}}export{ne as V,ie as a,te as i,re as r,oe as s};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var x=Object.defineProperty;var v=(i,e)=>x(i,"name",{value:e,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var
|
|
2
|
-
`).map(
|
|
1
|
+
"use strict";var x=Object.defineProperty;var v=(i,e)=>x(i,"name",{value:e,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var g=Object.defineProperty,d=v((i,e)=>g(i,"name",{value:e,configurable:!0}),"u");const u=d((i,...e)=>{process.env.DEBUG&&String(process.env.DEBUG)==="true"&&console.debug(`error:parse-stacktrace: ${i}`,...e)},"debugLog"),f="<unknown>",N=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,S=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,h=/(.*?):(\d+):(\d+)(\s<-\s(.+):(\d+):(\d+))?/,b=/(eval)\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*(<anonymous>)?:(\d+)?:(\d+)/,k=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,w=/in\s(.*)\s\(at\s(.+)\)\sat/,O=/^(?:.*@)?(.*):(\d+):(\d+)$/,E=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,J=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,A=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,p=/\(error: (.*)\)/,y=d((i,e)=>{const n=i.includes("safari-extension"),t=i.includes("safari-web-extension");return n||t?[i.includes("@")?i.split("@")[0]:f,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[i,e]},"extractSafariExtensionDetails"),$=d((i,e)=>{const n=h.exec(e);n&&(i.file=n[1],i.line=+n[2],i.column=+n[3])},"parseMapped"),G=d(i=>{const e=w.exec(i);if(e){u(`parse nested node error stack line: "${i}"`,`found: ${JSON.stringify(e)}`);const t=e[2].split(":");return{column:t[2]?+t[2]:void 0,file:t[0],line:t[1]?+t[1]:void 0,methodName:e[1]||f,raw:i,type:void 0}}const n=k.exec(i);if(n){u(`parse node error stack line: "${i}"`,`found: ${JSON.stringify(n)}`);const t={column:n[4]?+n[4]:void 0,file:n[2]?n[2].replace(/at\s/,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]||f,raw:i,type:i.startsWith("internal")?"internal":void 0};return $(t,n[2]+":"+n[3]+":"+n[4]),t}},"parseNode"),W=d(i=>{const e=N.exec(i);if(e){u(`parse chrome error stack line: "${i}"`,`found: ${JSON.stringify(e)}`);const n=e[2]?.startsWith("native"),t=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let o,a;if(t){const s=S.exec(i);if(s){const r=/(\S+):(\d+):(\d+)|(\S+):(\d+)$/.exec(s[1]);r?(e[2]=r[4]??r[1],e[3]=r[5]??r[2],e[4]=r[3]):s[2]&&(e[2]=s[1]),s[2]&&(o={column:s[4]?+s[4]:void 0,file:s[2],line:s[3]?+s[3]:void 0,methodName:"eval",raw:i,type:"eval"})}else{const r=b.exec(i);r&&(a={column:r[5]?+r[5]:void 0,file:r[3],line:r[4]?+r[4]:void 0},o={column:r[8]?+r[8]:void 0,file:r[2],line:r[7]?+r[7]:void 0,methodName:"eval",raw:r[0],type:"eval"})}}const[m,c]=y(e[1]?e[1].replace(/^Anonymous function$/,"<anonymous>"):f,e[2]),l={column:e[4]?+e[4]:void 0,evalOrigin:o,file:c,line:e[3]?+e[3]:void 0,methodName:m,raw:i,type:t?"eval":n?"native":void 0};return a?(l.column=a.column,l.file=a.file,l.line=a.line):$(l,c+":"+e[3]+":"+e[4]),l}},"parseChromium"),j=d((i,e)=>{const n=E.exec(i);if(n){u(`parse gecko error stack line: "${i}"`,`found: ${JSON.stringify(n)}`);const t=n[3]?.includes(" > eval"),o=t&&n[3]&&J.exec(n[3]);let a;t&&o&&(n[3]=o[1],a={column:n[5]?+n[5]:void 0,file:n[3],line:n[4]?+n[4]:void 0,methodName:"eval",raw:i,type:"eval"},n[4]=o[2]);const[m,c]=y(n[1]?n[1].replace(/^Anonymous function$/,"<anonymous>"):f,n[3]);let l;(e?.type==="safari"||!t&&e?.type==="firefox")&&e.column?l=e.column:!t&&n[5]&&(l=+n[5]);let s;return(e?.type==="safari"||!t&&e?.type==="firefox")&&e.line?s=e.line:n[4]&&(s=+n[4]),{column:l,evalOrigin:a,file:c,line:s,methodName:m,raw:i,type:t?"eval":c.includes("[native code]")?"native":void 0}}},"parseGecko"),D=d((i,e)=>{const n=A.exec(i);if(!(n&&n[2].includes(" > eval"))&&n)return u(`parse firefox error stack line: "${i}"`,`found: ${JSON.stringify(n)}`),{column:n[4]?+n[4]:e?.column??void 0,file:n[2],line:n[3]?+n[3]:e?.line??void 0,methodName:n[1]||f,raw:i,type:void 0}},"parseFirefox"),z=d(i=>{const e=O.exec(i);if(e)return u(`parse react android native error stack line: "${i}"`,`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:f,raw:i,type:void 0}},"parseReactAndroidNative"),B=d((i,{filter:e,frameLimit:n=50}={})=>{let t=(i.stacktrace??i.stack??"").split(`
|
|
2
|
+
`).map(o=>(p.test(o)?o.replace(p,"$1"):o).replace(/^\s+|\s+$/g,"")).filter(o=>!/\S*(?:Error: |AggregateError:)/.test(o)&&o!=="eval code");return e&&(t=t.filter(o=>e(o))),t=t.slice(0,n),t.reduce((o,a,m)=>{if(!a||a.length>1024)return o;let c;if(/^\s*in\s.*/.test(a))c=G(a);else if(/^.*?\s*at\s.*/.test(a))c=W(a);else if(/^.*?\s*@.*|\[native code\]/.test(a)){let l;m===0&&(i.columnNumber||i.lineNumber?l={column:i.columnNumber,line:i.lineNumber,type:"firefox"}:(i.line||i.column)&&(l={column:i.column,line:i.line,type:"safari"})),c=D(a,l)||j(a,l)}else c=z(a);return c?o.push(c):u(`parse error stack line: "${a}"`,"not parser found"),o},[])},"parse"),L=B;exports.parseStacktrace=L;
|
|
@@ -9,7 +9,8 @@ interface Trace {
|
|
|
9
9
|
type?: TraceType | undefined;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
declare const parse: (error: Error,
|
|
12
|
+
declare const parse: (error: Error, { filter, frameLimit }?: Partial<{
|
|
13
|
+
filter?: (line: string) => boolean;
|
|
13
14
|
frameLimit: number;
|
|
14
15
|
}>) => Trace[];
|
|
15
16
|
|
|
@@ -9,7 +9,8 @@ interface Trace {
|
|
|
9
9
|
type?: TraceType | undefined;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
declare const parse: (error: Error,
|
|
12
|
+
declare const parse: (error: Error, { filter, frameLimit }?: Partial<{
|
|
13
|
+
filter?: (line: string) => boolean;
|
|
13
14
|
frameLimit: number;
|
|
14
15
|
}>) => Trace[];
|
|
15
16
|
|
|
@@ -9,7 +9,8 @@ interface Trace {
|
|
|
9
9
|
type?: TraceType | undefined;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
declare const parse: (error: Error,
|
|
12
|
+
declare const parse: (error: Error, { filter, frameLimit }?: Partial<{
|
|
13
|
+
filter?: (line: string) => boolean;
|
|
13
14
|
frameLimit: number;
|
|
14
15
|
}>) => Trace[];
|
|
15
16
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var x=Object.defineProperty;var v=(i,e)=>x(i,"name",{value:e,configurable:!0});var N=Object.defineProperty,d=v((i,e)=>N(i,"name",{value:e,configurable:!0}),"u");const u=d((i,...e)=>{process.env.DEBUG&&String(process.env.DEBUG)==="true"&&console.debug(`error:parse-stacktrace: ${i}`,...e)},"debugLog"),f="<unknown>",
|
|
2
|
-
`).map(
|
|
1
|
+
var x=Object.defineProperty;var v=(i,e)=>x(i,"name",{value:e,configurable:!0});var N=Object.defineProperty,d=v((i,e)=>N(i,"name",{value:e,configurable:!0}),"u");const u=d((i,...e)=>{process.env.DEBUG&&String(process.env.DEBUG)==="true"&&console.debug(`error:parse-stacktrace: ${i}`,...e)},"debugLog"),f="<unknown>",g=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,h=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,S=/(.*?):(\d+):(\d+)(\s<-\s(.+):(\d+):(\d+))?/,k=/(eval)\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*(<anonymous>)?:(\d+)?:(\d+)/,w=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,b=/in\s(.*)\s\(at\s(.+)\)\sat/,O=/^(?:.*@)?(.*):(\d+):(\d+)$/,E=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,J=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,A=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,p=/\(error: (.*)\)/,y=d((i,e)=>{const n=i.includes("safari-extension"),o=i.includes("safari-web-extension");return n||o?[i.includes("@")?i.split("@")[0]:f,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[i,e]},"extractSafariExtensionDetails"),$=d((i,e)=>{const n=S.exec(e);n&&(i.file=n[1],i.line=+n[2],i.column=+n[3])},"parseMapped"),G=d(i=>{const e=b.exec(i);if(e){u(`parse nested node error stack line: "${i}"`,`found: ${JSON.stringify(e)}`);const o=e[2].split(":");return{column:o[2]?+o[2]:void 0,file:o[0],line:o[1]?+o[1]:void 0,methodName:e[1]||f,raw:i,type:void 0}}const n=w.exec(i);if(n){u(`parse node error stack line: "${i}"`,`found: ${JSON.stringify(n)}`);const o={column:n[4]?+n[4]:void 0,file:n[2]?n[2].replace(/at\s/,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]||f,raw:i,type:i.startsWith("internal")?"internal":void 0};return $(o,n[2]+":"+n[3]+":"+n[4]),o}},"parseNode"),W=d(i=>{const e=g.exec(i);if(e){u(`parse chrome error stack line: "${i}"`,`found: ${JSON.stringify(e)}`);const n=e[2]?.startsWith("native"),o=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let t,a;if(o){const s=h.exec(i);if(s){const r=/(\S+):(\d+):(\d+)|(\S+):(\d+)$/.exec(s[1]);r?(e[2]=r[4]??r[1],e[3]=r[5]??r[2],e[4]=r[3]):s[2]&&(e[2]=s[1]),s[2]&&(t={column:s[4]?+s[4]:void 0,file:s[2],line:s[3]?+s[3]:void 0,methodName:"eval",raw:i,type:"eval"})}else{const r=k.exec(i);r&&(a={column:r[5]?+r[5]:void 0,file:r[3],line:r[4]?+r[4]:void 0},t={column:r[8]?+r[8]:void 0,file:r[2],line:r[7]?+r[7]:void 0,methodName:"eval",raw:r[0],type:"eval"})}}const[m,c]=y(e[1]?e[1].replace(/^Anonymous function$/,"<anonymous>"):f,e[2]),l={column:e[4]?+e[4]:void 0,evalOrigin:t,file:c,line:e[3]?+e[3]:void 0,methodName:m,raw:i,type:o?"eval":n?"native":void 0};return a?(l.column=a.column,l.file=a.file,l.line=a.line):$(l,c+":"+e[3]+":"+e[4]),l}},"parseChromium"),D=d((i,e)=>{const n=E.exec(i);if(n){u(`parse gecko error stack line: "${i}"`,`found: ${JSON.stringify(n)}`);const o=n[3]?.includes(" > eval"),t=o&&n[3]&&J.exec(n[3]);let a;o&&t&&(n[3]=t[1],a={column:n[5]?+n[5]:void 0,file:n[3],line:n[4]?+n[4]:void 0,methodName:"eval",raw:i,type:"eval"},n[4]=t[2]);const[m,c]=y(n[1]?n[1].replace(/^Anonymous function$/,"<anonymous>"):f,n[3]);let l;(e?.type==="safari"||!o&&e?.type==="firefox")&&e.column?l=e.column:!o&&n[5]&&(l=+n[5]);let s;return(e?.type==="safari"||!o&&e?.type==="firefox")&&e.line?s=e.line:n[4]&&(s=+n[4]),{column:l,evalOrigin:a,file:c,line:s,methodName:m,raw:i,type:o?"eval":c.includes("[native code]")?"native":void 0}}},"parseGecko"),j=d((i,e)=>{const n=A.exec(i);if(!(n&&n[2].includes(" > eval"))&&n)return u(`parse firefox error stack line: "${i}"`,`found: ${JSON.stringify(n)}`),{column:n[4]?+n[4]:e?.column??void 0,file:n[2],line:n[3]?+n[3]:e?.line??void 0,methodName:n[1]||f,raw:i,type:void 0}},"parseFirefox"),z=d(i=>{const e=O.exec(i);if(e)return u(`parse react android native error stack line: "${i}"`,`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:f,raw:i,type:void 0}},"parseReactAndroidNative"),B=d((i,{filter:e,frameLimit:n=50}={})=>{let o=(i.stacktrace??i.stack??"").split(`
|
|
2
|
+
`).map(t=>(p.test(t)?t.replace(p,"$1"):t).replace(/^\s+|\s+$/g,"")).filter(t=>!/\S*(?:Error: |AggregateError:)/.test(t)&&t!=="eval code");return e&&(o=o.filter(t=>e(t))),o=o.slice(0,n),o.reduce((t,a,m)=>{if(!a||a.length>1024)return t;let c;if(/^\s*in\s.*/.test(a))c=G(a);else if(/^.*?\s*at\s.*/.test(a))c=W(a);else if(/^.*?\s*@.*|\[native code\]/.test(a)){let l;m===0&&(i.columnNumber||i.lineNumber?l={column:i.columnNumber,line:i.lineNumber,type:"firefox"}:(i.line||i.column)&&(l={column:i.column,line:i.line,type:"safari"})),c=j(a,l)||D(a,l)}else c=z(a);return c?t.push(c):u(`parse error stack line: "${a}"`,"not parser found"),t},[])},"parse"),R=B;export{R as parseStacktrace};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/error",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "Error with more than just a message, stacktrace parsing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"prettier": "^3.3.2",
|
|
147
147
|
"rimraf": "^5.0.7",
|
|
148
148
|
"semantic-release": "24.0.0",
|
|
149
|
-
"typescript": "
|
|
149
|
+
"typescript": "5.4.5",
|
|
150
150
|
"vitest": "^1.6.0"
|
|
151
151
|
},
|
|
152
152
|
"engines": {
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";var k=Object.defineProperty;var c=(e,t)=>k(e,"name",{value:t,configurable:!0});const C=require("node:util"),g=require("node:fs"),P=require("node:path"),T=require("node:process"),A=require("node:url"),I=require("../code-frame/index.cjs"),E=require("../stacktrace/index.cjs");var L=Object.defineProperty,_=c((e,t)=>L(e,"name",{value:t,configurable:!0}),"a");const F=_(e=>{const t=new Set,r=[];let o=e;for(;o;){if(t.has(o)){console.error(`Circular reference detected in error causes: ${C.inspect(e)}`);break}if(r.push(o),t.add(o),!o.cause)break;o=o.cause}return r},"getErrorCauses"),J=F;var M=Object.defineProperty,a=c((e,t)=>M(e,"name",{value:t,configurable:!0}),"o");const u=a((e,t)=>t===0?"":e===" "?" ".repeat(t):" ".repeat(e*t),"getPrefix"),$=a((e,t)=>{const r=e.replace("async file:","file:");return P.relative(t,r.startsWith("file:")?A.fileURLToPath(r):r)},"getRelativePath"),y=a((e,{color:t,hideErrorTitle:r,indentation:o},i)=>u(o,i)+(r?t.title(e.message):t.title(e.name+": "+e.message))+`
|
|
2
|
-
`,"getMessage"),v=a((e,{color:t,indentation:r},o)=>{if(e.hint===void 0)return;const i=u(r,o);let n="";if(Array.isArray(e.hint))for(const s of e.hint)n+=i+s+`
|
|
3
|
-
`;else n+=i+e.hint;return t.hint(n)},"getHint"),b=a((e,{color:t,cwd:r,displayShortPath:o,indentation:i},n=0)=>{const s=o?$(e.file,r):e.file,{fileLine:l,method:h}=t;return u(i,n)+"at "+(e.methodName?h(e.methodName)+" ":"")+l(s)+":"+l(e.line+"")},"getMainFrame"),w=a((e,{color:t,indentation:r,linesAbove:o,linesBelow:i,showGutter:n,showLineNumbers:s,tabWidth:l},h)=>{if(e.file===void 0)return;const p=e.file.replace("file://","");if(!g.existsSync(p))return;const V=g.readFileSync(p,"utf8");return I.codeFrame(V,{start:{column:e.column,line:e.line}},{color:t,linesAbove:o,linesBelow:i,prefix:u(r,h),showGutter:n,showLineNumbers:s,tabWidth:l})},"getCode"),S=a((e,t,r)=>{if(e.errors.length===0)return;let o=u(t.indentation,r)+`Errors:
|
|
4
|
-
|
|
5
|
-
`,i=!0;for(const n of e.errors)i?i=!1:o+=`
|
|
6
|
-
|
|
7
|
-
`,o+=N(n,{...t,framesMaxLimit:0,hideErrorCodeView:t.hideErrorErrorsCodeView},r+1);return`
|
|
8
|
-
`+o},"getErrors"),O=a((e,t,r)=>{let o=u(t.indentation,r)+`Caused by:
|
|
9
|
-
|
|
10
|
-
`;const i=e.cause;o+=y(i,t,r);const n=E.parseStacktrace(i).shift(),s=v(i,t,r);return s&&(o+=s+`
|
|
11
|
-
`),o+=b(n,t,r),t.hideErrorCauseCodeView||(o+=`
|
|
12
|
-
`+w(n,t,r)),i.cause?o+=`
|
|
13
|
-
`+O(i,t,r+1):i instanceof AggregateError&&(o+=`
|
|
14
|
-
`+S(i,t,r)),`
|
|
15
|
-
`+o},"getCause"),q=a((e,t)=>{const r=e.slice(0,t.framesMaxLimit);return(r.length>0?`
|
|
16
|
-
`:"")+r.map(o=>b(o,t)).join(`
|
|
17
|
-
`)},"getStacktrace"),N=a((e,t,r)=>{const o={cwd:T.cwd(),displayShortPath:!1,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,showGutter:!0,showLineNumbers:!0,tabWidth:4,...t,color:{fileLine:a(s=>s,"fileLine"),gutter:a(s=>s,"gutter"),hint:a(s=>s,"hint"),marker:a(s=>s,"marker"),message:a(s=>s,"message"),method:a(s=>s,"method"),title:a(s=>s,"title"),...t.color}},i=E.parseStacktrace(e),n=i.shift();return[t.hideMessage?void 0:y(e,o,r),"",v(e,o,r),"",n?b(n,o,r):void 0,n&&!o.hideErrorCodeView?w(n,o,r):void 0,e instanceof AggregateError?S(e,o,r):void 0,e.cause===void 0?void 0:O(e,o,r),i.length>0?q(i,o):void 0].filter(Boolean).join(`
|
|
18
|
-
`)},"internalRenderError"),B=a((e,t={})=>N(e,t,0),"renderError");function D(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}c(D,"isPlainObject");const z=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 W=Object.defineProperty,d=c((e,t)=>W(e,"name",{value:t,configurable:!0}),"c");const m=new WeakSet,G=d(e=>{m.add(e);const t=e.toJSON();return m.delete(e),t},"toJSON"),j=d((e,t,r,o)=>{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]":(r+=1,f(e,o,t,r));if(o.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(D(e)){if(r+=1,o.maxDepth&&r>=o.maxDepth)return{};const i={};for(const n in e)i[n]=j(e[n],t,r,o);return i}try{return e}catch{return"[Not Available]"}},"serializeValue"),f=d((e,t,r,o)=>{if(r.push(e),t.maxDepth===0)return{};if(t.useToJSON&&typeof e.toJSON=="function"&&!m.has(e))return G(e);const i=Object.create(z);if(i.name=Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,i.message=e.message,i.stack=e.stack,Array.isArray(e.errors)){const n=[];for(const s of e.errors){if(!(s instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(r.includes(s))return i.errors=[],i;n.push(f(s,t,r,o))}i.errors=n}e.cause instanceof Error&&!r.includes(e.cause)&&(i.cause=f(e.cause,t,r,o));for(const n in e)if(i[n]===void 0){const s=e[n];i[n]=j(s,r,o,t)}if(Array.isArray(t.exclude)&&t.exclude.length>0)for(const n of t.exclude)try{delete i[n]}catch{}return i},"_serialize"),R=d((e,t={})=>f(e,{exclude:t.exclude??[],maxDepth:t.maxDepth??Number.POSITIVE_INFINITY,useToJSON:t.useToJSON??!1},[],0),"serialize");var H=Object.defineProperty,x=c((e,t)=>H(e,"name",{value:t,configurable:!0}),"t");const U=x(e=>e instanceof Error&&e.type==="VisulimaError","isVisulimaError");class Y extends Error{static{c(this,"VisulimaError")}static{x(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:t,hint:r,location:o,message:i,name:n,stack:s,title:l}){super(i,{cause:t}),this.title=l,this.name=n,this.stack=s??this.stack,this.loc=o,this.hint=r,Error.captureStackTrace(this,this.constructor)}setLocation(t){this.loc=t}setName(t){this.name=t}setMessage(t){this.message=t}setHint(t){this.hint=t}}exports.VisulimaError=Y;exports.i=J;exports.isVisulimaError=U;exports.renderError=B;exports.serialize=R;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
var V=Object.defineProperty;var c=(e,t)=>V(e,"name",{value:t,configurable:!0});import{inspect as C}from"node:util";import{existsSync as P,readFileSync as T}from"node:fs";import{relative as k}from"node:path";import{cwd as A}from"node:process";import{fileURLToPath as I}from"node:url";import{codeFrame as L}from"../code-frame/index.mjs";import{parseStacktrace as g}from"../stacktrace/index.mjs";var J=Object.defineProperty,$=c((e,t)=>J(e,"name",{value:t,configurable:!0}),"a");const F=$(e=>{const t=new Set,r=[];let o=e;for(;o;){if(t.has(o)){console.error(`Circular reference detected in error causes: ${C(e)}`);break}if(r.push(o),t.add(o),!o.cause)break;o=o.cause}return r},"getErrorCauses"),ee=F;var M=Object.defineProperty,a=c((e,t)=>M(e,"name",{value:t,configurable:!0}),"o");const u=a((e,t)=>t===0?"":e===" "?" ".repeat(t):" ".repeat(e*t),"getPrefix"),B=a((e,t)=>{const r=e.replace("async file:","file:");return k(t,r.startsWith("file:")?I(r):r)},"getRelativePath"),y=a((e,{color:t,hideErrorTitle:r,indentation:o},i)=>u(o,i)+(r?t.title(e.message):t.title(e.name+": "+e.message))+`
|
|
2
|
-
`,"getMessage"),E=a((e,{color:t,indentation:r},o)=>{if(e.hint===void 0)return;const i=u(r,o);let n="";if(Array.isArray(e.hint))for(const s of e.hint)n+=i+s+`
|
|
3
|
-
`;else n+=i+e.hint;return t.hint(n)},"getHint"),p=a((e,{color:t,cwd:r,displayShortPath:o,indentation:i},n=0)=>{const s=o?B(e.file,r):e.file,{fileLine:l,method:d}=t;return u(i,n)+"at "+(e.methodName?d(e.methodName)+" ":"")+l(s)+":"+l(e.line+"")},"getMainFrame"),v=a((e,{color:t,indentation:r,linesAbove:o,linesBelow:i,showGutter:n,showLineNumbers:s,tabWidth:l},d)=>{if(e.file===void 0)return;const b=e.file.replace("file://","");if(!P(b))return;const x=T(b,"utf8");return L(x,{start:{column:e.column,line:e.line}},{color:t,linesAbove:o,linesBelow:i,prefix:u(r,d),showGutter:n,showLineNumbers:s,tabWidth:l})},"getCode"),w=a((e,t,r)=>{if(e.errors.length===0)return;let o=u(t.indentation,r)+`Errors:
|
|
4
|
-
|
|
5
|
-
`,i=!0;for(const n of e.errors)i?i=!1:o+=`
|
|
6
|
-
|
|
7
|
-
`,o+=O(n,{...t,framesMaxLimit:0,hideErrorCodeView:t.hideErrorErrorsCodeView},r+1);return`
|
|
8
|
-
`+o},"getErrors"),S=a((e,t,r)=>{let o=u(t.indentation,r)+`Caused by:
|
|
9
|
-
|
|
10
|
-
`;const i=e.cause;o+=y(i,t,r);const n=g(i).shift(),s=E(i,t,r);return s&&(o+=s+`
|
|
11
|
-
`),o+=p(n,t,r),t.hideErrorCauseCodeView||(o+=`
|
|
12
|
-
`+v(n,t,r)),i.cause?o+=`
|
|
13
|
-
`+S(i,t,r+1):i instanceof AggregateError&&(o+=`
|
|
14
|
-
`+w(i,t,r)),`
|
|
15
|
-
`+o},"getCause"),D=a((e,t)=>{const r=e.slice(0,t.framesMaxLimit);return(r.length>0?`
|
|
16
|
-
`:"")+r.map(o=>p(o,t)).join(`
|
|
17
|
-
`)},"getStacktrace"),O=a((e,t,r)=>{const o={cwd:A(),displayShortPath:!1,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,showGutter:!0,showLineNumbers:!0,tabWidth:4,...t,color:{fileLine:a(s=>s,"fileLine"),gutter:a(s=>s,"gutter"),hint:a(s=>s,"hint"),marker:a(s=>s,"marker"),message:a(s=>s,"message"),method:a(s=>s,"method"),title:a(s=>s,"title"),...t.color}},i=g(e),n=i.shift();return[t.hideMessage?void 0:y(e,o,r),"",E(e,o,r),"",n?p(n,o,r):void 0,n&&!o.hideErrorCodeView?v(n,o,r):void 0,e instanceof AggregateError?w(e,o,r):void 0,e.cause===void 0?void 0:S(e,o,r),i.length>0?D(i,o):void 0].filter(Boolean).join(`
|
|
18
|
-
`)},"internalRenderError"),te=a((e,t={})=>O(e,t,0),"renderError");function W(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}c(W,"isPlainObject");const z=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 G=Object.defineProperty,m=c((e,t)=>G(e,"name",{value:t,configurable:!0}),"c");const h=new WeakSet,R=m(e=>{h.add(e);const t=e.toJSON();return h.delete(e),t},"toJSON"),N=m((e,t,r,o)=>{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]":(r+=1,f(e,o,t,r));if(o.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(W(e)){if(r+=1,o.maxDepth&&r>=o.maxDepth)return{};const i={};for(const n in e)i[n]=N(e[n],t,r,o);return i}try{return e}catch{return"[Not Available]"}},"serializeValue"),f=m((e,t,r,o)=>{if(r.push(e),t.maxDepth===0)return{};if(t.useToJSON&&typeof e.toJSON=="function"&&!h.has(e))return R(e);const i=Object.create(z);if(i.name=Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,i.message=e.message,i.stack=e.stack,Array.isArray(e.errors)){const n=[];for(const s of e.errors){if(!(s instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(r.includes(s))return i.errors=[],i;n.push(f(s,t,r,o))}i.errors=n}e.cause instanceof Error&&!r.includes(e.cause)&&(i.cause=f(e.cause,t,r,o));for(const n in e)if(i[n]===void 0){const s=e[n];i[n]=N(s,r,o,t)}if(Array.isArray(t.exclude)&&t.exclude.length>0)for(const n of t.exclude)try{delete i[n]}catch{}return i},"_serialize"),re=m((e,t={})=>f(e,{exclude:t.exclude??[],maxDepth:t.maxDepth??Number.POSITIVE_INFINITY,useToJSON:t.useToJSON??!1},[],0),"serialize");var _=Object.defineProperty,j=c((e,t)=>_(e,"name",{value:t,configurable:!0}),"t");const oe=j(e=>e instanceof Error&&e.type==="VisulimaError","isVisulimaError");class ie extends Error{static{c(this,"VisulimaError")}static{j(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:t,hint:r,location:o,message:i,name:n,stack:s,title:l}){super(i,{cause:t}),this.title=l,this.name=n,this.stack=s??this.stack,this.loc=o,this.hint=r,Error.captureStackTrace(this,this.constructor)}setLocation(t){this.loc=t}setName(t){this.name=t}setMessage(t){this.message=t}setHint(t){this.hint=t}}export{ie as V,oe as a,ee as i,te as r,re as s};
|