@visulima/error 4.6.0 → 4.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/code-frame/index.cjs +6 -136
- package/dist/code-frame/index.mjs +6 -131
- package/dist/error/index.cjs +1 -25
- package/dist/error/index.mjs +1 -8
- package/dist/index.cjs +1 -43
- package/dist/index.mjs +1 -16
- 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-B1jRHBM_.cjs +34 -0
- package/dist/packem_shared/ruleBasedFinder-P88d0gpK.mjs +34 -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.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.mjs +1 -2
- package/package.json +1 -1
- package/dist/packem_shared/NonError-BrwMc2LE.mjs +0 -13
- package/dist/packem_shared/NonError-DqwGL5Cy.cjs +0 -15
- package/dist/packem_shared/addKnownErrorConstructor-DBmmT2OF.mjs +0 -32
- package/dist/packem_shared/addKnownErrorConstructor-J1_ZUURa.cjs +0 -39
- package/dist/packem_shared/aiFinder-BR9Pq804.cjs +0 -259
- package/dist/packem_shared/aiFinder-CFHvOjD8.mjs +0 -257
- package/dist/packem_shared/aiSolutionResponse-BaN1M990.mjs +0 -36
- package/dist/packem_shared/aiSolutionResponse-Cqi0mFxy.cjs +0 -38
- package/dist/packem_shared/captureRawStackTrace-ClSI1tHb.cjs +0 -14
- package/dist/packem_shared/captureRawStackTrace-Tl3Rqkat.mjs +0 -12
- package/dist/packem_shared/deserializeError-Be3qOGBQ.cjs +0 -120
- package/dist/packem_shared/deserializeError-DuzHucBb.mjs +0 -118
- 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/index-BmoOJLvu.mjs +0 -12
- package/dist/packem_shared/index-C53Tqb7g.cjs +0 -14
- package/dist/packem_shared/indexToLineColumn-CKQKtKEK.mjs +0 -52
- package/dist/packem_shared/indexToLineColumn-Cro5eT8v.cjs +0 -54
- package/dist/packem_shared/isVisulimaError-Bb1_TB6w.cjs +0 -44
- package/dist/packem_shared/isVisulimaError-zyd80Gui.mjs +0 -39
- package/dist/packem_shared/parseStacktrace-BlguTUcF.mjs +0 -275
- package/dist/packem_shared/parseStacktrace-woJgU2XY.cjs +0 -277
- package/dist/packem_shared/renderError-Cn8M0fQ3.mjs +0 -180
- package/dist/packem_shared/renderError-n3kXGdYj.cjs +0 -184
- package/dist/packem_shared/ruleBasedFinder-Cbmc6N7f.mjs +0 -227
- package/dist/packem_shared/ruleBasedFinder-CkybTSHw.cjs +0 -229
- package/dist/packem_shared/serializeError-DHIelq5o.mjs +0 -144
- package/dist/packem_shared/serializeError-Dt7oFM2R.cjs +0 -148
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const index = require('./index-C53Tqb7g.cjs');
|
|
4
|
-
const addKnownErrorConstructor = require('./addKnownErrorConstructor-J1_ZUURa.cjs');
|
|
5
|
-
const NonError = require('./NonError-DqwGL5Cy.cjs');
|
|
6
|
-
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
-
const defaultOptions = {
|
|
10
|
-
maxDepth: Number.POSITIVE_INFINITY
|
|
11
|
-
};
|
|
12
|
-
const deserializePlainObject = /* @__PURE__ */ __name((object, options, depth = 0) => {
|
|
13
|
-
if (addKnownErrorConstructor.isErrorLike(object)) {
|
|
14
|
-
return reconstructError(object, options, depth);
|
|
15
|
-
}
|
|
16
|
-
if (options.maxDepth !== void 0 && depth >= options.maxDepth) {
|
|
17
|
-
return new NonError(JSON.stringify(object));
|
|
18
|
-
}
|
|
19
|
-
return new NonError(JSON.stringify(object));
|
|
20
|
-
}, "deserializePlainObject");
|
|
21
|
-
const reconstructAggregateError = /* @__PURE__ */ __name((Constructor, errors, message, options, depth) => {
|
|
22
|
-
const reconstructedErrors = errors.map((error_) => deserializeValue(error_, options, depth + 1));
|
|
23
|
-
return new Constructor(reconstructedErrors, message);
|
|
24
|
-
}, "reconstructAggregateError");
|
|
25
|
-
const reconstructError = /* @__PURE__ */ __name((serialized, options, depth) => {
|
|
26
|
-
if (options.maxDepth !== void 0 && depth >= options.maxDepth) {
|
|
27
|
-
return new NonError(JSON.stringify(serialized));
|
|
28
|
-
}
|
|
29
|
-
const { cause, errors, message, name, stack, ...properties } = serialized;
|
|
30
|
-
const Constructor = addKnownErrorConstructor.getErrorConstructor(name) || Error;
|
|
31
|
-
const error = name === "AggregateError" && Array.isArray(errors) ? reconstructAggregateError(Constructor, errors, message, options, depth) : new Constructor(message);
|
|
32
|
-
if (!error.name && name) {
|
|
33
|
-
error.name = name;
|
|
34
|
-
}
|
|
35
|
-
if (message !== void 0) {
|
|
36
|
-
error.message = message;
|
|
37
|
-
}
|
|
38
|
-
if (stack) {
|
|
39
|
-
error.stack = stack;
|
|
40
|
-
}
|
|
41
|
-
restoreErrorProperties(error, properties, cause, name, options, depth);
|
|
42
|
-
if (cause !== void 0) {
|
|
43
|
-
error.cause = deserializeValue(cause, options, depth + 1);
|
|
44
|
-
}
|
|
45
|
-
makePropertiesEnumerable(error, serialized);
|
|
46
|
-
return error;
|
|
47
|
-
}, "reconstructError");
|
|
48
|
-
const deserializeValue = /* @__PURE__ */ __name((value, options, depth) => {
|
|
49
|
-
if (index.isPlainObject(value)) {
|
|
50
|
-
return deserializePlainObject(value, options, depth);
|
|
51
|
-
}
|
|
52
|
-
if (Array.isArray(value)) {
|
|
53
|
-
return value.map((item) => deserializeValue(item, options, depth));
|
|
54
|
-
}
|
|
55
|
-
return value;
|
|
56
|
-
}, "deserializeValue");
|
|
57
|
-
const restoreErrorProperties = /* @__PURE__ */ __name((error, properties, cause, name, options, depth) => {
|
|
58
|
-
const errorCopy = error;
|
|
59
|
-
for (const [key, value] of Object.entries(properties)) {
|
|
60
|
-
if (key === "cause" && cause !== void 0) {
|
|
61
|
-
continue;
|
|
62
|
-
} else if (key === "errors" && name === "AggregateError") {
|
|
63
|
-
continue;
|
|
64
|
-
} else {
|
|
65
|
-
errorCopy[key] = deserializeValue(value, options, depth + 1);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}, "restoreErrorProperties");
|
|
69
|
-
const makePropertiesEnumerable = /* @__PURE__ */ __name((error, serialized) => {
|
|
70
|
-
const errorProperties = /* @__PURE__ */ new Set();
|
|
71
|
-
errorProperties.add("name");
|
|
72
|
-
errorProperties.add("message");
|
|
73
|
-
errorProperties.add("stack");
|
|
74
|
-
for (const key of Object.keys(serialized)) {
|
|
75
|
-
errorProperties.add(key);
|
|
76
|
-
}
|
|
77
|
-
for (const key of errorProperties) {
|
|
78
|
-
if (key in error) {
|
|
79
|
-
const descriptor = Object.getOwnPropertyDescriptor(error, key);
|
|
80
|
-
if (descriptor && !descriptor.enumerable) {
|
|
81
|
-
Object.defineProperty(error, key, {
|
|
82
|
-
...descriptor,
|
|
83
|
-
enumerable: true
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}, "makePropertiesEnumerable");
|
|
89
|
-
const handlePrimitive = /* @__PURE__ */ __name((value) => new NonError(JSON.stringify(value)), "handlePrimitive");
|
|
90
|
-
const handleArray = /* @__PURE__ */ __name((value) => new NonError(JSON.stringify(value)), "handleArray");
|
|
91
|
-
const handlePlainObject = /* @__PURE__ */ __name((value, config) => {
|
|
92
|
-
if (addKnownErrorConstructor.isErrorLike(value)) {
|
|
93
|
-
return reconstructError(value, config, 0);
|
|
94
|
-
}
|
|
95
|
-
return deserializePlainObject(value, config);
|
|
96
|
-
}, "handlePlainObject");
|
|
97
|
-
const deserialize = /* @__PURE__ */ __name((value, options = {}) => {
|
|
98
|
-
const config = { ...defaultOptions, ...options };
|
|
99
|
-
if (value instanceof Error) {
|
|
100
|
-
return value;
|
|
101
|
-
}
|
|
102
|
-
if (value === null) {
|
|
103
|
-
return handlePrimitive(null);
|
|
104
|
-
}
|
|
105
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
106
|
-
return handlePrimitive(value);
|
|
107
|
-
}
|
|
108
|
-
if (Array.isArray(value)) {
|
|
109
|
-
return handleArray(value);
|
|
110
|
-
}
|
|
111
|
-
if (addKnownErrorConstructor.isErrorLike(value)) {
|
|
112
|
-
return reconstructError(value, config, 0);
|
|
113
|
-
}
|
|
114
|
-
if (index.isPlainObject(value)) {
|
|
115
|
-
return handlePlainObject(value, config);
|
|
116
|
-
}
|
|
117
|
-
return new NonError(JSON.stringify(value));
|
|
118
|
-
}, "deserialize");
|
|
119
|
-
|
|
120
|
-
module.exports = deserialize;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { i as isPlainObject } from './index-BmoOJLvu.mjs';
|
|
2
|
-
import { isErrorLike, getErrorConstructor } from './addKnownErrorConstructor-DBmmT2OF.mjs';
|
|
3
|
-
import NonError from './NonError-BrwMc2LE.mjs';
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
const defaultOptions = {
|
|
8
|
-
maxDepth: Number.POSITIVE_INFINITY
|
|
9
|
-
};
|
|
10
|
-
const deserializePlainObject = /* @__PURE__ */ __name((object, options, depth = 0) => {
|
|
11
|
-
if (isErrorLike(object)) {
|
|
12
|
-
return reconstructError(object, options, depth);
|
|
13
|
-
}
|
|
14
|
-
if (options.maxDepth !== void 0 && depth >= options.maxDepth) {
|
|
15
|
-
return new NonError(JSON.stringify(object));
|
|
16
|
-
}
|
|
17
|
-
return new NonError(JSON.stringify(object));
|
|
18
|
-
}, "deserializePlainObject");
|
|
19
|
-
const reconstructAggregateError = /* @__PURE__ */ __name((Constructor, errors, message, options, depth) => {
|
|
20
|
-
const reconstructedErrors = errors.map((error_) => deserializeValue(error_, options, depth + 1));
|
|
21
|
-
return new Constructor(reconstructedErrors, message);
|
|
22
|
-
}, "reconstructAggregateError");
|
|
23
|
-
const reconstructError = /* @__PURE__ */ __name((serialized, options, depth) => {
|
|
24
|
-
if (options.maxDepth !== void 0 && depth >= options.maxDepth) {
|
|
25
|
-
return new NonError(JSON.stringify(serialized));
|
|
26
|
-
}
|
|
27
|
-
const { cause, errors, message, name, stack, ...properties } = serialized;
|
|
28
|
-
const Constructor = getErrorConstructor(name) || Error;
|
|
29
|
-
const error = name === "AggregateError" && Array.isArray(errors) ? reconstructAggregateError(Constructor, errors, message, options, depth) : new Constructor(message);
|
|
30
|
-
if (!error.name && name) {
|
|
31
|
-
error.name = name;
|
|
32
|
-
}
|
|
33
|
-
if (message !== void 0) {
|
|
34
|
-
error.message = message;
|
|
35
|
-
}
|
|
36
|
-
if (stack) {
|
|
37
|
-
error.stack = stack;
|
|
38
|
-
}
|
|
39
|
-
restoreErrorProperties(error, properties, cause, name, options, depth);
|
|
40
|
-
if (cause !== void 0) {
|
|
41
|
-
error.cause = deserializeValue(cause, options, depth + 1);
|
|
42
|
-
}
|
|
43
|
-
makePropertiesEnumerable(error, serialized);
|
|
44
|
-
return error;
|
|
45
|
-
}, "reconstructError");
|
|
46
|
-
const deserializeValue = /* @__PURE__ */ __name((value, options, depth) => {
|
|
47
|
-
if (isPlainObject(value)) {
|
|
48
|
-
return deserializePlainObject(value, options, depth);
|
|
49
|
-
}
|
|
50
|
-
if (Array.isArray(value)) {
|
|
51
|
-
return value.map((item) => deserializeValue(item, options, depth));
|
|
52
|
-
}
|
|
53
|
-
return value;
|
|
54
|
-
}, "deserializeValue");
|
|
55
|
-
const restoreErrorProperties = /* @__PURE__ */ __name((error, properties, cause, name, options, depth) => {
|
|
56
|
-
const errorCopy = error;
|
|
57
|
-
for (const [key, value] of Object.entries(properties)) {
|
|
58
|
-
if (key === "cause" && cause !== void 0) {
|
|
59
|
-
continue;
|
|
60
|
-
} else if (key === "errors" && name === "AggregateError") {
|
|
61
|
-
continue;
|
|
62
|
-
} else {
|
|
63
|
-
errorCopy[key] = deserializeValue(value, options, depth + 1);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}, "restoreErrorProperties");
|
|
67
|
-
const makePropertiesEnumerable = /* @__PURE__ */ __name((error, serialized) => {
|
|
68
|
-
const errorProperties = /* @__PURE__ */ new Set();
|
|
69
|
-
errorProperties.add("name");
|
|
70
|
-
errorProperties.add("message");
|
|
71
|
-
errorProperties.add("stack");
|
|
72
|
-
for (const key of Object.keys(serialized)) {
|
|
73
|
-
errorProperties.add(key);
|
|
74
|
-
}
|
|
75
|
-
for (const key of errorProperties) {
|
|
76
|
-
if (key in error) {
|
|
77
|
-
const descriptor = Object.getOwnPropertyDescriptor(error, key);
|
|
78
|
-
if (descriptor && !descriptor.enumerable) {
|
|
79
|
-
Object.defineProperty(error, key, {
|
|
80
|
-
...descriptor,
|
|
81
|
-
enumerable: true
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}, "makePropertiesEnumerable");
|
|
87
|
-
const handlePrimitive = /* @__PURE__ */ __name((value) => new NonError(JSON.stringify(value)), "handlePrimitive");
|
|
88
|
-
const handleArray = /* @__PURE__ */ __name((value) => new NonError(JSON.stringify(value)), "handleArray");
|
|
89
|
-
const handlePlainObject = /* @__PURE__ */ __name((value, config) => {
|
|
90
|
-
if (isErrorLike(value)) {
|
|
91
|
-
return reconstructError(value, config, 0);
|
|
92
|
-
}
|
|
93
|
-
return deserializePlainObject(value, config);
|
|
94
|
-
}, "handlePlainObject");
|
|
95
|
-
const deserialize = /* @__PURE__ */ __name((value, options = {}) => {
|
|
96
|
-
const config = { ...defaultOptions, ...options };
|
|
97
|
-
if (value instanceof Error) {
|
|
98
|
-
return value;
|
|
99
|
-
}
|
|
100
|
-
if (value === null) {
|
|
101
|
-
return handlePrimitive(null);
|
|
102
|
-
}
|
|
103
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
104
|
-
return handlePrimitive(value);
|
|
105
|
-
}
|
|
106
|
-
if (Array.isArray(value)) {
|
|
107
|
-
return handleArray(value);
|
|
108
|
-
}
|
|
109
|
-
if (isErrorLike(value)) {
|
|
110
|
-
return reconstructError(value, config, 0);
|
|
111
|
-
}
|
|
112
|
-
if (isPlainObject(value)) {
|
|
113
|
-
return handlePlainObject(value, config);
|
|
114
|
-
}
|
|
115
|
-
return new NonError(JSON.stringify(value));
|
|
116
|
-
}, "deserialize");
|
|
117
|
-
|
|
118
|
-
export { deserialize as default };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
const errorHintFinder = {
|
|
4
|
-
handle: /* @__PURE__ */ __name(async (error) => {
|
|
5
|
-
if (error.hint === void 0) {
|
|
6
|
-
return void 0;
|
|
7
|
-
}
|
|
8
|
-
if (typeof error.hint === "string") {
|
|
9
|
-
return { body: error.hint };
|
|
10
|
-
}
|
|
11
|
-
if (typeof error.hint === "object" && typeof error.hint.body === "string") {
|
|
12
|
-
return error.hint;
|
|
13
|
-
}
|
|
14
|
-
if (Array.isArray(error.hint)) {
|
|
15
|
-
return { body: error.hint.join("\n") };
|
|
16
|
-
}
|
|
17
|
-
return void 0;
|
|
18
|
-
}, "handle"),
|
|
19
|
-
name: "errorHint",
|
|
20
|
-
priority: 1
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export { errorHintFinder as default };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
const errorHintFinder = {
|
|
6
|
-
handle: /* @__PURE__ */ __name(async (error) => {
|
|
7
|
-
if (error.hint === void 0) {
|
|
8
|
-
return void 0;
|
|
9
|
-
}
|
|
10
|
-
if (typeof error.hint === "string") {
|
|
11
|
-
return { body: error.hint };
|
|
12
|
-
}
|
|
13
|
-
if (typeof error.hint === "object" && typeof error.hint.body === "string") {
|
|
14
|
-
return error.hint;
|
|
15
|
-
}
|
|
16
|
-
if (Array.isArray(error.hint)) {
|
|
17
|
-
return { body: error.hint.join("\n") };
|
|
18
|
-
}
|
|
19
|
-
return void 0;
|
|
20
|
-
}, "handle"),
|
|
21
|
-
name: "errorHint",
|
|
22
|
-
priority: 1
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
module.exports = errorHintFinder;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
const formatStackFrameLine = /* @__PURE__ */ __name((frame) => {
|
|
8
|
-
const method = frame.methodName && frame.methodName !== "<unknown>" ? `${frame.methodName} ` : "";
|
|
9
|
-
const file = frame.file ?? "<unknown>";
|
|
10
|
-
const line = frame.line ?? 0;
|
|
11
|
-
const column = frame.column ?? 0;
|
|
12
|
-
if (method.trim()) {
|
|
13
|
-
return ` at ${method}(${file}:${line}:${column})`;
|
|
14
|
-
}
|
|
15
|
-
return ` at ${file}:${line}:${column}`;
|
|
16
|
-
}, "formatStackFrameLine");
|
|
17
|
-
const formatStacktrace = /* @__PURE__ */ __name((frames, options) => {
|
|
18
|
-
const lines = [];
|
|
19
|
-
if (options?.header && (options.header.name || options.header.message)) {
|
|
20
|
-
const headerName = String(options.header.name || "Error");
|
|
21
|
-
const headerMessage = String(options.header.message || "");
|
|
22
|
-
lines.push(`${headerName}${headerMessage ? ": " : ""}${headerMessage}`);
|
|
23
|
-
}
|
|
24
|
-
for (const frame of frames) {
|
|
25
|
-
lines.push(formatStackFrameLine(frame));
|
|
26
|
-
}
|
|
27
|
-
return lines.join("\n");
|
|
28
|
-
}, "formatStacktrace");
|
|
29
|
-
|
|
30
|
-
exports.formatStackFrameLine = formatStackFrameLine;
|
|
31
|
-
exports.formatStacktrace = formatStacktrace;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
const formatStackFrameLine = /* @__PURE__ */ __name((frame) => {
|
|
4
|
-
const method = frame.methodName && frame.methodName !== "<unknown>" ? `${frame.methodName} ` : "";
|
|
5
|
-
const file = frame.file ?? "<unknown>";
|
|
6
|
-
const line = frame.line ?? 0;
|
|
7
|
-
const column = frame.column ?? 0;
|
|
8
|
-
if (method.trim()) {
|
|
9
|
-
return ` at ${method}(${file}:${line}:${column})`;
|
|
10
|
-
}
|
|
11
|
-
return ` at ${file}:${line}:${column}`;
|
|
12
|
-
}, "formatStackFrameLine");
|
|
13
|
-
const formatStacktrace = /* @__PURE__ */ __name((frames, options) => {
|
|
14
|
-
const lines = [];
|
|
15
|
-
if (options?.header && (options.header.name || options.header.message)) {
|
|
16
|
-
const headerName = String(options.header.name || "Error");
|
|
17
|
-
const headerMessage = String(options.header.message || "");
|
|
18
|
-
lines.push(`${headerName}${headerMessage ? ": " : ""}${headerMessage}`);
|
|
19
|
-
}
|
|
20
|
-
for (const frame of frames) {
|
|
21
|
-
lines.push(formatStackFrameLine(frame));
|
|
22
|
-
}
|
|
23
|
-
return lines.join("\n");
|
|
24
|
-
}, "formatStacktrace");
|
|
25
|
-
|
|
26
|
-
export { formatStackFrameLine, formatStacktrace };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { inspect } from 'node:util';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
const getErrorCauses = /* @__PURE__ */ __name((error) => {
|
|
6
|
-
const seen = /* @__PURE__ */ new Set();
|
|
7
|
-
const causes = [];
|
|
8
|
-
let currentError = error;
|
|
9
|
-
while (currentError) {
|
|
10
|
-
if (seen.has(currentError)) {
|
|
11
|
-
console.error(`Circular reference detected in error causes: ${inspect(error)}`);
|
|
12
|
-
break;
|
|
13
|
-
}
|
|
14
|
-
causes.push(currentError);
|
|
15
|
-
seen.add(currentError);
|
|
16
|
-
if (!currentError.cause) {
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
currentError = currentError.cause;
|
|
20
|
-
}
|
|
21
|
-
return causes;
|
|
22
|
-
}, "getErrorCauses");
|
|
23
|
-
|
|
24
|
-
export { getErrorCauses as default };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const node_util = require('node:util');
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
const getErrorCauses = /* @__PURE__ */ __name((error) => {
|
|
8
|
-
const seen = /* @__PURE__ */ new Set();
|
|
9
|
-
const causes = [];
|
|
10
|
-
let currentError = error;
|
|
11
|
-
while (currentError) {
|
|
12
|
-
if (seen.has(currentError)) {
|
|
13
|
-
console.error(`Circular reference detected in error causes: ${node_util.inspect(error)}`);
|
|
14
|
-
break;
|
|
15
|
-
}
|
|
16
|
-
causes.push(currentError);
|
|
17
|
-
seen.add(currentError);
|
|
18
|
-
if (!currentError.cause) {
|
|
19
|
-
break;
|
|
20
|
-
}
|
|
21
|
-
currentError = currentError.cause;
|
|
22
|
-
}
|
|
23
|
-
return causes;
|
|
24
|
-
}, "getErrorCauses");
|
|
25
|
-
|
|
26
|
-
module.exports = getErrorCauses;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
function isPlainObject(value) {
|
|
4
|
-
if (typeof value !== "object" || value === null) {
|
|
5
|
-
return false;
|
|
6
|
-
}
|
|
7
|
-
const prototype = Object.getPrototypeOf(value);
|
|
8
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
9
|
-
}
|
|
10
|
-
__name(isPlainObject, "isPlainObject");
|
|
11
|
-
|
|
12
|
-
export { isPlainObject as i };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
function isPlainObject(value) {
|
|
6
|
-
if (typeof value !== "object" || value === null) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
const prototype = Object.getPrototypeOf(value);
|
|
10
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
11
|
-
}
|
|
12
|
-
__name(isPlainObject, "isPlainObject");
|
|
13
|
-
|
|
14
|
-
exports.isPlainObject = isPlainObject;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
const binarySearch = /* @__PURE__ */ __name((element, array) => {
|
|
4
|
-
let m = 0;
|
|
5
|
-
let n = array.length - 2;
|
|
6
|
-
while (m < n) {
|
|
7
|
-
const key = m + (n - m >> 1);
|
|
8
|
-
if (element < array[key]) {
|
|
9
|
-
n = key - 1;
|
|
10
|
-
} else if (element >= array[key + 1]) {
|
|
11
|
-
m = key + 1;
|
|
12
|
-
} else {
|
|
13
|
-
m = key;
|
|
14
|
-
break;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return m;
|
|
18
|
-
}, "binarySearch");
|
|
19
|
-
const getLineStartIndexes = /* @__PURE__ */ __name((string_) => (
|
|
20
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
21
|
-
string_.split(/\n|\r(?!\n)/).reduce(
|
|
22
|
-
(accumulator, current) => {
|
|
23
|
-
accumulator.push(accumulator.at(-1) + current.length + 1);
|
|
24
|
-
return accumulator;
|
|
25
|
-
},
|
|
26
|
-
[0]
|
|
27
|
-
)
|
|
28
|
-
), "getLineStartIndexes");
|
|
29
|
-
const indexToLineColumn = /* @__PURE__ */ __name((input, index, options) => {
|
|
30
|
-
const skipChecks = options?.skipChecks ?? false;
|
|
31
|
-
if (!skipChecks && (!Array.isArray(input) && typeof input !== "string" || (typeof input === "string" || Array.isArray(input)) && input.length === 0)) {
|
|
32
|
-
return { column: 0, line: 0 };
|
|
33
|
-
}
|
|
34
|
-
if (!skipChecks && (typeof index !== "number" || typeof input === "string" && index >= input.length || Array.isArray(input) && index + 1 >= input.at(-1))) {
|
|
35
|
-
return { column: 0, line: 0 };
|
|
36
|
-
}
|
|
37
|
-
if (typeof input === "string") {
|
|
38
|
-
const startIndexesOfEachLine = getLineStartIndexes(input);
|
|
39
|
-
const line2 = binarySearch(index, startIndexesOfEachLine);
|
|
40
|
-
return {
|
|
41
|
-
column: index - startIndexesOfEachLine[line2] + 1,
|
|
42
|
-
line: line2 + 1
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
const line = binarySearch(index, input);
|
|
46
|
-
return {
|
|
47
|
-
column: index - input[line] + 1,
|
|
48
|
-
line: line + 1
|
|
49
|
-
};
|
|
50
|
-
}, "indexToLineColumn");
|
|
51
|
-
|
|
52
|
-
export { indexToLineColumn as default };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
const binarySearch = /* @__PURE__ */ __name((element, array) => {
|
|
6
|
-
let m = 0;
|
|
7
|
-
let n = array.length - 2;
|
|
8
|
-
while (m < n) {
|
|
9
|
-
const key = m + (n - m >> 1);
|
|
10
|
-
if (element < array[key]) {
|
|
11
|
-
n = key - 1;
|
|
12
|
-
} else if (element >= array[key + 1]) {
|
|
13
|
-
m = key + 1;
|
|
14
|
-
} else {
|
|
15
|
-
m = key;
|
|
16
|
-
break;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return m;
|
|
20
|
-
}, "binarySearch");
|
|
21
|
-
const getLineStartIndexes = /* @__PURE__ */ __name((string_) => (
|
|
22
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
23
|
-
string_.split(/\n|\r(?!\n)/).reduce(
|
|
24
|
-
(accumulator, current) => {
|
|
25
|
-
accumulator.push(accumulator.at(-1) + current.length + 1);
|
|
26
|
-
return accumulator;
|
|
27
|
-
},
|
|
28
|
-
[0]
|
|
29
|
-
)
|
|
30
|
-
), "getLineStartIndexes");
|
|
31
|
-
const indexToLineColumn = /* @__PURE__ */ __name((input, index, options) => {
|
|
32
|
-
const skipChecks = options?.skipChecks ?? false;
|
|
33
|
-
if (!skipChecks && (!Array.isArray(input) && typeof input !== "string" || (typeof input === "string" || Array.isArray(input)) && input.length === 0)) {
|
|
34
|
-
return { column: 0, line: 0 };
|
|
35
|
-
}
|
|
36
|
-
if (!skipChecks && (typeof index !== "number" || typeof input === "string" && index >= input.length || Array.isArray(input) && index + 1 >= input.at(-1))) {
|
|
37
|
-
return { column: 0, line: 0 };
|
|
38
|
-
}
|
|
39
|
-
if (typeof input === "string") {
|
|
40
|
-
const startIndexesOfEachLine = getLineStartIndexes(input);
|
|
41
|
-
const line2 = binarySearch(index, startIndexesOfEachLine);
|
|
42
|
-
return {
|
|
43
|
-
column: index - startIndexesOfEachLine[line2] + 1,
|
|
44
|
-
line: line2 + 1
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
const line = binarySearch(index, input);
|
|
48
|
-
return {
|
|
49
|
-
column: index - input[line] + 1,
|
|
50
|
-
line: line + 1
|
|
51
|
-
};
|
|
52
|
-
}, "indexToLineColumn");
|
|
53
|
-
|
|
54
|
-
module.exports = indexToLineColumn;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
|
-
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
const isVisulimaError = /* @__PURE__ */ __name((error) => error instanceof Error && error.type === "VisulimaError", "isVisulimaError");
|
|
8
|
-
class VisulimaError extends Error {
|
|
9
|
-
static {
|
|
10
|
-
__name(this, "VisulimaError");
|
|
11
|
-
}
|
|
12
|
-
loc;
|
|
13
|
-
title;
|
|
14
|
-
/**
|
|
15
|
-
* A message that explains to the user how they can fix the error.
|
|
16
|
-
*/
|
|
17
|
-
hint;
|
|
18
|
-
type = "VisulimaError";
|
|
19
|
-
constructor({ cause, hint, location, message, name, stack, title }) {
|
|
20
|
-
super(message, {
|
|
21
|
-
cause
|
|
22
|
-
});
|
|
23
|
-
this.title = title;
|
|
24
|
-
this.name = name;
|
|
25
|
-
this.stack = stack ?? this.stack;
|
|
26
|
-
this.loc = location;
|
|
27
|
-
this.hint = hint;
|
|
28
|
-
}
|
|
29
|
-
setLocation(location) {
|
|
30
|
-
this.loc = location;
|
|
31
|
-
}
|
|
32
|
-
setName(name) {
|
|
33
|
-
this.name = name;
|
|
34
|
-
}
|
|
35
|
-
setMessage(message) {
|
|
36
|
-
this.message = message;
|
|
37
|
-
}
|
|
38
|
-
setHint(hint) {
|
|
39
|
-
this.hint = hint;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
exports.VisulimaError = VisulimaError;
|
|
44
|
-
exports.isVisulimaError = isVisulimaError;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
const isVisulimaError = /* @__PURE__ */ __name((error) => error instanceof Error && error.type === "VisulimaError", "isVisulimaError");
|
|
4
|
-
class VisulimaError extends Error {
|
|
5
|
-
static {
|
|
6
|
-
__name(this, "VisulimaError");
|
|
7
|
-
}
|
|
8
|
-
loc;
|
|
9
|
-
title;
|
|
10
|
-
/**
|
|
11
|
-
* A message that explains to the user how they can fix the error.
|
|
12
|
-
*/
|
|
13
|
-
hint;
|
|
14
|
-
type = "VisulimaError";
|
|
15
|
-
constructor({ cause, hint, location, message, name, stack, title }) {
|
|
16
|
-
super(message, {
|
|
17
|
-
cause
|
|
18
|
-
});
|
|
19
|
-
this.title = title;
|
|
20
|
-
this.name = name;
|
|
21
|
-
this.stack = stack ?? this.stack;
|
|
22
|
-
this.loc = location;
|
|
23
|
-
this.hint = hint;
|
|
24
|
-
}
|
|
25
|
-
setLocation(location) {
|
|
26
|
-
this.loc = location;
|
|
27
|
-
}
|
|
28
|
-
setName(name) {
|
|
29
|
-
this.name = name;
|
|
30
|
-
}
|
|
31
|
-
setMessage(message) {
|
|
32
|
-
this.message = message;
|
|
33
|
-
}
|
|
34
|
-
setHint(hint) {
|
|
35
|
-
this.hint = hint;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { VisulimaError, isVisulimaError };
|