@visulima/error 5.0.2 → 5.0.4

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/LICENSE.md +1 -1
  3. package/dist/code-frame/index.js +125 -6
  4. package/dist/error/index.js +8 -1
  5. package/dist/index.js +16 -1
  6. package/dist/packem_shared/NonError-D5FGLYKY.js +8 -0
  7. package/dist/packem_shared/addKnownErrorConstructor-s_3SsXtQ.js +30 -0
  8. package/dist/packem_shared/aiFinder-HftEgsry.js +277 -0
  9. package/dist/packem_shared/aiSolutionResponse-CJBMLS9t.js +34 -0
  10. package/dist/packem_shared/captureRawStackTrace-ySw7cU0U.js +10 -0
  11. package/dist/packem_shared/deserializeError-E0VQnnm0.js +116 -0
  12. package/dist/packem_shared/errorHintFinder-DEaeRnRW.js +21 -0
  13. package/dist/packem_shared/formatStackFrameLine-D3_6oSWZ.js +24 -0
  14. package/dist/packem_shared/getErrorCauses-DpUsmuqw.js +43 -0
  15. package/dist/packem_shared/index-y_UPkY2Z.js +9 -0
  16. package/dist/packem_shared/indexToLineColumn-Bg8UW1bU.js +50 -0
  17. package/dist/packem_shared/isVisulimaError-DA7QsCxH.js +34 -0
  18. package/dist/packem_shared/parseStacktrace-oQvk7wYp.js +273 -0
  19. package/dist/packem_shared/renderError-C30PRFtU.js +206 -0
  20. package/dist/packem_shared/ruleBasedFinder-C2F8rQ30.js +207 -0
  21. package/dist/packem_shared/serializeError-BZ62KiYZ.js +142 -0
  22. package/dist/solution/ai/ai-prompt.js +13 -7
  23. package/dist/solution/ai/index.js +3 -1
  24. package/dist/solution/index.js +2 -1
  25. package/dist/stacktrace/index.js +2 -1
  26. package/package.json +1 -1
  27. package/dist/packem_shared/NonError-CS10kwil.js +0 -1
  28. package/dist/packem_shared/addKnownErrorConstructor-BqqnTSZp.js +0 -1
  29. package/dist/packem_shared/aiFinder-McmYwPGR.js +0 -1
  30. package/dist/packem_shared/aiSolutionResponse-RD0AK1jh.js +0 -10
  31. package/dist/packem_shared/captureRawStackTrace-CQPNHvBG.js +0 -1
  32. package/dist/packem_shared/deserializeError-BJM8Kd6G.js +0 -1
  33. package/dist/packem_shared/errorHintFinder-C_g0nvml.js +0 -2
  34. package/dist/packem_shared/formatStackFrameLine-iU54KA81.js +0 -2
  35. package/dist/packem_shared/getErrorCauses-geeK5cwE.js +0 -1
  36. package/dist/packem_shared/index-CLFYRLyq.js +0 -1
  37. package/dist/packem_shared/indexToLineColumn-B1F7aNZh.js +0 -1
  38. package/dist/packem_shared/isVisulimaError-jVZgumOU.js +0 -1
  39. package/dist/packem_shared/parseStacktrace-Dnxnc4PL.js +0 -2
  40. package/dist/packem_shared/renderError-ZMlMvw1N.js +0 -18
  41. package/dist/packem_shared/ruleBasedFinder-P88d0gpK.js +0 -34
  42. package/dist/packem_shared/serializeError-CTpDr3CL.js +0 -1
@@ -0,0 +1,206 @@
1
+ import { createRequire as __cjs_createRequire } from "node:module";
2
+
3
+ const __cjs_require = __cjs_createRequire(import.meta.url);
4
+
5
+ const __cjs_getProcess = typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" ? globalThis.process : process;
6
+
7
+ const __cjs_getBuiltinModule = (module) => {
8
+ // Check if we're in Node.js and version supports getBuiltinModule
9
+ if (typeof __cjs_getProcess !== "undefined" && __cjs_getProcess.versions && __cjs_getProcess.versions.node) {
10
+ const [major, minor] = __cjs_getProcess.versions.node.split(".").map(Number);
11
+ // Node.js 20.16.0+ and 22.3.0+
12
+ if (major > 22 || (major === 22 && minor >= 3) || (major === 20 && minor >= 16)) {
13
+ return __cjs_getProcess.getBuiltinModule(module);
14
+ }
15
+ }
16
+ // Fallback to createRequire
17
+ return __cjs_require(module);
18
+ };
19
+
20
+ const {
21
+ existsSync,
22
+ readFileSync
23
+ } = __cjs_getBuiltinModule("node:fs");
24
+ const {
25
+ relative
26
+ } = __cjs_getBuiltinModule("node:path");
27
+ const {
28
+ cwd
29
+ } = __cjs_getProcess;
30
+ const {
31
+ fileURLToPath
32
+ } = __cjs_getBuiltinModule("node:url");
33
+ import { codeFrame } from '../code-frame/index.js';
34
+ import parseStacktrace from './parseStacktrace-oQvk7wYp.js';
35
+
36
+ const getPrefix = (prefix, indentation, deep) => {
37
+ if (deep === 0) {
38
+ return prefix.toString();
39
+ }
40
+ if (indentation === " ") {
41
+ return prefix + " ".repeat(deep);
42
+ }
43
+ return prefix + " ".repeat(indentation * deep);
44
+ };
45
+ const getRelativePath = (filePath, cwdPath) => {
46
+ const path = filePath.replace("async file:", "file:");
47
+ return relative(cwdPath, path.startsWith("file:") ? fileURLToPath(path) : path);
48
+ };
49
+ const getTitleText = (error, hideErrorTitle, color) => {
50
+ if (hideErrorTitle) {
51
+ return color.title(error.message);
52
+ }
53
+ const messagePart = error.message ? `: ${error.message}` : "";
54
+ return color.title(error.name + messagePart);
55
+ };
56
+ const getMessage = (error, { color, hideErrorTitle, indentation, prefix }, deep) => `${getPrefix(prefix, indentation, deep)}${getTitleText(error, hideErrorTitle, color)}
57
+ `;
58
+ const getHint = (error, { color, indentation, prefix }, deep) => {
59
+ if (error.hint === void 0) {
60
+ return void 0;
61
+ }
62
+ const spaces = getPrefix(prefix, indentation, deep);
63
+ let message = "";
64
+ if (Array.isArray(error.hint)) {
65
+ for (const line of error.hint) {
66
+ message += `${(spaces + line).toString()}
67
+ `;
68
+ }
69
+ } else {
70
+ message += spaces + error.hint;
71
+ }
72
+ return color.hint(message);
73
+ };
74
+ const getMainFrame = (trace, { color, cwd: cwdPath, displayShortPath, indentation, prefix }, deep = 0) => {
75
+ const filePath = displayShortPath ? getRelativePath(trace.file, cwdPath) : trace.file;
76
+ const { fileLine, method } = color;
77
+ return `${getPrefix(prefix, indentation, deep)}at ${trace.methodName ? `${method(trace.methodName)} ` : ""}${fileLine(filePath)}:${fileLine(
78
+ trace.line?.toString() ?? ""
79
+ )}`.toString();
80
+ };
81
+ const getCode = (trace, { color, indentation, linesAbove, linesBelow, prefix, showGutter, showLineNumbers, tabWidth }, deep) => {
82
+ if (trace.file === void 0) {
83
+ return void 0;
84
+ }
85
+ const filePath = trace.file.replace("file://", "");
86
+ if (!existsSync(filePath)) {
87
+ return void 0;
88
+ }
89
+ const fileContent = readFileSync(filePath, "utf8");
90
+ return codeFrame(
91
+ fileContent,
92
+ {
93
+ start: { column: trace.column, line: trace.line }
94
+ },
95
+ { color, linesAbove, linesBelow, prefix: getPrefix(prefix, indentation, deep), showGutter, showLineNumbers, tabWidth }
96
+ );
97
+ };
98
+ const getErrors = (error, options, deep) => {
99
+ if (error.errors.length === 0) {
100
+ return void 0;
101
+ }
102
+ let message = `${getPrefix(options.prefix, options.indentation, deep)}Errors:
103
+
104
+ `;
105
+ let first = true;
106
+ for (const error_ of error.errors) {
107
+ if (first) {
108
+ first = false;
109
+ } else {
110
+ message += "\n\n";
111
+ }
112
+ message += internalRenderError(error_, { ...options, framesMaxLimit: 1, hideErrorCodeView: options.hideErrorErrorsCodeView }, deep + 1);
113
+ }
114
+ return `
115
+ ${message}`;
116
+ };
117
+ const getCause = (error, options, deep) => {
118
+ let message = `${getPrefix(options.prefix, options.indentation, deep)}Caused by:
119
+
120
+ `;
121
+ const cause = error.cause;
122
+ message += getMessage(cause, options, deep);
123
+ const stacktrace = parseStacktrace(cause);
124
+ const mainFrame = stacktrace.shift();
125
+ const hint = getHint(cause, options, deep);
126
+ if (hint) {
127
+ message += `${hint}
128
+ `;
129
+ }
130
+ if (mainFrame) {
131
+ message += getMainFrame(mainFrame, options, deep);
132
+ if (!options.hideErrorCauseCodeView) {
133
+ const code = getCode(mainFrame, options, deep);
134
+ if (code !== void 0) {
135
+ message += `
136
+ ${code}`;
137
+ }
138
+ }
139
+ }
140
+ if (cause.cause) {
141
+ message += `
142
+ ${getCause(cause, options, deep + 1)}`;
143
+ } else if (cause instanceof AggregateError) {
144
+ const errors = getErrors(cause, options, deep);
145
+ if (errors !== void 0) {
146
+ message += `
147
+ ${errors}`;
148
+ }
149
+ }
150
+ return `
151
+ ${message}`;
152
+ };
153
+ const getStacktrace = (stack, options) => (stack.length > 0 ? "\n" : "") + stack.map((frame) => getMainFrame(frame, options)).join("\n");
154
+ const internalRenderError = (error, options, deep) => {
155
+ const config = {
156
+ cwd: cwd(),
157
+ displayShortPath: false,
158
+ filterStacktrace: void 0,
159
+ framesMaxLimit: Number.POSITIVE_INFINITY,
160
+ hideErrorCauseCodeView: false,
161
+ hideErrorCodeView: false,
162
+ hideErrorErrorsCodeView: false,
163
+ hideErrorTitle: false,
164
+ hideMessage: false,
165
+ indentation: 4,
166
+ linesAbove: 2,
167
+ linesBelow: 3,
168
+ prefix: "",
169
+ showGutter: true,
170
+ showLineNumbers: true,
171
+ tabWidth: 4,
172
+ ...options,
173
+ color: {
174
+ fileLine: (value) => value,
175
+ gutter: (value) => value,
176
+ hint: (value) => value,
177
+ marker: (value) => value,
178
+ message: (value) => value,
179
+ method: (value) => value,
180
+ title: (value) => value,
181
+ ...options.color
182
+ }
183
+ };
184
+ const stack = parseStacktrace(error, {
185
+ filter: options.filterStacktrace,
186
+ frameLimit: config.framesMaxLimit
187
+ });
188
+ const mainFrame = stack.shift();
189
+ return [
190
+ options.hideMessage ? void 0 : getMessage(error, config, deep),
191
+ getHint(error, config, deep),
192
+ mainFrame ? getMainFrame(mainFrame, config, deep) : void 0,
193
+ mainFrame && !config.hideErrorCodeView ? getCode(mainFrame, config, deep) : void 0,
194
+ error instanceof AggregateError ? getErrors(error, config, deep) : void 0,
195
+ error.cause === void 0 ? void 0 : getCause(error, config, deep),
196
+ stack.length > 0 ? getStacktrace(stack, config) : void 0
197
+ ].filter(Boolean).join("\n").replaceAll("\\", "/");
198
+ };
199
+ const renderError = (error, options = {}) => {
200
+ if (options.framesMaxLimit !== void 0 && options.framesMaxLimit <= 0) {
201
+ throw new RangeError("The 'framesMaxLimit' option must be a positive number");
202
+ }
203
+ return internalRenderError(error, options, 0);
204
+ };
205
+
206
+ export { renderError };
@@ -0,0 +1,207 @@
1
+ const code = (s) => `\`\`\`
2
+ ${s.trim()}
3
+ \`\`\``;
4
+ const bash = (s) => `\`\`\`bash
5
+ ${s.trim()}
6
+ \`\`\``;
7
+ const ts = (s) => `\`\`\`ts
8
+ ${s.trim()}
9
+ \`\`\``;
10
+ const js = (s) => `\`\`\`js
11
+ ${s.trim()}
12
+ \`\`\``;
13
+ const has = (message, ...needles) => {
14
+ const lower = message.toLowerCase();
15
+ return needles.some((n) => lower.includes(n.toLowerCase()));
16
+ };
17
+ const rules = [
18
+ {
19
+ name: "esm-cjs-interop",
20
+ test: (error) => {
21
+ const message = (error?.message || String(error || "")).toString();
22
+ if (has(
23
+ message,
24
+ "err_require_esm",
25
+ "cannot use import statement outside a module",
26
+ "must use import to load es module",
27
+ "require() of es module",
28
+ "does not provide an export named"
29
+ )) {
30
+ return {
31
+ md: [
32
+ "Your project or a dependency may be mixing CommonJS and ES Modules.",
33
+ "",
34
+ "Try:",
35
+ "- Ensure package.json has the correct `type` (either `module` or `commonjs`).",
36
+ "- Use dynamic `import()` when requiring ESM from CJS.",
37
+ "- Prefer ESM-compatible entrypoints from dependencies.",
38
+ "- In Node, align `module` resolution with your bundler config.",
39
+ "",
40
+ "Check Node resolution:",
41
+ bash("node -v\ncat package.json | jq .type"),
42
+ "",
43
+ "Example dynamic import in CJS:",
44
+ js("(async () => { const mod = await import('some-esm'); mod.default(); })();")
45
+ ].join("\n"),
46
+ title: "ESM/CJS interop"
47
+ };
48
+ }
49
+ return void 0;
50
+ }
51
+ },
52
+ {
53
+ name: "missing-default-export",
54
+ test: (error) => {
55
+ const message = (error?.message || String(error || "")).toString();
56
+ if (has(message, "default export not found", "has no default export", "does not provide an export named 'default'", "is not exported from")) {
57
+ return {
58
+ md: [
59
+ "Verify your import/export shapes.",
60
+ "",
61
+ "Default export example:",
62
+ ts("export default function Component() {}\n// import Component from './file'"),
63
+ "",
64
+ "Named export example:",
65
+ ts("export function Component() {}\n// import { Component } from './file'")
66
+ ].join("\n"),
67
+ title: "Export mismatch (default vs named)"
68
+ };
69
+ }
70
+ return void 0;
71
+ }
72
+ },
73
+ {
74
+ name: "port-in-use",
75
+ test: (error) => {
76
+ const message = (error?.message || String(error || "")).toString();
77
+ if (has(message, "eaddrinuse", "address already in use", "listen eaddrinuse")) {
78
+ return {
79
+ md: [
80
+ "Another process is using the port.",
81
+ "",
82
+ "Change the port or stop the other process.",
83
+ "",
84
+ "On macOS/Linux:",
85
+ bash("lsof -i :3000\nkill -9 <PID>"),
86
+ "",
87
+ "On Windows (PowerShell):",
88
+ bash("netstat -ano | findstr :3000\ntaskkill /PID <PID> /F")
89
+ ].join("\n"),
90
+ title: "Port already in use"
91
+ };
92
+ }
93
+ return void 0;
94
+ }
95
+ },
96
+ {
97
+ name: "file-not-found-or-case",
98
+ test: (error, file) => {
99
+ const message = (error?.message || String(error || "")).toString();
100
+ if (has(message, "enoent", "module not found", "cannot find module")) {
101
+ return {
102
+ md: [
103
+ "Check the import path and filename case (Linux/macOS are case-sensitive).",
104
+ "If using TS path aliases, verify `tsconfig.paths` and bundler aliases.",
105
+ "",
106
+ "Current file:",
107
+ code(`${file.file}:${file.line}`)
108
+ ].join("\n"),
109
+ title: "Missing file or path case mismatch"
110
+ };
111
+ }
112
+ return void 0;
113
+ }
114
+ },
115
+ {
116
+ name: "ts-path-mapping",
117
+ test: (error) => {
118
+ const message = (error?.message || String(error || "")).toString();
119
+ if (has(message, "ts2307", "cannot find module") || message.includes("TS2307")) {
120
+ return {
121
+ md: [
122
+ "If you use path aliases, align TS `paths` with Vite/Webpack resolve aliases.",
123
+ "Ensure file extensions are correct and included in resolver.",
124
+ "",
125
+ "tsconfig.json excerpt:",
126
+ ts(`{
127
+ "compilerOptions": {
128
+ "baseUrl": ".",
129
+ "paths": { "@/*": ["src/*"] }
130
+ }
131
+ }`)
132
+ ].join("\n"),
133
+ title: "TypeScript path mapping / resolution"
134
+ };
135
+ }
136
+ return void 0;
137
+ }
138
+ },
139
+ {
140
+ name: "network-dns-enotfound",
141
+ test: (error) => {
142
+ const message = (error?.message || String(error || "")).toString();
143
+ if (has(message, "enotfound", "getaddrinfo enotfound", "dns", "fetch failed", "ecconnrefused", "econnrefused")) {
144
+ return {
145
+ md: [
146
+ "The host may be unreachable or misconfigured.",
147
+ "",
148
+ "Try:",
149
+ "- Verify the hostname and protocol (http/https).",
150
+ "- Check VPN/proxy and firewall.",
151
+ "- Confirm the service is running and listening on the expected port.",
152
+ "",
153
+ bash("ping <host>\nnslookup <host>\ncurl -v http://<host>:<port>")
154
+ ].join("\n"),
155
+ title: "Network/DNS connection issue"
156
+ };
157
+ }
158
+ return void 0;
159
+ }
160
+ },
161
+ {
162
+ name: "undefined-property",
163
+ test: (error) => {
164
+ const message = (error?.message || String(error || "")).toString();
165
+ if (has(message, "cannot read properties of undefined", "reading '")) {
166
+ return {
167
+ md: [
168
+ "A variable or function returned `undefined`.",
169
+ "",
170
+ "Mitigations:",
171
+ "- Add nullish checks before property access.",
172
+ "- Validate function return values and input props/state.",
173
+ "",
174
+ ts("const value = maybe?.prop; // or: if (maybe) { use(maybe.prop) }")
175
+ ].join("\n"),
176
+ title: "Accessing property of undefined"
177
+ };
178
+ }
179
+ return void 0;
180
+ }
181
+ }
182
+ ];
183
+ const ruleBasedFinder = {
184
+ handle: async (error, file) => {
185
+ try {
186
+ const matches = rules.map((r) => {
187
+ return { match: r.test(error, file), rule: r };
188
+ }).filter((x) => Boolean(x.match));
189
+ if (matches.length === 0) {
190
+ return void 0;
191
+ }
192
+ const sections = matches.toSorted((a, b) => (a.match.priority || 0) - (b.match.priority || 0)).map((m) => `#### ${m.match.title}
193
+
194
+ ${m.match.md}`).join("\n\n---\n\n");
195
+ if (sections === "") {
196
+ return void 0;
197
+ }
198
+ return { body: sections, header: "### Potential fixes detected" };
199
+ } catch {
200
+ return void 0;
201
+ }
202
+ },
203
+ name: "ruleBasedHints",
204
+ priority: 0
205
+ };
206
+
207
+ export { ruleBasedFinder as default };
@@ -0,0 +1,142 @@
1
+ import { i as isPlainObject } from './index-y_UPkY2Z.js';
2
+
3
+ const ErrorProto = Object.create(
4
+ {},
5
+ {
6
+ cause: {
7
+ enumerable: true,
8
+ value: void 0,
9
+ writable: true
10
+ },
11
+ code: {
12
+ enumerable: true,
13
+ value: void 0,
14
+ writable: true
15
+ },
16
+ errors: {
17
+ enumerable: true,
18
+ value: void 0,
19
+ writable: true
20
+ },
21
+ message: {
22
+ enumerable: true,
23
+ value: void 0,
24
+ writable: true
25
+ },
26
+ name: {
27
+ enumerable: true,
28
+ value: void 0,
29
+ writable: true
30
+ },
31
+ stack: {
32
+ enumerable: true,
33
+ value: void 0,
34
+ writable: true
35
+ }
36
+ }
37
+ );
38
+
39
+ const toJsonWasCalled = /* @__PURE__ */ new WeakSet();
40
+ const toJSON = (from) => {
41
+ toJsonWasCalled.add(from);
42
+ const json = from.toJSON();
43
+ toJsonWasCalled.delete(from);
44
+ return json;
45
+ };
46
+ const serializeValue = (value, seen, depth, options) => {
47
+ if (value && value instanceof Uint8Array && value.constructor.name === "Buffer") {
48
+ return "[object Buffer]";
49
+ }
50
+ if (value !== null && typeof value === "object" && typeof value.pipe === "function") {
51
+ return "[object Stream]";
52
+ }
53
+ if (value instanceof Error) {
54
+ if (seen.includes(value)) {
55
+ return "[Circular]";
56
+ }
57
+ depth += 1;
58
+ return _serialize(value, options, seen, depth);
59
+ }
60
+ if (options.useToJSON && typeof value.toJSON === "function") {
61
+ return value.toJSON();
62
+ }
63
+ if (typeof value === "object" && value instanceof Date) {
64
+ return value.toISOString();
65
+ }
66
+ if (typeof value === "function") {
67
+ return `[Function: ${value.name || "anonymous"}]`;
68
+ }
69
+ if (isPlainObject(value)) {
70
+ depth += 1;
71
+ if (options.maxDepth && depth >= options.maxDepth) {
72
+ return {};
73
+ }
74
+ const plainObject = {};
75
+ for (const key in value) {
76
+ plainObject[key] = serializeValue(value[key], seen, depth, options);
77
+ }
78
+ return plainObject;
79
+ }
80
+ try {
81
+ return value;
82
+ } catch {
83
+ return "[Not Available]";
84
+ }
85
+ };
86
+ const _serialize = (error, options, seen, depth) => {
87
+ seen.push(error);
88
+ if (options.maxDepth === 0) {
89
+ return {};
90
+ }
91
+ if (options.useToJSON && typeof error.toJSON === "function" && !toJsonWasCalled.has(error)) {
92
+ return toJSON(error);
93
+ }
94
+ const protoError = Object.create(ErrorProto);
95
+ protoError.name = Object.prototype.toString.call(error.constructor) === "[object Function]" ? error.constructor.name : error.name;
96
+ protoError.message = error.message;
97
+ protoError.stack = error.stack;
98
+ if (Array.isArray(error.errors)) {
99
+ const aggregateErrors = [];
100
+ for (const aggregateError of error.errors) {
101
+ if (!(aggregateError instanceof Error)) {
102
+ throw new TypeError("All errors in the 'errors' property must be instances of Error");
103
+ }
104
+ if (seen.includes(aggregateError)) {
105
+ protoError.errors = [];
106
+ return protoError;
107
+ }
108
+ aggregateErrors.push(_serialize(aggregateError, options, seen, depth));
109
+ }
110
+ protoError.errors = aggregateErrors;
111
+ }
112
+ if (error.cause instanceof Error && !seen.includes(error.cause)) {
113
+ protoError.cause = _serialize(error.cause, options, seen, depth);
114
+ }
115
+ for (const key in error) {
116
+ if (protoError[key] === void 0) {
117
+ const value = error[key];
118
+ protoError[key] = serializeValue(value, seen, depth, options);
119
+ }
120
+ }
121
+ if (Array.isArray(options.exclude) && options.exclude.length > 0) {
122
+ for (const key of options.exclude) {
123
+ try {
124
+ delete protoError[key];
125
+ } catch {
126
+ }
127
+ }
128
+ }
129
+ return protoError;
130
+ };
131
+ const serialize = (error, options = {}) => _serialize(
132
+ error,
133
+ {
134
+ exclude: options.exclude ?? [],
135
+ maxDepth: options.maxDepth ?? Number.POSITIVE_INFINITY,
136
+ useToJSON: options.useToJSON ?? false
137
+ },
138
+ [],
139
+ 0
140
+ );
141
+
142
+ export { serialize };
@@ -1,6 +1,10 @@
1
- var o=Object.defineProperty;var n=(e,i)=>o(e,"name",{value:i,configurable:!0});var a=Object.defineProperty,l=n((e,i)=>a(e,"name",{value:i,configurable:!0}),"t");const r=l(({applicationType:e,error:i,file:t})=>`You are a very skilled ${t.language} programmer.
1
+ const aiPrompt = ({
2
+ applicationType,
3
+ error,
4
+ file
5
+ }) => `You are a very skilled ${file.language} programmer.
2
6
 
3
- ${e?`You are working on a ${e} application.`:""}
7
+ ${applicationType ? `You are working on a ${applicationType} application.` : ""}
4
8
 
5
9
  Use the following context to find a possible fix for the exception message at the end. Limit your answer to 4 or 5 sentences. Also include a few links to documentation that might help.
6
10
 
@@ -17,16 +21,18 @@ ENDLINKS
17
21
 
18
22
  Here comes the context and the exception message:
19
23
 
20
- Line: ${t.line}
24
+ Line: ${file.line}
21
25
 
22
26
  File:
23
- ${t.file}
27
+ ${file.file}
24
28
 
25
29
  Snippet including line numbers:
26
- ${t.snippet}
30
+ ${file.snippet}
27
31
 
28
32
  Exception class:
29
- ${i.name}
33
+ ${error.name}
30
34
 
31
35
  Exception message:
32
- ${i.message}`,"aiPrompt");export{r as default};
36
+ ${error.message}`;
37
+
38
+ export { aiPrompt as default };
@@ -1 +1,3 @@
1
- import{default as e}from"../../packem_shared/aiFinder-McmYwPGR.js";import{default as t}from"./ai-prompt.js";import{default as i}from"../../packem_shared/aiSolutionResponse-RD0AK1jh.js";export{e as aiFinder,t as aiPrompt,i as aiSolutionResponse};
1
+ export { default as aiFinder } from '../../packem_shared/aiFinder-HftEgsry.js';
2
+ export { default as aiPrompt } from './ai-prompt.js';
3
+ export { default as aiSolutionResponse } from '../../packem_shared/aiSolutionResponse-CJBMLS9t.js';
@@ -1 +1,2 @@
1
- import{default as a}from"../packem_shared/errorHintFinder-C_g0nvml.js";import{default as o}from"../packem_shared/ruleBasedFinder-P88d0gpK.js";export{a as errorHintFinder,o as ruleBasedFinder};
1
+ export { default as errorHintFinder } from '../packem_shared/errorHintFinder-DEaeRnRW.js';
2
+ export { default as ruleBasedFinder } from '../packem_shared/ruleBasedFinder-C2F8rQ30.js';
@@ -1 +1,2 @@
1
- import{default as t}from"../packem_shared/parseStacktrace-Dnxnc4PL.js";import{formatStackFrameLine as o,formatStacktrace as c}from"../packem_shared/formatStackFrameLine-iU54KA81.js";export{o as formatStackFrameLine,c as formatStacktrace,t as parseStacktrace};
1
+ export { default as parseStacktrace } from '../packem_shared/parseStacktrace-oQvk7wYp.js';
2
+ export { formatStackFrameLine, formatStacktrace } from '../packem_shared/formatStackFrameLine-D3_6oSWZ.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/error",
3
- "version": "5.0.2",
3
+ "version": "5.0.4",
4
4
  "description": "Error with more than just a message, stacktrace parsing.",
5
5
  "keywords": [
6
6
  "anolilab",
@@ -1 +0,0 @@
1
- var a=Object.defineProperty;var t=(e,r)=>a(e,"name",{value:r,configurable:!0});var o=Object.defineProperty,s=t((e,r)=>o(e,"name",{value:r,configurable:!0}),"s");class c extends Error{static{t(this,"e")}static{s(this,"NonError")}constructor(r){super(r),this.name="NonError"}}export{c as default};
@@ -1 +0,0 @@
1
- var c=Object.defineProperty;var E=(r,o)=>c(r,"name",{value:o,configurable:!0});var g=Object.defineProperty,t=E((r,o)=>g(r,"name",{value:o,configurable:!0}),"n");const e=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&e.set("AggregateError",AggregateError);const w=t((r,o)=>{let a;try{a=new r}catch(s){throw new Error(`The error constructor "${r.name}" is not compatible`,{cause:s})}const n=o??a.name;if(e.has(n))throw new Error(`The error constructor "${n}" is already known.`);e.set(n,r)},"addKnownErrorConstructor"),p=t(()=>new Map(e),"getKnownErrorConstructors"),u=t(r=>e.get(r),"getErrorConstructor"),y=t(r=>r!==null&&typeof r=="object"&&typeof r.name=="string"&&typeof r.message=="string"&&(u(r.name)!==void 0||r.name==="Error"),"isErrorLike");export{w as addKnownErrorConstructor,u as getErrorConstructor,p as getKnownErrorConstructors,y as isErrorLike};
@@ -1 +0,0 @@
1
- var Tt=Object.defineProperty;var F=(n,o)=>Tt(n,"name",{value:o,configurable:!0});import{createRequire as Bt}from"node:module";import Wt from"../solution/ai/ai-prompt.js";import J from"./aiSolutionResponse-RD0AK1jh.js";const $e=Bt(import.meta.url),Z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Y=F(n=>{if(typeof Z<"u"&&Z.versions&&Z.versions.node){const[o,i]=Z.versions.node.split(".").map(Number);if(o>22||o===22&&i>=3||o===20&&i>=16)return Z.getBuiltinModule(n)}return $e(n)},"__cjs_getBuiltinModule"),{createHash:Dt}=Y("node:crypto"),{existsSync:be,readFileSync:Et,mkdirSync:Ft,writeFileSync:Nt}=Y("node:fs"),{tmpdir:qt}=Y("node:os"),{generateText:Rt}=$e("ai");var Jt=Object.defineProperty,Lt=F((n,o)=>Jt(n,"name",{value:o,configurable:!0}),"ce"),Gt=Object.defineProperty,Q=Lt((n,o)=>Gt(n,"name",{value:o,configurable:!0}),"C"),Kt=Object.defineProperty,c=Q((n,o)=>Kt(n,"name",{value:o,configurable:!0}),"u$1");let ge=c(()=>{var n=(()=>{var o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,m=c((e,t)=>{for(var r in t)o(e,r,{get:t[r],enumerable:!0})},"J"),b=c((e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of u(t))!d.call(e,s)&&s!==r&&o(e,s,{get:c(()=>t[s],"get"),enumerable:!(a=i(t,s))||a.enumerable});return e},"T"),g=c(e=>b(o({},"__esModule",{value:!0}),e),"W"),k={};m(k,{zeptomatch:c(()=>Ct,"zeptomatch")});var j=c(e=>Array.isArray(e),"k"),x=c(e=>typeof e=="function","x"),O=c(e=>e.length===0,"K"),S=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return r=>(r.length===0||r.length===1)&&t.test(e.call(r))})(),Oe=c(e=>typeof e=="number","Y"),Me=c(e=>typeof e=="object"&&e!==null,"rr"),_e=c(e=>e instanceof RegExp,"er"),ze=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),ke=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),V=c(e=>typeof e=="string","M"),M=c(e=>e===void 0,"f"),Ce=c(e=>{const t=new Map;return r=>{const a=t.get(r);if(a!==void 0)return a;const s=e(r);return t.set(r,s),s}},"ar"),Pe=c((e,t,r={})=>{const a={cache:{},input:e,index:0,indexBacktrackMax:0,options:r,output:[]},s=_(t)(a),f=Math.max(a.index,a.indexBacktrackMax);if(s&&a.index===e.length)return a.output;throw new Error(`Failed to parse at index ${f}`)},"or"),l=c((e,t)=>j(e)?Se(e,t):V(e)?X(e,t):Ie(e,t),"o"),Se=c((e,t)=>{const r={};for(const a of e){if(a.length!==1)throw new Error(`Invalid character: "${a}"`);const s=a.charCodeAt(0);r[s]=!0}return a=>{const s=a.input;let f=a.index,p=f;for(;p<s.length&&s.charCodeAt(p)in r;)p+=1;if(p>f){if(!M(t)&&!a.options.silent){const h=s.slice(f,p),$=x(t)?t(h,s,`${f}`):t;M($)||a.output.push($)}a.index=p}return!0}},"ir"),Ie=c((e,t)=>{if(ke(e))return X(e.source,t);{const r=e.source,a=e.flags.replace(/y|$/,"y"),s=new RegExp(r,a);return ze(e)&&x(t)&&!S(t)?Ze(s,t):Te(s,t)}},"ur"),Ze=c((e,t)=>r=>{const a=r.index,s=r.input;e.lastIndex=a;const f=e.exec(s);if(f){const p=e.lastIndex;if(!r.options.silent){const h=t(...f,s,`${a}`);M(h)||r.output.push(h)}return r.index=p,!0}else return!1},"sr"),Te=c((e,t)=>r=>{const a=r.index,s=r.input;if(e.lastIndex=a,e.test(s)){const f=e.lastIndex;if(!M(t)&&!r.options.silent){const p=x(t)?t(s.slice(a,f),s,`${a}`):t;M(p)||r.output.push(p)}return r.index=f,!0}else return!1},"cr"),X=c((e,t)=>r=>{const a=r.index,s=r.input;if(s.startsWith(e,a)){if(!M(t)&&!r.options.silent){const f=x(t)?t(e,s,`${a}`):t;M(f)||r.output.push(f)}return r.index+=e.length,!0}else return!1},"R"),ee=c((e,t,r,a)=>{const s=_(e),f=t>1;return q(N(te(p=>{let h=0;for(;h<r;){const $=p.index;if(!s(p)||(h+=1,p.index===$))break}return h>=t},f),a))},"O"),Be=c((e,t)=>ee(e,0,1,t),"lr"),B=c((e,t)=>ee(e,0,1/0,t),"m"),D=c((e,t)=>{const r=e.map(_);return q(N(te(a=>{for(let s=0,f=r.length;s<f;s++)if(!r[s](a))return!1;return!0}),t))},"S"),w=c((e,t)=>{const r=e.map(_);return q(N(a=>{for(let s=0,f=r.length;s<f;s++)if(r[s](a))return!0;return!1},t))},"p"),te=c((e,t=!0,r=!1)=>{const a=_(e);return t?s=>{const f=s.index,p=s.output.length,h=a(s);return!h&&!r&&(s.indexBacktrackMax=Math.max(s.indexBacktrackMax,s.index)),(!h||r)&&(s.index=f,s.output.length!==p&&(s.output.length=p)),h}:a},"P"),N=c((e,t)=>{const r=_(e);return t?a=>{if(a.options.silent)return r(a);const s=a.output.length;if(r(a)){const f=a.output.splice(s,1/0),p=t(f);return M(p)||a.output.push(p),!0}else return!1}:r},"C"),q=(()=>{let e=0;return t=>{const r=_(t),a=e+=1;return s=>{var f;if(s.options.memoization===!1)return r(s);const p=s.index,h=(f=s.cache)[a]||(f[a]={indexMax:-1,queue:[]}),$=h.queue;if(p<=h.indexMax){const I=h.store||(h.store=new Map);if($.length){for(let P=0,St=$.length;P<St;P+=2){const It=$[P*2],Zt=$[P*2+1];I.set(It,Zt)}$.length=0}const v=I.get(p);if(v===!1)return!1;if(Oe(v))return s.index=v,!0;if(v)return s.index=v.index,v.output?.length&&s.output.push(...v.output),!0}const he=s.output.length,Pt=r(s);if(h.indexMax=Math.max(h.indexMax,p),Pt){const I=s.index,v=s.output.length;if(v>he){const P=s.output.slice(he,v);$.push(p,{index:I,output:P})}else $.push(p,I);return!0}else return $.push(p,!1),!1}}})(),ne=c(e=>{let t;return r=>(t||(t=_(e())),t(r))},"A"),_=Ce(e=>{if(x(e))return O(e)?ne(e):e;if(V(e)||_e(e))return l(e);if(j(e))return D(e);if(Me(e))return w(Object.values(e));throw new Error("Invalid rule")}),A=c(e=>e,"v"),re=c(e=>t=>Pe(t,e,{memoization:!1}).join(""),"z"),De=c(e=>{const t={};return r=>t[r]??(t[r]=e(r))},"pr"),oe="abcdefghijklmnopqrstuvwxyz",Ee=c(e=>{let t="";for(;e>0;){const r=(e-1)%26;t=oe[r]+t,e=Math.floor((e-1)/26)}return t},"vr"),ie=c(e=>{let t=0;for(let r=0,a=e.length;r<a;r++)t=t*26+oe.indexOf(e[r])+1;return t},"N"),R=c((e,t)=>{if(t<e)return R(t,e);const r=[];for(;e<=t;)r.push(e++);return r},"$"),Fe=c((e,t,r)=>R(e,t).map(a=>String(a).padStart(r,"0")),"fr"),se=c((e,t)=>R(ie(e),ie(t)).map(Ee),"j"),W=l(/\\./,A),Ne=l(/[$.*+?^(){}[\]\|]/,e=>`\\${e}`),qe=l(/[\\/]/,"[\\\\/]"),Re=l(/./,A),We=l(/^(?:!!)*!(.*)$/,(e,t)=>`(?!^${de(t)}$).*?`),Je=l(/^(!!)+/,""),Le=w([We,Je]),Ge=l(/\/(\*\*\/)+/,"(?:[\\\\/].+[\\\\/]|[\\\\/])"),Ke=l(/^(\*\*\/)+/,"(?:^|.*[\\\\/])"),Ue=l(/\/(\*\*)$/,"(?:[\\\\/].*|$)"),He=l(/\*\*/,".*"),ae=w([Ge,Ke,Ue,He]),Ye=l(/\*\/(?!\*\*\/|\*$)/,"[^\\\\/]*[\\\\/]"),Qe=l(/\*/,"[^\\\\/]*"),ue=w([Ye,Qe]),ce=l("?","[^\\\\/]"),Ve=l("[",A),Xe=l("]",A),et=l(/[!^]/,"^\\\\/"),tt=l(/[a-z]-[a-z]|[0-9]-[0-9]/i,A),nt=l(/[$.*+?^(){}[\|]/,e=>`\\${e}`),rt=l(/[^\]]/,A),ot=w([W,nt,tt,rt]),le=D([Ve,Be(et),B(ot),Xe]),it=l("{","(?:"),st=l("}",")"),at=l(/(\d+)\.\.(\d+)/,(e,t,r)=>Fe(+t,+r,Math.min(t.length,r.length)).join("|")),ut=l(/([a-z]+)\.\.([a-z]+)/,(e,t,r)=>se(t,r).join("|")),ct=l(/([A-Z]+)\.\.([A-Z]+)/,(e,t,r)=>se(t.toLowerCase(),r.toLowerCase()).join("|").toUpperCase()),lt=w([at,ut,ct]),fe=D([it,lt,st]),ft=l("{","(?:"),pt=l("}",")"),dt=l(",","|"),ht=l(/[$.*+?^(){[\]\|]/,e=>`\\${e}`),gt=l(/[^}]/,A),mt=ne(()=>pe),xt=w([ae,ue,ce,le,fe,mt,W,ht,dt,gt]),pe=D([ft,B(xt),pt]),yt=B(w([Le,ae,ue,ce,le,fe,pe,W,Ne,qe,Re])),$t=yt,bt=re($t),de=bt,vt=l(/\\./,A),jt=l(/./,A),wt=l(/\*\*\*+/,"*"),At=l(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),Ot=l(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),Mt=B(w([vt,wt,At,Ot,jt])),_t=Mt,zt=re(_t),kt=zt,E=c((e,t)=>Array.isArray(e)?e.map(E.compile).some(r=>r.test(t)):E.compile(e).test(t),"_");E.compile=De(e=>new RegExp(`^${de(kt(e))}[\\\\/]?$`,"s"));var Ct=E;return g(k)})();return n.default||n},"_lazyMatch"),L;const Ut=c((n,o)=>(L||(L=ge(),ge=null),L(n,o)),"default");var Ht=Object.defineProperty,Yt=Q((n,o)=>Ht(n,"name",{value:o,configurable:!0}),"t");const Qt=/^[A-Z]:\//i,C=Yt((n="")=>n&&n.replaceAll("\\","/").replace(Qt,o=>o.toUpperCase()),"normalizeWindowsPath");var Vt=Object.defineProperty,y=Q((n,o)=>Vt(n,"name",{value:o,configurable:!0}),"r");const Xt=/^[/\\]{2}/,en=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ve=/^[A-Z]:$/i,me=/^\/([A-Z]:)?$/i,tn=/.(\.[^./]+)$/,nn=/^[/\\]|^[a-z]:[/\\]/i,rn=y(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),je=y((n,o)=>{let i="",u=0,d=-1,m=0,b;for(let g=0;g<=n.length;++g){if(g<n.length)b=n[g];else{if(b==="/")break;b="/"}if(b==="/"){if(!(d===g-1||m===1))if(m===2){if(i.length<2||u!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const k=i.lastIndexOf("/");k===-1?(i="",u=0):(i=i.slice(0,k),u=i.length-1-i.lastIndexOf("/")),d=g,m=0;continue}else if(i.length>0){i="",u=0,d=g,m=0;continue}}o&&(i+=i.length>0?"/..":"..",u=2)}else i.length>0?i+=`/${n.slice(d+1,g)}`:i=n.slice(d+1,g),u=g-d-1;d=g,m=0}else b==="."&&m!==-1?++m:m=-1}return i},"normalizeString"),T=y(n=>en.test(n),"isAbsolute"),we=y(function(n){if(n.length===0)return".";n=C(n);const o=Xt.exec(n),i=T(n),u=n.at(-1)==="/";return n=je(n,!i),n.length===0?i?"/":u?"./":".":(u&&(n+="/"),ve.test(n)&&(n+="/"),o?i?`//${n}`:`//./${n}`:i&&!T(n)?`/${n}`:n)},"normalize"),Ae=y((...n)=>{let o="";for(const i of n)if(i)if(o.length>0){const u=o[o.length-1]==="/",d=i[0]==="/";u&&d?o+=i.slice(1):o+=u||d?i:`/${i}`}else o+=i;return we(o)},"join"),H=y(function(...n){n=n.map(u=>C(u));let o="",i=!1;for(let u=n.length-1;u>=-1&&!i;u--){const d=u>=0?n[u]:rn();!d||d.length===0||(o=`${d}/${o}`,i=T(d))}return o=je(o,!i),i&&!T(o)?`/${o}`:o.length>0?o:"."},"resolve");y(function(n){return C(n)},"toNamespacedPath");const on=y(function(n){return tn.exec(C(n))?.[1]??""},"extname");y(function(n,o){const i=H(n).replace(me,"$1").split("/"),u=H(o).replace(me,"$1").split("/");if(u[0][1]===":"&&i[0][1]===":"&&i[0]!==u[0])return u.join("/");const d=[...i];for(const m of d){if(u[0]!==m)break;i.shift(),u.shift()}return[...i.map(()=>".."),...u].join("/")},"relative");const sn=y(n=>{const o=C(n).replace(/\/$/,"").split("/").slice(0,-1);return o.length===1&&ve.test(o[0])&&(o[0]+="/"),o.join("/")||(T(n)?"/":".")},"dirname");y(function(n){const o=[n.root,n.dir,n.base??n.name+n.ext].filter(Boolean);return C(n.root?H(...o):o.join("/"))},"format");const an=y((n,o)=>{const i=C(n).split("/").pop();return o&&i.endsWith(o)?i.slice(0,-o.length):i},"basename");y(function(n){const o=nn.exec(n)?.[0]?.replaceAll("\\","/")??"",i=an(n),u=on(i);return{base:i,dir:sn(n),ext:u,name:i.slice(0,i.length-u.length),root:o}},"parse");y((n,o)=>Ut(o,we(n)),"matchesGlob");var un=Object.defineProperty,z=F((n,o)=>un(n,"name",{value:o,configurable:!0}),"i");const G="## Ai Generated Solution",xe="Creation of a AI solution failed.",K=z((n,o,i)=>{const u={error:{message:n.message,name:n.name,stack:n.stack},file:{file:o.file,language:o.language,line:o.line,snippet:o.snippet},temperature:i};return Dt("sha256").update(JSON.stringify(u)).digest("hex")},"generateCacheKey"),cn=z(n=>n||Ae(qt(),"visulima-error-cache"),"getCacheDirectory"),ln=z(n=>{be(n)||Ft(n,{recursive:!0})},"ensureCacheDirectory"),U=z((n,o)=>Ae(n,`${o}.json`),"getCacheFilePath"),fn=z((n,o)=>{try{if(!be(n))return;const i=Et(n,"utf8"),u=JSON.parse(i);return Date.now()-u.timestamp>o?void 0:u.solution}catch{return}},"readFromCache"),ye=z((n,o,i)=>{try{const u={solution:o,timestamp:Date.now(),ttl:i};Nt(n,JSON.stringify(u,null,2),"utf8")}catch{}},"writeToCache"),mn=z((n,o)=>({handle:z(async(i,u)=>{const d=o?.cache,m=o?.temperature??0,b=d?.ttl??1440*60*1e3,g=cn(d?.directory);if(d?.enabled!==!1){const j=K(i,u,m),x=U(g,j),O=fn(x,b);if(O)return O;ln(g)}const k=Wt({applicationType:void 0,error:i,file:u});try{const j=(await Rt({model:n,prompt:k,temperature:m})).text;let x;if(j?x={body:J(j),header:G}:x={body:J(xe),header:G},d?.enabled!==!1){const O=K(i,u,m),S=U(g,O);ye(S,x,b)}return x}catch(j){console.error(j);const x={body:J(xe),header:G};if(d?.enabled!==!1){const O=K(i,u,m),S=U(g,O);ye(S,x,b)}return x}},"handle"),name:"AI SDK",priority:99}),"aiFinder");export{mn as default};
@@ -1,10 +0,0 @@
1
- var u=Object.defineProperty;var i=(e,r)=>u(e,"name",{value:r,configurable:!0});var c=Object.defineProperty,l=i((e,r)=>c(e,"name",{value:r,configurable:!0}),"i");const s=l((e,r,n)=>{const t=n.indexOf(e);if(t===-1)return"";const a=t+e.length,o=n.indexOf(r,a);return o===-1?"":n.slice(a,o).trim()},"between"),f=l(e=>{const r=s("FIX","ENDFIX",e);if(!r)return["No solution found.",'Provide this response to the Maintainer of <a href="https://github.com/visulima/visulima/issues/new?assignees=&labels=s%3A+pending+triage%2Cc%3A+bug&projects=&template=bug_report.yml" target="_blank" rel="noopener noreferrer" class="text-blue-500 hover:underline inline-flex items-center text-sm">@visulima/error</a>.',`"${e}"`].join("</br></br>");const n=s("LINKS","ENDLINKS",e).split(`
2
- `).map(t=>JSON.parse(t));return`${r.replaceAll(/"([^"]*)"(\s|\.)/g,"<code>$1</code> ")}
3
-
4
- ## Links
5
-
6
- ${n.map(t=>`- <a href="${t.url}" target="_blank" rel="noopener noreferrer">${t.title}</a>`).join(`
7
- `)}
8
-
9
- --------------------
10
- This solution was generated with the <a href="https://sdk.vercel.ai/" target="_blank" rel="noopener noreferrer">AI SDK</a> and may not be 100% accurate.`},"aiSolutionResponse");export{f as default};
@@ -1 +0,0 @@
1
- var t=Object.defineProperty;var a=(r,e)=>t(r,"name",{value:e,configurable:!0});var c=Object.defineProperty,u=a((r,e)=>c(r,"name",{value:e,configurable:!0}),"e");const o=u(()=>{if(!Error.captureStackTrace)return;const r=new Error;return Error.captureStackTrace(r),r.stack},"captureRawStackTrace");export{o as default};