@visulima/pail 1.1.13 → 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 +13 -0
- package/LICENSE.md +185 -0
- package/README.md +1 -0
- package/dist/index.browser.cjs +1 -16
- package/dist/index.browser.d.cts +5 -5
- package/dist/index.browser.d.mts +10 -0
- package/dist/index.browser.d.ts +5 -5
- package/dist/index.browser.mjs +1 -0
- package/dist/index.server.cjs +4 -20
- package/dist/index.server.d.cts +7 -7
- package/dist/index.server.d.mts +30 -0
- package/dist/index.server.d.ts +7 -7
- package/dist/index.server.mjs +5 -0
- package/dist/processor.browser.cjs +1 -12
- package/dist/processor.browser.d.cts +1 -1
- package/dist/processor.browser.d.mts +15 -0
- package/dist/processor.browser.d.ts +1 -1
- package/dist/processor.browser.mjs +1 -0
- package/dist/processor.server.cjs +1 -18
- package/dist/processor.server.d.cts +3 -3
- package/dist/processor.server.d.mts +47 -0
- package/dist/processor.server.d.ts +3 -3
- package/dist/processor.server.mjs +1 -0
- package/dist/reporter.browser.cjs +4 -26
- package/dist/reporter.browser.d.cts +4 -4
- package/dist/reporter.browser.d.mts +17 -0
- package/dist/reporter.browser.d.ts +4 -4
- package/dist/reporter.browser.mjs +5 -0
- package/dist/reporter.server.cjs +9 -24
- package/dist/reporter.server.d.cts +25 -18
- package/dist/reporter.server.d.mts +64 -0
- package/dist/reporter.server.d.ts +25 -18
- package/dist/reporter.server.mjs +19 -0
- package/dist/shared/pail.3G15muTS.cjs +1 -0
- package/dist/shared/pail.B-Tp78gL.cjs +1 -0
- package/dist/shared/pail.B0AqLGpo.cjs +1 -0
- package/dist/shared/pail.B85Cx0UJ.cjs +1 -0
- package/dist/shared/pail.BP95fgQZ.mjs +1 -0
- package/dist/shared/pail.BlF6_AB7.mjs +1 -0
- package/dist/{pail.browser-pg1HpChf.d.cts → shared/pail.BsONPwkb.d.mts} +3 -3
- package/dist/{types-DrhFTME0.d.ts → shared/pail.BxGKtnGM.d.cts} +70 -17
- package/dist/{types-DrhFTME0.d.cts → shared/pail.BxGKtnGM.d.mts} +70 -17
- package/dist/shared/pail.BxGKtnGM.d.ts +176 -0
- package/dist/shared/pail.Bz_4Ee-U.mjs +1 -0
- package/dist/shared/pail.C0epjAht.cjs +1 -0
- package/dist/shared/pail.CKgnzwt6.mjs +1 -0
- package/dist/shared/pail.CNxJnpWG.mjs +1 -0
- package/dist/{pail.browser-DuX9zHSz.d.ts → shared/pail.CQyMoJfJ.d.ts} +3 -3
- package/dist/{abstract-pretty-reporter-DwzTRutd.d.cts → shared/pail.CW2izieN.d.cts} +4 -4
- package/dist/shared/pail.CY7GSNwy.d.cts +58 -0
- package/dist/shared/pail.Cn4oOlxI.mjs +1 -0
- package/dist/shared/pail.CyfBrVNa.d.mts +36 -0
- package/dist/shared/pail.D5MfZlaK.mjs +21 -0
- 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.NUhULbBB.cjs +21 -0
- package/dist/{abstract-pretty-reporter-B-VS5gYX.d.ts → shared/pail.QGbXqfVW.d.ts} +4 -4
- package/dist/shared/pail.nEbRCLhY.mjs +1 -0
- package/dist/shared/pail.nUyAB-mN.cjs +1 -0
- package/package.json +55 -36
- package/dist/chunk-2I5JHTDY.js +0 -9
- package/dist/chunk-2I5JHTDY.js.map +0 -1
- package/dist/chunk-5MNFJRLM.cjs +0 -10
- package/dist/chunk-5MNFJRLM.cjs.map +0 -1
- package/dist/chunk-AFMDCM5W.js +0 -5
- package/dist/chunk-AFMDCM5W.js.map +0 -1
- package/dist/chunk-F4FJCQ4L.cjs +0 -9
- package/dist/chunk-F4FJCQ4L.cjs.map +0 -1
- package/dist/chunk-KERJDMYV.js +0 -8
- package/dist/chunk-KERJDMYV.js.map +0 -1
- package/dist/chunk-N2UPJYJR.cjs +0 -7
- package/dist/chunk-N2UPJYJR.cjs.map +0 -1
- package/dist/chunk-NF47XQ47.js +0 -5
- package/dist/chunk-NF47XQ47.js.map +0 -1
- package/dist/chunk-QINSQ6TU.cjs +0 -9
- package/dist/chunk-QINSQ6TU.cjs.map +0 -1
- package/dist/chunk-R5F555RP.js +0 -5
- package/dist/chunk-R5F555RP.js.map +0 -1
- package/dist/chunk-S4PFPURC.cjs +0 -45
- package/dist/chunk-S4PFPURC.cjs.map +0 -1
- package/dist/chunk-SR3Q3EUO.js +0 -7
- package/dist/chunk-SR3Q3EUO.js.map +0 -1
- package/dist/chunk-TAH23BHM.js +0 -5
- package/dist/chunk-TAH23BHM.js.map +0 -1
- package/dist/chunk-VWAGNTLB.cjs +0 -7
- package/dist/chunk-VWAGNTLB.cjs.map +0 -1
- package/dist/chunk-WHEIXCFS.js +0 -33
- package/dist/chunk-WHEIXCFS.js.map +0 -1
- package/dist/chunk-YP3U3DTV.cjs +0 -10
- package/dist/chunk-YP3U3DTV.cjs.map +0 -1
- package/dist/chunk-ZB7IIFHO.js +0 -7
- package/dist/chunk-ZB7IIFHO.js.map +0 -1
- package/dist/chunk-ZHHJ42XL.cjs +0 -12
- package/dist/chunk-ZHHJ42XL.cjs.map +0 -1
- package/dist/chunk-ZJMTPHZR.cjs +0 -7
- package/dist/chunk-ZJMTPHZR.cjs.map +0 -1
- package/dist/index.browser.cjs.map +0 -1
- package/dist/index.browser.js +0 -13
- package/dist/index.browser.js.map +0 -1
- package/dist/index.server.cjs.map +0 -1
- package/dist/index.server.js +0 -18
- package/dist/index.server.js.map +0 -1
- package/dist/processor.browser.cjs.map +0 -1
- package/dist/processor.browser.js +0 -3
- package/dist/processor.browser.js.map +0 -1
- package/dist/processor.server.cjs.map +0 -1
- package/dist/processor.server.js +0 -8
- package/dist/processor.server.js.map +0 -1
- package/dist/reporter.browser.cjs.map +0 -1
- package/dist/reporter.browser.js +0 -17
- package/dist/reporter.browser.js.map +0 -1
- package/dist/reporter.server.cjs.map +0 -1
- package/dist/reporter.server.js +0 -15
- package/dist/reporter.server.js.map +0 -1
|
@@ -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,176 @@
|
|
|
1
|
+
import { AnsiColors } from '@visulima/colorize';
|
|
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
|
+
|
|
58
|
+
declare class InteractiveStreamHook {
|
|
59
|
+
#private;
|
|
60
|
+
static readonly DRAIN = true;
|
|
61
|
+
constructor(stream: NodeJS.WriteStream);
|
|
62
|
+
active(): void;
|
|
63
|
+
erase(count: number): void;
|
|
64
|
+
inactive(separateHistory?: boolean): void;
|
|
65
|
+
renew(): void;
|
|
66
|
+
write(message: string): void;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type StreamType = "stderr" | "stdout";
|
|
70
|
+
declare class InteractiveManager {
|
|
71
|
+
#private;
|
|
72
|
+
constructor(stdout: InteractiveStreamHook, stderr: InteractiveStreamHook);
|
|
73
|
+
get lastLength(): number;
|
|
74
|
+
get outside(): number;
|
|
75
|
+
get isHooked(): boolean;
|
|
76
|
+
get isSuspended(): boolean;
|
|
77
|
+
erase(stream: StreamType, count?: number): void;
|
|
78
|
+
hook(): boolean;
|
|
79
|
+
resume(stream: StreamType, eraseRowCount?: number): void;
|
|
80
|
+
suspend(stream: StreamType, erase?: boolean): void;
|
|
81
|
+
unhook(separateHistory?: boolean): boolean;
|
|
82
|
+
update(stream: StreamType, rows: string[], from?: number): void;
|
|
83
|
+
private _clear;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
declare global {
|
|
87
|
+
namespace VisulimaPail {
|
|
88
|
+
interface CustomMeta<L> {
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
interface Meta<L> extends VisulimaPail.CustomMeta<L> {
|
|
93
|
+
badge: string | undefined;
|
|
94
|
+
context: any[] | undefined;
|
|
95
|
+
date: Date | string;
|
|
96
|
+
error: Error | undefined;
|
|
97
|
+
groups: string[];
|
|
98
|
+
label: string | undefined;
|
|
99
|
+
message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
|
|
100
|
+
prefix: string | undefined;
|
|
101
|
+
repeated?: number | undefined;
|
|
102
|
+
scope: string[] | undefined;
|
|
103
|
+
suffix: string | undefined;
|
|
104
|
+
traceError: Error | undefined;
|
|
105
|
+
type: {
|
|
106
|
+
level: ExtendedRfc5424LogLevels | L;
|
|
107
|
+
name: string;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
|
|
111
|
+
type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
|
|
112
|
+
interface LoggerFunction {
|
|
113
|
+
(message: Message): void;
|
|
114
|
+
(...message: (Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown> | undefined)[]): void;
|
|
115
|
+
}
|
|
116
|
+
interface LoggerConfiguration<L extends string> {
|
|
117
|
+
badge?: string;
|
|
118
|
+
color?: AnsiColors | undefined;
|
|
119
|
+
label: string;
|
|
120
|
+
logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
|
|
121
|
+
}
|
|
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> {
|
|
126
|
+
log: (meta: ReadonlyMeta<L>) => void;
|
|
127
|
+
}
|
|
128
|
+
interface StreamAwareReporter<L extends string> extends Reporter<L> {
|
|
129
|
+
setStderr: (stderr: NodeJS.WriteStream) => void;
|
|
130
|
+
setStdout: (stdout: NodeJS.WriteStream) => void;
|
|
131
|
+
}
|
|
132
|
+
interface LoggerTypesAwareReporter<T extends string, L extends string> extends Reporter<L> {
|
|
133
|
+
setLoggerTypes: (types: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>) => void;
|
|
134
|
+
}
|
|
135
|
+
interface StringifyAwareReporter<L extends string> extends Reporter<L> {
|
|
136
|
+
setStringify: (stringify: typeof JSON.stringify) => void;
|
|
137
|
+
}
|
|
138
|
+
interface InteractiveStreamReporter<L extends string> extends StreamAwareReporter<L> {
|
|
139
|
+
setInteractiveManager: (manager?: InteractiveManager) => void;
|
|
140
|
+
setIsInteractive: (interactive: boolean) => void;
|
|
141
|
+
}
|
|
142
|
+
interface Processor<L extends string> {
|
|
143
|
+
process: (meta: Meta<L>) => Meta<L>;
|
|
144
|
+
}
|
|
145
|
+
interface StringifyAwareProcessor<L extends string> extends Processor<L> {
|
|
146
|
+
setStringify: (stringify: typeof JSON.stringify) => void;
|
|
147
|
+
}
|
|
148
|
+
interface ConstructorOptions<T extends string, L extends string> {
|
|
149
|
+
disabled?: boolean;
|
|
150
|
+
logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
|
|
151
|
+
logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
|
|
152
|
+
messages?: {
|
|
153
|
+
timerEnd?: string;
|
|
154
|
+
timerStart?: string;
|
|
155
|
+
};
|
|
156
|
+
processors?: Processor<L>[];
|
|
157
|
+
rawReporter?: Reporter<L>;
|
|
158
|
+
reporters?: Reporter<L>[];
|
|
159
|
+
scope?: string[] | string;
|
|
160
|
+
throttle?: number;
|
|
161
|
+
throttleMin?: number;
|
|
162
|
+
types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
|
|
163
|
+
}
|
|
164
|
+
interface ServerConstructorOptions<T extends string, L extends string> extends ConstructorOptions<T, L> {
|
|
165
|
+
interactive?: boolean;
|
|
166
|
+
stderr?: NodeJS.WriteStream;
|
|
167
|
+
stdout?: NodeJS.WriteStream;
|
|
168
|
+
}
|
|
169
|
+
type Message = {
|
|
170
|
+
context?: any[] | undefined;
|
|
171
|
+
message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown> | undefined;
|
|
172
|
+
prefix?: string;
|
|
173
|
+
suffix?: string;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export { type ConstructorOptions as C, type DefaultLoggerTypes as D, type ExtendedRfc5424LogLevels as E, InteractiveManager as I, type LoggerConfiguration as L, type Meta as M, type Processor as P, type Reporter as R, type StreamAwareReporter as S, type DefaultLogTypes as a, type LoggerFunction as b, type LoggerTypesAwareReporter as c, type LoggerTypesConfig as d, type LiteralUnion as e, type ServerConstructorOptions as f, type ReadonlyMeta as g, type StringifyAwareReporter as h, type InteractiveStreamReporter as i, type StringifyAwareProcessor as j };
|
|
@@ -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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var u=Object.defineProperty;var s=(e,r)=>u(e,"name",{value:r,configurable:!0});const c=Symbol("circular-reference-tag"),i=Symbol("raw-error-ref"),l=Object.create({},{aggregateErrors:{enumerable:!0,value:void 0,writable:!0},cause:{enumerable:!0,value:void 0,writable:!0},code:{enumerable:!0,value:void 0,writable:!0},message:{enumerable:!0,value:void 0,writable:!0},name:{enumerable:!0,value:void 0,writable:!0},raw:{enumerable:!1,get(){return this[i]},set(e){this[i]=e}},stack:{enumerable:!0,value:void 0,writable:!0}});Object.defineProperty(l,i,{value:{},writable:!0});const b=l;var m=Object.defineProperty,v=s((e,r)=>m(e,"name",{value:r,configurable:!0}),"c");const n=v((e,r={})=>{e[c]=void 0;const t=Object.create(b);t.name=Object.prototype.toString.call(e.constructor)==="[object Function]"?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(a=>n(a,r))),e.cause instanceof Error&&!Object.prototype.hasOwnProperty.call(e.cause,c)&&(t.cause=n(e.cause,r));for(const a in e)if(t[a]===void 0){const o=e[a];if(o instanceof Error)Object.prototype.hasOwnProperty.call(o,c)||(t[a]=n(o,r));else if(typeof o=="function")t[a]="[Function: "+(o.name||"anonymous");else try{t[a]=o}catch{}}return delete e[c],t.raw=e,t},"errorWithCauseSerializer");var p=Object.defineProperty,y=s((e,r)=>p(e,"name",{value:r,configurable:!0}),"o");class f{static{s(this,"i")}static{y(this,"ErrorProcessor")}_options;constructor(r={}){this._options={maxDepth:Number.POSITIVE_INFINITY,useToJSON:!0,...r}}process(r){return r.error&&(r.error=n(r.error,this._options)),r}}const g=f;exports.L=g;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=Object.defineProperty;var a=(e,l)=>t(e,"name",{value:l,configurable:!0});const g={alert:7,critical:6,debug:1,emergency:8,error:5,informational:2,notice:3,trace:2,warning:4},b={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 n=Object.defineProperty,i=a((e,l)=>n(e,"name",{value:l,configurable:!0}),"g");const L=i(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");export{g as E,b as L,L as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var u=Object.defineProperty;var s=(e,r)=>u(e,"name",{value:r,configurable:!0});const n=Symbol("circular-reference-tag"),i=Symbol("raw-error-ref"),l=Object.create({},{aggregateErrors:{enumerable:!0,value:void 0,writable:!0},cause:{enumerable:!0,value:void 0,writable:!0},code:{enumerable:!0,value:void 0,writable:!0},message:{enumerable:!0,value:void 0,writable:!0},name:{enumerable:!0,value:void 0,writable:!0},raw:{enumerable:!1,get(){return this[i]},set(e){this[i]=e}},stack:{enumerable:!0,value:void 0,writable:!0}});Object.defineProperty(l,i,{value:{},writable:!0});const b=l;var m=Object.defineProperty,v=s((e,r)=>m(e,"name",{value:r,configurable:!0}),"c");const c=v((e,r={})=>{e[n]=void 0;const o=Object.create(b);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)&&(o.aggregateErrors=e.errors.map(t=>c(t,r))),e.cause instanceof Error&&!Object.prototype.hasOwnProperty.call(e.cause,n)&&(o.cause=c(e.cause,r));for(const t in e)if(o[t]===void 0){const a=e[t];if(a instanceof Error)Object.prototype.hasOwnProperty.call(a,n)||(o[t]=c(a,r));else if(typeof a=="function")o[t]="[Function: "+(a.name||"anonymous");else try{o[t]=a}catch{}}return delete e[n],o.raw=e,o},"errorWithCauseSerializer");var p=Object.defineProperty,y=s((e,r)=>p(e,"name",{value:r,configurable:!0}),"o");class f{static{s(this,"i")}static{y(this,"ErrorProcessor")}_options;constructor(r={}){this._options={maxDepth:Number.POSITIVE_INFINITY,useToJSON:!0,...r}}process(r){return r.error&&(r.error=c(r.error,this._options)),r}}const d=f;export{d as L};
|
|
@@ -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 './
|
|
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.js';
|
|
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,14 +1,14 @@
|
|
|
1
1
|
import { stringify } from 'safe-stable-stringify';
|
|
2
|
-
import { h as StringifyAwareReporter, g as ReadonlyMeta, e as LiteralUnion, E as ExtendedRfc5424LogLevels, c as LoggerTypesAwareReporter, d as LoggerTypesConfig, a as DefaultLogTypes } from './
|
|
2
|
+
import { h as StringifyAwareReporter, g as ReadonlyMeta, e as LiteralUnion, E as ExtendedRfc5424LogLevels, c as LoggerTypesAwareReporter, d as LoggerTypesConfig, a as DefaultLogTypes } from './pail.BxGKtnGM.cjs';
|
|
3
3
|
|
|
4
|
-
declare abstract class AbstractJsonReporter<L extends string =
|
|
5
|
-
protected
|
|
4
|
+
declare abstract class AbstractJsonReporter<L extends string = string> implements StringifyAwareReporter<L> {
|
|
5
|
+
protected stringify: typeof stringify | undefined;
|
|
6
6
|
setStringify(function_: any): void;
|
|
7
7
|
log(meta: ReadonlyMeta<L>): void;
|
|
8
8
|
protected abstract _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
declare abstract class AbstractPrettyReporter<T extends string =
|
|
11
|
+
declare abstract class AbstractPrettyReporter<T extends string = string, L extends string = string> implements LoggerTypesAwareReporter<T, L>, StringifyAwareReporter<L> {
|
|
12
12
|
protected readonly _styles: PrettyStyleOptions;
|
|
13
13
|
protected _loggerTypes: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
|
|
14
14
|
protected _stringify: typeof stringify | undefined;
|
|
@@ -0,0 +1,58 @@
|
|
|
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.BxGKtnGM.cjs';
|
|
3
|
+
|
|
4
|
+
declare class PailBrowserImpl<T extends string = string, L extends string = string> {
|
|
5
|
+
protected timersMap: Map<string, number>;
|
|
6
|
+
protected countMap: Map<string, number>;
|
|
7
|
+
protected seqTimers: Set<string>;
|
|
8
|
+
protected readonly lastLog: {
|
|
9
|
+
count?: number;
|
|
10
|
+
object?: Meta<L>;
|
|
11
|
+
serialized?: string;
|
|
12
|
+
time?: Date;
|
|
13
|
+
timeout?: ReturnType<typeof setTimeout>;
|
|
14
|
+
};
|
|
15
|
+
protected readonly logLevels: Record<string, number>;
|
|
16
|
+
protected disabled: boolean;
|
|
17
|
+
protected scopeName: string[];
|
|
18
|
+
protected readonly types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
|
|
19
|
+
protected readonly longestLabel: string;
|
|
20
|
+
protected readonly processors: Set<Processor<L>>;
|
|
21
|
+
protected readonly generalLogLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
|
|
22
|
+
protected reporters: Set<Reporter<L>>;
|
|
23
|
+
protected readonly throttle: number;
|
|
24
|
+
protected readonly throttleMin: number;
|
|
25
|
+
protected readonly stringify: typeof stringify;
|
|
26
|
+
protected groups: string[];
|
|
27
|
+
protected readonly startTimerMessage: string;
|
|
28
|
+
protected readonly endTimerMessage: string;
|
|
29
|
+
protected rawReporter: Reporter<L>;
|
|
30
|
+
constructor(options: ConstructorOptions<T, L>);
|
|
31
|
+
wrapConsole(): void;
|
|
32
|
+
restoreConsole(): void;
|
|
33
|
+
wrapException(): void;
|
|
34
|
+
disable(): void;
|
|
35
|
+
enable(): void;
|
|
36
|
+
isEnabled(): boolean;
|
|
37
|
+
scope<N extends string = T>(...name: string[]): PailBrowserType<N, L>;
|
|
38
|
+
unscope(): void;
|
|
39
|
+
time(label?: string): void;
|
|
40
|
+
timeLog(label?: string, ...data: unknown[]): void;
|
|
41
|
+
timeEnd(label?: string): void;
|
|
42
|
+
group(label?: string): void;
|
|
43
|
+
groupEnd(): void;
|
|
44
|
+
count(label?: string): void;
|
|
45
|
+
countReset(label?: string): void;
|
|
46
|
+
clear(): void;
|
|
47
|
+
raw(message: string, ...arguments_: unknown[]): void;
|
|
48
|
+
protected extendReporter(reporter: Reporter<L>): Reporter<L>;
|
|
49
|
+
protected registerReporters(reporters: Reporter<L>[]): void;
|
|
50
|
+
private _report;
|
|
51
|
+
private registerProcessors;
|
|
52
|
+
private _normalizeLogLevel;
|
|
53
|
+
private _buildMeta;
|
|
54
|
+
private _logger;
|
|
55
|
+
}
|
|
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
|
+
|
|
58
|
+
export { type PailBrowserType as P, PailBrowserImpl as a };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r=Object.defineProperty;var s=(l,e)=>r(l,"name",{value:e,configurable:!0});var a=Object.defineProperty,o=s((l,e)=>a(l,"name",{value:e,configurable:!0}),"n");class f{static{s(this,"o")}static{o(this,"AbstractJsonReporter")}stringify;setStringify(e){this.stringify=e}log(e){const{file:t,type:n,...i}=e;i.label&&(i.label=i.label.trim()),t&&(i.file=t.name+":"+t.line+(t.column?":"+t.column:"")),this._log(this.stringify(i),n.level)}}export{f as o};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { stringify } from 'safe-stable-stringify';
|
|
2
|
+
import { h as StringifyAwareReporter, g as ReadonlyMeta, e as LiteralUnion, E as ExtendedRfc5424LogLevels, c as LoggerTypesAwareReporter, d as LoggerTypesConfig, a as DefaultLogTypes } from './pail.BxGKtnGM.mjs';
|
|
3
|
+
|
|
4
|
+
declare abstract class AbstractJsonReporter<L extends string = string> implements StringifyAwareReporter<L> {
|
|
5
|
+
protected stringify: typeof stringify | undefined;
|
|
6
|
+
setStringify(function_: any): void;
|
|
7
|
+
log(meta: ReadonlyMeta<L>): void;
|
|
8
|
+
protected abstract _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare abstract class AbstractPrettyReporter<T extends string = string, L extends string = string> implements LoggerTypesAwareReporter<T, L>, StringifyAwareReporter<L> {
|
|
12
|
+
protected readonly _styles: PrettyStyleOptions;
|
|
13
|
+
protected _loggerTypes: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
|
|
14
|
+
protected _stringify: typeof stringify | undefined;
|
|
15
|
+
protected constructor(options: Partial<PrettyStyleOptions>);
|
|
16
|
+
setStringify(function_: any): void;
|
|
17
|
+
setLoggerTypes(types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>): void;
|
|
18
|
+
abstract log(meta: ReadonlyMeta<L>): void;
|
|
19
|
+
}
|
|
20
|
+
type PrettyStyleOptions = {
|
|
21
|
+
bold: {
|
|
22
|
+
label: boolean;
|
|
23
|
+
};
|
|
24
|
+
dateFormatter: (date: Date) => string;
|
|
25
|
+
messageLength: number | undefined;
|
|
26
|
+
underline: {
|
|
27
|
+
label: boolean;
|
|
28
|
+
prefix: boolean;
|
|
29
|
+
suffix: boolean;
|
|
30
|
+
};
|
|
31
|
+
uppercase: {
|
|
32
|
+
label: boolean;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export { AbstractJsonReporter as A, type PrettyStyleOptions as P, AbstractPrettyReporter as a };
|