@rushstack/terminal 0.2.29 → 0.2.30
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 +26 -0
- package/CHANGELOG.md +8 -1
- package/lib/PrintUtilities.js +1 -1
- package/lib/PrintUtilities.js.map +1 -1
- package/lib/SplitterTransform.js.map +1 -1
- package/lib/index.js +1 -1
- package/package.json +6 -6
package/CHANGELOG.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/terminal",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.2.30",
|
|
6
|
+
"tag": "@rushstack/terminal_v0.2.30",
|
|
7
|
+
"date": "Thu, 23 Sep 2021 00:10:41 GMT",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"comment": "Upgrade the `@types/node` dependency to version to version 12."
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"dependency": [
|
|
15
|
+
{
|
|
16
|
+
"comment": "Updating dependency \"@rushstack/node-core-library\" to `3.40.3`"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"comment": "Updating dependency \"@rushstack/eslint-config\" to `2.4.1`"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"comment": "Updating dependency \"@rushstack/heft\" to `0.39.1`"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"comment": "Updating dependency \"@rushstack/heft-node-rig\" to `1.2.16`"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
4
30
|
{
|
|
5
31
|
"version": "0.2.29",
|
|
6
32
|
"tag": "@rushstack/terminal_v0.2.29",
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# Change Log - @rushstack/terminal
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 23 Sep 2021 00:10:41 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 0.2.30
|
|
6
|
+
Thu, 23 Sep 2021 00:10:41 GMT
|
|
7
|
+
|
|
8
|
+
### Patches
|
|
9
|
+
|
|
10
|
+
- Upgrade the `@types/node` dependency to version to version 12.
|
|
4
11
|
|
|
5
12
|
## 0.2.29
|
|
6
13
|
Wed, 22 Sep 2021 03:27:12 GMT
|
package/lib/PrintUtilities.js
CHANGED
|
@@ -39,7 +39,7 @@ class PrintUtilities {
|
|
|
39
39
|
if (!maxLineLength) {
|
|
40
40
|
maxLineLength = PrintUtilities.getConsoleWidth() || exports.DEFAULT_CONSOLE_WIDTH;
|
|
41
41
|
}
|
|
42
|
-
const wrap = wordwrap_1.default(indent, maxLineLength, { mode: 'soft' });
|
|
42
|
+
const wrap = (0, wordwrap_1.default)(indent, maxLineLength, { mode: 'soft' });
|
|
43
43
|
return wrap(text);
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrintUtilities.js","sourceRoot":"","sources":["../src/PrintUtilities.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;;;;AAG3D,wDAAgC;AAGhC;;;;GAIG;AACU,QAAA,qBAAqB,GAAW,EAAE,CAAC;AAEhD;;;;GAIG;AACH,MAAa,cAAc;IACzB;;OAEG;IACI,MAAM,CAAC,eAAe;QAC3B,MAAM,MAAM,GAAoB,OAAO,CAAC,MAAyB,CAAC;QAClE,IAAI,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE;YAC5B,OAAO,MAAM,CAAC,OAAO,CAAC;SACvB;IACH,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,SAAS,CAAC,IAAY,EAAE,aAAsB,EAAE,MAAe;QAC3E,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,GAAG,CAAC,CAAC;SACZ;QAED,IAAI,CAAC,aAAa,EAAE;YA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AM,cAAc,GAAW,cAAc,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;QAChF,MAAM,mBAAmB,GAAa,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAEjE,gBAAgB;QAChB,gBAAgB;QAChB,gBAAgB;QAChB,QAAQ,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;QACtD,KAAK,MAAM,IAAI,IAAI,mBAAmB,EAAE;YACtC,MAAM,WAAW,GAAW,IAAI,CAAC,IAAI,EAAE,CAAC;YACxC,MAAM,OAAO,GAAW,QAAQ,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;YAC1D,MAAM,WAAW,GAAW,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;YACpD,MAAM,YAAY,GAAW,OAAO,GAAG,WAAW,CAAC;YACnD,QAAQ,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;SAC/F;QACD,QAAQ,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;CACF;AAvDD,wCAuDC","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 * as tty from 'tty';\r\nimport wordwrap from 'wordwrap';\r\nimport { Terminal } from '@rushstack/node-core-library';\r\n\r\n/**\r\n * A sensible fallback column width for consoles.\r\n *\r\n * @public\r\n */\r\nexport const DEFAULT_CONSOLE_WIDTH: number = 80;\r\n\r\n/**\r\n * A collection of utilities for printing messages to the console.\r\n *\r\n * @public\r\n */\r\nexport class PrintUtilities {\r\n /**\r\n * Returns the width of the console, measured in columns\r\n */\r\n public static getConsoleWidth(): number | undefined {\r\n const stdout: tty.WriteStream = process.stdout as tty.WriteStream;\r\n if (stdout && stdout.columns) {\r\n return stdout.columns;\r\n }\r\n }\r\n\r\n /**\r\n * Applies word wrapping. If maxLineLength is unspecified, then it defaults to the\r\n * console width.\r\n */\r\n public static wrapWords(text: string, maxLineLength?: number, indent?: number): string {\r\n if (!indent) {\r\n indent = 0;\r\n }\r\n\r\n if (!maxLineLength) {\r\n maxLineLength = PrintUtilities.getConsoleWidth() || DEFAULT_CONSOLE_WIDTH;\r\n }\r\n\r\n const wrap: (textToWrap: string) => string = wordwrap(indent, maxLineLength, { mode: 'soft' });\r\n return wrap(text);\r\n }\r\n\r\n /**\r\n * Displays a message in the console wrapped in a box UI.\r\n *\r\n * @param boxWidth - The width of the box, defaults to half of the console width.\r\n */\r\n public static printMessageInBox(message: string, terminal: Terminal, boxWidth?: number): void {\r\n if (!boxWidth) {\r\n const consoleWidth: number = PrintUtilities.getConsoleWidth() || DEFAULT_CONSOLE_WIDTH;\r\n boxWidth = Math.floor(consoleWidth / 2);\r\n }\r\n const maxLineLength: number = boxWidth - 10;\r\n const wrappedMessage: string = PrintUtilities.wrapWords(message, maxLineLength);\r\n const wrappedMessageLines: string[] = wrappedMessage.split('\\n');\r\n\r\n // ╔═══════════╗\r\n // ║ Message ║\r\n // ╚═══════════╝\r\n terminal.writeLine(` ╔${'═'.repeat(boxWidth - 2)}╗ `);\r\n for (const line of wrappedMessageLines) {\r\n const trimmedLine: string = line.trim();\r\n const padding: number = boxWidth - trimmedLine.length - 2;\r\n const leftPadding: number = Math.floor(padding / 2);\r\n const rightPadding: number = padding - leftPadding;\r\n terminal.writeLine(` ║${' '.repeat(leftPadding)}${trimmedLine}${' '.repeat(rightPadding)}║ `);\r\n }\r\n terminal.writeLine(` ╚${'═'.repeat(boxWidth - 2)}╝ `);\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitterTransform.js","sourceRoot":"","sources":["../src/SplitterTransform.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,yDAAgF;AAehF;;;;;;;;;;;GAWG;AACH,MAAa,iBAAkB,SAAQ,mCAAgB;IAGrD,YAAmB,OAAkC;QACnD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,GAAG,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;IAES,YAAY,CAAC,KAAqB;QAC1C,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,YAAY,EAAE;YAC3C,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;SAC/B;IACH,CAAC;IAES,OAAO;QACf,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,2FAA2F;QAC3F,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,YAAY,EAAE;YAC3C,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE;gBACjC,IAAI;oBACF,WAAW,CAAC,KAAK,EAAE,CAAC;iBACrB;gBAAC,OAAO,KAAK,EAAE;oBACd,MAAM,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"SplitterTransform.js","sourceRoot":"","sources":["../src/SplitterTransform.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,yDAAgF;AAehF;;;;;;;;;;;GAWG;AACH,MAAa,iBAAkB,SAAQ,mCAAgB;IAGrD,YAAmB,OAAkC;QACnD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,GAAG,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAChD,CAAC;IAES,YAAY,CAAC,KAAqB;QAC1C,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,YAAY,EAAE;YAC3C,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;SAC/B;IACH,CAAC;IAES,OAAO;QACf,MAAM,MAAM,GAAY,EAAE,CAAC;QAE3B,2FAA2F;QAC3F,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,YAAY,EAAE;YAC3C,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE;gBACjC,IAAI;oBACF,WAAW,CAAC,KAAK,EAAE,CAAC;iBACrB;gBAAC,OAAO,KAAK,EAAE;oBACd,MAAM,CAAC,IAAI,CAAC,KAAc,CAAC,CAAC;iBAC7B;aACF;SACF;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YACrB,MAAM,MAAM,CAAC,CAAC,CAAC,CAAC;SACjB;IACH,CAAC;CACF;AAhCD,8CAgCC","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 { TerminalWritable, ITerminalWritableOptions } from './TerminalWritable';\r\nimport { ITerminalChunk } from './ITerminalChunk';\r\n\r\n/**\r\n * Constructor options for {@link SplitterTransform}.\r\n *\r\n * @public\r\n */\r\nexport interface ISplitterTransformOptions extends ITerminalWritableOptions {\r\n /**\r\n * Each input chunk will be passed to each destination in the array.\r\n */\r\n destinations: TerminalWritable[];\r\n}\r\n\r\n/**\r\n * Use this instead of {@link TerminalTransform} if you need to output `ITerminalChunk`\r\n * data to more than one destination.\r\n *\r\n * @remarks\r\n *\r\n * Splitting streams complicates the pipeline topology and can make debugging more difficult.\r\n * For this reason, it is modeled as an explicit `SplitterTransform` node, rather than\r\n * as a built-in feature of `TerminalTransform`.\r\n *\r\n * @public\r\n */\r\nexport class SplitterTransform extends TerminalWritable {\r\n public readonly destinations: ReadonlyArray<TerminalWritable>;\r\n\r\n public constructor(options: ISplitterTransformOptions) {\r\n super();\r\n this.destinations = [...options.destinations];\r\n }\r\n\r\n protected onWriteChunk(chunk: ITerminalChunk): void {\r\n for (const destination of this.destinations) {\r\n destination.writeChunk(chunk);\r\n }\r\n }\r\n\r\n protected onClose(): void {\r\n const errors: Error[] = [];\r\n\r\n // If an exception is thrown, try to ensure that the other destinations get closed properly\r\n for (const destination of this.destinations) {\r\n if (!destination.preventAutoclose) {\r\n try {\r\n destination.close();\r\n } catch (error) {\r\n errors.push(error as Error);\r\n }\r\n }\r\n }\r\n\r\n if (errors.length > 0) {\r\n throw errors[0];\r\n }\r\n }\r\n}\r\n"]}
|
package/lib/index.js
CHANGED
|
@@ -9,7 +9,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
9
9
|
o[k2] = m[k];
|
|
10
10
|
}));
|
|
11
11
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
12
|
-
for (var p in m) if (p !== "default" && !
|
|
12
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rushstack/terminal",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.30",
|
|
4
4
|
"description": "User interface primitives for console applications",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "dist/terminal.d.ts",
|
|
@@ -9,14 +9,14 @@
|
|
|
9
9
|
"url": "https://github.com/microsoft/rushstack/tree/master/libraries/terminal"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@rushstack/node-core-library": "3.40.
|
|
13
|
-
"@types/node": "
|
|
12
|
+
"@rushstack/node-core-library": "3.40.3",
|
|
13
|
+
"@types/node": "12.20.24",
|
|
14
14
|
"wordwrap": "~1.0.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@rushstack/eslint-config": "2.4.
|
|
18
|
-
"@rushstack/heft": "0.39.
|
|
19
|
-
"@rushstack/heft-node-rig": "1.2.
|
|
17
|
+
"@rushstack/eslint-config": "2.4.1",
|
|
18
|
+
"@rushstack/heft": "0.39.1",
|
|
19
|
+
"@rushstack/heft-node-rig": "1.2.16",
|
|
20
20
|
"@types/heft-jest": "1.0.1",
|
|
21
21
|
"@types/wordwrap": "~1.0.0",
|
|
22
22
|
"colors": "~1.2.1"
|