diff --git a/packages/plugin-dts/src/tsc.ts b/packages/plugin-dts/src/tsc.ts index bcbb74d5b..bc8584d10 100644 --- a/packages/plugin-dts/src/tsc.ts +++ b/packages/plugin-dts/src/tsc.ts @@ -50,7 +50,7 @@ export function emitDts( for (const diagnostic of allDiagnostics) { const fileLoc = getFileLoc(diagnostic); - const message = `${fileLoc} error TS${diagnostic.code}: ${ts.flattenDiagnosticMessageText( + const message = `${fileLoc} - ${color.red('error')} ${color.gray(`TS${diagnostic.code}:`)} ${ts.flattenDiagnosticMessageText( diagnostic.messageText, host.getNewLine(), )}`; @@ -84,7 +84,7 @@ export function emitDts( const fileLoc = getFileLoc(diagnostic); logger.error( - `${fileLoc} error TS${diagnostic.code}:`, + `${fileLoc} - ${color.red('error')} ${color.gray(`TS${diagnostic.code}:`)}`, ts.flattenDiagnosticMessageText( diagnostic.messageText, formatHost.getNewLine(), diff --git a/packages/plugin-dts/src/utils.ts b/packages/plugin-dts/src/utils.ts index f57d315ef..90168c4ff 100644 --- a/packages/plugin-dts/src/utils.ts +++ b/packages/plugin-dts/src/utils.ts @@ -1,5 +1,6 @@ import fs, { writeFileSync } from 'node:fs'; import path from 'node:path'; +import color from 'picocolors'; import * as ts from 'typescript'; export function loadTsconfig(tsconfigPath: string): ts.ParsedCommandLine { @@ -37,7 +38,7 @@ export function getFileLoc(diagnostic: ts.Diagnostic): string { diagnostic.file, diagnostic.start!, ); - return `${diagnostic.file.fileName}:${line + 1}:${character + 1} - `; + return `${color.cyan(diagnostic.file.fileName)}:${color.yellow(line + 1)}:${color.yellow(character + 1)}`; } return '';