@visulima/error 4.5.0 → 4.6.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 +25 -0
- package/README.md +148 -4
- package/dist/code-frame/index.cjs +6 -135
- package/dist/code-frame/index.mjs +6 -130
- package/dist/error/index.cjs +1 -18
- package/dist/error/index.d.cts +19 -1
- package/dist/error/index.d.mts +19 -1
- package/dist/error/index.d.ts +19 -1
- package/dist/error/index.mjs +1 -5
- package/dist/index.cjs +1 -36
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -13
- package/dist/packem_shared/NonError-CQn4sdxd.cjs +1 -0
- package/dist/packem_shared/NonError-CS10kwil.mjs +1 -0
- package/dist/packem_shared/addKnownErrorConstructor-B5dNFGsR.cjs +1 -0
- package/dist/packem_shared/addKnownErrorConstructor-BqqnTSZp.mjs +1 -0
- package/dist/packem_shared/aiFinder-Be-xHFVO.mjs +1 -0
- package/dist/packem_shared/aiFinder-CN0pneE2.cjs +1 -0
- package/dist/packem_shared/aiSolutionResponse-C5apAmTu.cjs +10 -0
- package/dist/packem_shared/aiSolutionResponse-RD0AK1jh.mjs +10 -0
- package/dist/packem_shared/captureRawStackTrace-B9d1821F.cjs +1 -0
- package/dist/packem_shared/captureRawStackTrace-CQPNHvBG.mjs +1 -0
- package/dist/packem_shared/deserializeError-2C6o7QF7.cjs +1 -0
- package/dist/packem_shared/deserializeError-tzZhIV70.mjs +1 -0
- package/dist/packem_shared/errorHintFinder-C_g0nvml.mjs +2 -0
- package/dist/packem_shared/errorHintFinder-DRCn1Ysx.cjs +2 -0
- package/dist/packem_shared/formatStackFrameLine-DD2DUdW0.cjs +2 -0
- package/dist/packem_shared/formatStackFrameLine-iU54KA81.mjs +2 -0
- package/dist/packem_shared/getErrorCauses-B7_Z_gEF.cjs +1 -0
- package/dist/packem_shared/getErrorCauses-D025FGyO.mjs +1 -0
- package/dist/packem_shared/index-CLFYRLyq.mjs +1 -0
- package/dist/packem_shared/index-CqSGigts.cjs +1 -0
- package/dist/packem_shared/indexToLineColumn-B1F7aNZh.mjs +1 -0
- package/dist/packem_shared/indexToLineColumn-C_v57REF.cjs +1 -0
- package/dist/packem_shared/isVisulimaError-CrvBm0kw.cjs +1 -0
- package/dist/packem_shared/isVisulimaError-jVZgumOU.mjs +1 -0
- package/dist/packem_shared/parseStacktrace-Dnxnc4PL.mjs +2 -0
- package/dist/packem_shared/parseStacktrace-MW4-SLXl.cjs +2 -0
- package/dist/packem_shared/renderError-D7R71d_7.mjs +18 -0
- package/dist/packem_shared/renderError-D8XJnkIF.cjs +18 -0
- package/dist/packem_shared/ruleBasedFinder-DTyLJeCs.cjs +35 -0
- package/dist/packem_shared/ruleBasedFinder-W5UXhtHl.mjs +35 -0
- package/dist/packem_shared/serializeError-7S1IG6zs.cjs +1 -0
- package/dist/packem_shared/serializeError-Bc-QciX0.mjs +1 -0
- package/dist/solution/ai/ai-prompt.cjs +7 -17
- package/dist/solution/ai/ai-prompt.mjs +7 -15
- package/dist/solution/ai/index.cjs +1 -13
- package/dist/solution/ai/index.d.cts +2 -2
- package/dist/solution/ai/index.d.mts +2 -2
- package/dist/solution/ai/index.d.ts +2 -2
- package/dist/solution/ai/index.mjs +1 -3
- package/dist/solution/index.cjs +1 -11
- package/dist/solution/index.mjs +1 -2
- package/dist/stacktrace/index.cjs +1 -12
- package/dist/stacktrace/index.d.cts +2 -2
- package/dist/stacktrace/index.d.mts +2 -2
- package/dist/stacktrace/index.d.ts +2 -2
- package/dist/stacktrace/index.mjs +1 -2
- package/package.json +1 -1
- package/dist/packem_shared/aiFinder-BGfwKKxE.cjs +0 -263
- package/dist/packem_shared/aiFinder-Bk1vt0_x.mjs +0 -261
- package/dist/packem_shared/aiSolutionResponse-BPckbL56.cjs +0 -37
- package/dist/packem_shared/aiSolutionResponse-bDi4ad8f.mjs +0 -35
- package/dist/packem_shared/captureRawStackTrace-ClSI1tHb.cjs +0 -14
- package/dist/packem_shared/captureRawStackTrace-Tl3Rqkat.mjs +0 -12
- package/dist/packem_shared/errorHintFinder-CQy_qIK3.mjs +0 -23
- package/dist/packem_shared/errorHintFinder-DZugFHq0.cjs +0 -25
- package/dist/packem_shared/formatStackFrameLine-DcXSX--m.cjs +0 -31
- package/dist/packem_shared/formatStackFrameLine-DqkmKWH3.mjs +0 -26
- package/dist/packem_shared/getErrorCauses-CG_JRE6j.mjs +0 -24
- package/dist/packem_shared/getErrorCauses-miTeYJEG.cjs +0 -26
- package/dist/packem_shared/indexToLineColumn-DjmjeiIY.cjs +0 -56
- package/dist/packem_shared/indexToLineColumn-Dx91YDU1.mjs +0 -54
- package/dist/packem_shared/isVisulimaError-BVLWvREw.cjs +0 -45
- package/dist/packem_shared/isVisulimaError-H6TqEA42.mjs +0 -40
- package/dist/packem_shared/parseStacktrace-6pFoXW43.cjs +0 -282
- package/dist/packem_shared/parseStacktrace-BKGoWCwC.mjs +0 -280
- package/dist/packem_shared/renderError-BWpM2m6k.mjs +0 -165
- package/dist/packem_shared/renderError-CXZTAXig.cjs +0 -169
- package/dist/packem_shared/ruleBasedFinder-BYrndubA.mjs +0 -227
- package/dist/packem_shared/ruleBasedFinder-y_-5kbeT.cjs +0 -229
- package/dist/packem_shared/serializeError-CT7s0Ffk.cjs +0 -157
- package/dist/packem_shared/serializeError-DusTUACt.mjs +0 -153
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
## @visulima/error [4.6.1](https://github.com/visulima/visulima/compare/@visulima/error@4.6.0...@visulima/error@4.6.1) (2025-09-19)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **error:** improve error hint handling and update license documentation ([bc019ed](https://github.com/visulima/visulima/commit/bc019ed786452b5ced8ce37f91e730916d0c3406))
|
|
6
|
+
|
|
7
|
+
### Miscellaneous Chores
|
|
8
|
+
|
|
9
|
+
* **deps:** update build scripts and remove cross-env dependency ([7510e82](https://github.com/visulima/visulima/commit/7510e826b9235a0013fe61c82a7eb333bc4cbb78))
|
|
10
|
+
|
|
11
|
+
## @visulima/error [4.6.0](https://github.com/visulima/visulima/compare/@visulima/error@4.5.0...@visulima/error@4.6.0) (2025-09-12)
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **error:** enhance error constructor handling and serialization tests ([036ba31](https://github.com/visulima/visulima/commit/036ba31acb182e9fa8c6e0b78ea10cf9f57c75f3))
|
|
16
|
+
* **error:** enhance error serialization and deserialization functionality ([3b07347](https://github.com/visulima/visulima/commit/3b073474807b40c65f692b037fccc6fe152cdc5b))
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **error:** enhance error serialization tests to preserve serialized values ([5ab8db3](https://github.com/visulima/visulima/commit/5ab8db3968142313b2f5c48b13605b843a1f0a1e))
|
|
21
|
+
|
|
22
|
+
### Miscellaneous Chores
|
|
23
|
+
|
|
24
|
+
* update dependencies and fix linting issues ([0e802fe](https://github.com/visulima/visulima/commit/0e802fe02bb9ed791659cb5f3c77605ae5b42ec8))
|
|
25
|
+
|
|
1
26
|
## @visulima/error [4.5.0](https://github.com/visulima/visulima/compare/@visulima/error@4.4.18...@visulima/error@4.5.0) (2025-09-07)
|
|
2
27
|
|
|
3
28
|
### Features
|
package/README.md
CHANGED
|
@@ -267,11 +267,11 @@ const firstLine = formatStackFrameLine(frames[0]);
|
|
|
267
267
|
#### API
|
|
268
268
|
|
|
269
269
|
- `stringifyStackFrames(frames, options?)`
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
- `frames`: `Trace[]` — parsed frames from `parseStacktrace`
|
|
271
|
+
- `options.header`: `{ name?: string; message?: string }` — optional first-line header
|
|
272
272
|
- `formatStackFrameLine(frame)`
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
- `frame`: `Trace`
|
|
274
|
+
- returns a single formatted line like `" at myMethod (/path/file.ts:10:5)"`
|
|
275
275
|
|
|
276
276
|
## Solutions (finders)
|
|
277
277
|
|
|
@@ -396,6 +396,67 @@ const errorString = JSON.stringify(errorObject);
|
|
|
396
396
|
const newErrorObject = JSON.parse(errorString);
|
|
397
397
|
```
|
|
398
398
|
|
|
399
|
+
## `deserialize` an error object
|
|
400
|
+
|
|
401
|
+
Deserialize a previously serialized error back to an Error instance.
|
|
402
|
+
|
|
403
|
+
- Automatically detects error-like objects
|
|
404
|
+
- Reconstructs proper Error instances with correct constructors
|
|
405
|
+
- Handles custom error classes registered with `addKnownErrorConstructor`
|
|
406
|
+
- Supports AggregateError deserialization
|
|
407
|
+
- Preserves error properties and cause chains
|
|
408
|
+
- Wraps non-error-like objects in NonError
|
|
409
|
+
|
|
410
|
+
```ts
|
|
411
|
+
import { serializeError, deserializeError } from "@visulima/error";
|
|
412
|
+
|
|
413
|
+
const error = new TypeError("example");
|
|
414
|
+
const serialized = serializeError(error);
|
|
415
|
+
|
|
416
|
+
// Deserialize back to Error instance
|
|
417
|
+
const deserialized = deserializeError(serialized);
|
|
418
|
+
|
|
419
|
+
console.log(deserialized instanceof TypeError); // true
|
|
420
|
+
console.log(deserialized.message); // "example"
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
### Registering Custom Error Constructors
|
|
424
|
+
|
|
425
|
+
```ts
|
|
426
|
+
import { addKnownErrorConstructor, deserializeError } from "@visulima/error";
|
|
427
|
+
|
|
428
|
+
class CustomError extends Error {
|
|
429
|
+
constructor(message: string, code: number) {
|
|
430
|
+
super(message);
|
|
431
|
+
this.name = "CustomError";
|
|
432
|
+
this.code = code;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// Register the custom error constructor
|
|
437
|
+
addKnownErrorConstructor(CustomError);
|
|
438
|
+
|
|
439
|
+
// Now it can be deserialized properly
|
|
440
|
+
const serialized = { name: "CustomError", message: "test", code: 42 };
|
|
441
|
+
const deserialized = deserializeError(serialized);
|
|
442
|
+
|
|
443
|
+
console.log(deserialized instanceof CustomError); // true
|
|
444
|
+
console.log(deserialized.code); // 42
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
### NonError for Non-Error Objects
|
|
448
|
+
|
|
449
|
+
When deserializing objects that don't look like errors, they're wrapped in a `NonError`:
|
|
450
|
+
|
|
451
|
+
```ts
|
|
452
|
+
import { deserializeError, NonError } from "@visulima/error";
|
|
453
|
+
|
|
454
|
+
const deserialized = deserializeError({ foo: "bar" });
|
|
455
|
+
|
|
456
|
+
console.log(deserialized instanceof NonError); // true
|
|
457
|
+
console.log(deserialized.message); // '{"foo":"bar"}'
|
|
458
|
+
```
|
|
459
|
+
|
|
399
460
|
## renderError - pretty print an error
|
|
400
461
|
|
|
401
462
|
```ts
|
|
@@ -492,6 +553,89 @@ Default: `false`
|
|
|
492
553
|
|
|
493
554
|
Hide the error message.
|
|
494
555
|
|
|
556
|
+
### `deserializeError`
|
|
557
|
+
|
|
558
|
+
Deserialize a value back to its original form. If the value looks like a serialized error, it will be reconstructed as an Error instance. Otherwise, it will be wrapped in a NonError.
|
|
559
|
+
|
|
560
|
+
```ts
|
|
561
|
+
import { deserializeError } from "@visulima/error";
|
|
562
|
+
|
|
563
|
+
const deserialized = deserializeError({ name: "TypeError", message: "example" });
|
|
564
|
+
|
|
565
|
+
console.log(deserialized instanceof TypeError); // true
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
#### value
|
|
569
|
+
|
|
570
|
+
Type: `unknown`
|
|
571
|
+
|
|
572
|
+
The value to deserialize.
|
|
573
|
+
|
|
574
|
+
#### options
|
|
575
|
+
|
|
576
|
+
Type: `object`
|
|
577
|
+
|
|
578
|
+
##### options.maxDepth
|
|
579
|
+
|
|
580
|
+
Type: `number` \
|
|
581
|
+
Default: `Number.POSITIVE_INFINITY`
|
|
582
|
+
|
|
583
|
+
The maximum depth to deserialize nested objects.
|
|
584
|
+
|
|
585
|
+
### `NonError`
|
|
586
|
+
|
|
587
|
+
A class for wrapping non-error-like objects during deserialization.
|
|
588
|
+
|
|
589
|
+
```ts
|
|
590
|
+
import { NonError } from "@visulima/error";
|
|
591
|
+
|
|
592
|
+
const nonError = new NonError("some message");
|
|
593
|
+
|
|
594
|
+
console.log(nonError instanceof Error); // true
|
|
595
|
+
console.log(nonError.name); // "NonError"
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
### `addKnownErrorConstructor`
|
|
599
|
+
|
|
600
|
+
Add a known error constructor to the registry for proper deserialization.
|
|
601
|
+
|
|
602
|
+
```ts
|
|
603
|
+
import { addKnownErrorConstructor } from "@visulima/error";
|
|
604
|
+
|
|
605
|
+
class CustomError extends Error {
|
|
606
|
+
constructor(message: string) {
|
|
607
|
+
super(message);
|
|
608
|
+
this.name = "CustomError";
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
addKnownErrorConstructor(CustomError);
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
#### constructor
|
|
616
|
+
|
|
617
|
+
Type: `new (...args: unknown[]) => Error`
|
|
618
|
+
|
|
619
|
+
The error constructor to add to the registry.
|
|
620
|
+
|
|
621
|
+
### `isErrorLike`
|
|
622
|
+
|
|
623
|
+
Check if an object looks like a serialized error.
|
|
624
|
+
|
|
625
|
+
```ts
|
|
626
|
+
import { isErrorLike } from "@visulima/error";
|
|
627
|
+
|
|
628
|
+
const obj = { name: "TypeError", message: "example" };
|
|
629
|
+
|
|
630
|
+
console.log(isErrorLike(obj)); // true
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
#### value
|
|
634
|
+
|
|
635
|
+
Type: `unknown`
|
|
636
|
+
|
|
637
|
+
The value to check.
|
|
638
|
+
|
|
495
639
|
### captureRawStackTrace
|
|
496
640
|
|
|
497
641
|
Capture a raw stack trace.
|
|
@@ -1,135 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const normalizeLF = /* @__PURE__ */ __name$2((code) => code.replaceAll(/\r\n|\r(?!\n)|\n/gu, "\n"), "normalizeLF");
|
|
8
|
-
|
|
9
|
-
const _process = globalThis.process || /* @__PURE__ */ Object.create(null);
|
|
10
|
-
const processShims = {
|
|
11
|
-
versions: {}
|
|
12
|
-
};
|
|
13
|
-
const process = new Proxy(_process, {
|
|
14
|
-
get(target, property) {
|
|
15
|
-
if (property in target) {
|
|
16
|
-
return target[property];
|
|
17
|
-
}
|
|
18
|
-
if (property in processShims) {
|
|
19
|
-
return processShims[property];
|
|
20
|
-
}
|
|
21
|
-
return void 0;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
var __defProp$1 = Object.defineProperty;
|
|
26
|
-
var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
|
|
27
|
-
const getMarkerLines = /* @__PURE__ */ __name$1((loc, source, linesAbove, linesBelow) => {
|
|
28
|
-
const startLoc = {
|
|
29
|
-
column: 0,
|
|
30
|
-
// @ts-expect-error Can be overwritten
|
|
31
|
-
line: -1,
|
|
32
|
-
...loc.start
|
|
33
|
-
};
|
|
34
|
-
const endLoc = {
|
|
35
|
-
...startLoc,
|
|
36
|
-
...loc.end
|
|
37
|
-
};
|
|
38
|
-
const startLine = startLoc.line;
|
|
39
|
-
const startColumn = startLoc.column;
|
|
40
|
-
const endLine = endLoc.line;
|
|
41
|
-
const endColumn = endLoc.column;
|
|
42
|
-
let start = Math.max(startLine - (linesAbove + 1), 0);
|
|
43
|
-
let end = Math.min(source.length, endLine + linesBelow);
|
|
44
|
-
if (startLine === -1) {
|
|
45
|
-
start = 0;
|
|
46
|
-
}
|
|
47
|
-
if (endLine === -1) {
|
|
48
|
-
end = source.length;
|
|
49
|
-
}
|
|
50
|
-
const lineDiff = endLine - startLine;
|
|
51
|
-
const markerLines = {};
|
|
52
|
-
if (lineDiff) {
|
|
53
|
-
for (let index = 0; index <= lineDiff; index++) {
|
|
54
|
-
const lineNumber = index + startLine;
|
|
55
|
-
if (!startColumn) {
|
|
56
|
-
markerLines[lineNumber] = true;
|
|
57
|
-
} else if (index === 0) {
|
|
58
|
-
const sourceLength = source[lineNumber - 1]?.length;
|
|
59
|
-
markerLines[lineNumber] = [startColumn, (sourceLength ?? 0) - startColumn + 1];
|
|
60
|
-
} else if (index === lineDiff) {
|
|
61
|
-
markerLines[lineNumber] = [0, endColumn];
|
|
62
|
-
} else {
|
|
63
|
-
const sourceLength = source[lineNumber - index]?.length;
|
|
64
|
-
markerLines[lineNumber] = [0, sourceLength];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
} else if (startColumn === endColumn) {
|
|
68
|
-
markerLines[startLine] = startColumn ? [startColumn, 0] : true;
|
|
69
|
-
} else {
|
|
70
|
-
markerLines[startLine] = [startColumn, (endColumn ?? 0) - (startColumn ?? 0)];
|
|
71
|
-
}
|
|
72
|
-
return { end, markerLines, start };
|
|
73
|
-
}, "getMarkerLines");
|
|
74
|
-
|
|
75
|
-
var __defProp = Object.defineProperty;
|
|
76
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
77
|
-
const CODE_FRAME_POINTER = process.platform === "win32" && !process.env?.WT_SESSION ? ">" : "❯";
|
|
78
|
-
const codeFrame = /* @__PURE__ */ __name((source, loc, options) => {
|
|
79
|
-
const config = {
|
|
80
|
-
// grab 2 lines before, and 3 lines after focused line
|
|
81
|
-
linesAbove: 2,
|
|
82
|
-
linesBelow: 3,
|
|
83
|
-
prefix: "",
|
|
84
|
-
showGutter: true,
|
|
85
|
-
tabWidth: 4,
|
|
86
|
-
...options,
|
|
87
|
-
color: {
|
|
88
|
-
gutter: /* @__PURE__ */ __name((value) => value, "gutter"),
|
|
89
|
-
marker: /* @__PURE__ */ __name((value) => value, "marker"),
|
|
90
|
-
message: /* @__PURE__ */ __name((value) => value, "message"),
|
|
91
|
-
...options?.color
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
const hasColumns = loc.start && typeof loc.start.column === "number";
|
|
95
|
-
let lines = normalizeLF(source).split("\n");
|
|
96
|
-
if (typeof config?.tabWidth === "number") {
|
|
97
|
-
lines = lines.map((ln) => ln.replaceAll(" ", " ".repeat(config.tabWidth)));
|
|
98
|
-
}
|
|
99
|
-
const { end, markerLines, start } = getMarkerLines(loc, lines, config.linesAbove, config.linesBelow);
|
|
100
|
-
const numberMaxWidth = String(end).length;
|
|
101
|
-
const { gutter: colorizeGutter, marker: colorizeMarker, message: colorizeMessage } = config.color;
|
|
102
|
-
let frame = lines.slice(start, end).map((line, index) => {
|
|
103
|
-
const number = start + 1 + index;
|
|
104
|
-
const hasMarker = markerLines[number];
|
|
105
|
-
const paddedNumber = (" " + number).slice(-numberMaxWidth);
|
|
106
|
-
const lastMarkerLine = !markerLines[number + 1];
|
|
107
|
-
const gutter = " " + paddedNumber + (config.showGutter ? " |" : "");
|
|
108
|
-
if (hasMarker) {
|
|
109
|
-
let markerLine = "";
|
|
110
|
-
if (Array.isArray(hasMarker)) {
|
|
111
|
-
const markerSpacing = line.replaceAll(/[^\t]/g, " ").slice(0, Math.max(hasMarker[0] - 1, 0));
|
|
112
|
-
const numberOfMarkers = hasMarker[1] || 1;
|
|
113
|
-
markerLine = [
|
|
114
|
-
"\n ",
|
|
115
|
-
config.prefix + colorizeGutter(gutter.replaceAll(/\d/g, " ")),
|
|
116
|
-
" ",
|
|
117
|
-
markerSpacing,
|
|
118
|
-
colorizeMarker("^").repeat(numberOfMarkers)
|
|
119
|
-
].join("");
|
|
120
|
-
if (lastMarkerLine && config.message) {
|
|
121
|
-
markerLine += ` ${colorizeMessage(config.message)}`;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return [config.prefix + colorizeMarker(CODE_FRAME_POINTER), colorizeGutter(gutter), line.length > 0 ? " " + line : "", markerLine].join("");
|
|
125
|
-
}
|
|
126
|
-
return config.prefix + " " + colorizeGutter(gutter) + (line.length > 0 ? " " + line : "");
|
|
127
|
-
}).join("\n");
|
|
128
|
-
if (config.message && !hasColumns) {
|
|
129
|
-
frame = config.prefix + " ".repeat(numberMaxWidth + 1) + config.message + "\n" + frame;
|
|
130
|
-
}
|
|
131
|
-
return frame;
|
|
132
|
-
}, "codeFrame");
|
|
133
|
-
|
|
134
|
-
exports.CODE_FRAME_POINTER = CODE_FRAME_POINTER;
|
|
135
|
-
exports.codeFrame = codeFrame;
|
|
1
|
+
"use strict";var P=Object.defineProperty;var v=(t,e)=>P(t,"name",{value:e,configurable:!0});Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var _=Object.defineProperty,w=v((t,e)=>_(t,"name",{value:e,configurable:!0}),"r$1");const L=w(t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
2
|
+
`),"normalizeLF"),S=globalThis.process||Object.create(null),O={versions:{}},x=new Proxy(S,{get(t,e){if(e in t)return t[e];if(e in O)return O[e]}});var T=Object.defineProperty,R=v((t,e)=>T(t,"name",{value:e,configurable:!0}),"b");const W=R((t,e,d,n)=>{const f={column:0,line:-1,...t.start},i={...f,...t.end},o=f.line,l=f.column,u=i.line,m=i.column;let g=Math.max(o-(d+1),0),p=Math.min(e.length,u+n);o===-1&&(g=0),u===-1&&(p=e.length);const b=u-o,a={};if(b)for(let r=0;r<=b;r++){const s=r+o;if(!l)a[s]=!0;else if(r===0){const c=e[s-1]?.length;a[s]=[l,(c??0)-l+1]}else if(r===b)a[s]=[0,m];else{const c=e[s-r]?.length;a[s]=[0,c]}}else l===m?a[o]=l?[l,0]:!0:a[o]=[l,(m??0)-(l??0)];return{end:p,markerLines:a,start:g}},"getMarkerLines");var C=Object.defineProperty,$=v((t,e)=>C(t,"name",{value:e,configurable:!0}),"o");const M=x.platform==="win32"&&!x.env?.WT_SESSION?">":"❯",I=$((t,e,d)=>{const n={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...d,color:{gutter:$(r=>r,"gutter"),marker:$(r=>r,"marker"),message:$(r=>r,"message"),...d?.color}},f=e.start&&typeof e.start.column=="number";let i=L(t).split(`
|
|
3
|
+
`);typeof n?.tabWidth=="number"&&(i=i.map(r=>r.replaceAll(" "," ".repeat(n.tabWidth))));const{end:o,markerLines:l,start:u}=W(e,i,n.linesAbove,n.linesBelow),m=String(o).length,{gutter:g,marker:p,message:b}=n.color;let a=i.slice(u,o).map((r,s)=>{const c=u+1+s,h=l[c],j=` ${c}`.slice(-m),k=!l[c+1],A=` ${j}${n.showGutter?" |":""}`;if(h){let y="";if(Array.isArray(h)){const E=r.replaceAll(/[^\t]/g," ").slice(0,Math.max(h[0]-1,0)),F=h[1]||1;y=[`
|
|
4
|
+
`,n.prefix+g(A.replaceAll(/\d/g," "))," ",E,p("^").repeat(F)].join(""),k&&n.message&&(y+=` ${b(n.message)}`)}return[n.prefix+p(M),g(A),r.length>0?` ${r}`:"",y].join("")}return`${n.prefix} ${g(A)}${r.length>0?` ${r}`:""}`}).join(`
|
|
5
|
+
`);return n.message&&!f&&(a=`${n.prefix+" ".repeat(m+1)+n.message}
|
|
6
|
+
${a}`),a},"codeFrame");exports.CODE_FRAME_POINTER=M;exports.codeFrame=I;
|
|
@@ -1,130 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
versions: {}
|
|
8
|
-
};
|
|
9
|
-
const process = new Proxy(_process, {
|
|
10
|
-
get(target, property) {
|
|
11
|
-
if (property in target) {
|
|
12
|
-
return target[property];
|
|
13
|
-
}
|
|
14
|
-
if (property in processShims) {
|
|
15
|
-
return processShims[property];
|
|
16
|
-
}
|
|
17
|
-
return void 0;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
var __defProp$1 = Object.defineProperty;
|
|
22
|
-
var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
|
|
23
|
-
const getMarkerLines = /* @__PURE__ */ __name$1((loc, source, linesAbove, linesBelow) => {
|
|
24
|
-
const startLoc = {
|
|
25
|
-
column: 0,
|
|
26
|
-
// @ts-expect-error Can be overwritten
|
|
27
|
-
line: -1,
|
|
28
|
-
...loc.start
|
|
29
|
-
};
|
|
30
|
-
const endLoc = {
|
|
31
|
-
...startLoc,
|
|
32
|
-
...loc.end
|
|
33
|
-
};
|
|
34
|
-
const startLine = startLoc.line;
|
|
35
|
-
const startColumn = startLoc.column;
|
|
36
|
-
const endLine = endLoc.line;
|
|
37
|
-
const endColumn = endLoc.column;
|
|
38
|
-
let start = Math.max(startLine - (linesAbove + 1), 0);
|
|
39
|
-
let end = Math.min(source.length, endLine + linesBelow);
|
|
40
|
-
if (startLine === -1) {
|
|
41
|
-
start = 0;
|
|
42
|
-
}
|
|
43
|
-
if (endLine === -1) {
|
|
44
|
-
end = source.length;
|
|
45
|
-
}
|
|
46
|
-
const lineDiff = endLine - startLine;
|
|
47
|
-
const markerLines = {};
|
|
48
|
-
if (lineDiff) {
|
|
49
|
-
for (let index = 0; index <= lineDiff; index++) {
|
|
50
|
-
const lineNumber = index + startLine;
|
|
51
|
-
if (!startColumn) {
|
|
52
|
-
markerLines[lineNumber] = true;
|
|
53
|
-
} else if (index === 0) {
|
|
54
|
-
const sourceLength = source[lineNumber - 1]?.length;
|
|
55
|
-
markerLines[lineNumber] = [startColumn, (sourceLength ?? 0) - startColumn + 1];
|
|
56
|
-
} else if (index === lineDiff) {
|
|
57
|
-
markerLines[lineNumber] = [0, endColumn];
|
|
58
|
-
} else {
|
|
59
|
-
const sourceLength = source[lineNumber - index]?.length;
|
|
60
|
-
markerLines[lineNumber] = [0, sourceLength];
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
} else if (startColumn === endColumn) {
|
|
64
|
-
markerLines[startLine] = startColumn ? [startColumn, 0] : true;
|
|
65
|
-
} else {
|
|
66
|
-
markerLines[startLine] = [startColumn, (endColumn ?? 0) - (startColumn ?? 0)];
|
|
67
|
-
}
|
|
68
|
-
return { end, markerLines, start };
|
|
69
|
-
}, "getMarkerLines");
|
|
70
|
-
|
|
71
|
-
var __defProp = Object.defineProperty;
|
|
72
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
73
|
-
const CODE_FRAME_POINTER = process.platform === "win32" && !process.env?.WT_SESSION ? ">" : "❯";
|
|
74
|
-
const codeFrame = /* @__PURE__ */ __name((source, loc, options) => {
|
|
75
|
-
const config = {
|
|
76
|
-
// grab 2 lines before, and 3 lines after focused line
|
|
77
|
-
linesAbove: 2,
|
|
78
|
-
linesBelow: 3,
|
|
79
|
-
prefix: "",
|
|
80
|
-
showGutter: true,
|
|
81
|
-
tabWidth: 4,
|
|
82
|
-
...options,
|
|
83
|
-
color: {
|
|
84
|
-
gutter: /* @__PURE__ */ __name((value) => value, "gutter"),
|
|
85
|
-
marker: /* @__PURE__ */ __name((value) => value, "marker"),
|
|
86
|
-
message: /* @__PURE__ */ __name((value) => value, "message"),
|
|
87
|
-
...options?.color
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
const hasColumns = loc.start && typeof loc.start.column === "number";
|
|
91
|
-
let lines = normalizeLF(source).split("\n");
|
|
92
|
-
if (typeof config?.tabWidth === "number") {
|
|
93
|
-
lines = lines.map((ln) => ln.replaceAll(" ", " ".repeat(config.tabWidth)));
|
|
94
|
-
}
|
|
95
|
-
const { end, markerLines, start } = getMarkerLines(loc, lines, config.linesAbove, config.linesBelow);
|
|
96
|
-
const numberMaxWidth = String(end).length;
|
|
97
|
-
const { gutter: colorizeGutter, marker: colorizeMarker, message: colorizeMessage } = config.color;
|
|
98
|
-
let frame = lines.slice(start, end).map((line, index) => {
|
|
99
|
-
const number = start + 1 + index;
|
|
100
|
-
const hasMarker = markerLines[number];
|
|
101
|
-
const paddedNumber = (" " + number).slice(-numberMaxWidth);
|
|
102
|
-
const lastMarkerLine = !markerLines[number + 1];
|
|
103
|
-
const gutter = " " + paddedNumber + (config.showGutter ? " |" : "");
|
|
104
|
-
if (hasMarker) {
|
|
105
|
-
let markerLine = "";
|
|
106
|
-
if (Array.isArray(hasMarker)) {
|
|
107
|
-
const markerSpacing = line.replaceAll(/[^\t]/g, " ").slice(0, Math.max(hasMarker[0] - 1, 0));
|
|
108
|
-
const numberOfMarkers = hasMarker[1] || 1;
|
|
109
|
-
markerLine = [
|
|
110
|
-
"\n ",
|
|
111
|
-
config.prefix + colorizeGutter(gutter.replaceAll(/\d/g, " ")),
|
|
112
|
-
" ",
|
|
113
|
-
markerSpacing,
|
|
114
|
-
colorizeMarker("^").repeat(numberOfMarkers)
|
|
115
|
-
].join("");
|
|
116
|
-
if (lastMarkerLine && config.message) {
|
|
117
|
-
markerLine += ` ${colorizeMessage(config.message)}`;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return [config.prefix + colorizeMarker(CODE_FRAME_POINTER), colorizeGutter(gutter), line.length > 0 ? " " + line : "", markerLine].join("");
|
|
121
|
-
}
|
|
122
|
-
return config.prefix + " " + colorizeGutter(gutter) + (line.length > 0 ? " " + line : "");
|
|
123
|
-
}).join("\n");
|
|
124
|
-
if (config.message && !hasColumns) {
|
|
125
|
-
frame = config.prefix + " ".repeat(numberMaxWidth + 1) + config.message + "\n" + frame;
|
|
126
|
-
}
|
|
127
|
-
return frame;
|
|
128
|
-
}, "codeFrame");
|
|
129
|
-
|
|
130
|
-
export { CODE_FRAME_POINTER, codeFrame };
|
|
1
|
+
var M=Object.defineProperty;var v=(t,e)=>M(t,"name",{value:e,configurable:!0});var F=Object.defineProperty,P=v((t,e)=>F(t,"name",{value:e,configurable:!0}),"r$1");const E=P(t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
2
|
+
`),"normalizeLF"),S=globalThis.process||Object.create(null),y={versions:{}},k=new Proxy(S,{get(t,e){if(e in t)return t[e];if(e in y)return y[e]}});var W=Object.defineProperty,T=v((t,e)=>W(t,"name",{value:e,configurable:!0}),"b");const _=T((t,e,h,n)=>{const f={column:0,line:-1,...t.start},i={...f,...t.end},o=f.line,l=f.column,u=i.line,m=i.column;let g=Math.max(o-(h+1),0),p=Math.min(e.length,u+n);o===-1&&(g=0),u===-1&&(p=e.length);const b=u-o,a={};if(b)for(let r=0;r<=b;r++){const s=r+o;if(!l)a[s]=!0;else if(r===0){const c=e[s-1]?.length;a[s]=[l,(c??0)-l+1]}else if(r===b)a[s]=[0,m];else{const c=e[s-r]?.length;a[s]=[0,c]}}else l===m?a[o]=l?[l,0]:!0:a[o]=[l,(m??0)-(l??0)];return{end:p,markerLines:a,start:g}},"getMarkerLines");var B=Object.defineProperty,$=v((t,e)=>B(t,"name",{value:e,configurable:!0}),"o");const C=k.platform==="win32"&&!k.env?.WT_SESSION?">":"❯",I=$((t,e,h)=>{const n={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...h,color:{gutter:$(r=>r,"gutter"),marker:$(r=>r,"marker"),message:$(r=>r,"message"),...h?.color}},f=e.start&&typeof e.start.column=="number";let i=E(t).split(`
|
|
3
|
+
`);typeof n?.tabWidth=="number"&&(i=i.map(r=>r.replaceAll(" "," ".repeat(n.tabWidth))));const{end:o,markerLines:l,start:u}=_(e,i,n.linesAbove,n.linesBelow),m=String(o).length,{gutter:g,marker:p,message:b}=n.color;let a=i.slice(u,o).map((r,s)=>{const c=u+1+s,d=l[c],j=` ${c}`.slice(-m),O=!l[c+1],x=` ${j}${n.showGutter?" |":""}`;if(d){let A="";if(Array.isArray(d)){const w=r.replaceAll(/[^\t]/g," ").slice(0,Math.max(d[0]-1,0)),L=d[1]||1;A=[`
|
|
4
|
+
`,n.prefix+g(x.replaceAll(/\d/g," "))," ",w,p("^").repeat(L)].join(""),O&&n.message&&(A+=` ${b(n.message)}`)}return[n.prefix+p(C),g(x),r.length>0?` ${r}`:"",A].join("")}return`${n.prefix} ${g(x)}${r.length>0?` ${r}`:""}`}).join(`
|
|
5
|
+
`);return n.message&&!f&&(a=`${n.prefix+" ".repeat(m+1)+n.message}
|
|
6
|
+
${a}`),a},"codeFrame");export{C as CODE_FRAME_POINTER,I as codeFrame};
|
package/dist/error/index.cjs
CHANGED
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
-
|
|
5
|
-
const captureRawStackTrace = require('../packem_shared/captureRawStackTrace-ClSI1tHb.cjs');
|
|
6
|
-
const getErrorCauses = require('../packem_shared/getErrorCauses-miTeYJEG.cjs');
|
|
7
|
-
const renderError = require('../packem_shared/renderError-CXZTAXig.cjs');
|
|
8
|
-
const serializeError = require('../packem_shared/serializeError-CT7s0Ffk.cjs');
|
|
9
|
-
const isVisulimaError = require('../packem_shared/isVisulimaError-BVLWvREw.cjs');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.captureRawStackTrace = captureRawStackTrace;
|
|
14
|
-
exports.getErrorCauses = getErrorCauses;
|
|
15
|
-
exports.renderError = renderError.renderError;
|
|
16
|
-
exports.serializeError = serializeError.serialize;
|
|
17
|
-
exports.VisulimaError = isVisulimaError.VisulimaError;
|
|
18
|
-
exports.isVisulimaError = isVisulimaError.isVisulimaError;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../packem_shared/captureRawStackTrace-B9d1821F.cjs"),o=require("../packem_shared/getErrorCauses-B7_Z_gEF.cjs"),s=require("../packem_shared/renderError-D8XJnkIF.cjs"),a=require("../packem_shared/deserializeError-2C6o7QF7.cjs"),r=require("../packem_shared/addKnownErrorConstructor-B5dNFGsR.cjs"),u=require("../packem_shared/NonError-CQn4sdxd.cjs"),E=require("../packem_shared/serializeError-7S1IG6zs.cjs"),e=require("../packem_shared/isVisulimaError-CrvBm0kw.cjs");exports.captureRawStackTrace=i;exports.getErrorCauses=o;exports.renderError=s.renderError;exports.deserializeError=a;exports.addKnownErrorConstructor=r.addKnownErrorConstructor;exports.isErrorLike=r.isErrorLike;exports.NonError=u;exports.serializeError=E.serialize;exports.VisulimaError=e.VisulimaError;exports.isVisulimaError=e.isVisulimaError;
|
package/dist/error/index.d.cts
CHANGED
|
@@ -54,6 +54,20 @@ type Options$1 = Omit<CodeFrameOptions, "message | prefix"> & {
|
|
|
54
54
|
};
|
|
55
55
|
declare const renderError: (error: AggregateError | Error | VisulimaError, options?: Partial<Options$1>) => string;
|
|
56
56
|
|
|
57
|
+
interface DeserializeOptions {
|
|
58
|
+
maxDepth?: number;
|
|
59
|
+
}
|
|
60
|
+
type DeserializeOptionsType = DeserializeOptions;
|
|
61
|
+
declare const deserialize: (value: unknown, options?: DeserializeOptionsType) => Error;
|
|
62
|
+
|
|
63
|
+
type ErrorConstructor = new (...arguments_: any[]) => Error;
|
|
64
|
+
declare const addKnownErrorConstructor: (constructor: ErrorConstructor, name?: string) => void;
|
|
65
|
+
declare const isErrorLike: (value: unknown) => value is {
|
|
66
|
+
message?: string;
|
|
67
|
+
name?: string;
|
|
68
|
+
stack?: string;
|
|
69
|
+
};
|
|
70
|
+
|
|
57
71
|
type SerializedError<ErrorType = Error> = Record<PropertyKey, unknown> & {
|
|
58
72
|
aggregateErrors?: SerializedError<ErrorType>[];
|
|
59
73
|
cause?: unknown;
|
|
@@ -64,6 +78,10 @@ type SerializedError<ErrorType = Error> = Record<PropertyKey, unknown> & {
|
|
|
64
78
|
stack?: string;
|
|
65
79
|
};
|
|
66
80
|
|
|
81
|
+
declare class NonError extends Error {
|
|
82
|
+
constructor(message: string);
|
|
83
|
+
}
|
|
84
|
+
|
|
67
85
|
interface JsonError extends Error {
|
|
68
86
|
toJSON: () => SerializedError;
|
|
69
87
|
}
|
|
@@ -74,4 +92,4 @@ type Options = {
|
|
|
74
92
|
};
|
|
75
93
|
declare const serialize: (error: AggregateError | Error | JsonError, options?: Options) => SerializedError;
|
|
76
94
|
|
|
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 };
|
|
95
|
+
export { type ErrorHint, type ErrorLocation, type ErrorProperties, type Options as ErrorWithCauseSerializerOptions, NonError, type Options$1 as RenderErrorOptions, type SerializedError, VisulimaError, addKnownErrorConstructor, captureRawStackTrace, deserialize as deserializeError, getErrorCauses, isErrorLike, isVisulimaError, renderError, serialize as serializeError };
|
package/dist/error/index.d.mts
CHANGED
|
@@ -54,6 +54,20 @@ type Options$1 = Omit<CodeFrameOptions, "message | prefix"> & {
|
|
|
54
54
|
};
|
|
55
55
|
declare const renderError: (error: AggregateError | Error | VisulimaError, options?: Partial<Options$1>) => string;
|
|
56
56
|
|
|
57
|
+
interface DeserializeOptions {
|
|
58
|
+
maxDepth?: number;
|
|
59
|
+
}
|
|
60
|
+
type DeserializeOptionsType = DeserializeOptions;
|
|
61
|
+
declare const deserialize: (value: unknown, options?: DeserializeOptionsType) => Error;
|
|
62
|
+
|
|
63
|
+
type ErrorConstructor = new (...arguments_: any[]) => Error;
|
|
64
|
+
declare const addKnownErrorConstructor: (constructor: ErrorConstructor, name?: string) => void;
|
|
65
|
+
declare const isErrorLike: (value: unknown) => value is {
|
|
66
|
+
message?: string;
|
|
67
|
+
name?: string;
|
|
68
|
+
stack?: string;
|
|
69
|
+
};
|
|
70
|
+
|
|
57
71
|
type SerializedError<ErrorType = Error> = Record<PropertyKey, unknown> & {
|
|
58
72
|
aggregateErrors?: SerializedError<ErrorType>[];
|
|
59
73
|
cause?: unknown;
|
|
@@ -64,6 +78,10 @@ type SerializedError<ErrorType = Error> = Record<PropertyKey, unknown> & {
|
|
|
64
78
|
stack?: string;
|
|
65
79
|
};
|
|
66
80
|
|
|
81
|
+
declare class NonError extends Error {
|
|
82
|
+
constructor(message: string);
|
|
83
|
+
}
|
|
84
|
+
|
|
67
85
|
interface JsonError extends Error {
|
|
68
86
|
toJSON: () => SerializedError;
|
|
69
87
|
}
|
|
@@ -74,4 +92,4 @@ type Options = {
|
|
|
74
92
|
};
|
|
75
93
|
declare const serialize: (error: AggregateError | Error | JsonError, options?: Options) => SerializedError;
|
|
76
94
|
|
|
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 };
|
|
95
|
+
export { type ErrorHint, type ErrorLocation, type ErrorProperties, type Options as ErrorWithCauseSerializerOptions, NonError, type Options$1 as RenderErrorOptions, type SerializedError, VisulimaError, addKnownErrorConstructor, captureRawStackTrace, deserialize as deserializeError, getErrorCauses, isErrorLike, isVisulimaError, renderError, serialize as serializeError };
|
package/dist/error/index.d.ts
CHANGED
|
@@ -54,6 +54,20 @@ type Options$1 = Omit<CodeFrameOptions, "message | prefix"> & {
|
|
|
54
54
|
};
|
|
55
55
|
declare const renderError: (error: AggregateError | Error | VisulimaError, options?: Partial<Options$1>) => string;
|
|
56
56
|
|
|
57
|
+
interface DeserializeOptions {
|
|
58
|
+
maxDepth?: number;
|
|
59
|
+
}
|
|
60
|
+
type DeserializeOptionsType = DeserializeOptions;
|
|
61
|
+
declare const deserialize: (value: unknown, options?: DeserializeOptionsType) => Error;
|
|
62
|
+
|
|
63
|
+
type ErrorConstructor = new (...arguments_: any[]) => Error;
|
|
64
|
+
declare const addKnownErrorConstructor: (constructor: ErrorConstructor, name?: string) => void;
|
|
65
|
+
declare const isErrorLike: (value: unknown) => value is {
|
|
66
|
+
message?: string;
|
|
67
|
+
name?: string;
|
|
68
|
+
stack?: string;
|
|
69
|
+
};
|
|
70
|
+
|
|
57
71
|
type SerializedError<ErrorType = Error> = Record<PropertyKey, unknown> & {
|
|
58
72
|
aggregateErrors?: SerializedError<ErrorType>[];
|
|
59
73
|
cause?: unknown;
|
|
@@ -64,6 +78,10 @@ type SerializedError<ErrorType = Error> = Record<PropertyKey, unknown> & {
|
|
|
64
78
|
stack?: string;
|
|
65
79
|
};
|
|
66
80
|
|
|
81
|
+
declare class NonError extends Error {
|
|
82
|
+
constructor(message: string);
|
|
83
|
+
}
|
|
84
|
+
|
|
67
85
|
interface JsonError extends Error {
|
|
68
86
|
toJSON: () => SerializedError;
|
|
69
87
|
}
|
|
@@ -74,4 +92,4 @@ type Options = {
|
|
|
74
92
|
};
|
|
75
93
|
declare const serialize: (error: AggregateError | Error | JsonError, options?: Options) => SerializedError;
|
|
76
94
|
|
|
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 };
|
|
95
|
+
export { type ErrorHint, type ErrorLocation, type ErrorProperties, type Options as ErrorWithCauseSerializerOptions, NonError, type Options$1 as RenderErrorOptions, type SerializedError, VisulimaError, addKnownErrorConstructor, captureRawStackTrace, deserialize as deserializeError, getErrorCauses, isErrorLike, isVisulimaError, renderError, serialize as serializeError };
|
package/dist/error/index.mjs
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { default as getErrorCauses } from '../packem_shared/getErrorCauses-CG_JRE6j.mjs';
|
|
3
|
-
export { renderError } from '../packem_shared/renderError-BWpM2m6k.mjs';
|
|
4
|
-
export { serialize as serializeError } from '../packem_shared/serializeError-DusTUACt.mjs';
|
|
5
|
-
export { VisulimaError, isVisulimaError } from '../packem_shared/isVisulimaError-H6TqEA42.mjs';
|
|
1
|
+
import{default as e}from"../packem_shared/captureRawStackTrace-CQPNHvBG.mjs";import{default as t}from"../packem_shared/getErrorCauses-D025FGyO.mjs";import{renderError as i}from"../packem_shared/renderError-D7R71d_7.mjs";import{default as m}from"../packem_shared/deserializeError-tzZhIV70.mjs";import{addKnownErrorConstructor as p,isErrorLike as u}from"../packem_shared/addKnownErrorConstructor-BqqnTSZp.mjs";import{default as d}from"../packem_shared/NonError-CS10kwil.mjs";import{serialize as n}from"../packem_shared/serializeError-Bc-QciX0.mjs";import{VisulimaError as z,isVisulimaError as k}from"../packem_shared/isVisulimaError-jVZgumOU.mjs";export{d as NonError,z as VisulimaError,p as addKnownErrorConstructor,e as captureRawStackTrace,m as deserializeError,t as getErrorCauses,u as isErrorLike,k as isVisulimaError,i as renderError,n as serializeError};
|