[terminal] Allow adding/removing destinations from the SplitterTransform after creation #5386
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Updates the API contract for the
SplitterTransformto support adding and removing destinations after creation. This is useful for pipelines where a plugin may wish to temporarily listen to the terminal output and direct it somewhere, e.g. over a websocket connection.Details
Adds new
addDestinationandremoveDestinationAPIs toSplitterTransform. Updates the underlying implementation of the collection to use a Set instead of an array to simplify removal and deduplication during add. Updates the constructor arguments to accept anyIterable<TerminalWritable>so that the caller can pass aSetor other collection rather than requiring explicitly an array.As an unrelated change, also fixed an issue with the
heft-swc-testproject that it was not cleaning the correct folders, causing breaks during local development.How it was tested
Added unit tests for all the functionality on
SplitterTransform.Impacted documentation
API Documentation for
@rushstack/terminal.