@rushstack/terminal 0.5.36 → 0.5.38

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.
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.36.3"
8
+ "packageVersion": "7.36.4"
9
9
  }
10
10
  ]
11
11
  }
@@ -85,7 +85,7 @@ class TextRewriterTransform extends TerminalTransform_1.TerminalTransform {
85
85
  }
86
86
  onClose() {
87
87
  this._closeRewriters(this._stderrStates, "E" /* TerminalChunkKind.Stderr */);
88
- this._closeRewriters(this._stderrStates, "O" /* TerminalChunkKind.Stdout */);
88
+ this._closeRewriters(this._stdoutStates, "O" /* TerminalChunkKind.Stdout */);
89
89
  this.autocloseDestination();
90
90
  }
91
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TextRewriterTransform.js","sourceRoot":"","sources":["../src/TextRewriterTransform.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAK3D,2DAAmF;AAEnF,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;YACxB,aAAa,CAAC,IAAI,CAAC,IAAI,mDAAwB,EAAE,CAAC,CAAC;SACpD;QACD,IAAI,OAAO,CAAC,iBAAiB,EAAE;YAC7B,aAAa,CAAC,IAAI,CAChB,IAAI,6DAA6B,CAAC;gBAChC,WAAW,EAAE,OAAO,CAAC,iBAAiB;gBACtC,kBAAkB,EAAE,OAAO,CAAC,kBAAkB;aAC/C,CAAC,CACH,CAAC;SACH;QAED,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE;YAC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AAC,UAAU,CAAC,KAAK,CAAC,CAAC;aACpC;iBAAM;gBACL,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;oBAC1B,IAAI,EAAE,IAAI;oBACV,IAAI,EAAE,KAAK,CAAC,IAAI;iBACjB,CAAC,CAAC;aACJ;SACF;IACH,CAAC;IAEO,eAAe,CAAC,MAA2B,EAAE,SAA4B;QAC/E,IAAI,IAAI,GAAW,EAAE,CAAC;QACtB,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;YAC9C,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;gBACnB,IAAI,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;aACvD;YACD,IAAI,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;SAChD;QACD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACnB,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;gBAC1B,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,SAAS;aAChB,CAAC,CAAC;SACJ;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 { NewlineKind } from '@rushstack/node-core-library';\n\nimport { ITerminalChunk, TerminalChunkKind } from './ITerminalChunk';\nimport { TerminalTransform, ITerminalTransformOptions } from './TerminalTransform';\nimport { 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._stderrStates, 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;;;AAK3D,2DAAmF;AAEnF,yEAA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AM,GAAG,CAAC,EAAE;YACnB,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;gBAC1B,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,SAAS;aAChB,CAAC,CAAC;SACJ;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 { NewlineKind } from '@rushstack/node-core-library';\n\nimport { ITerminalChunk, TerminalChunkKind } from './ITerminalChunk';\nimport { TerminalTransform, ITerminalTransformOptions } from './TerminalTransform';\nimport { 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rushstack/terminal",
3
- "version": "0.5.36",
3
+ "version": "0.5.38",
4
4
  "description": "User interface primitives for console applications",
5
5
  "main": "lib/index.js",
6
6
  "typings": "dist/terminal.d.ts",
@@ -12,16 +12,16 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "wordwrap": "~1.0.0",
15
- "@rushstack/node-core-library": "3.59.6"
15
+ "@rushstack/node-core-library": "3.59.7"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/heft-jest": "1.0.1",
19
19
  "@types/node": "14.18.36",
20
20
  "@types/wordwrap": "~1.0.0",
21
21
  "colors": "~1.2.1",
22
- "@rushstack/eslint-config": "3.3.2",
23
- "@rushstack/heft": "0.58.1",
24
- "@rushstack/heft-node-rig": "2.2.21"
22
+ "@rushstack/eslint-config": "3.3.3",
23
+ "@rushstack/heft": "0.58.2",
24
+ "@rushstack/heft-node-rig": "2.2.22"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "@types/node": "*"