UNPKG

dejarun

Version:

A file system operation cache for Node.js, using a hash of the file or folder contents as the cache key.

27 lines 996 B
import chalk from "chalk"; export default function logger(type, message, logo = '[${chalk.hex("#ffae42")("déjà")}${chalk.hex("#00e0d3")("run")}]') { const titleStyle = { hit: chalk.greenBright, miss: chalk.yellowBright, clean: chalk.redBright, debug: chalk, error: chalk.redBright, }[type]; const messageStyle = { hit: chalk.dim, miss: chalk.bold, clean: chalk.bold, debug: chalk.dim, error: chalk.redBright, }[type]; const runOrSkip = type === "hit" ? "skip" : "run"; const title = type === "debug" ? "Debug" : `Cache ${type}, ${runOrSkip}`; const formattedLogo = logo === false ? "" : new Function("chalk", `return \`${logo} \``)(chalk); if (type === "error") { console.error(`${formattedLogo}${messageStyle(message)}`); } else { console.log(`${formattedLogo}${titleStyle(`${title}:`)} ${messageStyle(message)}`); } } //# sourceMappingURL=logger.js.map