@visulima/error 4.4.0 → 4.4.2

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 (38) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE.md +4 -4
  3. package/dist/code-frame/index.d.cts +2 -2
  4. package/dist/code-frame/index.d.mts +2 -2
  5. package/dist/code-frame/index.d.ts +2 -2
  6. package/dist/code-frame/index.mjs +4 -4
  7. package/dist/error/index.cjs +1 -1
  8. package/dist/error/index.d.cts +1 -1
  9. package/dist/error/index.d.mts +1 -1
  10. package/dist/error/index.d.ts +1 -1
  11. package/dist/error/index.mjs +1 -1
  12. package/dist/index.cjs +1 -1
  13. package/dist/index.d.cts +1 -1
  14. package/dist/index.d.mts +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.mjs +1 -1
  17. package/dist/shared/captureRawStackTrace-BaS1v79I.cjs +1 -0
  18. package/dist/shared/captureRawStackTrace-CIytqD_R.mjs +1 -0
  19. package/dist/shared/getErrorCauses-BmCcq-Tu.mjs +1 -0
  20. package/dist/shared/getErrorCauses-DarICRbk.cjs +1 -0
  21. package/dist/shared/indexToLineColumn-ClV9rDZJ.mjs +1 -0
  22. package/dist/shared/indexToLineColumn-DukzY75E.cjs +1 -0
  23. package/dist/shared/isVisulimaError-B-Ulvg7W.mjs +1 -0
  24. package/dist/shared/isVisulimaError-DYPrVHSe.cjs +1 -0
  25. package/dist/shared/parseStacktrace-BhPQp5la.cjs +2 -0
  26. package/dist/shared/parseStacktrace-CPq_BDLE.mjs +2 -0
  27. package/dist/shared/renderError-Bs1vQcPe.mjs +18 -0
  28. package/dist/shared/renderError-C7MhmUnl.cjs +18 -0
  29. package/dist/shared/serializeError-Br1DnFP1.mjs +1 -0
  30. package/dist/shared/serializeError-DIcZqLmW.cjs +1 -0
  31. package/dist/stacktrace/index.cjs +1 -2
  32. package/dist/stacktrace/index.mjs +1 -2
  33. package/package.json +20 -5
  34. package/dist/shared/error.B400_kIl.cjs +0 -18
  35. package/dist/shared/error.DR_c4iBF.mjs +0 -18
  36. /package/dist/shared/{error.CrVmNoPV.d.cts → types-CrVmNoPV.d.cts} +0 -0
  37. /package/dist/shared/{error.CrVmNoPV.d.mts → types-CrVmNoPV.d.mjs} +0 -0
  38. /package/dist/shared/{error.CrVmNoPV.d.ts → types-CrVmNoPV.d.mts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ ## @visulima/error [4.4.2](https://github.com/visulima/visulima/compare/@visulima/error@4.4.1...@visulima/error@4.4.2) (2024-09-07)
2
+
3
+ ### Bug Fixes
4
+
5
+ * added types support for node10 ([604583f](https://github.com/visulima/visulima/commit/604583fa3c24b950fafad45d17e7a1333040fd76))
6
+
7
+ ### Styles
8
+
9
+ * cs fixes ([f5c4af7](https://github.com/visulima/visulima/commit/f5c4af7cfa9fc79b6d3fa60c1e48d88bffab5a08))
10
+
11
+ ### Miscellaneous Chores
12
+
13
+ * update dev dependencies ([0738f98](https://github.com/visulima/visulima/commit/0738f9810478bb215ce4b2571dc8874c4c503089))
14
+
15
+
16
+ ### Dependencies
17
+
18
+ * **@visulima/path:** upgraded to 1.0.6
19
+
20
+ ## @visulima/error [4.4.1](https://github.com/visulima/visulima/compare/@visulima/error@4.4.0...@visulima/error@4.4.1) (2024-08-30)
21
+
22
+ ### Miscellaneous Chores
23
+
24
+ * updated dev dependencies ([45c2a76](https://github.com/visulima/visulima/commit/45c2a76bc974ecb2c6b172c3af03373d4cc6a5ce))
25
+
26
+
27
+ ### Dependencies
28
+
29
+ * **@visulima/path:** upgraded to 1.0.5
30
+
1
31
  ## @visulima/error [4.4.0](https://github.com/visulima/visulima/compare/@visulima/error@4.3.2...@visulima/error@4.4.0) (2024-08-08)
2
32
 
3
33
  ### Features
package/LICENSE.md CHANGED
@@ -33,13 +33,13 @@ By: Sindre Sorhus
33
33
  Repository: sindresorhus/is-plain-obj
34
34
 
35
35
  > MIT License
36
- >
36
+ >
37
37
  > Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
38
- >
38
+ >
39
39
  > Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
40
- >
40
+ >
41
41
  > The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
42
- >
42
+ >
43
43
  > THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
44
44
 
45
45
  <!-- DEPENDENCIES -->
@@ -1,5 +1,5 @@
1
- import { a as CodeFrameNodeLocation, b as CodeFrameOptions } from '../shared/error.CrVmNoPV.cjs';
2
- export { C as CodeFrameLocation, c as ColorizeMethod } from '../shared/error.CrVmNoPV.cjs';
1
+ import { a as CodeFrameNodeLocation, b as CodeFrameOptions } from '../shared/types-CrVmNoPV.cjs';
2
+ export { C as CodeFrameLocation, c as ColorizeMethod } from '../shared/types-CrVmNoPV.cjs';
3
3
 
4
4
  declare const CODE_FRAME_POINTER: string;
5
5
  declare const codeFrame: (source: string, loc: CodeFrameNodeLocation, options?: CodeFrameOptions) => string;
@@ -1,5 +1,5 @@
1
- import { a as CodeFrameNodeLocation, b as CodeFrameOptions } from '../shared/error.CrVmNoPV.mjs';
2
- export { C as CodeFrameLocation, c as ColorizeMethod } from '../shared/error.CrVmNoPV.mjs';
1
+ import { a as CodeFrameNodeLocation, b as CodeFrameOptions } from '../shared/types-CrVmNoPV.mjs';
2
+ export { C as CodeFrameLocation, c as ColorizeMethod } from '../shared/types-CrVmNoPV.mjs';
3
3
 
4
4
  declare const CODE_FRAME_POINTER: string;
5
5
  declare const codeFrame: (source: string, loc: CodeFrameNodeLocation, options?: CodeFrameOptions) => string;
@@ -1,5 +1,5 @@
1
- import { a as CodeFrameNodeLocation, b as CodeFrameOptions } from '../shared/error.CrVmNoPV.js';
2
- export { C as CodeFrameLocation, c as ColorizeMethod } from '../shared/error.CrVmNoPV.js';
1
+ import { a as CodeFrameNodeLocation, b as CodeFrameOptions } from '../shared/types-CrVmNoPV.d.mjs';
2
+ export { C as CodeFrameLocation, c as ColorizeMethod } from '../shared/types-CrVmNoPV.d.mjs';
3
3
 
4
4
  declare const CODE_FRAME_POINTER: string;
5
5
  declare const codeFrame: (source: string, loc: CodeFrameNodeLocation, options?: CodeFrameOptions) => string;
@@ -1,6 +1,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=[`
1
+ var P=Object.defineProperty;var v=(t,e)=>P(t,"name",{value:e,configurable:!0});var C=Object.defineProperty,E=v((t,e)=>C(t,"name",{value:e,configurable:!0}),"r$1");const F=E(t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
2
+ `),"normalizeLF"),N=globalThis.process||Object.create(null),j={versions:{}},k=new Proxy(N,{get(t,e){if(e in t)return t[e];if(e in j)return j[e]}});var S=Object.defineProperty,W=v((t,e)=>S(t,"name",{value:e,configurable:!0}),"b");const T=W((t,e,h,n)=>{const f={column:0,line:-1,...t.start},i={...f,...t.end},s=f.line,l=f.column,m=i.line,u=i.column;let g=Math.max(s-(h+1),0),p=Math.min(e.length,m+n);s===-1&&(g=0),m===-1&&(p=e.length);const b=m-s,a={};if(b)for(let r=0;r<=b;r++){const o=r+s;if(!l)a[o]=!0;else if(r===0){const c=e[o-1]?.length;a[o]=[l,(c??0)-l+1]}else if(r===b)a[o]=[0,u];else{const c=e[o-r]?.length;a[o]=[0,c]}}else l===u?a[s]=l?[l,0]:!0:a[s]=[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=F(t).split(`
3
+ `);typeof n?.tabWidth=="number"&&(i=i.map(r=>r.replaceAll(" "," ".repeat(n.tabWidth))));const{end:s,markerLines:l,start:m}=T(e,i,n.linesAbove,n.linesBelow),u=String(s).length,{gutter:g,marker:p,message:b}=n.color;let a=i.slice(m,s).map((r,o)=>{const c=m+1+o,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
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
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};
6
+ `+a),a},"codeFrame");export{B as C,I as c};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../shared/error.B400_kIl.cjs");exports.VisulimaError=r.VisulimaError;exports.captureRawStackTrace=r.c;exports.getErrorCauses=r.i;exports.isVisulimaError=r.isVisulimaError;exports.renderError=r.renderError;exports.serializeError=r.serialize;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../shared/captureRawStackTrace-BaS1v79I.cjs"),i=require("../shared/getErrorCauses-DarICRbk.cjs"),s=require("../shared/renderError-C7MhmUnl.cjs"),o=require("../shared/serializeError-DIcZqLmW.cjs"),r=require("../shared/isVisulimaError-DYPrVHSe.cjs");exports.captureRawStackTrace=e.c;exports.getErrorCauses=i.i;exports.renderError=s.renderError;exports.serializeError=o.serialize;exports.VisulimaError=r.VisulimaError;exports.isVisulimaError=r.isVisulimaError;
@@ -1,4 +1,4 @@
1
- import { b as CodeFrameOptions, c as ColorizeMethod } from '../shared/error.CrVmNoPV.cjs';
1
+ import { b as CodeFrameOptions, c as ColorizeMethod } from '../shared/types-CrVmNoPV.cjs';
2
2
 
3
3
  declare const captureRawStackTrace: () => string | undefined;
4
4
 
@@ -1,4 +1,4 @@
1
- import { b as CodeFrameOptions, c as ColorizeMethod } from '../shared/error.CrVmNoPV.mjs';
1
+ import { b as CodeFrameOptions, c as ColorizeMethod } from '../shared/types-CrVmNoPV.mjs';
2
2
 
3
3
  declare const captureRawStackTrace: () => string | undefined;
4
4
 
@@ -1,4 +1,4 @@
1
- import { b as CodeFrameOptions, c as ColorizeMethod } from '../shared/error.CrVmNoPV.js';
1
+ import { b as CodeFrameOptions, c as ColorizeMethod } from '../shared/types-CrVmNoPV.d.mjs';
2
2
 
3
3
  declare const captureRawStackTrace: () => string | undefined;
4
4
 
@@ -1 +1 @@
1
- import{V as s,c as e,i,a as o,r as E,s as c}from"../shared/error.DR_c4iBF.mjs";export{s as VisulimaError,e as captureRawStackTrace,i as getErrorCauses,o as isVisulimaError,E as renderError,c as serializeError};
1
+ import{c as a}from"../shared/captureRawStackTrace-CIytqD_R.mjs";import{i as s}from"../shared/getErrorCauses-BmCcq-Tu.mjs";import{r as t}from"../shared/renderError-Bs1vQcPe.mjs";import{s as p}from"../shared/serializeError-Br1DnFP1.mjs";import{V as x,i as E}from"../shared/isVisulimaError-B-Ulvg7W.mjs";export{x as VisulimaError,a as captureRawStackTrace,s as getErrorCauses,E as isVisulimaError,t as renderError,p as serializeError};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var y=Object.defineProperty;var l=(r,e)=>y(r,"name",{value:e,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./code-frame/index.cjs"),a=require("./shared/error.B400_kIl.cjs"),E=require("./stacktrace/index.cjs");var d=Object.defineProperty,o=l((r,e)=>d(r,"name",{value:e,configurable:!0}),"l");const u=o((r,e)=>{let t=0,i=e.length-2;for(;t<i;){const n=t+(i-t>>1);if(r<e[n])i=n-1;else if(r>=e[n+1])t=n+1;else{t=n;break}}return t},"binarySearch"),f=o(r=>r.split(/\n|\r(?!\n)/).reduce((e,t)=>(e.push(e.at(-1)+t.length+1),e),[0]),"getLineStartIndexes"),g=o((r,e,t)=>{const i=t?.skipChecks??!1;if(!i&&(!Array.isArray(r)&&typeof r!="string"||(typeof r=="string"||Array.isArray(r))&&r.length===0))return{column:0,line:0};if(!i&&(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 s=f(r),c=u(e,s);return{column:e-s[c]+1,line:c+1}}const n=u(e,r);return{column:e-r[n]+1,line:n+1}},"indexToLineColumn"),p=g;exports.CODE_FRAME_POINTER=m.CODE_FRAME_POINTER;exports.codeFrame=m.codeFrame;exports.VisulimaError=a.VisulimaError;exports.captureRawStackTrace=a.c;exports.getErrorCauses=a.i;exports.isVisulimaError=a.isVisulimaError;exports.renderError=a.renderError;exports.serializeError=a.serialize;exports.parseStacktrace=E.parseStacktrace;exports.indexToLineColumn=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./code-frame/index.cjs"),i=require("./shared/indexToLineColumn-DukzY75E.cjs"),o=require("./shared/captureRawStackTrace-BaS1v79I.cjs"),a=require("./shared/getErrorCauses-DarICRbk.cjs"),s=require("./shared/parseStacktrace-BhPQp5la.cjs"),e=require("./shared/isVisulimaError-DYPrVHSe.cjs"),c=require("./shared/renderError-C7MhmUnl.cjs"),t=require("./shared/serializeError-DIcZqLmW.cjs");exports.CODE_FRAME_POINTER=r.CODE_FRAME_POINTER;exports.codeFrame=r.codeFrame;exports.indexToLineColumn=i.u;exports.captureRawStackTrace=o.c;exports.getErrorCauses=a.i;exports.parseStacktrace=s.X;exports.VisulimaError=e.VisulimaError;exports.isVisulimaError=e.isVisulimaError;exports.renderError=c.renderError;exports.serializeError=t.serialize;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { CODE_FRAME_POINTER, codeFrame } from './code-frame/index.cjs';
2
2
  export { ErrorHint, ErrorLocation, ErrorProperties, ErrorWithCauseSerializerOptions, RenderErrorOptions, SerializedError, VisulimaError, captureRawStackTrace, getErrorCauses, isVisulimaError, renderError, serializeError } from './error/index.cjs';
3
3
  export { Trace, TraceType, parseStacktrace } from './stacktrace/index.cjs';
4
- export { C as CodeFrameLocation, a as CodeFrameNodeLocation, b as CodeFrameOptions, c as ColorizeMethod } from './shared/error.CrVmNoPV.cjs';
4
+ export { C as CodeFrameLocation, a as CodeFrameNodeLocation, b as CodeFrameOptions, c as ColorizeMethod } from './shared/types-CrVmNoPV.cjs';
5
5
 
6
6
  declare const indexToLineColumn: (input: number[] | string, index: number, options?: {
7
7
  skipChecks: boolean;
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { CODE_FRAME_POINTER, codeFrame } from './code-frame/index.mjs';
2
2
  export { ErrorHint, ErrorLocation, ErrorProperties, ErrorWithCauseSerializerOptions, RenderErrorOptions, SerializedError, VisulimaError, captureRawStackTrace, getErrorCauses, isVisulimaError, renderError, serializeError } from './error/index.mjs';
3
3
  export { Trace, TraceType, parseStacktrace } from './stacktrace/index.mjs';
4
- export { C as CodeFrameLocation, a as CodeFrameNodeLocation, b as CodeFrameOptions, c as ColorizeMethod } from './shared/error.CrVmNoPV.mjs';
4
+ export { C as CodeFrameLocation, a as CodeFrameNodeLocation, b as CodeFrameOptions, c as ColorizeMethod } from './shared/types-CrVmNoPV.mjs';
5
5
 
6
6
  declare const indexToLineColumn: (input: number[] | string, index: number, options?: {
7
7
  skipChecks: boolean;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { CODE_FRAME_POINTER, codeFrame } from './code-frame/index.js';
2
2
  export { ErrorHint, ErrorLocation, ErrorProperties, ErrorWithCauseSerializerOptions, RenderErrorOptions, SerializedError, VisulimaError, captureRawStackTrace, getErrorCauses, isVisulimaError, renderError, serializeError } from './error/index.js';
3
3
  export { Trace, TraceType, parseStacktrace } from './stacktrace/index.js';
4
- export { C as CodeFrameLocation, a as CodeFrameNodeLocation, b as CodeFrameOptions, c as ColorizeMethod } from './shared/error.CrVmNoPV.js';
4
+ export { C as CodeFrameLocation, a as CodeFrameNodeLocation, b as CodeFrameOptions, c as ColorizeMethod } from './shared/types-CrVmNoPV.d.mjs';
5
5
 
6
6
  declare const indexToLineColumn: (input: number[] | string, index: number, options?: {
7
7
  skipChecks: boolean;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var u=Object.defineProperty;var l=(r,e)=>u(r,"name",{value:e,configurable:!0});import{CODE_FRAME_POINTER as h,codeFrame as x}from"./code-frame/index.mjs";import{V as b,c as k,i as C,a as S,r as T,s as v}from"./shared/error.DR_c4iBF.mjs";import{parseStacktrace as O}from"./stacktrace/index.mjs";var f=Object.defineProperty,s=l((r,e)=>f(r,"name",{value:e,configurable:!0}),"l");const c=s((r,e)=>{let n=0,a=e.length-2;for(;n<a;){const t=n+(a-n>>1);if(r<e[t])a=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 a=n?.skipChecks??!1;if(!a&&(!Array.isArray(r)&&typeof r!="string"||(typeof r=="string"||Array.isArray(r))&&r.length===0))return{column:0,line:0};if(!a&&(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 o=m(r),i=c(e,o);return{column:e-o[i]+1,line:i+1}}const t=c(e,r);return{column:e-r[t]+1,line:t+1}},"indexToLineColumn"),g=p;export{h as CODE_FRAME_POINTER,b as VisulimaError,k as captureRawStackTrace,x as codeFrame,C as getErrorCauses,g as indexToLineColumn,S as isVisulimaError,O as parseStacktrace,T as renderError,v as serializeError};
1
+ import{C as a,c as e}from"./code-frame/index.mjs";import{u as t}from"./shared/indexToLineColumn-ClV9rDZJ.mjs";import{c as i}from"./shared/captureRawStackTrace-CIytqD_R.mjs";import{i as x}from"./shared/getErrorCauses-BmCcq-Tu.mjs";import{X as f}from"./shared/parseStacktrace-CPq_BDLE.mjs";import{V as u,i as l}from"./shared/isVisulimaError-B-Ulvg7W.mjs";import{r as C}from"./shared/renderError-Bs1vQcPe.mjs";import{s as R}from"./shared/serializeError-Br1DnFP1.mjs";export{a as CODE_FRAME_POINTER,u as VisulimaError,i as captureRawStackTrace,e as codeFrame,x as getErrorCauses,t as indexToLineColumn,l as isVisulimaError,f as parseStacktrace,C as renderError,R as serializeError};
@@ -0,0 +1 @@
1
+ "use strict";var t=Object.defineProperty;var a=(r,e)=>t(r,"name",{value:e,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var c=Object.defineProperty,o=a((r,e)=>c(r,"name",{value:e,configurable:!0}),"e");const n=o(()=>{if(!Error.captureStackTrace)return;const r=new Error;return Error.captureStackTrace(r),r.stack},"captureRawStackTrace");exports.c=n;
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var a=(r,e)=>c(r,"name",{value:e,configurable:!0});var t=Object.defineProperty,n=a((r,e)=>t(r,"name",{value:e,configurable:!0}),"e");const u=n(()=>{if(!Error.captureStackTrace)return;const r=new Error;return Error.captureStackTrace(r),r.stack},"captureRawStackTrace");export{u as c};
@@ -0,0 +1 @@
1
+ var s=Object.defineProperty;var t=(r,a)=>s(r,"name",{value:a,configurable:!0});import{inspect as c}from"node:util";var n=Object.defineProperty,i=t((r,a)=>n(r,"name",{value:a,configurable:!0}),"a");const d=i(r=>{const a=new Set,o=[];let e=r;for(;e;){if(a.has(e)){console.error(`Circular reference detected in error causes: ${c(r)}`);break}if(o.push(e),a.add(e),!e.cause)break;e=e.cause}return o},"getErrorCauses");export{d as i};
@@ -0,0 +1 @@
1
+ "use strict";var s=Object.defineProperty;var o=(r,t)=>s(r,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("node:util");var n=Object.defineProperty,i=o((r,t)=>n(r,"name",{value:t,configurable:!0}),"a");const u=i(r=>{const t=new Set,a=[];let e=r;for(;e;){if(t.has(e)){console.error(`Circular reference detected in error causes: ${c.inspect(r)}`);break}if(a.push(e),t.add(e),!e.cause)break;e=e.cause}return a},"getErrorCauses");exports.i=u;
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var a=(n,t)=>c(n,"name",{value:t,configurable:!0});var f=Object.defineProperty,o=a((n,t)=>f(n,"name",{value:t,configurable:!0}),"l");const u=o((n,t)=>{let e=0,i=t.length-2;for(;e<i;){const r=e+(i-e>>1);if(n<t[r])i=r-1;else if(n>=t[r+1])e=r+1;else{e=r;break}}return e},"binarySearch"),y=o(n=>n.split(/\n|\r(?!\n)/).reduce((t,e)=>(t.push(t.at(-1)+e.length+1),t),[0]),"getLineStartIndexes"),p=o((n,t,e)=>{const i=e?.skipChecks??!1;if(!i&&(!Array.isArray(n)&&typeof n!="string"||(typeof n=="string"||Array.isArray(n))&&n.length===0))return{column:0,line:0};if(!i&&(typeof t!="number"||typeof n=="string"&&t>=n.length||Array.isArray(n)&&t+1>=n.at(-1)))return{column:0,line:0};if(typeof n=="string"){const s=y(n),l=u(t,s);return{column:t-s[l]+1,line:l+1}}const r=u(t,n);return{column:t-n[r]+1,line:r+1}},"indexToLineColumn");export{p as u};
@@ -0,0 +1 @@
1
+ "use strict";var c=Object.defineProperty;var a=(n,t)=>c(n,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var y=Object.defineProperty,o=a((n,t)=>y(n,"name",{value:t,configurable:!0}),"l");const u=o((n,t)=>{let e=0,i=t.length-2;for(;e<i;){const r=e+(i-e>>1);if(n<t[r])i=r-1;else if(n>=t[r+1])e=r+1;else{e=r;break}}return e},"binarySearch"),f=o(n=>n.split(/\n|\r(?!\n)/).reduce((t,e)=>(t.push(t.at(-1)+e.length+1),t),[0]),"getLineStartIndexes"),g=o((n,t,e)=>{const i=e?.skipChecks??!1;if(!i&&(!Array.isArray(n)&&typeof n!="string"||(typeof n=="string"||Array.isArray(n))&&n.length===0))return{column:0,line:0};if(!i&&(typeof t!="number"||typeof n=="string"&&t>=n.length||Array.isArray(n)&&t+1>=n.at(-1)))return{column:0,line:0};if(typeof n=="string"){const l=f(n),s=u(t,l);return{column:t-l[s]+1,line:s+1}}const r=u(t,n);return{column:t-n[r]+1,line:r+1}},"indexToLineColumn");exports.u=g;
@@ -0,0 +1 @@
1
+ var l=Object.defineProperty;var i=(s,t)=>l(s,"name",{value:t,configurable:!0});var u=Object.defineProperty,r=i((s,t)=>u(s,"name",{value:t,configurable:!0}),"t");const E=r(s=>s instanceof Error&&s.type==="VisulimaError","isVisulimaError");class V extends Error{static{i(this,"VisulimaError")}static{r(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:t,hint:e,location:a,message:o,name:c,stack:n,title:h}){super(o,{cause:t}),this.title=h,this.name=c,this.stack=n??this.stack,this.loc=a,this.hint=e,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{V,E as i};
@@ -0,0 +1 @@
1
+ "use strict";var u=Object.defineProperty;var r=(s,t)=>u(s,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var h=Object.defineProperty,i=r((s,t)=>h(s,"name",{value:t,configurable:!0}),"t");const m=i(s=>s instanceof Error&&s.type==="VisulimaError","isVisulimaError");class E extends Error{static{r(this,"VisulimaError")}static{i(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:t,hint:e,location:a,message:o,name:c,stack:l,title:n}){super(o,{cause:t}),this.title=n,this.name=c,this.stack=l??this.stack,this.loc=a,this.hint=e,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=E;exports.isVisulimaError=m;
@@ -0,0 +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 g=Object.defineProperty,c=v((i,e)=>g(i,"name",{value:e,configurable:!0}),"u");const u=c((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,h=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,S=/(.*?):(\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=c((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"),$=c((i,e)=>{const n=S.exec(e);n&&(i.file=n[1],i.line=+n[2],i.column=+n[3])},"parseMapped"),G=c(i=>{const e=w.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=k.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=c(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"),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=b.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,d]=y(e[1]?e[1].replace(/^Anonymous function$/,"<anonymous>"):f,e[2]),l={column:e[4]?+e[4]:void 0,evalOrigin:t,file:d,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,d+":"+e[3]+":"+e[4]),l}},"parseChromium"),j=c((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,d]=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:d,line:s,methodName:m,raw:i,type:o?"eval":d.includes("[native code]")?"native":void 0}}},"parseGecko"),D=c((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=c(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=c((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 d;if(/^\s*in\s.*/.test(a))d=G(a);else if(/^.*?\s*at\s.*/.test(a))d=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"})),d=D(a,l)||j(a,l)}else d=z(a);return d?t.push(d):u(`parse error stack line: "${a}"`,"not parser found"),t},[])},"parse");exports.X=B;
@@ -0,0 +1,2 @@
1
+ var x=Object.defineProperty;var v=(i,e)=>x(i,"name",{value:e,configurable:!0});var N=Object.defineProperty,c=v((i,e)=>N(i,"name",{value:e,configurable:!0}),"u");const u=c((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=c((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"),$=c((i,e)=>{const n=S.exec(e);n&&(i.file=n[1],i.line=+n[2],i.column=+n[3])},"parseMapped"),G=c(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=c(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,d]=y(e[1]?e[1].replace(/^Anonymous function$/,"<anonymous>"):f,e[2]),l={column:e[4]?+e[4]:void 0,evalOrigin:t,file:d,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,d+":"+e[3]+":"+e[4]),l}},"parseChromium"),D=c((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,d]=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:d,line:s,methodName:m,raw:i,type:o?"eval":d.includes("[native code]")?"native":void 0}}},"parseGecko"),j=c((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=c(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"),L=c((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 d;if(/^\s*in\s.*/.test(a))d=G(a);else if(/^.*?\s*at\s.*/.test(a))d=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"})),d=j(a,l)||D(a,l)}else d=z(a);return d?t.push(d):u(`parse error stack line: "${a}"`,"not parser found"),t},[])},"parse");export{L as X};
@@ -0,0 +1,18 @@
1
+ var C=Object.defineProperty;var u=(e,r)=>C(e,"name",{value:r,configurable:!0});import{existsSync as M,readFileSync as y}from"node:fs";import{relative as S}from"node:path";import{cwd as V}from"node:process";import{fileURLToPath as N}from"node:url";import{c as P}from"../code-frame/index.mjs";import{X as g}from"./parseStacktrace-CPq_BDLE.mjs";var A=Object.defineProperty,s=u((e,r)=>A(e,"name",{value:r,configurable:!0}),"o");const f=s((e,r,t)=>t===0?e+"":r===" "?e+" ".repeat(t):e+" ".repeat(r*t),"getPrefix"),T=s((e,r)=>{const t=e.replace("async file:","file:");return S(r,t.startsWith("file:")?N(t):t)},"getRelativePath"),p=s((e,{color:r,hideErrorTitle:t,indentation:i,prefix:n},a)=>f(n,i,a)+(t?r.title(e.message):r.title(e.name+(e.message?": "+e.message:"")))+`
2
+ `,"getMessage"),v=s((e,{color:r,indentation:t,prefix:i},n)=>{if(e.hint===void 0)return;const a=f(i,t,n);let o="";if(Array.isArray(e.hint))for(const l of e.hint)o+=a+l+`
3
+ `;else o+=a+e.hint;return r.hint(o)},"getHint"),h=s((e,{color:r,cwd:t,displayShortPath:i,indentation:n,prefix:a},o=0)=>{const l=i?T(e.file,t):e.file,{fileLine:d,method:m}=r;return f(a,n,o)+"at "+(e.methodName?m(e.methodName)+" ":"")+d(l)+":"+d(e.line+"")},"getMainFrame"),w=s((e,{color:r,indentation:t,linesAbove:i,linesBelow:n,prefix:a,showGutter:o,showLineNumbers:l,tabWidth:d},m)=>{if(e.file===void 0)return;const c=e.file.replace("file://","");if(!M(c))return;const L=y(c,"utf8");return P(L,{start:{column:e.column,line:e.line}},{color:r,linesAbove:i,linesBelow:n,prefix:f(a,t,m),showGutter:o,showLineNumbers:l,tabWidth:d})},"getCode"),E=s((e,r,t)=>{if(e.errors.length===0)return;let i=f(r.prefix,r.indentation,t)+`Errors:
4
+
5
+ `,n=!0;for(const a of e.errors)n?n=!1:i+=`
6
+
7
+ `,i+=b(a,{...r,framesMaxLimit:1,hideErrorCodeView:r.hideErrorErrorsCodeView},t+1);return`
8
+ `+i},"getErrors"),x=s((e,r,t)=>{let i=f(r.prefix,r.indentation,t)+`Caused by:
9
+
10
+ `;const n=e.cause;i+=p(n,r,t);const a=g(n).shift(),o=v(n,r,t);if(o&&(i+=o+`
11
+ `),i+=h(a,r,t),!r.hideErrorCauseCodeView){const l=w(a,r,t);l!==void 0&&(i+=`
12
+ `+l)}if(n.cause)i+=`
13
+ `+x(n,r,t+1);else if(n instanceof AggregateError){const l=E(n,r,t);l!==void 0&&(i+=`
14
+ `+l)}return`
15
+ `+i},"getCause"),k=s((e,r)=>(e.length>0?`
16
+ `:"")+e.map(t=>h(t,r)).join(`
17
+ `),"getStacktrace"),b=s((e,r,t)=>{const i={cwd:V(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...r,color:{fileLine:s(o=>o,"fileLine"),gutter:s(o=>o,"gutter"),hint:s(o=>o,"hint"),marker:s(o=>o,"marker"),message:s(o=>o,"message"),method:s(o=>o,"method"),title:s(o=>o,"title"),...r.color}},n=g(e,{filter:r.filterStacktrace,frameLimit:i.framesMaxLimit}),a=n.shift();return[r.hideMessage?void 0:p(e,i,t),v(e,i,t),a?h(a,i,t):void 0,a&&!i.hideErrorCodeView?w(a,i,t):void 0,e instanceof AggregateError?E(e,i,t):void 0,e.cause===void 0?void 0:x(e,i,t),n.length>0?k(n,i):void 0].filter(Boolean).join(`
18
+ `)},"internalRenderError"),O=s((e,r={})=>{if(r.framesMaxLimit!==void 0&&r.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return b(e,r,0)},"renderError");export{O as r};
@@ -0,0 +1,18 @@
1
+ "use strict";var M=Object.defineProperty;var u=(e,r)=>M(e,"name",{value:r,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node:fs"),S=require("node:path"),y=require("node:process"),P=require("node:url"),V=require("../code-frame/index.cjs"),v=require("./parseStacktrace-BhPQp5la.cjs");var N=Object.defineProperty,a=u((e,r)=>N(e,"name",{value:r,configurable:!0}),"o");const l=a((e,r,t)=>t===0?e+"":r===" "?e+" ".repeat(t):e+" ".repeat(r*t),"getPrefix"),A=a((e,r)=>{const t=e.replace("async file:","file:");return S.relative(r,t.startsWith("file:")?P.fileURLToPath(t):t)},"getRelativePath"),p=a((e,{color:r,hideErrorTitle:t,indentation:i,prefix:n},s)=>l(n,i,s)+(t?r.title(e.message):r.title(e.name+(e.message?": "+e.message:"")))+`
2
+ `,"getMessage"),w=a((e,{color:r,indentation:t,prefix:i},n)=>{if(e.hint===void 0)return;const s=l(i,t,n);let o="";if(Array.isArray(e.hint))for(const d of e.hint)o+=s+d+`
3
+ `;else o+=s+e.hint;return r.hint(o)},"getHint"),h=a((e,{color:r,cwd:t,displayShortPath:i,indentation:n,prefix:s},o=0)=>{const d=i?A(e.file,t):e.file,{fileLine:c,method:f}=r;return l(s,n,o)+"at "+(e.methodName?f(e.methodName)+" ":"")+c(d)+":"+c(e.line+"")},"getMainFrame"),E=a((e,{color:r,indentation:t,linesAbove:i,linesBelow:n,prefix:s,showGutter:o,showLineNumbers:d,tabWidth:c},f)=>{if(e.file===void 0)return;const m=e.file.replace("file://","");if(!g.existsSync(m))return;const C=g.readFileSync(m,"utf8");return V.codeFrame(C,{start:{column:e.column,line:e.line}},{color:r,linesAbove:i,linesBelow:n,prefix:l(s,t,f),showGutter:o,showLineNumbers:d,tabWidth:c})},"getCode"),b=a((e,r,t)=>{if(e.errors.length===0)return;let i=l(r.prefix,r.indentation,t)+`Errors:
4
+
5
+ `,n=!0;for(const s of e.errors)n?n=!1:i+=`
6
+
7
+ `,i+=L(s,{...r,framesMaxLimit:1,hideErrorCodeView:r.hideErrorErrorsCodeView},t+1);return`
8
+ `+i},"getErrors"),x=a((e,r,t)=>{let i=l(r.prefix,r.indentation,t)+`Caused by:
9
+
10
+ `;const n=e.cause;i+=p(n,r,t);const s=v.X(n).shift(),o=w(n,r,t);if(o&&(i+=o+`
11
+ `),i+=h(s,r,t),!r.hideErrorCauseCodeView){const d=E(s,r,t);d!==void 0&&(i+=`
12
+ `+d)}if(n.cause)i+=`
13
+ `+x(n,r,t+1);else if(n instanceof AggregateError){const d=b(n,r,t);d!==void 0&&(i+=`
14
+ `+d)}return`
15
+ `+i},"getCause"),T=a((e,r)=>(e.length>0?`
16
+ `:"")+e.map(t=>h(t,r)).join(`
17
+ `),"getStacktrace"),L=a((e,r,t)=>{const i={cwd:y.cwd(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...r,color:{fileLine: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.X(e,{filter:r.filterStacktrace,frameLimit:i.framesMaxLimit}),s=n.shift();return[r.hideMessage?void 0:p(e,i,t),w(e,i,t),s?h(s,i,t):void 0,s&&!i.hideErrorCodeView?E(s,i,t):void 0,e instanceof AggregateError?b(e,i,t):void 0,e.cause===void 0?void 0:x(e,i,t),n.length>0?T(n,i):void 0].filter(Boolean).join(`
18
+ `)},"internalRenderError"),k=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");exports.renderError=k;
@@ -0,0 +1 @@
1
+ var b=Object.defineProperty;var u=(e,t)=>b(e,"name",{value:t,configurable:!0});function p(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)}u(p,"isPlainObject");const m=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 y=Object.defineProperty,s=u((e,t)=>y(e,"name",{value:t,configurable:!0}),"c");const l=new WeakSet,d=s(e=>{l.add(e);const t=e.toJSON();return l.delete(e),t},"toJSON"),f=s((e,t,n,c)=>{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,a(e,c,t,n));if(c.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(p(e)){if(n+=1,c.maxDepth&&n>=c.maxDepth)return{};const r={};for(const o in e)r[o]=f(e[o],t,n,c);return r}try{return e}catch{return"[Not Available]"}},"serializeValue"),a=s((e,t,n,c)=>{if(n.push(e),t.maxDepth===0)return{};if(t.useToJSON&&typeof e.toJSON=="function"&&!l.has(e))return d(e);const r=Object.create(m);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 i of e.errors){if(!(i instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(n.includes(i))return r.errors=[],r;o.push(a(i,t,n,c))}r.errors=o}e.cause instanceof Error&&!n.includes(e.cause)&&(r.cause=a(e.cause,t,n,c));for(const o in e)if(r[o]===void 0){const i=e[o];r[o]=f(i,n,c,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=s((e,t={})=>a(e,{exclude:t.exclude??[],maxDepth:t.maxDepth??Number.POSITIVE_INFINITY,useToJSON:t.useToJSON??!1},[],0),"serialize");export{S as s};
@@ -0,0 +1 @@
1
+ "use strict";var b=Object.defineProperty;var s=(e,t)=>b(e,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(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)}s(p,"isPlainObject");const m=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 y=Object.defineProperty,u=s((e,t)=>y(e,"name",{value:t,configurable:!0}),"c");const l=new WeakSet,d=u(e=>{l.add(e);const t=e.toJSON();return l.delete(e),t},"toJSON"),f=u((e,t,n,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]":(n+=1,a(e,i,t,n));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(p(e)){if(n+=1,i.maxDepth&&n>=i.maxDepth)return{};const r={};for(const o in e)r[o]=f(e[o],t,n,i);return r}try{return e}catch{return"[Not Available]"}},"serializeValue"),a=u((e,t,n,i)=>{if(n.push(e),t.maxDepth===0)return{};if(t.useToJSON&&typeof e.toJSON=="function"&&!l.has(e))return d(e);const r=Object.create(m);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 c of e.errors){if(!(c instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(n.includes(c))return r.errors=[],r;o.push(a(c,t,n,i))}r.errors=o}e.cause instanceof Error&&!n.includes(e.cause)&&(r.cause=a(e.cause,t,n,i));for(const o in e)if(r[o]===void 0){const c=e[o];r[o]=f(c,n,i,t)}if(Array.isArray(t.exclude)&&t.exclude.length>0)for(const o of t.exclude)try{delete r[o]}catch{}return r},"_serialize"),O=u((e,t={})=>a(e,{exclude:t.exclude??[],maxDepth:t.maxDepth??Number.POSITIVE_INFINITY,useToJSON:t.useToJSON??!1},[],0),"serialize");exports.serialize=O;
@@ -1,2 +1 @@
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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../shared/parseStacktrace-BhPQp5la.cjs");exports.parseStacktrace=e.X;
@@ -1,2 +1 @@
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};
1
+ import{X as e}from"../shared/parseStacktrace-CPq_BDLE.mjs";export{e as parseStacktrace};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/error",
3
- "version": "4.4.0",
3
+ "version": "4.4.2",
4
4
  "description": "Error with more than just a message, stacktrace parsing.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -37,9 +37,12 @@
37
37
  "visulima"
38
38
  ],
39
39
  "homepage": "https://www.visulima.com/docs/package/error",
40
+ "bugs": {
41
+ "url": "https://github.com/visulima/visulima/issues"
42
+ },
40
43
  "repository": {
41
44
  "type": "git",
42
- "url": "https://github.com/visulima/visulima.git",
45
+ "url": "git+https://github.com/visulima/visulima.git",
43
46
  "directory": "packages/error"
44
47
  },
45
48
  "funding": [
@@ -105,6 +108,16 @@
105
108
  "main": "dist/index.cjs",
106
109
  "module": "dist/index.mjs",
107
110
  "types": "dist/index.d.ts",
111
+ "typesVersions": {
112
+ "*": {
113
+ "*": [
114
+ "./dist/code-frame/index.d.ts",
115
+ "./dist/code-frame/index.d.ts",
116
+ "./dist/error/index.d.ts",
117
+ "./dist/stacktrace/index.d.ts"
118
+ ]
119
+ }
120
+ },
108
121
  "files": [
109
122
  "dist",
110
123
  "README.md",
@@ -116,6 +129,7 @@
116
129
  "@anolilab/prettier-config": "^5.0.14",
117
130
  "@anolilab/semantic-release-pnpm": "^1.1.3",
118
131
  "@anolilab/semantic-release-preset": "^9.0.0",
132
+ "@arethetypeswrong/cli": "^0.15.4",
119
133
  "@babel/core": "^7.25.2",
120
134
  "@eslint-types/deprecation": "^2.0.0",
121
135
  "@eslint-types/import": "^2.29.1",
@@ -123,12 +137,12 @@
123
137
  "@eslint-types/typescript-eslint": "^7.5.0",
124
138
  "@eslint-types/unicorn": "^52.0.0",
125
139
  "@rushstack/eslint-plugin-security": "^0.8.2",
126
- "@total-typescript/ts-reset": "^0.5.1",
140
+ "@total-typescript/ts-reset": "^0.6.1",
127
141
  "@types/command-line-args": "^5.2.3",
128
142
  "@types/node": "18.19.15",
129
143
  "@visulima/nextra-theme-docs": "4.0.26",
130
- "@visulima/packem": "^1.0.0-alpha.60",
131
- "@visulima/path": "1.0.4",
144
+ "@visulima/packem": "^1.0.0-alpha.93",
145
+ "@visulima/path": "1.0.6",
132
146
  "@vitest/coverage-v8": "^2.0.5",
133
147
  "@vitest/ui": "^2.0.5",
134
148
  "conventional-changelog-conventionalcommits": "8.0.0",
@@ -177,6 +191,7 @@
177
191
  "build:prod": "cross-env NODE_ENV=production packem build",
178
192
  "clean": "rimraf node_modules dist .eslintcache",
179
193
  "dev": "pnpm run build --watch",
194
+ "lint:attw": "attw --pack",
180
195
  "lint:eslint": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs",
181
196
  "lint:eslint:fix": "eslint . --ext js,cjs,mjs,jsx,ts,tsx,json,yaml,yml,md,mdx --max-warnings=0 --config .eslintrc.cjs --fix",
182
197
  "lint:package-json": "publint --strict",
@@ -1,18 +0,0 @@
1
- "use strict";var T=Object.defineProperty;var u=(e,r)=>T(e,"name",{value:r,configurable:!0});const P=require("node:util"),E=require("node:fs"),C=require("node:path"),L=require("node:process"),A=require("node:url"),M=require("../code-frame/index.cjs"),v=require("../stacktrace/index.cjs");var I=Object.defineProperty,_=u((e,r)=>I(e,"name",{value:r,configurable:!0}),"e");const $=_(()=>{if(!Error.captureStackTrace)return;const e=new Error;return Error.captureStackTrace(e),e.stack},"captureRawStackTrace"),J=$;var F=Object.defineProperty,q=u((e,r)=>F(e,"name",{value:r,configurable:!0}),"a");const B=q(e=>{const r=new Set,t=[];let i=e;for(;i;){if(r.has(i)){console.error(`Circular reference detected in error causes: ${P.inspect(e)}`);break}if(t.push(i),r.add(i),!i.cause)break;i=i.cause}return t},"getErrorCauses"),D=B;var z=Object.defineProperty,s=u((e,r)=>z(e,"name",{value:r,configurable:!0}),"o");const l=s((e,r,t)=>t===0?e+"":r===" "?e+" ".repeat(t):e+" ".repeat(r*t),"getPrefix"),R=s((e,r)=>{const t=e.replace("async file:","file:");return C.relative(r,t.startsWith("file:")?A.fileURLToPath(t):t)},"getRelativePath"),y=s((e,{color:r,hideErrorTitle:t,indentation:i,prefix:o},n)=>l(o,i,n)+(t?r.title(e.message):r.title(e.name+(e.message?": "+e.message:"")))+`
2
- `,"getMessage"),w=s((e,{color:r,indentation:t,prefix:i},o)=>{if(e.hint===void 0)return;const n=l(i,t,o);let a="";if(Array.isArray(e.hint))for(const c of e.hint)a+=n+c+`
3
- `;else a+=n+e.hint;return r.hint(a)},"getHint"),b=s((e,{color:r,cwd:t,displayShortPath:i,indentation:o,prefix:n},a=0)=>{const c=i?R(e.file,t):e.file,{fileLine:f,method:h}=r;return l(n,o,a)+"at "+(e.methodName?h(e.methodName)+" ":"")+f(c)+":"+f(e.line+"")},"getMainFrame"),S=s((e,{color:r,indentation:t,linesAbove:i,linesBelow:o,prefix:n,showGutter:a,showLineNumbers:c,tabWidth:f},h)=>{if(e.file===void 0)return;const g=e.file.replace("file://","");if(!E.existsSync(g))return;const V=E.readFileSync(g,"utf8");return M.codeFrame(V,{start:{column:e.column,line:e.line}},{color:r,linesAbove:i,linesBelow:o,prefix:l(n,t,h),showGutter:a,showLineNumbers:c,tabWidth:f})},"getCode"),x=s((e,r,t)=>{if(e.errors.length===0)return;let i=l(r.prefix,r.indentation,t)+`Errors:
4
-
5
- `,o=!0;for(const n of e.errors)o?o=!1:i+=`
6
-
7
- `,i+=k(n,{...r,framesMaxLimit:1,hideErrorCodeView:r.hideErrorErrorsCodeView},t+1);return`
8
- `+i},"getErrors"),O=s((e,r,t)=>{let i=l(r.prefix,r.indentation,t)+`Caused by:
9
-
10
- `;const o=e.cause;i+=y(o,r,t);const n=v.parseStacktrace(o).shift(),a=w(o,r,t);if(a&&(i+=a+`
11
- `),i+=b(n,r,t),!r.hideErrorCauseCodeView){const c=S(n,r,t);c!==void 0&&(i+=`
12
- `+c)}if(o.cause)i+=`
13
- `+O(o,r,t+1);else if(o instanceof AggregateError){const c=x(o,r,t);c!==void 0&&(i+=`
14
- `+c)}return`
15
- `+i},"getCause"),W=s((e,r)=>(e.length>0?`
16
- `:"")+e.map(t=>b(t,r)).join(`
17
- `),"getStacktrace"),k=s((e,r,t)=>{const i={cwd:L.cwd(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...r,color:{fileLine:s(a=>a,"fileLine"),gutter:s(a=>a,"gutter"),hint:s(a=>a,"hint"),marker:s(a=>a,"marker"),message:s(a=>a,"message"),method:s(a=>a,"method"),title:s(a=>a,"title"),...r.color}},o=v.parseStacktrace(e,{filter:r.filterStacktrace,frameLimit:i.framesMaxLimit}),n=o.shift();return[r.hideMessage?void 0:y(e,i,t),w(e,i,t),n?b(n,i,t):void 0,n&&!i.hideErrorCodeView?S(n,i,t):void 0,e instanceof AggregateError?x(e,i,t):void 0,e.cause===void 0?void 0:O(e,i,t),o.length>0?W(o,i):void 0].filter(Boolean).join(`
18
- `)},"internalRenderError"),G=s((e,r={})=>{if(r.framesMaxLimit!==void 0&&r.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return k(e,r,0)},"renderError");function H(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}u(H,"isPlainObject");const U=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 Y=Object.defineProperty,m=u((e,r)=>Y(e,"name",{value:r,configurable:!0}),"c");const p=new WeakSet,K=m(e=>{p.add(e);const r=e.toJSON();return p.delete(e),r},"toJSON"),N=m((e,r,t,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 r.includes(e)?"[Circular]":(t+=1,d(e,i,r,t));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(H(e)){if(t+=1,i.maxDepth&&t>=i.maxDepth)return{};const o={};for(const n in e)o[n]=N(e[n],r,t,i);return o}try{return e}catch{return"[Not Available]"}},"serializeValue"),d=m((e,r,t,i)=>{if(t.push(e),r.maxDepth===0)return{};if(r.useToJSON&&typeof e.toJSON=="function"&&!p.has(e))return K(e);const o=Object.create(U);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 a of e.errors){if(!(a instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(t.includes(a))return o.errors=[],o;n.push(d(a,r,t,i))}o.errors=n}e.cause instanceof Error&&!t.includes(e.cause)&&(o.cause=d(e.cause,r,t,i));for(const n in e)if(o[n]===void 0){const a=e[n];o[n]=N(a,t,i,r)}if(Array.isArray(r.exclude)&&r.exclude.length>0)for(const n of r.exclude)try{delete o[n]}catch{}return o},"_serialize"),Q=m((e,r={})=>d(e,{exclude:r.exclude??[],maxDepth:r.maxDepth??Number.POSITIVE_INFINITY,useToJSON:r.useToJSON??!1},[],0),"serialize");var X=Object.defineProperty,j=u((e,r)=>X(e,"name",{value:r,configurable:!0}),"t");const Z=j(e=>e instanceof Error&&e.type==="VisulimaError","isVisulimaError");class ee extends Error{static{u(this,"VisulimaError")}static{j(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:r,hint:t,location:i,message:o,name:n,stack:a,title:c}){super(o,{cause:r}),this.title=c,this.name=n,this.stack=a??this.stack,this.loc=i,this.hint=t,Error.captureStackTrace(this,this.constructor)}setLocation(r){this.loc=r}setName(r){this.name=r}setMessage(r){this.message=r}setHint(r){this.hint=r}}exports.VisulimaError=ee;exports.c=J;exports.i=D;exports.isVisulimaError=Z;exports.renderError=G;exports.serialize=Q;
@@ -1,18 +0,0 @@
1
- var T=Object.defineProperty;var l=(e,t)=>T(e,"name",{value:t,configurable:!0});import{inspect as V}from"node:util";import{existsSync as P,readFileSync as C}from"node:fs";import{relative as L}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 $=Object.defineProperty,J=l((e,t)=>$(e,"name",{value:t,configurable:!0}),"e");const F=J(()=>{if(!Error.captureStackTrace)return;const e=new Error;return Error.captureStackTrace(e),e.stack},"captureRawStackTrace"),ie=F;var B=Object.defineProperty,D=l((e,t)=>B(e,"name",{value:t,configurable:!0}),"a");const R=D(e=>{const t=new Set,r=[];let o=e;for(;o;){if(t.has(o)){console.error(`Circular reference detected in error causes: ${V(e)}`);break}if(r.push(o),t.add(o),!o.cause)break;o=o.cause}return r},"getErrorCauses"),ne=R;var W=Object.defineProperty,s=l((e,t)=>W(e,"name",{value:t,configurable:!0}),"o");const u=s((e,t,r)=>r===0?e+"":t===" "?e+" ".repeat(r):e+" ".repeat(t*r),"getPrefix"),z=s((e,t)=>{const r=e.replace("async file:","file:");return L(t,r.startsWith("file:")?M(r):r)},"getRelativePath"),E=s((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=s((e,{color:t,indentation:r,prefix:o},i)=>{if(e.hint===void 0)return;const n=u(o,r,i);let a="";if(Array.isArray(e.hint))for(const c of e.hint)a+=n+c+`
3
- `;else a+=n+e.hint;return t.hint(a)},"getHint"),b=s((e,{color:t,cwd:r,displayShortPath:o,indentation:i,prefix:n},a=0)=>{const c=o?z(e.file,r):e.file,{fileLine:f,method:h}=t;return u(n,i,a)+"at "+(e.methodName?h(e.methodName)+" ":"")+f(c)+":"+f(e.line+"")},"getMainFrame"),w=s((e,{color:t,indentation:r,linesAbove:o,linesBelow:i,prefix:n,showGutter:a,showLineNumbers:c,tabWidth:f},h)=>{if(e.file===void 0)return;const g=e.file.replace("file://","");if(!P(g))return;const k=C(g,"utf8");return I(k,{start:{column:e.column,line:e.line}},{color:t,linesAbove:o,linesBelow:i,prefix:u(n,r,h),showGutter:a,showLineNumbers:c,tabWidth:f})},"getCode"),S=s((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=s((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(),a=y(i,t,r);if(a&&(o+=a+`
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"),G=s((e,t)=>(e.length>0?`
16
- `:"")+e.map(r=>b(r,t)).join(`
17
- `),"getStacktrace"),O=s((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:s(a=>a,"fileLine"),gutter:s(a=>a,"gutter"),hint:s(a=>a,"hint"),marker:s(a=>a,"marker"),message:s(a=>a,"message"),method:s(a=>a,"method"),title:s(a=>a,"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?G(i,o):void 0].filter(Boolean).join(`
18
- `)},"internalRenderError"),ae=s((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 _(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(_,"isPlainObject");const H=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 U=Object.defineProperty,d=l((e,t)=>U(e,"name",{value:t,configurable:!0}),"c");const p=new WeakSet,Y=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(_(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 Y(e);const i=Object.create(H);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 a of e.errors){if(!(a instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(r.includes(a))return i.errors=[],i;n.push(m(a,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 a=e[n];i[n]=N(a,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"),se=d((e,t={})=>m(e,{exclude:t.exclude??[],maxDepth:t.maxDepth??Number.POSITIVE_INFINITY,useToJSON:t.useToJSON??!1},[],0),"serialize");var q=Object.defineProperty,j=l((e,t)=>q(e,"name",{value:t,configurable:!0}),"t");const ce=j(e=>e instanceof Error&&e.type==="VisulimaError","isVisulimaError");class le 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:a,title:c}){super(i,{cause:t}),this.title=c,this.name=n,this.stack=a??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{le as V,ce as a,ie as c,ne as i,ae as r,se as s};