@visulima/pail 4.0.0-alpha.10 → 4.0.0-alpha.12
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 +57 -0
- package/LICENSE.md +143 -931
- package/dist/error.d.ts +95 -96
- package/dist/index.browser.d.ts +557 -47
- package/dist/index.browser.js +2 -2
- package/dist/index.server.d.ts +722 -65
- package/dist/index.server.js +27 -410
- package/dist/middleware/elysia.d.ts +65 -63
- package/dist/middleware/elysia.js +2 -2
- package/dist/middleware/express.d.ts +73 -71
- package/dist/middleware/express.js +1 -1
- package/dist/middleware/fastify.d.ts +69 -67
- package/dist/middleware/fastify.js +2 -2
- package/dist/middleware/hono.d.ts +74 -72
- package/dist/middleware/next/handler.d.ts +101 -34
- package/dist/middleware/sveltekit.d.ts +100 -98
- package/dist/object-tree.d.ts +67 -70
- package/dist/packem_shared/{AbstractJsonReporter-DlugSJpY.js → AbstractJsonReporter-BO8Calb4.js} +1 -5
- package/dist/packem_shared/{AbstractJsonReporter-CjtVgHbU.js → AbstractJsonReporter-nOj0Ft1F.js} +1 -5
- package/dist/packem_shared/{JsonReporter-Dbw82ewj.js → JsonReporter-CCmj7oYL.js} +1 -1
- package/dist/packem_shared/{JsonReporter-BgPvIyC2.js → JsonReporter-Ck2PIAEw.js} +2 -2
- package/dist/packem_shared/{PrettyReporter-C2dCzIaf.js → PrettyReporter-CIbrmjUV.js} +2 -4
- package/dist/packem_shared/{PrettyReporter-gMqa7j_m.js → PrettyReporter-CNJEO9g7.js} +1250 -15
- package/dist/packem_shared/abstract-json-reporter.d-BAgznjyU.d.ts +61 -0
- package/dist/packem_shared/{abstract-pretty-reporter-szQO-IgK.js → abstract-pretty-reporter-CkqCt5hg.js} +2300 -2298
- package/dist/packem_shared/create-middleware-logger.d-DheMh8q4.d.ts +47 -0
- package/dist/packem_shared/{index-Bx3-C0j9.js → index-6cG1Kp0t.js} +2 -2
- package/dist/packem_shared/types.d-BeLumqgD.d.ts +246 -0
- package/dist/packem_shared/types.d-C51XNfQz.d.ts +194 -0
- package/dist/packem_shared/types.d-CM5ie2qm.d.ts +236 -0
- package/dist/packem_shared/wide-event.d-B-t8ZnhI.d.ts +704 -0
- package/dist/packem_shared/{write-stream-BuFtjATz.js → write-stream-MDqyXmc_.js} +1 -1
- package/dist/processor/caller/caller-processor.d.ts +49 -47
- package/dist/processor/caller/caller-processor.js +1 -1
- package/dist/processor/environment-processor.d.ts +113 -113
- package/dist/processor/message-formatter-processor.d.ts +51 -49
- package/dist/processor/message-formatter-processor.js +2 -2
- package/dist/processor/opentelemetry-processor.d.ts +69 -66
- package/dist/processor/redact-processor.d.ts +60 -41
- package/dist/processor/sampling-processor.d.ts +102 -101
- package/dist/reporter/file/json-file-reporter.d.ts +91 -42
- package/dist/reporter/file/json-file-reporter.js +1 -1
- package/dist/reporter/http/abstract-http-reporter.d.ts +213 -211
- package/dist/reporter/http/abstract-http-reporter.js +1 -1
- package/dist/reporter/http/http-reporter.d.ts +40 -36
- package/dist/reporter/http/http-reporter.edge-light.d.ts +430 -38
- package/dist/reporter/http/http-reporter.edge-light.js +1 -5
- package/dist/reporter/json/index.browser.d.ts +99 -3
- package/dist/reporter/json/index.browser.js +2 -2
- package/dist/reporter/json/index.d.ts +51 -3
- package/dist/reporter/json/index.js +2 -2
- package/dist/reporter/pretty/index.browser.d.ts +106 -2
- package/dist/reporter/pretty/index.browser.js +1 -1
- package/dist/reporter/pretty/index.d.ts +219 -2
- package/dist/reporter/pretty/index.js +1 -1
- package/dist/reporter/simple/simple-reporter.server.d.ts +168 -18
- package/dist/reporter/simple/simple-reporter.server.js +3 -2
- package/dist/wide-event.d.ts +5 -300
- package/dist/wide-event.js +3 -2
- package/package.json +9 -21
- package/dist/constants.d.ts +0 -37
- package/dist/interactive/index.d.ts +0 -2
- package/dist/interactive/index.js +0 -2
- package/dist/interactive/interactive-manager.d.ts +0 -108
- package/dist/interactive/interactive-stream-hook.d.ts +0 -68
- package/dist/middleware/next/middleware.d.ts +0 -59
- package/dist/middleware/next/storage.d.ts +0 -14
- package/dist/middleware/shared/create-middleware-logger.d.ts +0 -82
- package/dist/middleware/shared/headers.d.ts +0 -14
- package/dist/middleware/shared/routes.d.ts +0 -30
- package/dist/middleware/shared/storage.d.ts +0 -29
- package/dist/packem_shared/InteractiveManager-CowYA3Hx.js +0 -178
- package/dist/packem_shared/InteractiveStreamHook-BypRlYTX.js +0 -133
- package/dist/packem_shared/Spinner-Cokext9b.js +0 -2183
- package/dist/packem_shared/getBarChar-D7JfmdTr.js +0 -459
- package/dist/packem_shared/index-BEfVUy9P.js +0 -1256
- package/dist/pail.browser.d.ts +0 -412
- package/dist/pail.server.d.ts +0 -233
- package/dist/processor/caller/get-caller-filename.d.ts +0 -23
- package/dist/progress-bar.d.ts +0 -145
- package/dist/progress-bar.js +0 -459
- package/dist/reporter/file/utils/rotating-file-stream.d.ts +0 -48
- package/dist/reporter/http/utils/compression.d.ts +0 -7
- package/dist/reporter/http/utils/log-size-error.d.ts +0 -30
- package/dist/reporter/http/utils/retry.d.ts +0 -27
- package/dist/reporter/json/abstract-json-reporter.d.ts +0 -61
- package/dist/reporter/json/json-reporter.browser.d.ts +0 -40
- package/dist/reporter/json/json-reporter.server.d.ts +0 -50
- package/dist/reporter/pretty/abstract-pretty-reporter.d.ts +0 -83
- package/dist/reporter/pretty/pretty-reporter.browser.d.ts +0 -36
- package/dist/reporter/pretty/pretty-reporter.server.d.ts +0 -70
- package/dist/reporter/raw/raw-reporter.browser.d.ts +0 -5
- package/dist/reporter/raw/raw-reporter.server.d.ts +0 -13
- package/dist/reporter/utils/default-inspector-config.d.ts +0 -3
- package/dist/reporter/utils/format-label.d.ts +0 -3
- package/dist/spinner.d.ts +0 -220
- package/dist/spinner.js +0 -2183
- package/dist/types.d.ts +0 -241
- package/dist/utils/ansi-escapes.d.ts +0 -4
- package/dist/utils/arrayify.d.ts +0 -2
- package/dist/utils/get-longest-badge.d.ts +0 -4
- package/dist/utils/get-longest-label.d.ts +0 -4
- package/dist/utils/merge-types.d.ts +0 -4
- package/dist/utils/stream/safe-stream-handler.d.ts +0 -21
- package/dist/utils/write-console-log-based-on-level.d.ts +0 -4
- package/dist/utils/write-stream.d.ts +0 -2
|
@@ -1,2 +1,106 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { LiteralUnion } from 'type-fest';
|
|
2
|
+
import { D as DefaultLogTypes, L as LoggerTypesConfig, R as ReadonlyMeta, a as LoggerTypesAwareReporter } from "../../packem_shared/types.d-C51XNfQz.js";
|
|
3
|
+
import '@visulima/colorize';
|
|
4
|
+
import '@visulima/interactive-manager';
|
|
5
|
+
/**
|
|
6
|
+
* Abstract Pretty Reporter.
|
|
7
|
+
*
|
|
8
|
+
* Base class for pretty-printing reporters that format log messages with colors,
|
|
9
|
+
* styles, and structured layout. Provides common functionality for styling options
|
|
10
|
+
* and logger type configuration.
|
|
11
|
+
* @template T - Custom logger type names
|
|
12
|
+
* @template L - Log level types
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* class CustomPrettyReporter extends AbstractPrettyReporter {
|
|
16
|
+
* public log(meta: ReadonlyMeta) {
|
|
17
|
+
* const formatted = this.formatMessage(meta);
|
|
18
|
+
* console.log(formatted);
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare abstract class AbstractPrettyReporter<T extends string = string, L extends string = string> implements LoggerTypesAwareReporter<T, L> {
|
|
24
|
+
/** Styling options for pretty formatting */
|
|
25
|
+
protected readonly styles: PrettyStyleOptions;
|
|
26
|
+
/** Logger type configurations for styling */
|
|
27
|
+
protected loggerTypes: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a new AbstractPrettyReporter instance.
|
|
30
|
+
* @param options Styling options for pretty formatting
|
|
31
|
+
* @protected
|
|
32
|
+
*/
|
|
33
|
+
protected constructor(options: Partial<PrettyStyleOptions>);
|
|
34
|
+
/**
|
|
35
|
+
* Sets the logger types configuration for styling.
|
|
36
|
+
* @param types Logger type configurations with colors and labels
|
|
37
|
+
*/
|
|
38
|
+
setLoggerTypes(types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>): void;
|
|
39
|
+
/**
|
|
40
|
+
* Logs a message with pretty formatting.
|
|
41
|
+
* @param meta The log metadata to format and output
|
|
42
|
+
* @abstract
|
|
43
|
+
*/
|
|
44
|
+
abstract log(meta: ReadonlyMeta<L>): void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Options for configuring pretty reporter styling.
|
|
48
|
+
*/
|
|
49
|
+
type PrettyStyleOptions = {
|
|
50
|
+
/** Bold styling options */
|
|
51
|
+
bold: {
|
|
52
|
+
/** Whether to bold the label text */
|
|
53
|
+
label: boolean;
|
|
54
|
+
};
|
|
55
|
+
/** Function to format dates in log output */
|
|
56
|
+
dateFormatter: (date: Date) => string;
|
|
57
|
+
/** Maximum length of message before line break (optional) */
|
|
58
|
+
messageLength: number | undefined;
|
|
59
|
+
/** Underline styling options */
|
|
60
|
+
underline: {
|
|
61
|
+
/** Whether to underline the label */
|
|
62
|
+
label: boolean;
|
|
63
|
+
/** Whether to underline prefixes */
|
|
64
|
+
prefix: boolean;
|
|
65
|
+
/** Whether to underline suffixes */
|
|
66
|
+
suffix: boolean;
|
|
67
|
+
};
|
|
68
|
+
/** Uppercase styling options */
|
|
69
|
+
uppercase: {
|
|
70
|
+
/** Whether to uppercase the label text */
|
|
71
|
+
label: boolean;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Browser Pretty Reporter.
|
|
76
|
+
*
|
|
77
|
+
* A pretty-printing reporter for browser environments that formats log messages
|
|
78
|
+
* with colors and structured layout for console output. Uses browser-compatible
|
|
79
|
+
* color formatting and console APIs.
|
|
80
|
+
* @template T - Custom logger type names
|
|
81
|
+
* @template L - Log level types
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* import { createPail } from "@visulima/pail";
|
|
85
|
+
*
|
|
86
|
+
* const logger = createPail({
|
|
87
|
+
* reporters: [new PrettyReporter({
|
|
88
|
+
* bold: { label: true },
|
|
89
|
+
* uppercase: { label: true }
|
|
90
|
+
* })]
|
|
91
|
+
* });
|
|
92
|
+
*
|
|
93
|
+
* logger.info("Application started");
|
|
94
|
+
* logger.error("Something went wrong", error);
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
declare class PrettyReporter<T extends string = string, L extends string = string> extends AbstractPrettyReporter<T, L> {
|
|
98
|
+
#private;
|
|
99
|
+
/**
|
|
100
|
+
* Creates a new Browser Pretty Reporter instance.
|
|
101
|
+
* @param options Styling options for pretty formatting
|
|
102
|
+
*/
|
|
103
|
+
constructor(options?: Partial<PrettyStyleOptions>);
|
|
104
|
+
log(meta: ReadonlyMeta<L>): void;
|
|
105
|
+
}
|
|
106
|
+
export { PrettyReporter, type PrettyStyleOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as PrettyReporter } from '../../packem_shared/PrettyReporter-
|
|
1
|
+
export { default as PrettyReporter } from '../../packem_shared/PrettyReporter-CIbrmjUV.js';
|
|
@@ -1,2 +1,219 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { InteractiveManager } from '@visulima/interactive-manager';
|
|
2
|
+
import { D as DefaultLogTypes, L as LiteralUnion$1, c as LoggerTypesConfig, R as ReadonlyMeta, f as LoggerTypesAwareReporter, E as ExtendedRfc5424LogLevels, I as InteractiveStreamReporter } from "../../packem_shared/types.d-BeLumqgD.js";
|
|
3
|
+
import '@visulima/colorize';
|
|
4
|
+
type ColorizeMethod = (value: string) => string;
|
|
5
|
+
type CodeFrameOptions = {
|
|
6
|
+
color?: {
|
|
7
|
+
gutter?: ColorizeMethod;
|
|
8
|
+
marker?: ColorizeMethod;
|
|
9
|
+
message?: ColorizeMethod;
|
|
10
|
+
};
|
|
11
|
+
linesAbove?: number;
|
|
12
|
+
linesBelow?: number;
|
|
13
|
+
message?: string;
|
|
14
|
+
prefix?: string;
|
|
15
|
+
showGutter?: boolean;
|
|
16
|
+
showLineNumbers?: boolean;
|
|
17
|
+
tabWidth?: number | false;
|
|
18
|
+
};
|
|
19
|
+
type Options$1 = Omit<CodeFrameOptions, "message | prefix"> & {
|
|
20
|
+
color: CodeFrameOptions["color"] & {
|
|
21
|
+
fileLine: ColorizeMethod;
|
|
22
|
+
hint: ColorizeMethod;
|
|
23
|
+
method: ColorizeMethod;
|
|
24
|
+
title: ColorizeMethod;
|
|
25
|
+
};
|
|
26
|
+
cwd: string;
|
|
27
|
+
displayShortPath: boolean;
|
|
28
|
+
filterStacktrace: ((line: string) => boolean) | undefined;
|
|
29
|
+
framesMaxLimit: number;
|
|
30
|
+
hideErrorCauseCodeView: boolean;
|
|
31
|
+
hideErrorCodeView: boolean;
|
|
32
|
+
hideErrorErrorsCodeView: boolean;
|
|
33
|
+
hideErrorTitle: boolean;
|
|
34
|
+
hideMessage: boolean;
|
|
35
|
+
indentation: number | " ";
|
|
36
|
+
prefix: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
40
|
+
|
|
41
|
+
@category Type
|
|
42
|
+
*/
|
|
43
|
+
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
44
|
+
/**
|
|
45
|
+
Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
|
|
46
|
+
|
|
47
|
+
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.
|
|
48
|
+
|
|
49
|
+
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.
|
|
50
|
+
|
|
51
|
+
@example
|
|
52
|
+
```
|
|
53
|
+
import type {LiteralUnion} from 'type-fest';
|
|
54
|
+
|
|
55
|
+
// Before
|
|
56
|
+
|
|
57
|
+
type Pet = 'dog' | 'cat' | string;
|
|
58
|
+
|
|
59
|
+
const petWithoutAutocomplete: Pet = '';
|
|
60
|
+
// Start typing in your TypeScript-enabled IDE.
|
|
61
|
+
// You **will not** get auto-completion for `dog` and `cat` literals.
|
|
62
|
+
|
|
63
|
+
// After
|
|
64
|
+
|
|
65
|
+
type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
|
66
|
+
|
|
67
|
+
const petWithAutoComplete: Pet2 = '';
|
|
68
|
+
// You **will** get auto-completion for `dog` and `cat` literals.
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
@category Type
|
|
72
|
+
*/
|
|
73
|
+
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
74
|
+
interface Options {
|
|
75
|
+
breakLength: number;
|
|
76
|
+
customInspect: boolean;
|
|
77
|
+
depth: number;
|
|
78
|
+
indent: number | " " | undefined;
|
|
79
|
+
maxArrayLength: number;
|
|
80
|
+
numericSeparator: boolean;
|
|
81
|
+
quoteStyle: "double" | "single";
|
|
82
|
+
showHidden: boolean;
|
|
83
|
+
showProxy: boolean;
|
|
84
|
+
stylize: (value: string, styleType: LiteralUnion<"bigint" | "boolean" | "date" | "null" | "number" | "regexp" | "special" | "string" | "symbol" | "undefined", string>) => string;
|
|
85
|
+
truncate: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Abstract Pretty Reporter.
|
|
89
|
+
*
|
|
90
|
+
* Base class for pretty-printing reporters that format log messages with colors,
|
|
91
|
+
* styles, and structured layout. Provides common functionality for styling options
|
|
92
|
+
* and logger type configuration.
|
|
93
|
+
* @template T - Custom logger type names
|
|
94
|
+
* @template L - Log level types
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* class CustomPrettyReporter extends AbstractPrettyReporter {
|
|
98
|
+
* public log(meta: ReadonlyMeta) {
|
|
99
|
+
* const formatted = this.formatMessage(meta);
|
|
100
|
+
* console.log(formatted);
|
|
101
|
+
* }
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
declare abstract class AbstractPrettyReporter<T extends string = string, L extends string = string> implements LoggerTypesAwareReporter<T, L> {
|
|
106
|
+
/** Styling options for pretty formatting */
|
|
107
|
+
protected readonly styles: PrettyStyleOptions;
|
|
108
|
+
/** Logger type configurations for styling */
|
|
109
|
+
protected loggerTypes: LoggerTypesConfig<LiteralUnion$1<DefaultLogTypes, T>, L>;
|
|
110
|
+
/**
|
|
111
|
+
* Creates a new AbstractPrettyReporter instance.
|
|
112
|
+
* @param options Styling options for pretty formatting
|
|
113
|
+
* @protected
|
|
114
|
+
*/
|
|
115
|
+
protected constructor(options: Partial<PrettyStyleOptions>);
|
|
116
|
+
/**
|
|
117
|
+
* Sets the logger types configuration for styling.
|
|
118
|
+
* @param types Logger type configurations with colors and labels
|
|
119
|
+
*/
|
|
120
|
+
setLoggerTypes(types: LoggerTypesConfig<LiteralUnion$1<DefaultLogTypes, T>, L>): void;
|
|
121
|
+
/**
|
|
122
|
+
* Logs a message with pretty formatting.
|
|
123
|
+
* @param meta The log metadata to format and output
|
|
124
|
+
* @abstract
|
|
125
|
+
*/
|
|
126
|
+
abstract log(meta: ReadonlyMeta<L>): void;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Options for configuring pretty reporter styling.
|
|
130
|
+
*/
|
|
131
|
+
type PrettyStyleOptions = {
|
|
132
|
+
/** Bold styling options */
|
|
133
|
+
bold: {
|
|
134
|
+
/** Whether to bold the label text */
|
|
135
|
+
label: boolean;
|
|
136
|
+
};
|
|
137
|
+
/** Function to format dates in log output */
|
|
138
|
+
dateFormatter: (date: Date) => string;
|
|
139
|
+
/** Maximum length of message before line break (optional) */
|
|
140
|
+
messageLength: number | undefined;
|
|
141
|
+
/** Underline styling options */
|
|
142
|
+
underline: {
|
|
143
|
+
/** Whether to underline the label */
|
|
144
|
+
label: boolean;
|
|
145
|
+
/** Whether to underline prefixes */
|
|
146
|
+
prefix: boolean;
|
|
147
|
+
/** Whether to underline suffixes */
|
|
148
|
+
suffix: boolean;
|
|
149
|
+
};
|
|
150
|
+
/** Uppercase styling options */
|
|
151
|
+
uppercase: {
|
|
152
|
+
/** Whether to uppercase the label text */
|
|
153
|
+
label: boolean;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Options for configuring the Server Pretty Reporter.
|
|
158
|
+
*/
|
|
159
|
+
type PrettyReporterOptions = PrettyStyleOptions & {
|
|
160
|
+
/** Error rendering options */
|
|
161
|
+
error: Partial<Omit<Options$1, "color" | "prefix" | "indentation">>;
|
|
162
|
+
/** Object inspection options */
|
|
163
|
+
inspect: Partial<Options>;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* Server Pretty Reporter.
|
|
167
|
+
*
|
|
168
|
+
* A comprehensive pretty-printing reporter for Node.js server environments that
|
|
169
|
+
* formats log messages with colors, structured layout, and advanced features like
|
|
170
|
+
* error rendering, object inspection, and interactive terminal support.
|
|
171
|
+
* @template T - Custom logger type names
|
|
172
|
+
* @template L - Log level types
|
|
173
|
+
* @example
|
|
174
|
+
* ```typescript
|
|
175
|
+
* import { createPail } from "@visulima/pail";
|
|
176
|
+
*
|
|
177
|
+
* const logger = createPail({
|
|
178
|
+
* reporters: [new PrettyReporter({
|
|
179
|
+
* bold: { label: true },
|
|
180
|
+
* error: { color: { title: 'red' } }
|
|
181
|
+
* })]
|
|
182
|
+
* });
|
|
183
|
+
*
|
|
184
|
+
* logger.info("Server started on port 3000");
|
|
185
|
+
* logger.error("Database error", dbError);
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
declare class PrettyReporter<T extends string = string, L extends string = string> extends AbstractPrettyReporter<T, L> implements InteractiveStreamReporter<L> {
|
|
189
|
+
#private;
|
|
190
|
+
/**
|
|
191
|
+
* Creates a new Server Pretty Reporter instance.
|
|
192
|
+
* @param options Configuration options for styling, error rendering, and object inspection
|
|
193
|
+
*/
|
|
194
|
+
constructor(options?: Partial<PrettyReporterOptions>);
|
|
195
|
+
/**
|
|
196
|
+
* Sets the stdout stream for the reporter.
|
|
197
|
+
* @param stdout_ The writable stream to use for standard output
|
|
198
|
+
*/
|
|
199
|
+
setStdout(stdout_: NodeJS.WriteStream): void;
|
|
200
|
+
/**
|
|
201
|
+
* Sets the stderr stream for the reporter.
|
|
202
|
+
* @param stderr_ The writable stream to use for error output
|
|
203
|
+
*/
|
|
204
|
+
setStderr(stderr_: NodeJS.WriteStream): void;
|
|
205
|
+
/**
|
|
206
|
+
* Sets the interactive manager for handling interactive output.
|
|
207
|
+
* @param manager The interactive manager instance, or undefined to disable
|
|
208
|
+
*/
|
|
209
|
+
setInteractiveManager(manager?: InteractiveManager): void;
|
|
210
|
+
/**
|
|
211
|
+
* Enables or disables interactive mode.
|
|
212
|
+
* @param interactive Whether to enable interactive terminal features
|
|
213
|
+
*/
|
|
214
|
+
setIsInteractive(interactive: boolean): void;
|
|
215
|
+
log(meta: ReadonlyMeta<L>): void;
|
|
216
|
+
protected _formatMessage(data: ReadonlyMeta<L>): string;
|
|
217
|
+
protected _log(message: string, logLevel: LiteralUnion$1<ExtendedRfc5424LogLevels, L>): void;
|
|
218
|
+
}
|
|
219
|
+
export { PrettyReporter, type PrettyReporterOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PrettyReporter } from '../../packem_shared/PrettyReporter-
|
|
1
|
+
export { PrettyReporter } from '../../packem_shared/PrettyReporter-CNJEO9g7.js';
|
|
@@ -1,20 +1,170 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { InteractiveManager } from '@visulima/interactive-manager';
|
|
2
|
+
import { D as DefaultLogTypes, L as LiteralUnion$1, a as LoggerTypesConfig, g as ReadonlyMeta, e as LoggerTypesAwareReporter, I as InteractiveStreamReporter } from "../../packem_shared/types.d-CM5ie2qm.js";
|
|
3
|
+
import '@visulima/colorize';
|
|
4
|
+
type ColorizeMethod = (value: string) => string;
|
|
5
|
+
type CodeFrameOptions = {
|
|
6
|
+
color?: {
|
|
7
|
+
gutter?: ColorizeMethod;
|
|
8
|
+
marker?: ColorizeMethod;
|
|
9
|
+
message?: ColorizeMethod;
|
|
10
|
+
};
|
|
11
|
+
linesAbove?: number;
|
|
12
|
+
linesBelow?: number;
|
|
13
|
+
message?: string;
|
|
14
|
+
prefix?: string;
|
|
15
|
+
showGutter?: boolean;
|
|
16
|
+
showLineNumbers?: boolean;
|
|
17
|
+
tabWidth?: number | false;
|
|
10
18
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
type Options$1 = Omit<CodeFrameOptions, "message | prefix"> & {
|
|
20
|
+
color: CodeFrameOptions["color"] & {
|
|
21
|
+
fileLine: ColorizeMethod;
|
|
22
|
+
hint: ColorizeMethod;
|
|
23
|
+
method: ColorizeMethod;
|
|
24
|
+
title: ColorizeMethod;
|
|
25
|
+
};
|
|
26
|
+
cwd: string;
|
|
27
|
+
displayShortPath: boolean;
|
|
28
|
+
filterStacktrace: ((line: string) => boolean) | undefined;
|
|
29
|
+
framesMaxLimit: number;
|
|
30
|
+
hideErrorCauseCodeView: boolean;
|
|
31
|
+
hideErrorCodeView: boolean;
|
|
32
|
+
hideErrorErrorsCodeView: boolean;
|
|
33
|
+
hideErrorTitle: boolean;
|
|
34
|
+
hideMessage: boolean;
|
|
35
|
+
indentation: number | " ";
|
|
36
|
+
prefix: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
40
|
+
|
|
41
|
+
@category Type
|
|
42
|
+
*/
|
|
43
|
+
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
44
|
+
/**
|
|
45
|
+
Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
|
|
46
|
+
|
|
47
|
+
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.
|
|
48
|
+
|
|
49
|
+
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.
|
|
50
|
+
|
|
51
|
+
@example
|
|
52
|
+
```
|
|
53
|
+
import type {LiteralUnion} from 'type-fest';
|
|
54
|
+
|
|
55
|
+
// Before
|
|
56
|
+
|
|
57
|
+
type Pet = 'dog' | 'cat' | string;
|
|
58
|
+
|
|
59
|
+
const petWithoutAutocomplete: Pet = '';
|
|
60
|
+
// Start typing in your TypeScript-enabled IDE.
|
|
61
|
+
// You **will not** get auto-completion for `dog` and `cat` literals.
|
|
62
|
+
|
|
63
|
+
// After
|
|
64
|
+
|
|
65
|
+
type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
|
66
|
+
|
|
67
|
+
const petWithAutoComplete: Pet2 = '';
|
|
68
|
+
// You **will** get auto-completion for `dog` and `cat` literals.
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
@category Type
|
|
72
|
+
*/
|
|
73
|
+
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
74
|
+
interface Options {
|
|
75
|
+
breakLength: number;
|
|
76
|
+
customInspect: boolean;
|
|
77
|
+
depth: number;
|
|
78
|
+
indent: number | " " | undefined;
|
|
79
|
+
maxArrayLength: number;
|
|
80
|
+
numericSeparator: boolean;
|
|
81
|
+
quoteStyle: "double" | "single";
|
|
82
|
+
showHidden: boolean;
|
|
83
|
+
showProxy: boolean;
|
|
84
|
+
stylize: (value: string, styleType: LiteralUnion<"bigint" | "boolean" | "date" | "null" | "number" | "regexp" | "special" | "string" | "symbol" | "undefined", string>) => string;
|
|
85
|
+
truncate: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Abstract Pretty Reporter.
|
|
89
|
+
*
|
|
90
|
+
* Base class for pretty-printing reporters that format log messages with colors,
|
|
91
|
+
* styles, and structured layout. Provides common functionality for styling options
|
|
92
|
+
* and logger type configuration.
|
|
93
|
+
* @template T - Custom logger type names
|
|
94
|
+
* @template L - Log level types
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* class CustomPrettyReporter extends AbstractPrettyReporter {
|
|
98
|
+
* public log(meta: ReadonlyMeta) {
|
|
99
|
+
* const formatted = this.formatMessage(meta);
|
|
100
|
+
* console.log(formatted);
|
|
101
|
+
* }
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
declare abstract class AbstractPrettyReporter<T extends string = string, L extends string = string> implements LoggerTypesAwareReporter<T, L> {
|
|
106
|
+
/** Styling options for pretty formatting */
|
|
107
|
+
protected readonly styles: PrettyStyleOptions;
|
|
108
|
+
/** Logger type configurations for styling */
|
|
109
|
+
protected loggerTypes: LoggerTypesConfig<LiteralUnion$1<DefaultLogTypes, T>, L>;
|
|
110
|
+
/**
|
|
111
|
+
* Creates a new AbstractPrettyReporter instance.
|
|
112
|
+
* @param options Styling options for pretty formatting
|
|
113
|
+
* @protected
|
|
114
|
+
*/
|
|
115
|
+
protected constructor(options: Partial<PrettyStyleOptions>);
|
|
116
|
+
/**
|
|
117
|
+
* Sets the logger types configuration for styling.
|
|
118
|
+
* @param types Logger type configurations with colors and labels
|
|
119
|
+
*/
|
|
120
|
+
setLoggerTypes(types: LoggerTypesConfig<LiteralUnion$1<DefaultLogTypes, T>, L>): void;
|
|
121
|
+
/**
|
|
122
|
+
* Logs a message with pretty formatting.
|
|
123
|
+
* @param meta The log metadata to format and output
|
|
124
|
+
* @abstract
|
|
125
|
+
*/
|
|
126
|
+
abstract log(meta: ReadonlyMeta<L>): void;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Options for configuring pretty reporter styling.
|
|
130
|
+
*/
|
|
131
|
+
type PrettyStyleOptions = {
|
|
132
|
+
/** Bold styling options */
|
|
133
|
+
bold: {
|
|
134
|
+
/** Whether to bold the label text */
|
|
135
|
+
label: boolean;
|
|
136
|
+
};
|
|
137
|
+
/** Function to format dates in log output */
|
|
138
|
+
dateFormatter: (date: Date) => string;
|
|
139
|
+
/** Maximum length of message before line break (optional) */
|
|
140
|
+
messageLength: number | undefined;
|
|
141
|
+
/** Underline styling options */
|
|
142
|
+
underline: {
|
|
143
|
+
/** Whether to underline the label */
|
|
144
|
+
label: boolean;
|
|
145
|
+
/** Whether to underline prefixes */
|
|
146
|
+
prefix: boolean;
|
|
147
|
+
/** Whether to underline suffixes */
|
|
148
|
+
suffix: boolean;
|
|
149
|
+
};
|
|
150
|
+
/** Uppercase styling options */
|
|
151
|
+
uppercase: {
|
|
152
|
+
/** Whether to uppercase the label text */
|
|
153
|
+
label: boolean;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
type SimpleReporterOptions = PrettyStyleOptions & {
|
|
157
|
+
error: Partial<Omit<Options$1, "color | prefix | indentation">>;
|
|
158
|
+
inspect: Partial<Options>;
|
|
159
|
+
};
|
|
160
|
+
declare class SimpleReporter<T extends string = string, L extends string = string> extends AbstractPrettyReporter<T, L> implements InteractiveStreamReporter<L> {
|
|
161
|
+
#private;
|
|
162
|
+
constructor(options?: Partial<SimpleReporterOptions>);
|
|
163
|
+
setStdout(stdout_: NodeJS.WriteStream): void;
|
|
164
|
+
setStderr(stderr_: NodeJS.WriteStream): void;
|
|
165
|
+
setInteractiveManager(manager?: InteractiveManager): void;
|
|
166
|
+
setIsInteractive(interactive: boolean): void;
|
|
167
|
+
log(meta: ReadonlyMeta<L>): void;
|
|
168
|
+
protected formatMessage(data: ReadonlyMeta<L>): string;
|
|
20
169
|
}
|
|
170
|
+
export { SimpleReporter, SimpleReporterOptions };
|
|
@@ -8,9 +8,10 @@ const {
|
|
|
8
8
|
stdout,
|
|
9
9
|
stderr
|
|
10
10
|
} = __cjs_getProcess;
|
|
11
|
-
import colorize
|
|
12
|
-
import { A as AbstractPrettyReporter, d as defaultInspectorConfig,
|
|
11
|
+
import colorize from '@visulima/colorize';
|
|
12
|
+
import { A as AbstractPrettyReporter, d as defaultInspectorConfig, w as writeStream, t as terminalSize, b as getLongestBadge, g as getLongestLabel, c as getStringWidth, f as formatLabel, a as EMPTY_SYMBOL, i as inspect, e as wordWrap, r as renderError, W as WrapMode } from '../../packem_shared/abstract-pretty-reporter-CkqCt5hg.js';
|
|
13
13
|
|
|
14
|
+
const { bgGrey, bold, cyan, green, greenBright, grey, red, underline, white } = colorize;
|
|
14
15
|
const PAIL_DIST_REGEX = /[\\/]pail[\\/]dist/;
|
|
15
16
|
const pailFileFilter = (line) => !PAIL_DIST_REGEX.test(line);
|
|
16
17
|
class SimpleReporter extends AbstractPrettyReporter {
|