@visulima/error-handler 2.0.0-alpha.1 → 2.0.0-alpha.3

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 CHANGED
@@ -1,3 +1,22 @@
1
+ ## @visulima/error-handler [2.0.0-alpha.3](https://github.com/visulima/visulima/compare/@visulima/error-handler@2.0.0-alpha.2...@visulima/error-handler@2.0.0-alpha.3) (2025-12-11)
2
+
3
+ ### Bug Fixes
4
+
5
+ * update package OG images across multiple packages ([f08e4dd](https://github.com/visulima/visulima/commit/f08e4dd2b105ccb29c8412020a9c2be36d6c1e9e))
6
+
7
+
8
+ ### Dependencies
9
+
10
+ * **@visulima/boxen:** upgraded to 3.0.0-alpha.3
11
+ * **@visulima/error:** upgraded to 6.0.0-alpha.2
12
+
13
+ ## @visulima/error-handler [2.0.0-alpha.2](https://github.com/visulima/visulima/compare/@visulima/error-handler@2.0.0-alpha.1...@visulima/error-handler@2.0.0-alpha.2) (2025-12-08)
14
+
15
+
16
+ ### Dependencies
17
+
18
+ * **@visulima/boxen:** upgraded to 3.0.0-alpha.2
19
+
1
20
  ## @visulima/error-handler [2.0.0-alpha.1](https://github.com/visulima/visulima/compare/@visulima/error-handler@1.0.13...@visulima/error-handler@2.0.0-alpha.1) (2025-12-07)
2
21
 
3
22
  ### ⚠ BREAKING CHANGES
@@ -1,3 +1,3 @@
1
- var o=Object.defineProperty;var a=(r,e)=>o(r,"name",{value:e,configurable:!0});import{buildOutput as i}from"../packem_shared/cliHandler-nqs3YWf5.js";import{terminalOutput as f}from"../packem_shared/cliHandler-nqs3YWf5.js";var u=Object.defineProperty,l=a((r,e)=>u(r,"name",{value:e,configurable:!0}),"o");const d=l(async(r,e={})=>{const{errorAnsi:t,solutionBox:n}=await i(r,e);return n===void 0?t:`${t}
1
+ var o=Object.defineProperty;var a=(r,e)=>o(r,"name",{value:e,configurable:!0});import{buildOutput as i}from"../packem_shared/cliHandler-CeQ8tsGj.js";import{terminalOutput as f}from"../packem_shared/cliHandler-CeQ8tsGj.js";var u=Object.defineProperty,l=a((r,e)=>u(r,"name",{value:e,configurable:!0}),"o");const d=l(async(r,e={})=>{const{errorAnsi:t,solutionBox:n}=await i(r,e);return n===void 0?t:`${t}
2
2
 
3
3
  ${n}`},"ansiHandler");export{d as ansiHandler,f as cliHandler};
@@ -0,0 +1 @@
1
+ var h=Object.defineProperty;var c=(e,r)=>h(e,"name",{value:r,configurable:!0});import{createRequire as y}from"node:module";import{parseStacktrace as v}from"@visulima/error/stacktrace";import{boxen as x}from"@visulima/boxen";import{renderError as w}from"@visulima/error/error";import{ruleBasedFinder as F,errorHintFinder as B}from"@visulima/error/solution";const b=y(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,p=c(e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[r,t]=u.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return u.getBuiltinModule(e)}return b(e)},"__cjs_getBuiltinModule"),{readFile:_}=p("node:fs/promises"),{fileURLToPath:O}=p("node:url");var T=Object.defineProperty,A=c((e,r)=>T(e,"name",{value:r,configurable:!0}),"r");const q=["cjs","mjs"],P=["mdoc"],S=A(e=>{const r=(e.split("?")[0]??e).split(".").pop()?.toLowerCase();if(!r||q.includes(r))return"javascript";if(P.includes(r))return"markdown";switch(r){case"js":case"cjs":case"mjs":return"javascript";case"json":return"json";case"json5":return"json5";case"jsonc":return"jsonc";case"jsx":return"jsx";case"sql":return"sql";case"ts":case"cts":case"mts":return"typescript";case"tsx":return"tsx";case"xml":return"xml";case"md":return"markdown";case"mdx":return"mdx";case"svelte":return"svelte";case"vue":return"vue";case"html":return"html";case"css":return"css";case"scss":return"scss";case"less":return"less";case"sass":return"sass";case"stylus":return"stylus";case"styl":return"styl";case"txt":return"text";default:return"javascript"}},"findLanguageBasedOnExtension");var k=Object.defineProperty,m=c((e,r)=>k(e,"name",{value:r,configurable:!0}),"o");const l=new Map,L=m(async e=>{if(/^(?:http|https|file|data):/.test(e)){if(l.has(e))return l.get(e);if(e.startsWith("file:"))try{const r=O(e),t=await _(r,"utf8");return l.set(e,t),t}catch{return}try{const r=await fetch(e);if(!r.ok)return;const t=await r.text();return l.set(e,t),t}catch{return}}},"getFileSource");m(()=>{l.clear()},"clearFileSourceCache");var C=Object.defineProperty,f=c((e,r)=>C(e,"name",{value:r,configurable:!0}),"d");const M=f(e=>e.replace(/^\s*#+\s*/,"").trim(),"sanitizeTitle"),R=f(async(e,r,t=!1)=>{const a=[...r,F,B],s=v(e,{frameLimit:1})[0]??{};for await(const o of a.sort((i,n)=>i.priority-n.priority)){const{handle:i}=o;if(typeof i!="function")continue;const n=await i(e,{file:s.file??"",language:S(s.file??""),line:s.line??0,snippet:s.file?await L(s.file):""});if(n)return n}},"runSolutionFinders"),$=f(async(e,r)=>{const{solutionFinders:t=[],solutionTitle:a,color:s,debug:o=!1,...i}=r,n=w(e,{...i,...s?.codeFrame}),d=await R(e,t,o);if(!d)return{errorAnsi:n,solutionBox:void 0};const g=M(d.header??a??"A possible solution to this error"),j=x(d.body,{borderStyle:"round",padding:{top:1,right:2,bottom:1,left:2},margin:{top:0,right:0,bottom:0,left:0},headerText:`💡 ${g}`,headerAlignment:"left",textAlignment:"left",...s?.boxen});return{errorAnsi:n,solutionBox:j}},"buildOutput"),D=f(async(e,r={})=>{const{logger:t=console,...a}=r,{errorAnsi:s,solutionBox:o}=await $(e,a);t.error(s),o&&(t.log(""),t.log(o))},"terminalOutput");export{$ as buildOutput,D as terminalOutput};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/error-handler",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0-alpha.3",
4
4
  "description": "Error handlers for use in development and production environments.",
5
5
  "keywords": [
6
6
  "visulima",
@@ -134,8 +134,8 @@
134
134
  ],
135
135
  "dependencies": {
136
136
  "@tinyhttp/accepts": "^2.2.4",
137
- "@visulima/boxen": "3.0.0-alpha.1",
138
- "@visulima/error": "6.0.0-alpha.1",
137
+ "@visulima/boxen": "3.0.0-alpha.3",
138
+ "@visulima/error": "6.0.0-alpha.2",
139
139
  "http-errors": "^2.0.1",
140
140
  "http-status-codes": "^2.3.0",
141
141
  "jstoxml": "^7.0.1",
@@ -1 +0,0 @@
1
- var j=Object.defineProperty;var c=(e,r)=>j(e,"name",{value:r,configurable:!0});import{createRequire as y}from"node:module";import{parseStacktrace as v}from"@visulima/error/stacktrace";import{boxen as x}from"@visulima/boxen";import{renderError as w}from"@visulima/error/error";import{ruleBasedFinder as F,errorHintFinder as B}from"@visulima/error/solution";const b=y(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,p=c(e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[r,t]=u.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return u.getBuiltinModule(e)}return b(e)},"__cjs_getBuiltinModule"),{readFile:_}=p("node:fs/promises"),{fileURLToPath:O}=p("node:url");var T=Object.defineProperty,A=c((e,r)=>T(e,"name",{value:r,configurable:!0}),"t");const q=["cjs","mjs"],P=["mdoc"],S=A(e=>{const r=(e.split("?")[0]??e).split(".").pop()?.toLowerCase();if(!r||q.includes(r))return"javascript";if(P.includes(r))return"markdown";switch(r){case"js":return"javascript";case"json":return"json";case"json5":return"json5";case"jsonc":return"jsonc";case"jsx":return"jsx";case"sql":return"sql";case"ts":return"typescript";case"tsx":return"tsx";case"xml":return"xml";case"md":return"markdown";case"mdx":return"mdx";case"svelte":return"svelte";case"vue":return"vue";case"html":return"html";case"css":return"css";case"scss":return"scss";case"less":return"less";case"sass":return"sass";case"stylus":return"stylus";case"styl":return"styl";default:return"javascript"}},"findLanguageBasedOnExtension");var k=Object.defineProperty,m=c((e,r)=>k(e,"name",{value:r,configurable:!0}),"o");const l=new Map,L=m(async e=>{if(/^(?:http|https|file|data):/.test(e)){if(l.has(e))return l.get(e);if(e.startsWith("file:"))try{const r=O(e),t=await _(r,"utf8");return l.set(e,t),t}catch{return}try{const r=await fetch(e);if(!r.ok)return;const t=await r.text();return l.set(e,t),t}catch{return}}},"getFileSource");m(()=>{l.clear()},"clearFileSourceCache");var C=Object.defineProperty,f=c((e,r)=>C(e,"name",{value:r,configurable:!0}),"d");const M=f(e=>e.replace(/^\s*#+\s*/,"").trim(),"sanitizeTitle"),R=f(async(e,r,t=!1)=>{const a=[...r,F,B],s=v(e,{frameLimit:1})[0]??{};for await(const o of a.sort((i,n)=>i.priority-n.priority)){const{handle:i}=o;if(typeof i!="function")continue;const n=await i(e,{file:s.file??"",language:S(s.file??""),line:s.line??0,snippet:s.file?await L(s.file):""});if(n)return n}},"runSolutionFinders"),$=f(async(e,r)=>{const{solutionFinders:t=[],solutionTitle:a,color:s,debug:o=!1,...i}=r,n=w(e,{...i,...s?.codeFrame}),d=await R(e,t,o);if(!d)return{errorAnsi:n,solutionBox:void 0};const g=M(d.header??a??"A possible solution to this error"),h=x(d.body,{borderStyle:"round",padding:{top:1,right:2,bottom:1,left:2},margin:{top:0,right:0,bottom:0,left:0},headerText:`💡 ${g}`,headerAlignment:"left",textAlignment:"left",...s?.boxen});return{errorAnsi:n,solutionBox:h}},"buildOutput"),D=f(async(e,r={})=>{const{logger:t=console,...a}=r,{errorAnsi:s,solutionBox:o}=await $(e,a);t.error(s),o&&(t.log(""),t.log(o))},"terminalOutput");export{$ as buildOutput,D as terminalOutput};