Comparing version 2.7.0 to 2.7.1
@@ -5,2 +5,11 @@ # Changelog | ||
### [2.7.1](https://github.com/nuxt/consola/compare/v2.7.0...v2.7.1) (2019-05-26) | ||
### Bug Fixes | ||
* **browser:** hide `:` with tag and normal log ([8250d5a](https://github.com/nuxt/consola/commit/8250d5a)) | ||
## [2.7.0](https://github.com/nuxt/consola/compare/v2.6.2...v2.7.0) (2019-05-26) | ||
@@ -7,0 +16,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).consola=t()}(this,function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function r(e,r,o){return r&&t(e.prototype,r),o&&t(e,o),e}function o(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var s={fatal:{level:0},error:{level:0},warn:{level:1},log:{level:2},info:{level:3},success:{level:3},debug:{level:4},trace:{level:5},silent:{level:1/0},ready:{level:3},start:{level:3}};function n(e){return t=e,"[object Object]"===Object.prototype.toString.call(t)&&(!(!e.message&&!e.args)&&!e.stack);var t}var i=!1,l=[],a=function(){function t(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var o in e(this,t),this._reporters=r.reporters||[],this._types=r.types||s,this._level=null!=r.level?r.level:3,this._defaults=r.defaults||{},this._async=void 0!==r.async?r.async:null,this._stdout=r.stdout,this._stderr=r.stdout,this._mockFn=r.mockFn,this._types)this[o]=this._wrapLogFn(Object.assign({type:o},this._types[o],this._defaults));this._mockFn&&this.mockTypes()}return r(t,[{key:"create",value:function(e){return new t(Object.assign({reporters:this._reporters,level:this._level,types:this._types,defaults:this._defaults,stdout:this._stdout,stderr:this._stderr,mockFn:this._mockFn},e))}},{key:"withDefaults",value:function(e){return this.create({defaults:Object.assign({},this._defaults,e)})}},{key:"withTag",value:function(e){return this.withDefaults({tag:this._defaults.tag?this._defaults.tag+":"+e:e})}},{key:"addReporter",value:function(e){return this._reporters.push(e),this}},{key:"removeReporter",value:function(e){if(e){var t=this._reporters.indexOf(e);if(t>=0)return this._reporters.splice(t,1)}else this._reporters.splice(0);return this}},{key:"setReporters",value:function(e){return this._reporters=Array.isArray(e)?e:[e],this}},{key:"wrapAll",value:function(){this.wrapConsole(),this.wrapStd()}},{key:"restoreAll",value:function(){this.restoreConsole(),this.restoreStd()}},{key:"wrapConsole",value:function(){for(var e in this._types)console["__"+e]||(console["__"+e]=console[e]),console[e]=this[e]}},{key:"restoreConsole",value:function(){for(var e in this._types)console["__"+e]&&(console[e]=console["__"+e],delete console["__"+e])}},{key:"wrapStd",value:function(){this._wrapStream(this.stdout,"log"),this._wrapStream(this.stderr,"log")}},{key:"_wrapStream",value:function(e,t){var r=this;e&&(e.__write||(e.__write=e.write),e.write=function(e){r[t](String(e).trim())})}},{key:"restoreStd",value:function(){this._restoreStream(this.stdout),this._restoreStream(this.stderr)}},{key:"_restoreStream",value:function(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}},{key:"pauseLogs",value:function(){i=!0}},{key:"resumeLogs",value:function(){i=!1;var e=l.splice(0),t=!0,r=!1,o=void 0;try{for(var s,n=e[Symbol.iterator]();!(t=(s=n.next()).done);t=!0){var a=s.value;a[0]._logFn(a[1],a[2])}}catch(e){r=!0,o=e}finally{try{t||null==n.return||n.return()}finally{if(r)throw o}}}},{key:"mockTypes",value:function(e){if(this._mockFn=e||this._mockFn,"function"==typeof this._mockFn)for(var t in this._types)this[t]=this._mockFn(t,this._types[t])||this[t]}},{key:"_wrapLogFn",value:function(e){return function(){if(!i)return this._logFn(e,arguments);l.push([this,e,arguments])}.bind(this)}},{key:"_logFn",value:function(e,t){if(e.level>this._level)return!!this._async&&Promise.resolve(!1);var r=Object.assign({date:new Date,args:[]},e);if(1===t.length&&n(t[0])?Object.assign(r,t[0]):r.args=Array.from(t),r.message&&(r.args.unshift(r.message),delete r.message),r.additional&&(Array.isArray(r.additional)||(r.additional=r.additional.split("\n")),r.args.push("\n"+r.additional.join("\n")),delete r.additional),r.type&&(r.type=r.type.toLowerCase()),r.tag&&(r.tag=r.tag.toLowerCase()),this._async)return this._logAsync(r);this._log(r)}},{key:"_log",value:function(e){var t=!0,r=!1,o=void 0;try{for(var s,n=this._reporters[Symbol.iterator]();!(t=(s=n.next()).done);t=!0){s.value.log(e,{async:!1,stdout:this.stdout,stderr:this.stderr})}}catch(e){r=!0,o=e}finally{try{t||null==n.return||n.return()}finally{if(r)throw o}}}},{key:"_logAsync",value:function(e){var t=this;return Promise.all(this._reporters.map(function(r){return r.log(e,{async:!0,stdout:t.stdout,stderr:t.stderr})}))}},{key:"level",get:function(){return this._level},set:function(e){var t=0,r=0;for(var o in this._types){var s=this._types[o];s.level>r?r=s.level:s.level<t&&(t=s.level)}this._level=Math.min(r,Math.max(t,e))}},{key:"stdout",get:function(){return this._stdout||console._stdout}},{key:"stderr",get:function(){return this._stderr||console._stderr}}]),t}();a.prototype.add=a.prototype.addReporter,a.prototype.remove=a.prototype.removeReporter,a.prototype.clear=a.prototype.removeReporter,a.prototype.withScope=a.prototype.withTag,a.prototype.mock=a.prototype.mockTypes,a.prototype.pause=a.prototype.pauseLogs,a.prototype.resume=a.prototype.resumeLogs;var u,c=function(){function t(r){e(this,t),this.options=Object.assign({},r),this.defaultColor="#7f8c8d",this.levelColorMap={0:"#c0392b",1:"#f39c12",3:"#00BCD4"},this.typeColorMap={success:"#2ecc71"}}return r(t,[{key:"log",value:function(e){var t=e.level<1?console.__error||console.error:1===e.level&&console.warn?console.__warn||console.warn:console.__log||console.log,r="log"!==e.type?e.type:"",s=e.tag?e.tag:"",n=this.typeColorMap[e.type]||this.levelColorMap[e.level]||this.defaultColor,i="\n background: ".concat(n,";\n border-radius: 0.5em;\n color: white;\n font-weight: bold;\n padding: 2px 0.5em;\n ");t.apply(void 0,["%c"+s+(s?":":"")+r,i].concat(o(e.args)))}}]),t}();return"undefined"!=typeof window&&window.consola||((u=new a({reporters:[new c]})).Consola=a,u.BrowserReporter=c,u)}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).consola=t()}(this,function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function r(e,r,o){return r&&t(e.prototype,r),o&&t(e,o),e}function o(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var s={fatal:{level:0},error:{level:0},warn:{level:1},log:{level:2},info:{level:3},success:{level:3},debug:{level:4},trace:{level:5},silent:{level:1/0},ready:{level:3},start:{level:3}};function n(e){return t=e,"[object Object]"===Object.prototype.toString.call(t)&&(!(!e.message&&!e.args)&&!e.stack);var t}var i=!1,l=[],a=function(){function t(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var o in e(this,t),this._reporters=r.reporters||[],this._types=r.types||s,this._level=null!=r.level?r.level:3,this._defaults=r.defaults||{},this._async=void 0!==r.async?r.async:null,this._stdout=r.stdout,this._stderr=r.stdout,this._mockFn=r.mockFn,this._types)this[o]=this._wrapLogFn(Object.assign({type:o},this._types[o],this._defaults));this._mockFn&&this.mockTypes()}return r(t,[{key:"create",value:function(e){return new t(Object.assign({reporters:this._reporters,level:this._level,types:this._types,defaults:this._defaults,stdout:this._stdout,stderr:this._stderr,mockFn:this._mockFn},e))}},{key:"withDefaults",value:function(e){return this.create({defaults:Object.assign({},this._defaults,e)})}},{key:"withTag",value:function(e){return this.withDefaults({tag:this._defaults.tag?this._defaults.tag+":"+e:e})}},{key:"addReporter",value:function(e){return this._reporters.push(e),this}},{key:"removeReporter",value:function(e){if(e){var t=this._reporters.indexOf(e);if(t>=0)return this._reporters.splice(t,1)}else this._reporters.splice(0);return this}},{key:"setReporters",value:function(e){return this._reporters=Array.isArray(e)?e:[e],this}},{key:"wrapAll",value:function(){this.wrapConsole(),this.wrapStd()}},{key:"restoreAll",value:function(){this.restoreConsole(),this.restoreStd()}},{key:"wrapConsole",value:function(){for(var e in this._types)console["__"+e]||(console["__"+e]=console[e]),console[e]=this[e]}},{key:"restoreConsole",value:function(){for(var e in this._types)console["__"+e]&&(console[e]=console["__"+e],delete console["__"+e])}},{key:"wrapStd",value:function(){this._wrapStream(this.stdout,"log"),this._wrapStream(this.stderr,"log")}},{key:"_wrapStream",value:function(e,t){var r=this;e&&(e.__write||(e.__write=e.write),e.write=function(e){r[t](String(e).trim())})}},{key:"restoreStd",value:function(){this._restoreStream(this.stdout),this._restoreStream(this.stderr)}},{key:"_restoreStream",value:function(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}},{key:"pauseLogs",value:function(){i=!0}},{key:"resumeLogs",value:function(){i=!1;var e=l.splice(0),t=!0,r=!1,o=void 0;try{for(var s,n=e[Symbol.iterator]();!(t=(s=n.next()).done);t=!0){var a=s.value;a[0]._logFn(a[1],a[2])}}catch(e){r=!0,o=e}finally{try{t||null==n.return||n.return()}finally{if(r)throw o}}}},{key:"mockTypes",value:function(e){if(this._mockFn=e||this._mockFn,"function"==typeof this._mockFn)for(var t in this._types)this[t]=this._mockFn(t,this._types[t])||this[t]}},{key:"_wrapLogFn",value:function(e){return function(){if(!i)return this._logFn(e,arguments);l.push([this,e,arguments])}.bind(this)}},{key:"_logFn",value:function(e,t){if(e.level>this._level)return!!this._async&&Promise.resolve(!1);var r=Object.assign({date:new Date,args:[]},e);if(1===t.length&&n(t[0])?Object.assign(r,t[0]):r.args=Array.from(t),r.message&&(r.args.unshift(r.message),delete r.message),r.additional&&(Array.isArray(r.additional)||(r.additional=r.additional.split("\n")),r.args.push("\n"+r.additional.join("\n")),delete r.additional),r.type&&(r.type=r.type.toLowerCase()),r.tag&&(r.tag=r.tag.toLowerCase()),this._async)return this._logAsync(r);this._log(r)}},{key:"_log",value:function(e){var t=!0,r=!1,o=void 0;try{for(var s,n=this._reporters[Symbol.iterator]();!(t=(s=n.next()).done);t=!0){s.value.log(e,{async:!1,stdout:this.stdout,stderr:this.stderr})}}catch(e){r=!0,o=e}finally{try{t||null==n.return||n.return()}finally{if(r)throw o}}}},{key:"_logAsync",value:function(e){var t=this;return Promise.all(this._reporters.map(function(r){return r.log(e,{async:!0,stdout:t.stdout,stderr:t.stderr})}))}},{key:"level",get:function(){return this._level},set:function(e){var t=0,r=0;for(var o in this._types){var s=this._types[o];s.level>r?r=s.level:s.level<t&&(t=s.level)}this._level=Math.min(r,Math.max(t,e))}},{key:"stdout",get:function(){return this._stdout||console._stdout}},{key:"stderr",get:function(){return this._stderr||console._stderr}}]),t}();a.prototype.add=a.prototype.addReporter,a.prototype.remove=a.prototype.removeReporter,a.prototype.clear=a.prototype.removeReporter,a.prototype.withScope=a.prototype.withTag,a.prototype.mock=a.prototype.mockTypes,a.prototype.pause=a.prototype.pauseLogs,a.prototype.resume=a.prototype.resumeLogs;var u,c=function(){function t(r){e(this,t),this.options=Object.assign({},r),this.defaultColor="#7f8c8d",this.levelColorMap={0:"#c0392b",1:"#f39c12",3:"#00BCD4"},this.typeColorMap={success:"#2ecc71"}}return r(t,[{key:"log",value:function(e){var t=e.level<1?console.__error||console.error:1===e.level&&console.warn?console.__warn||console.warn:console.__log||console.log,r="log"!==e.type?e.type:"",s=e.tag?e.tag:"",n=this.typeColorMap[e.type]||this.levelColorMap[e.level]||this.defaultColor,i="\n background: ".concat(n,";\n border-radius: 0.5em;\n color: white;\n font-weight: bold;\n padding: 2px 0.5em;\n ");t.apply(void 0,["%c"+[s,r].filter(Boolean).join(":"),i].concat(o(e.args)))}}]),t}();return"undefined"!=typeof window&&window.consola||((u=new a({reporters:[new c]})).Consola=a,u.BrowserReporter=c,u)}); |
{ | ||
"name": "consola", | ||
"version": "2.7.0", | ||
"version": "2.7.1", | ||
"description": "Elegant Console Logger for Node.js and Browser", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
90009
0