@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.
Files changed (106) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/LICENSE.md +143 -931
  3. package/dist/error.d.ts +95 -96
  4. package/dist/index.browser.d.ts +557 -47
  5. package/dist/index.browser.js +2 -2
  6. package/dist/index.server.d.ts +722 -65
  7. package/dist/index.server.js +27 -410
  8. package/dist/middleware/elysia.d.ts +65 -63
  9. package/dist/middleware/elysia.js +2 -2
  10. package/dist/middleware/express.d.ts +73 -71
  11. package/dist/middleware/express.js +1 -1
  12. package/dist/middleware/fastify.d.ts +69 -67
  13. package/dist/middleware/fastify.js +2 -2
  14. package/dist/middleware/hono.d.ts +74 -72
  15. package/dist/middleware/next/handler.d.ts +101 -34
  16. package/dist/middleware/sveltekit.d.ts +100 -98
  17. package/dist/object-tree.d.ts +67 -70
  18. package/dist/packem_shared/{AbstractJsonReporter-DlugSJpY.js → AbstractJsonReporter-BO8Calb4.js} +1 -5
  19. package/dist/packem_shared/{AbstractJsonReporter-CjtVgHbU.js → AbstractJsonReporter-nOj0Ft1F.js} +1 -5
  20. package/dist/packem_shared/{JsonReporter-Dbw82ewj.js → JsonReporter-CCmj7oYL.js} +1 -1
  21. package/dist/packem_shared/{JsonReporter-BgPvIyC2.js → JsonReporter-Ck2PIAEw.js} +2 -2
  22. package/dist/packem_shared/{PrettyReporter-C2dCzIaf.js → PrettyReporter-CIbrmjUV.js} +2 -4
  23. package/dist/packem_shared/{PrettyReporter-gMqa7j_m.js → PrettyReporter-CNJEO9g7.js} +1250 -15
  24. package/dist/packem_shared/abstract-json-reporter.d-BAgznjyU.d.ts +61 -0
  25. package/dist/packem_shared/{abstract-pretty-reporter-szQO-IgK.js → abstract-pretty-reporter-CkqCt5hg.js} +2300 -2298
  26. package/dist/packem_shared/create-middleware-logger.d-DheMh8q4.d.ts +47 -0
  27. package/dist/packem_shared/{index-Bx3-C0j9.js → index-6cG1Kp0t.js} +2 -2
  28. package/dist/packem_shared/types.d-BeLumqgD.d.ts +246 -0
  29. package/dist/packem_shared/types.d-C51XNfQz.d.ts +194 -0
  30. package/dist/packem_shared/types.d-CM5ie2qm.d.ts +236 -0
  31. package/dist/packem_shared/wide-event.d-B-t8ZnhI.d.ts +704 -0
  32. package/dist/packem_shared/{write-stream-BuFtjATz.js → write-stream-MDqyXmc_.js} +1 -1
  33. package/dist/processor/caller/caller-processor.d.ts +49 -47
  34. package/dist/processor/caller/caller-processor.js +1 -1
  35. package/dist/processor/environment-processor.d.ts +113 -113
  36. package/dist/processor/message-formatter-processor.d.ts +51 -49
  37. package/dist/processor/message-formatter-processor.js +2 -2
  38. package/dist/processor/opentelemetry-processor.d.ts +69 -66
  39. package/dist/processor/redact-processor.d.ts +60 -41
  40. package/dist/processor/sampling-processor.d.ts +102 -101
  41. package/dist/reporter/file/json-file-reporter.d.ts +91 -42
  42. package/dist/reporter/file/json-file-reporter.js +1 -1
  43. package/dist/reporter/http/abstract-http-reporter.d.ts +213 -211
  44. package/dist/reporter/http/abstract-http-reporter.js +1 -1
  45. package/dist/reporter/http/http-reporter.d.ts +40 -36
  46. package/dist/reporter/http/http-reporter.edge-light.d.ts +430 -38
  47. package/dist/reporter/http/http-reporter.edge-light.js +1 -5
  48. package/dist/reporter/json/index.browser.d.ts +99 -3
  49. package/dist/reporter/json/index.browser.js +2 -2
  50. package/dist/reporter/json/index.d.ts +51 -3
  51. package/dist/reporter/json/index.js +2 -2
  52. package/dist/reporter/pretty/index.browser.d.ts +106 -2
  53. package/dist/reporter/pretty/index.browser.js +1 -1
  54. package/dist/reporter/pretty/index.d.ts +219 -2
  55. package/dist/reporter/pretty/index.js +1 -1
  56. package/dist/reporter/simple/simple-reporter.server.d.ts +168 -18
  57. package/dist/reporter/simple/simple-reporter.server.js +3 -2
  58. package/dist/wide-event.d.ts +5 -300
  59. package/dist/wide-event.js +3 -2
  60. package/package.json +9 -21
  61. package/dist/constants.d.ts +0 -37
  62. package/dist/interactive/index.d.ts +0 -2
  63. package/dist/interactive/index.js +0 -2
  64. package/dist/interactive/interactive-manager.d.ts +0 -108
  65. package/dist/interactive/interactive-stream-hook.d.ts +0 -68
  66. package/dist/middleware/next/middleware.d.ts +0 -59
  67. package/dist/middleware/next/storage.d.ts +0 -14
  68. package/dist/middleware/shared/create-middleware-logger.d.ts +0 -82
  69. package/dist/middleware/shared/headers.d.ts +0 -14
  70. package/dist/middleware/shared/routes.d.ts +0 -30
  71. package/dist/middleware/shared/storage.d.ts +0 -29
  72. package/dist/packem_shared/InteractiveManager-CowYA3Hx.js +0 -178
  73. package/dist/packem_shared/InteractiveStreamHook-BypRlYTX.js +0 -133
  74. package/dist/packem_shared/Spinner-Cokext9b.js +0 -2183
  75. package/dist/packem_shared/getBarChar-D7JfmdTr.js +0 -459
  76. package/dist/packem_shared/index-BEfVUy9P.js +0 -1256
  77. package/dist/pail.browser.d.ts +0 -412
  78. package/dist/pail.server.d.ts +0 -233
  79. package/dist/processor/caller/get-caller-filename.d.ts +0 -23
  80. package/dist/progress-bar.d.ts +0 -145
  81. package/dist/progress-bar.js +0 -459
  82. package/dist/reporter/file/utils/rotating-file-stream.d.ts +0 -48
  83. package/dist/reporter/http/utils/compression.d.ts +0 -7
  84. package/dist/reporter/http/utils/log-size-error.d.ts +0 -30
  85. package/dist/reporter/http/utils/retry.d.ts +0 -27
  86. package/dist/reporter/json/abstract-json-reporter.d.ts +0 -61
  87. package/dist/reporter/json/json-reporter.browser.d.ts +0 -40
  88. package/dist/reporter/json/json-reporter.server.d.ts +0 -50
  89. package/dist/reporter/pretty/abstract-pretty-reporter.d.ts +0 -83
  90. package/dist/reporter/pretty/pretty-reporter.browser.d.ts +0 -36
  91. package/dist/reporter/pretty/pretty-reporter.server.d.ts +0 -70
  92. package/dist/reporter/raw/raw-reporter.browser.d.ts +0 -5
  93. package/dist/reporter/raw/raw-reporter.server.d.ts +0 -13
  94. package/dist/reporter/utils/default-inspector-config.d.ts +0 -3
  95. package/dist/reporter/utils/format-label.d.ts +0 -3
  96. package/dist/spinner.d.ts +0 -220
  97. package/dist/spinner.js +0 -2183
  98. package/dist/types.d.ts +0 -241
  99. package/dist/utils/ansi-escapes.d.ts +0 -4
  100. package/dist/utils/arrayify.d.ts +0 -2
  101. package/dist/utils/get-longest-badge.d.ts +0 -4
  102. package/dist/utils/get-longest-label.d.ts +0 -4
  103. package/dist/utils/merge-types.d.ts +0 -4
  104. package/dist/utils/stream/safe-stream-handler.d.ts +0 -21
  105. package/dist/utils/write-console-log-based-on-level.d.ts +0 -4
  106. package/dist/utils/write-stream.d.ts +0 -2
@@ -1,27 +0,0 @@
1
- /**
2
- * Sends an HTTP request with retry logic and rate limiting support.
3
- * @param url The URL to send the request to
4
- * @param method The HTTP method to use
5
- * @param headers Request headers
6
- * @param body The request body (string or Uint8Array)
7
- * @param maxRetries Maximum number of retry attempts
8
- * @param retryDelay Base delay between retries in milliseconds
9
- * @param respectRateLimit Whether to respect rate limiting (429 responses)
10
- * @param onDebugRequestResponse Optional callback for debugging requests/responses
11
- * @param onError Optional callback for error handling
12
- */
13
- declare const sendWithRetry: (url: string, method: string, headers: Record<string, string>, body: string | Uint8Array, maxRetries: number, retryDelay: number, respectRateLimit: boolean, onDebugRequestResponse?: (requestResponse: {
14
- req: {
15
- body: string | Uint8Array;
16
- headers: Record<string, string>;
17
- method: string;
18
- url: string;
19
- };
20
- res: {
21
- body: string;
22
- headers: Record<string, string>;
23
- status: number;
24
- statusText: string;
25
- };
26
- }) => void, onError?: (error: Error) => void) => Promise<void>;
27
- export default sendWithRetry;
@@ -1,61 +0,0 @@
1
- import type { stringify } from "safe-stable-stringify";
2
- import type { LiteralUnion } from "type-fest";
3
- import type { ExtendedRfc5424LogLevels, ReadonlyMeta, StringifyAwareReporter } from "../../types.d.ts";
4
- /**
5
- * Options for configuring JSON reporters.
6
- */
7
- export type AbstractJsonReporterOptions = {
8
- /** Error serialization options */
9
- error: Partial<{
10
- /** Properties to exclude from error serialization */
11
- exclude?: string[];
12
- /** Maximum depth for error object serialization */
13
- maxDepth?: number;
14
- /** Whether to use toJSON methods during serialization */
15
- useToJSON?: boolean;
16
- }>;
17
- };
18
- /**
19
- * Abstract JSON Reporter.
20
- *
21
- * Base class for JSON-based reporters that provides common functionality
22
- * for serializing log metadata to JSON format. Handles error serialization,
23
- * context processing, and provides a template method for actual output.
24
- * @template L - The log level type
25
- * @example
26
- * ```typescript
27
- * class CustomJsonReporter extends AbstractJsonReporter {
28
- * protected _log(message: string): void {
29
- * console.log(message);
30
- * }
31
- * }
32
- * ```
33
- */
34
- export declare abstract class AbstractJsonReporter<L extends string = string> implements StringifyAwareReporter<L> {
35
- /** Custom stringify function for object serialization */
36
- protected stringify: typeof stringify | undefined;
37
- /** Error serialization options */
38
- protected errorOptions: AbstractJsonReporterOptions["error"];
39
- /**
40
- * Creates a new AbstractJsonReporter instance.
41
- * @param options Configuration options for JSON formatting and error handling
42
- */
43
- constructor(options?: Partial<AbstractJsonReporterOptions>);
44
- /**
45
- * Sets a custom stringify function for object serialization.
46
- * @param function_ The stringify function to use for serialization
47
- */
48
- setStringify(function_: typeof stringify): void;
49
- log(meta: ReadonlyMeta<L>): void;
50
- /**
51
- * Template method for outputting the JSON log message.
52
- *
53
- * Subclasses must implement this method to define how the JSON message
54
- * is actually written (to console, file, network, etc.).
55
- * @param message The JSON-formatted log message
56
- * @param logLevel The log level of the message
57
- * @protected
58
- * @abstract
59
- */
60
- protected abstract _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
61
- }
@@ -1,40 +0,0 @@
1
- import type { LiteralUnion } from "type-fest";
2
- import type { ExtendedRfc5424LogLevels } 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
- * Browser JSON Reporter.
7
- *
8
- * A JSON reporter for browser environments that outputs structured log data
9
- * to the browser console. Uses appropriate console methods based on log level.
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("Application started", { version: "1.0.0" });
20
- * // Outputs: {"level":"info","message":"Application started","context":[{"version":"1.0.0"}],...}
21
- * ```
22
- */
23
- declare class JsonReporter<L extends string = string> extends AbstractJsonReporter<L> {
24
- /**
25
- * Creates a new Browser JSON Reporter instance.
26
- * @param options Configuration options for JSON formatting
27
- */
28
- constructor(options?: Partial<AbstractJsonReporterOptions>);
29
- /**
30
- * Outputs the JSON message to the browser console.
31
- *
32
- * Uses the appropriate console method based on the log level
33
- * (console.log, console.error, console.warn, etc.).
34
- * @param message The JSON-formatted log message
35
- * @param logLevel The log level determining which console method to use
36
- * @protected
37
- */
38
- protected _log(message: string, logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>): void;
39
- }
40
- export default JsonReporter;
@@ -1,50 +0,0 @@
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;
@@ -1,83 +0,0 @@
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,36 +0,0 @@
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;
@@ -1,70 +0,0 @@
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
- }
@@ -1,5 +0,0 @@
1
- import type { ReadonlyMeta, Reporter } from "../../types.d.ts";
2
- declare class RawReporter<L extends string = string> implements Reporter<L> {
3
- log(meta: ReadonlyMeta<L>): void;
4
- }
5
- export default RawReporter;
@@ -1,13 +0,0 @@
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,3 +0,0 @@
1
- import type { Options } from "@visulima/inspector";
2
- declare const defaultInspectorConfig: Partial<Options>;
3
- export default defaultInspectorConfig;
@@ -1,3 +0,0 @@
1
- import type { PrettyStyleOptions } from "../pretty/abstract-pretty-reporter.d.ts";
2
- declare const formatLabel: (label: string, styles: PrettyStyleOptions) => string;
3
- export default formatLabel;
package/dist/spinner.d.ts DELETED
@@ -1,220 +0,0 @@
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") */
8
- bgColor?: string;
9
- /** Background color as hex (e.g., "#FF0000") */
10
- bgHex?: `#${string}`;
11
- /** Background color as RGB (e.g., [255, 0, 0]) */
12
- bgRgb?: [number, number, number];
13
- /** Apply bold style */
14
- bold?: boolean;
15
- /** Foreground color name (e.g., "red", "blue", "green") */
16
- color?: string;
17
- /** Apply dim/faint style */
18
- dim?: boolean;
19
- /** Foreground color as hex (e.g., "#FF0000") */
20
- hex?: `#${string}`;
21
- /** Apply inverse style (swap fg/bg) */
22
- inverse?: boolean;
23
- /** Apply italic style */
24
- italic?: boolean;
25
- /** Apply overline style */
26
- overline?: boolean;
27
- /** Foreground color as RGB (e.g., [255, 0, 0]) */
28
- rgb?: [number, number, number];
29
- /** Apply strikethrough style */
30
- strikethrough?: boolean;
31
- /** Apply underline style */
32
- underline?: boolean;
33
- }
34
- /**
35
- * Spinner completion icons.
36
- */
37
- export interface SpinnerIcons {
38
- /** Icon to show on failure (default: "✖") */
39
- error?: string;
40
- /** Icon to show on info (default: "ℹ") */
41
- info?: string;
42
- /** Icon to show on success (default: "✓") */
43
- success?: string;
44
- /** Icon to show on warning (default: "⚠") */
45
- warning?: string;
46
- }
47
- /**
48
- * Spinner style options.
49
- */
50
- export interface SpinnerOptions {
51
- /** Custom icons for completion states */
52
- icons?: SpinnerIcons;
53
- /** Name of the spinner from cli-spinners */
54
- name?: SpinnerName;
55
- /** Prefix text to show before the spinner */
56
- prefixText?: string;
57
- /** Style configuration for the spinner */
58
- style?: SpinnerStyle;
59
- /** Whether to output spinner (default: true) */
60
- verbose?: boolean;
61
- }
62
- /**
63
- * Options for starting a spinner.
64
- */
65
- export interface SpinnerStartOptions {
66
- /** Prefix text to show before the spinner */
67
- prefixText?: string;
68
- }
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 {
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
- */
89
- constructor(options?: SpinnerOptions, interactiveManager?: InteractiveManager);
90
- /**
91
- * Current elapsed time in milliseconds.
92
- */
93
- get elapsedTime(): number;
94
- /**
95
- * Get or set the spinner text.
96
- */
97
- get getText(): string;
98
- set text(value: string);
99
- /**
100
- * Get or set the prefix text.
101
- */
102
- get getPrefixText(): string;
103
- set prefixText(value: string);
104
- /**
105
- * Whether the spinner is currently active.
106
- */
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
- */
125
- start(text?: string, options?: SpinnerStartOptions): this;
126
- /**
127
- * Stop the spinner with a success message.
128
- * @param text Optional success text
129
- */
130
- succeed(text?: string): void;
131
- /**
132
- * Stop the spinner with a failure message.
133
- * @param text Optional failure text
134
- */
135
- failed(text?: string): void;
136
- /**
137
- * Stop the spinner with a warning message.
138
- * @param text Optional warning text
139
- */
140
- warn(text?: string): void;
141
- /**
142
- * Stop the spinner with an info message.
143
- * @param text Optional info text
144
- */
145
- info(text?: string): void;
146
- /**
147
- * Pause the spinner without stopping it.
148
- */
149
- pause(): void;
150
- /**
151
- * Resume the spinner if it was paused.
152
- */
153
- resume(): void;
154
- /**
155
- * Get current frame output.
156
- * @internal
157
- */
158
- getFrameOutput(): string;
159
- }
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 {
183
- #private;
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
- */
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
- */
205
- remove(spinner: Spinner): boolean;
206
- /**
207
- * Stop all spinners.
208
- */
209
- stop(): void;
210
- /**
211
- * Clear all spinners without stopping them.
212
- */
213
- clear(): void;
214
- /**
215
- * Render all spinners.
216
- * @internal
217
- */
218
- renderAll(): void;
219
- }
220
- export type SpinnerType<T extends string = string, L extends string = string> = Record<T, L> & Spinner;