Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Progress messages for writing to cache #9368

Merged
merged 12 commits into from
Nov 30, 2023
377 changes: 377 additions & 0 deletions flow-libs/cli-progress.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,377 @@
/**
* Flowtype definitions for index
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.21.0
* @flow
*/
declare module 'cli-progress' {
declare export interface Params {
progress: number;
eta: number;
startTime: number;
stopTime: number | null;
total: number;
value: number;
maxWidth: number;
}
declare export interface Options {
/**
* progress bar output format.
* The progressbar can be customized by using the following build-in placeholders. They can be combined in any order.
* {bar} - the progress bar, customizable by the options barsize, barCompleteString and barIncompleteString
* {percentage} - the current progress in percent (0-100)
* {total} - the end value
* {value} - the current value set by last update() call
* {eta} - expected time of accomplishment in seconds
* {duration} - elapsed time in seconds
* {eta_formatted} - expected time of accomplishment formatted into appropriate units
* {duration_formatted} - elapsed time formatted into appropriate units
*
* Example:
* progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}
* is rendered as
* progress [========================================] 100% | ETA: 0s | 200/200
*/
format?: string | GenericFormatter | void;

/**
* a custom bar formatter function which renders the bar-element (default: format-bar.js)
*/
formatBar?: BarFormatter | void;

/**
* a custom timer formatter function which renders the formatted time elements like eta_formatted and duration-formatted (default: format-time.js)
*/
formatTime?: TimeFormatter | void;

/**
* a custom value formatter function which renders all other values (default: format-value.js)
*/
formatValue?: ValueFormatter | void;

/**
* the maximum update rate (default: 10)
*/
fps?: number | void;

/**
* output stream to use (default: process.stderr)
*/
stream?: WritableStream | void;

/**
* automatically call stop() when the value reaches the total (default: false)
*/
stopOnComplete?: boolean | void;

/**
* clear the progress bar on complete / stop() call (default: false)
*/
clearOnComplete?: boolean | void;

/**
* the length of the progress bar in chars (default: 40)
*/
barsize?: number | void;

/**
* position of the progress bar - 'left' (default), 'right' or 'center
*/
align?: 'left' | 'right' | 'center' | void;

/**
* character to use as "complete" indicator in the bar (default: "=")
*/
barCompleteString?: string | void;

/**
* character to use as "incomplete" indicator in the bar (default: "-")
*/
barIncompleteString?: string | void;

/**
* character to use as "complete" indicator in the bar (default: "=")
*/
barCompleteChar?: string | void;

/**
* character to use as "incomplete" indicator in the bar (default: "-")
*/
barIncompleteChar?: string | void;

/**
* hide the cursor during progress operation; restored on complete (default: false)
* - pass `null` to keep terminal settings
*/
hideCursor?: boolean | null | void;

/**
* glue sequence (control chars) between bar elements (default: '')
*/
barGlue?: string | void;

/**
* number of updates with which to calculate the eta; higher numbers give a more stable eta (default: 10)
*/
etaBuffer?: number | void;

/**
* trigger an eta calculation update during asynchronous rendering trigger using the current value
* - should only be used for long running processes in conjunction with lof `fps` values and large `etaBuffer`
* @default false
*/
etaAsynchronousUpdate?: boolean | void;

/**
* progress calculation relative to start value ? default start at 0 (default: false)
*/
progressCalculationRelative?: boolean | void;

/**
* disable line wrapping (default: false) - pass null to keep terminal settings; pass true to trim the output to terminal width
*/
linewrap?: boolean | null | void;

/**
* trigger redraw during update() in case threshold time x2 is exceeded (default: true) - limited to single bar usage
*/
synchronousUpdate?: boolean | void;

/**
* enable scheduled output to notty streams - e.g. redirect to files (default: false)
*/
noTTYOutput?: boolean | void;

/**
* set the output schedule/interval for notty output in ms (default: 2000ms)
*/
notTTYSchedule?: number | void;

/**
* display progress bars with 'total' of zero(0) as empty, not full (default: false)
*/
emptyOnZero?: boolean | void;

/**
* trigger redraw on every frame even if progress remains the same; can be useful if progress bar gets overwritten by other concurrent writes to the terminal (default: false)
*/
forceRedraw?: boolean | void;

/**
* add padding chars to formatted time and percentage to force fixed width (default: false)
*/
autopadding?: boolean | void;

/**
* the character sequence used for autopadding (default: " ")
*/
autopaddingChar?: string | void;

/**
* stop bar on SIGINT/SIGTERM to restore cursor settings (default: true)
*/
gracefulExit?: boolean | void;
}
declare export interface Preset {
barCompleteChar: string;
barIncompleteChar: string;

/**
* Example: 'progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}'
*
* {bar} - the progress bar, customizable by the options barsize, barCompleteString and barIncompleteString
*
* {percentage} - the current progress in percent (0-100)
*
* {total} - the end value
*
* {value} - the current value set by last update() call
*
* {eta} - expected time of accomplishment in seconds (limited to 115days, otherwise INF is displayed)
*
* {duration} - elapsed time in seconds
*
* {eta_formatted} - expected time of accomplishment formatted into appropriate units
*
* {duration_formatted} - elapsed time formatted into appropriate units
*/
format: string;
}
declare export class GenericBar mixins events$EventEmitter {
/**
* Initialize a new Progress bar. An instance can be used multiple times! it's not required to re-create it!
*/
constructor(opt: Options, preset?: Preset): this;

/**
* Internal render function
*/
render(forceRendering?: boolean): void;

/**
* Starts the progress bar and set the total and initial value
*/
start(
total: number,
startValue: number,
payload?: {[key: string]: any},
): void;

/**
* Stops the progress bar and go to next line
*/
stop(): void;

/**
* Sets the current progress value and optionally the payload with values of custom tokens as a second parameter
*/
update(current: number, payload?: {[key: string]: any}): void;
update(payload: {[key: string]: any}): void;

/**
* Calculate the actual progress value
*/
getProgress(): number;

/**
* Increases the current progress value by a specified amount (default +1). Update payload optionally
*/
increment(step?: number, payload?: {[key: string]: any}): void;
increment(payload: {[key: string]: any}): void;

/**
* Get the total (limit) value
*/
getTotal(): number;

/**
* Sets the total progress value while progressbar is active. Especially useful handling dynamic tasks.
*/
setTotal(total: number): void;

/**
* Force eta calculation update (long running processes) without altering the progress values.
*/
updateETA(): void;
}
declare export class SingleBar mixins GenericBar {
/**
* Initialize a new Progress bar. An instance can be used multiple times! it's not required to re-create it!
*/
constructor(opt: Options, preset?: Preset): this;

/**
* Internal render function
*/
render(): void;

/**
* Sets the current progress value and optionally the payload with values of custom tokens as a second parameter
*/
update(current: number, payload?: {[key: string]: any}): void;
update(payload: {[key: string]: any}): void;

/**
* Starts the progress bar and set the total and initial value
*/
start(
total: number,
startValue: number,
payload?: {[key: string]: any},
): void;

/**
* Stops the progress bar and go to next line
*/
stop(): void;
}
declare export class MultiBar mixins events$EventEmitter {
constructor(opt: Options, preset?: Preset): this;

/**
* add a new bar to the stack
*/
create(
total: number,
startValue: number,
payload?: any,
barOptions?: Options,
): SingleBar;

/**
* remove a bar from the stack
*/
remove(bar: SingleBar): boolean;

/**
* internal update routine
*/
update(): void;
stop(): void;

/**
* log output above the progress bars; string must end with newline character!
*/
log(data: string): void;
}
declare export var Presets: {
/**
* Styles as of cli-progress v1.3.0
*/
legacy: Preset,

/**
* Unicode Rectangles
*/
rect: Preset,

/**
* Unicode background shades are used for the bar
*/
shades_classic: Preset,

/**
* Unicode background shades with grey bar
*/
shades_grey: Preset,
...
};
declare export interface GenericFormatter {
(options: Options, params: Params, payload: any): string;
}
declare export interface TimeFormatter {
(t: number, options: Options, roundToMultipleOf: number): string;
}
declare export interface ValueFormatter {
(v: number, options: Options, type: ValueType): string;
}
declare export interface BarFormatter {
(progress: number, options: Options): string;
}
declare export type ValueType =
| 'percentage'
| 'total'
| 'value'
| 'eta'
| 'duration';
declare var defaultFormatter: GenericFormatter;
declare var formatBar: BarFormatter;
declare var formatValue: ValueFormatter;
declare var formatTime: TimeFormatter;
declare export var Format: {
Formatter: typeof defaultFormatter,
BarFormat: typeof formatBar,
ValueFormat: typeof formatValue,
TimeFormat: typeof formatTime,
...
};
declare export class Bar mixins SingleBar {}
declare export interface cliProgress {
Bar: typeof Bar;
SingleBar: typeof SingleBar;
MultiBar: typeof MultiBar;
Presets: typeof Presets;
Format: typeof Format;
}
declare export default cliProgress;
}
2 changes: 1 addition & 1 deletion packages/core/core/src/Parcel.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ export default class Parcel {
this.#initialized = false;

await Promise.all([
this.#disposable.dispose(),
await this.#requestTracker.writeToCache(),
this.#disposable.dispose(),
thebriando marked this conversation as resolved.
Show resolved Hide resolved
]);
}

Expand Down
Loading
Loading