@visulima/pail 1.2.0 → 1.2.1
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 +7 -0
- package/LICENSE.md +11 -0
- package/README.md +1 -0
- package/dist/index.browser.cjs +1 -1
- package/dist/index.browser.d.cts +5 -5
- package/dist/index.browser.d.mts +5 -5
- package/dist/index.browser.d.ts +5 -5
- package/dist/index.browser.mjs +1 -1
- package/dist/index.server.cjs +4 -4
- package/dist/index.server.d.cts +7 -7
- package/dist/index.server.d.mts +7 -7
- package/dist/index.server.d.ts +7 -7
- package/dist/index.server.mjs +3 -3
- package/dist/processor.browser.d.cts +1 -1
- package/dist/processor.browser.d.mts +1 -1
- package/dist/processor.browser.d.ts +1 -1
- package/dist/processor.server.cjs +1 -1
- package/dist/processor.server.d.cts +3 -3
- package/dist/processor.server.d.mts +3 -3
- package/dist/processor.server.d.ts +3 -3
- package/dist/processor.server.mjs +1 -1
- package/dist/reporter.browser.cjs +2 -2
- package/dist/reporter.browser.d.cts +4 -4
- package/dist/reporter.browser.d.mts +4 -4
- package/dist/reporter.browser.d.ts +4 -4
- package/dist/reporter.browser.mjs +2 -2
- package/dist/reporter.server.cjs +6 -6
- package/dist/reporter.server.d.cts +7 -7
- package/dist/reporter.server.d.mts +7 -7
- package/dist/reporter.server.d.ts +7 -7
- package/dist/reporter.server.mjs +15 -7
- package/dist/shared/{pail.BU1VqUN1.cjs → pail.3G15muTS.cjs} +1 -1
- package/dist/shared/pail.B-Tp78gL.cjs +1 -0
- package/dist/shared/{pail.DwWkopDF.cjs → pail.B0AqLGpo.cjs} +1 -1
- package/dist/shared/{pail.DF5wQ_KA.mjs → pail.BP95fgQZ.mjs} +1 -1
- package/dist/shared/{pail.D3wUM96H.mjs → pail.BlF6_AB7.mjs} +1 -1
- package/dist/shared/{pail.CHPrWCMI.d.ts → pail.BsONPwkb.d.mts} +3 -3
- package/dist/shared/{pail.DrhFTME0.d.cts → pail.BxGKtnGM.d.cts} +70 -17
- package/dist/shared/{pail.DrhFTME0.d.mts → pail.BxGKtnGM.d.mts} +70 -17
- package/dist/shared/{pail.DrhFTME0.d.ts → pail.BxGKtnGM.d.ts} +70 -17
- package/dist/shared/pail.Bz_4Ee-U.mjs +1 -0
- package/dist/shared/{pail.BP9NvmFd.mjs → pail.CKgnzwt6.mjs} +1 -1
- package/dist/shared/{pail.DW7tr027.d.cts → pail.CQyMoJfJ.d.ts} +3 -3
- package/dist/shared/{pail.Bdbc3_zr.d.ts → pail.CW2izieN.d.cts} +3 -3
- package/dist/shared/{pail.Cc48XFs7.d.mts → pail.CY7GSNwy.d.cts} +3 -3
- package/dist/shared/pail.Cn4oOlxI.mjs +1 -0
- package/dist/shared/{pail.qb_TjNJQ.d.mts → pail.CyfBrVNa.d.mts} +3 -3
- package/dist/shared/{pail.CzAicDBX.mjs → pail.D5MfZlaK.mjs} +1 -1
- package/dist/shared/pail.DFhaFnnA.cjs +1 -0
- package/dist/shared/pail.DbDZ7fkY.mjs +1 -0
- package/dist/shared/pail.Di3NskY9.cjs +1 -0
- package/dist/shared/{pail.BDMlOMw8.cjs → pail.NUhULbBB.cjs} +2 -2
- package/dist/shared/{pail.B4CNQvGO.d.cts → pail.QGbXqfVW.d.ts} +3 -3
- package/dist/shared/{pail.t5UYgSXE.cjs → pail.nUyAB-mN.cjs} +1 -1
- package/package.json +2 -1
- package/dist/shared/pail.Br_AAl-2.mjs +0 -1
- package/dist/shared/pail.BuhpbVGv.mjs +0 -1
- package/dist/shared/pail.D9OQPGNq.cjs +0 -1
- package/dist/shared/pail.DvAyNJOC.mjs +0 -1
- package/dist/shared/pail.boZRgdP1.cjs +0 -1
- package/dist/shared/pail.zBliJm8v.cjs +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Options as Options$1 } from 'rotating-file-stream';
|
|
2
|
-
import { R as Reporter, g as ReadonlyMeta, M as Meta, S as StreamAwareReporter, e as LiteralUnion, E as ExtendedRfc5424LogLevels, i as InteractiveStreamReporter, I as InteractiveManager } from './shared/pail.
|
|
3
|
-
import { A as AbstractJsonReporter, a as AbstractPrettyReporter, P as PrettyStyleOptions } from './shared/pail.
|
|
2
|
+
import { R as Reporter, g as ReadonlyMeta, M as Meta, S as StreamAwareReporter, e as LiteralUnion, E as ExtendedRfc5424LogLevels, i as InteractiveStreamReporter, I as InteractiveManager } from './shared/pail.BxGKtnGM.mjs';
|
|
3
|
+
import { A as AbstractJsonReporter, a as AbstractPrettyReporter, P as PrettyStyleOptions } from './shared/pail.CyfBrVNa.mjs';
|
|
4
4
|
import '@visulima/colorize';
|
|
5
5
|
import 'safe-stable-stringify';
|
|
6
6
|
|
|
@@ -15,21 +15,21 @@ type Options = Options$1 & {
|
|
|
15
15
|
filePath: string;
|
|
16
16
|
writeImmediately?: boolean;
|
|
17
17
|
};
|
|
18
|
-
declare abstract class AbstractFileReporter<L extends string =
|
|
18
|
+
declare abstract class AbstractFileReporter<L extends string = string> implements Reporter<L> {
|
|
19
19
|
protected stream: RotatingFileStream;
|
|
20
20
|
protected constructor(options: Options);
|
|
21
21
|
log(meta: ReadonlyMeta<L>): void;
|
|
22
22
|
protected abstract _formatMessage(data: ReadonlyMeta<L>): string;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
declare class JsonFileReporter<L extends string =
|
|
25
|
+
declare class JsonFileReporter<L extends string = string> extends AbstractFileReporter<L> {
|
|
26
26
|
#private;
|
|
27
27
|
constructor(options: Options);
|
|
28
28
|
setStringify(function_: any): void;
|
|
29
29
|
protected _formatMessage(meta: Meta<L>): string;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
declare class JsonReporter<L extends string =
|
|
32
|
+
declare class JsonReporter<L extends string = string> extends AbstractJsonReporter<L> implements StreamAwareReporter<L> {
|
|
33
33
|
#private;
|
|
34
34
|
constructor();
|
|
35
35
|
setStdout(stdout_: NodeJS.WriteStream): void;
|
|
@@ -37,7 +37,7 @@ declare class JsonReporter<L extends string = never> extends AbstractJsonReporte
|
|
|
37
37
|
protected _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
declare class PrettyReporter<T extends string =
|
|
40
|
+
declare class PrettyReporter<T extends string = string, L extends string = string> extends AbstractPrettyReporter<T, L> implements InteractiveStreamReporter<L> {
|
|
41
41
|
#private;
|
|
42
42
|
constructor(options?: Partial<PrettyStyleOptions>);
|
|
43
43
|
setStdout(stdout_: NodeJS.WriteStream): void;
|
|
@@ -49,7 +49,7 @@ declare class PrettyReporter<T extends string = never, L extends string = never>
|
|
|
49
49
|
protected _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
declare class SimpleReporter<T extends string =
|
|
52
|
+
declare class SimpleReporter<T extends string = string, L extends string = string> extends AbstractPrettyReporter<T, L> implements InteractiveStreamReporter<L> {
|
|
53
53
|
#private;
|
|
54
54
|
constructor(options?: Partial<PrettyStyleOptions>);
|
|
55
55
|
setStdout(stdout_: NodeJS.WriteStream): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Options as Options$1 } from 'rotating-file-stream';
|
|
2
|
-
import { R as Reporter, g as ReadonlyMeta, M as Meta, S as StreamAwareReporter, e as LiteralUnion, E as ExtendedRfc5424LogLevels, i as InteractiveStreamReporter, I as InteractiveManager } from './shared/pail.
|
|
3
|
-
import { A as AbstractJsonReporter, a as AbstractPrettyReporter, P as PrettyStyleOptions } from './shared/pail.
|
|
2
|
+
import { R as Reporter, g as ReadonlyMeta, M as Meta, S as StreamAwareReporter, e as LiteralUnion, E as ExtendedRfc5424LogLevels, i as InteractiveStreamReporter, I as InteractiveManager } from './shared/pail.BxGKtnGM.js';
|
|
3
|
+
import { A as AbstractJsonReporter, a as AbstractPrettyReporter, P as PrettyStyleOptions } from './shared/pail.QGbXqfVW.js';
|
|
4
4
|
import '@visulima/colorize';
|
|
5
5
|
import 'safe-stable-stringify';
|
|
6
6
|
|
|
@@ -15,21 +15,21 @@ type Options = Options$1 & {
|
|
|
15
15
|
filePath: string;
|
|
16
16
|
writeImmediately?: boolean;
|
|
17
17
|
};
|
|
18
|
-
declare abstract class AbstractFileReporter<L extends string =
|
|
18
|
+
declare abstract class AbstractFileReporter<L extends string = string> implements Reporter<L> {
|
|
19
19
|
protected stream: RotatingFileStream;
|
|
20
20
|
protected constructor(options: Options);
|
|
21
21
|
log(meta: ReadonlyMeta<L>): void;
|
|
22
22
|
protected abstract _formatMessage(data: ReadonlyMeta<L>): string;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
declare class JsonFileReporter<L extends string =
|
|
25
|
+
declare class JsonFileReporter<L extends string = string> extends AbstractFileReporter<L> {
|
|
26
26
|
#private;
|
|
27
27
|
constructor(options: Options);
|
|
28
28
|
setStringify(function_: any): void;
|
|
29
29
|
protected _formatMessage(meta: Meta<L>): string;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
declare class JsonReporter<L extends string =
|
|
32
|
+
declare class JsonReporter<L extends string = string> extends AbstractJsonReporter<L> implements StreamAwareReporter<L> {
|
|
33
33
|
#private;
|
|
34
34
|
constructor();
|
|
35
35
|
setStdout(stdout_: NodeJS.WriteStream): void;
|
|
@@ -37,7 +37,7 @@ declare class JsonReporter<L extends string = never> extends AbstractJsonReporte
|
|
|
37
37
|
protected _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
declare class PrettyReporter<T extends string =
|
|
40
|
+
declare class PrettyReporter<T extends string = string, L extends string = string> extends AbstractPrettyReporter<T, L> implements InteractiveStreamReporter<L> {
|
|
41
41
|
#private;
|
|
42
42
|
constructor(options?: Partial<PrettyStyleOptions>);
|
|
43
43
|
setStdout(stdout_: NodeJS.WriteStream): void;
|
|
@@ -49,7 +49,7 @@ declare class PrettyReporter<T extends string = never, L extends string = never>
|
|
|
49
49
|
protected _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
declare class SimpleReporter<T extends string =
|
|
52
|
+
declare class SimpleReporter<T extends string = string, L extends string = string> extends AbstractPrettyReporter<T, L> implements InteractiveStreamReporter<L> {
|
|
53
53
|
#private;
|
|
54
54
|
constructor(options?: Partial<PrettyStyleOptions>);
|
|
55
55
|
setStdout(stdout_: NodeJS.WriteStream): void;
|
package/dist/reporter.server.mjs
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var E=Object.defineProperty;var n=(s,t)=>E(s,"name",{value:t,configurable:!0});import{stdout as F,stderr as O}from"node:process";import{n as J,t as L,b as W,s as A,w as C,c as b}from"./shared/pail.D5MfZlaK.mjs";import{a as Rt}from"./shared/pail.D5MfZlaK.mjs";import{o as D}from"./shared/pail.Cn4oOlxI.mjs";import G,{white as H,grey as h,bold as M,bgGrey as N,underline as T}from"@visulima/colorize";import{A as Y,s as B}from"./shared/pail.BlF6_AB7.mjs";import{s as K}from"./shared/pail.CKgnzwt6.mjs";
|
|
2
|
+
// -- pack CommonJS Shims --
|
|
3
|
+
import __cjs_url__ from "node:url";
|
|
4
|
+
import __cjs_path__ from "node:path";
|
|
5
|
+
import __cjs_mod__ from "node:module";
|
|
6
|
+
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = __cjs_path__.dirname(__filename);
|
|
8
|
+
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
9
|
+
var Q=Object.defineProperty,U=n((s,t)=>Q(s,"name",{value:t,configurable:!0}),"i$2");let V=class{static{n(this,"s")}static{U(this,"SafeStreamHandler")}_ready=!0;_stream;_name;constructor(t,e){this._stream=t,this._name=e}write(t){this.writeStream(t)}end(...t){this._stream.end(...t)}writeStream(t){if(!this._ready){console.warn("Stream busy: "+this._name+'. Write will be dropped: "'+t+'"');return}this._ready=!1,this._stream.on("error",e=>{throw e}),this._stream.on("drain",()=>{this._ready=!0}),this._stream.on("finish",()=>{this._ready=!0}),this._ready=this._stream.write(t,()=>{})}};var X=Object.defineProperty,Z=n((s,t)=>X(s,"name",{value:t,configurable:!0}),"s$1");let v;try{v=require("rotating-file-stream").createStream}catch{throw new Error("The 'rotating-file-stream' package is missing. Make sure to install the 'rotating-file-stream' package.")}class tt{static{n(this,"l")}static{Z(this,"RotatingFileStream")}#t;#e;#s;#r;constructor(t,e=!1,r={}){this.#t=t,this.#e=e,this.#r=r,this.#e||(this.#s=v(this.#t,r))}write(t){let e=this.#s;this.#e&&(e=v(this.#t,this.#r));const r=new V(e,this.#t);r.write(t),this.#e&&r.end()}end(){this.#s!==void 0&&this.#s.end()}}var et=Object.defineProperty,st=n((s,t)=>et(s,"name",{value:t,configurable:!0}),"r$1");class rt{static{n(this,"AbstractFileReporter")}static{st(this,"AbstractFileReporter")}stream;constructor(t){const{filePath:e,writeImmediately:r=!1,...a}=t;this.stream=new tt(e,r,a)}log(t){this.stream.write(this._formatMessage(t)+`
|
|
10
|
+
`)}}var it=Object.defineProperty,at=n((s,t)=>it(s,"name",{value:t,configurable:!0}),"s");class nt extends rt{static{n(this,"p")}static{at(this,"JsonFileReporter")}#t;constructor(t){super({compress:"gzip",interval:"1d",size:"10M",...t})}setStringify(t){this.#t=t}_formatMessage(t){const{file:e,type:r,...a}=t;return a.label&&(a.label=a.label.trim()),e&&(a.file=e.name+":"+e.line+(e.column?":"+e.column:"")),this.#t(a)}}const wt=nt;var ot=Object.defineProperty,ht=n((s,t)=>ot(s,"name",{value:t,configurable:!0}),"r");class lt extends D{static{n(this,"a")}static{ht(this,"JsonReporter")}#t;#e;constructor(){super(),this.#t=F,this.#e=O}setStdout(t){this.#t=t}setStderr(t){this.#e=t}_log(t,e){const r=["error","warn"].includes(e)?this.#e:this.#t;J(t+`
|
|
11
|
+
`,r)}}const St=lt;var pt=Object.defineProperty,ct=n((s,t)=>pt(s,"name",{value:t,configurable:!0}),"R");class mt extends Y{static{n(this,"q")}static{ct(this,"SimpleReporter")}#t;#e;#s;#r=!1;constructor(t={}){super({uppercase:{label:!0,...t.uppercase},...t}),this.#t=F,this.#e=O}setStdout(t){this.#t=t}setStderr(t){this.#e=t}setInteractiveManager(t){this.#s=t}setIsInteractive(t){this.#r=t}log(t){this._log(this._formatMessage(t),t.type.level)}_formatMessage(t){const{columns:e}=L();let r=e;typeof this._styles.messageLength=="number"&&(r=this._styles.messageLength);const{badge:a,context:w,date:c,error:S,file:m,groups:u,label:d,message:f,prefix:g,repeated:$,scope:y,suffix:_,traceError:j,type:z}=t,{color:x}=this._loggerTypes[z.name],R=x?G[x]:H,l=u.map(()=>" ").join(""),i=[];if(u.length>0&&i.push(l+h("["+u.at(-1)+"]")+" "),c&&i.push(h(this._styles.dateFormatter(typeof c=="string"?new Date(c):c))+" "),a)i.push(M(R(a)));else{const o=B(this._loggerTypes);o.length>0&&i.push(h(" ".repeat(o.length)))}const P=K(this._loggerTypes);d?i.push(M(R(W(d,this._styles)))+" "," ".repeat(P.length-A(d))):i.push(" ".repeat(P.length+1)),$&&i.push(N.white("["+$+"x]")+" "),Array.isArray(y)&&y.length>0&&i.push(h("["+y.join(" > ")+"]")+" "),g&&i.push(h("["+(this._styles.underline.prefix?T(g):g)+"]")+" ");const I=A(i.join("")),k=typeof f=="string"?f:this._stringify(f);if(i.push(l+C(k??"undefined",r-3,{hard:!0,trim:!0,wordWrap:!0})),w){let o=!1;i.push(...w.map(p=>{if(p instanceof Error)return o=!0,`
|
|
4
12
|
|
|
5
|
-
`+b(p,r,l);if(typeof p=="object")return" "+this._stringify(p);const
|
|
13
|
+
`+b(p,r,l);if(typeof p=="object")return" "+this._stringify(p);const q=(o?`
|
|
6
14
|
|
|
7
|
-
`:" ")+p;return
|
|
8
|
-
`,h("Caller: ")," ".repeat(I-8),
|
|
15
|
+
`:" ")+p;return o=!1,q}))}if(S&&i.push(b(S,r,l)),j&&i.push(b(j,r,l,!0)),_&&i.push(" "+l+h(this._styles.underline.suffix?T(_):_)),m){const o=m.name+(m.line?":"+m.line:"");i.push(`
|
|
16
|
+
`,h("Caller: ")," ".repeat(I-8),o,`
|
|
9
17
|
`)}return i.join("")}_log(t,e){const r=["error","trace","warn"].includes(e)?"stderr":"stdout",a=r==="stderr"?this.#e:this.#t;this.#r&&this.#s!==void 0&&a.isTTY?this.#s.update(r,t.split(`
|
|
10
18
|
`),0):J(t+`
|
|
11
|
-
`,a)}}const
|
|
19
|
+
`,a)}}const $t=mt;export{rt as AbstractFileReporter,wt as JsonFileReporter,St as JsonReporter,Rt as PrettyReporter,$t as SimpleReporter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var n=Object.defineProperty;var r=(o,e)=>n(o,"name",{value:e,configurable:!0});var c=Object.defineProperty,
|
|
1
|
+
"use strict";var n=Object.defineProperty;var r=(o,e)=>n(o,"name",{value:e,configurable:!0});var c=Object.defineProperty,l=r((o,e)=>c(o,"name",{value:e,configurable:!0}),"o");const s=l(o=>o==="error"?console.__error??console.error:o==="warn"?console.__warn??console.warn:o==="trace"?console.__trace??console.trace:console.__log??console.log,"writeConsoleLogBasedOnLevel");exports.t=s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var r=(t,e)=>s(t,"name",{value:e,configurable:!0});const n=require("./pail.3G15muTS.cjs"),c=require("./pail.DFhaFnnA.cjs");var a=Object.defineProperty,i=r((t,e)=>a(t,"name",{value:e,configurable:!0}),"t");class u extends c.o{static{r(this,"p")}static{i(this,"JsonReporter")}constructor(){super()}_log(e,o){n.t(o)(e)}}const l=u;exports.n=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t=Object.defineProperty;var a=(e,l)=>t(e,"name",{value:l,configurable:!0});const n={alert:7,critical:6,debug:1,emergency:8,error:5,informational:2,notice:3,trace:2,warning:4},i={alert:{color:"red",label:"alert",logLevel:"alert"},await:{color:"blue",label:"awaiting",logLevel:"informational"},complete:{color:"cyan",label:"complete",logLevel:"informational"},critical:{color:"redBright",label:"critical",logLevel:"critical"},debug:{color:"gray",label:"debug",logLevel:"debug"},emergency:{color:"redBright",label:"emergency",logLevel:"emergency"},error:{color:"red",label:"error",logLevel:"error"},info:{color:"blueBright",label:"info",logLevel:"informational"},log:{label:"",logLevel:"informational"},notice:{color:"magentaBright",label:"notice",logLevel:"notice"},pending:{color:"magenta",label:"pending",logLevel:"informational"},start:{color:"greenBright",label:"start",logLevel:"informational"},stop:{color:"red",label:"stop",logLevel:"informational"},success:{color:"green",label:"success",logLevel:"informational"},trace:{color:"cyanBright",label:"trace",logLevel:"trace"},wait:{color:"blue",label:"waiting",logLevel:"informational"},warn:{color:"yellow",label:"warning",logLevel:"warning"},watch:{color:"yellowBright",label:"watching",logLevel:"informational"}};var c=Object.defineProperty,g=a((e,l)=>c(e,"name",{value:l,configurable:!0}),"
|
|
1
|
+
"use strict";var t=Object.defineProperty;var a=(e,l)=>t(e,"name",{value:l,configurable:!0});const n={alert:7,critical:6,debug:1,emergency:8,error:5,informational:2,notice:3,trace:2,warning:4},i={alert:{color:"red",label:"alert",logLevel:"alert"},await:{color:"blue",label:"awaiting",logLevel:"informational"},complete:{color:"cyan",label:"complete",logLevel:"informational"},critical:{color:"redBright",label:"critical",logLevel:"critical"},debug:{color:"gray",label:"debug",logLevel:"debug"},emergency:{color:"redBright",label:"emergency",logLevel:"emergency"},error:{color:"red",label:"error",logLevel:"error"},info:{color:"blueBright",label:"info",logLevel:"informational"},log:{label:"",logLevel:"informational"},notice:{color:"magentaBright",label:"notice",logLevel:"notice"},pending:{color:"magenta",label:"pending",logLevel:"informational"},start:{color:"greenBright",label:"start",logLevel:"informational"},stop:{color:"red",label:"stop",logLevel:"informational"},success:{color:"green",label:"success",logLevel:"informational"},trace:{color:"cyanBright",label:"trace",logLevel:"trace"},wait:{color:"blue",label:"waiting",logLevel:"informational"},warn:{color:"yellow",label:"warning",logLevel:"warning"},watch:{color:"yellowBright",label:"watching",logLevel:"informational"}};var c=Object.defineProperty,g=a((e,l)=>c(e,"name",{value:l,configurable:!0}),"g");const b=g(e=>{const l=Object.keys(e).map(o=>e[o].label??"");return l.length===0?"":l.reduce((o,r)=>o.length>r.length?o:r)},"getLongestLabel");exports.EXTENDED_RFC_5424_LOG_LEVELS=n;exports.LOG_TYPES=i;exports.s=b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var n=Object.defineProperty;var r=(o,e)=>n(o,"name",{value:e,configurable:!0});var
|
|
1
|
+
var n=Object.defineProperty;var r=(o,e)=>n(o,"name",{value:e,configurable:!0});var c=Object.defineProperty,l=r((o,e)=>c(o,"name",{value:e,configurable:!0}),"o");const s=l(o=>o==="error"?console.__error??console.error:o==="warn"?console.__warn??console.warn:o==="trace"?console.__trace??console.trace:console.__log??console.log,"writeConsoleLogBasedOnLevel");export{s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var g=Object.defineProperty;var s=(t,e)=>g(t,"name",{value:e,configurable:!0});import{L as i}from"./pail.
|
|
1
|
+
var g=Object.defineProperty;var s=(t,e)=>g(t,"name",{value:e,configurable:!0});import{L as i}from"./pail.CKgnzwt6.mjs";var n=Object.defineProperty,l=s((t,e)=>n(t,"name",{value:e,configurable:!0}),"r$1");const u=l(t=>{const e=Object.keys(t).map(r=>t[r].badge??"");return e.length===0?"":e.reduce((r,a)=>r.length>a.length?r:a)},"getLongestBadge");var c=Object.defineProperty,o=s((t,e)=>c(t,"name",{value:e,configurable:!0}),"r");const p=o(t=>[t.getHours(),t.getMinutes(),t.getSeconds()].map(e=>String(e).padStart(2,"0")).join(":"),"dateFormatter");class d{static{s(this,"AbstractPrettyReporter")}static{o(this,"AbstractPrettyReporter")}_styles;_loggerTypes;_stringify;constructor(e){this._styles={bold:{label:!1},dateFormatter:p,underline:{label:!1,message:!1,prefix:!1,suffix:!1},uppercase:{label:!1},...e},this._loggerTypes=i}setStringify(e){this._stringify=e}setLoggerTypes(e){this._loggerTypes=e}}export{d as A,u as s};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { stringify } from 'safe-stable-stringify';
|
|
2
|
-
import { a as DefaultLogTypes, b as LoggerFunction, C as ConstructorOptions, M as Meta, d as LoggerTypesConfig, e as LiteralUnion, P as Processor, E as ExtendedRfc5424LogLevels, R as Reporter } from './pail.
|
|
2
|
+
import { a as DefaultLogTypes, b as LoggerFunction, C as ConstructorOptions, M as Meta, d as LoggerTypesConfig, e as LiteralUnion, P as Processor, E as ExtendedRfc5424LogLevels, R as Reporter } from './pail.BxGKtnGM.mjs';
|
|
3
3
|
|
|
4
|
-
declare class PailBrowserImpl<T extends string =
|
|
4
|
+
declare class PailBrowserImpl<T extends string = string, L extends string = string> {
|
|
5
5
|
protected timersMap: Map<string, number>;
|
|
6
6
|
protected countMap: Map<string, number>;
|
|
7
7
|
protected seqTimers: Set<string>;
|
|
@@ -53,6 +53,6 @@ declare class PailBrowserImpl<T extends string = never, L extends string = never
|
|
|
53
53
|
private _buildMeta;
|
|
54
54
|
private _logger;
|
|
55
55
|
}
|
|
56
|
-
type PailBrowserType<T extends string =
|
|
56
|
+
type PailBrowserType<T extends string = string, L extends string = string> = PailBrowserImpl<T, L> & Record<DefaultLogTypes, LoggerFunction> & Record<T, LoggerFunction> & (new <TC extends string = string, LC extends string = string>(options?: ConstructorOptions<TC, LC>) => PailBrowserType<TC, LC>);
|
|
57
57
|
|
|
58
58
|
export { type PailBrowserType as P, PailBrowserImpl as a };
|
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
import { AnsiColors } from '@visulima/colorize';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
5
|
+
|
|
6
|
+
@category Type
|
|
7
|
+
*/
|
|
8
|
+
type Primitive =
|
|
9
|
+
| null
|
|
10
|
+
| undefined
|
|
11
|
+
| string
|
|
12
|
+
| number
|
|
13
|
+
| boolean
|
|
14
|
+
| symbol
|
|
15
|
+
| bigint;
|
|
16
|
+
|
|
17
|
+
declare global {
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
19
|
+
interface SymbolConstructor {
|
|
20
|
+
readonly observable: symbol;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
|
|
26
|
+
|
|
27
|
+
Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
|
|
28
|
+
|
|
29
|
+
This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
|
|
30
|
+
|
|
31
|
+
@example
|
|
32
|
+
```
|
|
33
|
+
import type {LiteralUnion} from 'type-fest';
|
|
34
|
+
|
|
35
|
+
// Before
|
|
36
|
+
|
|
37
|
+
type Pet = 'dog' | 'cat' | string;
|
|
38
|
+
|
|
39
|
+
const pet: Pet = '';
|
|
40
|
+
// Start typing in your TypeScript-enabled IDE.
|
|
41
|
+
// You **will not** get auto-completion for `dog` and `cat` literals.
|
|
42
|
+
|
|
43
|
+
// After
|
|
44
|
+
|
|
45
|
+
type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
|
46
|
+
|
|
47
|
+
const pet: Pet2 = '';
|
|
48
|
+
// You **will** get auto-completion for `dog` and `cat` literals.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
@category Type
|
|
52
|
+
*/
|
|
53
|
+
type LiteralUnion<
|
|
54
|
+
LiteralType,
|
|
55
|
+
BaseType extends Primitive,
|
|
56
|
+
> = LiteralType | (BaseType & Record<never, never>);
|
|
57
|
+
|
|
3
58
|
declare class InteractiveStreamHook {
|
|
4
59
|
#private;
|
|
5
60
|
static readonly DRAIN = true;
|
|
@@ -34,8 +89,6 @@ declare global {
|
|
|
34
89
|
}
|
|
35
90
|
}
|
|
36
91
|
}
|
|
37
|
-
type Primitive = bigint | boolean | number | string | symbol | null | undefined;
|
|
38
|
-
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
39
92
|
interface Meta<L> extends VisulimaPail.CustomMeta<L> {
|
|
40
93
|
badge: string | undefined;
|
|
41
94
|
context: any[] | undefined;
|
|
@@ -57,42 +110,42 @@ interface Meta<L> extends VisulimaPail.CustomMeta<L> {
|
|
|
57
110
|
type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
|
|
58
111
|
type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
|
|
59
112
|
interface LoggerFunction {
|
|
60
|
-
(...message: any[]): void;
|
|
61
113
|
(message: Message): void;
|
|
114
|
+
(...message: (Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown> | undefined)[]): void;
|
|
62
115
|
}
|
|
63
|
-
interface LoggerConfiguration<L extends string
|
|
116
|
+
interface LoggerConfiguration<L extends string> {
|
|
64
117
|
badge?: string;
|
|
65
118
|
color?: AnsiColors | undefined;
|
|
66
119
|
label: string;
|
|
67
120
|
logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
|
|
68
121
|
}
|
|
69
|
-
type LoggerTypesConfig<T extends string, L extends string
|
|
70
|
-
type DefaultLoggerTypes<L extends string =
|
|
71
|
-
type ReadonlyMeta<L extends string
|
|
72
|
-
interface Reporter<L extends string
|
|
122
|
+
type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
|
|
123
|
+
type DefaultLoggerTypes<L extends string = string> = Record<DefaultLogTypes, LoggerConfiguration<L>>;
|
|
124
|
+
type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
|
|
125
|
+
interface Reporter<L extends string> {
|
|
73
126
|
log: (meta: ReadonlyMeta<L>) => void;
|
|
74
127
|
}
|
|
75
|
-
interface StreamAwareReporter<L extends string
|
|
128
|
+
interface StreamAwareReporter<L extends string> extends Reporter<L> {
|
|
76
129
|
setStderr: (stderr: NodeJS.WriteStream) => void;
|
|
77
130
|
setStdout: (stdout: NodeJS.WriteStream) => void;
|
|
78
131
|
}
|
|
79
|
-
interface LoggerTypesAwareReporter<T extends string
|
|
132
|
+
interface LoggerTypesAwareReporter<T extends string, L extends string> extends Reporter<L> {
|
|
80
133
|
setLoggerTypes: (types: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>) => void;
|
|
81
134
|
}
|
|
82
|
-
interface StringifyAwareReporter<L extends string
|
|
135
|
+
interface StringifyAwareReporter<L extends string> extends Reporter<L> {
|
|
83
136
|
setStringify: (stringify: typeof JSON.stringify) => void;
|
|
84
137
|
}
|
|
85
|
-
interface InteractiveStreamReporter<L extends string
|
|
138
|
+
interface InteractiveStreamReporter<L extends string> extends StreamAwareReporter<L> {
|
|
86
139
|
setInteractiveManager: (manager?: InteractiveManager) => void;
|
|
87
140
|
setIsInteractive: (interactive: boolean) => void;
|
|
88
141
|
}
|
|
89
|
-
interface Processor<L extends string
|
|
142
|
+
interface Processor<L extends string> {
|
|
90
143
|
process: (meta: Meta<L>) => Meta<L>;
|
|
91
144
|
}
|
|
92
|
-
interface StringifyAwareProcessor<L extends string
|
|
145
|
+
interface StringifyAwareProcessor<L extends string> extends Processor<L> {
|
|
93
146
|
setStringify: (stringify: typeof JSON.stringify) => void;
|
|
94
147
|
}
|
|
95
|
-
interface ConstructorOptions<T extends string
|
|
148
|
+
interface ConstructorOptions<T extends string, L extends string> {
|
|
96
149
|
disabled?: boolean;
|
|
97
150
|
logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
|
|
98
151
|
logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
|
|
@@ -108,14 +161,14 @@ interface ConstructorOptions<T extends string = never, L extends string = never>
|
|
|
108
161
|
throttleMin?: number;
|
|
109
162
|
types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
|
|
110
163
|
}
|
|
111
|
-
interface ServerConstructorOptions<T extends string
|
|
164
|
+
interface ServerConstructorOptions<T extends string, L extends string> extends ConstructorOptions<T, L> {
|
|
112
165
|
interactive?: boolean;
|
|
113
166
|
stderr?: NodeJS.WriteStream;
|
|
114
167
|
stdout?: NodeJS.WriteStream;
|
|
115
168
|
}
|
|
116
169
|
type Message = {
|
|
117
170
|
context?: any[] | undefined;
|
|
118
|
-
message: Primitive | ReadonlyArray<unknown> | undefined;
|
|
171
|
+
message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown> | undefined;
|
|
119
172
|
prefix?: string;
|
|
120
173
|
suffix?: string;
|
|
121
174
|
};
|
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
import { AnsiColors } from '@visulima/colorize';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
5
|
+
|
|
6
|
+
@category Type
|
|
7
|
+
*/
|
|
8
|
+
type Primitive =
|
|
9
|
+
| null
|
|
10
|
+
| undefined
|
|
11
|
+
| string
|
|
12
|
+
| number
|
|
13
|
+
| boolean
|
|
14
|
+
| symbol
|
|
15
|
+
| bigint;
|
|
16
|
+
|
|
17
|
+
declare global {
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
19
|
+
interface SymbolConstructor {
|
|
20
|
+
readonly observable: symbol;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
|
|
26
|
+
|
|
27
|
+
Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
|
|
28
|
+
|
|
29
|
+
This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
|
|
30
|
+
|
|
31
|
+
@example
|
|
32
|
+
```
|
|
33
|
+
import type {LiteralUnion} from 'type-fest';
|
|
34
|
+
|
|
35
|
+
// Before
|
|
36
|
+
|
|
37
|
+
type Pet = 'dog' | 'cat' | string;
|
|
38
|
+
|
|
39
|
+
const pet: Pet = '';
|
|
40
|
+
// Start typing in your TypeScript-enabled IDE.
|
|
41
|
+
// You **will not** get auto-completion for `dog` and `cat` literals.
|
|
42
|
+
|
|
43
|
+
// After
|
|
44
|
+
|
|
45
|
+
type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
|
46
|
+
|
|
47
|
+
const pet: Pet2 = '';
|
|
48
|
+
// You **will** get auto-completion for `dog` and `cat` literals.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
@category Type
|
|
52
|
+
*/
|
|
53
|
+
type LiteralUnion<
|
|
54
|
+
LiteralType,
|
|
55
|
+
BaseType extends Primitive,
|
|
56
|
+
> = LiteralType | (BaseType & Record<never, never>);
|
|
57
|
+
|
|
3
58
|
declare class InteractiveStreamHook {
|
|
4
59
|
#private;
|
|
5
60
|
static readonly DRAIN = true;
|
|
@@ -34,8 +89,6 @@ declare global {
|
|
|
34
89
|
}
|
|
35
90
|
}
|
|
36
91
|
}
|
|
37
|
-
type Primitive = bigint | boolean | number | string | symbol | null | undefined;
|
|
38
|
-
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
39
92
|
interface Meta<L> extends VisulimaPail.CustomMeta<L> {
|
|
40
93
|
badge: string | undefined;
|
|
41
94
|
context: any[] | undefined;
|
|
@@ -57,42 +110,42 @@ interface Meta<L> extends VisulimaPail.CustomMeta<L> {
|
|
|
57
110
|
type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
|
|
58
111
|
type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
|
|
59
112
|
interface LoggerFunction {
|
|
60
|
-
(...message: any[]): void;
|
|
61
113
|
(message: Message): void;
|
|
114
|
+
(...message: (Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown> | undefined)[]): void;
|
|
62
115
|
}
|
|
63
|
-
interface LoggerConfiguration<L extends string
|
|
116
|
+
interface LoggerConfiguration<L extends string> {
|
|
64
117
|
badge?: string;
|
|
65
118
|
color?: AnsiColors | undefined;
|
|
66
119
|
label: string;
|
|
67
120
|
logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
|
|
68
121
|
}
|
|
69
|
-
type LoggerTypesConfig<T extends string, L extends string
|
|
70
|
-
type DefaultLoggerTypes<L extends string =
|
|
71
|
-
type ReadonlyMeta<L extends string
|
|
72
|
-
interface Reporter<L extends string
|
|
122
|
+
type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
|
|
123
|
+
type DefaultLoggerTypes<L extends string = string> = Record<DefaultLogTypes, LoggerConfiguration<L>>;
|
|
124
|
+
type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
|
|
125
|
+
interface Reporter<L extends string> {
|
|
73
126
|
log: (meta: ReadonlyMeta<L>) => void;
|
|
74
127
|
}
|
|
75
|
-
interface StreamAwareReporter<L extends string
|
|
128
|
+
interface StreamAwareReporter<L extends string> extends Reporter<L> {
|
|
76
129
|
setStderr: (stderr: NodeJS.WriteStream) => void;
|
|
77
130
|
setStdout: (stdout: NodeJS.WriteStream) => void;
|
|
78
131
|
}
|
|
79
|
-
interface LoggerTypesAwareReporter<T extends string
|
|
132
|
+
interface LoggerTypesAwareReporter<T extends string, L extends string> extends Reporter<L> {
|
|
80
133
|
setLoggerTypes: (types: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>) => void;
|
|
81
134
|
}
|
|
82
|
-
interface StringifyAwareReporter<L extends string
|
|
135
|
+
interface StringifyAwareReporter<L extends string> extends Reporter<L> {
|
|
83
136
|
setStringify: (stringify: typeof JSON.stringify) => void;
|
|
84
137
|
}
|
|
85
|
-
interface InteractiveStreamReporter<L extends string
|
|
138
|
+
interface InteractiveStreamReporter<L extends string> extends StreamAwareReporter<L> {
|
|
86
139
|
setInteractiveManager: (manager?: InteractiveManager) => void;
|
|
87
140
|
setIsInteractive: (interactive: boolean) => void;
|
|
88
141
|
}
|
|
89
|
-
interface Processor<L extends string
|
|
142
|
+
interface Processor<L extends string> {
|
|
90
143
|
process: (meta: Meta<L>) => Meta<L>;
|
|
91
144
|
}
|
|
92
|
-
interface StringifyAwareProcessor<L extends string
|
|
145
|
+
interface StringifyAwareProcessor<L extends string> extends Processor<L> {
|
|
93
146
|
setStringify: (stringify: typeof JSON.stringify) => void;
|
|
94
147
|
}
|
|
95
|
-
interface ConstructorOptions<T extends string
|
|
148
|
+
interface ConstructorOptions<T extends string, L extends string> {
|
|
96
149
|
disabled?: boolean;
|
|
97
150
|
logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
|
|
98
151
|
logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
|
|
@@ -108,14 +161,14 @@ interface ConstructorOptions<T extends string = never, L extends string = never>
|
|
|
108
161
|
throttleMin?: number;
|
|
109
162
|
types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
|
|
110
163
|
}
|
|
111
|
-
interface ServerConstructorOptions<T extends string
|
|
164
|
+
interface ServerConstructorOptions<T extends string, L extends string> extends ConstructorOptions<T, L> {
|
|
112
165
|
interactive?: boolean;
|
|
113
166
|
stderr?: NodeJS.WriteStream;
|
|
114
167
|
stdout?: NodeJS.WriteStream;
|
|
115
168
|
}
|
|
116
169
|
type Message = {
|
|
117
170
|
context?: any[] | undefined;
|
|
118
|
-
message: Primitive | ReadonlyArray<unknown> | undefined;
|
|
171
|
+
message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown> | undefined;
|
|
119
172
|
prefix?: string;
|
|
120
173
|
suffix?: string;
|
|
121
174
|
};
|
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
import { AnsiColors } from '@visulima/colorize';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
5
|
+
|
|
6
|
+
@category Type
|
|
7
|
+
*/
|
|
8
|
+
type Primitive =
|
|
9
|
+
| null
|
|
10
|
+
| undefined
|
|
11
|
+
| string
|
|
12
|
+
| number
|
|
13
|
+
| boolean
|
|
14
|
+
| symbol
|
|
15
|
+
| bigint;
|
|
16
|
+
|
|
17
|
+
declare global {
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
19
|
+
interface SymbolConstructor {
|
|
20
|
+
readonly observable: symbol;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
|
|
26
|
+
|
|
27
|
+
Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
|
|
28
|
+
|
|
29
|
+
This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
|
|
30
|
+
|
|
31
|
+
@example
|
|
32
|
+
```
|
|
33
|
+
import type {LiteralUnion} from 'type-fest';
|
|
34
|
+
|
|
35
|
+
// Before
|
|
36
|
+
|
|
37
|
+
type Pet = 'dog' | 'cat' | string;
|
|
38
|
+
|
|
39
|
+
const pet: Pet = '';
|
|
40
|
+
// Start typing in your TypeScript-enabled IDE.
|
|
41
|
+
// You **will not** get auto-completion for `dog` and `cat` literals.
|
|
42
|
+
|
|
43
|
+
// After
|
|
44
|
+
|
|
45
|
+
type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
|
46
|
+
|
|
47
|
+
const pet: Pet2 = '';
|
|
48
|
+
// You **will** get auto-completion for `dog` and `cat` literals.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
@category Type
|
|
52
|
+
*/
|
|
53
|
+
type LiteralUnion<
|
|
54
|
+
LiteralType,
|
|
55
|
+
BaseType extends Primitive,
|
|
56
|
+
> = LiteralType | (BaseType & Record<never, never>);
|
|
57
|
+
|
|
3
58
|
declare class InteractiveStreamHook {
|
|
4
59
|
#private;
|
|
5
60
|
static readonly DRAIN = true;
|
|
@@ -34,8 +89,6 @@ declare global {
|
|
|
34
89
|
}
|
|
35
90
|
}
|
|
36
91
|
}
|
|
37
|
-
type Primitive = bigint | boolean | number | string | symbol | null | undefined;
|
|
38
|
-
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
39
92
|
interface Meta<L> extends VisulimaPail.CustomMeta<L> {
|
|
40
93
|
badge: string | undefined;
|
|
41
94
|
context: any[] | undefined;
|
|
@@ -57,42 +110,42 @@ interface Meta<L> extends VisulimaPail.CustomMeta<L> {
|
|
|
57
110
|
type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
|
|
58
111
|
type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
|
|
59
112
|
interface LoggerFunction {
|
|
60
|
-
(...message: any[]): void;
|
|
61
113
|
(message: Message): void;
|
|
114
|
+
(...message: (Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown> | undefined)[]): void;
|
|
62
115
|
}
|
|
63
|
-
interface LoggerConfiguration<L extends string
|
|
116
|
+
interface LoggerConfiguration<L extends string> {
|
|
64
117
|
badge?: string;
|
|
65
118
|
color?: AnsiColors | undefined;
|
|
66
119
|
label: string;
|
|
67
120
|
logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
|
|
68
121
|
}
|
|
69
|
-
type LoggerTypesConfig<T extends string, L extends string
|
|
70
|
-
type DefaultLoggerTypes<L extends string =
|
|
71
|
-
type ReadonlyMeta<L extends string
|
|
72
|
-
interface Reporter<L extends string
|
|
122
|
+
type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
|
|
123
|
+
type DefaultLoggerTypes<L extends string = string> = Record<DefaultLogTypes, LoggerConfiguration<L>>;
|
|
124
|
+
type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
|
|
125
|
+
interface Reporter<L extends string> {
|
|
73
126
|
log: (meta: ReadonlyMeta<L>) => void;
|
|
74
127
|
}
|
|
75
|
-
interface StreamAwareReporter<L extends string
|
|
128
|
+
interface StreamAwareReporter<L extends string> extends Reporter<L> {
|
|
76
129
|
setStderr: (stderr: NodeJS.WriteStream) => void;
|
|
77
130
|
setStdout: (stdout: NodeJS.WriteStream) => void;
|
|
78
131
|
}
|
|
79
|
-
interface LoggerTypesAwareReporter<T extends string
|
|
132
|
+
interface LoggerTypesAwareReporter<T extends string, L extends string> extends Reporter<L> {
|
|
80
133
|
setLoggerTypes: (types: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>) => void;
|
|
81
134
|
}
|
|
82
|
-
interface StringifyAwareReporter<L extends string
|
|
135
|
+
interface StringifyAwareReporter<L extends string> extends Reporter<L> {
|
|
83
136
|
setStringify: (stringify: typeof JSON.stringify) => void;
|
|
84
137
|
}
|
|
85
|
-
interface InteractiveStreamReporter<L extends string
|
|
138
|
+
interface InteractiveStreamReporter<L extends string> extends StreamAwareReporter<L> {
|
|
86
139
|
setInteractiveManager: (manager?: InteractiveManager) => void;
|
|
87
140
|
setIsInteractive: (interactive: boolean) => void;
|
|
88
141
|
}
|
|
89
|
-
interface Processor<L extends string
|
|
142
|
+
interface Processor<L extends string> {
|
|
90
143
|
process: (meta: Meta<L>) => Meta<L>;
|
|
91
144
|
}
|
|
92
|
-
interface StringifyAwareProcessor<L extends string
|
|
145
|
+
interface StringifyAwareProcessor<L extends string> extends Processor<L> {
|
|
93
146
|
setStringify: (stringify: typeof JSON.stringify) => void;
|
|
94
147
|
}
|
|
95
|
-
interface ConstructorOptions<T extends string
|
|
148
|
+
interface ConstructorOptions<T extends string, L extends string> {
|
|
96
149
|
disabled?: boolean;
|
|
97
150
|
logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
|
|
98
151
|
logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
|
|
@@ -108,14 +161,14 @@ interface ConstructorOptions<T extends string = never, L extends string = never>
|
|
|
108
161
|
throttleMin?: number;
|
|
109
162
|
types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
|
|
110
163
|
}
|
|
111
|
-
interface ServerConstructorOptions<T extends string
|
|
164
|
+
interface ServerConstructorOptions<T extends string, L extends string> extends ConstructorOptions<T, L> {
|
|
112
165
|
interactive?: boolean;
|
|
113
166
|
stderr?: NodeJS.WriteStream;
|
|
114
167
|
stdout?: NodeJS.WriteStream;
|
|
115
168
|
}
|
|
116
169
|
type Message = {
|
|
117
170
|
context?: any[] | undefined;
|
|
118
|
-
message: Primitive | ReadonlyArray<unknown> | undefined;
|
|
171
|
+
message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown> | undefined;
|
|
119
172
|
prefix?: string;
|
|
120
173
|
suffix?: string;
|
|
121
174
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s=Object.defineProperty;var o=(r,t)=>s(r,"name",{value:t,configurable:!0});import{t as n}from"./pail.BP95fgQZ.mjs";import{o as a}from"./pail.Cn4oOlxI.mjs";var c=Object.defineProperty,p=o((r,t)=>c(r,"name",{value:t,configurable:!0}),"t");class i extends a{static{o(this,"p")}static{p(this,"JsonReporter")}constructor(){super()}_log(t,e){n(e)(t)}}const u=i;export{u as n};
|