@rushstack/terminal 0.12.3 → 0.13.1

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.
@@ -981,7 +981,7 @@ export declare class Terminal implements ITerminal {
981
981
  * Specifies the kind of data represented by a {@link ITerminalChunk} object.
982
982
  * @public
983
983
  */
984
- export declare const enum TerminalChunkKind {
984
+ export declare enum TerminalChunkKind {
985
985
  /**
986
986
  * Indicates a `ITerminalChunk` object representing `stdout` console output.
987
987
  */
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.43.7"
8
+ "packageVersion": "7.46.2"
9
9
  }
10
10
  ]
11
11
  }
@@ -3,6 +3,7 @@
3
3
  // See LICENSE in the project root for license information.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.DiscardStdoutTransform = void 0;
6
+ const ITerminalChunk_1 = require("./ITerminalChunk");
6
7
  const TerminalTransform_1 = require("./TerminalTransform");
7
8
  var State;
8
9
  (function (State) {
@@ -59,14 +60,14 @@ class DiscardStdoutTransform extends TerminalTransform_1.TerminalTransform {
59
60
  if (chunk.text.indexOf('\r') >= 0) {
60
61
  throw new Error('DiscardStdoutTransform expects chunks with normalized newlines');
61
62
  }
62
- if (chunk.kind === "O" /* TerminalChunkKind.Stdout */) {
63
+ if (chunk.kind === ITerminalChunk_1.TerminalChunkKind.Stdout) {
63
64
  if (this._state === State.StderrFragment) {
64
65
  if (chunk.text.indexOf('\n') >= 0) {
65
66
  this._state = State.InsertLinefeed;
66
67
  }
67
68
  }
68
69
  }
69
- else if (chunk.kind === "E" /* TerminalChunkKind.Stderr */) {
70
+ else if (chunk.kind === ITerminalChunk_1.TerminalChunkKind.Stderr) {
70
71
  let correctedText;
71
72
  if (this._state === State.InsertLinefeed) {
72
73
  correctedText = '\n' + chunk.text;
@@ -74,7 +75,7 @@ class DiscardStdoutTransform extends TerminalTransform_1.TerminalTransform {
74
75
  else {
75
76
  correctedText = chunk.text;
76
77
  }
77
- this.destination.writeChunk({ kind: "E" /* TerminalChunkKind.Stderr */, text: correctedText });
78
+ this.destination.writeChunk({ kind: ITerminalChunk_1.TerminalChunkKind.Stderr, text: correctedText });
78
79
  if (correctedText.length > 0) {
79
80
  if (correctedText[correctedText.length - 1] === '\n') {
80
81
  this._state = State.Okay;
@@ -1 +1 @@
1
- {"version":3,"file":"DiscardStdoutTransform.js","sourceRoot":"","sources":["../src/DiscardStdoutTransform.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,2DAAwF;AASxF,IAAK,KAIJ;AAJD,WAAK,KAAK;IACR,iCAAI,CAAA;IACJ,qDAAc,CAAA;IACd,qDAAc,CAAA;AAChB,CAAC,EAJI,KAAK,KAAL,KAAK,QAIT;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAa,sBAAuB,SAAQ,qCAAiB;IAG3D,YAAmB,OAAuC;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC;IAC3B,CAAC;IAES,YAAY,CAAC,KAAqB;QAC1C,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;QACpF,CAAC;QAED,IAAI,KAAK,CAAC,IAAI,uCAA6B,EAAE,CAAC;YAC5C,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,cAAc,EAAE,CAAC;gBACzC,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBAClC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC;gBACrC,CAAC;YACH,CAAC;QACH,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,uCAA6B,EAAE,CAAC;YACnD,IAAI,aAAqB,CAAC;YAC1B,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,cAAc,EAAE,CAAC;gBACzC,aAAa,GAAG,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;YACpC,CAAC;iBAAM,CAAC;gBACN,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC;YAC7B,CAAC;YAED,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,IAAI,oCAA0B,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC;YAErF,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC7B,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;oBACrD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC;gBAC3B,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC;gBACrC,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;CACF;AAzCD,wDAyCC","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 ITerminalChunk, TerminalChunkKind } from './ITerminalChunk';\nimport { TerminalTransform, type ITerminalTransformOptions } from './TerminalTransform';\n\n/**\n * Constructor options for {@link DiscardStdoutTransform}\n *\n * @beta\n */\nexport interface IDiscardStdoutTransformOptions extends ITerminalTransformOptions {}\n\nenum State {\n Okay,\n StderrFragment,\n InsertLinefeed\n}\n\n/**\n * `DiscardStdoutTransform` discards `stdout` chunks while fixing up malformed `stderr` lines.\n *\n * @remarks\n * Suppose that a poorly behaved process produces output like this:\n *\n * ```ts\n * process.stdout.write('Starting operation...\\n');\n * process.stderr.write('An error occurred');\n * process.stdout.write('\\nFinishing up\\n');\n * process.stderr.write('The process completed with errors\\n');\n * ```\n *\n * When `stdout` and `stderr` are combined on the console, the mistake in the output would not be noticeable:\n * ```\n * Starting operation...\n * An error occurred\n * Finishing up\n * The process completed with errors\n * ```\n *\n * However, if we discard `stdout`, then `stderr` is missing a newline:\n * ```\n * An error occurredThe process completed with errors\n * ```\n *\n * Tooling scripts can introduce these sorts of problems via edge cases that are difficult to find and fix.\n * `DiscardStdoutTransform` can discard the `stdout` stream and fix up `stderr`:\n *\n * ```\n * An error occurred\n * The process completed with errors\n * ```\n *\n * @privateRemarks\n * This class is experimental and marked as `@beta`. The algorithm may need some fine-tuning, or there may\n * be better solutions to this problem.\n *\n * @beta\n */\nexport class DiscardStdoutTransform extends TerminalTransform {\n private _state: State;\n\n public constructor(options: IDiscardStdoutTransformOptions) {\n super(options);\n\n this._state = State.Okay;\n }\n\n protected onWriteChunk(chunk: ITerminalChunk): void {\n if (chunk.text.indexOf('\\r') >= 0) {\n throw new Error('DiscardStdoutTransform expects chunks with normalized newlines');\n }\n\n if (chunk.kind === TerminalChunkKind.Stdout) {\n if (this._state === State.StderrFragment) {\n if (chunk.text.indexOf('\\n') >= 0) {\n this._state = State.InsertLinefeed;\n }\n }\n } else if (chunk.kind === TerminalChunkKind.Stderr) {\n let correctedText: string;\n if (this._state === State.InsertLinefeed) {\n correctedText = '\\n' + chunk.text;\n } else {\n correctedText = chunk.text;\n }\n\n this.destination.writeChunk({ kind: TerminalChunkKind.Stderr, text: correctedText });\n\n if (correctedText.length > 0) {\n if (correctedText[correctedText.length - 1] === '\\n') {\n this._state = State.Okay;\n } else {\n this._state = State.StderrFragment;\n }\n }\n } else {\n this.destination.writeChunk(chunk);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"DiscardStdoutTransform.js","sourceRoot":"","sources":["../src/DiscardStdoutTransform.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,qDAA0E;AAC1E,2D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AE,aAAa,EAAE,CAAC,CAAC;YAErF,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC7B,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;oBACrD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC;gBAC3B,CAAC;qBAAM,CAAC;oBACN,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,cAAc,CAAC;gBACrC,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;CACF;AAzCD,wDAyCC","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 ITerminalChunk, TerminalChunkKind } from './ITerminalChunk';\nimport { TerminalTransform, type ITerminalTransformOptions } from './TerminalTransform';\n\n/**\n * Constructor options for {@link DiscardStdoutTransform}\n *\n * @beta\n */\nexport interface IDiscardStdoutTransformOptions extends ITerminalTransformOptions {}\n\nenum State {\n Okay,\n StderrFragment,\n InsertLinefeed\n}\n\n/**\n * `DiscardStdoutTransform` discards `stdout` chunks while fixing up malformed `stderr` lines.\n *\n * @remarks\n * Suppose that a poorly behaved process produces output like this:\n *\n * ```ts\n * process.stdout.write('Starting operation...\\n');\n * process.stderr.write('An error occurred');\n * process.stdout.write('\\nFinishing up\\n');\n * process.stderr.write('The process completed with errors\\n');\n * ```\n *\n * When `stdout` and `stderr` are combined on the console, the mistake in the output would not be noticeable:\n * ```\n * Starting operation...\n * An error occurred\n * Finishing up\n * The process completed with errors\n * ```\n *\n * However, if we discard `stdout`, then `stderr` is missing a newline:\n * ```\n * An error occurredThe process completed with errors\n * ```\n *\n * Tooling scripts can introduce these sorts of problems via edge cases that are difficult to find and fix.\n * `DiscardStdoutTransform` can discard the `stdout` stream and fix up `stderr`:\n *\n * ```\n * An error occurred\n * The process completed with errors\n * ```\n *\n * @privateRemarks\n * This class is experimental and marked as `@beta`. The algorithm may need some fine-tuning, or there may\n * be better solutions to this problem.\n *\n * @beta\n */\nexport class DiscardStdoutTransform extends TerminalTransform {\n private _state: State;\n\n public constructor(options: IDiscardStdoutTransformOptions) {\n super(options);\n\n this._state = State.Okay;\n }\n\n protected onWriteChunk(chunk: ITerminalChunk): void {\n if (chunk.text.indexOf('\\r') >= 0) {\n throw new Error('DiscardStdoutTransform expects chunks with normalized newlines');\n }\n\n if (chunk.kind === TerminalChunkKind.Stdout) {\n if (this._state === State.StderrFragment) {\n if (chunk.text.indexOf('\\n') >= 0) {\n this._state = State.InsertLinefeed;\n }\n }\n } else if (chunk.kind === TerminalChunkKind.Stderr) {\n let correctedText: string;\n if (this._state === State.InsertLinefeed) {\n correctedText = '\\n' + chunk.text;\n } else {\n correctedText = chunk.text;\n }\n\n this.destination.writeChunk({ kind: TerminalChunkKind.Stderr, text: correctedText });\n\n if (correctedText.length > 0) {\n if (correctedText[correctedText.length - 1] === '\\n') {\n this._state = State.Okay;\n } else {\n this._state = State.StderrFragment;\n }\n }\n } else {\n this.destination.writeChunk(chunk);\n }\n }\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Specifies the kind of data represented by a {@link ITerminalChunk} object.
3
3
  * @public
4
4
  */
5
- export declare const enum TerminalChunkKind {
5
+ export declare enum TerminalChunkKind {
6
6
  /**
7
7
  * Indicates a `ITerminalChunk` object representing `stdout` console output.
8
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ITerminalChunk.d.ts","sourceRoot":"","sources":["../src/ITerminalChunk.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,0BAAkB,iBAAiB;IACjC;;OAEG;IACH,MAAM,MAAM;IAEZ;;OAEG;IACH,MAAM,MAAM;CACb;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;OAQG;IACH,IAAI,EAAE,iBAAiB,CAAC;IAExB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd"}
1
+ {"version":3,"file":"ITerminalChunk.d.ts","sourceRoot":"","sources":["../src/ITerminalChunk.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,oBAAY,iBAAiB;IAC3B;;OAEG;IACH,MAAM,MAAM;IAEZ;;OAEG;IACH,MAAM,MAAM;CACb;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;OAQG;IACH,IAAI,EAAE,iBAAiB,CAAC;IAExB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd"}
@@ -2,4 +2,20 @@
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.TerminalChunkKind = void 0;
6
+ /**
7
+ * Specifies the kind of data represented by a {@link ITerminalChunk} object.
8
+ * @public
9
+ */
10
+ var TerminalChunkKind;
11
+ (function (TerminalChunkKind) {
12
+ /**
13
+ * Indicates a `ITerminalChunk` object representing `stdout` console output.
14
+ */
15
+ TerminalChunkKind["Stdout"] = "O";
16
+ /**
17
+ * Indicates a `ITerminalChunk` object representing `stderr` console output.
18
+ */
19
+ TerminalChunkKind["Stderr"] = "E";
20
+ })(TerminalChunkKind || (exports.TerminalChunkKind = TerminalChunkKind = {}));
5
21
  //# sourceMappingURL=ITerminalChunk.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ITerminalChunk.js","sourceRoot":"","sources":["../src/ITerminalChunk.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\n/**\n * Specifies the kind of data represented by a {@link ITerminalChunk} object.\n * @public\n */\nexport const enum TerminalChunkKind {\n /**\n * Indicates a `ITerminalChunk` object representing `stdout` console output.\n */\n Stdout = 'O',\n\n /**\n * Indicates a `ITerminalChunk` object representing `stderr` console output.\n */\n Stderr = 'E'\n}\n\n/**\n * Represents a chunk of output that will ultimately be written to a {@link TerminalWritable}.\n *\n * @remarks\n * Today `ITerminalChunk` represents the `stdout` and `stderr` text streams. In the future,\n * we plan to expand it to include other console UI elements such as instructions for displaying\n * an interactive progress bar. We may also add other metadata, for example tracking whether\n * the `text` string is known to contain color codes or not.\n *\n * The `ITerminalChunk` object should be considered to be immutable once it is created.\n * For example, {@link SplitterTransform} may pass the same chunk to multiple destinations.\n *\n * @public\n */\nexport interface ITerminalChunk {\n /**\n * Indicates the kind of information stored in this chunk.\n *\n * @remarks\n * More kinds will be introduced in the future. Implementors of\n * {@link TerminalWritable.onWriteChunk} should ignore unrecognized `TerminalChunkKind`\n * values. `TerminalTransform` implementors should pass along unrecognized chunks\n * rather than discarding them.\n */\n kind: TerminalChunkKind;\n\n /**\n * The next chunk of text from the `stderr` or `stdout` stream.\n */\n text: string;\n}\n"]}
1
+ {"version":3,"file":"ITerminalChunk.js","sourceRoot":"","sources":["../src/ITerminalChunk.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;GAGG;AACH,IAAY,iBAUX;AAVD,WAAY,iBAAiB;IAC3B;;OAEG;IACH,iCAAY,CAAA;IAEZ;;OAEG;IACH,iCAAY,CAAA;AACd,CAAC,EAVW,iBAAiB,iCAAjB,iBAAiB,QAU5B","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/**\n * Specifies the kind of data represented by a {@link ITerminalChunk} object.\n * @public\n */\nexport enum TerminalChunkKind {\n /**\n * Indicates a `ITerminalChunk` object representing `stdout` console output.\n */\n Stdout = 'O',\n\n /**\n * Indicates a `ITerminalChunk` object representing `stderr` console output.\n */\n Stderr = 'E'\n}\n\n/**\n * Represents a chunk of output that will ultimately be written to a {@link TerminalWritable}.\n *\n * @remarks\n * Today `ITerminalChunk` represents the `stdout` and `stderr` text streams. In the future,\n * we plan to expand it to include other console UI elements such as instructions for displaying\n * an interactive progress bar. We may also add other metadata, for example tracking whether\n * the `text` string is known to contain color codes or not.\n *\n * The `ITerminalChunk` object should be considered to be immutable once it is created.\n * For example, {@link SplitterTransform} may pass the same chunk to multiple destinations.\n *\n * @public\n */\nexport interface ITerminalChunk {\n /**\n * Indicates the kind of information stored in this chunk.\n *\n * @remarks\n * More kinds will be introduced in the future. Implementors of\n * {@link TerminalWritable.onWriteChunk} should ignore unrecognized `TerminalChunkKind`\n * values. `TerminalTransform` implementors should pass along unrecognized chunks\n * rather than discarding them.\n */\n kind: TerminalChunkKind;\n\n /**\n * The next chunk of text from the `stderr` or `stdout` stream.\n */\n text: string;\n}\n"]}
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.StderrLineTransform = void 0;
6
6
  const node_core_library_1 = require("@rushstack/node-core-library");
7
+ const ITerminalChunk_1 = require("./ITerminalChunk");
7
8
  const TerminalTransform_1 = require("./TerminalTransform");
8
9
  /**
9
10
  * `StderrLineTransform` normalizes lines that mix characters from `stdout` and `stderr`,
@@ -70,7 +71,7 @@ class StderrLineTransform extends TerminalTransform_1.TerminalTransform {
70
71
  const text = chunk.text;
71
72
  let startIndex = 0;
72
73
  while (startIndex < text.length) {
73
- if (chunk.kind === "E" /* TerminalChunkKind.Stderr */) {
74
+ if (chunk.kind === ITerminalChunk_1.TerminalChunkKind.Stderr) {
74
75
  this._accumulatedStderr = true;
75
76
  }
76
77
  const endIndex = text.indexOf('\n', startIndex);
@@ -96,13 +97,13 @@ class StderrLineTransform extends TerminalTransform_1.TerminalTransform {
96
97
  this._accumulatedLine += this.newline;
97
98
  if (this._accumulatedStderr) {
98
99
  this.destination.writeChunk({
99
- kind: "E" /* TerminalChunkKind.Stderr */,
100
+ kind: ITerminalChunk_1.TerminalChunkKind.Stderr,
100
101
  text: this._accumulatedLine
101
102
  });
102
103
  }
103
104
  else {
104
105
  this.destination.writeChunk({
105
- kind: "O" /* TerminalChunkKind.Stdout */,
106
+ kind: ITerminalChunk_1.TerminalChunkKind.Stdout,
106
107
  text: this._accumulatedLine
107
108
  });
108
109
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StdioLineTransform.js","sourceRoot":"","sources":["../src/StdioLineTransform.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAiE;AAGjE,2DAAwF;AAaxF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,MAAa,mBAAoB,SAAQ,qCAAiB;IAMxD,YAAmB,OAAmC;QACpD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAEhC,IAAI,CAAC,OAAO,GAAG,wBAAI,CAAC,UAAU,CAAC,OAAO,CAAC,WAAW,IAAI,+BAAW,CAAC,EAAE,CAAC,CAAC;IACxE,CAAC;IAES,YAAY,CAAC,KAAqB;QAC1C,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;QACjF,CAAC;QAED,qFAAqF;QACrF,sBAAsB;QACtB,MAAM,IAAI,GAAW,KAAK,CAAC,IAAI,CAAC;QAChC,IAAI,UAAU,GAAW,CAAC,CAAC;QAE3B,OAAO,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAChC,IAAI,KAAK,CAAC,IAAI,uCAA6B,EAAE,CAAC;gBAC5C,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;YACjC,CAAC;YAED,MAAM,QAAQ,GAAW,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YACxD,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;gBACjB,uCAAuC;gBACvC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;gBACpD,MAAM;YACR,CAAC;YAED,6BAA6B;YAC7B,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;YAE9D,IAAI,CAAC,uBAAuB,EAAE,CAAC;YAE/B,cAAc;YACd,UAAU,GAAG,QAAQ,GAAG,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAES,OAAO;QACf,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAEO,uBAAuB;QAC7B,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,OAAO,CAAC;QAEtC,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC5B,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;gBAC1B,IAAI,oCAA0B;gBAC9B,IAAI,EAAE,IAAI,CAAC,gBAAgB;aAC5B,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;gBAC1B,IAAI,oCAA0B;gBAC9B,IAAI,EAAE,IAAI,CAAC,gBAAgB;aAC5B,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IAClC,CAAC;CACF;AAxED,kDAwEC","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 { Text, NewlineKind } from '@rushstack/node-core-library';\n\nimport { type ITerminalChunk, TerminalChunkKind } from './ITerminalChunk';\nimport { TerminalTransform, type ITerminalTransformOptions } from './TerminalTransform';\n\n/**\n * Constructor options for {@link StderrLineTransform}\n * @beta\n */\nexport interface IStdioLineTransformOptions extends ITerminalTransformOptions {\n /**\n * Specifies the kind of newline for the output.\n */\n newlineKind?: NewlineKind;\n}\n\n/**\n * `StderrLineTransform` normalizes lines that mix characters from `stdout` and `stderr`,\n * so that each output line is routed entirely to `stdout` or `stderr`.\n *\n * @remarks\n * IMPORTANT: This transform assumes that its input has been normalized to use `\"\\n\"` newlines.\n *\n * IMPORTANT: This transform does not produce realtime output, because lines are buffered\n * until a newline character is encountered.\n *\n * Suppose that a poorly behaved process produces output like this:\n *\n * ```ts\n * process.stderr.write('An error occurred, cleaning up');\n * process.stdout.write('.'); // (delay)\n * process.stdout.write('.'); // (delay)\n * process.stdout.write('.');\n * process.stdout.write('\\n');\n * process.stderr.write('The process completed with errors\\n');\n * ```\n *\n * When `stdout` and `stderr` are combined on the console, the mistake in the output would not be noticeable:\n * ```\n * An error occurred, cleaning up...\n * The process completed with errors\n * ```\n *\n * However, if we discard `stdout`, then `stderr` is malformed:\n * ```\n * An error occurred, cleaning upThe process completed with errors\n * ```\n *\n * Tooling scripts can introduce these sorts of problems via edge cases that are difficult to find and fix.\n *\n * `StderrLineTransform` normalizes the output so that if a combined line contains any `stderr` characters,\n * then the entire line is routed to `stderr`. Later, if we discard `stdout`, then the output will\n * preserve the appropriate context:\n *\n * ```\n * An error occurred, cleaning up...\n * The process completed with errors\n * ```\n *\n * @privateRemarks\n * This class is experimental and marked as `@beta`. The algorithm may need some fine-tuning, or there may\n * be better solutions to this problem.\n *\n * @beta\n */\nexport class StderrLineTransform extends TerminalTransform {\n private _accumulatedLine: string;\n private _accumulatedStderr: boolean;\n\n public readonly newline: string;\n\n public constructor(options: IStdioLineTransformOptions) {\n super(options);\n\n this._accumulatedLine = '';\n this._accumulatedStderr = false;\n\n this.newline = Text.getNewline(options.newlineKind || NewlineKind.Lf);\n }\n\n protected onWriteChunk(chunk: ITerminalChunk): void {\n if (chunk.text.indexOf('\\r') >= 0) {\n throw new Error('StderrLineTransform expects chunks with normalized newlines');\n }\n\n // After _newlineNormalizerTransform was applied, we can now assume that all newlines\n // use the \"\\n\" string\n const text: string = chunk.text;\n let startIndex: number = 0;\n\n while (startIndex < text.length) {\n if (chunk.kind === TerminalChunkKind.Stderr) {\n this._accumulatedStderr = true;\n }\n\n const endIndex: number = text.indexOf('\\n', startIndex);\n if (endIndex < 0) {\n // we did not find \\n, so simply append\n this._accumulatedLine += text.substring(startIndex);\n break;\n }\n\n // append everything up to \\n\n this._accumulatedLine += text.substring(startIndex, endIndex);\n\n this._processAccumulatedLine();\n\n // skip the \\n\n startIndex = endIndex + 1;\n }\n }\n\n protected onClose(): void {\n if (this._accumulatedLine.length > 0) {\n this._processAccumulatedLine();\n }\n this.autocloseDestination();\n }\n\n private _processAccumulatedLine(): void {\n this._accumulatedLine += this.newline;\n\n if (this._accumulatedStderr) {\n this.destination.writeChunk({\n kind: TerminalChunkKind.Stderr,\n text: this._accumulatedLine\n });\n } else {\n this.destination.writeChunk({\n kind: TerminalChunkKind.Stdout,\n text: this._accumulatedLine\n });\n }\n\n this._accumulatedLine = '';\n this._accumulatedStderr = false;\n }\n}\n"]}
1
+ {"version":3,"file":"StdioLineTransform.js","sourceRoot":"","sources":["../src/StdioLineTransform.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAiE;AAEjE,qDAA0E;AAC1E,2DAAwF;AAaxF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,MAAa,mBAAoB,SAAQ,qCAAiB;IAMxD,YAAmB,OAAmC;QACpD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAEhC,IAAI,CAAC,OAAO,GAAG,wBAAI,CAAC,UAAU,CAAC,OAAO,CAA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C;QAEtC,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC5B,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;gBAC1B,IAAI,EAAE,kCAAiB,CAAC,MAAM;gBAC9B,IAAI,EAAE,IAAI,CAAC,gBAAgB;aAC5B,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;gBAC1B,IAAI,EAAE,kCAAiB,CAAC,MAAM;gBAC9B,IAAI,EAAE,IAAI,CAAC,gBAAgB;aAC5B,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;IAClC,CAAC;CACF;AAxED,kDAwEC","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 { Text, NewlineKind } from '@rushstack/node-core-library';\n\nimport { type ITerminalChunk, TerminalChunkKind } from './ITerminalChunk';\nimport { TerminalTransform, type ITerminalTransformOptions } from './TerminalTransform';\n\n/**\n * Constructor options for {@link StderrLineTransform}\n * @beta\n */\nexport interface IStdioLineTransformOptions extends ITerminalTransformOptions {\n /**\n * Specifies the kind of newline for the output.\n */\n newlineKind?: NewlineKind;\n}\n\n/**\n * `StderrLineTransform` normalizes lines that mix characters from `stdout` and `stderr`,\n * so that each output line is routed entirely to `stdout` or `stderr`.\n *\n * @remarks\n * IMPORTANT: This transform assumes that its input has been normalized to use `\"\\n\"` newlines.\n *\n * IMPORTANT: This transform does not produce realtime output, because lines are buffered\n * until a newline character is encountered.\n *\n * Suppose that a poorly behaved process produces output like this:\n *\n * ```ts\n * process.stderr.write('An error occurred, cleaning up');\n * process.stdout.write('.'); // (delay)\n * process.stdout.write('.'); // (delay)\n * process.stdout.write('.');\n * process.stdout.write('\\n');\n * process.stderr.write('The process completed with errors\\n');\n * ```\n *\n * When `stdout` and `stderr` are combined on the console, the mistake in the output would not be noticeable:\n * ```\n * An error occurred, cleaning up...\n * The process completed with errors\n * ```\n *\n * However, if we discard `stdout`, then `stderr` is malformed:\n * ```\n * An error occurred, cleaning upThe process completed with errors\n * ```\n *\n * Tooling scripts can introduce these sorts of problems via edge cases that are difficult to find and fix.\n *\n * `StderrLineTransform` normalizes the output so that if a combined line contains any `stderr` characters,\n * then the entire line is routed to `stderr`. Later, if we discard `stdout`, then the output will\n * preserve the appropriate context:\n *\n * ```\n * An error occurred, cleaning up...\n * The process completed with errors\n * ```\n *\n * @privateRemarks\n * This class is experimental and marked as `@beta`. The algorithm may need some fine-tuning, or there may\n * be better solutions to this problem.\n *\n * @beta\n */\nexport class StderrLineTransform extends TerminalTransform {\n private _accumulatedLine: string;\n private _accumulatedStderr: boolean;\n\n public readonly newline: string;\n\n public constructor(options: IStdioLineTransformOptions) {\n super(options);\n\n this._accumulatedLine = '';\n this._accumulatedStderr = false;\n\n this.newline = Text.getNewline(options.newlineKind || NewlineKind.Lf);\n }\n\n protected onWriteChunk(chunk: ITerminalChunk): void {\n if (chunk.text.indexOf('\\r') >= 0) {\n throw new Error('StderrLineTransform expects chunks with normalized newlines');\n }\n\n // After _newlineNormalizerTransform was applied, we can now assume that all newlines\n // use the \"\\n\" string\n const text: string = chunk.text;\n let startIndex: number = 0;\n\n while (startIndex < text.length) {\n if (chunk.kind === TerminalChunkKind.Stderr) {\n this._accumulatedStderr = true;\n }\n\n const endIndex: number = text.indexOf('\\n', startIndex);\n if (endIndex < 0) {\n // we did not find \\n, so simply append\n this._accumulatedLine += text.substring(startIndex);\n break;\n }\n\n // append everything up to \\n\n this._accumulatedLine += text.substring(startIndex, endIndex);\n\n this._processAccumulatedLine();\n\n // skip the \\n\n startIndex = endIndex + 1;\n }\n }\n\n protected onClose(): void {\n if (this._accumulatedLine.length > 0) {\n this._processAccumulatedLine();\n }\n this.autocloseDestination();\n }\n\n private _processAccumulatedLine(): void {\n this._accumulatedLine += this.newline;\n\n if (this._accumulatedStderr) {\n this.destination.writeChunk({\n kind: TerminalChunkKind.Stderr,\n text: this._accumulatedLine\n });\n } else {\n this.destination.writeChunk({\n kind: TerminalChunkKind.Stdout,\n text: this._accumulatedLine\n });\n }\n\n this._accumulatedLine = '';\n this._accumulatedStderr = false;\n }\n}\n"]}
@@ -3,6 +3,7 @@
3
3
  // See LICENSE in the project root for license information.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.StdioSummarizer = void 0;
6
+ const ITerminalChunk_1 = require("./ITerminalChunk");
6
7
  const TerminalWritable_1 = require("./TerminalWritable");
7
8
  /**
8
9
  * Summarizes the results of a failed build task by returning a subset of `stderr` output not to exceed
@@ -70,14 +71,14 @@ class StdioSummarizer extends TerminalWritable_1.TerminalWritable {
70
71
  ' Invalid input: ' +
71
72
  JSON.stringify(chunk.text));
72
73
  }
73
- if (chunk.kind === "E" /* TerminalChunkKind.Stderr */ && !this._abridgedStderr) {
74
+ if (chunk.kind === ITerminalChunk_1.TerminalChunkKind.Stderr && !this._abridgedStderr) {
74
75
  // The first time we see stderr, switch to capturing stderr
75
76
  this._abridgedStderr = true;
76
77
  this._abridgedLeading.length = 0;
77
78
  this._abridgedTrailing.length = 0;
78
79
  this._abridgedOmittedLines = 0;
79
80
  }
80
- else if (this._abridgedStderr && chunk.kind !== "E" /* TerminalChunkKind.Stderr */) {
81
+ else if (this._abridgedStderr && chunk.kind !== ITerminalChunk_1.TerminalChunkKind.Stderr) {
81
82
  // If we're capturing stderr, then ignore non-stderr input
82
83
  return;
83
84
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StdioSummarizer.js","sourceRoot":"","sources":["../src/StdioSummarizer.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAG3D,yDAAqF;AAoBrF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,eAAgB,SAAQ,mCAAgB;IAYnD,YAAmB,OAAiC;QAClD,KAAK,CAAC,OAAO,CAAC,CAAC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AAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAC1E,MAAM,IAAI,KAAK,CACb,+FAA+F;gBAC7F,kBAAkB;gBAClB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAC7B,CAAC;QACJ,CAAC;QAED,IAAI,KAAK,CAAC,IAAI,uCAA6B,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YACrE,2DAA2D;YAC3D,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;YAC5B,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;YACjC,IAAI,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC;YAClC,IAAI,CAAC,qBAAqB,GAAG,CAAC,CAAC;QACjC,CAAC;aAAM,IAAI,IAAI,CAAC,eAAe,IAAI,KAAK,CAAC,IAAI,uCAA6B,EAAE,CAAC;YAC3E,0DAA0D;YAC1D,OAAO;QACT,CAAC;QAED,uCAAuC;QACvC,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;YACtD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACvC,OAAO;QACT,CAAC;QAED,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAExC,yDAAyD;QACzD,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;YAC3D,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;YAC/B,EAAE,IAAI,CAAC,qBAAqB,CAAC;QAC/B,CAAC;IACH,CAAC;CACF;AAlFD,0CAkFC","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 ITerminalChunk, TerminalChunkKind } from './ITerminalChunk';\nimport { type ITerminalWritableOptions, TerminalWritable } from './TerminalWritable';\n\n/**\n * Constructor options for {@link StdioSummarizer}.\n * @beta\n */\nexport interface IStdioSummarizerOptions extends ITerminalWritableOptions {\n /**\n * Specifies the maximum number of leading lines to include in the summary.\n * @defaultValue `10`\n */\n leadingLines?: number;\n\n /**\n * Specifies the maximum number of trailing lines to include in the summary.\n * @defaultValue `10`\n */\n trailingLines?: number;\n}\n\n/**\n * Summarizes the results of a failed build task by returning a subset of `stderr` output not to exceed\n * a specified maximum number of lines.\n *\n * @remarks\n * IMPORTANT: This transform assumes that its input was prepared by {@link StderrLineTransform}, so that each\n * {@link ITerminalChunk.text} item is a single line terminated by a `\"\\n\"` character.\n *\n * The {@link IStdioSummarizerOptions.leadingLines} and {@link IStdioSummarizerOptions.trailingLines}\n * counts specify the maximum number of lines to be returned. Any additional lines will be omitted.\n * For example, if `leadingLines` and `trailingLines` were set to `3`, then the summary of 16 `stderr` lines might\n * look like this:\n *\n * ```\n * Line 1\n * Line 2\n * Line 3\n * ...10 lines omitted...\n * Line 14\n * Line 15\n * Line 16\n * ```\n *\n * If the `stderr` output is completely empty, then the `stdout` output will be summarized instead.\n *\n * @beta\n */\nexport class StdioSummarizer extends TerminalWritable {\n // Capture up to this many leading lines\n private _leadingLines: number;\n\n // Capture up to this many trailing lines\n private _trailingLines: number;\n\n private readonly _abridgedLeading: string[];\n private readonly _abridgedTrailing: string[];\n private _abridgedOmittedLines: number = 0;\n private _abridgedStderr: boolean;\n\n public constructor(options?: IStdioSummarizerOptions) {\n super(options);\n\n if (!options) {\n options = {};\n }\n\n this._leadingLines = options.leadingLines !== undefined ? options.leadingLines : 10;\n this._trailingLines = options.trailingLines !== undefined ? options.trailingLines : 10;\n\n this._abridgedLeading = [];\n this._abridgedTrailing = [];\n this._abridgedStderr = false;\n }\n\n /**\n * Returns the summary report.\n *\n * @remarks\n * The `close()` method must be called before `getReport()` can be used.\n */\n public getReport(): string {\n if (this.isOpen) {\n throw new Error('The summary cannot be prepared until after close() is called.');\n }\n const report: string[] = [...this._abridgedLeading];\n if (this._abridgedOmittedLines === 1) {\n report.push(` ...${this._abridgedOmittedLines} line omitted...\\n`);\n }\n if (this._abridgedOmittedLines > 1) {\n report.push(` ...${this._abridgedOmittedLines} lines omitted...\\n`);\n }\n report.push(...this._abridgedTrailing);\n return report.join('');\n }\n\n public onWriteChunk(chunk: ITerminalChunk): void {\n if (chunk.text.length === 0 || chunk.text[chunk.text.length - 1] !== '\\n') {\n throw new Error(\n 'StdioSummarizer expects chunks that were separated parsed into lines by StderrLineTransform\\n' +\n ' Invalid input: ' +\n JSON.stringify(chunk.text)\n );\n }\n\n if (chunk.kind === TerminalChunkKind.Stderr && !this._abridgedStderr) {\n // The first time we see stderr, switch to capturing stderr\n this._abridgedStderr = true;\n this._abridgedLeading.length = 0;\n this._abridgedTrailing.length = 0;\n this._abridgedOmittedLines = 0;\n } else if (this._abridgedStderr && chunk.kind !== TerminalChunkKind.Stderr) {\n // If we're capturing stderr, then ignore non-stderr input\n return;\n }\n\n // Did we capture enough leading lines?\n if (this._abridgedLeading.length < this._leadingLines) {\n this._abridgedLeading.push(chunk.text);\n return;\n }\n\n this._abridgedTrailing.push(chunk.text);\n\n // If we captured to many trailing lines, omit the extras\n while (this._abridgedTrailing.length > this._trailingLines) {\n this._abridgedTrailing.shift();\n ++this._abridgedOmittedLines;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"StdioSummarizer.js","sourceRoot":"","sources":["../src/StdioSummarizer.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,qDAA0E;AAC1E,yDAAqF;AAoBrF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAa,eAAgB,SAAQ,mCAAgB;IAYnD,YAAmB,OAAiC;QAClD,KAAK,CAAC,OAAO,CAAC,CAAC;QAJT,0BAAqB,GAAW,CAAC,CAAC;QAMxC,IAAI,CAAC,OAAO,EA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AK,IAAI,EAAE,CAAC;YAC1E,MAAM,IAAI,KAAK,CACb,+FAA+F;gBAC7F,kBAAkB;gBAClB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAC7B,CAAC;QACJ,CAAC;QAED,IAAI,KAAK,CAAC,IAAI,KAAK,kCAAiB,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YACrE,2DAA2D;YAC3D,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;YAC5B,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;YACjC,IAAI,CAAC,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC;YAClC,IAAI,CAAC,qBAAqB,GAAG,CAAC,CAAC;QACjC,CAAC;aAAM,IAAI,IAAI,CAAC,eAAe,IAAI,KAAK,CAAC,IAAI,KAAK,kCAAiB,CAAC,MAAM,EAAE,CAAC;YAC3E,0DAA0D;YAC1D,OAAO;QACT,CAAC;QAED,uCAAuC;QACvC,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;YACtD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACvC,OAAO;QACT,CAAC;QAED,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAExC,yDAAyD;QACzD,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;YAC3D,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;YAC/B,EAAE,IAAI,CAAC,qBAAqB,CAAC;QAC/B,CAAC;IACH,CAAC;CACF;AAlFD,0CAkFC","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 ITerminalChunk, TerminalChunkKind } from './ITerminalChunk';\nimport { type ITerminalWritableOptions, TerminalWritable } from './TerminalWritable';\n\n/**\n * Constructor options for {@link StdioSummarizer}.\n * @beta\n */\nexport interface IStdioSummarizerOptions extends ITerminalWritableOptions {\n /**\n * Specifies the maximum number of leading lines to include in the summary.\n * @defaultValue `10`\n */\n leadingLines?: number;\n\n /**\n * Specifies the maximum number of trailing lines to include in the summary.\n * @defaultValue `10`\n */\n trailingLines?: number;\n}\n\n/**\n * Summarizes the results of a failed build task by returning a subset of `stderr` output not to exceed\n * a specified maximum number of lines.\n *\n * @remarks\n * IMPORTANT: This transform assumes that its input was prepared by {@link StderrLineTransform}, so that each\n * {@link ITerminalChunk.text} item is a single line terminated by a `\"\\n\"` character.\n *\n * The {@link IStdioSummarizerOptions.leadingLines} and {@link IStdioSummarizerOptions.trailingLines}\n * counts specify the maximum number of lines to be returned. Any additional lines will be omitted.\n * For example, if `leadingLines` and `trailingLines` were set to `3`, then the summary of 16 `stderr` lines might\n * look like this:\n *\n * ```\n * Line 1\n * Line 2\n * Line 3\n * ...10 lines omitted...\n * Line 14\n * Line 15\n * Line 16\n * ```\n *\n * If the `stderr` output is completely empty, then the `stdout` output will be summarized instead.\n *\n * @beta\n */\nexport class StdioSummarizer extends TerminalWritable {\n // Capture up to this many leading lines\n private _leadingLines: number;\n\n // Capture up to this many trailing lines\n private _trailingLines: number;\n\n private readonly _abridgedLeading: string[];\n private readonly _abridgedTrailing: string[];\n private _abridgedOmittedLines: number = 0;\n private _abridgedStderr: boolean;\n\n public constructor(options?: IStdioSummarizerOptions) {\n super(options);\n\n if (!options) {\n options = {};\n }\n\n this._leadingLines = options.leadingLines !== undefined ? options.leadingLines : 10;\n this._trailingLines = options.trailingLines !== undefined ? options.trailingLines : 10;\n\n this._abridgedLeading = [];\n this._abridgedTrailing = [];\n this._abridgedStderr = false;\n }\n\n /**\n * Returns the summary report.\n *\n * @remarks\n * The `close()` method must be called before `getReport()` can be used.\n */\n public getReport(): string {\n if (this.isOpen) {\n throw new Error('The summary cannot be prepared until after close() is called.');\n }\n const report: string[] = [...this._abridgedLeading];\n if (this._abridgedOmittedLines === 1) {\n report.push(` ...${this._abridgedOmittedLines} line omitted...\\n`);\n }\n if (this._abridgedOmittedLines > 1) {\n report.push(` ...${this._abridgedOmittedLines} lines omitted...\\n`);\n }\n report.push(...this._abridgedTrailing);\n return report.join('');\n }\n\n public onWriteChunk(chunk: ITerminalChunk): void {\n if (chunk.text.length === 0 || chunk.text[chunk.text.length - 1] !== '\\n') {\n throw new Error(\n 'StdioSummarizer expects chunks that were separated parsed into lines by StderrLineTransform\\n' +\n ' Invalid input: ' +\n JSON.stringify(chunk.text)\n );\n }\n\n if (chunk.kind === TerminalChunkKind.Stderr && !this._abridgedStderr) {\n // The first time we see stderr, switch to capturing stderr\n this._abridgedStderr = true;\n this._abridgedLeading.length = 0;\n this._abridgedTrailing.length = 0;\n this._abridgedOmittedLines = 0;\n } else if (this._abridgedStderr && chunk.kind !== TerminalChunkKind.Stderr) {\n // If we're capturing stderr, then ignore non-stderr input\n return;\n }\n\n // Did we capture enough leading lines?\n if (this._abridgedLeading.length < this._leadingLines) {\n this._abridgedLeading.push(chunk.text);\n return;\n }\n\n this._abridgedTrailing.push(chunk.text);\n\n // If we captured to many trailing lines, omit the extras\n while (this._abridgedTrailing.length > this._trailingLines) {\n this._abridgedTrailing.shift();\n ++this._abridgedOmittedLines;\n }\n }\n}\n"]}
@@ -7,6 +7,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.StdioWritable = void 0;
9
9
  const process_1 = __importDefault(require("process"));
10
+ const ITerminalChunk_1 = require("./ITerminalChunk");
10
11
  const TerminalWritable_1 = require("./TerminalWritable");
11
12
  /**
12
13
  * A {@link TerminalWritable} subclass that writes its output directly to the process `stdout` and `stderr`
@@ -20,10 +21,10 @@ const TerminalWritable_1 = require("./TerminalWritable");
20
21
  */
21
22
  class StdioWritable extends TerminalWritable_1.TerminalWritable {
22
23
  onWriteChunk(chunk) {
23
- if (chunk.kind === "O" /* TerminalChunkKind.Stdout */) {
24
+ if (chunk.kind === ITerminalChunk_1.TerminalChunkKind.Stdout) {
24
25
  process_1.default.stdout.write(chunk.text);
25
26
  }
26
- else if (chunk.kind === "E" /* TerminalChunkKind.Stderr */) {
27
+ else if (chunk.kind === ITerminalChunk_1.TerminalChunkKind.Stderr) {
27
28
  process_1.default.stderr.write(chunk.text);
28
29
  }
29
30
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StdioWritable.js","sourceRoot":"","sources":["../src/StdioWritable.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,sDAA8B;AAE9B,yDAAsD;AAEtD;;;;;;;;;GASG;AACH,MAAa,aAAc,SAAQ,mCAAgB;IAGvC,YAAY,CAAC,KAAqB;QAC1C,IAAI,KAAK,CAAC,IAAI,uCAA6B,EAAE,CAAC;YAC5C,iBAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,uCAA6B,EAAE,CAAC;YACnD,iBAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;;AATH,sCAUC;AATe,sBAAQ,GAAkB,IAAI,aAAa,EAAE,CAAC","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 process from 'process';\nimport { type ITerminalChunk, TerminalChunkKind } from './ITerminalChunk';\nimport { TerminalWritable } from './TerminalWritable';\n\n/**\n * A {@link TerminalWritable} subclass that writes its output directly to the process `stdout` and `stderr`\n * streams.\n *\n * @remarks\n * This is the standard output target for a process. You normally do not need to construct\n * this class; the {@link StdioWritable.\"instance\"} singleton can be used instead.\n *\n * @public\n */\nexport class StdioWritable extends TerminalWritable {\n public static instance: StdioWritable = new StdioWritable();\n\n protected onWriteChunk(chunk: ITerminalChunk): void {\n if (chunk.kind === TerminalChunkKind.Stdout) {\n process.stdout.write(chunk.text);\n } else if (chunk.kind === TerminalChunkKind.Stderr) {\n process.stderr.write(chunk.text);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"StdioWritable.js","sourceRoot":"","sources":["../src/StdioWritable.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAE3D,sDAA8B;AAC9B,qDAA0E;AAC1E,yDAAsD;AAEtD;;;;;;;;;GASG;AACH,MAAa,aAAc,SAAQ,mCAAgB;IAGvC,YAAY,CAAC,KAAqB;QAC1C,IAAI,KAAK,CAAC,IAAI,KAAK,kCAAiB,CAAC,MAAM,EAAE,CAAC;YAC5C,iBAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,KAAK,kCAAiB,CAAC,MAAM,EAAE,CAAC;YACnD,iBAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;;AATH,sCAUC;AATe,sBAAQ,GAAkB,IAAI,aAAa,EAAE,CAAC","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 process from 'process';\nimport { type ITerminalChunk, TerminalChunkKind } from './ITerminalChunk';\nimport { TerminalWritable } from './TerminalWritable';\n\n/**\n * A {@link TerminalWritable} subclass that writes its output directly to the process `stdout` and `stderr`\n * streams.\n *\n * @remarks\n * This is the standard output target for a process. You normally do not need to construct\n * this class; the {@link StdioWritable.\"instance\"} singleton can be used instead.\n *\n * @public\n */\nexport class StdioWritable extends TerminalWritable {\n public static instance: StdioWritable = new StdioWritable();\n\n protected onWriteChunk(chunk: ITerminalChunk): void {\n if (chunk.kind === TerminalChunkKind.Stdout) {\n process.stdout.write(chunk.text);\n } else if (chunk.kind === TerminalChunkKind.Stderr) {\n process.stderr.write(chunk.text);\n }\n }\n}\n"]}
@@ -3,6 +3,7 @@
3
3
  // See LICENSE in the project root for license information.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.TextRewriterTransform = void 0;
6
+ const ITerminalChunk_1 = require("./ITerminalChunk");
6
7
  const TerminalTransform_1 = require("./TerminalTransform");
7
8
  const RemoveColorsTextRewriter_1 = require("./RemoveColorsTextRewriter");
8
9
  const NormalizeNewlinesTextRewriter_1 = require("./NormalizeNewlinesTextRewriter");
@@ -38,10 +39,10 @@ class TextRewriterTransform extends TerminalTransform_1.TerminalTransform {
38
39
  this._stdoutStates = this.textRewriters.map((x) => x.initialize());
39
40
  }
40
41
  onWriteChunk(chunk) {
41
- if (chunk.kind === "E" /* TerminalChunkKind.Stderr */) {
42
+ if (chunk.kind === ITerminalChunk_1.TerminalChunkKind.Stderr) {
42
43
  this._processText(chunk, this._stderrStates);
43
44
  }
44
- else if (chunk.kind === "O" /* TerminalChunkKind.Stdout */) {
45
+ else if (chunk.kind === ITerminalChunk_1.TerminalChunkKind.Stdout) {
45
46
  this._processText(chunk, this._stdoutStates);
46
47
  }
47
48
  else {
@@ -84,8 +85,8 @@ class TextRewriterTransform extends TerminalTransform_1.TerminalTransform {
84
85
  }
85
86
  }
86
87
  onClose() {
87
- this._closeRewriters(this._stderrStates, "E" /* TerminalChunkKind.Stderr */);
88
- this._closeRewriters(this._stdoutStates, "O" /* TerminalChunkKind.Stdout */);
88
+ this._closeRewriters(this._stderrStates, ITerminalChunk_1.TerminalChunkKind.Stderr);
89
+ this._closeRewriters(this._stdoutStates, ITerminalChunk_1.TerminalChunkKind.Stdout);
89
90
  this.autocloseDestination();
90
91
  }
91
92
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TextRewriterTransform.js","sourceRoot":"","sources":["../src/TextRewriterTransform.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAK3D,2DAAwF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CAAC,CAAC;YACxD,CAAC;YACD,IAAI,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;gBAC1B,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,SAAS;aAChB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAES,OAAO;QACf,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,qCAA2B,CAAC;QACnE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,aAAa,qCAA2B,CAAC;QAEnE,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;CACF;AArFD,sDAqFC","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 { NewlineKind } from '@rushstack/node-core-library';\n\nimport { type ITerminalChunk, TerminalChunkKind } from './ITerminalChunk';\nimport { TerminalTransform, type ITerminalTransformOptions } from './TerminalTransform';\nimport type { TextRewriter, TextRewriterState } from './TextRewriter';\nimport { RemoveColorsTextRewriter } from './RemoveColorsTextRewriter';\nimport { NormalizeNewlinesTextRewriter } from './NormalizeNewlinesTextRewriter';\n\n/**\n * Constructor options for {@link TextRewriterTransform}.\n *\n * @public\n */\nexport interface ITextRewriterTransformOptions extends ITerminalTransformOptions {\n /**\n * A list of rewriters to be applied. More items may be appended to the list, for example\n * if {@link ITextRewriterTransformOptions.removeColors} is specified.\n *\n * @remarks\n * The final list must contain at least one item.\n */\n textRewriters?: TextRewriter[];\n\n /**\n * If specified, a {@link RemoveColorsTextRewriter} will be appended to the list of rewriters.\n */\n removeColors?: boolean;\n\n /**\n * If `normalizeNewlines` or `ensureNewlineAtEnd` is specified, a {@link NormalizeNewlinesTextRewriter}\n * will be appended to the list of rewriters with the specified settings.\n *\n * @remarks\n * See {@link INormalizeNewlinesTextRewriterOptions} for details.\n */\n normalizeNewlines?: NewlineKind;\n\n /**\n * If `normalizeNewlines` or `ensureNewlineAtEnd` is specified, a {@link NormalizeNewlinesTextRewriter}\n * will be appended to the list of rewriters with the specified settings.\n *\n * @remarks\n * See {@link INormalizeNewlinesTextRewriterOptions} for details.\n */\n ensureNewlineAtEnd?: boolean;\n}\n\n/**\n * A {@link TerminalTransform} subclass that performs one or more {@link TextRewriter} operations.\n * The most common operations are {@link NormalizeNewlinesTextRewriter} and {@link RemoveColorsTextRewriter}.\n *\n * @remarks\n * The `TextRewriter` operations are applied separately to the `stderr` and `stdout` streams.\n * If multiple {@link ITextRewriterTransformOptions.textRewriters} are configured, they are applied\n * in the order that they appear in the array.\n *\n * @public\n */\nexport class TextRewriterTransform extends TerminalTransform {\n private readonly _stderrStates: TextRewriterState[];\n private readonly _stdoutStates: TextRewriterState[];\n\n public readonly textRewriters: ReadonlyArray<TextRewriter>;\n\n public constructor(options: ITextRewriterTransformOptions) {\n super(options);\n\n const textRewriters: TextRewriter[] = options.textRewriters || [];\n\n if (options.removeColors) {\n textRewriters.push(new RemoveColorsTextRewriter());\n }\n if (options.normalizeNewlines) {\n textRewriters.push(\n new NormalizeNewlinesTextRewriter({\n newlineKind: options.normalizeNewlines,\n ensureNewlineAtEnd: options.ensureNewlineAtEnd\n })\n );\n }\n\n if (textRewriters.length === 0) {\n throw new Error('TextRewriterTransform requires at least one matcher');\n }\n\n this.textRewriters = textRewriters;\n\n this._stderrStates = this.textRewriters.map((x) => x.initialize());\n this._stdoutStates = this.textRewriters.map((x) => x.initialize());\n }\n\n protected onWriteChunk(chunk: ITerminalChunk): void {\n if (chunk.kind === TerminalChunkKind.Stderr) {\n this._processText(chunk, this._stderrStates);\n } else if (chunk.kind === TerminalChunkKind.Stdout) {\n this._processText(chunk, this._stdoutStates);\n } else {\n this.destination.writeChunk(chunk);\n }\n }\n\n private _processText(chunk: ITerminalChunk, states: TextRewriterState[]): void {\n let text: string = chunk.text;\n for (let i: number = 0; i < states.length; ++i) {\n if (text.length > 0) {\n text = this.textRewriters[i].process(states[i], text);\n }\n }\n if (text.length > 0) {\n // If possible, avoid allocating a new chunk\n if (text === chunk.text) {\n this.destination.writeChunk(chunk);\n } else {\n this.destination.writeChunk({\n text: text,\n kind: chunk.kind\n });\n }\n }\n }\n\n private _closeRewriters(states: TextRewriterState[], chunkKind: TerminalChunkKind): void {\n let text: string = '';\n for (let i: number = 0; i < states.length; ++i) {\n if (text.length > 0) {\n text = this.textRewriters[i].process(states[i], text);\n }\n text += this.textRewriters[i].close(states[i]);\n }\n if (text.length > 0) {\n this.destination.writeChunk({\n text: text,\n kind: chunkKind\n });\n }\n }\n\n protected onClose(): void {\n this._closeRewriters(this._stderrStates, TerminalChunkKind.Stderr);\n this._closeRewriters(this._stdoutStates, TerminalChunkKind.Stdout);\n\n this.autocloseDestination();\n }\n}\n"]}
1
+ {"version":3,"file":"TextRewriterTransform.js","sourceRoot":"","sources":["../src/TextRewriterTransform.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAI3D,qDAA0E;AAC1E,2DAAwF;AAExF,yEAAsE;AACtE,mFAAgF;AAyChF;;;;;;;;;;GAUG;AACH,MAAa,qBAAsB,SAAQ,qCAAiB;IAM1D,YAAmB,OAAsC;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,MAAM,aAAa,GAAmB,OAAO,CAAC,aAAa,IAAI,EAAE,CAAC;QAElE,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YACzB,aAAa,CAAC,IAAI,CAAC,IAAI,mDAAwB,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;YAC9B,aAAa,CAAC,IAAI,CAChB,IAAI,6DAA6B,CAAC;gBAChC,WAAW,EAAE,OAAO,CAAC,iBAAiB;gBACtC,kBAAkB,EAAE,OAAO,CAAC,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AI,CAAC,aAAa,EAAE,kCAAiB,CAAC,MAAM,CAAC,CAAC;QAEnE,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;CACF;AArFD,sDAqFC","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 { NewlineKind } from '@rushstack/node-core-library';\n\nimport { type ITerminalChunk, TerminalChunkKind } from './ITerminalChunk';\nimport { TerminalTransform, type ITerminalTransformOptions } from './TerminalTransform';\nimport type { TextRewriter, TextRewriterState } from './TextRewriter';\nimport { RemoveColorsTextRewriter } from './RemoveColorsTextRewriter';\nimport { NormalizeNewlinesTextRewriter } from './NormalizeNewlinesTextRewriter';\n\n/**\n * Constructor options for {@link TextRewriterTransform}.\n *\n * @public\n */\nexport interface ITextRewriterTransformOptions extends ITerminalTransformOptions {\n /**\n * A list of rewriters to be applied. More items may be appended to the list, for example\n * if {@link ITextRewriterTransformOptions.removeColors} is specified.\n *\n * @remarks\n * The final list must contain at least one item.\n */\n textRewriters?: TextRewriter[];\n\n /**\n * If specified, a {@link RemoveColorsTextRewriter} will be appended to the list of rewriters.\n */\n removeColors?: boolean;\n\n /**\n * If `normalizeNewlines` or `ensureNewlineAtEnd` is specified, a {@link NormalizeNewlinesTextRewriter}\n * will be appended to the list of rewriters with the specified settings.\n *\n * @remarks\n * See {@link INormalizeNewlinesTextRewriterOptions} for details.\n */\n normalizeNewlines?: NewlineKind;\n\n /**\n * If `normalizeNewlines` or `ensureNewlineAtEnd` is specified, a {@link NormalizeNewlinesTextRewriter}\n * will be appended to the list of rewriters with the specified settings.\n *\n * @remarks\n * See {@link INormalizeNewlinesTextRewriterOptions} for details.\n */\n ensureNewlineAtEnd?: boolean;\n}\n\n/**\n * A {@link TerminalTransform} subclass that performs one or more {@link TextRewriter} operations.\n * The most common operations are {@link NormalizeNewlinesTextRewriter} and {@link RemoveColorsTextRewriter}.\n *\n * @remarks\n * The `TextRewriter` operations are applied separately to the `stderr` and `stdout` streams.\n * If multiple {@link ITextRewriterTransformOptions.textRewriters} are configured, they are applied\n * in the order that they appear in the array.\n *\n * @public\n */\nexport class TextRewriterTransform extends TerminalTransform {\n private readonly _stderrStates: TextRewriterState[];\n private readonly _stdoutStates: TextRewriterState[];\n\n public readonly textRewriters: ReadonlyArray<TextRewriter>;\n\n public constructor(options: ITextRewriterTransformOptions) {\n super(options);\n\n const textRewriters: TextRewriter[] = options.textRewriters || [];\n\n if (options.removeColors) {\n textRewriters.push(new RemoveColorsTextRewriter());\n }\n if (options.normalizeNewlines) {\n textRewriters.push(\n new NormalizeNewlinesTextRewriter({\n newlineKind: options.normalizeNewlines,\n ensureNewlineAtEnd: options.ensureNewlineAtEnd\n })\n );\n }\n\n if (textRewriters.length === 0) {\n throw new Error('TextRewriterTransform requires at least one matcher');\n }\n\n this.textRewriters = textRewriters;\n\n this._stderrStates = this.textRewriters.map((x) => x.initialize());\n this._stdoutStates = this.textRewriters.map((x) => x.initialize());\n }\n\n protected onWriteChunk(chunk: ITerminalChunk): void {\n if (chunk.kind === TerminalChunkKind.Stderr) {\n this._processText(chunk, this._stderrStates);\n } else if (chunk.kind === TerminalChunkKind.Stdout) {\n this._processText(chunk, this._stdoutStates);\n } else {\n this.destination.writeChunk(chunk);\n }\n }\n\n private _processText(chunk: ITerminalChunk, states: TextRewriterState[]): void {\n let text: string = chunk.text;\n for (let i: number = 0; i < states.length; ++i) {\n if (text.length > 0) {\n text = this.textRewriters[i].process(states[i], text);\n }\n }\n if (text.length > 0) {\n // If possible, avoid allocating a new chunk\n if (text === chunk.text) {\n this.destination.writeChunk(chunk);\n } else {\n this.destination.writeChunk({\n text: text,\n kind: chunk.kind\n });\n }\n }\n }\n\n private _closeRewriters(states: TextRewriterState[], chunkKind: TerminalChunkKind): void {\n let text: string = '';\n for (let i: number = 0; i < states.length; ++i) {\n if (text.length > 0) {\n text = this.textRewriters[i].process(states[i], text);\n }\n text += this.textRewriters[i].close(states[i]);\n }\n if (text.length > 0) {\n this.destination.writeChunk({\n text: text,\n kind: chunkKind\n });\n }\n }\n\n protected onClose(): void {\n this._closeRewriters(this._stderrStates, TerminalChunkKind.Stderr);\n this._closeRewriters(this._stdoutStates, TerminalChunkKind.Stdout);\n\n this.autocloseDestination();\n }\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -7,28 +7,28 @@
7
7
  *
8
8
  * @packageDocumentation
9
9
  */
10
- export { ICallbackWritableOptions, CallbackWritable } from './CallbackWritable';
11
- export { IDiscardStdoutTransformOptions, DiscardStdoutTransform } from './DiscardStdoutTransform';
12
- export { TerminalChunkKind, ITerminalChunk } from './ITerminalChunk';
10
+ export { type ICallbackWritableOptions, CallbackWritable } from './CallbackWritable';
11
+ export { type IDiscardStdoutTransformOptions, DiscardStdoutTransform } from './DiscardStdoutTransform';
12
+ export { TerminalChunkKind, type ITerminalChunk } from './ITerminalChunk';
13
13
  export { MockWritable } from './MockWritable';
14
- export { INormalizeNewlinesTextRewriterOptions, NormalizeNewlinesTextRewriter } from './NormalizeNewlinesTextRewriter';
14
+ export { type INormalizeNewlinesTextRewriterOptions, NormalizeNewlinesTextRewriter } from './NormalizeNewlinesTextRewriter';
15
15
  export { DEFAULT_CONSOLE_WIDTH, PrintUtilities } from './PrintUtilities';
16
16
  export { RemoveColorsTextRewriter } from './RemoveColorsTextRewriter';
17
- export { ISplitterTransformOptions, SplitterTransform } from './SplitterTransform';
18
- export { IStdioLineTransformOptions, StderrLineTransform } from './StdioLineTransform';
19
- export { IStdioSummarizerOptions, StdioSummarizer } from './StdioSummarizer';
17
+ export { type ISplitterTransformOptions, SplitterTransform } from './SplitterTransform';
18
+ export { type IStdioLineTransformOptions, StderrLineTransform } from './StdioLineTransform';
19
+ export { type IStdioSummarizerOptions, StdioSummarizer } from './StdioSummarizer';
20
20
  export { StdioWritable } from './StdioWritable';
21
- export { ITerminalTransformOptions, TerminalTransform } from './TerminalTransform';
22
- export { ITerminalWritableOptions, TerminalWritable } from './TerminalWritable';
23
- export { TextRewriterState, TextRewriter } from './TextRewriter';
24
- export { ITextRewriterTransformOptions, TextRewriterTransform } from './TextRewriterTransform';
25
- export { AnsiEscape, IAnsiEscapeConvertForTestsOptions } from './AnsiEscape';
26
- export { ITerminal, TerminalWriteParameters, ITerminalWriteOptions } from './ITerminal';
21
+ export { type ITerminalTransformOptions, TerminalTransform } from './TerminalTransform';
22
+ export { type ITerminalWritableOptions, TerminalWritable } from './TerminalWritable';
23
+ export { type TextRewriterState, TextRewriter } from './TextRewriter';
24
+ export { type ITextRewriterTransformOptions, TextRewriterTransform } from './TextRewriterTransform';
25
+ export { AnsiEscape, type IAnsiEscapeConvertForTestsOptions } from './AnsiEscape';
26
+ export type { ITerminal, TerminalWriteParameters, ITerminalWriteOptions } from './ITerminal';
27
27
  export { Terminal } from './Terminal';
28
28
  export { Colorize } from './Colorize';
29
- export { ITerminalProvider, TerminalProviderSeverity } from './ITerminalProvider';
30
- export { ConsoleTerminalProvider, IConsoleTerminalProviderOptions } from './ConsoleTerminalProvider';
31
- export { StringBufferTerminalProvider, IStringBufferOutputOptions } from './StringBufferTerminalProvider';
32
- export { PrefixProxyTerminalProvider, IPrefixProxyTerminalProviderOptions, IDynamicPrefixProxyTerminalProviderOptions, IPrefixProxyTerminalProviderOptionsBase, IStaticPrefixProxyTerminalProviderOptions } from './PrefixProxyTerminalProvider';
33
- export { TerminalStreamWritable, ITerminalStreamWritableOptions } from './TerminalStreamWritable';
29
+ export { type ITerminalProvider, TerminalProviderSeverity } from './ITerminalProvider';
30
+ export { ConsoleTerminalProvider, type IConsoleTerminalProviderOptions } from './ConsoleTerminalProvider';
31
+ export { StringBufferTerminalProvider, type IStringBufferOutputOptions } from './StringBufferTerminalProvider';
32
+ export { PrefixProxyTerminalProvider, type IPrefixProxyTerminalProviderOptions, type IDynamicPrefixProxyTerminalProviderOptions, type IPrefixProxyTerminalProviderOptionsBase, type IStaticPrefixProxyTerminalProviderOptions } from './PrefixProxyTerminalProvider';
33
+ export { TerminalStreamWritable, type ITerminalStreamWritableOptions } from './TerminalStreamWritable';
34
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,qCAAqC,EACrC,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,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAE,UAAU,EAAE,iCAAiC,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,uBAA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AO,EAAE,KAAK,uBAAuB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,KAAK,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxF,OAAO,EAAE,KAAK,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,KAAK,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,KAAK,6BAA6B,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACpG,OAAO,EAAE,UAAU,EAAE,KAAK,iCAAiC,EAAE,MAAM,cAAc,CAAC;AAClF,YAAY,EAAE,SAAS,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,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,sBAAsB,EAAE,KAAK,8BAA8B,EAAE,MAAM,0BAA0B,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.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;
5
+ 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.TerminalChunkKind = exports.DiscardStdoutTransform = exports.CallbackWritable = void 0;
6
6
  /**
7
7
  * This library implements a system for processing human readable text that
8
8
  * will be output by console applications.
@@ -16,6 +16,8 @@ var CallbackWritable_1 = require("./CallbackWritable");
16
16
  Object.defineProperty(exports, "CallbackWritable", { enumerable: true, get: function () { return CallbackWritable_1.CallbackWritable; } });
17
17
  var DiscardStdoutTransform_1 = require("./DiscardStdoutTransform");
18
18
  Object.defineProperty(exports, "DiscardStdoutTransform", { enumerable: true, get: function () { return DiscardStdoutTransform_1.DiscardStdoutTransform; } });
19
+ var ITerminalChunk_1 = require("./ITerminalChunk");
20
+ Object.defineProperty(exports, "TerminalChunkKind", { enumerable: true, get: function () { return ITerminalChunk_1.TerminalChunkKind; } });
19
21
  var MockWritable_1 = require("./MockWritable");
20
22
  Object.defineProperty(exports, "MockWritable", { enumerable: true, get: function () { return MockWritable_1.MockWritable; } });
21
23
  var NormalizeNewlinesTextRewriter_1 = require("./NormalizeNewlinesTextRewriter");
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;;;;;;;;GAQG;AAEH,uDAAgF;AAA7C,oHAAA,gBAAgB,OAAA;AACnD,mEAAkG;AAAzD,gIAAA,sBAAsB,OAAA;AAE/D,+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,yDAAmF;AAA/C,sHAAA,iBAAiB,OAAA;AACrD,2DAAuF;AAAlD,yHAAA,mBAAmB,OAAA;AACxD,qDAA6E;AAA3C,kHAAA,eAAe,OAAA;AACjD,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,yDAAmF;AAA/C,sHAAA,iBAAiB,OAAA;AACrD,uDAAgF;AAA7C,oHAAA,gBAAgB,OAAA;AACnD,+CAAiE;AAArC,4GAAA,YAAY,OAAA;AACxC,iEAA+F;AAAvD,8HAAA,qBAAqB,OAAA;AAC7D,2CAA6E;AAApE,wGAAA,UAAU,OAAA;AAEnB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,yDAAkF;AAAtD,6HAAA,wBAAwB,OAAA;AACpD,qEAAqG;AAA5F,kIAAA,uBAAuB,OAAA;AAChC,+EAA0G;AAAjG,4IAAA,4BAA4B,OAAA;AACrC,6EAMuC;AALrC,0IAAA,2BAA2B,OAAA;AAM7B,mEAAkG;AAAzF,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/**\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 { ICallbackWritableOptions, CallbackWritable } from './CallbackWritable';\nexport { IDiscardStdoutTransformOptions, DiscardStdoutTransform } from './DiscardStdoutTransform';\nexport { TerminalChunkKind, ITerminalChunk } from './ITerminalChunk';\nexport { MockWritable } from './MockWritable';\nexport {\n INormalizeNewlinesTextRewriterOptions,\n NormalizeNewlinesTextRewriter\n} from './NormalizeNewlinesTextRewriter';\nexport { DEFAULT_CONSOLE_WIDTH, PrintUtilities } from './PrintUtilities';\nexport { RemoveColorsTextRewriter } from './RemoveColorsTextRewriter';\nexport { ISplitterTransformOptions, SplitterTransform } from './SplitterTransform';\nexport { IStdioLineTransformOptions, StderrLineTransform } from './StdioLineTransform';\nexport { IStdioSummarizerOptions, StdioSummarizer } from './StdioSummarizer';\nexport { StdioWritable } from './StdioWritable';\nexport { ITerminalTransformOptions, TerminalTransform } from './TerminalTransform';\nexport { ITerminalWritableOptions, TerminalWritable } from './TerminalWritable';\nexport { TextRewriterState, TextRewriter } from './TextRewriter';\nexport { ITextRewriterTransformOptions, TextRewriterTransform } from './TextRewriterTransform';\nexport { AnsiEscape, IAnsiEscapeConvertForTestsOptions } from './AnsiEscape';\nexport { ITerminal, TerminalWriteParameters, ITerminalWriteOptions } from './ITerminal';\nexport { Terminal } from './Terminal';\nexport { Colorize } from './Colorize';\nexport { ITerminalProvider, TerminalProviderSeverity } from './ITerminalProvider';\nexport { ConsoleTerminalProvider, IConsoleTerminalProviderOptions } from './ConsoleTerminalProvider';\nexport { StringBufferTerminalProvider, IStringBufferOutputOptions } from './StringBufferTerminalProvider';\nexport {\n PrefixProxyTerminalProvider,\n IPrefixProxyTerminalProviderOptions,\n IDynamicPrefixProxyTerminalProviderOptions,\n IPrefixProxyTerminalProviderOptionsBase,\n IStaticPrefixProxyTerminalProviderOptions\n} from './PrefixProxyTerminalProvider';\nexport { TerminalStreamWritable, ITerminalStreamWritableOptions } from './TerminalStreamWritable';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D;;;;;;;;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,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/**\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 { TerminalStreamWritable, type ITerminalStreamWritableOptions } from './TerminalStreamWritable';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/terminal",
3
- "version": "0.12.3",
3
+ "version": "0.13.1",
4
4
  "description": "User interface primitives for console applications",
5
5
  "main": "lib/index.js",
6
6
  "typings": "dist/terminal.d.ts",
@@ -12,11 +12,11 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "supports-color": "~8.1.1",
15
- "@rushstack/node-core-library": "5.4.0"
15
+ "@rushstack/node-core-library": "5.5.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@rushstack/heft": "0.66.9",
19
- "@rushstack/heft-node-rig": "2.6.7",
18
+ "@rushstack/heft": "0.66.17",
19
+ "@rushstack/heft-node-rig": "2.6.15",
20
20
  "@types/heft-jest": "1.0.1",
21
21
  "@types/node": "18.17.15",
22
22
  "@types/supports-color": "8.1.3",