vite-plugin-dts-build
Version:
Fast .d.ts builds for Vite (worker + incremental) with optional dual ESM/CJS support.
25 lines (24 loc) • 659 B
JavaScript
const CYAN = "\x1B[36m";
const GREEN = "\x1B[32m";
const YELLOW = "\x1B[33m";
const RESET = "\x1B[0m";
const PREFIX_MSG = "[vite-tsc-build]";
const COLORED_PREFIX_MSG = `${CYAN}${PREFIX_MSG}`;
function getMessageWithPrefix(message, messageColor) {
const isNoColor = "NO_COLOR" in process.env;
if (isNoColor) {
return `${PREFIX_MSG} ${message}`;
} else {
return `${COLORED_PREFIX_MSG} ${messageColor}${message}${RESET}`;
}
}
function printInfo(message) {
console.log(getMessageWithPrefix(message, GREEN));
}
function printWarn(message) {
console.warn(getMessageWithPrefix(message, YELLOW));
}
export {
printWarn as a,
printInfo as p
};