@visulima/pail 4.0.0-alpha.8 → 4.0.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/CHANGELOG.md +531 -0
- package/LICENSE.md +270 -166
- package/README.md +53 -24
- package/dist/error.d.ts +95 -96
- package/dist/error.js +5 -76
- package/dist/index.browser.d.ts +568 -47
- package/dist/index.browser.js +19 -1499
- package/dist/index.server.d.ts +749 -65
- package/dist/index.server.js +32 -3179
- package/dist/middleware/elysia.d.ts +66 -63
- package/dist/middleware/elysia.js +1 -70
- package/dist/middleware/express.d.ts +74 -71
- package/dist/middleware/express.js +1 -29
- package/dist/middleware/fastify.d.ts +70 -67
- package/dist/middleware/fastify.js +1 -46
- package/dist/middleware/hono.d.ts +75 -72
- package/dist/middleware/hono.js +1 -33
- package/dist/middleware/next/handler.d.ts +102 -34
- package/dist/middleware/next/handler.js +1 -53
- package/dist/middleware/sveltekit.d.ts +101 -98
- package/dist/middleware/sveltekit.js +1 -43
- package/dist/object-tree.d.ts +67 -70
- package/dist/object-tree.js +2 -89
- package/dist/packem_shared/AbstractJsonReporter-Bp_JCrMQ.js +1 -0
- package/dist/packem_shared/AbstractJsonReporter-w_bGGiD-.js +1 -0
- package/dist/packem_shared/JsonReporter-Sd_lJGS-.js +2 -0
- package/dist/packem_shared/JsonReporter-bmem9lcg.js +1 -0
- package/dist/packem_shared/PailError-CbU1Ogfa.js +5 -0
- package/dist/packem_shared/PrettyReporter-CcDdPQSt.js +44 -0
- package/dist/packem_shared/PrettyReporter-DsHfKOU7.js +5 -0
- package/dist/packem_shared/abstract-json-reporter.d-wfESoEa-.d.ts +62 -0
- package/dist/packem_shared/abstract-pretty-reporter-DrLBJ6ds.js +57 -0
- package/dist/packem_shared/addKnownErrorConstructor-C1OJTj2D-0FlJMfXz.js +25 -0
- package/dist/packem_shared/constants-DKfCaSUR.js +1 -0
- package/dist/packem_shared/constants-ep2nsfdy.js +1 -0
- package/dist/packem_shared/create-middleware-logger.d-B-JmQ1Sl.d.ts +47 -0
- package/dist/packem_shared/headers-DH0H2s8W.js +1 -0
- package/dist/packem_shared/index-Q1764hvO.js +1 -0
- package/dist/packem_shared/index.d-T71KjNAr.d.ts +16 -0
- package/dist/packem_shared/pailMiddleware-B5DJoBYl.js +1 -0
- package/dist/packem_shared/serializeError-C-NFvZ8_-D0CA_Qlx.js +1 -0
- package/dist/packem_shared/storage-DaXAlpiO.js +1 -0
- package/dist/packem_shared/types.d-Cz9S7jZh.d.ts +201 -0
- package/dist/packem_shared/types.d-bWnqHJKL.d.ts +211 -0
- package/dist/packem_shared/types.d-xxE3FOD3.d.ts +229 -0
- package/dist/packem_shared/useLogger-DB34CuU5.js +1 -0
- package/dist/packem_shared/wide-event.d-D3ATYpoK.d.ts +717 -0
- package/dist/packem_shared/write-console-log-based-on-level-BqjxV016.js +1 -0
- package/dist/packem_shared/write-stream-C7jxLxIT.js +1 -0
- package/dist/processor/caller/caller-processor.d.ts +50 -47
- package/dist/processor/caller/caller-processor.js +1 -59
- package/dist/processor/environment-processor.d.ts +114 -113
- package/dist/processor/environment-processor.js +1 -78
- package/dist/processor/message-formatter-processor.d.ts +59 -49
- package/dist/processor/message-formatter-processor.js +1 -713
- package/dist/processor/opentelemetry-processor.d.ts +70 -66
- package/dist/processor/opentelemetry-processor.js +1 -52
- package/dist/processor/redact-processor.d.ts +99 -41
- package/dist/processor/redact-processor.js +1 -30
- package/dist/processor/sampling-processor.d.ts +103 -101
- package/dist/processor/sampling-processor.js +1 -59
- package/dist/reporter/file/json-file-reporter.d.ts +109 -42
- package/dist/reporter/file/json-file-reporter.js +2 -136
- package/dist/reporter/http/abstract-http-reporter.d.ts +256 -211
- package/dist/reporter/http/abstract-http-reporter.js +2 -435
- package/dist/reporter/http/http-reporter.d.ts +41 -36
- package/dist/reporter/http/http-reporter.edge-light.d.ts +487 -39
- package/dist/reporter/http/http-reporter.edge-light.js +2 -733
- package/dist/reporter/http/http-reporter.js +1 -13
- package/dist/reporter/json/index.browser.d.ts +98 -3
- package/dist/reporter/json/index.browser.js +1 -2
- package/dist/reporter/json/index.d.ts +53 -3
- package/dist/reporter/json/index.js +1 -2
- package/dist/reporter/pretty/index.browser.d.ts +105 -2
- package/dist/reporter/pretty/index.browser.js +1 -1
- package/dist/reporter/pretty/index.d.ts +270 -2
- package/dist/reporter/pretty/index.js +1 -1
- package/dist/reporter/simple/simple-reporter.server.d.ts +215 -18
- package/dist/reporter/simple/simple-reporter.server.js +8 -182
- package/dist/wide-event.d.ts +6 -300
- package/dist/wide-event.js +1 -281
- package/package.json +23 -38
- 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/AbstractJsonReporter-CGKHS8_M.js +0 -286
- package/dist/packem_shared/AbstractJsonReporter-DDjDkciI.js +0 -286
- package/dist/packem_shared/InteractiveManager-Cd6A14ZK.js +0 -172
- package/dist/packem_shared/InteractiveStreamHook-ePIURL_U.js +0 -133
- package/dist/packem_shared/JsonReporter-B3XX8GHN.js +0 -58
- package/dist/packem_shared/JsonReporter-p_BXg6Sj.js +0 -28
- package/dist/packem_shared/PrettyReporter-BYL3NrdA.js +0 -214
- package/dist/packem_shared/PrettyReporter-CvBn-hxP.js +0 -1459
- package/dist/packem_shared/Spinner-DIdVcfWq.js +0 -2183
- package/dist/packem_shared/abstract-pretty-reporter-jU8WL_6c.js +0 -2602
- package/dist/packem_shared/constants-B1RjD_ps.js +0 -99
- package/dist/packem_shared/constants-omsTHUWB.js +0 -119
- package/dist/packem_shared/createPailError-B11aRfrT.js +0 -76
- package/dist/packem_shared/getBarChar-BWj1UrH3.js +0 -404
- package/dist/packem_shared/headers-Cp4uLtr4.js +0 -123
- package/dist/packem_shared/index-DnkF86LQ.js +0 -658
- package/dist/packem_shared/index-frijFf5m.js +0 -1252
- package/dist/packem_shared/pailMiddleware-Ci88geIF.js +0 -24
- package/dist/packem_shared/storage-D0vqz8OX.js +0 -36
- package/dist/packem_shared/useLogger-D0rU3lcX.js +0 -33
- package/dist/packem_shared/write-console-log-based-on-level-DBmRYXpj.js +0 -14
- package/dist/packem_shared/write-stream-BG8fhcs3.js +0 -6
- 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 -136
- package/dist/progress-bar.js +0 -404
- 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
package/dist/pail.server.d.ts
DELETED
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import InteractiveManager from "./interactive/interactive-manager.d.ts";
|
|
2
|
-
import { PailBrowserImpl } from "./pail.d.ts";
|
|
3
|
-
import type { MultiBarOptions, SingleBarOptions } from "./progress-bar.d.ts";
|
|
4
|
-
import { MultiProgressBar, ProgressBar } from "./progress-bar.d.ts";
|
|
5
|
-
import type { SpinnerOptions } from "./spinner.d.ts";
|
|
6
|
-
import { MultiSpinner, Spinner } from "./spinner.d.ts";
|
|
7
|
-
import type { ConstructorOptions, DefaultLogTypes, LoggerFunction, Reporter, ServerConstructorOptions } from "./types.d.ts";
|
|
8
|
-
declare class PailServerImpl<T extends string = string, L extends string = string> extends PailBrowserImpl<T, L> {
|
|
9
|
-
#private;
|
|
10
|
-
readonly options: ServerConstructorOptions<T, L>;
|
|
11
|
-
protected readonly stdout: NodeJS.WriteStream;
|
|
12
|
-
protected readonly stderr: NodeJS.WriteStream;
|
|
13
|
-
protected interactiveManager: InteractiveManager | undefined;
|
|
14
|
-
protected readonly interactive: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Creates a new Pail server logger instance.
|
|
17
|
-
*
|
|
18
|
-
* Initializes the server-compatible logger with streams, interactive support,
|
|
19
|
-
* and server-specific configuration options.
|
|
20
|
-
* @param options Server-specific configuration options
|
|
21
|
-
*/
|
|
22
|
-
constructor(options: ServerConstructorOptions<T, L>);
|
|
23
|
-
scope<N extends string = T>(...name: string[]): PailServerType<N, L>;
|
|
24
|
-
/**
|
|
25
|
-
* Creates a child logger that inherits settings from the parent.
|
|
26
|
-
*
|
|
27
|
-
* Returns a new logger instance that inherits all configuration from the parent
|
|
28
|
-
* (reporters, processors, types, log levels, throttle settings, etc.) while allowing
|
|
29
|
-
* you to override only what you need. Child loggers are independent instances with
|
|
30
|
-
* their own state (timers, counters, etc.).
|
|
31
|
-
* @template N - The new custom logger type names
|
|
32
|
-
* @template LC - The new log level types
|
|
33
|
-
* @param options Configuration options to override or extend parent settings
|
|
34
|
-
* @returns A new child logger instance
|
|
35
|
-
* @example
|
|
36
|
-
* ```typescript
|
|
37
|
-
* const parent = createPail({
|
|
38
|
-
* logLevel: "info",
|
|
39
|
-
* types: { http: { label: "HTTP", logLevel: "info" } },
|
|
40
|
-
* reporters: [new PrettyReporter()],
|
|
41
|
-
* });
|
|
42
|
-
*
|
|
43
|
-
* // Child inherits parent settings but overrides log level
|
|
44
|
-
* const child = parent.child({ logLevel: "debug" });
|
|
45
|
-
* child.info("This will be logged"); // Uses debug level from child
|
|
46
|
-
* child.http("GET /api 200"); // Inherits http type from parent
|
|
47
|
-
*
|
|
48
|
-
* // Child can add new types
|
|
49
|
-
* const childWithNewType = parent.child({
|
|
50
|
-
* types: { db: { label: "DB", logLevel: "info" } },
|
|
51
|
-
* });
|
|
52
|
-
* childWithNewType.db("Query executed"); // New type available
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
child<N extends string = T, LC extends string = L>(options?: Partial<ConstructorOptions<N, LC>> & Partial<Pick<ServerConstructorOptions<N, LC>, "interactive" | "stderr" | "stdout">>): PailServerType<N, LC>;
|
|
56
|
-
/**
|
|
57
|
-
* Gets the interactive manager instance if interactive mode is enabled.
|
|
58
|
-
*
|
|
59
|
-
* Returns the InteractiveManager instance that handles interactive terminal
|
|
60
|
-
* features like progress bars and dynamic updates. Only available when
|
|
61
|
-
* interactive mode is enabled in the constructor options.
|
|
62
|
-
* @returns The interactive manager instance, or undefined if not in interactive mode
|
|
63
|
-
* @example
|
|
64
|
-
* ```typescript
|
|
65
|
-
* const logger = createPail({ interactive: true });
|
|
66
|
-
* const manager = logger.getInteractiveManager();
|
|
67
|
-
* if (manager) {
|
|
68
|
-
* manager.hook();
|
|
69
|
-
* // Use interactive features
|
|
70
|
-
* manager.unhook();
|
|
71
|
-
* }
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
getInteractiveManager(): InteractiveManager | undefined;
|
|
75
|
-
/**
|
|
76
|
-
* Wraps stdout and stderr streams to redirect them through the logger.
|
|
77
|
-
*
|
|
78
|
-
* Intercepts writes to process.stdout and process.stderr, redirecting them
|
|
79
|
-
* through the logger instead of writing directly to the streams. This allows
|
|
80
|
-
* all output to be processed by the logging pipeline.
|
|
81
|
-
* @example
|
|
82
|
-
* ```typescript
|
|
83
|
-
* const logger = createPail();
|
|
84
|
-
* logger.wrapStd();
|
|
85
|
-
*
|
|
86
|
-
* console.log("This goes through logger");
|
|
87
|
-
* process.stdout.write("This too");
|
|
88
|
-
*
|
|
89
|
-
* logger.restoreStd(); // Restore original streams
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
wrapStd(): void;
|
|
93
|
-
/**
|
|
94
|
-
* Restores the original stdout and stderr streams.
|
|
95
|
-
*
|
|
96
|
-
* Removes the stream wrapping that was applied by wrapStd(),
|
|
97
|
-
* restoring the original stream write methods.
|
|
98
|
-
* @example
|
|
99
|
-
* ```typescript
|
|
100
|
-
* const logger = createPail();
|
|
101
|
-
* logger.wrapStd();
|
|
102
|
-
* // Streams are wrapped
|
|
103
|
-
* logger.restoreStd();
|
|
104
|
-
* // Streams are restored to original behavior
|
|
105
|
-
* ```
|
|
106
|
-
*/
|
|
107
|
-
restoreStd(): void;
|
|
108
|
-
/**
|
|
109
|
-
* Wraps all output sources (console and streams).
|
|
110
|
-
*
|
|
111
|
-
* Convenience method that calls both wrapConsole() and wrapStd()
|
|
112
|
-
* to redirect all output through the logger.
|
|
113
|
-
* @example
|
|
114
|
-
* ```typescript
|
|
115
|
-
* const logger = createPail();
|
|
116
|
-
* logger.wrapAll(); // Wraps console and streams
|
|
117
|
-
*
|
|
118
|
-
* // All output now goes through logger
|
|
119
|
-
* console.log("Console output");
|
|
120
|
-
* process.stdout.write("Stream output");
|
|
121
|
-
*
|
|
122
|
-
* logger.restoreAll(); // Restore everything
|
|
123
|
-
* ```
|
|
124
|
-
*/
|
|
125
|
-
wrapAll(): void;
|
|
126
|
-
/**
|
|
127
|
-
* Restores all wrapped output sources.
|
|
128
|
-
*
|
|
129
|
-
* Convenience method that calls both restoreConsole() and restoreStd()
|
|
130
|
-
* to restore all original output behavior.
|
|
131
|
-
* @example
|
|
132
|
-
* ```typescript
|
|
133
|
-
* const logger = createPail();
|
|
134
|
-
* logger.wrapAll();
|
|
135
|
-
* // All output is wrapped
|
|
136
|
-
* logger.restoreAll();
|
|
137
|
-
* // All output sources are restored
|
|
138
|
-
* ```
|
|
139
|
-
*/
|
|
140
|
-
restoreAll(): void;
|
|
141
|
-
/**
|
|
142
|
-
* Creates a single progress bar.
|
|
143
|
-
* @param options Configuration options for the progress bar
|
|
144
|
-
* @returns A new ProgressBar instance
|
|
145
|
-
* @example
|
|
146
|
-
* ```typescript
|
|
147
|
-
* const logger = createPail({ interactive: true });
|
|
148
|
-
* const bar = logger.createProgressBar({
|
|
149
|
-
* total: 100,
|
|
150
|
-
* format: 'Downloading [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}'
|
|
151
|
-
* });
|
|
152
|
-
*
|
|
153
|
-
* bar.start();
|
|
154
|
-
* // ... do work and update progress
|
|
155
|
-
* bar.update(50);
|
|
156
|
-
* bar.stop();
|
|
157
|
-
* ```
|
|
158
|
-
*/
|
|
159
|
-
createProgressBar(options: SingleBarOptions): ProgressBar;
|
|
160
|
-
/**
|
|
161
|
-
* Creates a multi-bar progress manager for displaying multiple progress bars.
|
|
162
|
-
* @param options Configuration options for the multi-bar manager
|
|
163
|
-
* @returns A new MultiProgressBar instance
|
|
164
|
-
* @example
|
|
165
|
-
* ```typescript
|
|
166
|
-
* const logger = createPail({ interactive: true });
|
|
167
|
-
* const multiBar = logger.createMultiProgressBar();
|
|
168
|
-
*
|
|
169
|
-
* const bar1 = multiBar.create(100);
|
|
170
|
-
* const bar2 = multiBar.create(200);
|
|
171
|
-
*
|
|
172
|
-
* bar1.start();
|
|
173
|
-
* bar2.start();
|
|
174
|
-
* // ... update bars as needed
|
|
175
|
-
* multiBar.stop();
|
|
176
|
-
* ```
|
|
177
|
-
*/
|
|
178
|
-
createMultiProgressBar(options?: MultiBarOptions): MultiProgressBar;
|
|
179
|
-
/**
|
|
180
|
-
* Creates a single spinner.
|
|
181
|
-
* @param options Configuration options for the spinner
|
|
182
|
-
* @returns A new Spinner instance
|
|
183
|
-
* @example
|
|
184
|
-
* ```typescript
|
|
185
|
-
* const logger = createPail({ interactive: true });
|
|
186
|
-
* const spinner = logger.createSpinner({ name: 'dots' });
|
|
187
|
-
* spinner.start('Loading...');
|
|
188
|
-
* // ... do work
|
|
189
|
-
* spinner.succeed('Done');
|
|
190
|
-
* ```
|
|
191
|
-
*/
|
|
192
|
-
createSpinner(options?: SpinnerOptions): Spinner;
|
|
193
|
-
/**
|
|
194
|
-
* Creates a multi-spinner manager for displaying multiple spinners.
|
|
195
|
-
* @param options Configuration options for the multi-spinner manager
|
|
196
|
-
* @returns A new MultiSpinner instance
|
|
197
|
-
* @example
|
|
198
|
-
* ```typescript
|
|
199
|
-
* const logger = createPail({ interactive: true });
|
|
200
|
-
* const multiSpinner = logger.createMultiSpinner();
|
|
201
|
-
*
|
|
202
|
-
* const spinner1 = multiSpinner.create('Loading 1');
|
|
203
|
-
* const spinner2 = multiSpinner.create('Loading 2');
|
|
204
|
-
*
|
|
205
|
-
* spinner1.start();
|
|
206
|
-
* spinner2.start();
|
|
207
|
-
* // ... update spinners as needed
|
|
208
|
-
* multiSpinner.stop();
|
|
209
|
-
* ```
|
|
210
|
-
*/
|
|
211
|
-
createMultiSpinner(options?: SpinnerOptions): MultiSpinner;
|
|
212
|
-
/**
|
|
213
|
-
* Clears the terminal screen.
|
|
214
|
-
*
|
|
215
|
-
* Sends ANSI escape sequences to clear the terminal screen and move
|
|
216
|
-
* the cursor to the top-left position. This overrides the browser
|
|
217
|
-
* implementation to work with terminal streams.
|
|
218
|
-
* @example
|
|
219
|
-
* ```typescript
|
|
220
|
-
* const logger = createPail();
|
|
221
|
-
* logger.info("Some output");
|
|
222
|
-
* logger.clear(); // Clears the terminal screen
|
|
223
|
-
* ```
|
|
224
|
-
*/
|
|
225
|
-
clear(): void;
|
|
226
|
-
protected extendReporter(reporter: Reporter<L>): Reporter<L>;
|
|
227
|
-
}
|
|
228
|
-
export type PailServerType<T extends string = string, L extends string = string> = Console & (new <TC extends string = string, LC extends string = string>(options?: ServerConstructorOptions<TC, LC>) => PailServerType<TC, LC>) & PailServerImpl<T, L> & Record<DefaultLogTypes, LoggerFunction> & Record<T, LoggerFunction> & {
|
|
229
|
-
force: Record<DefaultLogTypes, LoggerFunction> & Record<T, LoggerFunction>;
|
|
230
|
-
};
|
|
231
|
-
export type PailConstructor<T extends string = string, L extends string = string> = new (options?: ServerConstructorOptions<T, L>) => PailServerType<T, L>;
|
|
232
|
-
export declare const PailServer: PailServerType;
|
|
233
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Gets the file location information of the caller.
|
|
3
|
-
*
|
|
4
|
-
* Uses Node.js stack trace API to analyze the call stack and determine
|
|
5
|
-
* the file, line, and column where this function was called from.
|
|
6
|
-
* Filters out internal pail files and native code.
|
|
7
|
-
* @returns Object containing file location information
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* const location = getCallerFilename();
|
|
11
|
-
* console.log(location);
|
|
12
|
-
* // { fileName: "/path/to/file.js", lineNumber: 42, columnNumber: 10 }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare const getCallerFilename: () => {
|
|
16
|
-
/** Column number where the call originated */
|
|
17
|
-
columnNumber?: number;
|
|
18
|
-
/** File name/path where the call originated */
|
|
19
|
-
fileName: string | undefined;
|
|
20
|
-
/** Line number where the call originated */
|
|
21
|
-
lineNumber?: number;
|
|
22
|
-
};
|
|
23
|
-
export default getCallerFilename;
|
package/dist/progress-bar.d.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import type InteractiveManager from "./interactive/interactive-manager.d.ts";
|
|
2
|
-
export type ProgressBarStyle = "shades_classic" | "shades_grey" | "rect" | "filled" | "solid" | "ascii" | "custom";
|
|
3
|
-
export interface ProgressBarOptions {
|
|
4
|
-
barCompleteChar?: string | string[];
|
|
5
|
-
barGlue?: string;
|
|
6
|
-
barIncompleteChar?: string | string[];
|
|
7
|
-
current?: number;
|
|
8
|
-
format?: string;
|
|
9
|
-
fps?: number;
|
|
10
|
-
style?: ProgressBarStyle;
|
|
11
|
-
total: number;
|
|
12
|
-
width?: number;
|
|
13
|
-
}
|
|
14
|
-
export interface SingleBarOptions extends ProgressBarOptions {
|
|
15
|
-
format?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface MultiBarOptions {
|
|
18
|
-
barCompleteChar?: string | string[];
|
|
19
|
-
barGlue?: string;
|
|
20
|
-
barIncompleteChar?: string | string[];
|
|
21
|
-
composite?: boolean;
|
|
22
|
-
format?: string;
|
|
23
|
-
fps?: number;
|
|
24
|
-
style?: ProgressBarStyle;
|
|
25
|
-
}
|
|
26
|
-
export interface ProgressBarPayload {
|
|
27
|
-
[key: string]: string | number | boolean;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Gets the appropriate bar character based on style and completion state.
|
|
31
|
-
* @param char Custom character override
|
|
32
|
-
* @param style Progress bar style to use
|
|
33
|
-
* @param complete Whether to get completed or incomplete character
|
|
34
|
-
* @returns The appropriate character for the given style
|
|
35
|
-
*/
|
|
36
|
-
export declare const getBarChar: (char: string | undefined, style: ProgressBarStyle, complete?: boolean) => string;
|
|
37
|
-
export declare const applyStyleToOptions: <T extends ProgressBarOptions | MultiBarOptions>(options: T) => T;
|
|
38
|
-
export declare class ProgressBar {
|
|
39
|
-
protected options: ProgressBarOptions;
|
|
40
|
-
protected current: number;
|
|
41
|
-
private startTime;
|
|
42
|
-
private interactiveManager?;
|
|
43
|
-
private isActive;
|
|
44
|
-
private payload?;
|
|
45
|
-
/**
|
|
46
|
-
* Creates a new progress bar instance.
|
|
47
|
-
* @param options Configuration options for the progress bar
|
|
48
|
-
* @param interactiveManager Optional interactive manager for rendering
|
|
49
|
-
* @param payload Optional initial payload data for format placeholders
|
|
50
|
-
*/
|
|
51
|
-
constructor(options: ProgressBarOptions, interactiveManager?: InteractiveManager, payload?: ProgressBarPayload);
|
|
52
|
-
/**
|
|
53
|
-
* Updates the progress bar to a new value.
|
|
54
|
-
* @param current The current progress value
|
|
55
|
-
* @param payload Optional payload data to merge with existing data
|
|
56
|
-
*/
|
|
57
|
-
update(current: number, payload?: ProgressBarPayload): void;
|
|
58
|
-
/**
|
|
59
|
-
* Increments the progress bar by a specified step.
|
|
60
|
-
* @param step Amount to increment (default: 1)
|
|
61
|
-
* @param payload Optional payload data to merge with existing data
|
|
62
|
-
*/
|
|
63
|
-
increment(step?: number, payload?: ProgressBarPayload): void;
|
|
64
|
-
/**
|
|
65
|
-
* Renders the progress bar as a formatted string.
|
|
66
|
-
* @returns Formatted progress bar string with all placeholders replaced
|
|
67
|
-
*/
|
|
68
|
-
render(): string;
|
|
69
|
-
/**
|
|
70
|
-
* Starts the progress bar.
|
|
71
|
-
* @param total Optional total value to set
|
|
72
|
-
* @param startValue Optional starting value
|
|
73
|
-
* @param payload Optional initial payload data
|
|
74
|
-
*/
|
|
75
|
-
start(total?: number, startValue?: number, payload?: ProgressBarPayload): void;
|
|
76
|
-
/**
|
|
77
|
-
* Stops the progress bar and cleanup.
|
|
78
|
-
*/
|
|
79
|
-
stop(): void;
|
|
80
|
-
private calculateETA;
|
|
81
|
-
}
|
|
82
|
-
export declare class MultiBarInstance extends ProgressBar {
|
|
83
|
-
private multiBar;
|
|
84
|
-
constructor(multiBar: MultiProgressBar, options: ProgressBarOptions, payload?: ProgressBarPayload);
|
|
85
|
-
update(current: number, payload?: ProgressBarPayload): void;
|
|
86
|
-
getBarState(): {
|
|
87
|
-
char: string;
|
|
88
|
-
current: number;
|
|
89
|
-
total: number;
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
export declare class MultiProgressBar {
|
|
93
|
-
private bars;
|
|
94
|
-
private options;
|
|
95
|
-
private interactiveManager?;
|
|
96
|
-
private isActive;
|
|
97
|
-
private nextBarId;
|
|
98
|
-
private composite;
|
|
99
|
-
private barColors;
|
|
100
|
-
/**
|
|
101
|
-
* Creates a new multi progress bar manager.
|
|
102
|
-
* @param options Configuration options for the progress bars
|
|
103
|
-
* @param interactiveManager Optional interactive manager for rendering
|
|
104
|
-
*/
|
|
105
|
-
constructor(options?: MultiBarOptions, interactiveManager?: InteractiveManager);
|
|
106
|
-
/**
|
|
107
|
-
* Creates a new progress bar within this multi-bar manager.
|
|
108
|
-
* @param total Total value for the progress bar
|
|
109
|
-
* @param current Starting current value (default: 0)
|
|
110
|
-
* @param payload Optional initial payload data for format placeholders
|
|
111
|
-
* @returns The created progress bar instance
|
|
112
|
-
*/
|
|
113
|
-
create(total: number, current?: number, payload?: ProgressBarPayload): ProgressBar;
|
|
114
|
-
/**
|
|
115
|
-
* Removes a progress bar from the manager.
|
|
116
|
-
* @param bar The progress bar instance to remove
|
|
117
|
-
* @returns True if the bar was removed, false if not found
|
|
118
|
-
*/
|
|
119
|
-
remove(bar: ProgressBar): boolean;
|
|
120
|
-
/**
|
|
121
|
-
* Renders all progress bars.
|
|
122
|
-
*/
|
|
123
|
-
renderAll(): void;
|
|
124
|
-
/**
|
|
125
|
-
* Sets or removes a color function for a specific bar.
|
|
126
|
-
* @param bar The progress bar instance to color (must be from this MultiProgressBar)
|
|
127
|
-
* @param color Color function or undefined to remove color
|
|
128
|
-
*/
|
|
129
|
-
setBarColor(bar: MultiBarInstance, color: ((text: string) => string) | undefined): void;
|
|
130
|
-
/**
|
|
131
|
-
* Stops all progress bars and cleanup.
|
|
132
|
-
*/
|
|
133
|
-
stop(): void;
|
|
134
|
-
private renderComposite;
|
|
135
|
-
private getCompositeChar;
|
|
136
|
-
}
|