diff --git a/.gitignore b/.gitignore index 3c3629e..f06235c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +dist diff --git a/build.js b/build.js index 6e03ebd..f9f6bd3 100644 --- a/build.js +++ b/build.js @@ -1,6 +1,11 @@ var browserify = require('browserify'), fs = require('fs'), - uglify = require('uglify-js'); + uglify = require('uglify-js'), + outdir = './dist'; + +if (!fs.existsSync(outdir)) { + fs.mkdirSync(outdir); +} var b = browserify({ standalone: 'bows' }); b.add('./bows.js'); diff --git a/dist/bows.js b/dist/bows.js deleted file mode 100644 index 600ac71..0000000 --- a/dist/bows.js +++ /dev/null @@ -1,253 +0,0 @@ -!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= 31.0 || electron; - } - - function getLocalStorageSafely() { - var localStorage; - try { - localStorage = window.localStorage; - } catch (e) { - // failed: access to localStorage is denied - } - return localStorage; - } - - var yieldColor = function() { - var goldenRatio = 0.618033988749895; - hue += goldenRatio; - hue = hue % 1; - return hue * 360; - }; - - 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 = {}; - - if (debug && debug[0] === '!' && debug[1] === '/') { - invertRegex = true; - debug = debug.slice(1); - } - debugRegex = - debug && - debug[0] === '/' && - new RegExp(debug.substring(1, debug.length - 1)); - - var logLevels = ['log', 'debug', 'warn', 'error', 'info']; - - //Noop should noop - for (var i = 0, ii = logLevels.length; i < ii; i++) { - 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 += Array(padLength + 3 - msg.length).join(' ') + separator; - } else { - msg = str + Array(3).join(' ') + separator; - } - - if (debugRegex) { - var matches = str.match(debugRegex); - if ((!invertRegex && !matches) || (invertRegex && matches)) return noop; - } - - if (!bind) return noop; - - var logArgs = [logger]; - if (colorsSupported) { - if (!moduleColorsMap[str]) { - moduleColorsMap[str] = yieldColor(); - } - var color = moduleColorsMap[str]; - msg = '%c' + msg; - colorString = 'color: hsl(' + color + ',99%,40%); font-weight: bold'; - - logArgs.push(msg, colorString); - } else { - logArgs.push(msg); - } - - if (arguments.length > 1) { - var args = Array.prototype.slice.call(arguments, 1); - logArgs = logArgs.concat(args); - } - - logfn = bind.apply(logger.log, logArgs); - - logLevels.forEach(function(f) { - logfn[f] = bind.apply(logger[f] || logfn, logArgs); - }); - return logfn; - }; - - bows.config = function(config) { - if (config.padLength) { - padLength = config.padLength; - } - - if (typeof config.padding === 'boolean') { - padding = config.padding; - } - - if (config.separator) { - separator = config.separator; - } else if (config.separator === false || config.separator === '') { - separator = ''; - } - }; - - if (typeof module !== 'undefined') { - module.exports = bows; - } else { - window.bows = bows; - } -}.call()); - -}).call(this,require('_process')) -},{"_process":3,"andlog":2}],2:[function(require,module,exports){ -// follow @HenrikJoreteg and @andyet if you like this ;) -(function () { - function getLocalStorageSafely() { - var localStorage; - try { - localStorage = window.localStorage; - } catch (e) { - // failed: access to localStorage is denied - } - return localStorage; - } - - var inNode = typeof window === 'undefined', - ls = !inNode && getLocalStorageSafely(), - out = {}; - - if (inNode || !ls) { - module.exports = console; - return; - } - - var andlogKey = ls.andlogKey || 'debug' - if (ls && ls[andlogKey] && window.console) { - out = window.console; - } else { - var methods = "assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","), - l = methods.length, - fn = function () {}; - - while (l--) { - out[methods[l]] = fn; - } - } - if (typeof exports !== 'undefined') { - module.exports = out; - } else { - window.console = out; - } -})(); - -},{}],3:[function(require,module,exports){ -// shim for using process in browser - -var process = module.exports = {}; - -process.nextTick = (function () { - var canSetImmediate = typeof window !== 'undefined' - && window.setImmediate; - var canPost = typeof window !== 'undefined' - && window.postMessage && window.addEventListener - ; - - if (canSetImmediate) { - return function (f) { return window.setImmediate(f) }; - } - - if (canPost) { - var queue = []; - window.addEventListener('message', function (ev) { - var source = ev.source; - if ((source === window || source === null) && ev.data === 'process-tick') { - ev.stopPropagation(); - if (queue.length > 0) { - var fn = queue.shift(); - fn(); - } - } - }, true); - - return function nextTick(fn) { - queue.push(fn); - window.postMessage('process-tick', '*'); - }; - } - - return function nextTick(fn) { - setTimeout(fn, 0); - }; -})(); - -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -} - -// TODO(shtylman) -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; - -},{}]},{},[1])(1) -}); \ No newline at end of file diff --git a/dist/bows.min.js b/dist/bows.min.js deleted file mode 100644 index d16a240..0000000 --- a/dist/bows.min.js +++ /dev/null @@ -1 +0,0 @@ -!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=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;x1){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)}); \ No newline at end of file