UNPKG

printaeu

Version:
1 lines 20.3 kB
(()=>{"use strict";var o={274:function(o,n,t){var c,i=this&&this.__extends||(c=function(o,n){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,n){o.__proto__=n}||function(o,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(o[t]=n[t])},c(o,n)},function(o,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=o}c(o,n),o.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}),r=this&&this.__createBinding||(Object.create?function(o,n,t,c){void 0===c&&(c=t);var i=Object.getOwnPropertyDescriptor(n,t);i&&!("get"in i?!n.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return n[t]}}),Object.defineProperty(o,c,i)}:function(o,n,t,c){void 0===c&&(c=t),o[c]=n[t]}),e=this&&this.__setModuleDefault||(Object.create?function(o,n){Object.defineProperty(o,"default",{enumerable:!0,value:n})}:function(o,n){o.default=n}),s=this&&this.__importStar||function(o){if(o&&o.__esModule)return o;var n={};if(null!=o)for(var t in o)"default"!==t&&Object.prototype.hasOwnProperty.call(o,t)&&r(n,o,t);return e(n,o),n},a=this&&this.__spreadArray||function(o,n,t){if(t||2===arguments.length)for(var c,i=0,r=n.length;i<r;i++)!c&&i in n||(c||(c=Array.prototype.slice.call(n,0,i)),c[i]=n[i]);return o.concat(c||Array.prototype.slice.call(n))};Object.defineProperty(n,"__esModule",{value:!0}),n.no_entry=n.satellite_antenna=n.heavy_check_mark=n.heart=n.recycle=n.warning=n.print=n.Print=n.color=n.reverse=n.underline=n.italic=n.dim=n.bold=void 0;var u=s(t(521)),l=s(t(147)),f=function(){this.on="",this.off=""};n.bold=new(function(o){function n(){var n=null!==o&&o.apply(this,arguments)||this;return n.on="",n.off="win32"===process.platform?"":"",n}return i(n,o),n}(f)),n.dim=new(function(o){function n(){var n=null!==o&&o.apply(this,arguments)||this;return n.on="",n.off="",n}return i(n,o),n}(f)),n.italic=new(function(o){function n(){var n=null!==o&&o.apply(this,arguments)||this;return n.on="",n.off="",n}return i(n,o),n}(f)),n.underline=new(function(o){function n(){var n=null!==o&&o.apply(this,arguments)||this;return n.on="",n.off="",n}return i(n,o),n}(f)),n.reverse=new(function(o){function n(){var n=null!==o&&o.apply(this,arguments)||this;return n.on="",n.off="",n}return i(n,o),n}(f));var g,d,h=function(){this.reset="",this.bright="",this.dim="",this.italic="",this.underline="",this.reverse="",this.black="",this.red="",this.green="",this.yellow="",this.blue="",this.magenta="",this.cyan="",this.white="",this.gray="",this.pink="",this.orange="",this.dimBlack="",this.dimRed="",this.dimGreen="",this.dimYellow="",this.dimBlue="",this.dimMagenta="",this.dimCyan="",this.dimWhite="",this.dimGray="",this.dimPink="",this.dimOrange="",this.backgrounds=[{name:"black",value:""},{name:"red",value:""},{name:"green",value:""},{name:"yellow",value:""},{name:"blue",value:""},{name:"magenta",value:""},{name:"cyan",value:""},{name:"white",value:""}],this.cls="c"};n.color=new h,function(o){o[o.ON=-1]="ON",o[o.OFF=-5]="OFF"}(g||(g={})),function(o){o[o.ON=0]="ON",o[o.OFF=11]="OFF"}(d||(d={}));var p,m=function(){function o(o,n,t){this.modifier=t.modifier?t.modifier:"",this.isDim=!!t.dim,this.isInline=!!t.inline&&t.inline,this.verbosity=o,this.config=n}return o.prototype.logToFile=function(o,n){if(void 0===n&&(n=!0),n)this.config.logFiles=this.config.logFiles.includes(o)?this.config.logFiles:a(a([],this.config.logFiles,!0),[o],!1);else{var t;-1!==(t=this.config.logFiles.indexOf(o))&&this.config.logFiles.splice(t,1)}},o.prototype.timeStamp=function(){return"["+new Date((new Date).getTime()-60*(new Date).getTimezoneOffset()*1e3).toISOString().slice(this.config.dateOnOff,this.config.msOnOff)+"] "},o.prototype.log=function(o){for(var t=[],c=1;c<arguments.length;c++)t[c-1]=arguments[c];if(this.config.verbosity>=this.verbosity){this.isInline&&(u.cursorTo(process.stdout,0),u.moveCursor(process.stdout,0,-1),u.clearLine(process.stdout,0));var i=this.modifier,r=this.timeStamp();i=this.config.cleanTimeStamp?"".concat(r).concat(this.config.preAppend).concat(i):"".concat(i).concat(r).concat(this.config.preAppend).concat(i),console.log("".concat(i).concat(o),t.reduce((function(o,n){return o+n+" "}),"")),this.modifier&&process.stdout.write(n.color.reset),this.toLog("".concat(r).concat(o)),this._socket&&this._socket.emit("console",this.timeStamp()+o)}},o.prototype.black=function(o){for(var t=[],c=1;c<arguments.length;c++)t[c-1]=arguments[c];if(this.config.verbosity>=this.verbosity){this.isInline&&(u.cursorTo(process.stdout,0),u.moveCursor(process.stdout,0,-1),u.clearLine(process.stdout,0));var i="".concat(this.modifier).concat(this.isDim?n.color.dimBlack:n.color.black).concat(this.config.backgroundColors.black),r=this.timeStamp();i=this.config.cleanTimeStamp?"".concat(r).concat(this.config.preAppend).concat(i):"".concat(i).concat(r).concat(this.config.preAppend).concat(i),console.log("".concat(i).concat(o),t.reduce((function(o,n){return o+n+" "}),"")),process.stdout.write(n.color.reset),this.toLog("".concat(r).concat(o))}},o.prototype.red=function(o){for(var t=[],c=1;c<arguments.length;c++)t[c-1]=arguments[c];if(this.config.verbosity>=this.verbosity){this.isInline&&(u.cursorTo(process.stdout,0),u.moveCursor(process.stdout,0,-1),u.clearLine(process.stdout,0));var i="".concat(this.modifier).concat(this.isDim?n.color.dimRed:n.color.red).concat(this.config.backgroundColors.red),r=this.timeStamp();i=this.config.cleanTimeStamp?"".concat(r).concat(this.config.preAppend).concat(i):"".concat(i).concat(r).concat(this.config.preAppend).concat(i),console.log("".concat(i).concat(o),t.reduce((function(o,n){return o+n+" "}),"")),process.stdout.write(n.color.reset),this.toLog("".concat(r).concat(o))}},o.prototype.green=function(o){for(var t=[],c=1;c<arguments.length;c++)t[c-1]=arguments[c];if(this.config.verbosity>=this.verbosity){this.isInline&&(u.cursorTo(process.stdout,0),u.moveCursor(process.stdout,0,-1),u.clearLine(process.stdout,0));var i="".concat(this.modifier).concat(this.isDim?n.color.dimGreen:n.color.green).concat(this.config.backgroundColors.green),r=this.timeStamp();i=this.config.cleanTimeStamp?"".concat(r).concat(this.config.preAppend).concat(i):"".concat(i).concat(r).concat(this.config.preAppend).concat(i),console.log("".concat(i).concat(o),t.reduce((function(o,n){return o+n+" "}),"")),process.stdout.write(n.color.reset),this.toLog("".concat(r).concat(o))}},o.prototype.yellow=function(o){for(var t=[],c=1;c<arguments.length;c++)t[c-1]=arguments[c];if(this.config.verbosity>=this.verbosity){this.isInline&&(u.cursorTo(process.stdout,0),u.moveCursor(process.stdout,0,-1),u.clearLine(process.stdout,0));var i="".concat(this.modifier).concat(this.isDim?n.color.dimYellow:n.color.yellow).concat(this.config.backgroundColors.yellow),r=this.timeStamp();i=this.config.cleanTimeStamp?"".concat(r).concat(this.config.preAppend).concat(i):"".concat(i).concat(r).concat(this.config.preAppend).concat(i),console.log("".concat(i).concat(o),t.reduce((function(o,n){return o+n+" "}),"")),process.stdout.write(n.color.reset),this.toLog("".concat(r).concat(o))}},o.prototype.blue=function(o){for(var t=[],c=1;c<arguments.length;c++)t[c-1]=arguments[c];if(this.config.verbosity>=this.verbosity){this.isInline&&(u.cursorTo(process.stdout,0),u.moveCursor(process.stdout,0,-1),u.clearLine(process.stdout,0));var i="".concat(this.modifier).concat(this.isDim?n.color.dimBlue:n.color.blue).concat(this.config.backgroundColors.blue),r=this.timeStamp();i=this.config.cleanTimeStamp?"".concat(r).concat(this.config.preAppend).concat(i):"".concat(i).concat(r).concat(this.config.preAppend).concat(i),console.log("".concat(i).concat(o),t.reduce((function(o,n){return o+n+" "}),"")),process.stdout.write(n.color.reset),this.toLog("".concat(r).concat(o))}},o.prototype.magenta=function(o){for(var t=[],c=1;c<arguments.length;c++)t[c-1]=arguments[c];if(this.config.verbosity>=this.verbosity){this.isInline&&(u.cursorTo(process.stdout,0),u.moveCursor(process.stdout,0,-1),u.clearLine(process.stdout,0));var i="".concat(this.modifier).concat(this.isDim?n.color.dimMagenta:n.color.magenta).concat(this.config.backgroundColors.magenta),r=this.timeStamp();i=this.config.cleanTimeStamp?"".concat(r).concat(this.config.preAppend).concat(i):"".concat(i).concat(r).concat(this.config.preAppend).concat(i),console.log("".concat(i).concat(o),t.reduce((function(o,n){return o+n+" "}),"")),process.stdout.write(n.color.reset),this.toLog("".concat(r).concat(o))}},o.prototype.cyan=function(o){for(var t=[],c=1;c<arguments.length;c++)t[c-1]=arguments[c];if(this.config.verbosity>=this.verbosity){this.isInline&&(u.cursorTo(process.stdout,0),u.moveCursor(process.stdout,0,-1),u.clearLine(process.stdout,0));var i="".concat(this.modifier).concat(this.isDim?n.color.dimCyan:n.color.cyan).concat(this.config.backgroundColors.cyan),r=this.timeStamp();i=this.config.cleanTimeStamp?"".concat(r).concat(this.config.preAppend).concat(i):"".concat(i).concat(r).concat(this.config.preAppend).concat(i),console.log("".concat(i).concat(o),t.reduce((function(o,n){return o+n+" "}),"")),process.stdout.write(n.color.reset),this.toLog("".concat(r).concat(o))}},o.prototype.white=function(o){for(var t=[],c=1;c<arguments.length;c++)t[c-1]=arguments[c];if(this.config.verbosity>=this.verbosity){this.isInline&&(u.cursorTo(process.stdout,0),u.moveCursor(process.stdout,0,-1),u.clearLine(process.stdout,0));var i="".concat(this.modifier).concat(this.isDim?n.color.dimWhite:n.color.white).concat(this.config.backgroundColors.white),r=this.timeStamp();i=this.config.cleanTimeStamp?"".concat(r).concat(this.config.preAppend).concat(i):"".concat(i).concat(r).concat(this.config.preAppend).concat(i),console.log("".concat(i).concat(o),t.reduce((function(o,n){return o+n+" "}),"")),process.stdout.write(n.color.reset),this.toLog("".concat(r).concat(o))}},o.prototype.gray=function(o){for(var t=[],c=1;c<arguments.length;c++)t[c-1]=arguments[c];if(this.config.verbosity>=this.verbosity){this.isInline&&(u.cursorTo(process.stdout,0),u.moveCursor(process.stdout,0,-1),u.clearLine(process.stdout,0));var i="".concat(this.modifier).concat(this.isDim?n.color.dimGray:n.color.gray).concat(this.config.backgroundColors.gray),r=this.timeStamp();i=this.config.cleanTimeStamp?"".concat(r).concat(this.config.preAppend).concat(i):"".concat(i).concat(r).concat(this.config.preAppend).concat(i),console.log("".concat(i).concat(o),t.reduce((function(o,n){return o+n+" "}),"")),process.stdout.write(n.color.reset),this.toLog("".concat(r).concat(o))}},o.prototype.grey=function(o){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];this.gray(o,n)},o.prototype.pink=function(o){for(var t=[],c=1;c<arguments.length;c++)t[c-1]=arguments[c];if(this.config.verbosity>=this.verbosity){this.isInline&&(u.cursorTo(process.stdout,0),u.moveCursor(process.stdout,0,-1),u.clearLine(process.stdout,0));var i="".concat(this.modifier).concat(this.isDim?n.color.dimPink:n.color.pink).concat(this.config.backgroundColors.pink),r=this.timeStamp();i=this.config.cleanTimeStamp?"".concat(r).concat(this.config.preAppend).concat(i):"".concat(i).concat(r).concat(this.config.preAppend).concat(i),console.log("".concat(i).concat(o),t.reduce((function(o,n){return o+n+" "}),"")),process.stdout.write(n.color.reset),this.toLog("".concat(r).concat(o))}},o.prototype.orange=function(o){for(var t=[],c=1;c<arguments.length;c++)t[c-1]=arguments[c];if(this.config.verbosity>=this.verbosity){this.isInline&&(u.cursorTo(process.stdout,0),u.moveCursor(process.stdout,0,-1),u.clearLine(process.stdout,0));var i="".concat(this.modifier).concat(this.isDim?n.color.dimOrange:n.color.orange).concat(this.config.backgroundColors.orange),r=this.timeStamp();i=this.config.cleanTimeStamp?"".concat(r).concat(this.config.preAppend).concat(i):"".concat(i).concat(r).concat(this.config.preAppend).concat(i),console.log("".concat(i).concat(o),t.reduce((function(o,n){return o+n+" "}),"")),process.stdout.write(n.color.reset),this.toLog("".concat(r).concat(o))}},o.prototype.toLog=function(o){if(this.config.logFiles.length){Array.isArray(o)||(o=[o]);var n="";o.forEach((function(o){n+="object"==typeof o?JSON.stringify(o)+"\n":o+"\n"})),this.config.logFiles.forEach((function(o){return l.appendFileSync(o,n)}))}},o}(),v=function(o){function t(t,c,i){var r=o.call(this,t,c,{inline:i})||this;return r.bright=new m(t,c,{modifier:n.color.bright,inline:i}),r.bold=new m(t,c,{modifier:n.color.bright,inline:i}),r.italic=new m(t,c,{modifier:n.color.italic,inline:i}),r.dim=new m(t,c,{modifier:n.color.dim,inline:i}),r.underscore=new m(t,c,{modifier:n.color.underline,inline:i}),r.underline=new m(t,c,{modifier:n.color.underline,inline:i}),r.reverse=new m(t,c,{modifier:n.color.reverse,inline:i}),r}return i(t,o),t}(m);!function(o){o[o.LOW=0]="LOW",o[o.MEDIUM=1]="MEDIUM",o[o.HIGH=2]="HIGH"}(p||(p={}));var b=function(o){function n(n){var t=o.call(this,p.HIGH,n,!1)||this;return t.inline=new v(p.HIGH,n,!0),t}return i(n,o),n}(v),_=function(o){function n(n){var t=o.call(this,p.MEDIUM,n,!1)||this;return t.inline=new v(p.MEDIUM,n,!0),t}return i(n,o),n}(v),y=function(){this.cleanTimeStamp=!1,this.msOnOff=g.OFF,this.dateOnOff=d.OFF,this.preAppend="",this.verbosity=p.HIGH,this.backgroundColors={black:"",red:"",green:"",yellow:"",blue:"",magenta:"",cyan:"",white:"",gray:"",pink:"",orange:""},this.logFiles=[]},k=function(o){function t(t){var c=o.call(this,p.LOW,t,!1)||this;return c.setBg={black:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.black=t.value)},red:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.red=t.value)},green:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.green=t.value)},yellow:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.yellow=t.value)},blue:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.blue=t.value)},magenta:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.magenta=t.value)},cyan:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.cyan=t.value)},white:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.white=t.value)},gray:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.gray=t.value)},grey:function(o){c.setBg.gray(o)},pink:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.pink=t.value)},orange:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.orange=t.value)}},c.setBG={black:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.black=t.value)},red:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.red=t.value)},green:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.green=t.value)},yellow:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.yellow=t.value)},blue:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.blue=t.value)},magenta:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.magenta=t.value)},cyan:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.cyan=t.value)},white:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.white=t.value)},gray:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.gray=t.value)},grey:function(o){c.setBg.gray(o)},pink:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.pink=t.value)},orange:function(o){var t=n.color.backgrounds.find((function(n){return n.name===o}));t&&(c._config_.backgroundColors.orange=t.value)}},c.clear_Bg={black:function(){c._config_.backgroundColors.black=""},red:function(){c._config_.backgroundColors.red=""},green:function(){c._config_.backgroundColors.green=""},yellow:function(){c._config_.backgroundColors.yellow=""},blue:function(){c._config_.backgroundColors.blue=""},magenta:function(){c._config_.backgroundColors.magenta=""},cyan:function(){c._config_.backgroundColors.cyan=""},white:function(){c._config_.backgroundColors.white=""},gray:function(){c._config_.backgroundColors.gray=""},grey:function(){c._config_.backgroundColors.gray=""},pink:function(){c._config_.backgroundColors.pink=""},orange:function(){c._config_.backgroundColors.orange=""}},c.clearBG={black:function(){c._config_.backgroundColors.black=""},red:function(){c._config_.backgroundColors.red=""},green:function(){c._config_.backgroundColors.green=""},yellow:function(){c._config_.backgroundColors.yellow=""},blue:function(){c._config_.backgroundColors.blue=""},magenta:function(){c._config_.backgroundColors.magenta=""},cyan:function(){c._config_.backgroundColors.cyan=""},white:function(){c._config_.backgroundColors.white=""},gray:function(){c._config_.backgroundColors.gray=""},grey:function(){c._config_.backgroundColors.gray=""},pink:function(){c._config_.backgroundColors.pink=""},orange:function(){c._config_.backgroundColors.orange=""}},c._config_=t,c.high=new b(t),c.med=new _(t),c.inline=new v(p.LOW,t,!0),c}return i(t,o),t.create=function(){return new t(new y)},t.prototype.preAppend=function(o){this._config_.preAppend=o},t.prototype.goBacknLines=function(o){u.cursorTo(process.stdout,0),u.moveCursor(process.stdout,0,-o),u.clearLine(process.stdout,0)},t.prototype.clearLine=function(o){void 0===o&&(o=0),u.cursorTo(process.stdout,0),u.moveCursor(process.stdout,0,-o),u.clearLine(process.stdout,0)},t.prototype.clear=function(){process.stdout.write(n.color.cls)},t.prototype.showMs=function(o){void 0===o&&(o=!0),this._config_.msOnOff=o?g.ON:g.OFF},t.prototype.showDate=function(o){void 0===o&&(o=!0),this._config_.dateOnOff=o?d.ON:d.OFF},t.prototype.setColorfulTimeStamp=function(o){void 0===o&&(o=!0),this._config_.cleanTimeStamp=!o},t.prototype.track=function(o){var t="";if(this.bright.red("Error trace: "),void 0!==o.stack){for(var c=o.stack.toString().split("\n"),i=0,r=c.length-1;r>0;r--){var e=c[r],s=w(e),a=C(e);i?i!==c.length-1?t+="[".concat(i,"] ").concat(s,"(").concat(a,")\n"):t+="".concat(n.color.bright).concat(n.color.white,"[throw] ").concat(n.color.reset).concat(s,"(").concat(a,")\n"):(t+="".concat(n.color.bright).concat(n.color.white,"[call] ").concat(n.color.reset).concat(s,"(").concat(a,")\n"),i++),i++}this.log(t)}else this.bright.orange("No error trace!")},t.prototype.setVerbosity=function(o){switch(o){case"high":this._config_.verbosity=p.HIGH;break;case"medium":this._config_.verbosity=p.MEDIUM;break;case"low":this._config_.verbosity=p.LOW}},t.prototype.socket=function(o){this._config_.socket=o},t}(v);function w(o){return o.slice(o.indexOf("at ")+3,o.indexOf(" ("))}function C(o){var n;return(n=o.includes("\\")?o.split("\\"):o.split("/"))[n.length-1].replace(")","")}n.Print=k,n.print=k.create(),n.warning="⚠",n.recycle="♻",n.heart="❤",n.heavy_check_mark="️",n.satellite_antenna="📡",n.no_entry="⛔"},147:o=>{o.exports=require("fs")},521:o=>{o.exports=require("readline")}},n={};var t=function t(c){var i=n[c];if(void 0!==i)return i.exports;var r=n[c]={exports:{}};return o[c].call(r.exports,r,r.exports,t),r.exports}(274),c=exports;for(var i in t)c[i]=t[i];t.__esModule&&Object.defineProperty(c,"__esModule",{value:!0})})();