@rushstack/terminal 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json CHANGED
@@ -1,6 +1,49 @@
1
1
  {
2
2
  "name": "@rushstack/terminal",
3
3
  "entries": [
4
+ {
5
+ "version": "0.18.0",
6
+ "tag": "@rushstack/terminal_v0.18.0",
7
+ "date": "Tue, 30 Sep 2025 23:57:45 GMT",
8
+ "comments": {
9
+ "minor": [
10
+ {
11
+ "comment": "Add ProblemCollector.onProblem notification callback"
12
+ },
13
+ {
14
+ "comment": "Update API contract for `SplitterTransform` to support adding and removing destinations after creation."
15
+ }
16
+ ],
17
+ "dependency": [
18
+ {
19
+ "comment": "Updating dependency \"@rushstack/node-core-library\" to `5.15.1`"
20
+ },
21
+ {
22
+ "comment": "Updating dependency \"@rushstack/problem-matcher\" to `0.1.1`"
23
+ }
24
+ ]
25
+ }
26
+ },
27
+ {
28
+ "version": "0.17.0",
29
+ "tag": "@rushstack/terminal_v0.17.0",
30
+ "date": "Tue, 30 Sep 2025 20:33:51 GMT",
31
+ "comments": {
32
+ "minor": [
33
+ {
34
+ "comment": "Add `ProblemCollector extends TerminalWritable` API which matches and collects VS Code style problem matchers"
35
+ }
36
+ ],
37
+ "dependency": [
38
+ {
39
+ "comment": "Updating dependency \"@rushstack/node-core-library\" to `5.15.0`"
40
+ },
41
+ {
42
+ "comment": "Updating dependency \"@rushstack/problem-matcher\" to `0.1.0`"
43
+ }
44
+ ]
45
+ }
46
+ },
4
47
  {
5
48
  "version": "0.16.0",
6
49
  "tag": "@rushstack/terminal_v0.16.0",
package/CHANGELOG.md CHANGED
@@ -1,6 +1,21 @@
1
1
  # Change Log - @rushstack/terminal
2
2
 
3
- This log was last generated on Thu, 11 Sep 2025 00:22:31 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 30 Sep 2025 23:57:45 GMT and should not be manually modified.
4
+
5
+ ## 0.18.0
6
+ Tue, 30 Sep 2025 23:57:45 GMT
7
+
8
+ ### Minor changes
9
+
10
+ - Add ProblemCollector.onProblem notification callback
11
+ - Update API contract for `SplitterTransform` to support adding and removing destinations after creation.
12
+
13
+ ## 0.17.0
14
+ Tue, 30 Sep 2025 20:33:51 GMT
15
+
16
+ ### Minor changes
17
+
18
+ - Add `ProblemCollector extends TerminalWritable` API which matches and collects VS Code style problem matchers
4
19
 
5
20
  ## 0.16.0
6
21
  Thu, 11 Sep 2025 00:22:31 GMT
@@ -11,6 +11,9 @@
11
11
  /// <reference types="node" />
12
12
 
13
13
  import type { Brand } from '@rushstack/node-core-library';
14
+ import type { IProblem } from '@rushstack/problem-matcher';
15
+ import type { IProblemMatcher } from '@rushstack/problem-matcher';
16
+ import type { IProblemMatcherJson } from '@rushstack/problem-matcher';
14
17
  import { NewlineKind } from '@rushstack/node-core-library';
15
18
  import { Writable } from 'stream';
16
19
  import { WritableOptions } from 'stream';
@@ -286,6 +289,38 @@ export declare interface IPrefixProxyTerminalProviderOptionsBase {
286
289
  terminalProvider: ITerminalProvider;
287
290
  }
288
291
 
292
+ /**
293
+ * Collects problems (errors/warnings/info) encountered during an operation.
294
+ *
295
+ * @beta
296
+ */
297
+ export declare interface IProblemCollector {
298
+ /**
299
+ * Returns the collected problems so far.
300
+ */
301
+ get problems(): ReadonlySet<IProblem>;
302
+ }
303
+
304
+ /**
305
+ * Constructor options for {@link ProblemCollector}.
306
+ * @beta
307
+ */
308
+ export declare interface IProblemCollectorOptions extends ITerminalWritableOptions {
309
+ /**
310
+ * The set of matchers that will be applied to each incoming line. Must contain at least one item.
311
+ */
312
+ matchers?: IProblemMatcher[];
313
+ /**
314
+ * VS Code style problem matcher definitions. These will be converted to
315
+ * {@link @rushstack/problem-matcher#IProblemMatcher | IProblemMatcher} definitions.
316
+ */
317
+ matcherJson?: IProblemMatcherJson[];
318
+ /**
319
+ * Optional callback invoked immediately whenever a problem is produced.
320
+ */
321
+ onProblem?: (problem: IProblem) => void;
322
+ }
323
+
289
324
  /**
290
325
  * Constructor options for {@link SplitterTransform}.
291
326
  *
@@ -293,9 +328,9 @@ export declare interface IPrefixProxyTerminalProviderOptionsBase {
293
328
  */
294
329
  export declare interface ISplitterTransformOptions extends ITerminalWritableOptions {
295
330
  /**
296
- * Each input chunk will be passed to each destination in the array.
331
+ * Each input chunk will be passed to each destination in the iterable.
297
332
  */
298
- destinations: TerminalWritable[];
333
+ destinations: Iterable<TerminalWritable>;
299
334
  }
300
335
 
301
336
  /**
@@ -734,6 +769,36 @@ export declare class PrintUtilities {
734
769
  static printMessageInBox(message: string, terminal: ITerminal, boxWidth?: number): void;
735
770
  }
736
771
 
772
+ /**
773
+ * A {@link TerminalWritable} that consumes line-oriented terminal output and extracts structured
774
+ * problems using one or more {@link @rushstack/problem-matcher#IProblemMatcher | IProblemMatcher} instances.
775
+ *
776
+ * @remarks
777
+ * This collector expects that each incoming {@link ITerminalChunk} represents a single line terminated
778
+ * by a `"\n"` character (for example when preceded by {@link StderrLineTransform} / `StdioLineTransform`).
779
+ * If a chunk does not end with a newline an error is thrown to surface incorrect pipeline wiring early.
780
+ *
781
+ * @beta
782
+ */
783
+ export declare class ProblemCollector extends TerminalWritable implements IProblemCollector {
784
+ private readonly _matchers;
785
+ private readonly _problems;
786
+ private readonly _onProblem;
787
+ constructor(options: IProblemCollectorOptions);
788
+ /**
789
+ * {@inheritdoc IProblemCollector}
790
+ */
791
+ get problems(): ReadonlySet<IProblem>;
792
+ /**
793
+ * {@inheritdoc TerminalWritable}
794
+ */
795
+ protected onWriteChunk(chunk: ITerminalChunk): void;
796
+ /**
797
+ * {@inheritdoc TerminalWritable}
798
+ */
799
+ protected onClose(): void;
800
+ }
801
+
737
802
  /**
738
803
  * For use with {@link TextRewriterTransform}, this rewriter removes ANSI escape codes
739
804
  * including colored text.
@@ -763,8 +828,25 @@ export declare class RemoveColorsTextRewriter extends TextRewriter {
763
828
  * @public
764
829
  */
765
830
  export declare class SplitterTransform extends TerminalWritable {
766
- readonly destinations: ReadonlyArray<TerminalWritable>;
831
+ private readonly _destinations;
767
832
  constructor(options: ISplitterTransformOptions);
833
+ get destinations(): ReadonlySet<TerminalWritable>;
834
+ /**
835
+ * Adds a destination to the set of destinations. Duplicates are ignored.
836
+ * Only new chunks received after the destination is added will be sent to it.
837
+ * @param destination - The destination to add.
838
+ */
839
+ addDestination(destination: TerminalWritable): void;
840
+ /**
841
+ * Removes a destination from the set of destinations. It will no longer receive chunks, and will be closed, unless
842
+ * `destination.preventAutoclose` is set to `true`.
843
+ * @param destination - The destination to remove.
844
+ * @param close - If `true` (default), the destination will be closed when removed, unless `destination.preventAutoclose` is set to `true`.
845
+ * @returns `true` if the destination was removed, `false` if it was not found.
846
+ * @remarks
847
+ * If the destination is not found, it will not be closed.
848
+ */
849
+ removeDestination(destination: TerminalWritable, close?: boolean): boolean;
768
850
  protected onWriteChunk(chunk: ITerminalChunk): void;
769
851
  protected onClose(): void;
770
852
  }
@@ -0,0 +1,13 @@
1
+ import type { IProblem } from '@rushstack/problem-matcher';
2
+ /**
3
+ * Collects problems (errors/warnings/info) encountered during an operation.
4
+ *
5
+ * @beta
6
+ */
7
+ export interface IProblemCollector {
8
+ /**
9
+ * Returns the collected problems so far.
10
+ */
11
+ get problems(): ReadonlySet<IProblem>;
12
+ }
13
+ //# sourceMappingURL=IProblemCollector.d.ts.map
@@ -0,0 +1 @@
1
+ {"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"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=IProblemCollector.js.map
@@ -0,0 +1 @@
1
+ {"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"]}
@@ -0,0 +1,53 @@
1
+ import type { IProblemMatcher, IProblemMatcherJson, IProblem } from '@rushstack/problem-matcher';
2
+ import type { ITerminalChunk } from './ITerminalChunk';
3
+ import { type ITerminalWritableOptions, TerminalWritable } from './TerminalWritable';
4
+ import type { IProblemCollector } from './IProblemCollector';
5
+ /**
6
+ * Constructor options for {@link ProblemCollector}.
7
+ * @beta
8
+ */
9
+ export interface IProblemCollectorOptions extends ITerminalWritableOptions {
10
+ /**
11
+ * The set of matchers that will be applied to each incoming line. Must contain at least one item.
12
+ */
13
+ matchers?: IProblemMatcher[];
14
+ /**
15
+ * VS Code style problem matcher definitions. These will be converted to
16
+ * {@link @rushstack/problem-matcher#IProblemMatcher | IProblemMatcher} definitions.
17
+ */
18
+ matcherJson?: IProblemMatcherJson[];
19
+ /**
20
+ * Optional callback invoked immediately whenever a problem is produced.
21
+ */
22
+ onProblem?: (problem: IProblem) => void;
23
+ }
24
+ /**
25
+ * A {@link TerminalWritable} that consumes line-oriented terminal output and extracts structured
26
+ * problems using one or more {@link @rushstack/problem-matcher#IProblemMatcher | IProblemMatcher} instances.
27
+ *
28
+ * @remarks
29
+ * This collector expects that each incoming {@link ITerminalChunk} represents a single line terminated
30
+ * by a `"\n"` character (for example when preceded by {@link StderrLineTransform} / `StdioLineTransform`).
31
+ * If a chunk does not end with a newline an error is thrown to surface incorrect pipeline wiring early.
32
+ *
33
+ * @beta
34
+ */
35
+ export declare class ProblemCollector extends TerminalWritable implements IProblemCollector {
36
+ private readonly _matchers;
37
+ private readonly _problems;
38
+ private readonly _onProblem;
39
+ constructor(options: IProblemCollectorOptions);
40
+ /**
41
+ * {@inheritdoc IProblemCollector}
42
+ */
43
+ get problems(): ReadonlySet<IProblem>;
44
+ /**
45
+ * {@inheritdoc TerminalWritable}
46
+ */
47
+ protected onWriteChunk(chunk: ITerminalChunk): void;
48
+ /**
49
+ * {@inheritdoc TerminalWritable}
50
+ */
51
+ protected onClose(): void;
52
+ }
53
+ //# sourceMappingURL=ProblemCollector.d.ts.map
@@ -0,0 +1 @@
1
+ {"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;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,IAAI,CAAC;CACzC;AAED;;;;;;;;;;GAUG;AACH,qBAAa,gBAAiB,SAAQ,gBAAiB,YAAW,iBAAiB;IACjF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoB;IAC9C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4B;IACtD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA4C;gBAEpD,OAAO,EAAE,wBAAwB;IAqBpD;;OAEG;IACH,IAAW,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC,CAE3C;IAED;;OAEG;IACH,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAuBnD;;OAEG;IACH,SAAS,CAAC,OAAO,IAAI,IAAI;CAiB1B"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
+ // See LICENSE in the project root for license information.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.ProblemCollector = void 0;
6
+ const problem_matcher_1 = require("@rushstack/problem-matcher");
7
+ const TerminalWritable_1 = require("./TerminalWritable");
8
+ /**
9
+ * A {@link TerminalWritable} that consumes line-oriented terminal output and extracts structured
10
+ * problems using one or more {@link @rushstack/problem-matcher#IProblemMatcher | IProblemMatcher} instances.
11
+ *
12
+ * @remarks
13
+ * This collector expects that each incoming {@link ITerminalChunk} represents a single line terminated
14
+ * by a `"\n"` character (for example when preceded by {@link StderrLineTransform} / `StdioLineTransform`).
15
+ * If a chunk does not end with a newline an error is thrown to surface incorrect pipeline wiring early.
16
+ *
17
+ * @beta
18
+ */
19
+ class ProblemCollector extends TerminalWritable_1.TerminalWritable {
20
+ constructor(options) {
21
+ super(options);
22
+ this._problems = new Set();
23
+ if (!options ||
24
+ ((!options.matchers || options.matchers.length === 0) &&
25
+ (!options.matcherJson || options.matcherJson.length === 0))) {
26
+ throw new Error('ProblemCollector requires at least one problem matcher.');
27
+ }
28
+ const fromJson = options.matcherJson
29
+ ? (0, problem_matcher_1.parseProblemMatchersJson)(options.matcherJson)
30
+ : [];
31
+ this._matchers = [...(options.matchers || []), ...fromJson];
32
+ if (this._matchers.length === 0) {
33
+ throw new Error('ProblemCollector requires at least one problem matcher.');
34
+ }
35
+ this._onProblem = options.onProblem;
36
+ }
37
+ /**
38
+ * {@inheritdoc IProblemCollector}
39
+ */
40
+ get problems() {
41
+ return this._problems;
42
+ }
43
+ /**
44
+ * {@inheritdoc TerminalWritable}
45
+ */
46
+ onWriteChunk(chunk) {
47
+ var _a;
48
+ const text = chunk.text;
49
+ if (text.length === 0 || text[text.length - 1] !== '\n') {
50
+ throw new Error('ProblemCollector expects chunks that were split into newline terminated lines. ' +
51
+ 'Invalid input: ' +
52
+ JSON.stringify(text));
53
+ }
54
+ for (const matcher of this._matchers) {
55
+ const problem = matcher.exec(text);
56
+ if (problem) {
57
+ const finalized = {
58
+ ...problem,
59
+ matcherName: matcher.name
60
+ };
61
+ this._problems.add(finalized);
62
+ (_a = this._onProblem) === null || _a === void 0 ? void 0 : _a.call(this, finalized);
63
+ }
64
+ }
65
+ }
66
+ /**
67
+ * {@inheritdoc TerminalWritable}
68
+ */
69
+ onClose() {
70
+ var _a;
71
+ for (const matcher of this._matchers) {
72
+ if (matcher.flush) {
73
+ const flushed = matcher.flush();
74
+ if (flushed && flushed.length > 0) {
75
+ for (const problem of flushed) {
76
+ const finalized = {
77
+ ...problem,
78
+ matcherName: matcher.name
79
+ };
80
+ this._problems.add(finalized);
81
+ (_a = this._onProblem) === null || _a === void 0 ? void 0 : _a.call(this, finalized);
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
87
+ }
88
+ exports.ProblemCollector = ProblemCollector;
89
+ //# sourceMappingURL=ProblemCollector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProblemCollector.js","sourceRoot":"","sources":["../src/ProblemCollector.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,gEAAsE;AAItE,yDAAqF;AAuBrF;;;;;;;;;;GAUG;AACH,MAAa,gBAAiB,SAAQ,mCAAgB;IAKpD,YAAmB,OAAiC;QAClD,KAAK,CAAC,OAAO,CAAC,CAAC;QAJA,cAAS,GAAkB,IAAI,GAAG,EAAE,CAAC;QAMpD,IACE,CAAC,OAAO;YACR,CAAC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AAC,CAAC;YACrD,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,SAAS,GAAa;oBAC1B,GAAG,OAAO;oBACV,WAAW,EAAE,OAAO,CAAC,IAAI;iBAC1B,CAAC;gBACF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBAC9B,MAAA,IAAI,CAAC,UAAU,qDAAG,SAAS,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IAED;;OAEG;IACO,OAAO;;QACf,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACrC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;gBAClB,MAAM,OAAO,GAAe,OAAO,CAAC,KAAK,EAAE,CAAC;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;wBAC9B,MAAA,IAAI,CAAC,UAAU,qDAAG,SAAS,CAAC,CAAC;oBAC/B,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF;AA/ED,4CA+EC","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 * Optional callback invoked immediately whenever a problem is produced.\n */\n onProblem?: (problem: IProblem) => void;\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 private readonly _onProblem: ((problem: IProblem) => void) | undefined;\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 this._onProblem = options.onProblem;\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 this._onProblem?.(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 this._onProblem?.(finalized);\n }\n }\n }\n }\n }\n}\n"]}
@@ -7,9 +7,9 @@ import type { ITerminalChunk } from './ITerminalChunk';
7
7
  */
8
8
  export interface ISplitterTransformOptions extends ITerminalWritableOptions {
9
9
  /**
10
- * Each input chunk will be passed to each destination in the array.
10
+ * Each input chunk will be passed to each destination in the iterable.
11
11
  */
12
- destinations: TerminalWritable[];
12
+ destinations: Iterable<TerminalWritable>;
13
13
  }
14
14
  /**
15
15
  * Use this instead of {@link TerminalTransform} if you need to output `ITerminalChunk`
@@ -24,8 +24,25 @@ export interface ISplitterTransformOptions extends ITerminalWritableOptions {
24
24
  * @public
25
25
  */
26
26
  export declare class SplitterTransform extends TerminalWritable {
27
- readonly destinations: ReadonlyArray<TerminalWritable>;
27
+ private readonly _destinations;
28
28
  constructor(options: ISplitterTransformOptions);
29
+ get destinations(): ReadonlySet<TerminalWritable>;
30
+ /**
31
+ * Adds a destination to the set of destinations. Duplicates are ignored.
32
+ * Only new chunks received after the destination is added will be sent to it.
33
+ * @param destination - The destination to add.
34
+ */
35
+ addDestination(destination: TerminalWritable): void;
36
+ /**
37
+ * Removes a destination from the set of destinations. It will no longer receive chunks, and will be closed, unless
38
+ * `destination.preventAutoclose` is set to `true`.
39
+ * @param destination - The destination to remove.
40
+ * @param close - If `true` (default), the destination will be closed when removed, unless `destination.preventAutoclose` is set to `true`.
41
+ * @returns `true` if the destination was removed, `false` if it was not found.
42
+ * @remarks
43
+ * If the destination is not found, it will not be closed.
44
+ */
45
+ removeDestination(destination: TerminalWritable, close?: boolean): boolean;
29
46
  protected onWriteChunk(chunk: ITerminalChunk): void;
30
47
  protected onClose(): void;
31
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SplitterTransform.d.ts","sourceRoot":"","sources":["../src/SplitterTransform.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,KAAK,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,yBAA0B,SAAQ,wBAAwB;IACzE;;OAEG;IACH,YAAY,EAAE,gBAAgB,EAAE,CAAC;CAClC;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;IACrD,SAAgB,YAAY,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;gBAE3C,OAAO,EAAE,yBAAyB;IAKrD,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAMnD,SAAS,CAAC,OAAO,IAAI,IAAI;CAkB1B"}
1
+ {"version":3,"file":"SplitterTransform.d.ts","sourceRoot":"","sources":["../src/SplitterTransform.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,KAAK,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,yBAA0B,SAAQ,wBAAwB;IACzE;;OAEG;IACH,YAAY,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;IACrD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAwB;gBAEnC,OAAO,EAAE,yBAAyB;IAKrD,IAAW,YAAY,IAAI,WAAW,CAAC,gBAAgB,CAAC,CAEvD;IAED;;;;OAIG;IACI,cAAc,CAAC,WAAW,EAAE,gBAAgB,GAAG,IAAI;IAI1D;;;;;;;;OAQG;IACI,iBAAiB,CAAC,WAAW,EAAE,gBAAgB,EAAE,KAAK,GAAE,OAAc,GAAG,OAAO;IAUvF,SAAS,CAAC,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI;IAMnD,SAAS,CAAC,OAAO,IAAI,IAAI;CAoB1B"}
@@ -19,17 +19,46 @@ const TerminalWritable_1 = require("./TerminalWritable");
19
19
  class SplitterTransform extends TerminalWritable_1.TerminalWritable {
20
20
  constructor(options) {
21
21
  super();
22
- this.destinations = [...options.destinations];
22
+ this._destinations = new Set(options.destinations);
23
+ }
24
+ get destinations() {
25
+ return this._destinations;
26
+ }
27
+ /**
28
+ * Adds a destination to the set of destinations. Duplicates are ignored.
29
+ * Only new chunks received after the destination is added will be sent to it.
30
+ * @param destination - The destination to add.
31
+ */
32
+ addDestination(destination) {
33
+ this._destinations.add(destination);
34
+ }
35
+ /**
36
+ * Removes a destination from the set of destinations. It will no longer receive chunks, and will be closed, unless
37
+ * `destination.preventAutoclose` is set to `true`.
38
+ * @param destination - The destination to remove.
39
+ * @param close - If `true` (default), the destination will be closed when removed, unless `destination.preventAutoclose` is set to `true`.
40
+ * @returns `true` if the destination was removed, `false` if it was not found.
41
+ * @remarks
42
+ * If the destination is not found, it will not be closed.
43
+ */
44
+ removeDestination(destination, close = true) {
45
+ if (this._destinations.delete(destination)) {
46
+ if (close && !destination.preventAutoclose) {
47
+ destination.close();
48
+ }
49
+ return true;
50
+ }
51
+ return false;
23
52
  }
24
53
  onWriteChunk(chunk) {
25
- for (const destination of this.destinations) {
54
+ for (const destination of this._destinations) {
26
55
  destination.writeChunk(chunk);
27
56
  }
28
57
  }
29
58
  onClose() {
30
59
  const errors = [];
31
60
  // If an exception is thrown, try to ensure that the other destinations get closed properly
32
- for (const destination of this.destinations) {
61
+ for (const destination of this._destinations) {
33
62
  if (!destination.preventAutoclose) {
34
63
  try {
35
64
  destination.close();
@@ -39,6 +68,7 @@ class SplitterTransform extends TerminalWritable_1.TerminalWritable {
39
68
  }
40
69
  }
41
70
  }
71
+ this._destinations.clear();
42
72
  if (errors.length > 0) {
43
73
  throw errors[0];
44
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SplitterTransform.js","sourceRoot":"","sources":["../src/SplitterTransform.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,yDAAqF;AAerF;;;;;;;;;;;GAWG;AACH,MAAa,iBAAkB,SAAQ,mCAAgB;IAGrD,YAAmB,OAAkC;QACnD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,GAAG,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;IAES,YAAY,CAAC,KAAqB;QAC1C,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YAC5C,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAES,OAAO;QACf,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,2FAA2F;QAC3F,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YAC5C,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC;gBAClC,IAAI,CAAC;oBACH,WAAW,CAAC,KAAK,EAAE,CAAC;gBACtB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,CAAC,IAAI,CAAC,KAAc,CAAC,CAAC;gBAC9B,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF;AAhCD,8CAgCC","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 { TerminalWritable, type ITerminalWritableOptions } from './TerminalWritable';\nimport type { ITerminalChunk } from './ITerminalChunk';\n\n/**\n * Constructor options for {@link SplitterTransform}.\n *\n * @public\n */\nexport interface ISplitterTransformOptions extends ITerminalWritableOptions {\n /**\n * Each input chunk will be passed to each destination in the array.\n */\n destinations: TerminalWritable[];\n}\n\n/**\n * Use this instead of {@link TerminalTransform} if you need to output `ITerminalChunk`\n * data to more than one destination.\n *\n * @remarks\n *\n * Splitting streams complicates the pipeline topology and can make debugging more difficult.\n * For this reason, it is modeled as an explicit `SplitterTransform` node, rather than\n * as a built-in feature of `TerminalTransform`.\n *\n * @public\n */\nexport class SplitterTransform extends TerminalWritable {\n public readonly destinations: ReadonlyArray<TerminalWritable>;\n\n public constructor(options: ISplitterTransformOptions) {\n super();\n this.destinations = [...options.destinations];\n }\n\n protected onWriteChunk(chunk: ITerminalChunk): void {\n for (const destination of this.destinations) {\n destination.writeChunk(chunk);\n }\n }\n\n protected onClose(): void {\n const errors: Error[] = [];\n\n // If an exception is thrown, try to ensure that the other destinations get closed properly\n for (const destination of this.destinations) {\n if (!destination.preventAutoclose) {\n try {\n destination.close();\n } catch (error) {\n errors.push(error as Error);\n }\n }\n }\n\n if (errors.length > 0) {\n throw errors[0];\n }\n }\n}\n"]}
1
+ {"version":3,"file":"SplitterTransform.js","sourceRoot":"","sources":["../src/SplitterTransform.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,yDAAqF;AAerF;;;;;;;;;;;GAWG;AACH,MAAa,iBAAkB,SAAQ,mCAAgB;IAGrD,YAAmB,OAAkC;QACnD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,aAAa,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACrD,CAAC;IAED,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,WAA6B;QACjD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;OAQG;IACI,iBAAiB,CAAC,WAA6B,EAAE,QAAiB,IAAI;QAC3E,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;YAC3C,IAAI,KAAK,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC;gBAC3C,WAAW,CAAC,KAAK,EAAE,CAAC;YACtB,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAES,YAAY,CAAC,KAAqB;QAC1C,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YAC7C,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAES,OAAO;QACf,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,2FAA2F;QAC3F,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YAC7C,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC;gBAClC,IAAI,CAAC;oBACH,WAAW,CAAC,KAAK,EAAE,CAAC;gBACtB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,MAAM,CAAC,IAAI,CAAC,KAAc,CAAC,CAAC;gBAC9B,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QAE3B,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;CACF;AAlED,8CAkEC","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 { TerminalWritable, type ITerminalWritableOptions } from './TerminalWritable';\nimport type { ITerminalChunk } from './ITerminalChunk';\n\n/**\n * Constructor options for {@link SplitterTransform}.\n *\n * @public\n */\nexport interface ISplitterTransformOptions extends ITerminalWritableOptions {\n /**\n * Each input chunk will be passed to each destination in the iterable.\n */\n destinations: Iterable<TerminalWritable>;\n}\n\n/**\n * Use this instead of {@link TerminalTransform} if you need to output `ITerminalChunk`\n * data to more than one destination.\n *\n * @remarks\n *\n * Splitting streams complicates the pipeline topology and can make debugging more difficult.\n * For this reason, it is modeled as an explicit `SplitterTransform` node, rather than\n * as a built-in feature of `TerminalTransform`.\n *\n * @public\n */\nexport class SplitterTransform extends TerminalWritable {\n private readonly _destinations: Set<TerminalWritable>;\n\n public constructor(options: ISplitterTransformOptions) {\n super();\n this._destinations = new Set(options.destinations);\n }\n\n public get destinations(): ReadonlySet<TerminalWritable> {\n return this._destinations;\n }\n\n /**\n * Adds a destination to the set of destinations. Duplicates are ignored.\n * Only new chunks received after the destination is added will be sent to it.\n * @param destination - The destination to add.\n */\n public addDestination(destination: TerminalWritable): void {\n this._destinations.add(destination);\n }\n\n /**\n * Removes a destination from the set of destinations. It will no longer receive chunks, and will be closed, unless\n * `destination.preventAutoclose` is set to `true`.\n * @param destination - The destination to remove.\n * @param close - If `true` (default), the destination will be closed when removed, unless `destination.preventAutoclose` is set to `true`.\n * @returns `true` if the destination was removed, `false` if it was not found.\n * @remarks\n * If the destination is not found, it will not be closed.\n */\n public removeDestination(destination: TerminalWritable, close: boolean = true): boolean {\n if (this._destinations.delete(destination)) {\n if (close && !destination.preventAutoclose) {\n destination.close();\n }\n return true;\n }\n return false;\n }\n\n protected onWriteChunk(chunk: ITerminalChunk): void {\n for (const destination of this._destinations) {\n destination.writeChunk(chunk);\n }\n }\n\n protected onClose(): void {\n const errors: Error[] = [];\n\n // If an exception is thrown, try to ensure that the other destinations get closed properly\n for (const destination of this._destinations) {\n if (!destination.preventAutoclose) {\n try {\n destination.close();\n } catch (error) {\n errors.push(error as Error);\n }\n }\n }\n\n this._destinations.clear();\n\n if (errors.length > 0) {\n throw errors[0];\n }\n }\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -33,4 +33,6 @@ export { StringBufferTerminalProvider, type IStringBufferOutputOptions } from '.
33
33
  export { PrefixProxyTerminalProvider, type IPrefixProxyTerminalProviderOptions, type IDynamicPrefixProxyTerminalProviderOptions, type IPrefixProxyTerminalProviderOptionsBase, type IStaticPrefixProxyTerminalProviderOptions } from './PrefixProxyTerminalProvider';
34
34
  export { NoOpTerminalProvider } from './NoOpTerminalProvider';
35
35
  export { TerminalStreamWritable, type ITerminalStreamWritableOptions } from './TerminalStreamWritable';
36
+ export { ProblemCollector, type IProblemCollectorOptions } from './ProblemCollector';
37
+ export type { IProblemCollector } from './IProblemCollector';
36
38
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAKA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,KAAK,8BAA8B,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,KAAK,qCAAqC,EAC1C,6BAA6B,EAC9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,KAAK,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,KAAK,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OA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AAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,KAAK,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAC1G,OAAO,EACL,4BAA4B,EAC5B,KAAK,0BAA0B,EAChC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,2BAA2B,EAC3B,KAAK,mCAAmC,EACxC,KAAK,0CAA0C,EAC/C,KAAK,uCAAuC,EAC5C,KAAK,yCAAyC,EAC/C,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,KAAK,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AACvG,OAAO,EAAE,gBAAgB,EAAE,KAAK,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACrF,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
package/lib/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
3
3
  // See LICENSE in the project root for license information.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- 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;
5
+ 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;
6
6
  /// <reference types="node" preserve="true" />
7
7
  /**
8
8
  * This library implements a system for processing human readable text that
@@ -62,4 +62,6 @@ var NoOpTerminalProvider_1 = require("./NoOpTerminalProvider");
62
62
  Object.defineProperty(exports, "NoOpTerminalProvider", { enumerable: true, get: function () { return NoOpTerminalProvider_1.NoOpTerminalProvider; } });
63
63
  var TerminalStreamWritable_1 = require("./TerminalStreamWritable");
64
64
  Object.defineProperty(exports, "TerminalStreamWritable", { enumerable: true, get: function () { return TerminalStreamWritable_1.TerminalStreamWritable; } });
65
+ var ProblemCollector_1 = require("./ProblemCollector");
66
+ Object.defineProperty(exports, "ProblemCollector", { enumerable: true, get: function () { return ProblemCollector_1.ProblemCollector; } });
65
67
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,8CAA8C;AAE9C;;;;;;;;GAQG;AAEH,uDAAqF;AAA7C,oHAAA,gBAAgB,OAAA;AACxD,mEAAuG;AAAzD,gIAAA,sBAAsB,OAAA;AACpE,mDAA0E;AAAjE,mHAAA,iBAAiB,OAAA;AAC1B,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,iFAGyC;AADvC,8IAAA,6BAA6B,OAAA;AAE/B,mDAAyE;AAAhE,uHAAA,qBAAqB,OAAA;AAAE,gHAAA,cAAc,OAAA;AAC9C,uEAAsE;AAA7D,oIAAA,wBAAwB,OAAA;AACjC,yDAAwF;AAA/C,sHAAA,iBAAiB,OAAA;AAC1D,2DAA4F;AAAlD,yHAAA,mBAAmB,OAAA;AAC7D,qDAAkF;AAA3C,kHAAA,eAAe,OAAA;AACtD,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,yDAAwF;AAA/C,sHAAA,iBAAiB,OAAA;AAC1D,uDAAqF;AAA7C,oHAAA,gBAAgB,OAAA;AACxD,+CAAsE;AAArC,4GAAA,YAAY,OAAA;AAC7C,iEAAoG;AAAvD,8HAAA,qBAAqB,OAAA;AAClE,2CAAkF;AAAzE,wGAAA,UAAU,OAAA;AAEnB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,yDAAuF;AAAtD,6HAAA,wBAAwB,OAAA;AACzD,qEAA0G;AAAjG,kIAAA,uBAAuB,OAAA;AAChC,+EAGwC;AAFtC,4IAAA,4BAA4B,OAAA;AAG9B,6EAMuC;AALrC,0IAAA,2BAA2B,OAAA;AAM7B,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,mEAAuG;AAA9F,gIAAA,sBAAsB,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/// <reference types=\"node\" preserve=\"true\" />\n\n/**\n * This library implements a system for processing human readable text that\n * will be output by console applications.\n *\n * @remarks\n * See the {@link TerminalWritable} documentation for an overview of the major concepts.\n *\n * @packageDocumentation\n */\n\nexport { type ICallbackWritableOptions, CallbackWritable } from './CallbackWritable';\nexport { type IDiscardStdoutTransformOptions, DiscardStdoutTransform } from './DiscardStdoutTransform';\nexport { TerminalChunkKind, type ITerminalChunk } from './ITerminalChunk';\nexport { MockWritable } from './MockWritable';\nexport {\n type INormalizeNewlinesTextRewriterOptions,\n NormalizeNewlinesTextRewriter\n} from './NormalizeNewlinesTextRewriter';\nexport { DEFAULT_CONSOLE_WIDTH, PrintUtilities } from './PrintUtilities';\nexport { RemoveColorsTextRewriter } from './RemoveColorsTextRewriter';\nexport { type ISplitterTransformOptions, SplitterTransform } from './SplitterTransform';\nexport { type IStdioLineTransformOptions, StderrLineTransform } from './StdioLineTransform';\nexport { type IStdioSummarizerOptions, StdioSummarizer } from './StdioSummarizer';\nexport { StdioWritable } from './StdioWritable';\nexport { type ITerminalTransformOptions, TerminalTransform } from './TerminalTransform';\nexport { type ITerminalWritableOptions, TerminalWritable } from './TerminalWritable';\nexport { type TextRewriterState, TextRewriter } from './TextRewriter';\nexport { type ITextRewriterTransformOptions, TextRewriterTransform } from './TextRewriterTransform';\nexport { AnsiEscape, type IAnsiEscapeConvertForTestsOptions } from './AnsiEscape';\nexport type { ITerminal, TerminalWriteParameters, ITerminalWriteOptions } from './ITerminal';\nexport { Terminal } from './Terminal';\nexport { Colorize } from './Colorize';\nexport { type ITerminalProvider, TerminalProviderSeverity } from './ITerminalProvider';\nexport { ConsoleTerminalProvider, type IConsoleTerminalProviderOptions } from './ConsoleTerminalProvider';\nexport {\n StringBufferTerminalProvider,\n type IStringBufferOutputOptions\n} from './StringBufferTerminalProvider';\nexport {\n PrefixProxyTerminalProvider,\n type IPrefixProxyTerminalProviderOptions,\n type IDynamicPrefixProxyTerminalProviderOptions,\n type IPrefixProxyTerminalProviderOptionsBase,\n type IStaticPrefixProxyTerminalProviderOptions\n} from './PrefixProxyTerminalProvider';\nexport { NoOpTerminalProvider } from './NoOpTerminalProvider';\nexport { TerminalStreamWritable, type ITerminalStreamWritableOptions } from './TerminalStreamWritable';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,8CAA8C;AAE9C;;;;;;;;GAQG;AAEH,uDAAqF;AAA7C,oHAAA,gBAAgB,OAAA;AACxD,mEAAuG;AAAzD,gIAAA,sBAAsB,OAAA;AACpE,mDAA0E;AAAjE,mHAAA,iBAAiB,OAAA;AAC1B,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,iFAGyC;AADvC,8IAAA,6BAA6B,OAAA;AAE/B,mDAAyE;AAAhE,uHAAA,qBAAqB,OAAA;AAAE,gHAAA,cAAc,OAAA;AAC9C,uEAAsE;AAA7D,oIAAA,wBAAwB,OAAA;AACjC,yDAAwF;AAA/C,sHAAA,iBAAiB,OAAA;AAC1D,2DAA4F;AAAlD,yHAAA,mBAAmB,OAAA;AAC7D,qDAAkF;AAA3C,kHAAA,eAAe,OAAA;AACtD,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,yDAAwF;AAA/C,sHAAA,iBAAiB,OAAA;AAC1D,uDAAqF;AAA7C,oHAAA,gBAAgB,OAAA;AACxD,+CAAsE;AAArC,4GAAA,YAAY,OAAA;AAC7C,iEAAoG;AAAvD,8HAAA,qBAAqB,OAAA;AAClE,2CAAkF;AAAzE,wGAAA,UAAU,OAAA;AAEnB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,yDAAuF;AAAtD,6HAAA,wBAAwB,OAAA;AACzD,qEAA0G;AAAjG,kIAAA,uBAAuB,OAAA;AAChC,+EAGwC;AAFtC,4IAAA,4BAA4B,OAAA;AAG9B,6EAMuC;AALrC,0IAAA,2BAA2B,OAAA;AAM7B,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,mEAAuG;AAA9F,gIAAA,sBAAsB,OAAA;AAC/B,uDAAqF;AAA5E,oHAAA,gBAAgB,OAAA","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\n/// <reference types=\"node\" preserve=\"true\" />\n\n/**\n * This library implements a system for processing human readable text that\n * will be output by console applications.\n *\n * @remarks\n * See the {@link TerminalWritable} documentation for an overview of the major concepts.\n *\n * @packageDocumentation\n */\n\nexport { type ICallbackWritableOptions, CallbackWritable } from './CallbackWritable';\nexport { type IDiscardStdoutTransformOptions, DiscardStdoutTransform } from './DiscardStdoutTransform';\nexport { TerminalChunkKind, type ITerminalChunk } from './ITerminalChunk';\nexport { MockWritable } from './MockWritable';\nexport {\n type INormalizeNewlinesTextRewriterOptions,\n NormalizeNewlinesTextRewriter\n} from './NormalizeNewlinesTextRewriter';\nexport { DEFAULT_CONSOLE_WIDTH, PrintUtilities } from './PrintUtilities';\nexport { RemoveColorsTextRewriter } from './RemoveColorsTextRewriter';\nexport { type ISplitterTransformOptions, SplitterTransform } from './SplitterTransform';\nexport { type IStdioLineTransformOptions, StderrLineTransform } from './StdioLineTransform';\nexport { type IStdioSummarizerOptions, StdioSummarizer } from './StdioSummarizer';\nexport { StdioWritable } from './StdioWritable';\nexport { type ITerminalTransformOptions, TerminalTransform } from './TerminalTransform';\nexport { type ITerminalWritableOptions, TerminalWritable } from './TerminalWritable';\nexport { type TextRewriterState, TextRewriter } from './TextRewriter';\nexport { type ITextRewriterTransformOptions, TextRewriterTransform } from './TextRewriterTransform';\nexport { AnsiEscape, type IAnsiEscapeConvertForTestsOptions } from './AnsiEscape';\nexport type { ITerminal, TerminalWriteParameters, ITerminalWriteOptions } from './ITerminal';\nexport { Terminal } from './Terminal';\nexport { Colorize } from './Colorize';\nexport { type ITerminalProvider, TerminalProviderSeverity } from './ITerminalProvider';\nexport { ConsoleTerminalProvider, type IConsoleTerminalProviderOptions } from './ConsoleTerminalProvider';\nexport {\n StringBufferTerminalProvider,\n type IStringBufferOutputOptions\n} from './StringBufferTerminalProvider';\nexport {\n PrefixProxyTerminalProvider,\n type IPrefixProxyTerminalProviderOptions,\n type IDynamicPrefixProxyTerminalProviderOptions,\n type IPrefixProxyTerminalProviderOptionsBase,\n type IStaticPrefixProxyTerminalProviderOptions\n} from './PrefixProxyTerminalProvider';\nexport { NoOpTerminalProvider } from './NoOpTerminalProvider';\nexport { TerminalStreamWritable, type ITerminalStreamWritableOptions } from './TerminalStreamWritable';\nexport { ProblemCollector, type IProblemCollectorOptions } from './ProblemCollector';\nexport type { IProblemCollector } from './IProblemCollector';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/terminal",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "description": "User interface primitives for console applications",
5
5
  "main": "lib/index.js",
6
6
  "typings": "dist/terminal.d.ts",
@@ -12,7 +12,8 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "supports-color": "~8.1.1",
15
- "@rushstack/node-core-library": "5.14.0"
15
+ "@rushstack/problem-matcher": "0.1.1",
16
+ "@rushstack/node-core-library": "5.15.1"
16
17
  },
17
18
  "devDependencies": {
18
19
  "@rushstack/heft": "0.74.3",