added gitignore

This commit is contained in:
Kasper Rynning-Tønnesen
2015-11-29 13:38:52 +01:00
parent 95bb0c3919
commit fbb9f9b745
3868 changed files with 12 additions and 11 deletions

18
node_modules/gulp-uglifyjs/.jshintrc generated vendored Executable file
View File

@@ -0,0 +1,18 @@
{
"bitwise": true,
"camelcase": true,
"curly": false,
"devel": true,
"eqeqeq": true,
"indent": 2,
"latedef": true,
"newcap": true,
"node": true,
"noempty": true,
"nonew": true,
"quotmark": "single",
"strict": true,
"trailing": true,
"undef": true,
"unused": true
}

2
node_modules/gulp-uglifyjs/.npmignore generated vendored Executable file
View File

@@ -0,0 +1,2 @@
node_modules/
npm-debug.log

4
node_modules/gulp-uglifyjs/.travis.yml generated vendored Executable file
View File

@@ -0,0 +1,4 @@
language: node_js
node_js:
- "0.11"
- "0.10"

60
node_modules/gulp-uglifyjs/CHANGELOG.md generated vendored Executable file
View File

@@ -0,0 +1,60 @@
# gulp-uglifyjs changelog
## 0.6.2
- Remove dependency on lodash, path
- Update dependencies
- Update deprecation notice
## 0.6.1
- Don't break pipe when no files given [1791bbf](https://github.com/craigjennings11/gulp-uglifyjs/commit/1791bbf979754d60c26ce205c58c9bfe746eed3c)
## 0.6.0
- Add support for mangle options [f35998c](https://github.com/craigjennings11/gulp-uglifyjs/commit/f35998c7a73dcd2ea24661dc801e34b6bfbe092c)
## 0.5.0
- Adding support for inSourceMap option [12460aa](https://github.com/craigjennings11/gulp-uglifyjs/commit/12460aa1bdcb373d0055ab323077bda5ebd76d35)
- Adding support for sourceRoot option to mirror Uglify.minify() API more closely
## 0.4.4
- Using correct filename for source_map.file option by default [#15](https://github.com/craigjennings11/gulp-uglifyjs/issues/15)
## 0.4.3
- Fixing problem where source wouldn't load in browser [#11](https://github.com/craigjennings11/gulp-uglifyjs/issues/11)
## 0.4.2
- Adding more details to error reporting
## 0.4.1
- Added better reporting when UglifyJS throws an error
## 0.4.0
- Added `sourceMapIncludeSources` option [da7684e](https://github.com/craigjennings11/gulp-uglifyjs/commit/da7684ea23475f5fc78f142ddb1556d9795309ba)
## 0.3.0
- Added `wrap` and `enclose` options [4ca8c29](https://github.com/craigjennings11/gulp-uglifyjs/commit/4ca8c2979fc08d85649056535d0dcb00eff9bb7a)
## 0.2.1
- No longer errors out when no files are passed in
## 0.2.0
- Refactored interaction with UglifyJS to have more granular control over
compression.
- Fixed [#1](https://github.com/craigjennings11/gulp-uglifyjs/issues/1)
## 0.1.1
- Added tests
- Clarified portions of README
## 0.1.0
- Initial release

20
node_modules/gulp-uglifyjs/LICENSE generated vendored Executable file
View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2014 Craig Jennings
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

146
node_modules/gulp-uglifyjs/README.md generated vendored Executable file
View File

@@ -0,0 +1,146 @@
# gulp-uglifyjs [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url]
__DEPRECATED__: This plugin has been blacklisted as it relies on Uglify to concat
the files instead of using [gulp-concat][concat-link], which breaks the "It
should do one thing" paradigm. When I created this plugin, there was no way to
get source maps to work with gulp, however now there is a [gulp-sourcemaps][sourcemaps-link]
plugin that achieves the same goal. gulp-uglifyjs still works great and gives
very granular control over the Uglify execution, I'm just giving you a heads up
that other options now exist.
> Minify multiple JavaScript with UglifyJS2.
This plugin is based off of [gulp-uglify][uglify-link] but allows you to
directly use all of Uglify's options. The main difference between these two
plugins is that passing in an array of files (or glob pattern that matches
multiple files) will pass that array directly to Uglify. Uglify will handle both
concatenating and minifying those files.
Letting Uglify handle the concatenation and minification allows for the
generated source map to be able to separate the files in the browser for easier
debugging, and it avoids the intermediate step of `concat()`. Using `concat()`
and then `uglify()` would result in a source map for the already concatenated
file which has the possibility of being quite large, making it hard to find the
code you are wanting to debug.
[sourcemaps-link]: https://github.com/floridoo/gulp-sourcemaps
[concat-link]: https://github.com/wearefractal/gulp-concat
[uglify-link]: https://github.com/terinjokes/gulp-uglify
## Usage
```javascript
var uglify = require('gulp-uglifyjs');
gulp.task('uglify', function() {
gulp.src('public/js/*.js')
.pipe(uglify())
.pipe(gulp.dest('dist/js'))
});
```
This will concatenate and minify all files found by `public/js/*.js` and write
it to a file with the same name as the first file found.
## API
`uglify([filename], [options])`
- filename - optional
Override the default output filename.
- options - optional
These options are directly passed to Uglify. Below are some examples of what
is available. To see a full list, read UglifyJS's [documentation](https://github.com/mishoo/UglifyJS2/#api-reference)
- `outSourceMap`
(default `false`) Give a `string` to be the name of the source map. Set to
`true` and the source map name will be the same as the output file name
suffixed with `.map`.
Note: if you would like your source map to point to relative paths instead
of absolute paths (which you probably will if it is hosted on a server), set
the `basePath` option to be the base of where the content is served.
- `inSourceMap`
If you're compressing compiled JavaScript and have a source map for it, you
can use the inSourceMap argument. This can only be used in conjunction with
`outSourceMap`.
- `sourceRoot`
Sets the root location for where the source files should be found
- `mangle`
(default `{}`) Set to `false` to skip mangling names. See [options](https://github.com/mishoo/UglifyJS2/blob/e37b67d013c4537a36bb3c24f4f99e72efbf6d4b/lib/scope.js#L328) for possible key/value pairs.
- `output`
(default `null`) Pass an Object if you wish to specify additional [output options](http://lisperator.net/uglifyjs/codegen).
The defaults are optimized for best compression.
- `compress`
(default `{}`) Pass an Object to specify custom [compressor options](http://lisperator.net/uglifyjs/compress).
Pass `false` to skip compression completely.
- `enclose`
(default `undefined`) Pass an Object to wrap all of the code in a closure
with a configurable arguments/parameters list. Each key-value pair in the
enclose object is effectively an argument-parameter pair.
- `wrap`
(default `undefined`) Pass a String to wrap all of the code in a closure.
This is an easy way to make sure nothing is leaking. Variables that need to
be public `exports` and `global` are made available. The value of wrap is
the global variable exports will be available as.
- `exportAll`
(default `false`) Set to `true` to make all global functions and variables
available via the `export` variable. Only available when using `wrap`.
### Examples
To minify multiple files into a 'app.min.js' and create a source map:
```js
gulp.task('uglify', function() {
gulp.src('public/js/*.js')
.pipe(uglify('app.min.js', {
outSourceMap: true
}))
.pipe(gulp.dest('dist/js'))
});
```
To minify multiple files from different paths to 'app.js', but skip mangling
and beautify the results:
```js
gulp.task('uglify', function() {
gulp.src(['public/js/*.js', 'bower_components/**/*.js'])
.pipe(uglify('app.js', {
mangle: false,
output: {
beautify: true
}
}))
.pipe(gulp.dest('dist/js'))
});
```
[npm-image]: http://img.shields.io/npm/v/gulp-uglifyjs.svg
[npm-url]: https://www.npmjs.org/package/gulp-uglifyjs/
[downloads-image]: http://img.shields.io/npm/dm/gulp-uglifyjs.svg
[travis-url]: https://travis-ci.org/craigjennings11/gulp-uglifyjs
[travis-image]: https://travis-ci.org/craigjennings11/gulp-uglifyjs.svg?branch=master

170
node_modules/gulp-uglifyjs/index.js generated vendored Executable file
View File

@@ -0,0 +1,170 @@
var fs = require('fs');
var gutil = require('gulp-util');
var path = require('path');
var through = require('through');
var UglifyJS = require('uglify-js');
var File = gutil.File;
var PluginError = gutil.PluginError;
module.exports = function(filename, options) {
'use strict';
var baseFile = null;
var basePath = '.';
var sourcesContent = {};
var toplevel = null;
if (typeof filename === 'object') {
// options given, but no filename
options = filename;
filename = null;
}
// Assign default values to options
options = options || {};
if (options.compress !== false) options.compress = options.compress || { warnings: false };
if (options.mangle !== false) options.mangle = options.mangle || {};
options.output = options.output || {};
// Needed to get the relative paths correct in the source map
if (options.basePath) {
basePath = process.cwd() + path.sep + options.basePath;
}
function bufferFiles(file) {
/* jshint validthis: true */
if (file.isNull()) return;
if (file.isStream()) {
return this.emit('error', new PluginError('gulp-uglifyjs', 'Streaming not supported'));
}
if (!baseFile) {
baseFile = file;
// Set the filename if one wasn't given
if (!filename) {
filename = baseFile.relative;
}
// Set the outSourceMap filename if one was requested
if (options.outSourceMap === true) {
options.outSourceMap = filename + '.map';
}
}
var code = file.contents.toString();
sourcesContent[file.path] = code;
try {
toplevel = UglifyJS.parse(code, {
filename: path.relative(basePath, file.path),
toplevel: toplevel
});
} catch(e) {
gutil.log('gulp-uglifyjs - UglifyJS threw an error');
gutil.log(gutil.colors.red('file: ') + file.path + ':' + e.line + ',' + e.col);
gutil.log(gutil.colors.red('error: ') + e.message);
return this.emit('error', new PluginError('gulp-uglifyjs', 'Aborting due to previous errors'));
}
}
function minify() {
/* jshint validthis: true, camelcase: false */
if(!toplevel) {
gutil.log('gulp-uglifyjs - No files given; aborting minification');
this.emit('end');
return;
}
if (options.wrap) {
toplevel = toplevel.wrap_commonjs(options.wrap, options.exportAll);
}
if (options.enclose) {
var argParameterList = [];
if (options.enclose !== true) {
Object.keys(options.enclose).forEach(function(key) {
argParameterList.push(key + ':' + options.enclose[key]);
});
}
toplevel = toplevel.wrap_enclose(argParameterList);
}
toplevel.figure_out_scope();
if (options.compress !== false) {
var compressor = UglifyJS.Compressor(options.compress);
toplevel = toplevel.transform(compressor);
toplevel.figure_out_scope();
}
if (options.mangle !== false) {
toplevel.compute_char_frequency();
toplevel.mangle_names(options.mangle);
}
// Setup source map if one was requested
if (options.outSourceMap) {
options.output.source_map = options.output.source_map || {
file: filename,
root: options.sourceRoot || baseFile.cwd,
};
if (options.inSourceMap) {
options.output.source_map.orig = fs.readFileSync(options.inSourceMap).toString();
}
var map = UglifyJS.SourceMap(options.output.source_map);
options.output.source_map = map;
if (options.sourceMapIncludeSources) {
for (var file in sourcesContent) {
if (sourcesContent.hasOwnProperty(file)) {
options.output.source_map.get().setSourceContent(file, sourcesContent[file]);
}
}
}
}
// Output the minified code
var stream = UglifyJS.OutputStream(options.output);
toplevel.print(stream);
var min = stream.get();
if (options.outSourceMap) {
// Manually add source map comment to uglified code
min += '\r\n//# sourceMappingURL=' + options.outSourceMap;
}
var compressedFile = new File({
cwd: baseFile.cwd,
base: baseFile.base,
path: path.join(baseFile.base, filename),
contents: new Buffer(min)
});
this.push(compressedFile);
if (options.outSourceMap) {
var sourceMap = new File({
cwd: baseFile.cwd,
base: baseFile.base,
path: path.join(baseFile.base, options.outSourceMap),
contents: new Buffer(options.output.source_map.toString())
});
this.push(sourceMap);
}
this.emit('end');
}
return through(bufferFiles, minify);
};

1
node_modules/gulp-uglifyjs/node_modules/.bin/uglifyjs generated vendored Symbolic link
View File

@@ -0,0 +1 @@
../uglify-js/bin/uglifyjs

20
node_modules/gulp-uglifyjs/node_modules/gulp-util/LICENSE generated vendored Executable file
View File

@@ -0,0 +1,20 @@
Copyright (c) 2014 Fractal <contact@wearefractal.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,146 @@
# gulp-util [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status][depstat-image]][depstat-url]
## Information
<table>
<tr>
<td>Package</td><td>gulp-util</td>
</tr>
<tr>
<td>Description</td>
<td>Utility functions for gulp plugins</td>
</tr>
<tr>
<td>Node Version</td>
<td>>= 0.10</td>
</tr>
</table>
## Usage
```javascript
var gutil = require('gulp-util');
gutil.log('stuff happened', 'Really it did', gutil.colors.magenta('123'));
gutil.beep();
gutil.replaceExtension('file.coffee', '.js'); // file.js
var opt = {
name: 'todd',
file: someGulpFile
};
gutil.template('test <%= name %> <%= file.path %>', opt) // test todd /js/hi.js
```
### log(msg...)
Logs stuff. Already prefixed with [gulp] and all that. If you pass in multiple arguments it will join them by a space.
The default gulp coloring using gutil.colors.<color>:
```
values (files, module names, etc.) = cyan
numbers (times, counts, etc) = magenta
```
### colors
Is an instance of [chalk](https://github.com/sindresorhus/chalk).
### replaceExtension(path, newExtension)
Replaces a file extension in a path. Returns the new path.
### isStream(obj)
Returns true or false if an object is a stream.
### isBuffer(obj)
Returns true or false if an object is a Buffer.
### template(string[, data])
This is a lodash.template function wrapper. You must pass in a valid gulp file object so it is available to the user or it will error. You can not configure any of the delimiters. Look at the [lodash docs](http://lodash.com/docs#template) for more info.
## new File(obj)
This is just [vinyl](https://github.com/wearefractal/vinyl)
```javascript
var file = new gutil.File({
base: path.join(__dirname, './fixtures/'),
cwd: __dirname,
path: path.join(__dirname, './fixtures/test.coffee')
});
```
## noop()
Returns a stream that does nothing but pass data straight through.
```javascript
// gulp should be called like this :
// $ gulp --type production
gulp.task('scripts', function() {
gulp.src('src/**/*.js')
.pipe(concat('script.js'))
.pipe(gutil.env.type === 'production' ? uglify() : gutil.noop())
.pipe(gulp.dest('dist/'));
});
```
## buffer(cb)
This is similar to es.wait but instead of buffering text into one string it buffers anything into an array (so very useful for file objects).
Returns a stream that can be piped to.
The stream will emit one data event after the stream piped to it has ended. The data will be the same array passed to the callback.
Callback is optional and receives two arguments: error and data
```javascript
gulp.src('stuff/*.js')
.pipe(gutil.buffer(function(err, files) {
}));
```
## new PluginError(pluginName, message[, options])
- pluginName should be the module name of your plugin
- message can be a string or an existing error
- By default the stack will not be shown. Set `options.showStack` to true if you think the stack is important for your error.
- If you pass an error in as the message the stack will be pulled from that, otherwise one will be created.
- Note that if you pass in a custom stack string you need to include the message along with that.
- Error properties will be included in `err.toString()`. Can be omitted by including `{showProperties: false}` in the options.
These are all acceptable forms of instantiation:
```javascript
var err = new gutil.PluginError('test', {
message: 'something broke'
});
var err = new gutil.PluginError({
plugin: 'test',
message: 'something broke'
});
var err = new gutil.PluginError('test', 'something broke');
var err = new gutil.PluginError('test', 'something broke', {showStack: true});
var existingError = new Error('OMG');
var err = new gutil.PluginError('test', existingError, {showStack: true});
```
[npm-url]: https://www.npmjs.com/package/gulp-util
[npm-image]: https://badge.fury.io/js/gulp-util.svg
[travis-url]: https://travis-ci.org/gulpjs/gulp-util
[travis-image]: https://img.shields.io/travis/gulpjs/gulp-util.svg?branch=master
[coveralls-url]: https://coveralls.io/r/gulpjs/gulp-util
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/gulp-util.svg
[depstat-url]: https://david-dm.org/gulpjs/gulp-util
[depstat-image]: https://david-dm.org/gulpjs/gulp-util.svg

View File

@@ -0,0 +1,18 @@
module.exports = {
File: require('vinyl'),
replaceExtension: require('replace-ext'),
colors: require('chalk'),
date: require('dateformat'),
log: require('./lib/log'),
template: require('./lib/template'),
env: require('./lib/env'),
beep: require('beeper'),
noop: require('./lib/noop'),
isStream: require('./lib/isStream'),
isBuffer: require('./lib/isBuffer'),
isNull: require('./lib/isNull'),
linefeed: '\n',
combine: require('./lib/combine'),
buffer: require('./lib/buffer'),
PluginError: require('./lib/PluginError')
};

View File

@@ -0,0 +1,130 @@
var util = require('util');
var arrayDiffer = require('array-differ');
var arrayUniq = require('array-uniq');
var chalk = require('chalk');
var objectAssign = require('object-assign');
var nonEnumberableProperties = ['name', 'message', 'stack'];
var propertiesNotToDisplay = nonEnumberableProperties.concat(['plugin', 'showStack', 'showProperties', '__safety', '_stack']);
// wow what a clusterfuck
var parseOptions = function(plugin, message, opt) {
opt = opt || {};
if (typeof plugin === 'object') {
opt = plugin;
} else {
if (message instanceof Error) {
opt.error = message;
} else if (typeof message === 'object') {
opt = message;
} else {
opt.message = message;
}
opt.plugin = plugin;
}
return objectAssign({
showStack: false,
showProperties: true
}, opt);
};
function PluginError(plugin, message, opt) {
if (!(this instanceof PluginError)) throw new Error('Call PluginError using new');
Error.call(this);
var options = parseOptions(plugin, message, opt);
var self = this;
// if options has an error, grab details from it
if (options.error) {
// These properties are not enumerable, so we have to add them explicitly.
arrayUniq(Object.keys(options.error).concat(nonEnumberableProperties))
.forEach(function(prop) {
self[prop] = options.error[prop];
});
}
var properties = ['name', 'message', 'fileName', 'lineNumber', 'stack', 'showStack', 'showProperties', 'plugin'];
// options object can override
properties.forEach(function(prop) {
if (prop in options) this[prop] = options[prop];
}, this);
// defaults
if (!this.name) this.name = 'Error';
if (!this.stack) {
// Error.captureStackTrace appends a stack property which relies on the toString method of the object it is applied to.
// Since we are using our own toString method which controls when to display the stack trace if we don't go through this
// safety object, then we'll get stack overflow problems.
var safety = {
toString: function() {
return this._messageWithDetails() + '\nStack:';
}.bind(this)
};
Error.captureStackTrace(safety, arguments.callee || this.constructor);
this.__safety = safety;
}
if (!this.plugin) throw new Error('Missing plugin name');
if (!this.message) throw new Error('Missing error message');
}
util.inherits(PluginError, Error);
PluginError.prototype._messageWithDetails = function() {
var messageWithDetails = 'Message:\n ' + this.message;
var details = this._messageDetails();
if (details !== '') {
messageWithDetails += '\n' + details;
}
return messageWithDetails;
};
PluginError.prototype._messageDetails = function() {
if (!this.showProperties) {
return '';
}
var properties = arrayDiffer(Object.keys(this), propertiesNotToDisplay);
if (properties.length === 0) {
return '';
}
var self = this;
properties = properties.map(function stringifyProperty(prop) {
return ' ' + prop + ': ' + self[prop];
});
return 'Details:\n' + properties.join('\n');
};
PluginError.prototype.toString = function () {
var sig = chalk.red(this.name) + ' in plugin \'' + chalk.cyan(this.plugin) + '\'';
var detailsWithStack = function(stack) {
return this._messageWithDetails() + '\nStack:\n' + stack;
}.bind(this);
var msg;
if (this.showStack) {
if (this.__safety) { // There is no wrapped error, use the stack captured in the PluginError ctor
msg = this.__safety.stack;
} else if (this._stack) {
msg = detailsWithStack(this._stack);
} else { // Stack from wrapped error
msg = detailsWithStack(this.stack);
}
} else {
msg = this._messageWithDetails();
}
return sig + '\n' + msg;
};
module.exports = PluginError;

View File

@@ -0,0 +1,15 @@
var through = require('through2');
module.exports = function(fn) {
var buf = [];
var end = function(cb) {
this.push(buf);
cb();
if(fn) fn(null, buf);
};
var push = function(data, enc, cb) {
buf.push(data);
cb();
};
return through.obj(push, end);
};

View File

@@ -0,0 +1,11 @@
var pipeline = require('multipipe');
module.exports = function(){
var args = arguments;
if (args.length === 1 && Array.isArray(args[0])) {
args = args[0];
}
return function(){
return pipeline.apply(pipeline, args);
};
};

View File

@@ -0,0 +1,4 @@
var parseArgs = require('minimist');
var argv = parseArgs(process.argv.slice(2));
module.exports = argv;

View File

@@ -0,0 +1,7 @@
var buf = require('buffer');
var Buffer = buf.Buffer;
// could use Buffer.isBuffer but this is the same exact thing...
module.exports = function(o) {
return typeof o === 'object' && o instanceof Buffer;
};

View File

@@ -0,0 +1,3 @@
module.exports = function(v) {
return v === null;
};

View File

@@ -0,0 +1,5 @@
var Stream = require('stream').Stream;
module.exports = function(o) {
return !!o && o instanceof Stream;
};

View File

@@ -0,0 +1,14 @@
var hasGulplog = require('has-gulplog');
module.exports = function(){
if(hasGulplog()){
// specifically deferring loading here to keep from registering it globally
var gulplog = require('gulplog');
gulplog.info.apply(gulplog, arguments);
} else {
// specifically defering loading because it might not be used
var fancylog = require('fancy-log');
fancylog.apply(null, arguments);
}
return this;
};

View File

@@ -0,0 +1,5 @@
var through = require('through2');
module.exports = function () {
return through.obj();
};

View File

@@ -0,0 +1,23 @@
var template = require('lodash.template');
var reEscape = require('lodash._reescape');
var reEvaluate = require('lodash._reevaluate');
var reInterpolate = require('lodash._reinterpolate');
var forcedSettings = {
escape: reEscape,
evaluate: reEvaluate,
interpolate: reInterpolate
};
module.exports = function(tmpl, data) {
var fn = template(tmpl, forcedSettings);
var wrapped = function(o) {
if (typeof o === 'undefined' || typeof o.file === 'undefined') {
throw new Error('Failed to provide the current file as "file" to the template');
}
return fn(o);
};
return (data ? wrapped(data) : wrapped);
};

View File

@@ -0,0 +1 @@
../dateformat/bin/cli.js

View File

@@ -0,0 +1,7 @@
'use strict';
module.exports = function (arr) {
var rest = [].concat.apply([], [].slice.call(arguments, 1));
return arr.filter(function (el) {
return rest.indexOf(el) === -1;
});
};

View File

@@ -0,0 +1,61 @@
{
"name": "array-differ",
"version": "1.0.0",
"description": "Create an array with values that are present in the first input array but not additional ones",
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/sindresorhus/array-differ"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"files": [
"index.js"
],
"keywords": [
"array",
"difference",
"diff",
"differ",
"filter",
"exclude"
],
"devDependencies": {
"mocha": "*"
},
"gitHead": "e91802976c4710eef8dea2090d48e48525cf41b1",
"bugs": {
"url": "https://github.com/sindresorhus/array-differ/issues"
},
"homepage": "https://github.com/sindresorhus/array-differ",
"_id": "array-differ@1.0.0",
"_shasum": "eff52e3758249d33be402b8bb8e564bb2b5d4031",
"_from": "array-differ@^1.0.0",
"_npmVersion": "1.4.14",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"dist": {
"shasum": "eff52e3758249d33be402b8bb8e564bb2b5d4031",
"tarball": "http://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,41 @@
# array-differ [![Build Status](https://travis-ci.org/sindresorhus/array-differ.svg?branch=master)](https://travis-ci.org/sindresorhus/array-differ)
> Create an array with values that are present in the first input array but not additional ones
## Install
```sh
$ npm install --save array-differ
```
## Usage
```js
var arrayDiffer = require('array-differ');
arrayDiffer([2, 3, 4], [3, 50]);
//=> [2, 4]
```
## API
### arrayDiffer(input, values, [values, ...])
Returns the new array.
#### input
Type: `array`
#### values
Type: `array`
Arrays of values to exclude.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,60 @@
'use strict';
// there's 3 implementations written in increasing order of efficiency
// 1 - no Set type is defined
function uniqNoSet(arr) {
var ret = [];
for (var i = 0; i < arr.length; i++) {
if (ret.indexOf(arr[i]) === -1) {
ret.push(arr[i]);
}
}
return ret;
}
// 2 - a simple Set type is defined
function uniqSet(arr) {
var seen = new Set();
return arr.filter(function (el) {
if (!seen.has(el)) {
seen.add(el);
return true;
}
});
}
// 3 - a standard Set type is defined and it has a forEach method
function uniqSetWithForEach(arr) {
var ret = [];
(new Set(arr)).forEach(function (el) {
ret.push(el);
});
return ret;
}
// V8 currently has a broken implementation
// https://github.com/joyent/node/issues/8449
function doesForEachActuallyWork() {
var ret = false;
(new Set([true])).forEach(function (el) {
ret = el;
});
return ret === true;
}
if ('Set' in global) {
if (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) {
module.exports = uniqSetWithForEach;
} else {
module.exports = uniqSet;
}
} else {
module.exports = uniqNoSet;
}

View File

@@ -0,0 +1,66 @@
{
"name": "array-uniq",
"version": "1.0.2",
"description": "Create an array without duplicates",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/sindresorhus/array-uniq"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"files": [
"index.js"
],
"keywords": [
"array",
"arr",
"set",
"uniq",
"unique",
"es6",
"duplicate",
"remove"
],
"devDependencies": {
"es6-set": "^0.1.0",
"mocha": "*",
"require-uncached": "^1.0.2"
},
"gitHead": "d5e311f37692dfd25ec216490df10632ce5f69f3",
"bugs": {
"url": "https://github.com/sindresorhus/array-uniq/issues"
},
"homepage": "https://github.com/sindresorhus/array-uniq",
"_id": "array-uniq@1.0.2",
"_shasum": "5fcc373920775723cfd64d65c64bef53bf9eba6d",
"_from": "array-uniq@^1.0.2",
"_npmVersion": "2.1.5",
"_nodeVersion": "0.10.32",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"dist": {
"shasum": "5fcc373920775723cfd64d65c64bef53bf9eba6d",
"tarball": "http://registry.npmjs.org/array-uniq/-/array-uniq-1.0.2.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.2.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,30 @@
# array-uniq [![Build Status](https://travis-ci.org/sindresorhus/array-uniq.svg?branch=master)](https://travis-ci.org/sindresorhus/array-uniq)
> Create an array without duplicates
It's already pretty fast, but will be much faster when [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) becomes available in V8 (especially with large arrays).
## Install
```sh
$ npm install --save array-uniq
```
## Usage
```js
var arrayUniq = require('array-uniq');
arrayUniq([1, 1, 2, 3, 3]);
//=> [1, 2, 3]
arrayUniq(['foo', 'foo', 'bar', 'foo']);
//=> ['foo', 'bar']
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,61 @@
'use strict';
var BEEP_DELAY = 500;
if (!process.stdout.isTTY ||
process.argv.indexOf('--no-beep') !== -1 ||
process.argv.indexOf('--beep=false') !== -1) {
module.exports = function () {};
return;
}
function beep() {
process.stdout.write('\u0007');
}
function melodicalBeep(val, cb) {
if (val.length === 0) {
cb();
return;
}
setTimeout(function () {
if (val.shift() === '*') {
beep();
}
melodicalBeep(val, cb);
}, BEEP_DELAY);
}
module.exports = function (val, cb) {
cb = cb || function () {};
if (val === parseInt(val)) {
if (val < 0) {
throw new TypeError('Negative numbers are not accepted');
}
if (val === 0) {
cb();
return;
}
for (var i = 0; i < val; i++) {
setTimeout(function (i) {
beep();
if (i === val - 1) {
cb();
}
}, BEEP_DELAY * i, i);
}
} else if (!val) {
beep();
cb();
} else if (typeof val === 'string') {
melodicalBeep(val.split(''), cb);
} else {
throw new TypeError('Not an accepted type');
}
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,68 @@
{
"name": "beeper",
"version": "1.1.0",
"description": "Make your terminal beep",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/sindresorhus/beeper"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "node test.js"
},
"files": [
"index.js"
],
"keywords": [
"beep",
"beeper",
"boop",
"terminal",
"term",
"cli",
"console",
"ding",
"ping",
"alert",
"gulpfriendly"
],
"devDependencies": {
"hooker": "^0.2.3",
"tape": "^4.0.0"
},
"gitHead": "8beb0413a8028ca2d52dbb86c75f42069535591b",
"bugs": {
"url": "https://github.com/sindresorhus/beeper/issues"
},
"homepage": "https://github.com/sindresorhus/beeper",
"_id": "beeper@1.1.0",
"_shasum": "9ee6fc1ce7f54feaace7ce73588b056037866a2c",
"_from": "beeper@^1.0.0",
"_npmVersion": "2.10.1",
"_nodeVersion": "0.12.4",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"dist": {
"shasum": "9ee6fc1ce7f54feaace7ce73588b056037866a2c",
"tarball": "http://registry.npmjs.org/beeper/-/beeper-1.1.0.tgz"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"directories": {},
"_resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.0.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,55 @@
# beeper [![Build Status](https://travis-ci.org/sindresorhus/beeper.svg?branch=master)](https://travis-ci.org/sindresorhus/beeper)
> Make your terminal beep
![](https://cloud.githubusercontent.com/assets/170270/5261236/f8471100-7a49-11e4-81af-96cd09a522d9.gif)
Useful as an attention grabber e.g. when an error happens.
## Install
```
$ npm install --save beeper
```
## Usage
```js
var beeper = require('beeper');
beeper();
// beep one time
beeper(3);
// beep three times
beeper('****-*-*');
// beep, beep, beep, beep, pause, beep, pause, beep
```
## API
It will not beep if stdout is not TTY or if the user supplies the `--no-beep` flag.
### beeper([count|melody], [callback])
#### count
Type: `number`
Default: `1`
How many times you want it to beep.
#### melody
Type: `string`
Construct your own melody by supplying a string of `*` for beep `-` for pause.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,116 @@
'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 isSimpleWindowsTerm = process.platform === 'win32' && !/^xterm/i.test(process.env.TERM);
function Chalk(options) {
// detect mode if not set manually
this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled;
}
// use bright blue on Windows as the normal blue color is illegible
if (isSimpleWindowsTerm) {
ansiStyles.blue.open = '\u001b[94m';
}
var styles = (function () {
var ret = {};
Object.keys(ansiStyles).forEach(function (key) {
ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
ret[key] = {
get: function () {
return build.call(this, this._styles.concat(key));
}
};
});
return ret;
})();
var proto = defineProps(function chalk() {}, styles);
function build(_styles) {
var builder = function () {
return applyStyle.apply(builder, arguments);
};
builder._styles = _styles;
builder.enabled = this.enabled;
// __proto__ is used because we must return a function, but there is
// no way to create a function with a different prototype.
/* eslint-disable no-proto */
builder.__proto__ = proto;
return builder;
}
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 (!this.enabled || !str) {
return str;
}
var nestedStyles = this._styles;
var i = nestedStyles.length;
// Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
// see https://github.com/chalk/chalk/issues/58
// If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
var originalDim = ansiStyles.dim.open;
if (isSimpleWindowsTerm && (nestedStyles.indexOf('gray') !== -1 || nestedStyles.indexOf('grey') !== -1)) {
ansiStyles.dim.open = '';
}
while (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;
}
// Reset the original 'dim' if we changed it to work around the Windows dimmed gray issue.
ansiStyles.dim.open = originalDim;
return str;
}
function init() {
var ret = {};
Object.keys(styles).forEach(function (name) {
ret[name] = {
get: function () {
return build.call(this, [name]);
}
};
});
return ret;
}
defineProps(Chalk.prototype, init());
module.exports = new Chalk();
module.exports.styles = ansiStyles;
module.exports.hasColor = hasAnsi;
module.exports.stripColor = stripAnsi;
module.exports.supportsColor = supportsColor;

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,65 @@
'use strict';
function assembleStyles () {
var styles = {
modifiers: {
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]
},
colors: {
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]
},
bgColors: {
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49],
bgMagenta: [45, 49],
bgCyan: [46, 49],
bgWhite: [47, 49]
}
};
// fix humans
styles.colors.grey = styles.colors.gray;
Object.keys(styles).forEach(function (groupName) {
var group = styles[groupName];
Object.keys(group).forEach(function (styleName) {
var style = group[styleName];
styles[styleName] = group[styleName] = {
open: '\u001b[' + style[0] + 'm',
close: '\u001b[' + style[1] + 'm'
};
});
Object.defineProperty(styles, groupName, {
value: group,
enumerable: false
});
});
return styles;
}
Object.defineProperty(module, 'exports', {
enumerable: true,
get: assembleStyles
});

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,80 @@
{
"name": "ansi-styles",
"version": "2.1.0",
"description": "ANSI escape codes for styling strings in the terminal",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/chalk/ansi-styles"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
{
"name": "jbnicolai",
"email": "jappelman@xebia.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": "*"
},
"gitHead": "18421cbe4a2d93359ec2599a894f704be126d066",
"bugs": {
"url": "https://github.com/chalk/ansi-styles/issues"
},
"homepage": "https://github.com/chalk/ansi-styles",
"_id": "ansi-styles@2.1.0",
"_shasum": "990f747146927b559a932bf92959163d60c0d0e2",
"_from": "ansi-styles@^2.1.0",
"_npmVersion": "2.10.1",
"_nodeVersion": "0.12.4",
"_npmUser": {
"name": "jbnicolai",
"email": "jappelman@xebia.com"
},
"dist": {
"shasum": "990f747146927b559a932bf92959163d60c0d0e2",
"tarball": "http://registry.npmjs.org/ansi-styles/-/ansi-styles-2.1.0.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.1.0.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,86 @@
# ansi-styles [![Build Status](https://travis-ci.org/chalk/ansi-styles.svg?branch=master)](https://travis-ci.org/chalk/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/chalk/chalk) module for styling your strings.
![](screenshot.png)
## Install
```
$ 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
### Modifiers
- `reset`
- `bold`
- `dim`
- `italic` *(not widely supported)*
- `underline`
- `inverse`
- `hidden`
- `strikethrough` *(not widely supported)*
### Colors
- `black`
- `red`
- `green`
- `yellow`
- `blue`
- `magenta`
- `cyan`
- `white`
- `gray`
### Background colors
- `bgBlack`
- `bgRed`
- `bgGreen`
- `bgYellow`
- `bgBlue`
- `bgMagenta`
- `bgCyan`
- `bgWhite`
## Advanced usage
By default you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module.
- `ansi.modifiers`
- `ansi.colors`
- `ansi.bgColors`
###### Example
```js
console.log(ansi.colors.green.open);
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View 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, '\\$&');
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,70 @@
{
"name": "escape-string-regexp",
"version": "1.0.3",
"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"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
{
"name": "jbnicolai",
"email": "jappelman@xebia.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": "1e446e6b4449b5f1f8868cd31bf8fd25ee37fb4b",
"bugs": {
"url": "https://github.com/sindresorhus/escape-string-regexp/issues"
},
"homepage": "https://github.com/sindresorhus/escape-string-regexp",
"_id": "escape-string-regexp@1.0.3",
"_shasum": "9e2d8b25bc2555c3336723750e03f099c2735bb5",
"_from": "escape-string-regexp@^1.0.2",
"_npmVersion": "2.1.16",
"_nodeVersion": "0.10.35",
"_npmUser": {
"name": "jbnicolai",
"email": "jappelman@xebia.com"
},
"dist": {
"shasum": "9e2d8b25bc2555c3336723750e03f099c2735bb5",
"tarball": "http://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,27 @@
# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](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)

View 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);

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,4 @@
'use strict';
module.exports = function () {
return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,86 @@
{
"name": "ansi-regex",
"version": "2.0.0",
"description": "Regular expression for matching ANSI escape codes",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/sindresorhus/ansi-regex"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
{
"name": "jbnicolai",
"email": "jappelman@xebia.com"
}
],
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha test/test.js",
"view-supported": "node test/viewCodes.js"
},
"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": "*"
},
"gitHead": "57c3f2941a73079fa8b081e02a522e3d29913e2f",
"bugs": {
"url": "https://github.com/sindresorhus/ansi-regex/issues"
},
"homepage": "https://github.com/sindresorhus/ansi-regex",
"_id": "ansi-regex@2.0.0",
"_shasum": "c5061b6e0ef8a81775e50f5d66151bf6bf371107",
"_from": "ansi-regex@^2.0.0",
"_npmVersion": "2.11.2",
"_nodeVersion": "0.12.5",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"dist": {
"shasum": "c5061b6e0ef8a81775e50f5d66151bf6bf371107",
"tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,31 @@
# ansi-regex [![Build Status](https://travis-ci.org/sindresorhus/ansi-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-regex)
> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
## Install
```
$ 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']
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,85 @@
{
"name": "has-ansi",
"version": "2.0.0",
"description": "Check if a string has ANSI escape codes",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/sindresorhus/has-ansi"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
{
"name": "jbnicolai",
"email": "jappelman@xebia.com"
}
],
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "node test.js"
},
"files": [
"index.js"
],
"keywords": [
"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": "^2.0.0"
},
"devDependencies": {
"ava": "0.0.4"
},
"gitHead": "0722275e1bef139fcd09137da6e5550c3cd368b9",
"bugs": {
"url": "https://github.com/sindresorhus/has-ansi/issues"
},
"homepage": "https://github.com/sindresorhus/has-ansi",
"_id": "has-ansi@2.0.0",
"_shasum": "34f5049ce1ecdf2b0649af3ef24e45ed35416d91",
"_from": "has-ansi@^2.0.0",
"_npmVersion": "2.11.2",
"_nodeVersion": "0.12.5",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"dist": {
"shasum": "34f5049ce1ecdf2b0649af3ef24e45ed35416d91",
"tarball": "http://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,36 @@
# has-ansi [![Build Status](https://travis-ci.org/sindresorhus/has-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/has-ansi)
> Check if a string has [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
## Install
```
$ npm install --save has-ansi
```
## Usage
```js
var hasAnsi = require('has-ansi');
hasAnsi('\u001b[4mcake\u001b[0m');
//=> true
hasAnsi('cake');
//=> false
```
## Related
- [has-ansi-cli](https://github.com/sindresorhus/has-ansi-cli) - CLI for this module
- [strip-ansi](https://github.com/sindresorhus/strip-ansi) - Strip ANSI escape codes
- [ansi-regex](https://github.com/sindresorhus/ansi-regex) - Regular expression for matching ANSI escape codes
- [chalk](https://github.com/sindresorhus/chalk) - Terminal string styling done right
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,6 @@
'use strict';
var ansiRegex = require('ansi-regex')();
module.exports = function (str) {
return typeof str === 'string' ? str.replace(ansiRegex, '') : str;
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,4 @@
'use strict';
module.exports = function () {
return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,86 @@
{
"name": "ansi-regex",
"version": "2.0.0",
"description": "Regular expression for matching ANSI escape codes",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/sindresorhus/ansi-regex"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
{
"name": "jbnicolai",
"email": "jappelman@xebia.com"
}
],
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha test/test.js",
"view-supported": "node test/viewCodes.js"
},
"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": "*"
},
"gitHead": "57c3f2941a73079fa8b081e02a522e3d29913e2f",
"bugs": {
"url": "https://github.com/sindresorhus/ansi-regex/issues"
},
"homepage": "https://github.com/sindresorhus/ansi-regex",
"_id": "ansi-regex@2.0.0",
"_shasum": "c5061b6e0ef8a81775e50f5d66151bf6bf371107",
"_from": "ansi-regex@^2.0.0",
"_npmVersion": "2.11.2",
"_nodeVersion": "0.12.5",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"dist": {
"shasum": "c5061b6e0ef8a81775e50f5d66151bf6bf371107",
"tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,31 @@
# ansi-regex [![Build Status](https://travis-ci.org/sindresorhus/ansi-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-regex)
> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
## Install
```
$ 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']
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,85 @@
{
"name": "strip-ansi",
"version": "3.0.0",
"description": "Strip ANSI escape codes",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/sindresorhus/strip-ansi"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
{
"name": "jbnicolai",
"email": "jappelman@xebia.com"
}
],
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "node test.js"
},
"files": [
"index.js"
],
"keywords": [
"strip",
"trim",
"remove",
"ansi",
"styles",
"color",
"colour",
"colors",
"terminal",
"console",
"string",
"tty",
"escape",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"dependencies": {
"ansi-regex": "^2.0.0"
},
"devDependencies": {
"ava": "0.0.4"
},
"gitHead": "3f05b9810e1438f946e2eb84ee854cc00b972e9e",
"bugs": {
"url": "https://github.com/sindresorhus/strip-ansi/issues"
},
"homepage": "https://github.com/sindresorhus/strip-ansi",
"_id": "strip-ansi@3.0.0",
"_shasum": "7510b665567ca914ccb5d7e072763ac968be3724",
"_from": "strip-ansi@^3.0.0",
"_npmVersion": "2.11.2",
"_nodeVersion": "0.12.5",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"dist": {
"shasum": "7510b665567ca914ccb5d7e072763ac968be3724",
"tarball": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.0.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.0.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,33 @@
# strip-ansi [![Build Status](https://travis-ci.org/sindresorhus/strip-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-ansi)
> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
## Install
```
$ npm install --save strip-ansi
```
## Usage
```js
var stripAnsi = require('strip-ansi');
stripAnsi('\u001b[4mcake\u001b[0m');
//=> 'cake'
```
## Related
- [strip-ansi-cli](https://github.com/sindresorhus/strip-ansi-cli) - CLI for this module
- [has-ansi](https://github.com/sindresorhus/has-ansi) - Check if a string has ANSI escape codes
- [ansi-regex](https://github.com/sindresorhus/ansi-regex) - Regular expression for matching ANSI escape codes
- [chalk](https://github.com/sindresorhus/chalk) - Terminal string styling done right
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,50 @@
'use strict';
var argv = process.argv;
var terminator = argv.indexOf('--');
var hasFlag = function (flag) {
flag = '--' + flag;
var pos = argv.indexOf(flag);
return pos !== -1 && (terminator !== -1 ? pos < terminator : true);
};
module.exports = (function () {
if ('FORCE_COLOR' in process.env) {
return true;
}
if (hasFlag('no-color') ||
hasFlag('no-colors') ||
hasFlag('color=false')) {
return false;
}
if (hasFlag('color') ||
hasFlag('colors') ||
hasFlag('color=true') ||
hasFlag('color=always')) {
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;
})();

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,79 @@
{
"name": "supports-color",
"version": "2.0.0",
"description": "Detect whether a terminal supports color",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/chalk/supports-color"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
{
"name": "jbnicolai",
"email": "jappelman@xebia.com"
}
],
"engines": {
"node": ">=0.8.0"
},
"scripts": {
"test": "mocha"
},
"files": [
"index.js"
],
"keywords": [
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"ansi",
"styles",
"tty",
"rgb",
"256",
"shell",
"xterm",
"command-line",
"support",
"supports",
"capability",
"detect"
],
"devDependencies": {
"mocha": "*",
"require-uncached": "^1.0.2"
},
"gitHead": "8400d98ade32b2adffd50902c06d9e725a5c6588",
"bugs": {
"url": "https://github.com/chalk/supports-color/issues"
},
"homepage": "https://github.com/chalk/supports-color",
"_id": "supports-color@2.0.0",
"_shasum": "535d045ce6b6363fa40117084629995e9df324c7",
"_from": "supports-color@^2.0.0",
"_npmVersion": "2.11.2",
"_nodeVersion": "0.12.5",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"dist": {
"shasum": "535d045ce6b6363fa40117084629995e9df324c7",
"tarball": "http://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,36 @@
# supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color)
> Detect whether a terminal supports color
## Install
```
$ 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.
For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`.
## Related
- [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module
- [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,103 @@
{
"name": "chalk",
"version": "1.1.1",
"description": "Terminal string styling done right. Much color.",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/chalk/chalk.git"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
{
"name": "jbnicolai",
"email": "jappelman@xebia.com"
},
{
"name": "unicorn",
"email": "sindresorhus+unicorn@gmail.com"
}
],
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && mocha",
"bench": "matcha benchmark.js",
"coverage": "nyc npm test && nyc report",
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
},
"files": [
"index.js"
],
"keywords": [
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"str",
"ansi",
"style",
"styles",
"tty",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"dependencies": {
"ansi-styles": "^2.1.0",
"escape-string-regexp": "^1.0.2",
"has-ansi": "^2.0.0",
"strip-ansi": "^3.0.0",
"supports-color": "^2.0.0"
},
"devDependencies": {
"coveralls": "^2.11.2",
"matcha": "^0.6.0",
"mocha": "*",
"nyc": "^3.0.0",
"require-uncached": "^1.0.2",
"resolve-from": "^1.0.0",
"semver": "^4.3.3",
"xo": "*"
},
"xo": {
"envs": [
"node",
"mocha"
]
},
"gitHead": "8b554e254e89c85c1fd04dcc444beeb15824e1a5",
"bugs": {
"url": "https://github.com/chalk/chalk/issues"
},
"homepage": "https://github.com/chalk/chalk#readme",
"_id": "chalk@1.1.1",
"_shasum": "509afb67066e7499f7eb3535c77445772ae2d019",
"_from": "chalk@^1.0.0",
"_npmVersion": "2.13.5",
"_nodeVersion": "0.12.7",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"dist": {
"shasum": "509afb67066e7499f7eb3535c77445772ae2d019",
"tarball": "http://registry.npmjs.org/chalk/-/chalk-1.1.1.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.1.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,213 @@
<h1 align="center">
<br>
<br>
<img width="360" src="https://cdn.rawgit.com/chalk/chalk/19935d6484811c5e468817f846b7b3d417d7bf4a/logo.svg" alt="chalk">
<br>
<br>
<br>
</h1>
> Terminal string styling done right
[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk)
[![Coverage Status](https://coveralls.io/repos/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/r/chalk/chalk?branch=master)
[![](http://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4)
[colors.js](https://github.com/Marak/colors.js) used to be 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.**
![](https://github.com/chalk/ansi-styles/raw/master/screenshot.png)
## 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 ~4500 modules](https://www.npmjs.com/browse/depended/chalk) as of July 15, 2015
## Install
```
$ 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
chalk.blue('Hello world!');
// combine styled and normal strings
chalk.blue('Hello') + 'World' + chalk.red('!');
// compose multiple styles using the chainable API
chalk.blue.bgRed.bold('Hello world!');
// pass in multiple arguments
chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz');
// nest styles
chalk.red('Hello', chalk.underline.bgBlue('world') + '!');
// nest styles of the same type even (color, underline, background)
chalk.green(
'I am a green line ' +
chalk.blue.underline.bold('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, and later styles take precedent in case of a conflict. This simply means that `Chalk.red.yellow.green` is equivalent to `Chalk.green`.
Multiple arguments will be separated by space.
### chalk.enabled
Color support is automatically detected, but you can override it by setting the `enabled` property. You should however only do this in your own code as it applies globally to all chalk consumers.
If you need to change this in a reusable module create a new instance:
```js
var ctx = new chalk.constructor({enabled: false});
```
### chalk.supportsColor
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`.
### chalk.styles
Exposes the styles as [ANSI escape codes](https://github.com/chalk/ansi-styles).
Generally not useful, but you might need just the `.open` or `.close` escape code if you're mixing externally styled strings with your own.
```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/chalk/has-ansi).
### chalk.stripColor(string)
[Strip color](https://github.com/chalk/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
### Modifiers
- `reset`
- `bold`
- `dim`
- `italic` *(not widely supported)*
- `underline`
- `inverse`
- `hidden`
- `strikethrough` *(not widely supported)*
### Colors
- `black`
- `red`
- `green`
- `yellow`
- `blue` *(on Windows the bright version is used as normal blue is illegible)*
- `magenta`
- `cyan`
- `white`
- `gray`
### Background colors
- `bgBlack`
- `bgRed`
- `bgGreen`
- `bgYellow`
- `bgBlue`
- `bgMagenta`
- `bgCyan`
- `bgWhite`
## 256-colors
Chalk does not support anything other than the base eight colors, which guarantees it will work on all terminals and systems. Some terminals, specifically `xterm` compliant ones, will support the full range of 8-bit colors. For this the lower level [ansi-256-colors](https://github.com/jbnicolai/ansi-256-colors) package can be used.
## Windows
If you're on Windows, do yourself a favor and use [`cmder`](http://bliker.github.io/cmder/) instead of `cmd.exe`.
## Related
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
- [ansi-styles](https://github.com/chalk/ansi-styles/) - ANSI escape codes for styling strings in the terminal
- [supports-color](https://github.com/chalk/supports-color/) - Detect whether a terminal supports color
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,57 @@
# .gitignore <https://github.com/tunnckoCore/dotfiles>
#
# Copyright (c) 2014 Charlike Mike Reagent, contributors.
# Released under the MIT license.
#
# Always-ignore dirs #
# ####################
_gh_pages
node_modules
bower_components
components
vendor
build
dest
dist
src
lib-cov
coverage
nbproject
cache
temp
tmp
# Packages #
# ##########
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip
# OS, Logs and databases #
# #########################
*.pid
*.dat
*.log
*.sql
*.sqlite
*~
~*
# Another files #
# ###############
Icon?
.DS_Store*
Thumbs.db
ehthumbs.db
Desktop.ini
npm-debug.log
.directory
._*
koa-better-body

View File

@@ -0,0 +1,4 @@
language: node_js
node_js:
- "0.11"
- "0.10"

View File

@@ -0,0 +1,20 @@
(c) 2007-2009 Steven Levithan <stevenlevithan.com>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,82 @@
# dateformat
A node.js package for Steven Levithan's excellent [dateFormat()][dateformat] function.
[![Build Status](https://travis-ci.org/felixge/node-dateformat.svg)](https://travis-ci.org/felixge/node-dateformat)
## Modifications
* Removed the `Date.prototype.format` method. Sorry folks, but extending native prototypes is for suckers.
* Added a `module.exports = dateFormat;` statement at the bottom
* Added the placeholder `N` to get the ISO 8601 numeric representation of the day of the week
## Installation
```bash
$ npm install dateformat
$ dateformat --help
```
## Usage
As taken from Steven's post, modified to match the Modifications listed above:
```js
var dateFormat = require('dateformat');
var now = new Date();
// Basic usage
dateFormat(now, "dddd, mmmm dS, yyyy, h:MM:ss TT");
// Saturday, June 9th, 2007, 5:46:21 PM
// You can use one of several named masks
dateFormat(now, "isoDateTime");
// 2007-06-09T17:46:21
// ...Or add your own
dateFormat.masks.hammerTime = 'HH:MM! "Can\'t touch this!"';
dateFormat(now, "hammerTime");
// 17:46! Can't touch this!
// When using the standalone dateFormat function,
// you can also provide the date as a string
dateFormat("Jun 9 2007", "fullDate");
// Saturday, June 9, 2007
// Note that if you don't include the mask argument,
// dateFormat.masks.default is used
dateFormat(now);
// Sat Jun 09 2007 17:46:21
// And if you don't include the date argument,
// the current date and time is used
dateFormat();
// Sat Jun 09 2007 17:46:22
// You can also skip the date argument (as long as your mask doesn't
// contain any numbers), in which case the current date/time is used
dateFormat("longTime");
// 5:46:22 PM EST
// And finally, you can convert local time to UTC time. Simply pass in
// true as an additional argument (no argument skipping allowed in this case):
dateFormat(now, "longTime", true);
// 10:46:21 PM UTC
// ...Or add the prefix "UTC:" or "GMT:" to your mask.
dateFormat(now, "UTC:h:MM:ss TT Z");
// 10:46:21 PM UTC
// You can also get the ISO 8601 week of the year:
dateFormat(now, "W");
// 42
// and also get the ISO 8601 numeric representation of the day of the week:
dateFormat(now,"N");
// 6
```
## License
(c) 2007-2009 Steven Levithan [stevenlevithan.com][stevenlevithan], MIT license.
[dateformat]: http://blog.stevenlevithan.com/archives/date-time-format
[stevenlevithan]: http://stevenlevithan.com/

View File

@@ -0,0 +1,75 @@
#!/usr/bin/env node
/**
* dateformat <https://github.com/felixge/node-dateformat>
*
* Copyright (c) 2014 Charlike Mike Reagent (cli), contributors.
* Released under the MIT license.
*/
'use strict';
/**
* Module dependencies.
*/
var dateFormat = require('../lib/dateformat');
var meow = require('meow');
var stdin = require('get-stdin');
var cli = meow({
pkg: '../package.json',
help: [
'Options',
' --help Show this help',
' --version Current version of package',
' -d | --date Date that want to format (Date object as Number or String)',
' -m | --mask Mask that will use to format the date',
' -u | --utc Convert local time to UTC time or use `UTC:` prefix in mask',
' -g | --gmt You can use `GMT:` prefix in mask',
'',
'Usage',
' dateformat [date] [mask]',
' dateformat "Nov 26 2014" "fullDate"',
' dateformat 1416985417095 "dddd, mmmm dS, yyyy, h:MM:ss TT"',
' dateformat 1315361943159 "W"',
' dateformat "UTC:h:MM:ss TT Z"',
' dateformat "longTime" true',
' dateformat "longTime" false true',
' dateformat "Jun 9 2007" "fullDate" true',
' date +%s | dateformat',
''
].join('\n')
})
var date = cli.input[0] || cli.flags.d || cli.flags.date || Date.now();
var mask = cli.input[1] || cli.flags.m || cli.flags.mask || dateFormat.masks.default;
var utc = cli.input[2] || cli.flags.u || cli.flags.utc || false;
var gmt = cli.input[3] || cli.flags.g || cli.flags.gmt || false;
utc = utc === 'true' ? true : false;
gmt = gmt === 'true' ? true : false;
if (!cli.input.length) {
stdin(function(date) {
console.log(dateFormat(date, dateFormat.masks.default, utc, gmt));
});
return;
}
if (cli.input.length === 1 && date) {
mask = date;
date = Date.now();
console.log(dateFormat(date, mask, utc, gmt));
return;
}
if (cli.input.length >= 2 && date && mask) {
if (mask === 'true' || mask === 'false') {
utc = mask === 'true' ? true : false;
gmt = !utc;
mask = date
date = Date.now();
}
console.log(dateFormat(date, mask, utc, gmt));
return;
}

View File

@@ -0,0 +1,226 @@
/*
* Date Format 1.2.3
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>
* MIT license
*
* Includes enhancements by Scott Trenda <scott.trenda.net>
* and Kris Kowal <cixar.com/~kris.kowal/>
*
* Accepts a date, a mask, or a date and a mask.
* Returns a formatted version of the given date.
* The date defaults to the current date/time.
* The mask defaults to dateFormat.masks.default.
*/
(function(global) {
'use strict';
var dateFormat = (function() {
var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g;
var timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g;
var timezoneClip = /[^-+\dA-Z]/g;
// Regexes and supporting functions are cached through closure
return function (date, mask, utc, gmt) {
// You can't provide utc if you skip other args (use the 'UTC:' mask prefix)
if (arguments.length === 1 && kindOf(date) === 'string' && !/\d/.test(date)) {
mask = date;
date = undefined;
}
date = date || new Date;
if(!(date instanceof Date)) {
date = new Date(date);
}
if (isNaN(date)) {
throw TypeError('Invalid date');
}
mask = String(dateFormat.masks[mask] || mask || dateFormat.masks['default']);
// Allow setting the utc/gmt argument via the mask
var maskSlice = mask.slice(0, 4);
if (maskSlice === 'UTC:' || maskSlice === 'GMT:') {
mask = mask.slice(4);
utc = true;
if (maskSlice === 'GMT:') {
gmt = true;
}
}
var _ = utc ? 'getUTC' : 'get';
var d = date[_ + 'Date']();
var D = date[_ + 'Day']();
var m = date[_ + 'Month']();
var y = date[_ + 'FullYear']();
var H = date[_ + 'Hours']();
var M = date[_ + 'Minutes']();
var s = date[_ + 'Seconds']();
var L = date[_ + 'Milliseconds']();
var o = utc ? 0 : date.getTimezoneOffset();
var W = getWeek(date);
var N = getDayOfWeek(date);
var flags = {
d: d,
dd: pad(d),
ddd: dateFormat.i18n.dayNames[D],
dddd: dateFormat.i18n.dayNames[D + 7],
m: m + 1,
mm: pad(m + 1),
mmm: dateFormat.i18n.monthNames[m],
mmmm: dateFormat.i18n.monthNames[m + 12],
yy: String(y).slice(2),
yyyy: y,
h: H % 12 || 12,
hh: pad(H % 12 || 12),
H: H,
HH: pad(H),
M: M,
MM: pad(M),
s: s,
ss: pad(s),
l: pad(L, 3),
L: pad(Math.round(L / 10)),
t: H < 12 ? 'a' : 'p',
tt: H < 12 ? 'am' : 'pm',
T: H < 12 ? 'A' : 'P',
TT: H < 12 ? 'AM' : 'PM',
Z: gmt ? 'GMT' : utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),
o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],
W: W,
N: N
};
return mask.replace(token, function (match) {
if (match in flags) {
return flags[match];
}
return match.slice(1, match.length - 1);
});
};
})();
dateFormat.masks = {
'default': 'ddd mmm dd yyyy HH:MM:ss',
'shortDate': 'm/d/yy',
'mediumDate': 'mmm d, yyyy',
'longDate': 'mmmm d, yyyy',
'fullDate': 'dddd, mmmm d, yyyy',
'shortTime': 'h:MM TT',
'mediumTime': 'h:MM:ss TT',
'longTime': 'h:MM:ss TT Z',
'isoDate': 'yyyy-mm-dd',
'isoTime': 'HH:MM:ss',
'isoDateTime': 'yyyy-mm-dd\'T\'HH:MM:sso',
'isoUtcDateTime': 'UTC:yyyy-mm-dd\'T\'HH:MM:ss\'Z\'',
'expiresHeaderFormat': 'ddd, dd mmm yyyy HH:MM:ss Z'
};
// Internationalization strings
dateFormat.i18n = {
dayNames: [
'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
],
monthNames: [
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
]
};
function pad(val, len) {
val = String(val);
len = len || 2;
while (val.length < len) {
val = '0' + val;
}
return val;
}
/**
* Get the ISO 8601 week number
* Based on comments from
* http://techblog.procurios.nl/k/n618/news/view/33796/14863/Calculate-ISO-8601-week-and-year-in-javascript.html
*
* @param {Object} `date`
* @return {Number}
*/
function getWeek(date) {
// Remove time components of date
var targetThursday = new Date(date.getFullYear(), date.getMonth(), date.getDate());
// Change date to Thursday same week
targetThursday.setDate(targetThursday.getDate() - ((targetThursday.getDay() + 6) % 7) + 3);
// Take January 4th as it is always in week 1 (see ISO 8601)
var firstThursday = new Date(targetThursday.getFullYear(), 0, 4);
// Change date to Thursday same week
firstThursday.setDate(firstThursday.getDate() - ((firstThursday.getDay() + 6) % 7) + 3);
// Check if daylight-saving-time-switch occured and correct for it
var ds = targetThursday.getTimezoneOffset() - firstThursday.getTimezoneOffset();
targetThursday.setHours(targetThursday.getHours() - ds);
// Number of weeks between target Thursday and first Thursday
var weekDiff = (targetThursday - firstThursday) / (86400000*7);
return 1 + Math.floor(weekDiff);
}
/**
* Get ISO-8601 numeric representation of the day of the week
* 1 (for Monday) through 7 (for Sunday)
*
* @param {Object} `date`
* @return {Number}
*/
function getDayOfWeek(date) {
var dow = date.getDay();
if(dow === 0) {
dow = 7;
}
return dow;
}
/**
* kind-of shortcut
* @param {*} val
* @return {String}
*/
function kindOf(val) {
if (val === null) {
return 'null';
}
if (val === undefined) {
return 'undefined';
}
if (typeof val !== 'object') {
return typeof val;
}
if (Array.isArray(val)) {
return 'array';
}
return {}.toString.call(val)
.slice(8, -1).toLowerCase();
};
if (typeof define === 'function' && define.amd) {
define(function () {
return dateFormat;
});
} else if (typeof exports === 'object') {
module.exports = dateFormat;
} else {
global.dateFormat = dateFormat;
}
})(this);

View File

@@ -0,0 +1,49 @@
'use strict';
module.exports = function (cb) {
var stdin = process.stdin;
var ret = '';
if (stdin.isTTY) {
setImmediate(cb, '');
return;
}
stdin.setEncoding('utf8');
stdin.on('readable', function () {
var chunk;
while (chunk = stdin.read()) {
ret += chunk;
}
});
stdin.on('end', function () {
cb(ret);
});
};
module.exports.buffer = function (cb) {
var stdin = process.stdin;
var ret = [];
var len = 0;
if (stdin.isTTY) {
setImmediate(cb, new Buffer(''));
return;
}
stdin.on('readable', function () {
var chunk;
while (chunk = stdin.read()) {
ret.push(chunk);
len += chunk.length;
}
});
stdin.on('end', function () {
cb(Buffer.concat(ret, len));
});
};

View File

@@ -0,0 +1,64 @@
{
"name": "get-stdin",
"version": "4.0.1",
"description": "Easier stdin",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/sindresorhus/get-stdin"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "node test.js && node test-buffer.js && echo unicorns | node test-real.js"
},
"files": [
"index.js"
],
"keywords": [
"std",
"stdin",
"stdio",
"concat",
"buffer",
"stream",
"process",
"stream"
],
"devDependencies": {
"ava": "0.0.4",
"buffer-equal": "0.0.1"
},
"gitHead": "65c744975229b25d6cc5c7546f49b6ad9099553f",
"bugs": {
"url": "https://github.com/sindresorhus/get-stdin/issues"
},
"homepage": "https://github.com/sindresorhus/get-stdin",
"_id": "get-stdin@4.0.1",
"_shasum": "b968c6b0a04384324902e8bf1a5df32579a450fe",
"_from": "get-stdin@^4.0.1",
"_npmVersion": "1.4.28",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"dist": {
"shasum": "b968c6b0a04384324902e8bf1a5df32579a450fe",
"tarball": "http://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,44 @@
# get-stdin [![Build Status](https://travis-ci.org/sindresorhus/get-stdin.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stdin)
> Easier stdin
## Install
```sh
$ npm install --save get-stdin
```
## Usage
```js
// example.js
var stdin = require('get-stdin');
stdin(function (data) {
console.log(data);
//=> unicorns
});
```
```sh
$ echo unicorns | node example.js
unicorns
```
## API
### stdin(callback)
Get `stdin` as a string.
### stdin.buffer(callback)
Get `stdin` as a buffer.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,74 @@
'use strict';
var path = require('path');
var minimist = require('minimist');
var objectAssign = require('object-assign');
var camelcaseKeys = require('camelcase-keys');
var trimNewlines = require('trim-newlines');
var redent = require('redent');
var readPkgUp = require('read-pkg-up');
var loudRejection = require('loud-rejection');
var normalizePackageData = require('normalize-package-data');
// get the uncached parent
delete require.cache[__filename];
var parentDir = path.dirname(module.parent.filename);
module.exports = function (opts, minimistOpts) {
loudRejection();
if (Array.isArray(opts) || typeof opts === 'string') {
opts = {help: opts};
}
opts = objectAssign({
pkg: readPkgUp.sync({
cwd: parentDir,
normalize: false
}).pkg,
argv: process.argv.slice(2)
}, opts);
if (Array.isArray(opts.help)) {
opts.help = opts.help.join('\n');
}
var pkg = typeof opts.pkg === 'string' ? require(path.join(parentDir, opts.pkg)) : opts.pkg;
var argv = minimist(opts.argv, minimistOpts);
var help = redent(trimNewlines(opts.help || ''), 2);
normalizePackageData(pkg);
process.title = pkg.bin ? Object.keys(pkg.bin)[0] : pkg.name;
var description = opts.description;
if (!description && description !== false) {
description = pkg.description;
}
help = (description ? '\n ' + description + '\n' : '') + (help ? '\n' + help : '\n');
var showHelp = function (code) {
console.log(help);
process.exit(code || 0);
};
if (argv.version && opts.version !== false) {
console.log(typeof opts.version === 'string' ? opts.version : pkg.version);
process.exit();
}
if (argv.help && opts.help !== false) {
showHelp();
}
var _ = argv._;
delete argv._;
return {
input: _,
flags: camelcaseKeys(argv),
pkg: pkg,
help: help,
showHelp: showHelp
};
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,9 @@
'use strict';
var mapObj = require('map-obj');
var camelCase = require('camelcase');
module.exports = function (obj) {
return mapObj(obj, function (key, val) {
return [camelCase(key), val];
});
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,35 @@
'use strict';
module.exports = function () {
var str = [].map.call(arguments, function (str) {
return str.trim();
}).filter(function (str) {
return str.length;
}).join('-');
if (!str.length) {
return '';
}
if (str.length === 1) {
return str;
}
if (!(/[_.\- ]+/).test(str)) {
if (str === str.toUpperCase()) {
return str.toLowerCase();
}
if (str[0] !== str[0].toLowerCase()) {
return str[0].toLowerCase() + str.slice(1);
}
return str;
}
return str
.replace(/^[_.\- ]+/, '')
.toLowerCase()
.replace(/[_.\- ]+(\w|$)/g, function (m, p1) {
return p1.toUpperCase();
});
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,69 @@
{
"name": "camelcase",
"version": "2.0.1",
"description": "Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/sindresorhus/camelcase"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"camelcase",
"camel-case",
"camel",
"case",
"dash",
"hyphen",
"dot",
"underscore",
"separator",
"string",
"text",
"convert"
],
"devDependencies": {
"ava": "*",
"xo": "*"
},
"gitHead": "fb178b39412e3b63ef86bf6933089282d74d85c4",
"bugs": {
"url": "https://github.com/sindresorhus/camelcase/issues"
},
"homepage": "https://github.com/sindresorhus/camelcase",
"_id": "camelcase@2.0.1",
"_shasum": "57568d687b8da56c4c1d17b4c74a3cee26d73aeb",
"_from": "camelcase@^2.0.0",
"_npmVersion": "2.14.7",
"_nodeVersion": "4.2.1",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"dist": {
"shasum": "57568d687b8da56c4c1d17b4c74a3cee26d73aeb",
"tarball": "http://registry.npmjs.org/camelcase/-/camelcase-2.0.1.tgz"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"directories": {},
"_resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.0.1.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,57 @@
# camelcase [![Build Status](https://travis-ci.org/sindresorhus/camelcase.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase)
> Convert a dash/dot/underscore/space separated string to camelCase: `foo-bar` → `fooBar`
## Install
```
$ npm install --save camelcase
```
## Usage
```js
const camelCase = require('camelcase');
camelCase('foo-bar');
//=> 'fooBar'
camelCase('foo_bar');
//=> 'fooBar'
camelCase('Foo-Bar');
//=> 'fooBar'
camelCase('--foo.bar');
//=> 'fooBar'
camelCase('__foo__bar__');
//=> 'fooBar'
camelCase('foo bar');
//=> 'fooBar'
console.log(process.argv[3]);
//=> '--foo-bar'
camelCase(process.argv[3]);
//=> 'fooBar'
camelCase('foo', 'bar');
//=> 'fooBar'
camelCase('__foo__', '--bar');
//=> 'fooBar'
```
## Related
- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
- [uppercamelcase](https://github.com/SamVerschueren/uppercamelcase) - Like this module, but to PascalCase instead of camelCase
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,13 @@
'use strict';
module.exports = function (obj, cb) {
var ret = {};
var keys = Object.keys(obj);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var res = cb(key, obj[key], obj);
ret[res[0]] = res[1];
}
return ret;
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,66 @@
{
"name": "map-obj",
"version": "1.0.1",
"description": "Map object keys and values into a new object",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/sindresorhus/map-obj"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "node test.js"
},
"files": [
"index.js"
],
"keywords": [
"map",
"obj",
"object",
"key",
"keys",
"value",
"values",
"val",
"iterate",
"iterator"
],
"devDependencies": {
"ava": "0.0.4"
},
"gitHead": "a4f2d49ae6b5f7c0e55130b49ab0412298b797bc",
"bugs": {
"url": "https://github.com/sindresorhus/map-obj/issues"
},
"homepage": "https://github.com/sindresorhus/map-obj",
"_id": "map-obj@1.0.1",
"_shasum": "d933ceb9205d82bdcf4886f6742bdc2b4dea146d",
"_from": "map-obj@^1.0.0",
"_npmVersion": "2.7.4",
"_nodeVersion": "0.12.2",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"dist": {
"shasum": "d933ceb9205d82bdcf4886f6742bdc2b4dea146d",
"tarball": "http://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"directories": {},
"_resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,29 @@
# map-obj [![Build Status](https://travis-ci.org/sindresorhus/map-obj.svg?branch=master)](https://travis-ci.org/sindresorhus/map-obj)
> Map object keys and values into a new object
## Install
```
$ npm install --save map-obj
```
## Usage
```js
var mapObj = require('map-obj');
var newObject = mapObj({foo: 'bar'}, function (key, value, object) {
// first element is the new key and second is the new value
// here we reverse the order
return [value, key];
});
//=> {bar: 'foo'}
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,82 @@
{
"name": "camelcase-keys",
"version": "2.0.0",
"description": "Convert object keys to camelCase",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/sindresorhus/camelcase-keys"
},
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"map",
"obj",
"object",
"key",
"keys",
"value",
"values",
"val",
"iterate",
"camelcase",
"camel-case",
"camel",
"case",
"dash",
"hyphen",
"dot",
"underscore",
"separator",
"string",
"text",
"convert"
],
"devDependencies": {
"ava": "*",
"xo": "*"
},
"dependencies": {
"camelcase": "^2.0.0",
"map-obj": "^1.0.0"
},
"gitHead": "6d88badb1d6908ef6eedf4140c8dfc5d515b5428",
"bugs": {
"url": "https://github.com/sindresorhus/camelcase-keys/issues"
},
"homepage": "https://github.com/sindresorhus/camelcase-keys",
"_id": "camelcase-keys@2.0.0",
"_shasum": "ab87e740d72a1ffcb12a43cc04c14b39d549eab9",
"_from": "camelcase-keys@^2.0.0",
"_npmVersion": "2.14.7",
"_nodeVersion": "4.2.1",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"dist": {
"shasum": "ab87e740d72a1ffcb12a43cc04c14b39d549eab9",
"tarball": "http://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.0.0.tgz"
},
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"directories": {},
"_resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.0.0.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,32 @@
# camelcase-keys [![Build Status](https://travis-ci.org/sindresorhus/camelcase-keys.svg?branch=master)](https://travis-ci.org/sindresorhus/camelcase-keys)
> Convert object keys to camelCase using [`camelcase`](https://github.com/sindresorhus/camelcase)
## Install
```
$ npm install --save camelcase-keys
```
## Usage
```js
const camelcaseKeys = require('camelcase-keys');
camelcaseKeys({'foo-bar': true});
//=> {fooBar: true}
const argv = require('minimist')(process.argv.slice(2));
//=> {_: [], 'foo-bar': true}
camelcaseKeys(argv);
//=> {_: [], fooBar: true}
```
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)

View File

@@ -0,0 +1,32 @@
'use strict';
// WARNING: This undocumented API is subject to change.
module.exports = function (process) {
var unhandledRejections = [];
process.on('unhandledRejection', function (reason, p) {
unhandledRejections.push({reason: reason, promise: p});
});
process.on('rejectionHandled', function (p) {
var index = unhandledRejections.reduce(function (result, item, idx) {
return (item.promise === p ? idx : result);
}, -1);
unhandledRejections.splice(index, 1);
});
function currentlyUnhandled() {
return unhandledRejections.map(function (entry) {
return {
reason: entry.reason,
promise: entry.promise
};
});
}
return {
currentlyUnhandled: currentlyUnhandled
};
};

View File

@@ -0,0 +1,37 @@
'use strict';
var onExit = require('signal-exit');
var api = require('./api');
var installed = false;
function outputRejectedMessage(err) {
if (err instanceof Error) {
console.error(err.stack);
} else if (typeof err === 'undefined') {
console.error('Promise rejected no value');
} else {
console.error('Promise rejected with value:', err);
}
}
module.exports = function () {
if (installed) {
console.trace('WARN: loud rejection called more than once');
return;
}
installed = true;
var tracker = api(process);
onExit(function () {
var unhandledRejections = tracker.currentlyUnhandled();
if (unhandledRejections.length > 0) {
unhandledRejections.forEach(function (x) {
outputRejectedMessage(x.reason);
});
process.exitCode = 1;
}
});
};

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,4 @@
node_modules
.DS_Store
nyc_output
coverage

View File

@@ -0,0 +1,7 @@
sudo: false
language: node_js
node_js:
- '0.12'
- '0.10'
- iojs
after_success: npm run coverage

View File

@@ -0,0 +1,14 @@
Copyright (c) 2015, Contributors
Permission to use, copy, modify, and/or distribute this software
for any purpose with or without fee is hereby granted, provided
that the above copyright notice and this permission notice
appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@@ -0,0 +1,38 @@
# signal-exit
[![Build Status](https://travis-ci.org/bcoe/signal-exit.png)](https://travis-ci.org/bcoe/signal-exit)
[![Coverage Status](https://coveralls.io/repos/bcoe/signal-exit/badge.svg?branch=)](https://coveralls.io/r/bcoe/signal-exit?branch=)
[![NPM version](https://img.shields.io/npm/v/signal-exit.svg)](https://www.npmjs.com/package/signal-exit)
When you want to fire an event no matter how a process exits:
* reaching the end of execution.
* explicitly having `process.exit(code)` called.
* having `process.kill(pid, sig)` called.
* receiving a fatal signal from outside the process
Use `signal-exit`.
```js
var onExit = require('signal-exit')
onExit(function (code, signal) {
console.log('process exited!')
})
```
## API
`var remove = onExit(function (code, signal) {}, options)`
The return value of the function is a function that will remove the
handler.
Note that the function *only* fires for signals if the signal would
cause the proces to exit. That is, there are no other listeners, and
it is a fatal signal.
## Options
* `alwaysLast`: Run this handler after any other signal or exit
handlers. This causes `process.emit` to be monkeypatched.

View File

@@ -0,0 +1,148 @@
// Note: since nyc uses this module to output coverage, any lines
// that are in the direct sync flow of nyc's outputCoverage are
// ignored, since we can never get coverage for them.
var assert = require('assert')
var signals = require('./signals.js')
var EE = require('events')
/* istanbul ignore if */
if (typeof EE !== 'function') {
EE = EE.EventEmitter
}
var emitter
if (process.__signal_exit_emitter__) {
emitter = process.__signal_exit_emitter__
} else {
emitter = process.__signal_exit_emitter__ = new EE()
emitter.count = 0
emitter.emitted = {}
}
module.exports = function (cb, opts) {
assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler')
if (loaded === false) {
load()
}
var ev = 'exit'
if (opts && opts.alwaysLast) {
ev = 'afterexit'
}
var remove = function () {
emitter.removeListener(ev, cb)
if (emitter.listeners('exit').length === 0 &&
emitter.listeners('afterexit').length === 0) {
unload()
}
}
emitter.on(ev, cb)
return remove
}
module.exports.unload = unload
function unload () {
if (!loaded) {
return
}
loaded = false
signals.forEach(function (sig) {
try {
process.removeListener(sig, sigListeners[sig])
} catch (er) {}
})
process.emit = originalProcessEmit
process.reallyExit = originalProcessReallyExit
emitter.count -= 1
}
function emit (event, code, signal) {
if (emitter.emitted[event]) {
return
}
emitter.emitted[event] = true
emitter.emit(event, code, signal)
}
// { <signal>: <listener fn>, ... }
var sigListeners = {}
signals.forEach(function (sig) {
sigListeners[sig] = function listener () {
// If there are no other listeners, an exit is coming!
// Simplest way: remove us and then re-send the signal.
// We know that this will kill the process, so we can
// safely emit now.
var listeners = process.listeners(sig)
if (listeners.length === emitter.count) {
unload()
emit('exit', null, sig)
/* istanbul ignore next */
emit('afterexit', null, sig)
/* istanbul ignore next */
process.kill(process.pid, sig)
}
}
})
module.exports.signals = function () {
return signals
}
module.exports.load = load
var loaded = false
function load () {
if (loaded) {
return
}
loaded = true
// This is the number of onSignalExit's that are in play.
// It's important so that we can count the correct number of
// listeners on signals, and don't wait for the other one to
// handle it instead of us.
emitter.count += 1
signals = signals.filter(function (sig) {
try {
process.on(sig, sigListeners[sig])
return true
} catch (er) {
return false
}
})
process.emit = processEmit
process.reallyExit = processReallyExit
}
var originalProcessReallyExit = process.reallyExit
function processReallyExit (code) {
process.exitCode = code || 0
emit('exit', process.exitCode, null)
/* istanbul ignore next */
emit('afterexit', process.exitCode, null)
/* istanbul ignore next */
originalProcessReallyExit.call(process, process.exitCode)
}
var originalProcessEmit = process.emit
function processEmit (ev, arg) {
if (ev === 'exit') {
if (arg !== undefined) {
process.exitCode = arg
}
var ret = originalProcessEmit.apply(this, arguments)
emit('exit', process.exitCode, null)
/* istanbul ignore next */
emit('afterexit', process.exitCode, null)
return ret
} else {
return originalProcessEmit.apply(this, arguments)
}
}

View File

@@ -0,0 +1,61 @@
{
"name": "signal-exit",
"version": "2.1.2",
"description": "when you want to fire an event no matter how a process exits.",
"main": "index.js",
"scripts": {
"test": "standard && nyc tap --timeout=240 ./test/*.js",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"repository": {
"type": "git",
"url": "git+https://github.com/bcoe/signal-exit.git"
},
"keywords": [
"signal",
"exit"
],
"author": {
"name": "Ben Coe",
"email": "ben@npmjs.com"
},
"license": "ISC",
"bugs": {
"url": "https://github.com/bcoe/signal-exit/issues"
},
"homepage": "https://github.com/bcoe/signal-exit",
"devDependencies": {
"chai": "^2.3.0",
"coveralls": "^2.11.2",
"nyc": "^2.1.2",
"standard": "^3.9.0",
"tap": "1.0.4"
},
"gitHead": "8d50231bda6d0d1c4d39de20fc09d11487eb9951",
"_id": "signal-exit@2.1.2",
"_shasum": "375879b1f92ebc3b334480d038dc546a6d558564",
"_from": "signal-exit@^2.1.2",
"_npmVersion": "2.9.0",
"_nodeVersion": "2.0.2",
"_npmUser": {
"name": "bcoe",
"email": "ben@npmjs.com"
},
"dist": {
"shasum": "375879b1f92ebc3b334480d038dc546a6d558564",
"tarball": "http://registry.npmjs.org/signal-exit/-/signal-exit-2.1.2.tgz"
},
"maintainers": [
{
"name": "bcoe",
"email": "ben@npmjs.com"
},
{
"name": "isaacs",
"email": "isaacs@npmjs.com"
}
],
"directories": {},
"_resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-2.1.2.tgz",
"readme": "ERROR: No README data found!"
}

View File

@@ -0,0 +1,47 @@
// This is not the set of all possible signals.
//
// It IS, however, the set of all signals that trigger
// an exit on either Linux or BSD systems. Linux is a
// superset of the signal names supported on BSD, and
// the unknown signals just fail to register, so we can
// catch that easily enough.
//
// Don't bother with SIGKILL. It's uncatchable, which
// means that we can't fire any callbacks anyway.
//
// If a user does happen to register a handler on a non-
// fatal signal like SIGWINCH or something, and then
// exit, it'll end up firing `process.emit('exit')`, so
// the handler will be fired anyway.
module.exports = [
'SIGABRT',
'SIGALRM',
'SIGBUS',
'SIGFPE',
'SIGHUP',
'SIGILL',
'SIGINT',
'SIGIOT',
'SIGPIPE',
'SIGPROF',
'SIGQUIT',
'SIGSEGV',
'SIGSYS',
'SIGTERM',
'SIGTRAP',
'SIGUSR2',
'SIGVTALRM',
'SIGXCPU',
'SIGXFSZ'
]
if (process.platform === 'linux') {
module.exports.push(
'SIGIO',
'SIGPOLL',
'SIGPWR',
'SIGSTKFLT',
'SIGUNUSED'
)
}

View File

@@ -0,0 +1,94 @@
/* global describe, it */
var exec = require('child_process').exec,
assert = require('assert')
require('chai').should()
require('tap').mochaGlobals()
var onSignalExit = require('../')
describe('all-signals-integration-test', function () {
// These are signals that are aliases for other signals, so
// the result will sometimes be one of the others. For these,
// we just verify that we GOT a signal, not what it is.
function weirdSignal (sig) {
return sig === 'SIGIOT' ||
sig === 'SIGIO' ||
sig === 'SIGSYS' ||
sig === 'SIGIOT' ||
sig === 'SIGABRT' ||
sig === 'SIGPOLL' ||
sig === 'SIGUNUSED'
}
// Exhaustively test every signal, and a few numbers.
var signals = onSignalExit.signals()
signals.concat('', 0, 1, 2, 3, 54).forEach(function (sig) {
var node = process.execPath
var js = require.resolve('./fixtures/exiter.js')
it('exits properly: ' + sig, function (done) {
// travis has issues with SIGUSR1 on Node 0.x.10.
if (process.env.TRAVIS && sig === 'SIGUSR1') return done()
exec(node + ' ' + js + ' ' + sig, function (err, stdout, stderr) {
if (sig) {
assert(err)
if (!isNaN(sig)) {
assert.equal(err.code, sig)
} else if (!weirdSignal(sig)) {
if (!process.env.TRAVIS) err.signal.should.equal(sig)
} else if (sig) {
if (!process.env.TRAVIS) assert(err.signal)
}
} else {
assert.ifError(err)
}
try {
var data = JSON.parse(stdout)
} catch (er) {
console.error('invalid json: %j', stdout, stderr)
throw er
}
if (weirdSignal(sig)) {
data.wanted[1] = true
data.found[1] = !!data.found[1]
}
assert.deepEqual(data.found, data.wanted)
done()
})
})
})
signals.forEach(function (sig) {
var node = process.execPath
var js = require.resolve('./fixtures/parent.js')
it('exits properly: (external sig) ' + sig, function (done) {
// travis has issues with SIGUSR1 on Node 0.x.10.
if (process.env.TRAVIS && sig === 'SIGUSR1') return done()
var cmd = node + ' ' + js + ' ' + sig
exec(cmd, function (err, stdout, stderr) {
assert.ifError(err)
try {
var data = JSON.parse(stdout)
} catch (er) {
console.error('invalid json: %j', stdout, stderr)
throw er
}
if (weirdSignal(sig)) {
data.wanted[1] = true
data.found[1] = !!data.found[1]
data.external[1] = !!data.external[1]
}
assert.deepEqual(data.found, data.wanted)
assert.deepEqual(data.external, data.wanted)
done()
})
})
})
})

View File

@@ -0,0 +1,35 @@
var expectSignal = process.argv[2]
if (!expectSignal || !isNaN(expectSignal)) {
throw new Error('signal not provided')
}
var onSignalExit = require('../../')
onSignalExit(function (code, signal) {
// some signals don't always get recognized properly, because
// they have the same numeric code.
if (wanted[1] === true) {
signal = !!signal
}
console.log('%j', {
found: [ code, signal ],
wanted: wanted
})
})
var wanted
switch (expectSignal) {
case 'SIGIOT':
case 'SIGUNUSED':
case 'SIGPOLL':
wanted = [ null, true ]
break
default:
wanted = [ null, expectSignal ]
break
}
console.error('want', wanted)
setTimeout(function () {}, 1000)

View File

@@ -0,0 +1,800 @@
{
"explicit 0 nochange sigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 0,
"actualSignal": null,
"stderr": [
"first code=0",
"second code=0"
]
},
"explicit 0 nochange nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 0,
"actualSignal": null,
"stderr": [
"first code=0",
"second code=0"
]
},
"explicit 0 change sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"explicit 0 change nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"explicit 0 code sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"second code=0"
]
},
"explicit 0 code nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"second code=0"
]
},
"explicit 0 twice sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"explicit 0 twice nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"explicit 0 twicecode sigexit": {
"code": 6,
"signal": null,
"exitCode": 6,
"actualCode": 6,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"set code from 5 to 6"
]
},
"explicit 0 twicecode nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 6,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"set code from 5 to 6"
]
},
"explicit 2 nochange sigexit": {
"code": 2,
"signal": null,
"exitCode": 2,
"actualCode": 2,
"actualSignal": null,
"stderr": [
"first code=2",
"second code=2"
]
},
"explicit 2 nochange nosigexit": {
"code": 2,
"signal": null,
"exitCode": 2,
"actualCode": 2,
"actualSignal": null,
"stderr": [
"first code=2",
"second code=2"
]
},
"explicit 2 change sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5"
]
},
"explicit 2 change nosigexit": {
"code": 2,
"signal": null,
"exitCode": 2,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5"
]
},
"explicit 2 code sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5",
"second code=2"
]
},
"explicit 2 code nosigexit": {
"code": 2,
"signal": null,
"exitCode": 2,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5",
"second code=2"
]
},
"explicit 2 twice sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5"
]
},
"explicit 2 twice nosigexit": {
"code": 2,
"signal": null,
"exitCode": 2,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5"
]
},
"explicit 2 twicecode sigexit": {
"code": 6,
"signal": null,
"exitCode": 6,
"actualCode": 6,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5",
"set code from 5 to 6"
]
},
"explicit 2 twicecode nosigexit": {
"code": 2,
"signal": null,
"exitCode": 2,
"actualCode": 6,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5",
"set code from 5 to 6"
]
},
"explicit null nochange sigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 0,
"actualSignal": null,
"stderr": [
"first code=0",
"second code=0"
]
},
"explicit null nochange nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 0,
"actualSignal": null,
"stderr": [
"first code=0",
"second code=0"
]
},
"explicit null change sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"explicit null change nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"explicit null code sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"second code=0"
]
},
"explicit null code nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"second code=0"
]
},
"explicit null twice sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"explicit null twice nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"explicit null twicecode sigexit": {
"code": 6,
"signal": null,
"exitCode": 6,
"actualCode": 6,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"set code from 5 to 6"
]
},
"explicit null twicecode nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 6,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"set code from 5 to 6"
]
},
"code 0 nochange sigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 0,
"actualSignal": null,
"stderr": [
"first code=0",
"second code=0"
]
},
"code 0 nochange nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 0,
"actualSignal": null,
"stderr": [
"first code=0",
"second code=0"
]
},
"code 0 change sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"code 0 change nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"code 0 code sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"second code=0"
]
},
"code 0 code nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"second code=0"
]
},
"code 0 twice sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"code 0 twice nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"code 0 twicecode sigexit": {
"code": 6,
"signal": null,
"exitCode": 6,
"actualCode": 6,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"set code from 5 to 6"
]
},
"code 0 twicecode nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 6,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"set code from 5 to 6"
]
},
"code 2 nochange sigexit": {
"code": 2,
"signal": null,
"exitCode": 2,
"actualCode": 2,
"actualSignal": null,
"stderr": [
"first code=2",
"second code=2"
]
},
"code 2 nochange nosigexit": {
"code": 2,
"signal": null,
"exitCode": 2,
"actualCode": 2,
"actualSignal": null,
"stderr": [
"first code=2",
"second code=2"
]
},
"code 2 change sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5"
]
},
"code 2 change nosigexit": {
"code": 2,
"signal": null,
"exitCode": 2,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5"
]
},
"code 2 code sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5",
"second code=2"
]
},
"code 2 code nosigexit": {
"code": 2,
"signal": null,
"exitCode": 2,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5",
"second code=2"
]
},
"code 2 twice sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5"
]
},
"code 2 twice nosigexit": {
"code": 2,
"signal": null,
"exitCode": 2,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5"
]
},
"code 2 twicecode sigexit": {
"code": 6,
"signal": null,
"exitCode": 6,
"actualCode": 6,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5",
"set code from 5 to 6"
]
},
"code 2 twicecode nosigexit": {
"code": 2,
"signal": null,
"exitCode": 2,
"actualCode": 6,
"actualSignal": null,
"stderr": [
"first code=2",
"set code from 2 to 5",
"set code from 5 to 6"
]
},
"code null nochange sigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 0,
"actualSignal": null,
"stderr": [
"first code=0",
"second code=0"
]
},
"code null nochange nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 0,
"actualSignal": null,
"stderr": [
"first code=0",
"second code=0"
]
},
"code null change sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"code null change nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"code null code sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"second code=0"
]
},
"code null code nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"second code=0"
]
},
"code null twice sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"code null twice nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"code null twicecode sigexit": {
"code": 6,
"signal": null,
"exitCode": 6,
"actualCode": 6,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"set code from 5 to 6"
]
},
"code null twicecode nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 6,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"set code from 5 to 6"
]
},
"normal 0 nochange sigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 0,
"actualSignal": null,
"stderr": [
"first code=0",
"second code=0"
]
},
"normal 0 nochange nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 0,
"actualSignal": null,
"stderr": [
"first code=0",
"second code=0"
]
},
"normal 0 change sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"normal 0 change nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"normal 0 code sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"second code=0"
]
},
"normal 0 code nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"second code=0"
]
},
"normal 0 twice sigexit": {
"code": 5,
"signal": null,
"exitCode": 5,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"normal 0 twice nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 5,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5"
]
},
"normal 0 twicecode sigexit": {
"code": 6,
"signal": null,
"exitCode": 6,
"actualCode": 6,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"set code from 5 to 6"
]
},
"normal 0 twicecode nosigexit": {
"code": 0,
"signal": null,
"exitCode": 0,
"actualCode": 6,
"actualSignal": null,
"stderr": [
"first code=0",
"set code from 0 to 5",
"set code from 5 to 6"
]
}
}

Some files were not shown because too many files have changed in this diff Show More