initial commit
This commit is contained in:
95
node_modules/chalk/index.js
generated
vendored
Normal file
95
node_modules/chalk/index.js
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
'use strict';
|
||||
var escapeStringRegexp = require('escape-string-regexp');
|
||||
var ansiStyles = require('ansi-styles');
|
||||
var stripAnsi = require('strip-ansi');
|
||||
var hasAnsi = require('has-ansi');
|
||||
var supportsColor = require('supports-color');
|
||||
var defineProps = Object.defineProperties;
|
||||
var chalk = module.exports;
|
||||
|
||||
function build(_styles) {
|
||||
var builder = function builder() {
|
||||
return applyStyle.apply(builder, arguments);
|
||||
};
|
||||
builder._styles = _styles;
|
||||
// __proto__ is used because we must return a function, but there is
|
||||
// no way to create a function with a different prototype.
|
||||
builder.__proto__ = proto;
|
||||
return builder;
|
||||
}
|
||||
|
||||
var styles = (function () {
|
||||
var ret = {};
|
||||
|
||||
ansiStyles.grey = ansiStyles.gray;
|
||||
|
||||
Object.keys(ansiStyles).forEach(function (key) {
|
||||
ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
|
||||
|
||||
ret[key] = {
|
||||
get: function () {
|
||||
return build(this._styles.concat(key));
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
return ret;
|
||||
})();
|
||||
|
||||
var proto = defineProps(function chalk() {}, styles);
|
||||
|
||||
function applyStyle() {
|
||||
// support varags, but simply cast to string in case there's only one arg
|
||||
var args = arguments;
|
||||
var argsLen = args.length;
|
||||
var str = argsLen !== 0 && String(arguments[0]);
|
||||
if (argsLen > 1) {
|
||||
// don't slice `arguments`, it prevents v8 optimizations
|
||||
for (var a = 1; a < argsLen; a++) {
|
||||
str += ' ' + args[a];
|
||||
}
|
||||
}
|
||||
|
||||
if (!chalk.enabled || !str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
/*jshint validthis: true*/
|
||||
var nestedStyles = this._styles;
|
||||
|
||||
for (var i = 0; i < nestedStyles.length; i++) {
|
||||
var code = ansiStyles[nestedStyles[i]];
|
||||
// Replace any instances already present with a re-opening code
|
||||
// otherwise only the part of the string until said closing code
|
||||
// will be colored, and the rest will simply be 'plain'.
|
||||
str = code.open + str.replace(code.closeRe, code.open) + code.close;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
function init() {
|
||||
var ret = {};
|
||||
|
||||
Object.keys(styles).forEach(function (name) {
|
||||
ret[name] = {
|
||||
get: function () {
|
||||
return build([name]);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
defineProps(chalk, init());
|
||||
|
||||
chalk.styles = ansiStyles;
|
||||
chalk.hasColor = hasAnsi;
|
||||
chalk.stripColor = stripAnsi;
|
||||
chalk.supportsColor = supportsColor;
|
||||
|
||||
// detect mode if not set manually
|
||||
if (chalk.enabled === undefined) {
|
||||
chalk.enabled = chalk.supportsColor;
|
||||
}
|
1
node_modules/chalk/node_modules/.bin/has-ansi
generated
vendored
Symbolic link
1
node_modules/chalk/node_modules/.bin/has-ansi
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../has-ansi/cli.js
|
1
node_modules/chalk/node_modules/.bin/strip-ansi
generated
vendored
Symbolic link
1
node_modules/chalk/node_modules/.bin/strip-ansi
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../strip-ansi/cli.js
|
1
node_modules/chalk/node_modules/.bin/supports-color
generated
vendored
Symbolic link
1
node_modules/chalk/node_modules/.bin/supports-color
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../supports-color/cli.js
|
40
node_modules/chalk/node_modules/ansi-styles/index.js
generated
vendored
Normal file
40
node_modules/chalk/node_modules/ansi-styles/index.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
var styles = module.exports;
|
||||
|
||||
var codes = {
|
||||
reset: [0, 0],
|
||||
|
||||
bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
|
||||
dim: [2, 22],
|
||||
italic: [3, 23],
|
||||
underline: [4, 24],
|
||||
inverse: [7, 27],
|
||||
hidden: [8, 28],
|
||||
strikethrough: [9, 29],
|
||||
|
||||
black: [30, 39],
|
||||
red: [31, 39],
|
||||
green: [32, 39],
|
||||
yellow: [33, 39],
|
||||
blue: [34, 39],
|
||||
magenta: [35, 39],
|
||||
cyan: [36, 39],
|
||||
white: [37, 39],
|
||||
gray: [90, 39],
|
||||
|
||||
bgBlack: [40, 49],
|
||||
bgRed: [41, 49],
|
||||
bgGreen: [42, 49],
|
||||
bgYellow: [43, 49],
|
||||
bgBlue: [44, 49],
|
||||
bgMagenta: [45, 49],
|
||||
bgCyan: [46, 49],
|
||||
bgWhite: [47, 49]
|
||||
};
|
||||
|
||||
Object.keys(codes).forEach(function (key) {
|
||||
var val = codes[key];
|
||||
var style = styles[key] = {};
|
||||
style.open = '\u001b[' + val[0] + 'm';
|
||||
style.close = '\u001b[' + val[1] + 'm';
|
||||
});
|
74
node_modules/chalk/node_modules/ansi-styles/package.json
generated
vendored
Normal file
74
node_modules/chalk/node_modules/ansi-styles/package.json
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
{
|
||||
"name": "ansi-styles",
|
||||
"version": "1.1.0",
|
||||
"description": "ANSI escape codes for styling strings in the terminal",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/sindresorhus/ansi-styles"
|
||||
},
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/ansi-styles/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sindresorhus/ansi-styles",
|
||||
"_id": "ansi-styles@1.1.0",
|
||||
"_shasum": "eaecbf66cd706882760b2f4691582b8f55d7a7de",
|
||||
"_from": "ansi-styles@>=1.1.0 <2.0.0",
|
||||
"_npmVersion": "1.4.9",
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "eaecbf66cd706882760b2f4691582b8f55d7a7de",
|
||||
"tarball": "http://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "http://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
70
node_modules/chalk/node_modules/ansi-styles/readme.md
generated
vendored
Normal file
70
node_modules/chalk/node_modules/ansi-styles/readme.md
generated
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
# ansi-styles [](https://travis-ci.org/sindresorhus/ansi-styles)
|
||||
|
||||
> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal
|
||||
|
||||
You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings.
|
||||
|
||||

|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save ansi-styles
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var ansi = require('ansi-styles');
|
||||
|
||||
console.log(ansi.green.open + 'Hello world!' + ansi.green.close);
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
Each style has an `open` and `close` property.
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### General
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(not widely supported)*
|
||||
|
||||
### Text colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `gray`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
11
node_modules/chalk/node_modules/escape-string-regexp/index.js
generated
vendored
Normal file
11
node_modules/chalk/node_modules/escape-string-regexp/index.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
|
||||
|
||||
module.exports = function (str) {
|
||||
if (typeof str !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
return str.replace(matchOperatorsRe, '\\$&');
|
||||
};
|
69
node_modules/chalk/node_modules/escape-string-regexp/package.json
generated
vendored
Normal file
69
node_modules/chalk/node_modules/escape-string-regexp/package.json
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
{
|
||||
"name": "escape-string-regexp",
|
||||
"version": "1.0.2",
|
||||
"description": "Escape RegExp special characters",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sindresorhus/escape-string-regexp"
|
||||
},
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"regular",
|
||||
"expression",
|
||||
"escape",
|
||||
"string",
|
||||
"str",
|
||||
"special",
|
||||
"characters"
|
||||
],
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"gitHead": "0587ee0ee03ea3fcbfa3c15cf67b47f214e20987",
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/escape-string-regexp/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sindresorhus/escape-string-regexp",
|
||||
"_id": "escape-string-regexp@1.0.2",
|
||||
"_shasum": "4dbc2fe674e71949caf3fb2695ce7f2dc1d9a8d1",
|
||||
"_from": "escape-string-regexp@>=1.0.0 <2.0.0",
|
||||
"_npmVersion": "1.4.23",
|
||||
"_npmUser": {
|
||||
"name": "jbnicolai",
|
||||
"email": "jappelman@xebia.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "jbnicolai",
|
||||
"email": "jappelman@xebia.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "4dbc2fe674e71949caf3fb2695ce7f2dc1d9a8d1",
|
||||
"tarball": "http://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "http://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
27
node_modules/chalk/node_modules/escape-string-regexp/readme.md
generated
vendored
Normal file
27
node_modules/chalk/node_modules/escape-string-regexp/readme.md
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
# escape-string-regexp [](https://travis-ci.org/sindresorhus/escape-string-regexp)
|
||||
|
||||
> Escape RegExp special characters
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save escape-string-regexp
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var escapeStringRegexp = require('escape-string-regexp');
|
||||
|
||||
var escapedString = escapeStringRegexp('how much $ for a unicorn?');
|
||||
//=> how much \$ for a unicorn\?
|
||||
|
||||
new RegExp(escapedString);
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
53
node_modules/chalk/node_modules/has-ansi/cli.js
generated
vendored
Executable file
53
node_modules/chalk/node_modules/has-ansi/cli.js
generated
vendored
Executable file
@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
var pkg = require('./package.json');
|
||||
var hasAnsi = require('./');
|
||||
var input = process.argv[2];
|
||||
|
||||
function stdin(cb) {
|
||||
var ret = '';
|
||||
process.stdin.setEncoding('utf8');
|
||||
process.stdin.on('data', function (data) {
|
||||
ret += data;
|
||||
});
|
||||
process.stdin.on('end', function () {
|
||||
cb(ret);
|
||||
});
|
||||
}
|
||||
|
||||
function help() {
|
||||
console.log([
|
||||
pkg.description,
|
||||
'',
|
||||
'Usage',
|
||||
' $ has-ansi <string>',
|
||||
' $ echo <string> | has-ansi',
|
||||
'',
|
||||
'Exits with code 0 if input has ANSI escape codes and 1 if not'
|
||||
].join('\n'));
|
||||
}
|
||||
|
||||
function init(data) {
|
||||
process.exit(hasAnsi(data) ? 0 : 1);
|
||||
}
|
||||
|
||||
if (process.argv.indexOf('--help') !== -1) {
|
||||
help();
|
||||
return;
|
||||
}
|
||||
|
||||
if (process.argv.indexOf('--version') !== -1) {
|
||||
console.log(pkg.version);
|
||||
return;
|
||||
}
|
||||
|
||||
if (process.stdin.isTTY) {
|
||||
if (!input) {
|
||||
help();
|
||||
return;
|
||||
}
|
||||
|
||||
init(input);
|
||||
} else {
|
||||
stdin(init);
|
||||
}
|
4
node_modules/chalk/node_modules/has-ansi/index.js
generated
vendored
Normal file
4
node_modules/chalk/node_modules/has-ansi/index.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
var ansiRegex = require('ansi-regex');
|
||||
var re = new RegExp(ansiRegex().source); // remove the `g` flag
|
||||
module.exports = re.test.bind(re);
|
4
node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js
generated
vendored
Normal file
4
node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
module.exports = function () {
|
||||
return /\u001b\[(?:[0-9]{1,3}(?:;[0-9]{1,3})*)?[m|K]/g;
|
||||
};
|
79
node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json
generated
vendored
Normal file
79
node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
{
|
||||
"name": "ansi-regex",
|
||||
"version": "0.2.1",
|
||||
"description": "Regular expression for matching ANSI escape codes",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/sindresorhus/ansi-regex"
|
||||
},
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"text",
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"match",
|
||||
"test",
|
||||
"find",
|
||||
"pattern"
|
||||
],
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/ansi-regex/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sindresorhus/ansi-regex",
|
||||
"_id": "ansi-regex@0.2.1",
|
||||
"_shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9",
|
||||
"_from": "ansi-regex@>=0.2.0 <0.3.0",
|
||||
"_npmVersion": "1.4.9",
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9",
|
||||
"tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
33
node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md
generated
vendored
Normal file
33
node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
# ansi-regex [](https://travis-ci.org/sindresorhus/ansi-regex)
|
||||
|
||||
> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save ansi-regex
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var ansiRegex = require('ansi-regex');
|
||||
|
||||
ansiRegex().test('\u001b[4mcake\u001b[0m');
|
||||
//=> true
|
||||
|
||||
ansiRegex().test('cake');
|
||||
//=> false
|
||||
|
||||
'\u001b[4mcake\u001b[0m'.match(ansiRegex());
|
||||
//=> ['\u001b[4m', '\u001b[0m']
|
||||
```
|
||||
|
||||
*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.*
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
85
node_modules/chalk/node_modules/has-ansi/package.json
generated
vendored
Normal file
85
node_modules/chalk/node_modules/has-ansi/package.json
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
{
|
||||
"name": "has-ansi",
|
||||
"version": "0.1.0",
|
||||
"description": "Check if a string has ANSI escape codes",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/sindresorhus/has-ansi"
|
||||
},
|
||||
"bin": {
|
||||
"has-ansi": "cli.js"
|
||||
},
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"cli.js"
|
||||
],
|
||||
"keywords": [
|
||||
"cli",
|
||||
"bin",
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"text",
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"match",
|
||||
"test",
|
||||
"find",
|
||||
"pattern",
|
||||
"has"
|
||||
],
|
||||
"dependencies": {
|
||||
"ansi-regex": "^0.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/has-ansi/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sindresorhus/has-ansi",
|
||||
"_id": "has-ansi@0.1.0",
|
||||
"_shasum": "84f265aae8c0e6a88a12d7022894b7568894c62e",
|
||||
"_from": "has-ansi@>=0.1.0 <0.2.0",
|
||||
"_npmVersion": "1.4.9",
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "84f265aae8c0e6a88a12d7022894b7568894c62e",
|
||||
"tarball": "http://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "http://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
45
node_modules/chalk/node_modules/has-ansi/readme.md
generated
vendored
Normal file
45
node_modules/chalk/node_modules/has-ansi/readme.md
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
# has-ansi [](https://travis-ci.org/sindresorhus/has-ansi)
|
||||
|
||||
> Check if a string has [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save has-ansi
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var hasAnsi = require('has-ansi');
|
||||
|
||||
hasAnsi('\u001b[4mcake\u001b[0m');
|
||||
//=> true
|
||||
|
||||
hasAnsi('cake');
|
||||
//=> false
|
||||
```
|
||||
|
||||
|
||||
## CLI
|
||||
|
||||
```sh
|
||||
$ npm install --global has-ansi
|
||||
```
|
||||
|
||||
```
|
||||
$ has-ansi --help
|
||||
|
||||
Usage
|
||||
$ has-ansi <string>
|
||||
$ echo <string> | has-ansi
|
||||
|
||||
Exits with code 0 if input has ANSI escape codes and 1 if not
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
39
node_modules/chalk/node_modules/strip-ansi/cli.js
generated
vendored
Executable file
39
node_modules/chalk/node_modules/strip-ansi/cli.js
generated
vendored
Executable file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
var fs = require('fs');
|
||||
var pkg = require('./package.json');
|
||||
var strip = require('./');
|
||||
var input = process.argv[2];
|
||||
|
||||
function help() {
|
||||
console.log([
|
||||
pkg.description,
|
||||
'',
|
||||
'Usage',
|
||||
' $ strip-ansi <input-file> > <output-file>',
|
||||
' $ cat <input-file> | strip-ansi > <output-file>',
|
||||
'',
|
||||
'Example',
|
||||
' $ strip-ansi unicorn.txt > unicorn-stripped.txt'
|
||||
].join('\n'));
|
||||
}
|
||||
|
||||
if (process.argv.indexOf('--help') !== -1) {
|
||||
help();
|
||||
return;
|
||||
}
|
||||
|
||||
if (process.argv.indexOf('--version') !== -1) {
|
||||
console.log(pkg.version);
|
||||
return;
|
||||
}
|
||||
|
||||
if (input) {
|
||||
process.stdout.write(strip(fs.readFileSync(input, 'utf8')));
|
||||
return;
|
||||
}
|
||||
|
||||
process.stdin.setEncoding('utf8');
|
||||
process.stdin.on('data', function (data) {
|
||||
process.stdout.write(strip(data));
|
||||
});
|
6
node_modules/chalk/node_modules/strip-ansi/index.js
generated
vendored
Normal file
6
node_modules/chalk/node_modules/strip-ansi/index.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
var ansiRegex = require('ansi-regex')();
|
||||
|
||||
module.exports = function (str) {
|
||||
return typeof str === 'string' ? str.replace(ansiRegex, '') : str;
|
||||
};
|
4
node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js
generated
vendored
Normal file
4
node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
'use strict';
|
||||
module.exports = function () {
|
||||
return /\u001b\[(?:[0-9]{1,3}(?:;[0-9]{1,3})*)?[m|K]/g;
|
||||
};
|
79
node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json
generated
vendored
Normal file
79
node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
{
|
||||
"name": "ansi-regex",
|
||||
"version": "0.2.1",
|
||||
"description": "Regular expression for matching ANSI escape codes",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/sindresorhus/ansi-regex"
|
||||
},
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"text",
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"match",
|
||||
"test",
|
||||
"find",
|
||||
"pattern"
|
||||
],
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/ansi-regex/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sindresorhus/ansi-regex",
|
||||
"_id": "ansi-regex@0.2.1",
|
||||
"_shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9",
|
||||
"_from": "ansi-regex@>=0.2.1 <0.3.0",
|
||||
"_npmVersion": "1.4.9",
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9",
|
||||
"tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
33
node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
generated
vendored
Normal file
33
node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
# ansi-regex [](https://travis-ci.org/sindresorhus/ansi-regex)
|
||||
|
||||
> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save ansi-regex
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var ansiRegex = require('ansi-regex');
|
||||
|
||||
ansiRegex().test('\u001b[4mcake\u001b[0m');
|
||||
//=> true
|
||||
|
||||
ansiRegex().test('cake');
|
||||
//=> false
|
||||
|
||||
'\u001b[4mcake\u001b[0m'.match(ansiRegex());
|
||||
//=> ['\u001b[4m', '\u001b[0m']
|
||||
```
|
||||
|
||||
*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.*
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
84
node_modules/chalk/node_modules/strip-ansi/package.json
generated
vendored
Normal file
84
node_modules/chalk/node_modules/strip-ansi/package.json
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
{
|
||||
"name": "strip-ansi",
|
||||
"version": "0.3.0",
|
||||
"description": "Strip ANSI escape codes",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"strip-ansi": "cli.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/sindresorhus/strip-ansi"
|
||||
},
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"cli.js"
|
||||
],
|
||||
"keywords": [
|
||||
"strip",
|
||||
"trim",
|
||||
"remove",
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"ansi-regex": "^0.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/strip-ansi/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sindresorhus/strip-ansi",
|
||||
"_id": "strip-ansi@0.3.0",
|
||||
"_shasum": "25f48ea22ca79187f3174a4db8759347bb126220",
|
||||
"_from": "strip-ansi@>=0.3.0 <0.4.0",
|
||||
"_npmVersion": "1.4.9",
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "25f48ea22ca79187f3174a4db8759347bb126220",
|
||||
"tarball": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
43
node_modules/chalk/node_modules/strip-ansi/readme.md
generated
vendored
Normal file
43
node_modules/chalk/node_modules/strip-ansi/readme.md
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
# strip-ansi [](https://travis-ci.org/sindresorhus/strip-ansi)
|
||||
|
||||
> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save strip-ansi
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var stripAnsi = require('strip-ansi');
|
||||
|
||||
stripAnsi('\x1b[4mcake\x1b[0m');
|
||||
//=> 'cake'
|
||||
```
|
||||
|
||||
|
||||
## CLI
|
||||
|
||||
```sh
|
||||
$ npm install --global strip-ansi
|
||||
```
|
||||
|
||||
```sh
|
||||
$ strip-ansi --help
|
||||
|
||||
Usage
|
||||
$ strip-ansi <input-file> > <output-file>
|
||||
$ cat <input-file> | strip-ansi > <output-file>
|
||||
|
||||
Example
|
||||
$ strip-ansi unicorn.txt > unicorn-stripped.txt
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
28
node_modules/chalk/node_modules/supports-color/cli.js
generated
vendored
Executable file
28
node_modules/chalk/node_modules/supports-color/cli.js
generated
vendored
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
var pkg = require('./package.json');
|
||||
var supportsColor = require('./');
|
||||
var input = process.argv[2];
|
||||
|
||||
function help() {
|
||||
console.log([
|
||||
pkg.description,
|
||||
'',
|
||||
'Usage',
|
||||
' $ supports-color',
|
||||
'',
|
||||
'Exits with code 0 if color is supported and 1 if not'
|
||||
].join('\n'));
|
||||
}
|
||||
|
||||
if (!input || process.argv.indexOf('--help') !== -1) {
|
||||
help();
|
||||
return;
|
||||
}
|
||||
|
||||
if (process.argv.indexOf('--version') !== -1) {
|
||||
console.log(pkg.version);
|
||||
return;
|
||||
}
|
||||
|
||||
process.exit(supportsColor ? 0 : 1);
|
32
node_modules/chalk/node_modules/supports-color/index.js
generated
vendored
Normal file
32
node_modules/chalk/node_modules/supports-color/index.js
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
module.exports = (function () {
|
||||
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;
|
||||
})();
|
78
node_modules/chalk/node_modules/supports-color/package.json
generated
vendored
Normal file
78
node_modules/chalk/node_modules/supports-color/package.json
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
{
|
||||
"name": "supports-color",
|
||||
"version": "0.2.0",
|
||||
"description": "Detect whether a terminal supports color",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/sindresorhus/supports-color"
|
||||
},
|
||||
"bin": {
|
||||
"supports-color": "cli.js"
|
||||
},
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"cli.js"
|
||||
],
|
||||
"keywords": [
|
||||
"cli",
|
||||
"bin",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"ansi",
|
||||
"styles",
|
||||
"tty",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"support",
|
||||
"supports",
|
||||
"capability",
|
||||
"detect"
|
||||
],
|
||||
"devDependencies": {
|
||||
"mocha": "*"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/supports-color/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sindresorhus/supports-color",
|
||||
"_id": "supports-color@0.2.0",
|
||||
"_shasum": "d92de2694eb3f67323973d7ae3d8b55b4c22190a",
|
||||
"_from": "supports-color@>=0.2.0 <0.3.0",
|
||||
"_npmVersion": "1.4.9",
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "d92de2694eb3f67323973d7ae3d8b55b4c22190a",
|
||||
"tarball": "http://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "http://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
44
node_modules/chalk/node_modules/supports-color/readme.md
generated
vendored
Normal file
44
node_modules/chalk/node_modules/supports-color/readme.md
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
# supports-color [](https://travis-ci.org/sindresorhus/supports-color)
|
||||
|
||||
> Detect whether a terminal supports color
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save supports-color
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var supportsColor = require('supports-color');
|
||||
|
||||
if (supportsColor) {
|
||||
console.log('Terminal supports color');
|
||||
}
|
||||
```
|
||||
|
||||
It obeys the `--color` and `--no-color` CLI flags.
|
||||
|
||||
|
||||
## CLI
|
||||
|
||||
```sh
|
||||
$ npm install --global supports-color
|
||||
```
|
||||
|
||||
```sh
|
||||
$ supports-color --help
|
||||
|
||||
Usage
|
||||
$ supports-color
|
||||
|
||||
# Exits with code 0 if color is supported and 1 if not
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
82
node_modules/chalk/package.json
generated
vendored
Normal file
82
node_modules/chalk/package.json
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
"name": "chalk",
|
||||
"version": "0.5.1",
|
||||
"description": "Terminal string styling done right. Created because the `colors` module does some really horrible things.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/sindresorhus/chalk"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "jbnicolai",
|
||||
"email": "jappelman@xebia.com"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
"bench": "matcha benchmark.js"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"ansi",
|
||||
"styles",
|
||||
"tty",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text"
|
||||
],
|
||||
"dependencies": {
|
||||
"ansi-styles": "^1.1.0",
|
||||
"escape-string-regexp": "^1.0.0",
|
||||
"has-ansi": "^0.1.0",
|
||||
"strip-ansi": "^0.3.0",
|
||||
"supports-color": "^0.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"matcha": "^0.5.0",
|
||||
"mocha": "*"
|
||||
},
|
||||
"gitHead": "994758f01293f1fdcf63282e9917cb9f2cfbdaac",
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/chalk/issues"
|
||||
},
|
||||
"homepage": "https://github.com/sindresorhus/chalk",
|
||||
"_id": "chalk@0.5.1",
|
||||
"_shasum": "663b3a648b68b55d04690d49167aa837858f2174",
|
||||
"_from": "chalk@*",
|
||||
"_npmVersion": "1.4.14",
|
||||
"_npmUser": {
|
||||
"name": "jbnicolai",
|
||||
"email": "jappelman@xebia.com"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "663b3a648b68b55d04690d49167aa837858f2174",
|
||||
"tarball": "http://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "http://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
175
node_modules/chalk/readme.md
generated
vendored
Normal file
175
node_modules/chalk/readme.md
generated
vendored
Normal file
@ -0,0 +1,175 @@
|
||||
# <img width="300" src="https://cdn.rawgit.com/sindresorhus/chalk/77ae94f63ab1ac61389b190e5a59866569d1a376/logo.svg" alt="chalk">
|
||||
|
||||
> Terminal string styling done right
|
||||
|
||||
[](https://travis-ci.org/sindresorhus/chalk)
|
||||

|
||||
|
||||
[colors.js](https://github.com/Marak/colors.js) is currently the most popular string styling module, but it has serious deficiencies like extending String.prototype which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68). Although there are other ones, they either do too much or not enough.
|
||||
|
||||
**Chalk is a clean and focused alternative.**
|
||||
|
||||

|
||||
|
||||
|
||||
## Why
|
||||
|
||||
- Highly performant
|
||||
- Doesn't extend String.prototype
|
||||
- Expressive API
|
||||
- Ability to nest styles
|
||||
- Clean and focused
|
||||
- Auto-detects color support
|
||||
- Actively maintained
|
||||
- [Used by 1000+ modules](https://npmjs.org/browse/depended/chalk)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save chalk
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
|
||||
// style a string
|
||||
console.log( chalk.blue('Hello world!') );
|
||||
|
||||
// combine styled and normal strings
|
||||
console.log( chalk.blue('Hello'), 'World' + chalk.red('!') );
|
||||
|
||||
// compose multiple styles using the chainable API
|
||||
console.log( chalk.blue.bgRed.bold('Hello world!') );
|
||||
|
||||
// pass in multiple arguments
|
||||
console.log( chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz') );
|
||||
|
||||
// nest styles
|
||||
console.log( chalk.red('Hello', chalk.underline.bgBlue('world') + '!') );
|
||||
|
||||
// nest styles of the same type even (color, underline, background)
|
||||
console.log( chalk.green('I am a green line ' + chalk.blue('with a blue substring') + ' that becomes green again!') );
|
||||
```
|
||||
|
||||
Easily define your own themes.
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
var error = chalk.bold.red;
|
||||
console.log(error('Error!'));
|
||||
```
|
||||
|
||||
Take advantage of console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data).
|
||||
|
||||
```js
|
||||
var name = 'Sindre';
|
||||
console.log(chalk.green('Hello %s'), name);
|
||||
//=> Hello Sindre
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### chalk.`<style>[.<style>...](string, [string...])`
|
||||
|
||||
Example: `chalk.red.bold.underline('Hello', 'world');`
|
||||
|
||||
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter.
|
||||
|
||||
Multiple arguments will be separated by space.
|
||||
|
||||
### chalk.enabled
|
||||
|
||||
Color support is automatically detected, but you can override it.
|
||||
|
||||
### chalk.supportsColor
|
||||
|
||||
Detect whether the terminal [supports color](https://github.com/sindresorhus/supports-color).
|
||||
|
||||
Can be overridden by the user with the flags `--color` and `--no-color`.
|
||||
|
||||
Used internally and handled for you, but exposed for convenience.
|
||||
|
||||
### chalk.styles
|
||||
|
||||
Exposes the styles as [ANSI escape codes](https://github.com/sindresorhus/ansi-styles).
|
||||
|
||||
Generally not useful, but you might need just the `.open` or `.close` escape code if you're mixing externally styled strings with yours.
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
|
||||
console.log(chalk.styles.red);
|
||||
//=> {open: '\u001b[31m', close: '\u001b[39m'}
|
||||
|
||||
console.log(chalk.styles.red.open + 'Hello' + chalk.styles.red.close);
|
||||
```
|
||||
|
||||
### chalk.hasColor(string)
|
||||
|
||||
Check whether a string [has color](https://github.com/sindresorhus/has-ansi).
|
||||
|
||||
### chalk.stripColor(string)
|
||||
|
||||
[Strip color](https://github.com/sindresorhus/strip-ansi) from a string.
|
||||
|
||||
Can be useful in combination with `.supportsColor` to strip color on externally styled text when it's not supported.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
var chalk = require('chalk');
|
||||
var styledString = getText();
|
||||
|
||||
if (!chalk.supportsColor) {
|
||||
styledString = chalk.stripColor(styledString);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Styles
|
||||
|
||||
### General
|
||||
|
||||
- `reset`
|
||||
- `bold`
|
||||
- `dim`
|
||||
- `italic` *(not widely supported)*
|
||||
- `underline`
|
||||
- `inverse`
|
||||
- `hidden`
|
||||
- `strikethrough` *(not widely supported)*
|
||||
|
||||
### Text colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `gray`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
Reference in New Issue
Block a user