@rushstack/terminal 0.3.13 → 0.3.14
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 +18 -0
- package/CHANGELOG.md +6 -1
- package/lib/StdioLineTransform.js +1 -1
- package/lib/StdioLineTransform.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/terminal",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.3.14",
|
|
6
|
+
"tag": "@rushstack/terminal_v0.3.14",
|
|
7
|
+
"date": "Fri, 03 Dec 2021 03:05:23 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"dependency": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Updating dependency \"@rushstack/node-core-library\" to `3.44.0`"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"comment": "Updating dependency \"@rushstack/heft\" to `0.42.4`"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"comment": "Updating dependency \"@rushstack/heft-node-rig\" to `1.2.33`"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
4
22
|
{
|
|
5
23
|
"version": "0.3.13",
|
|
6
24
|
"tag": "@rushstack/terminal_v0.3.13",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
# Change Log - @rushstack/terminal
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 03 Dec 2021 03:05:23 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.3.14
|
|
6
|
+
Fri, 03 Dec 2021 03:05:23 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
4
9
|
|
|
5
10
|
## 0.3.13
|
|
6
11
|
Tue, 30 Nov 2021 20:18:41 GMT
|
|
@@ -59,7 +59,7 @@ class StderrLineTransform extends TerminalTransform_1.TerminalTransform {
|
|
|
59
59
|
super(options);
|
|
60
60
|
this._accumulatedLine = '';
|
|
61
61
|
this._accumulatedStderr = false;
|
|
62
|
-
this.newline = node_core_library_1.Text.getNewline(options.newlineKind ||
|
|
62
|
+
this.newline = node_core_library_1.Text.getNewline(options.newlineKind || node_core_library_1.NewlineKind.Lf);
|
|
63
63
|
}
|
|
64
64
|
onWriteChunk(chunk) {
|
|
65
65
|
if (chunk.text.indexOf('\r') >= 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StdioLineTransform.js","sourceRoot":"","sources":["../src/StdioLineTransform.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAiE;AAGjE,2DAAmF;AAanF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,
|
|
1
|
+
{"version":3,"file":"StdioLineTransform.js","sourceRoot":"","sources":["../src/StdioLineTransform.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAiE;AAGjE,2DAAmF;AAanF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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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AEtC,IAAI,IAAI,CAAC,kBAAkB,EAAE;YAC3B,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;gBAC1B,IAAI,kBAA0B;gBAC9B,IAAI,EAAE,IAAI,CAAC,gBAAgB;aAC5B,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;gBAC1B,IAAI,kBAA0B;gBAC9B,IAAI,EAAE,IAAI,CAAC,gBAAgB;aAC5B,CAAC,CAAC;SACJ;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.\r\n// See LICENSE in the project root for license information.\r\n\r\nimport { Text, NewlineKind } from '@rushstack/node-core-library';\r\n\r\nimport { ITerminalChunk, TerminalChunkKind } from './ITerminalChunk';\r\nimport { TerminalTransform, ITerminalTransformOptions } from './TerminalTransform';\r\n\r\n/**\r\n * Constructor options for {@link StderrLineTransform}\r\n * @beta\r\n */\r\nexport interface IStdioLineTransformOptions extends ITerminalTransformOptions {\r\n /**\r\n * Specifies the kind of newline for the output.\r\n */\r\n newlineKind?: NewlineKind;\r\n}\r\n\r\n/**\r\n * `StderrLineTransform` normalizes lines that mix characters from `stdout` and `stderr`,\r\n * so that each output line is routed entirely to `stdout` or `stderr`.\r\n *\r\n * @remarks\r\n * IMPORTANT: This transform assumes that its input has been normalized to use `\"\\n\"` newlines.\r\n *\r\n * IMPORTANT: This transform does not produce realtime output, because lines are buffered\r\n * until a newline character is encountered.\r\n *\r\n * Suppose that a poorly behaved process produces output like this:\r\n *\r\n * ```ts\r\n * process.stderr.write('An error occurred, cleaning up');\r\n * process.stdout.write('.'); // (delay)\r\n * process.stdout.write('.'); // (delay)\r\n * process.stdout.write('.');\r\n * process.stdout.write('\\n');\r\n * process.stderr.write('The process completed with errors\\n');\r\n * ```\r\n *\r\n * When `stdout` and `stderr` are combined on the console, the mistake in the output would not be noticeable:\r\n * ```\r\n * An error occurred, cleaning up...\r\n * The process completed with errors\r\n * ```\r\n *\r\n * However, if we discard `stdout`, then `stderr` is malformed:\r\n * ```\r\n * An error occurred, cleaning upThe process completed with errors\r\n * ```\r\n *\r\n * Tooling scripts can introduce these sorts of problems via edge cases that are difficult to find and fix.\r\n *\r\n * `StderrLineTransform` normalizes the output so that if a combined line contains any `stderr` characters,\r\n * then the entire line is routed to `stderr`. Later, if we discard `stdout`, then the output will\r\n * preserve the appropriate context:\r\n *\r\n * ```\r\n * An error occurred, cleaning up...\r\n * The process completed with errors\r\n * ```\r\n *\r\n * @privateRemarks\r\n * This class is experimental and marked as `@beta`. The algorithm may need some fine-tuning, or there may\r\n * be better solutions to this problem.\r\n *\r\n * @beta\r\n */\r\nexport class StderrLineTransform extends TerminalTransform {\r\n private _accumulatedLine: string;\r\n private _accumulatedStderr: boolean;\r\n\r\n public readonly newline: string;\r\n\r\n public constructor(options: IStdioLineTransformOptions) {\r\n super(options);\r\n\r\n this._accumulatedLine = '';\r\n this._accumulatedStderr = false;\r\n\r\n this.newline = Text.getNewline(options.newlineKind || NewlineKind.Lf);\r\n }\r\n\r\n protected onWriteChunk(chunk: ITerminalChunk): void {\r\n if (chunk.text.indexOf('\\r') >= 0) {\r\n throw new Error('StderrLineTransform expects chunks with normalized newlines');\r\n }\r\n\r\n // After _newlineNormalizerTransform was applied, we can now assume that all newlines\r\n // use the \"\\n\" string\r\n const text: string = chunk.text;\r\n let startIndex: number = 0;\r\n\r\n while (startIndex < text.length) {\r\n if (chunk.kind === TerminalChunkKind.Stderr) {\r\n this._accumulatedStderr = true;\r\n }\r\n\r\n const endIndex: number = text.indexOf('\\n', startIndex);\r\n if (endIndex < 0) {\r\n // we did not find \\n, so simply append\r\n this._accumulatedLine += text.substring(startIndex);\r\n break;\r\n }\r\n\r\n // append everything up to \\n\r\n this._accumulatedLine += text.substring(startIndex, endIndex);\r\n\r\n this._processAccumulatedLine();\r\n\r\n // skip the \\n\r\n startIndex = endIndex + 1;\r\n }\r\n }\r\n\r\n protected onClose(): void {\r\n if (this._accumulatedLine.length > 0) {\r\n this._processAccumulatedLine();\r\n }\r\n this.autocloseDestination();\r\n }\r\n\r\n private _processAccumulatedLine(): void {\r\n this._accumulatedLine += this.newline;\r\n\r\n if (this._accumulatedStderr) {\r\n this.destination.writeChunk({\r\n kind: TerminalChunkKind.Stderr,\r\n text: this._accumulatedLine\r\n });\r\n } else {\r\n this.destination.writeChunk({\r\n kind: TerminalChunkKind.Stdout,\r\n text: this._accumulatedLine\r\n });\r\n }\r\n\r\n this._accumulatedLine = '';\r\n this._accumulatedStderr = false;\r\n }\r\n}\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/terminal",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.14",
|
|
4
4
|
"description": "User interface primitives for console applications",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "dist/terminal.d.ts",
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
"directory": "libraries/terminal"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@rushstack/node-core-library": "3.
|
|
14
|
+
"@rushstack/node-core-library": "3.44.0",
|
|
15
15
|
"@types/node": "12.20.24",
|
|
16
16
|
"wordwrap": "~1.0.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@rushstack/eslint-config": "2.4.5",
|
|
20
|
-
"@rushstack/heft": "0.42.
|
|
21
|
-
"@rushstack/heft-node-rig": "1.2.
|
|
20
|
+
"@rushstack/heft": "0.42.4",
|
|
21
|
+
"@rushstack/heft-node-rig": "1.2.33",
|
|
22
22
|
"@types/heft-jest": "1.0.1",
|
|
23
23
|
"@types/wordwrap": "~1.0.0",
|
|
24
24
|
"colors": "~1.2.1"
|