Comparing version 1.7.1 to 1.7.2-rc2
88
bows.js
@@ -8,11 +8,11 @@ (function() { | ||
var chrome = !!window.chrome, | ||
firefox = /firefox/i.test(navigator.userAgent), | ||
firefoxVersion, | ||
electron = process && process.versions && process.versions.electron; | ||
firefox = /firefox/i.test(navigator.userAgent), | ||
firefoxVersion, | ||
electron = process && process.versions && process.versions.electron; | ||
if (firefox) { | ||
var match = navigator.userAgent.match(/Firefox\/(\d+\.\d+)/); | ||
if (match && match[1] && Number(match[1])) { | ||
firefoxVersion = Number(match[1]); | ||
} | ||
var match = navigator.userAgent.match(/Firefox\/(\d+\.\d+)/); | ||
if (match && match[1] && Number(match[1])) { | ||
firefoxVersion = Number(match[1]); | ||
} | ||
} | ||
@@ -40,18 +40,19 @@ return chrome || firefoxVersion >= 31.0 || electron; | ||
var inNode = typeof window === 'undefined', | ||
ls = !inNode && getLocalStorageSafely(), | ||
debugKey = ls && ls.andlogKey ? ls.andlogKey : 'debug', | ||
debug = ls && ls[debugKey] ? ls[debugKey] : false, | ||
logger = require('andlog'), | ||
bind = Function.prototype.bind, | ||
hue = 0, | ||
padding = true, | ||
separator = '|', | ||
padLength = 15, | ||
noop = function() {}, | ||
// if ls.debugColors is set, use that, otherwise check for support | ||
colorsSupported = ls && ls.debugColors ? (ls.debugColors !== "false") : checkColorSupport(), | ||
bows = null, | ||
debugRegex = null, | ||
invertRegex = false, | ||
moduleColorsMap = {}; | ||
ls = !inNode && getLocalStorageSafely(), | ||
debugKey = ls && ls.andlogKey ? ls.andlogKey : 'debug', | ||
debug = ls && ls[debugKey] ? ls[debugKey] : false, | ||
logger = require('andlog'), | ||
bind = Function.prototype.bind, | ||
hue = 0, | ||
padding = true, | ||
separator = '|', | ||
padLength = 15, | ||
noop = function() {}, | ||
// if ls.debugColors is set, use that, otherwise check for support | ||
colorsSupported = | ||
ls && ls.debugColors ? ls.debugColors !== 'false' : checkColorSupport(), | ||
bows = null, | ||
debugRegex = null, | ||
invertRegex = false, | ||
moduleColorsMap = {}; | ||
@@ -62,3 +63,6 @@ if (debug && debug[0] === '!' && debug[1] === '/') { | ||
} | ||
debugRegex = debug && debug[0]==='/' && new RegExp(debug.substring(1,debug.length-1)); | ||
debugRegex = | ||
debug && | ||
debug[0] === '/' && | ||
new RegExp(debug.substring(1, debug.length - 1)); | ||
@@ -69,10 +73,13 @@ var logLevels = ['log', 'debug', 'warn', 'error', 'info']; | ||
for (var i = 0, ii = logLevels.length; i < ii; i++) { | ||
noop[ logLevels[i] ] = noop; | ||
noop[logLevels[i]] = noop; | ||
} | ||
bows = function(str) { | ||
// If localStorage is not available just don't log | ||
if (!ls) return noop; | ||
var msg, colorString, logfn; | ||
if (padding) { | ||
msg = (str.slice(0, padLength)); | ||
msg = str.slice(0, padLength); | ||
msg += Array(padLength + 3 - msg.length).join(' ') + separator; | ||
@@ -84,7 +91,4 @@ } else { | ||
if (debugRegex) { | ||
var matches = str.match(debugRegex); | ||
if ( | ||
(!invertRegex && !matches) || | ||
(invertRegex && matches) | ||
) return noop; | ||
var matches = str.match(debugRegex); | ||
if ((!invertRegex && !matches) || (invertRegex && matches)) return noop; | ||
} | ||
@@ -96,17 +100,17 @@ | ||
if (colorsSupported) { | ||
if(!moduleColorsMap[str]){ | ||
moduleColorsMap[str]= yieldColor(); | ||
if (!moduleColorsMap[str]) { | ||
moduleColorsMap[str] = yieldColor(); | ||
} | ||
var color = moduleColorsMap[str]; | ||
msg = "%c" + msg; | ||
colorString = "color: hsl(" + (color) + ",99%,40%); font-weight: bold"; | ||
msg = '%c' + msg; | ||
colorString = 'color: hsl(' + color + ',99%,40%); font-weight: bold'; | ||
logArgs.push(msg, colorString); | ||
}else{ | ||
} else { | ||
logArgs.push(msg); | ||
} | ||
if(arguments.length>1){ | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
logArgs = logArgs.concat(args); | ||
if (arguments.length > 1) { | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
logArgs = logArgs.concat(args); | ||
} | ||
@@ -116,3 +120,3 @@ | ||
logLevels.forEach(function (f) { | ||
logLevels.forEach(function(f) { | ||
logfn[f] = bind.apply(logger[f] || logfn, logArgs); | ||
@@ -135,3 +139,3 @@ }); | ||
} else if (config.separator === false || config.separator === '') { | ||
separator = '' | ||
separator = ''; | ||
} | ||
@@ -145,2 +149,2 @@ }; | ||
} | ||
}).call(); | ||
}.call()); |
19
build.js
var browserify = require('browserify'), | ||
fs = require('fs'), | ||
uglify = require("uglify-js"); | ||
fs = require('fs'), | ||
uglify = require('uglify-js'), | ||
outdir = './dist'; | ||
if (!fs.existsSync(outdir)) { | ||
fs.mkdirSync(outdir); | ||
} | ||
var b = browserify({ standalone: 'bows' }); | ||
b.add('./bows.js'); | ||
b.bundle(function (error, code) { | ||
fs.writeFileSync('./dist/bows.js', code); | ||
b.bundle(function(error, code) { | ||
fs.writeFileSync('./dist/bows.js', code); | ||
//Uglify | ||
var min_code = uglify.minify('./dist/bows.js').code; | ||
fs.writeFileSync('./dist/bows.min.js', min_code); | ||
//Uglify | ||
var min_code = uglify.minify('./dist/bows.js').code; | ||
fs.writeFileSync('./dist/bows.min.js', min_code); | ||
}); |
@@ -10,11 +10,11 @@ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.bows=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var chrome = !!window.chrome, | ||
firefox = /firefox/i.test(navigator.userAgent), | ||
firefoxVersion, | ||
electron = process && process.versions && process.versions.electron; | ||
firefox = /firefox/i.test(navigator.userAgent), | ||
firefoxVersion, | ||
electron = process && process.versions && process.versions.electron; | ||
if (firefox) { | ||
var match = navigator.userAgent.match(/Firefox\/(\d+\.\d+)/); | ||
if (match && match[1] && Number(match[1])) { | ||
firefoxVersion = Number(match[1]); | ||
} | ||
var match = navigator.userAgent.match(/Firefox\/(\d+\.\d+)/); | ||
if (match && match[1] && Number(match[1])) { | ||
firefoxVersion = Number(match[1]); | ||
} | ||
} | ||
@@ -42,18 +42,19 @@ return chrome || firefoxVersion >= 31.0 || electron; | ||
var inNode = typeof window === 'undefined', | ||
ls = !inNode && getLocalStorageSafely(), | ||
debugKey = ls && ls.andlogKey ? ls.andlogKey : 'debug', | ||
debug = ls && ls[debugKey] ? ls[debugKey] : false, | ||
logger = require('andlog'), | ||
bind = Function.prototype.bind, | ||
hue = 0, | ||
padding = true, | ||
separator = '|', | ||
padLength = 15, | ||
noop = function() {}, | ||
// if ls.debugColors is set, use that, otherwise check for support | ||
colorsSupported = ls && ls.debugColors ? (ls.debugColors !== "false") : checkColorSupport(), | ||
bows = null, | ||
debugRegex = null, | ||
invertRegex = false, | ||
moduleColorsMap = {}; | ||
ls = !inNode && getLocalStorageSafely(), | ||
debugKey = ls && ls.andlogKey ? ls.andlogKey : 'debug', | ||
debug = ls && ls[debugKey] ? ls[debugKey] : false, | ||
logger = require('andlog'), | ||
bind = Function.prototype.bind, | ||
hue = 0, | ||
padding = true, | ||
separator = '|', | ||
padLength = 15, | ||
noop = function() {}, | ||
// if ls.debugColors is set, use that, otherwise check for support | ||
colorsSupported = | ||
ls && ls.debugColors ? ls.debugColors !== 'false' : checkColorSupport(), | ||
bows = null, | ||
debugRegex = null, | ||
invertRegex = false, | ||
moduleColorsMap = {}; | ||
@@ -64,3 +65,6 @@ if (debug && debug[0] === '!' && debug[1] === '/') { | ||
} | ||
debugRegex = debug && debug[0]==='/' && new RegExp(debug.substring(1,debug.length-1)); | ||
debugRegex = | ||
debug && | ||
debug[0] === '/' && | ||
new RegExp(debug.substring(1, debug.length - 1)); | ||
@@ -71,10 +75,13 @@ var logLevels = ['log', 'debug', 'warn', 'error', 'info']; | ||
for (var i = 0, ii = logLevels.length; i < ii; i++) { | ||
noop[ logLevels[i] ] = noop; | ||
noop[logLevels[i]] = noop; | ||
} | ||
bows = function(str) { | ||
// If localStorage is not available just don't log | ||
if (!ls) return noop; | ||
var msg, colorString, logfn; | ||
if (padding) { | ||
msg = (str.slice(0, padLength)); | ||
msg = str.slice(0, padLength); | ||
msg += Array(padLength + 3 - msg.length).join(' ') + separator; | ||
@@ -86,7 +93,4 @@ } else { | ||
if (debugRegex) { | ||
var matches = str.match(debugRegex); | ||
if ( | ||
(!invertRegex && !matches) || | ||
(invertRegex && matches) | ||
) return noop; | ||
var matches = str.match(debugRegex); | ||
if ((!invertRegex && !matches) || (invertRegex && matches)) return noop; | ||
} | ||
@@ -98,17 +102,17 @@ | ||
if (colorsSupported) { | ||
if(!moduleColorsMap[str]){ | ||
moduleColorsMap[str]= yieldColor(); | ||
if (!moduleColorsMap[str]) { | ||
moduleColorsMap[str] = yieldColor(); | ||
} | ||
var color = moduleColorsMap[str]; | ||
msg = "%c" + msg; | ||
colorString = "color: hsl(" + (color) + ",99%,40%); font-weight: bold"; | ||
msg = '%c' + msg; | ||
colorString = 'color: hsl(' + color + ',99%,40%); font-weight: bold'; | ||
logArgs.push(msg, colorString); | ||
}else{ | ||
} else { | ||
logArgs.push(msg); | ||
} | ||
if(arguments.length>1){ | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
logArgs = logArgs.concat(args); | ||
if (arguments.length > 1) { | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
logArgs = logArgs.concat(args); | ||
} | ||
@@ -118,3 +122,3 @@ | ||
logLevels.forEach(function (f) { | ||
logLevels.forEach(function(f) { | ||
logfn[f] = bind.apply(logger[f] || logfn, logArgs); | ||
@@ -137,3 +141,3 @@ }); | ||
} else if (config.separator === false || config.separator === '') { | ||
separator = '' | ||
separator = ''; | ||
} | ||
@@ -147,3 +151,3 @@ }; | ||
} | ||
}).call(); | ||
}.call()); | ||
@@ -150,0 +154,0 @@ }).call(this,require('_process')) |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.bows=e()}}(function(){return function e(n,o,r){function t(f,d){if(!o[f]){if(!n[f]){var u="function"==typeof require&&require;if(!d&&u)return u(f,!0);if(i)return i(f,!0);var a=new Error("Cannot find module '"+f+"'");throw a.code="MODULE_NOT_FOUND",a}var s=o[f]={exports:{}};n[f][0].call(s.exports,function(e){var o=n[f][1][e];return t(o||e)},s,s.exports,e,n,o,r)}return o[f].exports}for(var i="function"==typeof require&&require,f=0;f<r.length;f++)t(r[f]);return t}({1:[function(e,n,o){(function(o){(function(){var r=function(){return s+=.618033988749895,360*(s%=1)},t="undefined"==typeof window,i=!t&&function(){var e;try{e=window.localStorage}catch(e){}return e}(),f=i&&i.andlogKey?i.andlogKey:"debug",d=!(!i||!i[f])&&i[f],u=e("andlog"),a=Function.prototype.bind,s=0,c=!0,l="|",p=15,w=function(){},g=i&&i.debugColors?"false"!==i.debugColors:function(){if("undefined"==typeof window||"undefined"==typeof navigator)return!1;var e,n=!!window.chrome,r=/firefox/i.test(navigator.userAgent),t=o&&o.versions&&o.versions.electron;if(r){var i=navigator.userAgent.match(/Firefox\/(\d+\.\d+)/);i&&i[1]&&Number(i[1])&&(e=Number(i[1]))}return n||e>=31||t}(),v=null,h=null,y=!1,m={};d&&"!"===d[0]&&"/"===d[1]&&(y=!0,d=d.slice(1)),h=d&&"/"===d[0]&&new RegExp(d.substring(1,d.length-1));for(var b=["log","debug","warn","error","info"],x=0,E=b.length;x<E;x++)w[b[x]]=w;v=function(e){var n,o,t;if(c?(n=e.slice(0,p),n+=Array(p+3-n.length).join(" ")+l):n=e+Array(3).join(" ")+l,h){var i=e.match(h);if(!y&&!i||y&&i)return w}if(!a)return w;var f=[u];if(g){m[e]||(m[e]=r());var d=m[e];n="%c"+n,o="color: hsl("+d+",99%,40%); font-weight: bold",f.push(n,o)}else f.push(n);if(arguments.length>1){var s=Array.prototype.slice.call(arguments,1);f=f.concat(s)}return t=a.apply(u.log,f),b.forEach(function(e){t[e]=a.apply(u[e]||t,f)}),t},v.config=function(e){e.padLength&&(p=e.padLength),"boolean"==typeof e.padding&&(c=e.padding),e.separator?l=e.separator:!1!==e.separator&&""!==e.separator||(l="")},void 0!==n?n.exports=v:window.bows=v}).call()}).call(this,e("_process"))},{_process:3,andlog:2}],2:[function(e,n,o){!function(){var e="undefined"==typeof window,r=!e&&function(){var e;try{e=window.localStorage}catch(e){}return e}(),t={};if(e||!r)return void(n.exports=console);var i=r.andlogKey||"debug";if(r&&r[i]&&window.console)t=window.console;else for(var f="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),d=f.length,u=function(){};d--;)t[f[d]]=u;void 0!==o?n.exports=t:window.console=t}()},{}],3:[function(e,n,o){function r(){}var t=n.exports={};t.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,n="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(n){var o=[];return window.addEventListener("message",function(e){var n=e.source;if((n===window||null===n)&&"process-tick"===e.data&&(e.stopPropagation(),o.length>0)){o.shift()()}},!0),function(e){o.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),t.title="browser",t.browser=!0,t.env={},t.argv=[],t.on=r,t.addListener=r,t.once=r,t.off=r,t.removeListener=r,t.removeAllListeners=r,t.emit=r,t.binding=function(e){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(e){throw new Error("process.chdir is not supported")}},{}]},{},[1])(1)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;"undefined"!=typeof window?n=window:"undefined"!=typeof global?n=global:"undefined"!=typeof self&&(n=self),n.bows=e()}}(function(){return function e(n,o,r){function t(f,d){if(!o[f]){if(!n[f]){var u="function"==typeof require&&require;if(!d&&u)return u(f,!0);if(i)return i(f,!0);var a=new Error("Cannot find module '"+f+"'");throw a.code="MODULE_NOT_FOUND",a}var s=o[f]={exports:{}};n[f][0].call(s.exports,function(e){var o=n[f][1][e];return t(o||e)},s,s.exports,e,n,o,r)}return o[f].exports}for(var i="function"==typeof require&&require,f=0;f<r.length;f++)t(r[f]);return t}({1:[function(e,n,o){(function(o){(function(){var r=function(){return s+=.618033988749895,360*(s%=1)},t="undefined"==typeof window,i=!t&&function(){var e;try{e=window.localStorage}catch(e){}return e}(),f=i&&i.andlogKey?i.andlogKey:"debug",d=!(!i||!i[f])&&i[f],u=e("andlog"),a=Function.prototype.bind,s=0,c=!0,l="|",p=15,w=function(){},g=i&&i.debugColors?"false"!==i.debugColors:function(){if("undefined"==typeof window||"undefined"==typeof navigator)return!1;var e,n=!!window.chrome,r=/firefox/i.test(navigator.userAgent),t=o&&o.versions&&o.versions.electron;if(r){var i=navigator.userAgent.match(/Firefox\/(\d+\.\d+)/);i&&i[1]&&Number(i[1])&&(e=Number(i[1]))}return n||e>=31||t}(),v=null,h=null,y=!1,m={};d&&"!"===d[0]&&"/"===d[1]&&(y=!0,d=d.slice(1)),h=d&&"/"===d[0]&&new RegExp(d.substring(1,d.length-1));for(var b=["log","debug","warn","error","info"],x=0,E=b.length;x<E;x++)w[b[x]]=w;v=function(e){if(!i)return w;var n,o,t;if(c?(n=e.slice(0,p),n+=Array(p+3-n.length).join(" ")+l):n=e+Array(3).join(" ")+l,h){var f=e.match(h);if(!y&&!f||y&&f)return w}if(!a)return w;var d=[u];if(g){m[e]||(m[e]=r());var s=m[e];n="%c"+n,o="color: hsl("+s+",99%,40%); font-weight: bold",d.push(n,o)}else d.push(n);if(arguments.length>1){var v=Array.prototype.slice.call(arguments,1);d=d.concat(v)}return t=a.apply(u.log,d),b.forEach(function(e){t[e]=a.apply(u[e]||t,d)}),t},v.config=function(e){e.padLength&&(p=e.padLength),"boolean"==typeof e.padding&&(c=e.padding),e.separator?l=e.separator:!1!==e.separator&&""!==e.separator||(l="")},void 0!==n?n.exports=v:window.bows=v}).call()}).call(this,e("_process"))},{_process:3,andlog:2}],2:[function(e,n,o){!function(){var e="undefined"==typeof window,r=!e&&function(){var e;try{e=window.localStorage}catch(e){}return e}(),t={};if(e||!r)return void(n.exports=console);var i=r.andlogKey||"debug";if(r&&r[i]&&window.console)t=window.console;else for(var f="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),d=f.length,u=function(){};d--;)t[f[d]]=u;void 0!==o?n.exports=t:window.console=t}()},{}],3:[function(e,n,o){function r(){}var t=n.exports={};t.nextTick=function(){var e="undefined"!=typeof window&&window.setImmediate,n="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(n){var o=[];return window.addEventListener("message",function(e){var n=e.source;if((n===window||null===n)&&"process-tick"===e.data&&(e.stopPropagation(),o.length>0)){o.shift()()}},!0),function(e){o.push(e),window.postMessage("process-tick","*")}}return function(e){setTimeout(e,0)}}(),t.title="browser",t.browser=!0,t.env={},t.argv=[],t.on=r,t.addListener=r,t.once=r,t.off=r,t.removeListener=r,t.removeAllListeners=r,t.emit=r,t.binding=function(e){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(e){throw new Error("process.chdir is not supported")}},{}]},{},[1])(1)}); |
{ | ||
"name": "bows", | ||
"version": "1.7.1", | ||
"version": "1.7.2-rc2", | ||
"description": "Rainbowed console logs for chrome, opera and firefox in development.", | ||
@@ -8,3 +8,5 @@ "main": "bows.js", | ||
"build": "node build.js", | ||
"test": "node build.js && phantomjs test/index.js", | ||
"prettier": "prettier --single-quote --write {.,test}/**/*.js *.js test/**/*.html", | ||
"prettier-check": "prettier --single-quote --check {.,test}/**/*.js *.js test/**/*.html", | ||
"test": "node build.js && npm run prettier-check && node test/index.js", | ||
"preversion": "git checkout master && git pull && npm ls", | ||
@@ -20,3 +22,4 @@ "publish-patch": "npm run preversion && npm version patch && git push origin master --tags && npm publish", | ||
"browserify": "^5.10.0", | ||
"phantomjs": "^1.9.7-8", | ||
"prettier": "1.19.0", | ||
"puppeteer": "^2.0.0", | ||
"uglify-js": "^2.3.6" | ||
@@ -23,0 +26,0 @@ }, |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
23966
4
12
378
3