UNPKG

@mornya/cli-libs

Version:
1 lines 4.82 kB
"use strict";var a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,l,a=r.call(e),n=[];try{for(;(void 0===t||0<t--)&&!(o=a.next()).done;)n.push(o.value)}catch(e){l={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(l)throw l.error}}return n},n=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var o,l=0,a=t.length;l<a;l++)!o&&l in t||((o=o||Array.prototype.slice.call(t,0,l))[l]=t[l]);return e.concat(o||Array.prototype.slice.call(t))},e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},t=(Object.defineProperty(exports,"__esModule",{value:!0}),exports.failure=exports.success=exports.bad=exports.okay=exports.error=exports.warn=exports.debug=exports.watch=exports.devOnly=exports.progress=exports.info=exports.out=exports.linefeed=exports.hideCursor=exports.showCursor=exports.setLogger=exports.chalk=void 0,e(require("os"))),i=e(require("chalk")),d=require("./Icons"),e=("win32"===t.default.platform()&&(Object.defineProperty(i.default,"magenta",{value:i.default.magentaBright}),Object.defineProperty(i.default.bold,"magenta",{value:i.default.bold.magentaBright}),Object.defineProperty(i.default.italic,"magenta",{value:i.default.italic.magentaBright}),Object.defineProperty(i.default.strikethrough,"magenta",{value:i.default.strikethrough.magentaBright}),Object.defineProperty(i.default.underline,"magenta",{value:i.default.underline.magentaBright}),Object.defineProperty(i.default,"yellow",{value:i.default.yellowBright}),Object.defineProperty(i.default.bold,"yellow",{value:i.default.bold.yellowBright}),Object.defineProperty(i.default.italic,"yellow",{value:i.default.italic.yellowBright}),Object.defineProperty(i.default.strikethrough,"yellow",{value:i.default.strikethrough.yellowBright}),Object.defineProperty(i.default.underline,"yellow",{value:i.default.underline.yellowBright})),exports.chalk=i.default,new Date),t=e.getMonth()+1,e=e.getDate(),o=["2-14","3-14","3-25","5-5","5-14","9-9","9-20","11-5","12-2","12-24","12-25"].includes("".concat(t,"-").concat(e))?d.icon.shineHeart:d.icon.pin,u=console.log;function linefeed(){process.stdout.write("\r\n")}exports.setLogger=function setLogger(e){u=e},exports.showCursor=function showCursor(){process.stdout.write("[?25h")},exports.hideCursor=function hideCursor(){process.stdout.write("[?25l")},exports.linefeed=linefeed,exports.out=function out(e){for(var t,r,o=[],l=1;l<arguments.length;l++)o[l-1]=arguments[l];e?Array.isArray(e)?(t=(r=a(e))[0],r=r.slice(1),u.apply(void 0,n([t],a(o),!1)),r.forEach(function(e){return u.apply(void 0,n([e],a(o),!1))})):u.apply(void 0,n([e],a(o),!1)):linefeed()},exports.info=function info(e){for(var t,r,o=[],l=1;l<arguments.length;l++)o[l-1]=arguments[l];e?Array.isArray(e)?(t=(r=a(e))[0],r=r.slice(1),u.apply(void 0,n(["",i.default.magentaBright.bold(d.icon.info),t],a(o),!1)),r.forEach(function(e){return u.apply(void 0,n([" ",e],a(o),!1))})):u.apply(void 0,n(["",i.default.magentaBright.bold(d.icon.info),e],a(o),!1)):linefeed()},exports.progress=function progress(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.apply(void 0,n([i.default.red.bold(o),e],a(t),!1))},exports.devOnly=function devOnly(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.apply(void 0,n([i.default.blue.bgBlack.bold("[dev]"),i.default.gray(e)],a(t),!1))},exports.watch=function watch(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.apply(void 0,n([i.default.blue.bgBlack.bold("[watch]"),i.default.gray(e)],a(t),!1))},exports.debug=function debug(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.apply(void 0,n([i.default.white.bgBlack.bold("[debug]"),i.default.gray(e)],a(t),!1))},exports.warn=function warn(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.apply(void 0,n([i.default.yellowBright.bold(e)],a(t),!1))},exports.error=function error(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.apply(void 0,n([i.default.red.bold(e)],a(t),!1))},exports.okay=function okay(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.apply(void 0,n(["",i.default.green.bold(d.icon.okay),i.default.green.bold(e)],a(t),!1))},exports.bad=function bad(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.apply(void 0,n(["",i.default.red.bold(d.icon.bad),i.default.red.bold(e)],a(t),!1))},exports.success=function success(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];linefeed(),u.apply(void 0,n(["",i.default.green.bold(d.icon.okay),i.default.green.bold(e)],a(t),!1)),linefeed()},exports.failure=function failure(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];linefeed(),u.apply(void 0,n(["",i.default.red.bold(d.icon.bad),i.default.red.bold(e)],a(t),!1)),linefeed()};