New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

probe.gl

Package Overview
Dependencies
Maintainers
5
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

probe.gl - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

3

CHANGELOG.md
CHANGELOG
v1.0.1 - May 3, 2018
- Image logging improvements
v1.0.0 - Apr 16, 2018

@@ -4,0 +7,0 @@ - Initial official release

2

dist/lib/log.js

@@ -1,2 +0,2 @@

'use strict';var _typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&'function'==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj},_createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_globals=require('./utils/globals'),_localStorage=require('./utils/local-storage'),_localStorage2=_interopRequireDefault(_localStorage),_timestamp=require('./utils/timestamp'),_formatters=require('./utils/formatters'),_color=require('./utils/color'),_autobind=require('./utils/autobind'),_assert=require('../lib/utils/assert'),_assert2=_interopRequireDefault(_assert);Object.defineProperty(exports,'__esModule',{value:!0});function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}return Array.from(arr)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}var originalConsole={debug:_globals.isBrowser?console.debug||console.log:console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},DEFAULT_SETTINGS={enabled:!1,priority:0};function noop(){}var cache={};function getTableHeader(table){for(var key in table)for(var title in table[key])return title||'untitled';return'empty'}var Log=function(){function Log(){var _ref=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},id=_ref.id;_classCallCheck(this,Log),this.id=id,this.VERSION=_globals.VERSION,this._startTs=(0,_timestamp.getTimestamp)(),this._deltaTs=(0,_timestamp.getTimestamp)(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new _localStorage2.default('__probe-'+this.id+'__',DEFAULT_SETTINGS),this.userData={},this.timeStamp(this.id+' started'),(0,_autobind.autobind)(this),Object.seal(this)}return _createClass(Log,[{key:'isEnabled',value:function isEnabled(){return this._storage.config.enabled}},{key:'getPriority',value:function getPriority(){return this._storage.config.priority}},{key:'getLevel',value:function getLevel(){return this._storage.config.priority}},{key:'getTotal',value:function getTotal(){return+((0,_timestamp.getTimestamp)()-this._startTs).toPrecision(10)}},{key:'getDelta',value:function getDelta(){return+((0,_timestamp.getTimestamp)()-this._deltaTs).toPrecision(10)}},{key:'enable',value:function enable(){var enabled=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:enabled}),this}},{key:'setLevel',value:function setLevel(level){return this._storage.updateConfiguration({priority:level}),this}},{key:'warn',value:function warn(message){for(var _len=arguments.length,args=Array(1<_len?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];return this._getLogFunction({message:message,args:args,method:originalConsole.warn,once:!0})}},{key:'error',value:function error(message){for(var _len2=arguments.length,args=Array(1<_len2?_len2-1:0),_key2=1;_key2<_len2;_key2++)args[_key2-1]=arguments[_key2];return this._getLogFunction({message:message,args:args,method:originalConsole.error})}},{key:'deprecated',value:function deprecated(oldUsage,newUsage){return this.warn('`'+oldUsage+'` is deprecated and will be removed in a later version. Use `'+newUsage+'` instead')}},{key:'removed',value:function removed(oldUsage,newUsage){return this.error('`'+oldUsage+'` has been removed. Use `'+newUsage+'` instead')}},{key:'probe',value:function probe(priority,message){for(var _len3=arguments.length,args=Array(2<_len3?_len3-2:0),_key3=2;_key3<_len3;_key3++)args[_key3-2]=arguments[_key3];return this._getLogFunction({priority:priority,message:message,args:args,method:originalConsole.log,time:!0})}},{key:'log',value:function log(priority,message){for(var _len4=arguments.length,args=Array(2<_len4?_len4-2:0),_key4=2;_key4<_len4;_key4++)args[_key4-2]=arguments[_key4];return this._getLogFunction({priority:priority,message:message,args:args,method:originalConsole.debug})}},{key:'info',value:function info(priority,message){for(var _len5=arguments.length,args=Array(2<_len5?_len5-2:0),_key5=2;_key5<_len5;_key5++)args[_key5-2]=arguments[_key5];return this._getLogFunction({priority:priority,message:message,args:args,method:console.info})}},{key:'once',value:function once(priority,message){for(var _len6=arguments.length,args=Array(2<_len6?_len6-2:0),_key6=2;_key6<_len6;_key6++)args[_key6-2]=arguments[_key6];return this._getLogFunction({priority:priority,message:message,args:args,method:originalConsole.debug||originalConsole.info,once:!0})}},{key:'table',value:function table(priority,_table,columns){if(_table){var tag=getTableHeader(_table);return this._getLogFunction({priority:priority,message:_table,args:columns&&[columns],tag:tag,method:console.table||noop})}return noop}},{key:'image',value:function image(_ref2){var priority=_ref2.priority,_image=_ref2.image,_ref2$message=_ref2.message,message=void 0===_ref2$message?'':_ref2$message,_ref2$scale=_ref2.scale,scale=void 0===_ref2$scale?1:_ref2$scale;if(priority>this.getPriority())return noop;if('undefined'==typeof window)return noop;if('string'==typeof _image){var img=new Image;img.onload=function(){return console.log(_formatters.formatImage.bind(null,img,message,scale))},img.src=_image}var element=_image.nodeName||'';if('img'===element.toLowerCase()&&console.log((0,_formatters.formatImage)(_image,message,scale)),'canvas'===element.toLowerCase()){var _img=new Image;_img.onload=function(){return console.log(_formatters.formatImage.bind(null,_img,message,scale))},_img.src=_image.toDataURL()}return noop}},{key:'time',value:function time(priority,message){return this._getLogFunction({priority:priority,message:message,method:console.time?console.time:console.info})}},{key:'timeEnd',value:function timeEnd(priority,message){return this._getLogFunction({priority:priority,message:message,method:console.timeEnd?console.timeEnd:console.info})}},{key:'timeStamp',value:function timeStamp(priority,message){return this._getLogFunction({priority:priority,message:message,method:console.timeStamp||noop})}},{key:'group',value:function group(priority,message){var opts=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};opts=this._normalizeArguments({priority:priority,message:message,opts:opts});var _opts=opts,collapsed=_opts.collapsed;return this._getLogFunction({priority:priority,message:message,opts:opts,method:(collapsed?console.groupCollapsed:console.group)||console.info})}},{key:'groupCollapsed',value:function groupCollapsed(priority,message){var opts=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return this.group(priority,message,Object.assign({},opts,{collapsed:!0}))}},{key:'groupEnd',value:function groupEnd(priority){return this._getLogFunction({priority:priority,message:'',method:console.groupEnd||noop})}},{key:'withGroup',value:function withGroup(priority,message,func){var opts=this._normalizeArguments({priority:priority,message:message});this.group(opts);try{func()}finally{this.groupEnd(opts.message)}}},{key:'trace',value:function trace(){console.trace&&console.trace()}},{key:'_shouldLog',value:function _shouldLog(priority){return priority=this._normalizePriority(priority),0===priority||this.isEnabled()&&this.getPriority()>=priority}},{key:'_getElapsedTime',value:function _getElapsedTime(){var total=this.getTotal(),delta=this.getDelta();return this._deltaTs=(0,_timestamp.getTimestamp)(),{total:total,delta:delta}}},{key:'_getLogFunction',value:function _getLogFunction(opts){if(this._shouldLog(opts.priority)){var _opts2=opts,method=_opts2.method;opts=this._parseArguments(opts),(0,_assert2.default)(method);var _opts3=opts,message=_opts3.message,tag=opts.tag||opts.message;if(opts.once)if(!cache[tag])cache[tag]=(0,_timestamp.getTimestamp)();else return noop;return message=this._decorateMessage(message,opts),method.bind.apply(method,[console,message].concat(_toConsumableArray(opts.args)))}return noop}},{key:'_parseArguments',value:function _parseArguments(options){var normOpts=this._normalizeArguments(options),_getElapsedTime2=this._getElapsedTime(),delta=_getElapsedTime2.delta,total=_getElapsedTime2.total;return Object.assign(options,normOpts,{delta:delta,total:total})}},{key:'_normalizePriority',value:function _normalizePriority(priority){var resolvedPriority;switch('undefined'==typeof priority?'undefined':_typeof(priority)){case'number':resolvedPriority=priority;break;case'object':resolvedPriority=priority.priority||0;break;default:resolvedPriority=0;}return(0,_assert2.default)(Number.isFinite(resolvedPriority)&&0<=resolvedPriority),resolvedPriority}},{key:'_normalizeArguments',value:function _normalizeArguments(_ref3){var priority=_ref3.priority,message=_ref3.message,_ref3$args=_ref3.args,args=void 0===_ref3$args?[]:_ref3$args,opts=_ref3.opts,newOpts={priority:this._normalizePriority(priority),message:message,args:args};switch('undefined'==typeof priority?'undefined':_typeof(priority)){case'string':case'function':void 0!==message&&args.unshift(message),Object.assign(newOpts,{message:priority});break;case'object':Object.assign(newOpts,priority);break;default:}return'function'==typeof newOpts.message&&(newOpts.message=this._shouldLog(newOpts.priority)?newOpts.message():''),(0,_assert2.default)('string'==typeof newOpts.message||'object'===_typeof(newOpts.message)),Object.assign(newOpts,opts)}},{key:'_decorateMessage',value:function _decorateMessage(message,opts){if('string'==typeof message){var time='';if(opts.time){var _getElapsedTime3=this._getElapsedTime(),total=_getElapsedTime3.total;time=(0,_formatters.leftPad)((0,_formatters.formatTime)(total))}message=opts.time?this.id+': '+time+' '+message:this.id+': '+message,message=(0,_color.addColor)(message,opts.color,opts.background)}return message}},{key:'priority',set:function set(newPriority){return this._storage.updateConfiguration({priority:newPriority}),this},get:function get(){return this._storage.config.priority}}]),Log}();exports.default=Log,Log.VERSION=_globals.VERSION;
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});var _typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&'function'==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj},_createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_globals=require('./utils/globals'),_localStorage=require('./utils/local-storage'),_localStorage2=_interopRequireDefault(_localStorage),_timestamp=require('./utils/timestamp'),_formatters=require('./utils/formatters'),_color=require('./utils/color'),_autobind=require('./utils/autobind'),_assert=require('../lib/utils/assert'),_assert2=_interopRequireDefault(_assert);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}return Array.from(arr)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}var originalConsole={debug:_globals.isBrowser?console.debug||console.log:console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},DEFAULT_SETTINGS={enabled:!1,priority:0};function noop(){}var cache={};function getTableHeader(table){for(var key in table)for(var title in table[key])return title||'untitled';return'empty'}var Log=function(){function Log(){var _ref=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},id=_ref.id;_classCallCheck(this,Log),this.id=id,this.VERSION=_globals.VERSION,this._startTs=(0,_timestamp.getTimestamp)(),this._deltaTs=(0,_timestamp.getTimestamp)(),this.LOG_THROTTLE_TIMEOUT=0,this._storage=new _localStorage2.default('__probe-'+this.id+'__',DEFAULT_SETTINGS),this.userData={},this.timeStamp(this.id+' started'),(0,_autobind.autobind)(this),Object.seal(this)}return _createClass(Log,[{key:'isEnabled',value:function isEnabled(){return this._storage.config.enabled}},{key:'getPriority',value:function getPriority(){return this._storage.config.priority}},{key:'getLevel',value:function getLevel(){return this._storage.config.priority}},{key:'getTotal',value:function getTotal(){return+((0,_timestamp.getTimestamp)()-this._startTs).toPrecision(10)}},{key:'getDelta',value:function getDelta(){return+((0,_timestamp.getTimestamp)()-this._deltaTs).toPrecision(10)}},{key:'enable',value:function enable(){var enabled=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];return this._storage.updateConfiguration({enabled:enabled}),this}},{key:'setLevel',value:function setLevel(level){return this._storage.updateConfiguration({priority:level}),this}},{key:'warn',value:function warn(message){for(var _len=arguments.length,args=Array(1<_len?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];return this._getLogFunction({message:message,args:args,method:originalConsole.warn,once:!0})}},{key:'error',value:function error(message){for(var _len2=arguments.length,args=Array(1<_len2?_len2-1:0),_key2=1;_key2<_len2;_key2++)args[_key2-1]=arguments[_key2];return this._getLogFunction({message:message,args:args,method:originalConsole.error})}},{key:'deprecated',value:function deprecated(oldUsage,newUsage){return this.warn('`'+oldUsage+'` is deprecated and will be removed in a later version. Use `'+newUsage+'` instead')}},{key:'removed',value:function removed(oldUsage,newUsage){return this.error('`'+oldUsage+'` has been removed. Use `'+newUsage+'` instead')}},{key:'probe',value:function probe(priority,message){for(var _len3=arguments.length,args=Array(2<_len3?_len3-2:0),_key3=2;_key3<_len3;_key3++)args[_key3-2]=arguments[_key3];return this._getLogFunction({priority:priority,message:message,args:args,method:originalConsole.log,time:!0})}},{key:'log',value:function log(priority,message){for(var _len4=arguments.length,args=Array(2<_len4?_len4-2:0),_key4=2;_key4<_len4;_key4++)args[_key4-2]=arguments[_key4];return this._getLogFunction({priority:priority,message:message,args:args,method:originalConsole.debug})}},{key:'info',value:function info(priority,message){for(var _len5=arguments.length,args=Array(2<_len5?_len5-2:0),_key5=2;_key5<_len5;_key5++)args[_key5-2]=arguments[_key5];return this._getLogFunction({priority:priority,message:message,args:args,method:console.info})}},{key:'once',value:function once(priority,message){for(var _len6=arguments.length,args=Array(2<_len6?_len6-2:0),_key6=2;_key6<_len6;_key6++)args[_key6-2]=arguments[_key6];return this._getLogFunction({priority:priority,message:message,args:args,method:originalConsole.debug||originalConsole.info,once:!0})}},{key:'table',value:function table(priority,_table,columns){if(_table){var tag=getTableHeader(_table);return this._getLogFunction({priority:priority,message:_table,args:columns&&[columns],tag:tag,method:console.table||noop})}return noop}},{key:'image',value:function image(_ref2){var priority=_ref2.priority,_image=_ref2.image,_ref2$message=_ref2.message,message=void 0===_ref2$message?'':_ref2$message,_ref2$scale=_ref2.scale,scale=void 0===_ref2$scale?1:_ref2$scale;return priority>this.getPriority()?noop:_globals.isBrowser?this._logImageInBrowser({image:_image,message:message,scale:scale}):this._logImageInNode({image:_image,message:message,scale:scale})}},{key:'_logImageInNode',value:function _logImageInNode(_ref3){var image=_ref3.image,_ref3$message=_ref3.message,message=void 0===_ref3$message?'':_ref3$message,_ref3$scale=_ref3.scale,scale=void 0===_ref3$scale?1:_ref3$scale,asciify=module.require('asciify-image');return asciify?function(){return asciify(image,{fit:'box',width:Math.round(80*scale)+'%'}).then(function(data){return console.log(data)})}:noop}},{key:'_logImageInBrowser',value:function _logImageInBrowser(_ref4){var image=_ref4.image,_ref4$message=_ref4.message,message=void 0===_ref4$message?'':_ref4$message,_ref4$scale=_ref4.scale,scale=void 0===_ref4$scale?1:_ref4$scale;if('string'==typeof image){var img=new Image;return img.onload=function(){var _console,args=(0,_formatters.formatImage)(img,message,scale);(_console=console).log.apply(_console,_toConsumableArray(args))},img.src=image,noop}var element=image.nodeName||'';if('img'===element.toLowerCase()){var _console2;return(_console2=console).log.apply(_console2,_toConsumableArray((0,_formatters.formatImage)(image,message,scale))),noop}if('canvas'===element.toLowerCase()){var _img=new Image;return _img.onload=function(){var _console3;return(_console3=console).log.apply(_console3,_toConsumableArray((0,_formatters.formatImage)(_img,message,scale)))},_img.src=image.toDataURL(),noop}return noop}},{key:'time',value:function time(priority,message){return this._getLogFunction({priority:priority,message:message,method:console.time?console.time:console.info})}},{key:'timeEnd',value:function timeEnd(priority,message){return this._getLogFunction({priority:priority,message:message,method:console.timeEnd?console.timeEnd:console.info})}},{key:'timeStamp',value:function timeStamp(priority,message){return this._getLogFunction({priority:priority,message:message,method:console.timeStamp||noop})}},{key:'group',value:function group(priority,message){var opts=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{collapsed:!1};opts=this._normalizeArguments({priority:priority,message:message,opts:opts});var _opts=opts,collapsed=_opts.collapsed;return this._getLogFunction({priority:priority,message:message,opts:opts,method:(collapsed?console.groupCollapsed:console.group)||console.info})}},{key:'groupCollapsed',value:function groupCollapsed(priority,message){var opts=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return this.group(priority,message,Object.assign({},opts,{collapsed:!0}))}},{key:'groupEnd',value:function groupEnd(priority){return this._getLogFunction({priority:priority,message:'',method:console.groupEnd||noop})}},{key:'withGroup',value:function withGroup(priority,message,func){var opts=this._normalizeArguments({priority:priority,message:message});this.group(opts);try{func()}finally{this.groupEnd(opts.message)}}},{key:'trace',value:function trace(){console.trace&&console.trace()}},{key:'_shouldLog',value:function _shouldLog(priority){return priority=this._normalizePriority(priority),0===priority||this.isEnabled()&&this.getPriority()>=priority}},{key:'_getElapsedTime',value:function _getElapsedTime(){var total=this.getTotal(),delta=this.getDelta();return this._deltaTs=(0,_timestamp.getTimestamp)(),{total:total,delta:delta}}},{key:'_getLogFunction',value:function _getLogFunction(opts){if(this._shouldLog(opts.priority)){var _opts2=opts,method=_opts2.method;opts=this._parseArguments(opts),(0,_assert2.default)(method);var _opts3=opts,message=_opts3.message,tag=opts.tag||opts.message;if(opts.once)if(!cache[tag])cache[tag]=(0,_timestamp.getTimestamp)();else return noop;return message=this._decorateMessage(message,opts),method.bind.apply(method,[console,message].concat(_toConsumableArray(opts.args)))}return noop}},{key:'_parseArguments',value:function _parseArguments(options){var normOpts=this._normalizeArguments(options),_getElapsedTime2=this._getElapsedTime(),delta=_getElapsedTime2.delta,total=_getElapsedTime2.total;return Object.assign(options,normOpts,{delta:delta,total:total})}},{key:'_normalizePriority',value:function _normalizePriority(priority){var resolvedPriority;switch('undefined'==typeof priority?'undefined':_typeof(priority)){case'number':resolvedPriority=priority;break;case'object':resolvedPriority=priority.priority||0;break;default:resolvedPriority=0;}return(0,_assert2.default)(Number.isFinite(resolvedPriority)&&0<=resolvedPriority),resolvedPriority}},{key:'_normalizeArguments',value:function _normalizeArguments(_ref5){var priority=_ref5.priority,message=_ref5.message,_ref5$args=_ref5.args,args=void 0===_ref5$args?[]:_ref5$args,opts=_ref5.opts,newOpts={priority:this._normalizePriority(priority),message:message,args:args};switch('undefined'==typeof priority?'undefined':_typeof(priority)){case'string':case'function':void 0!==message&&args.unshift(message),Object.assign(newOpts,{message:priority});break;case'object':Object.assign(newOpts,priority);break;default:}return'function'==typeof newOpts.message&&(newOpts.message=this._shouldLog(newOpts.priority)?newOpts.message():''),(0,_assert2.default)('string'==typeof newOpts.message||'object'===_typeof(newOpts.message)),Object.assign(newOpts,opts)}},{key:'_decorateMessage',value:function _decorateMessage(message,opts){if('string'==typeof message){var time='';if(opts.time){var _getElapsedTime3=this._getElapsedTime(),total=_getElapsedTime3.total;time=(0,_formatters.leftPad)((0,_formatters.formatTime)(total))}message=opts.time?this.id+': '+time+' '+message:this.id+': '+message,message=(0,_color.addColor)(message,opts.color,opts.background)}return message}},{key:'priority',set:function set(newPriority){return this._storage.updateConfiguration({priority:newPriority}),this},get:function get(){return this._storage.config.priority}}]),Log}();exports.default=Log,Log.VERSION=_globals.VERSION;
//# sourceMappingURL=log.js.map

@@ -1,2 +0,2 @@

'use strict';var _createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_timestamp=require('./utils/timestamp'),_formatters=require('./utils/formatters');Object.defineProperty(exports,'__esModule',{value:!0});function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}var Stats=function(){function Stats(_ref){var id=_ref.id;_classCallCheck(this,Stats),this.id=id,this.time=(0,_timestamp.getTimestamp)(),this.counters={},Object.seal(this)}var _Mathround=Math.round;return _createClass(Stats,[{key:'addCounter',value:function addCounter(name){return this._getCounter(name),this}},{key:'bump',value:function bump(name){var counter=this._getCounter(name);return counter.call++,counter.count++,this}},{key:'increment',value:function increment(name,count){var counter=this._getCounter(name);return counter.call++,counter.count+=count,this}},{key:'addTimer',value:function addTimer(name){var timer=this._getCounter(name);return timer.time=0,this}},{key:'addTime',value:function addTime(name,time){var timer=this._getCounter(name);return timer.time+=time,timer.count++,this}},{key:'timeStart',value:function timeStart(name){var timer=this._getCounter(name);timer._startTime=(0,_timestamp.getTimestamp)()}},{key:'timeEnd',value:function timeEnd(name){var timer=this._getCounter(name);this.addTime(name,(0,_timestamp.getTimestamp)()-timer._startTime)}},{key:'reset',value:function reset(){for(var key in this.time=(0,_timestamp.getTimestamp)(),this.counters){var counter=this.counters[key];counter.count=0,counter.time=0}return this}},{key:'hasTimeElapsed',value:function hasTimeElapsed(){0<arguments.length&&void 0!==arguments[0]?arguments[0]:1e3;return 1e3<(0,_timestamp.getTimestamp)()-this.time}},{key:'getStats',value:function getStats(){var deltaTime=((0,_timestamp.getTimestamp)()-this.time)/1e3,stats={};for(var key in this.counters){var counter=this.counters[key];stats[counter.title]={total:counter.count,fps:_Mathround(counter.count/deltaTime)},counter.time&&(stats[counter.title].totalTime=(0,_formatters.formatTime)(counter.time),stats[counter.title].avgTime=(0,_formatters.formatTime)(counter.time/counter.count))}return stats}},{key:'getStatsTable',value:function getStatsTable(){var stats=this.getStats();for(var key in stats)0===stats[key].total&&delete stats[key];return stats}},{key:'getStatNames',value:function getStatNames(){return Object.keys(this.counters)}},{key:'get',value:function get(name){var counter=this._getCounter(name);return counter.count}},{key:'getCount',value:function getCount(name){var counter=this._getCounter(name);return counter.count}},{key:'getFPS',value:function getFPS(name){var counter=this._getCounter(name),deltaTime=((0,_timestamp.getTimestamp)()-this.time)/1e3;return _Mathround(counter.count/deltaTime)}},{key:'getTimeString',value:function getTimeString(){return this.id+':'+(0,_formatters.formatTime)(this.time)+'('+this.count+')'}},{key:'oneSecondPassed',value:function oneSecondPassed(){var deltaTime=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1e3;return this.hasTimeElapsed(deltaTime)}},{key:'_getCounter',value:function _getCounter(name){var counter=this.counters[name];return counter||(counter={title:name,unit:'',timer:!1,count:0,time:0,totalTime:0,averageTime:0},this.counters[name]=counter),counter}},{key:'_incrementTimer',value:function _incrementTimer(counter,time,count){counter.count+=count,counter.totalTime+=time,counter.averageTime=counter.totalTime/count}}]),Stats}();exports.default=Stats;
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});var _createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_timestamp=require('./utils/timestamp'),_formatters=require('./utils/formatters');function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}var Stats=function(){function Stats(_ref){var id=_ref.id;_classCallCheck(this,Stats),this.id=id,this.time=(0,_timestamp.getTimestamp)(),this.counters={},Object.seal(this)}var _Mathround=Math.round;return _createClass(Stats,[{key:'addCounter',value:function addCounter(name){return this._getCounter(name),this}},{key:'bump',value:function bump(name){var counter=this._getCounter(name);return counter.call++,counter.count++,this}},{key:'increment',value:function increment(name,count){var counter=this._getCounter(name);return counter.call++,counter.count+=count,this}},{key:'addTimer',value:function addTimer(name){var timer=this._getCounter(name);return timer.time=0,this}},{key:'addTime',value:function addTime(name,time){var timer=this._getCounter(name);return timer.time+=time,timer.count++,this}},{key:'timeStart',value:function timeStart(name){var timer=this._getCounter(name);timer._startTime=(0,_timestamp.getTimestamp)()}},{key:'timeEnd',value:function timeEnd(name){var timer=this._getCounter(name);this.addTime(name,(0,_timestamp.getTimestamp)()-timer._startTime)}},{key:'reset',value:function reset(){for(var key in this.time=(0,_timestamp.getTimestamp)(),this.counters){var counter=this.counters[key];counter.count=0,counter.time=0}return this}},{key:'hasTimeElapsed',value:function hasTimeElapsed(){0<arguments.length&&void 0!==arguments[0]?arguments[0]:1e3;return 1e3<(0,_timestamp.getTimestamp)()-this.time}},{key:'getStats',value:function getStats(){var deltaTime=((0,_timestamp.getTimestamp)()-this.time)/1e3,stats={};for(var key in this.counters){var counter=this.counters[key];stats[counter.title]={total:counter.count,fps:_Mathround(counter.count/deltaTime)},counter.time&&(stats[counter.title].totalTime=(0,_formatters.formatTime)(counter.time),stats[counter.title].avgTime=(0,_formatters.formatTime)(counter.time/counter.count))}return stats}},{key:'getStatsTable',value:function getStatsTable(){var stats=this.getStats();for(var key in stats)0===stats[key].total&&delete stats[key];return stats}},{key:'getStatNames',value:function getStatNames(){return Object.keys(this.counters)}},{key:'get',value:function get(name){var counter=this._getCounter(name);return counter.count}},{key:'getCount',value:function getCount(name){var counter=this._getCounter(name);return counter.count}},{key:'getFPS',value:function getFPS(name){var counter=this._getCounter(name),deltaTime=((0,_timestamp.getTimestamp)()-this.time)/1e3;return _Mathround(counter.count/deltaTime)}},{key:'getTimeString',value:function getTimeString(){return this.id+':'+(0,_formatters.formatTime)(this.time)+'('+this.count+')'}},{key:'oneSecondPassed',value:function oneSecondPassed(){var deltaTime=0<arguments.length&&void 0!==arguments[0]?arguments[0]:1e3;return this.hasTimeElapsed(deltaTime)}},{key:'_getCounter',value:function _getCounter(name){var counter=this.counters[name];return counter||(counter={title:name,unit:'',timer:!1,count:0,time:0,totalTime:0,averageTime:0},this.counters[name]=counter),counter}},{key:'_incrementTimer',value:function _incrementTimer(counter,time,count){counter.count+=count,counter.totalTime+=time,counter.averageTime=counter.totalTime/count}}]),Stats}();exports.default=Stats;
//# sourceMappingURL=stats.js.map

@@ -1,2 +0,2 @@

'use strict';Object.defineProperty(exports,'__esModule',{value:!0}),exports.formatTime=formatTime,exports.leftPad=leftPad,exports.rightPad=rightPad,exports.getSISuffix=getSISuffix,exports.formatSI=formatSI,exports.formatValue=formatValue,exports.formatImage=formatImage;function formatTime(ms){var formatted;return formatted=10>ms?ms.toFixed(2)+'ms':100>ms?ms.toFixed(1)+'ms':1e3>ms?ms.toFixed(0)+'ms':(ms/1e3).toFixed(2)+'s',formatted}function leftPad(string){var length=1<arguments.length&&arguments[1]!==void 0?arguments[1]:8,padLength=Math.max(length-string.length,0);return''+' '.repeat(padLength)+string}function rightPad(string){var length=1<arguments.length&&arguments[1]!==void 0?arguments[1]:8,padLength=Math.max(length-string.length,0);return''+string+' '.repeat(padLength)}function splitIntoBaseAndExponent(number){var base=number,exponent=0;if(0!==number){for(;10<=base||-10>=base;)base/=10,exponent++;for(;1>base&&-1<base;)base*=10,exponent--}return{base:base,exponent:exponent}}function getSISuffix(multipleOf3){var SI_SUFFIXES={0:'',1:'K',2:'M',3:'G',"-1":'m',"-2":'\xB5',"-3":'n'},key=multipleOf3+'';return key in SI_SUFFIXES?SI_SUFFIXES[key]:'e'+3*multipleOf3}function formatSI(number){var precision=1<arguments.length&&arguments[1]!==void 0?arguments[1]:3,_splitIntoBaseAndExpo=splitIntoBaseAndExponent(number),base=_splitIntoBaseAndExpo.base,exponent=_splitIntoBaseAndExpo.exponent,multipleOf3=Math.floor(exponent/3),digits=base*Math.pow(10,exponent-3*multipleOf3);return''+digits.toPrecision(precision)+getSISuffix(multipleOf3)}function formatValue(v){var _Mathabs=Math.abs,opts=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},_opts$isInteger=opts.isInteger,isInteger=void 0!==_opts$isInteger&&_opts$isInteger;if(Array.isArray(v)||ArrayBuffer.isView(v))return formatArrayValue(v,opts);if(!Number.isFinite(v))return v+'';if(_Mathabs(v)<1e-16)return isInteger?'0':'0.';if(isInteger)return v.toFixed(0);if(100<_Mathabs(v)&&1e4>_Mathabs(v))return v.toFixed(0);var string=v.toPrecision(2),decimal=string.indexOf('.0');return decimal===string.length-2?string.slice(0,-1):string}function formatArrayValue(v,opts){for(var _opts$maxElts=opts.maxElts,maxElts=_opts$maxElts===void 0?16:_opts$maxElts,_opts$size=opts.size,size=_opts$size===void 0?1:_opts$size,string='[',i=0;i<v.length&&i<maxElts;++i)0<i&&(string+=','+(0==i%size?' ':'')),string+=formatValue(v[i],opts);var terminator=v.length>maxElts?'...':']';return''+string+terminator}function formatImage(image,message,scale){var _Mathfloor=Math.floor,width=image.width*scale,height=image.height*scale,imageUrl=image.src.replace(/\(/g,'%28').replace(/\)/g,'%29'),style=['font-size:1px;','padding:'+_Mathfloor(height/2)+'px '+_Mathfloor(width/2)+'px;','line-height:'+height+'px;','background:url('+imageUrl+');','background-size:'+width+'px '+height+'px;','color:transparent;'].join('');return[message+' %c+',style]}
'use strict';Object.defineProperty(exports,'__esModule',{value:!0}),exports.formatTime=formatTime,exports.leftPad=leftPad,exports.rightPad=rightPad,exports.getSISuffix=getSISuffix,exports.formatSI=formatSI,exports.formatValue=formatValue,exports.formatImage=formatImage;function formatTime(ms){var formatted;return formatted=10>ms?ms.toFixed(2)+'ms':100>ms?ms.toFixed(1)+'ms':1e3>ms?ms.toFixed(0)+'ms':(ms/1e3).toFixed(2)+'s',formatted}function leftPad(string){var length=1<arguments.length&&arguments[1]!==void 0?arguments[1]:8,padLength=Math.max(length-string.length,0);return''+' '.repeat(padLength)+string}function rightPad(string){var length=1<arguments.length&&arguments[1]!==void 0?arguments[1]:8,padLength=Math.max(length-string.length,0);return''+string+' '.repeat(padLength)}function splitIntoBaseAndExponent(number){var base=number,exponent=0;if(0!==number){for(;10<=base||-10>=base;)base/=10,exponent++;for(;1>base&&-1<base;)base*=10,exponent--}return{base:base,exponent:exponent}}function getSISuffix(multipleOf3){var SI_SUFFIXES={0:'',1:'K',2:'M',3:'G',"-1":'m',"-2":'\xB5',"-3":'n'},key=multipleOf3+'';return key in SI_SUFFIXES?SI_SUFFIXES[key]:'e'+3*multipleOf3}function formatSI(number){var precision=1<arguments.length&&arguments[1]!==void 0?arguments[1]:3,_splitIntoBaseAndExpo=splitIntoBaseAndExponent(number),base=_splitIntoBaseAndExpo.base,exponent=_splitIntoBaseAndExpo.exponent,multipleOf3=Math.floor(exponent/3),digits=base*Math.pow(10,exponent-3*multipleOf3);return''+digits.toPrecision(precision)+getSISuffix(multipleOf3)}function formatValue(v){var _Mathabs=Math.abs,opts=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},_opts$isInteger=opts.isInteger,isInteger=void 0!==_opts$isInteger&&_opts$isInteger;if(Array.isArray(v)||ArrayBuffer.isView(v))return formatArrayValue(v,opts);if(!Number.isFinite(v))return v+'';if(_Mathabs(v)<1e-16)return isInteger?'0':'0.';if(isInteger)return v.toFixed(0);if(100<_Mathabs(v)&&1e4>_Mathabs(v))return v.toFixed(0);var string=v.toPrecision(2),decimal=string.indexOf('.0');return decimal===string.length-2?string.slice(0,-1):string}function formatArrayValue(v,opts){for(var _opts$maxElts=opts.maxElts,maxElts=_opts$maxElts===void 0?16:_opts$maxElts,_opts$size=opts.size,size=_opts$size===void 0?1:_opts$size,string='[',i=0;i<v.length&&i<maxElts;++i)0<i&&(string+=','+(0==i%size?' ':'')),string+=formatValue(v[i],opts);var terminator=v.length>maxElts?'...':']';return''+string+terminator}function formatImage(image,message,scale){var _Mathfloor=Math.floor,maxWidth=3<arguments.length&&void 0!==arguments[3]?arguments[3]:600,imageUrl=image.src.replace(/\(/g,'%28').replace(/\)/g,'%29');image.width>maxWidth&&(scale=Math.min(scale,maxWidth/image.width));var width=image.width*scale,height=image.height*scale,style=['font-size:1px;','padding:'+_Mathfloor(height/2)+'px '+_Mathfloor(width/2)+'px;','line-height:'+height+'px;','background:url('+imageUrl+');','background-size:'+width+'px '+height+'px;','color:transparent;'].join('');return[message+' %c+',style]}
//# sourceMappingURL=formatters.js.map

@@ -1,2 +0,2 @@

'use strict';var _typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&'function'==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj},isBrowser='object'!==('undefined'==typeof process?'undefined':_typeof(process))||'[object process]'!==process+''||process.browser,window_='undefined'==typeof window?global:window,document_='undefined'==typeof document?{}:document,global_='undefined'==typeof global?window:global,process_='object'===('undefined'==typeof process?'undefined':_typeof(process))?process:{},VERSION='1.0.0';Object.defineProperty(exports,'__esModule',{value:!0});exports.window=window_,exports.document=document_,exports.global=global_,exports.process=process_,exports.console=console,exports.isBrowser=isBrowser,exports.VERSION=VERSION;
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});var _typeof='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&'function'==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?'symbol':typeof obj},isBrowser='object'!==('undefined'==typeof process?'undefined':_typeof(process))||'[object process]'!==process+''||process.browser,window_='undefined'==typeof window?global:window,document_='undefined'==typeof document?{}:document,global_='undefined'==typeof global?window:global,process_='object'===('undefined'==typeof process?'undefined':_typeof(process))?process:{},VERSION='1.0.1';exports.window=window_,exports.document=document_,exports.global=global_,exports.process=process_,exports.console=console,exports.isBrowser=isBrowser,exports.VERSION=VERSION;
//# sourceMappingURL=globals.js.map

@@ -1,2 +0,2 @@

'use strict';var _createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_color=require('../../lib/utils/color'),_log=require('../../lib/log'),_log2=_interopRequireDefault(_log);Object.defineProperty(exports,'__esModule',{value:!0});function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}return Array.from(arr)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}var log=new _log2.default({id:'render-test'}),DEFAULT_CONFIG={process:'./node_modules/.bin/webpack-dev-server',parameters:['--config','webpack.config.js'],port:5e3,options:{maxBuffer:5120000}},DEFAULT_PUPPETEER_OPTIONS={headless:!1},BrowserDriver=function(){function BrowserDriver(){_classCallCheck(this,BrowserDriver),this.execFile=module.require('child_process').execFile,this.puppeteer=module.require('puppeteer'),this.console=module.require('console'),this.process=module.require('process'),this.child=null,this.browser=null,this.page=null,this.port=null,this.shellStatus=0}return _createClass(BrowserDriver,[{key:'setShellStatus',value:function setShellStatus(success){this.shellStatus=success?0:1}},{key:'startBrowser',value:function startBrowser(){var _this=this,options=0<arguments.length&&void 0!==arguments[0]?arguments[0]:DEFAULT_PUPPETEER_OPTIONS;return this.browser?Promise.resolve(this.browser):this.puppeteer.launch(options).then(function(browser){_this.browser=browser})}},{key:'newPage',value:function newPage(){var _this2=this,_ref=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},_ref$url=_ref.url,url=void 0===_ref$url?'http://localhost':_ref$url,_ref$width=_ref.width,width=void 0===_ref$width?1550:_ref$width,_ref$height=_ref.height,height=void 0===_ref$height?850:_ref$height;return log.log({message:'Connecting to port: '+this.port,color:_color.COLOR.YELLOW})(),this.startBrowser().then(function(){return _this2.browser.newPage()}).then(function(page){_this2.page=page}).then(function(){return _this2.page.waitFor(1e3)}).then(function(){return _this2.page.goto(url+':'+_this2.port)}).then(function(){return _this2.page.setViewport({width:1550,height:850})})}},{key:'exposeFunction',value:function exposeFunction(){var _this3=this,name=0<arguments.length&&void 0!==arguments[0]?arguments[0]:'testDriverDone';return new Promise(function(resolve){_this3.page.exposeFunction(name,resolve)})}},{key:'stopBrowser',value:function stopBrowser(){var _this4=this;return Promise.resolve().then(function(){return _this4.page.waitFor(1e3)}).then(function(){return _this4.browser.close()})}},{key:'startServer',value:function startServer(){var _this5=this,config=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},maxRetryTimes=1<arguments.length&&void 0!==arguments[1]?arguments[1]:30,newConfig=Object.assign({},DEFAULT_CONFIG,config);return new Promise(function(resolve,reject){log.log({message:'Binding to port: '+newConfig.port,color:_color.COLOR.YELLOW})();var timeout=setTimeout(function(){resolve()},2e3);_this5.child=_this5.execFile(newConfig.process,[].concat(_toConsumableArray(newConfig.parameters),['--port',''+newConfig.port]),newConfig.options,function(error){error&&(clearTimeout(timeout),log.log({message:'Failed to bind port: '+newConfig.port,color:_color.COLOR.YELLOW})(),reject(error))})}).then(function(){_this5.port=newConfig.port}).catch(function(error){if(0<maxRetryTimes)return newConfig.port++,_this5.startServer(newConfig,maxRetryTimes-1);throw log.log({message:'Failed to start server, use \'killall node\' to stop existing services',color:_color.COLOR.RED})(),error})}},{key:'stopServer',value:function stopServer(){this.child&&(this.child.kill(),this.child=null)}},{key:'exitProcess',value:function exitProcess(){this.process.exit(this.shellStatus)}},{key:'exit',value:function exit(){var _this6=this;return Promise.resolve().then(function(){return _this6.stopBrowser()}).then(function(){_this6.stopServer(),_this6.exitProcess()})}}]),BrowserDriver}();exports.default=BrowserDriver;
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});var _createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_color=require('../../lib/utils/color'),_log=require('../../lib/log'),_log2=_interopRequireDefault(_log);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _toConsumableArray(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}return Array.from(arr)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}var log=new _log2.default({id:'render-test'}),DEFAULT_CONFIG={process:'./node_modules/.bin/webpack-dev-server',parameters:['--config','webpack.config.js'],port:5e3,options:{maxBuffer:5120000}},DEFAULT_PUPPETEER_OPTIONS={headless:!1},BrowserDriver=function(){function BrowserDriver(){_classCallCheck(this,BrowserDriver),this.execFile=module.require('child_process').execFile,this.puppeteer=module.require('puppeteer'),this.console=module.require('console'),this.process=module.require('process'),this.child=null,this.browser=null,this.page=null,this.port=null,this.shellStatus=0}return _createClass(BrowserDriver,[{key:'setShellStatus',value:function setShellStatus(success){this.shellStatus=success?0:1}},{key:'startBrowser',value:function startBrowser(){var _this=this,options=0<arguments.length&&void 0!==arguments[0]?arguments[0]:DEFAULT_PUPPETEER_OPTIONS;return this.browser?Promise.resolve(this.browser):this.puppeteer.launch(options).then(function(browser){_this.browser=browser})}},{key:'newPage',value:function newPage(){var _this2=this,_ref=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},_ref$url=_ref.url,url=void 0===_ref$url?'http://localhost':_ref$url,_ref$width=_ref.width,width=void 0===_ref$width?1550:_ref$width,_ref$height=_ref.height,height=void 0===_ref$height?850:_ref$height;return log.log({message:'Connecting to port: '+this.port,color:_color.COLOR.YELLOW})(),this.startBrowser().then(function(){return _this2.browser.newPage()}).then(function(page){_this2.page=page}).then(function(){return _this2.page.waitFor(1e3)}).then(function(){return _this2.page.goto(url+':'+_this2.port)}).then(function(){return _this2.page.setViewport({width:1550,height:850})})}},{key:'exposeFunction',value:function exposeFunction(){var _this3=this,name=0<arguments.length&&void 0!==arguments[0]?arguments[0]:'testDriverDone';return new Promise(function(resolve){_this3.page.exposeFunction(name,resolve)})}},{key:'stopBrowser',value:function stopBrowser(){var _this4=this;return Promise.resolve().then(function(){return _this4.page.waitFor(1e3)}).then(function(){return _this4.browser.close()})}},{key:'startServer',value:function startServer(){var _this5=this,config=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},maxRetryTimes=1<arguments.length&&void 0!==arguments[1]?arguments[1]:30,newConfig=Object.assign({},DEFAULT_CONFIG,config);return new Promise(function(resolve,reject){log.log({message:'Binding to port: '+newConfig.port,color:_color.COLOR.YELLOW})();var timeout=setTimeout(function(){resolve()},2e3);_this5.child=_this5.execFile(newConfig.process,[].concat(_toConsumableArray(newConfig.parameters),['--port',''+newConfig.port]),newConfig.options,function(error){error&&(clearTimeout(timeout),log.log({message:'Failed to bind port: '+newConfig.port,color:_color.COLOR.YELLOW})(),reject(error))})}).then(function(){_this5.port=newConfig.port}).catch(function(error){if(0<maxRetryTimes)return newConfig.port++,_this5.startServer(newConfig,maxRetryTimes-1);throw log.log({message:'Failed to start server, use \'killall node\' to stop existing services',color:_color.COLOR.RED})(),error})}},{key:'stopServer',value:function stopServer(){this.child&&(this.child.kill(),this.child=null)}},{key:'exitProcess',value:function exitProcess(){this.process.exit(this.shellStatus)}},{key:'exit',value:function exit(){var _this6=this;return Promise.resolve().then(function(){return _this6.stopBrowser()}).then(function(){_this6.stopServer(),_this6.exitProcess()})}}]),BrowserDriver}();exports.default=BrowserDriver;
//# sourceMappingURL=browser-driver.js.map

@@ -1,2 +0,2 @@

'use strict';var _createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_browserDriver=require('./browser-driver'),_browserDriver2=_interopRequireDefault(_browserDriver),_color=require('../../lib/utils/color'),_log=require('../../lib/log'),_log2=_interopRequireDefault(_log);Object.defineProperty(exports,'__esModule',{value:!0});function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return call&&('object'==typeof call||'function'==typeof call)?call:self}function _inherits(subClass,superClass){if('function'!=typeof superClass&&null!==superClass)throw new TypeError('Super expression must either be null or a function, not '+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var log=new _log2.default({id:'render-test'}),webpackEnv='render';3<=process.argv.length&&(webpackEnv=process.argv[2]);var DEFAULT_CONFIG={title:'BrowserTest',exposeFunction:'taskComplete',parameters:['--env.'+webpackEnv]},BrowserTestDriver=function(_BrowserDriver){function BrowserTestDriver(){return _classCallCheck(this,BrowserTestDriver),_possibleConstructorReturn(this,(BrowserTestDriver.__proto__||Object.getPrototypeOf(BrowserTestDriver)).apply(this,arguments))}return _inherits(BrowserTestDriver,_BrowserDriver),_createClass(BrowserTestDriver,[{key:'run',value:function run(){var _this2=this,config=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};config=Object.assign(DEFAULT_CONFIG,config);var _config=config,title=_config.title,exposeFunction=_config.exposeFunction;return this.title=title,log.log({message:title+' started. Launching Chromium instance, waiting for '+exposeFunction+'...',color:_color.COLOR.YELLOW})(),this.time=Date.now(),Promise.resolve().then(function(){return _this2.startServer(config)}).then(function(){return _this2.startBrowser()}).then(function(){return _this2.newPage()}).then(function(){return _this2.exposeFunction(exposeFunction)}).then(function(resultString){var result=JSON.parse(resultString),ok=result.success===!!result.success&&(!result.failedTest||'string'==typeof result.failedTest);if(!ok)throw new Error('Illegal response "'+resultString+'" returned from Chrome test script');if(!result.success)throw new Error(result.failedTest||'Unknown failure');_this2._success()}).catch(function(error){_this2._failure(error)})}},{key:'_success',value:function _success(){var elapsed=((Date.now()-this.time)/1e3).toFixed(1);log.log({message:this.title+' successfully completed in '+elapsed+'s!',color:_color.COLOR.BRIGHT_GREEN})(),this.setShellStatus(!0),this.exit()}},{key:'_failure',value:function _failure(error){log.log({message:this.title+' failed: '+error.message+'. Keeping browser open to allow debugging.',color:_color.COLOR.BRIGHT_RED})(),this.setShellStatus(!1)}}]),BrowserTestDriver}(_browserDriver2.default);exports.default=BrowserTestDriver;
'use strict';Object.defineProperty(exports,'__esModule',{value:!0});var _createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i<props.length;i++)descriptor=props[i],descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,'value'in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}(),_browserDriver=require('./browser-driver'),_browserDriver2=_interopRequireDefault(_browserDriver),_color=require('../../lib/utils/color'),_log=require('../../lib/log'),_log2=_interopRequireDefault(_log);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError('Cannot call a class as a function')}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return call&&('object'==typeof call||'function'==typeof call)?call:self}function _inherits(subClass,superClass){if('function'!=typeof superClass&&null!==superClass)throw new TypeError('Super expression must either be null or a function, not '+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass)}var log=new _log2.default({id:'render-test'}),webpackEnv='render';3<=process.argv.length&&(webpackEnv=process.argv[2]);var DEFAULT_CONFIG={title:'BrowserTest',exposeFunction:'taskComplete',parameters:['--env.'+webpackEnv]},BrowserTestDriver=function(_BrowserDriver){function BrowserTestDriver(){return _classCallCheck(this,BrowserTestDriver),_possibleConstructorReturn(this,(BrowserTestDriver.__proto__||Object.getPrototypeOf(BrowserTestDriver)).apply(this,arguments))}return _inherits(BrowserTestDriver,_BrowserDriver),_createClass(BrowserTestDriver,[{key:'run',value:function run(){var _this2=this,config=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};config=Object.assign(DEFAULT_CONFIG,config);var _config=config,title=_config.title,exposeFunction=_config.exposeFunction;return this.title=title,log.log({message:title+' started. Launching Chromium instance, waiting for '+exposeFunction+'...',color:_color.COLOR.YELLOW})(),this.time=Date.now(),Promise.resolve().then(function(){return _this2.startServer(config)}).then(function(){return _this2.startBrowser()}).then(function(){return _this2.newPage()}).then(function(){return _this2.exposeFunction(exposeFunction)}).then(function(resultString){var result=JSON.parse(resultString),ok=result.success===!!result.success&&(!result.failedTest||'string'==typeof result.failedTest);if(!ok)throw new Error('Illegal response "'+resultString+'" returned from Chrome test script');if(!result.success)throw new Error(result.failedTest||'Unknown failure');_this2._success()}).catch(function(error){_this2._failure(error)})}},{key:'_success',value:function _success(){var elapsed=((Date.now()-this.time)/1e3).toFixed(1);log.log({message:this.title+' successfully completed in '+elapsed+'s!',color:_color.COLOR.BRIGHT_GREEN})(),this.setShellStatus(!0),this.exit()}},{key:'_failure',value:function _failure(error){log.log({message:this.title+' failed: '+error.message+'. Keeping browser open to allow debugging.',color:_color.COLOR.BRIGHT_RED})(),this.setShellStatus(!1)}}]),BrowserTestDriver}(_browserDriver2.default);exports.default=BrowserTestDriver;
//# sourceMappingURL=browser-test-driver.js.map

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "1.0.0",
"version": "1.0.1",
"keywords": [

@@ -42,6 +42,7 @@ "javascript",

"bench": "node test/start.js bench",
"test-browser": "webpack-dev-server --env.test --progress --hot --open",
"bench-browser": "webpack-dev-server --env.bench --progress --hot --open"
"test-browser": "webpack-dev-server --config test/webpack.config.js --env.test --progress --hot --open",
"bench-browser": "webpack-dev-server --config test/webpack.config.js --env.bench --progress --hot --open"
},
"dependencies": {
"asciify-image": "^0.1.1",
"babel-runtime": "^6.11.6"

@@ -75,2 +76,3 @@ },

"uglifyjs-webpack-plugin": "^1.2.4",
"url-loader": "^1.0.1",
"webpack": "^2.4.0",

@@ -77,0 +79,0 @@ "webpack-bundle-analyzer": "^2.11.1",

@@ -241,18 +241,39 @@ // Copyright (c) 2017 Uber Technologies, Inc.

}
if (typeof window === 'undefined') { // Let's not try this under node
return noop;
return isBrowser ?
this._logImageInBrowser({image, message, scale}) :
this._logImageInNode({image, message, scale});
}
// Use the asciify module to log an image under node.js
_logImageInNode({image, message = '', scale = 1}) {
// Note: Runtime load of the "asciify-image" module, avoids including in browser bundles
const asciify = module.require('asciify-image');
if (asciify) {
return () =>
asciify(image, {fit: 'box', width: `${Math.round(80 * scale)}%`})
.then(data => console.log(data));
}
return noop;
}
_logImageInBrowser({image, message = '', scale = 1}) {
if (typeof image === 'string') {
const img = new Image();
img.onload = () => console.log(formatImage.bind(null, img, message, scale));
img.onload = () => {
const args = formatImage(img, message, scale);
console.log(...args);
};
img.src = image;
return noop;
}
const element = image.nodeName || '';
if (element.toLowerCase() === 'img') {
console.log(formatImage(image, message, scale));
console.log(...formatImage(image, message, scale));
return noop;
}
if (element.toLowerCase() === 'canvas') {
const img = new Image();
img.onload = () => console.log(formatImage.bind(null, img, message, scale));
img.onload = () => console.log(...formatImage(img, message, scale));
img.src = image.toDataURL();
return noop;
}

@@ -259,0 +280,0 @@ return noop;

@@ -96,6 +96,11 @@ // TODO: Currently unused, keeping in case we want it later for log formatting

// Inspired by https://github.com/hughsk/console-image (MIT license)
export function formatImage(image, message, scale) {
export function formatImage(image, message, scale, maxWidth = 600) {
const imageUrl = image.src.replace(/\(/g, '%28').replace(/\)/g, '%29');
if (image.width > maxWidth) {
scale = Math.min(scale, maxWidth / image.width);
}
const width = image.width * scale;
const height = image.height * scale;
const imageUrl = image.src.replace(/\(/g, '%28').replace(/\)/g, '%29');

@@ -102,0 +107,0 @@ const style = [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc