@andrew_l/pino-pretty 0.3.22 → 0.4.0

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/dist/index.d.mts CHANGED
@@ -1,171 +1,170 @@
1
- import { Arrayable, DeepPartial } from '@andrew_l/toolkit';
2
- import { Transform } from 'node:stream';
3
-
1
+ import { Transform } from "node:stream";
2
+ import { Arrayable, DeepPartial } from "@andrew_l/toolkit";
3
+ import { StringWidth } from "@cto.af/string-width";
4
4
  declare const colorDefs: {
5
- reset: (string: string) => string;
6
- bold: (string: string) => string;
7
- dim: (string: string) => string;
8
- italic: (string: string) => string;
9
- underline: (string: string) => string;
10
- inverse: (string: string) => string;
11
- hidden: (string: string) => string;
12
- strikethrough: (string: string) => string;
13
- black: (string: string) => string;
14
- red: (string: string) => string;
15
- green: (string: string) => string;
16
- yellow: (string: string) => string;
17
- blue: (string: string) => string;
18
- magenta: (string: string) => string;
19
- cyan: (string: string) => string;
20
- white: (string: string) => string;
21
- gray: (string: string) => string;
22
- bgBlack: (string: string) => string;
23
- bgRed: (string: string) => string;
24
- bgGreen: (string: string) => string;
25
- bgYellow: (string: string) => string;
26
- bgBlue: (string: string) => string;
27
- bgMagenta: (string: string) => string;
28
- bgCyan: (string: string) => string;
29
- bgWhite: (string: string) => string;
30
- blackBright: (string: string) => string;
31
- redBright: (string: string) => string;
32
- greenBright: (string: string) => string;
33
- yellowBright: (string: string) => string;
34
- blueBright: (string: string) => string;
35
- magentaBright: (string: string) => string;
36
- cyanBright: (string: string) => string;
37
- whiteBright: (string: string) => string;
38
- bgBlackBright: (string: string) => string;
39
- bgRedBright: (string: string) => string;
40
- bgGreenBright: (string: string) => string;
41
- bgYellowBright: (string: string) => string;
42
- bgBlueBright: (string: string) => string;
43
- bgMagentaBright: (string: string) => string;
44
- bgCyanBright: (string: string) => string;
45
- bgWhiteBright: (string: string) => string;
46
- orange: (string: string) => string;
47
- purple: (string: string) => string;
48
- pink: (string: string) => string;
49
- lime: (string: string) => string;
50
- teal: (string: string) => string;
51
- indigo: (string: string) => string;
52
- brown: (string: string) => string;
53
- olive: (string: string) => string;
54
- navy: (string: string) => string;
55
- maroon: (string: string) => string;
56
- silver: (string: string) => string;
57
- gold: (string: string) => string;
58
- bgOrange: (string: string) => string;
59
- bgPurple: (string: string) => string;
60
- bgPink: (string: string) => string;
61
- bgLime: (string: string) => string;
62
- bgTeal: (string: string) => string;
63
- bgIndigo: (string: string) => string;
64
- bgBrown: (string: string) => string;
65
- bgOlive: (string: string) => string;
66
- bgNavy: (string: string) => string;
67
- bgMaroon: (string: string) => string;
68
- bgSilver: (string: string) => string;
69
- bgGold: (string: string) => string;
5
+ reset: (string: string) => string;
6
+ bold: (string: string) => string;
7
+ dim: (string: string) => string;
8
+ italic: (string: string) => string;
9
+ underline: (string: string) => string;
10
+ inverse: (string: string) => string;
11
+ hidden: (string: string) => string;
12
+ strikethrough: (string: string) => string;
13
+ black: (string: string) => string;
14
+ red: (string: string) => string;
15
+ green: (string: string) => string;
16
+ yellow: (string: string) => string;
17
+ blue: (string: string) => string;
18
+ magenta: (string: string) => string;
19
+ cyan: (string: string) => string;
20
+ white: (string: string) => string;
21
+ gray: (string: string) => string;
22
+ bgBlack: (string: string) => string;
23
+ bgRed: (string: string) => string;
24
+ bgGreen: (string: string) => string;
25
+ bgYellow: (string: string) => string;
26
+ bgBlue: (string: string) => string;
27
+ bgMagenta: (string: string) => string;
28
+ bgCyan: (string: string) => string;
29
+ bgWhite: (string: string) => string;
30
+ blackBright: (string: string) => string;
31
+ redBright: (string: string) => string;
32
+ greenBright: (string: string) => string;
33
+ yellowBright: (string: string) => string;
34
+ blueBright: (string: string) => string;
35
+ magentaBright: (string: string) => string;
36
+ cyanBright: (string: string) => string;
37
+ whiteBright: (string: string) => string;
38
+ bgBlackBright: (string: string) => string;
39
+ bgRedBright: (string: string) => string;
40
+ bgGreenBright: (string: string) => string;
41
+ bgYellowBright: (string: string) => string;
42
+ bgBlueBright: (string: string) => string;
43
+ bgMagentaBright: (string: string) => string;
44
+ bgCyanBright: (string: string) => string;
45
+ bgWhiteBright: (string: string) => string;
46
+ orange: (string: string) => string;
47
+ purple: (string: string) => string;
48
+ pink: (string: string) => string;
49
+ lime: (string: string) => string;
50
+ teal: (string: string) => string;
51
+ indigo: (string: string) => string;
52
+ brown: (string: string) => string;
53
+ olive: (string: string) => string;
54
+ navy: (string: string) => string;
55
+ maroon: (string: string) => string;
56
+ silver: (string: string) => string;
57
+ gold: (string: string) => string;
58
+ bgOrange: (string: string) => string;
59
+ bgPurple: (string: string) => string;
60
+ bgPink: (string: string) => string;
61
+ bgLime: (string: string) => string;
62
+ bgTeal: (string: string) => string;
63
+ bgIndigo: (string: string) => string;
64
+ bgBrown: (string: string) => string;
65
+ bgOlive: (string: string) => string;
66
+ bgNavy: (string: string) => string;
67
+ bgMaroon: (string: string) => string;
68
+ bgSilver: (string: string) => string;
69
+ bgGold: (string: string) => string;
70
70
  };
71
71
  type ColorName = keyof typeof colorDefs;
72
-
73
72
  type LevelConfig = {
74
- /**
75
- * Icon symbol displayed before the log message.
76
- * @example '🔥' - Fire emoji for error level
77
- * @example '✅' - Checkmark for success level
78
- */
79
- icon: string;
80
- color: ColorValue;
81
- /**
82
- * Level badge name displayed in log output.
83
- * Typically uppercase abbreviation of the level name.
84
- * @example 'INFO' - Information level
85
- * @example 'ERROR' - Error level
86
- * @example 'WARN' - Warning level
87
- */
88
- badge: string;
73
+ /**
74
+ * Icon symbol displayed before the log message.
75
+ * @example '🔥' - Fire emoji for error level
76
+ * @example '✅' - Checkmark for success level
77
+ */
78
+ icon: string;
79
+ color: ColorValue;
80
+ /**
81
+ * Level badge name displayed in log output.
82
+ * Typically uppercase abbreviation of the level name.
83
+ * @example 'INFO' - Information level
84
+ * @example 'ERROR' - Error level
85
+ * @example 'WARN' - Warning level
86
+ */
87
+ badge: string;
89
88
  };
90
89
  type TypeConfig = {
91
- color: ColorValue;
90
+ color: ColorValue;
92
91
  };
93
92
  interface PrettyOptions {
94
- /**
95
- * Pino message key.
96
- * @default 'regular'
97
- */
98
- inspect: 'regular' | 'compact' | InspectFunction;
99
- /**
100
- * Pino message key.
101
- */
102
- messageKey: string;
103
- /**
104
- * Pino nested key.
105
- */
106
- nestedKey?: string;
107
- /**
108
- * The maximum number of columns to output, affects formatting and line wrapping.
109
- * Should typically match the terminal width for optimal display.
110
- * @example process.stdout.columns
111
- * @default 80
112
- */
113
- columns: number;
114
- /**
115
- * Quote style for string values in log output.
116
- * @default 'single'
117
- * @example 'single' - Uses single quotes: 'hello world'
118
- * @example 'double' - Uses double quotes: "hello world"
119
- */
120
- quoteStyle: 'single' | 'double';
121
- /**
122
- * Comma-separated list of log message fields to ignore/hide from output.
123
- * Useful for reducing noise by hiding standard fields like hostname or PID.
124
- * @example 'time,name' - Hides timestamp and logger name
125
- * @default 'hostname,pid'
126
- */
127
- ignore: string;
128
- /**
129
- * Number of spaces to use for indentation when formatting nested objects.
130
- * @default 2
131
- */
132
- indent: number;
133
- /**
134
- * Maximum depth to recurse when formatting nested objects and arrays.
135
- * @default 5
136
- */
137
- depth: number;
138
- /**
139
- * Minimum log level value at which to show the level badge.
140
- * Levels below this threshold will not display their badge text.
141
- * @default 40
142
- * @example 30 - Show badges for levels 30 and above (info, warn, error, fatal)
143
- * @example 50 - Show badges only for levels 50 and above (error, fatal)
144
- */
145
- badgeMinLevel: number;
146
- /**
147
- * Maximum length for string values before they are truncated with ellipsis.
148
- * @default 400
149
- */
150
- maxStringLength: number;
151
- /**
152
- * When enabled, formats numbers like 1234567 as 1_234_567.
153
- * @default false
154
- */
155
- numericSeparator: boolean;
156
- /**
157
- * Whether to use ANSI colors in the output.
158
- * @default true
159
- */
160
- colorize: boolean;
161
- /**
162
- * Configuration mapping for log levels.
163
- */
164
- levels: Record<number, LevelConfig>;
165
- /**
166
- * Configuration mapping for data types.
167
- */
168
- types: Record<TypeName, TypeConfig>;
93
+ /**
94
+ * Pino message key.
95
+ * @default 'regular'
96
+ */
97
+ inspect: 'regular' | 'compact' | InspectFunction;
98
+ /**
99
+ * Pino message key.
100
+ */
101
+ messageKey: string;
102
+ /**
103
+ * Pino nested key.
104
+ */
105
+ nestedKey?: string;
106
+ /**
107
+ * The maximum number of columns to output, affects formatting and line wrapping.
108
+ * Should typically match the terminal width for optimal display.
109
+ * @example process.stdout.columns
110
+ * @default 80
111
+ */
112
+ columns: number;
113
+ /**
114
+ * Quote style for string values in log output.
115
+ * @default 'single'
116
+ * @example 'single' - Uses single quotes: 'hello world'
117
+ * @example 'double' - Uses double quotes: "hello world"
118
+ */
119
+ quoteStyle: 'single' | 'double';
120
+ /**
121
+ * Comma-separated list of log message fields to ignore/hide from output.
122
+ * Useful for reducing noise by hiding standard fields like hostname or PID.
123
+ * @example 'time,name' - Hides timestamp and logger name
124
+ * @default 'hostname,pid'
125
+ */
126
+ ignore: string;
127
+ /**
128
+ * Number of spaces to use for indentation when formatting nested objects.
129
+ * @default 2
130
+ */
131
+ indent: number;
132
+ /**
133
+ * Maximum depth to recurse when formatting nested objects and arrays.
134
+ * @default 5
135
+ */
136
+ depth: number;
137
+ /**
138
+ * Minimum log level value at which to show the level badge.
139
+ * Levels below this threshold will not display their badge text.
140
+ * @default 40
141
+ * @example 30 - Show badges for levels 30 and above (info, warn, error, fatal)
142
+ * @example 50 - Show badges only for levels 50 and above (error, fatal)
143
+ */
144
+ badgeMinLevel: number;
145
+ /**
146
+ * Maximum length for string values before they are truncated with ellipsis.
147
+ * @default 400
148
+ */
149
+ maxStringLength: number;
150
+ /**
151
+ * When enabled, formats numbers like 1234567 as 1_234_567.
152
+ * @default false
153
+ */
154
+ numericSeparator: boolean;
155
+ /**
156
+ * Whether to use ANSI colors in the output.
157
+ * @default true
158
+ */
159
+ colorize: boolean;
160
+ /**
161
+ * Configuration mapping for log levels.
162
+ */
163
+ levels: Record<number, LevelConfig>;
164
+ /**
165
+ * Configuration mapping for data types.
166
+ */
167
+ types: Record<TypeName, TypeConfig>;
169
168
  }
170
169
  type TypeName = 'number' | 'boolean' | 'string' | 'object' | 'error' | 'errorStack' | 'time' | 'name';
171
170
  /**
@@ -175,32 +174,31 @@ type TypeName = 'number' | 'boolean' | 'string' | 'object' | 'error' | 'errorSta
175
174
  type ColorValue = 'rand' | Arrayable<ColorName>;
176
175
  type InspectFunction = (obj: any, opts: InspectOptions) => string;
177
176
  interface InspectOptions {
178
- /** Maximum depth of the inspection @default 5 */
179
- depth: number;
180
- /** Quote style for strings @default 'single' */
181
- quoteStyle: 'single' | 'double';
182
- /** Maximum string length before truncation @default Infinity */
183
- maxStringLength: number;
184
- /** Indentation spaces @default 2 */
185
- indent: number;
186
- /** Add numeric separators (1_234.567_8) @default false */
187
- numericSeparator: boolean;
188
- /** Custom stringify functions for different types */
189
- customStringify: {
190
- [x: string]: InspectCustomStringify;
191
- };
192
- /** Available width columns */
193
- columns: number;
177
+ /** Maximum depth of the inspection @default 5 */
178
+ depth: number;
179
+ /** Quote style for strings @default 'single' */
180
+ quoteStyle: 'single' | 'double';
181
+ /** Maximum string length before truncation @default Infinity */
182
+ maxStringLength: number;
183
+ /** Indentation spaces @default 2 */
184
+ indent: number;
185
+ /** Add numeric separators (1_234.567_8) @default false */
186
+ numericSeparator: boolean;
187
+ /** Custom stringify functions for different types */
188
+ customStringify: {
189
+ [x: string]: InspectCustomStringify;
190
+ };
191
+ /** Available width columns */
192
+ columns: number;
194
193
  }
195
194
  type InspectCustomStringify = (value: any) => string;
196
-
197
195
  declare namespace PinoPretty {
198
- type Options = DeepPartial<PrettyOptions>;
196
+ type Options = DeepPartial<PrettyOptions>;
199
197
  }
200
198
  /**
201
199
  * Constructs a of stream to which the produced
202
200
  * prettified log data will be written.
203
201
  */
204
202
  declare function build(opts?: PinoPretty.Options): Promise<Transform>;
205
-
206
203
  export { PinoPretty, build, build as default };
204
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":["reset","string","bold","dim","italic","underline","inverse","hidden","strikethrough","black","red","green","yellow","blue","magenta","cyan","white","gray","bgBlack","bgRed","bgGreen","bgYellow","bgBlue","bgMagenta","bgCyan","bgWhite","blackBright","redBright","greenBright","yellowBright","blueBright","magentaBright","cyanBright","whiteBright","bgBlackBright","bgRedBright","bgGreenBright","bgYellowBright","bgBlueBright","bgMagentaBright","bgCyanBright","bgWhiteBright","orange","purple","pink","lime","teal","indigo","brown","olive","navy","maroon","silver","gold","bgOrange","bgPurple","bgPink","bgLime","bgTeal","bgIndigo","bgBrown","bgOlive","bgNavy","bgMaroon","bgSilver","bgGold","Readonly","ColorName","colorDefs","text","Record","ColorFunction","color","fallback","icon","color","ColorValue","badge","inspect","InspectFunction","messageKey","nestedKey","columns","quoteStyle","ignore","indent","depth","badgeMinLevel","maxStringLength","numericSeparator","colorize","levels","Record","LevelConfig","types","TypeName","TypeConfig","Omit","PrettyOptions","sw","StringWidth","Set","ignoreAdditional","LevelConfigParsed","TypeConfigParsed","inspectFn","inspectOptions","InspectOptions","colorFallback","ColorizeFn","Arrayable","ColorName","value","colorBadge","level","time","msg","pid","hostname","key","obj","opts","customStringify","x","InspectCustomStringify","Options","DeepPartial","PinoPretty","opts","Promise","Transform"],"sources":["../src/utils/getColor.d.ts","../src/types.d.ts","../src/index.d.ts"],"mappings":";;;cAAc,SAAA;EACVA,KAAAA,GAAQC,MAAAA;EACRC,IAAAA,GAAOD,MAAAA;EACPE,GAAAA,GAAMF,MAAAA;EACNG,MAAAA,GAASH,MAAAA;EACTI,SAAAA,GAAYJ,MAAAA;EACZK,OAAAA,GAAUL,MAAAA;EACVM,MAAAA,GAASN,MAAAA;EACTO,aAAAA,GAAgBP,MAAAA;EAChBQ,KAAAA,GAAQR,MAAAA;EACRS,GAAAA,GAAMT,MAAAA;EACNU,KAAAA,GAAQV,MAAAA;EACRW,MAAAA,GAASX,MAAAA;EACTY,IAAAA,GAAOZ,MAAAA;EACPa,OAAAA,GAAUb,MAAAA;EACVc,IAAAA,GAAOd,MAAAA;E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