@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.
- package/CHANGELOG.md +32 -1
- package/LICENSE.md +1 -1
- package/dist/code-frame/index.js +125 -6
- package/dist/error/index.js +8 -1
- package/dist/index.js +16 -1
- package/dist/packem_shared/NonError-D5FGLYKY.js +8 -0
- package/dist/packem_shared/addKnownErrorConstructor-s_3SsXtQ.js +30 -0
- package/dist/packem_shared/aiFinder-HftEgsry.js +277 -0
- package/dist/packem_shared/aiSolutionResponse-CJBMLS9t.js +34 -0
- package/dist/packem_shared/captureRawStackTrace-ySw7cU0U.js +10 -0
- package/dist/packem_shared/deserializeError-E0VQnnm0.js +116 -0
- package/dist/packem_shared/errorHintFinder-DEaeRnRW.js +21 -0
- package/dist/packem_shared/formatStackFrameLine-D3_6oSWZ.js +24 -0
- package/dist/packem_shared/getErrorCauses-DpUsmuqw.js +43 -0
- package/dist/packem_shared/index-y_UPkY2Z.js +9 -0
- package/dist/packem_shared/indexToLineColumn-Bg8UW1bU.js +50 -0
- package/dist/packem_shared/isVisulimaError-DA7QsCxH.js +34 -0
- package/dist/packem_shared/parseStacktrace-oQvk7wYp.js +273 -0
- package/dist/packem_shared/renderError-C30PRFtU.js +206 -0
- package/dist/packem_shared/ruleBasedFinder-C2F8rQ30.js +207 -0
- package/dist/packem_shared/serializeError-BZ62KiYZ.js +142 -0
- package/dist/solution/ai/ai-prompt.js +13 -7
- package/dist/solution/ai/index.js +3 -1
- package/dist/solution/index.js +2 -1
- package/dist/stacktrace/index.js +2 -1
- package/package.json +1 -1
- package/dist/packem_shared/NonError-CS10kwil.js +0 -1
- package/dist/packem_shared/addKnownErrorConstructor-BqqnTSZp.js +0 -1
- package/dist/packem_shared/aiFinder-McmYwPGR.js +0 -1
- package/dist/packem_shared/aiSolutionResponse-RD0AK1jh.js +0 -10
- package/dist/packem_shared/captureRawStackTrace-CQPNHvBG.js +0 -1
- package/dist/packem_shared/deserializeError-BJM8Kd6G.js +0 -1
- package/dist/packem_shared/errorHintFinder-C_g0nvml.js +0 -2
- package/dist/packem_shared/formatStackFrameLine-iU54KA81.js +0 -2
- package/dist/packem_shared/getErrorCauses-geeK5cwE.js +0 -1
- package/dist/packem_shared/index-CLFYRLyq.js +0 -1
- package/dist/packem_shared/indexToLineColumn-B1F7aNZh.js +0 -1
- package/dist/packem_shared/isVisulimaError-jVZgumOU.js +0 -1
- package/dist/packem_shared/parseStacktrace-Dnxnc4PL.js +0 -2
- package/dist/packem_shared/renderError-ZMlMvw1N.js +0 -18
- package/dist/packem_shared/ruleBasedFinder-P88d0gpK.js +0 -34
- package/dist/packem_shared/serializeError-CTpDr3CL.js +0 -1
|
@@ -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};
|