Comparing version 0.1.0 to 0.1.1
@@ -16,2 +16,3 @@ var gulp = require('gulp'); | ||
'lib/magicpen-utils.js', | ||
'lib/magicpen-default-format.js', | ||
'lib/magicpen-core.js', | ||
@@ -18,0 +19,0 @@ 'lib/magicpen-text-serializer.js', |
@@ -27,2 +27,3 @@ /*global console, __dirname, weknowhow, Uint8Array, Uint16Array*/ | ||
'magicpen-utils.js', | ||
'magicpen-default-format.js', | ||
'magicpen-core.js', | ||
@@ -29,0 +30,0 @@ 'magicpen-text-serializer.js', |
@@ -104,2 +104,5 @@ /*global namespace*/ | ||
format = format || 'text'; | ||
if (format === 'auto') { | ||
format = namespace.defaultFormat(); | ||
} | ||
var serializer = new MagicPen.serializers[format](); | ||
@@ -106,0 +109,0 @@ return serializer.serialize(this.output); |
@@ -130,2 +130,55 @@ (function () { | ||
(function () { | ||
function supportsColors() { | ||
// Copied from https://github.com/sindresorhus/supports-color/ | ||
// License: https://raw.githubusercontent.com/sindresorhus/supports-color/master/license | ||
if (typeof process === 'undefined') { | ||
return false; | ||
} | ||
if (process.argv.indexOf('--no-color') !== -1) { | ||
return false; | ||
} | ||
if (process.argv.indexOf('--color') !== -1) { | ||
return true; | ||
} | ||
if (process.stdout && !process.stdout.isTTY) { | ||
return false; | ||
} | ||
if (process.platform === 'win32') { | ||
return true; | ||
} | ||
if ('COLORTERM' in process.env) { | ||
return true; | ||
} | ||
if (process.env.TERM === 'dumb') { | ||
return false; | ||
} | ||
if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
function defaultFormat() { | ||
if (typeof window !== 'undefined' || typeof window.navigator !== 'undefined') { | ||
return 'html'; // Browser | ||
} else if (supportsColors()) { | ||
return 'ansi'; // colored console | ||
} else { | ||
return 'text'; // Plain text | ||
} | ||
} | ||
namespace.defaultFormat = defaultFormat; | ||
}()); | ||
(function () { | ||
var shim = namespace.shim; | ||
@@ -232,2 +285,5 @@ var map = shim.map; | ||
format = format || 'text'; | ||
if (format === 'auto') { | ||
format = namespace.defaultFormat(); | ||
} | ||
var serializer = new MagicPen.serializers[format](); | ||
@@ -234,0 +290,0 @@ return serializer.serialize(this.output); |
{ | ||
"name": "magicpen", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Styled output in both consoles and browsers", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99054
23
1655