@visulima/error 5.0.3 → 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 (41) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/code-frame/index.js +125 -6
  3. package/dist/error/index.js +8 -1
  4. package/dist/index.js +16 -1
  5. package/dist/packem_shared/NonError-D5FGLYKY.js +8 -0
  6. package/dist/packem_shared/addKnownErrorConstructor-s_3SsXtQ.js +30 -0
  7. package/dist/packem_shared/aiFinder-HftEgsry.js +277 -0
  8. package/dist/packem_shared/aiSolutionResponse-CJBMLS9t.js +34 -0
  9. package/dist/packem_shared/captureRawStackTrace-ySw7cU0U.js +10 -0
  10. package/dist/packem_shared/deserializeError-E0VQnnm0.js +116 -0
  11. package/dist/packem_shared/errorHintFinder-DEaeRnRW.js +21 -0
  12. package/dist/packem_shared/formatStackFrameLine-D3_6oSWZ.js +24 -0
  13. package/dist/packem_shared/getErrorCauses-DpUsmuqw.js +43 -0
  14. package/dist/packem_shared/index-y_UPkY2Z.js +9 -0
  15. package/dist/packem_shared/indexToLineColumn-Bg8UW1bU.js +50 -0
  16. package/dist/packem_shared/isVisulimaError-DA7QsCxH.js +34 -0
  17. package/dist/packem_shared/parseStacktrace-oQvk7wYp.js +273 -0
  18. package/dist/packem_shared/renderError-C30PRFtU.js +206 -0
  19. package/dist/packem_shared/ruleBasedFinder-C2F8rQ30.js +207 -0
  20. package/dist/packem_shared/serializeError-BZ62KiYZ.js +142 -0
  21. package/dist/solution/ai/ai-prompt.js +13 -7
  22. package/dist/solution/ai/index.js +3 -1
  23. package/dist/solution/index.js +2 -1
  24. package/dist/stacktrace/index.js +2 -1
  25. package/package.json +1 -1
  26. package/dist/packem_shared/NonError-CS10kwil.js +0 -1
  27. package/dist/packem_shared/addKnownErrorConstructor-BqqnTSZp.js +0 -1
  28. package/dist/packem_shared/aiFinder-DPoqj12B.js +0 -1
  29. package/dist/packem_shared/aiSolutionResponse-RD0AK1jh.js +0 -10
  30. package/dist/packem_shared/captureRawStackTrace-CQPNHvBG.js +0 -1
  31. package/dist/packem_shared/deserializeError-BJM8Kd6G.js +0 -1
  32. package/dist/packem_shared/errorHintFinder-C_g0nvml.js +0 -2
  33. package/dist/packem_shared/formatStackFrameLine-iU54KA81.js +0 -2
  34. package/dist/packem_shared/getErrorCauses-geeK5cwE.js +0 -1
  35. package/dist/packem_shared/index-CLFYRLyq.js +0 -1
  36. package/dist/packem_shared/indexToLineColumn-B1F7aNZh.js +0 -1
  37. package/dist/packem_shared/isVisulimaError-jVZgumOU.js +0 -1
  38. package/dist/packem_shared/parseStacktrace-Dnxnc4PL.js +0 -2
  39. package/dist/packem_shared/renderError-ZMlMvw1N.js +0 -18
  40. package/dist/packem_shared/ruleBasedFinder-P88d0gpK.js +0 -34
  41. package/dist/packem_shared/serializeError-CTpDr3CL.js +0 -1
@@ -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-DPoqj12B.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.3",
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 rn=Object.defineProperty;var L=(o,a)=>rn(o,"name",{value:a,configurable:!0});import{createRequire as on}from"node:module";import{generateText as pn}from"ai";import hn from"../solution/ai/ai-prompt.js";import Q from"./aiSolutionResponse-RD0AK1jh.js";const sn=on(import.meta.url),D=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,re=L(o=>{if(typeof D<"u"&&D.versions&&D.versions.node){const[a,i]=D.versions.node.split(".").map(Number);if(a>22||a===22&&i>=3||a===20&&i>=16)return D.getBuiltinModule(o)}return sn(o)},"__cjs_getBuiltinModule"),{createHash:an}=re("node:crypto"),{existsSync:Oe,readFileSync:ln,mkdirSync:cn,writeFileSync:un}=re("node:fs"),{tmpdir:fn}=re("node:os");var dn=Object.defineProperty,gn=L((o,a)=>dn(o,"name",{value:a,configurable:!0}),"$e"),mn=Object.defineProperty,oe=gn((o,a)=>mn(o,"name",{value:a,configurable:!0}),"W"),xn=Object.defineProperty,c=oe((o,a)=>xn(o,"name",{value:a,configurable:!0}),"u$1");let je=c(()=>{var o=(()=>{var a=Object.defineProperty,i=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,x=c((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},"ne"),b=c((e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of f(t))!d.call(e,r)&&r!==n&&a(e,r,{get:c(()=>t[r],"get"),enumerable:!(s=i(t,r))||s.enumerable});return e},"ae"),m=c(e=>b(a({},"__esModule",{value:!0}),e),"oe"),S={};x(S,{zeptomatch:c(()=>we,"zeptomatch")});var A=c(e=>{const t=new Set,n=[e];for(let s=0;s<n.length;s++){const r=n[s];if(t.has(r))continue;t.add(r);const{children:l}=r;if(l?.length)for(let u=0,h=l.length;u<h;u++)n.push(l[u])}return Array.from(t)},"M"),v=c(e=>{let t="";const n=A(e);for(let s=0,r=n.length;s<r;s++){const l=n[s];if(!l.regex)continue;const u=l.regex.flags;if(t||(t=u),t!==u)throw new Error(`Inconsistent RegExp flags used: "${t}" and "${u}"`)}return t},"se"),M=c((e,t,n)=>{const s=n.get(e);if(s!==void 0)return s;const r=e.partial??t;let l="";if(e.regex&&(l+=r?"(?:$|":"",l+=e.regex.source),e.children?.length){const u=Ee(e.children.map(h=>M(h,t,n)).filter(Boolean));if(u?.length){const h=e.children.some(W=>!W.regex||!(W.partial??t)),$=u.length>1||r&&(!l.length||h);l+=$?r?"(?:$|":"(?:":"",l+=u.join("|"),l+=$?")":""}}return e.regex&&(l+=r?")":""),n.set(e,l),l},"O"),B=c((e,t)=>{const n=new Map,s=A(e);for(let r=s.length-1;r>=0;r--){const l=M(s[r],t,n);if(!(r>0))return l}return""},"ie"),Ee=c(e=>Array.from(new Set(e)),"ue"),G=c((e,t,n)=>G.compile(e,n).test(t),"R");G.compile=(e,t)=>{const n=t?.partial??!1,s=B(e,n),r=v(e);return new RegExp(`^(?:${s})$`,r)};var Ie=G,Pe=c((e,t)=>{const n=Ie.compile(e,t),s=`${n.source.slice(0,-1)}[\\\\/]?$`,r=n.flags;return new RegExp(s,r)},"le"),Re=Pe,Be=c(e=>{const t=e.map(s=>s.source).join("|")||"$^",n=e[0]?.flags;return new RegExp(t,n)},"ve"),qe=Be,se=c(e=>Array.isArray(e),"j"),q=c(e=>typeof e=="function","_"),Fe=c(e=>e.length===0,"he"),We=(()=>{const{toString:e}=Function.prototype,t=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return n=>(n.length===0||n.length===1)&&t.test(e.call(n))})(),Ze=c(e=>typeof e=="number","de"),De=c(e=>typeof e=="object"&&e!==null,"xe"),Ne=c(e=>e instanceof RegExp,"me"),Te=(()=>{const e=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return t=>e.test(t.source)})(),Le=(()=>{const e=/^[a-zA-Z0-9_-]+$/;return t=>e.test(t.source)&&!t.flags.includes("i")})(),ae=c(e=>typeof e=="string","A"),k=c(e=>e===void 0,"f"),Ge=c(e=>{const t=new Map;return n=>{const s=t.get(n);if(s!==void 0)return s;const r=e(n);return t.set(n,r),r}},"ye"),ie=c((e,t,n={})=>{const s={cache:{},input:e,index:0,indexBacktrackMax:0,options:n,output:[]},r=O(t)(s),l=Math.max(s.index,s.indexBacktrackMax);if(r&&s.index===e.length)return s.output;throw new Error(`Failed to parse at index ${l}`)},"I"),p=c((e,t)=>se(e)?Je(e,t):ae(e)?le(e,t):Ke(e,t),"i"),Je=c((e,t)=>{const n={};for(const s of e){if(s.length!==1)throw new Error(`Invalid character: "${s}"`);const r=s.charCodeAt(0);n[r]=!0}return s=>{const r=s.input;let l=s.index,u=l;for(;u<r.length&&r.charCodeAt(u)in n;)u+=1;if(u>l){if(!k(t)&&!s.options.silent){const h=r.slice(l,u),$=q(t)?t(h,r,`${l}`):t;k($)||s.output.push($)}s.index=u}return!0}},"we"),Ke=c((e,t)=>{if(Le(e))return le(e.source,t);{const n=e.source,s=e.flags.replace(/y|$/,"y"),r=new RegExp(n,s);return Te(e)&&q(t)&&!We(t)?Ue(r,t):He(r,t)}},"$e"),Ue=c((e,t)=>n=>{const s=n.index,r=n.input;e.lastIndex=s;const l=e.exec(r);if(l){const u=e.lastIndex;if(!n.options.silent){const h=t(...l,r,`${s}`);k(h)||n.output.push(h)}return n.index=u,!0}else return!1},"Ee"),He=c((e,t)=>n=>{const s=n.index,r=n.input;if(e.lastIndex=s,e.test(r)){const l=e.lastIndex;if(!k(t)&&!n.options.silent){const u=q(t)?t(r.slice(s,l),r,`${s}`):t;k(u)||n.output.push(u)}return n.index=l,!0}else return!1},"Ce"),le=c((e,t)=>n=>{const s=n.index,r=n.input;if(r.startsWith(e,s)){if(!k(t)&&!n.options.silent){const l=q(t)?t(e,r,`${s}`):t;k(l)||n.output.push(l)}return n.index+=e.length,!0}else return!1},"F"),J=c((e,t,n,s)=>{const r=O(e),l=t>1;return U(K(ue(u=>{let h=0;for(;h<n;){const $=u.index;if(!r(u)||(h+=1,u.index===$))break}return h>=t},l),s))},"k"),ce=c((e,t)=>J(e,0,1,t),"L"),T=c((e,t)=>J(e,0,1/0,t),"$"),Ve=c((e,t)=>J(e,1,1/0,t),"Re"),I=c((e,t)=>{const n=e.map(O);return U(K(ue(s=>{for(let r=0,l=n.length;r<l;r++)if(!n[r](s))return!1;return!0}),t))},"x"),w=c((e,t)=>{const n=e.map(O);return U(K(s=>{for(let r=0,l=n.length;r<l;r++)if(n[r](s))return!0;return!1},t))},"p"),ue=c((e,t=!0,n=!1)=>{const s=O(e);return t?r=>{const l=r.index,u=r.output.length,h=s(r);return!h&&!n&&(r.indexBacktrackMax=Math.max(r.indexBacktrackMax,r.index)),(!h||n)&&(r.index=l,r.output.length!==u&&(r.output.length=u)),h}:s},"q"),K=c((e,t)=>{const n=O(e);return t?s=>{if(s.options.silent)return n(s);const r=s.output.length;if(n(s)){const l=s.output.splice(r,1/0),u=t(l);return k(u)||s.output.push(u),!0}else return!1}:n},"B"),U=(()=>{let e=0;return t=>{const n=O(t),s=e+=1;return r=>{var l;if(r.options.memoization===!1)return n(r);const u=r.index,h=(l=r.cache)[s]||(l[s]={indexMax:-1,queue:[]}),$=h.queue;if(u<=h.indexMax){const Z=h.store||(h.store=new Map);if($.length){for(let R=0,en=$.length;R<en;R+=2){const tn=$[R*2],nn=$[R*2+1];Z.set(tn,nn)}$.length=0}const j=Z.get(u);if(j===!1)return!1;if(Ze(j))return r.index=j,!0;if(j)return r.index=j.index,j.output?.length&&r.output.push(...j.output),!0}const W=r.output.length,Yt=n(r);if(h.indexMax=Math.max(h.indexMax,u),Yt){const Z=r.index,j=r.output.length;if(j>W){const R=r.output.slice(W,j);$.push(u,{index:Z,output:R})}else $.push(u,Z);return!0}else return $.push(u,!1),!1}}})(),fe=c(e=>{let t;return n=>(t||(t=O(e())),t(n))},"G"),O=Ge(e=>{if(q(e))return Fe(e)?fe(e):e;if(ae(e)||Ne(e))return p(e);if(se(e))return I(e);if(De(e))return w(Object.values(e));throw new Error("Invalid rule")}),C=c(e=>e,"d"),Qe=c(e=>typeof e=="string","ke"),Xe=c(e=>{const t=new WeakMap,n=new WeakMap;return(s,r)=>{const l=r?.partial?n:t,u=l.get(s);if(u!==void 0)return u;const h=e(s,r);return l.set(s,h),h}},"Be"),Ye=c(e=>{const t={},n={};return(s,r)=>{const l=r?.partial?n:t;return l[s]??(l[s]=e(s,r))}},"Pe"),et=p(/\\./,C),tt=p(/./,C),nt=p(/\*\*\*+/,"*"),rt=p(/([^/{[(!])\*\*/,(e,t)=>`${t}*`),ot=p(/(^|.)\*\*(?=[^*/)\]}])/,(e,t)=>`${t}*`),st=T(w([et,nt,rt,ot,tt])),at=st,it=c(e=>ie(e,at,{memoization:!1}).join(""),"Ie"),lt=it,pe="abcdefghijklmnopqrstuvwxyz",ct=c(e=>{let t="";for(;e>0;){const n=(e-1)%26;t=pe[n]+t,e=Math.floor((e-1)/26)}return t},"Le"),he=c(e=>{let t=0;for(let n=0,s=e.length;n<s;n++)t=t*26+pe.indexOf(e[n])+1;return t},"V"),H=c((e,t)=>{if(t<e)return H(t,e);const n=[];for(;e<=t;)n.push(e++);return n},"b"),ut=c((e,t,n)=>H(e,t).map(s=>String(s).padStart(n,"0")),"qe"),de=c((e,t)=>H(he(e),he(t)).map(ct),"W"),g=c(e=>({partial:!1,regex:new RegExp(e,"s"),children:[]}),"c"),F=c(e=>({children:e}),"y"),P=(()=>{const e=c((t,n,s)=>{if(s.has(t))return;s.add(t);const{children:r}=t;if(!r.length)r.push(n);else for(let l=0,u=r.length;l<u;l++)e(r[l],n,s)},"e");return t=>{if(!t.length)return F([]);for(let n=t.length-1;n>=1;n--){const s=new Set,r=t[n-1],l=t[n];e(r,l,s)}return t[0]}})(),_=c(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),ft=p(/\\./,g),pt=p(/[$.*+?^(){}[\]\|]/,e=>g(`\\${e}`)),ht=p(/[\\\/]/,_),dt=p(/[^$.*+?^(){}[\]\|\\\/]+/,g),gt=p(/^(?:!!)*!(.*)$/,(e,t)=>g(`(?!^${we.compile(t).source}$).*?`)),mt=p(/^(!!)+/),xt=w([gt,mt]),$t=p(/\/(\*\*\/)+/,()=>F([P([_(),g(".+?"),_()]),_()])),yt=p(/^(\*\*\/)+/,()=>F([g("^"),P([g(".*?"),_()])])),bt=p(/\/(\*\*)$/,()=>F([P([_(),g(".*?")]),g("$")])),vt=p(/\*\*/,()=>g(".*?")),ge=w([$t,yt,bt,vt]),wt=p(/\*\/(?!\*\*\/|\*$)/,()=>P([g("[^\\\\/]*?"),_()])),jt=p(/\*/,()=>g("[^\\\\/]*")),me=w([wt,jt]),xe=p("?",()=>g("[^\\\\/]")),At=p("[",C),Mt=p("]",C),kt=p(/[!^]/,"^\\\\/"),Ot=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,C),_t=p(/\\./,C),zt=p(/[$.*+?^(){}[\|]/,e=>`\\${e}`),St=p(/[\\\/]/,"\\\\/"),Ct=p(/[^$.*+?^(){}[\]\|\\\/]+/,C),Et=w([_t,zt,St,Ot,Ct]),$e=I([At,ce(kt),T(Et),Mt],e=>g(e.join(""))),It=p("{","(?:"),Pt=p("}",")"),Rt=p(/(\d+)\.\.(\d+)/,(e,t,n)=>ut(+t,+n,Math.min(t.length,n.length)).join("|")),Bt=p(/([a-z]+)\.\.([a-z]+)/,(e,t,n)=>de(t,n).join("|")),qt=p(/([A-Z]+)\.\.([A-Z]+)/,(e,t,n)=>de(t.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),Ft=w([Rt,Bt,qt]),ye=I([It,Ft,Pt],e=>g(e.join(""))),Wt=p("{"),Zt=p("}"),Dt=p(","),Nt=p(/\\./,g),Tt=p(/[$.*+?^(){[\]\|]/,e=>g(`\\${e}`)),Lt=p(/[\\\/]/,_),Gt=p(/[^$.*+?^(){}[\]\|\\\/,]+/,g),Jt=fe(()=>ve),Kt=p("",()=>g("(?:)")),Ut=Ve(w([ge,me,xe,$e,ye,Jt,Nt,Tt,Lt,Gt]),P),be=w([Ut,Kt]),ve=I([Wt,ce(I([be,T(I([Dt,be]))])),Zt],F),Ht=T(w([xt,ge,me,xe,$e,ye,ve,ft,pt,ht,dt]),P),Vt=Ht,Qt=c(e=>ie(e,Vt,{memoization:!1})[0],"kr"),Xt=Qt,V=c((e,t,n)=>V.compile(e,n).test(t),"N");V.compile=(()=>{const e=Ye((n,s)=>Re(Xt(lt(n)),s)),t=Xe((n,s)=>qe(n.map(r=>e(r,s))));return(n,s)=>Qe(n)?e(n,s):t(n,s)})();var we=V;return m(S)})();return o.default||o},"_lazyMatch"),X;const $n=c((o,a)=>(X||(X=je(),je=null),X(o,a)),"default");var yn=Object.defineProperty,bn=oe((o,a)=>yn(o,"name",{value:a,configurable:!0}),"t");const vn=/^[A-Z]:\//i,E=bn((o="")=>o&&o.replaceAll("\\","/").replace(vn,a=>a.toUpperCase()),"normalizeWindowsPath");var wn=Object.defineProperty,y=oe((o,a)=>wn(o,"name",{value:a,configurable:!0}),"r");const jn=/^[/\\]{2}/,An=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,_e=/^[A-Z]:$/i,Ae=/^\/([A-Z]:)?$/i,Mn=/.(\.[^./]+)$/,kn=/^[/\\]|^[a-z]:[/\\]/i,On=y(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),ze=y((o,a)=>{let i="",f=0,d=-1,x=0,b;for(let m=0;m<=o.length;++m){if(m<o.length)b=o[m];else{if(b==="/")break;b="/"}if(b==="/"){if(!(d===m-1||x===1))if(x===2){if(i.length<2||f!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const S=i.lastIndexOf("/");S===-1?(i="",f=0):(i=i.slice(0,S),f=i.length-1-i.lastIndexOf("/")),d=m,x=0;continue}else if(i.length>0){i="",f=0,d=m,x=0;continue}}a&&(i+=i.length>0?"/..":"..",f=2)}else i.length>0?i+=`/${o.slice(d+1,m)}`:i=o.slice(d+1,m),f=m-d-1;d=m,x=0}else b==="."&&x!==-1?++x:x=-1}return i},"normalizeString"),N=y(o=>An.test(o),"isAbsolute"),Se=y(function(o){if(o.length===0)return".";o=E(o);const a=jn.exec(o),i=N(o),f=o.at(-1)==="/";return o=ze(o,!i),o.length===0?i?"/":f?"./":".":(f&&(o+="/"),_e.test(o)&&(o+="/"),a?i?`//${o}`:`//./${o}`:i&&!N(o)?`/${o}`:o)},"normalize"),Ce=y((...o)=>{let a="";for(const i of o)if(i)if(a.length>0){const f=a[a.length-1]==="/",d=i[0]==="/";f&&d?a+=i.slice(1):a+=f||d?i:`/${i}`}else a+=i;return Se(a)},"join"),ne=y(function(...o){o=o.map(f=>E(f));let a="",i=!1;for(let f=o.length-1;f>=-1&&!i;f--){const d=f>=0?o[f]:On();!d||d.length===0||(a=`${d}/${a}`,i=N(d))}return a=ze(a,!i),i&&!N(a)?`/${a}`:a.length>0?a:"."},"resolve");y(function(o){return E(o)},"toNamespacedPath");const _n=y(function(o){return Mn.exec(E(o))?.[1]??""},"extname");y(function(o,a){const i=ne(o).replace(Ae,"$1").split("/"),f=ne(a).replace(Ae,"$1").split("/");if(f[0][1]===":"&&i[0][1]===":"&&i[0]!==f[0])return f.join("/");const d=[...i];for(const x of d){if(f[0]!==x)break;i.shift(),f.shift()}return[...i.map(()=>".."),...f].join("/")},"relative");const zn=y(o=>{const a=E(o).replace(/\/$/,"").split("/").slice(0,-1);return a.length===1&&_e.test(a[0])&&(a[0]+="/"),a.join("/")||(N(o)?"/":".")},"dirname");y(function(o){const a=[o.root,o.dir,o.base??o.name+o.ext].filter(Boolean);return E(o.root?ne(...a):a.join("/"))},"format");const Sn=y((o,a)=>{const i=E(o).split("/").pop();return a&&i.endsWith(a)?i.slice(0,-a.length):i},"basename");y(function(o){const a=kn.exec(o)?.[0]?.replaceAll("\\","/")??"",i=Sn(o),f=_n(i);return{base:i,dir:zn(o),ext:f,name:i.slice(0,i.length-f.length),root:a}},"parse");y((o,a)=>$n(a,Se(o)),"matchesGlob");var Cn=Object.defineProperty,z=L((o,a)=>Cn(o,"name",{value:a,configurable:!0}),"i");const Y="## Ai Generated Solution",Me="Creation of a AI solution failed.",ee=z((o,a,i)=>{const f={error:{message:o.message,name:o.name,stack:o.stack},file:{file:a.file,language:a.language,line:a.line,snippet:a.snippet},temperature:i};return an("sha256").update(JSON.stringify(f)).digest("hex")},"generateCacheKey"),En=z(o=>o||Ce(fn(),"visulima-error-cache"),"getCacheDirectory"),In=z(o=>{Oe(o)||cn(o,{recursive:!0})},"ensureCacheDirectory"),te=z((o,a)=>Ce(o,`${a}.json`),"getCacheFilePath"),Pn=z((o,a)=>{try{if(!Oe(o))return;const i=ln(o,"utf8"),f=JSON.parse(i);return Date.now()-f.timestamp>a?void 0:f.solution}catch{return}},"readFromCache"),ke=z((o,a,i)=>{try{const f={solution:a,timestamp:Date.now(),ttl:i};un(o,JSON.stringify(f,null,2),"utf8")}catch{}},"writeToCache"),Zn=z((o,a)=>({handle:z(async(i,f)=>{const d=a?.cache,x=a?.temperature??0,b=d?.ttl??1440*60*1e3,m=En(d?.directory);if(d?.enabled!==!1){const A=ee(i,f,x),v=te(m,A),M=Pn(v,b);if(M)return M;In(m)}const S=hn({applicationType:void 0,error:i,file:f});try{const A=(await pn({model:o,prompt:S,temperature:x})).text;let v;if(A?v={body:Q(A),header:Y}:v={body:Q(Me),header:Y},d?.enabled!==!1){const M=ee(i,f,x),B=te(m,M);ke(B,v,b)}return v}catch(A){console.error(A);const v={body:Q(Me),header:Y};if(d?.enabled!==!1){const M=ee(i,f,x),B=te(m,M);ke(B,v,b)}return v}},"handle"),name:"AI SDK",priority:99}),"aiFinder");export{Zn 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};
@@ -1 +0,0 @@
1
- var w=Object.defineProperty;var p=(e,r)=>w(e,"name",{value:r,configurable:!0});import{r as b}from"./index-CLFYRLyq.js";import{isErrorLike as g,getErrorConstructor as A}from"./addKnownErrorConstructor-BqqnTSZp.js";import f from"./NonError-CS10kwil.js";var N=Object.defineProperty,i=p((e,r)=>N(e,"name",{value:r,configurable:!0}),"o");const P={maxDepth:Number.POSITIVE_INFINITY},E=i((e,r,t=0)=>g(e)?l(e,r,t):r.maxDepth!==void 0&&t>=r.maxDepth?new f(JSON.stringify(e)):new f(JSON.stringify(e)),"deserializePlainObject"),v=i((e,r,t,o,a)=>{const s=r.map(n=>u(n,o,a+1));return new e(s,t)},"reconstructAggregateError"),l=i((e,r,t)=>{if(r.maxDepth!==void 0&&t>=r.maxDepth)return new f(JSON.stringify(e));const{cause:o,errors:a,message:s,name:n,stack:m,...d}=e,y=A(n)||Error,c=n==="AggregateError"&&Array.isArray(a)?v(y,a,s,r,t):new y(s);return!c.name&&n&&(c.name=n),s!==void 0&&(c.message=s),m&&(c.stack=m),h(c,d,o,n,r,t),o!==void 0&&(c.cause=u(o,r,t+1)),S(c,e),c},"reconstructError"),u=i((e,r,t)=>b(e)?E(e,r,t):Array.isArray(e)?e.map(o=>u(o,r,t)):e,"deserializeValue"),h=i((e,r,t,o,a,s)=>{const n=e;for(const[m,d]of Object.entries(r))if(!(m==="cause"&&t!==void 0)){if(m==="errors"&&o==="AggregateError")continue;n[m]=u(d,a,s+1)}},"restoreErrorProperties"),S=i((e,r)=>{const t=new Set;t.add("name"),t.add("message"),t.add("stack");for(const o of Object.keys(r))t.add(o);for(const o of t)if(o in e){const a=Object.getOwnPropertyDescriptor(e,o);a&&!a.enumerable&&Object.defineProperty(e,o,{...a,enumerable:!0})}},"makePropertiesEnumerable"),O=i(e=>new f(JSON.stringify(e)),"handlePrimitive"),j=i(e=>new f(JSON.stringify(e)),"handleArray"),D=i((e,r)=>g(e)?l(e,r,0):E(e,r),"handlePlainObject"),z=i((e,r={})=>{const t={...P,...r};return e instanceof Error?e:e===null?O(null):typeof e=="string"||typeof e=="number"||typeof e=="boolean"?O(e):Array.isArray(e)?j(e):g(e)?l(e,t,0):b(e)?D(e,t):new f(JSON.stringify(e))},"deserialize");export{z as default};
@@ -1,2 +0,0 @@
1
- var e=Object.defineProperty;var r=(t,i)=>e(t,"name",{value:i,configurable:!0});var n=Object.defineProperty,o=r((t,i)=>n(t,"name",{value:i,configurable:!0}),"i");const h={handle:o(async t=>{if(!(t.hint===void 0||t.hint===null)){if(typeof t.hint=="string"&&t.hint!=="")return{body:t.hint};if(typeof t.hint=="object"&&typeof t.hint.body=="string")return t.hint;if(Array.isArray(t.hint))return{body:t.hint.join(`
2
- `)}}},"handle"),name:"errorHint",priority:1};export{h as default};
@@ -1,2 +0,0 @@
1
- var c=Object.defineProperty;var n=(e,a)=>c(e,"name",{value:a,configurable:!0});var s=Object.defineProperty,m=n((e,a)=>s(e,"name",{value:a,configurable:!0}),"s");const i=m(e=>{const a=e.methodName&&e.methodName!=="<unknown>"?`${e.methodName} `:"",r=e.file??"<unknown>",t=e.line??0,o=e.column??0;return a.trim()?` at ${a}(${r}:${t}:${o})`:` at ${r}:${t}:${o}`},"formatStackFrameLine"),f=m((e,a)=>{const r=[];if(a?.header&&(a.header.name||a.header.message)){const t=String(a.header.name||"Error"),o=String(a.header.message||"");r.push(`${t}${o?": ":""}${o}`)}for(const t of e)r.push(i(t));return r.join(`
2
- `)},"formatStacktrace");export{i as formatStackFrameLine,f as formatStacktrace};
@@ -1 +0,0 @@
1
- var i=Object.defineProperty;var n=(r,e)=>i(r,"name",{value:e,configurable:!0});import{createRequire as c}from"node:module";const a=c(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=n(r=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[e,o]=t.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return t.getBuiltinModule(r)}return a(r)},"__cjs_getBuiltinModule"),{inspect:l}=u("node:util");var d=Object.defineProperty,f=n((r,e)=>d(r,"name",{value:e,configurable:!0}),"a");const b=f(r=>{const e=new Set,o=[];let s=r;for(;s;){if(e.has(s)){console.error(`Circular reference detected in error causes: ${l(r)}`);break}if(o.push(s),e.add(s),!s.cause)break;s=s.cause}return o},"getErrorCauses");export{b as default};
@@ -1 +0,0 @@
1
- var r=Object.defineProperty;var o=(e,t)=>r(e,"name",{value:t,configurable:!0});var n=Object.defineProperty,l=o((e,t)=>n(e,"name",{value:t,configurable:!0}),"e");function i(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}o(i,"r");l(i,"isPlainObject");export{i as r};
@@ -1 +0,0 @@
1
- var c=Object.defineProperty;var o=(n,t)=>c(n,"name",{value:t,configurable:!0});var f=Object.defineProperty,s=o((n,t)=>f(n,"name",{value:t,configurable:!0}),"l");const u=s((n,t)=>{let e=0,i=t.length-2;for(;e<i;){const r=e+(i-e>>1);if(n<t[r])i=r-1;else if(n>=t[r+1])e=r+1;else{e=r;break}}return e},"binarySearch"),y=s(n=>n.split(/\n|\r(?!\n)/).reduce((t,e)=>(t.push(t.at(-1)+e.length+1),t),[0]),"getLineStartIndexes"),p=s((n,t,e)=>{const i=e?.skipChecks??!1;if(!i&&(!Array.isArray(n)&&typeof n!="string"||(typeof n=="string"||Array.isArray(n))&&n.length===0))return{column:0,line:0};if(!i&&(typeof t!="number"||typeof n=="string"&&t>=n.length||Array.isArray(n)&&t+1>=n.at(-1)))return{column:0,line:0};if(typeof n=="string"){const l=y(n),a=u(t,l);return{column:t-l[a]+1,line:a+1}}const r=u(t,n);return{column:t-n[r]+1,line:r+1}},"indexToLineColumn");export{p as default};
@@ -1 +0,0 @@
1
- var h=Object.defineProperty;var i=(s,t)=>h(s,"name",{value:t,configurable:!0});var m=Object.defineProperty,e=i((s,t)=>m(s,"name",{value:t,configurable:!0}),"t");const E=e(s=>s instanceof Error&&s.type==="VisulimaError","isVisulimaError");class V extends Error{static{i(this,"VisulimaError")}static{e(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:t,hint:r,location:a,message:o,name:c,stack:n,title:l}){super(o,{cause:t}),this.title=l,this.name=c,this.stack=n??this.stack,this.loc=a,this.hint=r}setLocation(t){this.loc=t}setName(t){this.name=t}setMessage(t){this.message=t}setHint(t){this.hint=t}}export{V as VisulimaError,E as isVisulimaError};
@@ -1,2 +0,0 @@
1
- var x=Object.defineProperty;var v=(i,e)=>x(i,"name",{value:e,configurable:!0});var N=Object.defineProperty,d=v((i,e)=>N(i,"name",{value:e,configurable:!0}),"u");const u=d((i,...e)=>{process.env.DEBUG&&String(process.env.DEBUG)==="true"&&console.debug(`error:parse-stacktrace: ${i}`,...e)},"debugLog"),f="<unknown>",g=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,h=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,S=/(.*?):(\d+):(\d+)(\s<-\s(.+):(\d+):(\d+))?/,k=/(eval)\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*(<anonymous>)?:(\d+)?:(\d+)/,w=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,b=/in\s(.*)\s\(at\s(.+)\)\sat/,O=/^(?:.*@)?(.*):(\d+):(\d+)$/,E=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,J=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,A=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,p=/\(error: (.*)\)/,$=d((i,e)=>{const n=i.includes("safari-extension"),t=i.includes("safari-web-extension");return n||t?[i.includes("@")?i.split("@")[0]:f,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[i,e]},"extractSafariExtensionDetails"),y=d((i,e)=>{const n=S.exec(e);n&&(i.file=n[1],i.line=+n[2],i.column=+n[3])},"parseMapped"),G=d(i=>{const e=b.exec(i);if(e){u(`parse nested node error stack line: "${i}"`,`found: ${JSON.stringify(e)}`);const t=e[2].split(":");return{column:t[2]?+t[2]:void 0,file:t[0],line:t[1]?+t[1]:void 0,methodName:e[1]||f,raw:i,type:void 0}}const n=w.exec(i);if(n){u(`parse node error stack line: "${i}"`,`found: ${JSON.stringify(n)}`);const t={column:n[4]?+n[4]:void 0,file:n[2]?n[2].replace(/at\s/,""):void 0,line:n[3]?+n[3]:void 0,methodName:n[1]||f,raw:i,type:i.startsWith("internal")?"internal":void 0};return y(t,`${n[2]}:${n[3]}:${n[4]}`),t}},"parseNode"),W=d(i=>{const e=g.exec(i);if(e){u(`parse chrome error stack line: "${i}"`,`found: ${JSON.stringify(e)}`);const n=e[2]?.startsWith("native"),t=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let o,a;if(t){const s=h.exec(i);if(s){const r=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/.exec(s[1]);r?(e[2]=r[4]??r[1],e[3]=r[5]??r[2],e[4]=r[3]):s[2]&&(e[2]=s[1]),s[2]&&(o={column:s[4]?+s[4]:void 0,file:s[2],line:s[3]?+s[3]:void 0,methodName:"eval",raw:i,type:"eval"})}else{const r=k.exec(i);r&&(a={column:r[5]?+r[5]:void 0,file:r[3],line:r[4]?+r[4]:void 0},o={column:r[8]?+r[8]:void 0,file:r[2],line:r[7]?+r[7]:void 0,methodName:"eval",raw:r[0],type:"eval"})}}const[m,c]=$(e[1]?e[1].replace(/^Anonymous function$/,"<anonymous>"):f,e[2]),l={column:e[4]?+e[4]:void 0,evalOrigin:o,file:c,line:e[3]?+e[3]:void 0,methodName:m,raw:i,type:t?"eval":n?"native":void 0};return a?(l.column=a.column,l.file=a.file,l.line=a.line):y(l,`${c}:${e[3]}:${e[4]}`),l}},"parseChromium"),D=d((i,e)=>{const n=E.exec(i);if(n){u(`parse gecko error stack line: "${i}"`,`found: ${JSON.stringify(n)}`);const t=n[3]?.includes(" > eval"),o=t&&n[3]&&J.exec(n[3]);let a;t&&o&&(n[3]=o[1],a={column:n[5]?+n[5]:void 0,file:n[3],line:n[4]?+n[4]:void 0,methodName:"eval",raw:i,type:"eval"},n[4]=o[2]);const[m,c]=$(n[1]?n[1].replace(/^Anonymous function$/,"<anonymous>"):f,n[3]);let l;(e?.type==="safari"||!t&&e?.type==="firefox")&&e.column?l=e.column:!t&&n[5]&&(l=+n[5]);let s;return(e?.type==="safari"||!t&&e?.type==="firefox")&&e.line?s=e.line:n[4]&&(s=+n[4]),{column:l,evalOrigin:a,file:c,line:s,methodName:m,raw:i,type:t?"eval":c.includes("[native code]")?"native":void 0}}},"parseGecko"),j=d((i,e)=>{const n=A.exec(i);if(!(n&&n[2].includes(" > eval"))&&n)return u(`parse firefox error stack line: "${i}"`,`found: ${JSON.stringify(n)}`),{column:n[4]?+n[4]:e?.column??void 0,file:n[2],line:n[3]?+n[3]:e?.line??void 0,methodName:n[1]||f,raw:i,type:void 0}},"parseFirefox"),z=d(i=>{const e=O.exec(i);if(e)return u(`parse react android native error stack line: "${i}"`,`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:f,raw:i,type:void 0}},"parseReactAndroidNative"),L=d((i,{filter:e,frameLimit:n=50}={})=>{let t=(i.stacktrace??i.stack??"").split(`
2
- `).map(o=>(p.test(o)?o.replace(p,"$1"):o).replace(/^\s+|\s+$/g,"")).filter(o=>!/\S*(?:Error: |AggregateError:)/.test(o)&&o!=="eval code");return e&&(t=t.filter(o=>e(o))),t=t.slice(0,n),t.reduce((o,a,m)=>{if(!a||a.length>1024)return o;let c;if(/^\s*in\s.*/.test(a))c=G(a);else if(/^.*?\s*at\s.*/.test(a))c=W(a);else if(/^.*?\s*@.*|\[native code\]/.test(a)){let l;m===0&&(i.columnNumber||i.lineNumber?l={column:i.columnNumber,line:i.lineNumber,type:"firefox"}:(i.line||i.column)&&(l={column:i.column,line:i.line,type:"safari"})),c=j(a,l)||D(a,l)}else c=z(a);return c?o.push(c):u(`parse error stack line: "${a}"`,"not parser found"),o},[])},"parseStacktrace");export{L as default};
@@ -1,18 +0,0 @@
1
- var M=Object.defineProperty;var m=(e,r)=>M(e,"name",{value:r,configurable:!0});import{createRequire as _}from"node:module";import{codeFrame as V}from"../code-frame/index.js";import v from"./parseStacktrace-Dnxnc4PL.js";const y=_(import.meta.url),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,h=m(e=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[r,i]=f.versions.node.split(".").map(Number);if(r>22||r===22&&i>=3||r===20&&i>=16)return f.getBuiltinModule(e)}return y(e)},"__cjs_getBuiltinModule"),{existsSync:S,readFileSync:T}=h("node:fs"),{relative:A}=h("node:path"),{cwd:N}=f,{fileURLToPath:P}=h("node:url");var j=Object.defineProperty,a=m((e,r)=>j(e,"name",{value:r,configurable:!0}),"o");const d=a((e,r,i)=>i===0?e.toString():r===" "?e+" ".repeat(i):e+" ".repeat(r*i),"getPrefix"),B=a((e,r)=>{const i=e.replace("async file:","file:");return A(r,i.startsWith("file:")?P(i):i)},"getRelativePath"),R=a((e,r,i)=>{if(r)return i.title(e.message);const t=e.message?`: ${e.message}`:"";return i.title(e.name+t)},"getTitleText"),w=a((e,{color:r,hideErrorTitle:i,indentation:t,prefix:n},s)=>`${d(n,t,s)}${R(e,i,r)}
2
- `,"getMessage"),E=a((e,{color:r,indentation:i,prefix:t},n)=>{if(e.hint===void 0)return;const s=d(t,i,n);let o="";if(Array.isArray(e.hint))for(const l of e.hint)o+=`${(s+l).toString()}
3
- `;else o+=s+e.hint;return r.hint(o)},"getHint"),g=a((e,{color:r,cwd:i,displayShortPath:t,indentation:n,prefix:s},o=0)=>{const l=t?B(e.file,i):e.file,{fileLine:c,method:u}=r;return`${d(s,n,o)}at ${e.methodName?`${u(e.methodName)} `:""}${c(l)}:${c(e.line?.toString()??"")}`.toString()},"getMainFrame"),b=a((e,{color:r,indentation:i,linesAbove:t,linesBelow:n,prefix:s,showGutter:o,showLineNumbers:l,tabWidth:c},u)=>{if(e.file===void 0)return;const p=e.file.replace("file://","");if(!S(p))return;const C=T(p,"utf8");return V(C,{start:{column:e.column,line:e.line}},{color:r,linesAbove:t,linesBelow:n,prefix:d(s,i,u),showGutter:o,showLineNumbers:l,tabWidth:c})},"getCode"),x=a((e,r,i)=>{if(e.errors.length===0)return;let t=`${d(r.prefix,r.indentation,i)}Errors:
4
-
5
- `,n=!0;for(const s of e.errors)n?n=!1:t+=`
6
-
7
- `,t+=L(s,{...r,framesMaxLimit:1,hideErrorCodeView:r.hideErrorErrorsCodeView},i+1);return`
8
- ${t}`},"getErrors"),$=a((e,r,i)=>{let t=`${d(r.prefix,r.indentation,i)}Caused by:
9
-
10
- `;const n=e.cause;t+=w(n,r,i);const s=v(n).shift(),o=E(n,r,i);if(o&&(t+=`${o}
11
- `),s&&(t+=g(s,r,i),!r.hideErrorCauseCodeView)){const l=b(s,r,i);l!==void 0&&(t+=`
12
- ${l}`)}if(n.cause)t+=`
13
- ${$(n,r,i+1)}`;else if(n instanceof AggregateError){const l=x(n,r,i);l!==void 0&&(t+=`
14
- ${l}`)}return`
15
- ${t}`},"getCause"),k=a((e,r)=>(e.length>0?`
16
- `:"")+e.map(i=>g(i,r)).join(`
17
- `),"getStacktrace"),L=a((e,r,i)=>{const t={cwd:N(),displayShortPath:!1,filterStacktrace:void 0,framesMaxLimit:Number.POSITIVE_INFINITY,hideErrorCauseCodeView:!1,hideErrorCodeView:!1,hideErrorErrorsCodeView:!1,hideErrorTitle:!1,hideMessage:!1,indentation:4,linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,showLineNumbers:!0,tabWidth:4,...r,color:{fileLine:a(o=>o,"fileLine"),gutter:a(o=>o,"gutter"),hint:a(o=>o,"hint"),marker:a(o=>o,"marker"),message:a(o=>o,"message"),method:a(o=>o,"method"),title:a(o=>o,"title"),...r.color}},n=v(e,{filter:r.filterStacktrace,frameLimit:t.framesMaxLimit}),s=n.shift();return[r.hideMessage?void 0:w(e,t,i),E(e,t,i),s?g(s,t,i):void 0,s&&!t.hideErrorCodeView?b(s,t,i):void 0,e instanceof AggregateError?x(e,t,i):void 0,e.cause===void 0?void 0:$(e,t,i),n.length>0?k(n,t):void 0].filter(Boolean).join(`
18
- `).replaceAll("\\","/")},"internalRenderError"),G=a((e,r={})=>{if(r.framesMaxLimit!==void 0&&r.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return L(e,r,0)},"renderError");export{G as renderError};
@@ -1,34 +0,0 @@
1
- var u=Object.defineProperty;var m=(e,t)=>u(e,"name",{value:t,configurable:!0});var c=Object.defineProperty,n=m((e,t)=>c(e,"name",{value:t,configurable:!0}),"t");const l=n(e=>`\`\`\`
2
- ${e.trim()}
3
- \`\`\``,"code"),a=n(e=>`\`\`\`bash
4
- ${e.trim()}
5
- \`\`\``,"bash"),d=n(e=>`\`\`\`ts
6
- ${e.trim()}
7
- \`\`\``,"ts"),f=n(e=>`\`\`\`js
8
- ${e.trim()}
9
- \`\`\``,"js"),r=n((e,...t)=>{const i=e.toLowerCase();return t.some(s=>i.includes(s.toLowerCase()))},"has"),h=[{name:"esm-cjs-interop",test:n(e=>{const t=(e?.message||String(e||"")).toString();if(r(t,"err_require_esm","cannot use import statement outside a module","must use import to load es module","require() of es module","does not provide an export named"))return{md:["Your project or a dependency may be mixing CommonJS and ES Modules.","","Try:","- Ensure package.json has the correct `type` (either `module` or `commonjs`).","- Use dynamic `import()` when requiring ESM from CJS.","- Prefer ESM-compatible entrypoints from dependencies.","- In Node, align `module` resolution with your bundler config.","","Check Node resolution:",a(`node -v
10
- cat package.json | jq .type`),"","Example dynamic import in CJS:",f("(async () => { const mod = await import('some-esm'); mod.default(); })();")].join(`
11
- `),title:"ESM/CJS interop"}},"test")},{name:"missing-default-export",test:n(e=>{const t=(e?.message||String(e||"")).toString();if(r(t,"default export not found","has no default export","does not provide an export named 'default'","is not exported from"))return{md:["Verify your import/export shapes.","","Default export example:",d(`export default function Component() {}
12
- // import Component from './file'`),"","Named export example:",d(`export function Component() {}
13
- // import { Component } from './file'`)].join(`
14
- `),title:"Export mismatch (default vs named)"}},"test")},{name:"port-in-use",test:n(e=>{const t=(e?.message||String(e||"")).toString();if(r(t,"eaddrinuse","address already in use","listen eaddrinuse"))return{md:["Another process is using the port.","","Change the port or stop the other process.","","On macOS/Linux:",a(`lsof -i :3000
15
- kill -9 <PID>`),"","On Windows (PowerShell):",a(`netstat -ano | findstr :3000
16
- taskkill /PID <PID> /F`)].join(`
17
- `),title:"Port already in use"}},"test")},{name:"file-not-found-or-case",test:n((e,t)=>{const i=(e?.message||String(e||"")).toString();if(r(i,"enoent","module not found","cannot find module"))return{md:["Check the import path and filename case (Linux/macOS are case-sensitive).","If using TS path aliases, verify `tsconfig.paths` and bundler aliases.","","Current file:",l(`${t.file}:${t.line}`)].join(`
18
- `),title:"Missing file or path case mismatch"}},"test")},{name:"ts-path-mapping",test:n(e=>{const t=(e?.message||String(e||"")).toString();if(r(t,"ts2307","cannot find module")||t.includes("TS2307"))return{md:["If you use path aliases, align TS `paths` with Vite/Webpack resolve aliases.","Ensure file extensions are correct and included in resolver.","","tsconfig.json excerpt:",d(`{
19
- "compilerOptions": {
20
- "baseUrl": ".",
21
- "paths": { "@/*": ["src/*"] }
22
- }
23
- }`)].join(`
24
- `),title:"TypeScript path mapping / resolution"}},"test")},{name:"network-dns-enotfound",test:n(e=>{const t=(e?.message||String(e||"")).toString();if(r(t,"enotfound","getaddrinfo enotfound","dns","fetch failed","ecconnrefused","econnrefused"))return{md:["The host may be unreachable or misconfigured.","","Try:","- Verify the hostname and protocol (http/https).","- Check VPN/proxy and firewall.","- Confirm the service is running and listening on the expected port.","",a(`ping <host>
25
- nslookup <host>
26
- curl -v http://<host>:<port>`)].join(`
27
- `),title:"Network/DNS connection issue"}},"test")},{name:"undefined-property",test:n(e=>{const t=(e?.message||String(e||"")).toString();if(r(t,"cannot read properties of undefined","reading '"))return{md:["A variable or function returned `undefined`.","","Mitigations:","- Add nullish checks before property access.","- Validate function return values and input props/state.","",d("const value = maybe?.prop; // or: if (maybe) { use(maybe.prop) }")].join(`
28
- `),title:"Accessing property of undefined"}},"test")}],y={handle:n(async(e,t)=>{try{const i=h.map(o=>({match:o.test(e,t),rule:o})).filter(o=>!!o.match);if(i.length===0)return;const s=i.toSorted((o,p)=>(o.match.priority||0)-(p.match.priority||0)).map(o=>`#### ${o.match.title}
29
-
30
- ${o.match.md}`).join(`
31
-
32
- ---
33
-
34
- `);return s===""?void 0:{body:s,header:"### Potential fixes detected"}}catch{return}},"handle"),name:"ruleBasedHints",priority:0};export{y as default};
@@ -1 +0,0 @@
1
- var m=Object.defineProperty;var f=(e,t)=>m(e,"name",{value:t,configurable:!0});import{r as b}from"./index-CLFYRLyq.js";const p=Object.create({},{cause:{enumerable:!0,value:void 0,writable:!0},code:{enumerable:!0,value:void 0,writable:!0},errors:{enumerable:!0,value:void 0,writable:!0},message:{enumerable:!0,value:void 0,writable:!0},name:{enumerable:!0,value:void 0,writable:!0},stack:{enumerable:!0,value:void 0,writable:!0}});var d=Object.defineProperty,i=f((e,t)=>d(e,"name",{value:t,configurable:!0}),"c");const s=new WeakSet,y=i(e=>{s.add(e);const t=e.toJSON();return s.delete(e),t},"toJSON"),l=i((e,t,n,u)=>{if(e&&e instanceof Uint8Array&&e.constructor.name==="Buffer")return"[object Buffer]";if(e!==null&&typeof e=="object"&&typeof e.pipe=="function")return"[object Stream]";if(e instanceof Error)return t.includes(e)?"[Circular]":(n+=1,c(e,u,t,n));if(u.useToJSON&&typeof e.toJSON=="function")return e.toJSON();if(typeof e=="object"&&e instanceof Date)return e.toISOString();if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(b(e)){if(n+=1,u.maxDepth&&n>=u.maxDepth)return{};const r={};for(const o in e)r[o]=l(e[o],t,n,u);return r}try{return e}catch{return"[Not Available]"}},"serializeValue"),c=i((e,t,n,u)=>{if(n.push(e),t.maxDepth===0)return{};if(t.useToJSON&&typeof e.toJSON=="function"&&!s.has(e))return y(e);const r=Object.create(p);if(r.name=Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,r.message=e.message,r.stack=e.stack,Array.isArray(e.errors)){const o=[];for(const a of e.errors){if(!(a instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(n.includes(a))return r.errors=[],r;o.push(c(a,t,n,u))}r.errors=o}e.cause instanceof Error&&!n.includes(e.cause)&&(r.cause=c(e.cause,t,n,u));for(const o in e)if(r[o]===void 0){const a=e[o];r[o]=l(a,n,u,t)}if(Array.isArray(t.exclude)&&t.exclude.length>0)for(const o of t.exclude)try{delete r[o]}catch{}return r},"_serialize"),S=i((e,t={})=>c(e,{exclude:t.exclude??[],maxDepth:t.maxDepth??Number.POSITIVE_INFINITY,useToJSON:t.useToJSON??!1},[],0),"serialize");export{S as serialize};