mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
Clean up helpers which are always present in ES2020 (#55515)
This commit is contained in:
@@ -61,8 +61,6 @@ import {
|
||||
optionDeclarations,
|
||||
optionsForBuild,
|
||||
optionsForWatch,
|
||||
padLeft,
|
||||
padRight,
|
||||
parseBuildCommand,
|
||||
parseCommandLine,
|
||||
parseConfigFileWithSystem,
|
||||
@@ -329,12 +327,12 @@ function generateOptionOutput(sys: System, option: CommandLineOption, rightAlign
|
||||
while (remainRight.length > 0) {
|
||||
let curLeft = "";
|
||||
if (isFirstLine) {
|
||||
curLeft = padLeft(left, rightAlignOfLeft);
|
||||
curLeft = padRight(curLeft, leftAlignOfRight);
|
||||
curLeft = left.padStart(rightAlignOfLeft);
|
||||
curLeft = curLeft.padEnd(leftAlignOfRight);
|
||||
curLeft = colorLeft ? colors.blue(curLeft) : curLeft;
|
||||
}
|
||||
else {
|
||||
curLeft = padLeft("", leftAlignOfRight);
|
||||
curLeft = "".padStart(leftAlignOfRight);
|
||||
}
|
||||
|
||||
const curRight = remainRight.substr(0, rightCharacterNumber);
|
||||
@@ -524,15 +522,15 @@ function getHeader(sys: System, message: string) {
|
||||
const terminalWidth = sys.getWidthOfTerminal?.() ?? 0;
|
||||
const tsIconLength = 5;
|
||||
|
||||
const tsIconFirstLine = colors.blueBackground(padLeft("", tsIconLength));
|
||||
const tsIconSecondLine = colors.blueBackground(colors.brightWhite(padLeft("TS ", tsIconLength)));
|
||||
const tsIconFirstLine = colors.blueBackground("".padStart(tsIconLength));
|
||||
const tsIconSecondLine = colors.blueBackground(colors.brightWhite("TS ".padStart(tsIconLength)));
|
||||
// If we have enough space, print TS icon.
|
||||
if (terminalWidth >= message.length + tsIconLength) {
|
||||
// right align of the icon is 120 at most.
|
||||
const rightAlign = terminalWidth > 120 ? 120 : terminalWidth;
|
||||
const leftAlign = rightAlign - tsIconLength;
|
||||
header.push(padRight(message, leftAlign) + tsIconFirstLine + sys.newLine);
|
||||
header.push(padLeft("", leftAlign) + tsIconSecondLine + sys.newLine);
|
||||
header.push(message.padEnd(leftAlign) + tsIconFirstLine + sys.newLine);
|
||||
header.push("".padStart(leftAlign) + tsIconSecondLine + sys.newLine);
|
||||
}
|
||||
else {
|
||||
header.push(message + sys.newLine);
|
||||
@@ -1261,7 +1259,7 @@ function reportAllStatistics(sys: System, statistics: Statistic[]) {
|
||||
}
|
||||
|
||||
for (const s of statistics) {
|
||||
sys.write(padRight(s.name + ":", nameSize + 2) + padLeft(statisticValue(s).toString(), valueSize) + sys.newLine);
|
||||
sys.write(`${s.name}:`.padEnd(nameSize + 2) + statisticValue(s).toString().padStart(valueSize) + sys.newLine);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user