'use strict'; const readline = require('node:readline'); const consola$1 = require('consola'); const cliProgress = require('cli-progress'); function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; } const readline__default = /*#__PURE__*/_interopDefaultCompat(readline); const cliProgress__default = /*#__PURE__*/_interopDefaultCompat(cliProgress); const pkgName = "@icestack/ui"; const consola = consola$1.createConsola(); function clearLine(rowCount = 1) { try { readline__default.moveCursor(process.stdout, 0, -rowCount); readline__default.clearLine(process.stdout, 1); } catch { } } function createLogger(prefix) { return { logFlag: true, success(message, ...args) { return this.logFlag && consola.success(`[${prefix}]: ${message}`, ...args); }, warn(message, ...args) { return this.logFlag && consola.warn(`[${prefix}]: ${message}`, ...args); }, error(message, ...args) { return this.logFlag && consola.error(`[${prefix}]: ${message}`, ...args); }, createComponentsProgressBar() { let bar = this.logFlag ? new cliProgress__default.SingleBar( { format: "building components: [{bar}] | {componentName} | {value}/{total}" // barCompleteChar: '\u2588', // barIncompleteChar: '\u2591' // hideCursor: true }, cliProgress__default.Presets.shades_classic ) : void 0; return { destroy() { bar = void 0; }, start: (total, startValue, payload) => { return bar?.start(total, startValue, payload); }, stop: () => { return bar?.stop(); }, clearLine: (rowCount) => { return clearLine(rowCount); }, update: (current, payload) => { return bar?.update(current, payload); } }; } }; } const logger = createLogger(pkgName); exports.consola = consola; exports.createLogger = createLogger; exports.logger = logger;