@rushstack/terminal
Advanced tools
Comparing version 0.7.24 to 0.8.0
@@ -11,7 +11,35 @@ /** | ||
/// <reference types="node" /> | ||
import type { Brand } from '@rushstack/node-core-library'; | ||
import type { ITerminal } from '@rushstack/node-core-library'; | ||
import { NewlineKind } from '@rushstack/node-core-library'; | ||
import { Writable } from 'stream'; | ||
import { WritableOptions } from 'stream'; | ||
/** | ||
* Operations for working with text strings that contain | ||
* {@link https://en.wikipedia.org/wiki/ANSI_escape_code | ANSI escape codes}. | ||
* The most commonly used escape codes set the foreground/background color for console output. | ||
* @public | ||
*/ | ||
export declare class AnsiEscape { | ||
private static readonly _csiRegExp; | ||
private static readonly _sgrRegExp; | ||
private static readonly _backslashNRegExp; | ||
private static readonly _backslashRRegExp; | ||
static getEscapeSequenceForAnsiCode(code: number): string; | ||
/** | ||
* Returns the input text with all ANSI escape codes removed. For example, this is useful when saving | ||
* colorized console output to a log file. | ||
*/ | ||
static removeCodes(text: string): string; | ||
/** | ||
* Replaces ANSI escape codes with human-readable tokens. This is useful for unit tests | ||
* that compare text strings in test assertions or snapshot files. | ||
*/ | ||
static formatForTests(text: string, options?: IAnsiEscapeConvertForTestsOptions): string; | ||
private static _tryGetSgrFriendlyName; | ||
} | ||
/** | ||
* This class enables very basic {@link TerminalWritable.onWriteChunk} operations to be implemented | ||
@@ -37,2 +65,78 @@ * as a callback function, avoiding the need to define a subclass of `TerminalWritable`. | ||
/** | ||
* The static functions on this class are used to produce colored text | ||
* for use with a terminal that supports ANSI escape codes. | ||
* | ||
* Note that this API always generates color codes, regardless of whether | ||
* the process's stdout is a TTY. The reason is that, in a complex program, the | ||
* code that is generating strings often does not know were those strings will end | ||
* up. In some cases, the same log message may get printed both to a shell | ||
* that supports color AND to a log file that does not. | ||
* | ||
* @example | ||
* ```ts | ||
* console.log(Colorize.red('Red Text!')) | ||
* terminal.writeLine(Colorize.green('Green Text!'), ' ', Colorize.blue('Blue Text!')); | ||
*``` | ||
* | ||
* @public | ||
*/ | ||
export declare class Colorize { | ||
static black(text: string): string; | ||
static red(text: string): string; | ||
static green(text: string): string; | ||
static yellow(text: string): string; | ||
static blue(text: string): string; | ||
static magenta(text: string): string; | ||
static cyan(text: string): string; | ||
static white(text: string): string; | ||
static gray(text: string): string; | ||
static blackBackground(text: string): string; | ||
static redBackground(text: string): string; | ||
static greenBackground(text: string): string; | ||
static yellowBackground(text: string): string; | ||
static blueBackground(text: string): string; | ||
static magentaBackground(text: string): string; | ||
static cyanBackground(text: string): string; | ||
static whiteBackground(text: string): string; | ||
static grayBackground(text: string): string; | ||
static bold(text: string): string; | ||
static dim(text: string): string; | ||
static underline(text: string): string; | ||
static blink(text: string): string; | ||
static invertColor(text: string): string; | ||
static hidden(text: string): string; | ||
private static _wrapTextInAnsiEscapeCodes; | ||
} | ||
/** | ||
* Terminal provider that prints to STDOUT (for log- and verbose-level messages) and | ||
* STDERR (for warning- and error-level messsages). | ||
* | ||
* @beta | ||
*/ | ||
export declare class ConsoleTerminalProvider implements ITerminalProvider { | ||
/** | ||
* If true, verbose-level messages should be written to the console. | ||
*/ | ||
verboseEnabled: boolean; | ||
/** | ||
* If true, debug-level messages should be written to the console. | ||
*/ | ||
debugEnabled: boolean; | ||
constructor(options?: Partial<IConsoleTerminalProviderOptions>); | ||
/** | ||
* {@inheritDoc ITerminalProvider.write} | ||
*/ | ||
write(data: string, severity: TerminalProviderSeverity): void; | ||
/** | ||
* {@inheritDoc ITerminalProvider.eolCharacter} | ||
*/ | ||
get eolCharacter(): string; | ||
/** | ||
* {@inheritDoc ITerminalProvider.supportsColor} | ||
*/ | ||
get supportsColor(): boolean; | ||
} | ||
/** | ||
* A sensible fallback column width for consoles. | ||
@@ -91,2 +195,13 @@ * | ||
/** | ||
* Options for {@link AnsiEscape.formatForTests}. | ||
* @public | ||
*/ | ||
export declare interface IAnsiEscapeConvertForTestsOptions { | ||
/** | ||
* If true then `\n` will be replaced by `[n]`, and `\r` will be replaced by `[r]`. | ||
*/ | ||
encodeNewlines?: boolean; | ||
} | ||
/** | ||
* Constructor options for {@link CallbackWritable}. | ||
@@ -100,2 +215,20 @@ * @public | ||
/** | ||
* Options to be provided to a {@link ConsoleTerminalProvider} | ||
* | ||
* @beta | ||
*/ | ||
export declare interface IConsoleTerminalProviderOptions { | ||
/** | ||
* If true, print verbose logging messages. | ||
*/ | ||
verboseEnabled: boolean; | ||
/** | ||
* If true, print debug logging messages. Note that "verbose" and "debug" are considered | ||
* separate message filters; if you want debug to imply verbose, it is up to your | ||
* application code to enforce that. | ||
*/ | ||
debugEnabled: boolean; | ||
} | ||
/** | ||
* Constructor options for {@link DiscardStdoutTransform} | ||
@@ -109,2 +242,15 @@ * | ||
/** | ||
* Options for {@link PrefixProxyTerminalProvider}. | ||
* | ||
* @beta | ||
*/ | ||
export declare interface IDynamicPrefixProxyTerminalProviderOptions extends IPrefixProxyTerminalProviderOptionsBase { | ||
/** | ||
* A function that returns the prefix that should be added to each line of output. This is useful | ||
* for prefixing each line with a timestamp. | ||
*/ | ||
getPrefix: () => string; | ||
} | ||
/** | ||
* Constructor options for {@link NormalizeNewlinesTextRewriter} | ||
@@ -131,2 +277,17 @@ * | ||
/** | ||
* @beta | ||
*/ | ||
export declare type IPrefixProxyTerminalProviderOptions = IStaticPrefixProxyTerminalProviderOptions | IDynamicPrefixProxyTerminalProviderOptions; | ||
/** | ||
* @beta | ||
*/ | ||
export declare interface IPrefixProxyTerminalProviderOptionsBase { | ||
/** | ||
* The {@link ITerminalProvider} that will be wrapped. | ||
*/ | ||
terminalProvider: ITerminalProvider; | ||
} | ||
/** | ||
* Constructor options for {@link SplitterTransform}. | ||
@@ -144,2 +305,14 @@ * | ||
/** | ||
* Options for {@link PrefixProxyTerminalProvider}, with a static prefix. | ||
* | ||
* @beta | ||
*/ | ||
export declare interface IStaticPrefixProxyTerminalProviderOptions extends IPrefixProxyTerminalProviderOptionsBase { | ||
/** | ||
* The prefix that should be added to each line of output. | ||
*/ | ||
prefix: string; | ||
} | ||
/** | ||
* Constructor options for {@link StderrLineTransform} | ||
@@ -173,2 +346,81 @@ * @beta | ||
/** | ||
* @beta | ||
*/ | ||
export declare interface IStringBufferOutputOptions { | ||
/** | ||
* If set to true, special characters like \\n, \\r, and the \\u001b character | ||
* in color control tokens will get normalized to [-n-], [-r-], and [-x-] respectively | ||
* | ||
* This option defaults to `true` | ||
*/ | ||
normalizeSpecialCharacters: boolean; | ||
} | ||
/** | ||
* @beta | ||
*/ | ||
export declare interface ITerminal { | ||
/** | ||
* Subscribe a new terminal provider. | ||
*/ | ||
registerProvider(provider: ITerminalProvider): void; | ||
/** | ||
* Unsubscribe a terminal provider. If the provider isn't subscribed, this function does nothing. | ||
*/ | ||
unregisterProvider(provider: ITerminalProvider): void; | ||
/** | ||
* Write a generic message to the terminal | ||
*/ | ||
write(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* Write a generic message to the terminal, followed by a newline | ||
*/ | ||
writeLine(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* Write a warning message to the console with yellow text. | ||
* | ||
* @remarks | ||
* The yellow color takes precedence over any other foreground colors set. | ||
*/ | ||
writeWarning(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* Write a warning message to the console with yellow text, followed by a newline. | ||
* | ||
* @remarks | ||
* The yellow color takes precedence over any other foreground colors set. | ||
*/ | ||
writeWarningLine(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* Write an error message to the console with red text. | ||
* | ||
* @remarks | ||
* The red color takes precedence over any other foreground colors set. | ||
*/ | ||
writeError(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* Write an error message to the console with red text, followed by a newline. | ||
* | ||
* @remarks | ||
* The red color takes precedence over any other foreground colors set. | ||
*/ | ||
writeErrorLine(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* Write a verbose-level message. | ||
*/ | ||
writeVerbose(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* Write a verbose-level message followed by a newline. | ||
*/ | ||
writeVerboseLine(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* Write a debug-level message. | ||
*/ | ||
writeDebug(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* Write a debug-level message followed by a newline. | ||
*/ | ||
writeDebugLine(...messageParts: TerminalWriteParameters): void; | ||
} | ||
/** | ||
* Represents a chunk of output that will ultimately be written to a {@link TerminalWritable}. | ||
@@ -205,2 +457,51 @@ * | ||
/** | ||
* Implement the interface to create a terminal provider. Terminal providers | ||
* can be registered to a {@link Terminal} instance to receive messages. | ||
* | ||
* @beta | ||
*/ | ||
export declare interface ITerminalProvider { | ||
/** | ||
* This property should return true only if the terminal provider supports | ||
* rendering console colors. | ||
*/ | ||
supportsColor: boolean; | ||
/** | ||
* This property should return the newline character the terminal provider | ||
* expects. | ||
*/ | ||
eolCharacter: string; | ||
/** | ||
* This function gets called on every terminal provider upon every | ||
* message function call on the terminal instance. | ||
* | ||
* @param data - The terminal message. | ||
* @param severity - The message severity. Terminal providers can | ||
* route different kinds of messages to different streams and may choose | ||
* to ignore verbose or debug messages. | ||
*/ | ||
write(data: string, severity: TerminalProviderSeverity): void; | ||
} | ||
/** | ||
* Options for {@link TerminalStreamWritable}. | ||
* | ||
* @beta | ||
*/ | ||
export declare interface ITerminalStreamWritableOptions { | ||
/** | ||
* The {@link ITerminal} that the Writable will write to. | ||
*/ | ||
terminal: ITerminal; | ||
/** | ||
* The severity of the messages that will be written to the {@link ITerminal}. | ||
*/ | ||
severity: TerminalProviderSeverity; | ||
/** | ||
* Options for the underlying Writable. | ||
*/ | ||
writableOptions?: WritableOptions; | ||
} | ||
/** | ||
* Constructor options for {@link TerminalTransform}. | ||
@@ -250,2 +551,13 @@ * | ||
/** | ||
* @beta | ||
*/ | ||
export declare interface ITerminalWriteOptions { | ||
/** | ||
* If set to true, SGR parameters will not be replaced by the terminal | ||
* standard (i.e. - red for errors, yellow for warnings). | ||
*/ | ||
doNotOverrideSgrCodes?: boolean; | ||
} | ||
/** | ||
* Constructor options for {@link TextRewriterTransform}. | ||
@@ -321,2 +633,22 @@ * | ||
/** | ||
* Wraps an existing {@link ITerminalProvider} that prefixes each line of output with a specified | ||
* prefix string. | ||
* | ||
* @beta | ||
*/ | ||
export declare class PrefixProxyTerminalProvider implements ITerminalProvider { | ||
private readonly _parentTerminalProvider; | ||
private readonly _getPrefix; | ||
private readonly _newlineRegex; | ||
private _isOnNewline; | ||
constructor(options: IPrefixProxyTerminalProviderOptions); | ||
/** @override */ | ||
get supportsColor(): boolean; | ||
/** @override */ | ||
get eolCharacter(): string; | ||
/** @override */ | ||
write(data: string, severity: TerminalProviderSeverity): void; | ||
} | ||
/** | ||
* A collection of utilities for printing messages to the console. | ||
@@ -546,2 +878,113 @@ * | ||
/** | ||
* Terminal provider that stores written data in buffers separated by severity. | ||
* This terminal provider is designed to be used when code that prints to a terminal | ||
* is being unit tested. | ||
* | ||
* @beta | ||
*/ | ||
export declare class StringBufferTerminalProvider implements ITerminalProvider { | ||
private _standardBuffer; | ||
private _verboseBuffer; | ||
private _debugBuffer; | ||
private _warningBuffer; | ||
private _errorBuffer; | ||
private _supportsColor; | ||
constructor(supportsColor?: boolean); | ||
/** | ||
* {@inheritDoc ITerminalProvider.write} | ||
*/ | ||
write(data: string, severity: TerminalProviderSeverity): void; | ||
/** | ||
* {@inheritDoc ITerminalProvider.eolCharacter} | ||
*/ | ||
get eolCharacter(): string; | ||
/** | ||
* {@inheritDoc ITerminalProvider.supportsColor} | ||
*/ | ||
get supportsColor(): boolean; | ||
/** | ||
* Get everything that has been written at log-level severity. | ||
*/ | ||
getOutput(options?: IStringBufferOutputOptions): string; | ||
/** | ||
* Get everything that has been written at verbose-level severity. | ||
*/ | ||
getVerbose(options?: IStringBufferOutputOptions): string; | ||
/** | ||
* Get everything that has been written at debug-level severity. | ||
*/ | ||
getDebugOutput(options?: IStringBufferOutputOptions): string; | ||
/** | ||
* Get everything that has been written at error-level severity. | ||
*/ | ||
getErrorOutput(options?: IStringBufferOutputOptions): string; | ||
/** | ||
* Get everything that has been written at warning-level severity. | ||
*/ | ||
getWarningOutput(options?: IStringBufferOutputOptions): string; | ||
private _normalizeOutput; | ||
} | ||
/** | ||
* This class facilitates writing to a console. | ||
* | ||
* @beta | ||
*/ | ||
export declare class Terminal implements ITerminal { | ||
private _providers; | ||
constructor(provider: ITerminalProvider); | ||
/** | ||
* {@inheritdoc ITerminal.registerProvider} | ||
*/ | ||
registerProvider(provider: ITerminalProvider): void; | ||
/** | ||
* {@inheritdoc ITerminal.unregisterProvider} | ||
*/ | ||
unregisterProvider(provider: ITerminalProvider): void; | ||
/** | ||
* {@inheritdoc ITerminal.write} | ||
*/ | ||
write(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* {@inheritdoc ITerminal.writeLine} | ||
*/ | ||
writeLine(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* {@inheritdoc ITerminal.writeWarning} | ||
*/ | ||
writeWarning(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* {@inheritdoc ITerminal.writeWarningLine} | ||
*/ | ||
writeWarningLine(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* {@inheritdoc ITerminal.writeError} | ||
*/ | ||
writeError(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* {@inheritdoc ITerminal.writeErrorLine} | ||
*/ | ||
writeErrorLine(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* {@inheritdoc ITerminal.writeVerbose} | ||
*/ | ||
writeVerbose(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* {@inheritdoc ITerminal.writeVerboseLine} | ||
*/ | ||
writeVerboseLine(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* {@inheritdoc ITerminal.writeDebug} | ||
*/ | ||
writeDebug(...messageParts: TerminalWriteParameters): void; | ||
/** | ||
* {@inheritdoc ITerminal.writeDebugLine} | ||
*/ | ||
writeDebugLine(...messageParts: TerminalWriteParameters): void; | ||
private _writeSegmentsToProviders; | ||
private _serializeLegacyColorableSequence; | ||
private _normalizeWriteParameters; | ||
} | ||
/** | ||
* Specifies the kind of data represented by a {@link ITerminalChunk} object. | ||
@@ -562,2 +1005,39 @@ * @public | ||
/** | ||
* Similar to many popular logging packages, terminal providers support a range of message | ||
* severities. These severities have built-in formatting defaults in the Terminal object | ||
* (warnings are yellow, errors are red, etc.). | ||
* | ||
* Terminal providers may choose to suppress certain messages based on their severity, | ||
* or to route some messages to other providers or not based on severity. | ||
* | ||
* Severity | Purpose | ||
* --------- | ------- | ||
* error | Build errors and fatal issues | ||
* warning | Not necessarily fatal, but indicate a problem the user should fix | ||
* log | Informational messages | ||
* verbose | Additional information that may not always be necessary | ||
* debug | Highest detail level, best used for troubleshooting information | ||
* | ||
* @beta | ||
*/ | ||
export declare enum TerminalProviderSeverity { | ||
log = 0, | ||
warning = 1, | ||
error = 2, | ||
verbose = 3, | ||
debug = 4 | ||
} | ||
/** | ||
* A adapter to allow writing to a provided terminal using Writable streams. | ||
* | ||
* @beta | ||
*/ | ||
export declare class TerminalStreamWritable extends Writable { | ||
private _writeMethod; | ||
constructor(options: ITerminalStreamWritableOptions); | ||
_write(chunk: string | Buffer | Uint8Array, encoding: string, callback: (error?: Error | null) => void): void; | ||
} | ||
/** | ||
* The abstract base class for {@link TerminalWritable} objects that receive an input, | ||
@@ -609,3 +1089,3 @@ * transform it somehow, and then write the output to another `TerminalWritable`. | ||
* a console application. This output is typically prepared using | ||
* the {@link @rushstack/node-core-library#Terminal} API. | ||
* the {@link Terminal} API. | ||
* | ||
@@ -713,2 +1193,7 @@ * @remarks | ||
/** | ||
* @beta | ||
*/ | ||
export declare type TerminalWriteParameters = string[] | [...string[], ITerminalWriteOptions]; | ||
/** | ||
* The abstract base class for operations that can be applied by {@link TextRewriterTransform}. | ||
@@ -715,0 +1200,0 @@ * |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
"packageName": "@microsoft/api-extractor", | ||
"packageVersion": "7.40.1" | ||
"packageVersion": "7.39.1" | ||
} | ||
] | ||
} |
@@ -10,17 +10,26 @@ /** | ||
*/ | ||
export * from './CallbackWritable'; | ||
export * from './DiscardStdoutTransform'; | ||
export * from './ITerminalChunk'; | ||
export * from './MockWritable'; | ||
export * from './NormalizeNewlinesTextRewriter'; | ||
export * from './PrintUtilities'; | ||
export * from './RemoveColorsTextRewriter'; | ||
export * from './SplitterTransform'; | ||
export * from './StdioLineTransform'; | ||
export * from './StdioSummarizer'; | ||
export * from './StdioWritable'; | ||
export * from './TerminalTransform'; | ||
export * from './TerminalWritable'; | ||
export * from './TextRewriter'; | ||
export * from './TextRewriterTransform'; | ||
export { ICallbackWritableOptions, CallbackWritable } from './CallbackWritable'; | ||
export { IDiscardStdoutTransformOptions, DiscardStdoutTransform } from './DiscardStdoutTransform'; | ||
export { TerminalChunkKind, ITerminalChunk } from './ITerminalChunk'; | ||
export { MockWritable } from './MockWritable'; | ||
export { INormalizeNewlinesTextRewriterOptions, NormalizeNewlinesTextRewriter } from './NormalizeNewlinesTextRewriter'; | ||
export { DEFAULT_CONSOLE_WIDTH, PrintUtilities } from './PrintUtilities'; | ||
export { RemoveColorsTextRewriter } from './RemoveColorsTextRewriter'; | ||
export { ISplitterTransformOptions, SplitterTransform } from './SplitterTransform'; | ||
export { IStdioLineTransformOptions, StderrLineTransform } from './StdioLineTransform'; | ||
export { IStdioSummarizerOptions, StdioSummarizer } from './StdioSummarizer'; | ||
export { StdioWritable } from './StdioWritable'; | ||
export { ITerminalTransformOptions, TerminalTransform } from './TerminalTransform'; | ||
export { ITerminalWritableOptions, TerminalWritable } from './TerminalWritable'; | ||
export { TextRewriterState, TextRewriter } from './TextRewriter'; | ||
export { ITextRewriterTransformOptions, TextRewriterTransform } from './TextRewriterTransform'; | ||
export { AnsiEscape, IAnsiEscapeConvertForTestsOptions } from './AnsiEscape'; | ||
export { ITerminal, TerminalWriteParameters, ITerminalWriteOptions } from './ITerminal'; | ||
export { Terminal } from './Terminal'; | ||
export { Colorize } from './Colorize'; | ||
export { ITerminalProvider, TerminalProviderSeverity } from './ITerminalProvider'; | ||
export { ConsoleTerminalProvider, IConsoleTerminalProviderOptions } from './ConsoleTerminalProvider'; | ||
export { StringBufferTerminalProvider, IStringBufferOutputOptions } from './StringBufferTerminalProvider'; | ||
export { PrefixProxyTerminalProvider, IPrefixProxyTerminalProviderOptions, IDynamicPrefixProxyTerminalProviderOptions, IPrefixProxyTerminalProviderOptionsBase, IStaticPrefixProxyTerminalProviderOptions } from './PrefixProxyTerminalProvider'; | ||
export { TerminalStreamWritable, ITerminalStreamWritableOptions } from './TerminalStreamWritable'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
// See LICENSE in the project root for license information. | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TerminalStreamWritable = exports.PrefixProxyTerminalProvider = exports.StringBufferTerminalProvider = exports.ConsoleTerminalProvider = exports.TerminalProviderSeverity = exports.Colorize = exports.Terminal = exports.AnsiEscape = exports.TextRewriterTransform = exports.TextRewriter = exports.TerminalWritable = exports.TerminalTransform = exports.StdioWritable = exports.StdioSummarizer = exports.StderrLineTransform = exports.SplitterTransform = exports.RemoveColorsTextRewriter = exports.PrintUtilities = exports.DEFAULT_CONSOLE_WIDTH = exports.NormalizeNewlinesTextRewriter = exports.MockWritable = exports.DiscardStdoutTransform = exports.CallbackWritable = void 0; | ||
/** | ||
@@ -28,17 +15,47 @@ * This library implements a system for processing human readable text that | ||
*/ | ||
__exportStar(require("./CallbackWritable"), exports); | ||
__exportStar(require("./DiscardStdoutTransform"), exports); | ||
__exportStar(require("./ITerminalChunk"), exports); | ||
__exportStar(require("./MockWritable"), exports); | ||
__exportStar(require("./NormalizeNewlinesTextRewriter"), exports); | ||
__exportStar(require("./PrintUtilities"), exports); | ||
__exportStar(require("./RemoveColorsTextRewriter"), exports); | ||
__exportStar(require("./SplitterTransform"), exports); | ||
__exportStar(require("./StdioLineTransform"), exports); | ||
__exportStar(require("./StdioSummarizer"), exports); | ||
__exportStar(require("./StdioWritable"), exports); | ||
__exportStar(require("./TerminalTransform"), exports); | ||
__exportStar(require("./TerminalWritable"), exports); | ||
__exportStar(require("./TextRewriter"), exports); | ||
__exportStar(require("./TextRewriterTransform"), exports); | ||
var CallbackWritable_1 = require("./CallbackWritable"); | ||
Object.defineProperty(exports, "CallbackWritable", { enumerable: true, get: function () { return CallbackWritable_1.CallbackWritable; } }); | ||
var DiscardStdoutTransform_1 = require("./DiscardStdoutTransform"); | ||
Object.defineProperty(exports, "DiscardStdoutTransform", { enumerable: true, get: function () { return DiscardStdoutTransform_1.DiscardStdoutTransform; } }); | ||
var MockWritable_1 = require("./MockWritable"); | ||
Object.defineProperty(exports, "MockWritable", { enumerable: true, get: function () { return MockWritable_1.MockWritable; } }); | ||
var NormalizeNewlinesTextRewriter_1 = require("./NormalizeNewlinesTextRewriter"); | ||
Object.defineProperty(exports, "NormalizeNewlinesTextRewriter", { enumerable: true, get: function () { return NormalizeNewlinesTextRewriter_1.NormalizeNewlinesTextRewriter; } }); | ||
var PrintUtilities_1 = require("./PrintUtilities"); | ||
Object.defineProperty(exports, "DEFAULT_CONSOLE_WIDTH", { enumerable: true, get: function () { return PrintUtilities_1.DEFAULT_CONSOLE_WIDTH; } }); | ||
Object.defineProperty(exports, "PrintUtilities", { enumerable: true, get: function () { return PrintUtilities_1.PrintUtilities; } }); | ||
var RemoveColorsTextRewriter_1 = require("./RemoveColorsTextRewriter"); | ||
Object.defineProperty(exports, "RemoveColorsTextRewriter", { enumerable: true, get: function () { return RemoveColorsTextRewriter_1.RemoveColorsTextRewriter; } }); | ||
var SplitterTransform_1 = require("./SplitterTransform"); | ||
Object.defineProperty(exports, "SplitterTransform", { enumerable: true, get: function () { return SplitterTransform_1.SplitterTransform; } }); | ||
var StdioLineTransform_1 = require("./StdioLineTransform"); | ||
Object.defineProperty(exports, "StderrLineTransform", { enumerable: true, get: function () { return StdioLineTransform_1.StderrLineTransform; } }); | ||
var StdioSummarizer_1 = require("./StdioSummarizer"); | ||
Object.defineProperty(exports, "StdioSummarizer", { enumerable: true, get: function () { return StdioSummarizer_1.StdioSummarizer; } }); | ||
var StdioWritable_1 = require("./StdioWritable"); | ||
Object.defineProperty(exports, "StdioWritable", { enumerable: true, get: function () { return StdioWritable_1.StdioWritable; } }); | ||
var TerminalTransform_1 = require("./TerminalTransform"); | ||
Object.defineProperty(exports, "TerminalTransform", { enumerable: true, get: function () { return TerminalTransform_1.TerminalTransform; } }); | ||
var TerminalWritable_1 = require("./TerminalWritable"); | ||
Object.defineProperty(exports, "TerminalWritable", { enumerable: true, get: function () { return TerminalWritable_1.TerminalWritable; } }); | ||
var TextRewriter_1 = require("./TextRewriter"); | ||
Object.defineProperty(exports, "TextRewriter", { enumerable: true, get: function () { return TextRewriter_1.TextRewriter; } }); | ||
var TextRewriterTransform_1 = require("./TextRewriterTransform"); | ||
Object.defineProperty(exports, "TextRewriterTransform", { enumerable: true, get: function () { return TextRewriterTransform_1.TextRewriterTransform; } }); | ||
var AnsiEscape_1 = require("./AnsiEscape"); | ||
Object.defineProperty(exports, "AnsiEscape", { enumerable: true, get: function () { return AnsiEscape_1.AnsiEscape; } }); | ||
var Terminal_1 = require("./Terminal"); | ||
Object.defineProperty(exports, "Terminal", { enumerable: true, get: function () { return Terminal_1.Terminal; } }); | ||
var Colorize_1 = require("./Colorize"); | ||
Object.defineProperty(exports, "Colorize", { enumerable: true, get: function () { return Colorize_1.Colorize; } }); | ||
var ITerminalProvider_1 = require("./ITerminalProvider"); | ||
Object.defineProperty(exports, "TerminalProviderSeverity", { enumerable: true, get: function () { return ITerminalProvider_1.TerminalProviderSeverity; } }); | ||
var ConsoleTerminalProvider_1 = require("./ConsoleTerminalProvider"); | ||
Object.defineProperty(exports, "ConsoleTerminalProvider", { enumerable: true, get: function () { return ConsoleTerminalProvider_1.ConsoleTerminalProvider; } }); | ||
var StringBufferTerminalProvider_1 = require("./StringBufferTerminalProvider"); | ||
Object.defineProperty(exports, "StringBufferTerminalProvider", { enumerable: true, get: function () { return StringBufferTerminalProvider_1.StringBufferTerminalProvider; } }); | ||
var PrefixProxyTerminalProvider_1 = require("./PrefixProxyTerminalProvider"); | ||
Object.defineProperty(exports, "PrefixProxyTerminalProvider", { enumerable: true, get: function () { return PrefixProxyTerminalProvider_1.PrefixProxyTerminalProvider; } }); | ||
var TerminalStreamWritable_1 = require("./TerminalStreamWritable"); | ||
Object.defineProperty(exports, "TerminalStreamWritable", { enumerable: true, get: function () { return TerminalStreamWritable_1.TerminalStreamWritable; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -6,4 +6,4 @@ "use strict"; | ||
exports.MockWritable = void 0; | ||
const AnsiEscape_1 = require("./AnsiEscape"); | ||
const TerminalWritable_1 = require("./TerminalWritable"); | ||
const node_core_library_1 = require("@rushstack/node-core-library"); | ||
/** | ||
@@ -26,6 +26,6 @@ * A {@link TerminalWritable} subclass for use by unit tests. | ||
getAllOutput() { | ||
return node_core_library_1.AnsiEscape.formatForTests(this.chunks.map((x) => x.text).join('')); | ||
return AnsiEscape_1.AnsiEscape.formatForTests(this.chunks.map((x) => x.text).join('')); | ||
} | ||
getFormattedChunks() { | ||
return this.chunks.map((x) => (Object.assign(Object.assign({}, x), { text: node_core_library_1.AnsiEscape.formatForTests(x.text) }))); | ||
return this.chunks.map((x) => (Object.assign(Object.assign({}, x), { text: AnsiEscape_1.AnsiEscape.formatForTests(x.text) }))); | ||
} | ||
@@ -32,0 +32,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import type { ITerminal } from '@rushstack/node-core-library'; | ||
import type { ITerminal } from './ITerminal'; | ||
/** | ||
@@ -3,0 +3,0 @@ * A sensible fallback column width for consoles. |
@@ -6,3 +6,3 @@ "use strict"; | ||
exports.RemoveColorsTextRewriter = void 0; | ||
const node_core_library_1 = require("@rushstack/node-core-library"); | ||
const AnsiEscape_1 = require("./AnsiEscape"); | ||
const TextRewriter_1 = require("./TextRewriter"); | ||
@@ -79,3 +79,3 @@ var State; | ||
if (code < 0x20 || code > 0x3f) { | ||
result += node_core_library_1.AnsiEscape.removeCodes(state.buffer); | ||
result += AnsiEscape_1.AnsiEscape.removeCodes(state.buffer); | ||
state.buffer = ''; | ||
@@ -82,0 +82,0 @@ state.parseState = State.Start; |
@@ -24,3 +24,3 @@ import type { ITerminalChunk } from './ITerminalChunk'; | ||
* a console application. This output is typically prepared using | ||
* the {@link @rushstack/node-core-library#Terminal} API. | ||
* the {@link Terminal} API. | ||
* | ||
@@ -27,0 +27,0 @@ * @remarks |
@@ -9,3 +9,3 @@ "use strict"; | ||
* a console application. This output is typically prepared using | ||
* the {@link @rushstack/node-core-library#Terminal} API. | ||
* the {@link Terminal} API. | ||
* | ||
@@ -12,0 +12,0 @@ * @remarks |
{ | ||
"name": "@rushstack/terminal", | ||
"version": "0.7.24", | ||
"version": "0.8.0", | ||
"description": "User interface primitives for console applications", | ||
@@ -14,8 +14,11 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@rushstack/node-core-library": "3.66.1" | ||
"@rushstack/node-core-library": "4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@rushstack/heft": "0.64.0", | ||
"@rushstack/heft-node-rig": "2.4.0", | ||
"@types/heft-jest": "1.0.1", | ||
"@types/node": "18.17.15", | ||
"colors": "~1.2.1", | ||
"local-node-rig": "1.0.0", | ||
"@rushstack/heft": "0.64.7" | ||
"local-eslint-config": "1.0.0" | ||
}, | ||
@@ -22,0 +25,0 @@ "peerDependencies": { |
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 not supported yet
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 not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
357728
105
4617
6
+ Added@rushstack/node-core-library@4.0.0(transitive)
- Removed@rushstack/node-core-library@3.66.1(transitive)