@visulima/pail 3.2.0 → 3.2.2
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 +41 -0
- package/LICENSE.md +3 -0
- package/dist/constants.d.ts +37 -0
- package/dist/index.browser.d.ts +47 -12
- package/dist/index.browser.js +1 -1
- package/dist/index.server.d.ts +65 -43
- package/dist/index.server.js +1 -3
- package/dist/interactive/index.d.ts +2 -28
- package/dist/interactive/interactive-manager.d.ts +108 -0
- package/dist/interactive/interactive-stream-hook.d.ts +68 -0
- package/dist/object-tree.d.ts +65 -7
- package/dist/packem_shared/{JsonReporter-BqWsVkHP.js → JsonReporter-C0AXk99i.js} +0 -2
- package/dist/packem_shared/{pail.browser-CPDOE_d1.js → pail.browser-CPjQrsyy.js} +3 -3
- package/dist/pail.browser.d.ts +412 -0
- package/dist/pail.server.d.ts +233 -0
- package/dist/processor/caller/caller-processor.d.ts +40 -7
- package/dist/processor/caller/get-caller-filename.d.ts +23 -0
- package/dist/processor/message-formatter-processor.d.ts +44 -9
- package/dist/processor/message-formatter-processor.js +1 -1
- package/dist/processor/opentelemetry-processor.d.ts +61 -10
- package/dist/processor/redact-processor.d.ts +39 -8
- package/dist/progress-bar.d.ts +75 -15
- package/dist/reporter/file/json-file-reporter.d.ts +39 -20
- package/dist/reporter/file/utils/rotating-file-stream.d.ts +48 -0
- package/dist/reporter/http/abstract-http-reporter.d.ts +125 -12
- package/dist/reporter/http/http-reporter.d.ts +36 -10
- package/dist/reporter/http/http-reporter.edge-light.d.ts +37 -165
- package/dist/reporter/http/utils/compression.d.ts +7 -0
- package/dist/reporter/http/utils/log-size-error.d.ts +30 -0
- package/dist/reporter/http/utils/retry.d.ts +27 -0
- package/dist/reporter/json/abstract-json-reporter.d.ts +61 -0
- package/dist/reporter/json/index.browser.d.ts +3 -13
- package/dist/reporter/json/index.d.ts +3 -16
- package/dist/reporter/json/index.js +1 -1
- package/dist/reporter/json/json-reporter.browser.d.ts +40 -0
- package/dist/reporter/json/json-reporter.server.d.ts +50 -0
- package/dist/reporter/pretty/abstract-pretty-reporter.d.ts +83 -0
- package/dist/reporter/pretty/index.browser.d.ts +2 -13
- package/dist/reporter/pretty/index.d.ts +2 -25
- package/dist/reporter/pretty/pretty-reporter.browser.d.ts +36 -0
- package/dist/reporter/pretty/pretty-reporter.server.d.ts +70 -0
- package/dist/reporter/raw/raw-reporter.browser.d.ts +5 -0
- package/dist/reporter/raw/raw-reporter.server.d.ts +13 -0
- package/dist/reporter/simple/simple-reporter.server.d.ts +10 -14
- package/dist/reporter/utils/default-inspector-config.d.ts +3 -0
- package/dist/reporter/utils/format-label.d.ts +3 -0
- package/dist/spinner.d.ts +170 -104
- package/dist/spinner.js +89 -89
- package/dist/types.d.ts +241 -0
- package/dist/utils/ansi-escapes.d.ts +4 -0
- package/dist/utils/arrayify.d.ts +2 -0
- package/dist/utils/get-longest-badge.d.ts +4 -0
- package/dist/utils/get-longest-label.d.ts +4 -0
- package/dist/utils/merge-types.d.ts +4 -0
- package/dist/utils/stream/safe-stream-handler.d.ts +21 -0
- package/dist/utils/write-console-log-based-on-level.d.ts +4 -0
- package/dist/utils/write-stream.d.ts +2 -0
- package/package.json +3 -4
- package/dist/packem_shared/abstract-json-reporter-DiyVyU0j.d.ts +0 -22
- package/dist/packem_shared/abstract-pretty-reporter-BbOWXMCs.d.ts +0 -28
- package/dist/packem_shared/index.d-BR1GjZri.d.ts +0 -53
- package/dist/packem_shared/index.d-oxZvg_y7.d.ts +0 -20
- package/dist/packem_shared/pail.browser-By9KjOH7.d.ts +0 -69
- package/dist/packem_shared/types-D3ycu8-x.d.ts +0 -95
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { LiteralUnion } from "type-fest";
|
|
2
|
+
import type { ExtendedRfc5424LogLevels, StreamAwareReporter } from "../../types.d.ts";
|
|
3
|
+
import type { AbstractJsonReporterOptions } from "./abstract-json-reporter.d.ts";
|
|
4
|
+
import { AbstractJsonReporter } from "./abstract-json-reporter.d.ts";
|
|
5
|
+
/**
|
|
6
|
+
* Server JSON Reporter.
|
|
7
|
+
*
|
|
8
|
+
* A JSON reporter for Node.js server environments that outputs structured log data
|
|
9
|
+
* to stdout/stderr streams. Routes error-level logs to stderr and others to stdout.
|
|
10
|
+
* @template L - The log level type
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { createPail } from "@visulima/pail";
|
|
14
|
+
*
|
|
15
|
+
* const logger = createPail({
|
|
16
|
+
* reporters: [new JsonReporter()]
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* logger.info("Server started", { port: 3000 });
|
|
20
|
+
* logger.error("Database connection failed", error);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare class JsonReporter<L extends string = string> extends AbstractJsonReporter<L> implements StreamAwareReporter<L> {
|
|
24
|
+
#private;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new Server JSON Reporter instance.
|
|
27
|
+
* @param options Configuration options for JSON formatting
|
|
28
|
+
*/
|
|
29
|
+
constructor(options?: Partial<AbstractJsonReporterOptions>);
|
|
30
|
+
/**
|
|
31
|
+
* Sets the stdout stream for the reporter.
|
|
32
|
+
* @param stdout_ The writable stream to use for stdout output
|
|
33
|
+
*/
|
|
34
|
+
setStdout(stdout_: NodeJS.WriteStream): void;
|
|
35
|
+
/**
|
|
36
|
+
* Sets the stderr stream for the reporter.
|
|
37
|
+
* @param stderr_ The writable stream to use for stderr output
|
|
38
|
+
*/
|
|
39
|
+
setStderr(stderr_: NodeJS.WriteStream): void;
|
|
40
|
+
/**
|
|
41
|
+
* Outputs the JSON message to the appropriate stream.
|
|
42
|
+
*
|
|
43
|
+
* Routes error and warning level messages to stderr, others to stdout.
|
|
44
|
+
* @param message The JSON-formatted log message
|
|
45
|
+
* @param logLevel The log level determining which stream to use
|
|
46
|
+
* @protected
|
|
47
|
+
*/
|
|
48
|
+
protected _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
|
|
49
|
+
}
|
|
50
|
+
export default JsonReporter;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { LiteralUnion } from "type-fest";
|
|
2
|
+
import type { DefaultLogTypes, LoggerTypesAwareReporter, LoggerTypesConfig, ReadonlyMeta } from "../../types.d.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Default date formatter for pretty reporters.
|
|
5
|
+
*
|
|
6
|
+
* Formats a Date object as HH:MM:SS (24-hour format).
|
|
7
|
+
* @param date The date to format
|
|
8
|
+
* @returns Formatted time string
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* dateFormatter(new Date()); // "14:30:25"
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare const dateFormatter: (date: Date) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Abstract Pretty Reporter.
|
|
17
|
+
*
|
|
18
|
+
* Base class for pretty-printing reporters that format log messages with colors,
|
|
19
|
+
* styles, and structured layout. Provides common functionality for styling options
|
|
20
|
+
* and logger type configuration.
|
|
21
|
+
* @template T - Custom logger type names
|
|
22
|
+
* @template L - Log level types
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* class CustomPrettyReporter extends AbstractPrettyReporter {
|
|
26
|
+
* public log(meta: ReadonlyMeta) {
|
|
27
|
+
* const formatted = this.formatMessage(meta);
|
|
28
|
+
* console.log(formatted);
|
|
29
|
+
* }
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare abstract class AbstractPrettyReporter<T extends string = string, L extends string = string> implements LoggerTypesAwareReporter<T, L> {
|
|
34
|
+
/** Styling options for pretty formatting */
|
|
35
|
+
protected readonly styles: PrettyStyleOptions;
|
|
36
|
+
/** Logger type configurations for styling */
|
|
37
|
+
protected loggerTypes: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new AbstractPrettyReporter instance.
|
|
40
|
+
* @param options Styling options for pretty formatting
|
|
41
|
+
* @protected
|
|
42
|
+
*/
|
|
43
|
+
protected constructor(options: Partial<PrettyStyleOptions>);
|
|
44
|
+
/**
|
|
45
|
+
* Sets the logger types configuration for styling.
|
|
46
|
+
* @param types Logger type configurations with colors and labels
|
|
47
|
+
*/
|
|
48
|
+
setLoggerTypes(types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>): void;
|
|
49
|
+
/**
|
|
50
|
+
* Logs a message with pretty formatting.
|
|
51
|
+
* @param meta The log metadata to format and output
|
|
52
|
+
* @abstract
|
|
53
|
+
*/
|
|
54
|
+
abstract log(meta: ReadonlyMeta<L>): void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Options for configuring pretty reporter styling.
|
|
58
|
+
*/
|
|
59
|
+
export type PrettyStyleOptions = {
|
|
60
|
+
/** Bold styling options */
|
|
61
|
+
bold: {
|
|
62
|
+
/** Whether to bold the label text */
|
|
63
|
+
label: boolean;
|
|
64
|
+
};
|
|
65
|
+
/** Function to format dates in log output */
|
|
66
|
+
dateFormatter: (date: Date) => string;
|
|
67
|
+
/** Maximum length of message before line break (optional) */
|
|
68
|
+
messageLength: number | undefined;
|
|
69
|
+
/** Underline styling options */
|
|
70
|
+
underline: {
|
|
71
|
+
/** Whether to underline the label */
|
|
72
|
+
label: boolean;
|
|
73
|
+
/** Whether to underline prefixes */
|
|
74
|
+
prefix: boolean;
|
|
75
|
+
/** Whether to underline suffixes */
|
|
76
|
+
suffix: boolean;
|
|
77
|
+
};
|
|
78
|
+
/** Uppercase styling options */
|
|
79
|
+
uppercase: {
|
|
80
|
+
/** Whether to uppercase the label text */
|
|
81
|
+
label: boolean;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import 'type-fest';
|
|
4
|
-
import '@visulima/colorize';
|
|
5
|
-
import '../../interactive/index.js';
|
|
6
|
-
|
|
7
|
-
declare class PrettyReporter<T extends string = string, L extends string = string> extends AbstractPrettyReporter<T, L> {
|
|
8
|
-
#private;
|
|
9
|
-
constructor(options?: Partial<PrettyStyleOptions>);
|
|
10
|
-
log(meta: ReadonlyMeta<L>): void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { PrettyReporter, PrettyStyleOptions };
|
|
1
|
+
export type { PrettyStyleOptions } from "./abstract-pretty-reporter.d.ts";
|
|
2
|
+
export { default as PrettyReporter } from "./pretty-reporter.d.ts";
|
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { InteractiveManager } from '../../interactive/index.js';
|
|
4
|
-
import { I as InteractiveStreamReporter, e as ReadonlyMeta, E as ExtendedRfc5424LogLevels } from '../../packem_shared/types-D3ycu8-x.js';
|
|
5
|
-
import { P as PrettyStyleOptions, A as AbstractPrettyReporter } from '../../packem_shared/abstract-pretty-reporter-BbOWXMCs.js';
|
|
6
|
-
import '@visulima/colorize';
|
|
7
|
-
|
|
8
|
-
type PrettyReporterOptions = PrettyStyleOptions & {
|
|
9
|
-
error: Partial<Omit<Options$1, "color" | "prefix" | "indentation">>;
|
|
10
|
-
inspect: Partial<Options>;
|
|
11
|
-
};
|
|
12
|
-
declare class PrettyReporter<T extends string = string, L extends string = string> extends AbstractPrettyReporter<T, L> implements InteractiveStreamReporter<L> {
|
|
13
|
-
#private;
|
|
14
|
-
constructor(options?: Partial<PrettyReporterOptions>);
|
|
15
|
-
setStdout(stdout_: NodeJS.WriteStream): void;
|
|
16
|
-
setStderr(stderr_: NodeJS.WriteStream): void;
|
|
17
|
-
setInteractiveManager(manager?: InteractiveManager): void;
|
|
18
|
-
setIsInteractive(interactive: boolean): void;
|
|
19
|
-
log(meta: ReadonlyMeta<L>): void;
|
|
20
|
-
protected _formatMessage(data: ReadonlyMeta<L>): string;
|
|
21
|
-
protected _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { PrettyReporter };
|
|
25
|
-
export type { PrettyReporterOptions };
|
|
1
|
+
export type { PrettyReporterOptions } from "./pretty-reporter.d.ts";
|
|
2
|
+
export { PrettyReporter } from "./pretty-reporter.d.ts";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ReadonlyMeta } from "../../types.d.ts";
|
|
2
|
+
import type { PrettyStyleOptions } from "./abstract-pretty-reporter.d.ts";
|
|
3
|
+
import { AbstractPrettyReporter } from "./abstract-pretty-reporter.d.ts";
|
|
4
|
+
/**
|
|
5
|
+
* Browser Pretty Reporter.
|
|
6
|
+
*
|
|
7
|
+
* A pretty-printing reporter for browser environments that formats log messages
|
|
8
|
+
* with colors and structured layout for console output. Uses browser-compatible
|
|
9
|
+
* color formatting and console APIs.
|
|
10
|
+
* @template T - Custom logger type names
|
|
11
|
+
* @template L - Log level types
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { createPail } from "@visulima/pail";
|
|
15
|
+
*
|
|
16
|
+
* const logger = createPail({
|
|
17
|
+
* reporters: [new PrettyReporter({
|
|
18
|
+
* bold: { label: true },
|
|
19
|
+
* uppercase: { label: true }
|
|
20
|
+
* })]
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* logger.info("Application started");
|
|
24
|
+
* logger.error("Something went wrong", error);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
declare class PrettyReporter<T extends string = string, L extends string = string> extends AbstractPrettyReporter<T, L> {
|
|
28
|
+
#private;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new Browser Pretty Reporter instance.
|
|
31
|
+
* @param options Styling options for pretty formatting
|
|
32
|
+
*/
|
|
33
|
+
constructor(options?: Partial<PrettyStyleOptions>);
|
|
34
|
+
log(meta: ReadonlyMeta<L>): void;
|
|
35
|
+
}
|
|
36
|
+
export default PrettyReporter;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { RenderErrorOptions } from "@visulima/error/error";
|
|
2
|
+
import type { Options as InspectorOptions } from "@visulima/inspector";
|
|
3
|
+
import type { LiteralUnion } from "type-fest";
|
|
4
|
+
import type InteractiveManager from "../../interactive/interactive-manager.d.ts";
|
|
5
|
+
import type { ExtendedRfc5424LogLevels, InteractiveStreamReporter, ReadonlyMeta } from "../../types.d.ts";
|
|
6
|
+
import type { PrettyStyleOptions } from "./abstract-pretty-reporter.d.ts";
|
|
7
|
+
import { AbstractPrettyReporter } from "./abstract-pretty-reporter.d.ts";
|
|
8
|
+
/**
|
|
9
|
+
* Options for configuring the Server Pretty Reporter.
|
|
10
|
+
*/
|
|
11
|
+
export type PrettyReporterOptions = PrettyStyleOptions & {
|
|
12
|
+
/** Error rendering options */
|
|
13
|
+
error: Partial<Omit<RenderErrorOptions, "color" | "prefix" | "indentation">>;
|
|
14
|
+
/** Object inspection options */
|
|
15
|
+
inspect: Partial<InspectorOptions>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Server Pretty Reporter.
|
|
19
|
+
*
|
|
20
|
+
* A comprehensive pretty-printing reporter for Node.js server environments that
|
|
21
|
+
* formats log messages with colors, structured layout, and advanced features like
|
|
22
|
+
* error rendering, object inspection, and interactive terminal support.
|
|
23
|
+
* @template T - Custom logger type names
|
|
24
|
+
* @template L - Log level types
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { createPail } from "@visulima/pail";
|
|
28
|
+
*
|
|
29
|
+
* const logger = createPail({
|
|
30
|
+
* reporters: [new PrettyReporter({
|
|
31
|
+
* bold: { label: true },
|
|
32
|
+
* error: { color: { title: 'red' } }
|
|
33
|
+
* })]
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* logger.info("Server started on port 3000");
|
|
37
|
+
* logger.error("Database error", dbError);
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare class PrettyReporter<T extends string = string, L extends string = string> extends AbstractPrettyReporter<T, L> implements InteractiveStreamReporter<L> {
|
|
41
|
+
#private;
|
|
42
|
+
/**
|
|
43
|
+
* Creates a new Server Pretty Reporter instance.
|
|
44
|
+
* @param options Configuration options for styling, error rendering, and object inspection
|
|
45
|
+
*/
|
|
46
|
+
constructor(options?: Partial<PrettyReporterOptions>);
|
|
47
|
+
/**
|
|
48
|
+
* Sets the stdout stream for the reporter.
|
|
49
|
+
* @param stdout_ The writable stream to use for standard output
|
|
50
|
+
*/
|
|
51
|
+
setStdout(stdout_: NodeJS.WriteStream): void;
|
|
52
|
+
/**
|
|
53
|
+
* Sets the stderr stream for the reporter.
|
|
54
|
+
* @param stderr_ The writable stream to use for error output
|
|
55
|
+
*/
|
|
56
|
+
setStderr(stderr_: NodeJS.WriteStream): void;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the interactive manager for handling interactive output.
|
|
59
|
+
* @param manager The interactive manager instance, or undefined to disable
|
|
60
|
+
*/
|
|
61
|
+
setInteractiveManager(manager?: InteractiveManager): void;
|
|
62
|
+
/**
|
|
63
|
+
* Enables or disables interactive mode.
|
|
64
|
+
* @param interactive Whether to enable interactive terminal features
|
|
65
|
+
*/
|
|
66
|
+
setIsInteractive(interactive: boolean): void;
|
|
67
|
+
log(meta: ReadonlyMeta<L>): void;
|
|
68
|
+
protected _formatMessage(data: ReadonlyMeta<L>): string;
|
|
69
|
+
protected _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
|
|
70
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Options as InspectorOptions } from "@visulima/inspector";
|
|
2
|
+
import type InteractiveManager from "../../interactive/interactive-manager.d.ts";
|
|
3
|
+
import type { ReadonlyMeta, StreamAwareReporter } from "../../types.d.ts";
|
|
4
|
+
declare class RawReporter<L extends string = string> implements StreamAwareReporter<L> {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(inspectOptions?: Partial<InspectorOptions>);
|
|
7
|
+
setStdout(stdout_: NodeJS.WriteStream): void;
|
|
8
|
+
setStderr(stderr_: NodeJS.WriteStream): void;
|
|
9
|
+
setInteractiveManager(manager?: InteractiveManager): void;
|
|
10
|
+
setIsInteractive(interactive: boolean): void;
|
|
11
|
+
log(meta: ReadonlyMeta<L>): void;
|
|
12
|
+
}
|
|
13
|
+
export default RawReporter;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
inspect: Partial<Options>;
|
|
1
|
+
import type { RenderErrorOptions } from "@visulima/error";
|
|
2
|
+
import type { Options as InspectorOptions } from "@visulima/inspector";
|
|
3
|
+
import type InteractiveManager from "../../interactive/interactive-manager.d.ts";
|
|
4
|
+
import type { InteractiveStreamReporter, ReadonlyMeta } from "../../types.d.ts";
|
|
5
|
+
import type { PrettyStyleOptions } from "../pretty/abstract-pretty-reporter.d.ts";
|
|
6
|
+
import { AbstractPrettyReporter } from "../pretty/abstract-pretty-reporter.d.ts";
|
|
7
|
+
export type SimpleReporterOptions = PrettyStyleOptions & {
|
|
8
|
+
error: Partial<Omit<RenderErrorOptions, "color | prefix | indentation">>;
|
|
9
|
+
inspect: Partial<InspectorOptions>;
|
|
11
10
|
};
|
|
12
|
-
declare class SimpleReporter<T extends string = string, L extends string = string> extends AbstractPrettyReporter<T, L> implements InteractiveStreamReporter<L> {
|
|
11
|
+
export declare class SimpleReporter<T extends string = string, L extends string = string> extends AbstractPrettyReporter<T, L> implements InteractiveStreamReporter<L> {
|
|
13
12
|
#private;
|
|
14
13
|
constructor(options?: Partial<SimpleReporterOptions>);
|
|
15
14
|
setStdout(stdout_: NodeJS.WriteStream): void;
|
|
@@ -19,6 +18,3 @@ declare class SimpleReporter<T extends string = string, L extends string = strin
|
|
|
19
18
|
log(meta: ReadonlyMeta<L>): void;
|
|
20
19
|
protected formatMessage(data: ReadonlyMeta<L>): string;
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
export { SimpleReporter };
|
|
24
|
-
export type { SimpleReporterOptions };
|
package/dist/spinner.d.ts
CHANGED
|
@@ -1,154 +1,220 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
| 'dots4'
|
|
9
|
-
| 'dots5'
|
|
10
|
-
| 'dots6'
|
|
11
|
-
| 'dots7'
|
|
12
|
-
| 'dots8'
|
|
13
|
-
| 'dots9'
|
|
14
|
-
| 'dots10'
|
|
15
|
-
| 'dots11'
|
|
16
|
-
| 'dots12'
|
|
17
|
-
| 'dots13'
|
|
18
|
-
| 'dots14'
|
|
19
|
-
| 'dots8Bit'
|
|
20
|
-
| 'dotsCircle'
|
|
21
|
-
| 'sand'
|
|
22
|
-
| 'line'
|
|
23
|
-
| 'line2'
|
|
24
|
-
| 'rollingLine'
|
|
25
|
-
| 'pipe'
|
|
26
|
-
| 'simpleDots'
|
|
27
|
-
| 'simpleDotsScrolling'
|
|
28
|
-
| 'star'
|
|
29
|
-
| 'star2'
|
|
30
|
-
| 'flip'
|
|
31
|
-
| 'hamburger'
|
|
32
|
-
| 'growVertical'
|
|
33
|
-
| 'growHorizontal'
|
|
34
|
-
| 'balloon'
|
|
35
|
-
| 'balloon2'
|
|
36
|
-
| 'noise'
|
|
37
|
-
| 'bounce'
|
|
38
|
-
| 'boxBounce'
|
|
39
|
-
| 'boxBounce2'
|
|
40
|
-
| 'binary'
|
|
41
|
-
| 'triangle'
|
|
42
|
-
| 'arc'
|
|
43
|
-
| 'circle'
|
|
44
|
-
| 'squareCorners'
|
|
45
|
-
| 'circleQuarters'
|
|
46
|
-
| 'circleHalves'
|
|
47
|
-
| 'squish'
|
|
48
|
-
| 'toggle'
|
|
49
|
-
| 'toggle2'
|
|
50
|
-
| 'toggle3'
|
|
51
|
-
| 'toggle4'
|
|
52
|
-
| 'toggle5'
|
|
53
|
-
| 'toggle6'
|
|
54
|
-
| 'toggle7'
|
|
55
|
-
| 'toggle8'
|
|
56
|
-
| 'toggle9'
|
|
57
|
-
| 'toggle10'
|
|
58
|
-
| 'toggle11'
|
|
59
|
-
| 'toggle12'
|
|
60
|
-
| 'toggle13'
|
|
61
|
-
| 'arrow'
|
|
62
|
-
| 'arrow2'
|
|
63
|
-
| 'arrow3'
|
|
64
|
-
| 'bouncingBar'
|
|
65
|
-
| 'bouncingBall'
|
|
66
|
-
| 'smiley'
|
|
67
|
-
| 'monkey'
|
|
68
|
-
| 'hearts'
|
|
69
|
-
| 'clock'
|
|
70
|
-
| 'earth'
|
|
71
|
-
| 'material'
|
|
72
|
-
| 'moon'
|
|
73
|
-
| 'runner'
|
|
74
|
-
| 'pong'
|
|
75
|
-
| 'shark'
|
|
76
|
-
| 'dqpb'
|
|
77
|
-
| 'weather'
|
|
78
|
-
| 'christmas'
|
|
79
|
-
| 'grenade'
|
|
80
|
-
| 'point'
|
|
81
|
-
| 'layer'
|
|
82
|
-
| 'betaWave'
|
|
83
|
-
| 'fingerDance'
|
|
84
|
-
| 'fistBump'
|
|
85
|
-
| 'soccerHeader'
|
|
86
|
-
| 'mindblown'
|
|
87
|
-
| 'speaker'
|
|
88
|
-
| 'orangePulse'
|
|
89
|
-
| 'bluePulse'
|
|
90
|
-
| 'orangeBluePulse'
|
|
91
|
-
| 'timeTravel'
|
|
92
|
-
| 'aesthetic'
|
|
93
|
-
| 'dwarfFortress';
|
|
94
|
-
|
|
95
|
-
interface SpinnerStyle {
|
|
1
|
+
import type { SpinnerName } from "cli-spinners";
|
|
2
|
+
import type InteractiveManager from "./interactive/interactive-manager.d.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Spinner style configuration using colorize.
|
|
5
|
+
*/
|
|
6
|
+
export interface SpinnerStyle {
|
|
7
|
+
/** Background color name (e.g., "bgRed", "bgBlue") */
|
|
96
8
|
bgColor?: string;
|
|
9
|
+
/** Background color as hex (e.g., "#FF0000") */
|
|
97
10
|
bgHex?: `#${string}`;
|
|
11
|
+
/** Background color as RGB (e.g., [255, 0, 0]) */
|
|
98
12
|
bgRgb?: [number, number, number];
|
|
13
|
+
/** Apply bold style */
|
|
99
14
|
bold?: boolean;
|
|
15
|
+
/** Foreground color name (e.g., "red", "blue", "green") */
|
|
100
16
|
color?: string;
|
|
17
|
+
/** Apply dim/faint style */
|
|
101
18
|
dim?: boolean;
|
|
19
|
+
/** Foreground color as hex (e.g., "#FF0000") */
|
|
102
20
|
hex?: `#${string}`;
|
|
21
|
+
/** Apply inverse style (swap fg/bg) */
|
|
103
22
|
inverse?: boolean;
|
|
23
|
+
/** Apply italic style */
|
|
104
24
|
italic?: boolean;
|
|
25
|
+
/** Apply overline style */
|
|
105
26
|
overline?: boolean;
|
|
27
|
+
/** Foreground color as RGB (e.g., [255, 0, 0]) */
|
|
106
28
|
rgb?: [number, number, number];
|
|
29
|
+
/** Apply strikethrough style */
|
|
107
30
|
strikethrough?: boolean;
|
|
31
|
+
/** Apply underline style */
|
|
108
32
|
underline?: boolean;
|
|
109
33
|
}
|
|
110
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Spinner completion icons.
|
|
36
|
+
*/
|
|
37
|
+
export interface SpinnerIcons {
|
|
38
|
+
/** Icon to show on failure (default: "✖") */
|
|
111
39
|
error?: string;
|
|
40
|
+
/** Icon to show on info (default: "ℹ") */
|
|
112
41
|
info?: string;
|
|
42
|
+
/** Icon to show on success (default: "✓") */
|
|
113
43
|
success?: string;
|
|
44
|
+
/** Icon to show on warning (default: "⚠") */
|
|
114
45
|
warning?: string;
|
|
115
46
|
}
|
|
116
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Spinner style options.
|
|
49
|
+
*/
|
|
50
|
+
export interface SpinnerOptions {
|
|
51
|
+
/** Custom icons for completion states */
|
|
117
52
|
icons?: SpinnerIcons;
|
|
53
|
+
/** Name of the spinner from cli-spinners */
|
|
118
54
|
name?: SpinnerName;
|
|
55
|
+
/** Prefix text to show before the spinner */
|
|
119
56
|
prefixText?: string;
|
|
57
|
+
/** Style configuration for the spinner */
|
|
120
58
|
style?: SpinnerStyle;
|
|
59
|
+
/** Whether to output spinner (default: true) */
|
|
121
60
|
verbose?: boolean;
|
|
122
61
|
}
|
|
123
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Options for starting a spinner.
|
|
64
|
+
*/
|
|
65
|
+
export interface SpinnerStartOptions {
|
|
66
|
+
/** Prefix text to show before the spinner */
|
|
124
67
|
prefixText?: string;
|
|
125
68
|
}
|
|
126
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Spinner class for creating loading indicators in terminal applications.
|
|
71
|
+
*
|
|
72
|
+
* Provides an easy-to-use interface for displaying spinners with various styles
|
|
73
|
+
* from the cli-spinners library. Works seamlessly with interactive terminal features.
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const spinner = new Spinner({ name: "dots" });
|
|
77
|
+
* spinner.start("Loading...");
|
|
78
|
+
* // ... do work ...
|
|
79
|
+
* spinner.succeed("Done!");
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export declare class Spinner {
|
|
127
83
|
#private;
|
|
84
|
+
/**
|
|
85
|
+
* Creates a new Spinner instance.
|
|
86
|
+
* @param options Configuration options for the spinner
|
|
87
|
+
* @param interactiveManager Optional interactive manager for terminal control
|
|
88
|
+
*/
|
|
128
89
|
constructor(options?: SpinnerOptions, interactiveManager?: InteractiveManager);
|
|
90
|
+
/**
|
|
91
|
+
* Current elapsed time in milliseconds.
|
|
92
|
+
*/
|
|
129
93
|
get elapsedTime(): number;
|
|
94
|
+
/**
|
|
95
|
+
* Get or set the spinner text.
|
|
96
|
+
*/
|
|
130
97
|
get getText(): string;
|
|
131
98
|
set text(value: string);
|
|
99
|
+
/**
|
|
100
|
+
* Get or set the prefix text.
|
|
101
|
+
*/
|
|
132
102
|
get getPrefixText(): string;
|
|
133
103
|
set prefixText(value: string);
|
|
104
|
+
/**
|
|
105
|
+
* Whether the spinner is currently active.
|
|
106
|
+
*/
|
|
134
107
|
get isRunning(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Set the interactive manager for interactive mode.
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
setInteractiveManager(manager?: InteractiveManager): void;
|
|
113
|
+
/**
|
|
114
|
+
* Set the multi spinner reference.
|
|
115
|
+
* @internal
|
|
116
|
+
*/
|
|
117
|
+
setMultiSpinner(multiSpinner?: MultiSpinner): void;
|
|
118
|
+
/**
|
|
119
|
+
* Start the spinner with optional text.
|
|
120
|
+
* @param text Optional text to display
|
|
121
|
+
* @param options
|
|
122
|
+
* @param options.prefixText Optional prefix text to display
|
|
123
|
+
* @returns The spinner instance for chaining
|
|
124
|
+
*/
|
|
135
125
|
start(text?: string, options?: SpinnerStartOptions): this;
|
|
126
|
+
/**
|
|
127
|
+
* Stop the spinner with a success message.
|
|
128
|
+
* @param text Optional success text
|
|
129
|
+
*/
|
|
136
130
|
succeed(text?: string): void;
|
|
131
|
+
/**
|
|
132
|
+
* Stop the spinner with a failure message.
|
|
133
|
+
* @param text Optional failure text
|
|
134
|
+
*/
|
|
137
135
|
failed(text?: string): void;
|
|
136
|
+
/**
|
|
137
|
+
* Stop the spinner with a warning message.
|
|
138
|
+
* @param text Optional warning text
|
|
139
|
+
*/
|
|
138
140
|
warn(text?: string): void;
|
|
141
|
+
/**
|
|
142
|
+
* Stop the spinner with an info message.
|
|
143
|
+
* @param text Optional info text
|
|
144
|
+
*/
|
|
139
145
|
info(text?: string): void;
|
|
146
|
+
/**
|
|
147
|
+
* Pause the spinner without stopping it.
|
|
148
|
+
*/
|
|
140
149
|
pause(): void;
|
|
150
|
+
/**
|
|
151
|
+
* Resume the spinner if it was paused.
|
|
152
|
+
*/
|
|
141
153
|
resume(): void;
|
|
154
|
+
/**
|
|
155
|
+
* Get current frame output.
|
|
156
|
+
* @internal
|
|
157
|
+
*/
|
|
158
|
+
getFrameOutput(): string;
|
|
142
159
|
}
|
|
143
|
-
|
|
160
|
+
/**
|
|
161
|
+
* Multi-Spinner class for managing multiple spinners concurrently.
|
|
162
|
+
*
|
|
163
|
+
* Allows displaying and updating multiple spinners simultaneously with
|
|
164
|
+
* consistent formatting and management.
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* const multiSpinner = new MultiSpinner({ name: "dots" });
|
|
168
|
+
*
|
|
169
|
+
* const spinner1 = multiSpinner.create("Task 1");
|
|
170
|
+
* const spinner2 = multiSpinner.create("Task 2");
|
|
171
|
+
*
|
|
172
|
+
* spinner1.start();
|
|
173
|
+
* spinner2.start();
|
|
174
|
+
*
|
|
175
|
+
* // ... do work ...
|
|
176
|
+
*
|
|
177
|
+
* spinner1.succeed();
|
|
178
|
+
* spinner2.succeed();
|
|
179
|
+
* multiSpinner.stop();
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
export declare class MultiSpinner {
|
|
144
183
|
#private;
|
|
145
184
|
constructor(options?: SpinnerOptions, interactiveManager?: InteractiveManager);
|
|
185
|
+
/**
|
|
186
|
+
* Set the interactive manager for interactive mode.
|
|
187
|
+
* @internal
|
|
188
|
+
*/
|
|
189
|
+
setInteractiveManager(manager?: InteractiveManager): void;
|
|
190
|
+
/**
|
|
191
|
+
* Create a new spinner instance.
|
|
192
|
+
* @param text Initial text for the spinner
|
|
193
|
+
* @param options
|
|
194
|
+
* @param options.prefixText Optional prefix text to display
|
|
195
|
+
* @param options.style Optional style for the spinner
|
|
196
|
+
* @param options.verbose Whether to output spinner (default: true)
|
|
197
|
+
* @returns A new Spinner instance
|
|
198
|
+
*/
|
|
146
199
|
create(text?: string, options?: SpinnerOptions): Spinner;
|
|
200
|
+
/**
|
|
201
|
+
* Remove a spinner from the multi-spinner manager.
|
|
202
|
+
* @param spinner The spinner to remove
|
|
203
|
+
* @returns True if the spinner was removed, false otherwise
|
|
204
|
+
*/
|
|
147
205
|
remove(spinner: Spinner): boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Stop all spinners.
|
|
208
|
+
*/
|
|
148
209
|
stop(): void;
|
|
210
|
+
/**
|
|
211
|
+
* Clear all spinners without stopping them.
|
|
212
|
+
*/
|
|
149
213
|
clear(): void;
|
|
214
|
+
/**
|
|
215
|
+
* Render all spinners.
|
|
216
|
+
* @internal
|
|
217
|
+
*/
|
|
218
|
+
renderAll(): void;
|
|
150
219
|
}
|
|
151
|
-
type SpinnerType<T extends string = string, L extends string = string> = Record<T, L> & Spinner;
|
|
152
|
-
|
|
153
|
-
export { MultiSpinner, Spinner };
|
|
154
|
-
export type { SpinnerIcons, SpinnerOptions, SpinnerStartOptions, SpinnerStyle, SpinnerType };
|
|
220
|
+
export type SpinnerType<T extends string = string, L extends string = string> = Record<T, L> & Spinner;
|