@builder.io/dev-tools
Version:
Builder.io Visual CMS Devtools
51 lines (50 loc) • 1.58 kB
TypeScript
/**
* Simple terminal buffer that handles basic control sequences
* to properly represent what would be shown in a real terminal
*/
export declare class TerminalBuffer {
private lines;
private currentLine;
private currentColumn;
private maxLines;
private maxColumns;
private chunks;
constructor(maxLines?: number, maxColumns?: number);
write(data: string): void;
private ensureLineExists;
getWrite(): string;
getContent(): string;
clear(): void;
/**
* Like getContent(), but collapses runs of consecutive similar lines
* (e.g. webpack progress, npm install steps) into a summary.
*/
getCompactContent(opts?: {
minPrefixLength?: number;
minRunLength?: number;
maxLines?: number;
}): string;
/**
* Collapse runs of 3+ consecutive lines that share a long common prefix.
* Keeps the first and last line of each run and inserts a count summary.
* When maxLines is set, keeps the last maxLines from the result and
* prepends a truncation notice.
*/
static collapseRepetitiveLines(text: string, { minPrefixLength, minRunLength, maxLines }?: {
minPrefixLength?: number;
minRunLength?: number;
maxLines?: number;
}): string;
private static commonPrefixLength;
/**
* Get current cursor position for testing/debugging
*/
getCursorPosition(): {
line: number;
column: number;
};
/**
* Get the current number of lines for testing/debugging
*/
getLineCount(): number;
}