@visulima/error 4.4.7 → 4.4.9
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 +35 -0
- package/README.md +38 -38
- package/dist/error/index.cjs +1 -1
- package/dist/error/index.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/{renderError-0-DsuASp.mjs → renderError-Bul-oz45.mjs} +3 -3
- package/dist/packem_shared/renderError-DAUdGdkA.cjs +18 -0
- package/dist/packem_shared/serializeError-BX2VPOX2.cjs +1 -0
- package/dist/packem_shared/serializeError-Ddx6s06r.mjs +1 -0
- package/package.json +12 -12
- package/dist/packem_shared/renderError-CHpSwov5.cjs +0 -18
- package/dist/packem_shared/serializeError-DIcZqLmW.cjs +0 -1
- package/dist/packem_shared/serializeError-DlDgb1in.mjs +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
## @visulima/error [4.4.9](https://github.com/visulima/visulima/compare/@visulima/error@4.4.8...@visulima/error@4.4.9) (2024-12-31)
|
|
2
|
+
|
|
3
|
+
### Miscellaneous Chores
|
|
4
|
+
|
|
5
|
+
* updated dev dependencies ([9de2eab](https://github.com/visulima/visulima/commit/9de2eab91e95c8b9289d12f863a5167218770650))
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Dependencies
|
|
9
|
+
|
|
10
|
+
* **@visulima/path:** upgraded to 1.2.0
|
|
11
|
+
|
|
12
|
+
## @visulima/error [4.4.8](https://github.com/visulima/visulima/compare/@visulima/error@4.4.7...@visulima/error@4.4.8) (2024-12-12)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* allow node v23 ([8ca929a](https://github.com/visulima/visulima/commit/8ca929af311ce8036cbbfde68b6db05381b860a5))
|
|
17
|
+
* allowed node 23, updated dev dependencies ([f99d34e](https://github.com/visulima/visulima/commit/f99d34e01f6b13be8586a1b5d37dc8b8df0a5817))
|
|
18
|
+
* **error:** fixed path separator to always be / ([2cac82f](https://github.com/visulima/visulima/commit/2cac82f79491de517fcd6186bed9862eaffa8f67))
|
|
19
|
+
* **error:** fixed path separator to always be / ([d9f5d26](https://github.com/visulima/visulima/commit/d9f5d26a46ffcb38ce66f5bf9de35e21c661ef7a))
|
|
20
|
+
* updated packem to v1.8.2 ([23f869b](https://github.com/visulima/visulima/commit/23f869b4120856cc97e2bffa6d508e2ae30420ea))
|
|
21
|
+
* updated packem to v1.9.2 ([47bdc2d](https://github.com/visulima/visulima/commit/47bdc2dfaeca4e7014dbe7772eae2fdf8c8b35bb))
|
|
22
|
+
|
|
23
|
+
### Styles
|
|
24
|
+
|
|
25
|
+
* cs fixes ([46d31e0](https://github.com/visulima/visulima/commit/46d31e082e1865262bf380859c14fabd28ff456d))
|
|
26
|
+
|
|
27
|
+
### Miscellaneous Chores
|
|
28
|
+
|
|
29
|
+
* updated dev dependencies ([a916944](https://github.com/visulima/visulima/commit/a916944b888bb34c34b0c54328b38d29e4399857))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Dependencies
|
|
33
|
+
|
|
34
|
+
* **@visulima/path:** upgraded to 1.1.2
|
|
35
|
+
|
|
1
36
|
## @visulima/error [4.4.7](https://github.com/visulima/visulima/compare/@visulima/error@4.4.6...@visulima/error@4.4.7) (2024-10-05)
|
|
2
37
|
|
|
3
38
|
|
package/README.md
CHANGED
|
@@ -198,12 +198,12 @@ Default: `4`
|
|
|
198
198
|
|
|
199
199
|
Currently supported browsers/platforms:
|
|
200
200
|
|
|
201
|
-
-
|
|
202
|
-
-
|
|
203
|
-
-
|
|
204
|
-
-
|
|
205
|
-
-
|
|
206
|
-
-
|
|
201
|
+
- Firefox
|
|
202
|
+
- Chrome
|
|
203
|
+
- Webkit / Safari
|
|
204
|
+
- Edge
|
|
205
|
+
- Node / Node V8
|
|
206
|
+
- Opera (Chromium based)
|
|
207
207
|
|
|
208
208
|
```ts
|
|
209
209
|
import { parseStacktrace } from "@visulima/error";
|
|
@@ -254,18 +254,18 @@ The maximum number of frames to parse.
|
|
|
254
254
|
|
|
255
255
|
## `serialize` an error object
|
|
256
256
|
|
|
257
|
-
-
|
|
258
|
-
-
|
|
259
|
-
-
|
|
260
|
-
-
|
|
261
|
-
-
|
|
262
|
-
-
|
|
263
|
-
-
|
|
264
|
-
-
|
|
265
|
-
-
|
|
266
|
-
-
|
|
267
|
-
-
|
|
268
|
-
-
|
|
257
|
+
- Ensures errors are safe to serialize with JSON
|
|
258
|
+
- Can be used as error.toJSON()
|
|
259
|
+
- Deep serialization, including transforming
|
|
260
|
+
- Custom serialization (e.g. YAML or process.send())
|
|
261
|
+
- Keeps both native (TypeError, etc.) and custom error classes
|
|
262
|
+
- Preserves errors' additional properties
|
|
263
|
+
- Can keep constructor's arguments
|
|
264
|
+
- Works recursively with error.cause and AggregateError
|
|
265
|
+
- Buffer properties are replaced with [object Buffer]
|
|
266
|
+
- Circular references are handled.
|
|
267
|
+
- If the input object has a .toJSON() method, then it's called instead of serializing the object's properties.
|
|
268
|
+
- It's up to .toJSON() implementation to handle circular references and enumerability of the properties.
|
|
269
269
|
|
|
270
270
|
```ts
|
|
271
271
|
import { serializeError } from "@visulima/error";
|
|
@@ -399,31 +399,31 @@ If you would like to help take a look at the [list of issues](https://github.com
|
|
|
399
399
|
|
|
400
400
|
## Credits
|
|
401
401
|
|
|
402
|
-
-
|
|
403
|
-
-
|
|
402
|
+
- [Daniel Bannert](https://github.com/prisis)
|
|
403
|
+
- [All Contributors](https://github.com/visulima/visulima/graphs/contributors)
|
|
404
404
|
|
|
405
405
|
## About
|
|
406
406
|
|
|
407
407
|
### Related Projects
|
|
408
408
|
|
|
409
|
-
-
|
|
410
|
-
-
|
|
411
|
-
-
|
|
412
|
-
-
|
|
413
|
-
-
|
|
414
|
-
-
|
|
415
|
-
-
|
|
416
|
-
-
|
|
417
|
-
-
|
|
418
|
-
-
|
|
419
|
-
-
|
|
420
|
-
-
|
|
421
|
-
-
|
|
422
|
-
-
|
|
423
|
-
-
|
|
424
|
-
-
|
|
425
|
-
-
|
|
426
|
-
-
|
|
409
|
+
- [baseerr](https://github.com/tjmehta/baseerr): merge another error with additional properties.
|
|
410
|
+
- [callsites](https://github.com/sindresorhus/callsites): get callsites from the V8 stack trace API.
|
|
411
|
+
- [explain-error](https://github.com/dominictarr/explain-error): wrap an error with additional explanation.
|
|
412
|
+
- [error-wrapper](https://github.com/spudly/error-wrapper): merges the stack of another error to its own.
|
|
413
|
+
- [errwischt/stacktrace-parser](https://github.com/errwischt/stacktrace-parser)
|
|
414
|
+
- [trace](https://github.com/AndreasMadsen/trace): create super long stack traces.
|
|
415
|
+
- [clarify](https://github.com/AndreasMadsen/clarify): remove node related stack trace noise.
|
|
416
|
+
- [piotr-szewczyk/stacktrace-parser-node](https://github.com/piotr-szewczyk/stacktrace-parser-node)
|
|
417
|
+
- [pretty-error](https://github.com/AriaMinaei/pretty-error): make the call stacks clear.
|
|
418
|
+
- [node-pretty-exceptions](https://github.com/ahmadnassri/node-pretty-exceptions) - Pretty and more helpful uncaught exceptions, automatically
|
|
419
|
+
- [youch-terminal](https://github.com/poppinss/youch-terminal/tree/develop) - Display youch error message on terminal
|
|
420
|
+
- [ono](https://github.com/bigstickcarpet/ono): allow different types of error to be thrown.
|
|
421
|
+
- [stacktracejs/error-stack-parser](https://github.com/stacktracejs/error-stack-parser)
|
|
422
|
+
- [marvinhagemeister/errorstacks](https://github.com/marvinhagemeister/errorstacks) Tiny library to parse error stack traces
|
|
423
|
+
- [getsentry/sentry-javascript](https://github.com/getsentry/sentry-javascript)
|
|
424
|
+
- [serialize-error](https://github.com/sindresorhus/serialize-error) - Serialize/deserialize an error into a plain object
|
|
425
|
+
- [baseerr](https://github.com/tjmehta/baseerr): merge another error with additional properties.
|
|
426
|
+
- [callsite-record](https://github.com/inikulin/callsite-record) - Create fancy log entries for errors and function call sites
|
|
427
427
|
|
|
428
428
|
## License
|
|
429
429
|
|
package/dist/error/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../packem_shared/captureRawStackTrace-Dle60tQN.cjs"),i=require("../packem_shared/getErrorCauses--fuy5DYb.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../packem_shared/captureRawStackTrace-Dle60tQN.cjs"),i=require("../packem_shared/getErrorCauses--fuy5DYb.cjs"),a=require("../packem_shared/renderError-DAUdGdkA.cjs"),s=require("../packem_shared/serializeError-BX2VPOX2.cjs"),r=require("../packem_shared/isVisulimaError-DYPrVHSe.cjs");exports.captureRawStackTrace=e;exports.getErrorCauses=i;exports.renderError=a.renderError;exports.serializeError=s.serialize;exports.VisulimaError=r.VisulimaError;exports.isVisulimaError=r.isVisulimaError;
|
package/dist/error/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as o}from"../packem_shared/captureRawStackTrace-B7M10xhx.mjs";import{default as s}from"../packem_shared/getErrorCauses-D025FGyO.mjs";import{renderError as i}from"../packem_shared/renderError-
|
|
1
|
+
import{default as o}from"../packem_shared/captureRawStackTrace-B7M10xhx.mjs";import{default as s}from"../packem_shared/getErrorCauses-D025FGyO.mjs";import{renderError as i}from"../packem_shared/renderError-Bul-oz45.mjs";import{serialize as m}from"../packem_shared/serializeError-Ddx6s06r.mjs";import{VisulimaError as p,isVisulimaError as u}from"../packem_shared/isVisulimaError-7lgjv56R.mjs";export{p as VisulimaError,o as captureRawStackTrace,s as getErrorCauses,u as isVisulimaError,i as renderError,m as serializeError};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./code-frame/index.cjs"),i=require("./packem_shared/indexToLineColumn-BUaHBIUg.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./code-frame/index.cjs"),i=require("./packem_shared/indexToLineColumn-BUaHBIUg.cjs"),a=require("./packem_shared/captureRawStackTrace-Dle60tQN.cjs"),o=require("./packem_shared/getErrorCauses--fuy5DYb.cjs"),u=require("./packem_shared/parseStacktrace-DuzLAkHs.cjs"),e=require("./packem_shared/isVisulimaError-DYPrVHSe.cjs"),s=require("./packem_shared/renderError-DAUdGdkA.cjs"),E=require("./packem_shared/serializeError-BX2VPOX2.cjs");exports.CODE_FRAME_POINTER=r.CODE_FRAME_POINTER;exports.codeFrame=r.codeFrame;exports.indexToLineColumn=i;exports.captureRawStackTrace=a;exports.getErrorCauses=o;exports.parseStacktrace=u;exports.VisulimaError=e.VisulimaError;exports.isVisulimaError=e.isVisulimaError;exports.renderError=s.renderError;exports.serializeError=E.serialize;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CODE_FRAME_POINTER as o,codeFrame as a}from"./code-frame/index.mjs";import{default as s}from"./packem_shared/indexToLineColumn-BxCJ9Cey.mjs";import{default as m}from"./packem_shared/captureRawStackTrace-B7M10xhx.mjs";import{default as p}from"./packem_shared/getErrorCauses-D025FGyO.mjs";import{default as u}from"./packem_shared/parseStacktrace-CUC_6mhC.mjs";import{VisulimaError as E,isVisulimaError as d}from"./packem_shared/isVisulimaError-7lgjv56R.mjs";import{renderError as n}from"./packem_shared/renderError-
|
|
1
|
+
import{CODE_FRAME_POINTER as o,codeFrame as a}from"./code-frame/index.mjs";import{default as s}from"./packem_shared/indexToLineColumn-BxCJ9Cey.mjs";import{default as m}from"./packem_shared/captureRawStackTrace-B7M10xhx.mjs";import{default as p}from"./packem_shared/getErrorCauses-D025FGyO.mjs";import{default as u}from"./packem_shared/parseStacktrace-CUC_6mhC.mjs";import{VisulimaError as E,isVisulimaError as d}from"./packem_shared/isVisulimaError-7lgjv56R.mjs";import{renderError as n}from"./packem_shared/renderError-Bul-oz45.mjs";import{serialize as R}from"./packem_shared/serializeError-Ddx6s06r.mjs";export{o as CODE_FRAME_POINTER,E as VisulimaError,m as captureRawStackTrace,a as codeFrame,p as getErrorCauses,s as indexToLineColumn,d as isVisulimaError,u as parseStacktrace,n as renderError,R as serializeError};
|
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
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 A}from"node:url";import{codeFrame as N}from"../code-frame/index.mjs";import g from"./parseStacktrace-CUC_6mhC.mjs";var P=Object.defineProperty,s=u((e,r)=>P(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:")?A(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
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
|
|
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 N(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
4
|
|
|
5
5
|
`,n=!0;for(const a of e.errors)n?n=!1:i+=`
|
|
6
6
|
|
|
@@ -15,4 +15,4 @@ var C=Object.defineProperty;var u=(e,r)=>C(e,"name",{value:r,configurable:!0});i
|
|
|
15
15
|
`+i},"getCause"),k=s((e,r)=>(e.length>0?`
|
|
16
16
|
`:"")+e.map(t=>h(t,r)).join(`
|
|
17
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 renderError};
|
|
18
|
+
`).replaceAll("\\","/")},"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 renderError};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";var M=Object.defineProperty;var m=(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"),p=require("./parseStacktrace-DuzLAkHs.cjs");var A=Object.defineProperty,s=m((e,r)=>A(e,"name",{value:r,configurable:!0}),"o");const d=s((e,r,t)=>t===0?e+"":r===" "?e+" ".repeat(t):e+" ".repeat(r*t),"getPrefix"),N=s((e,r)=>{const t=e.replace("async file:","file:");return S.relative(r,t.startsWith("file:")?P.fileURLToPath(t):t)},"getRelativePath"),v=s((e,{color:r,hideErrorTitle:t,indentation:i,prefix:n},a)=>d(n,i,a)+(t?r.title(e.message):r.title(e.name+(e.message?": "+e.message:"")))+`
|
|
2
|
+
`,"getMessage"),w=s((e,{color:r,indentation:t,prefix:i},n)=>{if(e.hint===void 0)return;const a=d(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?N(e.file,t):e.file,{fileLine:f,method:c}=r;return d(a,n,o)+"at "+(e.methodName?c(e.methodName)+" ":"")+f(l)+":"+f(e.line+"")},"getMainFrame"),E=s((e,{color:r,indentation:t,linesAbove:i,linesBelow:n,prefix:a,showGutter:o,showLineNumbers:l,tabWidth:f},c)=>{if(e.file===void 0)return;const u=e.file.replace("file://","");if(!g.existsSync(u))return;const C=g.readFileSync(u,"utf8");return V.codeFrame(C,{start:{column:e.column,line:e.line}},{color:r,linesAbove:i,linesBelow:n,prefix:d(a,t,c),showGutter:o,showLineNumbers:l,tabWidth:f})},"getCode"),b=s((e,r,t)=>{if(e.errors.length===0)return;let i=d(r.prefix,r.indentation,t)+`Errors:
|
|
4
|
+
|
|
5
|
+
`,n=!0;for(const a of e.errors)n?n=!1:i+=`
|
|
6
|
+
|
|
7
|
+
`,i+=L(a,{...r,framesMaxLimit:1,hideErrorCodeView:r.hideErrorErrorsCodeView},t+1);return`
|
|
8
|
+
`+i},"getErrors"),x=s((e,r,t)=>{let i=d(r.prefix,r.indentation,t)+`Caused by:
|
|
9
|
+
|
|
10
|
+
`;const n=e.cause;i+=v(n,r,t);const a=p(n).shift(),o=w(n,r,t);if(o&&(i+=o+`
|
|
11
|
+
`),i+=h(a,r,t),!r.hideErrorCauseCodeView){const l=E(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=b(n,r,t);l!==void 0&&(i+=`
|
|
14
|
+
`+l)}return`
|
|
15
|
+
`+i},"getCause"),T=s((e,r)=>(e.length>0?`
|
|
16
|
+
`:"")+e.map(t=>h(t,r)).join(`
|
|
17
|
+
`),"getStacktrace"),L=s((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: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=p(e,{filter:r.filterStacktrace,frameLimit:i.framesMaxLimit}),a=n.shift();return[r.hideMessage?void 0:v(e,i,t),w(e,i,t),a?h(a,i,t):void 0,a&&!i.hideErrorCodeView?E(a,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
|
+
`).replaceAll("\\","/")},"internalRenderError"),k=s((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
|
+
"use strict";var m=Object.defineProperty;var c=(e,t)=>m(e,"name",{value:t,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var p=Object.defineProperty,y=c((e,t)=>p(e,"name",{value:t,configurable:!0}),"e");function f(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}c(f,"r");y(f,"isPlainObject");const d=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 O=Object.defineProperty,s=c((e,t)=>O(e,"name",{value:t,configurable:!0}),"c");const l=new WeakSet,v=s(e=>{l.add(e);const t=e.toJSON();return l.delete(e),t},"toJSON"),b=s((e,t,n,a)=>{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,u(e,a,t,n));if(a.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(f(e)){if(n+=1,a.maxDepth&&n>=a.maxDepth)return{};const r={};for(const o in e)r[o]=b(e[o],t,n,a);return r}try{return e}catch{return"[Not Available]"}},"serializeValue"),u=s((e,t,n,a)=>{if(n.push(e),t.maxDepth===0)return{};if(t.useToJSON&&typeof e.toJSON=="function"&&!l.has(e))return v(e);const r=Object.create(d);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(u(i,t,n,a))}r.errors=o}e.cause instanceof Error&&!n.includes(e.cause)&&(r.cause=u(e.cause,t,n,a));for(const o in e)if(r[o]===void 0){const i=e[o];r[o]=b(i,n,a,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={})=>u(e,{exclude:t.exclude??[],maxDepth:t.maxDepth??Number.POSITIVE_INFINITY,useToJSON:t.useToJSON??!1},[],0),"serialize");exports.serialize=S;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var m=Object.defineProperty;var i=(e,t)=>m(e,"name",{value:t,configurable:!0});var p=Object.defineProperty,y=i((e,t)=>p(e,"name",{value:t,configurable:!0}),"e");function f(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)}i(f,"r");y(f,"isPlainObject");const d=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 O=Object.defineProperty,s=i((e,t)=>O(e,"name",{value:t,configurable:!0}),"c");const l=new WeakSet,v=s(e=>{l.add(e);const t=e.toJSON();return l.delete(e),t},"toJSON"),b=s((e,t,n,a)=>{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,u(e,a,t,n));if(a.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(f(e)){if(n+=1,a.maxDepth&&n>=a.maxDepth)return{};const r={};for(const o in e)r[o]=b(e[o],t,n,a);return r}try{return e}catch{return"[Not Available]"}},"serializeValue"),u=s((e,t,n,a)=>{if(n.push(e),t.maxDepth===0)return{};if(t.useToJSON&&typeof e.toJSON=="function"&&!l.has(e))return v(e);const r=Object.create(d);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(u(c,t,n,a))}r.errors=o}e.cause instanceof Error&&!n.includes(e.cause)&&(r.cause=u(e.cause,t,n,a));for(const o in e)if(r[o]===void 0){const c=e[o];r[o]=b(c,n,a,t)}if(Array.isArray(t.exclude)&&t.exclude.length>0)for(const o of t.exclude)try{delete r[o]}catch{}return r},"_serialize"),j=s((e,t={})=>u(e,{exclude:t.exclude??[],maxDepth:t.maxDepth??Number.POSITIVE_INFINITY,useToJSON:t.useToJSON??!1},[],0),"serialize");export{j as serialize};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/error",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.9",
|
|
4
4
|
"description": "Error with more than just a message, stacktrace parsing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"anolilab",
|
|
@@ -133,10 +133,10 @@
|
|
|
133
133
|
"devDependencies": {
|
|
134
134
|
"@anolilab/eslint-config": "^15.0.3",
|
|
135
135
|
"@anolilab/prettier-config": "^5.0.14",
|
|
136
|
-
"@anolilab/semantic-release-pnpm": "^1.1.
|
|
137
|
-
"@anolilab/semantic-release-preset": "^9.0.
|
|
138
|
-
"@arethetypeswrong/cli": "^0.
|
|
139
|
-
"@babel/core": "^7.
|
|
136
|
+
"@anolilab/semantic-release-pnpm": "^1.1.6",
|
|
137
|
+
"@anolilab/semantic-release-preset": "^9.0.3",
|
|
138
|
+
"@arethetypeswrong/cli": "^0.17.2",
|
|
139
|
+
"@babel/core": "^7.26.0",
|
|
140
140
|
"@eslint-types/deprecation": "^2.0.0",
|
|
141
141
|
"@eslint-types/import": "^2.29.1",
|
|
142
142
|
"@eslint-types/jsdoc": "^48.2.2",
|
|
@@ -147,10 +147,10 @@
|
|
|
147
147
|
"@types/command-line-args": "^5.2.3",
|
|
148
148
|
"@types/node": "18.19.15",
|
|
149
149
|
"@visulima/nextra-theme-docs": "4.0.26",
|
|
150
|
-
"@visulima/packem": "1.
|
|
151
|
-
"@visulima/path": "1.
|
|
152
|
-
"@vitest/coverage-v8": "^2.1.
|
|
153
|
-
"@vitest/ui": "^2.1.
|
|
150
|
+
"@visulima/packem": "1.9.2",
|
|
151
|
+
"@visulima/path": "1.2.0",
|
|
152
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
153
|
+
"@vitest/ui": "^2.1.8",
|
|
154
154
|
"conventional-changelog-conventionalcommits": "8.0.0",
|
|
155
155
|
"cross-env": "^7.0.3",
|
|
156
156
|
"esbuild": "0.24.0",
|
|
@@ -161,14 +161,14 @@
|
|
|
161
161
|
"eslint-plugin-vitest": "^0.4.1",
|
|
162
162
|
"eslint-plugin-vitest-globals": "^1.5.0",
|
|
163
163
|
"is-plain-obj": "^4.1.0",
|
|
164
|
-
"prettier": "^3.
|
|
164
|
+
"prettier": "^3.4.2",
|
|
165
165
|
"rimraf": "5.0.9",
|
|
166
166
|
"semantic-release": "24.0.0",
|
|
167
167
|
"typescript": "5.4.5",
|
|
168
|
-
"vitest": "^2.1.
|
|
168
|
+
"vitest": "^2.1.8"
|
|
169
169
|
},
|
|
170
170
|
"engines": {
|
|
171
|
-
"node": ">=18.* <=
|
|
171
|
+
"node": ">=18.* <=23.*"
|
|
172
172
|
},
|
|
173
173
|
"os": [
|
|
174
174
|
"darwin",
|
|
@@ -1,18 +0,0 @@
|
|
|
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-DuzLAkHs.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(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(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;
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
var b=Object.defineProperty;var s=(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)}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,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=u((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=u((e,t={})=>a(e,{exclude:t.exclude??[],maxDepth:t.maxDepth??Number.POSITIVE_INFINITY,useToJSON:t.useToJSON??!1},[],0),"serialize");export{S as serialize};
|