@visulima/pail 3.0.1 → 3.0.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 +33 -1
- package/LICENSE.md +6 -6
- package/dist/index.server.js +2 -2
- package/dist/packem_shared/JsonReporter-DTBtHNaD.js +2 -0
- package/dist/packem_shared/PrettyReporter-APmxUrnh.js +12 -0
- package/dist/reporter/json/index.js +1 -1
- package/dist/reporter/pretty/index.js +1 -1
- package/dist/reporter/simple/simple-reporter.server.js +5 -5
- package/package.json +4 -4
- package/dist/packem_shared/JsonReporter-Bb6YuCj2.js +0 -2
- package/dist/packem_shared/PrettyReporter-CREln5bH.js +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
## @visulima/pail [3.0.3](https://github.com/visulima/visulima/compare/@visulima/pail@3.0.2...@visulima/pail@3.0.3) (2025-11-05)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* update dependencies across multiple packages ([36a47f2](https://github.com/visulima/visulima/commit/36a47f26d65d25a7b4d8371186710e7d0ab61a2b))
|
|
6
|
+
* Upgraded `type-fest` to version `5.2.0` ([bd6cd53](https://github.com/visulima/visulima/commit/bd6cd5367ff102a7487372dc1ca7742a41c69ea9))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Dependencies
|
|
10
|
+
|
|
11
|
+
* **@visulima/colorize:** upgraded to 1.4.26
|
|
12
|
+
* **@visulima/error:** upgraded to 5.0.3
|
|
13
|
+
* **@visulima/fmt:** upgraded to 1.1.18
|
|
14
|
+
* **@visulima/inspector:** upgraded to 1.0.27
|
|
15
|
+
* **@visulima/redact:** upgraded to 2.0.2
|
|
16
|
+
* **@visulima/string:** upgraded to 2.0.3
|
|
17
|
+
|
|
18
|
+
## @visulima/pail [3.0.2](https://github.com/visulima/visulima/compare/@visulima/pail@3.0.1...@visulima/pail@3.0.2) (2025-10-22)
|
|
19
|
+
|
|
20
|
+
### Miscellaneous Chores
|
|
21
|
+
|
|
22
|
+
* update package dependencies and configurations ([7bfe7e7](https://github.com/visulima/visulima/commit/7bfe7e71869580900aab50efb064b4293994ed9a))
|
|
23
|
+
|
|
24
|
+
### Tests
|
|
25
|
+
|
|
26
|
+
* enhance unit tests with beforeEach for mock cleanup ([aba2a50](https://github.com/visulima/visulima/commit/aba2a50d5031193fbb0902cfa407b5e226c43ced))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Dependencies
|
|
30
|
+
|
|
31
|
+
* **@visulima/string:** upgraded to 2.0.2
|
|
32
|
+
|
|
1
33
|
## @visulima/pail [3.0.1](https://github.com/visulima/visulima/compare/@visulima/pail@3.0.0...@visulima/pail@3.0.1) (2025-10-21)
|
|
2
34
|
|
|
3
35
|
### Bug Fixes
|
|
@@ -71,7 +103,7 @@
|
|
|
71
103
|
### Bug Fixes
|
|
72
104
|
|
|
73
105
|
* consolidate ESLint configuration and remove obsolete files for improved maintainability ([5b3e825](https://github.com/visulima/visulima/commit/5b3e825f3f2f428c9fb0950c300de10b42b657f9))
|
|
74
|
-
* update @visulima/packem to 2.0.0-alpha.
|
|
106
|
+
* update @visulima/packem to 2.0.0-alpha.32 across multiple packages for improved compatibility ([27b346e](https://github.com/visulima/visulima/commit/27b346eaa1c0fb0e420d9a9824482028307f4249))
|
|
75
107
|
|
|
76
108
|
### Miscellaneous Chores
|
|
77
109
|
|
package/LICENSE.md
CHANGED
|
@@ -34,7 +34,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
34
34
|
|
|
35
35
|
> MIT License
|
|
36
36
|
>
|
|
37
|
-
> Copyright (c)
|
|
37
|
+
> Copyright (c) 2025 visulima
|
|
38
38
|
>
|
|
39
39
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
40
40
|
> of this software and associated documentation files (the "Software"), to deal
|
|
@@ -210,7 +210,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
210
210
|
|
|
211
211
|
> MIT License
|
|
212
212
|
>
|
|
213
|
-
> Copyright (c)
|
|
213
|
+
> Copyright (c) 2025 visulima
|
|
214
214
|
>
|
|
215
215
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
216
216
|
> of this software and associated documentation files (the "Software"), to deal
|
|
@@ -239,7 +239,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
239
239
|
|
|
240
240
|
> MIT License
|
|
241
241
|
>
|
|
242
|
-
> Copyright (c)
|
|
242
|
+
> Copyright (c) 2025 visulima
|
|
243
243
|
>
|
|
244
244
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
245
245
|
> of this software and associated documentation files (the "Software"), to deal
|
|
@@ -617,7 +617,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
617
617
|
|
|
618
618
|
> MIT License
|
|
619
619
|
>
|
|
620
|
-
> Copyright (c)
|
|
620
|
+
> Copyright (c) 2025 visulima
|
|
621
621
|
>
|
|
622
622
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
623
623
|
> of this software and associated documentation files (the "Software"), to deal
|
|
@@ -795,7 +795,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
795
795
|
|
|
796
796
|
> MIT License
|
|
797
797
|
>
|
|
798
|
-
> Copyright (c)
|
|
798
|
+
> Copyright (c) 2025 visulima
|
|
799
799
|
>
|
|
800
800
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
801
801
|
> of this software and associated documentation files (the "Software"), to deal
|
|
@@ -827,7 +827,7 @@ Repository: git+https://github.com/visulima/visulima.git
|
|
|
827
827
|
|
|
828
828
|
> MIT License
|
|
829
829
|
>
|
|
830
|
-
> Copyright (c)
|
|
830
|
+
> Copyright (c) 2025 visulima
|
|
831
831
|
>
|
|
832
832
|
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
833
833
|
> of this software and associated documentation files (the "Software"), to deal
|
package/dist/index.server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var j=Object.defineProperty;var o=(r,t)=>j(r,"name",{value:t,configurable:!0});import{createRequire as I}from"node:module";import{O as x,i as $,B as O,a as f}from"./packem_shared/format-label-DqvZRRR6.js";import{a as R}from"./packem_shared/pail.browser-BmHoDvEA.js";import{applyStyleToOptions as g,ProgressBar as A,MultiProgressBar as N}from"./packem_shared/getBarChar-mKDZW32R.js";import{getBarChar as bt}from"./packem_shared/getBarChar-mKDZW32R.js";import{E as D}from"./packem_shared/constants-DKfCaSUR.js";import{n as H}from"./packem_shared/write-stream-CD8XFv1L.js";import k from"./processor/message-formatter-processor.js";import{PrettyReporter as C}from"./packem_shared/PrettyReporter-
|
|
1
|
+
var j=Object.defineProperty;var o=(r,t)=>j(r,"name",{value:t,configurable:!0});import{createRequire as I}from"node:module";import{O as x,i as $,B as O,a as f}from"./packem_shared/format-label-DqvZRRR6.js";import{a as R}from"./packem_shared/pail.browser-BmHoDvEA.js";import{applyStyleToOptions as g,ProgressBar as A,MultiProgressBar as N}from"./packem_shared/getBarChar-mKDZW32R.js";import{getBarChar as bt}from"./packem_shared/getBarChar-mKDZW32R.js";import{E as D}from"./packem_shared/constants-DKfCaSUR.js";import{n as H}from"./packem_shared/write-stream-CD8XFv1L.js";import k from"./processor/message-formatter-processor.js";import{PrettyReporter as C}from"./packem_shared/PrettyReporter-APmxUrnh.js";const P=I(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,E=o(r=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[t,e]=l.versions.node.split(".").map(Number);if(t>22||t===22&&e>=3||t===20&&e>=16)return l.getBuiltinModule(r)}return P(r)},"__cjs_getBuiltinModule"),{stdout:y,stderr:_,env:d}=l,{StringDecoder:T}=E("node:string_decoder");var G=Object.defineProperty,V=o((r,t)=>G(r,"name",{value:t,configurable:!0}),"l");class q{static{o(this,"g")}static{V(this,"InteractiveManager")}#t;#e=!1;#r=!1;#s=0;#i=0;constructor(t,e){this.#t={stderr:e,stdout:t}}get lastLength(){return this.#s}get outside(){return this.#i}get isHooked(){return this.#e}get isSuspended(){return this.#r}erase(t,e=this.#s){if(this.#t[t]===void 0)throw new TypeError(`Stream "${t}" is not available`);this.#t[t].erase(e)}hook(){return this.#e||(Object.values(this.#t).forEach(t=>t.active()),this.#o(!0)),this.#e}resume(t,e){this.#r&&(this.#r=!1,e&&this.erase(t,e),this.#s=0,Object.values(this.#t).forEach(s=>s.active()))}suspend(t,e=!0){this.#r||(this.#r=!0,e&&this.erase(t),Object.values(this.#t).forEach(s=>s.renew()))}unhook(t=!0){return this.#e&&(Object.values(this.#t).forEach(e=>e.inactive(t)),this.#o()),!this.#e}update(t,e,s=0){if(e.length>0){if(this.#t[t]===void 0)throw new TypeError(`Stream "${t}" is not available`);const a=this.#t[t],{columns:p,rows:i}=x(),h=s>i?i-1:Math.max(0,Math.min(i-1,s)),c=this.lastLength-h,u=Math.max(c-i,this.outside);let n=e.reduce((L,M)=>[...L,$(M,{trim:!1,width:p,wrapMode:O.STRICT_WIDTH})],[]);i<=c?(a.erase(i),h<u&&(n=n.slice(u-h+1))):c&&a.erase(c),a.write(`${n.join(`
|
|
2
2
|
`)}
|
|
3
|
-
`),this.#s=u?u+n.length+1:n.length,this.#i=Math.max(this.lastLength-i,this.outside)}}#o(t=!1){this.#e=t,this.#s=0,this.#i=0}}var Y=Object.defineProperty,b=o((r,t)=>Y(r,"name",{value:t,configurable:!0}),"t$2");const v="\x1B[2J",J="\x1B[2K",U=b((r=1)=>`${"\x1B["+r}A`,"cursorUp"),w=process.platform==="win32"?`${v}\x1B[0f`:`${v}\x1B[3J\x1B[H`,K="\x1B[?25l",W="\x1B[?25h",z=b(r=>{let t="";for(let e=0;e<r;e++)t+=J+(e<r-1?U():"");return r&&(t+="\x1B[G"),t},"eraseLines");var F=Object.defineProperty,Q=o((r,t)=>F(r,"name",{value:t,configurable:!0}),"
|
|
3
|
+
`),this.#s=u?u+n.length+1:n.length,this.#i=Math.max(this.lastLength-i,this.outside)}}#o(t=!1){this.#e=t,this.#s=0,this.#i=0}}var Y=Object.defineProperty,b=o((r,t)=>Y(r,"name",{value:t,configurable:!0}),"t$2");const v="\x1B[2J",J="\x1B[2K",U=b((r=1)=>`${"\x1B["+r}A`,"cursorUp"),w=process.platform==="win32"?`${v}\x1B[0f`:`${v}\x1B[3J\x1B[H`,K="\x1B[?25l",W="\x1B[?25h",z=b(r=>{let t="";for(let e=0;e<r;e++)t+=J+(e<r-1?U():"");return r&&(t+="\x1B[G"),t},"eraseLines");var F=Object.defineProperty,Q=o((r,t)=>F(r,"name",{value:t,configurable:!0}),"s$1");let m=class S{static{o(this,"t")}static{Q(this,"InteractiveStreamHook")}static DRAIN=!0;#t=new T;#e=[];#r;#s;constructor(t){this.#r=t.write,this.#s=t}active(){this.write(K),this.#s.write=(t,...e)=>{const s=e.at(-1);return this.#e.push(this.#t.write(typeof t=="string"?Buffer.from(t,typeof e[0]=="string"?e[0]:void 0):Buffer.from(t))),typeof s=="function"&&s(),S.DRAIN}}erase(t){t>0&&this.write(z(t+1))}inactive(t=!1){this.#e.length>0&&(t&&this.write(`
|
|
4
4
|
`),this.#e.forEach(e=>{this.write(e)}),this.#e=[]),this.renew()}renew(){this.#s.write=this.#r,this.write(W)}write(t){this.#r.apply(this.#s,[t])}};var X=Object.defineProperty,Z=o((r,t)=>X(r,"name",{value:t,configurable:!0}),"c");class tt{static{o(this,"v")}static{Z(this,"RawReporter")}#t;#e;#r;#s=!1;#i;constructor(t={}){this.#t=y,this.#e=_,this.#i=t}setStdout(t){this.#t=t}setStderr(t){this.#e=t}setInteractiveManager(t){this.#r=t}setIsInteractive(t){this.#s=t}log(t){const{context:e,groups:s,message:a,type:p}=t,i=[];if(a!==D){const n=typeof a=="string"?a:f(a,this.#i);i.push(n)}e&&i.push(...e.map(n=>typeof n=="object"?` ${f(n,this.#i)}`:` ${n}`));const h=["error","trace","warn"].includes(p.level)?"stderr":"stdout",c=h==="stderr"?this.#e:this.#t,u=s.map(()=>" ").join("");this.#s&&this.#r!==void 0&&c.isTTY?this.#r.update(h,(u+i.join("")).split(`
|
|
5
5
|
`),0):H(u+i.join(""),c)}}var et=Object.defineProperty,rt=o((r,t)=>et(r,"name",{value:t,configurable:!0}),"o");let st=class extends R{static{o(this,"L")}constructor(t){const{interactive:e,rawReporter:s,reporters:a,stderr:p,stdout:i,...h}=t;super(h),this.options=t,this.interactive=e??!1,this.stdout=i,this.stderr=p,this.interactive&&(this.interactiveManager=new q(new m(this.stdout),new m(this.stderr))),Array.isArray(a)&&this.registerReporters(a),this.rawReporter=this.extendReporter(t.rawReporter??new tt)}static{rt(this,"PailServerImpl")}stdout;stderr;interactiveManager;interactive;scope(...t){if(t.length===0)throw new Error("No scope name was defined.");return this.scopeName=t.flat(),this}getInteractiveManager(){return this.interactiveManager}wrapStd(){this.#t(this.stdout,"log"),this.#t(this.stderr,"log")}restoreStd(){this.#e(this.stdout),this.#e(this.stderr)}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}createProgressBar(t){const e=g(t);return new A(e,this.interactiveManager)}createMultiProgressBar(t={}){const e=g(t);return new N(e,this.interactiveManager)}clear(){this.stdout.write(w),this.stderr.write(w)}extendReporter(t){return typeof t.setStdout=="function"&&t.setStdout(this.stdout),typeof t.setStderr=="function"&&t.setStderr(this.stderr),typeof t.setLoggerTypes=="function"&&t.setLoggerTypes(this.types),typeof t.setStringify=="function"&&t.setStringify(this.stringify),typeof t.setIsInteractive=="function"&&t.setIsInteractive(this.interactive),this.interactive&&typeof t.setInteractiveManager=="function"&&t.setInteractiveManager(this.interactiveManager),t}#t(t,e){t&&(t.__write||(t.__write=t.write),t.write=s=>{this[e](String(s).trim())})}#e(t){t&&t.__write&&(t.write=t.__write,delete t.__write)}};const it=st;var ot=Object.defineProperty,B=o((r,t)=>ot(r,"name",{value:t,configurable:!0}),"t");const at=B(()=>d.NODE_ENV==="debug"||d.DEBUG!==void 0?"debug":d.NODE_ENV==="test"?"warning":"informational","getDefaultLogLevel"),nt=B(r=>{let t=at();return d.PAIL_LOG_LEVEL!==void 0&&(t=d.PAIL_LOG_LEVEL),new it({logLevel:t,processors:[new k],reporters:[new C],stderr:_,stdout:y,...r})},"createPail"),mt=nt();export{N as MultiProgressBar,A as ProgressBar,nt as createPail,bt as getBarChar,mt as pail};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var i=Object.defineProperty;var r=(t,e)=>i(t,"name",{value:e,configurable:!0});import{createRequire as c}from"node:module";import{n as p}from"./write-stream-CD8XFv1L.js";import{AbstractJsonReporter as d}from"./AbstractJsonReporter-UftN6CIL.js";const m=c(import.meta.url),a=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{stdout:n,stderr:u}=a;var l=Object.defineProperty,f=r((t,e)=>l(t,"name",{value:e,configurable:!0}),"e");class j extends d{static{r(this,"d")}static{f(this,"JsonReporter")}#e;#t;constructor(e={}){super(e),this.#e=n,this.#t=u}setStdout(e){this.#e=e}setStderr(e){this.#t=e}_log(e,s){const o=["error","warn"].includes(s)?this.#t:this.#e;p(`${e}
|
|
2
|
+
`,o)}}export{j as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var O=Object.defineProperty;var T=(n,e)=>O(n,"name",{value:e,configurable:!0});import{createRequire as q}from"node:module";import Y,{red as b,greenBright as D,cyan as G,green as H,grey as r,white as W,bgGrey as z,underline as C}from"@visulima/colorize";import{u as J,O as K,o as g,n as N,a as I,i as Q,B as U,G as M}from"./format-label-DqvZRRR6.js";import{E as X}from"./constants-DKfCaSUR.js";import{A as Z,s as ee}from"./abstract-pretty-reporter-CUtSm20r.js";import{s as te}from"./get-longest-label-B0NrI-o2.js";import{n as se}from"./write-stream-CD8XFv1L.js";const ae=q(import.meta.url),B=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{stdout:F,stderr:V}=B;var re=Object.defineProperty,L=T((n,e)=>re(n,"name",{value:e,configurable:!0}),"x");const w=L(n=>!/[\\/]pail[\\/]dist/.test(n),"pailFileFilter");class fe extends Z{static{T(this,"PrettyReporter")}static{L(this,"PrettyReporter")}#t;#s;#r;#o=!1;#i;#e;constructor(e={}){const{error:p,inspect:i,...a}=e;super({uppercase:{label:!0,...a.uppercase},...a}),this.#i={...J,...i},this.#e={...p,color:{fileLine:H,hint:G,marker:b,message:b,method:D,title:b}},this.#t=F,this.#s=V}setStdout(e){this.#t=e}setStderr(e){this.#s=e}setInteractiveManager(e){this.#r=e}setIsInteractive(e){this.#o=e}log(e){this._log(this._formatMessage(e),e.type.level)}_formatMessage(e){const{columns:p}=K();let i=p;typeof this.styles.messageLength=="number"&&(i=this.styles.messageLength);const{badge:a,context:j,date:u,error:E,file:c,groups:m,label:d,message:f,prefix:y,repeated:v,scope:l,suffix:$,traceError:S,type:k}=e,{color:A}=this.loggerTypes[k.name],P=A?Y[A]:W,h=m.map(()=>" ").join(""),t=[];if(m.length>0&&t.push(`${h+r(`[${m.at(-1)}]`)} `),u&&t.push(`${r(this.styles.dateFormatter(typeof u=="string"?new Date(u):u))} `),a)t.push(P(a));else{const s=ee(this.loggerTypes);s.length>0&&t.push(`${r(".".repeat(s.length))} `)}const R=te(this.loggerTypes);if(d){const s=g(R),o=g(d);t.push(`${P(N(d,this.styles))} `,r(".".repeat(Math.max(0,s-o))))}else t.push(r(".".repeat(R.length+2)));v&&t.push(`${z.white(`[${v}x]`)} `),Array.isArray(l)&&l.length>0&&t.push(` ${r(`[${l.join(" > ")}]`)} `),y&&t.push(`${r(`${Array.isArray(l)&&l.length>0?". ":" "}[${this.styles.underline.prefix?C(y):y}]`)} `);const _=g(t.join(" "));if(c){const s=c.name+(c.line?`:${c.line}`:""),o=g(s);if(o+_+2>i)t.push(r(` ${s}`));else{const x=Math.max(0,i-_-o-2);t.push(r(`${".".repeat(x)} ${s}`))}}else t.push(r(".".repeat(Math.max(0,i-_-1))));if(t.length>0&&t.push(`
|
|
2
|
+
|
|
3
|
+
`),f!==X){const s=typeof f=="string"?f:I(f,this.#i);t.push(h+Q(s,{trim:!1,width:i-3,wrapMode:U.STRICT_WIDTH}))}if(j){let s=!1;t.push(...j.map(o=>{if(o instanceof Error)return s=!0,`
|
|
4
|
+
|
|
5
|
+
${M(o,{...this.#e,filterStacktrace:w,prefix:h})}`;if(typeof o=="object")return` ${I(o,this.#i)}`;const x=(s?`
|
|
6
|
+
|
|
7
|
+
`:" ")+o;return s=!1,x}))}return E&&t.push(M(E,{...this.#e,filterStacktrace:w,prefix:h})),S&&t.push(`
|
|
8
|
+
|
|
9
|
+
${M(S,{...this.#e,filterStacktrace:w,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:h})}`),$&&t.push(`
|
|
10
|
+
`,h+r(this.styles.underline.suffix?C($):$)),t.join("")}_log(e,p){const i=["error","trace","warn"].includes(p)?"stderr":"stdout",a=i==="stderr"?this.#s:this.#t;this.#o&&this.#r!==void 0&&a.isTTY?this.#r.update(i,e.split(`
|
|
11
|
+
`),0):se(`${e}
|
|
12
|
+
`,a)}}export{fe as PrettyReporter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AbstractJsonReporter as e}from"../../packem_shared/AbstractJsonReporter-UftN6CIL.js";import{default as p}from"../../packem_shared/JsonReporter-
|
|
1
|
+
import{AbstractJsonReporter as e}from"../../packem_shared/AbstractJsonReporter-UftN6CIL.js";import{default as p}from"../../packem_shared/JsonReporter-DTBtHNaD.js";export{e as AbstractJsonReporter,p as JsonReporter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PrettyReporter as t}from"../../packem_shared/PrettyReporter-
|
|
1
|
+
import{PrettyReporter as t}from"../../packem_shared/PrettyReporter-APmxUrnh.js";export{t as PrettyReporter};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var q=Object.defineProperty;var
|
|
1
|
+
var q=Object.defineProperty;var x=(a,e)=>q(a,"name",{value:e,configurable:!0});import{createRequire as F}from"node:module";import G,{red as T,greenBright as z,cyan as H,green as W,grey as o,bold as R,white as J,bgGrey as K,underline as I}from"@visulima/colorize";import{u as N,O as Q,o as d,n as U,a as k,i as X,B as Z,G as _}from"../../packem_shared/format-label-DqvZRRR6.js";import{E as ee}from"../../packem_shared/constants-DKfCaSUR.js";import{A as te,s as re}from"../../packem_shared/abstract-pretty-reporter-CUtSm20r.js";import{s as se}from"../../packem_shared/get-longest-label-B0NrI-o2.js";import{n as ie}from"../../packem_shared/write-stream-CD8XFv1L.js";const pe=F(import.meta.url),V=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{stdout:Y,stderr:D}=V;var oe=Object.defineProperty,A=x((a,e)=>oe(a,"name",{value:e,configurable:!0}),"b");const j=A(a=>!/[\\/]pail[\\/]dist/.test(a),"pailFileFilter");class me extends te{static{x(this,"SimpleReporter")}static{A(this,"SimpleReporter")}#t;#r;#s;#o=!1;#i;#e;constructor(e={}){const{error:n,inspect:p,...i}=e;super({uppercase:{label:!0,...i.uppercase},...i}),this.#i={...N,indent:void 0,...p},this.#e={...n,color:{fileLine:W,hint:H,marker:T,message:T,method:z,title:T}},this.#t=Y,this.#r=D}setStdout(e){this.#t=e}setStderr(e){this.#r=e}setInteractiveManager(e){this.#s=e}setIsInteractive(e){this.#o=e}log(e){const n=this.formatMessage(e),p=e.type.level,i=["error","trace","warn"].includes(p)?"stderr":"stdout",h=i==="stderr"?this.#r:this.#t;this.#o&&this.#s!==void 0&&h.isTTY?this.#s.update(i,n.split(`
|
|
2
2
|
`),0):ie(`${n}
|
|
3
|
-
`,h)}formatMessage(e){const{columns:n}=Q();let p=n;typeof this.styles.messageLength=="number"&&(p=this.styles.messageLength);const{badge:i,context:h,date:
|
|
3
|
+
`,h)}formatMessage(e){const{columns:n}=Q();let p=n;typeof this.styles.messageLength=="number"&&(p=this.styles.messageLength);const{badge:i,context:h,date:c,error:S,file:u,groups:m,label:g,message:f,prefix:y,repeated:v,scope:$,suffix:b,traceError:w,type:B}=e,{color:E}=this.loggerTypes[B.name],M=E?G[E]:J,l=m.map(()=>" ").join(""),t=[];if(m.length>0&&t.push(`${l+o(`[${m.at(-1)}]`)} `),c&&t.push(`${o(this.styles.dateFormatter(typeof c=="string"?new Date(c):c))} `),i)t.push(R(M(i)));else{const r=re(this.loggerTypes);r.length>0&&t.push(o(" ".repeat(r.length)))}const L=se(this.loggerTypes),C=d(L);if(g){const r=d(g),s=Math.max(0,C-r);t.push(`${R(M(U(g,this.styles)))} `," ".repeat(s))}else t.push(" ".repeat(C+1));v&&t.push(`${K.white(`[${v}x]`)} `),Array.isArray($)&&$.length>0&&t.push(`${o(`[${$.join(" > ")}]`)} `),y&&t.push(`${o(`[${this.styles.underline.prefix?I(y):y}]`)} `);const O=d(t.join(""));if(f!==ee){const r=typeof f=="string"?f:k(f,this.#i);t.push(l+X(r,{trim:!1,width:p-3,wrapMode:Z.STRICT_WIDTH}))}if(h){let r=!1;t.push(...h.map(s=>{if(s instanceof Error)return r=!0,`
|
|
4
4
|
|
|
5
|
-
${
|
|
5
|
+
${_(s,{...this.#e,filterStacktrace:j,prefix:l})}`;if(typeof s=="object")return` ${k(s,this.#i)}`;const P=(r?`
|
|
6
6
|
|
|
7
|
-
`:" ")+s;return r=!1,P}))}if(
|
|
7
|
+
`:" ")+s;return r=!1,P}))}if(S&&t.push(_(S,{...this.#e,filterStacktrace:j,prefix:l})),w&&t.push(`
|
|
8
8
|
|
|
9
|
-
${
|
|
9
|
+
${_(w,{...this.#e,filterStacktrace:j,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:l})}`),b&&t.push(` ${l}${o(this.styles.underline.suffix?I(b):b)}`),u){const r=u.name+(u.line?`:${u.line}`:""),s=Math.max(0,O-d("Caller: "));t.push(`
|
|
10
10
|
`,o("Caller: ")," ".repeat(s),r,`
|
|
11
11
|
`)}return t.join("")}}export{me as SimpleReporter};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/pail",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Highly configurable Logger for Node.js, Edge and Browser.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ansi",
|
|
@@ -141,11 +141,11 @@
|
|
|
141
141
|
"LICENSE.md"
|
|
142
142
|
],
|
|
143
143
|
"dependencies": {
|
|
144
|
-
"@visulima/colorize": "1.4.
|
|
145
|
-
"type-fest": "^5.
|
|
144
|
+
"@visulima/colorize": "1.4.26",
|
|
145
|
+
"type-fest": "^5.2.0"
|
|
146
146
|
},
|
|
147
147
|
"peerDependencies": {
|
|
148
|
-
"@visulima/redact": "2.0.
|
|
148
|
+
"@visulima/redact": "2.0.2",
|
|
149
149
|
"rotating-file-stream": "^3.2.7"
|
|
150
150
|
},
|
|
151
151
|
"peerDependenciesMeta": {
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var i=Object.defineProperty;var r=(t,e)=>i(t,"name",{value:e,configurable:!0});import{createRequire as n}from"node:module";import{n as d}from"./write-stream-CD8XFv1L.js";import{AbstractJsonReporter as l}from"./AbstractJsonReporter-UftN6CIL.js";const h=n(import.meta.url),c=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const{stdout:u,stderr:a}=c;var p=Object.defineProperty,f=r((t,e)=>p(t,"name",{value:e,configurable:!0}),"e");class j extends l{static{r(this,"d")}static{f(this,"JsonReporter")}#e;#t;constructor(e={}){super(e),this.#e=u,this.#t=a}setStdout(e){this.#e=e}setStderr(e){this.#t=e}_log(e,s){const o=["error","warn"].includes(s)?this.#t:this.#e;d(`${e}
|
|
2
|
-
`,o)}}export{j as default};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
var k=Object.defineProperty;var M=(a,e)=>k(a,"name",{value:e,configurable:!0});import{createRequire as O}from"node:module";import Y,{red as b,greenBright as D,cyan as G,green as H,grey as r,white as N,bgGrey as W,underline as C}from"@visulima/colorize";import{u as z,O as J,o as g,n as K,a as I,i as Q,B as U,G as T}from"./format-label-DqvZRRR6.js";import{E as X}from"./constants-DKfCaSUR.js";import{A as Z,s as ee}from"./abstract-pretty-reporter-CUtSm20r.js";import{s as te}from"./get-longest-label-B0NrI-o2.js";import{n as se}from"./write-stream-CD8XFv1L.js";const ne=O(import.meta.url),q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process;const{stdout:F,stderr:V}=q;var re=Object.defineProperty,B=M((a,e)=>re(a,"name",{value:e,configurable:!0}),"x");const j=B(a=>!/[\\/]pail[\\/]dist/.test(a),"pailFileFilter");class fe extends Z{static{M(this,"PrettyReporter")}static{B(this,"PrettyReporter")}#t;#s;#r;#o=!1;#i;#e;constructor(e={}){const{error:h,inspect:i,...n}=e;super({uppercase:{label:!0,...n.uppercase},...n}),this.#i={...z,...i},this.#e={...h,color:{fileLine:H,hint:G,marker:b,message:b,method:D,title:b}},this.#t=F,this.#s=V}setStdout(e){this.#t=e}setStderr(e){this.#s=e}setInteractiveManager(e){this.#r=e}setIsInteractive(e){this.#o=e}log(e){this._log(this._formatMessage(e),e.type.level)}_formatMessage(e){const{columns:h}=J();let i=h;typeof this.styles.messageLength=="number"&&(i=this.styles.messageLength);const{badge:n,context:v,date:u,error:w,file:c,groups:d,label:m,message:f,prefix:y,repeated:E,scope:l,suffix:$,traceError:S,type:L}=e,{color:A}=this.loggerTypes[L.name],P=A?Y[A]:N,p=d.map(()=>" ").join(""),t=[];if(d.length>0&&t.push(`${p+r(`[${d.at(-1)}]`)} `),u&&t.push(`${r(this.styles.dateFormatter(typeof u=="string"?new Date(u):u))} `),n)t.push(P(n));else{const s=ee(this.loggerTypes);s.length>0&&t.push(`${r(".".repeat(s.length))} `)}const R=te(this.loggerTypes);if(m){const s=g(R),o=g(m);t.push(`${P(K(m,this.styles))} `,r(".".repeat(Math.max(0,s-o))))}else t.push(r(".".repeat(R.length+2)));E&&t.push(`${W.white(`[${E}x]`)} `),Array.isArray(l)&&l.length>0&&t.push(` ${r(`[${l.join(" > ")}]`)} `),y&&t.push(`${r(`${Array.isArray(l)&&l.length>0?". ":" "}[${this.styles.underline.prefix?C(y):y}]`)} `);const _=g(t.join(" "));if(c){const s=c.name+(c.line?`:${c.line}`:""),o=g(s);if(o+_+2>i)t.push(r(` ${s}`));else{const x=Math.max(0,i-_-o-2);t.push(r(`${".".repeat(x)} ${s}`))}}else t.push(r(".".repeat(Math.max(0,i-_-1))));if(t.length>0&&t.push(`
|
|
2
|
-
|
|
3
|
-
`),f!==X){const s=typeof f=="string"?f:I(f,this.#i);t.push(p+Q(s,{trim:!1,width:i-3,wrapMode:U.STRICT_WIDTH}))}if(v){let s=!1;t.push(...v.map(o=>{if(o instanceof Error)return s=!0,`
|
|
4
|
-
|
|
5
|
-
${T(o,{...this.#e,filterStacktrace:j,prefix:p})}`;if(typeof o=="object")return` ${I(o,this.#i)}`;const x=(s?`
|
|
6
|
-
|
|
7
|
-
`:" ")+o;return s=!1,x}))}return w&&t.push(T(w,{...this.#e,filterStacktrace:j,prefix:p})),S&&t.push(`
|
|
8
|
-
|
|
9
|
-
${T(S,{...this.#e,filterStacktrace:j,hideErrorCauseCodeView:!0,hideErrorCodeView:!0,hideErrorErrorsCodeView:!0,hideMessage:!0,prefix:p})}`),$&&t.push(`
|
|
10
|
-
`,p+r(this.styles.underline.suffix?C($):$)),t.join("")}_log(e,h){const i=["error","trace","warn"].includes(h)?"stderr":"stdout",n=i==="stderr"?this.#s:this.#t;this.#o&&this.#r!==void 0&&n.isTTY?this.#r.update(i,e.split(`
|
|
11
|
-
`),0):se(`${e}
|
|
12
|
-
`,n)}}export{fe as PrettyReporter};
|