@rushstack/terminal
Advanced tools
+8
-1
| # Change Log - @rushstack/terminal | ||
| This log was last generated on Wed, 23 Jul 2025 20:55:57 GMT and should not be manually modified. | ||
| This log was last generated on Thu, 11 Sep 2025 00:22:31 GMT and should not be manually modified. | ||
| ## 0.16.0 | ||
| Thu, 11 Sep 2025 00:22:31 GMT | ||
| ### Minor changes | ||
| - (BREAKING CHANGE) Remove support for legacy `IColorableSequence` parameters passed to `Terminal` insance `write*` functions. Note that types for `IColorableSequence` were removed with #3176 in 2022. | ||
| ## 0.15.4 | ||
@@ -6,0 +13,0 @@ Wed, 23 Jul 2025 20:55:57 GMT |
@@ -951,3 +951,3 @@ /** | ||
| export declare class Terminal implements ITerminal { | ||
| private _providers; | ||
| private readonly _providers; | ||
| constructor(provider: ITerminalProvider); | ||
@@ -1003,3 +1003,2 @@ /** | ||
| private _writeSegmentsToProviders; | ||
| private _serializeLegacyColorableSequence; | ||
| private _normalizeWriteParameters; | ||
@@ -1006,0 +1005,0 @@ } |
@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard. | ||
| "packageName": "@microsoft/api-extractor", | ||
| "packageVersion": "7.52.8" | ||
| "packageVersion": "7.52.11" | ||
| } | ||
| ] | ||
| } |
@@ -9,3 +9,3 @@ import { type ITerminalProvider } from './ITerminalProvider'; | ||
| export declare class Terminal implements ITerminal { | ||
| private _providers; | ||
| private readonly _providers; | ||
| constructor(provider: ITerminalProvider); | ||
@@ -61,5 +61,4 @@ /** | ||
| private _writeSegmentsToProviders; | ||
| private _serializeLegacyColorableSequence; | ||
| private _normalizeWriteParameters; | ||
| } | ||
| //# sourceMappingURL=Terminal.d.ts.map |
+3
-197
@@ -10,29 +10,2 @@ "use strict"; | ||
| /** | ||
| * Colors used with {@link ILegacyColorableSequence}. | ||
| */ | ||
| var ColorValue; | ||
| (function (ColorValue) { | ||
| ColorValue[ColorValue["Black"] = 0] = "Black"; | ||
| ColorValue[ColorValue["Red"] = 1] = "Red"; | ||
| ColorValue[ColorValue["Green"] = 2] = "Green"; | ||
| ColorValue[ColorValue["Yellow"] = 3] = "Yellow"; | ||
| ColorValue[ColorValue["Blue"] = 4] = "Blue"; | ||
| ColorValue[ColorValue["Magenta"] = 5] = "Magenta"; | ||
| ColorValue[ColorValue["Cyan"] = 6] = "Cyan"; | ||
| ColorValue[ColorValue["White"] = 7] = "White"; | ||
| ColorValue[ColorValue["Gray"] = 8] = "Gray"; | ||
| })(ColorValue || (ColorValue = {})); | ||
| /** | ||
| * Text styles used with {@link ILegacyColorableSequence}. | ||
| */ | ||
| var TextAttribute; | ||
| (function (TextAttribute) { | ||
| TextAttribute[TextAttribute["Bold"] = 0] = "Bold"; | ||
| TextAttribute[TextAttribute["Dim"] = 1] = "Dim"; | ||
| TextAttribute[TextAttribute["Underline"] = 2] = "Underline"; | ||
| TextAttribute[TextAttribute["Blink"] = 3] = "Blink"; | ||
| TextAttribute[TextAttribute["InvertColor"] = 4] = "InvertColor"; | ||
| TextAttribute[TextAttribute["Hidden"] = 5] = "Hidden"; | ||
| })(TextAttribute || (TextAttribute = {})); | ||
| /** | ||
| * This class facilitates writing to a console. | ||
@@ -44,4 +17,3 @@ * | ||
| constructor(provider) { | ||
| this._providers = new Set(); | ||
| this._providers.add(provider); | ||
| this._providers = new Set([provider]); | ||
| } | ||
@@ -58,5 +30,3 @@ /** | ||
| unregisterProvider(provider) { | ||
| if (this._providers.has(provider)) { | ||
| this._providers.delete(provider); | ||
| } | ||
| this._providers.delete(provider); | ||
| } | ||
@@ -138,22 +108,3 @@ /** | ||
| _writeSegmentsToProviders(segments, severity, followedByEol) { | ||
| const linesSegments = [[]]; | ||
| let currentLineSegments = linesSegments[0]; | ||
| for (const segment of segments) { | ||
| if (typeof segment === 'string') { | ||
| currentLineSegments.push(segment); | ||
| } | ||
| else { | ||
| if (segment.isEol) { | ||
| linesSegments.push([]); | ||
| currentLineSegments = linesSegments[linesSegments.length - 1]; | ||
| } | ||
| else { | ||
| currentLineSegments.push(this._serializeLegacyColorableSequence(segment)); | ||
| } | ||
| } | ||
| } | ||
| const lines = []; | ||
| for (const lineSegments of linesSegments) { | ||
| lines.push(lineSegments.join('')); | ||
| } | ||
| const lines = [segments.join('')]; | ||
| if (followedByEol) { | ||
@@ -191,147 +142,2 @@ lines.push(''); | ||
| } | ||
| _serializeLegacyColorableSequence(segment) { | ||
| const startColorCodes = []; | ||
| const endColorCodes = []; | ||
| switch (segment.foregroundColor) { | ||
| case ColorValue.Black: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.BlackForeground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultForeground); | ||
| break; | ||
| } | ||
| case ColorValue.Red: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.RedForeground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultForeground); | ||
| break; | ||
| } | ||
| case ColorValue.Green: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.GreenForeground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultForeground); | ||
| break; | ||
| } | ||
| case ColorValue.Yellow: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.YellowForeground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultForeground); | ||
| break; | ||
| } | ||
| case ColorValue.Blue: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.BlueForeground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultForeground); | ||
| break; | ||
| } | ||
| case ColorValue.Magenta: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.MagentaForeground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultForeground); | ||
| break; | ||
| } | ||
| case ColorValue.Cyan: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.CyanForeground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultForeground); | ||
| break; | ||
| } | ||
| case ColorValue.White: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.WhiteForeground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultForeground); | ||
| break; | ||
| } | ||
| case ColorValue.Gray: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.GrayForeground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultForeground); | ||
| break; | ||
| } | ||
| } | ||
| switch (segment.backgroundColor) { | ||
| case ColorValue.Black: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.BlackBackground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultBackground); | ||
| break; | ||
| } | ||
| case ColorValue.Red: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.RedBackground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultBackground); | ||
| break; | ||
| } | ||
| case ColorValue.Green: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.GreenBackground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultBackground); | ||
| break; | ||
| } | ||
| case ColorValue.Yellow: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.YellowBackground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultBackground); | ||
| break; | ||
| } | ||
| case ColorValue.Blue: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.BlueBackground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultBackground); | ||
| break; | ||
| } | ||
| case ColorValue.Magenta: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.MagentaBackground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultBackground); | ||
| break; | ||
| } | ||
| case ColorValue.Cyan: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.CyanBackground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultBackground); | ||
| break; | ||
| } | ||
| case ColorValue.White: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.WhiteBackground); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.DefaultBackground); | ||
| break; | ||
| } | ||
| case ColorValue.Gray: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.GrayBackground); | ||
| endColorCodes.push(49); | ||
| break; | ||
| } | ||
| } | ||
| if (segment.textAttributes) { | ||
| for (const textAttribute of segment.textAttributes) { | ||
| switch (textAttribute) { | ||
| case TextAttribute.Bold: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.Bold); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.NormalColorOrIntensity); | ||
| break; | ||
| } | ||
| case TextAttribute.Dim: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.Dim); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.NormalColorOrIntensity); | ||
| break; | ||
| } | ||
| case TextAttribute.Underline: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.Underline); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.UnderlineOff); | ||
| break; | ||
| } | ||
| case TextAttribute.Blink: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.Blink); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.BlinkOff); | ||
| break; | ||
| } | ||
| case TextAttribute.InvertColor: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.InvertColor); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.InvertColorOff); | ||
| break; | ||
| } | ||
| case TextAttribute.Hidden: { | ||
| startColorCodes.push(Colorize_1.SgrParameterAttribute.Hidden); | ||
| endColorCodes.push(Colorize_1.SgrParameterAttribute.HiddenOff); | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| const resultSegments = []; | ||
| for (let j = 0; j < startColorCodes.length; j++) { | ||
| const code = startColorCodes[j]; | ||
| resultSegments.push(AnsiEscape_1.AnsiEscape.getEscapeSequenceForAnsiCode(code)); | ||
| } | ||
| resultSegments.push(segment.text); | ||
| for (let j = endColorCodes.length - 1; j >= 0; j--) { | ||
| const code = endColorCodes[j]; | ||
| resultSegments.push(AnsiEscape_1.AnsiEscape.getEscapeSequenceForAnsiCode(code)); | ||
| } | ||
| return resultSegments.join(''); | ||
| } | ||
| _normalizeWriteParameters(parameters) { | ||
@@ -338,0 +144,0 @@ if (parameters.length === 0) { |
+2
-2
| { | ||
| "name": "@rushstack/terminal", | ||
| "version": "0.15.4", | ||
| "version": "0.16.0", | ||
| "description": "User interface primitives for console applications", | ||
@@ -18,3 +18,3 @@ "main": "lib/index.js", | ||
| "devDependencies": { | ||
| "@rushstack/heft": "0.74.0", | ||
| "@rushstack/heft": "0.74.3", | ||
| "@types/supports-color": "8.1.3", | ||
@@ -21,0 +21,0 @@ "eslint": "~9.25.1", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
509940
-4.04%9622
-1.88%