@visulima/error 4.5.0 → 4.6.0
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 +15 -0
- package/README.md +148 -4
- package/dist/code-frame/index.cjs +6 -5
- package/dist/code-frame/index.mjs +6 -5
- package/dist/error/index.cjs +10 -3
- 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 +6 -3
- package/dist/index.cjs +14 -7
- 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 +10 -7
- package/dist/packem_shared/NonError-BrwMc2LE.mjs +13 -0
- package/dist/packem_shared/NonError-DqwGL5Cy.cjs +15 -0
- package/dist/packem_shared/addKnownErrorConstructor-DBmmT2OF.mjs +32 -0
- package/dist/packem_shared/addKnownErrorConstructor-J1_ZUURa.cjs +39 -0
- package/dist/packem_shared/{aiFinder-BGfwKKxE.cjs → aiFinder-BR9Pq804.cjs} +19 -23
- package/dist/packem_shared/{aiFinder-Bk1vt0_x.mjs → aiFinder-CFHvOjD8.mjs} +19 -23
- package/dist/packem_shared/{aiSolutionResponse-bDi4ad8f.mjs → aiSolutionResponse-BaN1M990.mjs} +3 -2
- package/dist/packem_shared/{aiSolutionResponse-BPckbL56.cjs → aiSolutionResponse-Cqi0mFxy.cjs} +3 -2
- package/dist/packem_shared/deserializeError-Be3qOGBQ.cjs +120 -0
- package/dist/packem_shared/deserializeError-DuzHucBb.mjs +118 -0
- package/dist/packem_shared/index-BmoOJLvu.mjs +12 -0
- package/dist/packem_shared/index-C53Tqb7g.cjs +14 -0
- package/dist/packem_shared/{indexToLineColumn-Dx91YDU1.mjs → indexToLineColumn-CKQKtKEK.mjs} +0 -2
- package/dist/packem_shared/{indexToLineColumn-DjmjeiIY.cjs → indexToLineColumn-Cro5eT8v.cjs} +0 -2
- package/dist/packem_shared/{isVisulimaError-BVLWvREw.cjs → isVisulimaError-Bb1_TB6w.cjs} +0 -1
- package/dist/packem_shared/{isVisulimaError-H6TqEA42.mjs → isVisulimaError-zyd80Gui.mjs} +0 -1
- package/dist/packem_shared/{parseStacktrace-BKGoWCwC.mjs → parseStacktrace-BlguTUcF.mjs} +10 -15
- package/dist/packem_shared/{parseStacktrace-6pFoXW43.cjs → parseStacktrace-woJgU2XY.cjs} +10 -15
- package/dist/packem_shared/{renderError-BWpM2m6k.mjs → renderError-Cn8M0fQ3.mjs} +37 -22
- package/dist/packem_shared/{renderError-CXZTAXig.cjs → renderError-n3kXGdYj.cjs} +35 -20
- package/dist/packem_shared/{ruleBasedFinder-BYrndubA.mjs → ruleBasedFinder-Cbmc6N7f.mjs} +1 -1
- package/dist/packem_shared/{ruleBasedFinder-y_-5kbeT.cjs → ruleBasedFinder-CkybTSHw.cjs} +1 -1
- package/dist/packem_shared/{serializeError-DusTUACt.mjs → serializeError-DHIelq5o.mjs} +2 -11
- package/dist/packem_shared/{serializeError-CT7s0Ffk.cjs → serializeError-Dt7oFM2R.cjs} +3 -12
- package/dist/solution/ai/index.cjs +2 -2
- 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 +2 -2
- package/dist/solution/index.cjs +1 -1
- package/dist/solution/index.mjs +1 -1
- package/dist/stacktrace/index.cjs +1 -1
- 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 -1
- package/package.json +1 -1
|
@@ -6,10 +6,7 @@ const debugLog = /* @__PURE__ */ __name((message, ...arguments_) => {
|
|
|
6
6
|
}
|
|
7
7
|
}, "debugLog");
|
|
8
8
|
const UNKNOWN_FUNCTION = "<unknown>";
|
|
9
|
-
const CHROMIUM_REGEX = (
|
|
10
|
-
// eslint-disable-next-line security/detect-unsafe-regex,regexp/no-super-linear-backtracking
|
|
11
|
-
/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i
|
|
12
|
-
);
|
|
9
|
+
const CHROMIUM_REGEX = /^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
|
|
13
10
|
const CHROMIUM_EVAL_REGEX = /\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/;
|
|
14
11
|
const CHROMIUM_MAPPED = /(.*?):(\d+):(\d+)(\s<-\s(.+):(\d+):(\d+))?/;
|
|
15
12
|
const WINDOWS_EVAL_REGEX = /(eval)\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*(<anonymous>)?:(\d+)?:(\d+)/;
|
|
@@ -45,7 +42,6 @@ const parseNode = /* @__PURE__ */ __name((line) => {
|
|
|
45
42
|
column: split[2] ? +split[2] : void 0,
|
|
46
43
|
file: split[0],
|
|
47
44
|
line: split[1] ? +split[1] : void 0,
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
49
45
|
methodName: nestedNode[1] || UNKNOWN_FUNCTION,
|
|
50
46
|
raw: line,
|
|
51
47
|
type: void 0
|
|
@@ -58,12 +54,11 @@ const parseNode = /* @__PURE__ */ __name((line) => {
|
|
|
58
54
|
column: node[4] ? +node[4] : void 0,
|
|
59
55
|
file: node[2] ? node[2].replace(/at\s/, "") : void 0,
|
|
60
56
|
line: node[3] ? +node[3] : void 0,
|
|
61
|
-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
62
57
|
methodName: node[1] || UNKNOWN_FUNCTION,
|
|
63
58
|
raw: line,
|
|
64
59
|
type: line.startsWith("internal") ? "internal" : void 0
|
|
65
60
|
};
|
|
66
|
-
parseMapped(trace, node[2]
|
|
61
|
+
parseMapped(trace, `${node[2]}:${node[3]}:${node[4]}`);
|
|
67
62
|
return trace;
|
|
68
63
|
}
|
|
69
64
|
return void 0;
|
|
@@ -79,7 +74,7 @@ const parseChromium = /* @__PURE__ */ __name((line) => {
|
|
|
79
74
|
if (isEval) {
|
|
80
75
|
const subMatch = CHROMIUM_EVAL_REGEX.exec(line);
|
|
81
76
|
if (subMatch) {
|
|
82
|
-
const split =
|
|
77
|
+
const split = /^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/.exec(subMatch[1]);
|
|
83
78
|
if (split) {
|
|
84
79
|
parts[2] = split[4] ?? split[1];
|
|
85
80
|
parts[3] = split[5] ?? split[2];
|
|
@@ -128,6 +123,7 @@ const parseChromium = /* @__PURE__ */ __name((line) => {
|
|
|
128
123
|
line: parts[3] ? +parts[3] : void 0,
|
|
129
124
|
methodName,
|
|
130
125
|
raw: line,
|
|
126
|
+
// eslint-disable-next-line sonarjs/no-nested-conditional
|
|
131
127
|
type: isEval ? "eval" : isNative ? "native" : void 0
|
|
132
128
|
};
|
|
133
129
|
if (windowsParts) {
|
|
@@ -135,7 +131,7 @@ const parseChromium = /* @__PURE__ */ __name((line) => {
|
|
|
135
131
|
trace.file = windowsParts.file;
|
|
136
132
|
trace.line = windowsParts.line;
|
|
137
133
|
} else {
|
|
138
|
-
parseMapped(trace, file
|
|
134
|
+
parseMapped(trace, `${file}:${parts[3]}:${parts[4]}`);
|
|
139
135
|
}
|
|
140
136
|
return trace;
|
|
141
137
|
}
|
|
@@ -184,6 +180,7 @@ const parseGecko = /* @__PURE__ */ __name((line, topFrameMeta) => {
|
|
|
184
180
|
line: lineNumber,
|
|
185
181
|
methodName,
|
|
186
182
|
raw: line,
|
|
183
|
+
// eslint-disable-next-line sonarjs/no-nested-conditional
|
|
187
184
|
type: isEval ? "eval" : file.includes("[native code]") ? "native" : void 0
|
|
188
185
|
};
|
|
189
186
|
}
|
|
@@ -198,7 +195,6 @@ const parseFirefox = /* @__PURE__ */ __name((line, topFrameMeta) => {
|
|
|
198
195
|
column: parts[4] ? +parts[4] : topFrameMeta?.column ?? void 0,
|
|
199
196
|
file: parts[2],
|
|
200
197
|
line: parts[3] ? +parts[3] : topFrameMeta?.line ?? void 0,
|
|
201
|
-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
202
198
|
methodName: parts[1] || UNKNOWN_FUNCTION,
|
|
203
199
|
raw: line,
|
|
204
200
|
type: void 0
|
|
@@ -221,7 +217,7 @@ const parseReactAndroidNative = /* @__PURE__ */ __name((line) => {
|
|
|
221
217
|
}
|
|
222
218
|
return void 0;
|
|
223
219
|
}, "parseReactAndroidNative");
|
|
224
|
-
const
|
|
220
|
+
const parseStacktrace = /* @__PURE__ */ __name((error, { filter, frameLimit = 50 } = {}) => {
|
|
225
221
|
let lines = (error.stacktrace ?? error.stack ?? "").split("\n").map((line) => {
|
|
226
222
|
const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, "$1") : line;
|
|
227
223
|
return cleanedLine.replace(/^\s+|\s+$/g, "");
|
|
@@ -263,8 +259,7 @@ const parse = /* @__PURE__ */ __name((error, { filter, frameLimit = 50 } = {}) =
|
|
|
263
259
|
};
|
|
264
260
|
}
|
|
265
261
|
}
|
|
266
|
-
parseResult =
|
|
267
|
-
parseFirefox(line, topFrameMeta) || parseGecko(line, topFrameMeta);
|
|
262
|
+
parseResult = parseFirefox(line, topFrameMeta) || parseGecko(line, topFrameMeta);
|
|
268
263
|
} else {
|
|
269
264
|
parseResult = parseReactAndroidNative(line);
|
|
270
265
|
}
|
|
@@ -275,6 +270,6 @@ const parse = /* @__PURE__ */ __name((error, { filter, frameLimit = 50 } = {}) =
|
|
|
275
270
|
}
|
|
276
271
|
return stack;
|
|
277
272
|
}, []);
|
|
278
|
-
}, "
|
|
273
|
+
}, "parseStacktrace");
|
|
279
274
|
|
|
280
|
-
export {
|
|
275
|
+
export { parseStacktrace as default };
|
|
@@ -8,10 +8,7 @@ const debugLog = /* @__PURE__ */ __name((message, ...arguments_) => {
|
|
|
8
8
|
}
|
|
9
9
|
}, "debugLog");
|
|
10
10
|
const UNKNOWN_FUNCTION = "<unknown>";
|
|
11
|
-
const CHROMIUM_REGEX = (
|
|
12
|
-
// eslint-disable-next-line security/detect-unsafe-regex,regexp/no-super-linear-backtracking
|
|
13
|
-
/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i
|
|
14
|
-
);
|
|
11
|
+
const CHROMIUM_REGEX = /^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
|
|
15
12
|
const CHROMIUM_EVAL_REGEX = /\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/;
|
|
16
13
|
const CHROMIUM_MAPPED = /(.*?):(\d+):(\d+)(\s<-\s(.+):(\d+):(\d+))?/;
|
|
17
14
|
const WINDOWS_EVAL_REGEX = /(eval)\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*(<anonymous>)?:(\d+)?:(\d+)/;
|
|
@@ -47,7 +44,6 @@ const parseNode = /* @__PURE__ */ __name((line) => {
|
|
|
47
44
|
column: split[2] ? +split[2] : void 0,
|
|
48
45
|
file: split[0],
|
|
49
46
|
line: split[1] ? +split[1] : void 0,
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
51
47
|
methodName: nestedNode[1] || UNKNOWN_FUNCTION,
|
|
52
48
|
raw: line,
|
|
53
49
|
type: void 0
|
|
@@ -60,12 +56,11 @@ const parseNode = /* @__PURE__ */ __name((line) => {
|
|
|
60
56
|
column: node[4] ? +node[4] : void 0,
|
|
61
57
|
file: node[2] ? node[2].replace(/at\s/, "") : void 0,
|
|
62
58
|
line: node[3] ? +node[3] : void 0,
|
|
63
|
-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
64
59
|
methodName: node[1] || UNKNOWN_FUNCTION,
|
|
65
60
|
raw: line,
|
|
66
61
|
type: line.startsWith("internal") ? "internal" : void 0
|
|
67
62
|
};
|
|
68
|
-
parseMapped(trace, node[2]
|
|
63
|
+
parseMapped(trace, `${node[2]}:${node[3]}:${node[4]}`);
|
|
69
64
|
return trace;
|
|
70
65
|
}
|
|
71
66
|
return void 0;
|
|
@@ -81,7 +76,7 @@ const parseChromium = /* @__PURE__ */ __name((line) => {
|
|
|
81
76
|
if (isEval) {
|
|
82
77
|
const subMatch = CHROMIUM_EVAL_REGEX.exec(line);
|
|
83
78
|
if (subMatch) {
|
|
84
|
-
const split =
|
|
79
|
+
const split = /^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/.exec(subMatch[1]);
|
|
85
80
|
if (split) {
|
|
86
81
|
parts[2] = split[4] ?? split[1];
|
|
87
82
|
parts[3] = split[5] ?? split[2];
|
|
@@ -130,6 +125,7 @@ const parseChromium = /* @__PURE__ */ __name((line) => {
|
|
|
130
125
|
line: parts[3] ? +parts[3] : void 0,
|
|
131
126
|
methodName,
|
|
132
127
|
raw: line,
|
|
128
|
+
// eslint-disable-next-line sonarjs/no-nested-conditional
|
|
133
129
|
type: isEval ? "eval" : isNative ? "native" : void 0
|
|
134
130
|
};
|
|
135
131
|
if (windowsParts) {
|
|
@@ -137,7 +133,7 @@ const parseChromium = /* @__PURE__ */ __name((line) => {
|
|
|
137
133
|
trace.file = windowsParts.file;
|
|
138
134
|
trace.line = windowsParts.line;
|
|
139
135
|
} else {
|
|
140
|
-
parseMapped(trace, file
|
|
136
|
+
parseMapped(trace, `${file}:${parts[3]}:${parts[4]}`);
|
|
141
137
|
}
|
|
142
138
|
return trace;
|
|
143
139
|
}
|
|
@@ -186,6 +182,7 @@ const parseGecko = /* @__PURE__ */ __name((line, topFrameMeta) => {
|
|
|
186
182
|
line: lineNumber,
|
|
187
183
|
methodName,
|
|
188
184
|
raw: line,
|
|
185
|
+
// eslint-disable-next-line sonarjs/no-nested-conditional
|
|
189
186
|
type: isEval ? "eval" : file.includes("[native code]") ? "native" : void 0
|
|
190
187
|
};
|
|
191
188
|
}
|
|
@@ -200,7 +197,6 @@ const parseFirefox = /* @__PURE__ */ __name((line, topFrameMeta) => {
|
|
|
200
197
|
column: parts[4] ? +parts[4] : topFrameMeta?.column ?? void 0,
|
|
201
198
|
file: parts[2],
|
|
202
199
|
line: parts[3] ? +parts[3] : topFrameMeta?.line ?? void 0,
|
|
203
|
-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
204
200
|
methodName: parts[1] || UNKNOWN_FUNCTION,
|
|
205
201
|
raw: line,
|
|
206
202
|
type: void 0
|
|
@@ -223,7 +219,7 @@ const parseReactAndroidNative = /* @__PURE__ */ __name((line) => {
|
|
|
223
219
|
}
|
|
224
220
|
return void 0;
|
|
225
221
|
}, "parseReactAndroidNative");
|
|
226
|
-
const
|
|
222
|
+
const parseStacktrace = /* @__PURE__ */ __name((error, { filter, frameLimit = 50 } = {}) => {
|
|
227
223
|
let lines = (error.stacktrace ?? error.stack ?? "").split("\n").map((line) => {
|
|
228
224
|
const cleanedLine = WEBPACK_ERROR_REGEXP.test(line) ? line.replace(WEBPACK_ERROR_REGEXP, "$1") : line;
|
|
229
225
|
return cleanedLine.replace(/^\s+|\s+$/g, "");
|
|
@@ -265,8 +261,7 @@ const parse = /* @__PURE__ */ __name((error, { filter, frameLimit = 50 } = {}) =
|
|
|
265
261
|
};
|
|
266
262
|
}
|
|
267
263
|
}
|
|
268
|
-
parseResult =
|
|
269
|
-
parseFirefox(line, topFrameMeta) || parseGecko(line, topFrameMeta);
|
|
264
|
+
parseResult = parseFirefox(line, topFrameMeta) || parseGecko(line, topFrameMeta);
|
|
270
265
|
} else {
|
|
271
266
|
parseResult = parseReactAndroidNative(line);
|
|
272
267
|
}
|
|
@@ -277,6 +272,6 @@ const parse = /* @__PURE__ */ __name((error, { filter, frameLimit = 50 } = {}) =
|
|
|
277
272
|
}
|
|
278
273
|
return stack;
|
|
279
274
|
}, []);
|
|
280
|
-
}, "
|
|
275
|
+
}, "parseStacktrace");
|
|
281
276
|
|
|
282
|
-
module.exports =
|
|
277
|
+
module.exports = parseStacktrace;
|
|
@@ -3,13 +3,13 @@ import { relative } from 'node:path';
|
|
|
3
3
|
import { cwd } from 'node:process';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import { codeFrame } from '../code-frame/index.mjs';
|
|
6
|
-
import
|
|
6
|
+
import parseStacktrace from './parseStacktrace-BlguTUcF.mjs';
|
|
7
7
|
|
|
8
8
|
var __defProp = Object.defineProperty;
|
|
9
9
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
10
|
const getPrefix = /* @__PURE__ */ __name((prefix, indentation, deep) => {
|
|
11
11
|
if (deep === 0) {
|
|
12
|
-
return prefix
|
|
12
|
+
return prefix.toString();
|
|
13
13
|
}
|
|
14
14
|
if (indentation === " ") {
|
|
15
15
|
return prefix + " ".repeat(deep);
|
|
@@ -20,7 +20,15 @@ const getRelativePath = /* @__PURE__ */ __name((filePath, cwdPath) => {
|
|
|
20
20
|
const path = filePath.replace("async file:", "file:");
|
|
21
21
|
return relative(cwdPath, path.startsWith("file:") ? fileURLToPath(path) : path);
|
|
22
22
|
}, "getRelativePath");
|
|
23
|
-
const
|
|
23
|
+
const getTitleText = /* @__PURE__ */ __name((error, hideErrorTitle, color) => {
|
|
24
|
+
if (hideErrorTitle) {
|
|
25
|
+
return color.title(error.message);
|
|
26
|
+
}
|
|
27
|
+
const messagePart = error.message ? `: ${error.message}` : "";
|
|
28
|
+
return color.title(error.name + messagePart);
|
|
29
|
+
}, "getTitleText");
|
|
30
|
+
const getMessage = /* @__PURE__ */ __name((error, { color, hideErrorTitle, indentation, prefix }, deep) => `${getPrefix(prefix, indentation, deep)}${getTitleText(error, hideErrorTitle, color)}
|
|
31
|
+
`, "getMessage");
|
|
24
32
|
const getHint = /* @__PURE__ */ __name((error, { color, indentation, prefix }, deep) => {
|
|
25
33
|
if (error.hint === void 0) {
|
|
26
34
|
return void 0;
|
|
@@ -29,7 +37,8 @@ const getHint = /* @__PURE__ */ __name((error, { color, indentation, prefix }, d
|
|
|
29
37
|
let message = "";
|
|
30
38
|
if (Array.isArray(error.hint)) {
|
|
31
39
|
for (const line of error.hint) {
|
|
32
|
-
message += spaces + line
|
|
40
|
+
message += `${(spaces + line).toString()}
|
|
41
|
+
`;
|
|
33
42
|
}
|
|
34
43
|
} else {
|
|
35
44
|
message += spaces + error.hint;
|
|
@@ -39,8 +48,9 @@ const getHint = /* @__PURE__ */ __name((error, { color, indentation, prefix }, d
|
|
|
39
48
|
const getMainFrame = /* @__PURE__ */ __name((trace, { color, cwd: cwdPath, displayShortPath, indentation, prefix }, deep = 0) => {
|
|
40
49
|
const filePath = displayShortPath ? getRelativePath(trace.file, cwdPath) : trace.file;
|
|
41
50
|
const { fileLine, method } = color;
|
|
42
|
-
return getPrefix(prefix, indentation, deep)
|
|
43
|
-
|
|
51
|
+
return `${getPrefix(prefix, indentation, deep)}at ${trace.methodName ? `${method(trace.methodName)} ` : ""}${fileLine(filePath)}:${fileLine(
|
|
52
|
+
trace.line?.toString() ?? ""
|
|
53
|
+
)}`.toString();
|
|
44
54
|
}, "getMainFrame");
|
|
45
55
|
const getCode = /* @__PURE__ */ __name((trace, { color, indentation, linesAbove, linesBelow, prefix, showGutter, showLineNumbers, tabWidth }, deep) => {
|
|
46
56
|
if (trace.file === void 0) {
|
|
@@ -63,7 +73,9 @@ const getErrors = /* @__PURE__ */ __name((error, options, deep) => {
|
|
|
63
73
|
if (error.errors.length === 0) {
|
|
64
74
|
return void 0;
|
|
65
75
|
}
|
|
66
|
-
let message = getPrefix(options.prefix, options.indentation, deep)
|
|
76
|
+
let message = `${getPrefix(options.prefix, options.indentation, deep)}Errors:
|
|
77
|
+
|
|
78
|
+
`;
|
|
67
79
|
let first = true;
|
|
68
80
|
for (const error_ of error.errors) {
|
|
69
81
|
if (first) {
|
|
@@ -71,43 +83,46 @@ const getErrors = /* @__PURE__ */ __name((error, options, deep) => {
|
|
|
71
83
|
} else {
|
|
72
84
|
message += "\n\n";
|
|
73
85
|
}
|
|
74
|
-
message += internalRenderError(
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
76
|
-
error_,
|
|
77
|
-
{ ...options, framesMaxLimit: 1, hideErrorCodeView: options.hideErrorErrorsCodeView },
|
|
78
|
-
deep + 1
|
|
79
|
-
);
|
|
86
|
+
message += internalRenderError(error_, { ...options, framesMaxLimit: 1, hideErrorCodeView: options.hideErrorErrorsCodeView }, deep + 1);
|
|
80
87
|
}
|
|
81
|
-
return
|
|
88
|
+
return `
|
|
89
|
+
${message}`;
|
|
82
90
|
}, "getErrors");
|
|
83
91
|
const getCause = /* @__PURE__ */ __name((error, options, deep) => {
|
|
84
|
-
let message = getPrefix(options.prefix, options.indentation, deep)
|
|
92
|
+
let message = `${getPrefix(options.prefix, options.indentation, deep)}Caused by:
|
|
93
|
+
|
|
94
|
+
`;
|
|
85
95
|
const cause = error.cause;
|
|
86
96
|
message += getMessage(cause, options, deep);
|
|
87
|
-
const stacktrace =
|
|
97
|
+
const stacktrace = parseStacktrace(cause);
|
|
88
98
|
const mainFrame = stacktrace.shift();
|
|
89
99
|
const hint = getHint(cause, options, deep);
|
|
90
100
|
if (hint) {
|
|
91
|
-
message += hint
|
|
101
|
+
message += `${hint}
|
|
102
|
+
`;
|
|
92
103
|
}
|
|
93
104
|
if (mainFrame) {
|
|
94
105
|
message += getMainFrame(mainFrame, options, deep);
|
|
95
106
|
if (!options.hideErrorCauseCodeView) {
|
|
96
107
|
const code = getCode(mainFrame, options, deep);
|
|
97
108
|
if (code !== void 0) {
|
|
98
|
-
message +=
|
|
109
|
+
message += `
|
|
110
|
+
${code}`;
|
|
99
111
|
}
|
|
100
112
|
}
|
|
101
113
|
}
|
|
102
114
|
if (cause.cause) {
|
|
103
|
-
message +=
|
|
115
|
+
message += `
|
|
116
|
+
${getCause(cause, options, deep + 1)}`;
|
|
104
117
|
} else if (cause instanceof AggregateError) {
|
|
105
118
|
const errors = getErrors(cause, options, deep);
|
|
106
119
|
if (errors !== void 0) {
|
|
107
|
-
message +=
|
|
120
|
+
message += `
|
|
121
|
+
${errors}`;
|
|
108
122
|
}
|
|
109
123
|
}
|
|
110
|
-
return
|
|
124
|
+
return `
|
|
125
|
+
${message}`;
|
|
111
126
|
}, "getCause");
|
|
112
127
|
const getStacktrace = /* @__PURE__ */ __name((stack, options) => (stack.length > 0 ? "\n" : "") + stack.map((frame) => getMainFrame(frame, options)).join("\n"), "getStacktrace");
|
|
113
128
|
const internalRenderError = /* @__PURE__ */ __name((error, options, deep) => {
|
|
@@ -140,7 +155,7 @@ const internalRenderError = /* @__PURE__ */ __name((error, options, deep) => {
|
|
|
140
155
|
...options.color
|
|
141
156
|
}
|
|
142
157
|
};
|
|
143
|
-
const stack =
|
|
158
|
+
const stack = parseStacktrace(error, {
|
|
144
159
|
filter: options.filterStacktrace,
|
|
145
160
|
frameLimit: config.framesMaxLimit
|
|
146
161
|
});
|
|
@@ -7,13 +7,13 @@ const node_path = require('node:path');
|
|
|
7
7
|
const node_process = require('node:process');
|
|
8
8
|
const node_url = require('node:url');
|
|
9
9
|
const codeFrame_index = require('../code-frame/index.cjs');
|
|
10
|
-
const parseStacktrace = require('./parseStacktrace-
|
|
10
|
+
const parseStacktrace = require('./parseStacktrace-woJgU2XY.cjs');
|
|
11
11
|
|
|
12
12
|
var __defProp = Object.defineProperty;
|
|
13
13
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
14
14
|
const getPrefix = /* @__PURE__ */ __name((prefix, indentation, deep) => {
|
|
15
15
|
if (deep === 0) {
|
|
16
|
-
return prefix
|
|
16
|
+
return prefix.toString();
|
|
17
17
|
}
|
|
18
18
|
if (indentation === " ") {
|
|
19
19
|
return prefix + " ".repeat(deep);
|
|
@@ -24,7 +24,15 @@ const getRelativePath = /* @__PURE__ */ __name((filePath, cwdPath) => {
|
|
|
24
24
|
const path = filePath.replace("async file:", "file:");
|
|
25
25
|
return node_path.relative(cwdPath, path.startsWith("file:") ? node_url.fileURLToPath(path) : path);
|
|
26
26
|
}, "getRelativePath");
|
|
27
|
-
const
|
|
27
|
+
const getTitleText = /* @__PURE__ */ __name((error, hideErrorTitle, color) => {
|
|
28
|
+
if (hideErrorTitle) {
|
|
29
|
+
return color.title(error.message);
|
|
30
|
+
}
|
|
31
|
+
const messagePart = error.message ? `: ${error.message}` : "";
|
|
32
|
+
return color.title(error.name + messagePart);
|
|
33
|
+
}, "getTitleText");
|
|
34
|
+
const getMessage = /* @__PURE__ */ __name((error, { color, hideErrorTitle, indentation, prefix }, deep) => `${getPrefix(prefix, indentation, deep)}${getTitleText(error, hideErrorTitle, color)}
|
|
35
|
+
`, "getMessage");
|
|
28
36
|
const getHint = /* @__PURE__ */ __name((error, { color, indentation, prefix }, deep) => {
|
|
29
37
|
if (error.hint === void 0) {
|
|
30
38
|
return void 0;
|
|
@@ -33,7 +41,8 @@ const getHint = /* @__PURE__ */ __name((error, { color, indentation, prefix }, d
|
|
|
33
41
|
let message = "";
|
|
34
42
|
if (Array.isArray(error.hint)) {
|
|
35
43
|
for (const line of error.hint) {
|
|
36
|
-
message += spaces + line
|
|
44
|
+
message += `${(spaces + line).toString()}
|
|
45
|
+
`;
|
|
37
46
|
}
|
|
38
47
|
} else {
|
|
39
48
|
message += spaces + error.hint;
|
|
@@ -43,8 +52,9 @@ const getHint = /* @__PURE__ */ __name((error, { color, indentation, prefix }, d
|
|
|
43
52
|
const getMainFrame = /* @__PURE__ */ __name((trace, { color, cwd: cwdPath, displayShortPath, indentation, prefix }, deep = 0) => {
|
|
44
53
|
const filePath = displayShortPath ? getRelativePath(trace.file, cwdPath) : trace.file;
|
|
45
54
|
const { fileLine, method } = color;
|
|
46
|
-
return getPrefix(prefix, indentation, deep)
|
|
47
|
-
|
|
55
|
+
return `${getPrefix(prefix, indentation, deep)}at ${trace.methodName ? `${method(trace.methodName)} ` : ""}${fileLine(filePath)}:${fileLine(
|
|
56
|
+
trace.line?.toString() ?? ""
|
|
57
|
+
)}`.toString();
|
|
48
58
|
}, "getMainFrame");
|
|
49
59
|
const getCode = /* @__PURE__ */ __name((trace, { color, indentation, linesAbove, linesBelow, prefix, showGutter, showLineNumbers, tabWidth }, deep) => {
|
|
50
60
|
if (trace.file === void 0) {
|
|
@@ -67,7 +77,9 @@ const getErrors = /* @__PURE__ */ __name((error, options, deep) => {
|
|
|
67
77
|
if (error.errors.length === 0) {
|
|
68
78
|
return void 0;
|
|
69
79
|
}
|
|
70
|
-
let message = getPrefix(options.prefix, options.indentation, deep)
|
|
80
|
+
let message = `${getPrefix(options.prefix, options.indentation, deep)}Errors:
|
|
81
|
+
|
|
82
|
+
`;
|
|
71
83
|
let first = true;
|
|
72
84
|
for (const error_ of error.errors) {
|
|
73
85
|
if (first) {
|
|
@@ -75,43 +87,46 @@ const getErrors = /* @__PURE__ */ __name((error, options, deep) => {
|
|
|
75
87
|
} else {
|
|
76
88
|
message += "\n\n";
|
|
77
89
|
}
|
|
78
|
-
message += internalRenderError(
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
80
|
-
error_,
|
|
81
|
-
{ ...options, framesMaxLimit: 1, hideErrorCodeView: options.hideErrorErrorsCodeView },
|
|
82
|
-
deep + 1
|
|
83
|
-
);
|
|
90
|
+
message += internalRenderError(error_, { ...options, framesMaxLimit: 1, hideErrorCodeView: options.hideErrorErrorsCodeView }, deep + 1);
|
|
84
91
|
}
|
|
85
|
-
return
|
|
92
|
+
return `
|
|
93
|
+
${message}`;
|
|
86
94
|
}, "getErrors");
|
|
87
95
|
const getCause = /* @__PURE__ */ __name((error, options, deep) => {
|
|
88
|
-
let message = getPrefix(options.prefix, options.indentation, deep)
|
|
96
|
+
let message = `${getPrefix(options.prefix, options.indentation, deep)}Caused by:
|
|
97
|
+
|
|
98
|
+
`;
|
|
89
99
|
const cause = error.cause;
|
|
90
100
|
message += getMessage(cause, options, deep);
|
|
91
101
|
const stacktrace = parseStacktrace(cause);
|
|
92
102
|
const mainFrame = stacktrace.shift();
|
|
93
103
|
const hint = getHint(cause, options, deep);
|
|
94
104
|
if (hint) {
|
|
95
|
-
message += hint
|
|
105
|
+
message += `${hint}
|
|
106
|
+
`;
|
|
96
107
|
}
|
|
97
108
|
if (mainFrame) {
|
|
98
109
|
message += getMainFrame(mainFrame, options, deep);
|
|
99
110
|
if (!options.hideErrorCauseCodeView) {
|
|
100
111
|
const code = getCode(mainFrame, options, deep);
|
|
101
112
|
if (code !== void 0) {
|
|
102
|
-
message +=
|
|
113
|
+
message += `
|
|
114
|
+
${code}`;
|
|
103
115
|
}
|
|
104
116
|
}
|
|
105
117
|
}
|
|
106
118
|
if (cause.cause) {
|
|
107
|
-
message +=
|
|
119
|
+
message += `
|
|
120
|
+
${getCause(cause, options, deep + 1)}`;
|
|
108
121
|
} else if (cause instanceof AggregateError) {
|
|
109
122
|
const errors = getErrors(cause, options, deep);
|
|
110
123
|
if (errors !== void 0) {
|
|
111
|
-
message +=
|
|
124
|
+
message += `
|
|
125
|
+
${errors}`;
|
|
112
126
|
}
|
|
113
127
|
}
|
|
114
|
-
return
|
|
128
|
+
return `
|
|
129
|
+
${message}`;
|
|
115
130
|
}, "getCause");
|
|
116
131
|
const getStacktrace = /* @__PURE__ */ __name((stack, options) => (stack.length > 0 ? "\n" : "") + stack.map((frame) => getMainFrame(frame, options)).join("\n"), "getStacktrace");
|
|
117
132
|
const internalRenderError = /* @__PURE__ */ __name((error, options, deep) => {
|
|
@@ -212,7 +212,7 @@ const ruleBasedFinder = {
|
|
|
212
212
|
if (matches.length === 0) {
|
|
213
213
|
return void 0;
|
|
214
214
|
}
|
|
215
|
-
const sections = matches.
|
|
215
|
+
const sections = matches.toSorted((a, b) => (a.match.priority || 0) - (b.match.priority || 0)).map((m) => `#### ${m.match.title}
|
|
216
216
|
|
|
217
217
|
${m.match.md}`).join("\n\n---\n\n");
|
|
218
218
|
return { body: sections, header: "### Potential fixes detected" };
|
|
@@ -214,7 +214,7 @@ const ruleBasedFinder = {
|
|
|
214
214
|
if (matches.length === 0) {
|
|
215
215
|
return void 0;
|
|
216
216
|
}
|
|
217
|
-
const sections = matches.
|
|
217
|
+
const sections = matches.toSorted((a, b) => (a.match.priority || 0) - (b.match.priority || 0)).map((m) => `#### ${m.match.title}
|
|
218
218
|
|
|
219
219
|
${m.match.md}`).join("\n\n---\n\n");
|
|
220
220
|
return { body: sections, header: "### Potential fixes detected" };
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var __name$1 = (target, value) => __defProp$1(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$1(isPlainObject, "isPlainObject");
|
|
1
|
+
import { i as isPlainObject } from './index-BmoOJLvu.mjs';
|
|
11
2
|
|
|
12
3
|
const ErrorProto = Object.create(
|
|
13
4
|
{},
|
|
@@ -75,7 +66,7 @@ const serializeValue = /* @__PURE__ */ __name((value, seen, depth, options) => {
|
|
|
75
66
|
return value.toISOString();
|
|
76
67
|
}
|
|
77
68
|
if (typeof value === "function") {
|
|
78
|
-
return
|
|
69
|
+
return `[Function: ${value.name || "anonymous"}]`;
|
|
79
70
|
}
|
|
80
71
|
if (isPlainObject(value)) {
|
|
81
72
|
depth += 1;
|
|
@@ -2,16 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
var __name$1 = (target, value) => __defProp$1(target, "name", { value, configurable: true });
|
|
7
|
-
function isPlainObject(value) {
|
|
8
|
-
if (typeof value !== "object" || value === null) {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
const prototype = Object.getPrototypeOf(value);
|
|
12
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
|
|
13
|
-
}
|
|
14
|
-
__name$1(isPlainObject, "isPlainObject");
|
|
5
|
+
const index = require('./index-C53Tqb7g.cjs');
|
|
15
6
|
|
|
16
7
|
const ErrorProto = Object.create(
|
|
17
8
|
{},
|
|
@@ -79,9 +70,9 @@ const serializeValue = /* @__PURE__ */ __name((value, seen, depth, options) => {
|
|
|
79
70
|
return value.toISOString();
|
|
80
71
|
}
|
|
81
72
|
if (typeof value === "function") {
|
|
82
|
-
return
|
|
73
|
+
return `[Function: ${value.name || "anonymous"}]`;
|
|
83
74
|
}
|
|
84
|
-
if (isPlainObject(value)) {
|
|
75
|
+
if (index.isPlainObject(value)) {
|
|
85
76
|
depth += 1;
|
|
86
77
|
if (options.maxDepth && depth >= options.maxDepth) {
|
|
87
78
|
return {};
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
4
|
|
|
5
|
-
const aiFinder = require('../../packem_shared/aiFinder-
|
|
5
|
+
const aiFinder = require('../../packem_shared/aiFinder-BR9Pq804.cjs');
|
|
6
6
|
const solution_ai_aiPrompt = require('./ai-prompt.cjs');
|
|
7
|
-
const aiSolutionResponse = require('../../packem_shared/aiSolutionResponse-
|
|
7
|
+
const aiSolutionResponse = require('../../packem_shared/aiSolutionResponse-Cqi0mFxy.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -4,13 +4,13 @@ export { default as aiPrompt } from './ai-prompt.cjs';
|
|
|
4
4
|
export { a as aiSolutionResponse } from '../../packem_shared/ai-solution-response-BuaDQAEU.cjs';
|
|
5
5
|
|
|
6
6
|
interface CacheOptions {
|
|
7
|
-
enabled?: boolean;
|
|
8
7
|
directory?: string;
|
|
8
|
+
enabled?: boolean;
|
|
9
9
|
ttl?: number;
|
|
10
10
|
}
|
|
11
11
|
declare const aiFinder: (model: LanguageModel, options?: {
|
|
12
|
-
temperature?: number;
|
|
13
12
|
cache?: CacheOptions;
|
|
13
|
+
temperature?: number;
|
|
14
14
|
}) => SolutionFinder;
|
|
15
15
|
|
|
16
16
|
export { aiFinder };
|
|
@@ -4,13 +4,13 @@ export { default as aiPrompt } from './ai-prompt.mjs';
|
|
|
4
4
|
export { a as aiSolutionResponse } from '../../packem_shared/ai-solution-response-BuaDQAEU.mjs';
|
|
5
5
|
|
|
6
6
|
interface CacheOptions {
|
|
7
|
-
enabled?: boolean;
|
|
8
7
|
directory?: string;
|
|
8
|
+
enabled?: boolean;
|
|
9
9
|
ttl?: number;
|
|
10
10
|
}
|
|
11
11
|
declare const aiFinder: (model: LanguageModel, options?: {
|
|
12
|
-
temperature?: number;
|
|
13
12
|
cache?: CacheOptions;
|
|
13
|
+
temperature?: number;
|
|
14
14
|
}) => SolutionFinder;
|
|
15
15
|
|
|
16
16
|
export { aiFinder };
|
|
@@ -4,13 +4,13 @@ export { default as aiPrompt } from './ai-prompt.js';
|
|
|
4
4
|
export { a as aiSolutionResponse } from '../../packem_shared/ai-solution-response-BuaDQAEU.js';
|
|
5
5
|
|
|
6
6
|
interface CacheOptions {
|
|
7
|
-
enabled?: boolean;
|
|
8
7
|
directory?: string;
|
|
8
|
+
enabled?: boolean;
|
|
9
9
|
ttl?: number;
|
|
10
10
|
}
|
|
11
11
|
declare const aiFinder: (model: LanguageModel, options?: {
|
|
12
|
-
temperature?: number;
|
|
13
12
|
cache?: CacheOptions;
|
|
13
|
+
temperature?: number;
|
|
14
14
|
}) => SolutionFinder;
|
|
15
15
|
|
|
16
16
|
export { aiFinder };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as aiFinder } from '../../packem_shared/aiFinder-
|
|
1
|
+
export { default as aiFinder } from '../../packem_shared/aiFinder-CFHvOjD8.mjs';
|
|
2
2
|
export { default as aiPrompt } from './ai-prompt.mjs';
|
|
3
|
-
export { default as aiSolutionResponse } from '../../packem_shared/aiSolutionResponse-
|
|
3
|
+
export { default as aiSolutionResponse } from '../../packem_shared/aiSolutionResponse-BaN1M990.mjs';
|
package/dist/solution/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
4
|
|
|
5
5
|
const errorHintFinder = require('../packem_shared/errorHintFinder-DZugFHq0.cjs');
|
|
6
|
-
const ruleBasedFinder = require('../packem_shared/ruleBasedFinder-
|
|
6
|
+
const ruleBasedFinder = require('../packem_shared/ruleBasedFinder-CkybTSHw.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
package/dist/solution/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as errorHintFinder } from '../packem_shared/errorHintFinder-CQy_qIK3.mjs';
|
|
2
|
-
export { default as ruleBasedFinder } from '../packem_shared/ruleBasedFinder-
|
|
2
|
+
export { default as ruleBasedFinder } from '../packem_shared/ruleBasedFinder-Cbmc6N7f.mjs';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
4
4
|
|
|
5
|
-
const parseStacktrace = require('../packem_shared/parseStacktrace-
|
|
5
|
+
const parseStacktrace = require('../packem_shared/parseStacktrace-woJgU2XY.cjs');
|
|
6
6
|
const formatStackFrameLine = require('../packem_shared/formatStackFrameLine-DcXSX--m.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
@@ -9,7 +9,7 @@ interface Trace {
|
|
|
9
9
|
type?: TraceType | undefined;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
declare const
|
|
12
|
+
declare const parseStacktrace: (error: Error, { filter, frameLimit }?: Partial<{
|
|
13
13
|
filter?: (line: string) => boolean;
|
|
14
14
|
frameLimit: number;
|
|
15
15
|
}>) => Trace[];
|
|
@@ -22,4 +22,4 @@ declare const formatStacktrace: (frames: Trace[], options?: {
|
|
|
22
22
|
};
|
|
23
23
|
}) => string;
|
|
24
24
|
|
|
25
|
-
export { type Trace, type TraceType, formatStackFrameLine, formatStacktrace,
|
|
25
|
+
export { type Trace, type TraceType, formatStackFrameLine, formatStacktrace, parseStacktrace };
|