commit 89f70ed0490aac8239ca2fbcf836dad680af3741
parent 626c2be71cafe2b0e143add333941917411fd8ec
Author: Nathan Randecker <nathan.randecker@gmail.com>
Date: Tue, 17 Jan 2017 21:35:46 -0600
Added BrowserSync, gulp tasks, styles, and README
Diffstat:
130 files changed, 5957 insertions(+), 10936 deletions(-)
diff --git a/README.md b/README.md
@@ -7,8 +7,10 @@ The Theme features:
- Gulp
- SASS
- Sweet Scroll
+- Particle.js
+- BrowserSync
- Font Awesome and Devicon icons
-- Very very small and fast!
+- Google Analytics
- Info Customization
## Basic Setup
@@ -38,7 +40,14 @@ github_username: lorem_ipsum
gplus_username: lorem_ipsum
```
-**Don't forget to change your baseurl before build your site!**
+**Don't forget to change your url before you deploy your site!**
+
+## Color and Particle Customization
+- Color Customization
+ - Edit the sass variables
+- Particle Customization
+ - Edit the json data in particle function in app.js
+ - Refer to [Particle.js](https://github.com/VincentGarreau/particles.js/) for help
## Running the blog in local
@@ -54,7 +63,7 @@ Having any issues file a [GitHub Issue](https://github.com/nrandecker/particle/i
## License
-This theme is free and open source software, distributed under the The MIT License. So feel free to use this Jekyll theme on your site without linking back to me or using a disclaimer.
+This theme is free and open source software, distributed under the The MIT License. So feel free to use this Jekyll theme anyway you want.
## Credits
diff --git a/_config.yml b/_config.yml
@@ -6,13 +6,15 @@ url: "https://nrandecker.github.io" # the base hostname & protocol for your site
# User settings
username: Anon Developer
-user_description: Bicycle rights irony actually neutra typewriter lyft. Man bun taxidermy put a bird on it, umami yr ramps pop-up ugh bushwick chia lo-fi. Occupy bitters pour-over snackwave you probably haven't heard of them small batch. Cornhole mustache man bun letterpress echo park VHS. Humblebrag VHS mustache, dreamcatcher vinyl copper mug pitchfork fap artisan vape freegan vaporware. 90's fam kitsch drinking vinegar, +1 retro echo park. 8-bit pork belly biodiesel, jianbing 3 wolf moon enamel pin pabst glossier butcher.
+user_description: Bicycle rights irony actually neutra typewriter lyft. Man bun taxidermy put a bird on it, umami yr ramps pop-up ugh bushwick chia lo-fi. Occupy bitters pour-over snackwave you probably haven't heard of them small batch. Cornhole mustache man bun letterpress echo park VHS.
user_title: Software Developer
email: anon@anon.com
twitter_username: lorem_ipsum
github_username: lorem_ipsum
gplus_username: lorem_ipsum
-include: ['assets']
+# Google-analytics
+google-analytics:
+ id: ""
exclude: ['package.json', 'src' , 'node_modules']
diff --git a/_includes/footer.html b/_includes/footer.html
@@ -5,3 +5,4 @@
<script src="//cdn.jsdelivr.net/particles.js/2.0.0/particles.min.js"></script>
<script src="{{ "/assets/js/sweet-scroll.min.js" | prepend: site.baseurl }}"></script>
<script src="{{ "/assets/js/main.js" | prepend: site.baseurl }}"></script>
+{% include google-analytics.html %}
diff --git a/_includes/google-analytics.html b/_includes/google-analytics.html
@@ -0,0 +1,11 @@
+<!-- Google Analytics -->
+{% if site.google-analytics %}
+<script>
+(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
+ga('create', '{{ site.google-analytics.id }}', 'auto');
+ga('send', 'pageview');
+</script>
+{% endif %}
diff --git a/assets/css/main.css b/assets/css/main.css
@@ -1 +1 @@
-@import url(https://fonts.googleapis.com/css?family=Montserrat);body{font-family:'Montserrat',sans-serif}@-webkit-keyframes pulse{0%,to{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";filter:alpha(opacity=40);opacity:.4;top:0}50%{-ms-filter:none;-webkit-filter:none;filter:none;opacity:1;top:-10px}}@keyframes pulse{0%,to{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";filter:alpha(opacity=40);opacity:.4;top:0}50%{-ms-filter:none;-webkit-filter:none;filter:none;opacity:1;top:-10px}}#particles-js{background:#1a222c;display:block;vertical-align:bottom;width:100vw;min-height:100vh;background-repeat:no-repeat;background-size:cover;background-attachment:fixed}#particles-js .particles-js-canvas-el{width:100vw!important;height:100vh!important}.content{z-index:1;text-align:center;color:#fff;position:absolute;top:50%;left:50%;margin:0 auto;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.content .site-title{font-size:50px;display:block;line-height:1}@media only screen and (min-width:768px){.content .site-title{margin:0;font-size:100px}}.content .site-description{font-size:20px;display:block;line-height:1;margin:5px 0 10px}@media only screen and (min-width:768px){.content .site-description{font-size:40px}}.content .link{color:#fff;display:inline-flex;justify-content:space-between;text-decoration:none;font-size:15px;margin:10px}@media only screen and (min-width:768px){.content .link{font-size:20px}}.icons-header{display:flex;justify-content:center}.icons-header .icon{text-align:center;color:#fff;width:20px;height:20px;font-size:20px;padding:10px;margin:2px;border-radius:50%;border:2px solid #fff;transition:all .7s}.icons-header .icon:active,.icons-header .icon:hover{color:#1a222c;background:#fff}@media only screen and (min-width:768px){.icons-header .icon{width:35px;height:35px;font-size:35px}}.down,.icons-header,.user{text-align:center}.down{color:#fff;position:absolute;bottom:25px;width:100%;display:block;cursor:pointer;margin:0 auto;font-size:30px}.down .icon{position:absolute;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:100px;height:100px;fill:#fff;-webkit-animation:pulse 1.3s infinite;animation:pulse 1.3s infinite}.down .icon:active,.down .icon:hover,.footer a:active,.footer a:hover{color:#4b5664}.user{margin:10px;font-size:60px}.user p{font-size:16px}@media only screen and (min-width:768px){.user{font-size:75px}}.user-details{text-align:center;margin:10px}.user-projects{margin:10px}.user-projects img{max-width:100%;height:auto;border-radius:5px}.user-projects h5,body{margin:0}.user-projects li{color:#1a222c;font-size:1.1rem}.user-projects p{margin-right:5px}@media only screen and (min-width:768px){.images{float:right}}.project-link{display:block;width:100px;margin:10px 0;padding:5px;color:#1a222c;background-color:transparent;border:1px solid #1a222c;border-radius:10px;text-align:center;outline:none;text-decoration:none;cursor:pointer;transition:color .3s ease-out,background-color .3s ease-out,border-color .3s ease-out}.project-link:active,.project-link:hover{background-color:#54516a;border-color:#54516a;color:#fff;transition:color .3s ease-in,background-color .3s ease-in,border-color .3s ease-in}.footer{background:#1a222c;padding:10px 0;margin-top:100px;text-align:center;color:#fff}.footer .love{color:red}.footer a{text-decoration:none;margin:0;color:#fff}
-\ No newline at end of file
+@import url(https://fonts.googleapis.com/css?family=Montserrat);body{margin:0;font-family:'Montserrat',sans-serif}@-webkit-keyframes pulse{0%,to{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";filter:alpha(opacity=40);opacity:.4;top:0}50%{-ms-filter:none;-webkit-filter:none;filter:none;opacity:1;top:-10px}}@keyframes pulse{0%,to{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";filter:alpha(opacity=40);opacity:.4;top:0}50%{-ms-filter:none;-webkit-filter:none;filter:none;opacity:1;top:-10px}}#particles-js{background:#1a222c;display:block;vertical-align:bottom;width:100vw;min-height:100vh;background-repeat:no-repeat;background-size:cover;background-attachment:fixed}#particles-js .particles-js-canvas-el{width:100vw!important;height:100vh!important}.content{z-index:1;text-align:center;color:#fff;position:absolute;top:50%;left:50%;margin:0 auto;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.content .site-title{font-size:50px;display:block;line-height:1}@media only screen and (min-width:768px){.content .site-title{margin:0;font-size:100px}}.content .site-description{font-size:20px;display:block;line-height:1;margin:5px 0 10px}@media only screen and (min-width:768px){.content .site-description{font-size:40px}}.content .link{color:#fff;display:inline-flex;justify-content:space-between;text-decoration:none;font-size:15px;margin:10px}@media only screen and (min-width:768px){.content .link{font-size:20px}}.icons-header{display:flex;justify-content:center;text-align:center}.icons-header .icon{text-align:center;color:#fff;width:20px;height:20px;font-size:20px;padding:10px;margin:2px;border-radius:50%;border:2px solid #fff;transition:all .7s}.icons-header .icon:focus{color:#1a222c;background:#fff}.icons-header .icon:active{color:#1a222c;background:#fff}@media only screen and (min-width:768px){.icons-header .icon{width:35px;height:35px;font-size:35px}}.down{color:#fff;position:absolute;bottom:25px;width:100%;margin:0 auto;display:block;text-align:center;font-size:30px;cursor:pointer}.down .icon{position:absolute;-webkit-transform-style:preserve-3d;transform-style:preserve-3d;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:100px;height:100px;fill:#fff;-webkit-animation:pulse 1.3s infinite;animation:pulse 1.3s infinite}.down .icon:focus,.footer a:focus{color:#4b5664}.down .icon:active,.footer a:active{color:#4b5664}.user{text-align:center;margin:10px;font-size:60px}.user p{font-size:16px}@media only screen and (min-width:768px){.user{font-size:75px}}.user-details{text-align:center;margin:10px}.user-projects{margin:10px}.user-projects img{max-width:100%;height:auto;border-radius:5px}.user-projects h5{margin:0}.user-projects li{color:#1a222c;font-size:1.1rem}.user-projects p{margin-right:5px}@media only screen and (min-width:768px){.images{float:right}}.project-link{display:block;width:100px;margin:10px 0;padding:5px;color:#1a222c;background-color:transparent;border:1px solid #1a222c;border-radius:10px;text-align:center;outline:none;text-decoration:none;cursor:pointer;transition:color .3s ease-out,background-color .3s ease-out,border-color .3s ease-out}.project-link:focus{background-color:#54516a;border-color:#54516a;color:#fff;transition:color .3s ease-in,background-color .3s ease-in,border-color .3s ease-in}.project-link:active{background-color:#54516a;border-color:#54516a;color:#fff;transition:color .3s ease-in,background-color .3s ease-in,border-color .3s ease-in}.footer{background:#1a222c;padding:10px 0;margin-top:100px;text-align:center;color:#fff}.footer .love{color:red}.footer a{text-decoration:none;margin:0;color:#fff}
+\ No newline at end of file
diff --git a/gulpfile.js b/gulpfile.js
@@ -5,12 +5,14 @@ var concat = require('gulp-concat');
var sass = require('gulp-sass');
var plumber = require('gulp-plumber');
var cp = require('child_process');
-var imagemin = require('gulp-imagemin')
+var imagemin = require('gulp-imagemin');
+var browserSync = require('browser-sync');
var jekyllCommand = (/^win/.test(process.platform)) ? 'jekyll.bat' : 'jekyll';
/*
* Build the Jekyll Site
+ * runs a child process in node that runs the jekyll commands
*/
gulp.task('jekyll-build', function (done) {
return cp.spawn(jekyllCommand, ['build'], {stdio: 'inherit'})
@@ -18,11 +20,21 @@ gulp.task('jekyll-build', function (done) {
});
/*
-* build and launch the jekyll site
-*/
-gulp.task('jekyll-serve', function(done) {
- return cp.spawn(jekyllCommand, ['serve'], {stdio: 'inherit'})
- .on('close', done);
+ * Rebuild Jekyll & reload browserSync
+ */
+gulp.task('jekyll-rebuild', ['jekyll-build'], function () {
+ browserSync.reload();
+});
+
+/*
+ * Build the jekyll site and launch browser-sync
+ */
+gulp.task('browser-sync', ['jekyll-build'], function() {
+ browserSync({
+ server: {
+ baseDir: '_site'
+ }
+ });
});
/*
@@ -60,7 +72,8 @@ gulp.task('js', function(){
gulp.task('watch', function() {
gulp.watch('src/styles/**/*.scss', ['sass']);
gulp.watch('src/js/**/*.js', ['js']);
- gulp.watch(['*html', '_includes/*html', '_layouts/*.html'], ['jekyll-build']);
+ gulp.watch('src/img/**/*.{jpg,png,gif}', ['imagemin']);
+ gulp.watch(['*html', '_includes/*html', '_layouts/*.html'], ['jekyll-rebuild']);
});
-gulp.task('default', ['js', 'imagemin', 'sass', 'jekyll-serve', 'watch']);
+gulp.task('default', ['js', 'sass', 'browser-sync', 'watch']);
diff --git a/node_modules/.yarn-integrity b/node_modules/.yarn-integrity
@@ -1 +1 @@
-b33f816a4859c77f473e26b3c5bdd4288e932e8638b2610ba83bd1af6829653b
-\ No newline at end of file
+930305c3734649d7b6b2e21b0d2385113b68efea59a4266a854158434c62b797
+\ No newline at end of file
diff --git a/node_modules/async/LICENSE b/node_modules/async/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2010 Caolan McMahon
+Copyright (c) 2010-2014 Caolan McMahon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/node_modules/async/README.md b/node_modules/async/README.md
@@ -1,15 +1,29 @@
# Async.js
+[](https://travis-ci.org/caolan/async)
+[](https://www.npmjs.org/package/async)
+[](https://coveralls.io/r/caolan/async?branch=master)
+[](https://gitter.im/caolan/async?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+
+
Async is a utility module which provides straight-forward, powerful functions
for working with asynchronous JavaScript. Although originally designed for
-use with [node.js](http://nodejs.org), it can also be used directly in the
-browser. Also supports [component](https://github.com/component/component).
+use with [Node.js](http://nodejs.org) and installable via `npm install async`,
+it can also be used directly in the browser.
+
+Async is also installable via:
+
+- [bower](http://bower.io/): `bower install async`
+- [component](https://github.com/component/component): `component install
+ caolan/async`
+- [jam](http://jamjs.org/): `jam install async`
+- [spm](http://spmjs.io/): `spm install async`
Async provides around 20 functions that include the usual 'functional'
-suspects (map, reduce, filter, each…) as well as some common patterns
-for asynchronous control flow (parallel, series, waterfall…). All these
-functions assume you follow the node.js convention of providing a single
-callback as the last argument of your async function.
+suspects (`map`, `reduce`, `filter`, `each`…) as well as some common patterns
+for asynchronous control flow (`parallel`, `series`, `waterfall`…). All these
+functions assume you follow the Node.js convention of providing a single
+callback as the last argument of your `async` function.
## Quick Examples
@@ -38,19 +52,78 @@ There are many more functions available so take a look at the docs below for a
full list. This module aims to be comprehensive, so if you feel anything is
missing please create a GitHub issue for it.
-## Common Pitfalls
+## Common Pitfalls <sub>[(StackOverflow)](http://stackoverflow.com/questions/tagged/async.js)</sub>
+### Synchronous iteration functions
+
+If you get an error like `RangeError: Maximum call stack size exceeded.` or other stack overflow issues when using async, you are likely using a synchronous iterator. By *synchronous* we mean a function that calls its callback on the same tick in the javascript event loop, without doing any I/O or using any timers. Calling many callbacks iteratively will quickly overflow the stack. If you run into this issue, just defer your callback with `async.setImmediate` to start a new call stack on the next tick of the event loop.
+
+This can also arise by accident if you callback early in certain cases:
+
+```js
+async.eachSeries(hugeArray, function iterator(item, callback) {
+ if (inCache(item)) {
+ callback(null, cache[item]); // if many items are cached, you'll overflow
+ } else {
+ doSomeIO(item, callback);
+ }
+}, function done() {
+ //...
+});
+```
+
+Just change it to:
+
+```js
+async.eachSeries(hugeArray, function iterator(item, callback) {
+ if (inCache(item)) {
+ async.setImmediate(function () {
+ callback(null, cache[item]);
+ });
+ } else {
+ doSomeIO(item, callback);
+ //...
+```
+
+Async guards against synchronous functions in some, but not all, cases. If you are still running into stack overflows, you can defer as suggested above, or wrap functions with [`async.ensureAsync`](#ensureAsync) Functions that are asynchronous by their nature do not have this problem and don't need the extra callback deferral.
+
+If JavaScript's event loop is still a bit nebulous, check out [this article](http://blog.carbonfive.com/2013/10/27/the-javascript-event-loop-explained/) or [this talk](http://2014.jsconf.eu/speakers/philip-roberts-what-the-heck-is-the-event-loop-anyway.html) for more detailed information about how it works.
+
+
+### Multiple callbacks
+
+Make sure to always `return` when calling a callback early, otherwise you will cause multiple callbacks and unpredictable behavior in many cases.
+
+```js
+async.waterfall([
+ function (callback) {
+ getSomething(options, function (err, result) {
+ if (err) {
+ callback(new Error("failed getting something:" + err.message));
+ // we should return here
+ }
+ // since we did not return, this callback still will be called and
+ // `processData` will be called twice
+ callback(null, result);
+ });
+ },
+ processData
+], done)
+```
+
+It is always good practice to `return callback(err, result)` whenever a callback call is not the last statement of a function.
+
### Binding a context to an iterator
-This section is really about bind, not about async. If you are wondering how to
-make async execute your iterators in a given context, or are confused as to why
+This section is really about `bind`, not about `async`. If you are wondering how to
+make `async` execute your iterators in a given context, or are confused as to why
a method of another library isn't working as an iterator, study this example:
```js
// Here is a simple object with an (unnecessarily roundabout) squaring method
var AsyncSquaringLibrary = {
squareExponent: 2,
- square: function(number, callback){
+ square: function(number, callback){
var result = Math.pow(number, this.squareExponent);
setTimeout(function(){
callback(null, result);
@@ -68,7 +141,7 @@ async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){
async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){
// result is [1, 4, 9]
// With the help of bind we can attach a context to the iterator before
- // passing it to async. Now the square function will be executed in its
+ // passing it to async. Now the square function will be executed in its
// 'home' AsyncSquaringLibrary context and the value of `this.squareExponent`
// will be as expected.
});
@@ -77,16 +150,22 @@ async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), fun
## Download
The source is available for download from
-[GitHub](http://github.com/caolan/async).
-Alternatively, you can install using Node Package Manager (npm):
+[GitHub](https://github.com/caolan/async/blob/master/lib/async.js).
+Alternatively, you can install using Node Package Manager (`npm`):
npm install async
+As well as using Bower:
+
+ bower install async
+
__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed
## In the Browser
-So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:
+So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5.
+
+Usage:
```html
<script type="text/javascript" src="async.js"></script>
@@ -101,85 +180,84 @@ So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage:
## Documentation
+Some functions are also available in the following forms:
+* `<name>Series` - the same as `<name>` but runs only a single async operation at a time
+* `<name>Limit` - the same as `<name>` but runs a maximum of `limit` async operations at a time
+
### Collections
-* [each](#each)
-* [eachSeries](#eachSeries)
-* [eachLimit](#eachLimit)
-* [map](#map)
-* [mapSeries](#mapSeries)
-* [mapLimit](#mapLimit)
-* [filter](#filter)
-* [filterSeries](#filterSeries)
-* [reject](#reject)
-* [rejectSeries](#rejectSeries)
-* [reduce](#reduce)
-* [reduceRight](#reduceRight)
-* [detect](#detect)
-* [detectSeries](#detectSeries)
-* [sortBy](#sortBy)
-* [some](#some)
-* [every](#every)
-* [concat](#concat)
-* [concatSeries](#concatSeries)
+* [`each`](#each), `eachSeries`, `eachLimit`
+* [`forEachOf`](#forEachOf), `forEachOfSeries`, `forEachOfLimit`
+* [`map`](#map), `mapSeries`, `mapLimit`
+* [`filter`](#filter), `filterSeries`, `filterLimit`
+* [`reject`](#reject), `rejectSeries`, `rejectLimit`
+* [`reduce`](#reduce), [`reduceRight`](#reduceRight)
+* [`detect`](#detect), `detectSeries`, `detectLimit`
+* [`sortBy`](#sortBy)
+* [`some`](#some), `someLimit`
+* [`every`](#every), `everyLimit`
+* [`concat`](#concat), `concatSeries`
### Control Flow
-* [series](#series)
-* [parallel](#parallel)
-* [parallelLimit](#parallellimittasks-limit-callback)
-* [whilst](#whilst)
-* [doWhilst](#doWhilst)
-* [until](#until)
-* [doUntil](#doUntil)
-* [forever](#forever)
-* [waterfall](#waterfall)
-* [compose](#compose)
-* [applyEach](#applyEach)
-* [applyEachSeries](#applyEachSeries)
-* [queue](#queue)
-* [cargo](#cargo)
-* [auto](#auto)
-* [iterator](#iterator)
-* [apply](#apply)
-* [nextTick](#nextTick)
-* [times](#times)
-* [timesSeries](#timesSeries)
+* [`series`](#seriestasks-callback)
+* [`parallel`](#parallel), `parallelLimit`
+* [`whilst`](#whilst), [`doWhilst`](#doWhilst)
+* [`until`](#until), [`doUntil`](#doUntil)
+* [`during`](#during), [`doDuring`](#doDuring)
+* [`forever`](#forever)
+* [`waterfall`](#waterfall)
+* [`compose`](#compose)
+* [`seq`](#seq)
+* [`applyEach`](#applyEach), `applyEachSeries`
+* [`queue`](#queue), [`priorityQueue`](#priorityQueue)
+* [`cargo`](#cargo)
+* [`auto`](#auto)
+* [`retry`](#retry)
+* [`iterator`](#iterator)
+* [`times`](#times), `timesSeries`, `timesLimit`
### Utils
-* [memoize](#memoize)
-* [unmemoize](#unmemoize)
-* [log](#log)
-* [dir](#dir)
-* [noConflict](#noConflict)
-
+* [`apply`](#apply)
+* [`nextTick`](#nextTick)
+* [`memoize`](#memoize)
+* [`unmemoize`](#unmemoize)
+* [`ensureAsync`](#ensureAsync)
+* [`constant`](#constant)
+* [`asyncify`](#asyncify)
+* [`wrapSync`](#wrapSync)
+* [`log`](#log)
+* [`dir`](#dir)
+* [`noConflict`](#noConflict)
## Collections
<a name="forEach" />
<a name="each" />
-### each(arr, iterator, callback)
+### each(arr, iterator, [callback])
-Applies an iterator function to each item in an array, in parallel.
-The iterator is called with an item from the list and a callback for when it
-has finished. If the iterator passes an error to this callback, the main
-callback for the each function is immediately called with the error.
+Applies the function `iterator` to each item in `arr`, in parallel.
+The `iterator` is called with an item from the list, and a callback for when it
+has finished. If the `iterator` passes an error to its `callback`, the main
+`callback` (for the `each` function) is immediately called with the error.
-Note, that since this function applies the iterator to each item in parallel
+Note, that since this function applies `iterator` to each item in parallel,
there is no guarantee that the iterator functions will complete in order.
__Arguments__
-* arr - An array to iterate over.
-* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback(err) which must be called once it has
- completed. If no error has occured, the callback should be run without
- arguments or with an explicit null argument.
-* callback(err) - A callback which is called after all the iterator functions
- have finished, or an error has occurred.
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+ The iterator is passed a `callback(err)` which must be called once it has
+ completed. If no error has occurred, the `callback` should be run without
+ arguments or with an explicit `null` argument. The array index is not passed
+ to the iterator. If you need the index, use [`forEachOf`](#forEachOf).
+* `callback(err)` - *Optional* A callback which is called when all `iterator` functions
+ have finished, or an error occurs.
+
+__Examples__
-__Example__
```js
// assuming openFiles is an array of file names and saveFile is a function
@@ -190,148 +268,145 @@ async.each(openFiles, saveFile, function(err){
});
```
----------------------------------------
-
-<a name="forEachSeries" />
-<a name="eachSeries" />
-### eachSeries(arr, iterator, callback)
-
-The same as each only the iterator is applied to each item in the array in
-series. The next iterator is only called once the current one has completed
-processing. This means the iterator functions will complete in order.
-
-
----------------------------------------
-
-<a name="forEachLimit" />
-<a name="eachLimit" />
-### eachLimit(arr, limit, iterator, callback)
-
-The same as each only no more than "limit" iterators will be simultaneously
-running at any time.
-
-Note that the items are not processed in batches, so there is no guarantee that
- the first "limit" iterator functions will complete before any others are
-started.
+```js
+// assuming openFiles is an array of file names
-__Arguments__
+async.each(openFiles, function(file, callback) {
-* arr - An array to iterate over.
-* limit - The maximum number of iterators to run at any time.
-* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback(err) which must be called once it has
- completed. If no error has occured, the callback should be run without
- arguments or with an explicit null argument.
-* callback(err) - A callback which is called after all the iterator functions
- have finished, or an error has occurred.
+ // Perform operation on file here.
+ console.log('Processing file ' + file);
-__Example__
-
-```js
-// Assume documents is an array of JSON objects and requestApi is a
-// function that interacts with a rate-limited REST api.
-
-async.eachLimit(documents, 20, requestApi, function(err){
- // if any of the saves produced an error, err would equal that error
+ if( file.length > 32 ) {
+ console.log('This file name is too long');
+ callback('File name too long');
+ } else {
+ // Do work to process file here
+ console.log('File processed');
+ callback();
+ }
+}, function(err){
+ // if any of the file processing produced an error, err would equal that error
+ if( err ) {
+ // One of the iterations produced an error.
+ // All processing will now stop.
+ console.log('A file failed to process');
+ } else {
+ console.log('All files have been processed successfully');
+ }
});
```
+__Related__
+
+* eachSeries(arr, iterator, [callback])
+* eachLimit(arr, limit, iterator, [callback])
+
---------------------------------------
-<a name="map" />
-### map(arr, iterator, callback)
+<a name="forEachOf" />
+<a name="eachOf" />
-Produces a new array of values by mapping each value in the given array through
-the iterator function. The iterator is called with an item from the array and a
-callback for when it has finished processing. The callback takes 2 arguments,
-an error and the transformed item from the array. If the iterator passes an
-error to this callback, the main callback for the map function is immediately
-called with the error.
+### forEachOf(obj, iterator, [callback])
-Note, that since this function applies the iterator to each item in parallel
-there is no guarantee that the iterator functions will complete in order, however
-the results array will be in the same order as the original array.
+Like `each`, except that it iterates over objects, and passes the key as the second argument to the iterator.
__Arguments__
-* arr - An array to iterate over.
-* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback(err, transformed) which must be called once
- it has completed with an error (which can be null) and a transformed item.
-* callback(err, results) - A callback which is called after all the iterator
- functions have finished, or an error has occurred. Results is an array of the
- transformed items from the original array.
+* `obj` - An object or array to iterate over.
+* `iterator(item, key, callback)` - A function to apply to each item in `obj`.
+The `key` is the item's key, or index in the case of an array. The iterator is
+passed a `callback(err)` which must be called once it has completed. If no
+error has occurred, the callback should be run without arguments or with an
+explicit `null` argument.
+* `callback(err)` - *Optional* A callback which is called when all `iterator` functions have finished, or an error occurs.
__Example__
```js
-async.map(['file1','file2','file3'], fs.stat, function(err, results){
- // results is now an array of stats for each file
-});
+var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"};
+var configs = {};
+
+async.forEachOf(obj, function (value, key, callback) {
+ fs.readFile(__dirname + value, "utf8", function (err, data) {
+ if (err) return callback(err);
+ try {
+ configs[key] = JSON.parse(data);
+ } catch (e) {
+ return callback(e);
+ }
+ callback();
+ })
+}, function (err) {
+ if (err) console.error(err.message);
+ // configs is now a map of JSON data
+ doSomethingWith(configs);
+})
```
----------------------------------------
-
-<a name="mapSeries" />
-### mapSeries(arr, iterator, callback)
-
-The same as map only the iterator is applied to each item in the array in
-series. The next iterator is only called once the current one has completed
-processing. The results array will be in the same order as the original.
+__Related__
+* forEachOfSeries(obj, iterator, [callback])
+* forEachOfLimit(obj, limit, iterator, [callback])
---------------------------------------
-<a name="mapLimit" />
-### mapLimit(arr, limit, iterator, callback)
+<a name="map" />
+### map(arr, iterator, [callback])
-The same as map only no more than "limit" iterators will be simultaneously
-running at any time.
+Produces a new array of values by mapping each value in `arr` through
+the `iterator` function. The `iterator` is called with an item from `arr` and a
+callback for when it has finished processing. Each of these callback takes 2 arguments:
+an `error`, and the transformed item from `arr`. If `iterator` passes an error to its
+callback, the main `callback` (for the `map` function) is immediately called with the error.
-Note that the items are not processed in batches, so there is no guarantee that
- the first "limit" iterator functions will complete before any others are
-started.
+Note, that since this function applies the `iterator` to each item in parallel,
+there is no guarantee that the `iterator` functions will complete in order.
+However, the results array will be in the same order as the original `arr`.
__Arguments__
-* arr - An array to iterate over.
-* limit - The maximum number of iterators to run at any time.
-* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback(err, transformed) which must be called once
- it has completed with an error (which can be null) and a transformed item.
-* callback(err, results) - A callback which is called after all the iterator
- functions have finished, or an error has occurred. Results is an array of the
- transformed items from the original array.
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+ The iterator is passed a `callback(err, transformed)` which must be called once
+ it has completed with an error (which can be `null`) and a transformed item.
+* `callback(err, results)` - *Optional* A callback which is called when all `iterator`
+ functions have finished, or an error occurs. Results is an array of the
+ transformed items from the `arr`.
__Example__
```js
-async.mapLimit(['file1','file2','file3'], 1, fs.stat, function(err, results){
+async.map(['file1','file2','file3'], fs.stat, function(err, results){
// results is now an array of stats for each file
});
```
+__Related__
+* mapSeries(arr, iterator, [callback])
+* mapLimit(arr, limit, iterator, [callback])
+
---------------------------------------
+<a name="select" />
<a name="filter" />
-### filter(arr, iterator, callback)
+### filter(arr, iterator, [callback])
-__Alias:__ select
+__Alias:__ `select`
-Returns a new array of all the values which pass an async truth test.
-_The callback for each iterator call only accepts a single argument of true or
-false, it does not accept an error argument first!_ This is in-line with the
-way node libraries work with truth tests like fs.exists. This operation is
+Returns a new array of all the values in `arr` which pass an async truth test.
+_The callback for each `iterator` call only accepts a single argument of `true` or
+`false`; it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like `fs.exists`. This operation is
performed in parallel, but the results array will be in the same order as the
original.
__Arguments__
-* arr - An array to iterate over.
-* iterator(item, callback) - A truth test to apply to each item in the array.
- The iterator is passed a callback(truthValue) which must be called with a
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in `arr`.
+ The `iterator` is passed a `callback(truthValue)`, which must be called with a
boolean argument once it has completed.
-* callback(results) - A callback which is called after all the iterator
+* `callback(results)` - *Optional* A callback which is called after all the `iterator`
functions have finished.
__Example__
@@ -342,59 +417,50 @@ async.filter(['file1','file2','file3'], fs.exists, function(results){
});
```
----------------------------------------
-
-<a name="filterSeries" />
-### filterSeries(arr, iterator, callback)
+__Related__
-__alias:__ selectSeries
-
-The same as filter only the iterator is applied to each item in the array in
-series. The next iterator is only called once the current one has completed
-processing. The results array will be in the same order as the original.
+* filterSeries(arr, iterator, [callback])
+* filterLimit(arr, limit, iterator, [callback])
---------------------------------------
<a name="reject" />
-### reject(arr, iterator, callback)
-
-The opposite of filter. Removes values that pass an async truth test.
+### reject(arr, iterator, [callback])
----------------------------------------
+The opposite of [`filter`](#filter). Removes values that pass an `async` truth test.
-<a name="rejectSeries" />
-### rejectSeries(arr, iterator, callback)
-
-The same as reject, only the iterator is applied to each item in the array
-in series.
+__Related__
+* rejectSeries(arr, iterator, [callback])
+* rejectLimit(arr, limit, iterator, [callback])
---------------------------------------
<a name="reduce" />
-### reduce(arr, memo, iterator, callback)
+### reduce(arr, memo, iterator, [callback])
+
+__Aliases:__ `inject`, `foldl`
-__aliases:__ inject, foldl
+Reduces `arr` into a single value using an async `iterator` to return
+each successive step. `memo` is the initial state of the reduction.
+This function only operates in series.
-Reduces a list of values into a single value using an async iterator to return
-each successive step. Memo is the initial state of the reduction. This
-function only operates in series. For performance reasons, it may make sense to
-split a call to this function into a parallel map, then use the normal
-Array.prototype.reduce on the results. This function is for situations where
-each step in the reduction needs to be async, if you can get the data before
-reducing it then it's probably a good idea to do so.
+For performance reasons, it may make sense to split a call to this function into
+a parallel map, and then use the normal `Array.prototype.reduce` on the results.
+This function is for situations where each step in the reduction needs to be async;
+if you can get the data before reducing it, then it's probably a good idea to do so.
__Arguments__
-* arr - An array to iterate over.
-* memo - The initial state of the reduction.
-* iterator(memo, item, callback) - A function applied to each item in the
- array to produce the next step in the reduction. The iterator is passed a
- callback(err, reduction) which accepts an optional error as its first
- argument, and the state of the reduction as the second. If an error is
- passed to the callback, the reduction is stopped and the main callback is
+* `arr` - An array to iterate over.
+* `memo` - The initial state of the reduction.
+* `iterator(memo, item, callback)` - A function applied to each item in the
+ array to produce the next step in the reduction. The `iterator` is passed a
+ `callback(err, reduction)` which accepts an optional error as its first
+ argument, and the state of the reduction as the second. If an error is
+ passed to the callback, the reduction is stopped and the main `callback` is
immediately called with the error.
-* callback(err, result) - A callback which is called after all the iterator
+* `callback(err, result)` - *Optional* A callback which is called after all the `iterator`
functions have finished. Result is the reduced value.
__Example__
@@ -413,35 +479,35 @@ async.reduce([1,2,3], 0, function(memo, item, callback){
---------------------------------------
<a name="reduceRight" />
-### reduceRight(arr, memo, iterator, callback)
+### reduceRight(arr, memo, iterator, [callback])
-__Alias:__ foldr
+__Alias:__ `foldr`
-Same as reduce, only operates on the items in the array in reverse order.
+Same as [`reduce`](#reduce), only operates on `arr` in reverse order.
---------------------------------------
<a name="detect" />
-### detect(arr, iterator, callback)
+### detect(arr, iterator, [callback])
-Returns the first value in a list that passes an async truth test. The
-iterator is applied in parallel, meaning the first iterator to return true will
-fire the detect callback with that result. That means the result might not be
-the first item in the original array (in terms of order) that passes the test.
+Returns the first value in `arr` that passes an async truth test. The
+`iterator` is applied in parallel, meaning the first iterator to return `true` will
+fire the detect `callback` with that result. That means the result might not be
+the first item in the original `arr` (in terms of order) that passes the test.
-If order within the original array is important then look at detectSeries.
+If order within the original `arr` is important, then look at [`detectSeries`](#detectSeries).
__Arguments__
-* arr - An array to iterate over.
-* iterator(item, callback) - A truth test to apply to each item in the array.
- The iterator is passed a callback(truthValue) which must be called with a
- boolean argument once it has completed.
-* callback(result) - A callback which is called as soon as any iterator returns
- true, or after all the iterator functions have finished. Result will be
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in `arr`.
+ The iterator is passed a `callback(truthValue)` which must be called with a
+ boolean argument once it has completed. **Note: this callback does not take an error as its first argument.**
+* `callback(result)` - *Optional* A callback which is called as soon as any iterator returns
+ `true`, or after all the `iterator` functions have finished. Result will be
the first item in the array that passes the truth test (iterator) or the
- value undefined if none passed.
+ value `undefined` if none passed. **Note: this callback does not take an error as its first argument.**
__Example__
@@ -451,33 +517,28 @@ async.detect(['file1','file2','file3'], fs.exists, function(result){
});
```
----------------------------------------
-
-<a name="detectSeries" />
-### detectSeries(arr, iterator, callback)
-
-The same as detect, only the iterator is applied to each item in the array
-in series. This means the result is always the first in the original array (in
-terms of array order) that passes the truth test.
+__Related__
+* detectSeries(arr, iterator, [callback])
+* detectLimit(arr, limit, iterator, [callback])
---------------------------------------
<a name="sortBy" />
-### sortBy(arr, iterator, callback)
+### sortBy(arr, iterator, [callback])
-Sorts a list by the results of running each value through an async iterator.
+Sorts a list by the results of running each `arr` value through an async `iterator`.
__Arguments__
-* arr - An array to iterate over.
-* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback(err, sortValue) which must be called once it
- has completed with an error (which can be null) and a value to use as the sort
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+ The iterator is passed a `callback(err, sortValue)` which must be called once it
+ has completed with an error (which can be `null`) and a value to use as the sort
criteria.
-* callback(err, results) - A callback which is called after all the iterator
- functions have finished, or an error has occurred. Results is the items from
- the original array sorted by the values returned by the iterator calls.
+* `callback(err, results)` - *Optional* A callback which is called after all the `iterator`
+ functions have finished, or an error occurs. Results is the items from
+ the original `arr` sorted by the values returned by the `iterator` calls.
__Example__
@@ -492,29 +553,50 @@ async.sortBy(['file1','file2','file3'], function(file, callback){
});
```
+__Sort Order__
+
+By modifying the callback parameter the sorting order can be influenced:
+
+```js
+//ascending order
+async.sortBy([1,9,3,5], function(x, callback){
+ callback(null, x);
+}, function(err,result){
+ //result callback
+} );
+
+//descending order
+async.sortBy([1,9,3,5], function(x, callback){
+ callback(null, x*-1); //<- x*-1 instead of x, turns the order around
+}, function(err,result){
+ //result callback
+} );
+```
+
---------------------------------------
<a name="some" />
-### some(arr, iterator, callback)
+### some(arr, iterator, [callback])
-__Alias:__ any
+__Alias:__ `any`
-Returns true if at least one element in the array satisfies an async test.
-_The callback for each iterator call only accepts a single argument of true or
-false, it does not accept an error argument first!_ This is in-line with the
-way node libraries work with truth tests like fs.exists. Once any iterator
-call returns true, the main callback is immediately called.
+Returns `true` if at least one element in the `arr` satisfies an async test.
+_The callback for each iterator call only accepts a single argument of `true` or
+`false`; it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like `fs.exists`. Once any iterator
+call returns `true`, the main `callback` is immediately called.
__Arguments__
-* arr - An array to iterate over.
-* iterator(item, callback) - A truth test to apply to each item in the array.
- The iterator is passed a callback(truthValue) which must be called with a
- boolean argument once it has completed.
-* callback(result) - A callback which is called as soon as any iterator returns
- true, or after all the iterator functions have finished. Result will be
- either true or false depending on the values of the async tests.
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in the array
+ in parallel. The iterator is passed a `callback(truthValue)`` which must be
+ called with a boolean argument once it has completed.
+* `callback(result)` - *Optional* A callback which is called as soon as any iterator returns
+ `true`, or after all the iterator functions have finished. Result will be
+ either `true` or `false` depending on the values of the async tests.
+ **Note: the callbacks do not take an error as their first argument.**
__Example__
```js
@@ -523,27 +605,33 @@ async.some(['file1','file2','file3'], fs.exists, function(result){
});
```
+__Related__
+
+* someLimit(arr, limit, iterator, callback)
+
---------------------------------------
<a name="every" />
-### every(arr, iterator, callback)
+### every(arr, iterator, [callback])
-__Alias:__ all
+__Alias:__ `all`
-Returns true if every element in the array satisfies an async test.
-_The callback for each iterator call only accepts a single argument of true or
-false, it does not accept an error argument first!_ This is in-line with the
-way node libraries work with truth tests like fs.exists.
+Returns `true` if every element in `arr` satisfies an async test.
+_The callback for each `iterator` call only accepts a single argument of `true` or
+`false`; it does not accept an error argument first!_ This is in-line with the
+way node libraries work with truth tests like `fs.exists`.
__Arguments__
-* arr - An array to iterate over.
-* iterator(item, callback) - A truth test to apply to each item in the array.
- The iterator is passed a callback(truthValue) which must be called with a
- boolean argument once it has completed.
-* callback(result) - A callback which is called after all the iterator
- functions have finished. Result will be either true or false depending on
- the values of the async tests.
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A truth test to apply to each item in the array
+ in parallel. The iterator is passed a `callback(truthValue)` which must be
+ called with a boolean argument once it has completed.
+* `callback(result)` - *Optional* A callback which is called as soon as any iterator returns
+ `false`, or after all the iterator functions have finished. Result will be
+ either `true` or `false` depending on the values of the async tests.
+
+ **Note: the callbacks do not take an error as their first argument.**
__Example__
@@ -553,25 +641,29 @@ async.every(['file1','file2','file3'], fs.exists, function(result){
});
```
+__Related__
+
+* everyLimit(arr, limit, iterator, callback)
+
---------------------------------------
<a name="concat" />
-### concat(arr, iterator, callback)
+### concat(arr, iterator, [callback])
-Applies an iterator to each item in a list, concatenating the results. Returns the
-concatenated list. The iterators are called in parallel, and the results are
+Applies `iterator` to each item in `arr`, concatenating the results. Returns the
+concatenated list. The `iterator`s are called in parallel, and the results are
concatenated as they return. There is no guarantee that the results array will
-be returned in the original order of the arguments passed to the iterator function.
+be returned in the original order of `arr` passed to the `iterator` function.
__Arguments__
-* arr - An array to iterate over
-* iterator(item, callback) - A function to apply to each item in the array.
- The iterator is passed a callback(err, results) which must be called once it
- has completed with an error (which can be null) and an array of results.
-* callback(err, results) - A callback which is called after all the iterator
- functions have finished, or an error has occurred. Results is an array containing
- the concatenated results of the iterator function.
+* `arr` - An array to iterate over.
+* `iterator(item, callback)` - A function to apply to each item in `arr`.
+ The iterator is passed a `callback(err, results)` which must be called once it
+ has completed with an error (which can be `null`) and an array of results.
+* `callback(err, results)` - *Optional* A callback which is called after all the `iterator`
+ functions have finished, or an error occurs. Results is an array containing
+ the concatenated results of the `iterator` function.
__Example__
@@ -581,12 +673,9 @@ async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){
});
```
----------------------------------------
-
-<a name="concatSeries" />
-### concatSeries(arr, iterator, callback)
+__Related__
-Same as async.concat, but executes in series instead of parallel.
+* concatSeries(arr, iterator, [callback])
## Control Flow
@@ -594,26 +683,33 @@ Same as async.concat, but executes in series instead of parallel.
<a name="series" />
### series(tasks, [callback])
-Run an array of functions in series, each one running once the previous
+Run the functions in the `tasks` array in series, each one running once the previous
function has completed. If any functions in the series pass an error to its
-callback, no more functions are run and the callback for the series is
-immediately called with the value of the error. Once the tasks have completed,
-the results are passed to the final callback as an array.
+callback, no more functions are run, and `callback` is immediately called with the value of the error.
+Otherwise, `callback` receives an array of results when `tasks` have completed.
It is also possible to use an object instead of an array. Each property will be
-run as a function and the results will be passed to the final callback as an object
+run as a function, and the results will be passed to the final `callback` as an object
instead of an array. This can be a more readable way of handling results from
-async.series.
+[`series`](#series).
+**Note** that while many implementations preserve the order of object properties, the
+[ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6)
+explicitly states that
+
+> The mechanics and order of enumerating the properties is not specified.
+
+So if you rely on the order in which your series of functions are executed, and want
+this to work on all platforms, consider using an array.
__Arguments__
-* tasks - An array or object containing functions to run, each function is passed
- a callback(err, result) it must call on completion with an error (which can
- be null) and an optional result value.
-* callback(err, results) - An optional callback to run once all the functions
- have completed. This function gets a results array (or object) containing all
- the result arguments passed to the task callbacks.
+* `tasks` - An array or object containing functions to run, each function is passed
+ a `callback(err, result)` it must call on completion with an error `err` (which can
+ be `null`) and an optional `result` value.
+* `callback(err, results)` - An optional callback to run once all the functions
+ have completed. This function gets a results array (or object) containing all
+ the result arguments passed to the `task` callbacks.
__Example__
@@ -657,25 +753,27 @@ function(err, results) {
<a name="parallel" />
### parallel(tasks, [callback])
-Run an array of functions in parallel, without waiting until the previous
+Run the `tasks` array of functions in parallel, without waiting until the previous
function has completed. If any of the functions pass an error to its
-callback, the main callback is immediately called with the value of the error.
-Once the tasks have completed, the results are passed to the final callback as an
+callback, the main `callback` is immediately called with the value of the error.
+Once the `tasks` have completed, the results are passed to the final `callback` as an
array.
+**Note:** `parallel` is about kicking-off I/O tasks in parallel, not about parallel execution of code. If your tasks do not use any timers or perform any I/O, they will actually be executed in series. Any synchronous setup sections for each task will happen one after the other. JavaScript remains single-threaded.
+
It is also possible to use an object instead of an array. Each property will be
-run as a function and the results will be passed to the final callback as an object
+run as a function and the results will be passed to the final `callback` as an object
instead of an array. This can be a more readable way of handling results from
-async.parallel.
+[`parallel`](#parallel).
__Arguments__
-* tasks - An array or object containing functions to run, each function is passed
- a callback(err, result) it must call on completion with an error (which can
- be null) and an optional result value.
-* callback(err, results) - An optional callback to run once all the functions
- have completed. This function gets a results array (or object) containing all
+* `tasks` - An array or object containing functions to run. Each function is passed
+ a `callback(err, result)` which it must call on completion with an error `err`
+ (which can be `null`) and an optional `result` value.
+* `callback(err, results)` - An optional callback to run once all the functions
+ have completed successfully. This function gets a results array (or object) containing all
the result arguments passed to the task callbacks.
__Example__
@@ -718,43 +816,27 @@ function(err, results) {
});
```
----------------------------------------
-
-<a name="parallel" />
-### parallelLimit(tasks, limit, [callback])
+__Related__
-The same as parallel only the tasks are executed in parallel with a maximum of "limit"
-tasks executing at any time.
-
-Note that the tasks are not executed in batches, so there is no guarantee that
-the first "limit" tasks will complete before any others are started.
-
-__Arguments__
-
-* tasks - An array or object containing functions to run, each function is passed
- a callback(err, result) it must call on completion with an error (which can
- be null) and an optional result value.
-* limit - The maximum number of tasks to run at any time.
-* callback(err, results) - An optional callback to run once all the functions
- have completed. This function gets a results array (or object) containing all
- the result arguments passed to the task callbacks.
+* parallelLimit(tasks, limit, [callback])
---------------------------------------
<a name="whilst" />
### whilst(test, fn, callback)
-Repeatedly call fn, while test returns true. Calls the callback when stopped,
+Repeatedly call `fn`, while `test` returns `true`. Calls `callback` when stopped,
or an error occurs.
__Arguments__
-* test() - synchronous truth test to perform before each execution of fn.
-* fn(callback) - A function to call each time the test passes. The function is
- passed a callback(err) which must be called once it has completed with an
- optional error argument.
-* callback(err) - A callback which is called after the test fails and repeated
- execution of fn has stopped.
+* `test()` - synchronous truth test to perform before each execution of `fn`.
+* `fn(callback)` - A function which is called each time `test` passes. The function is
+ passed a `callback(err)`, which must be called once it has completed with an
+ optional `err` argument.
+* `callback(err, [results])` - A callback which is called after the test
+ function has failed and repeated execution of `fn` has stopped. `callback`
+ will be passed an error and any arguments passed to the final `fn`'s callback.
__Example__
@@ -765,10 +847,12 @@ async.whilst(
function () { return count < 5; },
function (callback) {
count++;
- setTimeout(callback, 1000);
+ setTimeout(function () {
+ callback(null, count);
+ }, 1000);
},
- function (err) {
- // 5 seconds have passed
+ function (err, n) {
+ // 5 seconds have passed, n = 5
}
);
```
@@ -778,51 +862,106 @@ async.whilst(
<a name="doWhilst" />
### doWhilst(fn, test, callback)
-The post check version of whilst. To reflect the difference in the order of operations `test` and `fn` arguments are switched. `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
+The post-check version of [`whilst`](#whilst). To reflect the difference in
+the order of operations, the arguments `test` and `fn` are switched.
+
+`doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript.
---------------------------------------
<a name="until" />
### until(test, fn, callback)
-Repeatedly call fn, until test returns true. Calls the callback when stopped,
-or an error occurs.
+Repeatedly call `fn` until `test` returns `true`. Calls `callback` when stopped,
+or an error occurs. `callback` will be passed an error and any arguments passed
+to the final `fn`'s callback.
-The inverse of async.whilst.
+The inverse of [`whilst`](#whilst).
---------------------------------------
<a name="doUntil" />
### doUntil(fn, test, callback)
-Like doWhilst except the test is inverted. Note the argument ordering differs from `until`.
+Like [`doWhilst`](#doWhilst), except the `test` is inverted. Note the argument ordering differs from `until`.
+
+---------------------------------------
+
+<a name="during" />
+### during(test, fn, callback)
+
+Like [`whilst`](#whilst), except the `test` is an asynchronous function that is passed a callback in the form of `function (err, truth)`. If error is passed to `test` or `fn`, the main callback is immediately called with the value of the error.
+
+__Example__
+
+```js
+var count = 0;
+
+async.during(
+ function (callback) {
+ return callback(null, count < 5);
+ },
+ function (callback) {
+ count++;
+ setTimeout(callback, 1000);
+ },
+ function (err) {
+ // 5 seconds have passed
+ }
+);
+```
+
+---------------------------------------
+
+<a name="doDuring" />
+### doDuring(fn, test, callback)
+
+The post-check version of [`during`](#during). To reflect the difference in
+the order of operations, the arguments `test` and `fn` are switched.
+
+Also a version of [`doWhilst`](#doWhilst) with asynchronous `test` function.
---------------------------------------
<a name="forever" />
-### forever(fn, callback)
+### forever(fn, [errback])
+
+Calls the asynchronous function `fn` with a callback parameter that allows it to
+call itself again, in series, indefinitely.
-Calls the asynchronous function 'fn' repeatedly, in series, indefinitely.
-If an error is passed to fn's callback then 'callback' is called with the
-error, otherwise it will never be called.
+If an error is passed to the callback then `errback` is called with the
+error, and execution stops, otherwise it will never be called.
+
+```js
+async.forever(
+ function(next) {
+ // next is suitable for passing to things that need a callback(err [, whatever]);
+ // it will result in this function being called again.
+ },
+ function(err) {
+ // if next is called with a value in its first parameter, it will appear
+ // in here as 'err', and execution will stop.
+ }
+);
+```
---------------------------------------
<a name="waterfall" />
### waterfall(tasks, [callback])
-Runs an array of functions in series, each passing their results to the next in
-the array. However, if any of the functions pass an error to the callback, the
-next function is not executed and the main callback is immediately called with
+Runs the `tasks` array of functions in series, each passing their results to the next in
+the array. However, if any of the `tasks` pass an error to their own callback, the
+next function is not executed, and the main `callback` is immediately called with
the error.
__Arguments__
-* tasks - An array of functions to run, each function is passed a
- callback(err, result1, result2, ...) it must call on completion. The first
- argument is an error (which can be null) and any further arguments will be
+* `tasks` - An array of functions to run, each function is passed a
+ `callback(err, result1, result2, ...)` it must call on completion. The first
+ argument is an error (which can be `null`) and any further arguments will be
passed as arguments in order to the next task.
-* callback(err, [results]) - An optional callback to run once all the functions
+* `callback(err, [results])` - An optional callback to run once all the functions
have completed. This will be passed the results of the last task's callback.
@@ -831,19 +970,66 @@ __Example__
```js
async.waterfall([
- function(callback){
+ function(callback) {
callback(null, 'one', 'two');
},
- function(arg1, arg2, callback){
+ function(arg1, arg2, callback) {
+ // arg1 now equals 'one' and arg2 now equals 'two'
callback(null, 'three');
},
- function(arg1, callback){
+ function(arg1, callback) {
// arg1 now equals 'three'
callback(null, 'done');
}
], function (err, result) {
- // result now equals 'done'
+ // result now equals 'done'
+});
+```
+Or, with named functions:
+
+```js
+async.waterfall([
+ myFirstFunction,
+ mySecondFunction,
+ myLastFunction,
+], function (err, result) {
+ // result now equals 'done'
+});
+function myFirstFunction(callback) {
+ callback(null, 'one', 'two');
+}
+function mySecondFunction(arg1, arg2, callback) {
+ // arg1 now equals 'one' and arg2 now equals 'two'
+ callback(null, 'three');
+}
+function myLastFunction(arg1, callback) {
+ // arg1 now equals 'three'
+ callback(null, 'done');
+}
+```
+
+Or, if you need to pass any argument to the first function:
+
+```js
+async.waterfall([
+ async.apply(myFirstFunction, 'zero'),
+ mySecondFunction,
+ myLastFunction,
+], function (err, result) {
+ // result now equals 'done'
});
+function myFirstFunction(arg1, callback) {
+ // arg1 now equals 'zero'
+ callback(null, 'one', 'two');
+}
+function mySecondFunction(arg1, arg2, callback) {
+ // arg1 now equals 'one' and arg2 now equals 'two'
+ callback(null, 'three');
+}
+function myLastFunction(arg1, callback) {
+ // arg1 now equals 'three'
+ callback(null, 'done');
+}
```
---------------------------------------
@@ -852,14 +1038,14 @@ async.waterfall([
Creates a function which is a composition of the passed asynchronous
functions. Each function consumes the return value of the function that
-follows. Composing functions f(), g() and h() would produce the result of
-f(g(h())), only this version uses callbacks to obtain the return values.
+follows. Composing functions `f()`, `g()`, and `h()` would produce the result of
+`f(g(h()))`, only this version uses callbacks to obtain the return values.
Each function is executed with the `this` binding of the composed function.
__Arguments__
-* functions... - the asynchronous functions to compose
+* `functions...` - the asynchronous functions to compose
__Example__
@@ -885,19 +1071,59 @@ add1mul3(4, function (err, result) {
```
---------------------------------------
+<a name="seq" />
+### seq(fn1, fn2...)
+
+Version of the compose function that is more natural to read.
+Each function consumes the return value of the previous function.
+It is the equivalent of [`compose`](#compose) with the arguments reversed.
+
+Each function is executed with the `this` binding of the composed function.
+
+__Arguments__
+
+* `functions...` - the asynchronous functions to compose
+
+
+__Example__
+
+```js
+// Requires lodash (or underscore), express3 and dresende's orm2.
+// Part of an app, that fetches cats of the logged user.
+// This example uses `seq` function to avoid overnesting and error
+// handling clutter.
+app.get('/cats', function(request, response) {
+ var User = request.models.User;
+ async.seq(
+ _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data))
+ function(user, fn) {
+ user.getCats(fn); // 'getCats' has signature (callback(err, data))
+ }
+ )(req.session.user_id, function (err, cats) {
+ if (err) {
+ console.error(err);
+ response.json({ status: 'error', message: err.message });
+ } else {
+ response.json({ status: 'ok', message: 'Cats found', data: cats });
+ }
+ });
+});
+```
+
+---------------------------------------
<a name="applyEach" />
### applyEach(fns, args..., callback)
-Applies the provided arguments to each function in the array, calling the
-callback after all functions have completed. If you only provide the first
-argument then it will return a function which lets you pass in the
+Applies the provided arguments to each function in the array, calling
+`callback` after all functions have completed. If you only provide the first
+argument, then it will return a function which lets you pass in the
arguments as if it were a single function call.
__Arguments__
-* fns - the asynchronous functions to all call with the same arguments
-* args... - any number of separate arguments to pass to the function
-* callback - the final argument should be the callback, called when all
+* `fns` - the asynchronous functions to all call with the same arguments
+* `args...` - any number of separate arguments to pass to the function
+* `callback` - the final argument should be the callback, called when all
functions have completed processing
@@ -914,47 +1140,53 @@ async.each(
);
```
----------------------------------------
-
-<a name="applyEachSeries" />
-### applyEachSeries(arr, iterator, callback)
+__Related__
-The same as applyEach only the functions are applied in series.
+* applyEachSeries(tasks, args..., [callback])
---------------------------------------
<a name="queue" />
-### queue(worker, concurrency)
+### queue(worker, [concurrency])
-Creates a queue object with the specified concurrency. Tasks added to the
-queue will be processed in parallel (up to the concurrency limit). If all
-workers are in progress, the task is queued until one is available. Once
-a worker has completed a task, the task's callback is called.
+Creates a `queue` object with the specified `concurrency`. Tasks added to the
+`queue` are processed in parallel (up to the `concurrency` limit). If all
+`worker`s are in progress, the task is queued until one becomes available.
+Once a `worker` completes a `task`, that `task`'s callback is called.
__Arguments__
-* worker(task, callback) - An asynchronous function for processing a queued
- task, which must call its callback(err) argument when finished, with an
- optional error as an argument.
-* concurrency - An integer for determining how many worker functions should be
- run in parallel.
+* `worker(task, callback)` - An asynchronous function for processing a queued
+ task, which must call its `callback(err)` argument when finished, with an
+ optional `error` as an argument. If you want to handle errors from an individual task, pass a callback to `q.push()`.
+* `concurrency` - An `integer` for determining how many `worker` functions should be
+ run in parallel. If omitted, the concurrency defaults to `1`. If the concurrency is `0`, an error is thrown.
__Queue objects__
-The queue object returned by this function has the following properties and
+The `queue` object returned by this function has the following properties and
methods:
-* length() - a function returning the number of items waiting to be processed.
-* concurrency - an integer for determining how many worker functions should be
- run in parallel. This property can be changed after a queue is created to
+* `length()` - a function returning the number of items waiting to be processed.
+* `started` - a function returning whether or not any items have been pushed and processed by the queue
+* `running()` - a function returning the number of items currently being processed.
+* `workersList()` - a function returning the array of items currently being processed.
+* `idle()` - a function returning false if there are items waiting or being processed, or true if not.
+* `concurrency` - an integer for determining how many `worker` functions should be
+ run in parallel. This property can be changed after a `queue` is created to
alter the concurrency on-the-fly.
-* push(task, [callback]) - add a new task to the queue, the callback is called
- once the worker has finished processing the task.
- instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.
-* unshift(task, [callback]) - add a new task to the front of the queue.
-* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued
-* empty - a callback that is called when the last item from the queue is given to a worker
-* drain - a callback that is called when the last item from the queue has returned from the worker
+* `push(task, [callback])` - add a new task to the `queue`. Calls `callback` once
+ the `worker` has finished processing the task. Instead of a single task, a `tasks` array
+ can be submitted. The respective callback is used for every task in the list.
+* `unshift(task, [callback])` - add a new task to the front of the `queue`.
+* `saturated` - a callback that is called when the `queue` length hits the `concurrency` limit,
+ and further tasks will be queued.
+* `empty` - a callback that is called when the last item from the `queue` is given to a `worker`.
+* `drain` - a callback that is called when the last item from the `queue` has returned from the `worker`.
+* `paused` - a boolean for determining whether the queue is in a paused state
+* `pause()` - a function that pauses the processing of tasks until `resume()` is called.
+* `resume()` - a function that resumes the processing of queued tasks when the queue is paused.
+* `kill()` - a function that removes the `drain` callback and empties remaining tasks from the queue forcing it to go idle.
__Example__
@@ -984,7 +1216,7 @@ q.push({name: 'bar'}, function (err) {
// add some items to the queue (batch-wise)
q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) {
- console.log('finished processing bar');
+ console.log('finished processing item');
});
// add some items to the front of the queue
@@ -994,39 +1226,57 @@ q.unshift({name: 'bar'}, function (err) {
});
```
+
+---------------------------------------
+
+<a name="priorityQueue" />
+### priorityQueue(worker, concurrency)
+
+The same as [`queue`](#queue) only tasks are assigned a priority and completed in ascending priority order. There are two differences between `queue` and `priorityQueue` objects:
+
+* `push(task, priority, [callback])` - `priority` should be a number. If an array of
+ `tasks` is given, all tasks will be assigned the same priority.
+* The `unshift` method was removed.
+
---------------------------------------
<a name="cargo" />
### cargo(worker, [payload])
-Creates a cargo object with the specified payload. Tasks added to the
-cargo will be processed altogether (up to the payload limit). If the
-worker is in progress, the task is queued until it is available. Once
-the worker has completed some tasks, each callback of those tasks is called.
+Creates a `cargo` object with the specified payload. Tasks added to the
+cargo will be processed altogether (up to the `payload` limit). If the
+`worker` is in progress, the task is queued until it becomes available. Once
+the `worker` has completed some tasks, each callback of those tasks is called.
+Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) for how `cargo` and `queue` work.
+
+While [queue](#queue) passes only one task to one of a group of workers
+at a time, cargo passes an array of tasks to a single worker, repeating
+when the worker is finished.
__Arguments__
-* worker(tasks, callback) - An asynchronous function for processing an array of
- queued tasks, which must call its callback(err) argument when finished, with
- an optional error as an argument.
-* payload - An optional integer for determining how many tasks should be
+* `worker(tasks, callback)` - An asynchronous function for processing an array of
+ queued tasks, which must call its `callback(err)` argument when finished, with
+ an optional `err` argument.
+* `payload` - An optional `integer` for determining how many tasks should be
processed per round; if omitted, the default is unlimited.
__Cargo objects__
-The cargo object returned by this function has the following properties and
+The `cargo` object returned by this function has the following properties and
methods:
-* length() - a function returning the number of items waiting to be processed.
-* payload - an integer for determining how many tasks should be
- process per round. This property can be changed after a cargo is created to
+* `length()` - A function returning the number of items waiting to be processed.
+* `payload` - An `integer` for determining how many tasks should be
+ process per round. This property can be changed after a `cargo` is created to
alter the payload on-the-fly.
-* push(task, [callback]) - add a new task to the queue, the callback is called
- once the worker has finished processing the task.
- instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list.
-* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued
-* empty - a callback that is called when the last item from the queue is given to a worker
-* drain - a callback that is called when the last item from the queue has returned from the worker
+* `push(task, [callback])` - Adds `task` to the `queue`. The callback is called
+ once the `worker` has finished processing the task. Instead of a single task, an array of `tasks`
+ can be submitted. The respective callback is used for every task in the list.
+* `saturated` - A callback that is called when the `queue.length()` hits the concurrency and further tasks will be queued.
+* `empty` - A callback that is called when the last item from the `queue` is given to a `worker`.
+* `drain` - A callback that is called when the last item from the `queue` has returned from the `worker`.
+* `idle()`, `pause()`, `resume()`, `kill()` - cargo inherits all of the same methods and event calbacks as [`queue`](#queue)
__Example__
@@ -1057,19 +1307,17 @@ cargo.push({name: 'baz'}, function (err) {
---------------------------------------
<a name="auto" />
-### auto(tasks, [callback])
+### auto(tasks, [concurrency], [callback])
+
+Determines the best order for running the functions in `tasks`, based on their requirements. Each function can optionally depend on other functions being completed first, and each function is run as soon as its requirements are satisfied.
-Determines the best order for running functions based on their requirements.
-Each function can optionally depend on other functions being completed first,
-and each function is run as soon as its requirements are satisfied. If any of
-the functions pass an error to their callback, that function will not complete
-(so any other functions depending on it will not run) and the main callback
-will be called immediately with the error. Functions also receive an object
-containing the results of functions which have completed so far.
+If any of the functions pass an error to their callback, the `auto` sequence will stop. Further tasks will not execute (so any other functions depending on it will not run), and the main `callback` is immediately called with the error. Functions also receive an object containing the results of functions which have completed so far.
-Note, all functions are called with a results object as a second argument,
-so it is unsafe to pass functions in the tasks object which cannot handle the
-extra argument. For example, this snippet of code:
+Note, all functions are called with a `results` object as a second argument,
+so it is unsafe to pass functions in the `tasks` object which cannot handle the
+extra argument.
+
+For example, this snippet of code:
```js
async.auto({
@@ -1077,15 +1325,15 @@ async.auto({
}, callback);
```
-will have the effect of calling readFile with the results object as the last
+will have the effect of calling `readFile` with the results object as the last
argument, which will fail:
```js
fs.readFile('data.txt', 'utf-8', cb, {});
```
-Instead, wrap the call to readFile in a function which does not forward the
-results object:
+Instead, wrap the call to `readFile` in a function which does not forward the
+`results` object:
```js
async.auto({
@@ -1097,40 +1345,52 @@ async.auto({
__Arguments__
-* tasks - An object literal containing named functions or an array of
- requirements, with the function itself the last item in the array. The key
- used for each function or array is used when specifying requirements. The
- function receives two arguments: (1) a callback(err, result) which must be
- called when finished, passing an error (which can be null) and the result of
- the function's execution, and (2) a results object, containing the results of
+* `tasks` - An object. Each of its properties is either a function or an array of
+ requirements, with the function itself the last item in the array. The object's key
+ of a property serves as the name of the task defined by that property,
+ i.e. can be used when specifying requirements for other tasks.
+ The function receives two arguments: (1) a `callback(err, result)` which must be
+ called when finished, passing an `error` (which can be `null`) and the result of
+ the function's execution, and (2) a `results` object, containing the results of
the previously executed functions.
-* callback(err, results) - An optional callback which is called when all the
- tasks have been completed. The callback will receive an error as an argument
- if any tasks pass an error to their callback. Results will always be passed
- but if an error occurred, no other tasks will be performed, and the results
- object will only contain partial results.
-
+* `concurrency` - An optional `integer` for determining the maximum number of tasks that can be run in parallel. By default, as many as possible.
+* `callback(err, results)` - An optional callback which is called when all the
+ tasks have been completed. It receives the `err` argument if any `tasks`
+ pass an error to their callback. Results are always returned; however, if
+ an error occurs, no further `tasks` will be performed, and the results
+ object will only contain partial results.
+
__Example__
```js
async.auto({
get_data: function(callback){
+ console.log('in get_data');
// async code to get some data
+ callback(null, 'data', 'converted to array');
},
make_folder: function(callback){
+ console.log('in make_folder');
// async code to create a directory to store a file in
// this is run at the same time as getting the data
+ callback(null, 'folder');
},
- write_file: ['get_data', 'make_folder', function(callback){
+ write_file: ['get_data', 'make_folder', function(callback, results){
+ console.log('in write_file', JSON.stringify(results));
// once there is some data and the directory exists,
// write the data to a file in the directory
- callback(null, filename);
+ callback(null, 'filename');
}],
email_link: ['write_file', function(callback, results){
+ console.log('in email_link', JSON.stringify(results));
// once the file is written let's email a link to it...
// results.write_file contains the filename returned by write_file.
+ callback(null, {'file':results.write_file, 'email':'user@example.com'});
}]
+}, function(err, results) {
+ console.log('err = ', err);
+ console.log('results = ', results);
});
```
@@ -1140,28 +1400,96 @@ series functions would look like this:
```js
async.parallel([
function(callback){
+ console.log('in get_data');
// async code to get some data
+ callback(null, 'data', 'converted to array');
},
function(callback){
+ console.log('in make_folder');
// async code to create a directory to store a file in
// this is run at the same time as getting the data
+ callback(null, 'folder');
}
],
function(err, results){
async.series([
function(callback){
+ console.log('in write_file', JSON.stringify(results));
// once there is some data and the directory exists,
// write the data to a file in the directory
+ results.push('filename');
+ callback(null);
},
function(callback){
+ console.log('in email_link', JSON.stringify(results));
// once the file is written let's email a link to it...
+ callback(null, {'file':results.pop(), 'email':'user@example.com'});
}
]);
});
```
-For a complicated series of async tasks using the auto function makes adding
-new tasks much easier and makes the code more readable.
+For a complicated series of `async` tasks, using the [`auto`](#auto) function makes adding
+new tasks much easier (and the code more readable).
+
+
+---------------------------------------
+
+<a name="retry" />
+### retry([opts = {times: 5, interval: 0}| 5], task, [callback])
+
+Attempts to get a successful response from `task` no more than `times` times before
+returning an error. If the task is successful, the `callback` will be passed the result
+of the successful task. If all attempts fail, the callback will be passed the error and
+result (if any) of the final attempt.
+
+__Arguments__
+
+* `opts` - Can be either an object with `times` and `interval` or a number.
+ * `times` - The number of attempts to make before giving up. The default is `5`.
+ * `interval` - The time to wait between retries, in milliseconds. The default is `0`.
+ * If `opts` is a number, the number specifies the number of times to retry, with the default interval of `0`.
+* `task(callback, results)` - A function which receives two arguments: (1) a `callback(err, result)`
+ which must be called when finished, passing `err` (which can be `null`) and the `result` of
+ the function's execution, and (2) a `results` object, containing the results of
+ the previously executed functions (if nested inside another control flow).
+* `callback(err, results)` - An optional callback which is called when the
+ task has succeeded, or after the final failed attempt. It receives the `err` and `result` arguments of the last attempt at completing the `task`.
+
+The [`retry`](#retry) function can be used as a stand-alone control flow by passing a callback, as shown below:
+
+```js
+// try calling apiMethod 3 times
+async.retry(3, apiMethod, function(err, result) {
+ // do something with the result
+});
+```
+
+```js
+// try calling apiMethod 3 times, waiting 200 ms between each retry
+async.retry({times: 3, interval: 200}, apiMethod, function(err, result) {
+ // do something with the result
+});
+```
+
+```js
+// try calling apiMethod the default 5 times no delay between each retry
+async.retry(apiMethod, function(err, result) {
+ // do something with the result
+});
+```
+
+It can also be embedded within other control flow functions to retry individual methods
+that are not as reliable, like this:
+
+```js
+async.auto({
+ users: api.getUsers.bind(api),
+ payments: async.retry(3, api.getPayments.bind(api))
+}, function(err, results) {
+ // do something with the results
+});
+```
---------------------------------------
@@ -1169,16 +1497,16 @@ new tasks much easier and makes the code more readable.
<a name="iterator" />
### iterator(tasks)
-Creates an iterator function which calls the next function in the array,
+Creates an iterator function which calls the next function in the `tasks` array,
returning a continuation to call the next one after that. It's also possible to
-'peek' the next iterator by doing iterator.next().
+“peek” at the next iterator with `iterator.next()`.
-This function is used internally by the async module but can be useful when
+This function is used internally by the `async` module, but can be useful when
you want to manually control the flow of functions in series.
__Arguments__
-* tasks - An array of functions to run.
+* `tasks` - An array of functions to run.
__Example__
@@ -1205,15 +1533,16 @@ node> nextfn();
<a name="apply" />
### apply(function, arguments..)
-Creates a continuation function with some arguments already applied, a useful
-shorthand when combined with other control flow functions. Any arguments
+Creates a continuation function with some arguments already applied.
+
+Useful as a shorthand when combined with other control flow functions. Any arguments
passed to the returned function are added to the arguments originally passed
to apply.
__Arguments__
-* function - The function you want to eventually apply all arguments to.
-* arguments... - Any number of arguments to automatically apply when the
+* `function` - The function you want to eventually apply all arguments to.
+* `arguments...` - Any number of arguments to automatically apply when the
continuation is called.
__Example__
@@ -1253,18 +1582,18 @@ three
---------------------------------------
<a name="nextTick" />
-### nextTick(callback)
+### nextTick(callback), setImmediate(callback)
-Calls the callback on a later loop around the event loop. In node.js this just
-calls process.nextTick, in the browser it falls back to setImmediate(callback)
-if available, otherwise setTimeout(callback, 0), which means other higher priority
-events may precede the execution of the callback.
+Calls `callback` on a later loop around the event loop. In Node.js this just
+calls `process.nextTick`; in the browser it falls back to `setImmediate(callback)`
+if available, otherwise `setTimeout(callback, 0)`, which means other higher priority
+events may precede the execution of `callback`.
This is used internally for browser-compatibility purposes.
__Arguments__
-* callback - The function to call on a later loop around the event loop.
+* `callback` - The function to call on a later loop around the event loop.
__Example__
@@ -1278,15 +1607,16 @@ call_order.push('one')
```
<a name="times" />
-### times(n, callback)
+### times(n, iterator, [callback])
-Calls the callback n times and accumulates results in the same manner
-you would use with async.map.
+Calls the `iterator` function `n` times, and accumulates results in the same manner
+you would use with [`map`](#map).
__Arguments__
-* n - The number of times to run the function.
-* callback - The function to call n times.
+* `n` - The number of times to run the function.
+* `iterator` - The function to call `n` times.
+* `callback` - see [`map`](#map)
__Example__
@@ -1307,12 +1637,10 @@ async.times(5, function(n, next){
});
```
-<a name="timesSeries" />
-### timesSeries(n, callback)
+__Related__
-The same as times only the iterator is applied to each item in the array in
-series. The next iterator is only called once the current one has completed
-processing. The results array will be in the same order as the original.
+* timesSeries(n, iterator, [callback])
+* timesLimit(n, limit, iterator, [callback])
## Utils
@@ -1320,18 +1648,20 @@ processing. The results array will be in the same order as the original.
<a name="memoize" />
### memoize(fn, [hasher])
-Caches the results of an async function. When creating a hash to store function
+Caches the results of an `async` function. When creating a hash to store function
results against, the callback is omitted from the hash and an optional hash
function can be used.
+If no hash function is specified, the first argument is used as a hash key, which may work reasonably if it is a string or a data type that converts to a distinct string. Note that objects and arrays will not behave reasonably. Neither will cases where the other arguments are significant. In such cases, specify your own hash function.
+
The cache of results is exposed as the `memo` property of the function returned
by `memoize`.
__Arguments__
-* fn - the function you to proxy and cache results from.
-* hasher - an optional function for generating a custom hash for storing
- results, it has all the arguments applied to it apart from the callback, and
+* `fn` - The function to proxy and cache results from.
+* `hasher` - An optional function for generating a custom hash for storing
+ results. It has all the arguments applied to it apart from the callback, and
must be synchronous.
__Example__
@@ -1352,25 +1682,147 @@ fn('some name', function () {
<a name="unmemoize" />
### unmemoize(fn)
-Undoes a memoized function, reverting it to the original, unmemoized
-form. Comes handy in tests.
+Undoes a [`memoize`](#memoize)d function, reverting it to the original, unmemoized
+form. Handy for testing.
__Arguments__
-* fn - the memoized function
+* `fn` - the memoized function
+
+---------------------------------------
+
+<a name="ensureAsync" />
+### ensureAsync(fn)
+
+Wrap an async function and ensure it calls its callback on a later tick of the event loop. If the function already calls its callback on a next tick, no extra deferral is added. This is useful for preventing stack overflows (`RangeError: Maximum call stack size exceeded`) and generally keeping [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony) contained.
+
+__Arguments__
+
+* `fn` - an async function, one that expects a node-style callback as its last argument
+
+Returns a wrapped function with the exact same call signature as the function passed in.
+
+__Example__
+
+```js
+function sometimesAsync(arg, callback) {
+ if (cache[arg]) {
+ return callback(null, cache[arg]); // this would be synchronous!!
+ } else {
+ doSomeIO(arg, callback); // this IO would be asynchronous
+ }
+}
+
+// this has a risk of stack overflows if many results are cached in a row
+async.mapSeries(args, sometimesAsync, done);
+
+// this will defer sometimesAsync's callback if necessary,
+// preventing stack overflows
+async.mapSeries(args, async.ensureAsync(sometimesAsync), done);
+
+```
+
+---------------------------------------
+
+<a name="constant">
+### constant(values...)
+
+Returns a function that when called, calls-back with the values provided. Useful as the first function in a `waterfall`, or for plugging values in to `auto`.
+
+__Example__
+
+```js
+async.waterfall([
+ async.constant(42),
+ function (value, next) {
+ // value === 42
+ },
+ //...
+], callback);
+
+async.waterfall([
+ async.constant(filename, "utf8"),
+ fs.readFile,
+ function (fileData, next) {
+ //...
+ }
+ //...
+], callback);
+
+async.auto({
+ hostname: async.constant("https://server.net/"),
+ port: findFreePort,
+ launchServer: ["hostname", "port", function (cb, options) {
+ startServer(options, cb);
+ }],
+ //...
+}, callback);
+
+```
+
+---------------------------------------
+
+<a name="asyncify">
+<a name="wrapSync">
+### asyncify(func)
+
+__Alias:__ `wrapSync`
+
+Take a sync function and make it async, passing its return value to a callback. This is useful for plugging sync functions into a waterfall, series, or other async functions. Any arguments passed to the generated function will be passed to the wrapped function (except for the final callback argument). Errors thrown will be passed to the callback.
+
+__Example__
+
+```js
+async.waterfall([
+ async.apply(fs.readFile, filename, "utf8"),
+ async.asyncify(JSON.parse),
+ function (data, next) {
+ // data is the result of parsing the text.
+ // If there was a parsing error, it would have been caught.
+ }
+], callback)
+```
+
+If the function passed to `asyncify` returns a Promise, that promises's resolved/rejected state will be used to call the callback, rather than simply the synchronous return value. Example:
+
+```js
+async.waterfall([
+ async.apply(fs.readFile, filename, "utf8"),
+ async.asyncify(function (contents) {
+ return db.model.create(contents);
+ }),
+ function (model, next) {
+ // `model` is the instantiated model object.
+ // If there was an error, this function would be skipped.
+ }
+], callback)
+```
+
+This also means you can asyncify ES2016 `async` functions.
+
+```js
+var q = async.queue(async.asyncify(async function (file) {
+ var intermediateStep = await processFile(file);
+ return await somePromise(intermediateStep)
+}));
+
+q.push(files);
+```
+
+---------------------------------------
<a name="log" />
### log(function, arguments)
-Logs the result of an async function to the console. Only works in node.js or
-in browsers that support console.log and console.error (such as FF and Chrome).
-If multiple arguments are returned from the async function, console.log is
+Logs the result of an `async` function to the `console`. Only works in Node.js or
+in browsers that support `console.log` and `console.error` (such as FF and Chrome).
+If multiple arguments are returned from the async function, `console.log` is
called on each argument in order.
__Arguments__
-* function - The function you want to eventually apply all arguments to.
-* arguments... - Any number of arguments to apply to the function.
+* `function` - The function you want to eventually apply all arguments to.
+* `arguments...` - Any number of arguments to apply to the function.
__Example__
@@ -1391,16 +1843,16 @@ node> async.log(hello, 'world');
<a name="dir" />
### dir(function, arguments)
-Logs the result of an async function to the console using console.dir to
-display the properties of the resulting object. Only works in node.js or
-in browsers that support console.dir and console.error (such as FF and Chrome).
-If multiple arguments are returned from the async function, console.dir is
+Logs the result of an `async` function to the `console` using `console.dir` to
+display the properties of the resulting object. Only works in Node.js or
+in browsers that support `console.dir` and `console.error` (such as FF and Chrome).
+If multiple arguments are returned from the async function, `console.dir` is
called on each argument in order.
__Arguments__
-* function - The function you want to eventually apply all arguments to.
-* arguments... - Any number of arguments to apply to the function.
+* `function` - The function you want to eventually apply all arguments to.
+* `arguments...` - Any number of arguments to apply to the function.
__Example__
@@ -1421,5 +1873,5 @@ node> async.dir(hello, 'world');
<a name="noConflict" />
### noConflict()
-Changes the value of async back to its original value, returning a reference to the
-async object.
+Changes the value of `async` back to its original value, returning a reference to the
+`async` object.
diff --git a/node_modules/async/component.json b/node_modules/async/component.json
@@ -1,11 +0,0 @@
-{
- "name": "async",
- "repo": "caolan/async",
- "description": "Higher-order functions and common patterns for asynchronous code",
- "version": "0.1.23",
- "keywords": [],
- "dependencies": {},
- "development": {},
- "main": "lib/async.js",
- "scripts": [ "lib/async.js" ]
-}
diff --git a/node_modules/async/lib/async.js b/node_modules/async/lib/async.js
@@ -1,14 +1,36 @@
-/*global setImmediate: false, setTimeout: false, console: false */
+/*!
+ * async
+ * https://github.com/caolan/async
+ *
+ * Copyright 2010-2014 Caolan McMahon
+ * Released under the MIT license
+ */
(function () {
var async = {};
+ function noop() {}
+ function identity(v) {
+ return v;
+ }
+ function toBool(v) {
+ return !!v;
+ }
+ function notId(v) {
+ return !v;
+ }
// global on the server, window in the browser
- var root, previous_async;
+ var previous_async;
+
+ // Establish the root object, `window` (`self`) in the browser, `global`
+ // on the server, or `this` in some virtual machines. We use `self`
+ // instead of `window` for `WebWorker` support.
+ var root = typeof self === 'object' && self.self === self && self ||
+ typeof global === 'object' && global.global === global && global ||
+ this;
- root = this;
if (root != null) {
- previous_async = root.async;
+ previous_async = root.async;
}
async.noConflict = function () {
@@ -17,50 +39,89 @@
};
function only_once(fn) {
- var called = false;
return function() {
- if (called) throw new Error("Callback was already called.");
- called = true;
- fn.apply(root, arguments);
- }
+ if (fn === null) throw new Error("Callback was already called.");
+ fn.apply(this, arguments);
+ fn = null;
+ };
+ }
+
+ function _once(fn) {
+ return function() {
+ if (fn === null) return;
+ fn.apply(this, arguments);
+ fn = null;
+ };
}
//// cross-browser compatiblity functions ////
- var _each = function (arr, iterator) {
- if (arr.forEach) {
- return arr.forEach(iterator);
- }
- for (var i = 0; i < arr.length; i += 1) {
- iterator(arr[i], i, arr);
- }
+ var _toString = Object.prototype.toString;
+
+ var _isArray = Array.isArray || function (obj) {
+ return _toString.call(obj) === '[object Array]';
};
- var _map = function (arr, iterator) {
- if (arr.map) {
- return arr.map(iterator);
- }
- var results = [];
- _each(arr, function (x, i, a) {
- results.push(iterator(x, i, a));
- });
- return results;
+ // Ported from underscore.js isObject
+ var _isObject = function(obj) {
+ var type = typeof obj;
+ return type === 'function' || type === 'object' && !!obj;
};
- var _reduce = function (arr, iterator, memo) {
- if (arr.reduce) {
- return arr.reduce(iterator, memo);
+ function _isArrayLike(arr) {
+ return _isArray(arr) || (
+ // has a positive integer length property
+ typeof arr.length === "number" &&
+ arr.length >= 0 &&
+ arr.length % 1 === 0
+ );
+ }
+
+ function _arrayEach(arr, iterator) {
+ var index = -1,
+ length = arr.length;
+
+ while (++index < length) {
+ iterator(arr[index], index, arr);
+ }
+ }
+
+ function _map(arr, iterator) {
+ var index = -1,
+ length = arr.length,
+ result = Array(length);
+
+ while (++index < length) {
+ result[index] = iterator(arr[index], index, arr);
}
- _each(arr, function (x, i, a) {
+ return result;
+ }
+
+ function _range(count) {
+ return _map(Array(count), function (v, i) { return i; });
+ }
+
+ function _reduce(arr, iterator, memo) {
+ _arrayEach(arr, function (x, i, a) {
memo = iterator(memo, x, i, a);
});
return memo;
- };
+ }
+
+ function _forEachOf(object, iterator) {
+ _arrayEach(_keys(object), function (key) {
+ iterator(object[key], key);
+ });
+ }
- var _keys = function (obj) {
- if (Object.keys) {
- return Object.keys(obj);
+ function _indexOf(arr, item) {
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i] === item) return i;
}
+ return -1;
+ }
+
+ var _keys = Object.keys || function (obj) {
var keys = [];
for (var k in obj) {
if (obj.hasOwnProperty(k)) {
@@ -70,182 +131,247 @@
return keys;
};
- //// exported async module functions ////
-
- //// nextTick implementation with browser-compatible fallback ////
- if (typeof process === 'undefined' || !(process.nextTick)) {
- if (typeof setImmediate === 'function') {
- async.nextTick = function (fn) {
- // not a direct alias for IE10 compatibility
- setImmediate(fn);
+ function _keyIterator(coll) {
+ var i = -1;
+ var len;
+ var keys;
+ if (_isArrayLike(coll)) {
+ len = coll.length;
+ return function next() {
+ i++;
+ return i < len ? i : null;
};
- async.setImmediate = async.nextTick;
- }
- else {
- async.nextTick = function (fn) {
- setTimeout(fn, 0);
+ } else {
+ keys = _keys(coll);
+ len = keys.length;
+ return function next() {
+ i++;
+ return i < len ? keys[i] : null;
};
- async.setImmediate = async.nextTick;
}
}
- else {
+
+ // Similar to ES6's rest param (http://ariya.ofilabs.com/2013/03/es6-and-rest-parameter.html)
+ // This accumulates the arguments passed into an array, after a given index.
+ // From underscore.js (https://github.com/jashkenas/underscore/pull/2140).
+ function _restParam(func, startIndex) {
+ startIndex = startIndex == null ? func.length - 1 : +startIndex;
+ return function() {
+ var length = Math.max(arguments.length - startIndex, 0);
+ var rest = Array(length);
+ for (var index = 0; index < length; index++) {
+ rest[index] = arguments[index + startIndex];
+ }
+ switch (startIndex) {
+ case 0: return func.call(this, rest);
+ case 1: return func.call(this, arguments[0], rest);
+ }
+ // Currently unused but handle cases outside of the switch statement:
+ // var args = Array(startIndex + 1);
+ // for (index = 0; index < startIndex; index++) {
+ // args[index] = arguments[index];
+ // }
+ // args[startIndex] = rest;
+ // return func.apply(this, args);
+ };
+ }
+
+ function _withoutIndex(iterator) {
+ return function (value, index, callback) {
+ return iterator(value, callback);
+ };
+ }
+
+ //// exported async module functions ////
+
+ //// nextTick implementation with browser-compatible fallback ////
+
+ // capture the global reference to guard against fakeTimer mocks
+ var _setImmediate = typeof setImmediate === 'function' && setImmediate;
+
+ var _delay = _setImmediate ? function(fn) {
+ // not a direct alias for IE10 compatibility
+ _setImmediate(fn);
+ } : function(fn) {
+ setTimeout(fn, 0);
+ };
+
+ if (typeof process === 'object' && typeof process.nextTick === 'function') {
async.nextTick = process.nextTick;
- if (typeof setImmediate !== 'undefined') {
- async.setImmediate = function (fn) {
- // not a direct alias for IE10 compatibility
- setImmediate(fn);
- };
- }
- else {
- async.setImmediate = async.nextTick;
- }
+ } else {
+ async.nextTick = _delay;
}
+ async.setImmediate = _setImmediate ? _delay : async.nextTick;
+
+ async.forEach =
async.each = function (arr, iterator, callback) {
- callback = callback || function () {};
- if (!arr.length) {
- return callback();
- }
- var completed = 0;
- _each(arr, function (x) {
- iterator(x, only_once(function (err) {
- if (err) {
- callback(err);
- callback = function () {};
- }
- else {
- completed += 1;
- if (completed >= arr.length) {
- callback(null);
- }
- }
- }));
- });
+ return async.eachOf(arr, _withoutIndex(iterator), callback);
};
- async.forEach = async.each;
+ async.forEachSeries =
async.eachSeries = function (arr, iterator, callback) {
- callback = callback || function () {};
- if (!arr.length) {
- return callback();
+ return async.eachOfSeries(arr, _withoutIndex(iterator), callback);
+ };
+
+
+ async.forEachLimit =
+ async.eachLimit = function (arr, limit, iterator, callback) {
+ return _eachOfLimit(limit)(arr, _withoutIndex(iterator), callback);
+ };
+
+ async.forEachOf =
+ async.eachOf = function (object, iterator, callback) {
+ callback = _once(callback || noop);
+ object = object || [];
+
+ var iter = _keyIterator(object);
+ var key, completed = 0;
+
+ while ((key = iter()) != null) {
+ completed += 1;
+ iterator(object[key], key, only_once(done));
+ }
+
+ if (completed === 0) callback(null);
+
+ function done(err) {
+ completed--;
+ if (err) {
+ callback(err);
+ }
+ // Check key is null in case iterator isn't exhausted
+ // and done resolved synchronously.
+ else if (key === null && completed <= 0) {
+ callback(null);
+ }
}
- var completed = 0;
- var iterate = function () {
- iterator(arr[completed], function (err) {
+ };
+
+ async.forEachOfSeries =
+ async.eachOfSeries = function (obj, iterator, callback) {
+ callback = _once(callback || noop);
+ obj = obj || [];
+ var nextKey = _keyIterator(obj);
+ var key = nextKey();
+ function iterate() {
+ var sync = true;
+ if (key === null) {
+ return callback(null);
+ }
+ iterator(obj[key], key, only_once(function (err) {
if (err) {
callback(err);
- callback = function () {};
}
else {
- completed += 1;
- if (completed >= arr.length) {
- callback(null);
- }
- else {
- iterate();
+ key = nextKey();
+ if (key === null) {
+ return callback(null);
+ } else {
+ if (sync) {
+ async.setImmediate(iterate);
+ } else {
+ iterate();
+ }
}
}
- });
- };
+ }));
+ sync = false;
+ }
iterate();
};
- async.forEachSeries = async.eachSeries;
- async.eachLimit = function (arr, limit, iterator, callback) {
- var fn = _eachLimit(limit);
- fn.apply(null, [arr, iterator, callback]);
+
+
+ async.forEachOfLimit =
+ async.eachOfLimit = function (obj, limit, iterator, callback) {
+ _eachOfLimit(limit)(obj, iterator, callback);
};
- async.forEachLimit = async.eachLimit;
- var _eachLimit = function (limit) {
+ function _eachOfLimit(limit) {
- return function (arr, iterator, callback) {
- callback = callback || function () {};
- if (!arr.length || limit <= 0) {
- return callback();
+ return function (obj, iterator, callback) {
+ callback = _once(callback || noop);
+ obj = obj || [];
+ var nextKey = _keyIterator(obj);
+ if (limit <= 0) {
+ return callback(null);
}
- var completed = 0;
- var started = 0;
+ var done = false;
var running = 0;
+ var errored = false;
(function replenish () {
- if (completed >= arr.length) {
- return callback();
+ if (done && running <= 0) {
+ return callback(null);
}
- while (running < limit && started < arr.length) {
- started += 1;
+ while (running < limit && !errored) {
+ var key = nextKey();
+ if (key === null) {
+ done = true;
+ if (running <= 0) {
+ callback(null);
+ }
+ return;
+ }
running += 1;
- iterator(arr[started - 1], function (err) {
+ iterator(obj[key], key, only_once(function (err) {
+ running -= 1;
if (err) {
callback(err);
- callback = function () {};
+ errored = true;
}
else {
- completed += 1;
- running -= 1;
- if (completed >= arr.length) {
- callback();
- }
- else {
- replenish();
- }
+ replenish();
}
- });
+ }));
}
})();
};
- };
+ }
- var doParallel = function (fn) {
- return function () {
- var args = Array.prototype.slice.call(arguments);
- return fn.apply(null, [async.each].concat(args));
+ function doParallel(fn) {
+ return function (obj, iterator, callback) {
+ return fn(async.eachOf, obj, iterator, callback);
};
- };
- var doParallelLimit = function(limit, fn) {
- return function () {
- var args = Array.prototype.slice.call(arguments);
- return fn.apply(null, [_eachLimit(limit)].concat(args));
+ }
+ function doParallelLimit(fn) {
+ return function (obj, limit, iterator, callback) {
+ return fn(_eachOfLimit(limit), obj, iterator, callback);
};
- };
- var doSeries = function (fn) {
- return function () {
- var args = Array.prototype.slice.call(arguments);
- return fn.apply(null, [async.eachSeries].concat(args));
+ }
+ function doSeries(fn) {
+ return function (obj, iterator, callback) {
+ return fn(async.eachOfSeries, obj, iterator, callback);
};
- };
-
+ }
- var _asyncMap = function (eachfn, arr, iterator, callback) {
- var results = [];
- arr = _map(arr, function (x, i) {
- return {index: i, value: x};
- });
- eachfn(arr, function (x, callback) {
- iterator(x.value, function (err, v) {
- results[x.index] = v;
+ function _asyncMap(eachfn, arr, iterator, callback) {
+ callback = _once(callback || noop);
+ arr = arr || [];
+ var results = _isArrayLike(arr) ? [] : {};
+ eachfn(arr, function (value, index, callback) {
+ iterator(value, function (err, v) {
+ results[index] = v;
callback(err);
});
}, function (err) {
callback(err, results);
});
- };
+ }
+
async.map = doParallel(_asyncMap);
async.mapSeries = doSeries(_asyncMap);
- async.mapLimit = function (arr, limit, iterator, callback) {
- return _mapLimit(limit)(arr, iterator, callback);
- };
-
- var _mapLimit = function(limit) {
- return doParallelLimit(limit, _asyncMap);
- };
+ async.mapLimit = doParallelLimit(_asyncMap);
// reduce only has a series version, as doing reduce in parallel won't
// work in many situations.
+ async.inject =
+ async.foldl =
async.reduce = function (arr, memo, iterator, callback) {
- async.eachSeries(arr, function (x, callback) {
+ async.eachOfSeries(arr, function (x, i, callback) {
iterator(memo, x, function (err, v) {
memo = v;
callback(err);
@@ -254,118 +380,106 @@
callback(err, memo);
});
};
- // inject alias
- async.inject = async.reduce;
- // foldl alias
- async.foldl = async.reduce;
+ async.foldr =
async.reduceRight = function (arr, memo, iterator, callback) {
- var reversed = _map(arr, function (x) {
- return x;
- }).reverse();
+ var reversed = _map(arr, identity).reverse();
async.reduce(reversed, memo, iterator, callback);
};
- // foldr alias
- async.foldr = async.reduceRight;
- var _filter = function (eachfn, arr, iterator, callback) {
- var results = [];
- arr = _map(arr, function (x, i) {
- return {index: i, value: x};
+ async.transform = function (arr, memo, iterator, callback) {
+ if (arguments.length === 3) {
+ callback = iterator;
+ iterator = memo;
+ memo = _isArray(arr) ? [] : {};
+ }
+
+ async.eachOf(arr, function(v, k, cb) {
+ iterator(memo, v, k, cb);
+ }, function(err) {
+ callback(err, memo);
});
- eachfn(arr, function (x, callback) {
- iterator(x.value, function (v) {
+ };
+
+ function _filter(eachfn, arr, iterator, callback) {
+ var results = [];
+ eachfn(arr, function (x, index, callback) {
+ iterator(x, function (v) {
if (v) {
- results.push(x);
+ results.push({index: index, value: x});
}
callback();
});
- }, function (err) {
+ }, function () {
callback(_map(results.sort(function (a, b) {
return a.index - b.index;
}), function (x) {
return x.value;
}));
});
- };
+ }
+
+ async.select =
async.filter = doParallel(_filter);
+
+ async.selectLimit =
+ async.filterLimit = doParallelLimit(_filter);
+
+ async.selectSeries =
async.filterSeries = doSeries(_filter);
- // select alias
- async.select = async.filter;
- async.selectSeries = async.filterSeries;
- var _reject = function (eachfn, arr, iterator, callback) {
- var results = [];
- arr = _map(arr, function (x, i) {
- return {index: i, value: x};
- });
- eachfn(arr, function (x, callback) {
- iterator(x.value, function (v) {
- if (!v) {
- results.push(x);
- }
- callback();
+ function _reject(eachfn, arr, iterator, callback) {
+ _filter(eachfn, arr, function(value, cb) {
+ iterator(value, function(v) {
+ cb(!v);
});
- }, function (err) {
- callback(_map(results.sort(function (a, b) {
- return a.index - b.index;
- }), function (x) {
- return x.value;
- }));
- });
- };
+ }, callback);
+ }
async.reject = doParallel(_reject);
+ async.rejectLimit = doParallelLimit(_reject);
async.rejectSeries = doSeries(_reject);
- var _detect = function (eachfn, arr, iterator, main_callback) {
- eachfn(arr, function (x, callback) {
- iterator(x, function (result) {
- if (result) {
- main_callback(x);
- main_callback = function () {};
- }
- else {
+ function _createTester(eachfn, check, getResult) {
+ return function(arr, limit, iterator, cb) {
+ function done() {
+ if (cb) cb(getResult(false, void 0));
+ }
+ function iteratee(x, _, callback) {
+ if (!cb) return callback();
+ iterator(x, function (v) {
+ if (cb && check(v)) {
+ cb(getResult(true, x));
+ cb = iterator = false;
+ }
callback();
- }
- });
- }, function (err) {
- main_callback();
- });
- };
- async.detect = doParallel(_detect);
- async.detectSeries = doSeries(_detect);
+ });
+ }
+ if (arguments.length > 3) {
+ eachfn(arr, limit, iteratee, done);
+ } else {
+ cb = iterator;
+ iterator = limit;
+ eachfn(arr, iteratee, done);
+ }
+ };
+ }
- async.some = function (arr, iterator, main_callback) {
- async.each(arr, function (x, callback) {
- iterator(x, function (v) {
- if (v) {
- main_callback(true);
- main_callback = function () {};
- }
- callback();
- });
- }, function (err) {
- main_callback(false);
- });
- };
- // any alias
- async.any = async.some;
+ async.any =
+ async.some = _createTester(async.eachOf, toBool, identity);
- async.every = function (arr, iterator, main_callback) {
- async.each(arr, function (x, callback) {
- iterator(x, function (v) {
- if (!v) {
- main_callback(false);
- main_callback = function () {};
- }
- callback();
- });
- }, function (err) {
- main_callback(true);
- });
- };
- // all alias
- async.all = async.every;
+ async.someLimit = _createTester(async.eachOfLimit, toBool, identity);
+
+ async.all =
+ async.every = _createTester(async.eachOf, notId, notId);
+
+ async.everyLimit = _createTester(async.eachOfLimit, notId, notId);
+
+ function _findGetResult(v, x) {
+ return x;
+ }
+ async.detect = _createTester(async.eachOf, identity, _findGetResult);
+ async.detectSeries = _createTester(async.eachOfSeries, identity, _findGetResult);
+ async.detectLimit = _createTester(async.eachOfLimit, identity, _findGetResult);
async.sortBy = function (arr, iterator, callback) {
async.map(arr, function (x, callback) {
@@ -382,111 +496,206 @@
return callback(err);
}
else {
- var fn = function (left, right) {
- var a = left.criteria, b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
- };
- callback(null, _map(results.sort(fn), function (x) {
+ callback(null, _map(results.sort(comparator), function (x) {
return x.value;
}));
}
+
});
+
+ function comparator(left, right) {
+ var a = left.criteria, b = right.criteria;
+ return a < b ? -1 : a > b ? 1 : 0;
+ }
};
- async.auto = function (tasks, callback) {
- callback = callback || function () {};
+ async.auto = function (tasks, concurrency, callback) {
+ if (typeof arguments[1] === 'function') {
+ // concurrency is optional, shift the args.
+ callback = concurrency;
+ concurrency = null;
+ }
+ callback = _once(callback || noop);
var keys = _keys(tasks);
- if (!keys.length) {
+ var remainingTasks = keys.length;
+ if (!remainingTasks) {
return callback(null);
}
+ if (!concurrency) {
+ concurrency = remainingTasks;
+ }
var results = {};
+ var runningTasks = 0;
+
+ var hasError = false;
var listeners = [];
- var addListener = function (fn) {
+ function addListener(fn) {
listeners.unshift(fn);
- };
- var removeListener = function (fn) {
- for (var i = 0; i < listeners.length; i += 1) {
- if (listeners[i] === fn) {
- listeners.splice(i, 1);
- return;
- }
- }
- };
- var taskComplete = function () {
- _each(listeners.slice(0), function (fn) {
+ }
+ function removeListener(fn) {
+ var idx = _indexOf(listeners, fn);
+ if (idx >= 0) listeners.splice(idx, 1);
+ }
+ function taskComplete() {
+ remainingTasks--;
+ _arrayEach(listeners.slice(0), function (fn) {
fn();
});
- };
+ }
addListener(function () {
- if (_keys(results).length === keys.length) {
+ if (!remainingTasks) {
callback(null, results);
- callback = function () {};
}
});
- _each(keys, function (k) {
- var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];
- var taskCallback = function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
+ _arrayEach(keys, function (k) {
+ if (hasError) return;
+ var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]];
+ var taskCallback = _restParam(function(err, args) {
+ runningTasks--;
if (args.length <= 1) {
args = args[0];
}
if (err) {
var safeResults = {};
- _each(_keys(results), function(rkey) {
- safeResults[rkey] = results[rkey];
+ _forEachOf(results, function(val, rkey) {
+ safeResults[rkey] = val;
});
safeResults[k] = args;
+ hasError = true;
+
callback(err, safeResults);
- // stop subsequent errors hitting callback multiple times
- callback = function () {};
}
else {
results[k] = args;
async.setImmediate(taskComplete);
}
- };
- var requires = task.slice(0, Math.abs(task.length - 1)) || [];
- var ready = function () {
- return _reduce(requires, function (a, x) {
+ });
+ var requires = task.slice(0, task.length - 1);
+ // prevent dead-locks
+ var len = requires.length;
+ var dep;
+ while (len--) {
+ if (!(dep = tasks[requires[len]])) {
+ throw new Error('Has nonexistent dependency in ' + requires.join(', '));
+ }
+ if (_isArray(dep) && _indexOf(dep, k) >= 0) {
+ throw new Error('Has cyclic dependencies');
+ }
+ }
+ function ready() {
+ return runningTasks < concurrency && _reduce(requires, function (a, x) {
return (a && results.hasOwnProperty(x));
}, true) && !results.hasOwnProperty(k);
- };
+ }
if (ready()) {
+ runningTasks++;
task[task.length - 1](taskCallback, results);
}
else {
- var listener = function () {
- if (ready()) {
- removeListener(listener);
- task[task.length - 1](taskCallback, results);
- }
- };
addListener(listener);
}
+ function listener() {
+ if (ready()) {
+ runningTasks++;
+ removeListener(listener);
+ task[task.length - 1](taskCallback, results);
+ }
+ }
});
};
+
+
+ async.retry = function(times, task, callback) {
+ var DEFAULT_TIMES = 5;
+ var DEFAULT_INTERVAL = 0;
+
+ var attempts = [];
+
+ var opts = {
+ times: DEFAULT_TIMES,
+ interval: DEFAULT_INTERVAL
+ };
+
+ function parseTimes(acc, t){
+ if(typeof t === 'number'){
+ acc.times = parseInt(t, 10) || DEFAULT_TIMES;
+ } else if(typeof t === 'object'){
+ acc.times = parseInt(t.times, 10) || DEFAULT_TIMES;
+ acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL;
+ } else {
+ throw new Error('Unsupported argument type for \'times\': ' + typeof t);
+ }
+ }
+
+ var length = arguments.length;
+ if (length < 1 || length > 3) {
+ throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)');
+ } else if (length <= 2 && typeof times === 'function') {
+ callback = task;
+ task = times;
+ }
+ if (typeof times !== 'function') {
+ parseTimes(opts, times);
+ }
+ opts.callback = callback;
+ opts.task = task;
+
+ function wrappedTask(wrappedCallback, wrappedResults) {
+ function retryAttempt(task, finalAttempt) {
+ return function(seriesCallback) {
+ task(function(err, result){
+ seriesCallback(!err || finalAttempt, {err: err, result: result});
+ }, wrappedResults);
+ };
+ }
+
+ function retryInterval(interval){
+ return function(seriesCallback){
+ setTimeout(function(){
+ seriesCallback(null);
+ }, interval);
+ };
+ }
+
+ while (opts.times) {
+
+ var finalAttempt = !(opts.times-=1);
+ attempts.push(retryAttempt(opts.task, finalAttempt));
+ if(!finalAttempt && opts.interval > 0){
+ attempts.push(retryInterval(opts.interval));
+ }
+ }
+
+ async.series(attempts, function(done, data){
+ data = data[data.length - 1];
+ (wrappedCallback || opts.callback)(data.err, data.result);
+ });
+ }
+
+ // If a callback is passed, run this as a controll flow
+ return opts.callback ? wrappedTask() : wrappedTask;
+ };
+
async.waterfall = function (tasks, callback) {
- callback = callback || function () {};
- if (tasks.constructor !== Array) {
- var err = new Error('First argument to waterfall must be an array of functions');
- return callback(err);
+ callback = _once(callback || noop);
+ if (!_isArray(tasks)) {
+ var err = new Error('First argument to waterfall must be an array of functions');
+ return callback(err);
}
if (!tasks.length) {
return callback();
}
- var wrapIterator = function (iterator) {
- return function (err) {
+ function wrapIterator(iterator) {
+ return _restParam(function (err, args) {
if (err) {
- callback.apply(null, arguments);
- callback = function () {};
+ callback.apply(null, [err].concat(args));
}
else {
- var args = Array.prototype.slice.call(arguments, 1);
var next = iterator.next();
if (next) {
args.push(wrapIterator(next));
@@ -494,241 +703,254 @@
else {
args.push(callback);
}
- async.setImmediate(function () {
- iterator.apply(null, args);
- });
+ ensureAsync(iterator).apply(null, args);
}
- };
- };
+ });
+ }
wrapIterator(async.iterator(tasks))();
};
- var _parallel = function(eachfn, tasks, callback) {
- callback = callback || function () {};
- if (tasks.constructor === Array) {
- eachfn.map(tasks, function (fn, callback) {
- if (fn) {
- fn(function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- callback.call(null, err, args);
- });
+ function _parallel(eachfn, tasks, callback) {
+ callback = callback || noop;
+ var results = _isArrayLike(tasks) ? [] : {};
+
+ eachfn(tasks, function (task, key, callback) {
+ task(_restParam(function (err, args) {
+ if (args.length <= 1) {
+ args = args[0];
}
- }, callback);
- }
- else {
- var results = {};
- eachfn.each(_keys(tasks), function (k, callback) {
- tasks[k](function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- results[k] = args;
- callback(err);
- });
- }, function (err) {
- callback(err, results);
- });
- }
- };
+ results[key] = args;
+ callback(err);
+ }));
+ }, function (err) {
+ callback(err, results);
+ });
+ }
async.parallel = function (tasks, callback) {
- _parallel({ map: async.map, each: async.each }, tasks, callback);
+ _parallel(async.eachOf, tasks, callback);
};
async.parallelLimit = function(tasks, limit, callback) {
- _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback);
- };
-
- async.series = function (tasks, callback) {
- callback = callback || function () {};
- if (tasks.constructor === Array) {
- async.mapSeries(tasks, function (fn, callback) {
- if (fn) {
- fn(function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- callback.call(null, err, args);
- });
- }
- }, callback);
- }
- else {
- var results = {};
- async.eachSeries(_keys(tasks), function (k, callback) {
- tasks[k](function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (args.length <= 1) {
- args = args[0];
- }
- results[k] = args;
- callback(err);
- });
- }, function (err) {
- callback(err, results);
- });
- }
+ _parallel(_eachOfLimit(limit), tasks, callback);
+ };
+
+ async.series = function(tasks, callback) {
+ _parallel(async.eachOfSeries, tasks, callback);
};
async.iterator = function (tasks) {
- var makeCallback = function (index) {
- var fn = function () {
+ function makeCallback(index) {
+ function fn() {
if (tasks.length) {
tasks[index].apply(null, arguments);
}
return fn.next();
- };
+ }
fn.next = function () {
return (index < tasks.length - 1) ? makeCallback(index + 1): null;
};
return fn;
- };
+ }
return makeCallback(0);
};
- async.apply = function (fn) {
- var args = Array.prototype.slice.call(arguments, 1);
- return function () {
+ async.apply = _restParam(function (fn, args) {
+ return _restParam(function (callArgs) {
return fn.apply(
- null, args.concat(Array.prototype.slice.call(arguments))
+ null, args.concat(callArgs)
);
- };
- };
+ });
+ });
- var _concat = function (eachfn, arr, fn, callback) {
- var r = [];
- eachfn(arr, function (x, cb) {
+ function _concat(eachfn, arr, fn, callback) {
+ var result = [];
+ eachfn(arr, function (x, index, cb) {
fn(x, function (err, y) {
- r = r.concat(y || []);
+ result = result.concat(y || []);
cb(err);
});
}, function (err) {
- callback(err, r);
+ callback(err, result);
});
- };
+ }
async.concat = doParallel(_concat);
async.concatSeries = doSeries(_concat);
async.whilst = function (test, iterator, callback) {
+ callback = callback || noop;
if (test()) {
- iterator(function (err) {
+ var next = _restParam(function(err, args) {
if (err) {
- return callback(err);
+ callback(err);
+ } else if (test.apply(this, args)) {
+ iterator(next);
+ } else {
+ callback.apply(null, [null].concat(args));
}
- async.whilst(test, iterator, callback);
});
- }
- else {
- callback();
+ iterator(next);
+ } else {
+ callback(null);
}
};
async.doWhilst = function (iterator, test, callback) {
- iterator(function (err) {
- if (err) {
- return callback(err);
- }
- if (test()) {
- async.doWhilst(iterator, test, callback);
- }
- else {
- callback();
- }
- });
+ var calls = 0;
+ return async.whilst(function() {
+ return ++calls <= 1 || test.apply(this, arguments);
+ }, iterator, callback);
};
async.until = function (test, iterator, callback) {
- if (!test()) {
- iterator(function (err) {
- if (err) {
- return callback(err);
- }
- async.until(test, iterator, callback);
- });
- }
- else {
- callback();
- }
+ return async.whilst(function() {
+ return !test.apply(this, arguments);
+ }, iterator, callback);
};
async.doUntil = function (iterator, test, callback) {
- iterator(function (err) {
+ return async.doWhilst(iterator, function() {
+ return !test.apply(this, arguments);
+ }, callback);
+ };
+
+ async.during = function (test, iterator, callback) {
+ callback = callback || noop;
+
+ var next = _restParam(function(err, args) {
if (err) {
- return callback(err);
+ callback(err);
+ } else {
+ args.push(check);
+ test.apply(this, args);
}
- if (!test()) {
- async.doUntil(iterator, test, callback);
+ });
+
+ var check = function(err, truth) {
+ if (err) {
+ callback(err);
+ } else if (truth) {
+ iterator(next);
+ } else {
+ callback(null);
}
- else {
- callback();
+ };
+
+ test(check);
+ };
+
+ async.doDuring = function (iterator, test, callback) {
+ var calls = 0;
+ async.during(function(next) {
+ if (calls++ < 1) {
+ next(null, true);
+ } else {
+ test.apply(this, arguments);
}
- });
+ }, iterator, callback);
};
- async.queue = function (worker, concurrency) {
- if (concurrency === undefined) {
+ function _queue(worker, concurrency, payload) {
+ if (concurrency == null) {
concurrency = 1;
}
+ else if(concurrency === 0) {
+ throw new Error('Concurrency must not be zero');
+ }
function _insert(q, data, pos, callback) {
- if(data.constructor !== Array) {
- data = [data];
- }
- _each(data, function(task) {
- var item = {
- data: task,
- callback: typeof callback === 'function' ? callback : null
- };
-
- if (pos) {
- q.tasks.unshift(item);
- } else {
- q.tasks.push(item);
- }
-
- if (q.saturated && q.tasks.length === concurrency) {
- q.saturated();
- }
- async.setImmediate(q.process);
- });
+ if (callback != null && typeof callback !== "function") {
+ throw new Error("task callback must be a function");
+ }
+ q.started = true;
+ if (!_isArray(data)) {
+ data = [data];
+ }
+ if(data.length === 0 && q.idle()) {
+ // call drain immediately if there are no tasks
+ return async.setImmediate(function() {
+ q.drain();
+ });
+ }
+ _arrayEach(data, function(task) {
+ var item = {
+ data: task,
+ callback: callback || noop
+ };
+
+ if (pos) {
+ q.tasks.unshift(item);
+ } else {
+ q.tasks.push(item);
+ }
+
+ if (q.tasks.length === q.concurrency) {
+ q.saturated();
+ }
+ });
+ async.setImmediate(q.process);
+ }
+ function _next(q, tasks) {
+ return function(){
+ workers -= 1;
+
+ var removed = false;
+ var args = arguments;
+ _arrayEach(tasks, function (task) {
+ _arrayEach(workersList, function (worker, index) {
+ if (worker === task && !removed) {
+ workersList.splice(index, 1);
+ removed = true;
+ }
+ });
+
+ task.callback.apply(task, args);
+ });
+ if (q.tasks.length + workers === 0) {
+ q.drain();
+ }
+ q.process();
+ };
}
var workers = 0;
+ var workersList = [];
var q = {
tasks: [],
concurrency: concurrency,
- saturated: null,
- empty: null,
- drain: null,
+ payload: payload,
+ saturated: noop,
+ empty: noop,
+ drain: noop,
+ started: false,
+ paused: false,
push: function (data, callback) {
- _insert(q, data, false, callback);
+ _insert(q, data, false, callback);
+ },
+ kill: function () {
+ q.drain = noop;
+ q.tasks = [];
},
unshift: function (data, callback) {
- _insert(q, data, true, callback);
+ _insert(q, data, true, callback);
},
process: function () {
- if (workers < q.concurrency && q.tasks.length) {
- var task = q.tasks.shift();
- if (q.empty && q.tasks.length === 0) {
+ while(!q.paused && workers < q.concurrency && q.tasks.length){
+
+ var tasks = q.payload ?
+ q.tasks.splice(0, q.payload) :
+ q.tasks.splice(0, q.tasks.length);
+
+ var data = _map(tasks, function (task) {
+ return task.data;
+ });
+
+ if (q.tasks.length === 0) {
q.empty();
}
workers += 1;
- var next = function () {
- workers -= 1;
- if (task.callback) {
- task.callback.apply(task, arguments);
- }
- if (q.drain && q.tasks.length + workers === 0) {
- q.drain();
- }
- q.process();
- };
- var cb = only_once(next);
- worker(task.data, cb);
+ workersList.push(tasks[0]);
+ var cb = only_once(_next(q, tasks));
+ worker(data, cb);
}
},
length: function () {
@@ -736,96 +958,124 @@
},
running: function () {
return workers;
+ },
+ workersList: function () {
+ return workersList;
+ },
+ idle: function() {
+ return q.tasks.length + workers === 0;
+ },
+ pause: function () {
+ q.paused = true;
+ },
+ resume: function () {
+ if (q.paused === false) { return; }
+ q.paused = false;
+ var resumeCount = Math.min(q.concurrency, q.tasks.length);
+ // Need to call q.process once per concurrent
+ // worker to preserve full concurrency after pause
+ for (var w = 1; w <= resumeCount; w++) {
+ async.setImmediate(q.process);
+ }
}
};
return q;
+ }
+
+ async.queue = function (worker, concurrency) {
+ var q = _queue(function (items, cb) {
+ worker(items[0], cb);
+ }, concurrency, 1);
+
+ return q;
};
- async.cargo = function (worker, payload) {
- var working = false,
- tasks = [];
+ async.priorityQueue = function (worker, concurrency) {
- var cargo = {
- tasks: tasks,
- payload: payload,
- saturated: null,
- empty: null,
- drain: null,
- push: function (data, callback) {
- if(data.constructor !== Array) {
- data = [data];
+ function _compareTasks(a, b){
+ return a.priority - b.priority;
+ }
+
+ function _binarySearch(sequence, item, compare) {
+ var beg = -1,
+ end = sequence.length - 1;
+ while (beg < end) {
+ var mid = beg + ((end - beg + 1) >>> 1);
+ if (compare(item, sequence[mid]) >= 0) {
+ beg = mid;
+ } else {
+ end = mid - 1;
}
- _each(data, function(task) {
- tasks.push({
- data: task,
- callback: typeof callback === 'function' ? callback : null
- });
- if (cargo.saturated && tasks.length === payload) {
- cargo.saturated();
- }
+ }
+ return beg;
+ }
+
+ function _insert(q, data, priority, callback) {
+ if (callback != null && typeof callback !== "function") {
+ throw new Error("task callback must be a function");
+ }
+ q.started = true;
+ if (!_isArray(data)) {
+ data = [data];
+ }
+ if(data.length === 0) {
+ // call drain immediately if there are no tasks
+ return async.setImmediate(function() {
+ q.drain();
});
- async.setImmediate(cargo.process);
- },
- process: function process() {
- if (working) return;
- if (tasks.length === 0) {
- if(cargo.drain) cargo.drain();
- return;
+ }
+ _arrayEach(data, function(task) {
+ var item = {
+ data: task,
+ priority: priority,
+ callback: typeof callback === 'function' ? callback : noop
+ };
+
+ q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);
+
+ if (q.tasks.length === q.concurrency) {
+ q.saturated();
}
+ async.setImmediate(q.process);
+ });
+ }
- var ts = typeof payload === 'number'
- ? tasks.splice(0, payload)
- : tasks.splice(0);
+ // Start with a normal queue
+ var q = async.queue(worker, concurrency);
- var ds = _map(ts, function (task) {
- return task.data;
- });
+ // Override push to accept second parameter representing priority
+ q.push = function (data, priority, callback) {
+ _insert(q, data, priority, callback);
+ };
- if(cargo.empty) cargo.empty();
- working = true;
- worker(ds, function () {
- working = false;
+ // Remove unshift function
+ delete q.unshift;
- var args = arguments;
- _each(ts, function (data) {
- if (data.callback) {
- data.callback.apply(null, args);
- }
- });
+ return q;
+ };
- process();
- });
- },
- length: function () {
- return tasks.length;
- },
- running: function () {
- return working;
- }
- };
- return cargo;
+ async.cargo = function (worker, payload) {
+ return _queue(worker, 1, payload);
};
- var _console_fn = function (name) {
- return function (fn) {
- var args = Array.prototype.slice.call(arguments, 1);
- fn.apply(null, args.concat([function (err) {
- var args = Array.prototype.slice.call(arguments, 1);
- if (typeof console !== 'undefined') {
+ function _console_fn(name) {
+ return _restParam(function (fn, args) {
+ fn.apply(null, args.concat([_restParam(function (err, args) {
+ if (typeof console === 'object') {
if (err) {
if (console.error) {
console.error(err);
}
}
else if (console[name]) {
- _each(args, function (x) {
+ _arrayEach(args, function (x) {
console[name](x);
});
}
}
- }]));
- };
- };
+ })]));
+ });
+ }
async.log = _console_fn('log');
async.dir = _console_fn('dir');
/*async.info = _console_fn('info');
@@ -835,121 +1085,178 @@
async.memoize = function (fn, hasher) {
var memo = {};
var queues = {};
- hasher = hasher || function (x) {
- return x;
- };
- var memoized = function () {
- var args = Array.prototype.slice.call(arguments);
+ var has = Object.prototype.hasOwnProperty;
+ hasher = hasher || identity;
+ var memoized = _restParam(function memoized(args) {
var callback = args.pop();
var key = hasher.apply(null, args);
- if (key in memo) {
- callback.apply(null, memo[key]);
+ if (has.call(memo, key)) {
+ async.setImmediate(function () {
+ callback.apply(null, memo[key]);
+ });
}
- else if (key in queues) {
+ else if (has.call(queues, key)) {
queues[key].push(callback);
}
else {
queues[key] = [callback];
- fn.apply(null, args.concat([function () {
- memo[key] = arguments;
+ fn.apply(null, args.concat([_restParam(function (args) {
+ memo[key] = args;
var q = queues[key];
delete queues[key];
for (var i = 0, l = q.length; i < l; i++) {
- q[i].apply(null, arguments);
+ q[i].apply(null, args);
}
- }]));
+ })]));
}
- };
+ });
memoized.memo = memo;
memoized.unmemoized = fn;
return memoized;
};
async.unmemoize = function (fn) {
- return function () {
- return (fn.unmemoized || fn).apply(null, arguments);
- };
+ return function () {
+ return (fn.unmemoized || fn).apply(null, arguments);
+ };
};
- async.times = function (count, iterator, callback) {
- var counter = [];
- for (var i = 0; i < count; i++) {
- counter.push(i);
- }
- return async.map(counter, iterator, callback);
- };
+ function _times(mapper) {
+ return function (count, iterator, callback) {
+ mapper(_range(count), iterator, callback);
+ };
+ }
- async.timesSeries = function (count, iterator, callback) {
- var counter = [];
- for (var i = 0; i < count; i++) {
- counter.push(i);
- }
- return async.mapSeries(counter, iterator, callback);
+ async.times = _times(async.map);
+ async.timesSeries = _times(async.mapSeries);
+ async.timesLimit = function (count, limit, iterator, callback) {
+ return async.mapLimit(_range(count), limit, iterator, callback);
};
- async.compose = function (/* functions... */) {
- var fns = Array.prototype.reverse.call(arguments);
- return function () {
+ async.seq = function (/* functions... */) {
+ var fns = arguments;
+ return _restParam(function (args) {
var that = this;
- var args = Array.prototype.slice.call(arguments);
- var callback = args.pop();
+
+ var callback = args[args.length - 1];
+ if (typeof callback == 'function') {
+ args.pop();
+ } else {
+ callback = noop;
+ }
+
async.reduce(fns, args, function (newargs, fn, cb) {
- fn.apply(that, newargs.concat([function () {
- var err = arguments[0];
- var nextargs = Array.prototype.slice.call(arguments, 1);
+ fn.apply(that, newargs.concat([_restParam(function (err, nextargs) {
cb(err, nextargs);
- }]))
+ })]));
},
function (err, results) {
callback.apply(that, [err].concat(results));
});
- };
+ });
};
- var _applyEach = function (eachfn, fns /*args...*/) {
- var go = function () {
- var that = this;
- var args = Array.prototype.slice.call(arguments);
- var callback = args.pop();
- return eachfn(fns, function (fn, cb) {
- fn.apply(that, args.concat([cb]));
- },
- callback);
- };
- if (arguments.length > 2) {
- var args = Array.prototype.slice.call(arguments, 2);
- return go.apply(this, args);
- }
- else {
- return go;
- }
+ async.compose = function (/* functions... */) {
+ return async.seq.apply(null, Array.prototype.reverse.call(arguments));
};
- async.applyEach = doParallel(_applyEach);
- async.applyEachSeries = doSeries(_applyEach);
+
+
+ function _applyEach(eachfn) {
+ return _restParam(function(fns, args) {
+ var go = _restParam(function(args) {
+ var that = this;
+ var callback = args.pop();
+ return eachfn(fns, function (fn, _, cb) {
+ fn.apply(that, args.concat([cb]));
+ },
+ callback);
+ });
+ if (args.length) {
+ return go.apply(this, args);
+ }
+ else {
+ return go;
+ }
+ });
+ }
+
+ async.applyEach = _applyEach(async.eachOf);
+ async.applyEachSeries = _applyEach(async.eachOfSeries);
+
async.forever = function (fn, callback) {
+ var done = only_once(callback || noop);
+ var task = ensureAsync(fn);
function next(err) {
if (err) {
- if (callback) {
- return callback(err);
- }
- throw err;
+ return done(err);
}
- fn(next);
+ task(next);
}
next();
};
- // AMD / RequireJS
- if (typeof define !== 'undefined' && define.amd) {
- define([], function () {
- return async;
+ function ensureAsync(fn) {
+ return _restParam(function (args) {
+ var callback = args.pop();
+ args.push(function () {
+ var innerArgs = arguments;
+ if (sync) {
+ async.setImmediate(function () {
+ callback.apply(null, innerArgs);
+ });
+ } else {
+ callback.apply(null, innerArgs);
+ }
+ });
+ var sync = true;
+ fn.apply(this, args);
+ sync = false;
});
}
+
+ async.ensureAsync = ensureAsync;
+
+ async.constant = _restParam(function(values) {
+ var args = [null].concat(values);
+ return function (callback) {
+ return callback.apply(this, args);
+ };
+ });
+
+ async.wrapSync =
+ async.asyncify = function asyncify(func) {
+ return _restParam(function (args) {
+ var callback = args.pop();
+ var result;
+ try {
+ result = func.apply(this, args);
+ } catch (e) {
+ return callback(e);
+ }
+ // if result is Promise object
+ if (_isObject(result) && typeof result.then === "function") {
+ result.then(function(value) {
+ callback(null, value);
+ })["catch"](function(err) {
+ callback(err.message ? err : new Error(err));
+ });
+ } else {
+ callback(null, result);
+ }
+ });
+ };
+
// Node.js
- else if (typeof module !== 'undefined' && module.exports) {
+ if (typeof module === 'object' && module.exports) {
module.exports = async;
}
+ // AMD / RequireJS
+ else if (typeof define === 'function' && define.amd) {
+ define([], function () {
+ return async;
+ });
+ }
// included directly via <script> tag
else {
root.async = async;
diff --git a/node_modules/async/package.json b/node_modules/async/package.json
@@ -1,36 +1,85 @@
{
- "name": "async",
- "description": "Higher-order functions and common patterns for asynchronous code",
- "main": "./lib/async",
- "author": "Caolan McMahon",
- "version": "0.2.10",
- "repository" : {
- "type" : "git",
- "url" : "https://github.com/caolan/async.git"
- },
- "bugs" : {
- "url" : "https://github.com/caolan/async/issues"
- },
- "licenses" : [
- {
- "type" : "MIT",
- "url" : "https://github.com/caolan/async/raw/master/LICENSE"
- }
+ "name": "async",
+ "description": "Higher-order functions and common patterns for asynchronous code",
+ "main": "lib/async.js",
+ "files": [
+ "lib",
+ "dist/async.js",
+ "dist/async.min.js"
+ ],
+ "author": "Caolan McMahon",
+ "version": "1.5.2",
+ "keywords": [
+ "async",
+ "callback",
+ "utility",
+ "module"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/caolan/async.git"
+ },
+ "bugs": {
+ "url": "https://github.com/caolan/async/issues"
+ },
+ "license": "MIT",
+ "devDependencies": {
+ "benchmark": "bestiejs/benchmark.js",
+ "bluebird": "^2.9.32",
+ "chai": "^3.1.0",
+ "coveralls": "^2.11.2",
+ "es6-promise": "^2.3.0",
+ "jscs": "^1.13.1",
+ "jshint": "~2.8.0",
+ "karma": "^0.13.2",
+ "karma-browserify": "^4.2.1",
+ "karma-firefox-launcher": "^0.1.6",
+ "karma-mocha": "^0.2.0",
+ "karma-mocha-reporter": "^1.0.2",
+ "lodash": "^3.9.0",
+ "mkdirp": "~0.5.1",
+ "mocha": "^2.2.5",
+ "native-promise-only": "^0.8.0-a",
+ "nodeunit": ">0.0.0",
+ "nyc": "^2.1.0",
+ "rsvp": "^3.0.18",
+ "semver": "^4.3.6",
+ "uglify-js": "~2.4.0",
+ "xyz": "^0.5.0",
+ "yargs": "~3.9.1"
+ },
+ "jam": {
+ "main": "lib/async.js",
+ "include": [
+ "lib/async.js",
+ "README.md",
+ "LICENSE"
],
- "devDependencies": {
- "nodeunit": ">0.0.0",
- "uglify-js": "1.2.x",
- "nodelint": ">0.0.0"
- },
- "jam": {
- "main": "lib/async.js",
- "include": [
- "lib/async.js",
- "README.md",
- "LICENSE"
- ]
- },
- "scripts": {
- "test": "nodeunit test/test-async.js"
- }
+ "categories": [
+ "Utilities"
+ ]
+ },
+ "scripts": {
+ "mocha-node-test": "mocha mocha_test/",
+ "mocha-browser-test": "karma start",
+ "mocha-test": "npm run mocha-node-test && npm run mocha-browser-test",
+ "nodeunit-test": "nodeunit test/test-async.js",
+ "test": "npm run-script lint && npm run nodeunit-test && npm run mocha-test",
+ "lint": "jshint lib/*.js test/*.js perf/*.js && jscs lib/*.js test/*.js perf/*.js",
+ "coverage": "nyc npm test && nyc report",
+ "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls"
+ },
+ "spm": {
+ "main": "lib/async.js"
+ },
+ "volo": {
+ "main": "lib/async.js",
+ "ignore": [
+ "**/.*",
+ "node_modules",
+ "bower_components",
+ "test",
+ "tests"
+ ]
+ }
}
diff --git a/node_modules/camelcase/index.js b/node_modules/camelcase/index.js
@@ -1,4 +1,23 @@
'use strict';
+
+function preserveCamelCase(str) {
+ var isLastCharLower = false;
+
+ for (var i = 0; i < str.length; i++) {
+ var c = str.charAt(i);
+
+ if (isLastCharLower && (/[a-zA-Z]/).test(c) && c.toUpperCase() === c) {
+ str = str.substr(0, i) + '-' + str.substr(i);
+ isLastCharLower = false;
+ i++;
+ } else {
+ isLastCharLower = (c.toLowerCase() === c);
+ }
+ }
+
+ return str;
+}
+
module.exports = function () {
var str = [].map.call(arguments, function (str) {
return str.trim();
@@ -10,14 +29,24 @@ module.exports = function () {
return '';
}
- if (str.length === 1 || !(/[_.\- ]+/).test(str) ) {
- if (str[0] === str[0].toLowerCase() && str.slice(1) !== str.slice(1).toLowerCase()) {
- return str;
+ if (str.length === 1) {
+ return str.toLowerCase();
+ }
+
+ if (!(/[_.\- ]+/).test(str)) {
+ if (str === str.toUpperCase()) {
+ return str.toLowerCase();
}
- return str.toLowerCase();
+ if (str[0] !== str[0].toLowerCase()) {
+ return str[0].toLowerCase() + str.slice(1);
+ }
+
+ return str;
}
+ str = preserveCamelCase(str);
+
return str
.replace(/^[_.\- ]+/, '')
.toLowerCase()
diff --git a/node_modules/camelcase/package.json b/node_modules/camelcase/package.json
@@ -1,6 +1,6 @@
{
"name": "camelcase",
- "version": "1.2.1",
+ "version": "3.0.0",
"description": "Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar",
"license": "MIT",
"repository": "sindresorhus/camelcase",
@@ -13,7 +13,7 @@
"node": ">=0.10.0"
},
"scripts": {
- "test": "node test.js"
+ "test": "xo && ava"
},
"files": [
"index.js"
@@ -33,6 +33,7 @@
"convert"
],
"devDependencies": {
- "ava": "0.0.4"
+ "ava": "*",
+ "xo": "*"
}
}
diff --git a/node_modules/camelcase/readme.md b/node_modules/camelcase/readme.md
@@ -5,7 +5,7 @@
## Install
-```sh
+```
$ npm install --save camelcase
```
@@ -13,42 +13,43 @@ $ npm install --save camelcase
## Usage
```js
-var camelCase = require('camelcase');
+const camelCase = require('camelcase');
camelCase('foo-bar');
-//=> fooBar
+//=> 'fooBar'
camelCase('foo_bar');
-//=> fooBar
+//=> 'fooBar'
camelCase('Foo-Bar');
-//=> fooBar
+//=> 'fooBar'
camelCase('--foo.bar');
-//=> fooBar
+//=> 'fooBar'
camelCase('__foo__bar__');
-//=> fooBar
+//=> 'fooBar'
camelCase('foo bar');
-//=> fooBar
+//=> 'fooBar'
console.log(process.argv[3]);
-//=> --foo-bar
+//=> '--foo-bar'
camelCase(process.argv[3]);
-//=> fooBar
+//=> 'fooBar'
camelCase('foo', 'bar');
-//=> fooBar
+//=> 'fooBar'
camelCase('__foo__', '--bar');
-//=> fooBar
+//=> 'fooBar'
```
## Related
-See [`decamelize`](https://github.com/sindresorhus/decamelize) for the inverse.
+- [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
diff --git a/node_modules/cliui/.coveralls.yml b/node_modules/cliui/.coveralls.yml
@@ -1 +0,0 @@
-repo_token: NiRhyj91Z2vtgob6XdEAqs83rzNnbMZUu
diff --git a/node_modules/cliui/.npmignore b/node_modules/cliui/.npmignore
@@ -1,2 +0,0 @@
-.DS_Store
-node_modules
diff --git a/node_modules/cliui/.travis.yml b/node_modules/cliui/.travis.yml
@@ -1,7 +0,0 @@
-language: node_js
-node_js:
- - "0.10"
- - "0.11"
- - "0.12"
- - "iojs"
-after_script: "NODE_ENV=test YOURPACKAGE_COVERAGE=1 ./node_modules/.bin/mocha --require patched-blanket --reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js"
diff --git a/node_modules/cliui/README.md b/node_modules/cliui/README.md
@@ -1,8 +1,9 @@
# cliui
-[](https://travis-ci.org/bcoe/cliui)
-[](https://coveralls.io/r/bcoe/cliui?branch=)
+[](https://travis-ci.org/yargs/cliui)
+[](https://coveralls.io/r/yargs/cliui?branch=)
[](https://www.npmjs.com/package/cliui)
+[](https://github.com/conventional-changelog/standard-version)
easily create complex multi-column command-line-interfaces.
@@ -23,15 +24,17 @@ ui.div({
ui.div(
{
text: "-f, --file",
- width: 40,
+ width: 20,
padding: [0, 4, 0, 4]
},
{
- text: "the file to load",
- width: 25
+ text: "the file to load." +
+ chalk.green("(if this description is long it wraps).")
+ ,
+ width: 20
},
{
- text: "[required]",
+ text: chalk.red("[required]"),
align: 'right'
}
)
@@ -39,6 +42,8 @@ ui.div(
console.log(ui.toString())
```
+<img width="500" src="screenshot.png">
+
## Layout DSL
cliui exposes a simple layout DSL:
@@ -48,7 +53,7 @@ object:
* `\n`: characters will be interpreted as new rows.
* `\t`: characters will be interpreted as new columns.
-* ` `: characters will be interpreted as padding.
+* `\s`: characters will be interpreted as padding.
**as an example...**
@@ -97,6 +102,7 @@ options:
* **width:** the width of a column.
* **align:** alignment, `right` or `center`.
* **padding:** `[top, right, bottom, left]`.
+* **border:** should a border be placed around the div?
### cliui.span(column, column, column)
diff --git a/node_modules/cliui/index.js b/node_modules/cliui/index.js
@@ -1,12 +1,14 @@
-var wrap = require('wordwrap'),
- align = {
- right: require('right-align'),
- center: require('center-align')
- },
- top = 0,
- right = 1,
- bottom = 2,
- left = 3
+var stringWidth = require('string-width')
+var stripAnsi = require('strip-ansi')
+var wrap = require('wrap-ansi')
+var align = {
+ right: alignRight,
+ center: alignCenter
+}
+var top = 0
+var right = 1
+var bottom = 2
+var left = 3
function UI (opts) {
this.width = opts.width
@@ -42,9 +44,9 @@ UI.prototype._shouldApplyLayoutDSL = function () {
}
UI.prototype._applyLayoutDSL = function (str) {
- var _this = this,
- rows = str.split('\n'),
- leftColumnWidth = 0
+ var _this = this
+ var rows = str.split('\n')
+ var leftColumnWidth = 0
// simple heuristic for layout, make sure the
// second column lines up along the left-hand.
@@ -52,10 +54,10 @@ UI.prototype._applyLayoutDSL = function (str) {
// than 50% of the screen.
rows.forEach(function (row) {
var columns = row.split('\t')
- if (columns.length > 1 && columns[0].length > leftColumnWidth) {
+ if (columns.length > 1 && stringWidth(columns[0]) > leftColumnWidth) {
leftColumnWidth = Math.min(
Math.floor(_this.width * 0.5),
- columns[0].length
+ stringWidth(columns[0])
)
}
})
@@ -68,7 +70,7 @@ UI.prototype._applyLayoutDSL = function (str) {
_this.div.apply(_this, columns.map(function (r, i) {
return {
text: r.trim(),
- padding: [0, r.match(/\s*$/)[0].length, 0, r.match(/^\s*/)[0].length],
+ padding: _this._measurePadding(r),
width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
}
}))
@@ -79,13 +81,20 @@ UI.prototype._applyLayoutDSL = function (str) {
UI.prototype._colFromString = function (str) {
return {
- text: str
+ text: str,
+ padding: this._measurePadding(str)
}
}
+UI.prototype._measurePadding = function (str) {
+ // measure padding without ansi escape codes
+ var noAnsi = stripAnsi(str)
+ return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length]
+}
+
UI.prototype.toString = function () {
- var _this = this,
- lines = []
+ var _this = this
+ var lines = []
_this.rows.forEach(function (row, i) {
_this.rowToString(row, lines)
@@ -103,13 +112,13 @@ UI.prototype.toString = function () {
}
UI.prototype.rowToString = function (row, lines) {
- var _this = this,
- paddingLeft,
- rrows = this._rasterize(row),
- str = '',
- ts,
- width,
- wrapWidth
+ var _this = this
+ var padding
+ var rrows = this._rasterize(row)
+ var str = ''
+ var ts
+ var width
+ var wrapWidth
rrows.forEach(function (rrow, r) {
str = ''
@@ -118,27 +127,30 @@ UI.prototype.rowToString = function (row, lines) {
width = row[c].width // the width with padding.
wrapWidth = _this._negatePadding(row[c]) // the width without padding.
- for (var i = 0; i < Math.max(wrapWidth, col.length); i++) {
- ts += col.charAt(i) || ' '
+ ts += col
+
+ for (var i = 0; i < wrapWidth - stringWidth(col); i++) {
+ ts += ' '
}
// align the string within its column.
if (row[c].align && row[c].align !== 'left' && _this.wrap) {
- ts = align[row[c].align](ts.trim() + '\n' + new Array(wrapWidth + 1).join(' '))
- .split('\n')[0]
- if (ts.length < wrapWidth) ts += new Array(width - ts.length).join(' ')
+ ts = align[row[c].align](ts, wrapWidth)
+ if (stringWidth(ts) < wrapWidth) ts += new Array(width - stringWidth(ts)).join(' ')
}
- // add left/right padding and print string.
- paddingLeft = (row[c].padding || [0, 0, 0, 0])[left]
- if (paddingLeft) str += new Array(row[c].padding[left] + 1).join(' ')
+ // apply border and padding to string.
+ padding = row[c].padding || [0, 0, 0, 0]
+ if (padding[left]) str += new Array(padding[left] + 1).join(' ')
+ str += addBorder(row[c], ts, '| ')
str += ts
- if (row[c].padding && row[c].padding[right]) str += new Array(row[c].padding[right] + 1).join(' ')
+ str += addBorder(row[c], ts, ' |')
+ if (padding[right]) str += new Array(padding[right] + 1).join(' ')
// if prior row is span, try to render the
// current row on the prior line.
if (r === 0 && lines.length > 0) {
- str = _this._renderInline(str, lines[lines.length - 1], paddingLeft)
+ str = _this._renderInline(str, lines[lines.length - 1])
}
})
@@ -152,11 +164,21 @@ UI.prototype.rowToString = function (row, lines) {
return lines
}
+function addBorder (col, ts, style) {
+ if (col.border) {
+ if (/[.']-+[.']/.test(ts)) return ''
+ else if (ts.trim().length) return style
+ else return ' '
+ }
+ return ''
+}
+
// if the full 'source' can render in
// the target line, do so.
-UI.prototype._renderInline = function (source, previousLine, paddingLeft) {
- var target = previousLine.text,
- str = ''
+UI.prototype._renderInline = function (source, previousLine) {
+ var leadingWhitespace = source.match(/^ */)[0].length
+ var target = previousLine.text
+ var targetTextWidth = stringWidth(target.trimRight())
if (!previousLine.span) return source
@@ -167,39 +189,34 @@ UI.prototype._renderInline = function (source, previousLine, paddingLeft) {
return target + source
}
- for (var i = 0, tc, sc; i < Math.max(source.length, target.length); i++) {
- tc = target.charAt(i) || ' '
- sc = source.charAt(i) || ' '
- // we tried to overwrite a character in the other string.
- if (tc !== ' ' && sc !== ' ') return source
- // there is not enough whitespace to maintain padding.
- if (sc !== ' ' && i < paddingLeft + target.length) return source
- // :thumbsup:
- if (tc === ' ') str += sc
- else str += tc
- }
+ if (leadingWhitespace < targetTextWidth) return source
previousLine.hidden = true
- return str
+ return target.trimRight() + new Array(leadingWhitespace - targetTextWidth + 1).join(' ') + source.trimLeft()
}
UI.prototype._rasterize = function (row) {
- var _this = this,
- i,
- rrow,
- rrows = [],
- widths = this._columnWidths(row),
- wrapped
+ var _this = this
+ var i
+ var rrow
+ var rrows = []
+ var widths = this._columnWidths(row)
+ var wrapped
// word wrap all columns, and create
// a data-structure that is easy to rasterize.
row.forEach(function (col, c) {
// leave room for left and right padding.
col.width = widths[c]
- if (_this.wrap) wrapped = wrap.hard(_this._negatePadding(col))(col.text).split('\n')
+ if (_this.wrap) wrapped = wrap(col.text, _this._negatePadding(col), {hard: true}).split('\n')
else wrapped = col.text.split('\n')
+ if (col.border) {
+ wrapped.unshift('.' + new Array(_this._negatePadding(col) + 3).join('-') + '.')
+ wrapped.push("'" + new Array(_this._negatePadding(col) + 3).join('-') + "'")
+ }
+
// add top and bottom padding.
if (col.padding) {
for (i = 0; i < (col.padding[top] || 0); i++) wrapped.unshift('')
@@ -224,15 +241,16 @@ UI.prototype._rasterize = function (row) {
UI.prototype._negatePadding = function (col) {
var wrapWidth = col.width
if (col.padding) wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0)
+ if (col.border) wrapWidth -= 4
return wrapWidth
}
UI.prototype._columnWidths = function (row) {
- var _this = this,
- widths = [],
- unset = row.length,
- unsetWidth,
- remainingWidth = this.width
+ var _this = this
+ var widths = []
+ var unset = row.length
+ var unsetWidth
+ var remainingWidth = this.width
// column widths can be set in config.
row.forEach(function (col, i) {
@@ -248,7 +266,7 @@ UI.prototype._columnWidths = function (row) {
// any unset widths should be calculated.
if (unset) unsetWidth = Math.floor(remainingWidth / unset)
widths.forEach(function (w, i) {
- if (!_this.wrap) widths[i] = row[i].width || row[i].text.length
+ if (!_this.wrap) widths[i] = row[i].width || stringWidth(row[i].text)
else if (w === undefined) widths[i] = Math.max(unsetWidth, _minWidth(row[i]))
})
@@ -259,8 +277,33 @@ UI.prototype._columnWidths = function (row) {
// a column, based on padding preferences.
function _minWidth (col) {
var padding = col.padding || []
+ var minWidth = 1 + (padding[left] || 0) + (padding[right] || 0)
+ if (col.border) minWidth += 4
+ return minWidth
+}
+
+function alignRight (str, width) {
+ str = str.trim()
+ var padding = ''
+ var strWidth = stringWidth(str)
+
+ if (strWidth < width) {
+ padding = new Array(width - strWidth + 1).join(' ')
+ }
+
+ return padding + str
+}
+
+function alignCenter (str, width) {
+ str = str.trim()
+ var padding = ''
+ var strWidth = stringWidth(str.trim())
+
+ if (strWidth < width) {
+ padding = new Array(parseInt((width - strWidth) / 2, 10) + 1).join(' ')
+ }
- return 1 + (padding[left] || 0) + (padding[right] || 0)
+ return padding + str
}
module.exports = function (opts) {
diff --git a/node_modules/cliui/package.json b/node_modules/cliui/package.json
@@ -1,14 +1,17 @@
{
"name": "cliui",
- "version": "2.1.0",
+ "version": "3.2.0",
"description": "easily create complex multi-column command-line-interfaces",
"main": "index.js",
"scripts": {
- "test": "standard && mocha --check-leaks --ui exports --require patched-blanket -R mocoverage"
+ "pretest": "standard",
+ "test": "nyc mocha",
+ "coverage": "nyc --reporter=text-lcov mocha | coveralls",
+ "version": "standard-version"
},
"repository": {
"type": "git",
- "url": "http://github.com/bcoe/cliui.git"
+ "url": "http://github.com/yargs/cliui.git"
},
"config": {
"blanket": {
@@ -42,18 +45,20 @@
"author": "Ben Coe <ben@npmjs.com>",
"license": "ISC",
"dependencies": {
- "center-align": "^0.1.1",
- "right-align": "^0.1.1",
- "wordwrap": "0.0.2"
+ "string-width": "^1.0.1",
+ "strip-ansi": "^3.0.1",
+ "wrap-ansi": "^2.0.0"
},
"devDependencies": {
- "blanket": "^1.1.6",
- "chai": "^2.2.0",
- "coveralls": "^2.11.2",
- "mocha": "^2.2.4",
- "mocha-lcov-reporter": "0.0.2",
- "mocoverage": "^1.0.0",
- "patched-blanket": "^1.0.1",
- "standard": "^3.6.1"
- }
-}
+ "chai": "^3.5.0",
+ "chalk": "^1.1.2",
+ "coveralls": "^2.11.8",
+ "mocha": "^2.4.5",
+ "nyc": "^6.4.0",
+ "standard": "^6.0.8",
+ "standard-version": "^2.1.2"
+ },
+ "files": [
+ "index.js"
+ ]
+}
+\ No newline at end of file
diff --git a/node_modules/cliui/test/cliui.js b/node_modules/cliui/test/cliui.js
@@ -1,349 +0,0 @@
-/* global describe, it */
-
-require('chai').should()
-
-var cliui = require('../')
-
-describe('cliui', function () {
- describe('div', function () {
- it("wraps text at 'width' if a single column is given", function () {
- var ui = cliui({
- width: 10
- })
-
- ui.div('i am a string that should be wrapped')
-
- ui.toString().split('\n').forEach(function (row) {
- row.length.should.be.lte(10)
- })
- })
-
- it('evenly divides text across columns if multiple columns are given', function () {
- var ui = cliui({
- width: 40
- })
-
- ui.div(
- {text: 'i am a string that should be wrapped', width: 15},
- 'i am a second string that should be wrapped',
- 'i am a third string that should be wrapped'
- )
-
- // total width of all columns is <=
- // the width cliui is initialized with.
- ui.toString().split('\n').forEach(function (row) {
- row.length.should.be.lte(40)
- })
-
- // it should wrap each column appropriately.
- var expected = [
- 'i am a string i am a i am a third',
- 'that should be second string that',
- 'wrapped string that should be',
- ' should be wrapped',
- ' wrapped'
- ]
-
- ui.toString().split('\n').should.eql(expected)
- })
-
- it('allows for a blank row to be appended', function () {
- var ui = cliui({
- width: 40
- })
-
- ui.div()
-
- // it should wrap each column appropriately.
- var expected = ['']
-
- ui.toString().split('\n').should.eql(expected)
- })
- })
-
- describe('_columnWidths', function () {
- it('uses same width for each column by default', function () {
- var ui = cliui({
- width: 40
- }),
- widths = ui._columnWidths([{}, {}, {}])
-
- widths[0].should.equal(13)
- widths[1].should.equal(13)
- widths[2].should.equal(13)
- })
-
- it('divides width over remaining columns if first column has width specified', function () {
- var ui = cliui({
- width: 40
- }),
- widths = ui._columnWidths([{width: 20}, {}, {}])
-
- widths[0].should.equal(20)
- widths[1].should.equal(10)
- widths[2].should.equal(10)
- })
-
- it('divides width over remaining columns if middle column has width specified', function () {
- var ui = cliui({
- width: 40
- }),
- widths = ui._columnWidths([{}, {width: 10}, {}])
-
- widths[0].should.equal(15)
- widths[1].should.equal(10)
- widths[2].should.equal(15)
- })
-
- it('keeps track of remaining width if multiple columns have width specified', function () {
- var ui = cliui({
- width: 40
- }),
- widths = ui._columnWidths([{width: 20}, {width: 12}, {}])
-
- widths[0].should.equal(20)
- widths[1].should.equal(12)
- widths[2].should.equal(8)
- })
-
- it('uses a sane default if impossible widths are specified', function () {
- var ui = cliui({
- width: 40
- }),
- widths = ui._columnWidths([{width: 30}, {width: 30}, {padding: [0, 2, 0, 1]}])
-
- widths[0].should.equal(30)
- widths[1].should.equal(30)
- widths[2].should.equal(4)
- })
- })
-
- describe('alignment', function () {
- it('allows a column to be right aligned', function () {
- var ui = cliui({
- width: 40
- })
-
- ui.div(
- 'i am a string',
- {text: 'i am a second string', align: 'right'},
- 'i am a third string that should be wrapped'
- )
-
- // it should right-align the second column.
- var expected = [
- 'i am a stringi am a secondi am a third',
- ' stringstring that',
- ' should be',
- ' wrapped'
- ]
-
- ui.toString().split('\n').should.eql(expected)
- })
-
- it('allows a column to be center aligned', function () {
- var ui = cliui({
- width: 60
- })
-
- ui.div(
- 'i am a string',
- {text: 'i am a second string', align: 'center', padding: [0, 2, 0, 2]},
- 'i am a third string that should be wrapped'
- )
-
- // it should right-align the second column.
- var expected = [
- 'i am a string i am a second i am a third string',
- ' string that should be',
- ' wrapped'
- ]
-
- ui.toString().split('\n').should.eql(expected)
- })
- })
-
- describe('padding', function () {
- it('handles left/right padding', function () {
- var ui = cliui({
- width: 40
- })
-
- ui.div(
- {text: 'i have padding on my left', padding: [0, 0, 0, 4]},
- {text: 'i have padding on my right', padding: [0, 2, 0, 0], align: 'center'},
- {text: 'i have no padding', padding: [0, 0, 0, 0]}
- )
-
- // it should add left/right padding to columns.
- var expected = [
- ' i have i have i have no',
- ' padding padding on padding',
- ' on my my right',
- ' left'
- ]
-
- ui.toString().split('\n').should.eql(expected)
- })
-
- it('handles top/bottom padding', function () {
- var ui = cliui({
- width: 40
- })
-
- ui.div(
- 'i am a string',
- {text: 'i am a second string', padding: [2, 0, 0, 0]},
- {text: 'i am a third string that should be wrapped', padding: [0, 0, 1, 0]}
- )
-
- // it should add top/bottom padding to second
- // and third columns.
- var expected = [
- 'i am a string i am a third',
- ' string that',
- ' i am a secondshould be',
- ' string wrapped',
- ''
- ]
-
- ui.toString().split('\n').should.eql(expected)
- })
- })
-
- describe('wrap', function () {
- it('allows wordwrap to be disabled', function () {
- var ui = cliui({
- wrap: false
- })
-
- ui.div(
- {text: 'i am a string', padding: [0, 1, 0, 0]},
- {text: 'i am a second string', padding: [0, 2, 0, 0]},
- {text: 'i am a third string that should not be wrapped', padding: [0, 0, 0, 2]}
- )
-
- ui.toString().should.equal('i am a string i am a second string i am a third string that should not be wrapped')
- })
- })
-
- describe('span', function () {
- it('appends the next row to the end of the prior row if it fits', function () {
- var ui = cliui({
- width: 40
- })
-
- ui.span(
- {text: 'i am a string that will be wrapped', width: 30}
- )
-
- ui.div(
- {text: ' [required] [default: 99]', align: 'right'}
- )
-
- var expected = [
- 'i am a string that will be',
- 'wrapped [required] [default: 99]'
- ]
-
- ui.toString().split('\n').should.eql(expected)
- })
-
- it('does not append the string if it does not fit on the prior row', function () {
- var ui = cliui({
- width: 40
- })
-
- ui.span(
- {text: 'i am a string that will be wrapped', width: 30}
- )
-
- ui.div(
- {text: 'i am a second row', align: 'left'}
- )
-
- var expected = [
- 'i am a string that will be',
- 'wrapped',
- 'i am a second row'
- ]
-
- ui.toString().split('\n').should.eql(expected)
- })
-
- it('always appends text to prior span if wrap is disabled', function () {
- var ui = cliui({
- wrap: false,
- width: 40
- })
-
- ui.span(
- {text: 'i am a string that will be wrapped', width: 30}
- )
-
- ui.div(
- {text: 'i am a second row', align: 'left', padding: [0, 0, 0, 3]}
- )
-
- ui.div('a third line')
-
- var expected = [
- 'i am a string that will be wrapped i am a second row',
- 'a third line'
- ]
-
- ui.toString().split('\n').should.eql(expected)
- })
- })
-
- describe('layoutDSL', function () {
- it('turns tab into multiple columns', function () {
- var ui = cliui({
- width: 60
- })
-
- ui.div(
- ' <regex> \tmy awesome regex\n <my second thing> \tanother row\t a third column'
- )
-
- var expected = [
- ' <regex> my awesome regex',
- ' <my second thing> another row a third column'
- ]
-
- ui.toString().split('\n').should.eql(expected)
- })
-
- it('turns newline into multiple rows', function () {
- var ui = cliui({
- width: 40
- })
-
- ui.div(
- 'Usage: $0\n <regex>\t my awesome regex\n <glob>\t my awesome glob\t [required]'
- )
- var expected = [
- 'Usage: $0',
- ' <regex> my awesome regex',
- ' <glob> my awesome [required]',
- ' glob'
- ]
-
- ui.toString().split('\n').should.eql(expected)
- })
-
- it('does not apply DSL if wrap is false', function () {
- var ui = cliui({
- width: 40,
- wrap: false
- })
-
- ui.div(
- 'Usage: $0\ttwo\tthree'
- )
-
- ui.toString().should.eql('Usage: $0\ttwo\tthree')
- })
-
- })
-})
diff --git a/node_modules/duplexer2/node_modules/isarray/README.md b/node_modules/duplexer2/node_modules/isarray/README.md
@@ -1,54 +0,0 @@
-
-# isarray
-
-`Array#isArray` for older browsers.
-
-## Usage
-
-```js
-var isArray = require('isarray');
-
-console.log(isArray([])); // => true
-console.log(isArray({})); // => false
-```
-
-## Installation
-
-With [npm](http://npmjs.org) do
-
-```bash
-$ npm install isarray
-```
-
-Then bundle for the browser with
-[browserify](https://github.com/substack/browserify).
-
-With [component](http://component.io) do
-
-```bash
-$ component install juliangruber/isarray
-```
-
-## License
-
-(MIT)
-
-Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
diff --git a/node_modules/duplexer2/node_modules/isarray/build/build.js b/node_modules/duplexer2/node_modules/isarray/build/build.js
@@ -1,209 +0,0 @@
-
-/**
- * Require the given path.
- *
- * @param {String} path
- * @return {Object} exports
- * @api public
- */
-
-function require(path, parent, orig) {
- var resolved = require.resolve(path);
-
- // lookup failed
- if (null == resolved) {
- orig = orig || path;
- parent = parent || 'root';
- var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
- err.path = orig;
- err.parent = parent;
- err.require = true;
- throw err;
- }
-
- var module = require.modules[resolved];
-
- // perform real require()
- // by invoking the module's
- // registered function
- if (!module.exports) {
- module.exports = {};
- module.client = module.component = true;
- module.call(this, module.exports, require.relative(resolved), module);
- }
-
- return module.exports;
-}
-
-/**
- * Registered modules.
- */
-
-require.modules = {};
-
-/**
- * Registered aliases.
- */
-
-require.aliases = {};
-
-/**
- * Resolve `path`.
- *
- * Lookup:
- *
- * - PATH/index.js
- * - PATH.js
- * - PATH
- *
- * @param {String} path
- * @return {String} path or null
- * @api private
- */
-
-require.resolve = function(path) {
- if (path.charAt(0) === '/') path = path.slice(1);
- var index = path + '/index.js';
-
- var paths = [
- path,
- path + '.js',
- path + '.json',
- path + '/index.js',
- path + '/index.json'
- ];
-
- for (var i = 0; i < paths.length; i++) {
- var path = paths[i];
- if (require.modules.hasOwnProperty(path)) return path;
- }
-
- if (require.aliases.hasOwnProperty(index)) {
- return require.aliases[index];
- }
-};
-
-/**
- * Normalize `path` relative to the current path.
- *
- * @param {String} curr
- * @param {String} path
- * @return {String}
- * @api private
- */
-
-require.normalize = function(curr, path) {
- var segs = [];
-
- if ('.' != path.charAt(0)) return path;
-
- curr = curr.split('/');
- path = path.split('/');
-
- for (var i = 0; i < path.length; ++i) {
- if ('..' == path[i]) {
- curr.pop();
- } else if ('.' != path[i] && '' != path[i]) {
- segs.push(path[i]);
- }
- }
-
- return curr.concat(segs).join('/');
-};
-
-/**
- * Register module at `path` with callback `definition`.
- *
- * @param {String} path
- * @param {Function} definition
- * @api private
- */
-
-require.register = function(path, definition) {
- require.modules[path] = definition;
-};
-
-/**
- * Alias a module definition.
- *
- * @param {String} from
- * @param {String} to
- * @api private
- */
-
-require.alias = function(from, to) {
- if (!require.modules.hasOwnProperty(from)) {
- throw new Error('Failed to alias "' + from + '", it does not exist');
- }
- require.aliases[to] = from;
-};
-
-/**
- * Return a require function relative to the `parent` path.
- *
- * @param {String} parent
- * @return {Function}
- * @api private
- */
-
-require.relative = function(parent) {
- var p = require.normalize(parent, '..');
-
- /**
- * lastIndexOf helper.
- */
-
- function lastIndexOf(arr, obj) {
- var i = arr.length;
- while (i--) {
- if (arr[i] === obj) return i;
- }
- return -1;
- }
-
- /**
- * The relative require() itself.
- */
-
- function localRequire(path) {
- var resolved = localRequire.resolve(path);
- return require(resolved, parent, path);
- }
-
- /**
- * Resolve relative to the parent.
- */
-
- localRequire.resolve = function(path) {
- var c = path.charAt(0);
- if ('/' == c) return path.slice(1);
- if ('.' == c) return require.normalize(p, path);
-
- // resolve deps by returning
- // the dep in the nearest "deps"
- // directory
- var segs = parent.split('/');
- var i = lastIndexOf(segs, 'deps') + 1;
- if (!i) i = 0;
- path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
- return path;
- };
-
- /**
- * Check if module is defined at `path`.
- */
-
- localRequire.exists = function(path) {
- return require.modules.hasOwnProperty(localRequire.resolve(path));
- };
-
- return localRequire;
-};
-require.register("isarray/index.js", function(exports, require, module){
-module.exports = Array.isArray || function (arr) {
- return Object.prototype.toString.call(arr) == '[object Array]';
-};
-
-});
-require.alias("isarray/index.js", "isarray/index.js");
-
diff --git a/node_modules/duplexer2/node_modules/isarray/component.json b/node_modules/duplexer2/node_modules/isarray/component.json
@@ -1,19 +0,0 @@
-{
- "name" : "isarray",
- "description" : "Array#isArray for older browsers",
- "version" : "0.0.1",
- "repository" : "juliangruber/isarray",
- "homepage": "https://github.com/juliangruber/isarray",
- "main" : "index.js",
- "scripts" : [
- "index.js"
- ],
- "dependencies" : {},
- "keywords": ["browser","isarray","array"],
- "author": {
- "name": "Julian Gruber",
- "email": "mail@juliangruber.com",
- "url": "http://juliangruber.com"
- },
- "license": "MIT"
-}
diff --git a/node_modules/duplexer2/node_modules/isarray/index.js b/node_modules/duplexer2/node_modules/isarray/index.js
@@ -1,3 +0,0 @@
-module.exports = Array.isArray || function (arr) {
- return Object.prototype.toString.call(arr) == '[object Array]';
-};
diff --git a/node_modules/duplexer2/node_modules/isarray/package.json b/node_modules/duplexer2/node_modules/isarray/package.json
@@ -1,25 +0,0 @@
-{
- "name" : "isarray",
- "description" : "Array#isArray for older browsers",
- "version" : "0.0.1",
- "repository" : {
- "type" : "git",
- "url" : "git://github.com/juliangruber/isarray.git"
- },
- "homepage": "https://github.com/juliangruber/isarray",
- "main" : "index.js",
- "scripts" : {
- "test" : "tap test/*.js"
- },
- "dependencies" : {},
- "devDependencies" : {
- "tap" : "*"
- },
- "keywords": ["browser","isarray","array"],
- "author": {
- "name": "Julian Gruber",
- "email": "mail@juliangruber.com",
- "url": "http://juliangruber.com"
- },
- "license": "MIT"
-}
diff --git a/node_modules/gauge/node_modules/object-assign/index.js b/node_modules/gauge/node_modules/object-assign/index.js
@@ -1,83 +0,0 @@
-'use strict';
-/* eslint-disable no-unused-vars */
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-var propIsEnumerable = Object.prototype.propertyIsEnumerable;
-
-function toObject(val) {
- if (val === null || val === undefined) {
- throw new TypeError('Object.assign cannot be called with null or undefined');
- }
-
- return Object(val);
-}
-
-function shouldUseNative() {
- try {
- if (!Object.assign) {
- return false;
- }
-
- // Detect buggy property enumeration order in older V8 versions.
-
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
- var test1 = new String('abc'); // eslint-disable-line
- test1[5] = 'de';
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
- return false;
- }
-
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
- var test2 = {};
- for (var i = 0; i < 10; i++) {
- test2['_' + String.fromCharCode(i)] = i;
- }
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
- return test2[n];
- });
- if (order2.join('') !== '0123456789') {
- return false;
- }
-
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
- var test3 = {};
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
- test3[letter] = letter;
- });
- if (Object.keys(Object.assign({}, test3)).join('') !==
- 'abcdefghijklmnopqrst') {
- return false;
- }
-
- return true;
- } catch (e) {
- // We don't expect any of the above to throw, but better to be safe.
- return false;
- }
-}
-
-module.exports = shouldUseNative() ? Object.assign : function (target, source) {
- var from;
- var to = toObject(target);
- var symbols;
-
- for (var s = 1; s < arguments.length; s++) {
- from = Object(arguments[s]);
-
- for (var key in from) {
- if (hasOwnProperty.call(from, key)) {
- to[key] = from[key];
- }
- }
-
- if (Object.getOwnPropertySymbols) {
- symbols = Object.getOwnPropertySymbols(from);
- for (var i = 0; i < symbols.length; i++) {
- if (propIsEnumerable.call(from, symbols[i])) {
- to[symbols[i]] = from[symbols[i]];
- }
- }
- }
- }
-
- return to;
-};
diff --git a/node_modules/gauge/node_modules/object-assign/license b/node_modules/gauge/node_modules/object-assign/license
@@ -1,21 +0,0 @@
-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.
diff --git a/node_modules/gauge/node_modules/object-assign/package.json b/node_modules/gauge/node_modules/object-assign/package.json
@@ -1,42 +0,0 @@
-{
- "name": "object-assign",
- "version": "4.1.0",
- "description": "ES2015 Object.assign() ponyfill",
- "license": "MIT",
- "repository": "sindresorhus/object-assign",
- "author": {
- "name": "Sindre Sorhus",
- "email": "sindresorhus@gmail.com",
- "url": "sindresorhus.com"
- },
- "engines": {
- "node": ">=0.10.0"
- },
- "scripts": {
- "test": "xo && mocha",
- "bench": "matcha bench.js"
- },
- "files": [
- "index.js"
- ],
- "keywords": [
- "object",
- "assign",
- "extend",
- "properties",
- "es2015",
- "ecmascript",
- "harmony",
- "ponyfill",
- "prollyfill",
- "polyfill",
- "shim",
- "browser"
- ],
- "devDependencies": {
- "lodash": "^4.8.2",
- "matcha": "^0.7.0",
- "mocha": "*",
- "xo": "*"
- }
-}
diff --git a/node_modules/gauge/node_modules/object-assign/readme.md b/node_modules/gauge/node_modules/object-assign/readme.md
@@ -1,56 +0,0 @@
-# object-assign [](https://travis-ci.org/sindresorhus/object-assign)
-
-> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) ponyfill
-
-> Ponyfill: A polyfill that doesn't overwrite the native method
-
-
-## Install
-
-```
-$ npm install --save object-assign
-```
-
-
-## Usage
-
-```js
-const objectAssign = require('object-assign');
-
-objectAssign({foo: 0}, {bar: 1});
-//=> {foo: 0, bar: 1}
-
-// multiple sources
-objectAssign({foo: 0}, {bar: 1}, {baz: 2});
-//=> {foo: 0, bar: 1, baz: 2}
-
-// overwrites equal keys
-objectAssign({foo: 0}, {foo: 1}, {foo: 2});
-//=> {foo: 2}
-
-// ignores null and undefined sources
-objectAssign({foo: 0}, null, {bar: 1}, undefined);
-//=> {foo: 0, bar: 1}
-```
-
-
-## API
-
-### objectAssign(target, source, [source, ...])
-
-Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones.
-
-
-## Resources
-
-- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign)
-
-
-## Related
-
-- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()`
-
-
-## License
-
-MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/node_modules/glob-stream/node_modules/isarray/README.md b/node_modules/glob-stream/node_modules/isarray/README.md
@@ -1,54 +0,0 @@
-
-# isarray
-
-`Array#isArray` for older browsers.
-
-## Usage
-
-```js
-var isArray = require('isarray');
-
-console.log(isArray([])); // => true
-console.log(isArray({})); // => false
-```
-
-## Installation
-
-With [npm](http://npmjs.org) do
-
-```bash
-$ npm install isarray
-```
-
-Then bundle for the browser with
-[browserify](https://github.com/substack/browserify).
-
-With [component](http://component.io) do
-
-```bash
-$ component install juliangruber/isarray
-```
-
-## License
-
-(MIT)
-
-Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
diff --git a/node_modules/glob-stream/node_modules/isarray/build/build.js b/node_modules/glob-stream/node_modules/isarray/build/build.js
@@ -1,209 +0,0 @@
-
-/**
- * Require the given path.
- *
- * @param {String} path
- * @return {Object} exports
- * @api public
- */
-
-function require(path, parent, orig) {
- var resolved = require.resolve(path);
-
- // lookup failed
- if (null == resolved) {
- orig = orig || path;
- parent = parent || 'root';
- var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
- err.path = orig;
- err.parent = parent;
- err.require = true;
- throw err;
- }
-
- var module = require.modules[resolved];
-
- // perform real require()
- // by invoking the module's
- // registered function
- if (!module.exports) {
- module.exports = {};
- module.client = module.component = true;
- module.call(this, module.exports, require.relative(resolved), module);
- }
-
- return module.exports;
-}
-
-/**
- * Registered modules.
- */
-
-require.modules = {};
-
-/**
- * Registered aliases.
- */
-
-require.aliases = {};
-
-/**
- * Resolve `path`.
- *
- * Lookup:
- *
- * - PATH/index.js
- * - PATH.js
- * - PATH
- *
- * @param {String} path
- * @return {String} path or null
- * @api private
- */
-
-require.resolve = function(path) {
- if (path.charAt(0) === '/') path = path.slice(1);
- var index = path + '/index.js';
-
- var paths = [
- path,
- path + '.js',
- path + '.json',
- path + '/index.js',
- path + '/index.json'
- ];
-
- for (var i = 0; i < paths.length; i++) {
- var path = paths[i];
- if (require.modules.hasOwnProperty(path)) return path;
- }
-
- if (require.aliases.hasOwnProperty(index)) {
- return require.aliases[index];
- }
-};
-
-/**
- * Normalize `path` relative to the current path.
- *
- * @param {String} curr
- * @param {String} path
- * @return {String}
- * @api private
- */
-
-require.normalize = function(curr, path) {
- var segs = [];
-
- if ('.' != path.charAt(0)) return path;
-
- curr = curr.split('/');
- path = path.split('/');
-
- for (var i = 0; i < path.length; ++i) {
- if ('..' == path[i]) {
- curr.pop();
- } else if ('.' != path[i] && '' != path[i]) {
- segs.push(path[i]);
- }
- }
-
- return curr.concat(segs).join('/');
-};
-
-/**
- * Register module at `path` with callback `definition`.
- *
- * @param {String} path
- * @param {Function} definition
- * @api private
- */
-
-require.register = function(path, definition) {
- require.modules[path] = definition;
-};
-
-/**
- * Alias a module definition.
- *
- * @param {String} from
- * @param {String} to
- * @api private
- */
-
-require.alias = function(from, to) {
- if (!require.modules.hasOwnProperty(from)) {
- throw new Error('Failed to alias "' + from + '", it does not exist');
- }
- require.aliases[to] = from;
-};
-
-/**
- * Return a require function relative to the `parent` path.
- *
- * @param {String} parent
- * @return {Function}
- * @api private
- */
-
-require.relative = function(parent) {
- var p = require.normalize(parent, '..');
-
- /**
- * lastIndexOf helper.
- */
-
- function lastIndexOf(arr, obj) {
- var i = arr.length;
- while (i--) {
- if (arr[i] === obj) return i;
- }
- return -1;
- }
-
- /**
- * The relative require() itself.
- */
-
- function localRequire(path) {
- var resolved = localRequire.resolve(path);
- return require(resolved, parent, path);
- }
-
- /**
- * Resolve relative to the parent.
- */
-
- localRequire.resolve = function(path) {
- var c = path.charAt(0);
- if ('/' == c) return path.slice(1);
- if ('.' == c) return require.normalize(p, path);
-
- // resolve deps by returning
- // the dep in the nearest "deps"
- // directory
- var segs = parent.split('/');
- var i = lastIndexOf(segs, 'deps') + 1;
- if (!i) i = 0;
- path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
- return path;
- };
-
- /**
- * Check if module is defined at `path`.
- */
-
- localRequire.exists = function(path) {
- return require.modules.hasOwnProperty(localRequire.resolve(path));
- };
-
- return localRequire;
-};
-require.register("isarray/index.js", function(exports, require, module){
-module.exports = Array.isArray || function (arr) {
- return Object.prototype.toString.call(arr) == '[object Array]';
-};
-
-});
-require.alias("isarray/index.js", "isarray/index.js");
-
diff --git a/node_modules/glob-stream/node_modules/isarray/component.json b/node_modules/glob-stream/node_modules/isarray/component.json
@@ -1,19 +0,0 @@
-{
- "name" : "isarray",
- "description" : "Array#isArray for older browsers",
- "version" : "0.0.1",
- "repository" : "juliangruber/isarray",
- "homepage": "https://github.com/juliangruber/isarray",
- "main" : "index.js",
- "scripts" : [
- "index.js"
- ],
- "dependencies" : {},
- "keywords": ["browser","isarray","array"],
- "author": {
- "name": "Julian Gruber",
- "email": "mail@juliangruber.com",
- "url": "http://juliangruber.com"
- },
- "license": "MIT"
-}
diff --git a/node_modules/glob-stream/node_modules/isarray/index.js b/node_modules/glob-stream/node_modules/isarray/index.js
@@ -1,3 +0,0 @@
-module.exports = Array.isArray || function (arr) {
- return Object.prototype.toString.call(arr) == '[object Array]';
-};
diff --git a/node_modules/glob-stream/node_modules/isarray/package.json b/node_modules/glob-stream/node_modules/isarray/package.json
@@ -1,25 +0,0 @@
-{
- "name" : "isarray",
- "description" : "Array#isArray for older browsers",
- "version" : "0.0.1",
- "repository" : {
- "type" : "git",
- "url" : "git://github.com/juliangruber/isarray.git"
- },
- "homepage": "https://github.com/juliangruber/isarray",
- "main" : "index.js",
- "scripts" : {
- "test" : "tap test/*.js"
- },
- "dependencies" : {},
- "devDependencies" : {
- "tap" : "*"
- },
- "keywords": ["browser","isarray","array"],
- "author": {
- "name": "Julian Gruber",
- "email": "mail@juliangruber.com",
- "url": "http://juliangruber.com"
- },
- "license": "MIT"
-}
diff --git a/node_modules/glob/node_modules/minimatch/LICENSE b/node_modules/glob/node_modules/minimatch/LICENSE
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and 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.
diff --git a/node_modules/glob/node_modules/minimatch/README.md b/node_modules/glob/node_modules/minimatch/README.md
@@ -1,209 +0,0 @@
-# minimatch
-
-A minimal matching utility.
-
-[](http://travis-ci.org/isaacs/minimatch)
-
-
-This is the matching library used internally by npm.
-
-It works by converting glob expressions into JavaScript `RegExp`
-objects.
-
-## Usage
-
-```javascript
-var minimatch = require("minimatch")
-
-minimatch("bar.foo", "*.foo") // true!
-minimatch("bar.foo", "*.bar") // false!
-minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy!
-```
-
-## Features
-
-Supports these glob features:
-
-* Brace Expansion
-* Extended glob matching
-* "Globstar" `**` matching
-
-See:
-
-* `man sh`
-* `man bash`
-* `man 3 fnmatch`
-* `man 5 gitignore`
-
-## Minimatch Class
-
-Create a minimatch object by instantiating the `minimatch.Minimatch` class.
-
-```javascript
-var Minimatch = require("minimatch").Minimatch
-var mm = new Minimatch(pattern, options)
-```
-
-### Properties
-
-* `pattern` The original pattern the minimatch object represents.
-* `options` The options supplied to the constructor.
-* `set` A 2-dimensional array of regexp or string expressions.
- Each row in the
- array corresponds to a brace-expanded pattern. Each item in the row
- corresponds to a single path-part. For example, the pattern
- `{a,b/c}/d` would expand to a set of patterns like:
-
- [ [ a, d ]
- , [ b, c, d ] ]
-
- If a portion of the pattern doesn't have any "magic" in it
- (that is, it's something like `"foo"` rather than `fo*o?`), then it
- will be left as a string rather than converted to a regular
- expression.
-
-* `regexp` Created by the `makeRe` method. A single regular expression
- expressing the entire pattern. This is useful in cases where you wish
- to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.
-* `negate` True if the pattern is negated.
-* `comment` True if the pattern is a comment.
-* `empty` True if the pattern is `""`.
-
-### Methods
-
-* `makeRe` Generate the `regexp` member if necessary, and return it.
- Will return `false` if the pattern is invalid.
-* `match(fname)` Return true if the filename matches the pattern, or
- false otherwise.
-* `matchOne(fileArray, patternArray, partial)` Take a `/`-split
- filename, and match it against a single row in the `regExpSet`. This
- method is mainly for internal use, but is exposed so that it can be
- used by a glob-walker that needs to avoid excessive filesystem calls.
-
-All other methods are internal, and will be called as necessary.
-
-### minimatch(path, pattern, options)
-
-Main export. Tests a path against the pattern using the options.
-
-```javascript
-var isJS = minimatch(file, "*.js", { matchBase: true })
-```
-
-### minimatch.filter(pattern, options)
-
-Returns a function that tests its
-supplied argument, suitable for use with `Array.filter`. Example:
-
-```javascript
-var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true}))
-```
-
-### minimatch.match(list, pattern, options)
-
-Match against the list of
-files, in the style of fnmatch or glob. If nothing is matched, and
-options.nonull is set, then return a list containing the pattern itself.
-
-```javascript
-var javascripts = minimatch.match(fileList, "*.js", {matchBase: true}))
-```
-
-### minimatch.makeRe(pattern, options)
-
-Make a regular expression object from the pattern.
-
-## Options
-
-All options are `false` by default.
-
-### debug
-
-Dump a ton of stuff to stderr.
-
-### nobrace
-
-Do not expand `{a,b}` and `{1..3}` brace sets.
-
-### noglobstar
-
-Disable `**` matching against multiple folder names.
-
-### dot
-
-Allow patterns to match filenames starting with a period, even if
-the pattern does not explicitly have a period in that spot.
-
-Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot`
-is set.
-
-### noext
-
-Disable "extglob" style patterns like `+(a|b)`.
-
-### nocase
-
-Perform a case-insensitive match.
-
-### nonull
-
-When a match is not found by `minimatch.match`, return a list containing
-the pattern itself if this option is set. When not set, an empty list
-is returned if there are no matches.
-
-### matchBase
-
-If set, then patterns without slashes will be matched
-against the basename of the path if it contains slashes. For example,
-`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
-
-### nocomment
-
-Suppress the behavior of treating `#` at the start of a pattern as a
-comment.
-
-### nonegate
-
-Suppress the behavior of treating a leading `!` character as negation.
-
-### flipNegate
-
-Returns from negate expressions the same as if they were not negated.
-(Ie, true on a hit, false on a miss.)
-
-
-## Comparisons to other fnmatch/glob implementations
-
-While strict compliance with the existing standards is a worthwhile
-goal, some discrepancies exist between minimatch and other
-implementations, and are intentional.
-
-If the pattern starts with a `!` character, then it is negated. Set the
-`nonegate` flag to suppress this behavior, and treat leading `!`
-characters normally. This is perhaps relevant if you wish to start the
-pattern with a negative extglob pattern like `!(a|B)`. Multiple `!`
-characters at the start of a pattern will negate the pattern multiple
-times.
-
-If a pattern starts with `#`, then it is treated as a comment, and
-will not match anything. Use `\#` to match a literal `#` at the
-start of a line, or set the `nocomment` flag to suppress this behavior.
-
-The double-star character `**` is supported by default, unless the
-`noglobstar` flag is set. This is supported in the manner of bsdglob
-and bash 4.1, where `**` only has special significance if it is the only
-thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but
-`a/**b` will not.
-
-If an escaped pattern has no matches, and the `nonull` flag is set,
-then minimatch.match returns the pattern as-provided, rather than
-interpreting the character escapes. For example,
-`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
-`"*a?"`. This is akin to setting the `nullglob` option in bash, except
-that it does not resolve escaped pattern characters.
-
-If brace expansion is not disabled, then it is performed before any
-other interpretation of the glob pattern. Thus, a pattern like
-`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
-**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
-checked for validity. Since those two are valid, matching proceeds.
diff --git a/node_modules/glob/node_modules/minimatch/minimatch.js b/node_modules/glob/node_modules/minimatch/minimatch.js
@@ -1,923 +0,0 @@
-module.exports = minimatch
-minimatch.Minimatch = Minimatch
-
-var path = { sep: '/' }
-try {
- path = require('path')
-} catch (er) {}
-
-var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
-var expand = require('brace-expansion')
-
-var plTypes = {
- '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
- '?': { open: '(?:', close: ')?' },
- '+': { open: '(?:', close: ')+' },
- '*': { open: '(?:', close: ')*' },
- '@': { open: '(?:', close: ')' }
-}
-
-// any single thing other than /
-// don't need to escape / when using new RegExp()
-var qmark = '[^/]'
-
-// * => any number of characters
-var star = qmark + '*?'
-
-// ** when dots are allowed. Anything goes, except .. and .
-// not (^ or / followed by one or two dots followed by $ or /),
-// followed by anything, any number of times.
-var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
-
-// not a ^ or / followed by a dot,
-// followed by anything, any number of times.
-var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
-
-// characters that need to be escaped in RegExp.
-var reSpecials = charSet('().*{}+?[]^$\\!')
-
-// "abc" -> { a:true, b:true, c:true }
-function charSet (s) {
- return s.split('').reduce(function (set, c) {
- set[c] = true
- return set
- }, {})
-}
-
-// normalizes slashes.
-var slashSplit = /\/+/
-
-minimatch.filter = filter
-function filter (pattern, options) {
- options = options || {}
- return function (p, i, list) {
- return minimatch(p, pattern, options)
- }
-}
-
-function ext (a, b) {
- a = a || {}
- b = b || {}
- var t = {}
- Object.keys(b).forEach(function (k) {
- t[k] = b[k]
- })
- Object.keys(a).forEach(function (k) {
- t[k] = a[k]
- })
- return t
-}
-
-minimatch.defaults = function (def) {
- if (!def || !Object.keys(def).length) return minimatch
-
- var orig = minimatch
-
- var m = function minimatch (p, pattern, options) {
- return orig.minimatch(p, pattern, ext(def, options))
- }
-
- m.Minimatch = function Minimatch (pattern, options) {
- return new orig.Minimatch(pattern, ext(def, options))
- }
-
- return m
-}
-
-Minimatch.defaults = function (def) {
- if (!def || !Object.keys(def).length) return Minimatch
- return minimatch.defaults(def).Minimatch
-}
-
-function minimatch (p, pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('glob pattern string required')
- }
-
- if (!options) options = {}
-
- // shortcut: comments match nothing.
- if (!options.nocomment && pattern.charAt(0) === '#') {
- return false
- }
-
- // "" only matches ""
- if (pattern.trim() === '') return p === ''
-
- return new Minimatch(pattern, options).match(p)
-}
-
-function Minimatch (pattern, options) {
- if (!(this instanceof Minimatch)) {
- return new Minimatch(pattern, options)
- }
-
- if (typeof pattern !== 'string') {
- throw new TypeError('glob pattern string required')
- }
-
- if (!options) options = {}
- pattern = pattern.trim()
-
- // windows support: need to use /, not \
- if (path.sep !== '/') {
- pattern = pattern.split(path.sep).join('/')
- }
-
- this.options = options
- this.set = []
- this.pattern = pattern
- this.regexp = null
- this.negate = false
- this.comment = false
- this.empty = false
-
- // make the set of regexps etc.
- this.make()
-}
-
-Minimatch.prototype.debug = function () {}
-
-Minimatch.prototype.make = make
-function make () {
- // don't do it more than once.
- if (this._made) return
-
- var pattern = this.pattern
- var options = this.options
-
- // empty patterns and comments match nothing.
- if (!options.nocomment && pattern.charAt(0) === '#') {
- this.comment = true
- return
- }
- if (!pattern) {
- this.empty = true
- return
- }
-
- // step 1: figure out negation, etc.
- this.parseNegate()
-
- // step 2: expand braces
- var set = this.globSet = this.braceExpand()
-
- if (options.debug) this.debug = console.error
-
- this.debug(this.pattern, set)
-
- // step 3: now we have a set, so turn each one into a series of path-portion
- // matching patterns.
- // These will be regexps, except in the case of "**", which is
- // set to the GLOBSTAR object for globstar behavior,
- // and will not contain any / characters
- set = this.globParts = set.map(function (s) {
- return s.split(slashSplit)
- })
-
- this.debug(this.pattern, set)
-
- // glob --> regexps
- set = set.map(function (s, si, set) {
- return s.map(this.parse, this)
- }, this)
-
- this.debug(this.pattern, set)
-
- // filter out everything that didn't compile properly.
- set = set.filter(function (s) {
- return s.indexOf(false) === -1
- })
-
- this.debug(this.pattern, set)
-
- this.set = set
-}
-
-Minimatch.prototype.parseNegate = parseNegate
-function parseNegate () {
- var pattern = this.pattern
- var negate = false
- var options = this.options
- var negateOffset = 0
-
- if (options.nonegate) return
-
- for (var i = 0, l = pattern.length
- ; i < l && pattern.charAt(i) === '!'
- ; i++) {
- negate = !negate
- negateOffset++
- }
-
- if (negateOffset) this.pattern = pattern.substr(negateOffset)
- this.negate = negate
-}
-
-// Brace expansion:
-// a{b,c}d -> abd acd
-// a{b,}c -> abc ac
-// a{0..3}d -> a0d a1d a2d a3d
-// a{b,c{d,e}f}g -> abg acdfg acefg
-// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
-//
-// Invalid sets are not expanded.
-// a{2..}b -> a{2..}b
-// a{b}c -> a{b}c
-minimatch.braceExpand = function (pattern, options) {
- return braceExpand(pattern, options)
-}
-
-Minimatch.prototype.braceExpand = braceExpand
-
-function braceExpand (pattern, options) {
- if (!options) {
- if (this instanceof Minimatch) {
- options = this.options
- } else {
- options = {}
- }
- }
-
- pattern = typeof pattern === 'undefined'
- ? this.pattern : pattern
-
- if (typeof pattern === 'undefined') {
- throw new TypeError('undefined pattern')
- }
-
- if (options.nobrace ||
- !pattern.match(/\{.*\}/)) {
- // shortcut. no need to expand.
- return [pattern]
- }
-
- return expand(pattern)
-}
-
-// parse a component of the expanded set.
-// At this point, no pattern may contain "/" in it
-// so we're going to return a 2d array, where each entry is the full
-// pattern, split on '/', and then turned into a regular expression.
-// A regexp is made at the end which joins each array with an
-// escaped /, and another full one which joins each regexp with |.
-//
-// Following the lead of Bash 4.1, note that "**" only has special meaning
-// when it is the *only* thing in a path portion. Otherwise, any series
-// of * is equivalent to a single *. Globstar behavior is enabled by
-// default, and can be disabled by setting options.noglobstar.
-Minimatch.prototype.parse = parse
-var SUBPARSE = {}
-function parse (pattern, isSub) {
- if (pattern.length > 1024 * 64) {
- throw new TypeError('pattern is too long')
- }
-
- var options = this.options
-
- // shortcuts
- if (!options.noglobstar && pattern === '**') return GLOBSTAR
- if (pattern === '') return ''
-
- var re = ''
- var hasMagic = !!options.nocase
- var escaping = false
- // ? => one single character
- var patternListStack = []
- var negativeLists = []
- var stateChar
- var inClass = false
- var reClassStart = -1
- var classStart = -1
- // . and .. never match anything that doesn't start with .,
- // even when options.dot is set.
- var patternStart = pattern.charAt(0) === '.' ? '' // anything
- // not (start or / followed by . or .. followed by / or end)
- : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
- : '(?!\\.)'
- var self = this
-
- function clearStateChar () {
- if (stateChar) {
- // we had some state-tracking character
- // that wasn't consumed by this pass.
- switch (stateChar) {
- case '*':
- re += star
- hasMagic = true
- break
- case '?':
- re += qmark
- hasMagic = true
- break
- default:
- re += '\\' + stateChar
- break
- }
- self.debug('clearStateChar %j %j', stateChar, re)
- stateChar = false
- }
- }
-
- for (var i = 0, len = pattern.length, c
- ; (i < len) && (c = pattern.charAt(i))
- ; i++) {
- this.debug('%s\t%s %s %j', pattern, i, re, c)
-
- // skip over any that are escaped.
- if (escaping && reSpecials[c]) {
- re += '\\' + c
- escaping = false
- continue
- }
-
- switch (c) {
- case '/':
- // completely not allowed, even escaped.
- // Should already be path-split by now.
- return false
-
- case '\\':
- clearStateChar()
- escaping = true
- continue
-
- // the various stateChar values
- // for the "extglob" stuff.
- case '?':
- case '*':
- case '+':
- case '@':
- case '!':
- this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
-
- // all of those are literals inside a class, except that
- // the glob [!a] means [^a] in regexp
- if (inClass) {
- this.debug(' in class')
- if (c === '!' && i === classStart + 1) c = '^'
- re += c
- continue
- }
-
- // if we already have a stateChar, then it means
- // that there was something like ** or +? in there.
- // Handle the stateChar, then proceed with this one.
- self.debug('call clearStateChar %j', stateChar)
- clearStateChar()
- stateChar = c
- // if extglob is disabled, then +(asdf|foo) isn't a thing.
- // just clear the statechar *now*, rather than even diving into
- // the patternList stuff.
- if (options.noext) clearStateChar()
- continue
-
- case '(':
- if (inClass) {
- re += '('
- continue
- }
-
- if (!stateChar) {
- re += '\\('
- continue
- }
-
- patternListStack.push({
- type: stateChar,
- start: i - 1,
- reStart: re.length,
- open: plTypes[stateChar].open,
- close: plTypes[stateChar].close
- })
- // negation is (?:(?!js)[^/]*)
- re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
- this.debug('plType %j %j', stateChar, re)
- stateChar = false
- continue
-
- case ')':
- if (inClass || !patternListStack.length) {
- re += '\\)'
- continue
- }
-
- clearStateChar()
- hasMagic = true
- var pl = patternListStack.pop()
- // negation is (?:(?!js)[^/]*)
- // The others are (?:<pattern>)<type>
- re += pl.close
- if (pl.type === '!') {
- negativeLists.push(pl)
- }
- pl.reEnd = re.length
- continue
-
- case '|':
- if (inClass || !patternListStack.length || escaping) {
- re += '\\|'
- escaping = false
- continue
- }
-
- clearStateChar()
- re += '|'
- continue
-
- // these are mostly the same in regexp and glob
- case '[':
- // swallow any state-tracking char before the [
- clearStateChar()
-
- if (inClass) {
- re += '\\' + c
- continue
- }
-
- inClass = true
- classStart = i
- reClassStart = re.length
- re += c
- continue
-
- case ']':
- // a right bracket shall lose its special
- // meaning and represent itself in
- // a bracket expression if it occurs
- // first in the list. -- POSIX.2 2.8.3.2
- if (i === classStart + 1 || !inClass) {
- re += '\\' + c
- escaping = false
- continue
- }
-
- // handle the case where we left a class open.
- // "[z-a]" is valid, equivalent to "\[z-a\]"
- if (inClass) {
- // split where the last [ was, make sure we don't have
- // an invalid re. if so, re-walk the contents of the
- // would-be class to re-translate any characters that
- // were passed through as-is
- // TODO: It would probably be faster to determine this
- // without a try/catch and a new RegExp, but it's tricky
- // to do safely. For now, this is safe and works.
- var cs = pattern.substring(classStart + 1, i)
- try {
- RegExp('[' + cs + ']')
- } catch (er) {
- // not a valid class!
- var sp = this.parse(cs, SUBPARSE)
- re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
- hasMagic = hasMagic || sp[1]
- inClass = false
- continue
- }
- }
-
- // finish up the class.
- hasMagic = true
- inClass = false
- re += c
- continue
-
- default:
- // swallow any state char that wasn't consumed
- clearStateChar()
-
- if (escaping) {
- // no need
- escaping = false
- } else if (reSpecials[c]
- && !(c === '^' && inClass)) {
- re += '\\'
- }
-
- re += c
-
- } // switch
- } // for
-
- // handle the case where we left a class open.
- // "[abc" is valid, equivalent to "\[abc"
- if (inClass) {
- // split where the last [ was, and escape it
- // this is a huge pita. We now have to re-walk
- // the contents of the would-be class to re-translate
- // any characters that were passed through as-is
- cs = pattern.substr(classStart + 1)
- sp = this.parse(cs, SUBPARSE)
- re = re.substr(0, reClassStart) + '\\[' + sp[0]
- hasMagic = hasMagic || sp[1]
- }
-
- // handle the case where we had a +( thing at the *end*
- // of the pattern.
- // each pattern list stack adds 3 chars, and we need to go through
- // and escape any | chars that were passed through as-is for the regexp.
- // Go through and escape them, taking care not to double-escape any
- // | chars that were already escaped.
- for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
- var tail = re.slice(pl.reStart + pl.open.length)
- this.debug('setting tail', re, pl)
- // maybe some even number of \, then maybe 1 \, followed by a |
- tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
- if (!$2) {
- // the | isn't already escaped, so escape it.
- $2 = '\\'
- }
-
- // need to escape all those slashes *again*, without escaping the
- // one that we need for escaping the | character. As it works out,
- // escaping an even number of slashes can be done by simply repeating
- // it exactly after itself. That's why this trick works.
- //
- // I am sorry that you have to see this.
- return $1 + $1 + $2 + '|'
- })
-
- this.debug('tail=%j\n %s', tail, tail, pl, re)
- var t = pl.type === '*' ? star
- : pl.type === '?' ? qmark
- : '\\' + pl.type
-
- hasMagic = true
- re = re.slice(0, pl.reStart) + t + '\\(' + tail
- }
-
- // handle trailing things that only matter at the very end.
- clearStateChar()
- if (escaping) {
- // trailing \\
- re += '\\\\'
- }
-
- // only need to apply the nodot start if the re starts with
- // something that could conceivably capture a dot
- var addPatternStart = false
- switch (re.charAt(0)) {
- case '.':
- case '[':
- case '(': addPatternStart = true
- }
-
- // Hack to work around lack of negative lookbehind in JS
- // A pattern like: *.!(x).!(y|z) needs to ensure that a name
- // like 'a.xyz.yz' doesn't match. So, the first negative
- // lookahead, has to look ALL the way ahead, to the end of
- // the pattern.
- for (var n = negativeLists.length - 1; n > -1; n--) {
- var nl = negativeLists[n]
-
- var nlBefore = re.slice(0, nl.reStart)
- var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
- var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
- var nlAfter = re.slice(nl.reEnd)
-
- nlLast += nlAfter
-
- // Handle nested stuff like *(*.js|!(*.json)), where open parens
- // mean that we should *not* include the ) in the bit that is considered
- // "after" the negated section.
- var openParensBefore = nlBefore.split('(').length - 1
- var cleanAfter = nlAfter
- for (i = 0; i < openParensBefore; i++) {
- cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
- }
- nlAfter = cleanAfter
-
- var dollar = ''
- if (nlAfter === '' && isSub !== SUBPARSE) {
- dollar = '$'
- }
- var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
- re = newRe
- }
-
- // if the re is not "" at this point, then we need to make sure
- // it doesn't match against an empty path part.
- // Otherwise a/* will match a/, which it should not.
- if (re !== '' && hasMagic) {
- re = '(?=.)' + re
- }
-
- if (addPatternStart) {
- re = patternStart + re
- }
-
- // parsing just a piece of a larger pattern.
- if (isSub === SUBPARSE) {
- return [re, hasMagic]
- }
-
- // skip the regexp for non-magical patterns
- // unescape anything in it, though, so that it'll be
- // an exact match against a file etc.
- if (!hasMagic) {
- return globUnescape(pattern)
- }
-
- var flags = options.nocase ? 'i' : ''
- try {
- var regExp = new RegExp('^' + re + '$', flags)
- } catch (er) {
- // If it was an invalid regular expression, then it can't match
- // anything. This trick looks for a character after the end of
- // the string, which is of course impossible, except in multi-line
- // mode, but it's not a /m regex.
- return new RegExp('$.')
- }
-
- regExp._glob = pattern
- regExp._src = re
-
- return regExp
-}
-
-minimatch.makeRe = function (pattern, options) {
- return new Minimatch(pattern, options || {}).makeRe()
-}
-
-Minimatch.prototype.makeRe = makeRe
-function makeRe () {
- if (this.regexp || this.regexp === false) return this.regexp
-
- // at this point, this.set is a 2d array of partial
- // pattern strings, or "**".
- //
- // It's better to use .match(). This function shouldn't
- // be used, really, but it's pretty convenient sometimes,
- // when you just want to work with a regex.
- var set = this.set
-
- if (!set.length) {
- this.regexp = false
- return this.regexp
- }
- var options = this.options
-
- var twoStar = options.noglobstar ? star
- : options.dot ? twoStarDot
- : twoStarNoDot
- var flags = options.nocase ? 'i' : ''
-
- var re = set.map(function (pattern) {
- return pattern.map(function (p) {
- return (p === GLOBSTAR) ? twoStar
- : (typeof p === 'string') ? regExpEscape(p)
- : p._src
- }).join('\\\/')
- }).join('|')
-
- // must match entire pattern
- // ending in a * or ** will make it less strict.
- re = '^(?:' + re + ')$'
-
- // can match anything, as long as it's not this.
- if (this.negate) re = '^(?!' + re + ').*$'
-
- try {
- this.regexp = new RegExp(re, flags)
- } catch (ex) {
- this.regexp = false
- }
- return this.regexp
-}
-
-minimatch.match = function (list, pattern, options) {
- options = options || {}
- var mm = new Minimatch(pattern, options)
- list = list.filter(function (f) {
- return mm.match(f)
- })
- if (mm.options.nonull && !list.length) {
- list.push(pattern)
- }
- return list
-}
-
-Minimatch.prototype.match = match
-function match (f, partial) {
- this.debug('match', f, this.pattern)
- // short-circuit in the case of busted things.
- // comments, etc.
- if (this.comment) return false
- if (this.empty) return f === ''
-
- if (f === '/' && partial) return true
-
- var options = this.options
-
- // windows: need to use /, not \
- if (path.sep !== '/') {
- f = f.split(path.sep).join('/')
- }
-
- // treat the test path as a set of pathparts.
- f = f.split(slashSplit)
- this.debug(this.pattern, 'split', f)
-
- // just ONE of the pattern sets in this.set needs to match
- // in order for it to be valid. If negating, then just one
- // match means that we have failed.
- // Either way, return on the first hit.
-
- var set = this.set
- this.debug(this.pattern, 'set', set)
-
- // Find the basename of the path by looking for the last non-empty segment
- var filename
- var i
- for (i = f.length - 1; i >= 0; i--) {
- filename = f[i]
- if (filename) break
- }
-
- for (i = 0; i < set.length; i++) {
- var pattern = set[i]
- var file = f
- if (options.matchBase && pattern.length === 1) {
- file = [filename]
- }
- var hit = this.matchOne(file, pattern, partial)
- if (hit) {
- if (options.flipNegate) return true
- return !this.negate
- }
- }
-
- // didn't get any hits. this is success if it's a negative
- // pattern, failure otherwise.
- if (options.flipNegate) return false
- return this.negate
-}
-
-// set partial to true to test if, for example,
-// "/a/b" matches the start of "/*/b/*/d"
-// Partial means, if you run out of file before you run
-// out of pattern, then that's fine, as long as all
-// the parts match.
-Minimatch.prototype.matchOne = function (file, pattern, partial) {
- var options = this.options
-
- this.debug('matchOne',
- { 'this': this, file: file, pattern: pattern })
-
- this.debug('matchOne', file.length, pattern.length)
-
- for (var fi = 0,
- pi = 0,
- fl = file.length,
- pl = pattern.length
- ; (fi < fl) && (pi < pl)
- ; fi++, pi++) {
- this.debug('matchOne loop')
- var p = pattern[pi]
- var f = file[fi]
-
- this.debug(pattern, p, f)
-
- // should be impossible.
- // some invalid regexp stuff in the set.
- if (p === false) return false
-
- if (p === GLOBSTAR) {
- this.debug('GLOBSTAR', [pattern, p, f])
-
- // "**"
- // a/**/b/**/c would match the following:
- // a/b/x/y/z/c
- // a/x/y/z/b/c
- // a/b/x/b/x/c
- // a/b/c
- // To do this, take the rest of the pattern after
- // the **, and see if it would match the file remainder.
- // If so, return success.
- // If not, the ** "swallows" a segment, and try again.
- // This is recursively awful.
- //
- // a/**/b/**/c matching a/b/x/y/z/c
- // - a matches a
- // - doublestar
- // - matchOne(b/x/y/z/c, b/**/c)
- // - b matches b
- // - doublestar
- // - matchOne(x/y/z/c, c) -> no
- // - matchOne(y/z/c, c) -> no
- // - matchOne(z/c, c) -> no
- // - matchOne(c, c) yes, hit
- var fr = fi
- var pr = pi + 1
- if (pr === pl) {
- this.debug('** at the end')
- // a ** at the end will just swallow the rest.
- // We have found a match.
- // however, it will not swallow /.x, unless
- // options.dot is set.
- // . and .. are *never* matched by **, for explosively
- // exponential reasons.
- for (; fi < fl; fi++) {
- if (file[fi] === '.' || file[fi] === '..' ||
- (!options.dot && file[fi].charAt(0) === '.')) return false
- }
- return true
- }
-
- // ok, let's see if we can swallow whatever we can.
- while (fr < fl) {
- var swallowee = file[fr]
-
- this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
-
- // XXX remove this slice. Just pass the start index.
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
- this.debug('globstar found match!', fr, fl, swallowee)
- // found a match.
- return true
- } else {
- // can't swallow "." or ".." ever.
- // can only swallow ".foo" when explicitly asked.
- if (swallowee === '.' || swallowee === '..' ||
- (!options.dot && swallowee.charAt(0) === '.')) {
- this.debug('dot detected!', file, fr, pattern, pr)
- break
- }
-
- // ** swallows a segment, and continue.
- this.debug('globstar swallow a segment, and continue')
- fr++
- }
- }
-
- // no match was found.
- // However, in partial mode, we can't say this is necessarily over.
- // If there's more *pattern* left, then
- if (partial) {
- // ran out of file
- this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
- if (fr === fl) return true
- }
- return false
- }
-
- // something other than **
- // non-magic patterns just have to match exactly
- // patterns with magic have been turned into regexps.
- var hit
- if (typeof p === 'string') {
- if (options.nocase) {
- hit = f.toLowerCase() === p.toLowerCase()
- } else {
- hit = f === p
- }
- this.debug('string match', p, f, hit)
- } else {
- hit = f.match(p)
- this.debug('pattern match', p, f, hit)
- }
-
- if (!hit) return false
- }
-
- // Note: ending in / means that we'll get a final ""
- // at the end of the pattern. This can only match a
- // corresponding "" at the end of the file.
- // If the file ends in /, then it can only match a
- // a pattern that ends in /, unless the pattern just
- // doesn't have any more for it. But, a/b/ should *not*
- // match "a/b/*", even though "" matches against the
- // [^/]*? pattern, except in partial mode, where it might
- // simply not be reached yet.
- // However, a/b/ should still satisfy a/*
-
- // now either we fell off the end of the pattern, or we're done.
- if (fi === fl && pi === pl) {
- // ran out of pattern and filename at the same time.
- // an exact hit!
- return true
- } else if (fi === fl) {
- // ran out of file, but still had pattern left.
- // this is ok if we're doing the match as part of
- // a glob fs traversal.
- return partial
- } else if (pi === pl) {
- // ran out of pattern, still have file left.
- // this is only acceptable if we're on the very last
- // empty segment of a file with a trailing slash.
- // a/* should match a/b/
- var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
- return emptyFileEnd
- }
-
- // should be unreachable.
- throw new Error('wtf?')
-}
-
-// replace stuff like \* with *
-function globUnescape (s) {
- return s.replace(/\\(.)/g, '$1')
-}
-
-function regExpEscape (s) {
- return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
-}
diff --git a/node_modules/glob/node_modules/minimatch/package.json b/node_modules/glob/node_modules/minimatch/package.json
@@ -1,29 +0,0 @@
-{
- "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
- "name": "minimatch",
- "description": "a glob matcher in javascript",
- "version": "3.0.3",
- "repository": {
- "type": "git",
- "url": "git://github.com/isaacs/minimatch.git"
- },
- "main": "minimatch.js",
- "scripts": {
- "posttest": "standard minimatch.js test/*.js",
- "test": "tap test/*.js"
- },
- "engines": {
- "node": "*"
- },
- "dependencies": {
- "brace-expansion": "^1.0.0"
- },
- "devDependencies": {
- "standard": "^3.7.2",
- "tap": "^5.6.0"
- },
- "license": "ISC",
- "files": [
- "minimatch.js"
- ]
-}
diff --git a/node_modules/globule/node_modules/minimatch/LICENSE b/node_modules/globule/node_modules/minimatch/LICENSE
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and 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.
diff --git a/node_modules/globule/node_modules/minimatch/README.md b/node_modules/globule/node_modules/minimatch/README.md
@@ -1,209 +0,0 @@
-# minimatch
-
-A minimal matching utility.
-
-[](http://travis-ci.org/isaacs/minimatch)
-
-
-This is the matching library used internally by npm.
-
-It works by converting glob expressions into JavaScript `RegExp`
-objects.
-
-## Usage
-
-```javascript
-var minimatch = require("minimatch")
-
-minimatch("bar.foo", "*.foo") // true!
-minimatch("bar.foo", "*.bar") // false!
-minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy!
-```
-
-## Features
-
-Supports these glob features:
-
-* Brace Expansion
-* Extended glob matching
-* "Globstar" `**` matching
-
-See:
-
-* `man sh`
-* `man bash`
-* `man 3 fnmatch`
-* `man 5 gitignore`
-
-## Minimatch Class
-
-Create a minimatch object by instantiating the `minimatch.Minimatch` class.
-
-```javascript
-var Minimatch = require("minimatch").Minimatch
-var mm = new Minimatch(pattern, options)
-```
-
-### Properties
-
-* `pattern` The original pattern the minimatch object represents.
-* `options` The options supplied to the constructor.
-* `set` A 2-dimensional array of regexp or string expressions.
- Each row in the
- array corresponds to a brace-expanded pattern. Each item in the row
- corresponds to a single path-part. For example, the pattern
- `{a,b/c}/d` would expand to a set of patterns like:
-
- [ [ a, d ]
- , [ b, c, d ] ]
-
- If a portion of the pattern doesn't have any "magic" in it
- (that is, it's something like `"foo"` rather than `fo*o?`), then it
- will be left as a string rather than converted to a regular
- expression.
-
-* `regexp` Created by the `makeRe` method. A single regular expression
- expressing the entire pattern. This is useful in cases where you wish
- to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.
-* `negate` True if the pattern is negated.
-* `comment` True if the pattern is a comment.
-* `empty` True if the pattern is `""`.
-
-### Methods
-
-* `makeRe` Generate the `regexp` member if necessary, and return it.
- Will return `false` if the pattern is invalid.
-* `match(fname)` Return true if the filename matches the pattern, or
- false otherwise.
-* `matchOne(fileArray, patternArray, partial)` Take a `/`-split
- filename, and match it against a single row in the `regExpSet`. This
- method is mainly for internal use, but is exposed so that it can be
- used by a glob-walker that needs to avoid excessive filesystem calls.
-
-All other methods are internal, and will be called as necessary.
-
-### minimatch(path, pattern, options)
-
-Main export. Tests a path against the pattern using the options.
-
-```javascript
-var isJS = minimatch(file, "*.js", { matchBase: true })
-```
-
-### minimatch.filter(pattern, options)
-
-Returns a function that tests its
-supplied argument, suitable for use with `Array.filter`. Example:
-
-```javascript
-var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true}))
-```
-
-### minimatch.match(list, pattern, options)
-
-Match against the list of
-files, in the style of fnmatch or glob. If nothing is matched, and
-options.nonull is set, then return a list containing the pattern itself.
-
-```javascript
-var javascripts = minimatch.match(fileList, "*.js", {matchBase: true}))
-```
-
-### minimatch.makeRe(pattern, options)
-
-Make a regular expression object from the pattern.
-
-## Options
-
-All options are `false` by default.
-
-### debug
-
-Dump a ton of stuff to stderr.
-
-### nobrace
-
-Do not expand `{a,b}` and `{1..3}` brace sets.
-
-### noglobstar
-
-Disable `**` matching against multiple folder names.
-
-### dot
-
-Allow patterns to match filenames starting with a period, even if
-the pattern does not explicitly have a period in that spot.
-
-Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot`
-is set.
-
-### noext
-
-Disable "extglob" style patterns like `+(a|b)`.
-
-### nocase
-
-Perform a case-insensitive match.
-
-### nonull
-
-When a match is not found by `minimatch.match`, return a list containing
-the pattern itself if this option is set. When not set, an empty list
-is returned if there are no matches.
-
-### matchBase
-
-If set, then patterns without slashes will be matched
-against the basename of the path if it contains slashes. For example,
-`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
-
-### nocomment
-
-Suppress the behavior of treating `#` at the start of a pattern as a
-comment.
-
-### nonegate
-
-Suppress the behavior of treating a leading `!` character as negation.
-
-### flipNegate
-
-Returns from negate expressions the same as if they were not negated.
-(Ie, true on a hit, false on a miss.)
-
-
-## Comparisons to other fnmatch/glob implementations
-
-While strict compliance with the existing standards is a worthwhile
-goal, some discrepancies exist between minimatch and other
-implementations, and are intentional.
-
-If the pattern starts with a `!` character, then it is negated. Set the
-`nonegate` flag to suppress this behavior, and treat leading `!`
-characters normally. This is perhaps relevant if you wish to start the
-pattern with a negative extglob pattern like `!(a|B)`. Multiple `!`
-characters at the start of a pattern will negate the pattern multiple
-times.
-
-If a pattern starts with `#`, then it is treated as a comment, and
-will not match anything. Use `\#` to match a literal `#` at the
-start of a line, or set the `nocomment` flag to suppress this behavior.
-
-The double-star character `**` is supported by default, unless the
-`noglobstar` flag is set. This is supported in the manner of bsdglob
-and bash 4.1, where `**` only has special significance if it is the only
-thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but
-`a/**b` will not.
-
-If an escaped pattern has no matches, and the `nonull` flag is set,
-then minimatch.match returns the pattern as-provided, rather than
-interpreting the character escapes. For example,
-`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
-`"*a?"`. This is akin to setting the `nullglob` option in bash, except
-that it does not resolve escaped pattern characters.
-
-If brace expansion is not disabled, then it is performed before any
-other interpretation of the glob pattern. Thus, a pattern like
-`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
-**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
-checked for validity. Since those two are valid, matching proceeds.
diff --git a/node_modules/globule/node_modules/minimatch/minimatch.js b/node_modules/globule/node_modules/minimatch/minimatch.js
@@ -1,923 +0,0 @@
-module.exports = minimatch
-minimatch.Minimatch = Minimatch
-
-var path = { sep: '/' }
-try {
- path = require('path')
-} catch (er) {}
-
-var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
-var expand = require('brace-expansion')
-
-var plTypes = {
- '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
- '?': { open: '(?:', close: ')?' },
- '+': { open: '(?:', close: ')+' },
- '*': { open: '(?:', close: ')*' },
- '@': { open: '(?:', close: ')' }
-}
-
-// any single thing other than /
-// don't need to escape / when using new RegExp()
-var qmark = '[^/]'
-
-// * => any number of characters
-var star = qmark + '*?'
-
-// ** when dots are allowed. Anything goes, except .. and .
-// not (^ or / followed by one or two dots followed by $ or /),
-// followed by anything, any number of times.
-var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
-
-// not a ^ or / followed by a dot,
-// followed by anything, any number of times.
-var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
-
-// characters that need to be escaped in RegExp.
-var reSpecials = charSet('().*{}+?[]^$\\!')
-
-// "abc" -> { a:true, b:true, c:true }
-function charSet (s) {
- return s.split('').reduce(function (set, c) {
- set[c] = true
- return set
- }, {})
-}
-
-// normalizes slashes.
-var slashSplit = /\/+/
-
-minimatch.filter = filter
-function filter (pattern, options) {
- options = options || {}
- return function (p, i, list) {
- return minimatch(p, pattern, options)
- }
-}
-
-function ext (a, b) {
- a = a || {}
- b = b || {}
- var t = {}
- Object.keys(b).forEach(function (k) {
- t[k] = b[k]
- })
- Object.keys(a).forEach(function (k) {
- t[k] = a[k]
- })
- return t
-}
-
-minimatch.defaults = function (def) {
- if (!def || !Object.keys(def).length) return minimatch
-
- var orig = minimatch
-
- var m = function minimatch (p, pattern, options) {
- return orig.minimatch(p, pattern, ext(def, options))
- }
-
- m.Minimatch = function Minimatch (pattern, options) {
- return new orig.Minimatch(pattern, ext(def, options))
- }
-
- return m
-}
-
-Minimatch.defaults = function (def) {
- if (!def || !Object.keys(def).length) return Minimatch
- return minimatch.defaults(def).Minimatch
-}
-
-function minimatch (p, pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('glob pattern string required')
- }
-
- if (!options) options = {}
-
- // shortcut: comments match nothing.
- if (!options.nocomment && pattern.charAt(0) === '#') {
- return false
- }
-
- // "" only matches ""
- if (pattern.trim() === '') return p === ''
-
- return new Minimatch(pattern, options).match(p)
-}
-
-function Minimatch (pattern, options) {
- if (!(this instanceof Minimatch)) {
- return new Minimatch(pattern, options)
- }
-
- if (typeof pattern !== 'string') {
- throw new TypeError('glob pattern string required')
- }
-
- if (!options) options = {}
- pattern = pattern.trim()
-
- // windows support: need to use /, not \
- if (path.sep !== '/') {
- pattern = pattern.split(path.sep).join('/')
- }
-
- this.options = options
- this.set = []
- this.pattern = pattern
- this.regexp = null
- this.negate = false
- this.comment = false
- this.empty = false
-
- // make the set of regexps etc.
- this.make()
-}
-
-Minimatch.prototype.debug = function () {}
-
-Minimatch.prototype.make = make
-function make () {
- // don't do it more than once.
- if (this._made) return
-
- var pattern = this.pattern
- var options = this.options
-
- // empty patterns and comments match nothing.
- if (!options.nocomment && pattern.charAt(0) === '#') {
- this.comment = true
- return
- }
- if (!pattern) {
- this.empty = true
- return
- }
-
- // step 1: figure out negation, etc.
- this.parseNegate()
-
- // step 2: expand braces
- var set = this.globSet = this.braceExpand()
-
- if (options.debug) this.debug = console.error
-
- this.debug(this.pattern, set)
-
- // step 3: now we have a set, so turn each one into a series of path-portion
- // matching patterns.
- // These will be regexps, except in the case of "**", which is
- // set to the GLOBSTAR object for globstar behavior,
- // and will not contain any / characters
- set = this.globParts = set.map(function (s) {
- return s.split(slashSplit)
- })
-
- this.debug(this.pattern, set)
-
- // glob --> regexps
- set = set.map(function (s, si, set) {
- return s.map(this.parse, this)
- }, this)
-
- this.debug(this.pattern, set)
-
- // filter out everything that didn't compile properly.
- set = set.filter(function (s) {
- return s.indexOf(false) === -1
- })
-
- this.debug(this.pattern, set)
-
- this.set = set
-}
-
-Minimatch.prototype.parseNegate = parseNegate
-function parseNegate () {
- var pattern = this.pattern
- var negate = false
- var options = this.options
- var negateOffset = 0
-
- if (options.nonegate) return
-
- for (var i = 0, l = pattern.length
- ; i < l && pattern.charAt(i) === '!'
- ; i++) {
- negate = !negate
- negateOffset++
- }
-
- if (negateOffset) this.pattern = pattern.substr(negateOffset)
- this.negate = negate
-}
-
-// Brace expansion:
-// a{b,c}d -> abd acd
-// a{b,}c -> abc ac
-// a{0..3}d -> a0d a1d a2d a3d
-// a{b,c{d,e}f}g -> abg acdfg acefg
-// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
-//
-// Invalid sets are not expanded.
-// a{2..}b -> a{2..}b
-// a{b}c -> a{b}c
-minimatch.braceExpand = function (pattern, options) {
- return braceExpand(pattern, options)
-}
-
-Minimatch.prototype.braceExpand = braceExpand
-
-function braceExpand (pattern, options) {
- if (!options) {
- if (this instanceof Minimatch) {
- options = this.options
- } else {
- options = {}
- }
- }
-
- pattern = typeof pattern === 'undefined'
- ? this.pattern : pattern
-
- if (typeof pattern === 'undefined') {
- throw new TypeError('undefined pattern')
- }
-
- if (options.nobrace ||
- !pattern.match(/\{.*\}/)) {
- // shortcut. no need to expand.
- return [pattern]
- }
-
- return expand(pattern)
-}
-
-// parse a component of the expanded set.
-// At this point, no pattern may contain "/" in it
-// so we're going to return a 2d array, where each entry is the full
-// pattern, split on '/', and then turned into a regular expression.
-// A regexp is made at the end which joins each array with an
-// escaped /, and another full one which joins each regexp with |.
-//
-// Following the lead of Bash 4.1, note that "**" only has special meaning
-// when it is the *only* thing in a path portion. Otherwise, any series
-// of * is equivalent to a single *. Globstar behavior is enabled by
-// default, and can be disabled by setting options.noglobstar.
-Minimatch.prototype.parse = parse
-var SUBPARSE = {}
-function parse (pattern, isSub) {
- if (pattern.length > 1024 * 64) {
- throw new TypeError('pattern is too long')
- }
-
- var options = this.options
-
- // shortcuts
- if (!options.noglobstar && pattern === '**') return GLOBSTAR
- if (pattern === '') return ''
-
- var re = ''
- var hasMagic = !!options.nocase
- var escaping = false
- // ? => one single character
- var patternListStack = []
- var negativeLists = []
- var stateChar
- var inClass = false
- var reClassStart = -1
- var classStart = -1
- // . and .. never match anything that doesn't start with .,
- // even when options.dot is set.
- var patternStart = pattern.charAt(0) === '.' ? '' // anything
- // not (start or / followed by . or .. followed by / or end)
- : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
- : '(?!\\.)'
- var self = this
-
- function clearStateChar () {
- if (stateChar) {
- // we had some state-tracking character
- // that wasn't consumed by this pass.
- switch (stateChar) {
- case '*':
- re += star
- hasMagic = true
- break
- case '?':
- re += qmark
- hasMagic = true
- break
- default:
- re += '\\' + stateChar
- break
- }
- self.debug('clearStateChar %j %j', stateChar, re)
- stateChar = false
- }
- }
-
- for (var i = 0, len = pattern.length, c
- ; (i < len) && (c = pattern.charAt(i))
- ; i++) {
- this.debug('%s\t%s %s %j', pattern, i, re, c)
-
- // skip over any that are escaped.
- if (escaping && reSpecials[c]) {
- re += '\\' + c
- escaping = false
- continue
- }
-
- switch (c) {
- case '/':
- // completely not allowed, even escaped.
- // Should already be path-split by now.
- return false
-
- case '\\':
- clearStateChar()
- escaping = true
- continue
-
- // the various stateChar values
- // for the "extglob" stuff.
- case '?':
- case '*':
- case '+':
- case '@':
- case '!':
- this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
-
- // all of those are literals inside a class, except that
- // the glob [!a] means [^a] in regexp
- if (inClass) {
- this.debug(' in class')
- if (c === '!' && i === classStart + 1) c = '^'
- re += c
- continue
- }
-
- // if we already have a stateChar, then it means
- // that there was something like ** or +? in there.
- // Handle the stateChar, then proceed with this one.
- self.debug('call clearStateChar %j', stateChar)
- clearStateChar()
- stateChar = c
- // if extglob is disabled, then +(asdf|foo) isn't a thing.
- // just clear the statechar *now*, rather than even diving into
- // the patternList stuff.
- if (options.noext) clearStateChar()
- continue
-
- case '(':
- if (inClass) {
- re += '('
- continue
- }
-
- if (!stateChar) {
- re += '\\('
- continue
- }
-
- patternListStack.push({
- type: stateChar,
- start: i - 1,
- reStart: re.length,
- open: plTypes[stateChar].open,
- close: plTypes[stateChar].close
- })
- // negation is (?:(?!js)[^/]*)
- re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
- this.debug('plType %j %j', stateChar, re)
- stateChar = false
- continue
-
- case ')':
- if (inClass || !patternListStack.length) {
- re += '\\)'
- continue
- }
-
- clearStateChar()
- hasMagic = true
- var pl = patternListStack.pop()
- // negation is (?:(?!js)[^/]*)
- // The others are (?:<pattern>)<type>
- re += pl.close
- if (pl.type === '!') {
- negativeLists.push(pl)
- }
- pl.reEnd = re.length
- continue
-
- case '|':
- if (inClass || !patternListStack.length || escaping) {
- re += '\\|'
- escaping = false
- continue
- }
-
- clearStateChar()
- re += '|'
- continue
-
- // these are mostly the same in regexp and glob
- case '[':
- // swallow any state-tracking char before the [
- clearStateChar()
-
- if (inClass) {
- re += '\\' + c
- continue
- }
-
- inClass = true
- classStart = i
- reClassStart = re.length
- re += c
- continue
-
- case ']':
- // a right bracket shall lose its special
- // meaning and represent itself in
- // a bracket expression if it occurs
- // first in the list. -- POSIX.2 2.8.3.2
- if (i === classStart + 1 || !inClass) {
- re += '\\' + c
- escaping = false
- continue
- }
-
- // handle the case where we left a class open.
- // "[z-a]" is valid, equivalent to "\[z-a\]"
- if (inClass) {
- // split where the last [ was, make sure we don't have
- // an invalid re. if so, re-walk the contents of the
- // would-be class to re-translate any characters that
- // were passed through as-is
- // TODO: It would probably be faster to determine this
- // without a try/catch and a new RegExp, but it's tricky
- // to do safely. For now, this is safe and works.
- var cs = pattern.substring(classStart + 1, i)
- try {
- RegExp('[' + cs + ']')
- } catch (er) {
- // not a valid class!
- var sp = this.parse(cs, SUBPARSE)
- re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
- hasMagic = hasMagic || sp[1]
- inClass = false
- continue
- }
- }
-
- // finish up the class.
- hasMagic = true
- inClass = false
- re += c
- continue
-
- default:
- // swallow any state char that wasn't consumed
- clearStateChar()
-
- if (escaping) {
- // no need
- escaping = false
- } else if (reSpecials[c]
- && !(c === '^' && inClass)) {
- re += '\\'
- }
-
- re += c
-
- } // switch
- } // for
-
- // handle the case where we left a class open.
- // "[abc" is valid, equivalent to "\[abc"
- if (inClass) {
- // split where the last [ was, and escape it
- // this is a huge pita. We now have to re-walk
- // the contents of the would-be class to re-translate
- // any characters that were passed through as-is
- cs = pattern.substr(classStart + 1)
- sp = this.parse(cs, SUBPARSE)
- re = re.substr(0, reClassStart) + '\\[' + sp[0]
- hasMagic = hasMagic || sp[1]
- }
-
- // handle the case where we had a +( thing at the *end*
- // of the pattern.
- // each pattern list stack adds 3 chars, and we need to go through
- // and escape any | chars that were passed through as-is for the regexp.
- // Go through and escape them, taking care not to double-escape any
- // | chars that were already escaped.
- for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
- var tail = re.slice(pl.reStart + pl.open.length)
- this.debug('setting tail', re, pl)
- // maybe some even number of \, then maybe 1 \, followed by a |
- tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
- if (!$2) {
- // the | isn't already escaped, so escape it.
- $2 = '\\'
- }
-
- // need to escape all those slashes *again*, without escaping the
- // one that we need for escaping the | character. As it works out,
- // escaping an even number of slashes can be done by simply repeating
- // it exactly after itself. That's why this trick works.
- //
- // I am sorry that you have to see this.
- return $1 + $1 + $2 + '|'
- })
-
- this.debug('tail=%j\n %s', tail, tail, pl, re)
- var t = pl.type === '*' ? star
- : pl.type === '?' ? qmark
- : '\\' + pl.type
-
- hasMagic = true
- re = re.slice(0, pl.reStart) + t + '\\(' + tail
- }
-
- // handle trailing things that only matter at the very end.
- clearStateChar()
- if (escaping) {
- // trailing \\
- re += '\\\\'
- }
-
- // only need to apply the nodot start if the re starts with
- // something that could conceivably capture a dot
- var addPatternStart = false
- switch (re.charAt(0)) {
- case '.':
- case '[':
- case '(': addPatternStart = true
- }
-
- // Hack to work around lack of negative lookbehind in JS
- // A pattern like: *.!(x).!(y|z) needs to ensure that a name
- // like 'a.xyz.yz' doesn't match. So, the first negative
- // lookahead, has to look ALL the way ahead, to the end of
- // the pattern.
- for (var n = negativeLists.length - 1; n > -1; n--) {
- var nl = negativeLists[n]
-
- var nlBefore = re.slice(0, nl.reStart)
- var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
- var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
- var nlAfter = re.slice(nl.reEnd)
-
- nlLast += nlAfter
-
- // Handle nested stuff like *(*.js|!(*.json)), where open parens
- // mean that we should *not* include the ) in the bit that is considered
- // "after" the negated section.
- var openParensBefore = nlBefore.split('(').length - 1
- var cleanAfter = nlAfter
- for (i = 0; i < openParensBefore; i++) {
- cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
- }
- nlAfter = cleanAfter
-
- var dollar = ''
- if (nlAfter === '' && isSub !== SUBPARSE) {
- dollar = '$'
- }
- var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
- re = newRe
- }
-
- // if the re is not "" at this point, then we need to make sure
- // it doesn't match against an empty path part.
- // Otherwise a/* will match a/, which it should not.
- if (re !== '' && hasMagic) {
- re = '(?=.)' + re
- }
-
- if (addPatternStart) {
- re = patternStart + re
- }
-
- // parsing just a piece of a larger pattern.
- if (isSub === SUBPARSE) {
- return [re, hasMagic]
- }
-
- // skip the regexp for non-magical patterns
- // unescape anything in it, though, so that it'll be
- // an exact match against a file etc.
- if (!hasMagic) {
- return globUnescape(pattern)
- }
-
- var flags = options.nocase ? 'i' : ''
- try {
- var regExp = new RegExp('^' + re + '$', flags)
- } catch (er) {
- // If it was an invalid regular expression, then it can't match
- // anything. This trick looks for a character after the end of
- // the string, which is of course impossible, except in multi-line
- // mode, but it's not a /m regex.
- return new RegExp('$.')
- }
-
- regExp._glob = pattern
- regExp._src = re
-
- return regExp
-}
-
-minimatch.makeRe = function (pattern, options) {
- return new Minimatch(pattern, options || {}).makeRe()
-}
-
-Minimatch.prototype.makeRe = makeRe
-function makeRe () {
- if (this.regexp || this.regexp === false) return this.regexp
-
- // at this point, this.set is a 2d array of partial
- // pattern strings, or "**".
- //
- // It's better to use .match(). This function shouldn't
- // be used, really, but it's pretty convenient sometimes,
- // when you just want to work with a regex.
- var set = this.set
-
- if (!set.length) {
- this.regexp = false
- return this.regexp
- }
- var options = this.options
-
- var twoStar = options.noglobstar ? star
- : options.dot ? twoStarDot
- : twoStarNoDot
- var flags = options.nocase ? 'i' : ''
-
- var re = set.map(function (pattern) {
- return pattern.map(function (p) {
- return (p === GLOBSTAR) ? twoStar
- : (typeof p === 'string') ? regExpEscape(p)
- : p._src
- }).join('\\\/')
- }).join('|')
-
- // must match entire pattern
- // ending in a * or ** will make it less strict.
- re = '^(?:' + re + ')$'
-
- // can match anything, as long as it's not this.
- if (this.negate) re = '^(?!' + re + ').*$'
-
- try {
- this.regexp = new RegExp(re, flags)
- } catch (ex) {
- this.regexp = false
- }
- return this.regexp
-}
-
-minimatch.match = function (list, pattern, options) {
- options = options || {}
- var mm = new Minimatch(pattern, options)
- list = list.filter(function (f) {
- return mm.match(f)
- })
- if (mm.options.nonull && !list.length) {
- list.push(pattern)
- }
- return list
-}
-
-Minimatch.prototype.match = match
-function match (f, partial) {
- this.debug('match', f, this.pattern)
- // short-circuit in the case of busted things.
- // comments, etc.
- if (this.comment) return false
- if (this.empty) return f === ''
-
- if (f === '/' && partial) return true
-
- var options = this.options
-
- // windows: need to use /, not \
- if (path.sep !== '/') {
- f = f.split(path.sep).join('/')
- }
-
- // treat the test path as a set of pathparts.
- f = f.split(slashSplit)
- this.debug(this.pattern, 'split', f)
-
- // just ONE of the pattern sets in this.set needs to match
- // in order for it to be valid. If negating, then just one
- // match means that we have failed.
- // Either way, return on the first hit.
-
- var set = this.set
- this.debug(this.pattern, 'set', set)
-
- // Find the basename of the path by looking for the last non-empty segment
- var filename
- var i
- for (i = f.length - 1; i >= 0; i--) {
- filename = f[i]
- if (filename) break
- }
-
- for (i = 0; i < set.length; i++) {
- var pattern = set[i]
- var file = f
- if (options.matchBase && pattern.length === 1) {
- file = [filename]
- }
- var hit = this.matchOne(file, pattern, partial)
- if (hit) {
- if (options.flipNegate) return true
- return !this.negate
- }
- }
-
- // didn't get any hits. this is success if it's a negative
- // pattern, failure otherwise.
- if (options.flipNegate) return false
- return this.negate
-}
-
-// set partial to true to test if, for example,
-// "/a/b" matches the start of "/*/b/*/d"
-// Partial means, if you run out of file before you run
-// out of pattern, then that's fine, as long as all
-// the parts match.
-Minimatch.prototype.matchOne = function (file, pattern, partial) {
- var options = this.options
-
- this.debug('matchOne',
- { 'this': this, file: file, pattern: pattern })
-
- this.debug('matchOne', file.length, pattern.length)
-
- for (var fi = 0,
- pi = 0,
- fl = file.length,
- pl = pattern.length
- ; (fi < fl) && (pi < pl)
- ; fi++, pi++) {
- this.debug('matchOne loop')
- var p = pattern[pi]
- var f = file[fi]
-
- this.debug(pattern, p, f)
-
- // should be impossible.
- // some invalid regexp stuff in the set.
- if (p === false) return false
-
- if (p === GLOBSTAR) {
- this.debug('GLOBSTAR', [pattern, p, f])
-
- // "**"
- // a/**/b/**/c would match the following:
- // a/b/x/y/z/c
- // a/x/y/z/b/c
- // a/b/x/b/x/c
- // a/b/c
- // To do this, take the rest of the pattern after
- // the **, and see if it would match the file remainder.
- // If so, return success.
- // If not, the ** "swallows" a segment, and try again.
- // This is recursively awful.
- //
- // a/**/b/**/c matching a/b/x/y/z/c
- // - a matches a
- // - doublestar
- // - matchOne(b/x/y/z/c, b/**/c)
- // - b matches b
- // - doublestar
- // - matchOne(x/y/z/c, c) -> no
- // - matchOne(y/z/c, c) -> no
- // - matchOne(z/c, c) -> no
- // - matchOne(c, c) yes, hit
- var fr = fi
- var pr = pi + 1
- if (pr === pl) {
- this.debug('** at the end')
- // a ** at the end will just swallow the rest.
- // We have found a match.
- // however, it will not swallow /.x, unless
- // options.dot is set.
- // . and .. are *never* matched by **, for explosively
- // exponential reasons.
- for (; fi < fl; fi++) {
- if (file[fi] === '.' || file[fi] === '..' ||
- (!options.dot && file[fi].charAt(0) === '.')) return false
- }
- return true
- }
-
- // ok, let's see if we can swallow whatever we can.
- while (fr < fl) {
- var swallowee = file[fr]
-
- this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
-
- // XXX remove this slice. Just pass the start index.
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
- this.debug('globstar found match!', fr, fl, swallowee)
- // found a match.
- return true
- } else {
- // can't swallow "." or ".." ever.
- // can only swallow ".foo" when explicitly asked.
- if (swallowee === '.' || swallowee === '..' ||
- (!options.dot && swallowee.charAt(0) === '.')) {
- this.debug('dot detected!', file, fr, pattern, pr)
- break
- }
-
- // ** swallows a segment, and continue.
- this.debug('globstar swallow a segment, and continue')
- fr++
- }
- }
-
- // no match was found.
- // However, in partial mode, we can't say this is necessarily over.
- // If there's more *pattern* left, then
- if (partial) {
- // ran out of file
- this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
- if (fr === fl) return true
- }
- return false
- }
-
- // something other than **
- // non-magic patterns just have to match exactly
- // patterns with magic have been turned into regexps.
- var hit
- if (typeof p === 'string') {
- if (options.nocase) {
- hit = f.toLowerCase() === p.toLowerCase()
- } else {
- hit = f === p
- }
- this.debug('string match', p, f, hit)
- } else {
- hit = f.match(p)
- this.debug('pattern match', p, f, hit)
- }
-
- if (!hit) return false
- }
-
- // Note: ending in / means that we'll get a final ""
- // at the end of the pattern. This can only match a
- // corresponding "" at the end of the file.
- // If the file ends in /, then it can only match a
- // a pattern that ends in /, unless the pattern just
- // doesn't have any more for it. But, a/b/ should *not*
- // match "a/b/*", even though "" matches against the
- // [^/]*? pattern, except in partial mode, where it might
- // simply not be reached yet.
- // However, a/b/ should still satisfy a/*
-
- // now either we fell off the end of the pattern, or we're done.
- if (fi === fl && pi === pl) {
- // ran out of pattern and filename at the same time.
- // an exact hit!
- return true
- } else if (fi === fl) {
- // ran out of file, but still had pattern left.
- // this is ok if we're doing the match as part of
- // a glob fs traversal.
- return partial
- } else if (pi === pl) {
- // ran out of pattern, still have file left.
- // this is only acceptable if we're on the very last
- // empty segment of a file with a trailing slash.
- // a/* should match a/b/
- var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
- return emptyFileEnd
- }
-
- // should be unreachable.
- throw new Error('wtf?')
-}
-
-// replace stuff like \* with *
-function globUnescape (s) {
- return s.replace(/\\(.)/g, '$1')
-}
-
-function regExpEscape (s) {
- return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
-}
diff --git a/node_modules/globule/node_modules/minimatch/package.json b/node_modules/globule/node_modules/minimatch/package.json
@@ -1,29 +0,0 @@
-{
- "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
- "name": "minimatch",
- "description": "a glob matcher in javascript",
- "version": "3.0.3",
- "repository": {
- "type": "git",
- "url": "git://github.com/isaacs/minimatch.git"
- },
- "main": "minimatch.js",
- "scripts": {
- "posttest": "standard minimatch.js test/*.js",
- "test": "tap test/*.js"
- },
- "engines": {
- "node": "*"
- },
- "dependencies": {
- "brace-expansion": "^1.0.0"
- },
- "devDependencies": {
- "standard": "^3.7.2",
- "tap": "^5.6.0"
- },
- "license": "ISC",
- "files": [
- "minimatch.js"
- ]
-}
diff --git a/node_modules/isarray/.npmignore b/node_modules/isarray/.npmignore
@@ -1 +0,0 @@
-node_modules
diff --git a/node_modules/isarray/.travis.yml b/node_modules/isarray/.travis.yml
@@ -1,4 +0,0 @@
-language: node_js
-node_js:
- - "0.8"
- - "0.10"
diff --git a/node_modules/isarray/Makefile b/node_modules/isarray/Makefile
@@ -1,6 +0,0 @@
-
-test:
- @node_modules/.bin/tape test.js
-
-.PHONY: test
-
diff --git a/node_modules/isarray/README.md b/node_modules/isarray/README.md
@@ -3,12 +3,6 @@
`Array#isArray` for older browsers.
-[](http://travis-ci.org/juliangruber/isarray)
-[](https://www.npmjs.org/package/isarray)
-
-[
-](https://ci.testling.com/juliangruber/isarray)
-
## Usage
```js
diff --git a/node_modules/isarray/index.js b/node_modules/isarray/index.js
@@ -1,5 +1,3 @@
-var toString = {}.toString;
-
module.exports = Array.isArray || function (arr) {
- return toString.call(arr) == '[object Array]';
+ return Object.prototype.toString.call(arr) == '[object Array]';
};
diff --git a/node_modules/isarray/package.json b/node_modules/isarray/package.json
@@ -1,45 +1,25 @@
{
- "name": "isarray",
- "description": "Array#isArray for older browsers",
- "version": "1.0.0",
- "repository": {
- "type": "git",
- "url": "git://github.com/juliangruber/isarray.git"
+ "name" : "isarray",
+ "description" : "Array#isArray for older browsers",
+ "version" : "0.0.1",
+ "repository" : {
+ "type" : "git",
+ "url" : "git://github.com/juliangruber/isarray.git"
},
"homepage": "https://github.com/juliangruber/isarray",
- "main": "index.js",
- "dependencies": {},
- "devDependencies": {
- "tape": "~2.13.4"
+ "main" : "index.js",
+ "scripts" : {
+ "test" : "tap test/*.js"
},
- "keywords": [
- "browser",
- "isarray",
- "array"
- ],
+ "dependencies" : {},
+ "devDependencies" : {
+ "tap" : "*"
+ },
+ "keywords": ["browser","isarray","array"],
"author": {
"name": "Julian Gruber",
"email": "mail@juliangruber.com",
"url": "http://juliangruber.com"
},
- "license": "MIT",
- "testling": {
- "files": "test.js",
- "browsers": [
- "ie/8..latest",
- "firefox/17..latest",
- "firefox/nightly",
- "chrome/22..latest",
- "chrome/canary",
- "opera/12..latest",
- "opera/next",
- "safari/5.1..latest",
- "ipad/6.0..latest",
- "iphone/6.0..latest",
- "android-browser/4.2..latest"
- ]
- },
- "scripts": {
- "test": "tape test.js"
- }
+ "license": "MIT"
}
diff --git a/node_modules/isarray/test.js b/node_modules/isarray/test.js
@@ -1,20 +0,0 @@
-var isArray = require('./');
-var test = require('tape');
-
-test('is array', function(t){
- t.ok(isArray([]));
- t.notOk(isArray({}));
- t.notOk(isArray(null));
- t.notOk(isArray(false));
-
- var obj = {};
- obj[0] = true;
- t.notOk(isArray(obj));
-
- var arr = [];
- arr.foo = 'bar';
- t.ok(isArray(arr));
-
- t.end();
-});
-
diff --git a/node_modules/meow/node_modules/object-assign/index.js b/node_modules/meow/node_modules/object-assign/index.js
@@ -1,83 +0,0 @@
-'use strict';
-/* eslint-disable no-unused-vars */
-var hasOwnProperty = Object.prototype.hasOwnProperty;
-var propIsEnumerable = Object.prototype.propertyIsEnumerable;
-
-function toObject(val) {
- if (val === null || val === undefined) {
- throw new TypeError('Object.assign cannot be called with null or undefined');
- }
-
- return Object(val);
-}
-
-function shouldUseNative() {
- try {
- if (!Object.assign) {
- return false;
- }
-
- // Detect buggy property enumeration order in older V8 versions.
-
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
- var test1 = new String('abc'); // eslint-disable-line
- test1[5] = 'de';
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
- return false;
- }
-
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
- var test2 = {};
- for (var i = 0; i < 10; i++) {
- test2['_' + String.fromCharCode(i)] = i;
- }
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
- return test2[n];
- });
- if (order2.join('') !== '0123456789') {
- return false;
- }
-
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
- var test3 = {};
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
- test3[letter] = letter;
- });
- if (Object.keys(Object.assign({}, test3)).join('') !==
- 'abcdefghijklmnopqrst') {
- return false;
- }
-
- return true;
- } catch (e) {
- // We don't expect any of the above to throw, but better to be safe.
- return false;
- }
-}
-
-module.exports = shouldUseNative() ? Object.assign : function (target, source) {
- var from;
- var to = toObject(target);
- var symbols;
-
- for (var s = 1; s < arguments.length; s++) {
- from = Object(arguments[s]);
-
- for (var key in from) {
- if (hasOwnProperty.call(from, key)) {
- to[key] = from[key];
- }
- }
-
- if (Object.getOwnPropertySymbols) {
- symbols = Object.getOwnPropertySymbols(from);
- for (var i = 0; i < symbols.length; i++) {
- if (propIsEnumerable.call(from, symbols[i])) {
- to[symbols[i]] = from[symbols[i]];
- }
- }
- }
- }
-
- return to;
-};
diff --git a/node_modules/meow/node_modules/object-assign/license b/node_modules/meow/node_modules/object-assign/license
@@ -1,21 +0,0 @@
-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.
diff --git a/node_modules/meow/node_modules/object-assign/package.json b/node_modules/meow/node_modules/object-assign/package.json
@@ -1,42 +0,0 @@
-{
- "name": "object-assign",
- "version": "4.1.0",
- "description": "ES2015 Object.assign() ponyfill",
- "license": "MIT",
- "repository": "sindresorhus/object-assign",
- "author": {
- "name": "Sindre Sorhus",
- "email": "sindresorhus@gmail.com",
- "url": "sindresorhus.com"
- },
- "engines": {
- "node": ">=0.10.0"
- },
- "scripts": {
- "test": "xo && mocha",
- "bench": "matcha bench.js"
- },
- "files": [
- "index.js"
- ],
- "keywords": [
- "object",
- "assign",
- "extend",
- "properties",
- "es2015",
- "ecmascript",
- "harmony",
- "ponyfill",
- "prollyfill",
- "polyfill",
- "shim",
- "browser"
- ],
- "devDependencies": {
- "lodash": "^4.8.2",
- "matcha": "^0.7.0",
- "mocha": "*",
- "xo": "*"
- }
-}
diff --git a/node_modules/meow/node_modules/object-assign/readme.md b/node_modules/meow/node_modules/object-assign/readme.md
@@ -1,56 +0,0 @@
-# object-assign [](https://travis-ci.org/sindresorhus/object-assign)
-
-> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) ponyfill
-
-> Ponyfill: A polyfill that doesn't overwrite the native method
-
-
-## Install
-
-```
-$ npm install --save object-assign
-```
-
-
-## Usage
-
-```js
-const objectAssign = require('object-assign');
-
-objectAssign({foo: 0}, {bar: 1});
-//=> {foo: 0, bar: 1}
-
-// multiple sources
-objectAssign({foo: 0}, {bar: 1}, {baz: 2});
-//=> {foo: 0, bar: 1, baz: 2}
-
-// overwrites equal keys
-objectAssign({foo: 0}, {foo: 1}, {foo: 2});
-//=> {foo: 2}
-
-// ignores null and undefined sources
-objectAssign({foo: 0}, null, {bar: 1}, undefined);
-//=> {foo: 0, bar: 1}
-```
-
-
-## API
-
-### objectAssign(target, source, [source, ...])
-
-Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones.
-
-
-## Resources
-
-- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign)
-
-
-## Related
-
-- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()`
-
-
-## License
-
-MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/node_modules/minimatch/README.md b/node_modules/minimatch/README.md
@@ -2,7 +2,7 @@
A minimal matching utility.
-[](http://travis-ci.org/isaacs/minimatch)
+[](http://travis-ci.org/isaacs/minimatch)
This is the matching library used internally by npm.
@@ -37,7 +37,7 @@ See:
## Minimatch Class
-Create a minimatch object by instanting the `minimatch.Minimatch` class.
+Create a minimatch object by instantiating the `minimatch.Minimatch` class.
```javascript
var Minimatch = require("minimatch").Minimatch
@@ -82,13 +82,6 @@ var mm = new Minimatch(pattern, options)
All other methods are internal, and will be called as necessary.
-## Functions
-
-The top-level exported function has a `cache` property, which is an LRU
-cache set to store 100 items. So, calling these methods repeatedly
-with the same pattern and options will use the same Minimatch object,
-saving the cost of parsing it multiple times.
-
### minimatch(path, pattern, options)
Main export. Tests a path against the pattern using the options.
diff --git a/node_modules/minimatch/browser.js b/node_modules/minimatch/browser.js
@@ -1,1159 +0,0 @@
-(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.minimatch = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
-module.exports = minimatch
-minimatch.Minimatch = Minimatch
-
-var path = { sep: '/' }
-try {
- path = require('path')
-} catch (er) {}
-
-var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
-var expand = require('brace-expansion')
-
-// any single thing other than /
-// don't need to escape / when using new RegExp()
-var qmark = '[^/]'
-
-// * => any number of characters
-var star = qmark + '*?'
-
-// ** when dots are allowed. Anything goes, except .. and .
-// not (^ or / followed by one or two dots followed by $ or /),
-// followed by anything, any number of times.
-var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
-
-// not a ^ or / followed by a dot,
-// followed by anything, any number of times.
-var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
-
-// characters that need to be escaped in RegExp.
-var reSpecials = charSet('().*{}+?[]^$\\!')
-
-// "abc" -> { a:true, b:true, c:true }
-function charSet (s) {
- return s.split('').reduce(function (set, c) {
- set[c] = true
- return set
- }, {})
-}
-
-// normalizes slashes.
-var slashSplit = /\/+/
-
-minimatch.filter = filter
-function filter (pattern, options) {
- options = options || {}
- return function (p, i, list) {
- return minimatch(p, pattern, options)
- }
-}
-
-function ext (a, b) {
- a = a || {}
- b = b || {}
- var t = {}
- Object.keys(b).forEach(function (k) {
- t[k] = b[k]
- })
- Object.keys(a).forEach(function (k) {
- t[k] = a[k]
- })
- return t
-}
-
-minimatch.defaults = function (def) {
- if (!def || !Object.keys(def).length) return minimatch
-
- var orig = minimatch
-
- var m = function minimatch (p, pattern, options) {
- return orig.minimatch(p, pattern, ext(def, options))
- }
-
- m.Minimatch = function Minimatch (pattern, options) {
- return new orig.Minimatch(pattern, ext(def, options))
- }
-
- return m
-}
-
-Minimatch.defaults = function (def) {
- if (!def || !Object.keys(def).length) return Minimatch
- return minimatch.defaults(def).Minimatch
-}
-
-function minimatch (p, pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('glob pattern string required')
- }
-
- if (!options) options = {}
-
- // shortcut: comments match nothing.
- if (!options.nocomment && pattern.charAt(0) === '#') {
- return false
- }
-
- // "" only matches ""
- if (pattern.trim() === '') return p === ''
-
- return new Minimatch(pattern, options).match(p)
-}
-
-function Minimatch (pattern, options) {
- if (!(this instanceof Minimatch)) {
- return new Minimatch(pattern, options)
- }
-
- if (typeof pattern !== 'string') {
- throw new TypeError('glob pattern string required')
- }
-
- if (!options) options = {}
- pattern = pattern.trim()
-
- // windows support: need to use /, not \
- if (path.sep !== '/') {
- pattern = pattern.split(path.sep).join('/')
- }
-
- this.options = options
- this.set = []
- this.pattern = pattern
- this.regexp = null
- this.negate = false
- this.comment = false
- this.empty = false
-
- // make the set of regexps etc.
- this.make()
-}
-
-Minimatch.prototype.debug = function () {}
-
-Minimatch.prototype.make = make
-function make () {
- // don't do it more than once.
- if (this._made) return
-
- var pattern = this.pattern
- var options = this.options
-
- // empty patterns and comments match nothing.
- if (!options.nocomment && pattern.charAt(0) === '#') {
- this.comment = true
- return
- }
- if (!pattern) {
- this.empty = true
- return
- }
-
- // step 1: figure out negation, etc.
- this.parseNegate()
-
- // step 2: expand braces
- var set = this.globSet = this.braceExpand()
-
- if (options.debug) this.debug = console.error
-
- this.debug(this.pattern, set)
-
- // step 3: now we have a set, so turn each one into a series of path-portion
- // matching patterns.
- // These will be regexps, except in the case of "**", which is
- // set to the GLOBSTAR object for globstar behavior,
- // and will not contain any / characters
- set = this.globParts = set.map(function (s) {
- return s.split(slashSplit)
- })
-
- this.debug(this.pattern, set)
-
- // glob --> regexps
- set = set.map(function (s, si, set) {
- return s.map(this.parse, this)
- }, this)
-
- this.debug(this.pattern, set)
-
- // filter out everything that didn't compile properly.
- set = set.filter(function (s) {
- return s.indexOf(false) === -1
- })
-
- this.debug(this.pattern, set)
-
- this.set = set
-}
-
-Minimatch.prototype.parseNegate = parseNegate
-function parseNegate () {
- var pattern = this.pattern
- var negate = false
- var options = this.options
- var negateOffset = 0
-
- if (options.nonegate) return
-
- for (var i = 0, l = pattern.length
- ; i < l && pattern.charAt(i) === '!'
- ; i++) {
- negate = !negate
- negateOffset++
- }
-
- if (negateOffset) this.pattern = pattern.substr(negateOffset)
- this.negate = negate
-}
-
-// Brace expansion:
-// a{b,c}d -> abd acd
-// a{b,}c -> abc ac
-// a{0..3}d -> a0d a1d a2d a3d
-// a{b,c{d,e}f}g -> abg acdfg acefg
-// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
-//
-// Invalid sets are not expanded.
-// a{2..}b -> a{2..}b
-// a{b}c -> a{b}c
-minimatch.braceExpand = function (pattern, options) {
- return braceExpand(pattern, options)
-}
-
-Minimatch.prototype.braceExpand = braceExpand
-
-function braceExpand (pattern, options) {
- if (!options) {
- if (this instanceof Minimatch) {
- options = this.options
- } else {
- options = {}
- }
- }
-
- pattern = typeof pattern === 'undefined'
- ? this.pattern : pattern
-
- if (typeof pattern === 'undefined') {
- throw new Error('undefined pattern')
- }
-
- if (options.nobrace ||
- !pattern.match(/\{.*\}/)) {
- // shortcut. no need to expand.
- return [pattern]
- }
-
- return expand(pattern)
-}
-
-// parse a component of the expanded set.
-// At this point, no pattern may contain "/" in it
-// so we're going to return a 2d array, where each entry is the full
-// pattern, split on '/', and then turned into a regular expression.
-// A regexp is made at the end which joins each array with an
-// escaped /, and another full one which joins each regexp with |.
-//
-// Following the lead of Bash 4.1, note that "**" only has special meaning
-// when it is the *only* thing in a path portion. Otherwise, any series
-// of * is equivalent to a single *. Globstar behavior is enabled by
-// default, and can be disabled by setting options.noglobstar.
-Minimatch.prototype.parse = parse
-var SUBPARSE = {}
-function parse (pattern, isSub) {
- var options = this.options
-
- // shortcuts
- if (!options.noglobstar && pattern === '**') return GLOBSTAR
- if (pattern === '') return ''
-
- var re = ''
- var hasMagic = !!options.nocase
- var escaping = false
- // ? => one single character
- var patternListStack = []
- var negativeLists = []
- var plType
- var stateChar
- var inClass = false
- var reClassStart = -1
- var classStart = -1
- // . and .. never match anything that doesn't start with .,
- // even when options.dot is set.
- var patternStart = pattern.charAt(0) === '.' ? '' // anything
- // not (start or / followed by . or .. followed by / or end)
- : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
- : '(?!\\.)'
- var self = this
-
- function clearStateChar () {
- if (stateChar) {
- // we had some state-tracking character
- // that wasn't consumed by this pass.
- switch (stateChar) {
- case '*':
- re += star
- hasMagic = true
- break
- case '?':
- re += qmark
- hasMagic = true
- break
- default:
- re += '\\' + stateChar
- break
- }
- self.debug('clearStateChar %j %j', stateChar, re)
- stateChar = false
- }
- }
-
- for (var i = 0, len = pattern.length, c
- ; (i < len) && (c = pattern.charAt(i))
- ; i++) {
- this.debug('%s\t%s %s %j', pattern, i, re, c)
-
- // skip over any that are escaped.
- if (escaping && reSpecials[c]) {
- re += '\\' + c
- escaping = false
- continue
- }
-
- switch (c) {
- case '/':
- // completely not allowed, even escaped.
- // Should already be path-split by now.
- return false
-
- case '\\':
- clearStateChar()
- escaping = true
- continue
-
- // the various stateChar values
- // for the "extglob" stuff.
- case '?':
- case '*':
- case '+':
- case '@':
- case '!':
- this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
-
- // all of those are literals inside a class, except that
- // the glob [!a] means [^a] in regexp
- if (inClass) {
- this.debug(' in class')
- if (c === '!' && i === classStart + 1) c = '^'
- re += c
- continue
- }
-
- // if we already have a stateChar, then it means
- // that there was something like ** or +? in there.
- // Handle the stateChar, then proceed with this one.
- self.debug('call clearStateChar %j', stateChar)
- clearStateChar()
- stateChar = c
- // if extglob is disabled, then +(asdf|foo) isn't a thing.
- // just clear the statechar *now*, rather than even diving into
- // the patternList stuff.
- if (options.noext) clearStateChar()
- continue
-
- case '(':
- if (inClass) {
- re += '('
- continue
- }
-
- if (!stateChar) {
- re += '\\('
- continue
- }
-
- plType = stateChar
- patternListStack.push({
- type: plType,
- start: i - 1,
- reStart: re.length
- })
- // negation is (?:(?!js)[^/]*)
- re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
- this.debug('plType %j %j', stateChar, re)
- stateChar = false
- continue
-
- case ')':
- if (inClass || !patternListStack.length) {
- re += '\\)'
- continue
- }
-
- clearStateChar()
- hasMagic = true
- re += ')'
- var pl = patternListStack.pop()
- plType = pl.type
- // negation is (?:(?!js)[^/]*)
- // The others are (?:<pattern>)<type>
- switch (plType) {
- case '!':
- negativeLists.push(pl)
- re += ')[^/]*?)'
- pl.reEnd = re.length
- break
- case '?':
- case '+':
- case '*':
- re += plType
- break
- case '@': break // the default anyway
- }
- continue
-
- case '|':
- if (inClass || !patternListStack.length || escaping) {
- re += '\\|'
- escaping = false
- continue
- }
-
- clearStateChar()
- re += '|'
- continue
-
- // these are mostly the same in regexp and glob
- case '[':
- // swallow any state-tracking char before the [
- clearStateChar()
-
- if (inClass) {
- re += '\\' + c
- continue
- }
-
- inClass = true
- classStart = i
- reClassStart = re.length
- re += c
- continue
-
- case ']':
- // a right bracket shall lose its special
- // meaning and represent itself in
- // a bracket expression if it occurs
- // first in the list. -- POSIX.2 2.8.3.2
- if (i === classStart + 1 || !inClass) {
- re += '\\' + c
- escaping = false
- continue
- }
-
- // handle the case where we left a class open.
- // "[z-a]" is valid, equivalent to "\[z-a\]"
- if (inClass) {
- // split where the last [ was, make sure we don't have
- // an invalid re. if so, re-walk the contents of the
- // would-be class to re-translate any characters that
- // were passed through as-is
- // TODO: It would probably be faster to determine this
- // without a try/catch and a new RegExp, but it's tricky
- // to do safely. For now, this is safe and works.
- var cs = pattern.substring(classStart + 1, i)
- try {
- RegExp('[' + cs + ']')
- } catch (er) {
- // not a valid class!
- var sp = this.parse(cs, SUBPARSE)
- re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
- hasMagic = hasMagic || sp[1]
- inClass = false
- continue
- }
- }
-
- // finish up the class.
- hasMagic = true
- inClass = false
- re += c
- continue
-
- default:
- // swallow any state char that wasn't consumed
- clearStateChar()
-
- if (escaping) {
- // no need
- escaping = false
- } else if (reSpecials[c]
- && !(c === '^' && inClass)) {
- re += '\\'
- }
-
- re += c
-
- } // switch
- } // for
-
- // handle the case where we left a class open.
- // "[abc" is valid, equivalent to "\[abc"
- if (inClass) {
- // split where the last [ was, and escape it
- // this is a huge pita. We now have to re-walk
- // the contents of the would-be class to re-translate
- // any characters that were passed through as-is
- cs = pattern.substr(classStart + 1)
- sp = this.parse(cs, SUBPARSE)
- re = re.substr(0, reClassStart) + '\\[' + sp[0]
- hasMagic = hasMagic || sp[1]
- }
-
- // handle the case where we had a +( thing at the *end*
- // of the pattern.
- // each pattern list stack adds 3 chars, and we need to go through
- // and escape any | chars that were passed through as-is for the regexp.
- // Go through and escape them, taking care not to double-escape any
- // | chars that were already escaped.
- for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
- var tail = re.slice(pl.reStart + 3)
- // maybe some even number of \, then maybe 1 \, followed by a |
- tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) {
- if (!$2) {
- // the | isn't already escaped, so escape it.
- $2 = '\\'
- }
-
- // need to escape all those slashes *again*, without escaping the
- // one that we need for escaping the | character. As it works out,
- // escaping an even number of slashes can be done by simply repeating
- // it exactly after itself. That's why this trick works.
- //
- // I am sorry that you have to see this.
- return $1 + $1 + $2 + '|'
- })
-
- this.debug('tail=%j\n %s', tail, tail)
- var t = pl.type === '*' ? star
- : pl.type === '?' ? qmark
- : '\\' + pl.type
-
- hasMagic = true
- re = re.slice(0, pl.reStart) + t + '\\(' + tail
- }
-
- // handle trailing things that only matter at the very end.
- clearStateChar()
- if (escaping) {
- // trailing \\
- re += '\\\\'
- }
-
- // only need to apply the nodot start if the re starts with
- // something that could conceivably capture a dot
- var addPatternStart = false
- switch (re.charAt(0)) {
- case '.':
- case '[':
- case '(': addPatternStart = true
- }
-
- // Hack to work around lack of negative lookbehind in JS
- // A pattern like: *.!(x).!(y|z) needs to ensure that a name
- // like 'a.xyz.yz' doesn't match. So, the first negative
- // lookahead, has to look ALL the way ahead, to the end of
- // the pattern.
- for (var n = negativeLists.length - 1; n > -1; n--) {
- var nl = negativeLists[n]
-
- var nlBefore = re.slice(0, nl.reStart)
- var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
- var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
- var nlAfter = re.slice(nl.reEnd)
-
- nlLast += nlAfter
-
- // Handle nested stuff like *(*.js|!(*.json)), where open parens
- // mean that we should *not* include the ) in the bit that is considered
- // "after" the negated section.
- var openParensBefore = nlBefore.split('(').length - 1
- var cleanAfter = nlAfter
- for (i = 0; i < openParensBefore; i++) {
- cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
- }
- nlAfter = cleanAfter
-
- var dollar = ''
- if (nlAfter === '' && isSub !== SUBPARSE) {
- dollar = '$'
- }
- var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
- re = newRe
- }
-
- // if the re is not "" at this point, then we need to make sure
- // it doesn't match against an empty path part.
- // Otherwise a/* will match a/, which it should not.
- if (re !== '' && hasMagic) {
- re = '(?=.)' + re
- }
-
- if (addPatternStart) {
- re = patternStart + re
- }
-
- // parsing just a piece of a larger pattern.
- if (isSub === SUBPARSE) {
- return [re, hasMagic]
- }
-
- // skip the regexp for non-magical patterns
- // unescape anything in it, though, so that it'll be
- // an exact match against a file etc.
- if (!hasMagic) {
- return globUnescape(pattern)
- }
-
- var flags = options.nocase ? 'i' : ''
- var regExp = new RegExp('^' + re + '$', flags)
-
- regExp._glob = pattern
- regExp._src = re
-
- return regExp
-}
-
-minimatch.makeRe = function (pattern, options) {
- return new Minimatch(pattern, options || {}).makeRe()
-}
-
-Minimatch.prototype.makeRe = makeRe
-function makeRe () {
- if (this.regexp || this.regexp === false) return this.regexp
-
- // at this point, this.set is a 2d array of partial
- // pattern strings, or "**".
- //
- // It's better to use .match(). This function shouldn't
- // be used, really, but it's pretty convenient sometimes,
- // when you just want to work with a regex.
- var set = this.set
-
- if (!set.length) {
- this.regexp = false
- return this.regexp
- }
- var options = this.options
-
- var twoStar = options.noglobstar ? star
- : options.dot ? twoStarDot
- : twoStarNoDot
- var flags = options.nocase ? 'i' : ''
-
- var re = set.map(function (pattern) {
- return pattern.map(function (p) {
- return (p === GLOBSTAR) ? twoStar
- : (typeof p === 'string') ? regExpEscape(p)
- : p._src
- }).join('\\\/')
- }).join('|')
-
- // must match entire pattern
- // ending in a * or ** will make it less strict.
- re = '^(?:' + re + ')$'
-
- // can match anything, as long as it's not this.
- if (this.negate) re = '^(?!' + re + ').*$'
-
- try {
- this.regexp = new RegExp(re, flags)
- } catch (ex) {
- this.regexp = false
- }
- return this.regexp
-}
-
-minimatch.match = function (list, pattern, options) {
- options = options || {}
- var mm = new Minimatch(pattern, options)
- list = list.filter(function (f) {
- return mm.match(f)
- })
- if (mm.options.nonull && !list.length) {
- list.push(pattern)
- }
- return list
-}
-
-Minimatch.prototype.match = match
-function match (f, partial) {
- this.debug('match', f, this.pattern)
- // short-circuit in the case of busted things.
- // comments, etc.
- if (this.comment) return false
- if (this.empty) return f === ''
-
- if (f === '/' && partial) return true
-
- var options = this.options
-
- // windows: need to use /, not \
- if (path.sep !== '/') {
- f = f.split(path.sep).join('/')
- }
-
- // treat the test path as a set of pathparts.
- f = f.split(slashSplit)
- this.debug(this.pattern, 'split', f)
-
- // just ONE of the pattern sets in this.set needs to match
- // in order for it to be valid. If negating, then just one
- // match means that we have failed.
- // Either way, return on the first hit.
-
- var set = this.set
- this.debug(this.pattern, 'set', set)
-
- // Find the basename of the path by looking for the last non-empty segment
- var filename
- var i
- for (i = f.length - 1; i >= 0; i--) {
- filename = f[i]
- if (filename) break
- }
-
- for (i = 0; i < set.length; i++) {
- var pattern = set[i]
- var file = f
- if (options.matchBase && pattern.length === 1) {
- file = [filename]
- }
- var hit = this.matchOne(file, pattern, partial)
- if (hit) {
- if (options.flipNegate) return true
- return !this.negate
- }
- }
-
- // didn't get any hits. this is success if it's a negative
- // pattern, failure otherwise.
- if (options.flipNegate) return false
- return this.negate
-}
-
-// set partial to true to test if, for example,
-// "/a/b" matches the start of "/*/b/*/d"
-// Partial means, if you run out of file before you run
-// out of pattern, then that's fine, as long as all
-// the parts match.
-Minimatch.prototype.matchOne = function (file, pattern, partial) {
- var options = this.options
-
- this.debug('matchOne',
- { 'this': this, file: file, pattern: pattern })
-
- this.debug('matchOne', file.length, pattern.length)
-
- for (var fi = 0,
- pi = 0,
- fl = file.length,
- pl = pattern.length
- ; (fi < fl) && (pi < pl)
- ; fi++, pi++) {
- this.debug('matchOne loop')
- var p = pattern[pi]
- var f = file[fi]
-
- this.debug(pattern, p, f)
-
- // should be impossible.
- // some invalid regexp stuff in the set.
- if (p === false) return false
-
- if (p === GLOBSTAR) {
- this.debug('GLOBSTAR', [pattern, p, f])
-
- // "**"
- // a/**/b/**/c would match the following:
- // a/b/x/y/z/c
- // a/x/y/z/b/c
- // a/b/x/b/x/c
- // a/b/c
- // To do this, take the rest of the pattern after
- // the **, and see if it would match the file remainder.
- // If so, return success.
- // If not, the ** "swallows" a segment, and try again.
- // This is recursively awful.
- //
- // a/**/b/**/c matching a/b/x/y/z/c
- // - a matches a
- // - doublestar
- // - matchOne(b/x/y/z/c, b/**/c)
- // - b matches b
- // - doublestar
- // - matchOne(x/y/z/c, c) -> no
- // - matchOne(y/z/c, c) -> no
- // - matchOne(z/c, c) -> no
- // - matchOne(c, c) yes, hit
- var fr = fi
- var pr = pi + 1
- if (pr === pl) {
- this.debug('** at the end')
- // a ** at the end will just swallow the rest.
- // We have found a match.
- // however, it will not swallow /.x, unless
- // options.dot is set.
- // . and .. are *never* matched by **, for explosively
- // exponential reasons.
- for (; fi < fl; fi++) {
- if (file[fi] === '.' || file[fi] === '..' ||
- (!options.dot && file[fi].charAt(0) === '.')) return false
- }
- return true
- }
-
- // ok, let's see if we can swallow whatever we can.
- while (fr < fl) {
- var swallowee = file[fr]
-
- this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
-
- // XXX remove this slice. Just pass the start index.
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
- this.debug('globstar found match!', fr, fl, swallowee)
- // found a match.
- return true
- } else {
- // can't swallow "." or ".." ever.
- // can only swallow ".foo" when explicitly asked.
- if (swallowee === '.' || swallowee === '..' ||
- (!options.dot && swallowee.charAt(0) === '.')) {
- this.debug('dot detected!', file, fr, pattern, pr)
- break
- }
-
- // ** swallows a segment, and continue.
- this.debug('globstar swallow a segment, and continue')
- fr++
- }
- }
-
- // no match was found.
- // However, in partial mode, we can't say this is necessarily over.
- // If there's more *pattern* left, then
- if (partial) {
- // ran out of file
- this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
- if (fr === fl) return true
- }
- return false
- }
-
- // something other than **
- // non-magic patterns just have to match exactly
- // patterns with magic have been turned into regexps.
- var hit
- if (typeof p === 'string') {
- if (options.nocase) {
- hit = f.toLowerCase() === p.toLowerCase()
- } else {
- hit = f === p
- }
- this.debug('string match', p, f, hit)
- } else {
- hit = f.match(p)
- this.debug('pattern match', p, f, hit)
- }
-
- if (!hit) return false
- }
-
- // Note: ending in / means that we'll get a final ""
- // at the end of the pattern. This can only match a
- // corresponding "" at the end of the file.
- // If the file ends in /, then it can only match a
- // a pattern that ends in /, unless the pattern just
- // doesn't have any more for it. But, a/b/ should *not*
- // match "a/b/*", even though "" matches against the
- // [^/]*? pattern, except in partial mode, where it might
- // simply not be reached yet.
- // However, a/b/ should still satisfy a/*
-
- // now either we fell off the end of the pattern, or we're done.
- if (fi === fl && pi === pl) {
- // ran out of pattern and filename at the same time.
- // an exact hit!
- return true
- } else if (fi === fl) {
- // ran out of file, but still had pattern left.
- // this is ok if we're doing the match as part of
- // a glob fs traversal.
- return partial
- } else if (pi === pl) {
- // ran out of pattern, still have file left.
- // this is only acceptable if we're on the very last
- // empty segment of a file with a trailing slash.
- // a/* should match a/b/
- var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
- return emptyFileEnd
- }
-
- // should be unreachable.
- throw new Error('wtf?')
-}
-
-// replace stuff like \* with *
-function globUnescape (s) {
- return s.replace(/\\(.)/g, '$1')
-}
-
-function regExpEscape (s) {
- return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
-}
-
-},{"brace-expansion":2,"path":undefined}],2:[function(require,module,exports){
-var concatMap = require('concat-map');
-var balanced = require('balanced-match');
-
-module.exports = expandTop;
-
-var escSlash = '\0SLASH'+Math.random()+'\0';
-var escOpen = '\0OPEN'+Math.random()+'\0';
-var escClose = '\0CLOSE'+Math.random()+'\0';
-var escComma = '\0COMMA'+Math.random()+'\0';
-var escPeriod = '\0PERIOD'+Math.random()+'\0';
-
-function numeric(str) {
- return parseInt(str, 10) == str
- ? parseInt(str, 10)
- : str.charCodeAt(0);
-}
-
-function escapeBraces(str) {
- return str.split('\\\\').join(escSlash)
- .split('\\{').join(escOpen)
- .split('\\}').join(escClose)
- .split('\\,').join(escComma)
- .split('\\.').join(escPeriod);
-}
-
-function unescapeBraces(str) {
- return str.split(escSlash).join('\\')
- .split(escOpen).join('{')
- .split(escClose).join('}')
- .split(escComma).join(',')
- .split(escPeriod).join('.');
-}
-
-
-// Basically just str.split(","), but handling cases
-// where we have nested braced sections, which should be
-// treated as individual members, like {a,{b,c},d}
-function parseCommaParts(str) {
- if (!str)
- return [''];
-
- var parts = [];
- var m = balanced('{', '}', str);
-
- if (!m)
- return str.split(',');
-
- var pre = m.pre;
- var body = m.body;
- var post = m.post;
- var p = pre.split(',');
-
- p[p.length-1] += '{' + body + '}';
- var postParts = parseCommaParts(post);
- if (post.length) {
- p[p.length-1] += postParts.shift();
- p.push.apply(p, postParts);
- }
-
- parts.push.apply(parts, p);
-
- return parts;
-}
-
-function expandTop(str) {
- if (!str)
- return [];
-
- var expansions = expand(escapeBraces(str));
- return expansions.filter(identity).map(unescapeBraces);
-}
-
-function identity(e) {
- return e;
-}
-
-function embrace(str) {
- return '{' + str + '}';
-}
-function isPadded(el) {
- return /^-?0\d/.test(el);
-}
-
-function lte(i, y) {
- return i <= y;
-}
-function gte(i, y) {
- return i >= y;
-}
-
-function expand(str) {
- var expansions = [];
-
- var m = balanced('{', '}', str);
- if (!m || /\$$/.test(m.pre)) return [str];
-
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
- var isSequence = isNumericSequence || isAlphaSequence;
- var isOptions = /^(.*,)+(.+)?$/.test(m.body);
- if (!isSequence && !isOptions) {
- // {a},b}
- if (m.post.match(/,.*}/)) {
- str = m.pre + '{' + m.body + escClose + m.post;
- return expand(str);
- }
- return [str];
- }
-
- var n;
- if (isSequence) {
- n = m.body.split(/\.\./);
- } else {
- n = parseCommaParts(m.body);
- if (n.length === 1) {
- // x{{a,b}}y ==> x{a}y x{b}y
- n = expand(n[0]).map(embrace);
- if (n.length === 1) {
- var post = m.post.length
- ? expand(m.post)
- : [''];
- return post.map(function(p) {
- return m.pre + n[0] + p;
- });
- }
- }
- }
-
- // at this point, n is the parts, and we know it's not a comma set
- // with a single entry.
-
- // no need to expand pre, since it is guaranteed to be free of brace-sets
- var pre = m.pre;
- var post = m.post.length
- ? expand(m.post)
- : [''];
-
- var N;
-
- if (isSequence) {
- var x = numeric(n[0]);
- var y = numeric(n[1]);
- var width = Math.max(n[0].length, n[1].length)
- var incr = n.length == 3
- ? Math.abs(numeric(n[2]))
- : 1;
- var test = lte;
- var reverse = y < x;
- if (reverse) {
- incr *= -1;
- test = gte;
- }
- var pad = n.some(isPadded);
-
- N = [];
-
- for (var i = x; test(i, y); i += incr) {
- var c;
- if (isAlphaSequence) {
- c = String.fromCharCode(i);
- if (c === '\\')
- c = '';
- } else {
- c = String(i);
- if (pad) {
- var need = width - c.length;
- if (need > 0) {
- var z = new Array(need + 1).join('0');
- if (i < 0)
- c = '-' + z + c.slice(1);
- else
- c = z + c;
- }
- }
- }
- N.push(c);
- }
- } else {
- N = concatMap(n, function(el) { return expand(el) });
- }
-
- for (var j = 0; j < N.length; j++) {
- for (var k = 0; k < post.length; k++) {
- expansions.push([pre, N[j], post[k]].join(''))
- }
- }
-
- return expansions;
-}
-
-
-},{"balanced-match":3,"concat-map":4}],3:[function(require,module,exports){
-module.exports = balanced;
-function balanced(a, b, str) {
- var bal = 0;
- var m = {};
- var ended = false;
-
- for (var i = 0; i < str.length; i++) {
- if (a == str.substr(i, a.length)) {
- if (!('start' in m)) m.start = i;
- bal++;
- }
- else if (b == str.substr(i, b.length) && 'start' in m) {
- ended = true;
- bal--;
- if (!bal) {
- m.end = i;
- m.pre = str.substr(0, m.start);
- m.body = (m.end - m.start > 1)
- ? str.substring(m.start + a.length, m.end)
- : '';
- m.post = str.slice(m.end + b.length);
- return m;
- }
- }
- }
-
- // if we opened more than we closed, find the one we closed
- if (bal && ended) {
- var start = m.start + a.length;
- m = balanced(a, b, str.substr(start));
- if (m) {
- m.start += start;
- m.end += start;
- m.pre = str.slice(0, start) + m.pre;
- }
- return m;
- }
-}
-
-},{}],4:[function(require,module,exports){
-module.exports = function (xs, fn) {
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- var x = fn(xs[i], i);
- if (Array.isArray(x)) res.push.apply(res, x);
- else res.push(x);
- }
- return res;
-};
-
-},{}]},{},[1])(1)
-});
-\ No newline at end of file
diff --git a/node_modules/minimatch/minimatch.js b/node_modules/minimatch/minimatch.js
@@ -9,6 +9,14 @@ try {
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
var expand = require('brace-expansion')
+var plTypes = {
+ '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
+ '?': { open: '(?:', close: ')?' },
+ '+': { open: '(?:', close: ')+' },
+ '*': { open: '(?:', close: ')*' },
+ '@': { open: '(?:', close: ')' }
+}
+
// any single thing other than /
// don't need to escape / when using new RegExp()
var qmark = '[^/]'
@@ -235,7 +243,7 @@ function braceExpand (pattern, options) {
? this.pattern : pattern
if (typeof pattern === 'undefined') {
- throw new Error('undefined pattern')
+ throw new TypeError('undefined pattern')
}
if (options.nobrace ||
@@ -261,6 +269,10 @@ function braceExpand (pattern, options) {
Minimatch.prototype.parse = parse
var SUBPARSE = {}
function parse (pattern, isSub) {
+ if (pattern.length > 1024 * 64) {
+ throw new TypeError('pattern is too long')
+ }
+
var options = this.options
// shortcuts
@@ -273,7 +285,6 @@ function parse (pattern, isSub) {
// ? => one single character
var patternListStack = []
var negativeLists = []
- var plType
var stateChar
var inClass = false
var reClassStart = -1
@@ -372,11 +383,12 @@ function parse (pattern, isSub) {
continue
}
- plType = stateChar
patternListStack.push({
- type: plType,
+ type: stateChar,
start: i - 1,
- reStart: re.length
+ reStart: re.length,
+ open: plTypes[stateChar].open,
+ close: plTypes[stateChar].close
})
// negation is (?:(?!js)[^/]*)
re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
@@ -392,24 +404,14 @@ function parse (pattern, isSub) {
clearStateChar()
hasMagic = true
- re += ')'
var pl = patternListStack.pop()
- plType = pl.type
// negation is (?:(?!js)[^/]*)
// The others are (?:<pattern>)<type>
- switch (plType) {
- case '!':
- negativeLists.push(pl)
- re += ')[^/]*?)'
- pl.reEnd = re.length
- break
- case '?':
- case '+':
- case '*':
- re += plType
- break
- case '@': break // the default anyway
+ re += pl.close
+ if (pl.type === '!') {
+ negativeLists.push(pl)
}
+ pl.reEnd = re.length
continue
case '|':
@@ -516,9 +518,10 @@ function parse (pattern, isSub) {
// Go through and escape them, taking care not to double-escape any
// | chars that were already escaped.
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
- var tail = re.slice(pl.reStart + 3)
+ var tail = re.slice(pl.reStart + pl.open.length)
+ this.debug('setting tail', re, pl)
// maybe some even number of \, then maybe 1 \, followed by a |
- tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function (_, $1, $2) {
+ tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
if (!$2) {
// the | isn't already escaped, so escape it.
$2 = '\\'
@@ -533,7 +536,7 @@ function parse (pattern, isSub) {
return $1 + $1 + $2 + '|'
})
- this.debug('tail=%j\n %s', tail, tail)
+ this.debug('tail=%j\n %s', tail, tail, pl, re)
var t = pl.type === '*' ? star
: pl.type === '?' ? qmark
: '\\' + pl.type
@@ -615,7 +618,15 @@ function parse (pattern, isSub) {
}
var flags = options.nocase ? 'i' : ''
- var regExp = new RegExp('^' + re + '$', flags)
+ try {
+ var regExp = new RegExp('^' + re + '$', flags)
+ } catch (er) {
+ // If it was an invalid regular expression, then it can't match
+ // anything. This trick looks for a character after the end of
+ // the string, which is of course impossible, except in multi-line
+ // mode, but it's not a /m regex.
+ return new RegExp('$.')
+ }
regExp._glob = pattern
regExp._src = re
diff --git a/node_modules/minimatch/package.json b/node_modules/minimatch/package.json
@@ -2,7 +2,7 @@
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
"name": "minimatch",
"description": "a glob matcher in javascript",
- "version": "2.0.10",
+ "version": "3.0.3",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/minimatch.git"
@@ -10,8 +10,7 @@
"main": "minimatch.js",
"scripts": {
"posttest": "standard minimatch.js test/*.js",
- "test": "tap test/*.js",
- "prepublish": "browserify -o browser.js -e minimatch.js -s minimatch --bare"
+ "test": "tap test/*.js"
},
"engines": {
"node": "*"
@@ -20,13 +19,11 @@
"brace-expansion": "^1.0.0"
},
"devDependencies": {
- "browserify": "^9.0.3",
"standard": "^3.7.2",
- "tap": "^1.2.0"
+ "tap": "^5.6.0"
},
"license": "ISC",
"files": [
- "minimatch.js",
- "browser.js"
+ "minimatch.js"
]
}
diff --git a/node_modules/node-gyp/node_modules/minimatch/LICENSE b/node_modules/node-gyp/node_modules/minimatch/LICENSE
@@ -1,15 +0,0 @@
-The ISC License
-
-Copyright (c) Isaac Z. Schlueter and 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.
diff --git a/node_modules/node-gyp/node_modules/minimatch/README.md b/node_modules/node-gyp/node_modules/minimatch/README.md
@@ -1,209 +0,0 @@
-# minimatch
-
-A minimal matching utility.
-
-[](http://travis-ci.org/isaacs/minimatch)
-
-
-This is the matching library used internally by npm.
-
-It works by converting glob expressions into JavaScript `RegExp`
-objects.
-
-## Usage
-
-```javascript
-var minimatch = require("minimatch")
-
-minimatch("bar.foo", "*.foo") // true!
-minimatch("bar.foo", "*.bar") // false!
-minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy!
-```
-
-## Features
-
-Supports these glob features:
-
-* Brace Expansion
-* Extended glob matching
-* "Globstar" `**` matching
-
-See:
-
-* `man sh`
-* `man bash`
-* `man 3 fnmatch`
-* `man 5 gitignore`
-
-## Minimatch Class
-
-Create a minimatch object by instantiating the `minimatch.Minimatch` class.
-
-```javascript
-var Minimatch = require("minimatch").Minimatch
-var mm = new Minimatch(pattern, options)
-```
-
-### Properties
-
-* `pattern` The original pattern the minimatch object represents.
-* `options` The options supplied to the constructor.
-* `set` A 2-dimensional array of regexp or string expressions.
- Each row in the
- array corresponds to a brace-expanded pattern. Each item in the row
- corresponds to a single path-part. For example, the pattern
- `{a,b/c}/d` would expand to a set of patterns like:
-
- [ [ a, d ]
- , [ b, c, d ] ]
-
- If a portion of the pattern doesn't have any "magic" in it
- (that is, it's something like `"foo"` rather than `fo*o?`), then it
- will be left as a string rather than converted to a regular
- expression.
-
-* `regexp` Created by the `makeRe` method. A single regular expression
- expressing the entire pattern. This is useful in cases where you wish
- to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled.
-* `negate` True if the pattern is negated.
-* `comment` True if the pattern is a comment.
-* `empty` True if the pattern is `""`.
-
-### Methods
-
-* `makeRe` Generate the `regexp` member if necessary, and return it.
- Will return `false` if the pattern is invalid.
-* `match(fname)` Return true if the filename matches the pattern, or
- false otherwise.
-* `matchOne(fileArray, patternArray, partial)` Take a `/`-split
- filename, and match it against a single row in the `regExpSet`. This
- method is mainly for internal use, but is exposed so that it can be
- used by a glob-walker that needs to avoid excessive filesystem calls.
-
-All other methods are internal, and will be called as necessary.
-
-### minimatch(path, pattern, options)
-
-Main export. Tests a path against the pattern using the options.
-
-```javascript
-var isJS = minimatch(file, "*.js", { matchBase: true })
-```
-
-### minimatch.filter(pattern, options)
-
-Returns a function that tests its
-supplied argument, suitable for use with `Array.filter`. Example:
-
-```javascript
-var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true}))
-```
-
-### minimatch.match(list, pattern, options)
-
-Match against the list of
-files, in the style of fnmatch or glob. If nothing is matched, and
-options.nonull is set, then return a list containing the pattern itself.
-
-```javascript
-var javascripts = minimatch.match(fileList, "*.js", {matchBase: true}))
-```
-
-### minimatch.makeRe(pattern, options)
-
-Make a regular expression object from the pattern.
-
-## Options
-
-All options are `false` by default.
-
-### debug
-
-Dump a ton of stuff to stderr.
-
-### nobrace
-
-Do not expand `{a,b}` and `{1..3}` brace sets.
-
-### noglobstar
-
-Disable `**` matching against multiple folder names.
-
-### dot
-
-Allow patterns to match filenames starting with a period, even if
-the pattern does not explicitly have a period in that spot.
-
-Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot`
-is set.
-
-### noext
-
-Disable "extglob" style patterns like `+(a|b)`.
-
-### nocase
-
-Perform a case-insensitive match.
-
-### nonull
-
-When a match is not found by `minimatch.match`, return a list containing
-the pattern itself if this option is set. When not set, an empty list
-is returned if there are no matches.
-
-### matchBase
-
-If set, then patterns without slashes will be matched
-against the basename of the path if it contains slashes. For example,
-`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`.
-
-### nocomment
-
-Suppress the behavior of treating `#` at the start of a pattern as a
-comment.
-
-### nonegate
-
-Suppress the behavior of treating a leading `!` character as negation.
-
-### flipNegate
-
-Returns from negate expressions the same as if they were not negated.
-(Ie, true on a hit, false on a miss.)
-
-
-## Comparisons to other fnmatch/glob implementations
-
-While strict compliance with the existing standards is a worthwhile
-goal, some discrepancies exist between minimatch and other
-implementations, and are intentional.
-
-If the pattern starts with a `!` character, then it is negated. Set the
-`nonegate` flag to suppress this behavior, and treat leading `!`
-characters normally. This is perhaps relevant if you wish to start the
-pattern with a negative extglob pattern like `!(a|B)`. Multiple `!`
-characters at the start of a pattern will negate the pattern multiple
-times.
-
-If a pattern starts with `#`, then it is treated as a comment, and
-will not match anything. Use `\#` to match a literal `#` at the
-start of a line, or set the `nocomment` flag to suppress this behavior.
-
-The double-star character `**` is supported by default, unless the
-`noglobstar` flag is set. This is supported in the manner of bsdglob
-and bash 4.1, where `**` only has special significance if it is the only
-thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but
-`a/**b` will not.
-
-If an escaped pattern has no matches, and the `nonull` flag is set,
-then minimatch.match returns the pattern as-provided, rather than
-interpreting the character escapes. For example,
-`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than
-`"*a?"`. This is akin to setting the `nullglob` option in bash, except
-that it does not resolve escaped pattern characters.
-
-If brace expansion is not disabled, then it is performed before any
-other interpretation of the glob pattern. Thus, a pattern like
-`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded
-**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are
-checked for validity. Since those two are valid, matching proceeds.
diff --git a/node_modules/node-gyp/node_modules/minimatch/minimatch.js b/node_modules/node-gyp/node_modules/minimatch/minimatch.js
@@ -1,923 +0,0 @@
-module.exports = minimatch
-minimatch.Minimatch = Minimatch
-
-var path = { sep: '/' }
-try {
- path = require('path')
-} catch (er) {}
-
-var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
-var expand = require('brace-expansion')
-
-var plTypes = {
- '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
- '?': { open: '(?:', close: ')?' },
- '+': { open: '(?:', close: ')+' },
- '*': { open: '(?:', close: ')*' },
- '@': { open: '(?:', close: ')' }
-}
-
-// any single thing other than /
-// don't need to escape / when using new RegExp()
-var qmark = '[^/]'
-
-// * => any number of characters
-var star = qmark + '*?'
-
-// ** when dots are allowed. Anything goes, except .. and .
-// not (^ or / followed by one or two dots followed by $ or /),
-// followed by anything, any number of times.
-var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
-
-// not a ^ or / followed by a dot,
-// followed by anything, any number of times.
-var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
-
-// characters that need to be escaped in RegExp.
-var reSpecials = charSet('().*{}+?[]^$\\!')
-
-// "abc" -> { a:true, b:true, c:true }
-function charSet (s) {
- return s.split('').reduce(function (set, c) {
- set[c] = true
- return set
- }, {})
-}
-
-// normalizes slashes.
-var slashSplit = /\/+/
-
-minimatch.filter = filter
-function filter (pattern, options) {
- options = options || {}
- return function (p, i, list) {
- return minimatch(p, pattern, options)
- }
-}
-
-function ext (a, b) {
- a = a || {}
- b = b || {}
- var t = {}
- Object.keys(b).forEach(function (k) {
- t[k] = b[k]
- })
- Object.keys(a).forEach(function (k) {
- t[k] = a[k]
- })
- return t
-}
-
-minimatch.defaults = function (def) {
- if (!def || !Object.keys(def).length) return minimatch
-
- var orig = minimatch
-
- var m = function minimatch (p, pattern, options) {
- return orig.minimatch(p, pattern, ext(def, options))
- }
-
- m.Minimatch = function Minimatch (pattern, options) {
- return new orig.Minimatch(pattern, ext(def, options))
- }
-
- return m
-}
-
-Minimatch.defaults = function (def) {
- if (!def || !Object.keys(def).length) return Minimatch
- return minimatch.defaults(def).Minimatch
-}
-
-function minimatch (p, pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('glob pattern string required')
- }
-
- if (!options) options = {}
-
- // shortcut: comments match nothing.
- if (!options.nocomment && pattern.charAt(0) === '#') {
- return false
- }
-
- // "" only matches ""
- if (pattern.trim() === '') return p === ''
-
- return new Minimatch(pattern, options).match(p)
-}
-
-function Minimatch (pattern, options) {
- if (!(this instanceof Minimatch)) {
- return new Minimatch(pattern, options)
- }
-
- if (typeof pattern !== 'string') {
- throw new TypeError('glob pattern string required')
- }
-
- if (!options) options = {}
- pattern = pattern.trim()
-
- // windows support: need to use /, not \
- if (path.sep !== '/') {
- pattern = pattern.split(path.sep).join('/')
- }
-
- this.options = options
- this.set = []
- this.pattern = pattern
- this.regexp = null
- this.negate = false
- this.comment = false
- this.empty = false
-
- // make the set of regexps etc.
- this.make()
-}
-
-Minimatch.prototype.debug = function () {}
-
-Minimatch.prototype.make = make
-function make () {
- // don't do it more than once.
- if (this._made) return
-
- var pattern = this.pattern
- var options = this.options
-
- // empty patterns and comments match nothing.
- if (!options.nocomment && pattern.charAt(0) === '#') {
- this.comment = true
- return
- }
- if (!pattern) {
- this.empty = true
- return
- }
-
- // step 1: figure out negation, etc.
- this.parseNegate()
-
- // step 2: expand braces
- var set = this.globSet = this.braceExpand()
-
- if (options.debug) this.debug = console.error
-
- this.debug(this.pattern, set)
-
- // step 3: now we have a set, so turn each one into a series of path-portion
- // matching patterns.
- // These will be regexps, except in the case of "**", which is
- // set to the GLOBSTAR object for globstar behavior,
- // and will not contain any / characters
- set = this.globParts = set.map(function (s) {
- return s.split(slashSplit)
- })
-
- this.debug(this.pattern, set)
-
- // glob --> regexps
- set = set.map(function (s, si, set) {
- return s.map(this.parse, this)
- }, this)
-
- this.debug(this.pattern, set)
-
- // filter out everything that didn't compile properly.
- set = set.filter(function (s) {
- return s.indexOf(false) === -1
- })
-
- this.debug(this.pattern, set)
-
- this.set = set
-}
-
-Minimatch.prototype.parseNegate = parseNegate
-function parseNegate () {
- var pattern = this.pattern
- var negate = false
- var options = this.options
- var negateOffset = 0
-
- if (options.nonegate) return
-
- for (var i = 0, l = pattern.length
- ; i < l && pattern.charAt(i) === '!'
- ; i++) {
- negate = !negate
- negateOffset++
- }
-
- if (negateOffset) this.pattern = pattern.substr(negateOffset)
- this.negate = negate
-}
-
-// Brace expansion:
-// a{b,c}d -> abd acd
-// a{b,}c -> abc ac
-// a{0..3}d -> a0d a1d a2d a3d
-// a{b,c{d,e}f}g -> abg acdfg acefg
-// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
-//
-// Invalid sets are not expanded.
-// a{2..}b -> a{2..}b
-// a{b}c -> a{b}c
-minimatch.braceExpand = function (pattern, options) {
- return braceExpand(pattern, options)
-}
-
-Minimatch.prototype.braceExpand = braceExpand
-
-function braceExpand (pattern, options) {
- if (!options) {
- if (this instanceof Minimatch) {
- options = this.options
- } else {
- options = {}
- }
- }
-
- pattern = typeof pattern === 'undefined'
- ? this.pattern : pattern
-
- if (typeof pattern === 'undefined') {
- throw new TypeError('undefined pattern')
- }
-
- if (options.nobrace ||
- !pattern.match(/\{.*\}/)) {
- // shortcut. no need to expand.
- return [pattern]
- }
-
- return expand(pattern)
-}
-
-// parse a component of the expanded set.
-// At this point, no pattern may contain "/" in it
-// so we're going to return a 2d array, where each entry is the full
-// pattern, split on '/', and then turned into a regular expression.
-// A regexp is made at the end which joins each array with an
-// escaped /, and another full one which joins each regexp with |.
-//
-// Following the lead of Bash 4.1, note that "**" only has special meaning
-// when it is the *only* thing in a path portion. Otherwise, any series
-// of * is equivalent to a single *. Globstar behavior is enabled by
-// default, and can be disabled by setting options.noglobstar.
-Minimatch.prototype.parse = parse
-var SUBPARSE = {}
-function parse (pattern, isSub) {
- if (pattern.length > 1024 * 64) {
- throw new TypeError('pattern is too long')
- }
-
- var options = this.options
-
- // shortcuts
- if (!options.noglobstar && pattern === '**') return GLOBSTAR
- if (pattern === '') return ''
-
- var re = ''
- var hasMagic = !!options.nocase
- var escaping = false
- // ? => one single character
- var patternListStack = []
- var negativeLists = []
- var stateChar
- var inClass = false
- var reClassStart = -1
- var classStart = -1
- // . and .. never match anything that doesn't start with .,
- // even when options.dot is set.
- var patternStart = pattern.charAt(0) === '.' ? '' // anything
- // not (start or / followed by . or .. followed by / or end)
- : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
- : '(?!\\.)'
- var self = this
-
- function clearStateChar () {
- if (stateChar) {
- // we had some state-tracking character
- // that wasn't consumed by this pass.
- switch (stateChar) {
- case '*':
- re += star
- hasMagic = true
- break
- case '?':
- re += qmark
- hasMagic = true
- break
- default:
- re += '\\' + stateChar
- break
- }
- self.debug('clearStateChar %j %j', stateChar, re)
- stateChar = false
- }
- }
-
- for (var i = 0, len = pattern.length, c
- ; (i < len) && (c = pattern.charAt(i))
- ; i++) {
- this.debug('%s\t%s %s %j', pattern, i, re, c)
-
- // skip over any that are escaped.
- if (escaping && reSpecials[c]) {
- re += '\\' + c
- escaping = false
- continue
- }
-
- switch (c) {
- case '/':
- // completely not allowed, even escaped.
- // Should already be path-split by now.
- return false
-
- case '\\':
- clearStateChar()
- escaping = true
- continue
-
- // the various stateChar values
- // for the "extglob" stuff.
- case '?':
- case '*':
- case '+':
- case '@':
- case '!':
- this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
-
- // all of those are literals inside a class, except that
- // the glob [!a] means [^a] in regexp
- if (inClass) {
- this.debug(' in class')
- if (c === '!' && i === classStart + 1) c = '^'
- re += c
- continue
- }
-
- // if we already have a stateChar, then it means
- // that there was something like ** or +? in there.
- // Handle the stateChar, then proceed with this one.
- self.debug('call clearStateChar %j', stateChar)
- clearStateChar()
- stateChar = c
- // if extglob is disabled, then +(asdf|foo) isn't a thing.
- // just clear the statechar *now*, rather than even diving into
- // the patternList stuff.
- if (options.noext) clearStateChar()
- continue
-
- case '(':
- if (inClass) {
- re += '('
- continue
- }
-
- if (!stateChar) {
- re += '\\('
- continue
- }
-
- patternListStack.push({
- type: stateChar,
- start: i - 1,
- reStart: re.length,
- open: plTypes[stateChar].open,
- close: plTypes[stateChar].close
- })
- // negation is (?:(?!js)[^/]*)
- re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
- this.debug('plType %j %j', stateChar, re)
- stateChar = false
- continue
-
- case ')':
- if (inClass || !patternListStack.length) {
- re += '\\)'
- continue
- }
-
- clearStateChar()
- hasMagic = true
- var pl = patternListStack.pop()
- // negation is (?:(?!js)[^/]*)
- // The others are (?:<pattern>)<type>
- re += pl.close
- if (pl.type === '!') {
- negativeLists.push(pl)
- }
- pl.reEnd = re.length
- continue
-
- case '|':
- if (inClass || !patternListStack.length || escaping) {
- re += '\\|'
- escaping = false
- continue
- }
-
- clearStateChar()
- re += '|'
- continue
-
- // these are mostly the same in regexp and glob
- case '[':
- // swallow any state-tracking char before the [
- clearStateChar()
-
- if (inClass) {
- re += '\\' + c
- continue
- }
-
- inClass = true
- classStart = i
- reClassStart = re.length
- re += c
- continue
-
- case ']':
- // a right bracket shall lose its special
- // meaning and represent itself in
- // a bracket expression if it occurs
- // first in the list. -- POSIX.2 2.8.3.2
- if (i === classStart + 1 || !inClass) {
- re += '\\' + c
- escaping = false
- continue
- }
-
- // handle the case where we left a class open.
- // "[z-a]" is valid, equivalent to "\[z-a\]"
- if (inClass) {
- // split where the last [ was, make sure we don't have
- // an invalid re. if so, re-walk the contents of the
- // would-be class to re-translate any characters that
- // were passed through as-is
- // TODO: It would probably be faster to determine this
- // without a try/catch and a new RegExp, but it's tricky
- // to do safely. For now, this is safe and works.
- var cs = pattern.substring(classStart + 1, i)
- try {
- RegExp('[' + cs + ']')
- } catch (er) {
- // not a valid class!
- var sp = this.parse(cs, SUBPARSE)
- re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
- hasMagic = hasMagic || sp[1]
- inClass = false
- continue
- }
- }
-
- // finish up the class.
- hasMagic = true
- inClass = false
- re += c
- continue
-
- default:
- // swallow any state char that wasn't consumed
- clearStateChar()
-
- if (escaping) {
- // no need
- escaping = false
- } else if (reSpecials[c]
- && !(c === '^' && inClass)) {
- re += '\\'
- }
-
- re += c
-
- } // switch
- } // for
-
- // handle the case where we left a class open.
- // "[abc" is valid, equivalent to "\[abc"
- if (inClass) {
- // split where the last [ was, and escape it
- // this is a huge pita. We now have to re-walk
- // the contents of the would-be class to re-translate
- // any characters that were passed through as-is
- cs = pattern.substr(classStart + 1)
- sp = this.parse(cs, SUBPARSE)
- re = re.substr(0, reClassStart) + '\\[' + sp[0]
- hasMagic = hasMagic || sp[1]
- }
-
- // handle the case where we had a +( thing at the *end*
- // of the pattern.
- // each pattern list stack adds 3 chars, and we need to go through
- // and escape any | chars that were passed through as-is for the regexp.
- // Go through and escape them, taking care not to double-escape any
- // | chars that were already escaped.
- for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
- var tail = re.slice(pl.reStart + pl.open.length)
- this.debug('setting tail', re, pl)
- // maybe some even number of \, then maybe 1 \, followed by a |
- tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
- if (!$2) {
- // the | isn't already escaped, so escape it.
- $2 = '\\'
- }
-
- // need to escape all those slashes *again*, without escaping the
- // one that we need for escaping the | character. As it works out,
- // escaping an even number of slashes can be done by simply repeating
- // it exactly after itself. That's why this trick works.
- //
- // I am sorry that you have to see this.
- return $1 + $1 + $2 + '|'
- })
-
- this.debug('tail=%j\n %s', tail, tail, pl, re)
- var t = pl.type === '*' ? star
- : pl.type === '?' ? qmark
- : '\\' + pl.type
-
- hasMagic = true
- re = re.slice(0, pl.reStart) + t + '\\(' + tail
- }
-
- // handle trailing things that only matter at the very end.
- clearStateChar()
- if (escaping) {
- // trailing \\
- re += '\\\\'
- }
-
- // only need to apply the nodot start if the re starts with
- // something that could conceivably capture a dot
- var addPatternStart = false
- switch (re.charAt(0)) {
- case '.':
- case '[':
- case '(': addPatternStart = true
- }
-
- // Hack to work around lack of negative lookbehind in JS
- // A pattern like: *.!(x).!(y|z) needs to ensure that a name
- // like 'a.xyz.yz' doesn't match. So, the first negative
- // lookahead, has to look ALL the way ahead, to the end of
- // the pattern.
- for (var n = negativeLists.length - 1; n > -1; n--) {
- var nl = negativeLists[n]
-
- var nlBefore = re.slice(0, nl.reStart)
- var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
- var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
- var nlAfter = re.slice(nl.reEnd)
-
- nlLast += nlAfter
-
- // Handle nested stuff like *(*.js|!(*.json)), where open parens
- // mean that we should *not* include the ) in the bit that is considered
- // "after" the negated section.
- var openParensBefore = nlBefore.split('(').length - 1
- var cleanAfter = nlAfter
- for (i = 0; i < openParensBefore; i++) {
- cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
- }
- nlAfter = cleanAfter
-
- var dollar = ''
- if (nlAfter === '' && isSub !== SUBPARSE) {
- dollar = '$'
- }
- var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
- re = newRe
- }
-
- // if the re is not "" at this point, then we need to make sure
- // it doesn't match against an empty path part.
- // Otherwise a/* will match a/, which it should not.
- if (re !== '' && hasMagic) {
- re = '(?=.)' + re
- }
-
- if (addPatternStart) {
- re = patternStart + re
- }
-
- // parsing just a piece of a larger pattern.
- if (isSub === SUBPARSE) {
- return [re, hasMagic]
- }
-
- // skip the regexp for non-magical patterns
- // unescape anything in it, though, so that it'll be
- // an exact match against a file etc.
- if (!hasMagic) {
- return globUnescape(pattern)
- }
-
- var flags = options.nocase ? 'i' : ''
- try {
- var regExp = new RegExp('^' + re + '$', flags)
- } catch (er) {
- // If it was an invalid regular expression, then it can't match
- // anything. This trick looks for a character after the end of
- // the string, which is of course impossible, except in multi-line
- // mode, but it's not a /m regex.
- return new RegExp('$.')
- }
-
- regExp._glob = pattern
- regExp._src = re
-
- return regExp
-}
-
-minimatch.makeRe = function (pattern, options) {
- return new Minimatch(pattern, options || {}).makeRe()
-}
-
-Minimatch.prototype.makeRe = makeRe
-function makeRe () {
- if (this.regexp || this.regexp === false) return this.regexp
-
- // at this point, this.set is a 2d array of partial
- // pattern strings, or "**".
- //
- // It's better to use .match(). This function shouldn't
- // be used, really, but it's pretty convenient sometimes,
- // when you just want to work with a regex.
- var set = this.set
-
- if (!set.length) {
- this.regexp = false
- return this.regexp
- }
- var options = this.options
-
- var twoStar = options.noglobstar ? star
- : options.dot ? twoStarDot
- : twoStarNoDot
- var flags = options.nocase ? 'i' : ''
-
- var re = set.map(function (pattern) {
- return pattern.map(function (p) {
- return (p === GLOBSTAR) ? twoStar
- : (typeof p === 'string') ? regExpEscape(p)
- : p._src
- }).join('\\\/')
- }).join('|')
-
- // must match entire pattern
- // ending in a * or ** will make it less strict.
- re = '^(?:' + re + ')$'
-
- // can match anything, as long as it's not this.
- if (this.negate) re = '^(?!' + re + ').*$'
-
- try {
- this.regexp = new RegExp(re, flags)
- } catch (ex) {
- this.regexp = false
- }
- return this.regexp
-}
-
-minimatch.match = function (list, pattern, options) {
- options = options || {}
- var mm = new Minimatch(pattern, options)
- list = list.filter(function (f) {
- return mm.match(f)
- })
- if (mm.options.nonull && !list.length) {
- list.push(pattern)
- }
- return list
-}
-
-Minimatch.prototype.match = match
-function match (f, partial) {
- this.debug('match', f, this.pattern)
- // short-circuit in the case of busted things.
- // comments, etc.
- if (this.comment) return false
- if (this.empty) return f === ''
-
- if (f === '/' && partial) return true
-
- var options = this.options
-
- // windows: need to use /, not \
- if (path.sep !== '/') {
- f = f.split(path.sep).join('/')
- }
-
- // treat the test path as a set of pathparts.
- f = f.split(slashSplit)
- this.debug(this.pattern, 'split', f)
-
- // just ONE of the pattern sets in this.set needs to match
- // in order for it to be valid. If negating, then just one
- // match means that we have failed.
- // Either way, return on the first hit.
-
- var set = this.set
- this.debug(this.pattern, 'set', set)
-
- // Find the basename of the path by looking for the last non-empty segment
- var filename
- var i
- for (i = f.length - 1; i >= 0; i--) {
- filename = f[i]
- if (filename) break
- }
-
- for (i = 0; i < set.length; i++) {
- var pattern = set[i]
- var file = f
- if (options.matchBase && pattern.length === 1) {
- file = [filename]
- }
- var hit = this.matchOne(file, pattern, partial)
- if (hit) {
- if (options.flipNegate) return true
- return !this.negate
- }
- }
-
- // didn't get any hits. this is success if it's a negative
- // pattern, failure otherwise.
- if (options.flipNegate) return false
- return this.negate
-}
-
-// set partial to true to test if, for example,
-// "/a/b" matches the start of "/*/b/*/d"
-// Partial means, if you run out of file before you run
-// out of pattern, then that's fine, as long as all
-// the parts match.
-Minimatch.prototype.matchOne = function (file, pattern, partial) {
- var options = this.options
-
- this.debug('matchOne',
- { 'this': this, file: file, pattern: pattern })
-
- this.debug('matchOne', file.length, pattern.length)
-
- for (var fi = 0,
- pi = 0,
- fl = file.length,
- pl = pattern.length
- ; (fi < fl) && (pi < pl)
- ; fi++, pi++) {
- this.debug('matchOne loop')
- var p = pattern[pi]
- var f = file[fi]
-
- this.debug(pattern, p, f)
-
- // should be impossible.
- // some invalid regexp stuff in the set.
- if (p === false) return false
-
- if (p === GLOBSTAR) {
- this.debug('GLOBSTAR', [pattern, p, f])
-
- // "**"
- // a/**/b/**/c would match the following:
- // a/b/x/y/z/c
- // a/x/y/z/b/c
- // a/b/x/b/x/c
- // a/b/c
- // To do this, take the rest of the pattern after
- // the **, and see if it would match the file remainder.
- // If so, return success.
- // If not, the ** "swallows" a segment, and try again.
- // This is recursively awful.
- //
- // a/**/b/**/c matching a/b/x/y/z/c
- // - a matches a
- // - doublestar
- // - matchOne(b/x/y/z/c, b/**/c)
- // - b matches b
- // - doublestar
- // - matchOne(x/y/z/c, c) -> no
- // - matchOne(y/z/c, c) -> no
- // - matchOne(z/c, c) -> no
- // - matchOne(c, c) yes, hit
- var fr = fi
- var pr = pi + 1
- if (pr === pl) {
- this.debug('** at the end')
- // a ** at the end will just swallow the rest.
- // We have found a match.
- // however, it will not swallow /.x, unless
- // options.dot is set.
- // . and .. are *never* matched by **, for explosively
- // exponential reasons.
- for (; fi < fl; fi++) {
- if (file[fi] === '.' || file[fi] === '..' ||
- (!options.dot && file[fi].charAt(0) === '.')) return false
- }
- return true
- }
-
- // ok, let's see if we can swallow whatever we can.
- while (fr < fl) {
- var swallowee = file[fr]
-
- this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
-
- // XXX remove this slice. Just pass the start index.
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
- this.debug('globstar found match!', fr, fl, swallowee)
- // found a match.
- return true
- } else {
- // can't swallow "." or ".." ever.
- // can only swallow ".foo" when explicitly asked.
- if (swallowee === '.' || swallowee === '..' ||
- (!options.dot && swallowee.charAt(0) === '.')) {
- this.debug('dot detected!', file, fr, pattern, pr)
- break
- }
-
- // ** swallows a segment, and continue.
- this.debug('globstar swallow a segment, and continue')
- fr++
- }
- }
-
- // no match was found.
- // However, in partial mode, we can't say this is necessarily over.
- // If there's more *pattern* left, then
- if (partial) {
- // ran out of file
- this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
- if (fr === fl) return true
- }
- return false
- }
-
- // something other than **
- // non-magic patterns just have to match exactly
- // patterns with magic have been turned into regexps.
- var hit
- if (typeof p === 'string') {
- if (options.nocase) {
- hit = f.toLowerCase() === p.toLowerCase()
- } else {
- hit = f === p
- }
- this.debug('string match', p, f, hit)
- } else {
- hit = f.match(p)
- this.debug('pattern match', p, f, hit)
- }
-
- if (!hit) return false
- }
-
- // Note: ending in / means that we'll get a final ""
- // at the end of the pattern. This can only match a
- // corresponding "" at the end of the file.
- // If the file ends in /, then it can only match a
- // a pattern that ends in /, unless the pattern just
- // doesn't have any more for it. But, a/b/ should *not*
- // match "a/b/*", even though "" matches against the
- // [^/]*? pattern, except in partial mode, where it might
- // simply not be reached yet.
- // However, a/b/ should still satisfy a/*
-
- // now either we fell off the end of the pattern, or we're done.
- if (fi === fl && pi === pl) {
- // ran out of pattern and filename at the same time.
- // an exact hit!
- return true
- } else if (fi === fl) {
- // ran out of file, but still had pattern left.
- // this is ok if we're doing the match as part of
- // a glob fs traversal.
- return partial
- } else if (pi === pl) {
- // ran out of pattern, still have file left.
- // this is only acceptable if we're on the very last
- // empty segment of a file with a trailing slash.
- // a/* should match a/b/
- var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
- return emptyFileEnd
- }
-
- // should be unreachable.
- throw new Error('wtf?')
-}
-
-// replace stuff like \* with *
-function globUnescape (s) {
- return s.replace(/\\(.)/g, '$1')
-}
-
-function regExpEscape (s) {
- return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
-}
diff --git a/node_modules/node-gyp/node_modules/minimatch/package.json b/node_modules/node-gyp/node_modules/minimatch/package.json
@@ -1,29 +0,0 @@
-{
- "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
- "name": "minimatch",
- "description": "a glob matcher in javascript",
- "version": "3.0.3",
- "repository": {
- "type": "git",
- "url": "git://github.com/isaacs/minimatch.git"
- },
- "main": "minimatch.js",
- "scripts": {
- "posttest": "standard minimatch.js test/*.js",
- "test": "tap test/*.js"
- },
- "engines": {
- "node": "*"
- },
- "dependencies": {
- "brace-expansion": "^1.0.0"
- },
- "devDependencies": {
- "standard": "^3.7.2",
- "tap": "^5.6.0"
- },
- "license": "ISC",
- "files": [
- "minimatch.js"
- ]
-}
diff --git a/node_modules/object-assign/index.js b/node_modules/object-assign/index.js
@@ -1,37 +1,81 @@
'use strict';
+/* eslint-disable no-unused-vars */
+var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
-function ToObject(val) {
- if (val == null) {
+function toObject(val) {
+ if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
-function ownEnumerableKeys(obj) {
- var keys = Object.getOwnPropertyNames(obj);
+function shouldUseNative() {
+ try {
+ if (!Object.assign) {
+ return false;
+ }
- if (Object.getOwnPropertySymbols) {
- keys = keys.concat(Object.getOwnPropertySymbols(obj));
- }
+ // Detect buggy property enumeration order in older V8 versions.
+
+ // https://bugs.chromium.org/p/v8/issues/detail?id=4118
+ var test1 = new String('abc'); // eslint-disable-line
+ test1[5] = 'de';
+ if (Object.getOwnPropertyNames(test1)[0] === '5') {
+ return false;
+ }
+
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
+ var test2 = {};
+ for (var i = 0; i < 10; i++) {
+ test2['_' + String.fromCharCode(i)] = i;
+ }
+ var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
+ return test2[n];
+ });
+ if (order2.join('') !== '0123456789') {
+ return false;
+ }
+
+ // https://bugs.chromium.org/p/v8/issues/detail?id=3056
+ var test3 = {};
+ 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
+ test3[letter] = letter;
+ });
+ if (Object.keys(Object.assign({}, test3)).join('') !==
+ 'abcdefghijklmnopqrst') {
+ return false;
+ }
- return keys.filter(function (key) {
- return propIsEnumerable.call(obj, key);
- });
+ return true;
+ } catch (e) {
+ // We don't expect any of the above to throw, but better to be safe.
+ return false;
+ }
}
-module.exports = Object.assign || function (target, source) {
+module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
- var keys;
- var to = ToObject(target);
+ var to = toObject(target);
+ var symbols;
for (var s = 1; s < arguments.length; s++) {
- from = arguments[s];
- keys = ownEnumerableKeys(Object(from));
+ from = Object(arguments[s]);
+
+ for (var key in from) {
+ if (hasOwnProperty.call(from, key)) {
+ to[key] = from[key];
+ }
+ }
- for (var i = 0; i < keys.length; i++) {
- to[keys[i]] = from[keys[i]];
+ if (Object.getOwnPropertySymbols) {
+ symbols = Object.getOwnPropertySymbols(from);
+ for (var i = 0; i < symbols.length; i++) {
+ if (propIsEnumerable.call(from, symbols[i])) {
+ to[symbols[i]] = from[symbols[i]];
+ }
+ }
}
}
diff --git a/node_modules/object-assign/package.json b/node_modules/object-assign/package.json
@@ -1,19 +1,20 @@
{
"name": "object-assign",
- "version": "3.0.0",
- "description": "ES6 Object.assign() ponyfill",
+ "version": "4.1.0",
+ "description": "ES2015 Object.assign() ponyfill",
"license": "MIT",
"repository": "sindresorhus/object-assign",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
- "url": "http://sindresorhus.com"
+ "url": "sindresorhus.com"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
- "test": "mocha"
+ "test": "xo && mocha",
+ "bench": "matcha bench.js"
},
"files": [
"index.js"
@@ -23,7 +24,7 @@
"assign",
"extend",
"properties",
- "es6",
+ "es2015",
"ecmascript",
"harmony",
"ponyfill",
@@ -33,6 +34,9 @@
"browser"
],
"devDependencies": {
- "mocha": "*"
+ "lodash": "^4.8.2",
+ "matcha": "^0.7.0",
+ "mocha": "*",
+ "xo": "*"
}
}
diff --git a/node_modules/object-assign/readme.md b/node_modules/object-assign/readme.md
@@ -1,13 +1,13 @@
# object-assign [](https://travis-ci.org/sindresorhus/object-assign)
-> ES6 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) ponyfill
+> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) ponyfill
> Ponyfill: A polyfill that doesn't overwrite the native method
## Install
-```sh
+```
$ npm install --save object-assign
```
@@ -15,7 +15,7 @@ $ npm install --save object-assign
## Usage
```js
-var objectAssign = require('object-assign');
+const objectAssign = require('object-assign');
objectAssign({foo: 0}, {bar: 1});
//=> {foo: 0, bar: 1}
@@ -43,9 +43,14 @@ Assigns enumerable own properties of `source` objects to the `target` object and
## Resources
-- [ES6 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign)
+- [ES2015 spec - Object.assign](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign)
+
+
+## Related
+
+- [deep-assign](https://github.com/sindresorhus/deep-assign) - Recursive `Object.assign()`
## License
-MIT © [Sindre Sorhus](http://sindresorhus.com)
+MIT © [Sindre Sorhus](https://sindresorhus.com)
diff --git a/node_modules/qs/.eslintrc b/node_modules/qs/.eslintrc
@@ -1,19 +1,19 @@
{
- "root": true,
+ "root": true,
- "extends": "@ljharb",
+ "extends": "@ljharb",
- "rules": {
- "complexity": [2, 25],
- "consistent-return": [1],
- "id-length": [2, { "min": 1, "max": 25, "properties": "never" }],
- "indent": [2, 4],
- "max-params": [2, 11],
- "max-statements": [2, 42],
- "no-extra-parens": [1],
- "no-continue": [1],
- "no-magic-numbers": 0,
- "no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"],
- "operator-linebreak": 1
- }
+ "rules": {
+ "complexity": [2, 22],
+ "consistent-return": [1],
+ "id-length": [2, { "min": 1, "max": 25, "properties": "never" }],
+ "indent": [2, 4],
+ "max-params": [2, 9],
+ "max-statements": [2, 36],
+ "no-extra-parens": [1],
+ "no-continue": [1],
+ "no-magic-numbers": 0,
+ "no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"],
+ "operator-linebreak": 1
+ }
}
diff --git a/node_modules/qs/CHANGELOG.md b/node_modules/qs/CHANGELOG.md
@@ -1,17 +1,3 @@
-## **6.3.0**
-- [New] Add support for RFC 1738 (#174, #173)
-- [New] `stringify`: Add `serializeDate` option to customize Date serialization (#159)
-- [Fix] ensure `utils.merge` handles merging two arrays
-- [Refactor] only constructors should be capitalized
-- [Refactor] capitalized var names are for constructors only
-- [Refactor] avoid using a sparse array
-- [Robustness] `formats`: cache `String#replace`
-- [Dev Deps] update `browserify`, `eslint`, `@ljharb/eslint-config`; add `safe-publish-latest`
-- [Tests] up to `node` `v6.8`, `v4.6`; improve test matrix
-- [Tests] flesh out arrayLimit/arrayFormat tests (#107)
-- [Tests] skip Object.create tests when null objects are not available
-- [Tests] Turn on eslint for test files (#175)
-
## **6.2.1**
- [Fix] ensure `key[]=x&key[]&key[]=y` results in 3, not 2, values
- [Refactor] Be explicit and use `Object.prototype.hasOwnProperty.call`
diff --git a/node_modules/qs/README.md b/node_modules/qs/README.md
@@ -39,11 +39,11 @@ assert.deepEqual(qs.parse('foo[bar]=baz'), {
});
```
-When using the `plainObjects` option the parsed value is returned as a null object, created via `Object.create(null)` and as such you should be aware that prototype methods will not exist on it and a user may set those names to whatever value they like:
+When using the `plainObjects` option the parsed value is returned as a plain object, created via `Object.create(null)` and as such you should be aware that prototype methods will not exist on it and a user may set those names to whatever value they like:
```javascript
-var nullObject = qs.parse('a[hasOwnProperty]=b', { plainObjects: true });
-assert.deepEqual(nullObject, { a: { hasOwnProperty: 'b' } });
+var plainObject = qs.parse('a[hasOwnProperty]=b', { plainObjects: true });
+assert.deepEqual(plainObject, { a: { hasOwnProperty: 'b' } });
```
By default parameters that would overwrite properties on the object prototype are ignored, if you wish to keep the data from those fields either use `plainObjects` as mentioned above, or set `allowPrototypes` to `true` which will allow user input to overwrite those properties. *WARNING* It is generally a bad idea to enable this option as it can cause problems when attempting to use the properties that have been overwritten. Always be careful with this option.
@@ -290,17 +290,6 @@ The delimiter may be overridden with stringify as well:
assert.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d');
```
-If you only want to override the serialization of `Date` objects, you can provide a `serializeDate` option:
-
-```javascript
-var date = new Date(7);
-assert.equal(qs.stringify({ a: date }), 'a=1970-01-01T00:00:00.007Z'.replace(/:/g, '%3A'));
-assert.equal(
- qs.stringify({ a: date }, { serializeDate: function (d) { return d.getTime(); } }),
- 'a=7'
-);
-```
-
Finally, you can use the `filter` option to restrict which keys will be included in the stringified output.
If you pass a function, it will be called for each key to obtain the replacement value. Otherwise, if you
pass an array, it will be used to select properties and array indices for stringification:
@@ -385,14 +374,3 @@ var decoder = require('qs-iconv/decoder')('shift_jis');
var obj = qs.parse('a=%82%B1%82%F1%82%C9%82%BF%82%CD%81I', { decoder: decoder });
assert.deepEqual(obj, { a: 'こんにちは!' });
```
-
-### RFC 3986 and RFC 1738 space encoding
-
-RFC3986 used as default option and encodes ' ' to *%20* which is backward compatible.
-In the same time, output can be stringified as per RFC1738 with ' ' equal to '+'.
-
-```
-assert.equal(qs.stringify({ a: 'b c' }), 'a=b%20c');
-assert.equal(qs.stringify({ a: 'b c' }, { format : 'RFC3986' }), 'a=b%20c');
-assert.equal(qs.stringify({ a: 'b c' }, { format : 'RFC1738' }), 'a=b+c');
-```
diff --git a/node_modules/qs/dist/qs.js b/node_modules/qs/dist/qs.js
@@ -1,53 +1,31 @@
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Qs = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
-var replace = String.prototype.replace;
-var percentTwenties = /%20/g;
+var Stringify = require('./stringify');
+var Parse = require('./parse');
module.exports = {
- 'default': 'RFC3986',
- formatters: {
- RFC1738: function (value) {
- return replace.call(value, percentTwenties, '+');
- },
- RFC3986: function (value) {
- return value;
- }
- },
- RFC1738: 'RFC1738',
- RFC3986: 'RFC3986'
-};
-
-},{}],2:[function(require,module,exports){
-'use strict';
-
-var stringify = require('./stringify');
-var parse = require('./parse');
-var formats = require('./formats');
-
-module.exports = {
- formats: formats,
- parse: parse,
- stringify: stringify
+ stringify: Stringify,
+ parse: Parse
};
-},{"./formats":1,"./parse":3,"./stringify":4}],3:[function(require,module,exports){
+},{"./parse":2,"./stringify":3}],2:[function(require,module,exports){
'use strict';
-var utils = require('./utils');
+var Utils = require('./utils');
var has = Object.prototype.hasOwnProperty;
var defaults = {
- allowDots: false,
- allowPrototypes: false,
- arrayLimit: 20,
- decoder: utils.decode,
delimiter: '&',
depth: 5,
+ arrayLimit: 20,
parameterLimit: 1000,
+ strictNullHandling: false,
plainObjects: false,
- strictNullHandling: false
+ allowPrototypes: false,
+ allowDots: false,
+ decoder: Utils.decode
};
var parseValues = function parseValues(str, options) {
@@ -169,7 +147,7 @@ module.exports = function (str, opts) {
throw new TypeError('Decoder has to be a function.');
}
- options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter;
+ options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter;
options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth;
options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit;
options.parseArrays = options.parseArrays !== false;
@@ -193,17 +171,16 @@ module.exports = function (str, opts) {
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
var newObj = parseKeys(key, tempObj[key], options);
- obj = utils.merge(obj, newObj, options);
+ obj = Utils.merge(obj, newObj, options);
}
- return utils.compact(obj);
+ return Utils.compact(obj);
};
-},{"./utils":5}],4:[function(require,module,exports){
+},{"./utils":4}],3:[function(require,module,exports){
'use strict';
-var utils = require('./utils');
-var formats = require('./formats');
+var Utils = require('./utils');
var arrayPrefixGenerators = {
brackets: function brackets(prefix) {
@@ -217,25 +194,20 @@ var arrayPrefixGenerators = {
}
};
-var toISO = Date.prototype.toISOString;
-
var defaults = {
delimiter: '&',
- encode: true,
- encoder: utils.encode,
- serializeDate: function serializeDate(date) {
- return toISO.call(date);
- },
+ strictNullHandling: false,
skipNulls: false,
- strictNullHandling: false
+ encode: true,
+ encoder: Utils.encode
};
-var stringify = function stringify(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, formatter) {
+var stringify = function stringify(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots) {
var obj = object;
if (typeof filter === 'function') {
obj = filter(prefix, obj);
} else if (obj instanceof Date) {
- obj = serializeDate(obj);
+ obj = obj.toISOString();
} else if (obj === null) {
if (strictNullHandling) {
return encoder ? encoder(prefix) : prefix;
@@ -244,11 +216,11 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNu
obj = '';
}
- if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) {
+ if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || Utils.isBuffer(obj)) {
if (encoder) {
- return [formatter(encoder(prefix)) + '=' + formatter(encoder(obj))];
+ return [encoder(prefix) + '=' + encoder(obj)];
}
- return [formatter(prefix) + '=' + formatter(String(obj))];
+ return [prefix + '=' + String(obj)];
}
var values = [];
@@ -273,33 +245,9 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNu
}
if (Array.isArray(obj)) {
- values = values.concat(stringify(
- obj[key],
- generateArrayPrefix(prefix, key),
- generateArrayPrefix,
- strictNullHandling,
- skipNulls,
- encoder,
- filter,
- sort,
- allowDots,
- serializeDate,
- formatter
- ));
+ values = values.concat(stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots));
} else {
- values = values.concat(stringify(
- obj[key],
- prefix + (allowDots ? '.' + key : '[' + key + ']'),
- generateArrayPrefix,
- strictNullHandling,
- skipNulls,
- encoder,
- filter,
- sort,
- allowDots,
- serializeDate,
- formatter
- ));
+ values = values.concat(stringify(obj[key], prefix + (allowDots ? '.' + key : '[' + key + ']'), generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots));
}
}
@@ -316,13 +264,6 @@ module.exports = function (object, opts) {
var encoder = encode ? (typeof options.encoder === 'function' ? options.encoder : defaults.encoder) : null;
var sort = typeof options.sort === 'function' ? options.sort : null;
var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;
- var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate;
- if (typeof options.format === 'undefined') {
- options.format = formats.default;
- } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) {
- throw new TypeError('Unknown format option provided.');
- }
- var formatter = formats.formatters[options.format];
var objKeys;
var filter;
@@ -334,8 +275,7 @@ module.exports = function (object, opts) {
filter = options.filter;
obj = filter('', obj);
} else if (Array.isArray(options.filter)) {
- filter = options.filter;
- objKeys = filter;
+ objKeys = filter = options.filter;
}
var keys = [];
@@ -370,40 +310,26 @@ module.exports = function (object, opts) {
continue;
}
- keys = keys.concat(stringify(
- obj[key],
- key,
- generateArrayPrefix,
- strictNullHandling,
- skipNulls,
- encoder,
- filter,
- sort,
- allowDots,
- serializeDate,
- formatter
- ));
+ keys = keys.concat(stringify(obj[key], key, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots));
}
return keys.join(delimiter);
};
-},{"./formats":1,"./utils":5}],5:[function(require,module,exports){
+},{"./utils":4}],4:[function(require,module,exports){
'use strict';
-var has = Object.prototype.hasOwnProperty;
-
var hexTable = (function () {
- var array = [];
+ var array = new Array(256);
for (var i = 0; i < 256; ++i) {
- array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
+ array[i] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();
}
return array;
}());
exports.arrayToObject = function (source, options) {
- var obj = options && options.plainObjects ? Object.create(null) : {};
+ var obj = options.plainObjects ? Object.create(null) : {};
for (var i = 0; i < source.length; ++i) {
if (typeof source[i] !== 'undefined') {
obj[i] = source[i];
@@ -439,21 +365,6 @@ exports.merge = function (target, source, options) {
mergeTarget = exports.arrayToObject(target, options);
}
- if (Array.isArray(target) && Array.isArray(source)) {
- source.forEach(function (item, i) {
- if (has.call(target, i)) {
- if (target[i] && typeof target[i] === 'object') {
- target[i] = exports.merge(target[i], item, options);
- } else {
- target.push(item);
- }
- } else {
- target[i] = item;
- }
- });
- return target;
- }
-
return Object.keys(source).reduce(function (acc, key) {
var value = source[key];
@@ -551,9 +462,10 @@ exports.compact = function (obj, references) {
}
var keys = Object.keys(obj);
- keys.forEach(function (key) {
+ for (var j = 0; j < keys.length; ++j) {
+ var key = keys[j];
obj[key] = exports.compact(obj[key], refs);
- });
+ }
return obj;
};
@@ -570,5 +482,5 @@ exports.isBuffer = function (obj) {
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
};
-},{}]},{},[2])(2)
+},{}]},{},[1])(1)
});
\ No newline at end of file
diff --git a/node_modules/qs/lib/formats.js b/node_modules/qs/lib/formats.js
@@ -1,18 +0,0 @@
-'use strict';
-
-var replace = String.prototype.replace;
-var percentTwenties = /%20/g;
-
-module.exports = {
- 'default': 'RFC3986',
- formatters: {
- RFC1738: function (value) {
- return replace.call(value, percentTwenties, '+');
- },
- RFC3986: function (value) {
- return value;
- }
- },
- RFC1738: 'RFC1738',
- RFC3986: 'RFC3986'
-};
diff --git a/node_modules/qs/lib/index.js b/node_modules/qs/lib/index.js
@@ -1,11 +1,9 @@
'use strict';
-var stringify = require('./stringify');
-var parse = require('./parse');
-var formats = require('./formats');
+var Stringify = require('./stringify');
+var Parse = require('./parse');
module.exports = {
- formats: formats,
- parse: parse,
- stringify: stringify
+ stringify: Stringify,
+ parse: Parse
};
diff --git a/node_modules/qs/lib/parse.js b/node_modules/qs/lib/parse.js
@@ -1,19 +1,19 @@
'use strict';
-var utils = require('./utils');
+var Utils = require('./utils');
var has = Object.prototype.hasOwnProperty;
var defaults = {
- allowDots: false,
- allowPrototypes: false,
- arrayLimit: 20,
- decoder: utils.decode,
delimiter: '&',
depth: 5,
+ arrayLimit: 20,
parameterLimit: 1000,
+ strictNullHandling: false,
plainObjects: false,
- strictNullHandling: false
+ allowPrototypes: false,
+ allowDots: false,
+ decoder: Utils.decode
};
var parseValues = function parseValues(str, options) {
@@ -135,7 +135,7 @@ module.exports = function (str, opts) {
throw new TypeError('Decoder has to be a function.');
}
- options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter;
+ options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter;
options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth;
options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit;
options.parseArrays = options.parseArrays !== false;
@@ -159,8 +159,8 @@ module.exports = function (str, opts) {
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
var newObj = parseKeys(key, tempObj[key], options);
- obj = utils.merge(obj, newObj, options);
+ obj = Utils.merge(obj, newObj, options);
}
- return utils.compact(obj);
+ return Utils.compact(obj);
};
diff --git a/node_modules/qs/lib/stringify.js b/node_modules/qs/lib/stringify.js
@@ -1,7 +1,6 @@
'use strict';
-var utils = require('./utils');
-var formats = require('./formats');
+var Utils = require('./utils');
var arrayPrefixGenerators = {
brackets: function brackets(prefix) {
@@ -15,25 +14,20 @@ var arrayPrefixGenerators = {
}
};
-var toISO = Date.prototype.toISOString;
-
var defaults = {
delimiter: '&',
- encode: true,
- encoder: utils.encode,
- serializeDate: function serializeDate(date) {
- return toISO.call(date);
- },
+ strictNullHandling: false,
skipNulls: false,
- strictNullHandling: false
+ encode: true,
+ encoder: Utils.encode
};
-var stringify = function stringify(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots, serializeDate, formatter) {
+var stringify = function stringify(object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots) {
var obj = object;
if (typeof filter === 'function') {
obj = filter(prefix, obj);
} else if (obj instanceof Date) {
- obj = serializeDate(obj);
+ obj = obj.toISOString();
} else if (obj === null) {
if (strictNullHandling) {
return encoder ? encoder(prefix) : prefix;
@@ -42,11 +36,11 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNu
obj = '';
}
- if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) {
+ if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || Utils.isBuffer(obj)) {
if (encoder) {
- return [formatter(encoder(prefix)) + '=' + formatter(encoder(obj))];
+ return [encoder(prefix) + '=' + encoder(obj)];
}
- return [formatter(prefix) + '=' + formatter(String(obj))];
+ return [prefix + '=' + String(obj)];
}
var values = [];
@@ -71,33 +65,9 @@ var stringify = function stringify(object, prefix, generateArrayPrefix, strictNu
}
if (Array.isArray(obj)) {
- values = values.concat(stringify(
- obj[key],
- generateArrayPrefix(prefix, key),
- generateArrayPrefix,
- strictNullHandling,
- skipNulls,
- encoder,
- filter,
- sort,
- allowDots,
- serializeDate,
- formatter
- ));
+ values = values.concat(stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots));
} else {
- values = values.concat(stringify(
- obj[key],
- prefix + (allowDots ? '.' + key : '[' + key + ']'),
- generateArrayPrefix,
- strictNullHandling,
- skipNulls,
- encoder,
- filter,
- sort,
- allowDots,
- serializeDate,
- formatter
- ));
+ values = values.concat(stringify(obj[key], prefix + (allowDots ? '.' + key : '[' + key + ']'), generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots));
}
}
@@ -114,13 +84,6 @@ module.exports = function (object, opts) {
var encoder = encode ? (typeof options.encoder === 'function' ? options.encoder : defaults.encoder) : null;
var sort = typeof options.sort === 'function' ? options.sort : null;
var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;
- var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate;
- if (typeof options.format === 'undefined') {
- options.format = formats.default;
- } else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) {
- throw new TypeError('Unknown format option provided.');
- }
- var formatter = formats.formatters[options.format];
var objKeys;
var filter;
@@ -132,8 +95,7 @@ module.exports = function (object, opts) {
filter = options.filter;
obj = filter('', obj);
} else if (Array.isArray(options.filter)) {
- filter = options.filter;
- objKeys = filter;
+ objKeys = filter = options.filter;
}
var keys = [];
@@ -168,19 +130,7 @@ module.exports = function (object, opts) {
continue;
}
- keys = keys.concat(stringify(
- obj[key],
- key,
- generateArrayPrefix,
- strictNullHandling,
- skipNulls,
- encoder,
- filter,
- sort,
- allowDots,
- serializeDate,
- formatter
- ));
+ keys = keys.concat(stringify(obj[key], key, generateArrayPrefix, strictNullHandling, skipNulls, encoder, filter, sort, allowDots));
}
return keys.join(delimiter);
diff --git a/node_modules/qs/lib/utils.js b/node_modules/qs/lib/utils.js
@@ -1,18 +1,16 @@
'use strict';
-var has = Object.prototype.hasOwnProperty;
-
var hexTable = (function () {
- var array = [];
+ var array = new Array(256);
for (var i = 0; i < 256; ++i) {
- array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
+ array[i] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase();
}
return array;
}());
exports.arrayToObject = function (source, options) {
- var obj = options && options.plainObjects ? Object.create(null) : {};
+ var obj = options.plainObjects ? Object.create(null) : {};
for (var i = 0; i < source.length; ++i) {
if (typeof source[i] !== 'undefined') {
obj[i] = source[i];
@@ -48,21 +46,6 @@ exports.merge = function (target, source, options) {
mergeTarget = exports.arrayToObject(target, options);
}
- if (Array.isArray(target) && Array.isArray(source)) {
- source.forEach(function (item, i) {
- if (has.call(target, i)) {
- if (target[i] && typeof target[i] === 'object') {
- target[i] = exports.merge(target[i], item, options);
- } else {
- target.push(item);
- }
- } else {
- target[i] = item;
- }
- });
- return target;
- }
-
return Object.keys(source).reduce(function (acc, key) {
var value = source[key];
@@ -160,9 +143,10 @@ exports.compact = function (obj, references) {
}
var keys = Object.keys(obj);
- keys.forEach(function (key) {
+ for (var j = 0; j < keys.length; ++j) {
+ var key = keys[j];
obj[key] = exports.compact(obj[key], refs);
- });
+ }
return obj;
};
diff --git a/node_modules/qs/package.json b/node_modules/qs/package.json
@@ -2,7 +2,7 @@
"name": "qs",
"description": "A querystring parser that supports nesting and arrays, with a depth limit",
"homepage": "https://github.com/ljharb/qs",
- "version": "6.3.0",
+ "version": "6.2.1",
"repository": {
"type": "git",
"url": "https://github.com/ljharb/qs.git"
@@ -24,27 +24,26 @@
},
"dependencies": {},
"devDependencies": {
- "@ljharb/eslint-config": "^8.0.0",
- "browserify": "^13.1.0",
+ "browserify": "^13.0.1",
+ "tape": "^4.6.0",
"covert": "^1.1.0",
- "eslint": "^3.8.0",
- "evalmd": "^0.0.17",
- "iconv-lite": "^0.4.13",
"mkdirp": "^0.5.1",
+ "eslint": "^3.1.0",
+ "@ljharb/eslint-config": "^6.0.0",
"parallelshell": "^2.0.0",
+ "iconv-lite": "^0.4.13",
"qs-iconv": "^1.0.3",
- "safe-publish-latest": "^1.1.1",
- "tape": "^4.6.2"
+ "evalmd": "^0.0.17"
},
"scripts": {
- "prepublish": "safe-publish-latest && npm run dist",
"pretest": "npm run --silent readme && npm run --silent lint",
"test": "npm run --silent coverage",
"tests-only": "node test",
"readme": "evalmd README.md",
- "lint": "eslint lib/*.js test/*.js",
+ "lint": "eslint lib/*.js text/*.js",
"coverage": "covert test",
- "dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js"
+ "dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js",
+ "prepublish": "npm run dist"
},
"license": "BSD-3-Clause"
}
diff --git a/node_modules/qs/test/.eslintrc b/node_modules/qs/test/.eslintrc
@@ -1,9 +0,0 @@
-{
- "rules": {
- "max-lines": 0,
- "max-nested-callbacks": [2, 3],
- "max-statements": 0,
- "no-extend-native": 0,
- "sort-keys": 1
- }
-}
diff --git a/node_modules/qs/test/index.js b/node_modules/qs/test/index.js
@@ -1,5 +1,3 @@
-'use strict';
-
require('./parse');
require('./stringify');
diff --git a/node_modules/qs/test/parse.js b/node_modules/qs/test/parse.js
@@ -6,7 +6,7 @@ var iconv = require('iconv-lite');
test('parse()', function (t) {
t.test('parses a simple string', function (st) {
- st.deepEqual(qs.parse('0=foo'), { 0: 'foo' });
+ st.deepEqual(qs.parse('0=foo'), { '0': 'foo' });
st.deepEqual(qs.parse('foo=c++'), { foo: 'c ' });
st.deepEqual(qs.parse('a[>=]=23'), { a: { '>=': '23' } });
st.deepEqual(qs.parse('a[<=>]==23'), { a: { '<=>': '=23' } });
@@ -64,15 +64,8 @@ test('parse()', function (t) {
st.deepEqual(qs.parse('a[]=b&a=c'), { a: ['b', 'c'] });
st.deepEqual(qs.parse('a[0]=b&a=c'), { a: ['b', 'c'] });
st.deepEqual(qs.parse('a=b&a[0]=c'), { a: ['b', 'c'] });
-
- st.deepEqual(qs.parse('a[1]=b&a=c', { arrayLimit: 20 }), { a: ['b', 'c'] });
- st.deepEqual(qs.parse('a[]=b&a=c', { arrayLimit: 0 }), { a: ['b', 'c'] });
- st.deepEqual(qs.parse('a[]=b&a=c'), { a: ['b', 'c'] });
-
- st.deepEqual(qs.parse('a=b&a[1]=c', { arrayLimit: 20 }), { a: ['b', 'c'] });
- st.deepEqual(qs.parse('a=b&a[]=c', { arrayLimit: 0 }), { a: ['b', 'c'] });
- st.deepEqual(qs.parse('a=b&a[]=c'), { a: ['b', 'c'] });
-
+ st.deepEqual(qs.parse('a[1]=b&a=c'), { a: ['b', 'c'] });
+ st.deepEqual(qs.parse('a=b&a[1]=c'), { a: ['b', 'c'] });
st.end();
});
@@ -85,15 +78,13 @@ test('parse()', function (t) {
t.test('allows to specify array indices', function (st) {
st.deepEqual(qs.parse('a[1]=c&a[0]=b&a[2]=d'), { a: ['b', 'c', 'd'] });
st.deepEqual(qs.parse('a[1]=c&a[0]=b'), { a: ['b', 'c'] });
- st.deepEqual(qs.parse('a[1]=c', { arrayLimit: 20 }), { a: ['c'] });
- st.deepEqual(qs.parse('a[1]=c', { arrayLimit: 0 }), { a: { 1: 'c' } });
st.deepEqual(qs.parse('a[1]=c'), { a: ['c'] });
st.end();
});
- t.test('limits specific array indices to arrayLimit', function (st) {
- st.deepEqual(qs.parse('a[20]=a', { arrayLimit: 20 }), { a: ['a'] });
- st.deepEqual(qs.parse('a[21]=a', { arrayLimit: 20 }), { a: { 21: 'a' } });
+ t.test('limits specific array indices to 20', function (st) {
+ st.deepEqual(qs.parse('a[20]=a'), { a: ['a'] });
+ st.deepEqual(qs.parse('a[21]=a'), { a: { '21': 'a' } });
st.end();
});
@@ -124,17 +115,17 @@ test('parse()', function (t) {
});
t.test('transforms arrays to objects', function (st) {
- st.deepEqual(qs.parse('foo[0]=bar&foo[bad]=baz'), { foo: { 0: 'bar', bad: 'baz' } });
- st.deepEqual(qs.parse('foo[bad]=baz&foo[0]=bar'), { foo: { bad: 'baz', 0: 'bar' } });
- st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar'), { foo: { bad: 'baz', 0: 'bar' } });
- st.deepEqual(qs.parse('foo[]=bar&foo[bad]=baz'), { foo: { 0: 'bar', bad: 'baz' } });
- st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar&foo[]=foo'), { foo: { bad: 'baz', 0: 'bar', 1: 'foo' } });
+ st.deepEqual(qs.parse('foo[0]=bar&foo[bad]=baz'), { foo: { '0': 'bar', bad: 'baz' } });
+ st.deepEqual(qs.parse('foo[bad]=baz&foo[0]=bar'), { foo: { bad: 'baz', '0': 'bar' } });
+ st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar'), { foo: { bad: 'baz', '0': 'bar' } });
+ st.deepEqual(qs.parse('foo[]=bar&foo[bad]=baz'), { foo: { '0': 'bar', bad: 'baz' } });
+ st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar&foo[]=foo'), { foo: { bad: 'baz', '0': 'bar', '1': 'foo' } });
st.deepEqual(qs.parse('foo[0][a]=a&foo[0][b]=b&foo[1][a]=aa&foo[1][b]=bb'), { foo: [{ a: 'a', b: 'b' }, { a: 'aa', b: 'bb' }] });
- st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c', { allowPrototypes: false }), { a: { 0: 'b', c: true, t: 'u' } });
- st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c', { allowPrototypes: true }), { a: { 0: 'b', t: 'u', hasOwnProperty: 'c' } });
- st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y', { allowPrototypes: false }), { a: { 0: 'b', 1: 'c', x: 'y' } });
- st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y', { allowPrototypes: true }), { a: { 0: 'b', hasOwnProperty: 'c', x: 'y' } });
+ st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c', { allowPrototypes: false }), { a: { '0': 'b', c: true, t: 'u' } });
+ st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c', { allowPrototypes: true }), { a: { '0': 'b', t: 'u', hasOwnProperty: 'c' } });
+ st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y', { allowPrototypes: false }), { a: { '0': 'b', '1': 'c', x: 'y' } });
+ st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y', { allowPrototypes: true }), { a: { '0': 'b', hasOwnProperty: 'c', x: 'y' } });
st.end();
});
@@ -144,10 +135,10 @@ test('parse()', function (t) {
st.deepEqual(qs.parse('foo[0][0].baz=bar&fool.bad=baz', { allowDots: true }), { foo: [[{ baz: 'bar' }]], fool: { bad: 'baz' } });
st.deepEqual(qs.parse('foo[0].baz[0]=15&foo[0].bar=2', { allowDots: true }), { foo: [{ baz: ['15'], bar: '2' }] });
st.deepEqual(qs.parse('foo[0].baz[0]=15&foo[0].baz[1]=16&foo[0].bar=2', { allowDots: true }), { foo: [{ baz: ['15', '16'], bar: '2' }] });
- st.deepEqual(qs.parse('foo.bad=baz&foo[0]=bar', { allowDots: true }), { foo: { bad: 'baz', 0: 'bar' } });
- st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar', { allowDots: true }), { foo: { bad: 'baz', 0: 'bar' } });
- st.deepEqual(qs.parse('foo[]=bar&foo.bad=baz', { allowDots: true }), { foo: { 0: 'bar', bad: 'baz' } });
- st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar&foo[]=foo', { allowDots: true }), { foo: { bad: 'baz', 0: 'bar', 1: 'foo' } });
+ st.deepEqual(qs.parse('foo.bad=baz&foo[0]=bar', { allowDots: true }), { foo: { bad: 'baz', '0': 'bar' } });
+ st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar', { allowDots: true }), { foo: { bad: 'baz', '0': 'bar' } });
+ st.deepEqual(qs.parse('foo[]=bar&foo.bad=baz', { allowDots: true }), { foo: { '0': 'bar', bad: 'baz' } });
+ st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar&foo[]=foo', { allowDots: true }), { foo: { bad: 'baz', '0': 'bar', '1': 'foo' } });
st.deepEqual(qs.parse('foo[0].a=a&foo[0].b=b&foo[1].a=aa&foo[1].b=bb', { allowDots: true }), { foo: [{ a: 'a', b: 'b' }, { a: 'aa', b: 'bb' }] });
st.end();
});
@@ -155,7 +146,7 @@ test('parse()', function (t) {
t.deepEqual(qs.parse('a[b]=c&a=d'), { a: { b: 'c', d: true } }, 'can add keys to objects');
t.test('correctly prunes undefined values when converting an array to an object', function (st) {
- st.deepEqual(qs.parse('a[2]=b&a[99999999]=c'), { a: { 2: 'b', 99999999: 'c' } });
+ st.deepEqual(qs.parse('a[2]=b&a[99999999]=c'), { a: { '2': 'b', '99999999': 'c' } });
st.end();
});
@@ -167,7 +158,7 @@ test('parse()', function (t) {
});
t.test('doesn\'t produce empty keys', function (st) {
- st.deepEqual(qs.parse('_r=1&'), { _r: '1' });
+ st.deepEqual(qs.parse('_r=1&'), { '_r': '1' });
st.end();
});
@@ -218,10 +209,10 @@ test('parse()', function (t) {
});
t.test('compacts sparse arrays', function (st) {
- st.deepEqual(qs.parse('a[10]=1&a[2]=2', { arrayLimit: 20 }), { a: ['2', '1'] });
- st.deepEqual(qs.parse('a[1][b][2][c]=1', { arrayLimit: 20 }), { a: [{ b: [{ c: '1' }] }] });
- st.deepEqual(qs.parse('a[1][2][3][c]=1', { arrayLimit: 20 }), { a: [[[{ c: '1' }]]] });
- st.deepEqual(qs.parse('a[1][2][3][c][1]=1', { arrayLimit: 20 }), { a: [[[{ c: ['1'] }]]] });
+ st.deepEqual(qs.parse('a[10]=1&a[2]=2'), { a: ['2', '1'] });
+ st.deepEqual(qs.parse('a[1][b][2][c]=1'), { a: [{ b: [{ c: '1' }] }] });
+ st.deepEqual(qs.parse('a[1][2][3][c]=1'), { a: [[[{ c: '1' }]]] });
+ st.deepEqual(qs.parse('a[1][2][3][c][1]=1'), { a: [[[{ c: ['1'] }]]] });
st.end();
});
@@ -238,8 +229,8 @@ test('parse()', function (t) {
});
t.test('continues parsing when no parent is found', function (st) {
- st.deepEqual(qs.parse('[]=&a=b'), { 0: '', a: 'b' });
- st.deepEqual(qs.parse('[]&a=b', { strictNullHandling: true }), { 0: null, a: 'b' });
+ st.deepEqual(qs.parse('[]=&a=b'), { '0': '', a: 'b' });
+ st.deepEqual(qs.parse('[]&a=b', { strictNullHandling: true }), { '0': null, a: 'b' });
st.deepEqual(qs.parse('[foo]=bar'), { foo: 'bar' });
st.end();
});
@@ -250,9 +241,7 @@ test('parse()', function (t) {
str = str + '&' + str;
}
- st.doesNotThrow(function () {
- qs.parse(str);
- });
+ st.doesNotThrow(function () { qs.parse(str); });
st.end();
});
@@ -295,14 +284,14 @@ test('parse()', function (t) {
});
t.test('allows overriding array limit', function (st) {
- st.deepEqual(qs.parse('a[0]=b', { arrayLimit: -1 }), { a: { 0: 'b' } });
+ st.deepEqual(qs.parse('a[0]=b', { arrayLimit: -1 }), { a: { '0': 'b' } });
st.deepEqual(qs.parse('a[-1]=b', { arrayLimit: -1 }), { a: { '-1': 'b' } });
- st.deepEqual(qs.parse('a[0]=b&a[1]=c', { arrayLimit: 0 }), { a: { 0: 'b', 1: 'c' } });
+ st.deepEqual(qs.parse('a[0]=b&a[1]=c', { arrayLimit: 0 }), { a: { '0': 'b', '1': 'c' } });
st.end();
});
t.test('allows disabling array parsing', function (st) {
- st.deepEqual(qs.parse('a[0]=b&a[1]=c', { parseArrays: false }), { a: { 0: 'b', 1: 'c' } });
+ st.deepEqual(qs.parse('a[0]=b&a[1]=c', { parseArrays: false }), { a: { '0': 'b', '1': 'c' } });
st.end();
});
@@ -346,13 +335,13 @@ test('parse()', function (t) {
t.test('parses an object and not child values', function (st) {
var input = {
- 'user[name]': { 'pop[bob]': { test: 3 } },
+ 'user[name]': { 'pop[bob]': { 'test': 3 } },
'user[email]': null
};
var expected = {
user: {
- name: { 'pop[bob]': { test: 3 } },
+ name: { 'pop[bob]': { 'test': 3 } },
email: null
}
};
@@ -390,7 +379,7 @@ test('parse()', function (t) {
st.end();
});
- t.test('parses null objects correctly', { skip: !Object.create }, function (st) {
+ t.test('parses plain objects correctly', function (st) {
var a = Object.create(null);
a.b = 'c';
@@ -419,7 +408,7 @@ test('parse()', function (t) {
st.end();
});
- t.test('can return null objects', { skip: !Object.create }, function (st) {
+ t.test('can return plain objects', function (st) {
var expected = Object.create(null);
expected.a = Object.create(null);
expected.a.b = 'c';
@@ -428,7 +417,7 @@ test('parse()', function (t) {
st.deepEqual(qs.parse(null, { plainObjects: true }), Object.create(null));
var expectedArray = Object.create(null);
expectedArray.a = Object.create(null);
- expectedArray.a[0] = 'b';
+ expectedArray.a['0'] = 'b';
expectedArray.a.c = 'd';
st.deepEqual(qs.parse('a[]=b&a[c]=d', { plainObjects: true }), expectedArray);
st.end();
@@ -437,12 +426,13 @@ test('parse()', function (t) {
t.test('can parse with custom encoding', function (st) {
st.deepEqual(qs.parse('%8c%a7=%91%e5%8d%e3%95%7b', {
decoder: function (str) {
- var reg = /%([0-9A-F]{2})/ig;
+ var reg = /\%([0-9A-F]{2})/ig;
var result = [];
- var parts = reg.exec(str);
- while (parts) {
+ var parts;
+ var last = 0;
+ while (parts = reg.exec(str)) {
result.push(parseInt(parts[1], 16));
- parts = reg.exec(str);
+ last = parts.index + parts[0].length;
}
return iconv.decode(new Buffer(result), 'shift_jis').toString();
}
@@ -452,7 +442,9 @@ test('parse()', function (t) {
t.test('throws error with wrong decoder', function (st) {
st.throws(function () {
- qs.parse({}, { decoder: 'string' });
+ qs.parse({}, {
+ decoder: 'string'
+ });
}, new TypeError('Decoder has to be a function.'));
st.end();
});
diff --git a/node_modules/qs/test/stringify.js b/node_modules/qs/test/stringify.js
@@ -30,21 +30,7 @@ test('stringify()', function (t) {
});
t.test('stringifies an array value', function (st) {
- st.equal(
- qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'indices' }),
- 'a%5B0%5D=b&a%5B1%5D=c&a%5B2%5D=d',
- 'indices => indices'
- );
- st.equal(
- qs.stringify({ a: ['b', 'c', 'd'] }, { arrayFormat: 'brackets' }),
- 'a%5B%5D=b&a%5B%5D=c&a%5B%5D=d',
- 'brackets => brackets'
- );
- st.equal(
- qs.stringify({ a: ['b', 'c', 'd'] }),
- 'a%5B0%5D=b&a%5B1%5D=c&a%5B2%5D=d',
- 'default => indices'
- );
+ st.equal(qs.stringify({ a: ['b', 'c', 'd'] }), 'a%5B0%5D=b&a%5B1%5D=c&a%5B2%5D=d');
st.end();
});
@@ -53,6 +39,7 @@ test('stringify()', function (t) {
st.end();
});
+
t.test('omits nested nulls when asked', function (st) {
st.equal(qs.stringify({ a: { b: 'c', d: null } }, { skipNulls: true }), 'a%5Bb%5D=c');
st.end();
@@ -64,149 +51,29 @@ test('stringify()', function (t) {
});
t.test('stringifies a nested array value', function (st) {
- st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { arrayFormat: 'indices' }), 'a%5Bb%5D%5B0%5D=c&a%5Bb%5D%5B1%5D=d');
- st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { arrayFormat: 'brackets' }), 'a%5Bb%5D%5B%5D=c&a%5Bb%5D%5B%5D=d');
st.equal(qs.stringify({ a: { b: ['c', 'd'] } }), 'a%5Bb%5D%5B0%5D=c&a%5Bb%5D%5B1%5D=d');
st.end();
});
t.test('stringifies a nested array value with dots notation', function (st) {
- st.equal(
- qs.stringify(
- { a: { b: ['c', 'd'] } },
- { allowDots: true, encode: false, arrayFormat: 'indices' }
- ),
- 'a.b[0]=c&a.b[1]=d',
- 'indices: stringifies with dots + indices'
- );
- st.equal(
- qs.stringify(
- { a: { b: ['c', 'd'] } },
- { allowDots: true, encode: false, arrayFormat: 'brackets' }
- ),
- 'a.b[]=c&a.b[]=d',
- 'brackets: stringifies with dots + brackets'
- );
- st.equal(
- qs.stringify(
- { a: { b: ['c', 'd'] } },
- { allowDots: true, encode: false }
- ),
- 'a.b[0]=c&a.b[1]=d',
- 'default: stringifies with dots + indices'
- );
+ st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { allowDots: true, encode: false }), 'a.b[0]=c&a.b[1]=d');
st.end();
});
t.test('stringifies an object inside an array', function (st) {
- st.equal(
- qs.stringify({ a: [{ b: 'c' }] }, { arrayFormat: 'indices' }),
- 'a%5B0%5D%5Bb%5D=c',
- 'indices => brackets'
- );
- st.equal(
- qs.stringify({ a: [{ b: 'c' }] }, { arrayFormat: 'brackets' }),
- 'a%5B%5D%5Bb%5D=c',
- 'brackets => brackets'
- );
- st.equal(
- qs.stringify({ a: [{ b: 'c' }] }),
- 'a%5B0%5D%5Bb%5D=c',
- 'default => indices'
- );
-
- st.equal(
- qs.stringify({ a: [{ b: { c: [1] } }] }, { arrayFormat: 'indices' }),
- 'a%5B0%5D%5Bb%5D%5Bc%5D%5B0%5D=1',
- 'indices => indices'
- );
-
- st.equal(
- qs.stringify({ a: [{ b: { c: [1] } }] }, { arrayFormat: 'brackets' }),
- 'a%5B%5D%5Bb%5D%5Bc%5D%5B%5D=1',
- 'brackets => brackets'
- );
-
- st.equal(
- qs.stringify({ a: [{ b: { c: [1] } }] }),
- 'a%5B0%5D%5Bb%5D%5Bc%5D%5B0%5D=1',
- 'default => indices'
- );
-
+ st.equal(qs.stringify({ a: [{ b: 'c' }] }), 'a%5B0%5D%5Bb%5D=c');
+ st.equal(qs.stringify({ a: [{ b: { c: [1] } }] }), 'a%5B0%5D%5Bb%5D%5Bc%5D%5B0%5D=1');
st.end();
});
t.test('stringifies an array with mixed objects and primitives', function (st) {
- st.equal(
- qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encode: false, arrayFormat: 'indices' }),
- 'a[0][b]=1&a[1]=2&a[2]=3',
- 'indices => indices'
- );
- st.equal(
- qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encode: false, arrayFormat: 'brackets' }),
- 'a[][b]=1&a[]=2&a[]=3',
- 'brackets => brackets'
- );
- st.equal(
- qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encode: false }),
- 'a[0][b]=1&a[1]=2&a[2]=3',
- 'default => indices'
- );
-
+ st.equal(qs.stringify({ a: [{ b: 1 }, 2, 3] }, { encode: false }), 'a[0][b]=1&a[1]=2&a[2]=3');
st.end();
});
t.test('stringifies an object inside an array with dots notation', function (st) {
- st.equal(
- qs.stringify(
- { a: [{ b: 'c' }] },
- { allowDots: true, encode: false, arrayFormat: 'indices' }
- ),
- 'a[0].b=c',
- 'indices => indices'
- );
- st.equal(
- qs.stringify(
- { a: [{ b: 'c' }] },
- { allowDots: true, encode: false, arrayFormat: 'brackets' }
- ),
- 'a[].b=c',
- 'brackets => brackets'
- );
- st.equal(
- qs.stringify(
- { a: [{ b: 'c' }] },
- { allowDots: true, encode: false }
- ),
- 'a[0].b=c',
- 'default => indices'
- );
-
- st.equal(
- qs.stringify(
- { a: [{ b: { c: [1] } }] },
- { allowDots: true, encode: false, arrayFormat: 'indices' }
- ),
- 'a[0].b.c[0]=1',
- 'indices => indices'
- );
- st.equal(
- qs.stringify(
- { a: [{ b: { c: [1] } }] },
- { allowDots: true, encode: false, arrayFormat: 'brackets' }
- ),
- 'a[].b.c[]=1',
- 'brackets => brackets'
- );
- st.equal(
- qs.stringify(
- { a: [{ b: { c: [1] } }] },
- { allowDots: true, encode: false }
- ),
- 'a[0].b.c[0]=1',
- 'default => indices'
- );
-
+ st.equal(qs.stringify({ a: [{ b: 'c' }] }, { allowDots: true, encode: false }), 'a[0].b=c');
+ st.equal(qs.stringify({ a: [{ b: { c: [1] } }] }, { allowDots: true, encode: false }), 'a[0].b.c[0]=1');
st.end();
});
@@ -259,7 +126,7 @@ test('stringify()', function (t) {
st.end();
});
- t.test('stringifies a null object', { skip: !Object.create }, function (st) {
+ t.test('stringifies an empty object', function (st) {
var obj = Object.create(null);
obj.a = 'b';
st.equal(qs.stringify(obj), 'a=b');
@@ -274,8 +141,10 @@ test('stringify()', function (t) {
st.end();
});
- t.test('stringifies an object with a null object as a child', { skip: !Object.create }, function (st) {
- var obj = { a: Object.create(null) };
+ t.test('stringifies an object with an empty object as a child', function (st) {
+ var obj = {
+ a: Object.create(null)
+ };
obj.a.b = 'c';
st.equal(qs.stringify(obj), 'a%5Bb%5D=c');
@@ -347,32 +216,7 @@ test('stringify()', function (t) {
t.test('selects properties when filter=array', function (st) {
st.equal(qs.stringify({ a: 'b' }, { filter: ['a'] }), 'a=b');
st.equal(qs.stringify({ a: 1 }, { filter: [] }), '');
-
- st.equal(
- qs.stringify(
- { a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' },
- { filter: ['a', 'b', 0, 2], arrayFormat: 'indices' }
- ),
- 'a%5Bb%5D%5B0%5D=1&a%5Bb%5D%5B2%5D=3',
- 'indices => indices'
- );
- st.equal(
- qs.stringify(
- { a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' },
- { filter: ['a', 'b', 0, 2], arrayFormat: 'brackets' }
- ),
- 'a%5Bb%5D%5B%5D=1&a%5Bb%5D%5B%5D=3',
- 'brackets => brackets'
- );
- st.equal(
- qs.stringify(
- { a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' },
- { filter: ['a', 'b', 0, 2] }
- ),
- 'a%5Bb%5D%5B0%5D=1&a%5Bb%5D%5B2%5D=3',
- 'default => indices'
- );
-
+ st.equal(qs.stringify({ a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' }, { filter: ['a', 'b', 0, 2] }), 'a%5Bb%5D%5B0%5D=1&a%5Bb%5D%5B2%5D=3');
st.end();
});
@@ -380,7 +224,7 @@ test('stringify()', function (t) {
var calls = 0;
var obj = { a: 'b', c: 'd', e: { f: new Date(1257894000000) } };
var filterFunc = function (prefix, value) {
- calls += 1;
+ calls++;
if (calls === 1) {
st.equal(prefix, '', 'prefix is empty');
st.equal(value, obj);
@@ -406,44 +250,28 @@ test('stringify()', function (t) {
});
t.test('can sort the keys', function (st) {
- var sort = function (a, b) {
- return a.localeCompare(b);
- };
+ var sort = function (a, b) { return a.localeCompare(b); };
st.equal(qs.stringify({ a: 'c', z: 'y', b: 'f' }, { sort: sort }), 'a=c&b=f&z=y');
st.equal(qs.stringify({ a: 'c', z: { j: 'a', i: 'b' }, b: 'f' }, { sort: sort }), 'a=c&b=f&z%5Bi%5D=b&z%5Bj%5D=a');
st.end();
});
t.test('can sort the keys at depth 3 or more too', function (st) {
- var sort = function (a, b) {
- return a.localeCompare(b);
- };
- st.equal(
- qs.stringify(
- { a: 'a', z: { zj: { zjb: 'zjb', zja: 'zja' }, zi: { zib: 'zib', zia: 'zia' } }, b: 'b' },
- { sort: sort, encode: false }
- ),
- 'a=a&b=b&z[zi][zia]=zia&z[zi][zib]=zib&z[zj][zja]=zja&z[zj][zjb]=zjb'
- );
- st.equal(
- qs.stringify(
- { a: 'a', z: { zj: { zjb: 'zjb', zja: 'zja' }, zi: { zib: 'zib', zia: 'zia' } }, b: 'b' },
- { sort: null, encode: false }
- ),
- 'a=a&z[zj][zjb]=zjb&z[zj][zja]=zja&z[zi][zib]=zib&z[zi][zia]=zia&b=b'
- );
+ var sort = function (a, b) { return a.localeCompare(b); };
+ st.equal(qs.stringify({ a: 'a', z: { zj: {zjb: 'zjb', zja: 'zja'}, zi: {zib: 'zib', zia: 'zia'} }, b: 'b' }, { sort: sort, encode: false }), 'a=a&b=b&z[zi][zia]=zia&z[zi][zib]=zib&z[zj][zja]=zja&z[zj][zjb]=zjb');
+ st.equal(qs.stringify({ a: 'a', z: { zj: {zjb: 'zjb', zja: 'zja'}, zi: {zib: 'zib', zia: 'zia'} }, b: 'b' }, { sort: null, encode: false }), 'a=a&z[zj][zjb]=zjb&z[zj][zja]=zja&z[zi][zib]=zib&z[zi][zia]=zia&b=b');
st.end();
});
t.test('can stringify with custom encoding', function (st) {
- st.equal(qs.stringify({ 県: '大阪府', '': '' }, {
+ st.equal(qs.stringify({ 県: '大阪府', '': ''}, {
encoder: function (str) {
if (str.length === 0) {
return '';
}
var buf = iconv.encode(str, 'shiftjis');
var result = [];
- for (var i = 0; i < buf.length; ++i) {
+ for (var i=0; i < buf.length; ++i) {
result.push(buf.readUInt8(i).toString(16));
}
return '%' + result.join('%');
@@ -454,12 +282,16 @@ test('stringify()', function (t) {
t.test('throws error with wrong encoder', function (st) {
st.throws(function () {
- qs.stringify({}, { encoder: 'string' });
+ qs.stringify({}, {
+ encoder: 'string'
+ });
}, new TypeError('Encoder has to be a function.'));
st.end();
});
- t.test('can use custom encoder for a buffer object', { skip: typeof Buffer === 'undefined' }, function (st) {
+ t.test('can use custom encoder for a buffer object', {
+ skip: typeof Buffer === 'undefined'
+ }, function (st) {
st.equal(qs.stringify({ a: new Buffer([1]) }, {
encoder: function (buffer) {
if (typeof buffer === 'string') {
@@ -470,69 +302,4 @@ test('stringify()', function (t) {
}), 'a=b');
st.end();
});
-
- t.test('serializeDate option', function (st) {
- var date = new Date();
- st.equal(
- qs.stringify({ a: date }),
- 'a=' + date.toISOString().replace(/:/g, '%3A'),
- 'default is toISOString'
- );
-
- var mutatedDate = new Date();
- mutatedDate.toISOString = function () {
- throw new SyntaxError();
- };
- st.throws(function () {
- mutatedDate.toISOString();
- }, SyntaxError);
- st.equal(
- qs.stringify({ a: mutatedDate }),
- 'a=' + Date.prototype.toISOString.call(mutatedDate).replace(/:/g, '%3A'),
- 'toISOString works even when method is not locally present'
- );
-
- var specificDate = new Date(6);
- st.equal(
- qs.stringify(
- { a: specificDate },
- { serializeDate: function (d) { return d.getTime() * 7; } }
- ),
- 'a=42',
- 'custom serializeDate function called'
- );
-
- st.end();
- });
-
- t.test('RFC 1738 spaces serialization', function (st) {
- st.equal(qs.stringify({ a: 'b c' }, { format: qs.formats.RFC1738 }), 'a=b+c');
- st.equal(qs.stringify({ 'a b': 'c d' }, { format: qs.formats.RFC1738 }), 'a+b=c+d');
- st.end();
- });
-
- t.test('RFC 3986 spaces serialization', function (st) {
- st.equal(qs.stringify({ a: 'b c' }, { format: qs.formats.RFC3986 }), 'a=b%20c');
- st.equal(qs.stringify({ 'a b': 'c d' }, { format: qs.formats.RFC3986 }), 'a%20b=c%20d');
- st.end();
- });
-
- t.test('Backward compatibility to RFC 3986', function (st) {
- st.equal(qs.stringify({ a: 'b c' }), 'a=b%20c');
- st.end();
- });
-
- t.test('Edge cases and unknown formats', function (st) {
- ['UFO1234', false, 1234, null, {}, []].forEach(
- function (format) {
- st.throws(
- function () {
- qs.stringify({ a: 'b c' }, { format: format });
- },
- new TypeError('Unknown format option provided.')
- );
- }
- );
- st.end();
- });
});
diff --git a/node_modules/qs/test/utils.js b/node_modules/qs/test/utils.js
@@ -5,18 +5,5 @@ var utils = require('../lib/utils');
test('merge()', function (t) {
t.deepEqual(utils.merge({ a: 'b' }, { a: 'c' }), { a: ['b', 'c'] }, 'merges two objects with the same key');
-
- var oneMerged = utils.merge({ foo: 'bar' }, { foo: { first: '123' } });
- t.deepEqual(oneMerged, { foo: ['bar', { first: '123' }] }, 'merges a standalone and an object into an array');
-
- var twoMerged = utils.merge({ foo: ['bar', { first: '123' }] }, { foo: { second: '456' } });
- t.deepEqual(twoMerged, { foo: { 0: 'bar', 1: { first: '123' }, second: '456' } }, 'merges a standalone and two objects into an array');
-
- var sandwiched = utils.merge({ foo: ['bar', { first: '123', second: '456' }] }, { foo: 'baz' });
- t.deepEqual(sandwiched, { foo: ['bar', { first: '123', second: '456' }, 'baz'] }, 'merges an object sandwiched by two standalones into an array');
-
- var nestedArrays = utils.merge({ foo: ['baz'] }, { foo: ['bar', 'xyzzy'] });
- t.deepEqual(nestedArrays, { foo: ['baz', 'bar', 'xyzzy'] });
-
t.end();
});
diff --git a/node_modules/request/CHANGELOG.md b/node_modules/request/CHANGELOG.md
@@ -1,13 +1,5 @@
## Change Log
-### v2.79.0 (2016/11/18)
-- [#2368](https://github.com/request/request/pull/2368) Fix typeof check in test-pool.js (@forivall)
-- [#2394](https://github.com/request/request/pull/2394) Use `files` in package.json (@SimenB)
-- [#2463](https://github.com/request/request/pull/2463) AWS support for session tokens for temporary credentials (@simov)
-- [#2467](https://github.com/request/request/pull/2467) Migrate to uuid (@simov, @antialias)
-- [#2459](https://github.com/request/request/pull/2459) Update taper to version 0.5.0 🚀 (@greenkeeperio-bot)
-- [#2448](https://github.com/request/request/pull/2448) Make other connect timeout test more reliable too (@mscdex)
-
### v2.78.0 (2016/11/03)
- [#2447](https://github.com/request/request/pull/2447) Always set request timeout on keep-alive connections (@mscdex)
@@ -504,6 +496,7 @@
### v2.29.0 (2013/12/06)
- [#727](https://github.com/request/request/pull/727) fix requester bug (@jchris)
+
### v2.28.0 (2013/12/04)
- [#724](https://github.com/request/request/pull/724) README.md: add custom HTTP Headers example. (@tcort)
- [#719](https://github.com/request/request/pull/719) Made a comment gender neutral. (@unsetbit)
diff --git a/node_modules/request/README.md b/node_modules/request/README.md
@@ -755,7 +755,7 @@ The first argument can be either a `url` or an `options` object. The only requir
- `auth` - A hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). See documentation above.
- `oauth` - Options for OAuth HMAC-SHA1 signing. See documentation above.
- `hawk` - Options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example).
-- `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`, and optionally `session` (note that this only works for services that require session as part of the canonical string). Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services). If you want to use AWS sign version 4 use the parameter `sign_version` with value `4` otherwise the default is version 2. **Note:** you need to `npm install aws4` first.
+- `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`. Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services). If you want to use AWS sign version 4 use the parameter `sign_version` with value `4` otherwise the default is version 2. **Note:** you need to `npm install aws4` first.
- `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options.
---
diff --git a/node_modules/request/lib/auth.js b/node_modules/request/lib/auth.js
@@ -1,7 +1,7 @@
'use strict'
var caseless = require('caseless')
- , uuid = require('uuid')
+ , uuid = require('node-uuid')
, helpers = require('./helpers')
var md5 = helpers.md5
diff --git a/node_modules/request/lib/multipart.js b/node_modules/request/lib/multipart.js
@@ -1,6 +1,6 @@
'use strict'
-var uuid = require('uuid')
+var uuid = require('node-uuid')
, CombinedStream = require('combined-stream')
, isstream = require('isstream')
diff --git a/node_modules/request/lib/oauth.js b/node_modules/request/lib/oauth.js
@@ -3,7 +3,7 @@
var url = require('url')
, qs = require('qs')
, caseless = require('caseless')
- , uuid = require('uuid')
+ , uuid = require('node-uuid')
, oauth = require('oauth-sign')
, crypto = require('crypto')
diff --git a/node_modules/request/node_modules/.bin/uuid b/node_modules/request/node_modules/.bin/uuid
@@ -1 +1 @@
-../../../uuid/bin/uuid
-\ No newline at end of file
+../../../node-uuid/bin/uuid
+\ No newline at end of file
diff --git a/node_modules/request/package.json b/node_modules/request/package.json
@@ -7,7 +7,7 @@
"util",
"utility"
],
- "version": "2.79.0",
+ "version": "2.78.0",
"author": "Mikeal Rogers <mikeal.rogers@gmail.com>",
"repository": {
"type": "git",
@@ -21,11 +21,6 @@
"node": ">= 4"
},
"main": "index.js",
- "files": [
- "lib/",
- "index.js",
- "request.js"
- ],
"dependencies": {
"aws-sign2": "~0.6.0",
"aws4": "^1.2.1",
@@ -41,12 +36,12 @@
"isstream": "~0.1.2",
"json-stringify-safe": "~5.0.1",
"mime-types": "~2.1.7",
+ "node-uuid": "~1.4.7",
"oauth-sign": "~0.8.1",
"qs": "~6.3.0",
"stringstream": "~0.0.4",
"tough-cookie": "~2.3.0",
- "tunnel-agent": "~0.4.1",
- "uuid": "^3.0.0"
+ "tunnel-agent": "~0.4.1"
},
"scripts": {
"test": "npm run lint && npm run test-ci && npm run test-browser",
@@ -75,7 +70,7 @@
"rimraf": "^2.2.8",
"server-destroy": "^1.0.1",
"tape": "^4.6.0",
- "taper": "^0.5.0"
+ "taper": "^0.4.0"
},
"greenkeeper": {
"ignore": [
diff --git a/node_modules/request/request.js b/node_modules/request/request.js
@@ -1292,14 +1292,10 @@ Request.prototype.aws = function (opts, now) {
}
var signRes = aws4.sign(options, {
accessKeyId: opts.key,
- secretAccessKey: opts.secret,
- sessionToken: opts.session
+ secretAccessKey: opts.secret
})
self.setHeader('authorization', signRes.headers.Authorization)
self.setHeader('x-amz-date', signRes.headers['X-Amz-Date'])
- if (signRes.headers['X-Amz-Security-Token']) {
- self.setHeader('x-amz-security-token', signRes.headers['X-Amz-Security-Token'])
- }
}
else {
// default: use aws-sign2
diff --git a/node_modules/sass-graph/node_modules/cliui/CHANGELOG.md b/node_modules/sass-graph/node_modules/cliui/CHANGELOG.md
@@ -1,15 +0,0 @@
-# Change Log
-
-All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
-
-<a name="3.2.0"></a>
-# [3.2.0](https://github.com/yargs/cliui/compare/v3.1.2...v3.2.0) (2016-04-11)
-
-
-### Bug Fixes
-
-* reduces tarball size ([acc6c33](https://github.com/yargs/cliui/commit/acc6c33))
-
-### Features
-
-* adds standard-version for release management ([ff84e32](https://github.com/yargs/cliui/commit/ff84e32))
diff --git a/node_modules/sass-graph/node_modules/cliui/LICENSE.txt b/node_modules/sass-graph/node_modules/cliui/LICENSE.txt
@@ -1,14 +0,0 @@
-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.
diff --git a/node_modules/sass-graph/node_modules/cliui/README.md b/node_modules/sass-graph/node_modules/cliui/README.md
@@ -1,110 +0,0 @@
-# cliui
-
-[](https://travis-ci.org/yargs/cliui)
-[](https://coveralls.io/r/yargs/cliui?branch=)
-[](https://www.npmjs.com/package/cliui)
-[](https://github.com/conventional-changelog/standard-version)
-
-easily create complex multi-column command-line-interfaces.
-
-## Example
-
-```js
-var ui = require('cliui')({
- width: 80
-})
-
-ui.div('Usage: $0 [command] [options]')
-
-ui.div({
- text: 'Options:',
- padding: [2, 0, 2, 0]
-})
-
-ui.div(
- {
- text: "-f, --file",
- width: 20,
- padding: [0, 4, 0, 4]
- },
- {
- text: "the file to load." +
- chalk.green("(if this description is long it wraps).")
- ,
- width: 20
- },
- {
- text: chalk.red("[required]"),
- align: 'right'
- }
-)
-
-console.log(ui.toString())
-```
-
-<img width="500" src="screenshot.png">
-
-## Layout DSL
-
-cliui exposes a simple layout DSL:
-
-If you create a single `ui.row`, passing a string rather than an
-object:
-
-* `\n`: characters will be interpreted as new rows.
-* `\t`: characters will be interpreted as new columns.
-* `\s`: characters will be interpreted as padding.
-
-**as an example...**
-
-```js
-var ui = require('./')({
- width: 60
-})
-
-ui.div(
- 'Usage: node ./bin/foo.js\n' +
- ' <regex>\t provide a regex\n' +
- ' <glob>\t provide a glob\t [required]'
-)
-
-console.log(ui.toString())
-```
-
-**will output:**
-
-```shell
-Usage: node ./bin/foo.js
- <regex> provide a regex
- <glob> provide a glob [required]
-```
-
-## Methods
-
-```js
-cliui = require('cliui')
-```
-
-### cliui({width: integer})
-
-Specify the maximum width of the UI being generated.
-
-### cliui({wrap: boolean})
-
-Enable or disable the wrapping of text in a column.
-
-### cliui.div(column, column, column)
-
-Create a row with any number of columns, a column
-can either be a string, or an object with the following
-options:
-
-* **width:** the width of a column.
-* **align:** alignment, `right` or `center`.
-* **padding:** `[top, right, bottom, left]`.
-* **border:** should a border be placed around the div?
-
-### cliui.span(column, column, column)
-
-Similar to `div`, except the next row will be appended without
-a new line being created.
diff --git a/node_modules/sass-graph/node_modules/cliui/index.js b/node_modules/sass-graph/node_modules/cliui/index.js
@@ -1,316 +0,0 @@
-var stringWidth = require('string-width')
-var stripAnsi = require('strip-ansi')
-var wrap = require('wrap-ansi')
-var align = {
- right: alignRight,
- center: alignCenter
-}
-var top = 0
-var right = 1
-var bottom = 2
-var left = 3
-
-function UI (opts) {
- this.width = opts.width
- this.wrap = opts.wrap
- this.rows = []
-}
-
-UI.prototype.span = function () {
- var cols = this.div.apply(this, arguments)
- cols.span = true
-}
-
-UI.prototype.div = function () {
- if (arguments.length === 0) this.div('')
- if (this.wrap && this._shouldApplyLayoutDSL.apply(this, arguments)) {
- return this._applyLayoutDSL(arguments[0])
- }
-
- var cols = []
-
- for (var i = 0, arg; (arg = arguments[i]) !== undefined; i++) {
- if (typeof arg === 'string') cols.push(this._colFromString(arg))
- else cols.push(arg)
- }
-
- this.rows.push(cols)
- return cols
-}
-
-UI.prototype._shouldApplyLayoutDSL = function () {
- return arguments.length === 1 && typeof arguments[0] === 'string' &&
- /[\t\n]/.test(arguments[0])
-}
-
-UI.prototype._applyLayoutDSL = function (str) {
- var _this = this
- var rows = str.split('\n')
- var leftColumnWidth = 0
-
- // simple heuristic for layout, make sure the
- // second column lines up along the left-hand.
- // don't allow the first column to take up more
- // than 50% of the screen.
- rows.forEach(function (row) {
- var columns = row.split('\t')
- if (columns.length > 1 && stringWidth(columns[0]) > leftColumnWidth) {
- leftColumnWidth = Math.min(
- Math.floor(_this.width * 0.5),
- stringWidth(columns[0])
- )
- }
- })
-
- // generate a table:
- // replacing ' ' with padding calculations.
- // using the algorithmically generated width.
- rows.forEach(function (row) {
- var columns = row.split('\t')
- _this.div.apply(_this, columns.map(function (r, i) {
- return {
- text: r.trim(),
- padding: _this._measurePadding(r),
- width: (i === 0 && columns.length > 1) ? leftColumnWidth : undefined
- }
- }))
- })
-
- return this.rows[this.rows.length - 1]
-}
-
-UI.prototype._colFromString = function (str) {
- return {
- text: str,
- padding: this._measurePadding(str)
- }
-}
-
-UI.prototype._measurePadding = function (str) {
- // measure padding without ansi escape codes
- var noAnsi = stripAnsi(str)
- return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length]
-}
-
-UI.prototype.toString = function () {
- var _this = this
- var lines = []
-
- _this.rows.forEach(function (row, i) {
- _this.rowToString(row, lines)
- })
-
- // don't display any lines with the
- // hidden flag set.
- lines = lines.filter(function (line) {
- return !line.hidden
- })
-
- return lines.map(function (line) {
- return line.text
- }).join('\n')
-}
-
-UI.prototype.rowToString = function (row, lines) {
- var _this = this
- var padding
- var rrows = this._rasterize(row)
- var str = ''
- var ts
- var width
- var wrapWidth
-
- rrows.forEach(function (rrow, r) {
- str = ''
- rrow.forEach(function (col, c) {
- ts = '' // temporary string used during alignment/padding.
- width = row[c].width // the width with padding.
- wrapWidth = _this._negatePadding(row[c]) // the width without padding.
-
- ts += col
-
- for (var i = 0; i < wrapWidth - stringWidth(col); i++) {
- ts += ' '
- }
-
- // align the string within its column.
- if (row[c].align && row[c].align !== 'left' && _this.wrap) {
- ts = align[row[c].align](ts, wrapWidth)
- if (stringWidth(ts) < wrapWidth) ts += new Array(width - stringWidth(ts)).join(' ')
- }
-
- // apply border and padding to string.
- padding = row[c].padding || [0, 0, 0, 0]
- if (padding[left]) str += new Array(padding[left] + 1).join(' ')
- str += addBorder(row[c], ts, '| ')
- str += ts
- str += addBorder(row[c], ts, ' |')
- if (padding[right]) str += new Array(padding[right] + 1).join(' ')
-
- // if prior row is span, try to render the
- // current row on the prior line.
- if (r === 0 && lines.length > 0) {
- str = _this._renderInline(str, lines[lines.length - 1])
- }
- })
-
- // remove trailing whitespace.
- lines.push({
- text: str.replace(/ +$/, ''),
- span: row.span
- })
- })
-
- return lines
-}
-
-function addBorder (col, ts, style) {
- if (col.border) {
- if (/[.']-+[.']/.test(ts)) return ''
- else if (ts.trim().length) return style
- else return ' '
- }
- return ''
-}
-
-// if the full 'source' can render in
-// the target line, do so.
-UI.prototype._renderInline = function (source, previousLine) {
- var leadingWhitespace = source.match(/^ */)[0].length
- var target = previousLine.text
- var targetTextWidth = stringWidth(target.trimRight())
-
- if (!previousLine.span) return source
-
- // if we're not applying wrapping logic,
- // just always append to the span.
- if (!this.wrap) {
- previousLine.hidden = true
- return target + source
- }
-
- if (leadingWhitespace < targetTextWidth) return source
-
- previousLine.hidden = true
-
- return target.trimRight() + new Array(leadingWhitespace - targetTextWidth + 1).join(' ') + source.trimLeft()
-}
-
-UI.prototype._rasterize = function (row) {
- var _this = this
- var i
- var rrow
- var rrows = []
- var widths = this._columnWidths(row)
- var wrapped
-
- // word wrap all columns, and create
- // a data-structure that is easy to rasterize.
- row.forEach(function (col, c) {
- // leave room for left and right padding.
- col.width = widths[c]
- if (_this.wrap) wrapped = wrap(col.text, _this._negatePadding(col), {hard: true}).split('\n')
- else wrapped = col.text.split('\n')
-
- if (col.border) {
- wrapped.unshift('.' + new Array(_this._negatePadding(col) + 3).join('-') + '.')
- wrapped.push("'" + new Array(_this._negatePadding(col) + 3).join('-') + "'")
- }
-
- // add top and bottom padding.
- if (col.padding) {
- for (i = 0; i < (col.padding[top] || 0); i++) wrapped.unshift('')
- for (i = 0; i < (col.padding[bottom] || 0); i++) wrapped.push('')
- }
-
- wrapped.forEach(function (str, r) {
- if (!rrows[r]) rrows.push([])
-
- rrow = rrows[r]
-
- for (var i = 0; i < c; i++) {
- if (rrow[i] === undefined) rrow.push('')
- }
- rrow.push(str)
- })
- })
-
- return rrows
-}
-
-UI.prototype._negatePadding = function (col) {
- var wrapWidth = col.width
- if (col.padding) wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0)
- if (col.border) wrapWidth -= 4
- return wrapWidth
-}
-
-UI.prototype._columnWidths = function (row) {
- var _this = this
- var widths = []
- var unset = row.length
- var unsetWidth
- var remainingWidth = this.width
-
- // column widths can be set in config.
- row.forEach(function (col, i) {
- if (col.width) {
- unset--
- widths[i] = col.width
- remainingWidth -= col.width
- } else {
- widths[i] = undefined
- }
- })
-
- // any unset widths should be calculated.
- if (unset) unsetWidth = Math.floor(remainingWidth / unset)
- widths.forEach(function (w, i) {
- if (!_this.wrap) widths[i] = row[i].width || stringWidth(row[i].text)
- else if (w === undefined) widths[i] = Math.max(unsetWidth, _minWidth(row[i]))
- })
-
- return widths
-}
-
-// calculates the minimum width of
-// a column, based on padding preferences.
-function _minWidth (col) {
- var padding = col.padding || []
- var minWidth = 1 + (padding[left] || 0) + (padding[right] || 0)
- if (col.border) minWidth += 4
- return minWidth
-}
-
-function alignRight (str, width) {
- str = str.trim()
- var padding = ''
- var strWidth = stringWidth(str)
-
- if (strWidth < width) {
- padding = new Array(width - strWidth + 1).join(' ')
- }
-
- return padding + str
-}
-
-function alignCenter (str, width) {
- str = str.trim()
- var padding = ''
- var strWidth = stringWidth(str.trim())
-
- if (strWidth < width) {
- padding = new Array(parseInt((width - strWidth) / 2, 10) + 1).join(' ')
- }
-
- return padding + str
-}
-
-module.exports = function (opts) {
- opts = opts || {}
-
- return new UI({
- width: (opts || {}).width || 80,
- wrap: typeof opts.wrap === 'boolean' ? opts.wrap : true
- })
-}
diff --git a/node_modules/sass-graph/node_modules/cliui/package.json b/node_modules/sass-graph/node_modules/cliui/package.json
@@ -1,64 +0,0 @@
-{
- "name": "cliui",
- "version": "3.2.0",
- "description": "easily create complex multi-column command-line-interfaces",
- "main": "index.js",
- "scripts": {
- "pretest": "standard",
- "test": "nyc mocha",
- "coverage": "nyc --reporter=text-lcov mocha | coveralls",
- "version": "standard-version"
- },
- "repository": {
- "type": "git",
- "url": "http://github.com/yargs/cliui.git"
- },
- "config": {
- "blanket": {
- "pattern": [
- "index.js"
- ],
- "data-cover-never": [
- "node_modules",
- "test"
- ],
- "output-reporter": "spec"
- }
- },
- "standard": {
- "ignore": [
- "**/example/**"
- ],
- "globals": [
- "it"
- ]
- },
- "keywords": [
- "cli",
- "command-line",
- "layout",
- "design",
- "console",
- "wrap",
- "table"
- ],
- "author": "Ben Coe <ben@npmjs.com>",
- "license": "ISC",
- "dependencies": {
- "string-width": "^1.0.1",
- "strip-ansi": "^3.0.1",
- "wrap-ansi": "^2.0.0"
- },
- "devDependencies": {
- "chai": "^3.5.0",
- "chalk": "^1.1.2",
- "coveralls": "^2.11.8",
- "mocha": "^2.4.5",
- "nyc": "^6.4.0",
- "standard": "^6.0.8",
- "standard-version": "^2.1.2"
- },
- "files": [
- "index.js"
- ]
-}
-\ No newline at end of file
diff --git a/node_modules/sass-graph/node_modules/window-size/LICENSE b/node_modules/sass-graph/node_modules/window-size/LICENSE
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2015, Jon Schlinkert.
-
-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.
diff --git a/node_modules/sass-graph/node_modules/window-size/README.md b/node_modules/sass-graph/node_modules/window-size/README.md
@@ -1,45 +0,0 @@
-# window-size [](http://badge.fury.io/js/window-size) [](https://travis-ci.org/jonschlinkert/window-size)
-
-> Reliable way to to get the height and width of the terminal/console in a node.js environment.
-
-## Install
-
-Install with [npm](https://www.npmjs.com/)
-
-```sh
-$ npm i window-size --save
-```
-
-## Usage
-
-```js
-var size = require('window-size');
-size.height; // "25" (rows)
-size.width; // "80" (columns)
-```
-
-## Other projects
-
-* [base-cli](https://www.npmjs.com/package/base-cli): Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a… [more](https://www.npmjs.com/package/base-cli) | [homepage](https://github.com/jonschlinkert/base-cli)
-* [lint-deps](https://www.npmjs.com/package/lint-deps): CLI tool that tells you when dependencies are missing from package.json and offers you a… [more](https://www.npmjs.com/package/lint-deps) | [homepage](https://github.com/jonschlinkert/lint-deps)
-* [yargs](https://www.npmjs.com/package/yargs): Light-weight option parsing with an argv hash. No optstrings attached. | [homepage](https://github.com/bcoe/yargs#readme)
-
-## Contributing
-
-Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/window-size/issues/new).
-
-## Author
-
-**Jon Schlinkert**
-
-+ [github/jonschlinkert](https://github.com/jonschlinkert)
-+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
-
-## License
-
-Copyright © 2014-2015 [Jon Schlinkert](https://github.com/jonschlinkert)
-Released under the MIT license.
-
-***
-
-_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 15, 2015._
-\ No newline at end of file
diff --git a/node_modules/sass-graph/node_modules/window-size/cli.js b/node_modules/sass-graph/node_modules/window-size/cli.js
@@ -1,30 +0,0 @@
-#!/usr/bin/env node
-'use strict';
-var helpText = ['Usage',
-' $ window-size',
-'',
-'Example',
-' $ window-size',
-' height: 40 ',
-' width : 145',
-''].join('\n');
-
-function showSize () {
- var size = require('./');
- console.log('height: ' + size.height);
- console.log('width : ' + size.width);
-}
-
-if (process.argv.length > 2) {
- switch (process.argv[2]) {
- case 'help':
- case '--help':
- case '-h':
- console.log(helpText);
- break;
- default:
- showSize();
- }
-} else {
- showSize();
-}
diff --git a/node_modules/sass-graph/node_modules/window-size/index.js b/node_modules/sass-graph/node_modules/window-size/index.js
@@ -1,32 +0,0 @@
-'use strict';
-
-/*!
- * window-size <https://github.com/jonschlinkert/window-size>
- *
- * Copyright (c) 2014-2015 Jon Schlinkert
- * Licensed under the MIT license.
- */
-
-var tty = require('tty');
-
-module.exports = (function () {
- var width;
- var height;
-
- if (tty.isatty(1) && tty.isatty(2)) {
- if (process.stdout.getWindowSize) {
- width = process.stdout.getWindowSize(1)[0];
- height = process.stdout.getWindowSize(1)[1];
- } else if (tty.getWindowSize) {
- width = tty.getWindowSize()[1];
- height = tty.getWindowSize()[0];
- } else if (process.stdout.columns && process.stdout.rows) {
- height = process.stdout.rows;
- width = process.stdout.columns;
- }
- } else {
- Error('window-size could not get size with tty or process.stdout.');
- }
-
- return {height: height, width: width};
-})();
diff --git a/node_modules/sass-graph/node_modules/window-size/package.json b/node_modules/sass-graph/node_modules/window-size/package.json
@@ -1,48 +0,0 @@
-{
- "name": "window-size",
- "description": "Reliable way to to get the height and width of the terminal/console in a node.js environment.",
- "version": "0.2.0",
- "homepage": "https://github.com/jonschlinkert/window-size",
- "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
- "repository": "jonschlinkert/window-size",
- "bugs": {
- "url": "https://github.com/jonschlinkert/window-size/issues"
- },
- "license": "MIT",
- "files": [
- "index.js",
- "cli.js"
- ],
- "main": "index.js",
- "engines": {
- "node": ">= 0.10.0"
- },
- "scripts": {
- "pretest": "semistandard",
- "test": "tap --coverage test.js"
- },
- "bin": "cli.js",
- "devDependencies": {
- "semistandard": "^7.0.2",
- "tap": "^2.2.1"
- },
- "keywords": [
- "console",
- "height",
- "resize",
- "size",
- "terminal",
- "tty",
- "width",
- "window"
- ],
- "verb": {
- "related": {
- "list": [
- "yargs",
- "lint-deps",
- "base-cli"
- ]
- }
- }
-}
diff --git a/node_modules/sass-graph/node_modules/yargs/node_modules/.bin/window-size b/node_modules/sass-graph/node_modules/yargs/node_modules/.bin/window-size
@@ -1 +1 @@
-../../../window-size/cli.js
-\ No newline at end of file
+../../../../../window-size/cli.js
+\ No newline at end of file
diff --git a/node_modules/vinyl-fs/node_modules/isarray/README.md b/node_modules/vinyl-fs/node_modules/isarray/README.md
@@ -1,54 +0,0 @@
-
-# isarray
-
-`Array#isArray` for older browsers.
-
-## Usage
-
-```js
-var isArray = require('isarray');
-
-console.log(isArray([])); // => true
-console.log(isArray({})); // => false
-```
-
-## Installation
-
-With [npm](http://npmjs.org) do
-
-```bash
-$ npm install isarray
-```
-
-Then bundle for the browser with
-[browserify](https://github.com/substack/browserify).
-
-With [component](http://component.io) do
-
-```bash
-$ component install juliangruber/isarray
-```
-
-## License
-
-(MIT)
-
-Copyright (c) 2013 Julian Gruber <julian@juliangruber.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.
diff --git a/node_modules/vinyl-fs/node_modules/isarray/build/build.js b/node_modules/vinyl-fs/node_modules/isarray/build/build.js
@@ -1,209 +0,0 @@
-
-/**
- * Require the given path.
- *
- * @param {String} path
- * @return {Object} exports
- * @api public
- */
-
-function require(path, parent, orig) {
- var resolved = require.resolve(path);
-
- // lookup failed
- if (null == resolved) {
- orig = orig || path;
- parent = parent || 'root';
- var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
- err.path = orig;
- err.parent = parent;
- err.require = true;
- throw err;
- }
-
- var module = require.modules[resolved];
-
- // perform real require()
- // by invoking the module's
- // registered function
- if (!module.exports) {
- module.exports = {};
- module.client = module.component = true;
- module.call(this, module.exports, require.relative(resolved), module);
- }
-
- return module.exports;
-}
-
-/**
- * Registered modules.
- */
-
-require.modules = {};
-
-/**
- * Registered aliases.
- */
-
-require.aliases = {};
-
-/**
- * Resolve `path`.
- *
- * Lookup:
- *
- * - PATH/index.js
- * - PATH.js
- * - PATH
- *
- * @param {String} path
- * @return {String} path or null
- * @api private
- */
-
-require.resolve = function(path) {
- if (path.charAt(0) === '/') path = path.slice(1);
- var index = path + '/index.js';
-
- var paths = [
- path,
- path + '.js',
- path + '.json',
- path + '/index.js',
- path + '/index.json'
- ];
-
- for (var i = 0; i < paths.length; i++) {
- var path = paths[i];
- if (require.modules.hasOwnProperty(path)) return path;
- }
-
- if (require.aliases.hasOwnProperty(index)) {
- return require.aliases[index];
- }
-};
-
-/**
- * Normalize `path` relative to the current path.
- *
- * @param {String} curr
- * @param {String} path
- * @return {String}
- * @api private
- */
-
-require.normalize = function(curr, path) {
- var segs = [];
-
- if ('.' != path.charAt(0)) return path;
-
- curr = curr.split('/');
- path = path.split('/');
-
- for (var i = 0; i < path.length; ++i) {
- if ('..' == path[i]) {
- curr.pop();
- } else if ('.' != path[i] && '' != path[i]) {
- segs.push(path[i]);
- }
- }
-
- return curr.concat(segs).join('/');
-};
-
-/**
- * Register module at `path` with callback `definition`.
- *
- * @param {String} path
- * @param {Function} definition
- * @api private
- */
-
-require.register = function(path, definition) {
- require.modules[path] = definition;
-};
-
-/**
- * Alias a module definition.
- *
- * @param {String} from
- * @param {String} to
- * @api private
- */
-
-require.alias = function(from, to) {
- if (!require.modules.hasOwnProperty(from)) {
- throw new Error('Failed to alias "' + from + '", it does not exist');
- }
- require.aliases[to] = from;
-};
-
-/**
- * Return a require function relative to the `parent` path.
- *
- * @param {String} parent
- * @return {Function}
- * @api private
- */
-
-require.relative = function(parent) {
- var p = require.normalize(parent, '..');
-
- /**
- * lastIndexOf helper.
- */
-
- function lastIndexOf(arr, obj) {
- var i = arr.length;
- while (i--) {
- if (arr[i] === obj) return i;
- }
- return -1;
- }
-
- /**
- * The relative require() itself.
- */
-
- function localRequire(path) {
- var resolved = localRequire.resolve(path);
- return require(resolved, parent, path);
- }
-
- /**
- * Resolve relative to the parent.
- */
-
- localRequire.resolve = function(path) {
- var c = path.charAt(0);
- if ('/' == c) return path.slice(1);
- if ('.' == c) return require.normalize(p, path);
-
- // resolve deps by returning
- // the dep in the nearest "deps"
- // directory
- var segs = parent.split('/');
- var i = lastIndexOf(segs, 'deps') + 1;
- if (!i) i = 0;
- path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
- return path;
- };
-
- /**
- * Check if module is defined at `path`.
- */
-
- localRequire.exists = function(path) {
- return require.modules.hasOwnProperty(localRequire.resolve(path));
- };
-
- return localRequire;
-};
-require.register("isarray/index.js", function(exports, require, module){
-module.exports = Array.isArray || function (arr) {
- return Object.prototype.toString.call(arr) == '[object Array]';
-};
-
-});
-require.alias("isarray/index.js", "isarray/index.js");
-
diff --git a/node_modules/vinyl-fs/node_modules/isarray/component.json b/node_modules/vinyl-fs/node_modules/isarray/component.json
@@ -1,19 +0,0 @@
-{
- "name" : "isarray",
- "description" : "Array#isArray for older browsers",
- "version" : "0.0.1",
- "repository" : "juliangruber/isarray",
- "homepage": "https://github.com/juliangruber/isarray",
- "main" : "index.js",
- "scripts" : [
- "index.js"
- ],
- "dependencies" : {},
- "keywords": ["browser","isarray","array"],
- "author": {
- "name": "Julian Gruber",
- "email": "mail@juliangruber.com",
- "url": "http://juliangruber.com"
- },
- "license": "MIT"
-}
diff --git a/node_modules/vinyl-fs/node_modules/isarray/index.js b/node_modules/vinyl-fs/node_modules/isarray/index.js
@@ -1,3 +0,0 @@
-module.exports = Array.isArray || function (arr) {
- return Object.prototype.toString.call(arr) == '[object Array]';
-};
diff --git a/node_modules/vinyl-fs/node_modules/isarray/package.json b/node_modules/vinyl-fs/node_modules/isarray/package.json
@@ -1,25 +0,0 @@
-{
- "name" : "isarray",
- "description" : "Array#isArray for older browsers",
- "version" : "0.0.1",
- "repository" : {
- "type" : "git",
- "url" : "git://github.com/juliangruber/isarray.git"
- },
- "homepage": "https://github.com/juliangruber/isarray",
- "main" : "index.js",
- "scripts" : {
- "test" : "tap test/*.js"
- },
- "dependencies" : {},
- "devDependencies" : {
- "tap" : "*"
- },
- "keywords": ["browser","isarray","array"],
- "author": {
- "name": "Julian Gruber",
- "email": "mail@juliangruber.com",
- "url": "http://juliangruber.com"
- },
- "license": "MIT"
-}
diff --git a/node_modules/window-size/LICENSE-MIT b/node_modules/window-size/LICENSE-MIT
@@ -1,22 +0,0 @@
-Copyright (c) 2014 Jon Schlinkert
-
-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.
diff --git a/node_modules/window-size/README.md b/node_modules/window-size/README.md
@@ -1,26 +1,45 @@
-# window-size [](http://badge.fury.io/js/window-size)
-
-> Reliable way to to get the height and width of the terminal/console in a node.js environment.
-
-## Install
-
-### [npm](npmjs.org)
-
-```bash
-npm i window-size --save
-```
-
-```javascript
-var size = require('window-size');
-size.height; // "80" (rows)
-size.width; // "25" (columns)
-```
-
-## Author
-
-+ [github/jonschlinkert](https://github.com/jonschlinkert)
-+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
-
-## License
-Copyright (c) 2014 Jon Schlinkert
-Licensed under the MIT license.
-\ No newline at end of file
+# window-size [](http://badge.fury.io/js/window-size) [](https://travis-ci.org/jonschlinkert/window-size)
+
+> Reliable way to to get the height and width of the terminal/console in a node.js environment.
+
+## Install
+
+Install with [npm](https://www.npmjs.com/)
+
+```sh
+$ npm i window-size --save
+```
+
+## Usage
+
+```js
+var size = require('window-size');
+size.height; // "25" (rows)
+size.width; // "80" (columns)
+```
+
+## Other projects
+
+* [base-cli](https://www.npmjs.com/package/base-cli): Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a… [more](https://www.npmjs.com/package/base-cli) | [homepage](https://github.com/jonschlinkert/base-cli)
+* [lint-deps](https://www.npmjs.com/package/lint-deps): CLI tool that tells you when dependencies are missing from package.json and offers you a… [more](https://www.npmjs.com/package/lint-deps) | [homepage](https://github.com/jonschlinkert/lint-deps)
+* [yargs](https://www.npmjs.com/package/yargs): Light-weight option parsing with an argv hash. No optstrings attached. | [homepage](https://github.com/bcoe/yargs#readme)
+
+## Contributing
+
+Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/window-size/issues/new).
+
+## Author
+
+**Jon Schlinkert**
+
++ [github/jonschlinkert](https://github.com/jonschlinkert)
++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+
+## License
+
+Copyright © 2014-2015 [Jon Schlinkert](https://github.com/jonschlinkert)
+Released under the MIT license.
+
+***
+
+_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 15, 2015._
+\ No newline at end of file
diff --git a/node_modules/window-size/index.js b/node_modules/window-size/index.js
@@ -1,33 +1,32 @@
-/*
- * window-size
- * https://github.com/jonschlinkert/window-size
- *
- * Copyright (c) 2014 Jon Schlinkert
- * Licensed under the MIT license.
- */
-
-const tty = require('tty')
-
-module.exports = (function() {
- var width;
- var height;
-
- if(tty.isatty(1) && tty.isatty(2)) {
- if(process.stdout.getWindowSize) {
- width = process.stdout.getWindowSize(1)[0];
- height = process.stdout.getWindowSize(1)[1];
- } else if (tty.getWindowSize) {
- width = tty.getWindowSize()[1];
- height = tty.getWindowSize()[0];
- } else if (process.stdout.columns && process.stdout.rows) {
- height = process.stdout.columns;
- width = process.stdout.rows;
- }
- } else {
- new Error('Error: could not get window size with tty or process.stdout');
- }
- return {
- height: height,
- width: width
- }
-})();
-\ No newline at end of file
+'use strict';
+
+/*!
+ * window-size <https://github.com/jonschlinkert/window-size>
+ *
+ * Copyright (c) 2014-2015 Jon Schlinkert
+ * Licensed under the MIT license.
+ */
+
+var tty = require('tty');
+
+module.exports = (function () {
+ var width;
+ var height;
+
+ if (tty.isatty(1) && tty.isatty(2)) {
+ if (process.stdout.getWindowSize) {
+ width = process.stdout.getWindowSize(1)[0];
+ height = process.stdout.getWindowSize(1)[1];
+ } else if (tty.getWindowSize) {
+ width = tty.getWindowSize()[1];
+ height = tty.getWindowSize()[0];
+ } else if (process.stdout.columns && process.stdout.rows) {
+ height = process.stdout.rows;
+ width = process.stdout.columns;
+ }
+ } else {
+ Error('window-size could not get size with tty or process.stdout.');
+ }
+
+ return {height: height, width: width};
+})();
diff --git a/node_modules/window-size/package.json b/node_modules/window-size/package.json
@@ -1,33 +1,48 @@
{
"name": "window-size",
"description": "Reliable way to to get the height and width of the terminal/console in a node.js environment.",
- "version": "0.1.0",
+ "version": "0.2.0",
"homepage": "https://github.com/jonschlinkert/window-size",
- "author": {
- "name": "Jon Schlinkert",
- "url": "https://github.com/jonschlinkert"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/jonschlinkert/window-size.git"
- },
+ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
+ "repository": "jonschlinkert/window-size",
"bugs": {
"url": "https://github.com/jonschlinkert/window-size/issues"
},
- "licenses": [
- {
- "type": "MIT",
- "url": "https://github.com/jonschlinkert/window-size/blob/master/LICENSE-MIT"
- }
+ "license": "MIT",
+ "files": [
+ "index.js",
+ "cli.js"
],
"main": "index.js",
"engines": {
- "node": ">= 0.8.0"
+ "node": ">= 0.10.0"
+ },
+ "scripts": {
+ "pretest": "semistandard",
+ "test": "tap --coverage test.js"
+ },
+ "bin": "cli.js",
+ "devDependencies": {
+ "semistandard": "^7.0.2",
+ "tap": "^2.2.1"
},
"keywords": [
- "window",
"console",
+ "height",
+ "resize",
+ "size",
"terminal",
- "tty"
- ]
-}
-\ No newline at end of file
+ "tty",
+ "width",
+ "window"
+ ],
+ "verb": {
+ "related": {
+ "list": [
+ "yargs",
+ "lint-deps",
+ "base-cli"
+ ]
+ }
+ }
+}
diff --git a/node_modules/yargs-parser/CHANGELOG.md b/node_modules/yargs-parser/CHANGELOG.md
@@ -2,6 +2,120 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+<a name="4.2.1"></a>
+## [4.2.1](https://github.com/yargs/yargs-parser/compare/v4.2.0...v4.2.1) (2017-01-02)
+
+
+### Bug Fixes
+
+* flatten/duplicate regression ([#75](https://github.com/yargs/yargs-parser/issues/75)) ([68d68a0](https://github.com/yargs/yargs-parser/commit/68d68a0))
+
+
+
+<a name="4.2.0"></a>
+# [4.2.0](https://github.com/yargs/yargs-parser/compare/v4.1.0...v4.2.0) (2016-12-01)
+
+
+### Bug Fixes
+
+* inner objects in configs had their keys appended to top-level key when dot-notation was disabled ([#72](https://github.com/yargs/yargs-parser/issues/72)) ([0b1b5f9](https://github.com/yargs/yargs-parser/commit/0b1b5f9))
+
+
+### Features
+
+* allow multiple arrays to be provided, rather than always combining ([#71](https://github.com/yargs/yargs-parser/issues/71)) ([0f0fb2d](https://github.com/yargs/yargs-parser/commit/0f0fb2d))
+
+
+
+<a name="4.1.0"></a>
+# [4.1.0](https://github.com/yargs/yargs-parser/compare/v4.0.2...v4.1.0) (2016-11-07)
+
+
+### Features
+
+* apply coercions to default options ([#65](https://github.com/yargs/yargs-parser/issues/65)) ([c79052b](https://github.com/yargs/yargs-parser/commit/c79052b))
+* handle dot notation boolean options ([#63](https://github.com/yargs/yargs-parser/issues/63)) ([02c3545](https://github.com/yargs/yargs-parser/commit/02c3545))
+
+
+
+<a name="4.0.2"></a>
+## [4.0.2](https://github.com/yargs/yargs-parser/compare/v4.0.1...v4.0.2) (2016-09-30)
+
+
+### Bug Fixes
+
+* whoops, let's make the assign not change the Object key order ([29d069a](https://github.com/yargs/yargs-parser/commit/29d069a))
+
+
+
+<a name="4.0.1"></a>
+## [4.0.1](https://github.com/yargs/yargs-parser/compare/v4.0.0...v4.0.1) (2016-09-30)
+
+
+### Bug Fixes
+
+* lodash.assign was deprecated ([#59](https://github.com/yargs/yargs-parser/issues/59)) ([5e7eb11](https://github.com/yargs/yargs-parser/commit/5e7eb11))
+
+
+
+<a name="4.0.0"></a>
+# [4.0.0](https://github.com/yargs/yargs-parser/compare/v3.2.0...v4.0.0) (2016-09-26)
+
+
+### Bug Fixes
+
+* coerce should be applied to the final objects and arrays created ([#57](https://github.com/yargs/yargs-parser/issues/57)) ([4ca69da](https://github.com/yargs/yargs-parser/commit/4ca69da))
+
+
+### BREAKING CHANGES
+
+* coerce is no longer applied to individual arguments in an implicit array.
+
+
+
+<a name="3.2.0"></a>
+# [3.2.0](https://github.com/yargs/yargs-parser/compare/v3.1.0...v3.2.0) (2016-08-13)
+
+
+### Features
+
+* coerce full array instead of each element ([#51](https://github.com/yargs/yargs-parser/issues/51)) ([cc4dc56](https://github.com/yargs/yargs-parser/commit/cc4dc56))
+
+
+
+<a name="3.1.0"></a>
+# [3.1.0](https://github.com/yargs/yargs-parser/compare/v3.0.0...v3.1.0) (2016-08-09)
+
+
+### Bug Fixes
+
+* address pkgConf parsing bug outlined in [#37](https://github.com/yargs/yargs-parser/issues/37) ([#45](https://github.com/yargs/yargs-parser/issues/45)) ([be76ee6](https://github.com/yargs/yargs-parser/commit/be76ee6))
+* better parsing of negative values ([#44](https://github.com/yargs/yargs-parser/issues/44)) ([2e43692](https://github.com/yargs/yargs-parser/commit/2e43692))
+* check aliases when guessing defaults for arguments fixes [#41](https://github.com/yargs/yargs-parser/issues/41) ([#43](https://github.com/yargs/yargs-parser/issues/43)) ([f3e4616](https://github.com/yargs/yargs-parser/commit/f3e4616))
+
+
+### Features
+
+* added coerce option, for providing specialized argument parsing ([#42](https://github.com/yargs/yargs-parser/issues/42)) ([7b49cd2](https://github.com/yargs/yargs-parser/commit/7b49cd2))
+
+
+
+<a name="3.0.0"></a>
+# [3.0.0](https://github.com/yargs/yargs-parser/compare/v2.4.1...v3.0.0) (2016-08-07)
+
+
+### Bug Fixes
+
+* parsing issue with numeric character in group of options ([#19](https://github.com/yargs/yargs-parser/issues/19)) ([f743236](https://github.com/yargs/yargs-parser/commit/f743236))
+* upgraded lodash.assign ([5d7fdf4](https://github.com/yargs/yargs-parser/commit/5d7fdf4))
+
+### BREAKING CHANGES
+
+* subtle change to how values are parsed in a group of single-character arguments.
+* _first released in 3.1.0, better handling of negative values should be considered a breaking change._
+
+
+
<a name="2.4.1"></a>
## [2.4.1](https://github.com/yargs/yargs-parser/compare/v2.4.0...v2.4.1) (2016-07-16)
diff --git a/node_modules/yargs-parser/README.md b/node_modules/yargs-parser/README.md
@@ -7,7 +7,7 @@
[](https://github.com/conventional-changelog/standard-version)
-The mighty option parser used by [yargs](https://github.com/bcoe/yargs).
+The mighty option parser used by [yargs](https://github.com/yargs/yargs).
visit the [yargs website](http://yargs.js.org/) for more examples, and thorough usage instructions.
@@ -20,7 +20,7 @@ npm i yargs-parser --save
```
```js
-var argv = require('yargs-parser')(process.argv.slice(2));
+var argv = require('yargs-parser')(process.argv.slice(2))
console.log(argv)
```
@@ -32,7 +32,7 @@ node example.js --foo=33 --bar hello
_or parse a string!_
```js
-var argv = require('./')('--foo=99 --bar=33');
+var argv = require('./')('--foo=99 --bar=33')
console.log(argv)
```
@@ -40,6 +40,14 @@ console.log(argv)
{ _: [], foo: 99, bar: 33 }
```
+Convert an array of mixed types before passing to `yargs-parser`:
+
+```js
+var parse = require('yargs-parser')
+parse(['-f', 11, '--zoom', 55].join(' ')) // <-- array to string
+parse(['-f', 11, '--zoom', 55].map(String)) // <-- array of strings
+```
+
## API
### require('yargs-parser')(args, opts={})
@@ -48,12 +56,14 @@ Parses command line arguments returning a simple mapping of keys and values.
**expects:**
-* `args`: an array or string representing the options to parse.
+* `args`: a string or array of strings representing the options to parse.
* `opts`: provide a set of hints indicating how `args` should be parsed:
* `opts.alias`: an object representing the set of aliases for a key: `{alias: {foo: ['f']}}`.
* `opts.array`: indicate that keys should be parsed as an array: `{array: ['foo', 'bar']}`.
* `opts.boolean`: arguments should be parsed as booleans: `{boolean: ['x', 'y']}`.
* `opts.config`: indicate a key that represents a path to a configuration file (this file will be loaded and parsed).
+ * `opts.coerce`: provide a custom synchronous function that returns a coerced value from the argument provided
+ (or throws an error), e.g. `{coerce: {foo: function (arg) {return modifiedArg}}}`.
* `opts.count`: indicate a key that should be used as a counter, e.g., `-vvv` = `{v: 3}`.
* `opts.default`: provide default values for keys: `{default: {x: 33, y: 'hello world!'}}`.
* `opts.envPrefix`: environment variables (`process.env`) with the prefix provided should be parsed.
@@ -76,7 +86,7 @@ yargs engine.
**expects:**
-* `args`: an array or string representing options to parse.
+* `args`: a string or array of strings representing options to parse.
* `opts`: provide a set of hints indicating how `args`, inputs are identical to `require('yargs-parser')(args, opts={})`.
**returns:**
@@ -164,7 +174,7 @@ node example.js --foo.bar
### parse numbers
* default: `true`
-* key: 'parse-numbers'
+* key: `parse-numbers`
Should keys that look like numbers be treated as such?
@@ -183,7 +193,7 @@ node example.js --foo=99.3
### boolean negation
* default: `true`
-* key: 'boolean-negation'
+* key: `boolean-negation`
Should variables prefixed with `--no` be treated as negations?
@@ -199,6 +209,44 @@ node example.js --no-foo
{ _: [], "no-foo": true }
```
+### duplicate arguments array
+
+* default: `true`
+* key: `duplicate-arguments-array`
+
+Should arguments be coerced into an array when duplicated:
+
+```sh
+node example.js -x 1 -x 2
+{ _: [], x: [1, 2] }
+```
+
+_if disabled:_
+
+```sh
+node example.js -x 1 -x 2
+{ _: [], x: 2 }
+```
+
+### flatten duplicate arrays
+
+* default: `true`
+* key: `flatten-duplicate-arrays`
+
+Should array arguments be coerced into a single array when duplicated:
+
+```sh
+node example.js -x 1 2 -x 3 4
+{ _: [], x: [1, 2, 3, 4] }
+```
+
+_if disabled:_
+
+```sh
+node example.js -x 1 2 -x 3 4
+{ _: [], x: [[1, 2], [3, 4]] }
+```
+
## Special Thanks
The yargs project evolves from optimist and minimist. It owes its
diff --git a/node_modules/yargs-parser/index.js b/node_modules/yargs-parser/index.js
@@ -1,4 +1,3 @@
-var assign = require('lodash.assign')
var camelCase = require('camelcase')
var path = require('path')
var tokenizeArgString = require('./lib/tokenize-arg-string')
@@ -11,12 +10,14 @@ function parse (args, opts) {
args = tokenizeArgString(args)
// aliases might have transitive relationships, normalize this.
var aliases = combineAliases(opts.alias || {})
- var configuration = assign({}, {
+ var configuration = assign({
'short-option-groups': true,
'camel-case-expansion': true,
'dot-notation': true,
'parse-numbers': true,
- 'boolean-negation': true
+ 'boolean-negation': true,
+ 'duplicate-arguments-array': true,
+ 'flatten-duplicate-arrays': true
}, opts.configuration)
var defaults = opts.default || {}
var configObjects = opts.configObjects || []
@@ -37,8 +38,10 @@ function parse (args, opts) {
normalize: {},
configs: {},
defaulted: {},
- nargs: {}
+ nargs: {},
+ coercions: {}
}
+ var negative = /^-[0-9]+(\.[0-9]+)?/
;[].concat(opts.array).filter(Boolean).forEach(function (key) {
flags.arrays[key] = true
@@ -68,6 +71,10 @@ function parse (args, opts) {
flags.nargs[k] = opts.narg[k]
})
+ Object.keys(opts.coerce || {}).forEach(function (k) {
+ flags.coercions[k] = opts.coerce[k]
+ })
+
if (Array.isArray(opts.config) || typeof opts.config === 'string') {
;[].concat(opts.config).filter(Boolean).forEach(function (key) {
flags.configs[key] = true
@@ -150,7 +157,8 @@ function parse (args, opts) {
} else {
next = args[i + 1]
- if (next !== undefined && !next.match(/^-/) &&
+ if (next !== undefined && (!next.match(/^-/) ||
+ next.match(negative)) &&
!checkAllAliases(key, flags.bools) &&
!checkAllAliases(key, flags.counts)) {
setArg(key, next)
@@ -181,7 +189,7 @@ function parse (args, opts) {
} else {
setArg(key, defaultForType(guessType(key, flags)))
}
- } else if (arg.match(/^-[^-]+/)) {
+ } else if (arg.match(/^-[^-]+/) && !arg.match(negative)) {
letters = arg.slice(1, -1).split('')
broken = false
@@ -213,8 +221,9 @@ function parse (args, opts) {
continue
}
+ // current letter is an alphabetic character and next value is a number
if (/[A-Za-z]/.test(letters[j]) &&
- /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
+ /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
setArg(letters[j], next)
broken = true
break
@@ -241,7 +250,8 @@ function parse (args, opts) {
} else {
next = args[i + 1]
- if (next !== undefined && !/^(-|--)[^-]/.test(next) &&
+ if (next !== undefined && (!/^(-|--)[^-]/.test(next) ||
+ next.match(negative)) &&
!checkAllAliases(key, flags.bools) &&
!checkAllAliases(key, flags.counts)) {
setArg(key, next)
@@ -272,6 +282,7 @@ function parse (args, opts) {
setConfigObjects()
applyEnvVars(argv, false)
applyDefaultsAndAliases(argv, flags.aliases, defaults)
+ applyCoercions(argv)
// for any counts either not in args or without an explicit default, set to 0
Object.keys(flags.counts).forEach(function (key) {
@@ -301,15 +312,27 @@ function parse (args, opts) {
// e.g., --foo apple banana cat becomes ["apple", "banana", "cat"]
function eatArray (i, key, args) {
var start = i + 1
+ var argsToSet = []
+ var multipleArrayFlag = i > 0
for (var ii = i + 1; ii < args.length; ii++) {
- if (/^-/.test(args[ii])) {
+ if (/^-/.test(args[ii]) && !negative.test(args[ii])) {
if (ii === start) {
setArg(key, defaultForType('array'))
}
+ multipleArrayFlag = true
break
}
i = ii
- setArg(key, args[ii])
+ argsToSet.push(args[ii])
+ }
+ if (multipleArrayFlag) {
+ setArg(key, argsToSet.map(function (arg) {
+ return processValue(key, arg)
+ }))
+ } else {
+ argsToSet.forEach(function (arg) {
+ setArg(key, arg)
+ })
}
return i
@@ -318,32 +341,13 @@ function parse (args, opts) {
function setArg (key, val) {
unsetDefaulted(key)
- // handle parsing boolean arguments --foo=true --bar false.
- if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
- if (typeof val === 'string') val = val === 'true'
- }
-
if (/-/.test(key) && !(flags.aliases[key] && flags.aliases[key].length) && configuration['camel-case-expansion']) {
var c = camelCase(key)
flags.aliases[key] = [c]
newAliases[c] = true
}
- var value = val
- if (!checkAllAliases(key, flags.strings)) {
- if (isNumber(val)) value = Number(val)
- if (!isUndefined(val) && !isNumber(val) && checkAllAliases(key, flags.numbers)) value = NaN
- }
-
- // increment a count given as arg (either no value or value parsed as boolean)
- if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === 'boolean')) {
- value = increment
- }
-
- // Set normalized value when key is in 'normalize' and in 'arrays'
- if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) {
- value = path.normalize(val)
- }
+ var value = processValue(key, val)
var splitKey = key.split('.')
setKey(argv, splitKey, value)
@@ -385,6 +389,31 @@ function parse (args, opts) {
}
}
+ function processValue (key, val) {
+ // handle parsing boolean arguments --foo=true --bar false.
+ if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
+ if (typeof val === 'string') val = val === 'true'
+ }
+
+ var value = val
+ if (!checkAllAliases(key, flags.strings) && !checkAllAliases(key, flags.coercions)) {
+ if (isNumber(val)) value = Number(val)
+ if (!isUndefined(val) && !isNumber(val) && checkAllAliases(key, flags.numbers)) value = NaN
+ }
+
+ // increment a count given as arg (either no value or value parsed as boolean)
+ if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === 'boolean')) {
+ value = increment
+ }
+
+ // Set normalized value when key is in 'normalize' and in 'arrays'
+ if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) {
+ if (Array.isArray(val)) value = val.map(path.normalize)
+ else value = path.normalize(val)
+ }
+ return value
+ }
+
// set args from config.json file, this should be
// applied last so that defaults can be applied.
function setConfig (argv) {
@@ -430,7 +459,10 @@ function parse (args, opts) {
var value = config[key]
var fullKey = prev ? prev + '.' + key : key
- if (Object.prototype.toString.call(value) === '[object Object]') {
+ // if the value is an inner object and we have dot-notation
+ // enabled, treat inner objects in config the same as
+ // heavily nested dot notations (foo.bar.apple).
+ if (typeof value === 'object' && !Array.isArray(value) && configuration['dot-notation']) {
// if the value is an object but not an array, check nested object
setConfigObject(value, fullKey)
} else {
@@ -472,6 +504,20 @@ function parse (args, opts) {
})
}
+ function applyCoercions (argv) {
+ var coerce
+ Object.keys(argv).forEach(function (key) {
+ coerce = checkAllAliases(key, flags.coercions)
+ if (typeof coerce === 'function') {
+ try {
+ argv[key] = coerce(argv[key])
+ } catch (err) {
+ error = err
+ }
+ }
+ })
+ }
+
function applyDefaultsAndAliases (obj, aliases, defaults) {
Object.keys(defaults).forEach(function (key) {
if (!hasKey(obj, key.split('.'))) {
@@ -512,16 +558,26 @@ function parse (args, opts) {
var key = keys[keys.length - 1]
+ var isTypeArray = checkAllAliases(key, flags.arrays)
+ var isValueArray = Array.isArray(value)
+ var duplicate = configuration['duplicate-arguments-array']
+
if (value === increment) {
o[key] = increment(o[key])
- } else if (o[key] === undefined && checkAllAliases(key, flags.arrays)) {
- o[key] = Array.isArray(value) ? value : [value]
- } else if (o[key] === undefined || checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
- o[key] = value
} else if (Array.isArray(o[key])) {
- o[key].push(value)
- } else {
+ if (duplicate && isTypeArray && isValueArray) {
+ o[key] = configuration['flatten-duplicate-arrays'] ? o[key].concat(value) : [o[key]].concat([value])
+ } else if (!duplicate && Boolean(isTypeArray) === Boolean(isValueArray)) {
+ o[key] = value
+ } else {
+ o[key] = o[key].concat([value])
+ }
+ } else if (o[key] === undefined && isTypeArray) {
+ o[key] = isValueArray ? value : [value]
+ } else if (duplicate && !(o[key] === undefined || checkAllAliases(key, flags.bools) || checkAllAliases(keys.join('.'), flags.bools) || checkAllAliases(key, flags.counts))) {
o[key] = [ o[key], value ]
+ } else {
+ o[key] = value
}
}
@@ -593,9 +649,9 @@ function parse (args, opts) {
function guessType (key, flags) {
var type = 'boolean'
- if (flags.strings && flags.strings[key]) type = 'string'
- else if (flags.numbers && flags.numbers[key]) type = 'number'
- else if (flags.arrays && flags.arrays[key]) type = 'array'
+ if (checkAllAliases(key, flags.strings)) type = 'string'
+ else if (checkAllAliases(key, flags.numbers)) type = 'number'
+ else if (checkAllAliases(key, flags.arrays)) type = 'array'
return type
}
@@ -667,6 +723,20 @@ function combineAliases (aliases) {
return combined
}
+function assign (defaults, configuration) {
+ var o = {}
+ configuration = configuration || {}
+
+ Object.keys(defaults).forEach(function (k) {
+ o[k] = defaults[k]
+ })
+ Object.keys(configuration).forEach(function (k) {
+ o[k] = configuration[k]
+ })
+
+ return o
+}
+
// this function should only be called when a count is given as an arg
// it is NOT called to set a default value
// thus we can start the count at 1 instead of 0
diff --git a/node_modules/yargs-parser/node_modules/camelcase/index.js b/node_modules/yargs-parser/node_modules/camelcase/index.js
@@ -1,56 +0,0 @@
-'use strict';
-
-function preserveCamelCase(str) {
- var isLastCharLower = false;
-
- for (var i = 0; i < str.length; i++) {
- var c = str.charAt(i);
-
- if (isLastCharLower && (/[a-zA-Z]/).test(c) && c.toUpperCase() === c) {
- str = str.substr(0, i) + '-' + str.substr(i);
- isLastCharLower = false;
- i++;
- } else {
- isLastCharLower = (c.toLowerCase() === c);
- }
- }
-
- return str;
-}
-
-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.toLowerCase();
- }
-
- 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;
- }
-
- str = preserveCamelCase(str);
-
- return str
- .replace(/^[_.\- ]+/, '')
- .toLowerCase()
- .replace(/[_.\- ]+(\w|$)/g, function (m, p1) {
- return p1.toUpperCase();
- });
-};
diff --git a/node_modules/yargs-parser/node_modules/camelcase/license b/node_modules/yargs-parser/node_modules/camelcase/license
@@ -1,21 +0,0 @@
-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.
diff --git a/node_modules/yargs-parser/node_modules/camelcase/package.json b/node_modules/yargs-parser/node_modules/camelcase/package.json
@@ -1,39 +0,0 @@
-{
- "name": "camelcase",
- "version": "3.0.0",
- "description": "Convert a dash/dot/underscore/space separated string to camelCase: foo-bar → fooBar",
- "license": "MIT",
- "repository": "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": "*"
- }
-}
diff --git a/node_modules/yargs-parser/node_modules/camelcase/readme.md b/node_modules/yargs-parser/node_modules/camelcase/readme.md
@@ -1,57 +0,0 @@
-# camelcase [](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)
diff --git a/node_modules/yargs-parser/package.json b/node_modules/yargs-parser/package.json
@@ -1,13 +1,13 @@
{
"name": "yargs-parser",
- "version": "2.4.1",
+ "version": "4.2.1",
"description": "the mighty option parser used by yargs",
"main": "index.js",
"scripts": {
"pretest": "standard",
"test": "nyc mocha test/*.js",
"coverage": "nyc report --reporter=text-lcov | coveralls",
- "version": "standard-version"
+ "release": "standard-version"
},
"repository": {
"url": "git@github.com:yargs/yargs-parser.git"
@@ -27,15 +27,14 @@
"license": "ISC",
"devDependencies": {
"chai": "^3.5.0",
- "coveralls": "^2.11.8",
- "mocha": "^2.4.5",
- "nyc": "^7.0.0",
- "standard": "^7.1.0",
- "standard-version": "^2.1.2"
+ "coveralls": "^2.11.12",
+ "mocha": "^3.0.1",
+ "nyc": "^10.0.0",
+ "standard": "^8.0.0",
+ "standard-version": "^4.0.0"
},
"dependencies": {
- "camelcase": "^3.0.0",
- "lodash.assign": "^4.0.6"
+ "camelcase": "^3.0.0"
},
"files": [
"lib",
diff --git a/node_modules/yargs/CHANGELOG.md b/node_modules/yargs/CHANGELOG.md
@@ -1,4 +1,440 @@
-## Change Log
+# Change Log
+
+All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+<a name="6.4.0"></a>
+# [6.4.0](https://github.com/yargs/yargs/compare/v6.3.0...v6.4.0) (2016-11-13)
+
+
+### Bug Fixes
+
+* **locales:** correct some Russian translations ([#691](https://github.com/yargs/yargs/issues/691)) ([a980671](https://github.com/yargs/yargs/commit/a980671))
+
+
+### Features
+
+* **locales:** Added Belarusian translation ([#690](https://github.com/yargs/yargs/issues/690)) ([68dac1f](https://github.com/yargs/yargs/commit/68dac1f))
+* **locales:** Create nl.json ([#687](https://github.com/yargs/yargs/issues/687)) ([46ce1bb](https://github.com/yargs/yargs/commit/46ce1bb))
+* update to yargs-parser that addresses [#598](https://github.com/yargs/yargs/issues/598), [#617](https://github.com/yargs/yargs/issues/617) ([#700](https://github.com/yargs/yargs/issues/700)) ([54cb31d](https://github.com/yargs/yargs/commit/54cb31d))
+* yargs is now passed as the third-argument to fail handler ([#613](https://github.com/yargs/yargs/issues/613)) ([21b74f9](https://github.com/yargs/yargs/commit/21b74f9))
+
+
+### Performance Improvements
+
+* normalizing package data is an expensive operation ([#705](https://github.com/yargs/yargs/issues/705)) ([49cf533](https://github.com/yargs/yargs/commit/49cf533))
+
+
+
+<a name="6.3.0"></a>
+# [6.3.0](https://github.com/yargs/yargs/compare/v6.2.0...v6.3.0) (2016-10-19)
+
+
+### Bug Fixes
+
+* **command:** subcommands via commandDir() now supported for parse(msg, cb) ([#678](https://github.com/yargs/yargs/issues/678)) ([6b85cc6](https://github.com/yargs/yargs/commit/6b85cc6))
+
+
+### Features
+
+* **locales:** Add Thai locale file ([#679](https://github.com/yargs/yargs/issues/679)) ([c05e36b](https://github.com/yargs/yargs/commit/c05e36b))
+
+
+
+<a name="6.2.0"></a>
+# [6.2.0](https://github.com/yargs/yargs/compare/v6.1.1...v6.2.0) (2016-10-16)
+
+
+### Bug Fixes
+
+* stop applying parser to context object ([#675](https://github.com/yargs/yargs/issues/675)) ([3fe9b8f](https://github.com/yargs/yargs/commit/3fe9b8f))
+
+
+### Features
+
+* add new pt_BR translations ([#674](https://github.com/yargs/yargs/issues/674)) ([5615a82](https://github.com/yargs/yargs/commit/5615a82))
+* Italian translations for 'did you mean' and 'aliases' ([#673](https://github.com/yargs/yargs/issues/673)) ([81984e6](https://github.com/yargs/yargs/commit/81984e6))
+
+
+
+<a name="6.1.1"></a>
+## [6.1.1](https://github.com/yargs/yargs/compare/v6.1.0...v6.1.1) (2016-10-15)
+
+
+### Bug Fixes
+
+* freeze was not resetting configObjects to initial state; addressed performance issue raised by [@nexdrew](https://github.com/nexdrew). ([#670](https://github.com/yargs/yargs/issues/670)) ([ae4bcd4](https://github.com/yargs/yargs/commit/ae4bcd4))
+
+
+
+<a name="6.1.0"></a>
+# [6.1.0](https://github.com/yargs/yargs/compare/v6.0.0...v6.1.0) (2016-10-15)
+
+
+### Bug Fixes
+
+* **locales:** change some translations ([#667](https://github.com/yargs/yargs/issues/667)) ([aa966c5](https://github.com/yargs/yargs/commit/aa966c5))
+* **locales:** conform hi locale to y18n.__n expectations ([#666](https://github.com/yargs/yargs/issues/666)) ([22adb18](https://github.com/yargs/yargs/commit/22adb18))
+
+
+### Features
+
+* initial support for command aliases ([#647](https://github.com/yargs/yargs/issues/647)) ([127a040](https://github.com/yargs/yargs/commit/127a040))
+* **command:** add camelcase commands to argv ([#658](https://github.com/yargs/yargs/issues/658)) ([b1cabae](https://github.com/yargs/yargs/commit/b1cabae))
+* **locales:** add Hindi translations ([9290912](https://github.com/yargs/yargs/commit/9290912))
+* **locales:** add Hungarian translations ([be92327](https://github.com/yargs/yargs/commit/be92327))
+* **locales:** Japanese translations for 'did you mean' and 'aliases' ([#651](https://github.com/yargs/yargs/issues/651)) ([5eb78fc](https://github.com/yargs/yargs/commit/5eb78fc))
+* **locales:** Polish translations for 'did you mean' and 'aliases' ([#650](https://github.com/yargs/yargs/issues/650)) ([c951c0e](https://github.com/yargs/yargs/commit/c951c0e))
+* reworking yargs API to make it easier to run in headless environments, e.g., Slack ([#646](https://github.com/yargs/yargs/issues/646)) ([f284c29](https://github.com/yargs/yargs/commit/f284c29))
+* Turkish translations for 'did you mean' and 'aliases' ([#660](https://github.com/yargs/yargs/issues/660)) ([072fd45](https://github.com/yargs/yargs/commit/072fd45))
+
+
+
+<a name="6.0.0"></a>
+# [6.0.0](https://github.com/yargs/yargs/compare/v5.0.0...v6.0.0) (2016-09-30)
+
+
+### Bug Fixes
+
+* changed parsing of the command string to ignore extra spaces ([#600](https://github.com/yargs/yargs/issues/600)) ([e8e5a72](https://github.com/yargs/yargs/commit/e8e5a72))
+* drop lodash.assign ([#641](https://github.com/yargs/yargs/issues/641)) ([ad3146f](https://github.com/yargs/yargs/commit/ad3146f))
+* for args that have skipValidation set to `true`, check if the parsed arg is `true` ([#619](https://github.com/yargs/yargs/issues/619)) ([658a34c](https://github.com/yargs/yargs/commit/658a34c))
+* upgrade standard, and fix appveyor config so that it works with newest standard ([#607](https://github.com/yargs/yargs/issues/607)) ([c301f42](https://github.com/yargs/yargs/commit/c301f42))
+
+
+### Chores
+
+* upgrade yargs-parser ([#633](https://github.com/yargs/yargs/issues/633)) ([cc1224e](https://github.com/yargs/yargs/commit/cc1224e))
+
+
+### Features
+
+* make opts object optional for .option() ([#624](https://github.com/yargs/yargs/issues/624)) ([4f29de6](https://github.com/yargs/yargs/commit/4f29de6))
+
+
+### Performance Improvements
+
+* defer windowWidth() to improve perf for non-help usage ([#610](https://github.com/yargs/yargs/issues/610)) ([cbc3636](https://github.com/yargs/yargs/commit/cbc3636))
+
+
+### BREAKING CHANGES
+
+* coerce is now applied as a final step after other parsing is complete
+
+
+
+<a name="5.0.0"></a>
+# [5.0.0](https://github.com/yargs/yargs/compare/v4.8.1...v5.0.0) (2016-08-14)
+
+
+### Bug Fixes
+
+* **default:** Remove undocumented alias of default() ([#469](https://github.com/yargs/yargs/issues/469)) ([b8591b2](https://github.com/yargs/yargs/commit/b8591b2))
+* remove deprecated zh.json ([#578](https://github.com/yargs/yargs/issues/578)) ([317c62c](https://github.com/yargs/yargs/commit/317c62c))
+
+
+### Features
+
+* .help() API can now enable implicit help command ([#574](https://github.com/yargs/yargs/issues/574)) ([7645019](https://github.com/yargs/yargs/commit/7645019))
+* **command:** builder function no longer needs to return the yargs instance ([#549](https://github.com/yargs/yargs/issues/549)) ([eaa2873](https://github.com/yargs/yargs/commit/eaa2873))
+* add coerce api ([#586](https://github.com/yargs/yargs/issues/586)) ([1d53ccb](https://github.com/yargs/yargs/commit/1d53ccb))
+* adds recommendCommands() for command suggestions ([#580](https://github.com/yargs/yargs/issues/580)) ([59474dc](https://github.com/yargs/yargs/commit/59474dc))
+* apply .env() globally ([#553](https://github.com/yargs/yargs/issues/553)) ([be65728](https://github.com/yargs/yargs/commit/be65728))
+* apply default builder to command() and apply fail() handlers globally ([#583](https://github.com/yargs/yargs/issues/583)) ([0aaa68b](https://github.com/yargs/yargs/commit/0aaa68b))
+* update yargs-parser to version 3.1.0 ([#581](https://github.com/yargs/yargs/issues/581)) ([882a127](https://github.com/yargs/yargs/commit/882a127))
+
+
+### Performance Improvements
+
+* defer requiring most external libs until needed ([#584](https://github.com/yargs/yargs/issues/584)) ([f9b0ed4](https://github.com/yargs/yargs/commit/f9b0ed4))
+
+
+### BREAKING CHANGES
+
+* fail is now applied globally.
+* we now default to an empty builder function when command is executed with no builder.
+* yargs-parser now better handles negative integer values, at the cost of handling numeric option names, e.g., -1 hello
+* default: removed undocumented `defaults` alias for `default`.
+* introduces a default `help` command which outputs help, as an alternative to a help flag.
+* interpret demand() numbers as relative to executing command ([#582](https://github.com/yargs/yargs/issues/582)) ([927810c](https://github.com/yargs/yargs/commit/927810c))
+
+
+
+<a name="4.8.1"></a>
+## [4.8.1](https://github.com/yargs/yargs/compare/v4.8.0...v4.8.1) (2016-07-16)
+
+
+### Bug Fixes
+
+* **commandDir:** make dir relative to caller instead of require.main.filename ([#548](https://github.com/yargs/yargs/issues/548)) ([3c2e479](https://github.com/yargs/yargs/commit/3c2e479))
+* add config lookup for .implies() ([#556](https://github.com/yargs/yargs/issues/556)) ([8d7585c](https://github.com/yargs/yargs/commit/8d7585c))
+* cache pkg lookups by path to avoid returning the wrong one ([#552](https://github.com/yargs/yargs/issues/552)) ([fea7e0b](https://github.com/yargs/yargs/commit/fea7e0b))
+* positional arguments were not being handled appropriately by parse() ([#559](https://github.com/yargs/yargs/issues/559)) ([063a866](https://github.com/yargs/yargs/commit/063a866))
+* pull in [@nexdrew](https://github.com/nexdrew)'s fixes to yargs-parser ([#560](https://github.com/yargs/yargs/issues/560)) ([c77c080](https://github.com/yargs/yargs/commit/c77c080)), closes [#560](https://github.com/yargs/yargs/issues/560)
+
+
+
+<a name="4.8.0"></a>
+# [4.8.0](https://github.com/yargs/yargs/compare/v4.7.1...v4.8.0) (2016-07-09)
+
+
+### Bug Fixes
+
+* drop unused camelcase dependency fixes [#516](https://github.com/yargs/yargs/issues/516) ([#525](https://github.com/yargs/yargs/issues/525)) ([365fb9a](https://github.com/yargs/yargs/commit/365fb9a)), closes [#516](https://github.com/yargs/yargs/issues/516) [#525](https://github.com/yargs/yargs/issues/525)
+* fake a tty in tests, so that we can use the new set-blocking ([#512](https://github.com/yargs/yargs/issues/512)) ([a54c742](https://github.com/yargs/yargs/commit/a54c742))
+* ignore invalid package.json during read-pkg-up ([#546](https://github.com/yargs/yargs/issues/546)) ([e058c87](https://github.com/yargs/yargs/commit/e058c87))
+* keep both zh and zh_CN until yargs[@5](https://github.com/5).x ([0f8faa7](https://github.com/yargs/yargs/commit/0f8faa7))
+* lazy-load package.json and cache. get rid of pkg-conf dependency. ([#544](https://github.com/yargs/yargs/issues/544)) ([2609b2e](https://github.com/yargs/yargs/commit/2609b2e))
+* we now respect the order of _ when applying commands ([#537](https://github.com/yargs/yargs/issues/537)) ([ed86b78](https://github.com/yargs/yargs/commit/ed86b78))
+
+
+### Features
+
+* add .commandDir(dir) to API to apply all command modules from a relative directory ([#494](https://github.com/yargs/yargs/issues/494)) ([b299dff](https://github.com/yargs/yargs/commit/b299dff))
+* **command:** derive missing command string from module filename ([#527](https://github.com/yargs/yargs/issues/527)) ([20d4b8a](https://github.com/yargs/yargs/commit/20d4b8a))
+* builder is now optional for a command module ([#545](https://github.com/yargs/yargs/issues/545)) ([8d6ad6e](https://github.com/yargs/yargs/commit/8d6ad6e))
+
+
+
+<a name="4.7.1"></a>
+## [4.7.1](https://github.com/yargs/yargs/compare/v4.7.0...v4.7.1) (2016-05-15)
+
+
+### Bug Fixes
+
+* switch to using `const` rather than `var` ([#499](https://github.com/yargs/yargs/pull/499))
+* make stdout flush on newer versions of Node.js ([#501](https://github.com/yargs/yargs/issues/501)) ([9f8c6f4](https://github.com/yargs/yargs/commit/9f8c6f4))
+
+
+
+<a name="4.7.0"></a>
+# [4.7.0](https://github.com/yargs/yargs/compare/v4.6.0...v4.7.0) (2016-05-02)
+
+
+### Bug Fixes
+
+* **pkgConf:** fix aliases issues in .pkgConf() ([#478](https://github.com/yargs/yargs/issues/478))([b900502](https://github.com/yargs/yargs/commit/b900502))
+
+
+### Features
+
+* **completion:** allow to get completions for any string, not just process.argv ([#470](https://github.com/yargs/yargs/issues/470))([74fcfbc](https://github.com/yargs/yargs/commit/74fcfbc))
+* **configuration:** Allow to directly pass a configuration object to .config() ([#480](https://github.com/yargs/yargs/issues/480))([e0a7e05](https://github.com/yargs/yargs/commit/e0a7e05))
+* **validation:** Add .skipValidation() method ([#471](https://github.com/yargs/yargs/issues/471))([d72badb](https://github.com/yargs/yargs/commit/d72badb))
+
+
+
+<a name="4.6.0"></a>
+# [4.6.0](https://github.com/yargs/yargs/compare/v4.5.0...v4.6.0) (2016-04-11)
+
+
+### Bug Fixes
+
+* **my brand!:** I agree with [@osher](https://github.com/osher) lightweight isn't a huge selling point of ours any longer, see [#468](https://github.com/yargs/yargs/issues/468) ([c46d7e1](https://github.com/yargs/yargs/commit/c46d7e1))
+
+### Features
+
+* switch to standard-version for release management ([f70f801](https://github.com/yargs/yargs/commit/f70f801))
+* upgrade to version of yargs-parser that introduces some slick new features, great work [@elas7](https://github.com/elas7). update cliui, replace win-spawn, replace badge. ([#475](https://github.com/yargs/yargs/issues/475)) ([f915dd4](https://github.com/yargs/yargs/commit/f915dd4))
+
+
+
+<a name="4.5.0"></a>
+# [4.5.0](https://github.com/yargs/yargs/compare/v4.4.0...v4.5.0) (2016-04-05)
+
+
+### Bug Fixes
+
+* **windows:** handle $0 better on Windows platforms ([eb6e03f](https://github.com/yargs/yargs/commit/eb6e03f))
+
+### Features
+
+* **commands:** implemented variadic positional arguments ([51d926e](https://github.com/yargs/yargs/commit/51d926e))
+* **completion:** completion now better handles aliases, and avoids duplicating keys. ([86416c8](https://github.com/yargs/yargs/commit/86416c8))
+* **config:** If invoking .config() without parameters, set a default option ([0413dd1](https://github.com/yargs/yargs/commit/0413dd1))
+* **conventional-changelog:** switching to using conventional-changelog for generating the changelog ([a2b5a2a](https://github.com/yargs/yargs/commit/a2b5a2a))
+
+
+
+### v4.4.0 (2016/04/03 21:10 +07:00)
+
+- [#454](https://github.com/yargs/yargs/pull/454) fix demand() when second argument is an array (@elas7)
+- [#452](https://github.com/yargs/yargs/pull/452) fix code example for `.help()` docs (@maxrimue)
+- [#450](https://github.com/yargs/yargs/pull/450) fix for bash completion trailing space edge-case (@elas7)
+- [#448](https://github.com/yargs/yargs/pull/448) allow a method to be passed to `showHelp`, rather than a log-level (@osher)
+- [#446](https://github.com/yargs/yargs/pull/446) update yargs-parser, y18n, nyc, cliui, pkg-conf (@bcoe)
+- [#436](https://github.com/yargs/yargs/pull/436) the rebase method is only used by tests, do not export it in two places (@elas7)
+- [#428](https://github.com/yargs/yargs/pull/428) initial support for subcommands (@nexdrew)
+
+### v4.3.2 (2016/3/20 15:07 +07:00)
+
+- [#445](https://github.com/yargs/yargs/pull/445) strict mode was failing if no commands were registered (@nexdrew)
+- [#443](https://github.com/yargs/yargs/pull/443) adds Italian translation \o/ (@madrisan)
+- [#441](https://github.com/yargs/yargs/pull/441) remove duplicate keys from array options configuration (@elas7)
+- [#437](https://github.com/yargs/yargs/pull/437) standardize tests for .command() (@lrlna)
+
+### v4.3.0 (2016/3/12 14:19 +07:00)
+
+- [#432](https://github.com/yargs/yargs/pull/432) non-singleton version of yargs (@bcoe)
+- [#422, #425, #420] translations for number (@zkat, @rilut, @maxrimue, @watilde)
+- [#414](https://github.com/yargs/yargs/pull/414) all command options can be defined in module now (@nexdrew)
+
+### v4.2.0 (2016/2/22 11:02 +07:00)
+
+- [#395](https://github.com/yargs/yargs/pull/395) do not reset groups if they contain
+ global keys (@novemberborn)
+- [#393](https://github.com/yargs/yargs/pull/393) use sane default for usage strings (@nexdrew)
+- [#392](https://github.com/yargs/yargs/pull/392) resetting wrap() was causing layout issues
+ with commands (@nexdrew)
+- [#391](https://github.com/yargs/yargs/pull/391) commands were being added multiple times (@nexdrew)
+
+### v4.0.0 (2016/2/14 1:27 +07:00)
+
+- [#384](https://github.com/bcoe/yargs/pull/384) add new number type to yargs (@lrlna, @maxrimue)
+- [#382](https://github.com/bcoe/yargs/pull/382) pass error as extra parameter to fail (@gajus)
+- [#378](https://github.com/bcoe/yargs/pull/378) introduces the pkgConf feature, which tells
+ yargs to load default argument values from a key on a project's package.json (@bcoe)
+- [#376](https://github.com/bcoe/yargs/pull/376) **breaking change**, make help() method signature
+ more consistent with other commands (@maxrimue)
+- [#368](https://github.com/bcoe/yargs/pull/368) **breaking change**, overhaul to command handling API:
+ introducing named positional arguments, commands as modules, introduces the concept of global options (options that don't reset). (@nexdrew, @bcoe).
+- [#364](https://github.com/bcoe/yargs/pull/364) add the slick new yargs website to the package.json (@iarna).
+- [#357](https://github.com/bcoe/yargs/pull/357) .strict() now requires that a valid command is provided (@lrlna)
+- [#356](https://github.com/bcoe/yargs/pull/356) pull the parsing bits of yargs into the separate module yargs-parser. Various parsing options can now be turned on and off using configuration (@bcoe).
+- [#330](https://github.com/bcoe/yargs/pull/330) **breaking change**, fix inconsistencies with `.version()` API. (@maxrimue).
+
+### v3.32.0 (2016/1/14 10:13 +07:00)
+
+- [#344](https://github.com/bcoe/yargs/pull/344) yargs now has a code of conduct and contributor guidelines (@bcoe)
+- [#341](https://github.com/bcoe/yargs/issues/341) Fix edge-case with camel-case arguments (@davibe)
+- [#331](https://github.com/bcoe/yargs/pull/331) Handle parsing a raw argument string (@kellyselden)
+- [#325](https://github.com/bcoe/yargs/pull/325) Tweaks to make tests pass again on Windows (@isaacs)
+- [#321](https://github.com/bcoe/yargs/pull/321) Custom config parsing function (@bcoe)
+
+### v3.31.0 (2015/12/03 10:15 +07:00)
+
+- [#239](https://github.com/bcoe/yargs/pull/239) Pass argv to commands (@bcoe)
+- [#308](https://github.com/bcoe/yargs/pull/308) Yargs now handles environment variables (@nexdrew)
+- [#302](https://github.com/bcoe/yargs/pull/302) Add Indonesian translation (@rilut)
+- [#300](https://github.com/bcoe/yargs/pull/300) Add Turkish translation (@feyzo)
+- [#298](https://github.com/bcoe/yargs/pull/298) Add Norwegian Bokmål translation (@sindresorhus)
+- [#297](https://github.com/bcoe/yargs/pull/297) Fix for layout of cjk characters (@disjukr)
+- [#296](https://github.com/bcoe/yargs/pull/296) Add Korean translation (@disjukr)
+
+### v3.30.0 (2015/11/13 16:29 +07:00)
+
+- [#293](https://github.com/bcoe/yargs/pull/293) Polish language support (@kamilogorek)
+- [#291](https://github.com/bcoe/yargs/pull/291) fix edge-cases with `.alias()` (@bcoe)
+- [#289](https://github.com/bcoe/yargs/pull/289) group options in custom groups (@bcoe)
+
+### v3.29.0 (2015/10/16 21:51 +07:00)
+
+- [#282](https://github.com/bcoe/yargs/pull/282) completions now accept promises (@LinusU)
+- [#281](https://github.com/bcoe/yargs/pull/281) fix parsing issues with dot notation (@bcoe)
+
+### v3.28.0 (2015/10/16 1:55 +07:00)
+
+- [#277](https://github.com/bcoe/yargs/pull/277) adds support for ansi escape codes (@bcoe)
+
+### v3.27.0 (2015/10/08 1:55 +00:00)
+
+- [#271](https://github.com/bcoe/yargs/pull/273) skips validation for help or version flags with exitProcess(false) (@tepez)
+- [#273](https://github.com/bcoe/yargs/pull/273) implements single output for errors with exitProcess(false) (@nexdrew)
+- [#269](https://github.com/bcoe/yargs/pull/269) verifies single output for errors with exitProcess(false) (@tepez)
+- [#268](https://github.com/bcoe/yargs/pull/268) adds Chinese translation (@qiu8310)
+- [#266](https://github.com/bcoe/yargs/pull/266) adds case for -- after -- in parser test (@geophree)
+
+### v3.26.0 (2015/09/25 2:14 +00:00)
+
+- [#263](https://github.com/bcoe/yargs/pull/263) document count() and option() object keys (@nexdrew)
+- [#259](https://github.com/bcoe/yargs/pull/259) remove util in readme (@38elements)
+- [#258](https://github.com/bcoe/yargs/pull/258) node v4 builds, update deps (@nexdrew)
+- [#257](https://github.com/bcoe/yargs/pull/257) fix spelling errors (@dkoleary88)
+
+### v3.25.0 (2015/09/13 7:38 -07:00)
+
+- [#254](https://github.com/bcoe/yargs/pull/254) adds Japanese translation (@oti)
+- [#253](https://github.com/bcoe/yargs/pull/253) fixes for tests on Windows (@bcoe)
+
+### v3.24.0 (2015/09/04 12:02 +00:00)
+
+- [#248](https://github.com/bcoe/yargs/pull/248) reinstate os-locale, no spawning (@nexdrew)
+- [#249](https://github.com/bcoe/yargs/pull/249) use travis container-based infrastructure (@nexdrew)
+- [#247](https://github.com/bcoe/yargs/pull/247) upgrade standard (@nexdrew)
+
+### v3.23.0 (2015/08/30 23:00 +00:00)
+
+- [#246](https://github.com/bcoe/yargs/pull/246) detect locale based only on environment variables (@bcoe)
+- [#244](https://github.com/bcoe/yargs/pull/244) adds Windows CI testing (@bcoe)
+- [#245](https://github.com/bcoe/yargs/pull/245) adds OSX CI testing (@bcoe, @nexdrew)
+
+### v3.22.0 (2015/08/28 22:26 +00:00)
+- [#242](https://github.com/bcoe/yargs/pull/242) adds detectLocale config option (@bcoe)
+
+### v3.21.1 (2015/08/28 20:58 +00:00)
+- [#240](https://github.com/bcoe/yargs/pull/240) hot-fix for Atom on Windows (@bcoe)
+
+### v3.21.0 (2015/08/21 21:20 +00:00)
+- [#238](https://github.com/bcoe/yargs/pull/238) upgrade camelcase, window-size, chai, mocha (@nexdrew)
+- [#237](https://github.com/bcoe/yargs/pull/237) adds defaultDescription to option() (@nexdrew)
+
+### v3.20.0 (2015/08/20 01:29 +00:00)
+- [#231](https://github.com/bcoe/yargs/pull/231) Merge pull request #231 from bcoe/detect-locale (@sindresorhus)
+- [#235](https://github.com/bcoe/yargs/pull/235) adds german translation to yargs (@maxrimue)
+
+### v3.19.0 (2015/08/14 05:12 +00:00)
+- [#224](https://github.com/bcoe/yargs/pull/224) added Portuguese translation (@codemonkey3045)
+
+### v3.18.1 (2015/08/12 05:53 +00:00)
+
+- [#228](https://github.com/bcoe/yargs/pull/228) notes about embedding yargs in Electron (@etiktin)
+- [#223](https://github.com/bcoe/yargs/pull/223) make booleans work in config files (@sgentle)
+
+### v3.18.0 (2015/08/06 20:05 +00:00)
+- [#222](https://github.com/bcoe/yargs/pull/222) updates fr locale (@nexdrew)
+- [#221](https://github.com/bcoe/yargs/pull/221) adds missing locale strings (@nexdrew)
+- [#220](https://github.com/bcoe/yargs/pull/220) adds es locale (@zkat)
+
+### v3.17.1 (2015/08/02 19:35 +00:00)
+- [#218](https://github.com/bcoe/yargs/pull/218) upgrades nyc (@bcoe)
+
+### v3.17.0 (2015/08/02 18:39 +00:00)
+- [#217](https://github.com/bcoe/yargs/pull/217) sort methods in README.md (@nexdrew)
+- [#215](https://github.com/bcoe/yargs/pull/215) adds fr locale (@LoicMahieu)
+
+### v3.16.0 (2015/07/30 04:35 +00:00)
+- [#210](https://github.com/bcoe/yargs/pull/210) adds i18n support to yargs (@bcoe)
+- [#209](https://github.com/bcoe/yargs/pull/209) adds choices type to yargs (@nexdrew)
+- [#207](https://github.com/bcoe/yargs/pull/207) pretty new shields from shields.io (@SimenB)
+- [#208](https://github.com/bcoe/yargs/pull/208) improvements to README.md (@nexdrew)
+- [#205](https://github.com/bcoe/yargs/pull/205) faster build times on Travis (@ChristianMurphy)
+
+### v3.15.0 (2015/07/06 06:01 +00:00)
+- [#197](https://github.com/bcoe/yargs/pull/197) tweaks to how errors bubble up from parser.js (@bcoe)
+- [#193](https://github.com/bcoe/yargs/pull/193) upgraded nyc, reporting now happens by default (@bcoe)
+
+### v3.14.0 (2015/06/28 02:12 +00:00)
+
+- [#192](https://github.com/bcoe/yargs/pull/192) standard style nits (@bcoe)
+- [#190](https://github.com/bcoe/yargs/pull/190) allow for hidden commands, e.g.,
+ .completion('completion', false) (@tschaub)
+
+### v3.13.0 (2015/06/24 04:12 +00:00)
+
+- [#187](https://github.com/bcoe/yargs/pull/187) completion now behaves differently
+ if it is being run in the context of a command (@tschaub)
+- [#186](https://github.com/bcoe/yargs/pull/186) if no matches are found for a completion
+ default to filename completion (@tschaub)
+
+### v3.12.0 (2015/06/19 03:23 +00:00)
+- [#183](https://github.com/bcoe/yargs/pull/183) don't complete commands if they've already been completed (@tschaub)
+- [#181](https://github.com/bcoe/yargs/pull/181) various fixes for completion. (@bcoe, @tschaub)
+- [#182](https://github.com/bcoe/yargs/pull/182) you can now set a maximum # of of required arguments (@bcoe)
+
+### v3.11.0 (2015/06/15 05:15 +00:00)
+
+- [#173](https://github.com/bcoe/yargs/pull/173) update standard, window-size, chai (@bcoe)
+- [#171](https://github.com/bcoe/yargs/pull/171) a description can now be set
+ when providing a config option. (@5c077yP)
### v3.10.0 (2015/05/29 04:25 +00:00)
diff --git a/node_modules/yargs/LICENSE b/node_modules/yargs/LICENSE
@@ -1,4 +1,5 @@
Copyright 2010 James Halliday (mail@substack.net)
+Modified work Copyright 2014 Contributors (ben@npmjs.com)
This project is free software released under the MIT/X11 license:
diff --git a/node_modules/yargs/README.md b/node_modules/yargs/README.md
@@ -1,16 +1,19 @@
-yargs
+ yargs
========
Yargs be a node.js library fer hearties tryin' ter parse optstrings.
With yargs, ye be havin' a map that leads straight to yer treasure! Treasure of course, being a simple option hash.
-[](https://travis-ci.org/bcoe/yargs)
-[](https://gemnasium.com/bcoe/yargs)
-[](https://coveralls.io/r/bcoe/yargs?branch=)
-[](https://www.npmjs.com/package/yargs)
+[![Build Status][travis-image]][travis-url]
+[![Coverage Status][coveralls-image]][coveralls-url]
+[![NPM version][npm-image]][npm-url]
+[![Windows Tests][windows-image]][windows-url]
+[![js-standard-style][standard-image]][standard-url]
+[![standard-version][standard-version-image]][standard-version-url]
+[![Gitter][gitter-image]][gitter-url]
-> Yargs is the official successor to optimist. Please feel free to submit issues and pull requests. If you'd like to contribute and don't know where to start, have a look at [the issue list](https://github.com/bcoe/yargs/issues) :)
+> Yargs is the official successor to optimist. Please feel free to submit issues and pull requests. If you'd like to contribute and don't know where to start, have a look at [the issue list](https://github.com/yargs/yargs/issues) :)
examples
========
@@ -26,8 +29,7 @@ var argv = require('yargs').argv;
if (argv.ships > 3 && argv.distance < 53.5) {
console.log('Plunder more riffiwobbles!');
-}
-else {
+} else {
console.log('Retreat from the xupptumblers!');
}
````
@@ -65,11 +67,10 @@ bool.js:
````javascript
#!/usr/bin/env node
-var util = require('util');
var argv = require('yargs').argv;
if (argv.s) {
- util.print(argv.fr ? 'Le perroquet dit: ' : 'The parrot says: ');
+ process.stdout.write(argv.fr ? 'Le perroquet dit: ' : 'The parrot says: ');
}
console.log(
(argv.fr ? 'couac' : 'squawk') + (argv.p ? '!' : '')
@@ -112,7 +113,7 @@ console.log(argv._);
Yargs even counts your booleans!
----------------------------------------------------------------------
-count.js
+count.js:
````javascript
#!/usr/bin/env node
@@ -128,7 +129,7 @@ function INFO() { VERBOSE_LEVEL >= 1 && console.log.apply(console, arguments);
function DEBUG() { VERBOSE_LEVEL >= 2 && console.log.apply(console, arguments); }
WARN("Showing only important stuff");
-INFO("Showing semi-mportant stuff too");
+INFO("Showing semi-important stuff too");
DEBUG("Extra chatty mode");
````
@@ -158,7 +159,7 @@ area.js:
````javascript
#!/usr/bin/env node
var argv = require('yargs')
- .usage('Usage: $0 -w [num] -yh[num]')
+ .usage('Usage: $0 -w [num] -h [num]')
.demand(['w','h'])
.argv;
@@ -168,10 +169,10 @@ console.log("The area is:", argv.w * argv.h);
***
$ ./area.js -w 55 -h 11
- 605
+ The area is: 605
$ node ./area.js -w 4.91 -w 2.51
- Usage: node ./area.js -w [num] -h [num]
+ Usage: area.js -w [num] -h [num]
Options:
-w [required]
@@ -179,7 +180,7 @@ console.log("The area is:", argv.w * argv.h);
Missing required arguments: h
-After yer demands have been met, demand more! Ask for non-hypenated arguments!
+After yer demands have been met, demand more! Ask for non-hyphenated arguments!
-----------------------------------------
demand_count.js:
@@ -189,17 +190,20 @@ demand_count.js:
var argv = require('yargs')
.demand(2)
.argv;
-console.dir(argv)
+console.dir(argv);
````
***
$ ./demand_count.js a
- Not enough arguments, expected 2, but only found 1
+
+ Not enough non-option arguments: got 1, need at least 2
+
$ ./demand_count.js a b
- { _: [ 'a', 'b' ], '$0': 'node ./demand_count.js' }
+ { _: [ 'a', 'b' ], '$0': 'demand_count.js' }
+
$ ./demand_count.js a b c
- { _: [ 'a', 'b', 'c' ], '$0': 'node ./demand_count.js' }
+ { _: [ 'a', 'b', 'c' ], '$0': 'demand_count.js' }
EVEN MORE SHIVER ME TIMBERS!
------------------
@@ -240,7 +244,7 @@ console.log(argv.x + argv.y);
And if you really want to get all descriptive about it...
---------------------------------------------------------
-boolean_single.js
+boolean_single.js:
````javascript
#!/usr/bin/env node
@@ -259,7 +263,7 @@ console.dir(argv._);
[ 'me hearties', 'yo', 'ho' ]
-boolean_double.js
+boolean_double.js:
````javascript
#!/usr/bin/env node
@@ -283,19 +287,18 @@ Yargs is here to help you...
Ye can describe parameters fer help messages and set aliases. Yargs figures
out how ter format a handy help string automatically.
-line_count.js
+line_count.js:
````javascript
#!/usr/bin/env node
var argv = require('yargs')
.usage('Usage: $0 <command> [options]')
.command('count', 'Count the lines in a file')
- .demand(1)
.example('$0 count -f foo.js', 'count the lines in the given file')
- .demand('f')
.alias('f', 'file')
.nargs('f', 1)
.describe('f', 'Load a file')
+ .demand(1, ['f'])
.help('h')
.alias('h', 'help')
.epilog('copyright 2015')
@@ -316,27 +319,27 @@ s.on('end', function () {
***
$ node line_count.js count
- Usage: node test.js <command> [options]
+ Usage: line_count.js <command> [options]
Commands:
count Count the lines in a file
Options:
-f, --file Load a file [required]
- -h, --help Show help
+ -h, --help Show help [boolean]
Examples:
- node test.js count -f foo.js count the lines in the given file
+ line_count.js count -f foo.js count the lines in the given file
copyright 2015
Missing required arguments: f
$ node line_count.js count --file line_count.js
- 20
+ 26
$ node line_count.js count -f line_count.js
- 20
+ 26
methods
=======
@@ -345,9 +348,9 @@ By itself,
````javascript
require('yargs').argv
-`````
+````
-will use `process.argv` array to construct the `argv` object.
+will use the `process.argv` array to construct the `argv` object.
You can pass in the `process.argv` yourself:
@@ -355,7 +358,7 @@ You can pass in the `process.argv` yourself:
require('yargs')([ '-x', '1', '-y', '2' ]).argv
````
-or use .parse() to do the same thing:
+or use `.parse()` to do the same thing:
````javascript
require('yargs').parse([ '-x', '1', '-y', '2' ])
@@ -363,7 +366,7 @@ require('yargs').parse([ '-x', '1', '-y', '2' ])
The rest of these methods below come in just before the terminating `.argv`.
-.alias(key, alias)
+<a name="alias"></a>.alias(key, alias)
------------------
Set key names as equivalent such that updates to a key will propagate to aliases
@@ -373,376 +376,511 @@ Optionally `.alias()` can take an object that maps keys to aliases.
Each key of this object should be the canonical version of the option, and each
value should be a string or an array of strings.
-.default(key, value, [description])
---------------------
-
-Set `argv[key]` to `value` if no option was specified on `process.argv`.
-
-Optionally `.default()` can take an object that maps keys to default values.
-
-But wait, there's more! the default value can be a `function` which returns
-a value. The name of the function will be used in the usage string:
-
-```js
-var argv = require('yargs')
- .default('random', function randomValue() {
- return Math.random() * 256;
- }).argv;
-```
+.argv
+-----
-Optionally, `description` can also be provided and will take precedence over
-displaying the value in the usage instructions:
+Get the arguments as a plain old object.
-```js
-.default('timeout', 60000, '(one-minute)');
-```
+Arguments without a corresponding flag show up in the `argv._` array.
-.demand(key, [msg | boolean])
------------------------------
-.require(key, [msg | boolean])
-------------------------------
-.required(key, [msg | boolean])
--------------------------------
+The script name or node command is available at `argv.$0` similarly to how `$0`
+works in bash or perl.
-If `key` is a string, show the usage information and exit if `key` wasn't
-specified in `process.argv`.
+If `yargs` is executed in an environment that embeds node and there's no script name (e.g.
+[Electron](http://electron.atom.io/) or [nw.js](http://nwjs.io/)), it will ignore the first parameter since it
+expects it to be the script name. In order to override this behavior, use `.parse(process.argv.slice(1))`
+instead of `.argv` and the first parameter won't be ignored.
-If `key` is a number, demand at least as many non-option arguments, which show
-up in `argv._`.
+<a name="array"></a>.array(key)
+----------
-If `key` is an Array, demand each element.
+Tell the parser to interpret `key` as an array. If `.array('foo')` is set,
+`--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'foo'`.
-If a `msg` string is given, it will be printed when the argument is missing,
-instead of the standard error message. This is especially helpful for the non-option arguments in `argv._`.
+<a name="boolean"></a>.boolean(key)
+-------------
-If a `boolean` value is given, it controls whether the option is demanded;
-this is useful when using `.options()` to specify command line parameters.
+Interpret `key` as a boolean. If a non-flag option follows `key` in
+`process.argv`, that string won't get set as the value of `key`.
-.requiresArg(key)
------------------
+`key` will default to `false`, unless a `default(key, undefined)` is
+explicitly set.
-Specifies either a single option key (string), or an array of options that
-must be followed by option values. If any option value is missing, show the
-usage information and exit.
+If `key` is an array, interpret all the elements as booleans.
-The default behaviour is to set the value of any key not followed by an
-option value to `true`.
+.check(fn)
+----------
-.implies(x, y)
---------------
+Check that certain conditions are met in the provided arguments.
-Given the key `x` is set, it is required that the key `y` is set.
+`fn` is called with two arguments, the parsed `argv` hash and an array of options and their aliases.
-implies can also accept an object specifying multiple implications.
+If `fn` throws or returns a non-truthy value, show the thrown error, usage information, and
+exit.
-.describe(key, desc)
---------------------
+<a name="choices"></a>.choices(key, choices)
+----------------------
-Describe a `key` for the generated usage information.
+Limit valid values for `key` to a predefined set of `choices`, given as an array
+or as an individual value.
-Optionally `.describe()` can take an object that maps keys to descriptions.
+```js
+var argv = require('yargs')
+ .alias('i', 'ingredient')
+ .describe('i', 'choose your sandwich ingredients')
+ .choices('i', ['peanut-butter', 'jelly', 'banana', 'pickles'])
+ .help('help')
+ .argv
+```
-.option(key, opt)
------------------
-.options(key, opt)
-------------------
+If this method is called multiple times, all enumerated values will be merged
+together. Choices are generally strings or numbers, and value matching is
+case-sensitive.
-Instead of chaining together `.alias().demand().default().describe().string()`, you can specify
-keys in `opt` for each of the chainable methods.
+Optionally `.choices()` can take an object that maps multiple keys to their
+choices.
-For example:
+Choices can also be specified as `choices` in the object given to `option()`.
-````javascript
+```js
var argv = require('yargs')
- .option('f', {
- alias : 'file',
- demand: true,
- default: '/etc/passwd',
- describe: 'x marks the spot',
- type: 'string'
- })
- .argv
-;
-````
+ .option('size', {
+ alias: 's',
+ describe: 'choose a size',
+ choices: ['xs', 's', 'm', 'l', 'xl']
+ })
+ .argv
+```
-is the same as
+<a name="coerce"></a>.coerce(key, fn)
+----------------
-````javascript
-var argv = require('yargs')
- .alias('f', 'file')
- .default('f', '/etc/passwd')
- .argv
-;
-````
+Provide a synchronous function to coerce or transform the value(s) given on the
+command line for `key`.
-Optionally `.options()` can take an object that maps keys to `opt` parameters.
+The coercion function should accept one argument, representing the parsed value
+from the command line, and should return a new value or throw an error. The
+returned value will be used as the value for `key` (or one of its aliases) in
+`argv`.
-````javascript
-var argv = require('yargs')
- .options({
- 'f': {
- alias: 'file',
- demand: true,
- default: '/etc/passwd',
- describe: 'x marks the spot',
- type: 'string'
- }
- })
- .argv
-;
-````
+If the function throws, the error will be treated as a validation
+failure, delegating to either a custom [`.fail()`](#fail) handler or printing
+the error message in the console.
-.usage(message, opts)
----------------------
+Coercion will be applied to a value after
+all other modifications, such as [`.normalize()`](#normalize).
-Set a usage message to show which commands to use. Inside `message`, the string
-`$0` will get interpolated to the current script name or node command for the
-present script similar to how `$0` works in bash or perl.
+_Examples:_
-`opts` is optional and acts like calling `.options(opts)`.
+```js
+var argv = require('yargs')
+ .coerce('file', function (arg) {
+ return require('fs').readFileSync(arg, 'utf8')
+ })
+ .argv
+```
-.command(cmd, desc, [fn])
--------------------
+Optionally `.coerce()` can take an object that maps several keys to their
+respective coercion function.
-Document the commands exposed by your application.
+```js
+var argv = require('yargs')
+ .coerce({
+ date: Date.parse,
+ json: JSON.parse
+ })
+ .argv
+```
-use `desc` to provide a description for each command your application accepts (the
-values stored in `argv._`).
+You can also map the same function to several keys at one time. Just pass an
+array of keys as the first argument to `.coerce()`:
-Optionally, you can provide a handler `fn` which will be executed when
-a given command is provided. The handler will be executed with an instance
-of `yargs`, which can be used to compose nested commands.
+```js
+var path = require('path')
+var argv = require('yargs')
+ .coerce(['src', 'dest'], path.resolve)
+ .argv
+```
-Here's an example of top-level and nested commands in action:
+If you are using dot-notion or arrays, .e.g., `user.email` and `user.password`,
+coercion will be applied to the final object that has been parsed:
```js
+// --user.name Batman --user.password 123
+// gives us: {name: 'batman', password: '[SECRET]'}
var argv = require('yargs')
- .usage('npm <command>')
- .command('install', 'tis a mighty fine package to install')
- .command('publish', 'shiver me timbers, should you be sharing all that', function (yargs) {
- argv = yargs.option('f', {
- alias: 'force',
- description: 'yar, it usually be a bad idea'
- })
- .help('help')
- .argv
+ .option('user')
+ .coerce('user', opt => {
+ opt.name = opt.name.toLowerCase()
+ opt.password = '[SECRET]'
+ return opt
})
- .help('help')
- .argv;
+ .argv
```
-.example(cmd, desc)
--------------------
+.command(cmd, desc, [builder], [handler])
+-----------------------------------------
+.command(cmd, desc, [module])
+-----------------------------
+.command(module)
+----------------
-Give some example invocations of your program. Inside `cmd`, the string
-`$0` will get interpolated to the current script name or node command for the
-present script similar to how `$0` works in bash or perl.
-Examples will be printed out as part of the help message.
+Define the commands exposed by your application.
+`cmd` should be a string representing the command or an array of strings
+representing the command and its aliases. Read more about command aliases in the
+subsection below.
-.epilogue(str)
---------------
-.epilog(str)
-------------
+Use `desc` to provide a description for each command your application accepts (the
+values stored in `argv._`). Set `desc` to `false` to create a hidden command.
+Hidden commands don't show up in the help output and aren't available for
+completion.
-A message to print at the end of the usage instructions, e.g.,
+Optionally, you can provide a `builder` object to give hints about the
+options that your command accepts:
```js
-var argv = require('yargs')
- .epilogue('for more information, find our manual at http://example.com');
+yargs
+ .command('get', 'make a get HTTP request', {
+ url: {
+ alias: 'u',
+ default: 'http://yargs.js.org/'
+ }
+ })
+ .help()
+ .argv
```
-.check(fn)
-----------
+Note that commands will not automatically inherit configuration _or_ options
+of their parent context. This means you'll have to re-apply configuration
+if necessary, and make options global manually using the [global](#global) method.
-Check that certain conditions are met in the provided arguments.
+Additionally, the [`help`](#help) and [`version`](#version)
+options (if used) **always** apply globally, just like the
+[`.wrap()`](#wrap) configuration.
-`fn` is called with two arguments, the parsed `argv` hash and an array of options and their aliases.
+`builder` can also be a function. This function is executed
+with a `yargs` instance, and can be used to provide _advanced_ command specific help:
-If `fn` throws or returns a non-truthy value, show the thrown error, usage information, and
-exit.
+```js
+yargs
+ .command('get', 'make a get HTTP request', function (yargs) {
+ return yargs.option('url', {
+ alias: 'u',
+ default: 'http://yargs.js.org/'
+ })
+ })
+ .help()
+ .argv
+```
-.fail(fn)
----------
+You can also provide a handler function, which will be executed with the
+parsed `argv` object:
-Method to execute when a failure occurs, rather then printing the failure message.
+```js
+yargs
+ .command(
+ 'get',
+ 'make a get HTTP request',
+ function (yargs) {
+ return yargs.option('u', {
+ alias: 'url',
+ describe: 'the URL to make an HTTP request to'
+ })
+ },
+ function (argv) {
+ console.log(argv.url)
+ }
+ )
+ .help()
+ .argv
+```
-`fn` is called with the failure message that would have been printed.
+### Positional Arguments
-.boolean(key)
--------------
+Commands can accept _optional_ and _required_ positional arguments. Required
+positional arguments take the form `<foo>`, and optional arguments
+take the form `[bar]`. The parsed positional arguments will be populated in
+`argv`:
-Interpret `key` as a boolean. If a non-flag option follows `key` in
-`process.argv`, that string won't get set as the value of `key`.
+```js
+yargs.command('get <source> [proxy]', 'make a get HTTP request')
+ .help()
+ .argv
+```
-`key` will default to `false`, unless an `default(key, undefined)` is
-explicitly set.
+#### Variadic Positional Arguments
-If `key` is an Array, interpret all the elements as booleans.
+The last positional argument can optionally accept an array of
+values, by using the `..` operator:
-.string(key)
-------------
+```js
+yargs.command('download <url> [files..]', 'download several files')
+ .help()
+ .argv
+```
-Tell the parser logic not to interpret `key` as a number or boolean.
-This can be useful if you need to preserve leading zeros in an input.
+### Command Execution
-If `key` is an Array, interpret all the elements as strings.
+When a command is given on the command line, yargs will execute the following:
-`.string('_')` will result in non-hyphenated arguments being interpreted as strings,
-regardless of whether they resemble numbers.
+1. push the command into the current context
+2. reset non-global configuration
+3. apply command configuration via the `builder`, if given
+4. parse and validate args from the command line, including positional args
+5. if validation succeeds, run the `handler` function, if given
+6. pop the command from the current context
-.array(key)
-----------
+### Command Aliases
-Tell the parser to interpret `key` as an array. If `.array('foo')` is set,
-`--foo foo bar` will be parsed as `['foo', 'bar']` rather than as `'bar'`.
+You can define aliases for a command by putting the command and all of its
+aliases into an array.
-.nargs(key, count)
------------
+Alternatively, a command module may specify an `aliases` property, which may be
+a string or an array of strings. All aliases defined via the `command` property
+and the `aliases` property will be concatenated together.
-The number of arguments that should be consumed after a key. This can be a
-useful hint to prevent parsing ambiguity:
+The first element in the array is considered the canonical command, which may
+define positional arguments, and the remaining elements in the array are
+considered aliases. Aliases inherit positional args from the canonical command,
+and thus any positional args defined in the aliases themselves are ignored.
+
+If either the canonical command or any of its aliases are given on the command
+line, the command will be executed.
```js
-var argv = require('yargs')
- .nargs('token', 1)
- .parse(['--token', '-my-token']);
+#!/usr/bin/env node
+require('yargs')
+ .command(['start [app]', 'run', 'up'], 'Start up an app', {}, (argv) => {
+ console.log('starting up the', argv.app || 'default', 'app')
+ })
+ .command({
+ command: 'configure <key> [value]',
+ aliases: ['config', 'cfg'],
+ desc: 'Set a config variable',
+ builder: (yargs) => yargs.default('value', 'true'),
+ handler: (argv) => {
+ console.log(`setting ${argv.key} to ${argv.value}`)
+ }
+ })
+ .demand(1)
+ .help()
+ .wrap(72)
+ .argv
```
-parses as:
+```
+$ ./svc.js help
+Commands:
+ start [app] Start up an app [aliases: run, up]
+ configure <key> [value] Set a config variable [aliases: config, cfg]
-`{ _: [], token: '-my-token', '$0': 'node test' }`
+Options:
+ --help Show help [boolean]
-Optionally `.nargs()` can take an object of `key`/`narg` pairs.
+$ ./svc.js cfg concurrency 4
+setting concurrency to 4
-.config(key)
-------------
+$ ./svc.js run web
+starting up the web app
+```
-Tells the parser that if the option specified by `key` is passed in, it
-should be interpreted as a path to a JSON config file. The file is loaded
-and parsed, and its properties are set as arguments.
+### Providing a Command Module
-.wrap(columns)
---------------
+For complicated commands you can pull the logic into a module. A module
+simply needs to export:
-Format usage output to wrap at `columns` many columns.
+* `exports.command`: string (or array of strings) that executes this command when given on the command line, first string may contain positional args
+* `exports.aliases`: array of strings (or a single string) representing aliases of `exports.command`, positional args defined in an alias are ignored
+* `exports.describe`: string used as the description for the command in help text, use `false` for a hidden command
+* `exports.builder`: object declaring the options the command accepts, or a function accepting and returning a yargs instance
+* `exports.handler`: a function which will be passed the parsed argv.
-By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to
-specify no column limit.
+```js
+// my-module.js
+exports.command = 'get <source> [proxy]'
+
+exports.describe = 'make a get HTTP request'
+
+exports.builder = {
+ banana: {
+ default: 'cool'
+ },
+ batman: {
+ default: 'sad'
+ }
+}
-`yargs.wrap(yargs.terminalWidth())` can be used to maximize the width
-of yargs' usage instructions.
+exports.handler = function (argv) {
+ // do something with argv.
+}
+```
-.strict()
----------
+You then register the module like so:
-Any command-line argument given that is not demanded, or does not have a
-corresponding description, will be reported as an error.
+```js
+yargs.command(require('my-module'))
+ .help()
+ .argv
+```
-.help([option, [description]])
+Or if the module does not export `command` and `describe` (or if you just want to override them):
+
+```js
+yargs.command('get <source> [proxy]', 'make a get HTTP request', require('my-module'))
+ .help()
+ .argv
+```
+
+.commandDir(directory, [opts])
------------------------------
-Add an option (e.g., `--help`) that displays the usage string and exits the
-process. If present, the `description` parameter customises the description of
-the help option in the usage string.
+Apply command modules from a directory relative to the module calling this method.
-If invoked without parameters, `.help` returns the generated usage string.
+This allows you to organize multiple commands into their own modules under a
+single directory and apply all of them at once instead of calling
+`.command(require('./dir/module'))` multiple times.
-Example:
+By default, it ignores subdirectories. This is so you can use a directory
+structure to represent your command hierarchy, where each command applies its
+subcommands using this method in its builder function. See the example below.
-```
-var yargs = require("yargs")
- .usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
-console.log(yargs.help());
-```
+Note that yargs assumes all modules in the given directory are command modules
+and will error if non-command modules are encountered. In this scenario, you
+can either move your module to a different directory or use the `exclude` or
+`visit` option to manually filter it out. More on that below.
-Later on, ```argv``` can be retrived with ```yargs.argv```
+`directory` is a relative directory path as a string (required).
-.version(version, [option], [description])
-----------------------------------------
+`opts` is an options object (optional). The following options are valid:
-Add an option (e.g., `--version`) that displays the version number (given by the
-`version` parameter) and exits the process. If present, the `description`
-parameter customizes the description of the version option in the usage string.
+- `recurse`: boolean, default `false`
-You can provide a `function` for version, rather than a string.
-This is useful if you want to use the version from your package.json:
+ Look for command modules in all subdirectories and apply them as a flattened
+ (non-hierarchical) list.
-```js
-var argv = require('yargs')
- .version(function() {
- return require('../package').version;
- })
- .argv;
-```
+- `extensions`: array of strings, default `['js']`
-.showHelpOnFail(enable, [message])
-----------------------------------
+ The types of files to look for when requiring command modules.
-By default, yargs outputs a usage string if any error is detected. Use the
-`.showHelpOnFail` method to customize this behaviour. if `enable` is `false`,
-the usage string is not output. If the `message` parameter is present, this
-message is output after the error message.
+- `visit`: function
-line_count.js
+ A synchronous function called for each command module encountered. Accepts
+ `commandObject`, `pathToFile`, and `filename` as arguments. Returns
+ `commandObject` to include the command; any falsy value to exclude/skip it.
-````javascript
-#!/usr/bin/env node
-var argv = require('yargs')
- .usage('Count the lines in a file.\nUsage: $0')
- .demand('f')
- .alias('f', 'file')
- .describe('f', 'Load a file')
- .showHelpOnFail(false, "Specify --help for available options")
- .argv;
+- `include`: RegExp or function
-// etc.
-````
+ Whitelist certain modules. See [`require-directory` whitelisting](https://www.npmjs.com/package/require-directory#whitelisting) for details.
-***
+- `exclude`: RegExp or function
- $ node line_count.js --file
- Missing argument value: f
+ Blacklist certain modules. See [`require-directory` blacklisting](https://www.npmjs.com/package/require-directory#blacklisting) for details.
- Specify --help for available options
+### Example command hierarchy using `.commandDir()`
-.showHelp(consoleLevel='error')
----------------------------
+Desired CLI:
-Print the usage data using the [`console`](https://nodejs.org/api/console.html) function `consoleLevel` for printing.
+```sh
+$ myapp --help
+$ myapp init
+$ myapp remote --help
+$ myapp remote add base http://yargs.js.org
+$ myapp remote prune base
+$ myapp remote prune base fork whatever
+```
-Example:
+Directory structure:
```
-var yargs = require("yargs")
- .usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
-yargs.showHelp();
+myapp/
+├─ cli.js
+└─ cmds/
+ ├─ init.js
+ ├─ remote.js
+ └─ remote_cmds/
+ ├─ add.js
+ └─ prune.js
```
-Or, to print the usage data to `stdout` instead, you can specify the use of `console.log`:
+cli.js:
-```
-yargs.showHelp("log");
+```js
+#!/usr/bin/env node
+require('yargs')
+ .commandDir('cmds')
+ .demand(1)
+ .help()
+ .argv
```
-Later on, ```argv``` can be retrived with ```yargs.argv```
+cmds/init.js:
-.completion(cmd, [description], [fn]);
--------------
+```js
+exports.command = 'init [dir]'
+exports.desc = 'Create an empty repo'
+exports.builder = {
+ dir: {
+ default: '.'
+ }
+}
+exports.handler = function (argv) {
+ console.log('init called for dir', argv.dir)
+}
+```
-Enable bash-completion shortcuts for commands and options.
+cmds/remote.js:
-`cmd`: when present in `argv._`, will result in the `.bashrc` completion script
+```js
+exports.command = 'remote <command>'
+exports.desc = 'Manage set of tracked repos'
+exports.builder = function (yargs) {
+ return yargs.commandDir('remote_cmds')
+}
+exports.handler = function (argv) {}
+```
+
+cmds/remote_cmds/add.js:
+
+```js
+exports.command = 'add <name> <url>'
+exports.desc = 'Add remote named <name> for repo at url <url>'
+exports.builder = {}
+exports.handler = function (argv) {
+ console.log('adding remote %s at url %s', argv.name, argv.url)
+}
+```
+
+cmds/remote_cmds/prune.js:
+
+```js
+exports.command = 'prune <name> [names..]'
+exports.desc = 'Delete tracked branches gone stale for remotes'
+exports.builder = {}
+exports.handler = function (argv) {
+ console.log('pruning remotes %s', [].concat(argv.name).concat(argv.names).join(', '))
+}
+```
+
+.completion([cmd], [description], [fn])
+---------------------------------------
+
+Enable bash-completion shortcuts for commands and options.
+
+`cmd`: When present in `argv._`, will result in the `.bashrc` completion script
being outputted. To enable bash completions, concat the generated script to your
-`.bashrc`, or `.bash_profile`.
+`.bashrc` or `.bash_profile`.
-`description`: provide a description in your usage instructions for the command
+`description`: Provide a description in your usage instructions for the command
that generates bash completion scripts.
-`fn`, rather than relying on yargs' default completion functionlity, which
+`fn`: Rather than relying on yargs' default completion functionality, which
shiver me timbers is pretty awesome, you can provide your own completion
method.
+If invoked without parameters, `.completion()` will make `completion` the command to output
+the completion script.
+
```js
var argv = require('yargs')
.completion('completion', function(current, argv) {
@@ -757,7 +895,7 @@ var argv = require('yargs')
.argv;
```
-But wait, there's more! you can provide asynchronous completions.
+You can also provide asynchronous completions.
```js
var argv = require('yargs')
@@ -772,31 +910,672 @@ var argv = require('yargs')
.argv;
```
-.showCompletionScript()
-----------------------
+But wait, there's more! You can return an asynchronous promise.
-Generate a bash completion script. Users of your application can install this
-script in their `.bashrc`, and yargs will provide completion shortcuts for
-commands and options.
+```js
+var argv = require('yargs')
+ .completion('completion', function(current, argv, done) {
+ return new Promise(function (resolve, reject) {
+ setTimeout(function () {
+ resolve(['apple', 'banana'])
+ }, 10)
+ })
+ })
+ .argv;
+```
+
+<a name="config"></a>.config([key], [description], [parseFn])
+-------------------------------------------------------------
+.config(object)
+---------------
+
+Tells the parser that if the option specified by `key` is passed in, it
+should be interpreted as a path to a JSON config file. The file is loaded
+and parsed, and its properties are set as arguments. Because the file is
+loaded using Node's require(), the filename MUST end in `.json` to be
+interpreted correctly.
+
+If invoked without parameters, `.config()` will make `--config` the option to pass the JSON config file.
+
+An optional `description` can be provided to customize the config (`key`) option
+in the usage string.
+
+An optional `parseFn` can be used to provide a custom parser. The parsing
+function must be synchronous, and should return an object containing
+key value pairs or an error.
+
+```js
+var argv = require('yargs')
+ .config('settings', function (configPath) {
+ return JSON.parse(fs.readFileSync(configPath, 'utf-8'))
+ })
+ .argv
+```
+
+You can also pass an explicit configuration `object`, it will be parsed
+and its properties will be set as arguments.
+
+```js
+var argv = require('yargs')
+ .config({foo: 1, bar: 2})
+ .argv
+console.log(argv)
+```
+
+```
+$ node test.js
+{ _: [],
+ foo: 1,
+ bar: 2,
+ '$0': 'test.js' }
+```
+
+<a name="count"></a>.count(key)
+------------
+
+Interpret `key` as a boolean flag, but set its parsed value to the number of
+flag occurrences rather than `true` or `false`. Default value is thus `0`.
+
+<a name="default"></a>.default(key, value, [description])
+---------------------------------------------------------
+.defaults(key, value, [description])
+------------------------------------
+
+**Note:** The `.defaults()` alias is deprecated. It will be
+removed in the next major version.
+
+Set `argv[key]` to `value` if no option was specified in `process.argv`.
+
+Optionally `.default()` can take an object that maps keys to default values.
+
+But wait, there's more! The default value can be a `function` which returns
+a value. The name of the function will be used in the usage string:
+
+```js
+var argv = require('yargs')
+ .default('random', function randomValue() {
+ return Math.random() * 256;
+ }).argv;
+```
+
+Optionally, `description` can also be provided and will take precedence over
+displaying the value in the usage instructions:
+
+```js
+.default('timeout', 60000, '(one-minute)')
+```
+
+<a name="demand"></a>.demand(key, [msg | boolean])
+------------------------------
+.demand(count, [max], [msg])
+------------------------------
+
+If `key` is a string, show the usage information and exit if `key` wasn't
+specified in `process.argv`.
+
+If `key` is a number, demand at least as many non-option arguments, which show
+up in `argv._`. A second number can also optionally be provided, which indicates
+the maximum number of non-option arguments.
+
+If `key` is an array, demand each element.
+
+If a `msg` string is given, it will be printed when the argument is missing,
+instead of the standard error message. This is especially helpful for the non-option arguments in `argv._`.
+
+If a `boolean` value is given, it controls whether the option is demanded;
+this is useful when using `.options()` to specify command line parameters.
+
+A combination of `.demand(1)` and `.strict()` will allow you to require a user to pass at least one command:
+
+```js
+var argv = require('yargs')
+ .command('install', 'tis a mighty fine package to install')
+ .demand(1)
+ .strict()
+ .argv
+```
+
+Similarly, you can require a command and arguments at the same time:
+
+```js
+var argv = require('yargs')
+ .command('install', 'tis a mighty fine package to install')
+ .demand(1, ['w', 'm'])
+ .strict()
+ .argv
+```
+
+<a name="describe"></a>.describe(key, desc)
+--------------------
+
+Describe a `key` for the generated usage information.
+
+Optionally `.describe()` can take an object that maps keys to descriptions.
+
+.detectLocale(boolean)
+-----------
+
+Should yargs attempt to detect the os' locale? Defaults to `true`.
+
+.env([prefix])
+--------------
+
+Tell yargs to parse environment variables matching the given prefix and apply
+them to argv as though they were command line arguments.
+
+Use the "__" separator in the environment variable to indicate nested options.
+(e.g. prefix_nested__foo => nested.foo)
+
+If this method is called with no argument or with an empty string or with `true`,
+then all env vars will be applied to argv.
+
+Program arguments are defined in this order of precedence:
+
+1. Command line args
+2. Config file
+3. Env var
+4. Configured defaults
+
+```js
+var argv = require('yargs')
+ .env('MY_PROGRAM')
+ .option('f', {
+ alias: 'fruit-thing',
+ default: 'apple'
+ })
+ .argv
+console.log(argv)
+```
+
+```
+$ node fruity.js
+{ _: [],
+ f: 'apple',
+ 'fruit-thing': 'apple',
+ fruitThing: 'apple',
+ '$0': 'fruity.js' }
+```
+
+```
+$ MY_PROGRAM_FRUIT_THING=banana node fruity.js
+{ _: [],
+ fruitThing: 'banana',
+ f: 'banana',
+ 'fruit-thing': 'banana',
+ '$0': 'fruity.js' }
+```
+
+```
+$ MY_PROGRAM_FRUIT_THING=banana node fruity.js -f cat
+{ _: [],
+ f: 'cat',
+ 'fruit-thing': 'cat',
+ fruitThing: 'cat',
+ '$0': 'fruity.js' }
+```
+
+Env var parsing is disabled by default, but you can also explicitly disable it
+by calling `.env(false)`, e.g. if you need to undo previous configuration.
+
+.epilog(str)
+------------
+.epilogue(str)
+--------------
-.exitProcess(enable)
+A message to print at the end of the usage instructions, e.g.
+
+```js
+var argv = require('yargs')
+ .epilogue('for more information, find our manual at http://example.com');
+```
+
+.example(cmd, desc)
+-------------------
+
+Give some example invocations of your program. Inside `cmd`, the string
+`$0` will get interpolated to the current script name or node command for the
+present script similar to how `$0` works in bash or perl.
+Examples will be printed out as part of the help message.
+
+<a name="exitprocess"></a>.exitProcess(enable)
----------------------------------
-By default, yargs exits the process when the user passes a help flag, uses the `.version` functionality or when validation fails. Calling `.exitProcess(false)` disables this behavior, enabling further actions after yargs have been validated.
+By default, yargs exits the process when the user passes a help flag, uses the
+`.version` functionality, or when validation fails. Calling
+`.exitProcess(false)` disables this behavior, enabling further actions after
+yargs have been validated.
+
+<a name="fail"></a>.fail(fn)
+---------
+
+Method to execute when a failure occurs, rather than printing the failure message.
+
+`fn` is called with the failure message that would have been printed, the
+`Error` instance originally thrown and yargs state when the failure
+occured.
+
+```js
+var argv = require('yargs')
+ .fail(function (msg, err, yargs) {
+ if (err) throw err // preserve stack
+ console.error('You broke it!')
+ console.error(msg)
+ console.error('You should be doing', yargs.help())
+ process.exit(1)
+ })
+ .argv
+```
+
+.getCompletion(args, done);
+---------------------------
+
+Allows to programmatically get completion choices for any line.
-.parse(args)
+`args`: An array of the words in the command line to complete.
+
+`done`: The callback to be called with the resulting completions.
+
+For example:
+
+```js
+require('yargs')
+ .option('foobar')
+ .option('foobaz')
+ .completion()
+ .getCompletion(['./test.js', '--foo'], function (completions) {
+ console.log(completions)
+ })
+```
+
+Outputs the same completion choices as `./test.js --foo`<kbd>TAB</kbd>: `--foobar` and `--foobaz`
+
+<a name="global"></a>.global(globals)
+------------
+
+Indicate that an option (or group of options) should not be reset when a command
+is executed, as an example:
+
+```js
+var argv = require('yargs')
+ .option('a', {
+ alias: 'all',
+ default: true
+ })
+ .option('n', {
+ alias: 'none',
+ default: true
+ })
+ .command('foo', 'foo command', function (yargs) {
+ return yargs.option('b', {
+ alias: 'bar'
+ })
+ })
+ .help('help')
+ .global('a')
+ .argv
+```
+
+If the `foo` command is executed the `all` option will remain, but the `none`
+option will have been eliminated.
+
+`help`, `version`, and `completion` options default to being global.
+
+<a name="group"></a>.group(key(s), groupName)
+--------------------
+
+Given a key, or an array of keys, places options under an alternative heading
+when displaying usage instructions, e.g.,
+
+```js
+var yargs = require('yargs')(['--help'])
+ .help()
+ .group('batman', 'Heroes:')
+ .describe('batman', "world's greatest detective")
+ .wrap(null)
+ .argv
+```
+***
+ Heroes:
+ --batman world's greatest detective
+
+ Options:
+ --help Show help [boolean]
+
+<a name="help"></a>.help()
+-----------------------------------------
+.help([option | boolean])
+-----------------------------------------
+.help([option, [description | boolean]])
+-----------------------------------------
+.help([option, [description, [boolean]]])
+-----------------------------------------
+
+Add an option (e.g. `--help`) and implicit command that displays the usage
+string and exits the process.
+
+If present, the `description` parameter customizes the description of
+the help option in the usage string.
+
+If a boolean argument is provided, it will enable or disable the use of an
+implicit command. The implicit command is enabled by default, but it can be
+disabled by passing `false`.
+
+Note that any multi-char aliases (e.g. `help`) used for the help option will
+also be used for the implicit command. If there are no multi-char aliases (e.g.
+`h`), then all single-char aliases will be used for the command.
+
+If invoked without parameters, `.help()` will use `--help` as the option and
+`help` as the implicit command to trigger help output.
+
+Example:
+
+```js
+var yargs = require("yargs")(['--help'])
+ .usage("$0 -operand1 number -operand2 number -operation [add|subtract]")
+ .help()
+ .argv
+```
+
+Later on, `argv` can be retrieved with `yargs.argv`.
+
+.implies(x, y)
+--------------
+
+Given the key `x` is set, it is required that the key `y` is set.
+
+Optionally `.implies()` can accept an object specifying multiple implications.
+
+.locale()
+---------
+
+Return the locale that yargs is currently using.
+
+By default, yargs will auto-detect the operating system's locale so that
+yargs-generated help content will display in the user's language.
+
+To override this behavior with a static locale, pass the desired locale as a
+string to this method (see below).
+
+.locale(locale)
+---------------
+
+Override the auto-detected locale from the user's operating system with a static
+locale. Note that the OS locale can be modified by setting/exporting the `LC_ALL`
+environment variable.
+
+```js
+var argv = require('yargs')
+ .usage('./$0 - follow ye instructions true')
+ .option('option', {
+ alias: 'o',
+ describe: "'tis a mighty fine option",
+ demand: true
+ })
+ .command('run', "Arrr, ya best be knowin' what yer doin'")
+ .example('$0 run foo', "shiver me timbers, here's an example for ye")
+ .help('help')
+ .wrap(70)
+ .locale('pirate')
+ .argv
+```
+
+***
+
+```shell
+./test.js - follow ye instructions true
+
+Choose yer command:
+ run Arrr, ya best be knowin' what yer doin'
+
+Options for me hearties!
+ --option, -o 'tis a mighty fine option [requi-yar-ed]
+ --help Parlay this here code of conduct [boolean]
+
+Ex. marks the spot:
+ test.js run foo shiver me timbers, here's an example for ye
+
+Ye be havin' to set the followin' argument land lubber: option
+```
+
+Locales currently supported:
+
+* **de:** German.
+* **en:** American English.
+* **es:** Spanish.
+* **fr:** French.
+* **hi:** Hindi.
+* **hu:** Hungarian.
+* **id:** Indonesian.
+* **it:** Italian.
+* **ja:** Japanese.
+* **ko:** Korean.
+* **nb:** Norwegian Bokmål.
+* **pirate:** American Pirate.
+* **pl:** Polish.
+* **pt:** Portuguese.
+* **pt_BR:** Brazilian Portuguese.
+* **ru:** Russian.
+* **th:** Thai.
+* **tr:** Turkish.
+* **zh_CN:** Chinese.
+
+To submit a new translation for yargs:
+
+1. use `./locales/en.json` as a starting point.
+2. submit a pull request with the new locale file.
+
+*The [Microsoft Terminology Search](http://www.microsoft.com/Language/en-US/Search.aspx) can be useful for finding the correct terminology in your locale.*
+
+<a name="nargs"></a>.nargs(key, count)
+-----------
+
+The number of arguments that should be consumed after a key. This can be a
+useful hint to prevent parsing ambiguity. For example:
+
+```js
+var argv = require('yargs')
+ .nargs('token', 1)
+ .parse(['--token', '-my-token']);
+```
+
+parses as:
+
+`{ _: [], token: '-my-token', '$0': 'node test' }`
+
+Optionally `.nargs()` can take an object of `key`/`narg` pairs.
+
+<a name="normalize"></a>.normalize(key)
+---------------
+
+The key provided represents a path and should have `path.normalize()` applied.
+
+<a name="number"></a>.number(key)
+------------
+
+Tell the parser to always interpret `key` as a number.
+
+If `key` is an array, all elements will be parsed as numbers.
+
+If the option is given on the command line without a value, `argv` will be
+populated with `undefined`.
+
+If the value given on the command line cannot be parsed as a number, `argv` will
+be populated with `NaN`.
+
+Note that decimals, hexadecimals, and scientific notation are all accepted.
+
+```js
+var argv = require('yargs')
+ .number('n')
+ .number(['width', 'height'])
+ .argv
+```
+
+.option(key, [opt])
+-----------------
+.options(key, [opt])
+------------------
+
+This method can be used to make yargs aware of options that _could_
+exist. You can also pass an `opt` object which can hold further
+customization, like `.alias()`, `.demand()` etc. for that option.
+
+For example:
+
+````javascript
+var argv = require('yargs')
+ .option('f', {
+ alias: 'file',
+ demand: true,
+ default: '/etc/passwd',
+ describe: 'x marks the spot',
+ type: 'string'
+ })
+ .argv
+;
+````
+
+is the same as
+
+````javascript
+var argv = require('yargs')
+ .alias('f', 'file')
+ .demand('f')
+ .default('f', '/etc/passwd')
+ .describe('f', 'x marks the spot')
+ .string('f')
+ .argv
+;
+````
+
+Optionally `.options()` can take an object that maps keys to `opt` parameters.
+
+````javascript
+var argv = require('yargs')
+ .options({
+ 'f': {
+ alias: 'file',
+ demand: true,
+ default: '/etc/passwd',
+ describe: 'x marks the spot',
+ type: 'string'
+ }
+ })
+ .argv
+;
+````
+
+Valid `opt` keys include:
+
+- `alias`: string or array of strings, alias(es) for the canonical option key, see [`alias()`](#alias)
+- `array`: boolean, interpret option as an array, see [`array()`](#array)
+- `boolean`: boolean, interpret option as a boolean flag, see [`boolean()`](#boolean)
+- `choices`: value or array of values, limit valid option arguments to a predefined set, see [`choices()`](#choices)
+- `coerce`: function, coerce or transform parsed command line values into another value, see [`coerce()`](#coerce)
+- `config`: boolean, interpret option as a path to a JSON config file, see [`config()`](#config)
+- `configParser`: function, provide a custom config parsing function, see [`config()`](#config)
+- `count`: boolean, interpret option as a count of boolean flags, see [`count()`](#count)
+- `default`: value, set a default value for the option, see [`default()`](#default)
+- `defaultDescription`: string, use this description for the default value in help content, see [`default()`](#default)
+- `demand`/`require`/`required`: boolean or string, demand the option be given, with optional error message, see [`demand()`](#demand)
+- `desc`/`describe`/`description`: string, the option description for help content, see [`describe()`](#describe)
+- `global`: boolean, indicate that this key should not be [reset](#reset) when a command is invoked, see [`global()`](#global)
+- `group`: string, when displaying usage instructions place the option under an alternative group heading, see [`group()`](#group)
+- `nargs`: number, specify how many arguments should be consumed for the option, see [`nargs()`](#nargs)
+- `normalize`: boolean, apply `path.normalize()` to the option, see [`normalize()`](#normalize)
+- `number`: boolean, interpret option as a number, [`number()`](#number)
+- `requiresArg`: boolean, require the option be specified with a value, see [`requiresArg()`](#requiresArg)
+- `skipValidation`: boolean, skips validation if the option is present, see [`skipValidation()`](#skipValidation)
+- `string`: boolean, interpret option as a string, see [`string()`](#string)
+- `type`: one of the following strings
+ - `'array'`: synonymous for `array: true`, see [`array()`](#array)
+ - `'boolean'`: synonymous for `boolean: true`, see [`boolean()`](#boolean)
+ - `'count'`: synonymous for `count: true`, see [`count()`](#count)
+ - `'number'`: synonymous for `number: true`, see [`number()`](#number)
+ - `'string'`: synonymous for `string: true`, see [`string()`](#string)
+
+.parse(args, [context], [parseCallback])
------------
Parse `args` instead of `process.argv`. Returns the `argv` object.
+`args` may either be a pre-processed argv array, or a raw argument string.
+
+A `context` object can optionally be given as the second argument to `parse()`, providing a
+useful mechanism for passing state information to commands:
+
+```js
+const parser = yargs
+ .command('lunch-train <restaurant>', 'start lunch train', function () {}, function (argv) {
+ console.log(argv.restaurant, argv.time)
+ })
+ .parse("lunch-train rudy's", {time: '12:15'})
+```
+
+A `parseCallback` can also be provided to `.parse()`. If a callback is given, it will be invoked with three arguments:
+
+1. `err`: populated if any validation errors raised while parsing.
+2. `argv`: the parsed argv object.
+3. `output`: any text that would have been output to the terminal, had a
+ callback not been provided.
+
+```js
+// providing the `fn` argument to `parse()` runs yargs in headless mode, this
+// makes it easy to use yargs in contexts other than the CLI, e.g., writing
+// a chat-bot.
+const parser = yargs
+ .command('lunch-train <restaurant> <time>', 'start lunch train', function () {}, function (argv) {
+ api.scheduleLunch(argv.restaurant, moment(argv.time))
+ })
+ .help()
-.reset()
+parser.parse(bot.userText, function (err, argv, output) {
+ if (output) bot.respond(output)
+})
+```
+
+***Note:*** Providing a callback to `parse()` disables the [`exitProcess` setting](#exitprocess) until after the callback is invoked.
+
+.pkgConf(key, [cwd])
+------------
+
+Similar to [`config()`](#config), indicates that yargs should interpret the object from the specified key in package.json
+as a configuration object.
+
+`cwd` can optionally be provided, the package.json will be read
+from this location.
+
+.recommendCommands()
+---------------------------
+
+Should yargs provide suggestions regarding similar commands if no matching
+command is found?
+
+.require(key, [msg | boolean])
+------------------------------
+.required(key, [msg | boolean])
+------------------------------
+
+An alias for [`demand()`](#demand). See docs there.
+
+<a name="requiresArg"></a>.requiresArg(key)
+-----------------
+
+Specifies either a single option key (string), or an array of options that
+must be followed by option values. If any option value is missing, show the
+usage information and exit.
+
+The default behavior is to set the value of any key not followed by an
+option value to `true`.
+
+<a name="reset"></a>.reset()
--------
Reset the argument object built up so far. This is useful for
-creating nested command line interfaces.
+creating nested command line interfaces. Use [global](#global)
+to specify keys that should not be reset.
```js
-var yargs = require('./yargs')
+var yargs = require('yargs')
.usage('$0 command')
.command('hello', 'hello command')
.command('world', 'world command')
@@ -825,15 +1604,161 @@ if (command === 'hello') {
}
```
-.argv
------
+.showCompletionScript()
+----------------------
-Get the arguments as a plain old object.
+Generate a bash completion script. Users of your application can install this
+script in their `.bashrc`, and yargs will provide completion shortcuts for
+commands and options.
-Arguments without a corresponding flag show up in the `argv._` array.
+.showHelp(consoleLevel='error')
+---------------------------
-The script name or node command is available at `argv.$0` similarly to how `$0`
-works in bash or perl.
+Print the usage data using the [`console`](https://nodejs.org/api/console.html) function `consoleLevel` for printing.
+
+Example:
+
+```js
+var yargs = require("yargs")
+ .usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
+yargs.showHelp(); //prints to stderr using console.error()
+```
+
+Or, to print the usage data to `stdout` instead, you can specify the use of `console.log`:
+
+```js
+yargs.showHelp("log"); //prints to stdout using console.log()
+```
+
+Later on, `argv` can be retrieved with `yargs.argv`.
+
+.showHelpOnFail(enable, [message])
+----------------------------------
+
+By default, yargs outputs a usage string if any error is detected. Use the
+`.showHelpOnFail()` method to customize this behavior. If `enable` is `false`,
+the usage string is not output. If the `message` parameter is present, this
+message is output after the error message.
+
+line_count.js:
+
+````javascript
+#!/usr/bin/env node
+var argv = require('yargs')
+ .usage('Count the lines in a file.\nUsage: $0 -f <file>')
+ .demand('f')
+ .alias('f', 'file')
+ .describe('f', 'Load a file')
+ .string('f')
+ .showHelpOnFail(false, 'Specify --help for available options')
+ .help('help')
+ .argv;
+
+// etc.
+````
+
+***
+
+```
+$ node line_count.js
+Missing argument value: f
+
+Specify --help for available options
+```
+
+<a name="skipValidation"></a>.skipValidation(key)
+-----------------
+
+Specifies either a single option key (string), or an array of options.
+If any of the options is present, yargs validation is skipped.
+
+.strict()
+---------
+
+Any command-line argument given that is not demanded, or does not have a
+corresponding description, will be reported as an error.
+
+<a name="string"></a>.string(key)
+------------
+
+Tell the parser logic not to interpret `key` as a number or boolean.
+This can be useful if you need to preserve leading zeros in an input.
+
+If `key` is an array, interpret all the elements as strings.
+
+`.string('_')` will result in non-hyphenated arguments being interpreted as strings,
+regardless of whether they resemble numbers.
+
+.updateLocale(obj)
+------------------
+.updateStrings(obj)
+------------------
+
+Override the default strings used by yargs with the key/value
+pairs provided in `obj`:
+
+```js
+var argv = require('yargs')
+ .command('run', 'the run command')
+ .help('help')
+ .updateStrings({
+ 'Commands:': 'My Commands -->\n'
+ })
+ .wrap(null)
+ .argv
+```
+
+***
+
+```shell
+My Commands -->
+
+ run the run command
+
+Options:
+ --help Show help [boolean]
+```
+
+If you explicitly specify a `locale()`, you should do so *before* calling
+`updateStrings()`.
+
+.usage(message, [opts])
+---------------------
+
+Set a usage message to show which commands to use. Inside `message`, the string
+`$0` will get interpolated to the current script name or node command for the
+present script similar to how `$0` works in bash or perl.
+
+`opts` is optional and acts like calling `.options(opts)`.
+
+<a name="version"></a>.version([option], [description], [version])
+----------------------------------------
+
+Add an option (e.g. `--version`) that displays the version number (given by the
+`version` parameter) and exits the process.
+
+If no arguments are passed to `version` (`.version()`), yargs will parse the `package.json`
+of your module and use its `version` value. The default value of `option` is `--version`.
+
+You can provide a `function` for version, rather than a string.
+This is useful if you want to use a version stored in a location other than package.json:
+
+```js
+var argv = require('yargs')
+ .version(function() {
+ return require('../lib/version').version;
+ })
+ .argv;
+```
+
+<a name="wrap"></a>.wrap(columns)
+--------------
+
+Format usage output to wrap at `columns` many columns.
+
+By default wrap will be set to `Math.min(80, windowWidth)`. Use `.wrap(null)` to
+specify no column limit (no right-align). Use `.wrap(yargs.terminalWidth())` to
+maximize the width of yargs' usage instructions.
parsing tricks
==============
@@ -845,21 +1770,18 @@ Use `--` to stop parsing flags and stuff the remainder into `argv._`.
$ node examples/reflect.js -a 1 -b 2 -- -c 3 -d 4
{ _: [ '-c', '3', '-d', '4' ],
- '$0': 'node ./examples/reflect.js',
a: 1,
- b: 2 }
+ b: 2,
+ '$0': 'examples/reflect.js' }
negate fields
-------------
-If you want to explicity set a field to false instead of just leaving it
+If you want to explicitly set a field to false instead of just leaving it
undefined or to override a default you can do `--no-key`.
$ node examples/reflect.js -a --no-b
- { _: [],
- '$0': 'node ./examples/reflect.js',
- a: true,
- b: false }
+ { _: [], a: true, b: false, '$0': 'examples/reflect.js' }
numbers
-------
@@ -876,9 +1798,7 @@ If you specify a flag multiple times it will get turned into an array containing
all the values in order.
$ node examples/reflect.js -x 5 -x 8 -x 0
- { _: [],
- '$0': 'node ./examples/reflect.js',
- x: [ 5, 8, 0 ] }
+ { _: [], x: [ 5, 8, 0 ], '$0': 'examples/reflect.js' }
dot notation
------------
@@ -886,41 +1806,72 @@ dot notation
When you use dots (`.`s) in argument names, an implicit object path is assumed.
This lets you organize arguments into nested objects.
- $ node examples/reflect.js --foo.bar.baz=33 --foo.quux=5
- { _: [],
- '$0': 'node ./examples/reflect.js',
- foo: { bar: { baz: 33 }, quux: 5 } }
+ $ node examples/reflect.js --foo.bar.baz=33 --foo.quux=5
+ { _: [],
+ foo: { bar: { baz: 33 }, quux: 5 },
+ '$0': 'examples/reflect.js' }
short numbers
-------------
-Short numeric `head -n5` style argument work too:
+Short numeric `-n5` style arguments work too:
- $ node reflect.js -n123 -m456
- { '3': true,
- '6': true,
- _: [],
- '$0': 'node ./reflect.js',
- n: 123,
- m: 456 }
+ $ node examples/reflect.js -n123 -m456
+ { _: [], n: 123, m: 456, '$0': 'examples/reflect.js' }
installation
============
-With [npm](http://github.com/isaacs/npm), just do:
+With [npm](https://github.com/npm/npm), just do:
npm install yargs
or clone this project on github:
- git clone http://github.com/bcoe/yargs.git
+ git clone http://github.com/yargs/yargs.git
To run the tests with npm, just do:
npm test
+configuration
+=============
+
+Using the `yargs` stanza in your `package.json` you can turn on and off
+some of yargs' parsing features:
+
+```json
+{
+ "yargs": {
+ "short-option-groups": true,
+ "camel-case-expansion": true,
+ "dot-notation": true,
+ "parse-numbers": true,
+ "boolean-negation": true
+ }
+}
+```
+
+See the [yargs-parser](https://github.com/yargs/yargs-parser#configuration) module
+for detailed documentation of this feature.
+
inspired by
===========
This module is loosely inspired by Perl's
[Getopt::Casual](http://search.cpan.org/~photo/Getopt-Casual-0.13.1/Casual.pm).
+
+[travis-url]: https://travis-ci.org/yargs/yargs
+[travis-image]: https://img.shields.io/travis/yargs/yargs/master.svg
+[coveralls-url]: https://coveralls.io/github/yargs/yargs
+[coveralls-image]: https://img.shields.io/coveralls/yargs/yargs.svg
+[npm-url]: https://www.npmjs.com/package/yargs
+[npm-image]: https://img.shields.io/npm/v/yargs.svg
+[windows-url]: https://ci.appveyor.com/project/bcoe/yargs-ljwvf
+[windows-image]: https://img.shields.io/appveyor/ci/bcoe/yargs-ljwvf/master.svg?label=Windows%20Tests
+[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
+[standard-url]: http://standardjs.com/
+[standard-version-image]: https://img.shields.io/badge/release-standard%20version-brightgreen.svg
+[standard-version-url]: https://github.com/conventional-changelog/standard-version
+[gitter-image]: https://img.shields.io/gitter/room/nwjs/nw.js.svg?maxAge=2592000
+[gitter-url]: https://gitter.im/yargs/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link
diff --git a/node_modules/yargs/completion.sh.hbs b/node_modules/yargs/completion.sh.hbs
@@ -10,12 +10,18 @@ _yargs_completions()
local cur_word args type_list
cur_word="${COMP_WORDS[COMP_CWORD]}"
- args=$(printf "%s " "${COMP_WORDS[@]}")
+ args=("${COMP_WORDS[@]}")
# ask yargs to generate completions.
- type_list=`{{app_path}} --get-yargs-completions $args`
+ type_list=$({{app_path}} --get-yargs-completions "${args[@]}")
COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )
+
+ # if no match was found, fall back to filename completion
+ if [ ${#COMPREPLY[@]} -eq 0 ]; then
+ COMPREPLY=( $(compgen -f -- "${cur_word}" ) )
+ fi
+
return 0
}
complete -F _yargs_completions {{app_name}}
diff --git a/node_modules/yargs/index.js b/node_modules/yargs/index.js
@@ -1,487 +1,16 @@
-var assert = require('assert'),
- path = require('path'),
- Completion = require('./lib/completion'),
- Parser = require('./lib/parser'),
- Usage = require('./lib/usage'),
- Validation = require('./lib/validation')
+// classic singleton yargs API, to use yargs
+// without running as a singleton do:
+// require('yargs/yargs')(process.argv.slice(2))
+const yargs = require('./yargs')
Argv(process.argv.slice(2))
-var exports = module.exports = Argv
-function Argv (processArgs, cwd) {
- processArgs = processArgs || [] // handle calling yargs().
-
- var self = {}
- var completion = null
- var usage = null
- var validation = null
-
- if (!cwd) cwd = process.cwd()
-
- self.$0 = process.argv
- .slice(0, 2)
- .map(function (x, i) {
- // ignore the node bin, specify this in your
- // bin file with #!/usr/bin/env node
- if (i === 0 && /\b(node|iojs)$/.test(x)) return
- var b = rebase(cwd, x)
- return x.match(/^\//) && b.length < x.length
- ? b : x
- })
- .join(' ').trim()
-
- if (process.env._ !== undefined && process.argv[1] === process.env._) {
- self.$0 = process.env._.replace(
- path.dirname(process.execPath) + '/', ''
- )
- }
-
- var options
- self.resetOptions = self.reset = function () {
- // put yargs back into its initial
- // state, this is useful for creating a
- // nested CLI.
- options = {
- array: [],
- boolean: [],
- string: [],
- narg: {},
- key: {},
- alias: {},
- default: {},
- defaultDescription: {},
- requiresArg: [],
- count: [],
- normalize: [],
- config: []
- }
-
- usage = Usage(self) // handle usage output.
- validation = Validation(self, usage) // handle arg validation.
- completion = Completion(self, usage)
-
- demanded = {}
-
- exitProcess = true
- strict = false
- helpOpt = null
- versionOpt = null
- completionOpt = null
- commandHandlers = {}
- self.parsed = false
-
- return self
- }
- self.resetOptions()
-
- self.boolean = function (bools) {
- options.boolean.push.apply(options.boolean, [].concat(bools))
- return self
- }
-
- self.array = function (arrays) {
- options.array.push.apply(options.array, [].concat(arrays))
- return self
- }
-
- self.nargs = function (key, n) {
- if (typeof key === 'object') {
- Object.keys(key).forEach(function (k) {
- self.nargs(k, key[k])
- })
- } else {
- options.narg[key] = n
- }
- return self
- }
-
- self.normalize = function (strings) {
- options.normalize.push.apply(options.normalize, [].concat(strings))
- return self
- }
-
- self.config = function (configs) {
- options.config.push.apply(options.config, [].concat(configs))
- return self
- }
-
- self.example = function (cmd, description) {
- usage.example(cmd, description)
- return self
- }
-
- self.command = function (cmd, description, fn) {
- usage.command(cmd, description)
- if (fn) commandHandlers[cmd] = fn
- return self
- }
-
- var commandHandlers = {}
- self.getCommandHandlers = function () {
- return commandHandlers
- }
-
- self.string = function (strings) {
- options.string.push.apply(options.string, [].concat(strings))
- return self
- }
-
- self.default = function (key, value, defaultDescription) {
- if (typeof key === 'object') {
- Object.keys(key).forEach(function (k) {
- self.default(k, key[k])
- })
- } else {
- if (typeof value === 'function') {
- defaultDescription = usage.functionDescription(value, defaultDescription)
- value = value.call()
- }
- options.defaultDescription[key] = defaultDescription
- options.default[key] = value
- }
- return self
- }
-
- self.alias = function (x, y) {
- if (typeof x === 'object') {
- Object.keys(x).forEach(function (key) {
- self.alias(key, x[key])
- })
- } else {
- options.alias[x] = (options.alias[x] || []).concat(y)
- }
- return self
- }
-
- self.count = function (counts) {
- options.count.push.apply(options.count, [].concat(counts))
- return self
- }
-
- var demanded = {}
- self.demand = self.required = self.require = function (keys, msg) {
- if (typeof keys === 'number') {
- if (!demanded._) demanded._ = { count: 0, msg: null }
- demanded._.count += keys
- demanded._.msg = msg
- } else if (Array.isArray(keys)) {
- keys.forEach(function (key) {
- self.demand(key, msg)
- })
- } else {
- if (typeof msg === 'string') {
- demanded[keys] = { msg: msg }
- } else if (msg === true || typeof msg === 'undefined') {
- demanded[keys] = { msg: undefined }
- }
- }
-
- return self
- }
- self.getDemanded = function () {
- return demanded
- }
-
- self.requiresArg = function (requiresArgs) {
- options.requiresArg.push.apply(options.requiresArg, [].concat(requiresArgs))
- return self
- }
-
- self.implies = function (key, value) {
- validation.implies(key, value)
- return self
- }
-
- self.usage = function (msg, opts) {
- if (!opts && typeof msg === 'object') {
- opts = msg
- msg = null
- }
-
- usage.usage(msg)
-
- if (opts) self.options(opts)
-
- return self
- }
-
- self.epilogue = self.epilog = function (msg) {
- usage.epilog(msg)
- return self
- }
-
- self.fail = function (f) {
- usage.failFn(f)
- return self
- }
-
- self.check = function (f) {
- validation.check(f)
- return self
- }
-
- self.defaults = self.default
-
- self.describe = function (key, desc) {
- options.key[key] = true
- usage.describe(key, desc)
- return self
- }
-
- self.parse = function (args) {
- return parseArgs(args)
- }
-
- self.option = self.options = function (key, opt) {
- if (typeof key === 'object') {
- Object.keys(key).forEach(function (k) {
- self.options(k, key[k])
- })
- } else {
- assert(typeof opt === 'object', 'second argument to option must be an object')
-
- options.key[key] = true // track manually set keys.
+module.exports = Argv
- if (opt.alias) self.alias(key, opt.alias)
-
- var demand = opt.demand || opt.required || opt.require
-
- if (demand) {
- self.demand(key, demand)
- } if ('default' in opt) {
- self.default(key, opt.default)
- } if ('nargs' in opt) {
- self.nargs(key, opt.nargs)
- } if (opt.boolean || opt.type === 'boolean') {
- self.boolean(key)
- if (opt.alias) self.boolean(opt.alias)
- } if (opt.array || opt.type === 'array') {
- self.array(key)
- if (opt.alias) self.array(opt.alias)
- } if (opt.string || opt.type === 'string') {
- self.string(key)
- if (opt.alias) self.string(opt.alias)
- } if (opt.count || opt.type === 'count') {
- self.count(key)
- }
-
- var desc = opt.describe || opt.description || opt.desc
- if (desc) {
- self.describe(key, desc)
- }
-
- if (opt.requiresArg) {
- self.requiresArg(key)
- }
- }
-
- return self
- }
- self.getOptions = function () {
- return options
- }
-
- self.wrap = function (cols) {
- usage.wrap(cols)
- return self
- }
-
- var strict = false
- self.strict = function () {
- strict = true
- return self
- }
- self.getStrict = function () {
- return strict
- }
-
- self.showHelp = function (level) {
- if (!self.parsed) parseArgs(processArgs) // run parser, if it has not already been executed.
- usage.showHelp(level)
- return self
- }
-
- var versionOpt = null
- self.version = function (ver, opt, msg) {
- versionOpt = opt || 'version'
- usage.version(ver)
- self.boolean(versionOpt)
- self.describe(versionOpt, msg || 'Show version number')
- return self
- }
-
- var helpOpt = null
- self.addHelpOpt = function (opt, msg) {
- helpOpt = opt
- self.boolean(opt)
- self.describe(opt, msg || 'Show help')
- return self
- }
-
- self.showHelpOnFail = function (enabled, message) {
- usage.showHelpOnFail(enabled, message)
- return self
- }
-
- var exitProcess = true
- self.exitProcess = function (enabled) {
- if (typeof enabled !== 'boolean') {
- enabled = true
- }
- exitProcess = enabled
- return self
- }
- self.getExitProcess = function () {
- return exitProcess
- }
-
- self.help = function () {
- if (arguments.length > 0) return self.addHelpOpt.apply(self, arguments)
-
- if (!self.parsed) parseArgs(processArgs) // run parser, if it has not already been executed.
-
- return usage.help()
- }
-
- var completionOpt = null,
- completionCommand = null
- self.completion = function (cmd, desc, fn) {
- // a function to execute when generating
- // completions can be provided as the second
- // or third argument to completion.
- if (typeof desc === 'function') {
- fn = desc
- desc = null
- }
-
- // register the completion command.
- completionCommand = cmd
- completionOpt = completion.completionKey
- self.command(completionCommand, desc || 'generate bash completion script')
-
- // a function can be provided
- if (fn) completion.registerFunction(fn)
-
- return self
- }
-
- self.showCompletionScript = function ($0) {
- $0 = $0 || self.$0
- console.log(completion.generateCompletionScript($0))
- return self
- }
-
- self.getUsageInstance = function () {
- return usage
- }
-
- self.getValidationInstance = function () {
- return validation
- }
-
- self.terminalWidth = function () {
- return require('window-size').width
- }
-
- Object.defineProperty(self, 'argv', {
- get: function () {
- var args = null
-
- try {
- args = parseArgs(processArgs)
- } catch (err) {
- usage.fail(err.message)
- }
-
- return args
- },
- enumerable: true
- })
-
- function parseArgs (args) {
- var parsed = Parser(args, options),
- argv = parsed.argv,
- aliases = parsed.aliases
-
- argv.$0 = self.$0
-
- self.parsed = parsed
-
- // generate a completion script for adding to ~/.bashrc.
- if (completionCommand && ~argv._.indexOf(completionCommand)) {
- self.showCompletionScript()
- if (exitProcess) {
- process.exit(0)
- }
- }
-
- // if there's a handler associated with a
- // command defer processing to it.
- var handlerKeys = Object.keys(self.getCommandHandlers())
- for (var i = 0, command; (command = handlerKeys[i]) !== undefined; i++) {
- if (~argv._.indexOf(command)) {
- self.getCommandHandlers()[command](self.reset())
- return self.argv
- }
- }
-
- Object.keys(argv).forEach(function (key) {
- if (key === helpOpt && argv[key]) {
- self.showHelp('log')
- if (exitProcess) {
- process.exit(0)
- }
- } else if (key === versionOpt && argv[key]) {
- usage.showVersion()
- if (exitProcess) {
- process.exit(0)
- }
- } else if (key === completionOpt) {
- // we allow for asynchronous completions,
- // e.g., loading in a list of commands from an API.
- completion.getCompletion(function (completions) {
- ;(completions || []).forEach(function (completion) {
- console.log(completion)
- })
-
- if (exitProcess) {
- process.exit(0)
- }
- })
- return
- }
- })
-
- validation.nonOptionCount(argv)
- validation.missingArgumentValue(argv)
- validation.requiredArguments(argv)
-
- if (strict) {
- validation.unknownArguments(argv, aliases)
- }
-
- validation.customChecks(argv, aliases)
- validation.implications(argv)
- setPlaceholderKeys(argv)
-
- return argv
- }
-
- function setPlaceholderKeys (argv) {
- Object.keys(options.key).forEach(function (key) {
- if (typeof argv[key] === 'undefined') argv[key] = undefined
- })
- }
-
- sigletonify(self)
- return self
-}
-
-// rebase an absolute path to a relative one with respect to a base directory
-// exported for tests
-exports.rebase = rebase
-function rebase (base, dir) {
- return path.relative(base, dir)
+function Argv (processArgs, cwd) {
+ const argv = yargs(processArgs, cwd, require)
+ singletonify(argv)
+ return argv
}
/* Hack an instance of Argv with process.argv into Argv
@@ -491,14 +20,12 @@ function rebase (base, dir) {
require('yargs').argv
to get a parsed version of process.argv.
*/
-function sigletonify (inst) {
+function singletonify (inst) {
Object.keys(inst).forEach(function (key) {
if (key === 'argv') {
Argv.__defineGetter__(key, inst.__lookupGetter__(key))
} else {
- Argv[key] = typeof inst[key] === 'function'
- ? inst[key].bind(inst)
- : inst[key]
+ Argv[key] = typeof inst[key] === 'function' ? inst[key].bind(inst) : inst[key]
}
})
}
diff --git a/node_modules/yargs/lib/completion.js b/node_modules/yargs/lib/completion.js
@@ -1,26 +1,38 @@
-var fs = require('fs'),
- path = require('path')
+const fs = require('fs')
+const path = require('path')
// add bash completions to your
// yargs-powered applications.
-module.exports = function (yargs, usage) {
- var self = {
+module.exports = function (yargs, usage, command) {
+ const self = {
completionKey: 'get-yargs-completions'
}
// get a list of completion commands.
- self.getCompletion = function (done) {
- var completions = [],
- current = process.argv[process.argv.length - 1],
- previous = process.argv.slice(process.argv.indexOf('--' + self.completionKey) + 1),
- argv = yargs.parse(previous)
+ // 'args' is the array of strings from the line to be completed
+ self.getCompletion = function (args, done) {
+ const completions = []
+ const current = args.length ? args[args.length - 1] : ''
+ const argv = yargs.parse(args, true)
+ const aliases = yargs.parsed.aliases
// a custom completion function can be provided
// to completion().
if (completionFunction) {
if (completionFunction.length < 3) {
+ var result = completionFunction(current, argv)
+
+ // promise based completion function.
+ if (typeof result.then === 'function') {
+ return result.then(function (list) {
+ process.nextTick(function () { done(list) })
+ }).catch(function (err) {
+ process.nextTick(function () { throw err })
+ })
+ }
+
// synchronous completion function.
- return done(completionFunction(current, argv))
+ return done(result)
} else {
// asynchronous completion function
return completionFunction(current, argv, function (completions) {
@@ -29,15 +41,31 @@ module.exports = function (yargs, usage) {
}
}
+ var handlers = command.getCommandHandlers()
+ for (var i = 0, ii = args.length; i < ii; ++i) {
+ if (handlers[args[i]] && handlers[args[i]].builder) {
+ return handlers[args[i]].builder(yargs.reset()).argv
+ }
+ }
+
if (!current.match(/^-/)) {
usage.getCommands().forEach(function (command) {
- completions.push(command[0])
+ if (args.indexOf(command[0]) === -1) {
+ completions.push(command[0])
+ }
})
}
if (current.match(/^-/)) {
Object.keys(yargs.getOptions().key).forEach(function (key) {
- completions.push('--' + key)
+ // If the key and its aliases aren't in 'args', add the key to 'completions'
+ var keyAndAliases = [key].concat(aliases[key] || [])
+ var notInArgs = keyAndAliases.every(function (val) {
+ return args.indexOf('--' + val) === -1
+ })
+ if (notInArgs) {
+ completions.push('--' + key)
+ }
})
}
@@ -49,8 +77,8 @@ module.exports = function (yargs, usage) {
var script = fs.readFileSync(
path.resolve(__dirname, '../completion.sh.hbs'),
'utf-8'
- ),
- name = path.basename($0)
+ )
+ var name = path.basename($0)
// add ./to applications not yet installed as bin.
if ($0.match(/\.js$/)) $0 = './' + $0
diff --git a/node_modules/yargs/lib/parser.js b/node_modules/yargs/lib/parser.js
@@ -1,448 +0,0 @@
-// fancy-pants parsing of argv, originally forked
-// from minimist: https://www.npmjs.com/package/minimist
-var camelCase = require('camelcase'),
- path = require('path')
-
-function increment (orig) {
- return orig !== undefined ? orig + 1 : 0
-}
-
-module.exports = function (args, opts) {
- if (!opts) opts = {}
- var flags = { arrays: {}, bools: {}, strings: {}, counts: {}, normalize: {}, configs: {} }
-
- ;[].concat(opts['array']).filter(Boolean).forEach(function (key) {
- flags.arrays[key] = true
- })
-
- ;[].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
- flags.bools[key] = true
- })
-
- ;[].concat(opts.string).filter(Boolean).forEach(function (key) {
- flags.strings[key] = true
- })
-
- ;[].concat(opts.count).filter(Boolean).forEach(function (key) {
- flags.counts[key] = true
- })
-
- ;[].concat(opts.normalize).filter(Boolean).forEach(function (key) {
- flags.normalize[key] = true
- })
-
- ;[].concat(opts.config).filter(Boolean).forEach(function (key) {
- flags.configs[key] = true
- })
-
- var aliases = {},
- newAliases = {}
-
- extendAliases(opts.key)
- extendAliases(opts.alias)
-
- var defaults = opts['default'] || {}
- Object.keys(defaults).forEach(function (key) {
- if (/-/.test(key) && !opts.alias[key]) {
- aliases[key] = aliases[key] || []
- }
- (aliases[key] || []).forEach(function (alias) {
- defaults[alias] = defaults[key]
- })
- })
-
- var argv = { _: [] }
-
- Object.keys(flags.bools).forEach(function (key) {
- setArg(key, !(key in defaults) ? false : defaults[key])
- })
-
- var notFlags = []
- if (args.indexOf('--') !== -1) {
- notFlags = args.slice(args.indexOf('--') + 1)
- args = args.slice(0, args.indexOf('--'))
- }
-
- for (var i = 0; i < args.length; i++) {
- var arg = args[i],
- broken,
- key,
- letters,
- m,
- next,
- value
-
- // -- seperated by =
- if (arg.match(/^--.+=/)) {
- // Using [\s\S] instead of . because js doesn't support the
- // 'dotall' regex modifier. See:
- // http://stackoverflow.com/a/1068308/13216
- m = arg.match(/^--([^=]+)=([\s\S]*)$/)
-
- // nargs format = '--f=monkey washing cat'
- if (checkAllAliases(m[1], opts.narg)) {
- args.splice(i + 1, m[1], m[2])
- i = eatNargs(i, m[1], args)
- // arrays format = '--f=a b c'
- } else if (checkAllAliases(m[1], flags.arrays) && args.length > i + 1) {
- args.splice(i + 1, m[1], m[2])
- i = eatArray(i, m[1], args)
- } else {
- setArg(m[1], m[2])
- }
- } else if (arg.match(/^--no-.+/)) {
- key = arg.match(/^--no-(.+)/)[1]
- setArg(key, false)
-
- // -- seperated by space.
- } else if (arg.match(/^--.+/)) {
- key = arg.match(/^--(.+)/)[1]
-
- // nargs format = '--foo a b c'
- if (checkAllAliases(key, opts.narg)) {
- i = eatNargs(i, key, args)
- // array format = '--foo a b c'
- } else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) {
- i = eatArray(i, key, args)
- } else {
- next = args[i + 1]
-
- if (next !== undefined && !next.match(/^-/)
- && !checkAllAliases(key, flags.bools)
- && !checkAllAliases(key, flags.counts)) {
- setArg(key, next)
- i++
- } else if (/^(true|false)$/.test(next)) {
- setArg(key, next)
- i++
- } else {
- setArg(key, defaultForType(guessType(key, flags)))
- }
- }
-
- // dot-notation flag seperated by '='.
- } else if (arg.match(/^-.\..+=/)) {
- m = arg.match(/^-([^=]+)=([\s\S]*)$/)
- setArg(m[1], m[2])
-
- // dot-notation flag seperated by space.
- } else if (arg.match(/^-.\..+/)) {
- next = args[i + 1]
- key = arg.match(/^-(.\..+)/)[1]
-
- if (next !== undefined && !next.match(/^-/)
- && !checkAllAliases(key, flags.bools)
- && !checkAllAliases(key, flags.counts)) {
- setArg(key, next)
- i++
- } else {
- setArg(key, defaultForType(guessType(key, flags)))
- }
- } else if (arg.match(/^-[^-]+/)) {
- letters = arg.slice(1, -1).split('')
- broken = false
-
- for (var j = 0; j < letters.length; j++) {
- next = arg.slice(j + 2)
-
- if (letters[j + 1] && letters[j + 1] === '=') {
- value = arg.slice(j + 3)
- key = letters[j]
-
- // nargs format = '-f=monkey washing cat'
- if (checkAllAliases(letters[j], opts.narg)) {
- args.splice(i + 1, 0, value)
- i = eatNargs(i, key, args)
- // array format = '-f=a b c'
- } else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) {
- args.splice(i + 1, 0, value)
- i = eatArray(i, key, args)
- } else {
- setArg(key, value)
- }
-
- broken = true
- break
- }
-
- if (next === '-') {
- setArg(letters[j], next)
- continue
- }
-
- if (/[A-Za-z]/.test(letters[j])
- && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
- setArg(letters[j], next)
- broken = true
- break
- }
-
- if (letters[j + 1] && letters[j + 1].match(/\W/)) {
- setArg(letters[j], arg.slice(j + 2))
- broken = true
- break
- } else {
- setArg(letters[j], defaultForType(guessType(letters[j], flags)))
- }
- }
-
- key = arg.slice(-1)[0]
-
- if (!broken && key !== '-') {
- // nargs format = '-f a b c'
- if (checkAllAliases(key, opts.narg)) {
- i = eatNargs(i, key, args)
- // array format = '-f a b c'
- } else if (checkAllAliases(key, flags.arrays) && args.length > i + 1) {
- i = eatArray(i, key, args)
- } else {
- if (args[i + 1] && !/^(-|--)[^-]/.test(args[i + 1])
- && !checkAllAliases(key, flags.bools)
- && !checkAllAliases(key, flags.counts)) {
- setArg(key, args[i + 1])
- i++
- } else if (args[i + 1] && /true|false/.test(args[i + 1])) {
- setArg(key, args[i + 1])
- i++
- } else {
- setArg(key, defaultForType(guessType(key, flags)))
- }
- }
- }
- } else {
- argv._.push(
- flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
- )
- }
- }
-
- setConfig(argv)
- applyDefaultsAndAliases(argv, aliases, defaults)
-
- Object.keys(flags.counts).forEach(function (key) {
- setArg(key, defaults[key])
- })
-
- notFlags.forEach(function (key) {
- argv._.push(key)
- })
-
- // how many arguments should we consume, based
- // on the nargs option?
- function eatNargs (i, key, args) {
- var toEat = checkAllAliases(key, opts.narg)
-
- if (args.length - (i + 1) < toEat) throw Error('not enough arguments following: ' + key)
-
- for (var ii = i + 1; ii < (toEat + i + 1); ii++) {
- setArg(key, args[ii])
- }
-
- return (i + toEat)
- }
-
- // if an option is an array, eat all non-hyphenated arguments
- // following it... YUM!
- // e.g., --foo apple banana cat becomes ["apple", "banana", "cat"]
- function eatArray (i, key, args) {
- for (var ii = i + 1; ii < args.length; ii++) {
- if (/^-/.test(args[ii])) break
- i = ii
- setArg(key, args[ii])
- }
-
- return i
- }
-
- function setArg (key, val) {
- // handle parsing boolean arguments --foo=true --bar false.
- if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
- if (typeof val === 'string') val = val === 'true'
- }
-
- if (/-/.test(key) && !(aliases[key] && aliases[key].length)) {
- var c = camelCase(key)
- aliases[key] = [c]
- newAliases[c] = true
- }
-
- var value = !checkAllAliases(key, flags.strings) && isNumber(val) ? Number(val) : val
-
- if (checkAllAliases(key, flags.counts)) {
- value = increment
- }
-
- var splitKey = key.split('.')
- setKey(argv, splitKey, value)
-
- ;(aliases[splitKey[0]] || []).forEach(function (x) {
- x = x.split('.')
-
- // handle populating dot notation for both
- // the key and its aliases.
- if (splitKey.length > 1) {
- var a = [].concat(splitKey)
- a.shift() // nuke the old key.
- x = x.concat(a)
- }
-
- setKey(argv, x, value)
- })
-
- var keys = [key].concat(aliases[key] || [])
- for (var i = 0, l = keys.length; i < l; i++) {
- if (flags.normalize[keys[i]]) {
- keys.forEach(function (key) {
- argv.__defineSetter__(key, function (v) {
- val = path.normalize(v)
- })
-
- argv.__defineGetter__(key, function () {
- return typeof val === 'string' ?
- path.normalize(val) : val
- })
- })
- break
- }
- }
- }
-
- // set args from config.json file, this should be
- // applied last so that defaults can be applied.
- function setConfig (argv) {
- var configLookup = {}
-
- // expand defaults/aliases, in-case any happen to reference
- // the config.json file.
- applyDefaultsAndAliases(configLookup, aliases, defaults)
-
- Object.keys(flags.configs).forEach(function (configKey) {
- var configPath = argv[configKey] || configLookup[configKey]
- if (configPath) {
- try {
- var config = require(path.resolve(process.cwd(), configPath))
-
- Object.keys(config).forEach(function (key) {
- // setting arguments via CLI takes precedence over
- // values within the config file.
- if (argv[key] === undefined) {
- delete argv[key]
- setArg(key, config[key])
- }
- })
- } catch (ex) {
- throw Error('invalid json config file: ' + configPath)
- }
- }
- })
- }
-
- function applyDefaultsAndAliases (obj, aliases, defaults) {
- Object.keys(defaults).forEach(function (key) {
- if (!hasKey(obj, key.split('.'))) {
- setKey(obj, key.split('.'), defaults[key])
-
- ;(aliases[key] || []).forEach(function (x) {
- setKey(obj, x.split('.'), defaults[key])
- })
- }
- })
- }
-
- function hasKey (obj, keys) {
- var o = obj
- keys.slice(0, -1).forEach(function (key) {
- o = (o[key] || {})
- })
-
- var key = keys[keys.length - 1]
- return key in o
- }
-
- function setKey (obj, keys, value) {
- var o = obj
- keys.slice(0, -1).forEach(function (key) {
- if (o[key] === undefined) o[key] = {}
- o = o[key]
- })
-
- var key = keys[keys.length - 1]
- if (value === increment) {
- o[key] = increment(o[key])
- } else if (o[key] === undefined && checkAllAliases(key, flags.arrays)) {
- o[key] = Array.isArray(value) ? value : [value]
- } else if (o[key] === undefined || typeof o[key] === 'boolean') {
- o[key] = value
- } else if (Array.isArray(o[key])) {
- o[key].push(value)
- } else {
- o[key] = [ o[key], value ]
- }
- }
-
- // extend the aliases list with inferred aliases.
- function extendAliases (obj) {
- Object.keys(obj || {}).forEach(function (key) {
- aliases[key] = [].concat(opts.alias[key] || [])
- // For "--option-name", also set argv.optionName
- aliases[key].concat(key).forEach(function (x) {
- if (/-/.test(x)) {
- var c = camelCase(x)
- aliases[key].push(c)
- newAliases[c] = true
- }
- })
- aliases[key].forEach(function (x) {
- aliases[x] = [key].concat(aliases[key].filter(function (y) {
- return x !== y
- }))
- })
- })
- }
-
- // check if a flag is set for any of a key's aliases.
- function checkAllAliases (key, flag) {
- var isSet = false,
- toCheck = [].concat(aliases[key] || [], key)
-
- toCheck.forEach(function (key) {
- if (flag[key]) isSet = flag[key]
- })
-
- return isSet
- }
-
- // return a default value, given the type of a flag.,
- // e.g., key of type 'string' will default to '', rather than 'true'.
- function defaultForType (type) {
- var def = {
- boolean: true,
- string: '',
- array: []
- }
-
- return def[type]
- }
-
- // given a flag, enforce a default type.
- function guessType (key, flags) {
- var type = 'boolean'
-
- if (flags.strings && flags.strings[key]) type = 'string'
- else if (flags.arrays && flags.arrays[key]) type = 'array'
-
- return type
- }
-
- function isNumber (x) {
- if (typeof x === 'number') return true
- if (/^0x[0-9a-f]+$/i.test(x)) return true
- return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x)
- }
-
- return {
- argv: argv,
- aliases: aliases,
- newAliases: newAliases
- }
-}
diff --git a/node_modules/yargs/lib/usage.js b/node_modules/yargs/lib/usage.js
@@ -1,11 +1,12 @@
// this file handles outputting usage instructions,
// failures, etc. keeps logging in one place.
-var cliui = require('cliui'),
- decamelize = require('decamelize'),
- wsize = require('window-size')
+const stringWidth = require('string-width')
+const objFilter = require('./obj-filter')
+const setBlocking = require('set-blocking')
-module.exports = function (yargs) {
- var self = {}
+module.exports = function (yargs, y18n) {
+ const __ = y18n.__
+ const self = {}
// methods for ouputting/building failure message.
var fails = []
@@ -27,22 +28,35 @@ module.exports = function (yargs) {
return self
}
- self.fail = function (msg) {
+ var failureOutput = false
+ self.fail = function (msg, err) {
+ const logger = yargs._getLoggerInstance()
+
if (fails.length) {
- fails.forEach(function (f) {
- f(msg)
- })
+ for (var i = fails.length - 1; i >= 0; --i) {
+ fails[i](msg, err, self)
+ }
} else {
- if (showHelpOnFail) yargs.showHelp('error')
- if (msg) console.error(msg)
- if (failMessage) {
- if (msg) console.error('')
- console.error(failMessage)
+ if (yargs.getExitProcess()) setBlocking(true)
+
+ // don't output failure message more than once
+ if (!failureOutput) {
+ failureOutput = true
+ if (showHelpOnFail) yargs.showHelp('error')
+ if (msg) logger.error(msg)
+ if (failMessage) {
+ if (msg) logger.error('')
+ logger.error(failMessage)
+ }
}
+
+ err = err || new Error(msg)
if (yargs.getExitProcess()) {
- process.exit(1)
+ return yargs.exit(1)
+ } else if (yargs._hasParseCallback()) {
+ return yargs.exit(1, err)
} else {
- throw new Error(msg)
+ throw err
}
}
}
@@ -52,6 +66,9 @@ module.exports = function (yargs) {
self.usage = function (msg) {
usage = msg
}
+ self.getUsage = function () {
+ return usage
+ }
var examples = []
self.example = function (cmd, description) {
@@ -59,8 +76,8 @@ module.exports = function (yargs) {
}
var commands = []
- self.command = function (cmd, description) {
- commands.push([cmd, description || ''])
+ self.command = function (cmd, description, aliases) {
+ commands.push([cmd, description || '', aliases])
}
self.getCommands = function () {
return commands
@@ -85,29 +102,49 @@ module.exports = function (yargs) {
epilog = msg
}
- var wrap = windowWidth()
+ var wrapSet = false
+ var wrap
self.wrap = function (cols) {
+ wrapSet = true
wrap = cols
}
+ function getWrap () {
+ // lazily call windowWidth() because it's very expensive,
+ // and only needs to be called if the user wants to show usage/help
+ if (!wrapSet) {
+ wrap = windowWidth()
+ wrapSet = true
+ }
+ return wrap
+ }
+
+ var deferY18nLookupPrefix = '__yargsString__:'
+ self.deferY18nLookup = function (str) {
+ return deferY18nLookupPrefix + str
+ }
+
+ var defaultGroup = 'Options:'
self.help = function () {
normalizeAliases()
- var demanded = yargs.getDemanded(),
- options = yargs.getOptions(),
- keys = Object.keys(
- Object.keys(descriptions)
- .concat(Object.keys(demanded))
- .concat(Object.keys(options.default))
- .reduce(function (acc, key) {
- if (key !== '_') acc[key] = true
- return acc
- }, {})
- ),
- ui = cliui({
- width: wrap,
- wrap: !!wrap
- })
+ var demanded = yargs.getDemanded()
+ var groups = yargs.getGroups()
+ var options = yargs.getOptions()
+ var keys = Object.keys(
+ Object.keys(descriptions)
+ .concat(Object.keys(demanded))
+ .concat(Object.keys(options.default))
+ .reduce(function (acc, key) {
+ if (key !== '_') acc[key] = true
+ return acc
+ }, {})
+ )
+ var theWrap = getWrap()
+ var ui = require('cliui')({
+ width: theWrap,
+ wrap: !!theWrap
+ })
// the usage string.
if (usage) {
@@ -118,19 +155,25 @@ module.exports = function (yargs) {
// your application's commands, i.e., non-option
// arguments populated in '_'.
if (commands.length) {
- ui.div('Commands:')
+ ui.div(__('Commands:'))
commands.forEach(function (command) {
- ui.div(
- {text: command[0], padding: [0, 2, 0, 2], width: maxWidth(commands) + 4},
+ ui.span(
+ {text: command[0], padding: [0, 2, 0, 2], width: maxWidth(commands, theWrap) + 4},
{text: command[1]}
)
+ if (command[2] && command[2].length) {
+ ui.div({text: '[' + __('aliases:') + ' ' + command[2].join(', ') + ']', padding: [0, 0, 0, 2], align: 'right'})
+ } else {
+ ui.div()
+ }
})
ui.div()
}
- // the options table.
+ // perform some cleanup on the keys array, making it
+ // only include top-level keys not their aliases.
var aliasKeys = (Object.keys(options.alias) || [])
.concat(Object.keys(yargs.parsed.newAliases) || [])
@@ -140,38 +183,62 @@ module.exports = function (yargs) {
})
})
- var switches = keys.reduce(function (acc, key) {
- acc[key] = [ key ].concat(options.alias[key] || [])
- .map(function (sw) {
- return (sw.length > 1 ? '--' : '-') + sw
+ // populate 'Options:' group with any keys that have not
+ // explicitly had a group set.
+ if (!groups[defaultGroup]) groups[defaultGroup] = []
+ addUngroupedKeys(keys, options.alias, groups)
+
+ // display 'Options:' table along with any custom tables:
+ Object.keys(groups).forEach(function (groupName) {
+ if (!groups[groupName].length) return
+
+ ui.div(__(groupName))
+
+ // if we've grouped the key 'f', but 'f' aliases 'foobar',
+ // normalizedKeys should contain only 'foobar'.
+ var normalizedKeys = groups[groupName].map(function (key) {
+ if (~aliasKeys.indexOf(key)) return key
+ for (var i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) {
+ if (~(options.alias[aliasKey] || []).indexOf(key)) return aliasKey
+ }
+ return key
})
- .join(', ')
- return acc
- }, {})
+ // actually generate the switches string --foo, -f, --bar.
+ var switches = normalizedKeys.reduce(function (acc, key) {
+ acc[key] = [ key ].concat(options.alias[key] || [])
+ .map(function (sw) {
+ return (sw.length > 1 ? '--' : '-') + sw
+ })
+ .join(', ')
- if (keys.length) {
- ui.div('Options:')
+ return acc
+ }, {})
- keys.forEach(function (key) {
+ normalizedKeys.forEach(function (key) {
var kswitch = switches[key]
var desc = descriptions[key] || ''
var type = null
- if (~options.boolean.indexOf(key)) type = '[boolean]'
- if (~options.count.indexOf(key)) type = '[count]'
- if (~options.string.indexOf(key)) type = '[string]'
- if (~options.normalize.indexOf(key)) type = '[string]'
- if (~options.array.indexOf(key)) type = '[array]'
+ if (~desc.lastIndexOf(deferY18nLookupPrefix)) desc = __(desc.substring(deferY18nLookupPrefix.length))
+
+ if (~options.boolean.indexOf(key)) type = '[' + __('boolean') + ']'
+ if (~options.count.indexOf(key)) type = '[' + __('count') + ']'
+ if (~options.string.indexOf(key)) type = '[' + __('string') + ']'
+ if (~options.normalize.indexOf(key)) type = '[' + __('string') + ']'
+ if (~options.array.indexOf(key)) type = '[' + __('array') + ']'
+ if (~options.number.indexOf(key)) type = '[' + __('number') + ']'
var extra = [
- type,
- demanded[key] ? '[required]' : null,
- defaultString(options.default[key], options.defaultDescription[key])
- ].filter(Boolean).join(' ')
+ type,
+ demanded[key] ? '[' + __('required') + ']' : null,
+ options.choices && options.choices[key] ? '[' + __('choices:') + ' ' +
+ self.stringifiedValues(options.choices[key]) + ']' : null,
+ defaultString(options.default[key], options.defaultDescription[key])
+ ].filter(Boolean).join(' ')
ui.span(
- {text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches) + 4},
+ {text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches, theWrap) + 4},
desc
)
@@ -180,11 +247,11 @@ module.exports = function (yargs) {
})
ui.div()
- }
+ })
// describe some common use-cases for your application.
if (examples.length) {
- ui.div('Examples:')
+ ui.div(__('Examples:'))
examples.forEach(function (example) {
example[0] = example[0].replace(/\$0/g, yargs.$0)
@@ -192,7 +259,7 @@ module.exports = function (yargs) {
examples.forEach(function (example) {
ui.div(
- {text: example[0], padding: [0, 2, 0, 2], width: maxWidth(examples) + 4},
+ {text: example[0], padding: [0, 2, 0, 2], width: maxWidth(examples, theWrap) + 4},
example[1]
)
})
@@ -211,11 +278,11 @@ module.exports = function (yargs) {
// return the maximum width of a string
// in the left-hand column of a table.
- function maxWidth (table) {
+ function maxWidth (table, theWrap) {
var width = 0
// table might be of the form [leftColumn],
- // or {key: leftColumn}}
+ // or {key: leftColumn}
if (!Array.isArray(table)) {
table = Object.keys(table).map(function (key) {
return [table[key]]
@@ -223,12 +290,12 @@ module.exports = function (yargs) {
}
table.forEach(function (v) {
- width = Math.max(v[0].length, width)
+ width = Math.max(stringWidth(v[0]), width)
})
// if we've enabled 'wrap' we should limit
// the max-width of the left-column.
- if (wrap) width = Math.min(width, parseInt(wrap * 0.5, 10))
+ if (theWrap) width = Math.min(width, parseInt(theWrap * 0.5, 10))
return width
}
@@ -236,8 +303,8 @@ module.exports = function (yargs) {
// make sure any options set for aliases,
// are copied to the keys being aliased.
function normalizeAliases () {
- var options = yargs.getOptions(),
- demanded = yargs.getDemanded()
+ var demanded = yargs.getDemanded()
+ var options = yargs.getOptions()
;(Object.keys(options.alias) || []).forEach(function (key) {
options.alias[key].forEach(function (alias) {
@@ -245,36 +312,70 @@ module.exports = function (yargs) {
if (descriptions[alias]) self.describe(key, descriptions[alias])
// copy demanded.
if (demanded[alias]) yargs.demand(key, demanded[alias].msg)
-
// type messages.
if (~options.boolean.indexOf(alias)) yargs.boolean(key)
if (~options.count.indexOf(alias)) yargs.count(key)
if (~options.string.indexOf(alias)) yargs.string(key)
if (~options.normalize.indexOf(alias)) yargs.normalize(key)
if (~options.array.indexOf(alias)) yargs.array(key)
+ if (~options.number.indexOf(alias)) yargs.number(key)
})
})
}
+ // given a set of keys, place any keys that are
+ // ungrouped under the 'Options:' grouping.
+ function addUngroupedKeys (keys, aliases, groups) {
+ var groupedKeys = []
+ var toCheck = null
+ Object.keys(groups).forEach(function (group) {
+ groupedKeys = groupedKeys.concat(groups[group])
+ })
+
+ keys.forEach(function (key) {
+ toCheck = [key].concat(aliases[key])
+ if (!toCheck.some(function (k) {
+ return groupedKeys.indexOf(k) !== -1
+ })) {
+ groups[defaultGroup].push(key)
+ }
+ })
+ return groupedKeys
+ }
+
self.showHelp = function (level) {
- level = level || 'error'
- console[level](self.help())
+ const logger = yargs._getLoggerInstance()
+ if (!level) level = 'error'
+ var emit = typeof level === 'function' ? level : logger[level]
+ emit(self.help())
}
- self.functionDescription = function (fn, defaultDescription) {
- if (defaultDescription) {
- return defaultDescription
- }
- var description = fn.name ? decamelize(fn.name, '-') : 'generated-value'
+ self.functionDescription = function (fn) {
+ var description = fn.name ? require('decamelize')(fn.name, '-') : __('generated-value')
return ['(', description, ')'].join('')
}
+ self.stringifiedValues = function (values, separator) {
+ var string = ''
+ var sep = separator || ', '
+ var array = [].concat(values)
+
+ if (!values || !array.length) return string
+
+ array.forEach(function (value) {
+ if (string.length) string += sep
+ string += JSON.stringify(value)
+ })
+
+ return string
+ }
+
// format the default-value-string displayed in
// the right-hand column.
function defaultString (value, defaultDescription) {
- var string = '[default: '
+ var string = '[' + __('default:') + ' '
- if (value === undefined) return null
+ if (value === undefined && !defaultDescription) return null
if (defaultDescription) {
string += defaultDescription
@@ -296,18 +397,57 @@ module.exports = function (yargs) {
// guess the width of the console window, max-width 80.
function windowWidth () {
+ const wsize = require('window-size')
return wsize.width ? Math.min(80, wsize.width) : null
}
// logic for displaying application version.
var version = null
- self.version = function (ver, opt, msg) {
+ self.version = function (ver) {
version = ver
}
self.showVersion = function () {
- if (typeof version === 'function') console.log(version())
- else console.log(version)
+ const logger = yargs._getLoggerInstance()
+ if (typeof version === 'function') logger.log(version())
+ else logger.log(version)
+ }
+
+ self.reset = function (globalLookup) {
+ // do not reset wrap here
+ // do not reset fails here
+ failMessage = null
+ failureOutput = false
+ usage = undefined
+ epilog = undefined
+ examples = []
+ commands = []
+ descriptions = objFilter(descriptions, function (k, v) {
+ return globalLookup[k]
+ })
+ return self
+ }
+
+ var frozen
+ self.freeze = function () {
+ frozen = {}
+ frozen.failMessage = failMessage
+ frozen.failureOutput = failureOutput
+ frozen.usage = usage
+ frozen.epilog = epilog
+ frozen.examples = examples
+ frozen.commands = commands
+ frozen.descriptions = descriptions
+ }
+ self.unfreeze = function () {
+ failMessage = frozen.failMessage
+ failureOutput = frozen.failureOutput
+ usage = frozen.usage
+ epilog = frozen.epilog
+ examples = frozen.examples
+ commands = frozen.commands
+ descriptions = frozen.descriptions
+ frozen = undefined
}
return self
diff --git a/node_modules/yargs/lib/validation.js b/node_modules/yargs/lib/validation.js
@@ -1,58 +1,80 @@
+const objFilter = require('./obj-filter')
+
// validation-type-stuff, missing params,
// bad implications, custom checks.
-module.exports = function (yargs, usage) {
- var self = {}
+module.exports = function (yargs, usage, y18n) {
+ const __ = y18n.__
+ const __n = y18n.__n
+ const self = {}
// validate appropriate # of non-option
// arguments were provided, i.e., '_'.
self.nonOptionCount = function (argv) {
- var demanded = yargs.getDemanded()
+ const demanded = yargs.getDemanded()
+ // don't count currently executing commands
+ const _s = argv._.length - yargs.getContext().commands.length
- if (demanded._ && argv._.length < demanded._.count) {
+ if (demanded._ && (_s < demanded._.count || _s > demanded._.max)) {
if (demanded._.msg !== undefined) {
usage.fail(demanded._.msg)
+ } else if (_s < demanded._.count) {
+ usage.fail(
+ __('Not enough non-option arguments: got %s, need at least %s', _s, demanded._.count)
+ )
} else {
- usage.fail('Not enough non-option arguments: got '
- + argv._.length + ', need at least ' + demanded._.count
+ usage.fail(
+ __('Too many non-option arguments: got %s, maximum of %s', _s, demanded._.max)
)
}
}
}
+ // validate the appropriate # of <required>
+ // positional arguments were provided:
+ self.positionalCount = function (required, observed) {
+ if (observed < required) {
+ usage.fail(
+ __('Not enough non-option arguments: got %s, need at least %s', observed, required)
+ )
+ }
+ }
+
// make sure that any args that require an
// value (--foo=bar), have a value.
self.missingArgumentValue = function (argv) {
- var options = yargs.getOptions(),
- defaultValues = [true, false, '']
+ const defaultValues = [true, false, '']
+ const options = yargs.getOptions()
if (options.requiresArg.length > 0) {
- var missingRequiredArgs = []
+ const missingRequiredArgs = []
options.requiresArg.forEach(function (key) {
- var value = argv[key]
+ const value = argv[key]
// if a value is explicitly requested,
// flag argument as missing if it does not
// look like foo=bar was entered.
- if (~defaultValues.indexOf(value)
- || (Array.isArray(value) && !value.length)) {
+ if (~defaultValues.indexOf(value) ||
+ (Array.isArray(value) && !value.length)) {
missingRequiredArgs.push(key)
}
})
- if (missingRequiredArgs.length === 1) {
- usage.fail('Missing argument value: ' + missingRequiredArgs[0])
- } else if (missingRequiredArgs.length > 1) {
- var message = 'Missing argument values: ' + missingRequiredArgs.join(', ')
- usage.fail(message)
+ if (missingRequiredArgs.length > 0) {
+ usage.fail(__n(
+ 'Missing argument value: %s',
+ 'Missing argument values: %s',
+ missingRequiredArgs.length,
+ missingRequiredArgs.join(', ')
+ ))
}
}
}
// make sure all the required arguments are present.
self.requiredArguments = function (argv) {
- var demanded = yargs.getDemanded(),
- missing = null
+ const demanded = yargs.getDemanded()
+ var missing = null
Object.keys(demanded).forEach(function (key) {
if (!argv.hasOwnProperty(key)) {
@@ -62,25 +84,33 @@ module.exports = function (yargs, usage) {
})
if (missing) {
- var customMsgs = []
+ const customMsgs = []
Object.keys(missing).forEach(function (key) {
- var msg = missing[key].msg
+ const msg = missing[key].msg
if (msg && customMsgs.indexOf(msg) < 0) {
customMsgs.push(msg)
}
})
- var customMsg = customMsgs.length ? '\n' + customMsgs.join('\n') : ''
- usage.fail('Missing required arguments: ' + Object.keys(missing).join(', ') + customMsg)
+ const customMsg = customMsgs.length ? '\n' + customMsgs.join('\n') : ''
+
+ usage.fail(__n(
+ 'Missing required argument: %s',
+ 'Missing required arguments: %s',
+ Object.keys(missing).length,
+ Object.keys(missing).join(', ') + customMsg
+ ))
}
}
// check for unknown arguments (strict-mode).
self.unknownArguments = function (argv, aliases) {
- var descriptions = usage.getDescriptions(),
- demanded = yargs.getDemanded(),
- unknown = [],
- aliasLookup = {}
+ const aliasLookup = {}
+ const descriptions = usage.getDescriptions()
+ const demanded = yargs.getDemanded()
+ const commandKeys = yargs.getCommandInstance().getCommands()
+ const unknown = []
+ const currentContext = yargs.getContext()
Object.keys(aliases).forEach(function (key) {
aliases[key].forEach(function (alias) {
@@ -97,13 +127,59 @@ module.exports = function (yargs, usage) {
}
})
- if (unknown.length === 1) {
- usage.fail('Unknown argument: ' + unknown[0])
- } else if (unknown.length > 1) {
- usage.fail('Unknown arguments: ' + unknown.join(', '))
+ if (commandKeys.length > 0) {
+ argv._.slice(currentContext.commands.length).forEach(function (key) {
+ if (commandKeys.indexOf(key) === -1) {
+ unknown.push(key)
+ }
+ })
+ }
+
+ if (unknown.length > 0) {
+ usage.fail(__n(
+ 'Unknown argument: %s',
+ 'Unknown arguments: %s',
+ unknown.length,
+ unknown.join(', ')
+ ))
}
}
+ // validate arguments limited to enumerated choices
+ self.limitedChoices = function (argv) {
+ const options = yargs.getOptions()
+ const invalid = {}
+
+ if (!Object.keys(options.choices).length) return
+
+ Object.keys(argv).forEach(function (key) {
+ if (key !== '$0' && key !== '_' &&
+ options.choices.hasOwnProperty(key)) {
+ [].concat(argv[key]).forEach(function (value) {
+ // TODO case-insensitive configurability
+ if (options.choices[key].indexOf(value) === -1) {
+ invalid[key] = (invalid[key] || []).concat(value)
+ }
+ })
+ }
+ })
+
+ const invalidKeys = Object.keys(invalid)
+
+ if (!invalidKeys.length) return
+
+ var msg = __('Invalid values:')
+ invalidKeys.forEach(function (key) {
+ msg += '\n ' + __(
+ 'Argument: %s, Given: %s, Choices: %s',
+ key,
+ usage.stringifiedValues(invalid[key]),
+ usage.stringifiedValues(options.choices[key])
+ )
+ })
+ usage.fail(msg)
+ }
+
// custom checks, added using the `check` option on yargs.
var checks = []
self.check = function (f) {
@@ -111,18 +187,21 @@ module.exports = function (yargs, usage) {
}
self.customChecks = function (argv, aliases) {
- checks.forEach(function (f) {
+ for (var i = 0, f; (f = checks[i]) !== undefined; i++) {
+ var result = null
try {
- var result = f(argv, aliases)
- if (!result) {
- usage.fail('Argument check failed: ' + f.toString())
- } else if (typeof result === 'string') {
- usage.fail(result)
- }
+ result = f(argv, aliases)
} catch (err) {
- usage.fail(err.message ? err.message : err)
+ usage.fail(err.message ? err.message : err, err)
+ continue
}
- })
+
+ if (!result) {
+ usage.fail(__('Argument check failed: %s', f.toString()))
+ } else if (typeof result === 'string' || result instanceof Error) {
+ usage.fail(result.toString(), result)
+ }
+ }
}
// check implications, argument foo implies => argument bar.
@@ -141,12 +220,18 @@ module.exports = function (yargs, usage) {
}
self.implications = function (argv) {
- var implyFail = []
+ const implyFail = []
Object.keys(implied).forEach(function (key) {
- var num,
- origKey = key,
- value = implied[key]
+ var booleanNegation
+ if (yargs.getOptions().configuration['boolean-negation'] === false) {
+ booleanNegation = false
+ } else {
+ booleanNegation = true
+ }
+ var num
+ const origKey = key
+ var value = implied[key]
// convert string '1' to number 1
num = Number(key)
@@ -155,7 +240,7 @@ module.exports = function (yargs, usage) {
if (typeof key === 'number') {
// check length of argv._
key = argv._.length >= key
- } else if (key.match(/^--no-.+/)) {
+ } else if (key.match(/^--no-.+/) && booleanNegation) {
// check if key doesn't exist
key = key.match(/^--no-(.+)/)[1]
key = !argv[key]
@@ -169,7 +254,7 @@ module.exports = function (yargs, usage) {
if (typeof value === 'number') {
value = argv._.length >= value
- } else if (value.match(/^--no-.+/)) {
+ } else if (value.match(/^--no-.+/) && booleanNegation) {
value = value.match(/^--no-(.+)/)[1]
value = !argv[value]
} else {
@@ -182,7 +267,7 @@ module.exports = function (yargs, usage) {
})
if (implyFail.length) {
- var msg = 'Implications failed:\n'
+ var msg = __('Implications failed:') + '\n'
implyFail.forEach(function (key) {
msg += (' ' + key + ' -> ' + implied[key])
@@ -192,5 +277,42 @@ module.exports = function (yargs, usage) {
}
}
+ self.recommendCommands = function (cmd, potentialCommands) {
+ const distance = require('./levenshtein')
+ const threshold = 3 // if it takes more than three edits, let's move on.
+ potentialCommands = potentialCommands.sort(function (a, b) { return b.length - a.length })
+
+ var recommended = null
+ var bestDistance = Infinity
+ for (var i = 0, candidate; (candidate = potentialCommands[i]) !== undefined; i++) {
+ var d = distance(cmd, candidate)
+ if (d <= threshold && d < bestDistance) {
+ bestDistance = d
+ recommended = candidate
+ }
+ }
+ if (recommended) usage.fail(__('Did you mean %s?', recommended))
+ }
+
+ self.reset = function (globalLookup) {
+ implied = objFilter(implied, function (k, v) {
+ return globalLookup[k]
+ })
+ checks = []
+ return self
+ }
+
+ var frozen
+ self.freeze = function () {
+ frozen = {}
+ frozen.implied = implied
+ frozen.checks = checks
+ }
+ self.unfreeze = function () {
+ implied = frozen.implied
+ checks = frozen.checks
+ frozen = undefined
+ }
+
return self
}
diff --git a/node_modules/yargs/package.json b/node_modules/yargs/package.json
@@ -1,42 +1,61 @@
{
"name": "yargs",
- "version": "3.10.0",
- "description": "Light-weight option parsing with an argv hash. No optstrings attached.",
+ "version": "6.4.0",
+ "description": "yargs the modern, pirate-themed, successor to optimist.",
"main": "./index.js",
"files": [
"index.js",
+ "yargs.js",
"lib",
+ "locales",
"completion.sh.hbs",
"LICENSE"
],
"dependencies": {
- "camelcase": "^1.0.2",
- "cliui": "^2.1.0",
- "decamelize": "^1.0.0",
- "window-size": "0.1.0"
+ "camelcase": "^3.0.0",
+ "cliui": "^3.2.0",
+ "decamelize": "^1.1.1",
+ "get-caller-file": "^1.0.1",
+ "os-locale": "^1.4.0",
+ "read-pkg-up": "^1.0.1",
+ "require-directory": "^2.1.1",
+ "require-main-filename": "^1.0.1",
+ "set-blocking": "^2.0.0",
+ "string-width": "^1.0.2",
+ "which-module": "^1.0.0",
+ "window-size": "^0.2.0",
+ "y18n": "^3.2.1",
+ "yargs-parser": "^4.1.0"
},
"devDependencies": {
- "chai": "^2.2.0",
- "coveralls": "^2.11.2",
+ "chai": "^3.4.1",
+ "chalk": "^1.1.3",
+ "coveralls": "^2.11.11",
+ "cpr": "^2.0.0",
+ "cross-spawn": "^5.0.1",
+ "es6-promise": "^4.0.2",
"hashish": "0.0.4",
- "mocha": "^2.2.1",
- "nyc": "^2.2.1",
- "standard": "^3.11.1"
+ "mocha": "^3.0.1",
+ "nyc": "^8.3.2",
+ "rimraf": "^2.5.0",
+ "standard": "^8.2.0",
+ "standard-version": "^3.0.0",
+ "which": "^1.2.9"
},
"scripts": {
- "test": "standard && nyc mocha --check-leaks && nyc report",
- "coverage": "nyc report --reporter=text-lcov | coveralls"
+ "pretest": "standard",
+ "test": "nyc --cache mocha --require ./test/before.js --timeout=8000 --check-leaks",
+ "coverage": "nyc report --reporter=text-lcov | coveralls",
+ "release": "standard-version"
},
"repository": {
"type": "git",
- "url": "http://github.com/bcoe/yargs.git"
+ "url": "http://github.com/yargs/yargs.git"
},
+ "homepage": "http://yargs.js.org/",
"standard": {
"ignore": [
"**/example/**"
- ],
- "globals": [
- "it"
]
},
"keywords": [
@@ -48,38 +67,15 @@
"cli",
"command"
],
- "author": {
- "name": "Alex Ford",
- "email": "Alex.Ford@CodeTunnel.com",
- "url": "http://CodeTunnel.com"
- },
- "contributors": [
- {
- "name": "Benjamin Coe",
- "email": "ben@npmjs.com",
- "url": "https://github.com/bcoe"
- },
- {
- "name": "Chris Needham",
- "email": "chris@chrisneedham.com",
- "url": "http://chrisneedham.com"
- },
- {
- "name": "James Nylen",
- "email": "jnylen@gmail.com",
- "url": "https://github.com/nylen"
- },
- {
- "name": "Benjamin Horsleben",
- "url": "https://github.com/fizker"
- },
- {
- "name": "Lin Clark",
- "url": "https://github.com/linclark"
- }
- ],
"license": "MIT",
"engine": {
- "node": ">=0.4"
+ "node": ">=0.10"
+ },
+ "greenkeeper": {
+ "ignore": [
+ "string-width",
+ "read-pkg-up",
+ "camelcase"
+ ]
}
}
diff --git a/package.json b/package.json
@@ -9,6 +9,7 @@
"author": "Nathan Randecker",
"license": "ISC",
"dependencies": {
+ "browser-sync": "^2.18.6",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.1",
"gulp-csso": "^2.0.0",
diff --git a/src/styles/main.scss b/src/styles/main.scss
@@ -125,7 +125,7 @@ body {
border-radius: 50%;
border: 2px solid #FFF;
transition: all .7s;
- &:hover {
+ &:focus {
color: $main;
background: #FFF;
}
@@ -164,7 +164,7 @@ body {
fill: #fff;
-webkit-animation: pulse 1.3s infinite;
animation: pulse 1.3s infinite;
- &:hover {
+ &:focus {
color: $sec;
}
&:active {
@@ -231,7 +231,7 @@ body {
transition: color 0.3s ease-out,
background-color 0.3s ease-out,
border-color 0.3s ease-out;
- &:hover {
+ &:focus {
background-color: $purple;
border-color: $purple;
color: #fff;
@@ -262,7 +262,7 @@ body {
text-decoration: none;
margin: 0;
color: #FFF;
- &:hover{
+ &:focus{
color: $sec;
}
&:active {
diff --git a/yarn.lock b/yarn.lock
@@ -6,6 +6,33 @@ abbrev@1:
version "1.0.9"
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135"
+accepts@1.3.3, accepts@~1.3.3:
+ version "1.3.3"
+ resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.3.tgz#c3ca7434938648c3e0d9c1e328dd68b622c284ca"
+ dependencies:
+ mime-types "~2.1.11"
+ negotiator "0.6.1"
+
+acorn-jsx@^3.0.1:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b"
+ dependencies:
+ acorn "^3.0.4"
+
+acorn-object-spread@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/acorn-object-spread/-/acorn-object-spread-1.0.0.tgz#48ead0f4a8eb16995a17a0db9ffc6acaada4ba68"
+ dependencies:
+ acorn "^3.1.0"
+
+acorn@^3.0.4, acorn@^3.1.0:
+ version "3.3.0"
+ resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"
+
+after@0.8.1:
+ version "0.8.1"
+ resolved "https://registry.yarnpkg.com/after/-/after-0.8.1.tgz#ab5d4fb883f596816d3515f8f791c0af486dd627"
+
align-text@^0.1.1, align-text@^0.1.3:
version "0.1.4"
resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117"
@@ -22,6 +49,13 @@ ansi-styles@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
+anymatch@^1.3.0:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-1.3.0.tgz#a3e52fa39168c825ff57b0248126ce5a8ff95507"
+ dependencies:
+ arrify "^1.0.0"
+ micromatch "^2.1.5"
+
aproba@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.0.4.tgz#2713680775e7614c8ba186c065d4e2e52d1072c0"
@@ -81,6 +115,10 @@ array-unique@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53"
+arraybuffer.slice@0.0.6:
+ version "0.0.6"
+ resolved "https://registry.yarnpkg.com/arraybuffer.slice/-/arraybuffer.slice-0.0.6.tgz#f33b2159f0532a3f3107a272c0ccfbd1ad2979ca"
+
arrify@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
@@ -97,14 +135,26 @@ assert-plus@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525"
+async-each-series@0.1.1:
+ version "0.1.1"
+ resolved "https://registry.yarnpkg.com/async-each-series/-/async-each-series-0.1.1.tgz#7617c1917401fd8ca4a28aadce3dbae98afeb432"
+
async-each-series@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/async-each-series/-/async-each-series-1.1.0.tgz#f42fd8155d38f21a5b8ea07c28e063ed1700b138"
+async-each@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d"
+
async-foreach@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/async-foreach/-/async-foreach-0.1.3.tgz#36121f845c0578172de419a97dbeb1d16ec34542"
+async@1.5.2:
+ version "1.5.2"
+ resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
+
async@~0.2.6:
version "0.2.10"
resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1"
@@ -121,10 +171,26 @@ aws4@^1.2.1:
version "1.5.0"
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.5.0.tgz#0a29ffb79c31c9e712eeb087e8e7a64b4a56d755"
+backo2@1.0.2:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/backo2/-/backo2-1.0.2.tgz#31ab1ac8b129363463e35b3ebb69f4dfcfba7947"
+
balanced-match@^0.4.1:
version "0.4.2"
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-0.4.2.tgz#cb3f3e3c732dc0f01ee70b403f302e61d7709838"
+base64-arraybuffer@0.1.5:
+ version "0.1.5"
+ resolved "https://registry.yarnpkg.com/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz#73926771923b5a19747ad666aa5cd4bf9c6e9ce8"
+
+base64id@0.1.0:
+ version "0.1.0"
+ resolved "https://registry.yarnpkg.com/base64id/-/base64id-0.1.0.tgz#02ce0fdeee0cef4f40080e1e73e834f0b1bfce3f"
+
+batch@0.5.3:
+ version "0.5.3"
+ resolved "https://registry.yarnpkg.com/batch/-/batch-0.5.3.tgz#3f3414f380321743bfc1042f9a83ff1d5824d464"
+
bcrypt-pbkdf@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.0.tgz#3ca76b85241c7170bf7d9703e7b9aa74630040d4"
@@ -135,6 +201,12 @@ beeper@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/beeper/-/beeper-1.1.1.tgz#e6d5ea8c5dad001304a70b22638447f69cb2f809"
+better-assert@~1.0.0:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/better-assert/-/better-assert-1.0.2.tgz#40866b9e1b9e0b55b481894311e68faffaebc522"
+ dependencies:
+ callsite "1.0.0"
+
bin-build@^2.0.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/bin-build/-/bin-build-2.2.0.tgz#11f8dd61f70ffcfa2bdcaa5b46f5e8fedd4221cc"
@@ -179,12 +251,20 @@ bin-wrapper@^3.0.0:
lazy-req "^1.0.0"
os-filter-obj "^1.0.0"
+binary-extensions@^1.0.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.8.0.tgz#48ec8d16df4377eae5fa5884682480af4d95c774"
+
bl@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.0.tgz#1397e7ec42c5f5dc387470c500e34a9f6be9ea98"
dependencies:
readable-stream "^2.0.5"
+blob@0.0.4:
+ version "0.0.4"
+ resolved "https://registry.yarnpkg.com/blob/-/blob-0.0.4.tgz#bcf13052ca54463f30f9fc7e95b9a47630a94921"
+
block-stream@*:
version "0.0.9"
resolved "https://registry.yarnpkg.com/block-stream/-/block-stream-0.0.9.tgz#13ebfe778a03205cfe03751481ebb4b3300c126a"
@@ -212,6 +292,78 @@ braces@^1.8.2:
preserve "^0.2.0"
repeat-element "^1.1.2"
+browser-sync-client@2.4.4:
+ version "2.4.4"
+ resolved "https://registry.yarnpkg.com/browser-sync-client/-/browser-sync-client-2.4.4.tgz#e2a6c27f770e0ad0ffed76964dfb6a971fcf55eb"
+ dependencies:
+ etag "^1.7.0"
+ fresh "^0.3.0"
+
+browser-sync-ui@0.6.2:
+ version "0.6.2"
+ resolved "https://registry.yarnpkg.com/browser-sync-ui/-/browser-sync-ui-0.6.2.tgz#9e7994004d463e55a024bdd149583b11ad8f87f3"
+ dependencies:
+ async-each-series "0.1.1"
+ connect-history-api-fallback "^1.1.0"
+ immutable "^3.7.6"
+ server-destroy "1.0.1"
+ stream-throttle "^0.1.3"
+ weinre "^2.0.0-pre-I0Z7U9OV"
+
+browser-sync@^2.18.6:
+ version "2.18.6"
+ resolved "https://registry.yarnpkg.com/browser-sync/-/browser-sync-2.18.6.tgz#7b303ea8905eaa20629e6c5d3e820c32ad96bb24"
+ dependencies:
+ browser-sync-client "2.4.4"
+ browser-sync-ui "0.6.2"
+ bs-recipes "1.3.4"
+ chokidar "1.6.1"
+ connect "3.5.0"
+ dev-ip "^1.0.1"
+ easy-extender "2.3.2"
+ eazy-logger "3.0.2"
+ emitter-steward "^1.0.0"
+ fs-extra "1.0.0"
+ http-proxy "1.15.2"
+ immutable "3.8.1"
+ localtunnel "1.8.2"
+ micromatch "2.3.11"
+ opn "4.0.2"
+ portscanner "2.1.1"
+ qs "6.2.1"
+ resp-modifier "6.0.2"
+ rx "4.1.0"
+ serve-index "1.8.0"
+ serve-static "1.11.1"
+ server-destroy "1.0.1"
+ socket.io "1.6.0"
+ socket.io-client "1.6.0"
+ ua-parser-js "0.7.12"
+ yargs "6.4.0"
+
+bs-recipes@1.3.4:
+ version "1.3.4"
+ resolved "https://registry.yarnpkg.com/bs-recipes/-/bs-recipes-1.3.4.tgz#0d2d4d48a718c8c044769fdc4f89592dc8b69585"
+
+buble@^0.12.0:
+ version "0.12.5"
+ resolved "https://registry.yarnpkg.com/buble/-/buble-0.12.5.tgz#c66ffe92f9f4a3c65d3256079b711e2bd0bc5013"
+ dependencies:
+ acorn "^3.1.0"
+ acorn-jsx "^3.0.1"
+ acorn-object-spread "^1.0.0"
+ chalk "^1.1.3"
+ magic-string "^0.14.0"
+ minimist "^1.2.0"
+ os-homedir "^1.0.1"
+
+bubleify@^0.5.1:
+ version "0.5.1"
+ resolved "https://registry.yarnpkg.com/bubleify/-/bubleify-0.5.1.tgz#f65c47cee31b80cad8b9e747bbe187d7fe51e927"
+ dependencies:
+ buble "^0.12.0"
+ object-assign "^4.0.1"
+
buffer-crc32@~0.2.3:
version "0.2.13"
resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242"
@@ -233,6 +385,10 @@ builtin-modules@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f"
+callsite@1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/callsite/-/callsite-1.0.0.tgz#280398e5d664bd74038b6f0905153e6e8af1bc20"
+
camelcase-keys@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/camelcase-keys/-/camelcase-keys-2.1.0.tgz#308beeaffdf28119051efa1d932213c91b8f92e7"
@@ -240,7 +396,7 @@ camelcase-keys@^2.0.0:
camelcase "^2.0.0"
map-obj "^1.0.0"
-camelcase@^1.0.2:
+camelcase@^1.0.2, camelcase@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39"
@@ -286,6 +442,21 @@ chalk@^1.0.0, chalk@^1.1.1, chalk@^1.1.3:
strip-ansi "^3.0.0"
supports-color "^2.0.0"
+chokidar@1.6.1:
+ version "1.6.1"
+ resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.6.1.tgz#2f4447ab5e96e50fb3d789fd90d4c72e0e4c70c2"
+ dependencies:
+ anymatch "^1.3.0"
+ async-each "^1.0.0"
+ glob-parent "^2.0.0"
+ inherits "^2.0.1"
+ is-binary-path "^1.0.0"
+ is-glob "^2.0.0"
+ path-is-absolute "^1.0.0"
+ readdirp "^2.0.0"
+ optionalDependencies:
+ fsevents "^1.0.0"
+
clap@^1.0.9:
version "1.1.2"
resolved "https://registry.yarnpkg.com/clap/-/clap-1.1.2.tgz#316545bf22229225a2cecaa6824cd2f56a9709ed"
@@ -300,7 +471,7 @@ cliui@^2.1.0:
right-align "^0.1.1"
wordwrap "0.0.2"
-cliui@^3.2.0:
+cliui@^3.0.3, cliui@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d"
dependencies:
@@ -360,7 +531,7 @@ combined-stream@^1.0.5, combined-stream@~1.0.5:
dependencies:
delayed-stream "~1.0.0"
-commander@^2.9.0:
+commander@^2.2.0, commander@^2.9.0:
version "2.9.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4"
dependencies:
@@ -372,6 +543,22 @@ commander@~2.8.1:
dependencies:
graceful-readlink ">= 1.0.0"
+component-bind@1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/component-bind/-/component-bind-1.0.0.tgz#00c608ab7dcd93897c0009651b1d3a8e1e73bbd1"
+
+component-emitter@1.1.2:
+ version "1.1.2"
+ resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.1.2.tgz#296594f2753daa63996d2af08d15a95116c9aec3"
+
+component-emitter@1.2.1:
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6"
+
+component-inherit@0.0.3:
+ version "0.0.3"
+ resolved "https://registry.yarnpkg.com/component-inherit/-/component-inherit-0.0.3.tgz#645fc4adf58b72b649d5cae65135619db26ff143"
+
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
@@ -390,6 +577,27 @@ concat-with-sourcemaps@^1.0.0:
dependencies:
source-map "^0.5.1"
+connect-history-api-fallback@^1.1.0:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.3.0.tgz#e51d17f8f0ef0db90a64fdb47de3051556e9f169"
+
+connect@1.x:
+ version "1.9.2"
+ resolved "https://registry.yarnpkg.com/connect/-/connect-1.9.2.tgz#42880a22e9438ae59a8add74e437f58ae8e52807"
+ dependencies:
+ formidable "1.0.x"
+ mime ">= 0.0.1"
+ qs ">= 0.4.0"
+
+connect@3.5.0:
+ version "3.5.0"
+ resolved "https://registry.yarnpkg.com/connect/-/connect-3.5.0.tgz#b357525a0b4c1f50599cd983e1d9efeea9677198"
+ dependencies:
+ debug "~2.2.0"
+ finalhandler "0.5.0"
+ parseurl "~1.3.1"
+ utils-merge "1.0.0"
+
console-control-strings@^1.0.0, console-control-strings@~1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e"
@@ -402,6 +610,10 @@ convert-source-map@^1.1.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.3.0.tgz#e9f3e9c6e2728efc2676696a70eb382f73106a67"
+cookie@0.3.1:
+ version "0.3.1"
+ resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.3.1.tgz#e7e0a1f9ef43b4c8ba925c5c5a96e806d16873bb"
+
core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
@@ -462,6 +674,18 @@ dateformat@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-2.0.0.tgz#2743e3abb5c3fc2462e527dca445e04e9f4dee17"
+debug@2.2.0, debug@^2.2.0, debug@~2.2.0:
+ version "2.2.0"
+ resolved "https://registry.yarnpkg.com/debug/-/debug-2.2.0.tgz#f87057e995b1a1f6ae6a4960664137bc56f039da"
+ dependencies:
+ ms "0.7.1"
+
+debug@2.3.3:
+ version "2.3.3"
+ resolved "https://registry.yarnpkg.com/debug/-/debug-2.3.3.tgz#40c453e67e6e13c901ddec317af8986cda9eff8c"
+ dependencies:
+ ms "0.7.2"
+
decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2:
version "1.2.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
@@ -544,16 +768,28 @@ delegates@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a"
+depd@~1.1.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.0.tgz#e1bd82c6aab6ced965b97b88b17ed3e528ca18c3"
+
deprecated@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/deprecated/-/deprecated-0.0.1.tgz#f9c9af5464afa1e7a971458a8bdef2aa94d5bb19"
+destroy@~1.0.4:
+ version "1.0.4"
+ resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.0.4.tgz#978857442c44749e4206613e37946205826abd80"
+
detect-file@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-0.1.0.tgz#4935dedfd9488648e006b0129566e9386711ea63"
dependencies:
fs-exists-sync "^0.1.0"
+dev-ip@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/dev-ip/-/dev-ip-1.0.1.tgz#a76a3ed1855be7a012bb8ac16cb80f3c00dc28f0"
+
download@^4.0.0, download@^4.1.2:
version "4.4.3"
resolved "https://registry.yarnpkg.com/download/-/download-4.4.3.tgz#aa55fdad392d95d4b68e8c2be03e0c2aa21ba9ac"
@@ -602,12 +838,36 @@ each-async@^1.0.0, each-async@^1.1.1:
onetime "^1.0.0"
set-immediate-shim "^1.0.0"
+easy-extender@2.3.2:
+ version "2.3.2"
+ resolved "https://registry.yarnpkg.com/easy-extender/-/easy-extender-2.3.2.tgz#3d3248febe2b159607316d8f9cf491c16648221d"
+ dependencies:
+ lodash "^3.10.1"
+
+eazy-logger@3.0.2:
+ version "3.0.2"
+ resolved "https://registry.yarnpkg.com/eazy-logger/-/eazy-logger-3.0.2.tgz#a325aa5e53d13a2225889b2ac4113b2b9636f4fc"
+ dependencies:
+ tfunk "^3.0.1"
+
ecc-jsbn@~0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505"
dependencies:
jsbn "~0.1.0"
+ee-first@1.1.1:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
+
+emitter-steward@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/emitter-steward/-/emitter-steward-1.0.0.tgz#f3411ade9758a7565df848b2da0cbbd1b46cbd64"
+
+encodeurl@~1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.1.tgz#79e3d58655346909fe6f0f45a5de68103b294d20"
+
end-of-stream@1.0.0, end-of-stream@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.0.0.tgz#d4596e702734a93e40e9af864319eabd99ff2f0e"
@@ -620,12 +880,55 @@ end-of-stream@~0.1.5:
dependencies:
once "~1.3.0"
+engine.io-client@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/engine.io-client/-/engine.io-client-1.8.0.tgz#7b730e4127414087596d9be3c88d2bc5fdb6cf5c"
+ dependencies:
+ component-emitter "1.2.1"
+ component-inherit "0.0.3"
+ debug "2.3.3"
+ engine.io-parser "1.3.1"
+ has-cors "1.1.0"
+ indexof "0.0.1"
+ parsejson "0.0.3"
+ parseqs "0.0.5"
+ parseuri "0.0.5"
+ ws "1.1.1"
+ xmlhttprequest-ssl "1.5.3"
+ yeast "0.1.2"
+
+engine.io-parser@1.3.1:
+ version "1.3.1"
+ resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-1.3.1.tgz#9554f1ae33107d6fbd170ca5466d2f833f6a07cf"
+ dependencies:
+ after "0.8.1"
+ arraybuffer.slice "0.0.6"
+ base64-arraybuffer "0.1.5"
+ blob "0.0.4"
+ has-binary "0.1.6"
+ wtf-8 "1.0.0"
+
+engine.io@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/engine.io/-/engine.io-1.8.0.tgz#3eeb5f264cb75dbbec1baaea26d61f5a4eace2aa"
+ dependencies:
+ accepts "1.3.3"
+ base64id "0.1.0"
+ cookie "0.3.1"
+ debug "2.3.3"
+ engine.io-parser "1.3.1"
+ ws "1.1.1"
+
error-ex@^1.2.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.0.tgz#e67b43f3e82c96ea3a584ffee0b9fc3325d802d9"
dependencies:
is-arrayish "^0.2.1"
+escape-html@~1.0.3:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
+
escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
@@ -634,6 +937,14 @@ esprima@^2.6.0:
version "2.7.3"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581"
+etag@^1.7.0, etag@~1.7.0:
+ version "1.7.0"
+ resolved "https://registry.yarnpkg.com/etag/-/etag-1.7.0.tgz#03d30b5f67dd6e632d2945d30d6652731a34d5d8"
+
+eventemitter3@1.x.x:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-1.2.0.tgz#1c86991d816ad1e504750e73874224ecf3bec508"
+
exec-buffer@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/exec-buffer/-/exec-buffer-3.1.0.tgz#851b46d062fca9bcbc6ff8781693e28e8da80402"
@@ -687,6 +998,15 @@ expand-tilde@^1.2.1, expand-tilde@^1.2.2:
dependencies:
os-homedir "^1.0.1"
+express@2.5.x:
+ version "2.5.11"
+ resolved "https://registry.yarnpkg.com/express/-/express-2.5.11.tgz#4ce8ea1f3635e69e49f0ebb497b6a4b0a51ce6f0"
+ dependencies:
+ connect "1.x"
+ mime "1.2.4"
+ mkdirp "0.3.0"
+ qs "0.4.x"
+
extend-shallow@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f"
@@ -757,6 +1077,16 @@ fill-range@^2.1.0:
repeat-element "^1.1.2"
repeat-string "^1.5.2"
+finalhandler@0.5.0:
+ version "0.5.0"
+ resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-0.5.0.tgz#e9508abece9b6dba871a6942a1d7911b91911ac7"
+ dependencies:
+ debug "~2.2.0"
+ escape-html "~1.0.3"
+ on-finished "~2.3.0"
+ statuses "~1.3.0"
+ unpipe "~1.0.0"
+
find-index@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/find-index/-/find-index-0.1.1.tgz#675d358b2ca3892d795a1ab47232f8b6e2e0dde4"
@@ -828,15 +1158,46 @@ form-data@~2.1.1:
combined-stream "^1.0.5"
mime-types "^2.1.12"
+formidable@1.0.x:
+ version "1.0.17"
+ resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.0.17.tgz#ef5491490f9433b705faa77249c99029ae348559"
+
+fresh@0.3.0, fresh@^0.3.0:
+ version "0.3.0"
+ resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.3.0.tgz#651f838e22424e7566de161d8358caa199f83d4f"
+
fs-exists-sync@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz#982d6893af918e72d08dec9e8673ff2b5a8d6add"
+fs-extra@1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-1.0.0.tgz#cd3ce5f7e7cb6145883fcae3191e9877f8587950"
+ dependencies:
+ graceful-fs "^4.1.2"
+ jsonfile "^2.1.0"
+ klaw "^1.0.0"
+
fs.realpath@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
-fstream@^1.0.0, fstream@^1.0.2:
+fsevents@^1.0.0:
+ version "1.0.17"
+ resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-1.0.17.tgz#8537f3f12272678765b4fd6528c0f1f66f8f4558"
+ dependencies:
+ nan "^2.3.0"
+ node-pre-gyp "^0.6.29"
+
+fstream-ignore@~1.0.5:
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/fstream-ignore/-/fstream-ignore-1.0.5.tgz#9c31dae34767018fe1d249b24dada67d092da105"
+ dependencies:
+ fstream "^1.0.0"
+ inherits "2"
+ minimatch "^3.0.0"
+
+fstream@^1.0.0, fstream@^1.0.2, fstream@~1.0.10:
version "1.0.10"
resolved "https://registry.yarnpkg.com/fstream/-/fstream-1.0.10.tgz#604e8a92fe26ffd9f6fae30399d4984e1ab22822"
dependencies:
@@ -1085,7 +1446,7 @@ graceful-fs@^3.0.0:
dependencies:
natives "^1.1.0"
-graceful-fs@^4.0.0, graceful-fs@^4.1.2:
+graceful-fs@^4.0.0, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9:
version "4.1.11"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
@@ -1244,6 +1605,22 @@ has-ansi@^2.0.0:
dependencies:
ansi-regex "^2.0.0"
+has-binary@0.1.6:
+ version "0.1.6"
+ resolved "https://registry.yarnpkg.com/has-binary/-/has-binary-0.1.6.tgz#25326f39cfa4f616ad8787894e3af2cfbc7b6e10"
+ dependencies:
+ isarray "0.0.1"
+
+has-binary@0.1.7:
+ version "0.1.7"
+ resolved "https://registry.yarnpkg.com/has-binary/-/has-binary-0.1.7.tgz#68e61eb16210c9545a0a5cce06a873912fe1e68c"
+ dependencies:
+ isarray "0.0.1"
+
+has-cors@1.1.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/has-cors/-/has-cors-1.1.0.tgz#5e474793f7ea9843d1bb99c23eef49ff126fff39"
+
has-gulplog@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/has-gulplog/-/has-gulplog-0.1.0.tgz#6414c82913697da51590397dafb12f22967811ce"
@@ -1281,6 +1658,21 @@ html-comment-regex@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/html-comment-regex/-/html-comment-regex-1.1.1.tgz#668b93776eaae55ebde8f3ad464b307a4963625e"
+http-errors@~1.5.0:
+ version "1.5.1"
+ resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.5.1.tgz#788c0d2c1de2c81b9e6e8c01843b6b97eb920750"
+ dependencies:
+ inherits "2.0.3"
+ setprototypeof "1.0.2"
+ statuses ">= 1.3.1 < 2"
+
+http-proxy@1.15.2:
+ version "1.15.2"
+ resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.15.2.tgz#642fdcaffe52d3448d2bda3b0079e9409064da31"
+ dependencies:
+ eventemitter3 "1.x.x"
+ requires-port "1.x.x"
+
http-signature@~1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.1.1.tgz#df72e267066cd0ac67fb76adf8e134a8fbcf91bf"
@@ -1331,6 +1723,10 @@ imagemin@^5.0.0:
promise.pipe "^3.0.0"
replace-ext "0.0.1"
+immutable@3.8.1, immutable@^3.7.6:
+ version "3.8.1"
+ resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.1.tgz#200807f11ab0f72710ea485542de088075f68cd2"
+
in-publish@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/in-publish/-/in-publish-2.0.0.tgz#e20ff5e3a2afc2690320b6dc552682a9c7fadf51"
@@ -1341,6 +1737,10 @@ indent-string@^2.1.0:
dependencies:
repeating "^2.0.0"
+indexof@0.0.1:
+ version "0.0.1"
+ resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d"
+
inflight@^1.0.4:
version "1.0.6"
resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
@@ -1352,7 +1752,7 @@ inherits@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-1.0.2.tgz#ca4309dadee6b54cc0b8d247e8d7c7a0975bdc9b"
-inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1:
+inherits@2, inherits@2.0.3, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.1:
version "2.0.3"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
@@ -1393,6 +1793,12 @@ is-arrayish@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"
+is-binary-path@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898"
+ dependencies:
+ binary-extensions "^1.0.0"
+
is-buffer@^1.0.2:
version "1.1.4"
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.4.tgz#cfc86ccd5dc5a52fa80489111c6920c457e2d98b"
@@ -1478,6 +1884,13 @@ is-natural-number@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/is-natural-number/-/is-natural-number-2.1.1.tgz#7d4c5728377ef386c3e194a9911bf57c6dc335e7"
+is-number-like@^1.0.3:
+ version "1.0.7"
+ resolved "https://registry.yarnpkg.com/is-number-like/-/is-number-like-1.0.7.tgz#a38d6b0fd2cd4282449128859eed86c03fd23552"
+ dependencies:
+ bubleify "^0.5.1"
+ lodash.isfinite "^3.3.2"
+
is-number@^2.0.2, is-number@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f"
@@ -1627,6 +2040,16 @@ json-stringify-safe@~5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
+json3@3.3.2:
+ version "3.3.2"
+ resolved "https://registry.yarnpkg.com/json3/-/json3-3.3.2.tgz#3c0434743df93e2f5c42aee7b19bcb483575f4e1"
+
+jsonfile@^2.1.0:
+ version "2.4.0"
+ resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8"
+ optionalDependencies:
+ graceful-fs "^4.1.6"
+
jsonify@~0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"
@@ -1649,6 +2072,12 @@ kind-of@^3.0.2:
dependencies:
is-buffer "^1.0.2"
+klaw@^1.0.0:
+ version "1.3.1"
+ resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439"
+ optionalDependencies:
+ graceful-fs "^4.1.9"
+
lazy-cache@^1.0.3:
version "1.0.4"
resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e"
@@ -1683,6 +2112,10 @@ liftoff@^2.1.0:
rechoir "^0.6.2"
resolve "^1.1.7"
+limiter@^1.0.5:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/limiter/-/limiter-1.1.0.tgz#6e2bd12ca3fcdaa11f224e2e53c896df3f08d913"
+
load-json-file@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0"
@@ -1693,6 +2126,15 @@ load-json-file@^1.0.0:
pinkie-promise "^2.0.0"
strip-bom "^2.0.0"
+localtunnel@1.8.2:
+ version "1.8.2"
+ resolved "https://registry.yarnpkg.com/localtunnel/-/localtunnel-1.8.2.tgz#913051e8328b51f75ad8a22ad1f5c5b8c599a359"
+ dependencies:
+ debug "2.2.0"
+ openurl "1.1.0"
+ request "2.78.0"
+ yargs "3.29.0"
+
lodash._basecopy@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz#8da0e6a876cf344c0ad8a54882111dd3c5c7ca36"
@@ -1763,6 +2205,10 @@ lodash.isequal@^4.0.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
+lodash.isfinite@^3.3.2:
+ version "3.3.2"
+ resolved "https://registry.yarnpkg.com/lodash.isfinite/-/lodash.isfinite-3.3.2.tgz#fb89b65a9a80281833f0b7478b3a5104f898ebb3"
+
lodash.isplainobject@^4.0.4:
version "4.0.6"
resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb"
@@ -1816,6 +2262,10 @@ lodash.templatesettings@^3.0.0:
lodash._reinterpolate "^3.0.0"
lodash.escape "^3.0.0"
+lodash@^3.10.1:
+ version "3.10.1"
+ resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6"
+
lodash@^4.0.0, lodash@^4.13.1:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
@@ -1874,6 +2324,12 @@ lru-cache@^4.0.1:
pseudomap "^1.0.1"
yallist "^2.0.0"
+magic-string@^0.14.0:
+ version "0.14.0"
+ resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.14.0.tgz#57224aef1701caeed273b17a39a956e72b172462"
+ dependencies:
+ vlq "^0.2.1"
+
make-error-cause@^1.1.1:
version "1.2.2"
resolved "https://registry.yarnpkg.com/make-error-cause/-/make-error-cause-1.2.2.tgz#df0388fcd0b37816dff0a5fb8108939777dcbc9d"
@@ -1913,7 +2369,7 @@ merge-stream@^1.0.0:
dependencies:
readable-stream "^2.0.1"
-micromatch@^2.3.7:
+micromatch@2.3.11, micromatch@^2.1.5, micromatch@^2.3.7:
version "2.3.11"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565"
dependencies:
@@ -1935,13 +2391,21 @@ mime-db@~1.26.0:
version "1.26.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.26.0.tgz#eaffcd0e4fc6935cf8134da246e2e6c35305adff"
-mime-types@^2.1.12, mime-types@~2.1.7:
+mime-types@^2.1.12, mime-types@~2.1.11, mime-types@~2.1.7:
version "2.1.14"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.14.tgz#f7ef7d97583fcaf3b7d282b6f8b5679dab1e94ee"
dependencies:
mime-db "~1.26.0"
-"minimatch@2 || 3", minimatch@^3.0.2, minimatch@~3.0.2:
+mime@1.2.4:
+ version "1.2.4"
+ resolved "https://registry.yarnpkg.com/mime/-/mime-1.2.4.tgz#11b5fdaf29c2509255176b80ad520294f5de92b7"
+
+mime@1.3.4, "mime@>= 0.0.1":
+ version "1.3.4"
+ resolved "https://registry.yarnpkg.com/mime/-/mime-1.3.4.tgz#115f9e3b6b3daf2959983cb38f149a2d40eb5d53"
+
+"minimatch@2 || 3", minimatch@^3.0.0, minimatch@^3.0.2, minimatch@~3.0.2:
version "3.0.3"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774"
dependencies:
@@ -1968,19 +2432,31 @@ minimist@^1.1.0, minimist@^1.1.3, minimist@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
+mkdirp@0.3.0:
+ version "0.3.0"
+ resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.3.0.tgz#1bbf5ab1ba827af23575143490426455f481fe1e"
+
"mkdirp@>=0.5 0", mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
dependencies:
minimist "0.0.8"
+ms@0.7.1:
+ version "0.7.1"
+ resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.1.tgz#9cd13c03adbff25b65effde7ce864ee952017098"
+
+ms@0.7.2:
+ version "0.7.2"
+ resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765"
+
multipipe@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/multipipe/-/multipipe-0.1.2.tgz#2a8f2ddf70eed564dff2d57f1e1a137d9f05078b"
dependencies:
duplexer2 "0.0.2"
-nan@^2.3.2:
+nan@^2.3.0, nan@^2.3.2:
version "2.5.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.5.0.tgz#aa8f1e34531d807e9e27755b234b4a6ec0c152a8"
@@ -1988,6 +2464,10 @@ natives@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/natives/-/natives-1.1.0.tgz#e9ff841418a6b2ec7a495e939984f78f163e6e31"
+negotiator@0.6.1:
+ version "0.6.1"
+ resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.1.tgz#2b327184e8992101177b28563fb5e7102acd0ca9"
+
node-gyp@^3.3.1:
version "3.5.0"
resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-3.5.0.tgz#a8fe5e611d079ec16348a3eb960e78e11c85274a"
@@ -2006,6 +2486,20 @@ node-gyp@^3.3.1:
tar "^2.0.0"
which "1"
+node-pre-gyp@^0.6.29:
+ version "0.6.32"
+ resolved "https://registry.yarnpkg.com/node-pre-gyp/-/node-pre-gyp-0.6.32.tgz#fc452b376e7319b3d255f5f34853ef6fd8fe1fd5"
+ dependencies:
+ mkdirp "~0.5.1"
+ nopt "~3.0.6"
+ npmlog "^4.0.1"
+ rc "~1.1.6"
+ request "^2.79.0"
+ rimraf "~2.5.4"
+ semver "~5.3.0"
+ tar "~2.2.1"
+ tar-pack "~3.3.0"
+
node-sass@^4.2.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.3.0.tgz#d014f64595d77b26af99e9f7a7e74704d9976bda"
@@ -2033,7 +2527,11 @@ node-status-codes@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/node-status-codes/-/node-status-codes-1.0.0.tgz#5ae5541d024645d32a58fcddc9ceecea7ae3ac2f"
-"nopt@2 || 3":
+node-uuid@~1.4.7:
+ version "1.4.7"
+ resolved "https://registry.yarnpkg.com/node-uuid/-/node-uuid-1.4.7.tgz#6da5a17668c4b3dd59623bda11cf7fa4c1f60a6f"
+
+"nopt@2 || 3", nopt@3.0.x, nopt@~3.0.6:
version "3.0.6"
resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9"
dependencies:
@@ -2058,7 +2556,7 @@ npm-run-path@^2.0.0:
dependencies:
path-key "^2.0.0"
-"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0:
+"npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.0.0, npmlog@^4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.0.2.tgz#d03950e0e78ce1527ba26d2a7592e9348ac3e75f"
dependencies:
@@ -2075,6 +2573,10 @@ oauth-sign@~0.8.1:
version "0.8.2"
resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43"
+object-assign@4.1.0, object-assign@^4.0.0, object-assign@^4.0.1, object-assign@^4.1.0:
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.0.tgz#7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0"
+
object-assign@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-2.1.1.tgz#43c36e5d569ff8e4816c4efa8be02d26967c18aa"
@@ -2083,9 +2585,13 @@ object-assign@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-3.0.0.tgz#9bedd5ca0897949bca47e7ff408062d549f587f2"
-object-assign@^4.0.0, object-assign@^4.0.1, object-assign@^4.1.0:
- version "4.1.0"
- resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.0.tgz#7a3b3d0e98063d43f4c03f2e8ae6cd51a86883a0"
+object-component@0.0.3:
+ version "0.0.3"
+ resolved "https://registry.yarnpkg.com/object-component/-/object-component-0.0.3.tgz#f0c69aa50efc95b866c186f400a33769cb2f1291"
+
+object-path@^0.9.0:
+ version "0.9.2"
+ resolved "https://registry.yarnpkg.com/object-path/-/object-path-0.9.2.tgz#0fd9a74fc5fad1ae3968b586bda5c632bd6c05a5"
object.omit@^2.0.0:
version "2.0.1"
@@ -2094,7 +2600,13 @@ object.omit@^2.0.0:
for-own "^0.1.4"
is-extendable "^0.1.1"
-once@^1.3.0, once@~1.3.0:
+on-finished@~2.3.0:
+ version "2.3.0"
+ resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"
+ dependencies:
+ ee-first "1.1.1"
+
+once@^1.3.0, once@~1.3.0, once@~1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/once/-/once-1.3.3.tgz#b2e261557ce4c314ec8304f3fa82663e4297ca20"
dependencies:
@@ -2104,6 +2616,21 @@ onetime@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/onetime/-/onetime-1.1.0.tgz#a1f7838f8314c516f05ecefcbc4ccfe04b4ed789"
+openurl@1.1.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/openurl/-/openurl-1.1.0.tgz#e2f2189d999c04823201f083f0f1a7cd8903187a"
+
+opn@4.0.2:
+ version "4.0.2"
+ resolved "https://registry.yarnpkg.com/opn/-/opn-4.0.2.tgz#7abc22e644dff63b0a96d5ab7f2790c0f01abc95"
+ dependencies:
+ object-assign "^4.0.1"
+ pinkie-promise "^2.0.0"
+
+options@>=0.0.5:
+ version "0.0.6"
+ resolved "https://registry.yarnpkg.com/options/-/options-0.0.6.tgz#ec22d312806bb53e731773e7cdaefcf1c643128f"
+
optipng-bin@^3.0.0:
version "3.1.2"
resolved "https://registry.yarnpkg.com/optipng-bin/-/optipng-bin-3.1.2.tgz#18c5a3388ed5d6f1e6ef1998ab0a6bcc8bdd0ca0"
@@ -2187,6 +2714,28 @@ parse-passwd@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6"
+parsejson@0.0.3:
+ version "0.0.3"
+ resolved "https://registry.yarnpkg.com/parsejson/-/parsejson-0.0.3.tgz#ab7e3759f209ece99437973f7d0f1f64ae0e64ab"
+ dependencies:
+ better-assert "~1.0.0"
+
+parseqs@0.0.5:
+ version "0.0.5"
+ resolved "https://registry.yarnpkg.com/parseqs/-/parseqs-0.0.5.tgz#d5208a3738e46766e291ba2ea173684921a8b89d"
+ dependencies:
+ better-assert "~1.0.0"
+
+parseuri@0.0.5:
+ version "0.0.5"
+ resolved "https://registry.yarnpkg.com/parseuri/-/parseuri-0.0.5.tgz#80204a50d4dbb779bfdc6ebe2778d90e4bce320a"
+ dependencies:
+ better-assert "~1.0.0"
+
+parseurl@~1.3.1:
+ version "1.3.1"
+ resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.1.tgz#c8ab8c9223ba34888aa64a297b28853bec18da56"
+
path-dirname@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0"
@@ -2247,6 +2796,13 @@ plur@^2.0.0:
dependencies:
irregular-plurals "^1.0.0"
+portscanner@2.1.1:
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/portscanner/-/portscanner-2.1.1.tgz#eabb409e4de24950f5a2a516d35ae769343fbb96"
+ dependencies:
+ async "1.5.2"
+ is-number-like "^1.0.3"
+
prepend-http@^1.0.1:
version "1.0.4"
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"
@@ -2283,7 +2839,15 @@ q@^1.1.2:
version "1.4.1"
resolved "https://registry.yarnpkg.com/q/-/q-1.4.1.tgz#55705bcd93c5f3673530c2c2cbc0c2b3addc286e"
-qs@~6.3.0:
+qs@0.4.x:
+ version "0.4.2"
+ resolved "https://registry.yarnpkg.com/qs/-/qs-0.4.2.tgz#3cac4c861e371a8c9c4770ac23cda8de639b8e5f"
+
+qs@6.2.1:
+ version "6.2.1"
+ resolved "https://registry.yarnpkg.com/qs/-/qs-6.2.1.tgz#ce03c5ff0935bc1d9d69a9f14cbd18e568d67625"
+
+"qs@>= 0.4.0", qs@~6.3.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.3.0.tgz#f403b264f23bc01228c74131b407f18d5ea5d442"
@@ -2294,7 +2858,11 @@ randomatic@^1.1.3:
is-number "^2.0.2"
kind-of "^3.0.2"
-rc@^1.1.2:
+range-parser@~1.2.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e"
+
+rc@^1.1.2, rc@~1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.1.6.tgz#43651b76b6ae53b5c802f1151fa3fc3b059969c9"
dependencies:
@@ -2355,6 +2923,27 @@ readable-stream@~1.1.9:
isarray "0.0.1"
string_decoder "~0.10.x"
+readable-stream@~2.1.4:
+ version "2.1.5"
+ resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.1.5.tgz#66fa8b720e1438b364681f2ad1a63c618448c9d0"
+ dependencies:
+ buffer-shims "^1.0.0"
+ core-util-is "~1.0.0"
+ inherits "~2.0.1"
+ isarray "~1.0.0"
+ process-nextick-args "~1.0.6"
+ string_decoder "~0.10.x"
+ util-deprecate "~1.0.1"
+
+readdirp@^2.0.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-2.1.0.tgz#4ed0ad060df3073300c48440373f72d1cc642d78"
+ dependencies:
+ graceful-fs "^4.1.2"
+ minimatch "^3.0.2"
+ readable-stream "^2.0.2"
+ set-immediate-shim "^1.0.1"
+
rechoir@^0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
@@ -2401,7 +2990,7 @@ replace-ext@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb"
-request@2, request@^2.61.0:
+request@2, request@^2.61.0, request@^2.79.0:
version "2.79.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de"
dependencies:
@@ -2426,6 +3015,31 @@ request@2, request@^2.61.0:
tunnel-agent "~0.4.1"
uuid "^3.0.0"
+request@2.78.0:
+ version "2.78.0"
+ resolved "https://registry.yarnpkg.com/request/-/request-2.78.0.tgz#e1c8dec346e1c81923b24acdb337f11decabe9cc"
+ dependencies:
+ aws-sign2 "~0.6.0"
+ aws4 "^1.2.1"
+ caseless "~0.11.0"
+ combined-stream "~1.0.5"
+ extend "~3.0.0"
+ forever-agent "~0.6.1"
+ form-data "~2.1.1"
+ har-validator "~2.0.6"
+ hawk "~3.1.3"
+ http-signature "~1.1.0"
+ is-typedarray "~1.0.0"
+ isstream "~0.1.2"
+ json-stringify-safe "~5.0.1"
+ mime-types "~2.1.7"
+ node-uuid "~1.4.7"
+ oauth-sign "~0.8.1"
+ qs "~6.3.0"
+ stringstream "~0.0.4"
+ tough-cookie "~2.3.0"
+ tunnel-agent "~0.4.1"
+
require-directory@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
@@ -2434,6 +3048,10 @@ require-main-filename@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1"
+requires-port@1.x.x:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
+
resolve-dir@^0.1.0:
version "0.1.1"
resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-0.1.1.tgz#b219259a5602fac5c5c496ad894a6e8cc430261e"
@@ -2445,18 +3063,29 @@ resolve@^1.1.6, resolve@^1.1.7:
version "1.2.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c"
+resp-modifier@6.0.2:
+ version "6.0.2"
+ resolved "https://registry.yarnpkg.com/resp-modifier/-/resp-modifier-6.0.2.tgz#b124de5c4fbafcba541f48ffa73970f4aa456b4f"
+ dependencies:
+ debug "^2.2.0"
+ minimatch "^3.0.2"
+
right-align@^0.1.1:
version "0.1.3"
resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef"
dependencies:
align-text "^0.1.1"
-rimraf@2, rimraf@^2.2.6, rimraf@^2.5.4:
+rimraf@2, rimraf@^2.2.6, rimraf@^2.5.4, rimraf@~2.5.1, rimraf@~2.5.4:
version "2.5.4"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04"
dependencies:
glob "^7.0.5"
+rx@4.1.0:
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/rx/-/rx-4.1.0.tgz#a5f13ff79ef3b740fe30aa803fb09f98805d4782"
+
sass-graph@^2.1.1:
version "2.1.2"
resolved "https://registry.yarnpkg.com/sass-graph/-/sass-graph-2.1.2.tgz#965104be23e8103cb7e5f710df65935b317da57b"
@@ -2489,22 +3118,69 @@ semver-truncate@^1.0.0:
version "4.3.6"
resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.6.tgz#300bc6e0e86374f7ba61068b5b1ecd57fc6532da"
-semver@^5.3.0:
+semver@^5.3.0, semver@~5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f"
+send@0.14.1:
+ version "0.14.1"
+ resolved "https://registry.yarnpkg.com/send/-/send-0.14.1.tgz#a954984325392f51532a7760760e459598c89f7a"
+ dependencies:
+ debug "~2.2.0"
+ depd "~1.1.0"
+ destroy "~1.0.4"
+ encodeurl "~1.0.1"
+ escape-html "~1.0.3"
+ etag "~1.7.0"
+ fresh "0.3.0"
+ http-errors "~1.5.0"
+ mime "1.3.4"
+ ms "0.7.1"
+ on-finished "~2.3.0"
+ range-parser "~1.2.0"
+ statuses "~1.3.0"
+
sequencify@~0.0.7:
version "0.0.7"
resolved "https://registry.yarnpkg.com/sequencify/-/sequencify-0.0.7.tgz#90cff19d02e07027fd767f5ead3e7b95d1e7380c"
+serve-index@1.8.0:
+ version "1.8.0"
+ resolved "https://registry.yarnpkg.com/serve-index/-/serve-index-1.8.0.tgz#7c5d96c13fb131101f93c1c5774f8516a1e78d3b"
+ dependencies:
+ accepts "~1.3.3"
+ batch "0.5.3"
+ debug "~2.2.0"
+ escape-html "~1.0.3"
+ http-errors "~1.5.0"
+ mime-types "~2.1.11"
+ parseurl "~1.3.1"
+
+serve-static@1.11.1:
+ version "1.11.1"
+ resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.11.1.tgz#d6cce7693505f733c759de57befc1af76c0f0805"
+ dependencies:
+ encodeurl "~1.0.1"
+ escape-html "~1.0.3"
+ parseurl "~1.3.1"
+ send "0.14.1"
+
+server-destroy@1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/server-destroy/-/server-destroy-1.0.1.tgz#f13bf928e42b9c3e79383e61cc3998b5d14e6cdd"
+
set-blocking@^2.0.0, set-blocking@~2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7"
-set-immediate-shim@^1.0.0:
+set-immediate-shim@^1.0.0, set-immediate-shim@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61"
+setprototypeof@1.0.2:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.0.2.tgz#81a552141ec104b88e89ce383103ad5c66564d08"
+
sigmund@~1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590"
@@ -2519,6 +3195,50 @@ sntp@1.x.x:
dependencies:
hoek "2.x.x"
+socket.io-adapter@0.5.0:
+ version "0.5.0"
+ resolved "https://registry.yarnpkg.com/socket.io-adapter/-/socket.io-adapter-0.5.0.tgz#cb6d4bb8bec81e1078b99677f9ced0046066bb8b"
+ dependencies:
+ debug "2.3.3"
+ socket.io-parser "2.3.1"
+
+socket.io-client@1.6.0:
+ version "1.6.0"
+ resolved "https://registry.yarnpkg.com/socket.io-client/-/socket.io-client-1.6.0.tgz#5b668f4f771304dfeed179064708386fa6717853"
+ dependencies:
+ backo2 "1.0.2"
+ component-bind "1.0.0"
+ component-emitter "1.2.1"
+ debug "2.3.3"
+ engine.io-client "1.8.0"
+ has-binary "0.1.7"
+ indexof "0.0.1"
+ object-component "0.0.3"
+ parseuri "0.0.5"
+ socket.io-parser "2.3.1"
+ to-array "0.1.4"
+
+socket.io-parser@2.3.1:
+ version "2.3.1"
+ resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-2.3.1.tgz#dd532025103ce429697326befd64005fcfe5b4a0"
+ dependencies:
+ component-emitter "1.1.2"
+ debug "2.2.0"
+ isarray "0.0.1"
+ json3 "3.3.2"
+
+socket.io@1.6.0:
+ version "1.6.0"
+ resolved "https://registry.yarnpkg.com/socket.io/-/socket.io-1.6.0.tgz#3e40d932637e6bd923981b25caf7c53e83b6e2e1"
+ dependencies:
+ debug "2.3.3"
+ engine.io "1.8.0"
+ has-binary "0.1.7"
+ object-assign "4.1.0"
+ socket.io-adapter "0.5.0"
+ socket.io-client "1.6.0"
+ socket.io-parser "2.3.1"
+
source-map@^0.5.1, source-map@^0.5.3, source-map@~0.5.1:
version "0.5.6"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412"
@@ -2572,6 +3292,10 @@ stat-mode@^0.2.0:
version "0.2.2"
resolved "https://registry.yarnpkg.com/stat-mode/-/stat-mode-0.2.2.tgz#e6c80b623123d7d80cf132ce538f346289072502"
+"statuses@>= 1.3.1 < 2", statuses@~1.3.0:
+ version "1.3.1"
+ resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e"
+
stdout-stream@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/stdout-stream/-/stdout-stream-1.4.0.tgz#a2c7c8587e54d9427ea9edb3ac3f2cd522df378b"
@@ -2593,7 +3317,14 @@ stream-shift@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952"
-string-width@^1.0.1:
+stream-throttle@^0.1.3:
+ version "0.1.3"
+ resolved "https://registry.yarnpkg.com/stream-throttle/-/stream-throttle-0.1.3.tgz#add57c8d7cc73a81630d31cd55d3961cfafba9c3"
+ dependencies:
+ commander "^2.2.0"
+ limiter "^1.0.5"
+
+string-width@^1.0.1, string-width@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
dependencies:
@@ -2692,6 +3423,19 @@ svgo@^0.7.0:
sax "~1.2.1"
whet.extend "~0.9.9"
+tar-pack@~3.3.0:
+ version "3.3.0"
+ resolved "https://registry.yarnpkg.com/tar-pack/-/tar-pack-3.3.0.tgz#30931816418f55afc4d21775afdd6720cee45dae"
+ dependencies:
+ debug "~2.2.0"
+ fstream "~1.0.10"
+ fstream-ignore "~1.0.5"
+ once "~1.3.3"
+ readable-stream "~2.1.4"
+ rimraf "~2.5.1"
+ tar "~2.2.1"
+ uid-number "~0.0.6"
+
tar-stream@^1.1.1:
version "1.5.2"
resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-1.5.2.tgz#fbc6c6e83c1a19d4cb48c7d96171fc248effc7bf"
@@ -2701,7 +3445,7 @@ tar-stream@^1.1.1:
readable-stream "^2.0.0"
xtend "^4.0.0"
-tar@^2.0.0:
+tar@^2.0.0, tar@~2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/tar/-/tar-2.2.1.tgz#8e4d2a256c0e2185c6b18ad694aec968b83cb1d1"
dependencies:
@@ -2716,6 +3460,13 @@ tempfile@^1.0.0:
os-tmpdir "^1.0.0"
uuid "^2.0.1"
+tfunk@^3.0.1:
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/tfunk/-/tfunk-3.1.0.tgz#38e4414fc64977d87afdaa72facb6d29f82f7b5b"
+ dependencies:
+ chalk "^1.1.1"
+ object-path "^0.9.0"
+
through2-concurrent@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/through2-concurrent/-/through2-concurrent-1.1.1.tgz#11cb4ea4c9e31bca6e4c1e6dba48d1c728c3524b"
@@ -2763,6 +3514,10 @@ to-absolute-glob@^0.1.1:
dependencies:
extend-shallow "^2.0.1"
+to-array@0.1.4:
+ version "0.1.4"
+ resolved "https://registry.yarnpkg.com/to-array/-/to-array-0.1.4.tgz#17e6c11f73dd4f3d74cda7a4ff3238e9ad9bf890"
+
tough-cookie@~2.3.0:
version "2.3.2"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.2.tgz#f081f76e4c85720e6c37a5faced737150d84072a"
@@ -2791,6 +3546,10 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
+ua-parser-js@0.7.12:
+ version "0.7.12"
+ resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.12.tgz#04c81a99bdd5dc52263ea29d24c6bf8d4818a4bb"
+
uglify-js@2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.7.0.tgz#f021e38ba2ca740860f5bd5c695c2a817345f0ec"
@@ -2808,10 +3567,22 @@ uglify-to-browserify@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"
+uid-number@~0.0.6:
+ version "0.0.6"
+ resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81"
+
+ultron@1.0.x:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.0.2.tgz#ace116ab557cd197386a4e88f4685378c8b2e4fa"
+
unc-path-regex@^0.1.0:
version "0.1.2"
resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa"
+underscore@1.7.x:
+ version "1.7.0"
+ resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.7.0.tgz#6bbaf0877500d36be34ecaa584e0db9fef035209"
+
unique-stream@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/unique-stream/-/unique-stream-1.0.0.tgz#d59a4a75427447d9aa6c91e70263f8d26a4b104b"
@@ -2823,6 +3594,10 @@ unique-stream@^2.0.2:
json-stable-stringify "^1.0.0"
through2-filter "^2.0.0"
+unpipe@~1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
+
unzip-response@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/unzip-response/-/unzip-response-1.0.2.tgz#b984f0877fc0a89c2c773cc1ef7b5b232b5b06fe"
@@ -2847,6 +3622,10 @@ util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
+utils-merge@1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.0.tgz#0294fb922bb9375153541c4f7096231f287c8af8"
+
uuid@^2.0.1:
version "2.0.3"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a"
@@ -2961,12 +3740,24 @@ vinyl@^2.0.0:
remove-trailing-separator "^1.0.1"
replace-ext "^1.0.0"
+vlq@^0.2.1:
+ version "0.2.1"
+ resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.1.tgz#14439d711891e682535467f8587c5630e4222a6c"
+
ware@^1.2.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/ware/-/ware-1.3.0.tgz#d1b14f39d2e2cb4ab8c4098f756fe4b164e473d4"
dependencies:
wrap-fn "^0.1.0"
+weinre@^2.0.0-pre-I0Z7U9OV:
+ version "2.0.0-pre-I0Z7U9OV"
+ resolved "https://registry.yarnpkg.com/weinre/-/weinre-2.0.0-pre-I0Z7U9OV.tgz#fef8aa223921f7b40bbbbd4c3ed4302f6fd0a813"
+ dependencies:
+ express "2.5.x"
+ nopt "3.0.x"
+ underscore "1.7.x"
+
whet.extend@~0.9.9:
version "0.9.9"
resolved "https://registry.yarnpkg.com/whet.extend/-/whet.extend-0.9.9.tgz#f877d5bf648c97e5aa542fadc16d6a259b9c11a1"
@@ -2991,6 +3782,10 @@ window-size@0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"
+window-size@^0.1.2:
+ version "0.1.4"
+ resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.4.tgz#f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876"
+
window-size@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.2.0.tgz#b4315bb4214a3d7058ebeee892e13fa24d98b075"
@@ -3016,11 +3811,26 @@ wrappy@1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
+ws@1.1.1:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/ws/-/ws-1.1.1.tgz#082ddb6c641e85d4bb451f03d52f06eabdb1f018"
+ dependencies:
+ options ">=0.0.5"
+ ultron "1.0.x"
+
+wtf-8@1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/wtf-8/-/wtf-8-1.0.0.tgz#392d8ba2d0f1c34d1ee2d630f15d0efb68e1048a"
+
+xmlhttprequest-ssl@1.5.3:
+ version "1.5.3"
+ resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.3.tgz#185a888c04eca46c3e4070d99f7b49de3528992d"
+
"xtend@>=4.0.0 <4.1.0-0", xtend@^4.0.0, xtend@~4.0.0, xtend@~4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"
-y18n@^3.2.1:
+y18n@^3.2.0, y18n@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"
@@ -3035,6 +3845,42 @@ yargs-parser@^2.4.1:
camelcase "^3.0.0"
lodash.assign "^4.0.6"
+yargs-parser@^4.1.0:
+ version "4.2.1"
+ resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-4.2.1.tgz#29cceac0dc4f03c6c87b4a9f217dd18c9f74871c"
+ dependencies:
+ camelcase "^3.0.0"
+
+yargs@3.29.0:
+ version "3.29.0"
+ resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.29.0.tgz#1aab9660eae79d8b8f675bcaeeab6ee34c2cf69c"
+ dependencies:
+ camelcase "^1.2.1"
+ cliui "^3.0.3"
+ decamelize "^1.0.0"
+ os-locale "^1.4.0"
+ window-size "^0.1.2"
+ y18n "^3.2.0"
+
+yargs@6.4.0:
+ version "6.4.0"
+ resolved "https://registry.yarnpkg.com/yargs/-/yargs-6.4.0.tgz#816e1a866d5598ccf34e5596ddce22d92da490d4"
+ dependencies:
+ camelcase "^3.0.0"
+ cliui "^3.2.0"
+ decamelize "^1.1.1"
+ get-caller-file "^1.0.1"
+ os-locale "^1.4.0"
+ read-pkg-up "^1.0.1"
+ require-directory "^2.1.1"
+ require-main-filename "^1.0.1"
+ set-blocking "^2.0.0"
+ string-width "^1.0.2"
+ which-module "^1.0.0"
+ window-size "^0.2.0"
+ y18n "^3.2.1"
+ yargs-parser "^4.1.0"
+
yargs@^4.7.1:
version "4.8.1"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-4.8.1.tgz#c0c42924ca4aaa6b0e6da1739dfb216439f9ddc0"
@@ -3069,3 +3915,7 @@ yauzl@^2.2.1:
dependencies:
buffer-crc32 "~0.2.3"
fd-slicer "~1.0.1"
+
+yeast@0.1.2:
+ version "0.1.2"
+ resolved "https://registry.yarnpkg.com/yeast/-/yeast-0.1.2.tgz#008e06d8094320c372dbc2f8ed76a0ca6c8ac419"