Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

listr2

Package Overview
Dependencies
Maintainers
1
Versions
235
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

listr2 - npm Package Compare versions

Comparing version 7.0.0-beta.3 to 7.0.0-beta.4

382

dist/index.d.ts

@@ -1,34 +0,6 @@

import Enquirer from 'enquirer';
import { Observable } from 'rxjs';
import { Writable, Readable } from 'stream';
import { Readable } from 'stream';
import * as colorette from 'colorette';
import { WriteStream } from 'fs';
import { CancelablePromise, Prompt } from '@inquirer/type';
/**
* Give event map a set of indexes to not make it go crazy when some events are missing from it.
* They are optional after all.
*/
declare class BaseEventMap {
[k: string]: any;
}
/**
* Parameters for the given event in the {@link EventMap}.
*/
type EventData<Event extends string, Map extends Record<string, unknown>> = Event extends keyof Map ? Map[Event] : never;
/**
* An event map of given events that defined the parameters and return types for firing a certain event.
*/
type EventMap<Events extends string> = Partial<Record<Events, unknown>>;
declare class EventManager<Event extends string = string, Map extends Partial<Record<Event, unknown>> = Partial<Record<Event, any>>> {
private readonly emitter;
emit<E extends Event = Event>(dispatch: E, args?: EventData<E, Map>): void;
on<E extends Event = Event>(dispatch: E, handler: (data: EventData<E, Map>) => void): void;
once<E extends Event = Event>(dispatch: E, handler: (data: EventData<E, Map>) => void): void;
off<E extends Event = Event>(dispatch: E, handler?: (data: EventData<E, Map>) => void): void;
complete(): void;
}
/**
* Indicates an UNICODE characters is coming up.

@@ -83,2 +55,8 @@ */

declare enum ListrRendererSelection {
PRIMARY = "PRIMARY",
SECONDARY = "SECONDARY",
SILENT = "SILENT"
}
/**

@@ -149,2 +127,27 @@ * Internal events that are fired from the Task.

/**
* Give event map a set of indexes to not make it go crazy when some events are missing from it.
* They are optional after all.
*/
declare class BaseEventMap {
[k: string]: any;
}
/**
* Parameters for the given event in the {@link EventMap}.
*/
type EventData<Event extends string, Map extends Record<string, unknown>> = Event extends keyof Map ? Map[Event] : never;
/**
* An event map of given events that defined the parameters and return types for firing a certain event.
*/
type EventMap<Events extends string> = Partial<Record<Events, unknown>>;
declare class EventManager<Event extends string = string, Map extends Partial<Record<Event, unknown>> = Partial<Record<Event, any>>> {
private readonly emitter;
emit<E extends Event = Event>(dispatch: E, args?: EventData<E, Map>): void;
on<E extends Event = Event>(dispatch: E, handler: (data: EventData<E, Map>) => void): void;
once<E extends Event = Event>(dispatch: E, handler: (data: EventData<E, Map>) => void): void;
off<E extends Event = Event>(dispatch: E, handler?: (data: EventData<E, Map>) => void): void;
complete(): void;
}
/**
* Tests to see if the object is an RxJS {@link Observable}

@@ -393,131 +396,7 @@ * @param obj the object to test

interface EnquirerBasePromptOptions {
message: string | (() => string) | (() => Promise<string>);
initial?: boolean | number | number[] | string | (() => string) | (() => Promise<string>);
required?: boolean;
stdin?: NodeJS.ReadStream;
stdout?: NodeJS.WriteStream;
header?: string;
footer?: string;
skip?: (value: any) => boolean | Promise<boolean>;
format?: (value: any) => any | Promise<any>;
result?: (value: any) => any | Promise<any>;
validate?: (value: any, state: any) => boolean | Promise<boolean> | string | Promise<string> | Promise<string | boolean>;
onSubmit?: (name: any, value: any, prompt: Enquirer.Prompt) => boolean | Promise<boolean>;
onCancel?: (name: any, value: any, prompt: Enquirer.Prompt) => boolean | Promise<boolean>;
}
interface EnquirerBasePromptOptionsWithName extends EnquirerBasePromptOptions {
name: string | (() => string);
}
interface EnquirerArrayPromptOptions extends EnquirerBasePromptOptions {
choices: string[] | EnquirerBasePromptOptionsWithName[];
maxChoices?: number;
multiple?: boolean;
initial?: number | number[];
delay?: number;
separator?: boolean;
sort?: boolean;
linebreak?: boolean;
edgeLength?: number;
align?: 'left' | 'right';
scroll?: boolean;
hint?: string;
}
interface EnquirerBooleanPromptOptions extends EnquirerBasePromptOptions {
initial?: boolean | (() => string) | (() => Promise<string>);
}
interface EnquirerStringPromptOptions extends EnquirerBasePromptOptions {
initial?: string;
multiline?: boolean;
}
interface EnquirerScalePromptOptions extends EnquirerArrayPromptOptions {
scale: EnquirerStringPromptOptions[];
margin?: [number, number, number, number];
}
interface EnquirerNumberPromptOptions extends EnquirerBasePromptOptions {
min?: number;
max?: number;
delay?: number;
float?: boolean;
round?: boolean;
major?: number;
minor?: number;
initial?: number;
}
interface EnquirerSnippetPromptOptions extends EnquirerBasePromptOptions {
newline?: string;
fields: Partial<EnquirerBasePromptOptionsWithName>[];
template: string;
}
interface EnquirerSortPromptOptions extends EnquirerBasePromptOptions {
hint?: string;
drag?: boolean;
numbered?: boolean;
}
interface EnquirerSurveyPromptOptions extends EnquirerArrayPromptOptions {
scale: EnquirerBasePromptOptionsWithName[];
margin: [number, number, number, number];
}
interface EnquirerQuizPromptOptions extends EnquirerArrayPromptOptions {
correctChoice: number;
}
interface EnquirerTogglePromptOptions extends EnquirerBasePromptOptions {
enabled?: string;
disabled?: string;
}
interface EnquirerPromptCancelOptions {
throw?: boolean;
}
/** Returns all the prompt options depending on the type selected. */
type EnquirerPromptOptions<T extends boolean = false> = Unionize<{
[K in EnquirerPromptTypes]-?: T extends true ? {
type: K;
} & EnquirerPromptOptionsType<K> & {
name: string | (() => string);
} : {
type: K;
} & EnquirerPromptOptionsType<K>;
}> | ({
type: string;
} & T extends true ? EnquirerPromptOptionsType<string> & {
name: string | (() => string);
} : EnquirerPromptOptionsType<string>);
type EnquirerPromptTypes = 'AutoComplete' | 'BasicAuth' | 'Confirm' | 'Editable' | 'Form' | 'Input' | 'Invisible' | 'List' | 'MultiSelect' | 'Numeral' | 'Password' | 'Quiz' | 'Scale' | 'Select' | 'Snippet' | 'Sort' | 'Survey' | 'Text' | 'Toggle';
type EnquirerPromptOptionsType<T> = T extends keyof EnquirerPromptOptionsMap ? EnquirerPromptOptionsMap[T] : T extends string ? EnquirerBasePromptOptions & Record<PropertyKey, unknown> : any;
declare class EnquirerPromptOptionsMap implements Record<EnquirerPromptTypes, Record<PropertyKey, any>> {
AutoComplete: EnquirerArrayPromptOptions;
BasicAuth: EnquirerStringPromptOptions;
Confirm: EnquirerBooleanPromptOptions;
Editable: EnquirerArrayPromptOptions;
Form: EnquirerArrayPromptOptions;
Input: EnquirerStringPromptOptions;
Invisible: EnquirerStringPromptOptions;
List: EnquirerArrayPromptOptions;
MultiSelect: EnquirerArrayPromptOptions;
Numeral: EnquirerNumberPromptOptions;
Password: EnquirerStringPromptOptions;
Quiz: EnquirerQuizPromptOptions;
Scale: EnquirerScalePromptOptions;
Select: EnquirerArrayPromptOptions;
Snippet: EnquirerSnippetPromptOptions;
Sort: EnquirerSortPromptOptions;
Survey: EnquirerSurveyPromptOptions;
Text: EnquirerStringPromptOptions;
Toggle: EnquirerTogglePromptOptions;
}
interface EnquirerPromptSettings {
error?: boolean;
stdout?: WriteStream | Writable;
enquirer?: Enquirer;
}
interface EnquirerPromptInstance extends Omit<EnquirerBasePromptOptions, 'onCancel' | 'onSubmit'> {
submit: () => void;
cancel: (err?: string) => void;
}
declare abstract class ListrPromptAdapter {
protected task: Task<any, any>;
protected wrapper: TaskWrapper<any, any>;
protected task: Task<any, any, any>;
protected wrapper: TaskWrapper<any, any, any>;
private state;
constructor(task: Task<any, any>, wrapper: TaskWrapper<any, any>);
constructor(task: Task<any, any, any>, wrapper: TaskWrapper<any, any, any>);
protected reportStarted(): void;

@@ -530,37 +409,2 @@ protected reportFailed(): void;

declare class ListrEnquirerPromptAdapter extends ListrPromptAdapter {
error: PromptError;
private prompt;
/**
* Get the current running instance of `enquirer`.
*/
get instance(): EnquirerPromptInstance;
/**
* Create a new prompt with `enquirer`.
*
* `enquirer` is a peer dependency that must be installed seperately.
*/
run<T = any>(options: EnquirerPromptOptions | EnquirerPromptOptions<true>[], settings?: EnquirerPromptSettings): Promise<T>;
/**
* Cancel the ongoing prompt.
*/
cancel(options?: EnquirerPromptCancelOptions): void;
}
declare class ListrInquirerPromptAdapter extends ListrPromptAdapter {
private prompt;
/**
* Get the current running instance of `inquirer`.
*/
get instance(): CancelablePromise<any>;
/**
* Create a new prompt with `inquirer`.
*/
run<T extends Prompt<any, any> = Prompt<any, any>>(prompt: T, ...[config, context]: Parameters<T>): Promise<ReturnType<T>>;
/**
* Cancel the ongoing prompt.
*/
cancel(): void;
}
declare class Spinner {

@@ -618,5 +462,5 @@ protected readonly spinner: string[];

*/
declare class TaskWrapper<Ctx, Renderer extends ListrRendererFactory> {
task: Task<Ctx, ListrRendererFactory>;
constructor(task: Task<Ctx, ListrRendererFactory>);
declare class TaskWrapper<Ctx, Renderer extends ListrRendererFactory, FallbackRenderer extends ListrRendererFactory> {
task: Task<Ctx, Renderer, FallbackRenderer>;
constructor(task: Task<Ctx, Renderer, FallbackRenderer>);
get title(): string;

@@ -643,3 +487,3 @@ /**

*/
newListr<NewCtx = Ctx>(task: ListrTask<NewCtx, Renderer> | ListrTask<NewCtx, Renderer>[] | ((parent: Omit<this, 'skip' | 'enabled'>) => ListrTask<NewCtx, Renderer> | ListrTask<NewCtx, Renderer>[]), options?: ListrSubClassOptions<NewCtx, Renderer>): Listr<NewCtx, any, any>;
newListr<NewCtx = Ctx>(task: ListrTask<NewCtx, Renderer, FallbackRenderer> | ListrTask<NewCtx, Renderer, FallbackRenderer>[] | ((parent: Omit<this, 'skip' | 'enabled'>) => ListrTask<NewCtx, Renderer, FallbackRenderer> | ListrTask<NewCtx, Renderer, FallbackRenderer>[]), options?: ListrSubClassOptions<NewCtx, Renderer, FallbackRenderer>): Listr<NewCtx, any, any>;
/**

@@ -662,3 +506,3 @@ * Report an error that has to be collected and handled.

*/
isRetrying(): Task<Ctx, Renderer>['retry'];
isRetrying(): Task<Ctx, Renderer, FallbackRenderer>['retry'];
/**

@@ -672,3 +516,3 @@ * Create a new prompt for getting user input through the prompt adapter.

*/
prompt<T extends ListrPromptAdapter = ListrPromptAdapter>(adapter: new (task: Task<Ctx, Renderer>, wrapper: TaskWrapper<Ctx, Renderer>) => T): T;
prompt<T extends ListrPromptAdapter = ListrPromptAdapter>(adapter: new (task: Task<Ctx, Renderer, FallbackRenderer>, wrapper: TaskWrapper<Ctx, Renderer, FallbackRenderer>) => T): T;
/**

@@ -690,7 +534,9 @@ * Generates a fake stdout for your use case, where it will be tunnelled through Listr to handle the rendering process.

*/
declare class Task<Ctx, Renderer extends ListrRendererFactory> extends ListrTaskEventManager {
listr: Listr<Ctx, any, any>;
task: ListrTask<Ctx, any>;
declare class Task<Ctx, Renderer extends ListrRendererFactory = ListrRendererFactory, FallbackRenderer extends ListrRendererFactory = ListrRendererFactory> extends ListrTaskEventManager {
listr: Listr<Ctx, Renderer, FallbackRenderer>;
task: ListrTask<Ctx, Renderer, FallbackRenderer>;
options: ListrOptions;
rendererOptions: ListrGetRendererOptions<Renderer>;
rendererOptions: ListrGetRendererOptions<Renderer> | ListrGetRendererOptions<FallbackRenderer>;
/** Per-task options for the current renderer of the task. */
rendererTaskOptions: ListrGetRendererTaskOptions<Renderer> | ListrGetRendererTaskOptions<FallbackRenderer>;
/** Unique id per task, can be used for identifying a Task. */

@@ -701,3 +547,3 @@ id: string;

/** Subtasks of the current task. */
subtasks: Task<Ctx, Renderer>[];
subtasks: Task<Ctx, Renderer, FallbackRenderer>[];
/** Title of the task. */

@@ -717,8 +563,6 @@ title?: string;

message: ListrTaskMessage;
/** Per-task options for the current renderer of the task. */
rendererTaskOptions: ListrGetRendererTaskOptions<Renderer>;
/** Current prompt instance or prompt error whenever the task is prompting. */
prompt: ListrTaskPrompt;
/** Parent task of the current task. */
parent?: Task<Ctx, Renderer>;
parent?: Task<Ctx, any, any>;
/** Enable flag of this task. */

@@ -730,3 +574,5 @@ private enabled;

private closed;
constructor(listr: Listr<Ctx, any, any>, task: ListrTask<Ctx, any>, options: ListrOptions, rendererOptions: ListrGetRendererOptions<Renderer>);
constructor(listr: Listr<Ctx, Renderer, FallbackRenderer>, task: ListrTask<Ctx, Renderer, FallbackRenderer>, options: ListrOptions, rendererOptions: ListrGetRendererOptions<Renderer> | ListrGetRendererOptions<FallbackRenderer>,
/** Per-task options for the current renderer of the task. */
rendererTaskOptions: ListrGetRendererTaskOptions<Renderer> | ListrGetRendererTaskOptions<FallbackRenderer>);
/**

@@ -747,3 +593,3 @@ * Update the current state of the Task and emit the neccassary events.

*/
set message$(data: Task<Ctx, Renderer>['message']);
set message$(data: Task<Ctx, Renderer, FallbackRenderer>['message']);
/**

@@ -796,3 +642,3 @@ * Update the current title of the Task and emit the neccassary events.

/** Run the current task. */
run(context: Ctx, wrapper: TaskWrapper<Ctx, Renderer>): Promise<void>;
run(context: Ctx, wrapper: TaskWrapper<Ctx, Renderer, FallbackRenderer>): Promise<void>;
private close;

@@ -892,3 +738,3 @@ }

type ListrDefaultRendererOptionsStyle = ListrLoggerStyleMap<ListrDefaultRendererLogLevels>;
type ListrDefaultRendererTask = Task<any, typeof DefaultRenderer>;
type ListrDefaultRendererTask = ListrRendererTask<typeof DefaultRenderer>;
interface ListrDefaultRendererOptions extends RendererPresetTimer, RendererLoggerOptions<ListrDefaultRendererLogLevels>, ListrLoggerStyleMap<ListrDefaultRendererLogLevels> {

@@ -1069,3 +915,3 @@ /**

type ListrSilentRendererTask = Task<any, typeof SilentRenderer>;
type ListrSilentRendererTask = ListrRendererTask<typeof SilentRenderer>;
type ListrSilentRendererOptions = never;

@@ -1090,3 +936,3 @@ type ListrSilentRendererTaskOptions = never;

type ListrSimpleRendererTask = Task<any, typeof SimpleRenderer>;
type ListrSimpleRendererTask = ListrRendererTask<typeof SimpleRenderer>;
interface ListrSimpleRendererOptions extends RendererPresetTimer, RendererPresetTimestamp, RendererLoggerOptions<ListrLogLevels>, ListrLoggerStyleMap<ListrLogLevels> {

@@ -1126,5 +972,5 @@ /**

}
type TestRendererSerializerTaskKeys = Extract<keyof Task<any, typeof TestRenderer>, 'hasSubtasks' | 'hasFinalized' | 'isPending' | 'isStarted' | 'isSkipped' | 'isCompleted' | 'hasFailed' | 'isRollingBack' | 'hasRolledBack' | 'isRetrying' | 'hasReset' | 'isEnabled' | 'hasTitle' | 'isPrompt' | 'isPaused' | 'title' | 'path'>;
type TestRendererSerializerTaskKeys = Extract<keyof ListrRendererTask<typeof TestRenderer>, 'hasSubtasks' | 'hasFinalized' | 'isPending' | 'isStarted' | 'isSkipped' | 'isCompleted' | 'hasFailed' | 'isRollingBack' | 'hasRolledBack' | 'isRetrying' | 'hasReset' | 'isEnabled' | 'hasTitle' | 'isPrompt' | 'isPaused' | 'title' | 'path'>;
type ListrTestRendererTask = Task<any, typeof TestRenderer>;
type ListrTestRendererTask = ListrRendererTask<typeof TestRenderer>;
interface ListrTestRendererOptions extends RendererLoggerOptions<ListrLogLevels> {

@@ -1191,3 +1037,3 @@ /**

type ListrVerboseRendererTask = Task<any, typeof VerboseRenderer>;
type ListrVerboseRendererTask = ListrRendererTask<typeof VerboseRenderer>;
interface ListrVerboseRendererOptions extends RendererPresetTimer, RendererPresetTimestamp, RendererLoggerOptions<ListrLogLevels>, ListrLoggerStyleMap<ListrLogLevels> {

@@ -1260,17 +1106,33 @@ /**

/** Selection and options of the primary preferred renderer. */
interface ListrPrimaryRendererOptions<T extends ListrRendererValue> {
interface ListrPrimaryRendererSelection<T extends ListrRendererValue> extends ListrPrimaryRendererOptions<T> {
/** Default renderer preferred. */
renderer?: T;
}
/** Options of the primary preferred renderer. */
interface ListrPrimaryRendererOptions<T extends ListrRendererValue> {
/** Renderer options depending on the current renderer. */
rendererOptions?: ListrGetRendererOptions<T>;
}
/** Task options of the primary preferred renderer. */
interface ListrPrimaryRendererTaskOptions<T extends ListrRendererValue> {
/** Renderer options depending on the current renderer. */
rendererOptions?: ListrGetRendererTaskOptions<T>;
}
/** Selection and options of the preferred fallback renderer. */
interface ListrSecondaryRendererOptions<T extends ListrRendererValue> {
interface ListrSecondaryRendererSelection<T extends ListrRendererValue> extends ListrSecondaryRendererOptions<T> {
/** Fallback renderer preferred. */
fallbackRenderer?: T;
}
/** Options of the fallback renderer. */
interface ListrSecondaryRendererOptions<T extends ListrRendererValue> {
/** Renderer options depending on the fallback renderer. */
fallbackRendererOptions?: ListrGetRendererOptions<T>;
}
/** Task options of the fallback renderer. */
interface ListrSecondaryRendererTaskOptions<T extends ListrRendererValue> {
/** Renderer options depending on the fallback renderer. */
fallbackRendererOptions?: ListrGetRendererTaskOptions<T>;
}
/** Renderer options for the parent Listr class, including setup for selecting default and fallback renderers. */
type ListrRendererOptions<Renderer extends ListrRendererValue, FallbackRenderer extends ListrRendererValue> = ListrPrimaryRendererOptions<Renderer> & ListrSecondaryRendererOptions<FallbackRenderer>;
type ListrRendererOptions<Renderer extends ListrRendererValue, FallbackRenderer extends ListrRendererValue> = ListrPrimaryRendererSelection<Renderer> & ListrSecondaryRendererSelection<FallbackRenderer>;
/**

@@ -1293,3 +1155,3 @@ * The definition of a ListrRenderer.

/** create a new renderer */
constructor(tasks: readonly Task<any, ListrRendererFactory>[], options: typeof ListrRenderer.rendererOptions, events?: ListrEventManager);
constructor(tasks: Task<any, ListrRendererFactory, ListrRendererFactory>[], options: typeof ListrRenderer.rendererOptions, events?: ListrEventManager);
}

@@ -1302,4 +1164,5 @@ /** Factory of compatible Listr renderers. */

options?: ListrGetRendererOptions<Renderer>;
selection: ListrRendererSelection;
}
type ListrRendererCacheMap<T> = Map<Task<any, any>['id'], T>;
type ListrRendererCacheMap<T> = Map<Task<any, any, any>['id'], T>;

@@ -1392,11 +1255,2 @@ /** Listr context. */

forceUnicode?: boolean;
/**
* Inject data directly to TaskWrapper.
*/
injectWrapper?: {
/**
* Inject an `enquirer` instance for using with prompts.
*/
enquirer?: Enquirer<object>;
};
}

@@ -1408,3 +1262,3 @@ /**

*/
interface ListrBaseClassOptions<Ctx = ListrContext, Renderer extends ListrRendererValue = ListrPrimaryRendererValue, FallbackRenderer extends ListrRendererValue = ListrSecondaryRendererValue> extends ListrOptions<Ctx>, ListrPrimaryRendererOptions<Renderer>, ListrSecondaryRendererOptions<FallbackRenderer> {
interface ListrBaseClassOptions<Ctx = ListrContext, Renderer extends ListrRendererValue = ListrPrimaryRendererValue, FallbackRenderer extends ListrRendererValue = ListrSecondaryRendererValue> extends ListrOptions<Ctx>, ListrPrimaryRendererSelection<Renderer>, ListrSecondaryRendererSelection<FallbackRenderer> {
}

@@ -1414,3 +1268,3 @@ /**

*/
interface ListrSubClassOptions<Ctx = ListrContext, Renderer extends ListrRendererValue = ListrPrimaryRendererValue> extends Omit<ListrOptions<Ctx>, 'registerSignalListeners' | 'fallbackRendererCondition' | 'silentRendererCondition' | 'forceTTY' | 'forceUnicode'>, Omit<ListrPrimaryRendererOptions<Renderer>, 'renderer'> {
interface ListrSubClassOptions<Ctx = ListrContext, Renderer extends ListrRendererValue = ListrPrimaryRendererValue, FallbackRenderer extends ListrRendererValue = ListrSecondaryRendererValue> extends Omit<ListrOptions<Ctx>, 'registerSignalListeners' | 'fallbackRendererCondition' | 'silentRendererCondition' | 'forceTTY' | 'forceUnicode'>, ListrPrimaryRendererOptions<Renderer>, ListrSecondaryRendererOptions<FallbackRenderer> {
}

@@ -1426,6 +1280,6 @@

type: ListrErrorTypes;
task: Task<Ctx, ListrRendererFactory>;
task: Task<Ctx, ListrRendererFactory, ListrRendererFactory>;
path: string[];
ctx: Ctx;
constructor(error: Error, type: ListrErrorTypes, task: Task<Ctx, ListrRendererFactory>);
constructor(error: Error, type: ListrErrorTypes, task: Task<Ctx, ListrRendererFactory, ListrRendererFactory>);
}

@@ -1455,3 +1309,3 @@

*/
interface ListrTask<Ctx = ListrContext, Renderer extends ListrRendererFactory = any> {
interface ListrTask<Ctx = ListrContext, Renderer extends ListrRendererFactory = any, FallbackRenderer extends ListrRendererFactory = any> extends ListrPrimaryRendererTaskOptions<Renderer>, ListrSecondaryRendererTaskOptions<FallbackRenderer> {
/**

@@ -1474,3 +1328,3 @@ * Title of the task.

*/
task: ListrTaskFn<Ctx, Renderer>;
task: ListrTaskFn<Ctx, Renderer, FallbackRenderer>;
/**

@@ -1508,3 +1362,3 @@ * Enable a task depending on the context.

*/
rollback?: ListrTaskFn<Ctx, Renderer>;
rollback?: ListrTaskFn<Ctx, Renderer, FallbackRenderer>;
/**

@@ -1514,12 +1368,2 @@ * Determine the default behavior of exiting on errors for this attached task.

exitOnError?: boolean | ((ctx: Ctx) => boolean | Promise<boolean>);
/**
* Per-task options, that depends on the selected renderer.
*
* - Options of the current preferred renderer can be changed on task level.
* - These options depend on the implementation of the preferred renderer.
* - Whenever the preferred renderer has no options it will be displayed as never.
*
* **This option will be deprecated in a future major release in favor of having options for both the default and the fallback renderer.**
*/
options?: ListrGetRendererTaskOptions<Renderer>;
}

@@ -1529,7 +1373,7 @@ /**

*/
type ListrTaskResult<Ctx> = string | Promise<any> | Listr<Ctx, ListrRendererValue, any> | Readable | NodeJS.ReadableStream | Observable<any>;
type ListrTaskResult<Ctx> = string | Promise<any> | Listr<Ctx, ListrRendererValue, ListrRendererValue> | Readable | NodeJS.ReadableStream | Observable<any>;
/**
* The callback function from the user that defines the task.
*/
type ListrTaskFn<Ctx, Renderer extends ListrRendererFactory> = (ctx: Ctx, task: TaskWrapper<Ctx, Renderer>) => void | ListrTaskResult<Ctx>;
type ListrTaskFn<Ctx, Renderer extends ListrRendererFactory, FallbackRenderer extends ListrRendererFactory> = (ctx: Ctx, task: TaskWrapper<Ctx, Renderer, FallbackRenderer>) => void | ListrTaskResult<Ctx>;
/**

@@ -1567,2 +1411,6 @@ * Tasks can have attached prompts to them.

}
/**
* Listr Task after the renderer has been selected and renderer related options removed.
*/
type ListrRendererTask<SelectedRenderer extends ListrRendererFactory> = Task<any, SelectedRenderer, SelectedRenderer>;

@@ -1578,3 +1426,3 @@ /**

[ListrTaskEventType.ENABLED]: boolean;
[ListrTaskEventType.SUBTASK]: Task<any, any>[];
[ListrTaskEventType.SUBTASK]: Task<any, any, any>[];
[ListrTaskEventType.TITLE]: string;

@@ -1595,6 +1443,2 @@ [ListrTaskEventType.OUTPUT]: string;

type Unionize<T extends Record<PropertyKey, unknown>> = {
[P in keyof T]: T[P];
}[keyof T];
/**

@@ -1606,6 +1450,6 @@ * Create a new task list with Listr.

declare class Listr<Ctx = ListrContext, Renderer extends ListrRendererValue = ListrPrimaryRendererValue, FallbackRenderer extends ListrRendererValue = ListrSecondaryRendererValue> {
task: ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>> | ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>>[];
task: ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<FallbackRenderer>> | ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<Renderer>>[];
options?: ListrBaseClassOptions<Ctx, Renderer, FallbackRenderer>;
parentTask?: Task<any, any>;
tasks: Task<Ctx, ListrGetRendererClassFromValue<Renderer>>[];
parentTask?: Task<any, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<FallbackRenderer>>;
tasks: Task<Ctx, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<FallbackRenderer>>[];
errors: ListrError<Ctx>[];

@@ -1616,6 +1460,7 @@ ctx: Ctx;

rendererClass: ListrRendererFactory;
rendererClassOptions: ListrGetRendererOptions<ListrRendererFactory>;
rendererClassOptions: ListrGetRendererOptions<ListrGetRendererClassFromValue<Renderer> | ListrGetRendererClassFromValue<FallbackRenderer>>;
rendererSelection: ListrRendererSelection;
private concurrency;
private renderer;
constructor(task: ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>> | ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>>[], options?: ListrBaseClassOptions<Ctx, Renderer, FallbackRenderer>, parentTask?: Task<any, any>);
constructor(task: ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<FallbackRenderer>> | ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<Renderer>>[], options?: ListrBaseClassOptions<Ctx, Renderer, FallbackRenderer>, parentTask?: Task<any, ListrGetRendererClassFromValue<Renderer>, ListrGetRendererClassFromValue<FallbackRenderer>>);
add(tasks: ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>> | ListrTask<Ctx, ListrGetRendererClassFromValue<Renderer>>[]): void;

@@ -1627,23 +1472,2 @@ run(context?: Ctx): Promise<Ctx>;

/**
* Creates a new Listr2 task manager.
*
* Useful for creating a single instance of Listr2 with pre-set settings.
*
* @see {@link https://listr2.kilic.dev/listr/manager.html}
*/
declare class Manager<Ctx = ListrContext, Renderer extends ListrRendererValue = ListrPrimaryRendererValue, FallbackRenderer extends ListrRendererValue = ListrSecondaryRendererValue> {
options?: ListrBaseClassOptions<Ctx, Renderer, FallbackRenderer>;
errors: ListrError[];
tasks: ListrTask<ListrContext, ListrGetRendererClassFromValue<Renderer>>[];
constructor(options?: ListrBaseClassOptions<Ctx, Renderer, FallbackRenderer>);
get ctx(): Ctx;
set ctx(ctx: Ctx);
add<InjectCtx = Ctx>(tasks: ListrTask<InjectCtx, ListrGetRendererClassFromValue<Renderer>>[] | ((ctx?: InjectCtx) => ListrTask<InjectCtx, ListrGetRendererClassFromValue<Renderer>>[]), options?: ListrSubClassOptions<InjectCtx, Renderer>): void;
runAll<InjectCtx = Ctx>(options?: ListrBaseClassOptions<InjectCtx, Renderer, FallbackRenderer>): Promise<InjectCtx>;
newListr<InjectCtx, InjectRenderer extends ListrRendererValue = Renderer, InjectFallbackRenderer extends ListrRendererValue = FallbackRenderer>(tasks: ListrTask<InjectCtx, ListrGetRendererClassFromValue<InjectRenderer>>[], options?: ListrBaseClassOptions<InjectCtx, InjectRenderer, InjectFallbackRenderer>): Listr<InjectCtx, InjectRenderer, InjectFallbackRenderer>;
indent<InjectCtx = Ctx>(tasks: ListrTask<InjectCtx, ListrGetRendererClassFromValue<Renderer>>[] | ((ctx?: InjectCtx) => ListrTask<InjectCtx, ListrGetRendererClassFromValue<Renderer>>[]), options?: ListrBaseClassOptions<InjectCtx, Renderer, FallbackRenderer>, taskOptions?: Omit<ListrTask<InjectCtx, ListrGetRendererClassFromValue<Renderer>>, 'task'>): ListrTask<InjectCtx, ListrGetRendererClassFromValue<Renderer>>;
run<InjectCtx = Ctx>(tasks: ListrTask<InjectCtx, ListrGetRendererClassFromValue<Renderer>>[], options?: ListrBaseClassOptions<InjectCtx, Renderer, FallbackRenderer>): Promise<InjectCtx>;
}
export { ANSI_ESCAPE, ANSI_ESCAPE_CODES, BaseEventMap, Concurrency, DefaultRenderer, EnquirerPromptCancelOptions, EnquirerPromptInstance, EnquirerPromptOptions, EnquirerPromptOptionsMap, EnquirerPromptOptionsType, EnquirerPromptSettings, EnquirerPromptTypes, EventData, EventManager, EventMap, Figures, LISTR_DEFAULT_RENDERER_STYLE, LISTR_LOGGER_STDERR_LEVELS, LISTR_LOGGER_STYLE, Listr, ListrBaseClassOptions, ListrContext, ListrDefaultRenderer, ListrDefaultRendererCache, ListrDefaultRendererLogLevels, ListrDefaultRendererOptions, ListrDefaultRendererOptionsStyle, ListrDefaultRendererOutputBuffer, ListrDefaultRendererTask, ListrDefaultRendererTaskOptions, ListrDefaultRendererValue, ListrEnquirerPromptAdapter, ListrEnvironmentVariables, ListrError, ListrErrorTypes, ListrEventManager, ListrEventMap, ListrEventType, ListrGetRendererClassFromValue, ListrGetRendererOptions, ListrGetRendererTaskOptions, ListrGetRendererValueFromClass, ListrInquirerPromptAdapter, ListrLogLevels, ListrLogger, ListrLoggerOptions, ListrLoggerStyleMap, ListrOptions, ListrPrimaryRendererOptions, ListrPrimaryRendererValue, ListrPromptAdapter, ListrRenderer, ListrRendererCacheMap, ListrRendererError, ListrRendererFactory, ListrRendererOptions, ListrRendererValue, ListrSecondaryRendererOptions, ListrSecondaryRendererValue, ListrSilentRenderer, ListrSilentRendererOptions, ListrSilentRendererTask, ListrSilentRendererTaskOptions, ListrSilentRendererValue, ListrSimpleRenderer, ListrSimpleRendererCache, ListrSimpleRendererOptions, ListrSimpleRendererTask, ListrSimpleRendererTaskOptions, ListrSimpleRendererValue, ListrSubClassOptions, ListrTask, ListrTaskEventManager, ListrTaskEventMap, ListrTaskEventType, ListrTaskFn, ListrTaskMessage, Task as ListrTaskObject, ListrTaskPrompt, ListrTaskResult, ListrTaskRetry, ListrTaskState, TaskWrapper as ListrTaskWrapper, ListrTestRenderer, ListrTestRendererOptions, ListrTestRendererTask, ListrTestRendererTaskOptions, ListrTestRendererValue, ListrVerboseRenderer, ListrVerboseRendererCache, ListrVerboseRendererOptions, ListrVerboseRendererTask, ListrVerboseRendererTaskOptions, ListrVerboseRendererValue, LoggerField, LoggerFieldFn, LoggerFieldOptions, LoggerFormat, LoggerFormatOptions, Manager, PRESET_TIMER, PRESET_TIMESTAMP, PresetTimer, PresetTimestamp, ProcessOutput, ProcessOutputBuffer, ProcessOutputBufferEntry, ProcessOutputBufferOptions, ProcessOutputOptions, ProcessOutputRendererOptions, ProcessOutputStream, ProcessOutputStreamMap, PromptError, RendererLoggerOptions, RendererPresetTimer, RendererPresetTimestamp, SilentRenderer, SimpleRenderer, Spinner, SupportedRenderer, TestRenderer, TestRendererSerializer, TestRendererSerializerOutput, TestRendererSerializerTaskKeys, Unionize, VerboseRenderer, assertFunctionOrSelf, cleanseAnsi, cloneObject, color, createWritable, delay, figures, getRenderer, getRendererClass, indent, isObservable, isUnicodeSupported, parseTimer, parseTimestamp, splat };
export { ANSI_ESCAPE, ANSI_ESCAPE_CODES, BaseEventMap, Concurrency, DefaultRenderer, EventData, EventManager, EventMap, Figures, LISTR_DEFAULT_RENDERER_STYLE, LISTR_LOGGER_STDERR_LEVELS, LISTR_LOGGER_STYLE, Listr, ListrBaseClassOptions, ListrContext, ListrDefaultRenderer, ListrDefaultRendererCache, ListrDefaultRendererLogLevels, ListrDefaultRendererOptions, ListrDefaultRendererOptionsStyle, ListrDefaultRendererOutputBuffer, ListrDefaultRendererTask, ListrDefaultRendererTaskOptions, ListrDefaultRendererValue, ListrEnvironmentVariables, ListrError, ListrErrorTypes, ListrEventManager, ListrEventMap, ListrEventType, ListrGetRendererClassFromValue, ListrGetRendererOptions, ListrGetRendererTaskOptions, ListrGetRendererValueFromClass, ListrLogLevels, ListrLogger, ListrLoggerOptions, ListrLoggerStyleMap, ListrOptions, ListrPrimaryRendererOptions, ListrPrimaryRendererSelection, ListrPrimaryRendererTaskOptions, ListrPrimaryRendererValue, ListrPromptAdapter, ListrRenderer, ListrRendererCacheMap, ListrRendererError, ListrRendererFactory, ListrRendererOptions, ListrRendererSelection, ListrRendererTask, ListrRendererValue, ListrSecondaryRendererOptions, ListrSecondaryRendererSelection, ListrSecondaryRendererTaskOptions, ListrSecondaryRendererValue, ListrSilentRenderer, ListrSilentRendererOptions, ListrSilentRendererTask, ListrSilentRendererTaskOptions, ListrSilentRendererValue, ListrSimpleRenderer, ListrSimpleRendererCache, ListrSimpleRendererOptions, ListrSimpleRendererTask, ListrSimpleRendererTaskOptions, ListrSimpleRendererValue, ListrSubClassOptions, ListrTask, ListrTaskEventManager, ListrTaskEventMap, ListrTaskEventType, ListrTaskFn, ListrTaskMessage, Task as ListrTaskObject, ListrTaskPrompt, ListrTaskResult, ListrTaskRetry, ListrTaskState, TaskWrapper as ListrTaskWrapper, ListrTestRenderer, ListrTestRendererOptions, ListrTestRendererTask, ListrTestRendererTaskOptions, ListrTestRendererValue, ListrVerboseRenderer, ListrVerboseRendererCache, ListrVerboseRendererOptions, ListrVerboseRendererTask, ListrVerboseRendererTaskOptions, ListrVerboseRendererValue, LoggerField, LoggerFieldFn, LoggerFieldOptions, LoggerFormat, LoggerFormatOptions, PRESET_TIMER, PRESET_TIMESTAMP, PresetTimer, PresetTimestamp, ProcessOutput, ProcessOutputBuffer, ProcessOutputBufferEntry, ProcessOutputBufferOptions, ProcessOutputOptions, ProcessOutputRendererOptions, ProcessOutputStream, ProcessOutputStreamMap, PromptError, RendererLoggerOptions, RendererPresetTimer, RendererPresetTimestamp, SilentRenderer, SimpleRenderer, Spinner, SupportedRenderer, TestRenderer, TestRendererSerializer, TestRendererSerializerOutput, TestRendererSerializerTaskKeys, VerboseRenderer, assertFunctionOrSelf, cleanseAnsi, cloneObject, color, createWritable, delay, figures, getRenderer, getRendererClass, indent, isObservable, isUnicodeSupported, parseTimer, parseTimestamp, splat };
{
"name": "listr2",
"version": "7.0.0-beta.3",
"version": "7.0.0-beta.4",
"description": "Terminal task list reborn! Create beautiful CLI interfaces via easy and logical to implement task lists that feel alive and interactive.",

@@ -35,26 +35,15 @@ "license": "MIT",

"dev:start": "tsup-node --watch",
"example": "TS_NODE_PROJECT=examples/tsconfig.json NODE_OPTIONS='--no-warnings --experimental-specifier-resolution=node --experimental-vm-modules --loader ./loader.js' node",
"clean": "rimraf node_modules pnpm-lock.yaml",
"format": "prettier --log-level warn --write src/ tests/ examples/ docs/ && pnpm run lint --fix",
"lint": "eslint --ext .ts,.js,.tsx,.jsx src/ tests/ examples/ docs/",
"test": "TS_NODE_PROJECT=tests/tsconfig.json NODE_OPTIONS='--no-warnings --experimental-specifier-resolution=node --experimental-vm-modules' jest --config ./tests/jest.config.ts",
"format": "prettier --log-level warn --write src/ tests/ && pnpm run lint --fix",
"lint": "eslint --ext .ts,.js,.tsx,.jsx src/ tests/",
"test": "NO_COLOR=1 TS_NODE_PROJECT=tests/tsconfig.json NODE_OPTIONS='--no-warnings --experimental-specifier-resolution=node --experimental-vm-modules' jest --config tests/jest.config.ts",
"test:cov": "pnpm run test --coverage",
"test:dev": "NODE_OPTIONS='--no-warnings --experimental-specifier-resolution=node --experimental-vm-modules --inspect=0.0.0.0:9229' pnpm run test --verbose --watchAll",
"test:read-snapshot": "./tests/read-terminal-snapshots.sh",
"docs:build": "vuepress build docs && vuepress build docs",
"docs:dev:start": "vuepress dev docs",
"docs:dev:start:clean": "vuepress dev docs --clean-cache"
"test:dev": "NODE_OPTIONS='--no-warnings --experimental-specifier-resolution=node --experimental-vm-modules --inspect=0.0.0.0:9229' pnpm run test --verbose --watchAll"
},
"simple-git-hooks": {
"pre-commit": "[ -n \"$SKIP_GIT_HOOKS\" ] && true || pnpm exec lint-staged",
"prepare-commit-msg": "[ -t 1 ] && exec < /dev/tty && git cz --hook || true",
"pre-push": "[ -n \"$SKIP_GIT_HOOKS\" ] && true || pnpm run test"
},
"lint-staged": {
"*.{ts,js,tsx,jsx,spec.ts}": [
"prettier --loglevel warn --write",
"{src,tests}/**/*.{ts,js,tsx,jsx,spec.ts}": [
"prettier --log-level warn --write",
"eslint --fix"
],
"*.{json,md}": [
"prettier --loglevel warn --write"
"prettier --log-level warn --write"
]

@@ -89,54 +78,9 @@ },

"devDependencies": {
"@cenk1cenk2/cz-cc": "^1.6.7",
"@cenk1cenk2/eslint-config": "^2.7.18",
"@inquirer/input": "^1.2.11",
"@inquirer/prompts": "^3.1.1",
"@inquirer/type": "^1.1.3",
"@jest/globals": "^29.6.4",
"@swc/core": "1.3.82",
"@tsconfig/node16": "^16.1.1",
"@types/jest": "^29.5.4",
"@types/node": "^20.6.0",
"@inquirer/type": "^1.1.4",
"@types/wrap-ansi": "^8.0.1",
"@vuepress/client": "2.0.0-beta.67",
"@vuepress/plugin-docsearch": "2.0.0-beta.67",
"enquirer": "^2.4.1",
"eslint": "^8.49.0",
"execa": "^8.0.1",
"jest": "^29.6.4",
"jest-mock-process": "^2.0.0",
"lint-staged": "^14.0.1",
"prettier": "^3.0.3",
"rimraf": "^5.0.1",
"rxjs": "^7.8.1",
"simple-git-hooks": "^2.9.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"tsconfig-paths": "^4.2.0",
"tsup": "7.2.0",
"typedoc": "^0.25.1",
"typedoc-plugin-markdown": "^3.16.0",
"typescript": "^5.2.2",
"vue": "^3.3.4",
"vuepress": "2.0.0-beta.67",
"vuepress-plugin-typedoc": "0.13.0",
"vuepress-theme-hope": "2.0.0-beta.237"
},
"peerDependencies": {
"enquirer": ">= 2.3.0 < 3",
"@inquirer/prompts": ">= 3 < 4"
},
"peerDependenciesMeta": {
"enquirer": {
"optional": true
},
"@inquirer/prompts": {
"optional": true
}
},
"config": {
"commitizen": {
"path": "./node_modules/@cenk1cenk2/cz-cc"
}
"eslint": "^8.49.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc