You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@rushstack/terminal

Package Overview
Dependencies
Maintainers
3
Versions
335
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rushstack/terminal - npm Package Compare versions

Comparing version
0.16.0
to
0.17.0
+13
lib/IProblemCollector.d.ts
import type { IProblem } from '@rushstack/problem-matcher';
/**
* Collects problems (errors/warnings/info) encountered during an operation.
*
* @beta
*/
export interface IProblemCollector {
/**
* Returns the collected problems so far.
*/
get problems(): ReadonlySet<IProblem>;
}
//# sourceMappingURL=IProblemCollector.d.ts.map
{"version":3,"file":"IProblemCollector.d.ts","sourceRoot":"","sources":["../src/IProblemCollector.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAE3D;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,IAAI,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC;CACvC"}
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IProblemCollector.js.map
{"version":3,"file":"IProblemCollector.js","sourceRoot":"","sources":["../src/IProblemCollector.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { IProblem } from '@rushstack/problem-matcher';\n\n/**\n * Collects problems (errors/warnings/info) encountered during an operation.\n *\n * @beta\n */\nexport interface IProblemCollector {\n /**\n * Returns the collected problems so far.\n */\n get problems(): ReadonlySet<IProblem>;\n}\n"]}
import type { IProblemMatcher, IProblemMatcherJson, IProblem } from '@rushstack/problem-matcher';
import type { ITerminalChunk } from './ITerminalChunk';
import { type ITerminalWritableOptions, TerminalWritable } from './TerminalWritable';
import type { IProblemCollector } from './IProblemCollector';
/**
* Constructor options for {@link ProblemCollector}.
* @beta
*/
export interface IProblemCollectorOptions extends ITerminalWritableOptions {
/**
* The set of matchers that will be applied to each incoming line. Must contain at least one item.
*/
matchers?: IProblemMatcher[];
/**
* VS Code style problem matcher definitions. These will be converted to
* {@link @rushstack/problem-matcher#IProblemMatcher | IProblemMatcher} definitions.
*/
matcherJson?: IProblemMatcherJson[];
}
/**
* A {@link TerminalWritable} that consumes line-oriented terminal output and extracts structured
* problems using one or more {@link @rushstack/problem-matcher#IProblemMatcher | IProblemMatcher} instances.
*
* @remarks
* This collector expects that each incoming {@link ITerminalChunk} represents a single line terminated
* by a `"\n"` character (for example when preceded by {@link StderrLineTransform} / `StdioLineTransform`).
* If a chunk does not end with a newline an error is thrown to surface incorrect pipeline wiring early.
*
* @beta
*/
export declare class ProblemCollector extends TerminalWritable implements IProblemCollector {
private readonly _matchers;
private readonly _problems;
constructor(options: IProblemCollectorOptions);
/**
* {@inheritdoc IProblemCollector}
*/
get problems(): ReadonlySet<IProblem>;
/**
* {@inheritdoc TerminalWritable}
*/
protected onWriteChunk(chunk: ITerminalChunk): void;
/**
* {@inheritdoc TerminalWritable}
*/
protected onClose(): void;
}
//# sourceMappingURL=ProblemCollector.d.ts.map
{"version":3,"file":"ProblemCollector.d.ts","sourceRoot":"","sources":["../src/ProblemCollector.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEjG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,KAAK,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D;;;GAGG;AACH,MAAM,WAAW,wBAAyB,SAAQ,wBAAwB;IACxE;;OAEG;IACH,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACrC;AAED;;;;;;;;;;GAUG;AACH,qBAAa,gBAAiB,SAAQ,gBAAiB,YAAW,iBAAiB;IACjF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoB;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4B;gBAEnC,OAAO,EAAE,wBAAwB;IAoBpD;;OAEG;IACH,IAAW,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,CAE3C;IAED;;OAEG;IACH,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAsBnD;;OAEG;IACH,SAAS,CAAC,OAAO,IAAI,IAAI;CAgB1B"}
"use strict";
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProblemCollector = void 0;
const problem_matcher_1 = require("@rushstack/problem-matcher");
const TerminalWritable_1 = require("./TerminalWritable");
/**
* A {@link TerminalWritable} that consumes line-oriented terminal output and extracts structured
* problems using one or more {@link @rushstack/problem-matcher#IProblemMatcher | IProblemMatcher} instances.
*
* @remarks
* This collector expects that each incoming {@link ITerminalChunk} represents a single line terminated
* by a `"\n"` character (for example when preceded by {@link StderrLineTransform} / `StdioLineTransform`).
* If a chunk does not end with a newline an error is thrown to surface incorrect pipeline wiring early.
*
* @beta
*/
class ProblemCollector extends TerminalWritable_1.TerminalWritable {
constructor(options) {
super(options);
this._problems = new Set();
if (!options ||
((!options.matchers || options.matchers.length === 0) &&
(!options.matcherJson || options.matcherJson.length === 0))) {
throw new Error('ProblemCollector requires at least one problem matcher.');
}
const fromJson = options.matcherJson
? (0, problem_matcher_1.parseProblemMatchersJson)(options.matcherJson)
: [];
this._matchers = [...(options.matchers || []), ...fromJson];
if (this._matchers.length === 0) {
throw new Error('ProblemCollector requires at least one problem matcher.');
}
}
/**
* {@inheritdoc IProblemCollector}
*/
get problems() {
return this._problems;
}
/**
* {@inheritdoc TerminalWritable}
*/
onWriteChunk(chunk) {
const text = chunk.text;
if (text.length === 0 || text[text.length - 1] !== '\n') {
throw new Error('ProblemCollector expects chunks that were split into newline terminated lines. ' +
'Invalid input: ' +
JSON.stringify(text));
}
for (const matcher of this._matchers) {
const problem = matcher.exec(text);
if (problem) {
const finalized = {
...problem,
matcherName: matcher.name
};
this._problems.add(finalized);
}
}
}
/**
* {@inheritdoc TerminalWritable}
*/
onClose() {
for (const matcher of this._matchers) {
if (matcher.flush) {
const flushed = matcher.flush();
if (flushed && flushed.length > 0) {
for (const problem of flushed) {
const finalized = {
...problem,
matcherName: matcher.name
};
this._problems.add(finalized);
}
}
}
}
}
}
exports.ProblemCollector = ProblemCollector;
//# sourceMappingURL=ProblemCollector.js.map
{"version":3,"file":"ProblemCollector.js","sourceRoot":"","sources":["../src/ProblemCollector.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,gEAAsE;AAItE,yDAAqF;AAmBrF;;;;;;;;;;GAUG;AACH,MAAa,gBAAiB,SAAQ,mCAAgB;IAIpD,YAAmB,OAAiC;QAClD,KAAK,CAAC,OAAO,CAAC,CAAC;QAHA,cAAS,GAAkB,IAAI,GAAG,EAAE,CAAC;QAKpD,IACE,CAAC,OAAO;YACR,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC;gBACnD,CAAC,CAAC,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,EAC7D,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAC7E,CAAC;QAED,MAAM,QAAQ,GAAsB,OAAO,CAAC,WAAW;YACrD,CAAC,CAAC,IAAA,0CAAwB,EAAC,OAAO,CAAC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;gBAC5C,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAClC,KAAK,MAAM,OAAO,IAAI,OAAO,EAAE,CAAC;wBAC9B,MAAM,SAAS,GAAa;4BAC1B,GAAG,OAAO;4BACV,WAAW,EAAE,OAAO,CAAC,IAAI;yBAC1B,CAAC;wBACF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;oBAChC,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA3ED,4CA2EC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { parseProblemMatchersJson } from '@rushstack/problem-matcher';\nimport type { IProblemMatcher, IProblemMatcherJson, IProblem } from '@rushstack/problem-matcher';\n\nimport type { ITerminalChunk } from './ITerminalChunk';\nimport { type ITerminalWritableOptions, TerminalWritable } from './TerminalWritable';\nimport type { IProblemCollector } from './IProblemCollector';\n\n/**\n * Constructor options for {@link ProblemCollector}.\n * @beta\n */\nexport interface IProblemCollectorOptions extends ITerminalWritableOptions {\n /**\n * The set of matchers that will be applied to each incoming line. Must contain at least one item.\n */\n matchers?: IProblemMatcher[];\n /**\n * VS Code style problem matcher definitions. These will be converted to\n * {@link @rushstack/problem-matcher#IProblemMatcher | IProblemMatcher} definitions.\n */\n matcherJson?: IProblemMatcherJson[];\n}\n\n/**\n * A {@link TerminalWritable} that consumes line-oriented terminal output and extracts structured\n * problems using one or more {@link @rushstack/problem-matcher#IProblemMatcher | IProblemMatcher} instances.\n *\n * @remarks\n * This collector expects that each incoming {@link ITerminalChunk} represents a single line terminated\n * by a `\"\\n\"` character (for example when preceded by {@link StderrLineTransform} / `StdioLineTransform`).\n * If a chunk does not end with a newline an error is thrown to surface incorrect pipeline wiring early.\n *\n * @beta\n */\nexport class ProblemCollector extends TerminalWritable implements IProblemCollector {\n private readonly _matchers: IProblemMatcher[];\n private readonly _problems: Set<IProblem> = new Set();\n\n public constructor(options: IProblemCollectorOptions) {\n super(options);\n\n if (\n !options ||\n ((!options.matchers || options.matchers.length === 0) &&\n (!options.matcherJson || options.matcherJson.length === 0))\n ) {\n throw new Error('ProblemCollector requires at least one problem matcher.');\n }\n\n const fromJson: IProblemMatcher[] = options.matcherJson\n ? parseProblemMatchersJson(options.matcherJson)\n : [];\n this._matchers = [...(options.matchers || []), ...fromJson];\n if (this._matchers.length === 0) {\n throw new Error('ProblemCollector requires at least one problem matcher.');\n }\n }\n\n /**\n * {@inheritdoc IProblemCollector}\n */\n public get problems(): ReadonlySet<IProblem> {\n return this._problems;\n }\n\n /**\n * {@inheritdoc TerminalWritable}\n */\n protected onWriteChunk(chunk: ITerminalChunk): void {\n const text: string = chunk.text;\n if (text.length === 0 || text[text.length - 1] !== '\\n') {\n throw new Error(\n 'ProblemCollector expects chunks that were split into newline terminated lines. ' +\n 'Invalid input: ' +\n JSON.stringify(text)\n );\n }\n\n for (const matcher of this._matchers) {\n const problem: IProblem | false = matcher.exec(text);\n if (problem) {\n const finalized: IProblem = {\n ...problem,\n matcherName: matcher.name\n };\n this._problems.add(finalized);\n }\n }\n }\n\n /**\n * {@inheritdoc TerminalWritable}\n */\n protected onClose(): void {\n for (const matcher of this._matchers) {\n if (matcher.flush) {\n const flushed: IProblem[] = matcher.flush();\n if (flushed && flushed.length > 0) {\n for (const problem of flushed) {\n const finalized: IProblem = {\n ...problem,\n matcherName: matcher.name\n };\n this._problems.add(finalized);\n }\n }\n }\n }\n }\n}\n"]}
+8
-1
# Change Log - @rushstack/terminal
This log was last generated on Thu, 11 Sep 2025 00:22:31 GMT and should not be manually modified.
This log was last generated on Tue, 30 Sep 2025 20:33:51 GMT and should not be manually modified.
## 0.17.0
Tue, 30 Sep 2025 20:33:51 GMT
### Minor changes
- Add `ProblemCollector extends TerminalWritable` API which matches and collects VS Code style problem matchers
## 0.16.0

@@ -6,0 +13,0 @@ Thu, 11 Sep 2025 00:22:31 GMT

@@ -14,2 +14,5 @@ /**

import type { Brand } from '@rushstack/node-core-library';
import type { IProblem } from '@rushstack/problem-matcher';
import type { IProblemMatcher } from '@rushstack/problem-matcher';
import type { IProblemMatcherJson } from '@rushstack/problem-matcher';
import { NewlineKind } from '@rushstack/node-core-library';

@@ -291,2 +294,30 @@ import { Writable } from 'stream';

/**
* Collects problems (errors/warnings/info) encountered during an operation.
*
* @beta
*/
export declare interface IProblemCollector {
/**
* Returns the collected problems so far.
*/
get problems(): ReadonlySet<IProblem>;
}
/**
* Constructor options for {@link ProblemCollector}.
* @beta
*/
export declare interface IProblemCollectorOptions extends ITerminalWritableOptions {
/**
* The set of matchers that will be applied to each incoming line. Must contain at least one item.
*/
matchers?: IProblemMatcher[];
/**
* VS Code style problem matcher definitions. These will be converted to
* {@link @rushstack/problem-matcher#IProblemMatcher | IProblemMatcher} definitions.
*/
matcherJson?: IProblemMatcherJson[];
}
/**
* Constructor options for {@link SplitterTransform}.

@@ -740,2 +771,31 @@ *

/**
* A {@link TerminalWritable} that consumes line-oriented terminal output and extracts structured
* problems using one or more {@link @rushstack/problem-matcher#IProblemMatcher | IProblemMatcher} instances.
*
* @remarks
* This collector expects that each incoming {@link ITerminalChunk} represents a single line terminated
* by a `"\n"` character (for example when preceded by {@link StderrLineTransform} / `StdioLineTransform`).
* If a chunk does not end with a newline an error is thrown to surface incorrect pipeline wiring early.
*
* @beta
*/
export declare class ProblemCollector extends TerminalWritable implements IProblemCollector {
private readonly _matchers;
private readonly _problems;
constructor(options: IProblemCollectorOptions);
/**
* {@inheritdoc IProblemCollector}
*/
get problems(): ReadonlySet<IProblem>;
/**
* {@inheritdoc TerminalWritable}
*/
protected onWriteChunk(chunk: ITerminalChunk): void;
/**
* {@inheritdoc TerminalWritable}
*/
protected onClose(): void;
}
/**
* For use with {@link TextRewriterTransform}, this rewriter removes ANSI escape codes

@@ -742,0 +802,0 @@ * including colored text.

@@ -36,2 +36,4 @@ /// <reference types="node" preserve="true" />

export { TerminalStreamWritable, type ITerminalStreamWritableOptions } from './TerminalStreamWritable';
export { ProblemCollector, type IProblemCollectorOptions } from './ProblemCollector';
export type { IProblemCollector } from './IProblemCollector';
//# sourceMappingURL=index.d.ts.map
+3
-1

@@ -5,3 +5,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.TerminalStreamWritable = exports.NoOpTerminalProvider = 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.TerminalChunkKind = exports.DiscardStdoutTransform = exports.CallbackWritable = void 0;
exports.ProblemCollector = exports.TerminalStreamWritable = exports.NoOpTerminalProvider = 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.TerminalChunkKind = exports.DiscardStdoutTransform = exports.CallbackWritable = void 0;
/// <reference types="node" preserve="true" />

@@ -66,2 +66,4 @@ /**

Object.defineProperty(exports, "TerminalStreamWritable", { enumerable: true, get: function () { return TerminalStreamWritable_1.TerminalStreamWritable; } });
var ProblemCollector_1 = require("./ProblemCollector");
Object.defineProperty(exports, "ProblemCollector", { enumerable: true, get: function () { return ProblemCollector_1.ProblemCollector; } });
//# sourceMappingURL=index.js.map
{
"name": "@rushstack/terminal",
"version": "0.16.0",
"version": "0.17.0",
"description": "User interface primitives for console applications",

@@ -15,3 +15,4 @@ "main": "lib/index.js",

"supports-color": "~8.1.1",
"@rushstack/node-core-library": "5.14.0"
"@rushstack/node-core-library": "5.15.0",
"@rushstack/problem-matcher": "0.1.0"
},

@@ -18,0 +19,0 @@ "devDependencies": {

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet