RoadmapShopEvents
Skip to main content

Home > @rushstack/terminal > TextRewriterTransform

TextRewriterTransform class

A TerminalTransform subclass that performs one or more TextRewriter operations. The most common operations are NormalizeNewlinesTextRewriter and RemoveColorsTextRewriter.

Signature:

export declare class TextRewriterTransform extends TerminalTransform 

Extends: TerminalTransform

Remarks

The TextRewriter operations are applied separately to the stderr and stdout streams. If multiple ITextRewriterTransformOptions.textRewriters are configured, they are applied in the order that they appear in the array.

Constructors

ConstructorModifiersDescription
(constructor)(options)Constructs a new instance of the TextRewriterTransform class

Properties

PropertyModifiersTypeDescription
destinationreadonlyTerminalWritable

The target TerminalWritable that the TerminalTransform will write its output to.

(Inherited from TerminalTransform)

isOpenreadonlyboolean

This property is initially true when the object is constructed, and becomes false when close() is called.

(Inherited from TerminalWritable)

preventAutoclosereadonlyboolean(Inherited from TerminalWritable)
preventDestinationAutoclosereadonlyboolean

Prevents the TerminalTransform.destination object from being closed automatically when the transform is closed.

(Inherited from TerminalTransform)

textRewritersreadonlyReadonlyArray<TextRewriter>

Methods

MethodModifiersDescription
autocloseDestination()protected

The default implementation of TerminalTransform.onClose() calls this method, which closes the TerminalTransform.destination if appropriate.

(Inherited from TerminalTransform)

close()

Calling this method flushes any remaining outputs and permanently transitions the TerminalWritable to a "closed" state, where no further chunks can be written.

(Inherited from TerminalWritable)

onClose()protected
onWriteChunk(chunk)protected
writeChunk(chunk)

Upstream objects call this method to provide inputs to this object.

(Inherited from TerminalWritable)