fix(vite): dim repeat count in logs (#29392)

This commit is contained in:
Alexander 2024-10-12 00:15:24 +05:00 committed by GitHub
parent ca65f150b3
commit 79f55e348e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,6 @@
import type * as vite from 'vite' import type * as vite from 'vite'
import { logger } from '@nuxt/kit' import { logger } from '@nuxt/kit'
import { colorize } from 'consola/utils'
import { hasTTY, isCI } from 'std-env' import { hasTTY, isCI } from 'std-env'
import clear from 'clear' import clear from 'clear'
import type { NuxtOptions } from '@nuxt/schema' import type { NuxtOptions } from '@nuxt/schema'
@ -61,8 +62,7 @@ export function createViteLogger (config: vite.InlineConfig): vite.Logger {
const prevLevel = logger.level const prevLevel = logger.level
logger.level = logLevelMapReverse[config.logLevel || 'info'] logger.level = logLevelMapReverse[config.logLevel || 'info']
// TODO: colorize counter after https://github.com/unjs/consola/pull/166 logger[type](msg + (sameAsLast ? colorize('dim', ` (x${duplicateCount + 1})`) : ''))
logger[type](msg + (sameAsLast ? ` (x${duplicateCount + 1})` : ''))
logger.level = prevLevel logger.level = prevLevel
} }