@visulima/error 4.3.2 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/LICENSE.md +4 -4
- package/README.md +12 -0
- package/dist/code-frame/index.d.cts +2 -2
- package/dist/code-frame/index.d.mts +2 -2
- package/dist/code-frame/index.d.ts +2 -2
- package/dist/code-frame/index.mjs +4 -4
- package/dist/error/index.cjs +1 -1
- package/dist/error/index.d.cts +4 -2
- package/dist/error/index.d.mts +4 -2
- package/dist/error/index.d.ts +4 -2
- package/dist/error/index.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/shared/captureRawStackTrace-BaS1v79I.cjs +1 -0
- package/dist/shared/captureRawStackTrace-CIytqD_R.mjs +1 -0
- package/dist/shared/getErrorCauses-BmCcq-Tu.mjs +1 -0
- package/dist/shared/getErrorCauses-DarICRbk.cjs +1 -0
- package/dist/shared/indexToLineColumn-ClV9rDZJ.mjs +1 -0
- package/dist/shared/indexToLineColumn-DukzY75E.cjs +1 -0
- package/dist/shared/isVisulimaError-B-Ulvg7W.mjs +1 -0
- package/dist/shared/isVisulimaError-DYPrVHSe.cjs +1 -0
- package/dist/shared/parseStacktrace-BhPQp5la.cjs +2 -0
- package/dist/shared/parseStacktrace-CPq_BDLE.mjs +2 -0
- package/dist/shared/renderError-Bs1vQcPe.mjs +18 -0
- package/dist/shared/renderError-C7MhmUnl.cjs +18 -0
- package/dist/shared/serializeError-Br1DnFP1.mjs +1 -0
- package/dist/shared/serializeError-DIcZqLmW.cjs +1 -0
- package/dist/stacktrace/index.cjs +1 -2
- package/dist/stacktrace/index.mjs +1 -2
- package/package.json +4 -4
- package/dist/shared/error.CylOaVUk.cjs +0 -18
- package/dist/shared/error.rD6X6s7e.mjs +0 -18
- /package/dist/shared/{error.CrVmNoPV.d.cts → types-CrVmNoPV.d.cts} +0 -0
- /package/dist/shared/{error.CrVmNoPV.d.mts → types-CrVmNoPV.d.mjs} +0 -0
- /package/dist/shared/{error.CrVmNoPV.d.ts → types-CrVmNoPV.d.mts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## @visulima/error [4.4.1](https://github.com/visulima/visulima/compare/@visulima/error@4.4.0...@visulima/error@4.4.1) (2024-08-30)
|
|
2
|
+
|
|
3
|
+
### Miscellaneous Chores
|
|
4
|
+
|
|
5
|
+
* updated dev dependencies ([45c2a76](https://github.com/visulima/visulima/commit/45c2a76bc974ecb2c6b172c3af03373d4cc6a5ce))
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Dependencies
|
|
9
|
+
|
|
10
|
+
* **@visulima/path:** upgraded to 1.0.5
|
|
11
|
+
|
|
12
|
+
## @visulima/error [4.4.0](https://github.com/visulima/visulima/compare/@visulima/error@4.3.2...@visulima/error@4.4.0) (2024-08-08)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **error:** added captureRawStackTrace ([1c988a3](https://github.com/visulima/visulima/commit/1c988a33d6ce9ab1afec6c94efd7fa091205742c))
|
|
17
|
+
|
|
18
|
+
### Tests
|
|
19
|
+
|
|
20
|
+
* **error:** fixed assertions on test ([f315754](https://github.com/visulima/visulima/commit/f3157544173590e8695c1419ba7f29cb480d43cf))
|
|
21
|
+
|
|
1
22
|
## @visulima/error [4.3.2](https://github.com/visulima/visulima/compare/@visulima/error@4.3.1...@visulima/error@4.3.2) (2024-08-04)
|
|
2
23
|
|
|
3
24
|
|
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 -->
|
package/README.md
CHANGED
|
@@ -374,6 +374,18 @@ Default: `false`
|
|
|
374
374
|
|
|
375
375
|
Hide the error message.
|
|
376
376
|
|
|
377
|
+
### captureRawStackTrace
|
|
378
|
+
|
|
379
|
+
Capture a raw stack trace.
|
|
380
|
+
|
|
381
|
+
```ts
|
|
382
|
+
import { captureRawStackTrace } from "@visulima/error";
|
|
383
|
+
|
|
384
|
+
const stack = captureRawStackTrace();
|
|
385
|
+
|
|
386
|
+
console.log(stack);
|
|
387
|
+
```
|
|
388
|
+
|
|
377
389
|
## Supported Node.js Versions
|
|
378
390
|
|
|
379
391
|
Libraries in this ecosystem make the best effort to track [Node.js’ release schedule](https://github.com/nodejs/release#release-schedule).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as CodeFrameNodeLocation, b as CodeFrameOptions } from '../shared/
|
|
2
|
-
export { C as CodeFrameLocation, c as ColorizeMethod } from '../shared/
|
|
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/
|
|
2
|
-
export { C as CodeFrameLocation, c as ColorizeMethod } from '../shared/
|
|
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/
|
|
2
|
-
export { C as CodeFrameLocation, c as ColorizeMethod } from '../shared/
|
|
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
|
|
2
|
-
`),"normalizeLF"),
|
|
3
|
-
`);typeof n?.tabWidth=="number"&&(i=i.map(r=>r.replaceAll(" "," ".repeat(n.tabWidth))));const{end:
|
|
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
|
|
6
|
+
`+a),a},"codeFrame");export{B as C,I as c};
|
package/dist/error/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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;
|
package/dist/error/index.d.cts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { b as CodeFrameOptions, c as ColorizeMethod } from '../shared/
|
|
1
|
+
import { b as CodeFrameOptions, c as ColorizeMethod } from '../shared/types-CrVmNoPV.cjs';
|
|
2
|
+
|
|
3
|
+
declare const captureRawStackTrace: () => string | undefined;
|
|
2
4
|
|
|
3
5
|
declare const getErrorCauses: <E = unknown>(error: E) => E[];
|
|
4
6
|
|
|
@@ -72,4 +74,4 @@ type Options = {
|
|
|
72
74
|
};
|
|
73
75
|
declare const serialize: (error: AggregateError | Error | JsonError, options?: Options) => SerializedError;
|
|
74
76
|
|
|
75
|
-
export { type ErrorHint, type ErrorLocation, type ErrorProperties, type Options as ErrorWithCauseSerializerOptions, type Options$1 as RenderErrorOptions, type SerializedError, VisulimaError, getErrorCauses, isVisulimaError, renderError, serialize as serializeError };
|
|
77
|
+
export { type ErrorHint, type ErrorLocation, type ErrorProperties, type Options as ErrorWithCauseSerializerOptions, type Options$1 as RenderErrorOptions, type SerializedError, VisulimaError, captureRawStackTrace, getErrorCauses, isVisulimaError, renderError, serialize as serializeError };
|
package/dist/error/index.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { b as CodeFrameOptions, c as ColorizeMethod } from '../shared/
|
|
1
|
+
import { b as CodeFrameOptions, c as ColorizeMethod } from '../shared/types-CrVmNoPV.mjs';
|
|
2
|
+
|
|
3
|
+
declare const captureRawStackTrace: () => string | undefined;
|
|
2
4
|
|
|
3
5
|
declare const getErrorCauses: <E = unknown>(error: E) => E[];
|
|
4
6
|
|
|
@@ -72,4 +74,4 @@ type Options = {
|
|
|
72
74
|
};
|
|
73
75
|
declare const serialize: (error: AggregateError | Error | JsonError, options?: Options) => SerializedError;
|
|
74
76
|
|
|
75
|
-
export { type ErrorHint, type ErrorLocation, type ErrorProperties, type Options as ErrorWithCauseSerializerOptions, type Options$1 as RenderErrorOptions, type SerializedError, VisulimaError, getErrorCauses, isVisulimaError, renderError, serialize as serializeError };
|
|
77
|
+
export { type ErrorHint, type ErrorLocation, type ErrorProperties, type Options as ErrorWithCauseSerializerOptions, type Options$1 as RenderErrorOptions, type SerializedError, VisulimaError, captureRawStackTrace, getErrorCauses, isVisulimaError, renderError, serialize as serializeError };
|
package/dist/error/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { b as CodeFrameOptions, c as ColorizeMethod } from '../shared/
|
|
1
|
+
import { b as CodeFrameOptions, c as ColorizeMethod } from '../shared/types-CrVmNoPV.d.mjs';
|
|
2
|
+
|
|
3
|
+
declare const captureRawStackTrace: () => string | undefined;
|
|
2
4
|
|
|
3
5
|
declare const getErrorCauses: <E = unknown>(error: E) => E[];
|
|
4
6
|
|
|
@@ -72,4 +74,4 @@ type Options = {
|
|
|
72
74
|
};
|
|
73
75
|
declare const serialize: (error: AggregateError | Error | JsonError, options?: Options) => SerializedError;
|
|
74
76
|
|
|
75
|
-
export { type ErrorHint, type ErrorLocation, type ErrorProperties, type Options as ErrorWithCauseSerializerOptions, type Options$1 as RenderErrorOptions, type SerializedError, VisulimaError, getErrorCauses, isVisulimaError, renderError, serialize as serializeError };
|
|
77
|
+
export { type ErrorHint, type ErrorLocation, type ErrorProperties, type Options as ErrorWithCauseSerializerOptions, type Options$1 as RenderErrorOptions, type SerializedError, VisulimaError, captureRawStackTrace, getErrorCauses, isVisulimaError, renderError, serialize as serializeError };
|
package/dist/error/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
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";
|
|
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
|
-
export { ErrorHint, ErrorLocation, ErrorProperties, ErrorWithCauseSerializerOptions, RenderErrorOptions, SerializedError, VisulimaError, getErrorCauses, isVisulimaError, renderError, serializeError } from './error/index.cjs';
|
|
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/
|
|
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
|
-
export { ErrorHint, ErrorLocation, ErrorProperties, ErrorWithCauseSerializerOptions, RenderErrorOptions, SerializedError, VisulimaError, getErrorCauses, isVisulimaError, renderError, serializeError } from './error/index.mjs';
|
|
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/
|
|
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
|
-
export { ErrorHint, ErrorLocation, ErrorProperties, ErrorWithCauseSerializerOptions, RenderErrorOptions, SerializedError, VisulimaError, getErrorCauses, isVisulimaError, renderError, serializeError } from './error/index.js';
|
|
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/
|
|
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
|
-
|
|
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";
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "4.4.1",
|
|
4
4
|
"description": "Error with more than just a message, stacktrace parsing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -123,12 +123,12 @@
|
|
|
123
123
|
"@eslint-types/typescript-eslint": "^7.5.0",
|
|
124
124
|
"@eslint-types/unicorn": "^52.0.0",
|
|
125
125
|
"@rushstack/eslint-plugin-security": "^0.8.2",
|
|
126
|
-
"@total-typescript/ts-reset": "^0.
|
|
126
|
+
"@total-typescript/ts-reset": "^0.6.0",
|
|
127
127
|
"@types/command-line-args": "^5.2.3",
|
|
128
128
|
"@types/node": "18.19.15",
|
|
129
129
|
"@visulima/nextra-theme-docs": "4.0.26",
|
|
130
|
-
"@visulima/packem": "^1.0.0-alpha.
|
|
131
|
-
"@visulima/path": "1.0.
|
|
130
|
+
"@visulima/packem": "^1.0.0-alpha.86",
|
|
131
|
+
"@visulima/path": "1.0.5",
|
|
132
132
|
"@vitest/coverage-v8": "^2.0.5",
|
|
133
133
|
"@vitest/ui": "^2.0.5",
|
|
134
134
|
"conventional-changelog-conventionalcommits": "8.0.0",
|
|
@@ -1,18 +0,0 @@
|
|
|
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;
|
|
@@ -1,18 +0,0 @@
|
|
|
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};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|