@visulima/cerebro 2.1.5 → 3.0.0-alpha.10

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 +228 -0
  2. package/LICENSE.md +1810 -98
  3. package/README.md +28 -21
  4. package/dist/cli.d.ts +22 -0
  5. package/dist/commands/completion-command.js +204 -5
  6. package/dist/commands/help-command.js +200 -1
  7. package/dist/commands/readme-command.js +326 -32
  8. package/dist/commands/version-command.js +18 -1
  9. package/dist/default-env.d.ts +1 -1
  10. package/dist/index.js +7 -1
  11. package/dist/logger/create-pail-logger.js +34 -1
  12. package/dist/packem_chunks/has-new-version.js +264 -1
  13. package/dist/packem_shared/Cerebro-bgCm5Tb1.js +3444 -0
  14. package/dist/packem_shared/VERBOSITY_QUIET-Dp46zlLW.js +10 -0
  15. package/dist/packem_shared/VisulimaError-DA7QsCxH.js +34 -0
  16. package/dist/packem_shared/cerebro-error-GmJ3jN7Q.js +16 -0
  17. package/dist/packem_shared/index-CS31xKFe.js +264 -0
  18. package/dist/packem_shared/runtime-process-B6ZplyWn.js +187 -0
  19. package/dist/plugins/error-handler-plugin.js +648 -1
  20. package/dist/plugins/runtime-version-check-plugin.js +77 -1
  21. package/dist/plugins/update-notifier/update-notifier-plugin.js +517 -1
  22. package/dist/types/cli.d.ts +11 -0
  23. package/dist/types/command-line-usage.d.ts +1 -1
  24. package/dist/types/command.d.ts +10 -10
  25. package/dist/util/command-processing/option-processor.d.ts +8 -8
  26. package/dist/util/general/compile-cache.d.ts +41 -0
  27. package/dist/util/general/compile-cache.js +16 -0
  28. package/dist/util/general/heap-tuning.d.ts +81 -0
  29. package/dist/util/general/heap-tuning.js +91 -0
  30. package/dist/util/general/register-exception-handler.d.ts +1 -1
  31. package/dist/util/process-env-variables.d.ts +1 -1
  32. package/package.json +18 -9
  33. package/dist/packem_shared/Cerebro-CQZ9sj4S.js +0 -4
  34. package/dist/packem_shared/VERBOSITY_QUIET-XPultrIA.js +0 -1
  35. package/dist/packem_shared/VisulimaError--04oA1Oy.js +0 -76
  36. package/dist/packem_shared/cerebro-error-BnJTixb2.js +0 -1
  37. package/dist/packem_shared/help-command-CIRIXN03.js +0 -1
  38. package/dist/packem_shared/index-DQ3pvLQH.js +0 -6
  39. package/dist/packem_shared/isVisulimaError-jVZgumOU-C4fgdbWg.js +0 -1
  40. package/dist/packem_shared/renderError-ZMlMvw1N-eVUSdl6c.js +0 -24
  41. package/dist/packem_shared/runtime-process-G-n-wOub.js +0 -1
@@ -1,76 +0,0 @@
1
- var q=Object.defineProperty;var s=(e,r)=>q(e,"name",{value:r,configurable:!0});import{createRequire as z}from"node:module";import{k as Rr,N as Fr,P as Mr,G as Vr}from"./renderError-ZMlMvw1N-eVUSdl6c.js";import{p as qr,V as zr}from"./isVisulimaError-jVZgumOU-C4fgdbWg.js";const B=z(import.meta.url),g=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,K=s(e=>{if(typeof g<"u"&&g.versions&&g.versions.node){const[r,t]=g.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return g.getBuiltinModule(e)}return B(e)},"__cjs_getBuiltinModule"),{createRequire:Y}=K("node:module");var H=Object.defineProperty,X=s((e,r)=>H(e,"name",{value:r,configurable:!0}),"s$6"),W=Object.defineProperty,G=X((e,r)=>W(e,"name",{value:r,configurable:!0}),"o"),Q=Object.defineProperty,x=G((e,r)=>Q(e,"name",{value:r,configurable:!0}),"l");const A=x((e,r)=>{let t=0,n=r.length-2;for(;t<n;){const o=t+(n-t>>1);if(e<r[o])n=o-1;else if(e>=r[o+1])t=o+1;else{t=o;break}}return t},"binarySearch"),Z=x(e=>e.split(/\n|\r(?!\n)/).reduce((r,t)=>(r.push(r.at(-1)+t.length+1),r),[0]),"getLineStartIndexes"),Er=x((e,r,t)=>{const n=t?.skipChecks??!1;if(!n&&(!Array.isArray(e)&&typeof e!="string"||(typeof e=="string"||Array.isArray(e))&&e.length===0))return{column:0,line:0};if(!n&&(typeof r!="number"||typeof e=="string"&&r>=e.length||Array.isArray(e)&&r+1>=e.at(-1)))return{column:0,line:0};if(typeof e=="string"){const a=Z(e),i=A(r,a);return{column:r-a[i]+1,line:i+1}}const o=A(r,e);return{column:r-e[o]+1,line:o+1}},"indexToLineColumn");var ee=Object.defineProperty,re=s((e,r)=>ee(e,"name",{value:r,configurable:!0}),"t$5"),te=Object.defineProperty,ne=re((e,r)=>te(e,"name",{value:r,configurable:!0}),"n"),oe=Object.defineProperty,ae=ne((e,r)=>oe(e,"name",{value:r,configurable:!0}),"t");const Pr=ae(({applicationType:e,error:r,file:t})=>`You are a very skilled ${t.language} programmer.
2
-
3
- ${e?`You are working on a ${e} application.`:""}
4
-
5
- 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
-
7
- Use this format in your answer, make sure links are json:
8
-
9
- FIX
10
- insert the possible fix here
11
- ENDFIX
12
- LINKS
13
- {"title": "Title link 1", "url": "URL link 1"}
14
- {"title": "Title link 2", "url": "URL link 2"}
15
- ENDLINKS
16
- ---
17
-
18
- Here comes the context and the exception message:
19
-
20
- Line: ${t.line}
21
-
22
- File:
23
- ${t.file}
24
-
25
- Snippet including line numbers:
26
- ${t.snippet}
27
-
28
- Exception class:
29
- ${r.name}
30
-
31
- Exception message:
32
- ${r.message}`,"aiPrompt");var ie=Object.defineProperty,se=s((e,r)=>ie(e,"name",{value:r,configurable:!0}),"o$6"),ue=Object.defineProperty,ce=se((e,r)=>ue(e,"name",{value:r,configurable:!0}),"i"),le=Object.defineProperty,C=ce((e,r)=>le(e,"name",{value:r,configurable:!0}),"i");const T=C((e,r,t)=>{const n=t.indexOf(e);if(n===-1)return"";const o=n+e.length,a=t.indexOf(r,o);return a===-1?"":t.slice(o,a).trim()},"between"),xr=C(e=>{const r=T("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 t=T("LINKS","ENDLINKS",e).split(`
33
- `).map(n=>JSON.parse(n));return`${r.replaceAll(/"([^"]*)"(\s|\.)/g,"<code>$1</code> ")}
34
-
35
- ## Links
36
-
37
- ${t.map(n=>`- <a href="${n.url}" target="_blank" rel="noopener noreferrer">${n.title}</a>`).join(`
38
- `)}
39
-
40
- --------------------
41
- 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");var fe=Object.defineProperty,me=s((e,r)=>fe(e,"name",{value:r,configurable:!0}),"r$2"),pe=Object.defineProperty,de=me((e,r)=>pe(e,"name",{value:r,configurable:!0}),"r"),ge=Object.defineProperty,be=de((e,r)=>ge(e,"name",{value:r,configurable:!0}),"i");const kr={handle:be(async e=>{if(!(e.hint===void 0||e.hint===null)){if(typeof e.hint=="string"&&e.hint!=="")return{body:e.hint};if(typeof e.hint=="object"&&typeof e.hint.body=="string")return e.hint;if(Array.isArray(e.hint))return{body:e.hint.join(`
42
- `)}}},"handle"),name:"errorHint",priority:1};var ye=Object.defineProperty,he=s((e,r)=>ye(e,"name",{value:r,configurable:!0}),"m$2"),ve=Object.defineProperty,$e=he((e,r)=>ve(e,"name",{value:r,configurable:!0}),"m"),je=Object.defineProperty,u=$e((e,r)=>je(e,"name",{value:r,configurable:!0}),"t");const Se=u(e=>`\`\`\`
43
- ${e.trim()}
44
- \`\`\``,"code"),h=u(e=>`\`\`\`bash
45
- ${e.trim()}
46
- \`\`\``,"bash"),v=u(e=>`\`\`\`ts
47
- ${e.trim()}
48
- \`\`\``,"ts"),Oe=u(e=>`\`\`\`js
49
- ${e.trim()}
50
- \`\`\``,"js"),f=u((e,...r)=>{const t=e.toLowerCase();return r.some(n=>t.includes(n.toLowerCase()))},"has"),Ee=[{name:"esm-cjs-interop",test:u(e=>{const r=(e?.message||String(e||"")).toString();if(f(r,"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:",h(`node -v
51
- cat package.json | jq .type`),"","Example dynamic import in CJS:",Oe("(async () => { const mod = await import('some-esm'); mod.default(); })();")].join(`
52
- `),title:"ESM/CJS interop"}},"test")},{name:"missing-default-export",test:u(e=>{const r=(e?.message||String(e||"")).toString();if(f(r,"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:",v(`export default function Component() {}
53
- // import Component from './file'`),"","Named export example:",v(`export function Component() {}
54
- // import { Component } from './file'`)].join(`
55
- `),title:"Export mismatch (default vs named)"}},"test")},{name:"port-in-use",test:u(e=>{const r=(e?.message||String(e||"")).toString();if(f(r,"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:",h(`lsof -i :3000
56
- kill -9 <PID>`),"","On Windows (PowerShell):",h(`netstat -ano | findstr :3000
57
- taskkill /PID <PID> /F`)].join(`
58
- `),title:"Port already in use"}},"test")},{name:"file-not-found-or-case",test:u((e,r)=>{const t=(e?.message||String(e||"")).toString();if(f(t,"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:",Se(`${r.file}:${r.line}`)].join(`
59
- `),title:"Missing file or path case mismatch"}},"test")},{name:"ts-path-mapping",test:u(e=>{const r=(e?.message||String(e||"")).toString();if(f(r,"ts2307","cannot find module")||r.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:",v(`{
60
- "compilerOptions": {
61
- "baseUrl": ".",
62
- "paths": { "@/*": ["src/*"] }
63
- }
64
- }`)].join(`
65
- `),title:"TypeScript path mapping / resolution"}},"test")},{name:"network-dns-enotfound",test:u(e=>{const r=(e?.message||String(e||"")).toString();if(f(r,"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.","",h(`ping <host>
66
- nslookup <host>
67
- curl -v http://<host>:<port>`)].join(`
68
- `),title:"Network/DNS connection issue"}},"test")},{name:"undefined-property",test:u(e=>{const r=(e?.message||String(e||"")).toString();if(f(r,"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.","",v("const value = maybe?.prop; // or: if (maybe) { use(maybe.prop) }")].join(`
69
- `),title:"Accessing property of undefined"}},"test")}],wr={handle:u(async(e,r)=>{try{const t=Ee.map(o=>({match:o.test(e,r),rule:o})).filter(o=>!!o.match);if(t.length===0)return;const n=t.toSorted((o,a)=>(o.match.priority||0)-(a.match.priority||0)).map(o=>`#### ${o.match.title}
70
-
71
- ${o.match.md}`).join(`
72
-
73
- ---
74
-
75
- `);return n===""?void 0:{body:n,header:"### Potential fixes detected"}}catch{return}},"handle"),name:"ruleBasedHints",priority:0};var Pe=Object.defineProperty,xe=s((e,r)=>Pe(e,"name",{value:r,configurable:!0}),"a$3"),ke=Object.defineProperty,we=xe((e,r)=>ke(e,"name",{value:r,configurable:!0}),"a"),Ne=Object.defineProperty,Ae=we((e,r)=>Ne(e,"name",{value:r,configurable:!0}),"e");const Nr=Ae(()=>{if(!Error.captureStackTrace)return;const e=new Error;return Error.captureStackTrace(e),e.stack},"captureRawStackTrace");var Te=Object.defineProperty,_=s((e,r)=>Te(e,"name",{value:r,configurable:!0}),"r"),Ie=Object.defineProperty,D=_((e,r)=>Ie(e,"name",{value:r,configurable:!0}),"o"),Ce=Object.defineProperty,_e=D((e,r)=>Ce(e,"name",{value:r,configurable:!0}),"e");function d(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}s(d,"o$3");_(d,"i");D(d,"r");_e(d,"isPlainObject");var De=Object.defineProperty,Je=s((e,r)=>De(e,"name",{value:r,configurable:!0}),"E$1"),Le=Object.defineProperty,Re=Je((e,r)=>Le(e,"name",{value:r,configurable:!0}),"E"),Fe=Object.defineProperty,j=Re((e,r)=>Fe(e,"name",{value:r,configurable:!0}),"n");const y=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&y.set("AggregateError",AggregateError);const Ar=j((e,r)=>{let t;try{t=new e}catch(o){throw new Error(`The error constructor "${e.name}" is not compatible`,{cause:o})}const n=r??t.name;if(y.has(n))throw new Error(`The error constructor "${n}" is already known.`);y.set(n,e)},"addKnownErrorConstructor");j(()=>new Map(y),"getKnownErrorConstructors");const J=j(e=>y.get(e),"getErrorConstructor"),k=j(e=>e!==null&&typeof e=="object"&&typeof e.name=="string"&&typeof e.message=="string"&&(J(e.name)!==void 0||e.name==="Error"),"isErrorLike");var Me=Object.defineProperty,L=s((e,r)=>Me(e,"name",{value:r,configurable:!0}),"t$1"),Ve=Object.defineProperty,R=L((e,r)=>Ve(e,"name",{value:r,configurable:!0}),"t"),Ue=Object.defineProperty,qe=R((e,r)=>Ue(e,"name",{value:r,configurable:!0}),"s");let p=class extends Error{static{s(this,"i")}static{L(this,"c")}static{R(this,"e")}static{qe(this,"NonError")}constructor(r){super(r),this.name="NonError"}};var ze=Object.defineProperty,Be=s((e,r)=>ze(e,"name",{value:r,configurable:!0}),"y$1"),Ke=Object.defineProperty,Ye=Be((e,r)=>Ke(e,"name",{value:r,configurable:!0}),"p"),He=Object.defineProperty,c=Ye((e,r)=>He(e,"name",{value:r,configurable:!0}),"o");const Xe={maxDepth:Number.POSITIVE_INFINITY},F=c((e,r,t=0)=>k(e)?w(e,r,t):r.maxDepth!==void 0&&t>=r.maxDepth?new p(JSON.stringify(e)):new p(JSON.stringify(e)),"deserializePlainObject"),We=c((e,r,t,n,o)=>{const a=r.map(i=>S(i,n,o+1));return new e(a,t)},"reconstructAggregateError"),w=c((e,r,t)=>{if(r.maxDepth!==void 0&&t>=r.maxDepth)return new p(JSON.stringify(e));const{cause:n,errors:o,message:a,name:i,stack:m,...E}=e,N=J(i)||Error,l=i==="AggregateError"&&Array.isArray(o)?We(N,o,a,r,t):new N(a);return!l.name&&i&&(l.name=i),a!==void 0&&(l.message=a),m&&(l.stack=m),Ge(l,E,n,i,r,t),n!==void 0&&(l.cause=S(n,r,t+1)),Qe(l,e),l},"reconstructError"),S=c((e,r,t)=>d(e)?F(e,r,t):Array.isArray(e)?e.map(n=>S(n,r,t)):e,"deserializeValue"),Ge=c((e,r,t,n,o,a)=>{const i=e;for(const[m,E]of Object.entries(r))if(!(m==="cause"&&t!==void 0)){if(m==="errors"&&n==="AggregateError")continue;i[m]=S(E,o,a+1)}},"restoreErrorProperties"),Qe=c((e,r)=>{const t=new Set;t.add("name"),t.add("message"),t.add("stack");for(const n of Object.keys(r))t.add(n);for(const n of t)if(n in e){const o=Object.getOwnPropertyDescriptor(e,n);o&&!o.enumerable&&Object.defineProperty(e,n,{...o,enumerable:!0})}},"makePropertiesEnumerable"),I=c(e=>new p(JSON.stringify(e)),"handlePrimitive"),Ze=c(e=>new p(JSON.stringify(e)),"handleArray"),er=c((e,r)=>k(e)?w(e,r,0):F(e,r),"handlePlainObject"),Ir=c((e,r={})=>{const t={...Xe,...r};return e instanceof Error?e:e===null?I(null):typeof e=="string"||typeof e=="number"||typeof e=="boolean"?I(e):Array.isArray(e)?Ze(e):k(e)?w(e,t,0):d(e)?er(e,t):new p(JSON.stringify(e))},"deserialize");var rr=Object.defineProperty,tr=s((e,r)=>rr(e,"name",{value:r,configurable:!0}),"a"),nr=Object.defineProperty,M=tr((e,r)=>nr(e,"name",{value:r,configurable:!0}),"n");const or=Y(import.meta.url),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ar=M(e=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[r,t]=b.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return b.getBuiltinModule(e)}return or(e)},"__cjs_getBuiltinModule"),{inspect:ir}=ar("node:util");var sr=Object.defineProperty,ur=M((e,r)=>sr(e,"name",{value:r,configurable:!0}),"a");const Cr=ur(e=>{const r=new Set,t=[];let n=e;for(;n;){if(r.has(n)){console.error(`Circular reference detected in error causes: ${ir(e)}`);break}if(t.push(n),r.add(n),!n.cause)break;n=n.cause}return t},"getErrorCauses");var cr=Object.defineProperty,lr=s((e,r)=>cr(e,"name",{value:r,configurable:!0}),"l"),fr=Object.defineProperty,mr=lr((e,r)=>fr(e,"name",{value:r,configurable:!0}),"f");const pr=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 dr=Object.defineProperty,O=mr((e,r)=>dr(e,"name",{value:r,configurable:!0}),"c");const P=new WeakSet,gr=O(e=>{P.add(e);const r=e.toJSON();return P.delete(e),r},"toJSON"),V=O((e,r,t,n)=>{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 r.includes(e)?"[Circular]":(t+=1,$(e,n,r,t));if(n.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(d(e)){if(t+=1,n.maxDepth&&t>=n.maxDepth)return{};const o={};for(const a in e)o[a]=V(e[a],r,t,n);return o}try{return e}catch{return"[Not Available]"}},"serializeValue"),$=O((e,r,t,n)=>{if(t.push(e),r.maxDepth===0)return{};if(r.useToJSON&&typeof e.toJSON=="function"&&!P.has(e))return gr(e);const o=Object.create(pr);if(o.name=Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,o.message=e.message,o.stack=e.stack,Array.isArray(e.errors)){const a=[];for(const i of e.errors){if(!(i instanceof Error))throw new TypeError("All errors in the 'errors' property must be instances of Error");if(t.includes(i))return o.errors=[],o;a.push($(i,r,t,n))}o.errors=a}e.cause instanceof Error&&!t.includes(e.cause)&&(o.cause=$(e.cause,r,t,n));for(const a in e)if(o[a]===void 0){const i=e[a];o[a]=V(i,t,n,r)}if(Array.isArray(r.exclude)&&r.exclude.length>0)for(const a of r.exclude)try{delete o[a]}catch{}return o},"_serialize"),_r=O((e,r={})=>$(e,{exclude:r.exclude??[],maxDepth:r.maxDepth??Number.POSITIVE_INFINITY,useToJSON:r.useToJSON??!1},[],0),"serialize");var br=Object.defineProperty,yr=s((e,r)=>br(e,"name",{value:r,configurable:!0}),"o"),hr=Object.defineProperty,vr=yr((e,r)=>hr(e,"name",{value:r,configurable:!0}),"n"),$r=Object.defineProperty,U=vr((e,r)=>$r(e,"name",{value:r,configurable:!0}),"s");const jr=U(e=>{const r=e.methodName&&e.methodName!=="<unknown>"?`${e.methodName} `:"",t=e.file??"<unknown>",n=e.line??0,o=e.column??0;return r.trim()?` at ${r}(${t}:${n}:${o})`:` at ${t}:${n}:${o}`},"formatStackFrameLine"),Dr=U((e,r)=>{const t=[];if(r?.header&&(r.header.name||r.header.message)){const n=String(r.header.name||"Error"),o=String(r.header.message||"");t.push(`${n}${o?": ":""}${o}`)}for(const n of e)t.push(jr(n));return t.join(`
76
- `)},"formatStacktrace");export{Rr as CODE_FRAME_POINTER,p as NonError,qr as VisulimaError,Ar as addKnownErrorConstructor,Pr as aiPrompt,xr as aiSolutionResponse,Nr as captureRawStackTrace,Fr as codeFrame,Ir as deserializeError,kr as errorHintFinder,jr as formatStackFrameLine,Dr as formatStacktrace,Cr as getErrorCauses,Er as indexToLineColumn,k as isErrorLike,zr as isVisulimaError,Mr as parseStacktrace,Vr as renderError,wr as ruleBasedFinder,_r as serializeError};
@@ -1 +0,0 @@
1
- var s=Object.defineProperty;var t=(r,e)=>s(r,"name",{value:e,configurable:!0});import{p as a}from"./isVisulimaError-jVZgumOU-C4fgdbWg.js";var i=Object.defineProperty,n=t((r,e)=>i(r,"name",{value:e,configurable:!0}),"e");class u extends a{static{t(this,"c")}static{n(this,"CerebroError")}code;context;constructor(e,o,c){super({message:e,name:"CerebroError"}),this.code=o,this.context=c}}export{u as c};
@@ -1 +0,0 @@
1
- var E=Object.defineProperty;var g=(i,r)=>E(i,"name",{value:r,configurable:!0});import{green as d,inverse as s,cyan as c,yellow as f}from"@visulima/colorize";import{f as y,p as $}from"./index-DQ3pvLQH.js";const O=[{defaultValue:"32",description:"Controls the verbosity level of output. Valid values: '16' (quiet), '32' (normal), '64' (verbose), '128' (debug)",name:"CEREBRO_OUTPUT_LEVEL",type:String},{description:"Sets the minimum required Node.js version. Overrides the default minimum version check",name:"CEREBRO_MIN_NODE_VERSION",type:Number},{defaultValue:!1,description:"When set, disables the update notifier check",name:"NO_UPDATE_NOTIFIER",type:Boolean},{description:"Standard Node.js environment variable. When set to 'test', disables update notifier",name:"NODE_ENV",type:String},{defaultValue:!1,description:"When set, enables debug output (same as --debug flag)",name:"DEBUG",type:Boolean},{description:"Sets the terminal width for table rendering. Useful for testing and consistent output",name:"CEREBRO_TERMINAL_WIDTH",type:Number}],C=[{description:"Turn on verbose output",group:"global",name:"verbose",type:Boolean},{description:"Turn on debugging output",group:"global",name:"debug",type:Boolean},{alias:"h",description:"Print out helpful usage information",group:"global",name:"help",type:Boolean},{alias:"q",description:"Silence output",group:"global",name:"quiet",type:Boolean},{alias:"V",description:"Print version info",group:"global",name:"version",type:Boolean},{description:"Turn off colored output",group:"global",name:"no-color",type:Boolean},{description:"Force colored output",group:"global",name:"color",type:Boolean}];var N=Object.defineProperty,u=g((i,r)=>N(i,"name",{value:r,configurable:!0}),"p");const b="__Other",v=u(i=>i.charAt(0).toUpperCase()+i.slice(1),"upperFirstChar"),A=u((i,r,p,t)=>{i.debug("no command given, printing general help...");let n=[...new Set(p.values())].filter(e=>!e.hidden);t&&(n=n.filter(e=>e.group===t));const a=n.reduce((e,o)=>{const l=o.group??b;return e[l]||(e[l]=[]),e[l].push(o),e},{}),m=u(e=>e.map(o=>{let l="";typeof o.alias=="string"?l=o.alias:Array.isArray(o.alias)&&(l=o.alias.join(", ")),l!==""&&(l=` [${l}]`);let h=o.name;return o.commandPath&&o.commandPath.length>0&&(h=`${o.commandPath.join(" ")} ${o.name}`),[`${d(h)}${l}`,o.description??""]}),"buildCommandList");(i?.raw??i.log)($([{content:`${c(r.getCliName())} ${d("<command>")} [positional arguments] ${f("[options]")}`,header:s.cyan(" Usage ")},...Object.keys(a).map(e=>{const o=t?` ${v(t)}`:"";return{content:m(a[e]),header:e===b||t?s.green(` Available${o} Commands `):` ${s.green(` ${v(e)} `)}`}}),p.has("help")?{header:s.yellow(" Command Options "),optionList:p.get("help").options?.filter(e=>!e.hidden)}:void 0,{header:s.yellow(" Global Options "),optionList:C},{content:O.filter(e=>!e.hidden).map(e=>[e.name,e.description??""]),header:s.magenta(" Environment Variables ")},{content:`Run "${c(r.getCliName())} ${d("help <command>")}" or "${c(r.getCliName())} ${d("<command>")} ${f("--help")}" for help with a specific command.`,raw:!0}].filter(Boolean)))},"printGeneralHelp"),B=u((i,r,p,t)=>{let n=p.get(t);if(!n)for(const e of p.values()){const o=e.commandPath?[...e.commandPath,e.name]:[e.name];if(o[o.length-1]===t||o.join(" ")===t){n=e;break}}if(!n){i.error(`Command "${t}" not found`);return}const a=[],m=(n.commandPath?[...n.commandPath,n.name]:[n.name]).join(" ");if(a.push({content:`${c(r.getCliName())} ${d(m)}${n.argument?" [positional arguments]":""}${n.options?" [options]":""}`,header:s.cyan(" Usage ")}),n.description&&a.push({content:n.description,header:s.green(" Description ")}),n.argument&&a.push({header:"Command Positional Arguments",isArgument:!0,optionList:[n.argument]}),Array.isArray(n.options)&&n.options.length>0&&a.push({header:s.yellow(" Command Options "),optionList:n.options.filter(e=>!e.hidden)}),a.push({header:s.yellow(" Global Options "),optionList:C}),Array.isArray(n.env)&&n.env.length>0){const e=n.env.filter(o=>!o.hidden);e.length>0&&a.push({content:e.map(o=>[o.name,o.description??""]),header:s.magenta(" Environment Variables ")})}if(n.alias!==void 0&&n.alias.length>0){let e=n.alias;typeof n.alias=="string"&&(e=[n.alias]),a.splice(1,0,{content:e,header:"Alias(es)"})}Array.isArray(n.examples)&&n.examples.length>0&&a.push({content:n.examples,header:"Examples"}),(i?.raw??i.log)($(a))},"printCommandHelp");class R{static{g(this,"D")}static{u(this,"HelpCommand")}name="help";options=[{description:"Display only the specified group",name:"group",type:String}];commands;constructor(r){this.commands=r}execute(r){const{commandName:p,logger:t,options:n,runtime:a}=r,{footer:m,header:e}=a.getCommandSection();e&&(t?.raw??t.log)(y(e)),p==="help"?A(t,a,this.commands,typeof n?.group=="string"?n.group:void 0):B(t,a,this.commands,p),m&&(t?.raw??t.log)(y(m))}}export{R as D,C as o};
@@ -1,6 +0,0 @@
1
- var m=Object.defineProperty;var s=(r,e)=>m(r,"name",{value:e,configurable:!0});import{createRequire as b}from"node:module";import{createTable as p}from"@visulima/tabular";import{NO_BORDER as u}from"@visulima/tabular/style";import $ from"@visulima/colorize/template";import{d as O}from"./runtime-process-G-n-wOub.js";import{bold as R}from"@visulima/colorize";const v=b(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,w=s(r=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[e,t]=l.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return l.getBuiltinModule(r)}return v(r)},"__cjs_getBuiltinModule"),A=w("node:os");var j=Object.defineProperty,_=s((r,e)=>j(r,"name",{value:e,configurable:!0}),"s");const c=new Map,E=500,o=_(r=>{if(!r||r==="")return"";const e=c.get(r);if(e!==void 0)return e;const t=$(Object.assign([],{raw:[r]}));if(c.size>=E){const n=c.keys().next().value;n!==void 0&&c.delete(n)}return c.set(r,t),t},"templateFormat");var L=Object.defineProperty,N=s((r,e)=>L(r,"name",{value:e,configurable:!0}),"t$1");const g=N(()=>{const r=O().CEREBRO_TERMINAL_WIDTH;if(r===void 0)return;const e=Number.parseInt(r,10);if(!(Number.isNaN(e)||e<=0))return e},"getTerminalWidth");var S=Object.defineProperty,W=s((r,e)=>S(r,"name",{value:e,configurable:!0}),"t");class h{static{s(this,"n")}static{W(this,"BaseSection")}lines;constructor(){this.lines=[]}add(e){this.lines.push(e)}toString(){return this.lines.join(A.EOL)}header(e){this.add(R(e)),this.lines.push("")}}var T=Object.defineProperty,B=s((r,e)=>T(r,"name",{value:e,configurable:!0}),"f");class P extends h{static{s(this,"l")}static{B(this,"ContentSection")}constructor(e){if(super(),e.header&&this.header(o(e.header)),e.content){if(e.raw)if(Array.isArray(e.content)&&e.content.every(t=>typeof t=="string"))e.content.forEach(t=>{Array.isArray(t)?t.forEach(n=>this.add(o(n))):this.add(o(t))});else if(typeof e.content=="string")this.add(o(e.content));else throw new TypeError("Invalid raw content, must be a string or array of strings.");else this.add(this.getContentLines(e.content));this.add("")}}getContentLines(e){if(typeof e=="string"){const t=p({showHeader:!1,style:{border:u,paddingLeft:4,paddingRight:1},terminalWidth:g(),truncateOverflow:!1,wordWrap:!0});return t.addRow([o(e)]),t.toString()}if(Array.isArray(e)&&e.every(t=>typeof t=="string"||Array.isArray(t)&&t.every(n=>typeof n=="string"))){const t=p({showHeader:!1,style:{border:u,paddingLeft:4,paddingRight:1},terminalWidth:g(),truncateOverflow:!1,wordWrap:!0});return e.forEach(n=>{Array.isArray(n)?t.addRow(n.map(i=>o(i))):t.addRow([o(n)])}),t.toString()}if(typeof e=="object"){const t=e;if(!t.options||!t.data)throw new Error(`Must have an "options" or "data" property
2
- ${JSON.stringify(e)}`);const n=p({showHeader:!1,style:{border:u,paddingLeft:4,paddingRight:1},terminalWidth:g(),truncateOverflow:!1,wordWrap:!0});return t.data.forEach(i=>{Array.isArray(i)?n.addRow(i.map(d=>o(d))):n.addRow([o(i)])}),n.toString()}throw new Error(`invalid input - 'content' must be a string, array of strings or a object:
3
-
4
- ${JSON.stringify(e)}`)}}var M=Object.defineProperty,C=s((r,e)=>M(r,"name",{value:e,configurable:!0}),"a");class H extends h{static{s(this,"b")}static{C(this,"OptionListSection")}constructor(e){super();let t=e.optionList??[];const n=Array.isArray(e.hide)?e.hide:[e.hide].filter(Boolean),i=Array.isArray(e.group)?e.group:[e.group].filter(Boolean);n.length>0&&(t=t.filter(a=>!n.includes(a.name))),e.header&&this.header(o(e.header)),i.length>0&&(t=t.filter(a=>{const f=i.includes("_none")&&!a.group,y=this.intersect(Array.isArray(a.group)?a.group:[a.group],i);return f||y?a:void 0}));const d=p({showHeader:!1,style:{border:u,paddingLeft:2,paddingRight:1,...e.tableOptions?.style},terminalWidth:g()??e.tableOptions?.terminalWidth,truncateOverflow:!1,wordWrap:e.tableOptions?.wordWrap??!0,...e.tableOptions});t.forEach(a=>d.addRow([this.getOptionNames(a,e.reverseNameOrder??!1,e.isArgument??!1),o(a.description)])),this.add(d.toString()),this.lines.push("")}getOptionNames(e,t,n){if(!e.name)throw new TypeError("Invalid option definition, name is required.");let i=e.type?e.type.name.toLowerCase():"string";const d=e.multiple||e.lazyMultiple?"[]":"";i=o(e.typeLabel??`{underline ${i}${d}}`);let a;if(e.alias)if(e.name){const f=n?e.name:`{yellow --${e.name}}`;a=o(t?`{bold ${f}}, {bold -${e.alias}} ${i}`:`{bold -${e.alias}}, {bold ${f}} ${i}`)}else t?a=o(`{bold -${e.alias}} ${i}`):a=o(`{bold -${e.alias}} ${i}`);else a=o(`{bold ${n?e.name:`{yellow --${e.name}}`}} ${i}`);return a}intersect(e,t){return e.some(n=>t.includes(n))}}var I=Object.defineProperty,q=s((r,e)=>I(r,"name",{value:e,configurable:!0}),"o");const G=q(r=>(Array.isArray(r)?r:[r]).length===0?"":`
5
- ${r.map(e=>e.optionList?new H(e).toString():new P(e).toString()).join(`
6
- `)}`,"commandLineUsage");export{o as f,G as p};
@@ -1 +0,0 @@
1
- var m=Object.defineProperty;var s=(e,t)=>m(e,"name",{value:t,configurable:!0});var p=Object.defineProperty,i=s((e,t)=>p(e,"name",{value:t,configurable:!0}),"s"),E=Object.defineProperty,r=i((e,t)=>E(e,"name",{value:t,configurable:!0}),"i"),f=Object.defineProperty,a=r((e,t)=>f(e,"name",{value:t,configurable:!0}),"t");const b=a(e=>e instanceof Error&&e.type==="VisulimaError","isVisulimaError");class g extends Error{static{s(this,"p")}static{i(this,"V")}static{r(this,"VisulimaError")}static{a(this,"VisulimaError")}loc;title;hint;type="VisulimaError";constructor({cause:t,hint:o,location:c,message:n,name:l,stack:u,title:h}){super(n,{cause:t}),this.title=h,this.name=l,this.stack=u??this.stack,this.loc=c,this.hint=o}setLocation(t){this.loc=t}setName(t){this.name=t}setMessage(t){this.message=t}setHint(t){this.hint=t}}export{b as V,g as p};
@@ -1,24 +0,0 @@
1
- var Y=Object.defineProperty;var N=(r,e)=>Y(r,"name",{value:e,configurable:!0});import{createRequire as K}from"node:module";const Q=K(import.meta.url),S=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,X=N(r=>{if(typeof S<"u"&&S.versions&&S.versions.node){const[e,t]=S.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return S.getBuiltinModule(r)}return Q(r)},"__cjs_getBuiltinModule"),{createRequire:Z}=X("node:module");var ee=Object.defineProperty,re=N((r,e)=>ee(r,"name",{value:e,configurable:!0}),"A$2"),te=Object.defineProperty,A=re((r,e)=>te(r,"name",{value:e,configurable:!0}),"v"),ie=Object.defineProperty,oe=A((r,e)=>ie(r,"name",{value:e,configurable:!0}),"r$1");const ne=oe(r=>r.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
2
- `),"normalizeLF"),se=globalThis.process||Object.create(null),M={versions:{}},_=new Proxy(se,{get(r,e){if(e in r)return r[e];if(e in M)return M[e]}});var ae=Object.defineProperty,le=A((r,e)=>ae(r,"name",{value:e,configurable:!0}),"b");const ce=le((r,e,t,i)=>{const o={column:0,line:-1,...r.start},n={...o,...r.end},s=o.line,a=o.column,c=n.line,u=n.column;let l=Math.max(s-(t+1),0),g=Math.min(e.length,c+i);s===-1&&(l=0),c===-1&&(g=e.length);const w=c-s,m={};if(w)for(let d=0;d<=w;d++){const v=d+s;if(!a)m[v]=!0;else if(d===0){const $=e[v-1]?.length;m[v]=[a,($??0)-a+1]}else if(d===w)m[v]=[0,u];else{const $=e[v-d]?.length;m[v]=[0,$]}}else a===u?m[s]=a?[a,0]:!0:m[s]=[a,(u??0)-(a??0)];return{end:g,markerLines:m,start:l}},"getMarkerLines");var ue=Object.defineProperty,E=A((r,e)=>ue(r,"name",{value:e,configurable:!0}),"o");const de=_.platform==="win32"&&!_.env?.WT_SESSION?">":"❯",fe=E((r,e,t)=>{const i={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...t,color:{gutter:E(d=>d,"gutter"),marker:E(d=>d,"marker"),message:E(d=>d,"message"),...t?.color}},o=e.start&&typeof e.start.column=="number";let n=ne(r).split(`
3
- `);typeof i?.tabWidth=="number"&&(n=n.map(d=>d.replaceAll(" "," ".repeat(i.tabWidth))));const{end:s,markerLines:a,start:c}=ce(e,n,i.linesAbove,i.linesBelow),u=String(s).length,{gutter:l,marker:g,message:w}=i.color;let m=n.slice(c,s).map((d,v)=>{const $=c+1+v,k=a[$],z=` ${$}`.slice(-u),D=!a[$+1],j=` ${z}${i.showGutter?" |":""}`;if(k){let O="";if(Array.isArray(k)){const U=d.replaceAll(/[^\t]/g," ").slice(0,Math.max(k[0]-1,0)),H=k[1]||1;O=[`
4
- `,i.prefix+l(j.replaceAll(/\d/g," "))," ",U,g("^").repeat(H)].join(""),D&&i.message&&(O+=` ${w(i.message)}`)}return[i.prefix+g(de),l(j),d.length>0?` ${d}`:"",O].join("")}return`${i.prefix} ${l(j)}${d.length>0?` ${d}`:""}`}).join(`
5
- `);return i.message&&!o&&(m=`${i.prefix+" ".repeat(u+1)+i.message}
6
- ${m}`),m},"codeFrame");var me=Object.defineProperty,pe=N((r,e)=>me(r,"name",{value:e,configurable:!0}),"v$1"),ve=Object.defineProperty,ge=pe((r,e)=>ve(r,"name",{value:e,configurable:!0}),"v"),$e=Object.defineProperty,p=ge((r,e)=>$e(r,"name",{value:e,configurable:!0}),"u");const h=p((r,...e)=>{process.env.DEBUG&&String(process.env.DEBUG)==="true"&&console.debug(`error:parse-stacktrace: ${r}`,...e)},"debugLog"),b="<unknown>",he=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,be=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,ye=/(.*?):(\d+):(\d+)(\s<-\s(.+):(\d+):(\d+))?/,xe=/(eval)\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*(<anonymous>)?:(\d+)?:(\d+)/,we=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,Ne=/in\s(.*)\s\(at\s(.+)\)\sat/,Se=/^(?:.*@)?(.*):(\d+):(\d+)$/,ke=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ee=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,je=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,T=/\(error: (.*)\)/,B=p((r,e)=>{const t=r.includes("safari-extension"),i=r.includes("safari-web-extension");return t||i?[r.includes("@")?r.split("@")[0]:b,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[r,e]},"extractSafariExtensionDetails"),C=p((r,e)=>{const t=ye.exec(e);t&&(r.file=t[1],r.line=+t[2],r.column=+t[3])},"parseMapped"),Oe=p(r=>{const e=Ne.exec(r);if(e){h(`parse nested node error stack line: "${r}"`,`found: ${JSON.stringify(e)}`);const i=e[2].split(":");return{column:i[2]?+i[2]:void 0,file:i[0],line:i[1]?+i[1]:void 0,methodName:e[1]||b,raw:r,type:void 0}}const t=we.exec(r);if(t){h(`parse node error stack line: "${r}"`,`found: ${JSON.stringify(t)}`);const i={column:t[4]?+t[4]:void 0,file:t[2]?t[2].replace(/at\s/,""):void 0,line:t[3]?+t[3]:void 0,methodName:t[1]||b,raw:r,type:r.startsWith("internal")?"internal":void 0};return C(i,`${t[2]}:${t[3]}:${t[4]}`),i}},"parseNode"),Ae=p(r=>{const e=he.exec(r);if(e){h(`parse chrome error stack line: "${r}"`,`found: ${JSON.stringify(e)}`);const t=e[2]?.startsWith("native"),i=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let o,n;if(i){const u=be.exec(r);if(u){const l=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/.exec(u[1]);l?(e[2]=l[4]??l[1],e[3]=l[5]??l[2],e[4]=l[3]):u[2]&&(e[2]=u[1]),u[2]&&(o={column:u[4]?+u[4]:void 0,file:u[2],line:u[3]?+u[3]:void 0,methodName:"eval",raw:r,type:"eval"})}else{const l=xe.exec(r);l&&(n={column:l[5]?+l[5]:void 0,file:l[3],line:l[4]?+l[4]:void 0},o={column:l[8]?+l[8]:void 0,file:l[2],line:l[7]?+l[7]:void 0,methodName:"eval",raw:l[0],type:"eval"})}}const[s,a]=B(e[1]?e[1].replace(/^Anonymous function$/,"<anonymous>"):b,e[2]),c={column:e[4]?+e[4]:void 0,evalOrigin:o,file:a,line:e[3]?+e[3]:void 0,methodName:s,raw:r,type:i?"eval":t?"native":void 0};return n?(c.column=n.column,c.file=n.file,c.line=n.line):C(c,`${a}:${e[3]}:${e[4]}`),c}},"parseChromium"),Le=p((r,e)=>{const t=ke.exec(r);if(t){h(`parse gecko error stack line: "${r}"`,`found: ${JSON.stringify(t)}`);const i=t[3]?.includes(" > eval"),o=i&&t[3]&&Ee.exec(t[3]);let n;i&&o&&(t[3]=o[1],n={column:t[5]?+t[5]:void 0,file:t[3],line:t[4]?+t[4]:void 0,methodName:"eval",raw:r,type:"eval"},t[4]=o[2]);const[s,a]=B(t[1]?t[1].replace(/^Anonymous function$/,"<anonymous>"):b,t[3]);let c;(e?.type==="safari"||!i&&e?.type==="firefox")&&e.column?c=e.column:!i&&t[5]&&(c=+t[5]);let u;return(e?.type==="safari"||!i&&e?.type==="firefox")&&e.line?u=e.line:t[4]&&(u=+t[4]),{column:c,evalOrigin:n,file:a,line:u,methodName:s,raw:r,type:i?"eval":a.includes("[native code]")?"native":void 0}}},"parseGecko"),Pe=p((r,e)=>{const t=je.exec(r);if(!(t&&t[2].includes(" > eval"))&&t)return h(`parse firefox error stack line: "${r}"`,`found: ${JSON.stringify(t)}`),{column:t[4]?+t[4]:e?.column??void 0,file:t[2],line:t[3]?+t[3]:e?.line??void 0,methodName:t[1]||b,raw:r,type:void 0}},"parseFirefox"),Me=p(r=>{const e=Se.exec(r);if(e)return h(`parse react android native error stack line: "${r}"`,`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:b,raw:r,type:void 0}},"parseReactAndroidNative"),W=p((r,{filter:e,frameLimit:t=50}={})=>{let i=(r.stacktrace??r.stack??"").split(`
7
- `).map(o=>(T.test(o)?o.replace(T,"$1"):o).replace(/^\s+|\s+$/g,"")).filter(o=>!/\S*(?:Error: |AggregateError:)/.test(o)&&o!=="eval code");return e&&(i=i.filter(o=>e(o))),i=i.slice(0,t),i.reduce((o,n,s)=>{if(!n||n.length>1024)return o;let a;if(/^\s*in\s.*/.test(n))a=Oe(n);else if(/^.*?\s*at\s.*/.test(n))a=Ae(n);else if(/^.*?\s*@.*|\[native code\]/.test(n)){let c;s===0&&(r.columnNumber||r.lineNumber?c={column:r.columnNumber,line:r.lineNumber,type:"firefox"}:(r.line||r.column)&&(c={column:r.column,line:r.line,type:"safari"})),a=Pe(n,c)||Le(n,c)}else a=Me(n);return a?o.push(a):h(`parse error stack line: "${n}"`,"not parser found"),o},[])},"parseStacktrace");var _e=Object.defineProperty,Te=N((r,e)=>_e(r,"name",{value:e,configurable:!0}),"p"),Be=Object.defineProperty,G=Te((r,e)=>Be(r,"name",{value:e,configurable:!0}),"m");const Ce=Z(import.meta.url),y=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,L=G(r=>{if(typeof y<"u"&&y.versions&&y.versions.node){const[e,t]=y.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return y.getBuiltinModule(r)}return Ce(r)},"__cjs_getBuiltinModule"),{existsSync:We,readFileSync:Ge}=L("node:fs"),{relative:Re}=L("node:path"),{cwd:Ve}=y,{fileURLToPath:Fe}=L("node:url");var Ie=Object.defineProperty,f=G((r,e)=>Ie(r,"name",{value:e,configurable:!0}),"o");const x=f((r,e,t)=>t===0?r.toString():e===" "?r+" ".repeat(t):r+" ".repeat(e*t),"getPrefix"),Je=f((r,e)=>{const t=r.replace("async file:","file:");return Re(e,t.startsWith("file:")?Fe(t):t)},"getRelativePath"),qe=f((r,e,t)=>{if(e)return t.title(r.message);const i=r.message?`: ${r.message}`:"";return t.title(r.name+i)},"getTitleText"),R=f((r,{color:e,hideErrorTitle:t,indentation:i,prefix:o},n)=>`${x(o,i,n)}${qe(r,t,e)}
8
- `,"getMessage"),V=f((r,{color:e,indentation:t,prefix:i},o)=>{if(r.hint===void 0)return;const n=x(i,t,o);let s="";if(Array.isArray(r.hint))for(const a of r.hint)s+=`${(n+a).toString()}
9
- `;else s+=n+r.hint;return e.hint(s)},"getHint"),P=f((r,{color:e,cwd:t,displayShortPath:i,indentation:o,prefix:n},s=0)=>{const a=i?Je(r.file,t):r.file,{fileLine:c,method:u}=e;return`${x(n,o,s)}at ${r.methodName?`${u(r.methodName)} `:""}${c(a)}:${c(r.line?.toString()??"")}`.toString()},"getMainFrame"),F=f((r,{color:e,indentation:t,linesAbove:i,linesBelow:o,prefix:n,showGutter:s,showLineNumbers:a,tabWidth:c},u)=>{if(r.file===void 0)return;const l=r.file.replace("file://","");if(!We(l))return;const g=Ge(l,"utf8");return fe(g,{start:{column:r.column,line:r.line}},{color:e,linesAbove:i,linesBelow:o,prefix:x(n,t,u),showGutter:s,showLineNumbers:a,tabWidth:c})},"getCode"),I=f((r,e,t)=>{if(r.errors.length===0)return;let i=`${x(e.prefix,e.indentation,t)}Errors:
10
-
11
- `,o=!0;for(const n of r.errors)o?o=!1:i+=`
12
-
13
- `,i+=q(n,{...e,framesMaxLimit:1,hideErrorCodeView:e.hideErrorErrorsCodeView},t+1);return`
14
- ${i}`},"getErrors"),J=f((r,e,t)=>{let i=`${x(e.prefix,e.indentation,t)}Caused by:
15
-
16
- `;const o=r.cause;i+=R(o,e,t);const n=W(o).shift(),s=V(o,e,t);if(s&&(i+=`${s}
17
- `),n&&(i+=P(n,e,t),!e.hideErrorCauseCodeView)){const a=F(n,e,t);a!==void 0&&(i+=`
18
- ${a}`)}if(o.cause)i+=`
19
- ${J(o,e,t+1)}`;else if(o instanceof AggregateError){const a=I(o,e,t);a!==void 0&&(i+=`
20
- ${a}`)}return`
21
- ${i}`},"getCause"),ze=f((r,e)=>(r.length>0?`
22
- `:"")+r.map(t=>P(t,e)).join(`
23
- `),"getStacktrace"),q=f((r,e,t)=>{const i={cwd:Ve(),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,...e,color:{fileLine:f(s=>s,"fileLine"),gutter:f(s=>s,"gutter"),hint:f(s=>s,"hint"),marker:f(s=>s,"marker"),message:f(s=>s,"message"),method:f(s=>s,"method"),title:f(s=>s,"title"),...e.color}},o=W(r,{filter:e.filterStacktrace,frameLimit:i.framesMaxLimit}),n=o.shift();return[e.hideMessage?void 0:R(r,i,t),V(r,i,t),n?P(n,i,t):void 0,n&&!i.hideErrorCodeView?F(n,i,t):void 0,r instanceof AggregateError?I(r,i,t):void 0,r.cause===void 0?void 0:J(r,i,t),o.length>0?ze(o,i):void 0].filter(Boolean).join(`
24
- `).replaceAll("\\","/")},"internalRenderError"),He=f((r,e={})=>{if(e.framesMaxLimit!==void 0&&e.framesMaxLimit<=0)throw new RangeError("The 'framesMaxLimit' option must be a positive number");return q(r,e,0)},"renderError");export{He as G,fe as N,W as P,de as k};
@@ -1 +0,0 @@
1
- var a=Object.defineProperty;var l=(e,s)=>a(e,"name",{value:s,configurable:!0});var g=Object.defineProperty,r=l((e,s)=>g(e,"name",{value:s,configurable:!0}),"r");const t=r(e=>"Deno"in e,"hasDeno"),i=r(e=>"Bun"in e,"hasBun"),h=r(()=>{if(t(globalThis)){const e=globalThis.Deno,s=e.execPath();let o=s;try{const{importMeta:n}=globalThis;n?.url&&(o=n.url)}catch{}return[s,o,...e.args]}return i(globalThis)?globalThis.Bun.process.argv:process.argv},"getArgv"),b=r(()=>t(globalThis)?globalThis.Deno.cwd():i(globalThis)?globalThis.Bun.process.cwd():process.cwd(),"getCwd"),u=r(()=>{if(t(globalThis)){const e=globalThis.Deno;return new Proxy(e.env.toObject(),{get:r((s,o)=>typeof o=="string"?e.env.get(o):s[o],"get"),has:r((s,o)=>typeof o=="string"?e.env.has(o):o in s,"has"),set:r((s,o,n)=>typeof o=="string"?(n===void 0||e.env.set(o,n),!0):!1,"set")})}return i(globalThis)?globalThis.Bun.process.env:process.env},"getEnv"),T=r(()=>t(globalThis)?[]:i(globalThis)?globalThis.Bun.process.execArgv:process.execArgv,"getExecArgv"),v=r(()=>t(globalThis)?globalThis.Deno.execPath():i(globalThis)?globalThis.Bun.process.execPath:process.execPath,"getExecPath"),p=r(()=>{if(t(globalThis)){const e=globalThis.Deno.build?.os??"unknown";return e==="windows"?"win32":e}return i(globalThis)?globalThis.Bun.platform??"unknown":process.platform},"getPlatform"),f=r(()=>{if(t(globalThis)){const e=globalThis.Deno.build?.arch??"unknown";return e==="x86_64"?"x64":e==="aarch64"?"arm64":e}return i(globalThis)?globalThis.Bun.process.arch:process.arch},"getArch"),x=r(()=>{if(t(globalThis)){const e=globalThis.Deno,s={};return e.version?.deno&&(s.deno=e.version.deno),e.version?.v8&&(s.v8=e.version.v8),e.version?.typescript&&(s.typescript=e.version.typescript),s}if(i(globalThis)){const e=globalThis.Bun,s={...e.process.versions};return e.version&&(s.bun=e.version),s}return process.versions},"getVersions"),d=r((e=0)=>{if(t(globalThis))throw globalThis.Deno.exit(e),new Error("Deno exit failed");if(i(globalThis))throw globalThis.Bun.process.exit(e),new Error("Bun exit failed");process.exit(e)},"exitProcess"),w=r((e,s)=>{if(t(globalThis))return()=>{};if(i(globalThis)){try{const n=globalThis.Bun;if(n.process?.on)return n.process.on(e,s),()=>{n.process?.removeListener&&n.process.removeListener(e,s)}}catch{}return()=>{}}const o=process;return o.on(e,s),()=>{o.removeListener(e,s)}},"onProcessEvent");export{b as a,p as b,f as c,u as d,d as e,h as f,x as g,v as h,T as i,w as o};