initial commit.
This commit is contained in:
1
node_modules/.bin/csvtojson
generated
vendored
Symbolic link
1
node_modules/.bin/csvtojson
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../csvtojson/bin/csvtojson
|
||||
1
node_modules/.bin/json2csv
generated
vendored
Symbolic link
1
node_modules/.bin/json2csv
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../json2csv/bin/json2csv.js
|
||||
88
node_modules/.package-lock.json
generated
vendored
Normal file
88
node_modules/.package-lock.json
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
{
|
||||
"name": "costar-data-ingest",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/bluebird": {
|
||||
"version": "3.7.2",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
|
||||
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg=="
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "6.2.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz",
|
||||
"integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==",
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/csvtojson": {
|
||||
"version": "2.0.10",
|
||||
"resolved": "https://registry.npmjs.org/csvtojson/-/csvtojson-2.0.10.tgz",
|
||||
"integrity": "sha512-lUWFxGKyhraKCW8Qghz6Z0f2l/PqB1W3AO0HKJzGIQ5JRSlR651ekJDiGJbBT4sRNNv5ddnSGVEnsxP9XRCVpQ==",
|
||||
"dependencies": {
|
||||
"bluebird": "^3.5.1",
|
||||
"lodash": "^4.17.3",
|
||||
"strip-bom": "^2.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"csvtojson": "bin/csvtojson"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/is-utf8": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
|
||||
"integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q=="
|
||||
},
|
||||
"node_modules/json2csv": {
|
||||
"version": "5.0.7",
|
||||
"resolved": "https://registry.npmjs.org/json2csv/-/json2csv-5.0.7.tgz",
|
||||
"integrity": "sha512-YRZbUnyaJZLZUJSRi2G/MqahCyRv9n/ds+4oIetjDF3jWQA7AG7iSeKTiZiCNqtMZM7HDyt0e/W6lEnoGEmMGA==",
|
||||
"dependencies": {
|
||||
"commander": "^6.1.0",
|
||||
"jsonparse": "^1.3.1",
|
||||
"lodash.get": "^4.4.2"
|
||||
},
|
||||
"bin": {
|
||||
"json2csv": "bin/json2csv.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10",
|
||||
"npm": ">= 6.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/jsonparse": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz",
|
||||
"integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==",
|
||||
"engines": [
|
||||
"node >= 0.2.0"
|
||||
]
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
||||
},
|
||||
"node_modules/lodash.get": {
|
||||
"version": "4.4.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
||||
"integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ=="
|
||||
},
|
||||
"node_modules/strip-bom": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
|
||||
"integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
|
||||
"dependencies": {
|
||||
"is-utf8": "^0.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
node_modules/bluebird/LICENSE
generated
vendored
Normal file
21
node_modules/bluebird/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2018 Petka Antonov
|
||||
|
||||
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.
|
||||
57
node_modules/bluebird/README.md
generated
vendored
Normal file
57
node_modules/bluebird/README.md
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<a href="http://promisesaplus.com/">
|
||||
<img src="http://promisesaplus.com/assets/logo-small.png" alt="Promises/A+ logo"
|
||||
title="Promises/A+ 1.1 compliant" align="right" />
|
||||
</a>
|
||||
|
||||
|
||||
[](https://travis-ci.org/petkaantonov/bluebird)
|
||||
[](http://petkaantonov.github.io/bluebird/coverage/debug/index.html)
|
||||
|
||||
**Got a question?** Join us on [stackoverflow](http://stackoverflow.com/questions/tagged/bluebird), the [mailing list](https://groups.google.com/forum/#!forum/bluebird-js) or chat on [IRC](https://webchat.freenode.net/?channels=#promises)
|
||||
|
||||
# Introduction
|
||||
|
||||
Bluebird is a fully featured promise library with focus on innovative features and performance
|
||||
|
||||
See the [**bluebird website**](http://bluebirdjs.com/docs/getting-started.html) for further documentation, references and instructions. See the [**API reference**](http://bluebirdjs.com/docs/api-reference.html) here.
|
||||
|
||||
For bluebird 2.x documentation and files, see the [2.x tree](https://github.com/petkaantonov/bluebird/tree/2.x).
|
||||
|
||||
### Note
|
||||
|
||||
Promises in Node.js 10 are significantly faster than before. Bluebird still includes a lot of features like cancellation, iteration methods and warnings that native promises don't. If you are using Bluebird for performance rather than for those - please consider giving native promises a shot and running the benchmarks yourself.
|
||||
|
||||
# Questions and issues
|
||||
|
||||
The [github issue tracker](https://github.com/petkaantonov/bluebird/issues) is **_only_** for bug reports and feature requests. Anything else, such as questions for help in using the library, should be posted in [StackOverflow](http://stackoverflow.com/questions/tagged/bluebird) under tags `promise` and `bluebird`.
|
||||
|
||||
|
||||
|
||||
## Thanks
|
||||
|
||||
Thanks to BrowserStack for providing us with a free account which lets us support old browsers like IE8.
|
||||
|
||||
# License
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2019 Petka Antonov
|
||||
|
||||
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.
|
||||
|
||||
1
node_modules/bluebird/changelog.md
generated
vendored
Normal file
1
node_modules/bluebird/changelog.md
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[http://bluebirdjs.com/docs/changelog.html](http://bluebirdjs.com/docs/changelog.html)
|
||||
3914
node_modules/bluebird/js/browser/bluebird.core.js
generated
vendored
Normal file
3914
node_modules/bluebird/js/browser/bluebird.core.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
31
node_modules/bluebird/js/browser/bluebird.core.min.js
generated
vendored
Normal file
31
node_modules/bluebird/js/browser/bluebird.core.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5778
node_modules/bluebird/js/browser/bluebird.js
generated
vendored
Normal file
5778
node_modules/bluebird/js/browser/bluebird.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
31
node_modules/bluebird/js/browser/bluebird.min.js
generated
vendored
Normal file
31
node_modules/bluebird/js/browser/bluebird.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
21
node_modules/bluebird/js/release/any.js
generated
vendored
Normal file
21
node_modules/bluebird/js/release/any.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise) {
|
||||
var SomePromiseArray = Promise._SomePromiseArray;
|
||||
function any(promises) {
|
||||
var ret = new SomePromiseArray(promises);
|
||||
var promise = ret.promise();
|
||||
ret.setHowMany(1);
|
||||
ret.setUnwrap();
|
||||
ret.init();
|
||||
return promise;
|
||||
}
|
||||
|
||||
Promise.any = function (promises) {
|
||||
return any(promises);
|
||||
};
|
||||
|
||||
Promise.prototype.any = function () {
|
||||
return any(this);
|
||||
};
|
||||
|
||||
};
|
||||
55
node_modules/bluebird/js/release/assert.js
generated
vendored
Normal file
55
node_modules/bluebird/js/release/assert.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
module.exports = (function(){
|
||||
var AssertionError = (function() {
|
||||
function AssertionError(a) {
|
||||
this.constructor$(a);
|
||||
this.message = a;
|
||||
this.name = "AssertionError";
|
||||
}
|
||||
AssertionError.prototype = new Error();
|
||||
AssertionError.prototype.constructor = AssertionError;
|
||||
AssertionError.prototype.constructor$ = Error;
|
||||
return AssertionError;
|
||||
})();
|
||||
|
||||
function getParams(args) {
|
||||
var params = [];
|
||||
for (var i = 0; i < args.length; ++i) params.push("arg" + i);
|
||||
return params;
|
||||
}
|
||||
|
||||
function nativeAssert(callName, args, expect) {
|
||||
try {
|
||||
var params = getParams(args);
|
||||
var constructorArgs = params;
|
||||
constructorArgs.push("return " +
|
||||
callName + "("+ params.join(",") + ");");
|
||||
var fn = Function.apply(null, constructorArgs);
|
||||
return fn.apply(null, args);
|
||||
} catch (e) {
|
||||
if (!(e instanceof SyntaxError)) {
|
||||
throw e;
|
||||
} else {
|
||||
return expect;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return function assert(boolExpr, message) {
|
||||
if (boolExpr === true) return;
|
||||
|
||||
if (typeof boolExpr === "string" &&
|
||||
boolExpr.charAt(0) === "%") {
|
||||
var nativeCallName = boolExpr;
|
||||
var $_len = arguments.length;var args = new Array(Math.max($_len - 2, 0)); for(var $_i = 2; $_i < $_len; ++$_i) {args[$_i - 2] = arguments[$_i];};
|
||||
if (nativeAssert(nativeCallName, args, message) === message) return;
|
||||
message = (nativeCallName + " !== " + message);
|
||||
}
|
||||
|
||||
var ret = new AssertionError(message);
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(ret, assert);
|
||||
}
|
||||
throw ret;
|
||||
};
|
||||
})();
|
||||
120
node_modules/bluebird/js/release/async.js
generated
vendored
Normal file
120
node_modules/bluebird/js/release/async.js
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
"use strict";
|
||||
var firstLineError;
|
||||
try {throw new Error(); } catch (e) {firstLineError = e;}
|
||||
var schedule = require("./schedule");
|
||||
var Queue = require("./queue");
|
||||
|
||||
function Async() {
|
||||
this._customScheduler = false;
|
||||
this._isTickUsed = false;
|
||||
this._lateQueue = new Queue(16);
|
||||
this._normalQueue = new Queue(16);
|
||||
this._haveDrainedQueues = false;
|
||||
var self = this;
|
||||
this.drainQueues = function () {
|
||||
self._drainQueues();
|
||||
};
|
||||
this._schedule = schedule;
|
||||
}
|
||||
|
||||
Async.prototype.setScheduler = function(fn) {
|
||||
var prev = this._schedule;
|
||||
this._schedule = fn;
|
||||
this._customScheduler = true;
|
||||
return prev;
|
||||
};
|
||||
|
||||
Async.prototype.hasCustomScheduler = function() {
|
||||
return this._customScheduler;
|
||||
};
|
||||
|
||||
Async.prototype.haveItemsQueued = function () {
|
||||
return this._isTickUsed || this._haveDrainedQueues;
|
||||
};
|
||||
|
||||
|
||||
Async.prototype.fatalError = function(e, isNode) {
|
||||
if (isNode) {
|
||||
process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) +
|
||||
"\n");
|
||||
process.exit(2);
|
||||
} else {
|
||||
this.throwLater(e);
|
||||
}
|
||||
};
|
||||
|
||||
Async.prototype.throwLater = function(fn, arg) {
|
||||
if (arguments.length === 1) {
|
||||
arg = fn;
|
||||
fn = function () { throw arg; };
|
||||
}
|
||||
if (typeof setTimeout !== "undefined") {
|
||||
setTimeout(function() {
|
||||
fn(arg);
|
||||
}, 0);
|
||||
} else try {
|
||||
this._schedule(function() {
|
||||
fn(arg);
|
||||
});
|
||||
} catch (e) {
|
||||
throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||
}
|
||||
};
|
||||
|
||||
function AsyncInvokeLater(fn, receiver, arg) {
|
||||
this._lateQueue.push(fn, receiver, arg);
|
||||
this._queueTick();
|
||||
}
|
||||
|
||||
function AsyncInvoke(fn, receiver, arg) {
|
||||
this._normalQueue.push(fn, receiver, arg);
|
||||
this._queueTick();
|
||||
}
|
||||
|
||||
function AsyncSettlePromises(promise) {
|
||||
this._normalQueue._pushOne(promise);
|
||||
this._queueTick();
|
||||
}
|
||||
|
||||
Async.prototype.invokeLater = AsyncInvokeLater;
|
||||
Async.prototype.invoke = AsyncInvoke;
|
||||
Async.prototype.settlePromises = AsyncSettlePromises;
|
||||
|
||||
|
||||
function _drainQueue(queue) {
|
||||
while (queue.length() > 0) {
|
||||
_drainQueueStep(queue);
|
||||
}
|
||||
}
|
||||
|
||||
function _drainQueueStep(queue) {
|
||||
var fn = queue.shift();
|
||||
if (typeof fn !== "function") {
|
||||
fn._settlePromises();
|
||||
} else {
|
||||
var receiver = queue.shift();
|
||||
var arg = queue.shift();
|
||||
fn.call(receiver, arg);
|
||||
}
|
||||
}
|
||||
|
||||
Async.prototype._drainQueues = function () {
|
||||
_drainQueue(this._normalQueue);
|
||||
this._reset();
|
||||
this._haveDrainedQueues = true;
|
||||
_drainQueue(this._lateQueue);
|
||||
};
|
||||
|
||||
Async.prototype._queueTick = function () {
|
||||
if (!this._isTickUsed) {
|
||||
this._isTickUsed = true;
|
||||
this._schedule(this.drainQueues);
|
||||
}
|
||||
};
|
||||
|
||||
Async.prototype._reset = function () {
|
||||
this._isTickUsed = false;
|
||||
};
|
||||
|
||||
module.exports = Async;
|
||||
module.exports.firstLineError = firstLineError;
|
||||
67
node_modules/bluebird/js/release/bind.js
generated
vendored
Normal file
67
node_modules/bluebird/js/release/bind.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {
|
||||
var calledBind = false;
|
||||
var rejectThis = function(_, e) {
|
||||
this._reject(e);
|
||||
};
|
||||
|
||||
var targetRejected = function(e, context) {
|
||||
context.promiseRejectionQueued = true;
|
||||
context.bindingPromise._then(rejectThis, rejectThis, null, this, e);
|
||||
};
|
||||
|
||||
var bindingResolved = function(thisArg, context) {
|
||||
if (((this._bitField & 50397184) === 0)) {
|
||||
this._resolveCallback(context.target);
|
||||
}
|
||||
};
|
||||
|
||||
var bindingRejected = function(e, context) {
|
||||
if (!context.promiseRejectionQueued) this._reject(e);
|
||||
};
|
||||
|
||||
Promise.prototype.bind = function (thisArg) {
|
||||
if (!calledBind) {
|
||||
calledBind = true;
|
||||
Promise.prototype._propagateFrom = debug.propagateFromFunction();
|
||||
Promise.prototype._boundValue = debug.boundValueFunction();
|
||||
}
|
||||
var maybePromise = tryConvertToPromise(thisArg);
|
||||
var ret = new Promise(INTERNAL);
|
||||
ret._propagateFrom(this, 1);
|
||||
var target = this._target();
|
||||
ret._setBoundTo(maybePromise);
|
||||
if (maybePromise instanceof Promise) {
|
||||
var context = {
|
||||
promiseRejectionQueued: false,
|
||||
promise: ret,
|
||||
target: target,
|
||||
bindingPromise: maybePromise
|
||||
};
|
||||
target._then(INTERNAL, targetRejected, undefined, ret, context);
|
||||
maybePromise._then(
|
||||
bindingResolved, bindingRejected, undefined, ret, context);
|
||||
ret._setOnCancel(maybePromise);
|
||||
} else {
|
||||
ret._resolveCallback(target);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
Promise.prototype._setBoundTo = function (obj) {
|
||||
if (obj !== undefined) {
|
||||
this._bitField = this._bitField | 2097152;
|
||||
this._boundTo = obj;
|
||||
} else {
|
||||
this._bitField = this._bitField & (~2097152);
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._isBound = function () {
|
||||
return (this._bitField & 2097152) === 2097152;
|
||||
};
|
||||
|
||||
Promise.bind = function (thisArg, value) {
|
||||
return Promise.resolve(value).bind(thisArg);
|
||||
};
|
||||
};
|
||||
11
node_modules/bluebird/js/release/bluebird.js
generated
vendored
Normal file
11
node_modules/bluebird/js/release/bluebird.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
var old;
|
||||
if (typeof Promise !== "undefined") old = Promise;
|
||||
function noConflict() {
|
||||
try { if (Promise === bluebird) Promise = old; }
|
||||
catch (e) {}
|
||||
return bluebird;
|
||||
}
|
||||
var bluebird = require("./promise")();
|
||||
bluebird.noConflict = noConflict;
|
||||
module.exports = bluebird;
|
||||
123
node_modules/bluebird/js/release/call_get.js
generated
vendored
Normal file
123
node_modules/bluebird/js/release/call_get.js
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
"use strict";
|
||||
var cr = Object.create;
|
||||
if (cr) {
|
||||
var callerCache = cr(null);
|
||||
var getterCache = cr(null);
|
||||
callerCache[" size"] = getterCache[" size"] = 0;
|
||||
}
|
||||
|
||||
module.exports = function(Promise) {
|
||||
var util = require("./util");
|
||||
var canEvaluate = util.canEvaluate;
|
||||
var isIdentifier = util.isIdentifier;
|
||||
|
||||
var getMethodCaller;
|
||||
var getGetter;
|
||||
if (!false) {
|
||||
var makeMethodCaller = function (methodName) {
|
||||
return new Function("ensureMethod", " \n\
|
||||
return function(obj) { \n\
|
||||
'use strict' \n\
|
||||
var len = this.length; \n\
|
||||
ensureMethod(obj, 'methodName'); \n\
|
||||
switch(len) { \n\
|
||||
case 1: return obj.methodName(this[0]); \n\
|
||||
case 2: return obj.methodName(this[0], this[1]); \n\
|
||||
case 3: return obj.methodName(this[0], this[1], this[2]); \n\
|
||||
case 0: return obj.methodName(); \n\
|
||||
default: \n\
|
||||
return obj.methodName.apply(obj, this); \n\
|
||||
} \n\
|
||||
}; \n\
|
||||
".replace(/methodName/g, methodName))(ensureMethod);
|
||||
};
|
||||
|
||||
var makeGetter = function (propertyName) {
|
||||
return new Function("obj", " \n\
|
||||
'use strict'; \n\
|
||||
return obj.propertyName; \n\
|
||||
".replace("propertyName", propertyName));
|
||||
};
|
||||
|
||||
var getCompiled = function(name, compiler, cache) {
|
||||
var ret = cache[name];
|
||||
if (typeof ret !== "function") {
|
||||
if (!isIdentifier(name)) {
|
||||
return null;
|
||||
}
|
||||
ret = compiler(name);
|
||||
cache[name] = ret;
|
||||
cache[" size"]++;
|
||||
if (cache[" size"] > 512) {
|
||||
var keys = Object.keys(cache);
|
||||
for (var i = 0; i < 256; ++i) delete cache[keys[i]];
|
||||
cache[" size"] = keys.length - 256;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
getMethodCaller = function(name) {
|
||||
return getCompiled(name, makeMethodCaller, callerCache);
|
||||
};
|
||||
|
||||
getGetter = function(name) {
|
||||
return getCompiled(name, makeGetter, getterCache);
|
||||
};
|
||||
}
|
||||
|
||||
function ensureMethod(obj, methodName) {
|
||||
var fn;
|
||||
if (obj != null) fn = obj[methodName];
|
||||
if (typeof fn !== "function") {
|
||||
var message = "Object " + util.classString(obj) + " has no method '" +
|
||||
util.toString(methodName) + "'";
|
||||
throw new Promise.TypeError(message);
|
||||
}
|
||||
return fn;
|
||||
}
|
||||
|
||||
function caller(obj) {
|
||||
var methodName = this.pop();
|
||||
var fn = ensureMethod(obj, methodName);
|
||||
return fn.apply(obj, this);
|
||||
}
|
||||
Promise.prototype.call = function (methodName) {
|
||||
var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];};
|
||||
if (!false) {
|
||||
if (canEvaluate) {
|
||||
var maybeCaller = getMethodCaller(methodName);
|
||||
if (maybeCaller !== null) {
|
||||
return this._then(
|
||||
maybeCaller, undefined, undefined, args, undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
args.push(methodName);
|
||||
return this._then(caller, undefined, undefined, args, undefined);
|
||||
};
|
||||
|
||||
function namedGetter(obj) {
|
||||
return obj[this];
|
||||
}
|
||||
function indexedGetter(obj) {
|
||||
var index = +this;
|
||||
if (index < 0) index = Math.max(0, index + obj.length);
|
||||
return obj[index];
|
||||
}
|
||||
Promise.prototype.get = function (propertyName) {
|
||||
var isIndex = (typeof propertyName === "number");
|
||||
var getter;
|
||||
if (!isIndex) {
|
||||
if (canEvaluate) {
|
||||
var maybeGetter = getGetter(propertyName);
|
||||
getter = maybeGetter !== null ? maybeGetter : namedGetter;
|
||||
} else {
|
||||
getter = namedGetter;
|
||||
}
|
||||
} else {
|
||||
getter = indexedGetter;
|
||||
}
|
||||
return this._then(getter, undefined, undefined, propertyName, undefined);
|
||||
};
|
||||
};
|
||||
129
node_modules/bluebird/js/release/cancel.js
generated
vendored
Normal file
129
node_modules/bluebird/js/release/cancel.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise, PromiseArray, apiRejection, debug) {
|
||||
var util = require("./util");
|
||||
var tryCatch = util.tryCatch;
|
||||
var errorObj = util.errorObj;
|
||||
var async = Promise._async;
|
||||
|
||||
Promise.prototype["break"] = Promise.prototype.cancel = function() {
|
||||
if (!debug.cancellation()) return this._warn("cancellation is disabled");
|
||||
|
||||
var promise = this;
|
||||
var child = promise;
|
||||
while (promise._isCancellable()) {
|
||||
if (!promise._cancelBy(child)) {
|
||||
if (child._isFollowing()) {
|
||||
child._followee().cancel();
|
||||
} else {
|
||||
child._cancelBranched();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
var parent = promise._cancellationParent;
|
||||
if (parent == null || !parent._isCancellable()) {
|
||||
if (promise._isFollowing()) {
|
||||
promise._followee().cancel();
|
||||
} else {
|
||||
promise._cancelBranched();
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
if (promise._isFollowing()) promise._followee().cancel();
|
||||
promise._setWillBeCancelled();
|
||||
child = promise;
|
||||
promise = parent;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._branchHasCancelled = function() {
|
||||
this._branchesRemainingToCancel--;
|
||||
};
|
||||
|
||||
Promise.prototype._enoughBranchesHaveCancelled = function() {
|
||||
return this._branchesRemainingToCancel === undefined ||
|
||||
this._branchesRemainingToCancel <= 0;
|
||||
};
|
||||
|
||||
Promise.prototype._cancelBy = function(canceller) {
|
||||
if (canceller === this) {
|
||||
this._branchesRemainingToCancel = 0;
|
||||
this._invokeOnCancel();
|
||||
return true;
|
||||
} else {
|
||||
this._branchHasCancelled();
|
||||
if (this._enoughBranchesHaveCancelled()) {
|
||||
this._invokeOnCancel();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
Promise.prototype._cancelBranched = function() {
|
||||
if (this._enoughBranchesHaveCancelled()) {
|
||||
this._cancel();
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._cancel = function() {
|
||||
if (!this._isCancellable()) return;
|
||||
this._setCancelled();
|
||||
async.invoke(this._cancelPromises, this, undefined);
|
||||
};
|
||||
|
||||
Promise.prototype._cancelPromises = function() {
|
||||
if (this._length() > 0) this._settlePromises();
|
||||
};
|
||||
|
||||
Promise.prototype._unsetOnCancel = function() {
|
||||
this._onCancelField = undefined;
|
||||
};
|
||||
|
||||
Promise.prototype._isCancellable = function() {
|
||||
return this.isPending() && !this._isCancelled();
|
||||
};
|
||||
|
||||
Promise.prototype.isCancellable = function() {
|
||||
return this.isPending() && !this.isCancelled();
|
||||
};
|
||||
|
||||
Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {
|
||||
if (util.isArray(onCancelCallback)) {
|
||||
for (var i = 0; i < onCancelCallback.length; ++i) {
|
||||
this._doInvokeOnCancel(onCancelCallback[i], internalOnly);
|
||||
}
|
||||
} else if (onCancelCallback !== undefined) {
|
||||
if (typeof onCancelCallback === "function") {
|
||||
if (!internalOnly) {
|
||||
var e = tryCatch(onCancelCallback).call(this._boundValue());
|
||||
if (e === errorObj) {
|
||||
this._attachExtraTrace(e.e);
|
||||
async.throwLater(e.e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
onCancelCallback._resultCancelled(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._invokeOnCancel = function() {
|
||||
var onCancelCallback = this._onCancel();
|
||||
this._unsetOnCancel();
|
||||
async.invoke(this._doInvokeOnCancel, this, onCancelCallback);
|
||||
};
|
||||
|
||||
Promise.prototype._invokeInternalOnCancel = function() {
|
||||
if (this._isCancellable()) {
|
||||
this._doInvokeOnCancel(this._onCancel(), true);
|
||||
this._unsetOnCancel();
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._resultCancelled = function() {
|
||||
this.cancel();
|
||||
};
|
||||
|
||||
};
|
||||
42
node_modules/bluebird/js/release/catch_filter.js
generated
vendored
Normal file
42
node_modules/bluebird/js/release/catch_filter.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
module.exports = function(NEXT_FILTER) {
|
||||
var util = require("./util");
|
||||
var getKeys = require("./es5").keys;
|
||||
var tryCatch = util.tryCatch;
|
||||
var errorObj = util.errorObj;
|
||||
|
||||
function catchFilter(instances, cb, promise) {
|
||||
return function(e) {
|
||||
var boundTo = promise._boundValue();
|
||||
predicateLoop: for (var i = 0; i < instances.length; ++i) {
|
||||
var item = instances[i];
|
||||
|
||||
if (item === Error ||
|
||||
(item != null && item.prototype instanceof Error)) {
|
||||
if (e instanceof item) {
|
||||
return tryCatch(cb).call(boundTo, e);
|
||||
}
|
||||
} else if (typeof item === "function") {
|
||||
var matchesPredicate = tryCatch(item).call(boundTo, e);
|
||||
if (matchesPredicate === errorObj) {
|
||||
return matchesPredicate;
|
||||
} else if (matchesPredicate) {
|
||||
return tryCatch(cb).call(boundTo, e);
|
||||
}
|
||||
} else if (util.isObject(e)) {
|
||||
var keys = getKeys(item);
|
||||
for (var j = 0; j < keys.length; ++j) {
|
||||
var key = keys[j];
|
||||
if (item[key] != e[key]) {
|
||||
continue predicateLoop;
|
||||
}
|
||||
}
|
||||
return tryCatch(cb).call(boundTo, e);
|
||||
}
|
||||
}
|
||||
return NEXT_FILTER;
|
||||
};
|
||||
}
|
||||
|
||||
return catchFilter;
|
||||
};
|
||||
69
node_modules/bluebird/js/release/context.js
generated
vendored
Normal file
69
node_modules/bluebird/js/release/context.js
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise) {
|
||||
var longStackTraces = false;
|
||||
var contextStack = [];
|
||||
|
||||
Promise.prototype._promiseCreated = function() {};
|
||||
Promise.prototype._pushContext = function() {};
|
||||
Promise.prototype._popContext = function() {return null;};
|
||||
Promise._peekContext = Promise.prototype._peekContext = function() {};
|
||||
|
||||
function Context() {
|
||||
this._trace = new Context.CapturedTrace(peekContext());
|
||||
}
|
||||
Context.prototype._pushContext = function () {
|
||||
if (this._trace !== undefined) {
|
||||
this._trace._promiseCreated = null;
|
||||
contextStack.push(this._trace);
|
||||
}
|
||||
};
|
||||
|
||||
Context.prototype._popContext = function () {
|
||||
if (this._trace !== undefined) {
|
||||
var trace = contextStack.pop();
|
||||
var ret = trace._promiseCreated;
|
||||
trace._promiseCreated = null;
|
||||
return ret;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
function createContext() {
|
||||
if (longStackTraces) return new Context();
|
||||
}
|
||||
|
||||
function peekContext() {
|
||||
var lastIndex = contextStack.length - 1;
|
||||
if (lastIndex >= 0) {
|
||||
return contextStack[lastIndex];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
Context.CapturedTrace = null;
|
||||
Context.create = createContext;
|
||||
Context.deactivateLongStackTraces = function() {};
|
||||
Context.activateLongStackTraces = function() {
|
||||
var Promise_pushContext = Promise.prototype._pushContext;
|
||||
var Promise_popContext = Promise.prototype._popContext;
|
||||
var Promise_PeekContext = Promise._peekContext;
|
||||
var Promise_peekContext = Promise.prototype._peekContext;
|
||||
var Promise_promiseCreated = Promise.prototype._promiseCreated;
|
||||
Context.deactivateLongStackTraces = function() {
|
||||
Promise.prototype._pushContext = Promise_pushContext;
|
||||
Promise.prototype._popContext = Promise_popContext;
|
||||
Promise._peekContext = Promise_PeekContext;
|
||||
Promise.prototype._peekContext = Promise_peekContext;
|
||||
Promise.prototype._promiseCreated = Promise_promiseCreated;
|
||||
longStackTraces = false;
|
||||
};
|
||||
longStackTraces = true;
|
||||
Promise.prototype._pushContext = Context.prototype._pushContext;
|
||||
Promise.prototype._popContext = Context.prototype._popContext;
|
||||
Promise._peekContext = Promise.prototype._peekContext = peekContext;
|
||||
Promise.prototype._promiseCreated = function() {
|
||||
var ctx = this._peekContext();
|
||||
if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;
|
||||
};
|
||||
};
|
||||
return Context;
|
||||
};
|
||||
1009
node_modules/bluebird/js/release/debuggability.js
generated
vendored
Normal file
1009
node_modules/bluebird/js/release/debuggability.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
46
node_modules/bluebird/js/release/direct_resolve.js
generated
vendored
Normal file
46
node_modules/bluebird/js/release/direct_resolve.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise) {
|
||||
function returner() {
|
||||
return this.value;
|
||||
}
|
||||
function thrower() {
|
||||
throw this.reason;
|
||||
}
|
||||
|
||||
Promise.prototype["return"] =
|
||||
Promise.prototype.thenReturn = function (value) {
|
||||
if (value instanceof Promise) value.suppressUnhandledRejections();
|
||||
return this._then(
|
||||
returner, undefined, undefined, {value: value}, undefined);
|
||||
};
|
||||
|
||||
Promise.prototype["throw"] =
|
||||
Promise.prototype.thenThrow = function (reason) {
|
||||
return this._then(
|
||||
thrower, undefined, undefined, {reason: reason}, undefined);
|
||||
};
|
||||
|
||||
Promise.prototype.catchThrow = function (reason) {
|
||||
if (arguments.length <= 1) {
|
||||
return this._then(
|
||||
undefined, thrower, undefined, {reason: reason}, undefined);
|
||||
} else {
|
||||
var _reason = arguments[1];
|
||||
var handler = function() {throw _reason;};
|
||||
return this.caught(reason, handler);
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype.catchReturn = function (value) {
|
||||
if (arguments.length <= 1) {
|
||||
if (value instanceof Promise) value.suppressUnhandledRejections();
|
||||
return this._then(
|
||||
undefined, returner, undefined, {value: value}, undefined);
|
||||
} else {
|
||||
var _value = arguments[1];
|
||||
if (_value instanceof Promise) _value.suppressUnhandledRejections();
|
||||
var handler = function() {return _value;};
|
||||
return this.caught(value, handler);
|
||||
}
|
||||
};
|
||||
};
|
||||
30
node_modules/bluebird/js/release/each.js
generated
vendored
Normal file
30
node_modules/bluebird/js/release/each.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise, INTERNAL) {
|
||||
var PromiseReduce = Promise.reduce;
|
||||
var PromiseAll = Promise.all;
|
||||
|
||||
function promiseAllThis() {
|
||||
return PromiseAll(this);
|
||||
}
|
||||
|
||||
function PromiseMapSeries(promises, fn) {
|
||||
return PromiseReduce(promises, fn, INTERNAL, INTERNAL);
|
||||
}
|
||||
|
||||
Promise.prototype.each = function (fn) {
|
||||
return PromiseReduce(this, fn, INTERNAL, 0)
|
||||
._then(promiseAllThis, undefined, undefined, this, undefined);
|
||||
};
|
||||
|
||||
Promise.prototype.mapSeries = function (fn) {
|
||||
return PromiseReduce(this, fn, INTERNAL, INTERNAL);
|
||||
};
|
||||
|
||||
Promise.each = function (promises, fn) {
|
||||
return PromiseReduce(promises, fn, INTERNAL, 0)
|
||||
._then(promiseAllThis, undefined, undefined, promises, undefined);
|
||||
};
|
||||
|
||||
Promise.mapSeries = PromiseMapSeries;
|
||||
};
|
||||
|
||||
116
node_modules/bluebird/js/release/errors.js
generated
vendored
Normal file
116
node_modules/bluebird/js/release/errors.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
"use strict";
|
||||
var es5 = require("./es5");
|
||||
var Objectfreeze = es5.freeze;
|
||||
var util = require("./util");
|
||||
var inherits = util.inherits;
|
||||
var notEnumerableProp = util.notEnumerableProp;
|
||||
|
||||
function subError(nameProperty, defaultMessage) {
|
||||
function SubError(message) {
|
||||
if (!(this instanceof SubError)) return new SubError(message);
|
||||
notEnumerableProp(this, "message",
|
||||
typeof message === "string" ? message : defaultMessage);
|
||||
notEnumerableProp(this, "name", nameProperty);
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
} else {
|
||||
Error.call(this);
|
||||
}
|
||||
}
|
||||
inherits(SubError, Error);
|
||||
return SubError;
|
||||
}
|
||||
|
||||
var _TypeError, _RangeError;
|
||||
var Warning = subError("Warning", "warning");
|
||||
var CancellationError = subError("CancellationError", "cancellation error");
|
||||
var TimeoutError = subError("TimeoutError", "timeout error");
|
||||
var AggregateError = subError("AggregateError", "aggregate error");
|
||||
try {
|
||||
_TypeError = TypeError;
|
||||
_RangeError = RangeError;
|
||||
} catch(e) {
|
||||
_TypeError = subError("TypeError", "type error");
|
||||
_RangeError = subError("RangeError", "range error");
|
||||
}
|
||||
|
||||
var methods = ("join pop push shift unshift slice filter forEach some " +
|
||||
"every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");
|
||||
|
||||
for (var i = 0; i < methods.length; ++i) {
|
||||
if (typeof Array.prototype[methods[i]] === "function") {
|
||||
AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
|
||||
}
|
||||
}
|
||||
|
||||
es5.defineProperty(AggregateError.prototype, "length", {
|
||||
value: 0,
|
||||
configurable: false,
|
||||
writable: true,
|
||||
enumerable: true
|
||||
});
|
||||
AggregateError.prototype["isOperational"] = true;
|
||||
var level = 0;
|
||||
AggregateError.prototype.toString = function() {
|
||||
var indent = Array(level * 4 + 1).join(" ");
|
||||
var ret = "\n" + indent + "AggregateError of:" + "\n";
|
||||
level++;
|
||||
indent = Array(level * 4 + 1).join(" ");
|
||||
for (var i = 0; i < this.length; ++i) {
|
||||
var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "";
|
||||
var lines = str.split("\n");
|
||||
for (var j = 0; j < lines.length; ++j) {
|
||||
lines[j] = indent + lines[j];
|
||||
}
|
||||
str = lines.join("\n");
|
||||
ret += str + "\n";
|
||||
}
|
||||
level--;
|
||||
return ret;
|
||||
};
|
||||
|
||||
function OperationalError(message) {
|
||||
if (!(this instanceof OperationalError))
|
||||
return new OperationalError(message);
|
||||
notEnumerableProp(this, "name", "OperationalError");
|
||||
notEnumerableProp(this, "message", message);
|
||||
this.cause = message;
|
||||
this["isOperational"] = true;
|
||||
|
||||
if (message instanceof Error) {
|
||||
notEnumerableProp(this, "message", message.message);
|
||||
notEnumerableProp(this, "stack", message.stack);
|
||||
} else if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
|
||||
}
|
||||
inherits(OperationalError, Error);
|
||||
|
||||
var errorTypes = Error["__BluebirdErrorTypes__"];
|
||||
if (!errorTypes) {
|
||||
errorTypes = Objectfreeze({
|
||||
CancellationError: CancellationError,
|
||||
TimeoutError: TimeoutError,
|
||||
OperationalError: OperationalError,
|
||||
RejectionError: OperationalError,
|
||||
AggregateError: AggregateError
|
||||
});
|
||||
es5.defineProperty(Error, "__BluebirdErrorTypes__", {
|
||||
value: errorTypes,
|
||||
writable: false,
|
||||
enumerable: false,
|
||||
configurable: false
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
Error: Error,
|
||||
TypeError: _TypeError,
|
||||
RangeError: _RangeError,
|
||||
CancellationError: errorTypes.CancellationError,
|
||||
OperationalError: errorTypes.OperationalError,
|
||||
TimeoutError: errorTypes.TimeoutError,
|
||||
AggregateError: errorTypes.AggregateError,
|
||||
Warning: Warning
|
||||
};
|
||||
80
node_modules/bluebird/js/release/es5.js
generated
vendored
Normal file
80
node_modules/bluebird/js/release/es5.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
var isES5 = (function(){
|
||||
"use strict";
|
||||
return this === undefined;
|
||||
})();
|
||||
|
||||
if (isES5) {
|
||||
module.exports = {
|
||||
freeze: Object.freeze,
|
||||
defineProperty: Object.defineProperty,
|
||||
getDescriptor: Object.getOwnPropertyDescriptor,
|
||||
keys: Object.keys,
|
||||
names: Object.getOwnPropertyNames,
|
||||
getPrototypeOf: Object.getPrototypeOf,
|
||||
isArray: Array.isArray,
|
||||
isES5: isES5,
|
||||
propertyIsWritable: function(obj, prop) {
|
||||
var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
||||
return !!(!descriptor || descriptor.writable || descriptor.set);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
var has = {}.hasOwnProperty;
|
||||
var str = {}.toString;
|
||||
var proto = {}.constructor.prototype;
|
||||
|
||||
var ObjectKeys = function (o) {
|
||||
var ret = [];
|
||||
for (var key in o) {
|
||||
if (has.call(o, key)) {
|
||||
ret.push(key);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
var ObjectGetDescriptor = function(o, key) {
|
||||
return {value: o[key]};
|
||||
};
|
||||
|
||||
var ObjectDefineProperty = function (o, key, desc) {
|
||||
o[key] = desc.value;
|
||||
return o;
|
||||
};
|
||||
|
||||
var ObjectFreeze = function (obj) {
|
||||
return obj;
|
||||
};
|
||||
|
||||
var ObjectGetPrototypeOf = function (obj) {
|
||||
try {
|
||||
return Object(obj).constructor.prototype;
|
||||
}
|
||||
catch (e) {
|
||||
return proto;
|
||||
}
|
||||
};
|
||||
|
||||
var ArrayIsArray = function (obj) {
|
||||
try {
|
||||
return str.call(obj) === "[object Array]";
|
||||
}
|
||||
catch(e) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
isArray: ArrayIsArray,
|
||||
keys: ObjectKeys,
|
||||
names: ObjectKeys,
|
||||
defineProperty: ObjectDefineProperty,
|
||||
getDescriptor: ObjectGetDescriptor,
|
||||
freeze: ObjectFreeze,
|
||||
getPrototypeOf: ObjectGetPrototypeOf,
|
||||
isES5: isES5,
|
||||
propertyIsWritable: function() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
12
node_modules/bluebird/js/release/filter.js
generated
vendored
Normal file
12
node_modules/bluebird/js/release/filter.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise, INTERNAL) {
|
||||
var PromiseMap = Promise.map;
|
||||
|
||||
Promise.prototype.filter = function (fn, options) {
|
||||
return PromiseMap(this, fn, options, INTERNAL);
|
||||
};
|
||||
|
||||
Promise.filter = function (promises, fn, options) {
|
||||
return PromiseMap(promises, fn, options, INTERNAL);
|
||||
};
|
||||
};
|
||||
146
node_modules/bluebird/js/release/finally.js
generated
vendored
Normal file
146
node_modules/bluebird/js/release/finally.js
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) {
|
||||
var util = require("./util");
|
||||
var CancellationError = Promise.CancellationError;
|
||||
var errorObj = util.errorObj;
|
||||
var catchFilter = require("./catch_filter")(NEXT_FILTER);
|
||||
|
||||
function PassThroughHandlerContext(promise, type, handler) {
|
||||
this.promise = promise;
|
||||
this.type = type;
|
||||
this.handler = handler;
|
||||
this.called = false;
|
||||
this.cancelPromise = null;
|
||||
}
|
||||
|
||||
PassThroughHandlerContext.prototype.isFinallyHandler = function() {
|
||||
return this.type === 0;
|
||||
};
|
||||
|
||||
function FinallyHandlerCancelReaction(finallyHandler) {
|
||||
this.finallyHandler = finallyHandler;
|
||||
}
|
||||
|
||||
FinallyHandlerCancelReaction.prototype._resultCancelled = function() {
|
||||
checkCancel(this.finallyHandler);
|
||||
};
|
||||
|
||||
function checkCancel(ctx, reason) {
|
||||
if (ctx.cancelPromise != null) {
|
||||
if (arguments.length > 1) {
|
||||
ctx.cancelPromise._reject(reason);
|
||||
} else {
|
||||
ctx.cancelPromise._cancel();
|
||||
}
|
||||
ctx.cancelPromise = null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function succeed() {
|
||||
return finallyHandler.call(this, this.promise._target()._settledValue());
|
||||
}
|
||||
function fail(reason) {
|
||||
if (checkCancel(this, reason)) return;
|
||||
errorObj.e = reason;
|
||||
return errorObj;
|
||||
}
|
||||
function finallyHandler(reasonOrValue) {
|
||||
var promise = this.promise;
|
||||
var handler = this.handler;
|
||||
|
||||
if (!this.called) {
|
||||
this.called = true;
|
||||
var ret = this.isFinallyHandler()
|
||||
? handler.call(promise._boundValue())
|
||||
: handler.call(promise._boundValue(), reasonOrValue);
|
||||
if (ret === NEXT_FILTER) {
|
||||
return ret;
|
||||
} else if (ret !== undefined) {
|
||||
promise._setReturnedNonUndefined();
|
||||
var maybePromise = tryConvertToPromise(ret, promise);
|
||||
if (maybePromise instanceof Promise) {
|
||||
if (this.cancelPromise != null) {
|
||||
if (maybePromise._isCancelled()) {
|
||||
var reason =
|
||||
new CancellationError("late cancellation observer");
|
||||
promise._attachExtraTrace(reason);
|
||||
errorObj.e = reason;
|
||||
return errorObj;
|
||||
} else if (maybePromise.isPending()) {
|
||||
maybePromise._attachCancellationCallback(
|
||||
new FinallyHandlerCancelReaction(this));
|
||||
}
|
||||
}
|
||||
return maybePromise._then(
|
||||
succeed, fail, undefined, this, undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (promise.isRejected()) {
|
||||
checkCancel(this);
|
||||
errorObj.e = reasonOrValue;
|
||||
return errorObj;
|
||||
} else {
|
||||
checkCancel(this);
|
||||
return reasonOrValue;
|
||||
}
|
||||
}
|
||||
|
||||
Promise.prototype._passThrough = function(handler, type, success, fail) {
|
||||
if (typeof handler !== "function") return this.then();
|
||||
return this._then(success,
|
||||
fail,
|
||||
undefined,
|
||||
new PassThroughHandlerContext(this, type, handler),
|
||||
undefined);
|
||||
};
|
||||
|
||||
Promise.prototype.lastly =
|
||||
Promise.prototype["finally"] = function (handler) {
|
||||
return this._passThrough(handler,
|
||||
0,
|
||||
finallyHandler,
|
||||
finallyHandler);
|
||||
};
|
||||
|
||||
|
||||
Promise.prototype.tap = function (handler) {
|
||||
return this._passThrough(handler, 1, finallyHandler);
|
||||
};
|
||||
|
||||
Promise.prototype.tapCatch = function (handlerOrPredicate) {
|
||||
var len = arguments.length;
|
||||
if(len === 1) {
|
||||
return this._passThrough(handlerOrPredicate,
|
||||
1,
|
||||
undefined,
|
||||
finallyHandler);
|
||||
} else {
|
||||
var catchInstances = new Array(len - 1),
|
||||
j = 0, i;
|
||||
for (i = 0; i < len - 1; ++i) {
|
||||
var item = arguments[i];
|
||||
if (util.isObject(item)) {
|
||||
catchInstances[j++] = item;
|
||||
} else {
|
||||
return Promise.reject(new TypeError(
|
||||
"tapCatch statement predicate: "
|
||||
+ "expecting an object but got " + util.classString(item)
|
||||
));
|
||||
}
|
||||
}
|
||||
catchInstances.length = j;
|
||||
var handler = arguments[i];
|
||||
return this._passThrough(catchFilter(catchInstances, handler, this),
|
||||
1,
|
||||
undefined,
|
||||
finallyHandler);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return PassThroughHandlerContext;
|
||||
};
|
||||
223
node_modules/bluebird/js/release/generators.js
generated
vendored
Normal file
223
node_modules/bluebird/js/release/generators.js
generated
vendored
Normal file
@@ -0,0 +1,223 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise,
|
||||
apiRejection,
|
||||
INTERNAL,
|
||||
tryConvertToPromise,
|
||||
Proxyable,
|
||||
debug) {
|
||||
var errors = require("./errors");
|
||||
var TypeError = errors.TypeError;
|
||||
var util = require("./util");
|
||||
var errorObj = util.errorObj;
|
||||
var tryCatch = util.tryCatch;
|
||||
var yieldHandlers = [];
|
||||
|
||||
function promiseFromYieldHandler(value, yieldHandlers, traceParent) {
|
||||
for (var i = 0; i < yieldHandlers.length; ++i) {
|
||||
traceParent._pushContext();
|
||||
var result = tryCatch(yieldHandlers[i])(value);
|
||||
traceParent._popContext();
|
||||
if (result === errorObj) {
|
||||
traceParent._pushContext();
|
||||
var ret = Promise.reject(errorObj.e);
|
||||
traceParent._popContext();
|
||||
return ret;
|
||||
}
|
||||
var maybePromise = tryConvertToPromise(result, traceParent);
|
||||
if (maybePromise instanceof Promise) return maybePromise;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {
|
||||
if (debug.cancellation()) {
|
||||
var internal = new Promise(INTERNAL);
|
||||
var _finallyPromise = this._finallyPromise = new Promise(INTERNAL);
|
||||
this._promise = internal.lastly(function() {
|
||||
return _finallyPromise;
|
||||
});
|
||||
internal._captureStackTrace();
|
||||
internal._setOnCancel(this);
|
||||
} else {
|
||||
var promise = this._promise = new Promise(INTERNAL);
|
||||
promise._captureStackTrace();
|
||||
}
|
||||
this._stack = stack;
|
||||
this._generatorFunction = generatorFunction;
|
||||
this._receiver = receiver;
|
||||
this._generator = undefined;
|
||||
this._yieldHandlers = typeof yieldHandler === "function"
|
||||
? [yieldHandler].concat(yieldHandlers)
|
||||
: yieldHandlers;
|
||||
this._yieldedPromise = null;
|
||||
this._cancellationPhase = false;
|
||||
}
|
||||
util.inherits(PromiseSpawn, Proxyable);
|
||||
|
||||
PromiseSpawn.prototype._isResolved = function() {
|
||||
return this._promise === null;
|
||||
};
|
||||
|
||||
PromiseSpawn.prototype._cleanup = function() {
|
||||
this._promise = this._generator = null;
|
||||
if (debug.cancellation() && this._finallyPromise !== null) {
|
||||
this._finallyPromise._fulfill();
|
||||
this._finallyPromise = null;
|
||||
}
|
||||
};
|
||||
|
||||
PromiseSpawn.prototype._promiseCancelled = function() {
|
||||
if (this._isResolved()) return;
|
||||
var implementsReturn = typeof this._generator["return"] !== "undefined";
|
||||
|
||||
var result;
|
||||
if (!implementsReturn) {
|
||||
var reason = new Promise.CancellationError(
|
||||
"generator .return() sentinel");
|
||||
Promise.coroutine.returnSentinel = reason;
|
||||
this._promise._attachExtraTrace(reason);
|
||||
this._promise._pushContext();
|
||||
result = tryCatch(this._generator["throw"]).call(this._generator,
|
||||
reason);
|
||||
this._promise._popContext();
|
||||
} else {
|
||||
this._promise._pushContext();
|
||||
result = tryCatch(this._generator["return"]).call(this._generator,
|
||||
undefined);
|
||||
this._promise._popContext();
|
||||
}
|
||||
this._cancellationPhase = true;
|
||||
this._yieldedPromise = null;
|
||||
this._continue(result);
|
||||
};
|
||||
|
||||
PromiseSpawn.prototype._promiseFulfilled = function(value) {
|
||||
this._yieldedPromise = null;
|
||||
this._promise._pushContext();
|
||||
var result = tryCatch(this._generator.next).call(this._generator, value);
|
||||
this._promise._popContext();
|
||||
this._continue(result);
|
||||
};
|
||||
|
||||
PromiseSpawn.prototype._promiseRejected = function(reason) {
|
||||
this._yieldedPromise = null;
|
||||
this._promise._attachExtraTrace(reason);
|
||||
this._promise._pushContext();
|
||||
var result = tryCatch(this._generator["throw"])
|
||||
.call(this._generator, reason);
|
||||
this._promise._popContext();
|
||||
this._continue(result);
|
||||
};
|
||||
|
||||
PromiseSpawn.prototype._resultCancelled = function() {
|
||||
if (this._yieldedPromise instanceof Promise) {
|
||||
var promise = this._yieldedPromise;
|
||||
this._yieldedPromise = null;
|
||||
promise.cancel();
|
||||
}
|
||||
};
|
||||
|
||||
PromiseSpawn.prototype.promise = function () {
|
||||
return this._promise;
|
||||
};
|
||||
|
||||
PromiseSpawn.prototype._run = function () {
|
||||
this._generator = this._generatorFunction.call(this._receiver);
|
||||
this._receiver =
|
||||
this._generatorFunction = undefined;
|
||||
this._promiseFulfilled(undefined);
|
||||
};
|
||||
|
||||
PromiseSpawn.prototype._continue = function (result) {
|
||||
var promise = this._promise;
|
||||
if (result === errorObj) {
|
||||
this._cleanup();
|
||||
if (this._cancellationPhase) {
|
||||
return promise.cancel();
|
||||
} else {
|
||||
return promise._rejectCallback(result.e, false);
|
||||
}
|
||||
}
|
||||
|
||||
var value = result.value;
|
||||
if (result.done === true) {
|
||||
this._cleanup();
|
||||
if (this._cancellationPhase) {
|
||||
return promise.cancel();
|
||||
} else {
|
||||
return promise._resolveCallback(value);
|
||||
}
|
||||
} else {
|
||||
var maybePromise = tryConvertToPromise(value, this._promise);
|
||||
if (!(maybePromise instanceof Promise)) {
|
||||
maybePromise =
|
||||
promiseFromYieldHandler(maybePromise,
|
||||
this._yieldHandlers,
|
||||
this._promise);
|
||||
if (maybePromise === null) {
|
||||
this._promiseRejected(
|
||||
new TypeError(
|
||||
"A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", String(value)) +
|
||||
"From coroutine:\u000a" +
|
||||
this._stack.split("\n").slice(1, -7).join("\n")
|
||||
)
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
maybePromise = maybePromise._target();
|
||||
var bitField = maybePromise._bitField;
|
||||
;
|
||||
if (((bitField & 50397184) === 0)) {
|
||||
this._yieldedPromise = maybePromise;
|
||||
maybePromise._proxy(this, null);
|
||||
} else if (((bitField & 33554432) !== 0)) {
|
||||
Promise._async.invoke(
|
||||
this._promiseFulfilled, this, maybePromise._value()
|
||||
);
|
||||
} else if (((bitField & 16777216) !== 0)) {
|
||||
Promise._async.invoke(
|
||||
this._promiseRejected, this, maybePromise._reason()
|
||||
);
|
||||
} else {
|
||||
this._promiseCancelled();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Promise.coroutine = function (generatorFunction, options) {
|
||||
if (typeof generatorFunction !== "function") {
|
||||
throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||
}
|
||||
var yieldHandler = Object(options).yieldHandler;
|
||||
var PromiseSpawn$ = PromiseSpawn;
|
||||
var stack = new Error().stack;
|
||||
return function () {
|
||||
var generator = generatorFunction.apply(this, arguments);
|
||||
var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,
|
||||
stack);
|
||||
var ret = spawn.promise();
|
||||
spawn._generator = generator;
|
||||
spawn._promiseFulfilled(undefined);
|
||||
return ret;
|
||||
};
|
||||
};
|
||||
|
||||
Promise.coroutine.addYieldHandler = function(fn) {
|
||||
if (typeof fn !== "function") {
|
||||
throw new TypeError("expecting a function but got " + util.classString(fn));
|
||||
}
|
||||
yieldHandlers.push(fn);
|
||||
};
|
||||
|
||||
Promise.spawn = function (generatorFunction) {
|
||||
debug.deprecated("Promise.spawn()", "Promise.coroutine()");
|
||||
if (typeof generatorFunction !== "function") {
|
||||
return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||
}
|
||||
var spawn = new PromiseSpawn(generatorFunction, this);
|
||||
var ret = spawn.promise();
|
||||
spawn._run(Promise.spawn);
|
||||
return ret;
|
||||
};
|
||||
};
|
||||
165
node_modules/bluebird/js/release/join.js
generated
vendored
Normal file
165
node_modules/bluebird/js/release/join.js
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
"use strict";
|
||||
module.exports =
|
||||
function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async) {
|
||||
var util = require("./util");
|
||||
var canEvaluate = util.canEvaluate;
|
||||
var tryCatch = util.tryCatch;
|
||||
var errorObj = util.errorObj;
|
||||
var reject;
|
||||
|
||||
if (!false) {
|
||||
if (canEvaluate) {
|
||||
var thenCallback = function(i) {
|
||||
return new Function("value", "holder", " \n\
|
||||
'use strict'; \n\
|
||||
holder.pIndex = value; \n\
|
||||
holder.checkFulfillment(this); \n\
|
||||
".replace(/Index/g, i));
|
||||
};
|
||||
|
||||
var promiseSetter = function(i) {
|
||||
return new Function("promise", "holder", " \n\
|
||||
'use strict'; \n\
|
||||
holder.pIndex = promise; \n\
|
||||
".replace(/Index/g, i));
|
||||
};
|
||||
|
||||
var generateHolderClass = function(total) {
|
||||
var props = new Array(total);
|
||||
for (var i = 0; i < props.length; ++i) {
|
||||
props[i] = "this.p" + (i+1);
|
||||
}
|
||||
var assignment = props.join(" = ") + " = null;";
|
||||
var cancellationCode= "var promise;\n" + props.map(function(prop) {
|
||||
return " \n\
|
||||
promise = " + prop + "; \n\
|
||||
if (promise instanceof Promise) { \n\
|
||||
promise.cancel(); \n\
|
||||
} \n\
|
||||
";
|
||||
}).join("\n");
|
||||
var passedArguments = props.join(", ");
|
||||
var name = "Holder$" + total;
|
||||
|
||||
|
||||
var code = "return function(tryCatch, errorObj, Promise, async) { \n\
|
||||
'use strict'; \n\
|
||||
function [TheName](fn) { \n\
|
||||
[TheProperties] \n\
|
||||
this.fn = fn; \n\
|
||||
this.asyncNeeded = true; \n\
|
||||
this.now = 0; \n\
|
||||
} \n\
|
||||
\n\
|
||||
[TheName].prototype._callFunction = function(promise) { \n\
|
||||
promise._pushContext(); \n\
|
||||
var ret = tryCatch(this.fn)([ThePassedArguments]); \n\
|
||||
promise._popContext(); \n\
|
||||
if (ret === errorObj) { \n\
|
||||
promise._rejectCallback(ret.e, false); \n\
|
||||
} else { \n\
|
||||
promise._resolveCallback(ret); \n\
|
||||
} \n\
|
||||
}; \n\
|
||||
\n\
|
||||
[TheName].prototype.checkFulfillment = function(promise) { \n\
|
||||
var now = ++this.now; \n\
|
||||
if (now === [TheTotal]) { \n\
|
||||
if (this.asyncNeeded) { \n\
|
||||
async.invoke(this._callFunction, this, promise); \n\
|
||||
} else { \n\
|
||||
this._callFunction(promise); \n\
|
||||
} \n\
|
||||
\n\
|
||||
} \n\
|
||||
}; \n\
|
||||
\n\
|
||||
[TheName].prototype._resultCancelled = function() { \n\
|
||||
[CancellationCode] \n\
|
||||
}; \n\
|
||||
\n\
|
||||
return [TheName]; \n\
|
||||
}(tryCatch, errorObj, Promise, async); \n\
|
||||
";
|
||||
|
||||
code = code.replace(/\[TheName\]/g, name)
|
||||
.replace(/\[TheTotal\]/g, total)
|
||||
.replace(/\[ThePassedArguments\]/g, passedArguments)
|
||||
.replace(/\[TheProperties\]/g, assignment)
|
||||
.replace(/\[CancellationCode\]/g, cancellationCode);
|
||||
|
||||
return new Function("tryCatch", "errorObj", "Promise", "async", code)
|
||||
(tryCatch, errorObj, Promise, async);
|
||||
};
|
||||
|
||||
var holderClasses = [];
|
||||
var thenCallbacks = [];
|
||||
var promiseSetters = [];
|
||||
|
||||
for (var i = 0; i < 8; ++i) {
|
||||
holderClasses.push(generateHolderClass(i + 1));
|
||||
thenCallbacks.push(thenCallback(i + 1));
|
||||
promiseSetters.push(promiseSetter(i + 1));
|
||||
}
|
||||
|
||||
reject = function (reason) {
|
||||
this._reject(reason);
|
||||
};
|
||||
}}
|
||||
|
||||
Promise.join = function () {
|
||||
var last = arguments.length - 1;
|
||||
var fn;
|
||||
if (last > 0 && typeof arguments[last] === "function") {
|
||||
fn = arguments[last];
|
||||
if (!false) {
|
||||
if (last <= 8 && canEvaluate) {
|
||||
var ret = new Promise(INTERNAL);
|
||||
ret._captureStackTrace();
|
||||
var HolderClass = holderClasses[last - 1];
|
||||
var holder = new HolderClass(fn);
|
||||
var callbacks = thenCallbacks;
|
||||
|
||||
for (var i = 0; i < last; ++i) {
|
||||
var maybePromise = tryConvertToPromise(arguments[i], ret);
|
||||
if (maybePromise instanceof Promise) {
|
||||
maybePromise = maybePromise._target();
|
||||
var bitField = maybePromise._bitField;
|
||||
;
|
||||
if (((bitField & 50397184) === 0)) {
|
||||
maybePromise._then(callbacks[i], reject,
|
||||
undefined, ret, holder);
|
||||
promiseSetters[i](maybePromise, holder);
|
||||
holder.asyncNeeded = false;
|
||||
} else if (((bitField & 33554432) !== 0)) {
|
||||
callbacks[i].call(ret,
|
||||
maybePromise._value(), holder);
|
||||
} else if (((bitField & 16777216) !== 0)) {
|
||||
ret._reject(maybePromise._reason());
|
||||
} else {
|
||||
ret._cancel();
|
||||
}
|
||||
} else {
|
||||
callbacks[i].call(ret, maybePromise, holder);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ret._isFateSealed()) {
|
||||
if (holder.asyncNeeded) {
|
||||
var context = Promise._getContext();
|
||||
holder.fn = util.contextBind(context, holder.fn);
|
||||
}
|
||||
ret._setAsyncGuaranteed();
|
||||
ret._setOnCancel(holder);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len ; ++$_i) {args[$_i] = arguments[$_i ];};
|
||||
if (fn) args.pop();
|
||||
var ret = new PromiseArray(args).promise();
|
||||
return fn !== undefined ? ret.spread(fn) : ret;
|
||||
};
|
||||
|
||||
};
|
||||
175
node_modules/bluebird/js/release/map.js
generated
vendored
Normal file
175
node_modules/bluebird/js/release/map.js
generated
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise,
|
||||
PromiseArray,
|
||||
apiRejection,
|
||||
tryConvertToPromise,
|
||||
INTERNAL,
|
||||
debug) {
|
||||
var util = require("./util");
|
||||
var tryCatch = util.tryCatch;
|
||||
var errorObj = util.errorObj;
|
||||
var async = Promise._async;
|
||||
|
||||
function MappingPromiseArray(promises, fn, limit, _filter) {
|
||||
this.constructor$(promises);
|
||||
this._promise._captureStackTrace();
|
||||
var context = Promise._getContext();
|
||||
this._callback = util.contextBind(context, fn);
|
||||
this._preservedValues = _filter === INTERNAL
|
||||
? new Array(this.length())
|
||||
: null;
|
||||
this._limit = limit;
|
||||
this._inFlight = 0;
|
||||
this._queue = [];
|
||||
async.invoke(this._asyncInit, this, undefined);
|
||||
if (util.isArray(promises)) {
|
||||
for (var i = 0; i < promises.length; ++i) {
|
||||
var maybePromise = promises[i];
|
||||
if (maybePromise instanceof Promise) {
|
||||
maybePromise.suppressUnhandledRejections();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
util.inherits(MappingPromiseArray, PromiseArray);
|
||||
|
||||
MappingPromiseArray.prototype._asyncInit = function() {
|
||||
this._init$(undefined, -2);
|
||||
};
|
||||
|
||||
MappingPromiseArray.prototype._init = function () {};
|
||||
|
||||
MappingPromiseArray.prototype._promiseFulfilled = function (value, index) {
|
||||
var values = this._values;
|
||||
var length = this.length();
|
||||
var preservedValues = this._preservedValues;
|
||||
var limit = this._limit;
|
||||
|
||||
if (index < 0) {
|
||||
index = (index * -1) - 1;
|
||||
values[index] = value;
|
||||
if (limit >= 1) {
|
||||
this._inFlight--;
|
||||
this._drainQueue();
|
||||
if (this._isResolved()) return true;
|
||||
}
|
||||
} else {
|
||||
if (limit >= 1 && this._inFlight >= limit) {
|
||||
values[index] = value;
|
||||
this._queue.push(index);
|
||||
return false;
|
||||
}
|
||||
if (preservedValues !== null) preservedValues[index] = value;
|
||||
|
||||
var promise = this._promise;
|
||||
var callback = this._callback;
|
||||
var receiver = promise._boundValue();
|
||||
promise._pushContext();
|
||||
var ret = tryCatch(callback).call(receiver, value, index, length);
|
||||
var promiseCreated = promise._popContext();
|
||||
debug.checkForgottenReturns(
|
||||
ret,
|
||||
promiseCreated,
|
||||
preservedValues !== null ? "Promise.filter" : "Promise.map",
|
||||
promise
|
||||
);
|
||||
if (ret === errorObj) {
|
||||
this._reject(ret.e);
|
||||
return true;
|
||||
}
|
||||
|
||||
var maybePromise = tryConvertToPromise(ret, this._promise);
|
||||
if (maybePromise instanceof Promise) {
|
||||
maybePromise = maybePromise._target();
|
||||
var bitField = maybePromise._bitField;
|
||||
;
|
||||
if (((bitField & 50397184) === 0)) {
|
||||
if (limit >= 1) this._inFlight++;
|
||||
values[index] = maybePromise;
|
||||
maybePromise._proxy(this, (index + 1) * -1);
|
||||
return false;
|
||||
} else if (((bitField & 33554432) !== 0)) {
|
||||
ret = maybePromise._value();
|
||||
} else if (((bitField & 16777216) !== 0)) {
|
||||
this._reject(maybePromise._reason());
|
||||
return true;
|
||||
} else {
|
||||
this._cancel();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
values[index] = ret;
|
||||
}
|
||||
var totalResolved = ++this._totalResolved;
|
||||
if (totalResolved >= length) {
|
||||
if (preservedValues !== null) {
|
||||
this._filter(values, preservedValues);
|
||||
} else {
|
||||
this._resolve(values);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
MappingPromiseArray.prototype._drainQueue = function () {
|
||||
var queue = this._queue;
|
||||
var limit = this._limit;
|
||||
var values = this._values;
|
||||
while (queue.length > 0 && this._inFlight < limit) {
|
||||
if (this._isResolved()) return;
|
||||
var index = queue.pop();
|
||||
this._promiseFulfilled(values[index], index);
|
||||
}
|
||||
};
|
||||
|
||||
MappingPromiseArray.prototype._filter = function (booleans, values) {
|
||||
var len = values.length;
|
||||
var ret = new Array(len);
|
||||
var j = 0;
|
||||
for (var i = 0; i < len; ++i) {
|
||||
if (booleans[i]) ret[j++] = values[i];
|
||||
}
|
||||
ret.length = j;
|
||||
this._resolve(ret);
|
||||
};
|
||||
|
||||
MappingPromiseArray.prototype.preservedValues = function () {
|
||||
return this._preservedValues;
|
||||
};
|
||||
|
||||
function map(promises, fn, options, _filter) {
|
||||
if (typeof fn !== "function") {
|
||||
return apiRejection("expecting a function but got " + util.classString(fn));
|
||||
}
|
||||
|
||||
var limit = 0;
|
||||
if (options !== undefined) {
|
||||
if (typeof options === "object" && options !== null) {
|
||||
if (typeof options.concurrency !== "number") {
|
||||
return Promise.reject(
|
||||
new TypeError("'concurrency' must be a number but it is " +
|
||||
util.classString(options.concurrency)));
|
||||
}
|
||||
limit = options.concurrency;
|
||||
} else {
|
||||
return Promise.reject(new TypeError(
|
||||
"options argument must be an object but it is " +
|
||||
util.classString(options)));
|
||||
}
|
||||
}
|
||||
limit = typeof limit === "number" &&
|
||||
isFinite(limit) && limit >= 1 ? limit : 0;
|
||||
return new MappingPromiseArray(promises, fn, limit, _filter).promise();
|
||||
}
|
||||
|
||||
Promise.prototype.map = function (fn, options) {
|
||||
return map(this, fn, options, null);
|
||||
};
|
||||
|
||||
Promise.map = function (promises, fn, options, _filter) {
|
||||
return map(promises, fn, options, _filter);
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
55
node_modules/bluebird/js/release/method.js
generated
vendored
Normal file
55
node_modules/bluebird/js/release/method.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
module.exports =
|
||||
function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {
|
||||
var util = require("./util");
|
||||
var tryCatch = util.tryCatch;
|
||||
|
||||
Promise.method = function (fn) {
|
||||
if (typeof fn !== "function") {
|
||||
throw new Promise.TypeError("expecting a function but got " + util.classString(fn));
|
||||
}
|
||||
return function () {
|
||||
var ret = new Promise(INTERNAL);
|
||||
ret._captureStackTrace();
|
||||
ret._pushContext();
|
||||
var value = tryCatch(fn).apply(this, arguments);
|
||||
var promiseCreated = ret._popContext();
|
||||
debug.checkForgottenReturns(
|
||||
value, promiseCreated, "Promise.method", ret);
|
||||
ret._resolveFromSyncValue(value);
|
||||
return ret;
|
||||
};
|
||||
};
|
||||
|
||||
Promise.attempt = Promise["try"] = function (fn) {
|
||||
if (typeof fn !== "function") {
|
||||
return apiRejection("expecting a function but got " + util.classString(fn));
|
||||
}
|
||||
var ret = new Promise(INTERNAL);
|
||||
ret._captureStackTrace();
|
||||
ret._pushContext();
|
||||
var value;
|
||||
if (arguments.length > 1) {
|
||||
debug.deprecated("calling Promise.try with more than 1 argument");
|
||||
var arg = arguments[1];
|
||||
var ctx = arguments[2];
|
||||
value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)
|
||||
: tryCatch(fn).call(ctx, arg);
|
||||
} else {
|
||||
value = tryCatch(fn)();
|
||||
}
|
||||
var promiseCreated = ret._popContext();
|
||||
debug.checkForgottenReturns(
|
||||
value, promiseCreated, "Promise.try", ret);
|
||||
ret._resolveFromSyncValue(value);
|
||||
return ret;
|
||||
};
|
||||
|
||||
Promise.prototype._resolveFromSyncValue = function (value) {
|
||||
if (value === util.errorObj) {
|
||||
this._rejectCallback(value.e, false);
|
||||
} else {
|
||||
this._resolveCallback(value, true);
|
||||
}
|
||||
};
|
||||
};
|
||||
51
node_modules/bluebird/js/release/nodeback.js
generated
vendored
Normal file
51
node_modules/bluebird/js/release/nodeback.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
var util = require("./util");
|
||||
var maybeWrapAsError = util.maybeWrapAsError;
|
||||
var errors = require("./errors");
|
||||
var OperationalError = errors.OperationalError;
|
||||
var es5 = require("./es5");
|
||||
|
||||
function isUntypedError(obj) {
|
||||
return obj instanceof Error &&
|
||||
es5.getPrototypeOf(obj) === Error.prototype;
|
||||
}
|
||||
|
||||
var rErrorKey = /^(?:name|message|stack|cause)$/;
|
||||
function wrapAsOperationalError(obj) {
|
||||
var ret;
|
||||
if (isUntypedError(obj)) {
|
||||
ret = new OperationalError(obj);
|
||||
ret.name = obj.name;
|
||||
ret.message = obj.message;
|
||||
ret.stack = obj.stack;
|
||||
var keys = es5.keys(obj);
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
var key = keys[i];
|
||||
if (!rErrorKey.test(key)) {
|
||||
ret[key] = obj[key];
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
util.markAsOriginatingFromRejection(obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
function nodebackForPromise(promise, multiArgs) {
|
||||
return function(err, value) {
|
||||
if (promise === null) return;
|
||||
if (err) {
|
||||
var wrapped = wrapAsOperationalError(maybeWrapAsError(err));
|
||||
promise._attachExtraTrace(wrapped);
|
||||
promise._reject(wrapped);
|
||||
} else if (!multiArgs) {
|
||||
promise._fulfill(value);
|
||||
} else {
|
||||
var $_len = arguments.length;var args = new Array(Math.max($_len - 1, 0)); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];};
|
||||
promise._fulfill(args);
|
||||
}
|
||||
promise = null;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = nodebackForPromise;
|
||||
58
node_modules/bluebird/js/release/nodeify.js
generated
vendored
Normal file
58
node_modules/bluebird/js/release/nodeify.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise) {
|
||||
var util = require("./util");
|
||||
var async = Promise._async;
|
||||
var tryCatch = util.tryCatch;
|
||||
var errorObj = util.errorObj;
|
||||
|
||||
function spreadAdapter(val, nodeback) {
|
||||
var promise = this;
|
||||
if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);
|
||||
var ret =
|
||||
tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val));
|
||||
if (ret === errorObj) {
|
||||
async.throwLater(ret.e);
|
||||
}
|
||||
}
|
||||
|
||||
function successAdapter(val, nodeback) {
|
||||
var promise = this;
|
||||
var receiver = promise._boundValue();
|
||||
var ret = val === undefined
|
||||
? tryCatch(nodeback).call(receiver, null)
|
||||
: tryCatch(nodeback).call(receiver, null, val);
|
||||
if (ret === errorObj) {
|
||||
async.throwLater(ret.e);
|
||||
}
|
||||
}
|
||||
function errorAdapter(reason, nodeback) {
|
||||
var promise = this;
|
||||
if (!reason) {
|
||||
var newReason = new Error(reason + "");
|
||||
newReason.cause = reason;
|
||||
reason = newReason;
|
||||
}
|
||||
var ret = tryCatch(nodeback).call(promise._boundValue(), reason);
|
||||
if (ret === errorObj) {
|
||||
async.throwLater(ret.e);
|
||||
}
|
||||
}
|
||||
|
||||
Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback,
|
||||
options) {
|
||||
if (typeof nodeback == "function") {
|
||||
var adapter = successAdapter;
|
||||
if (options !== undefined && Object(options).spread) {
|
||||
adapter = spreadAdapter;
|
||||
}
|
||||
this._then(
|
||||
adapter,
|
||||
errorAdapter,
|
||||
undefined,
|
||||
this,
|
||||
nodeback
|
||||
);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
};
|
||||
819
node_modules/bluebird/js/release/promise.js
generated
vendored
Normal file
819
node_modules/bluebird/js/release/promise.js
generated
vendored
Normal file
@@ -0,0 +1,819 @@
|
||||
"use strict";
|
||||
module.exports = function() {
|
||||
var makeSelfResolutionError = function () {
|
||||
return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||
};
|
||||
var reflectHandler = function() {
|
||||
return new Promise.PromiseInspection(this._target());
|
||||
};
|
||||
var apiRejection = function(msg) {
|
||||
return Promise.reject(new TypeError(msg));
|
||||
};
|
||||
function Proxyable() {}
|
||||
var UNDEFINED_BINDING = {};
|
||||
var util = require("./util");
|
||||
util.setReflectHandler(reflectHandler);
|
||||
|
||||
var getDomain = function() {
|
||||
var domain = process.domain;
|
||||
if (domain === undefined) {
|
||||
return null;
|
||||
}
|
||||
return domain;
|
||||
};
|
||||
var getContextDefault = function() {
|
||||
return null;
|
||||
};
|
||||
var getContextDomain = function() {
|
||||
return {
|
||||
domain: getDomain(),
|
||||
async: null
|
||||
};
|
||||
};
|
||||
var AsyncResource = util.isNode && util.nodeSupportsAsyncResource ?
|
||||
require("async_hooks").AsyncResource : null;
|
||||
var getContextAsyncHooks = function() {
|
||||
return {
|
||||
domain: getDomain(),
|
||||
async: new AsyncResource("Bluebird::Promise")
|
||||
};
|
||||
};
|
||||
var getContext = util.isNode ? getContextDomain : getContextDefault;
|
||||
util.notEnumerableProp(Promise, "_getContext", getContext);
|
||||
var enableAsyncHooks = function() {
|
||||
getContext = getContextAsyncHooks;
|
||||
util.notEnumerableProp(Promise, "_getContext", getContextAsyncHooks);
|
||||
};
|
||||
var disableAsyncHooks = function() {
|
||||
getContext = getContextDomain;
|
||||
util.notEnumerableProp(Promise, "_getContext", getContextDomain);
|
||||
};
|
||||
|
||||
var es5 = require("./es5");
|
||||
var Async = require("./async");
|
||||
var async = new Async();
|
||||
es5.defineProperty(Promise, "_async", {value: async});
|
||||
var errors = require("./errors");
|
||||
var TypeError = Promise.TypeError = errors.TypeError;
|
||||
Promise.RangeError = errors.RangeError;
|
||||
var CancellationError = Promise.CancellationError = errors.CancellationError;
|
||||
Promise.TimeoutError = errors.TimeoutError;
|
||||
Promise.OperationalError = errors.OperationalError;
|
||||
Promise.RejectionError = errors.OperationalError;
|
||||
Promise.AggregateError = errors.AggregateError;
|
||||
var INTERNAL = function(){};
|
||||
var APPLY = {};
|
||||
var NEXT_FILTER = {};
|
||||
var tryConvertToPromise = require("./thenables")(Promise, INTERNAL);
|
||||
var PromiseArray =
|
||||
require("./promise_array")(Promise, INTERNAL,
|
||||
tryConvertToPromise, apiRejection, Proxyable);
|
||||
var Context = require("./context")(Promise);
|
||||
/*jshint unused:false*/
|
||||
var createContext = Context.create;
|
||||
|
||||
var debug = require("./debuggability")(Promise, Context,
|
||||
enableAsyncHooks, disableAsyncHooks);
|
||||
var CapturedTrace = debug.CapturedTrace;
|
||||
var PassThroughHandlerContext =
|
||||
require("./finally")(Promise, tryConvertToPromise, NEXT_FILTER);
|
||||
var catchFilter = require("./catch_filter")(NEXT_FILTER);
|
||||
var nodebackForPromise = require("./nodeback");
|
||||
var errorObj = util.errorObj;
|
||||
var tryCatch = util.tryCatch;
|
||||
function check(self, executor) {
|
||||
if (self == null || self.constructor !== Promise) {
|
||||
throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||
}
|
||||
if (typeof executor !== "function") {
|
||||
throw new TypeError("expecting a function but got " + util.classString(executor));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function Promise(executor) {
|
||||
if (executor !== INTERNAL) {
|
||||
check(this, executor);
|
||||
}
|
||||
this._bitField = 0;
|
||||
this._fulfillmentHandler0 = undefined;
|
||||
this._rejectionHandler0 = undefined;
|
||||
this._promise0 = undefined;
|
||||
this._receiver0 = undefined;
|
||||
this._resolveFromExecutor(executor);
|
||||
this._promiseCreated();
|
||||
this._fireEvent("promiseCreated", this);
|
||||
}
|
||||
|
||||
Promise.prototype.toString = function () {
|
||||
return "[object Promise]";
|
||||
};
|
||||
|
||||
Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
|
||||
var len = arguments.length;
|
||||
if (len > 1) {
|
||||
var catchInstances = new Array(len - 1),
|
||||
j = 0, i;
|
||||
for (i = 0; i < len - 1; ++i) {
|
||||
var item = arguments[i];
|
||||
if (util.isObject(item)) {
|
||||
catchInstances[j++] = item;
|
||||
} else {
|
||||
return apiRejection("Catch statement predicate: " +
|
||||
"expecting an object but got " + util.classString(item));
|
||||
}
|
||||
}
|
||||
catchInstances.length = j;
|
||||
fn = arguments[i];
|
||||
|
||||
if (typeof fn !== "function") {
|
||||
throw new TypeError("The last argument to .catch() " +
|
||||
"must be a function, got " + util.toString(fn));
|
||||
}
|
||||
return this.then(undefined, catchFilter(catchInstances, fn, this));
|
||||
}
|
||||
return this.then(undefined, fn);
|
||||
};
|
||||
|
||||
Promise.prototype.reflect = function () {
|
||||
return this._then(reflectHandler,
|
||||
reflectHandler, undefined, this, undefined);
|
||||
};
|
||||
|
||||
Promise.prototype.then = function (didFulfill, didReject) {
|
||||
if (debug.warnings() && arguments.length > 0 &&
|
||||
typeof didFulfill !== "function" &&
|
||||
typeof didReject !== "function") {
|
||||
var msg = ".then() only accepts functions but was passed: " +
|
||||
util.classString(didFulfill);
|
||||
if (arguments.length > 1) {
|
||||
msg += ", " + util.classString(didReject);
|
||||
}
|
||||
this._warn(msg);
|
||||
}
|
||||
return this._then(didFulfill, didReject, undefined, undefined, undefined);
|
||||
};
|
||||
|
||||
Promise.prototype.done = function (didFulfill, didReject) {
|
||||
var promise =
|
||||
this._then(didFulfill, didReject, undefined, undefined, undefined);
|
||||
promise._setIsFinal();
|
||||
};
|
||||
|
||||
Promise.prototype.spread = function (fn) {
|
||||
if (typeof fn !== "function") {
|
||||
return apiRejection("expecting a function but got " + util.classString(fn));
|
||||
}
|
||||
return this.all()._then(fn, undefined, undefined, APPLY, undefined);
|
||||
};
|
||||
|
||||
Promise.prototype.toJSON = function () {
|
||||
var ret = {
|
||||
isFulfilled: false,
|
||||
isRejected: false,
|
||||
fulfillmentValue: undefined,
|
||||
rejectionReason: undefined
|
||||
};
|
||||
if (this.isFulfilled()) {
|
||||
ret.fulfillmentValue = this.value();
|
||||
ret.isFulfilled = true;
|
||||
} else if (this.isRejected()) {
|
||||
ret.rejectionReason = this.reason();
|
||||
ret.isRejected = true;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
Promise.prototype.all = function () {
|
||||
if (arguments.length > 0) {
|
||||
this._warn(".all() was passed arguments but it does not take any");
|
||||
}
|
||||
return new PromiseArray(this).promise();
|
||||
};
|
||||
|
||||
Promise.prototype.error = function (fn) {
|
||||
return this.caught(util.originatesFromRejection, fn);
|
||||
};
|
||||
|
||||
Promise.getNewLibraryCopy = module.exports;
|
||||
|
||||
Promise.is = function (val) {
|
||||
return val instanceof Promise;
|
||||
};
|
||||
|
||||
Promise.fromNode = Promise.fromCallback = function(fn) {
|
||||
var ret = new Promise(INTERNAL);
|
||||
ret._captureStackTrace();
|
||||
var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs
|
||||
: false;
|
||||
var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));
|
||||
if (result === errorObj) {
|
||||
ret._rejectCallback(result.e, true);
|
||||
}
|
||||
if (!ret._isFateSealed()) ret._setAsyncGuaranteed();
|
||||
return ret;
|
||||
};
|
||||
|
||||
Promise.all = function (promises) {
|
||||
return new PromiseArray(promises).promise();
|
||||
};
|
||||
|
||||
Promise.cast = function (obj) {
|
||||
var ret = tryConvertToPromise(obj);
|
||||
if (!(ret instanceof Promise)) {
|
||||
ret = new Promise(INTERNAL);
|
||||
ret._captureStackTrace();
|
||||
ret._setFulfilled();
|
||||
ret._rejectionHandler0 = obj;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
Promise.resolve = Promise.fulfilled = Promise.cast;
|
||||
|
||||
Promise.reject = Promise.rejected = function (reason) {
|
||||
var ret = new Promise(INTERNAL);
|
||||
ret._captureStackTrace();
|
||||
ret._rejectCallback(reason, true);
|
||||
return ret;
|
||||
};
|
||||
|
||||
Promise.setScheduler = function(fn) {
|
||||
if (typeof fn !== "function") {
|
||||
throw new TypeError("expecting a function but got " + util.classString(fn));
|
||||
}
|
||||
return async.setScheduler(fn);
|
||||
};
|
||||
|
||||
Promise.prototype._then = function (
|
||||
didFulfill,
|
||||
didReject,
|
||||
_, receiver,
|
||||
internalData
|
||||
) {
|
||||
var haveInternalData = internalData !== undefined;
|
||||
var promise = haveInternalData ? internalData : new Promise(INTERNAL);
|
||||
var target = this._target();
|
||||
var bitField = target._bitField;
|
||||
|
||||
if (!haveInternalData) {
|
||||
promise._propagateFrom(this, 3);
|
||||
promise._captureStackTrace();
|
||||
if (receiver === undefined &&
|
||||
((this._bitField & 2097152) !== 0)) {
|
||||
if (!((bitField & 50397184) === 0)) {
|
||||
receiver = this._boundValue();
|
||||
} else {
|
||||
receiver = target === this ? undefined : this._boundTo;
|
||||
}
|
||||
}
|
||||
this._fireEvent("promiseChained", this, promise);
|
||||
}
|
||||
|
||||
var context = getContext();
|
||||
if (!((bitField & 50397184) === 0)) {
|
||||
var handler, value, settler = target._settlePromiseCtx;
|
||||
if (((bitField & 33554432) !== 0)) {
|
||||
value = target._rejectionHandler0;
|
||||
handler = didFulfill;
|
||||
} else if (((bitField & 16777216) !== 0)) {
|
||||
value = target._fulfillmentHandler0;
|
||||
handler = didReject;
|
||||
target._unsetRejectionIsUnhandled();
|
||||
} else {
|
||||
settler = target._settlePromiseLateCancellationObserver;
|
||||
value = new CancellationError("late cancellation observer");
|
||||
target._attachExtraTrace(value);
|
||||
handler = didReject;
|
||||
}
|
||||
|
||||
async.invoke(settler, target, {
|
||||
handler: util.contextBind(context, handler),
|
||||
promise: promise,
|
||||
receiver: receiver,
|
||||
value: value
|
||||
});
|
||||
} else {
|
||||
target._addCallbacks(didFulfill, didReject, promise,
|
||||
receiver, context);
|
||||
}
|
||||
|
||||
return promise;
|
||||
};
|
||||
|
||||
Promise.prototype._length = function () {
|
||||
return this._bitField & 65535;
|
||||
};
|
||||
|
||||
Promise.prototype._isFateSealed = function () {
|
||||
return (this._bitField & 117506048) !== 0;
|
||||
};
|
||||
|
||||
Promise.prototype._isFollowing = function () {
|
||||
return (this._bitField & 67108864) === 67108864;
|
||||
};
|
||||
|
||||
Promise.prototype._setLength = function (len) {
|
||||
this._bitField = (this._bitField & -65536) |
|
||||
(len & 65535);
|
||||
};
|
||||
|
||||
Promise.prototype._setFulfilled = function () {
|
||||
this._bitField = this._bitField | 33554432;
|
||||
this._fireEvent("promiseFulfilled", this);
|
||||
};
|
||||
|
||||
Promise.prototype._setRejected = function () {
|
||||
this._bitField = this._bitField | 16777216;
|
||||
this._fireEvent("promiseRejected", this);
|
||||
};
|
||||
|
||||
Promise.prototype._setFollowing = function () {
|
||||
this._bitField = this._bitField | 67108864;
|
||||
this._fireEvent("promiseResolved", this);
|
||||
};
|
||||
|
||||
Promise.prototype._setIsFinal = function () {
|
||||
this._bitField = this._bitField | 4194304;
|
||||
};
|
||||
|
||||
Promise.prototype._isFinal = function () {
|
||||
return (this._bitField & 4194304) > 0;
|
||||
};
|
||||
|
||||
Promise.prototype._unsetCancelled = function() {
|
||||
this._bitField = this._bitField & (~65536);
|
||||
};
|
||||
|
||||
Promise.prototype._setCancelled = function() {
|
||||
this._bitField = this._bitField | 65536;
|
||||
this._fireEvent("promiseCancelled", this);
|
||||
};
|
||||
|
||||
Promise.prototype._setWillBeCancelled = function() {
|
||||
this._bitField = this._bitField | 8388608;
|
||||
};
|
||||
|
||||
Promise.prototype._setAsyncGuaranteed = function() {
|
||||
if (async.hasCustomScheduler()) return;
|
||||
var bitField = this._bitField;
|
||||
this._bitField = bitField |
|
||||
(((bitField & 536870912) >> 2) ^
|
||||
134217728);
|
||||
};
|
||||
|
||||
Promise.prototype._setNoAsyncGuarantee = function() {
|
||||
this._bitField = (this._bitField | 536870912) &
|
||||
(~134217728);
|
||||
};
|
||||
|
||||
Promise.prototype._receiverAt = function (index) {
|
||||
var ret = index === 0 ? this._receiver0 : this[
|
||||
index * 4 - 4 + 3];
|
||||
if (ret === UNDEFINED_BINDING) {
|
||||
return undefined;
|
||||
} else if (ret === undefined && this._isBound()) {
|
||||
return this._boundValue();
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
Promise.prototype._promiseAt = function (index) {
|
||||
return this[
|
||||
index * 4 - 4 + 2];
|
||||
};
|
||||
|
||||
Promise.prototype._fulfillmentHandlerAt = function (index) {
|
||||
return this[
|
||||
index * 4 - 4 + 0];
|
||||
};
|
||||
|
||||
Promise.prototype._rejectionHandlerAt = function (index) {
|
||||
return this[
|
||||
index * 4 - 4 + 1];
|
||||
};
|
||||
|
||||
Promise.prototype._boundValue = function() {};
|
||||
|
||||
Promise.prototype._migrateCallback0 = function (follower) {
|
||||
var bitField = follower._bitField;
|
||||
var fulfill = follower._fulfillmentHandler0;
|
||||
var reject = follower._rejectionHandler0;
|
||||
var promise = follower._promise0;
|
||||
var receiver = follower._receiverAt(0);
|
||||
if (receiver === undefined) receiver = UNDEFINED_BINDING;
|
||||
this._addCallbacks(fulfill, reject, promise, receiver, null);
|
||||
};
|
||||
|
||||
Promise.prototype._migrateCallbackAt = function (follower, index) {
|
||||
var fulfill = follower._fulfillmentHandlerAt(index);
|
||||
var reject = follower._rejectionHandlerAt(index);
|
||||
var promise = follower._promiseAt(index);
|
||||
var receiver = follower._receiverAt(index);
|
||||
if (receiver === undefined) receiver = UNDEFINED_BINDING;
|
||||
this._addCallbacks(fulfill, reject, promise, receiver, null);
|
||||
};
|
||||
|
||||
Promise.prototype._addCallbacks = function (
|
||||
fulfill,
|
||||
reject,
|
||||
promise,
|
||||
receiver,
|
||||
context
|
||||
) {
|
||||
var index = this._length();
|
||||
|
||||
if (index >= 65535 - 4) {
|
||||
index = 0;
|
||||
this._setLength(0);
|
||||
}
|
||||
|
||||
if (index === 0) {
|
||||
this._promise0 = promise;
|
||||
this._receiver0 = receiver;
|
||||
if (typeof fulfill === "function") {
|
||||
this._fulfillmentHandler0 = util.contextBind(context, fulfill);
|
||||
}
|
||||
if (typeof reject === "function") {
|
||||
this._rejectionHandler0 = util.contextBind(context, reject);
|
||||
}
|
||||
} else {
|
||||
var base = index * 4 - 4;
|
||||
this[base + 2] = promise;
|
||||
this[base + 3] = receiver;
|
||||
if (typeof fulfill === "function") {
|
||||
this[base + 0] =
|
||||
util.contextBind(context, fulfill);
|
||||
}
|
||||
if (typeof reject === "function") {
|
||||
this[base + 1] =
|
||||
util.contextBind(context, reject);
|
||||
}
|
||||
}
|
||||
this._setLength(index + 1);
|
||||
return index;
|
||||
};
|
||||
|
||||
Promise.prototype._proxy = function (proxyable, arg) {
|
||||
this._addCallbacks(undefined, undefined, arg, proxyable, null);
|
||||
};
|
||||
|
||||
Promise.prototype._resolveCallback = function(value, shouldBind) {
|
||||
if (((this._bitField & 117506048) !== 0)) return;
|
||||
if (value === this)
|
||||
return this._rejectCallback(makeSelfResolutionError(), false);
|
||||
var maybePromise = tryConvertToPromise(value, this);
|
||||
if (!(maybePromise instanceof Promise)) return this._fulfill(value);
|
||||
|
||||
if (shouldBind) this._propagateFrom(maybePromise, 2);
|
||||
|
||||
|
||||
var promise = maybePromise._target();
|
||||
|
||||
if (promise === this) {
|
||||
this._reject(makeSelfResolutionError());
|
||||
return;
|
||||
}
|
||||
|
||||
var bitField = promise._bitField;
|
||||
if (((bitField & 50397184) === 0)) {
|
||||
var len = this._length();
|
||||
if (len > 0) promise._migrateCallback0(this);
|
||||
for (var i = 1; i < len; ++i) {
|
||||
promise._migrateCallbackAt(this, i);
|
||||
}
|
||||
this._setFollowing();
|
||||
this._setLength(0);
|
||||
this._setFollowee(maybePromise);
|
||||
} else if (((bitField & 33554432) !== 0)) {
|
||||
this._fulfill(promise._value());
|
||||
} else if (((bitField & 16777216) !== 0)) {
|
||||
this._reject(promise._reason());
|
||||
} else {
|
||||
var reason = new CancellationError("late cancellation observer");
|
||||
promise._attachExtraTrace(reason);
|
||||
this._reject(reason);
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._rejectCallback =
|
||||
function(reason, synchronous, ignoreNonErrorWarnings) {
|
||||
var trace = util.ensureErrorObject(reason);
|
||||
var hasStack = trace === reason;
|
||||
if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
|
||||
var message = "a promise was rejected with a non-error: " +
|
||||
util.classString(reason);
|
||||
this._warn(message, true);
|
||||
}
|
||||
this._attachExtraTrace(trace, synchronous ? hasStack : false);
|
||||
this._reject(reason);
|
||||
};
|
||||
|
||||
Promise.prototype._resolveFromExecutor = function (executor) {
|
||||
if (executor === INTERNAL) return;
|
||||
var promise = this;
|
||||
this._captureStackTrace();
|
||||
this._pushContext();
|
||||
var synchronous = true;
|
||||
var r = this._execute(executor, function(value) {
|
||||
promise._resolveCallback(value);
|
||||
}, function (reason) {
|
||||
promise._rejectCallback(reason, synchronous);
|
||||
});
|
||||
synchronous = false;
|
||||
this._popContext();
|
||||
|
||||
if (r !== undefined) {
|
||||
promise._rejectCallback(r, true);
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._settlePromiseFromHandler = function (
|
||||
handler, receiver, value, promise
|
||||
) {
|
||||
var bitField = promise._bitField;
|
||||
if (((bitField & 65536) !== 0)) return;
|
||||
promise._pushContext();
|
||||
var x;
|
||||
if (receiver === APPLY) {
|
||||
if (!value || typeof value.length !== "number") {
|
||||
x = errorObj;
|
||||
x.e = new TypeError("cannot .spread() a non-array: " +
|
||||
util.classString(value));
|
||||
} else {
|
||||
x = tryCatch(handler).apply(this._boundValue(), value);
|
||||
}
|
||||
} else {
|
||||
x = tryCatch(handler).call(receiver, value);
|
||||
}
|
||||
var promiseCreated = promise._popContext();
|
||||
bitField = promise._bitField;
|
||||
if (((bitField & 65536) !== 0)) return;
|
||||
|
||||
if (x === NEXT_FILTER) {
|
||||
promise._reject(value);
|
||||
} else if (x === errorObj) {
|
||||
promise._rejectCallback(x.e, false);
|
||||
} else {
|
||||
debug.checkForgottenReturns(x, promiseCreated, "", promise, this);
|
||||
promise._resolveCallback(x);
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._target = function() {
|
||||
var ret = this;
|
||||
while (ret._isFollowing()) ret = ret._followee();
|
||||
return ret;
|
||||
};
|
||||
|
||||
Promise.prototype._followee = function() {
|
||||
return this._rejectionHandler0;
|
||||
};
|
||||
|
||||
Promise.prototype._setFollowee = function(promise) {
|
||||
this._rejectionHandler0 = promise;
|
||||
};
|
||||
|
||||
Promise.prototype._settlePromise = function(promise, handler, receiver, value) {
|
||||
var isPromise = promise instanceof Promise;
|
||||
var bitField = this._bitField;
|
||||
var asyncGuaranteed = ((bitField & 134217728) !== 0);
|
||||
if (((bitField & 65536) !== 0)) {
|
||||
if (isPromise) promise._invokeInternalOnCancel();
|
||||
|
||||
if (receiver instanceof PassThroughHandlerContext &&
|
||||
receiver.isFinallyHandler()) {
|
||||
receiver.cancelPromise = promise;
|
||||
if (tryCatch(handler).call(receiver, value) === errorObj) {
|
||||
promise._reject(errorObj.e);
|
||||
}
|
||||
} else if (handler === reflectHandler) {
|
||||
promise._fulfill(reflectHandler.call(receiver));
|
||||
} else if (receiver instanceof Proxyable) {
|
||||
receiver._promiseCancelled(promise);
|
||||
} else if (isPromise || promise instanceof PromiseArray) {
|
||||
promise._cancel();
|
||||
} else {
|
||||
receiver.cancel();
|
||||
}
|
||||
} else if (typeof handler === "function") {
|
||||
if (!isPromise) {
|
||||
handler.call(receiver, value, promise);
|
||||
} else {
|
||||
if (asyncGuaranteed) promise._setAsyncGuaranteed();
|
||||
this._settlePromiseFromHandler(handler, receiver, value, promise);
|
||||
}
|
||||
} else if (receiver instanceof Proxyable) {
|
||||
if (!receiver._isResolved()) {
|
||||
if (((bitField & 33554432) !== 0)) {
|
||||
receiver._promiseFulfilled(value, promise);
|
||||
} else {
|
||||
receiver._promiseRejected(value, promise);
|
||||
}
|
||||
}
|
||||
} else if (isPromise) {
|
||||
if (asyncGuaranteed) promise._setAsyncGuaranteed();
|
||||
if (((bitField & 33554432) !== 0)) {
|
||||
promise._fulfill(value);
|
||||
} else {
|
||||
promise._reject(value);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) {
|
||||
var handler = ctx.handler;
|
||||
var promise = ctx.promise;
|
||||
var receiver = ctx.receiver;
|
||||
var value = ctx.value;
|
||||
if (typeof handler === "function") {
|
||||
if (!(promise instanceof Promise)) {
|
||||
handler.call(receiver, value, promise);
|
||||
} else {
|
||||
this._settlePromiseFromHandler(handler, receiver, value, promise);
|
||||
}
|
||||
} else if (promise instanceof Promise) {
|
||||
promise._reject(value);
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._settlePromiseCtx = function(ctx) {
|
||||
this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
|
||||
};
|
||||
|
||||
Promise.prototype._settlePromise0 = function(handler, value, bitField) {
|
||||
var promise = this._promise0;
|
||||
var receiver = this._receiverAt(0);
|
||||
this._promise0 = undefined;
|
||||
this._receiver0 = undefined;
|
||||
this._settlePromise(promise, handler, receiver, value);
|
||||
};
|
||||
|
||||
Promise.prototype._clearCallbackDataAtIndex = function(index) {
|
||||
var base = index * 4 - 4;
|
||||
this[base + 2] =
|
||||
this[base + 3] =
|
||||
this[base + 0] =
|
||||
this[base + 1] = undefined;
|
||||
};
|
||||
|
||||
Promise.prototype._fulfill = function (value) {
|
||||
var bitField = this._bitField;
|
||||
if (((bitField & 117506048) >>> 16)) return;
|
||||
if (value === this) {
|
||||
var err = makeSelfResolutionError();
|
||||
this._attachExtraTrace(err);
|
||||
return this._reject(err);
|
||||
}
|
||||
this._setFulfilled();
|
||||
this._rejectionHandler0 = value;
|
||||
|
||||
if ((bitField & 65535) > 0) {
|
||||
if (((bitField & 134217728) !== 0)) {
|
||||
this._settlePromises();
|
||||
} else {
|
||||
async.settlePromises(this);
|
||||
}
|
||||
this._dereferenceTrace();
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._reject = function (reason) {
|
||||
var bitField = this._bitField;
|
||||
if (((bitField & 117506048) >>> 16)) return;
|
||||
this._setRejected();
|
||||
this._fulfillmentHandler0 = reason;
|
||||
|
||||
if (this._isFinal()) {
|
||||
return async.fatalError(reason, util.isNode);
|
||||
}
|
||||
|
||||
if ((bitField & 65535) > 0) {
|
||||
async.settlePromises(this);
|
||||
} else {
|
||||
this._ensurePossibleRejectionHandled();
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._fulfillPromises = function (len, value) {
|
||||
for (var i = 1; i < len; i++) {
|
||||
var handler = this._fulfillmentHandlerAt(i);
|
||||
var promise = this._promiseAt(i);
|
||||
var receiver = this._receiverAt(i);
|
||||
this._clearCallbackDataAtIndex(i);
|
||||
this._settlePromise(promise, handler, receiver, value);
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._rejectPromises = function (len, reason) {
|
||||
for (var i = 1; i < len; i++) {
|
||||
var handler = this._rejectionHandlerAt(i);
|
||||
var promise = this._promiseAt(i);
|
||||
var receiver = this._receiverAt(i);
|
||||
this._clearCallbackDataAtIndex(i);
|
||||
this._settlePromise(promise, handler, receiver, reason);
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._settlePromises = function () {
|
||||
var bitField = this._bitField;
|
||||
var len = (bitField & 65535);
|
||||
|
||||
if (len > 0) {
|
||||
if (((bitField & 16842752) !== 0)) {
|
||||
var reason = this._fulfillmentHandler0;
|
||||
this._settlePromise0(this._rejectionHandler0, reason, bitField);
|
||||
this._rejectPromises(len, reason);
|
||||
} else {
|
||||
var value = this._rejectionHandler0;
|
||||
this._settlePromise0(this._fulfillmentHandler0, value, bitField);
|
||||
this._fulfillPromises(len, value);
|
||||
}
|
||||
this._setLength(0);
|
||||
}
|
||||
this._clearCancellationData();
|
||||
};
|
||||
|
||||
Promise.prototype._settledValue = function() {
|
||||
var bitField = this._bitField;
|
||||
if (((bitField & 33554432) !== 0)) {
|
||||
return this._rejectionHandler0;
|
||||
} else if (((bitField & 16777216) !== 0)) {
|
||||
return this._fulfillmentHandler0;
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
|
||||
es5.defineProperty(Promise.prototype, Symbol.toStringTag, {
|
||||
get: function () {
|
||||
return "Object";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function deferResolve(v) {this.promise._resolveCallback(v);}
|
||||
function deferReject(v) {this.promise._rejectCallback(v, false);}
|
||||
|
||||
Promise.defer = Promise.pending = function() {
|
||||
debug.deprecated("Promise.defer", "new Promise");
|
||||
var promise = new Promise(INTERNAL);
|
||||
return {
|
||||
promise: promise,
|
||||
resolve: deferResolve,
|
||||
reject: deferReject
|
||||
};
|
||||
};
|
||||
|
||||
util.notEnumerableProp(Promise,
|
||||
"_makeSelfResolutionError",
|
||||
makeSelfResolutionError);
|
||||
|
||||
require("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection,
|
||||
debug);
|
||||
require("./bind")(Promise, INTERNAL, tryConvertToPromise, debug);
|
||||
require("./cancel")(Promise, PromiseArray, apiRejection, debug);
|
||||
require("./direct_resolve")(Promise);
|
||||
require("./synchronous_inspection")(Promise);
|
||||
require("./join")(
|
||||
Promise, PromiseArray, tryConvertToPromise, INTERNAL, async);
|
||||
Promise.Promise = Promise;
|
||||
Promise.version = "3.7.2";
|
||||
require('./call_get.js')(Promise);
|
||||
require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);
|
||||
require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
|
||||
require('./nodeify.js')(Promise);
|
||||
require('./promisify.js')(Promise, INTERNAL);
|
||||
require('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);
|
||||
require('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);
|
||||
require('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
|
||||
require('./settle.js')(Promise, PromiseArray, debug);
|
||||
require('./some.js')(Promise, PromiseArray, apiRejection);
|
||||
require('./timers.js')(Promise, INTERNAL, debug);
|
||||
require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
|
||||
require('./any.js')(Promise);
|
||||
require('./each.js')(Promise, INTERNAL);
|
||||
require('./filter.js')(Promise, INTERNAL);
|
||||
|
||||
util.toFastProperties(Promise);
|
||||
util.toFastProperties(Promise.prototype);
|
||||
function fillTypes(value) {
|
||||
var p = new Promise(INTERNAL);
|
||||
p._fulfillmentHandler0 = value;
|
||||
p._rejectionHandler0 = value;
|
||||
p._promise0 = value;
|
||||
p._receiver0 = value;
|
||||
}
|
||||
// Complete slack tracking, opt out of field-type tracking and
|
||||
// stabilize map
|
||||
fillTypes({a: 1});
|
||||
fillTypes({b: 2});
|
||||
fillTypes({c: 3});
|
||||
fillTypes(1);
|
||||
fillTypes(function(){});
|
||||
fillTypes(undefined);
|
||||
fillTypes(false);
|
||||
fillTypes(new Promise(INTERNAL));
|
||||
debug.setBounds(Async.firstLineError, util.lastLineError);
|
||||
return Promise;
|
||||
|
||||
};
|
||||
186
node_modules/bluebird/js/release/promise_array.js
generated
vendored
Normal file
186
node_modules/bluebird/js/release/promise_array.js
generated
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise, INTERNAL, tryConvertToPromise,
|
||||
apiRejection, Proxyable) {
|
||||
var util = require("./util");
|
||||
var isArray = util.isArray;
|
||||
|
||||
function toResolutionValue(val) {
|
||||
switch(val) {
|
||||
case -2: return [];
|
||||
case -3: return {};
|
||||
case -6: return new Map();
|
||||
}
|
||||
}
|
||||
|
||||
function PromiseArray(values) {
|
||||
var promise = this._promise = new Promise(INTERNAL);
|
||||
if (values instanceof Promise) {
|
||||
promise._propagateFrom(values, 3);
|
||||
values.suppressUnhandledRejections();
|
||||
}
|
||||
promise._setOnCancel(this);
|
||||
this._values = values;
|
||||
this._length = 0;
|
||||
this._totalResolved = 0;
|
||||
this._init(undefined, -2);
|
||||
}
|
||||
util.inherits(PromiseArray, Proxyable);
|
||||
|
||||
PromiseArray.prototype.length = function () {
|
||||
return this._length;
|
||||
};
|
||||
|
||||
PromiseArray.prototype.promise = function () {
|
||||
return this._promise;
|
||||
};
|
||||
|
||||
PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
|
||||
var values = tryConvertToPromise(this._values, this._promise);
|
||||
if (values instanceof Promise) {
|
||||
values = values._target();
|
||||
var bitField = values._bitField;
|
||||
;
|
||||
this._values = values;
|
||||
|
||||
if (((bitField & 50397184) === 0)) {
|
||||
this._promise._setAsyncGuaranteed();
|
||||
return values._then(
|
||||
init,
|
||||
this._reject,
|
||||
undefined,
|
||||
this,
|
||||
resolveValueIfEmpty
|
||||
);
|
||||
} else if (((bitField & 33554432) !== 0)) {
|
||||
values = values._value();
|
||||
} else if (((bitField & 16777216) !== 0)) {
|
||||
return this._reject(values._reason());
|
||||
} else {
|
||||
return this._cancel();
|
||||
}
|
||||
}
|
||||
values = util.asArray(values);
|
||||
if (values === null) {
|
||||
var err = apiRejection(
|
||||
"expecting an array or an iterable object but got " + util.classString(values)).reason();
|
||||
this._promise._rejectCallback(err, false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (values.length === 0) {
|
||||
if (resolveValueIfEmpty === -5) {
|
||||
this._resolveEmptyArray();
|
||||
}
|
||||
else {
|
||||
this._resolve(toResolutionValue(resolveValueIfEmpty));
|
||||
}
|
||||
return;
|
||||
}
|
||||
this._iterate(values);
|
||||
};
|
||||
|
||||
PromiseArray.prototype._iterate = function(values) {
|
||||
var len = this.getActualLength(values.length);
|
||||
this._length = len;
|
||||
this._values = this.shouldCopyValues() ? new Array(len) : this._values;
|
||||
var result = this._promise;
|
||||
var isResolved = false;
|
||||
var bitField = null;
|
||||
for (var i = 0; i < len; ++i) {
|
||||
var maybePromise = tryConvertToPromise(values[i], result);
|
||||
|
||||
if (maybePromise instanceof Promise) {
|
||||
maybePromise = maybePromise._target();
|
||||
bitField = maybePromise._bitField;
|
||||
} else {
|
||||
bitField = null;
|
||||
}
|
||||
|
||||
if (isResolved) {
|
||||
if (bitField !== null) {
|
||||
maybePromise.suppressUnhandledRejections();
|
||||
}
|
||||
} else if (bitField !== null) {
|
||||
if (((bitField & 50397184) === 0)) {
|
||||
maybePromise._proxy(this, i);
|
||||
this._values[i] = maybePromise;
|
||||
} else if (((bitField & 33554432) !== 0)) {
|
||||
isResolved = this._promiseFulfilled(maybePromise._value(), i);
|
||||
} else if (((bitField & 16777216) !== 0)) {
|
||||
isResolved = this._promiseRejected(maybePromise._reason(), i);
|
||||
} else {
|
||||
isResolved = this._promiseCancelled(i);
|
||||
}
|
||||
} else {
|
||||
isResolved = this._promiseFulfilled(maybePromise, i);
|
||||
}
|
||||
}
|
||||
if (!isResolved) result._setAsyncGuaranteed();
|
||||
};
|
||||
|
||||
PromiseArray.prototype._isResolved = function () {
|
||||
return this._values === null;
|
||||
};
|
||||
|
||||
PromiseArray.prototype._resolve = function (value) {
|
||||
this._values = null;
|
||||
this._promise._fulfill(value);
|
||||
};
|
||||
|
||||
PromiseArray.prototype._cancel = function() {
|
||||
if (this._isResolved() || !this._promise._isCancellable()) return;
|
||||
this._values = null;
|
||||
this._promise._cancel();
|
||||
};
|
||||
|
||||
PromiseArray.prototype._reject = function (reason) {
|
||||
this._values = null;
|
||||
this._promise._rejectCallback(reason, false);
|
||||
};
|
||||
|
||||
PromiseArray.prototype._promiseFulfilled = function (value, index) {
|
||||
this._values[index] = value;
|
||||
var totalResolved = ++this._totalResolved;
|
||||
if (totalResolved >= this._length) {
|
||||
this._resolve(this._values);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
PromiseArray.prototype._promiseCancelled = function() {
|
||||
this._cancel();
|
||||
return true;
|
||||
};
|
||||
|
||||
PromiseArray.prototype._promiseRejected = function (reason) {
|
||||
this._totalResolved++;
|
||||
this._reject(reason);
|
||||
return true;
|
||||
};
|
||||
|
||||
PromiseArray.prototype._resultCancelled = function() {
|
||||
if (this._isResolved()) return;
|
||||
var values = this._values;
|
||||
this._cancel();
|
||||
if (values instanceof Promise) {
|
||||
values.cancel();
|
||||
} else {
|
||||
for (var i = 0; i < values.length; ++i) {
|
||||
if (values[i] instanceof Promise) {
|
||||
values[i].cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PromiseArray.prototype.shouldCopyValues = function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
PromiseArray.prototype.getActualLength = function (len) {
|
||||
return len;
|
||||
};
|
||||
|
||||
return PromiseArray;
|
||||
};
|
||||
314
node_modules/bluebird/js/release/promisify.js
generated
vendored
Normal file
314
node_modules/bluebird/js/release/promisify.js
generated
vendored
Normal file
@@ -0,0 +1,314 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise, INTERNAL) {
|
||||
var THIS = {};
|
||||
var util = require("./util");
|
||||
var nodebackForPromise = require("./nodeback");
|
||||
var withAppended = util.withAppended;
|
||||
var maybeWrapAsError = util.maybeWrapAsError;
|
||||
var canEvaluate = util.canEvaluate;
|
||||
var TypeError = require("./errors").TypeError;
|
||||
var defaultSuffix = "Async";
|
||||
var defaultPromisified = {__isPromisified__: true};
|
||||
var noCopyProps = [
|
||||
"arity", "length",
|
||||
"name",
|
||||
"arguments",
|
||||
"caller",
|
||||
"callee",
|
||||
"prototype",
|
||||
"__isPromisified__"
|
||||
];
|
||||
var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$");
|
||||
|
||||
var defaultFilter = function(name) {
|
||||
return util.isIdentifier(name) &&
|
||||
name.charAt(0) !== "_" &&
|
||||
name !== "constructor";
|
||||
};
|
||||
|
||||
function propsFilter(key) {
|
||||
return !noCopyPropsPattern.test(key);
|
||||
}
|
||||
|
||||
function isPromisified(fn) {
|
||||
try {
|
||||
return fn.__isPromisified__ === true;
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function hasPromisified(obj, key, suffix) {
|
||||
var val = util.getDataPropertyOrDefault(obj, key + suffix,
|
||||
defaultPromisified);
|
||||
return val ? isPromisified(val) : false;
|
||||
}
|
||||
function checkValid(ret, suffix, suffixRegexp) {
|
||||
for (var i = 0; i < ret.length; i += 2) {
|
||||
var key = ret[i];
|
||||
if (suffixRegexp.test(key)) {
|
||||
var keyWithoutAsyncSuffix = key.replace(suffixRegexp, "");
|
||||
for (var j = 0; j < ret.length; j += 2) {
|
||||
if (ret[j] === keyWithoutAsyncSuffix) {
|
||||
throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/MqrFmX\u000a"
|
||||
.replace("%s", suffix));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function promisifiableMethods(obj, suffix, suffixRegexp, filter) {
|
||||
var keys = util.inheritedDataKeys(obj);
|
||||
var ret = [];
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
var key = keys[i];
|
||||
var value = obj[key];
|
||||
var passesDefaultFilter = filter === defaultFilter
|
||||
? true : defaultFilter(key, value, obj);
|
||||
if (typeof value === "function" &&
|
||||
!isPromisified(value) &&
|
||||
!hasPromisified(obj, key, suffix) &&
|
||||
filter(key, value, obj, passesDefaultFilter)) {
|
||||
ret.push(key, value);
|
||||
}
|
||||
}
|
||||
checkValid(ret, suffix, suffixRegexp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
var escapeIdentRegex = function(str) {
|
||||
return str.replace(/([$])/, "\\$");
|
||||
};
|
||||
|
||||
var makeNodePromisifiedEval;
|
||||
if (!false) {
|
||||
var switchCaseArgumentOrder = function(likelyArgumentCount) {
|
||||
var ret = [likelyArgumentCount];
|
||||
var min = Math.max(0, likelyArgumentCount - 1 - 3);
|
||||
for(var i = likelyArgumentCount - 1; i >= min; --i) {
|
||||
ret.push(i);
|
||||
}
|
||||
for(var i = likelyArgumentCount + 1; i <= 3; ++i) {
|
||||
ret.push(i);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
var argumentSequence = function(argumentCount) {
|
||||
return util.filledRange(argumentCount, "_arg", "");
|
||||
};
|
||||
|
||||
var parameterDeclaration = function(parameterCount) {
|
||||
return util.filledRange(
|
||||
Math.max(parameterCount, 3), "_arg", "");
|
||||
};
|
||||
|
||||
var parameterCount = function(fn) {
|
||||
if (typeof fn.length === "number") {
|
||||
return Math.max(Math.min(fn.length, 1023 + 1), 0);
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
makeNodePromisifiedEval =
|
||||
function(callback, receiver, originalName, fn, _, multiArgs) {
|
||||
var newParameterCount = Math.max(0, parameterCount(fn) - 1);
|
||||
var argumentOrder = switchCaseArgumentOrder(newParameterCount);
|
||||
var shouldProxyThis = typeof callback === "string" || receiver === THIS;
|
||||
|
||||
function generateCallForArgumentCount(count) {
|
||||
var args = argumentSequence(count).join(", ");
|
||||
var comma = count > 0 ? ", " : "";
|
||||
var ret;
|
||||
if (shouldProxyThis) {
|
||||
ret = "ret = callback.call(this, {{args}}, nodeback); break;\n";
|
||||
} else {
|
||||
ret = receiver === undefined
|
||||
? "ret = callback({{args}}, nodeback); break;\n"
|
||||
: "ret = callback.call(receiver, {{args}}, nodeback); break;\n";
|
||||
}
|
||||
return ret.replace("{{args}}", args).replace(", ", comma);
|
||||
}
|
||||
|
||||
function generateArgumentSwitchCase() {
|
||||
var ret = "";
|
||||
for (var i = 0; i < argumentOrder.length; ++i) {
|
||||
ret += "case " + argumentOrder[i] +":" +
|
||||
generateCallForArgumentCount(argumentOrder[i]);
|
||||
}
|
||||
|
||||
ret += " \n\
|
||||
default: \n\
|
||||
var args = new Array(len + 1); \n\
|
||||
var i = 0; \n\
|
||||
for (var i = 0; i < len; ++i) { \n\
|
||||
args[i] = arguments[i]; \n\
|
||||
} \n\
|
||||
args[i] = nodeback; \n\
|
||||
[CodeForCall] \n\
|
||||
break; \n\
|
||||
".replace("[CodeForCall]", (shouldProxyThis
|
||||
? "ret = callback.apply(this, args);\n"
|
||||
: "ret = callback.apply(receiver, args);\n"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
var getFunctionCode = typeof callback === "string"
|
||||
? ("this != null ? this['"+callback+"'] : fn")
|
||||
: "fn";
|
||||
var body = "'use strict'; \n\
|
||||
var ret = function (Parameters) { \n\
|
||||
'use strict'; \n\
|
||||
var len = arguments.length; \n\
|
||||
var promise = new Promise(INTERNAL); \n\
|
||||
promise._captureStackTrace(); \n\
|
||||
var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n\
|
||||
var ret; \n\
|
||||
var callback = tryCatch([GetFunctionCode]); \n\
|
||||
switch(len) { \n\
|
||||
[CodeForSwitchCase] \n\
|
||||
} \n\
|
||||
if (ret === errorObj) { \n\
|
||||
promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\
|
||||
} \n\
|
||||
if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n\
|
||||
return promise; \n\
|
||||
}; \n\
|
||||
notEnumerableProp(ret, '__isPromisified__', true); \n\
|
||||
return ret; \n\
|
||||
".replace("[CodeForSwitchCase]", generateArgumentSwitchCase())
|
||||
.replace("[GetFunctionCode]", getFunctionCode);
|
||||
body = body.replace("Parameters", parameterDeclaration(newParameterCount));
|
||||
return new Function("Promise",
|
||||
"fn",
|
||||
"receiver",
|
||||
"withAppended",
|
||||
"maybeWrapAsError",
|
||||
"nodebackForPromise",
|
||||
"tryCatch",
|
||||
"errorObj",
|
||||
"notEnumerableProp",
|
||||
"INTERNAL",
|
||||
body)(
|
||||
Promise,
|
||||
fn,
|
||||
receiver,
|
||||
withAppended,
|
||||
maybeWrapAsError,
|
||||
nodebackForPromise,
|
||||
util.tryCatch,
|
||||
util.errorObj,
|
||||
util.notEnumerableProp,
|
||||
INTERNAL);
|
||||
};
|
||||
}
|
||||
|
||||
function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {
|
||||
var defaultThis = (function() {return this;})();
|
||||
var method = callback;
|
||||
if (typeof method === "string") {
|
||||
callback = fn;
|
||||
}
|
||||
function promisified() {
|
||||
var _receiver = receiver;
|
||||
if (receiver === THIS) _receiver = this;
|
||||
var promise = new Promise(INTERNAL);
|
||||
promise._captureStackTrace();
|
||||
var cb = typeof method === "string" && this !== defaultThis
|
||||
? this[method] : callback;
|
||||
var fn = nodebackForPromise(promise, multiArgs);
|
||||
try {
|
||||
cb.apply(_receiver, withAppended(arguments, fn));
|
||||
} catch(e) {
|
||||
promise._rejectCallback(maybeWrapAsError(e), true, true);
|
||||
}
|
||||
if (!promise._isFateSealed()) promise._setAsyncGuaranteed();
|
||||
return promise;
|
||||
}
|
||||
util.notEnumerableProp(promisified, "__isPromisified__", true);
|
||||
return promisified;
|
||||
}
|
||||
|
||||
var makeNodePromisified = canEvaluate
|
||||
? makeNodePromisifiedEval
|
||||
: makeNodePromisifiedClosure;
|
||||
|
||||
function promisifyAll(obj, suffix, filter, promisifier, multiArgs) {
|
||||
var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$");
|
||||
var methods =
|
||||
promisifiableMethods(obj, suffix, suffixRegexp, filter);
|
||||
|
||||
for (var i = 0, len = methods.length; i < len; i+= 2) {
|
||||
var key = methods[i];
|
||||
var fn = methods[i+1];
|
||||
var promisifiedKey = key + suffix;
|
||||
if (promisifier === makeNodePromisified) {
|
||||
obj[promisifiedKey] =
|
||||
makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
|
||||
} else {
|
||||
var promisified = promisifier(fn, function() {
|
||||
return makeNodePromisified(key, THIS, key,
|
||||
fn, suffix, multiArgs);
|
||||
});
|
||||
util.notEnumerableProp(promisified, "__isPromisified__", true);
|
||||
obj[promisifiedKey] = promisified;
|
||||
}
|
||||
}
|
||||
util.toFastProperties(obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
function promisify(callback, receiver, multiArgs) {
|
||||
return makeNodePromisified(callback, receiver, undefined,
|
||||
callback, null, multiArgs);
|
||||
}
|
||||
|
||||
Promise.promisify = function (fn, options) {
|
||||
if (typeof fn !== "function") {
|
||||
throw new TypeError("expecting a function but got " + util.classString(fn));
|
||||
}
|
||||
if (isPromisified(fn)) {
|
||||
return fn;
|
||||
}
|
||||
options = Object(options);
|
||||
var receiver = options.context === undefined ? THIS : options.context;
|
||||
var multiArgs = !!options.multiArgs;
|
||||
var ret = promisify(fn, receiver, multiArgs);
|
||||
util.copyDescriptors(fn, ret, propsFilter);
|
||||
return ret;
|
||||
};
|
||||
|
||||
Promise.promisifyAll = function (target, options) {
|
||||
if (typeof target !== "function" && typeof target !== "object") {
|
||||
throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||
}
|
||||
options = Object(options);
|
||||
var multiArgs = !!options.multiArgs;
|
||||
var suffix = options.suffix;
|
||||
if (typeof suffix !== "string") suffix = defaultSuffix;
|
||||
var filter = options.filter;
|
||||
if (typeof filter !== "function") filter = defaultFilter;
|
||||
var promisifier = options.promisifier;
|
||||
if (typeof promisifier !== "function") promisifier = makeNodePromisified;
|
||||
|
||||
if (!util.isIdentifier(suffix)) {
|
||||
throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||
}
|
||||
|
||||
var keys = util.inheritedDataKeys(target);
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
var value = target[keys[i]];
|
||||
if (keys[i] !== "constructor" &&
|
||||
util.isClass(value)) {
|
||||
promisifyAll(value.prototype, suffix, filter, promisifier,
|
||||
multiArgs);
|
||||
promisifyAll(value, suffix, filter, promisifier, multiArgs);
|
||||
}
|
||||
}
|
||||
|
||||
return promisifyAll(target, suffix, filter, promisifier, multiArgs);
|
||||
};
|
||||
};
|
||||
|
||||
118
node_modules/bluebird/js/release/props.js
generated
vendored
Normal file
118
node_modules/bluebird/js/release/props.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
"use strict";
|
||||
module.exports = function(
|
||||
Promise, PromiseArray, tryConvertToPromise, apiRejection) {
|
||||
var util = require("./util");
|
||||
var isObject = util.isObject;
|
||||
var es5 = require("./es5");
|
||||
var Es6Map;
|
||||
if (typeof Map === "function") Es6Map = Map;
|
||||
|
||||
var mapToEntries = (function() {
|
||||
var index = 0;
|
||||
var size = 0;
|
||||
|
||||
function extractEntry(value, key) {
|
||||
this[index] = value;
|
||||
this[index + size] = key;
|
||||
index++;
|
||||
}
|
||||
|
||||
return function mapToEntries(map) {
|
||||
size = map.size;
|
||||
index = 0;
|
||||
var ret = new Array(map.size * 2);
|
||||
map.forEach(extractEntry, ret);
|
||||
return ret;
|
||||
};
|
||||
})();
|
||||
|
||||
var entriesToMap = function(entries) {
|
||||
var ret = new Es6Map();
|
||||
var length = entries.length / 2 | 0;
|
||||
for (var i = 0; i < length; ++i) {
|
||||
var key = entries[length + i];
|
||||
var value = entries[i];
|
||||
ret.set(key, value);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
function PropertiesPromiseArray(obj) {
|
||||
var isMap = false;
|
||||
var entries;
|
||||
if (Es6Map !== undefined && obj instanceof Es6Map) {
|
||||
entries = mapToEntries(obj);
|
||||
isMap = true;
|
||||
} else {
|
||||
var keys = es5.keys(obj);
|
||||
var len = keys.length;
|
||||
entries = new Array(len * 2);
|
||||
for (var i = 0; i < len; ++i) {
|
||||
var key = keys[i];
|
||||
entries[i] = obj[key];
|
||||
entries[i + len] = key;
|
||||
}
|
||||
}
|
||||
this.constructor$(entries);
|
||||
this._isMap = isMap;
|
||||
this._init$(undefined, isMap ? -6 : -3);
|
||||
}
|
||||
util.inherits(PropertiesPromiseArray, PromiseArray);
|
||||
|
||||
PropertiesPromiseArray.prototype._init = function () {};
|
||||
|
||||
PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {
|
||||
this._values[index] = value;
|
||||
var totalResolved = ++this._totalResolved;
|
||||
if (totalResolved >= this._length) {
|
||||
var val;
|
||||
if (this._isMap) {
|
||||
val = entriesToMap(this._values);
|
||||
} else {
|
||||
val = {};
|
||||
var keyOffset = this.length();
|
||||
for (var i = 0, len = this.length(); i < len; ++i) {
|
||||
val[this._values[i + keyOffset]] = this._values[i];
|
||||
}
|
||||
}
|
||||
this._resolve(val);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
PropertiesPromiseArray.prototype.shouldCopyValues = function () {
|
||||
return false;
|
||||
};
|
||||
|
||||
PropertiesPromiseArray.prototype.getActualLength = function (len) {
|
||||
return len >> 1;
|
||||
};
|
||||
|
||||
function props(promises) {
|
||||
var ret;
|
||||
var castValue = tryConvertToPromise(promises);
|
||||
|
||||
if (!isObject(castValue)) {
|
||||
return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||
} else if (castValue instanceof Promise) {
|
||||
ret = castValue._then(
|
||||
Promise.props, undefined, undefined, undefined, undefined);
|
||||
} else {
|
||||
ret = new PropertiesPromiseArray(castValue).promise();
|
||||
}
|
||||
|
||||
if (castValue instanceof Promise) {
|
||||
ret._propagateFrom(castValue, 2);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Promise.prototype.props = function () {
|
||||
return props(this);
|
||||
};
|
||||
|
||||
Promise.props = function (promises) {
|
||||
return props(promises);
|
||||
};
|
||||
};
|
||||
73
node_modules/bluebird/js/release/queue.js
generated
vendored
Normal file
73
node_modules/bluebird/js/release/queue.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
function arrayMove(src, srcIndex, dst, dstIndex, len) {
|
||||
for (var j = 0; j < len; ++j) {
|
||||
dst[j + dstIndex] = src[j + srcIndex];
|
||||
src[j + srcIndex] = void 0;
|
||||
}
|
||||
}
|
||||
|
||||
function Queue(capacity) {
|
||||
this._capacity = capacity;
|
||||
this._length = 0;
|
||||
this._front = 0;
|
||||
}
|
||||
|
||||
Queue.prototype._willBeOverCapacity = function (size) {
|
||||
return this._capacity < size;
|
||||
};
|
||||
|
||||
Queue.prototype._pushOne = function (arg) {
|
||||
var length = this.length();
|
||||
this._checkCapacity(length + 1);
|
||||
var i = (this._front + length) & (this._capacity - 1);
|
||||
this[i] = arg;
|
||||
this._length = length + 1;
|
||||
};
|
||||
|
||||
Queue.prototype.push = function (fn, receiver, arg) {
|
||||
var length = this.length() + 3;
|
||||
if (this._willBeOverCapacity(length)) {
|
||||
this._pushOne(fn);
|
||||
this._pushOne(receiver);
|
||||
this._pushOne(arg);
|
||||
return;
|
||||
}
|
||||
var j = this._front + length - 3;
|
||||
this._checkCapacity(length);
|
||||
var wrapMask = this._capacity - 1;
|
||||
this[(j + 0) & wrapMask] = fn;
|
||||
this[(j + 1) & wrapMask] = receiver;
|
||||
this[(j + 2) & wrapMask] = arg;
|
||||
this._length = length;
|
||||
};
|
||||
|
||||
Queue.prototype.shift = function () {
|
||||
var front = this._front,
|
||||
ret = this[front];
|
||||
|
||||
this[front] = undefined;
|
||||
this._front = (front + 1) & (this._capacity - 1);
|
||||
this._length--;
|
||||
return ret;
|
||||
};
|
||||
|
||||
Queue.prototype.length = function () {
|
||||
return this._length;
|
||||
};
|
||||
|
||||
Queue.prototype._checkCapacity = function (size) {
|
||||
if (this._capacity < size) {
|
||||
this._resizeTo(this._capacity << 1);
|
||||
}
|
||||
};
|
||||
|
||||
Queue.prototype._resizeTo = function (capacity) {
|
||||
var oldCapacity = this._capacity;
|
||||
this._capacity = capacity;
|
||||
var front = this._front;
|
||||
var length = this._length;
|
||||
var moveItemsCount = (front + length) & (oldCapacity - 1);
|
||||
arrayMove(this, 0, this, oldCapacity, moveItemsCount);
|
||||
};
|
||||
|
||||
module.exports = Queue;
|
||||
49
node_modules/bluebird/js/release/race.js
generated
vendored
Normal file
49
node_modules/bluebird/js/release/race.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
module.exports = function(
|
||||
Promise, INTERNAL, tryConvertToPromise, apiRejection) {
|
||||
var util = require("./util");
|
||||
|
||||
var raceLater = function (promise) {
|
||||
return promise.then(function(array) {
|
||||
return race(array, promise);
|
||||
});
|
||||
};
|
||||
|
||||
function race(promises, parent) {
|
||||
var maybePromise = tryConvertToPromise(promises);
|
||||
|
||||
if (maybePromise instanceof Promise) {
|
||||
return raceLater(maybePromise);
|
||||
} else {
|
||||
promises = util.asArray(promises);
|
||||
if (promises === null)
|
||||
return apiRejection("expecting an array or an iterable object but got " + util.classString(promises));
|
||||
}
|
||||
|
||||
var ret = new Promise(INTERNAL);
|
||||
if (parent !== undefined) {
|
||||
ret._propagateFrom(parent, 3);
|
||||
}
|
||||
var fulfill = ret._fulfill;
|
||||
var reject = ret._reject;
|
||||
for (var i = 0, len = promises.length; i < len; ++i) {
|
||||
var val = promises[i];
|
||||
|
||||
if (val === undefined && !(i in promises)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Promise.cast(val)._then(fulfill, reject, undefined, ret, null);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Promise.race = function (promises) {
|
||||
return race(promises, undefined);
|
||||
};
|
||||
|
||||
Promise.prototype.race = function () {
|
||||
return race(this, undefined);
|
||||
};
|
||||
|
||||
};
|
||||
183
node_modules/bluebird/js/release/reduce.js
generated
vendored
Normal file
183
node_modules/bluebird/js/release/reduce.js
generated
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise,
|
||||
PromiseArray,
|
||||
apiRejection,
|
||||
tryConvertToPromise,
|
||||
INTERNAL,
|
||||
debug) {
|
||||
var util = require("./util");
|
||||
var tryCatch = util.tryCatch;
|
||||
|
||||
function ReductionPromiseArray(promises, fn, initialValue, _each) {
|
||||
this.constructor$(promises);
|
||||
var context = Promise._getContext();
|
||||
this._fn = util.contextBind(context, fn);
|
||||
if (initialValue !== undefined) {
|
||||
initialValue = Promise.resolve(initialValue);
|
||||
initialValue._attachCancellationCallback(this);
|
||||
}
|
||||
this._initialValue = initialValue;
|
||||
this._currentCancellable = null;
|
||||
if(_each === INTERNAL) {
|
||||
this._eachValues = Array(this._length);
|
||||
} else if (_each === 0) {
|
||||
this._eachValues = null;
|
||||
} else {
|
||||
this._eachValues = undefined;
|
||||
}
|
||||
this._promise._captureStackTrace();
|
||||
this._init$(undefined, -5);
|
||||
}
|
||||
util.inherits(ReductionPromiseArray, PromiseArray);
|
||||
|
||||
ReductionPromiseArray.prototype._gotAccum = function(accum) {
|
||||
if (this._eachValues !== undefined &&
|
||||
this._eachValues !== null &&
|
||||
accum !== INTERNAL) {
|
||||
this._eachValues.push(accum);
|
||||
}
|
||||
};
|
||||
|
||||
ReductionPromiseArray.prototype._eachComplete = function(value) {
|
||||
if (this._eachValues !== null) {
|
||||
this._eachValues.push(value);
|
||||
}
|
||||
return this._eachValues;
|
||||
};
|
||||
|
||||
ReductionPromiseArray.prototype._init = function() {};
|
||||
|
||||
ReductionPromiseArray.prototype._resolveEmptyArray = function() {
|
||||
this._resolve(this._eachValues !== undefined ? this._eachValues
|
||||
: this._initialValue);
|
||||
};
|
||||
|
||||
ReductionPromiseArray.prototype.shouldCopyValues = function () {
|
||||
return false;
|
||||
};
|
||||
|
||||
ReductionPromiseArray.prototype._resolve = function(value) {
|
||||
this._promise._resolveCallback(value);
|
||||
this._values = null;
|
||||
};
|
||||
|
||||
ReductionPromiseArray.prototype._resultCancelled = function(sender) {
|
||||
if (sender === this._initialValue) return this._cancel();
|
||||
if (this._isResolved()) return;
|
||||
this._resultCancelled$();
|
||||
if (this._currentCancellable instanceof Promise) {
|
||||
this._currentCancellable.cancel();
|
||||
}
|
||||
if (this._initialValue instanceof Promise) {
|
||||
this._initialValue.cancel();
|
||||
}
|
||||
};
|
||||
|
||||
ReductionPromiseArray.prototype._iterate = function (values) {
|
||||
this._values = values;
|
||||
var value;
|
||||
var i;
|
||||
var length = values.length;
|
||||
if (this._initialValue !== undefined) {
|
||||
value = this._initialValue;
|
||||
i = 0;
|
||||
} else {
|
||||
value = Promise.resolve(values[0]);
|
||||
i = 1;
|
||||
}
|
||||
|
||||
this._currentCancellable = value;
|
||||
|
||||
for (var j = i; j < length; ++j) {
|
||||
var maybePromise = values[j];
|
||||
if (maybePromise instanceof Promise) {
|
||||
maybePromise.suppressUnhandledRejections();
|
||||
}
|
||||
}
|
||||
|
||||
if (!value.isRejected()) {
|
||||
for (; i < length; ++i) {
|
||||
var ctx = {
|
||||
accum: null,
|
||||
value: values[i],
|
||||
index: i,
|
||||
length: length,
|
||||
array: this
|
||||
};
|
||||
|
||||
value = value._then(gotAccum, undefined, undefined, ctx, undefined);
|
||||
|
||||
if ((i & 127) === 0) {
|
||||
value._setNoAsyncGuarantee();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this._eachValues !== undefined) {
|
||||
value = value
|
||||
._then(this._eachComplete, undefined, undefined, this, undefined);
|
||||
}
|
||||
value._then(completed, completed, undefined, value, this);
|
||||
};
|
||||
|
||||
Promise.prototype.reduce = function (fn, initialValue) {
|
||||
return reduce(this, fn, initialValue, null);
|
||||
};
|
||||
|
||||
Promise.reduce = function (promises, fn, initialValue, _each) {
|
||||
return reduce(promises, fn, initialValue, _each);
|
||||
};
|
||||
|
||||
function completed(valueOrReason, array) {
|
||||
if (this.isFulfilled()) {
|
||||
array._resolve(valueOrReason);
|
||||
} else {
|
||||
array._reject(valueOrReason);
|
||||
}
|
||||
}
|
||||
|
||||
function reduce(promises, fn, initialValue, _each) {
|
||||
if (typeof fn !== "function") {
|
||||
return apiRejection("expecting a function but got " + util.classString(fn));
|
||||
}
|
||||
var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
|
||||
return array.promise();
|
||||
}
|
||||
|
||||
function gotAccum(accum) {
|
||||
this.accum = accum;
|
||||
this.array._gotAccum(accum);
|
||||
var value = tryConvertToPromise(this.value, this.array._promise);
|
||||
if (value instanceof Promise) {
|
||||
this.array._currentCancellable = value;
|
||||
return value._then(gotValue, undefined, undefined, this, undefined);
|
||||
} else {
|
||||
return gotValue.call(this, value);
|
||||
}
|
||||
}
|
||||
|
||||
function gotValue(value) {
|
||||
var array = this.array;
|
||||
var promise = array._promise;
|
||||
var fn = tryCatch(array._fn);
|
||||
promise._pushContext();
|
||||
var ret;
|
||||
if (array._eachValues !== undefined) {
|
||||
ret = fn.call(promise._boundValue(), value, this.index, this.length);
|
||||
} else {
|
||||
ret = fn.call(promise._boundValue(),
|
||||
this.accum, value, this.index, this.length);
|
||||
}
|
||||
if (ret instanceof Promise) {
|
||||
array._currentCancellable = ret;
|
||||
}
|
||||
var promiseCreated = promise._popContext();
|
||||
debug.checkForgottenReturns(
|
||||
ret,
|
||||
promiseCreated,
|
||||
array._eachValues !== undefined ? "Promise.each" : "Promise.reduce",
|
||||
promise
|
||||
);
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
62
node_modules/bluebird/js/release/schedule.js
generated
vendored
Normal file
62
node_modules/bluebird/js/release/schedule.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
var util = require("./util");
|
||||
var schedule;
|
||||
var noAsyncScheduler = function() {
|
||||
throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||
};
|
||||
var NativePromise = util.getNativePromise();
|
||||
if (util.isNode && typeof MutationObserver === "undefined") {
|
||||
var GlobalSetImmediate = global.setImmediate;
|
||||
var ProcessNextTick = process.nextTick;
|
||||
schedule = util.isRecentNode
|
||||
? function(fn) { GlobalSetImmediate.call(global, fn); }
|
||||
: function(fn) { ProcessNextTick.call(process, fn); };
|
||||
} else if (typeof NativePromise === "function" &&
|
||||
typeof NativePromise.resolve === "function") {
|
||||
var nativePromise = NativePromise.resolve();
|
||||
schedule = function(fn) {
|
||||
nativePromise.then(fn);
|
||||
};
|
||||
} else if ((typeof MutationObserver !== "undefined") &&
|
||||
!(typeof window !== "undefined" &&
|
||||
window.navigator &&
|
||||
(window.navigator.standalone || window.cordova)) &&
|
||||
("classList" in document.documentElement)) {
|
||||
schedule = (function() {
|
||||
var div = document.createElement("div");
|
||||
var opts = {attributes: true};
|
||||
var toggleScheduled = false;
|
||||
var div2 = document.createElement("div");
|
||||
var o2 = new MutationObserver(function() {
|
||||
div.classList.toggle("foo");
|
||||
toggleScheduled = false;
|
||||
});
|
||||
o2.observe(div2, opts);
|
||||
|
||||
var scheduleToggle = function() {
|
||||
if (toggleScheduled) return;
|
||||
toggleScheduled = true;
|
||||
div2.classList.toggle("foo");
|
||||
};
|
||||
|
||||
return function schedule(fn) {
|
||||
var o = new MutationObserver(function() {
|
||||
o.disconnect();
|
||||
fn();
|
||||
});
|
||||
o.observe(div, opts);
|
||||
scheduleToggle();
|
||||
};
|
||||
})();
|
||||
} else if (typeof setImmediate !== "undefined") {
|
||||
schedule = function (fn) {
|
||||
setImmediate(fn);
|
||||
};
|
||||
} else if (typeof setTimeout !== "undefined") {
|
||||
schedule = function (fn) {
|
||||
setTimeout(fn, 0);
|
||||
};
|
||||
} else {
|
||||
schedule = noAsyncScheduler;
|
||||
}
|
||||
module.exports = schedule;
|
||||
47
node_modules/bluebird/js/release/settle.js
generated
vendored
Normal file
47
node_modules/bluebird/js/release/settle.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
module.exports =
|
||||
function(Promise, PromiseArray, debug) {
|
||||
var PromiseInspection = Promise.PromiseInspection;
|
||||
var util = require("./util");
|
||||
|
||||
function SettledPromiseArray(values) {
|
||||
this.constructor$(values);
|
||||
}
|
||||
util.inherits(SettledPromiseArray, PromiseArray);
|
||||
|
||||
SettledPromiseArray.prototype._promiseResolved = function (index, inspection) {
|
||||
this._values[index] = inspection;
|
||||
var totalResolved = ++this._totalResolved;
|
||||
if (totalResolved >= this._length) {
|
||||
this._resolve(this._values);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
SettledPromiseArray.prototype._promiseFulfilled = function (value, index) {
|
||||
var ret = new PromiseInspection();
|
||||
ret._bitField = 33554432;
|
||||
ret._settledValueField = value;
|
||||
return this._promiseResolved(index, ret);
|
||||
};
|
||||
SettledPromiseArray.prototype._promiseRejected = function (reason, index) {
|
||||
var ret = new PromiseInspection();
|
||||
ret._bitField = 16777216;
|
||||
ret._settledValueField = reason;
|
||||
return this._promiseResolved(index, ret);
|
||||
};
|
||||
|
||||
Promise.settle = function (promises) {
|
||||
debug.deprecated(".settle()", ".reflect()");
|
||||
return new SettledPromiseArray(promises).promise();
|
||||
};
|
||||
|
||||
Promise.allSettled = function (promises) {
|
||||
return new SettledPromiseArray(promises).promise();
|
||||
};
|
||||
|
||||
Promise.prototype.settle = function () {
|
||||
return Promise.settle(this);
|
||||
};
|
||||
};
|
||||
148
node_modules/bluebird/js/release/some.js
generated
vendored
Normal file
148
node_modules/bluebird/js/release/some.js
generated
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
"use strict";
|
||||
module.exports =
|
||||
function(Promise, PromiseArray, apiRejection) {
|
||||
var util = require("./util");
|
||||
var RangeError = require("./errors").RangeError;
|
||||
var AggregateError = require("./errors").AggregateError;
|
||||
var isArray = util.isArray;
|
||||
var CANCELLATION = {};
|
||||
|
||||
|
||||
function SomePromiseArray(values) {
|
||||
this.constructor$(values);
|
||||
this._howMany = 0;
|
||||
this._unwrap = false;
|
||||
this._initialized = false;
|
||||
}
|
||||
util.inherits(SomePromiseArray, PromiseArray);
|
||||
|
||||
SomePromiseArray.prototype._init = function () {
|
||||
if (!this._initialized) {
|
||||
return;
|
||||
}
|
||||
if (this._howMany === 0) {
|
||||
this._resolve([]);
|
||||
return;
|
||||
}
|
||||
this._init$(undefined, -5);
|
||||
var isArrayResolved = isArray(this._values);
|
||||
if (!this._isResolved() &&
|
||||
isArrayResolved &&
|
||||
this._howMany > this._canPossiblyFulfill()) {
|
||||
this._reject(this._getRangeError(this.length()));
|
||||
}
|
||||
};
|
||||
|
||||
SomePromiseArray.prototype.init = function () {
|
||||
this._initialized = true;
|
||||
this._init();
|
||||
};
|
||||
|
||||
SomePromiseArray.prototype.setUnwrap = function () {
|
||||
this._unwrap = true;
|
||||
};
|
||||
|
||||
SomePromiseArray.prototype.howMany = function () {
|
||||
return this._howMany;
|
||||
};
|
||||
|
||||
SomePromiseArray.prototype.setHowMany = function (count) {
|
||||
this._howMany = count;
|
||||
};
|
||||
|
||||
SomePromiseArray.prototype._promiseFulfilled = function (value) {
|
||||
this._addFulfilled(value);
|
||||
if (this._fulfilled() === this.howMany()) {
|
||||
this._values.length = this.howMany();
|
||||
if (this.howMany() === 1 && this._unwrap) {
|
||||
this._resolve(this._values[0]);
|
||||
} else {
|
||||
this._resolve(this._values);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
};
|
||||
SomePromiseArray.prototype._promiseRejected = function (reason) {
|
||||
this._addRejected(reason);
|
||||
return this._checkOutcome();
|
||||
};
|
||||
|
||||
SomePromiseArray.prototype._promiseCancelled = function () {
|
||||
if (this._values instanceof Promise || this._values == null) {
|
||||
return this._cancel();
|
||||
}
|
||||
this._addRejected(CANCELLATION);
|
||||
return this._checkOutcome();
|
||||
};
|
||||
|
||||
SomePromiseArray.prototype._checkOutcome = function() {
|
||||
if (this.howMany() > this._canPossiblyFulfill()) {
|
||||
var e = new AggregateError();
|
||||
for (var i = this.length(); i < this._values.length; ++i) {
|
||||
if (this._values[i] !== CANCELLATION) {
|
||||
e.push(this._values[i]);
|
||||
}
|
||||
}
|
||||
if (e.length > 0) {
|
||||
this._reject(e);
|
||||
} else {
|
||||
this._cancel();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
SomePromiseArray.prototype._fulfilled = function () {
|
||||
return this._totalResolved;
|
||||
};
|
||||
|
||||
SomePromiseArray.prototype._rejected = function () {
|
||||
return this._values.length - this.length();
|
||||
};
|
||||
|
||||
SomePromiseArray.prototype._addRejected = function (reason) {
|
||||
this._values.push(reason);
|
||||
};
|
||||
|
||||
SomePromiseArray.prototype._addFulfilled = function (value) {
|
||||
this._values[this._totalResolved++] = value;
|
||||
};
|
||||
|
||||
SomePromiseArray.prototype._canPossiblyFulfill = function () {
|
||||
return this.length() - this._rejected();
|
||||
};
|
||||
|
||||
SomePromiseArray.prototype._getRangeError = function (count) {
|
||||
var message = "Input array must contain at least " +
|
||||
this._howMany + " items but contains only " + count + " items";
|
||||
return new RangeError(message);
|
||||
};
|
||||
|
||||
SomePromiseArray.prototype._resolveEmptyArray = function () {
|
||||
this._reject(this._getRangeError(0));
|
||||
};
|
||||
|
||||
function some(promises, howMany) {
|
||||
if ((howMany | 0) !== howMany || howMany < 0) {
|
||||
return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||
}
|
||||
var ret = new SomePromiseArray(promises);
|
||||
var promise = ret.promise();
|
||||
ret.setHowMany(howMany);
|
||||
ret.init();
|
||||
return promise;
|
||||
}
|
||||
|
||||
Promise.some = function (promises, howMany) {
|
||||
return some(promises, howMany);
|
||||
};
|
||||
|
||||
Promise.prototype.some = function (howMany) {
|
||||
return some(this, howMany);
|
||||
};
|
||||
|
||||
Promise._SomePromiseArray = SomePromiseArray;
|
||||
};
|
||||
103
node_modules/bluebird/js/release/synchronous_inspection.js
generated
vendored
Normal file
103
node_modules/bluebird/js/release/synchronous_inspection.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise) {
|
||||
function PromiseInspection(promise) {
|
||||
if (promise !== undefined) {
|
||||
promise = promise._target();
|
||||
this._bitField = promise._bitField;
|
||||
this._settledValueField = promise._isFateSealed()
|
||||
? promise._settledValue() : undefined;
|
||||
}
|
||||
else {
|
||||
this._bitField = 0;
|
||||
this._settledValueField = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
PromiseInspection.prototype._settledValue = function() {
|
||||
return this._settledValueField;
|
||||
};
|
||||
|
||||
var value = PromiseInspection.prototype.value = function () {
|
||||
if (!this.isFulfilled()) {
|
||||
throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||
}
|
||||
return this._settledValue();
|
||||
};
|
||||
|
||||
var reason = PromiseInspection.prototype.error =
|
||||
PromiseInspection.prototype.reason = function () {
|
||||
if (!this.isRejected()) {
|
||||
throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||
}
|
||||
return this._settledValue();
|
||||
};
|
||||
|
||||
var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
|
||||
return (this._bitField & 33554432) !== 0;
|
||||
};
|
||||
|
||||
var isRejected = PromiseInspection.prototype.isRejected = function () {
|
||||
return (this._bitField & 16777216) !== 0;
|
||||
};
|
||||
|
||||
var isPending = PromiseInspection.prototype.isPending = function () {
|
||||
return (this._bitField & 50397184) === 0;
|
||||
};
|
||||
|
||||
var isResolved = PromiseInspection.prototype.isResolved = function () {
|
||||
return (this._bitField & 50331648) !== 0;
|
||||
};
|
||||
|
||||
PromiseInspection.prototype.isCancelled = function() {
|
||||
return (this._bitField & 8454144) !== 0;
|
||||
};
|
||||
|
||||
Promise.prototype.__isCancelled = function() {
|
||||
return (this._bitField & 65536) === 65536;
|
||||
};
|
||||
|
||||
Promise.prototype._isCancelled = function() {
|
||||
return this._target().__isCancelled();
|
||||
};
|
||||
|
||||
Promise.prototype.isCancelled = function() {
|
||||
return (this._target()._bitField & 8454144) !== 0;
|
||||
};
|
||||
|
||||
Promise.prototype.isPending = function() {
|
||||
return isPending.call(this._target());
|
||||
};
|
||||
|
||||
Promise.prototype.isRejected = function() {
|
||||
return isRejected.call(this._target());
|
||||
};
|
||||
|
||||
Promise.prototype.isFulfilled = function() {
|
||||
return isFulfilled.call(this._target());
|
||||
};
|
||||
|
||||
Promise.prototype.isResolved = function() {
|
||||
return isResolved.call(this._target());
|
||||
};
|
||||
|
||||
Promise.prototype.value = function() {
|
||||
return value.call(this._target());
|
||||
};
|
||||
|
||||
Promise.prototype.reason = function() {
|
||||
var target = this._target();
|
||||
target._unsetRejectionIsUnhandled();
|
||||
return reason.call(target);
|
||||
};
|
||||
|
||||
Promise.prototype._value = function() {
|
||||
return this._settledValue();
|
||||
};
|
||||
|
||||
Promise.prototype._reason = function() {
|
||||
this._unsetRejectionIsUnhandled();
|
||||
return this._settledValue();
|
||||
};
|
||||
|
||||
Promise.PromiseInspection = PromiseInspection;
|
||||
};
|
||||
86
node_modules/bluebird/js/release/thenables.js
generated
vendored
Normal file
86
node_modules/bluebird/js/release/thenables.js
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise, INTERNAL) {
|
||||
var util = require("./util");
|
||||
var errorObj = util.errorObj;
|
||||
var isObject = util.isObject;
|
||||
|
||||
function tryConvertToPromise(obj, context) {
|
||||
if (isObject(obj)) {
|
||||
if (obj instanceof Promise) return obj;
|
||||
var then = getThen(obj);
|
||||
if (then === errorObj) {
|
||||
if (context) context._pushContext();
|
||||
var ret = Promise.reject(then.e);
|
||||
if (context) context._popContext();
|
||||
return ret;
|
||||
} else if (typeof then === "function") {
|
||||
if (isAnyBluebirdPromise(obj)) {
|
||||
var ret = new Promise(INTERNAL);
|
||||
obj._then(
|
||||
ret._fulfill,
|
||||
ret._reject,
|
||||
undefined,
|
||||
ret,
|
||||
null
|
||||
);
|
||||
return ret;
|
||||
}
|
||||
return doThenable(obj, then, context);
|
||||
}
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
function doGetThen(obj) {
|
||||
return obj.then;
|
||||
}
|
||||
|
||||
function getThen(obj) {
|
||||
try {
|
||||
return doGetThen(obj);
|
||||
} catch (e) {
|
||||
errorObj.e = e;
|
||||
return errorObj;
|
||||
}
|
||||
}
|
||||
|
||||
var hasProp = {}.hasOwnProperty;
|
||||
function isAnyBluebirdPromise(obj) {
|
||||
try {
|
||||
return hasProp.call(obj, "_promise0");
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function doThenable(x, then, context) {
|
||||
var promise = new Promise(INTERNAL);
|
||||
var ret = promise;
|
||||
if (context) context._pushContext();
|
||||
promise._captureStackTrace();
|
||||
if (context) context._popContext();
|
||||
var synchronous = true;
|
||||
var result = util.tryCatch(then).call(x, resolve, reject);
|
||||
synchronous = false;
|
||||
|
||||
if (promise && result === errorObj) {
|
||||
promise._rejectCallback(result.e, true, true);
|
||||
promise = null;
|
||||
}
|
||||
|
||||
function resolve(value) {
|
||||
if (!promise) return;
|
||||
promise._resolveCallback(value);
|
||||
promise = null;
|
||||
}
|
||||
|
||||
function reject(reason) {
|
||||
if (!promise) return;
|
||||
promise._rejectCallback(reason, synchronous, true);
|
||||
promise = null;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
return tryConvertToPromise;
|
||||
};
|
||||
93
node_modules/bluebird/js/release/timers.js
generated
vendored
Normal file
93
node_modules/bluebird/js/release/timers.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise, INTERNAL, debug) {
|
||||
var util = require("./util");
|
||||
var TimeoutError = Promise.TimeoutError;
|
||||
|
||||
function HandleWrapper(handle) {
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
HandleWrapper.prototype._resultCancelled = function() {
|
||||
clearTimeout(this.handle);
|
||||
};
|
||||
|
||||
var afterValue = function(value) { return delay(+this).thenReturn(value); };
|
||||
var delay = Promise.delay = function (ms, value) {
|
||||
var ret;
|
||||
var handle;
|
||||
if (value !== undefined) {
|
||||
ret = Promise.resolve(value)
|
||||
._then(afterValue, null, null, ms, undefined);
|
||||
if (debug.cancellation() && value instanceof Promise) {
|
||||
ret._setOnCancel(value);
|
||||
}
|
||||
} else {
|
||||
ret = new Promise(INTERNAL);
|
||||
handle = setTimeout(function() { ret._fulfill(); }, +ms);
|
||||
if (debug.cancellation()) {
|
||||
ret._setOnCancel(new HandleWrapper(handle));
|
||||
}
|
||||
ret._captureStackTrace();
|
||||
}
|
||||
ret._setAsyncGuaranteed();
|
||||
return ret;
|
||||
};
|
||||
|
||||
Promise.prototype.delay = function (ms) {
|
||||
return delay(ms, this);
|
||||
};
|
||||
|
||||
var afterTimeout = function (promise, message, parent) {
|
||||
var err;
|
||||
if (typeof message !== "string") {
|
||||
if (message instanceof Error) {
|
||||
err = message;
|
||||
} else {
|
||||
err = new TimeoutError("operation timed out");
|
||||
}
|
||||
} else {
|
||||
err = new TimeoutError(message);
|
||||
}
|
||||
util.markAsOriginatingFromRejection(err);
|
||||
promise._attachExtraTrace(err);
|
||||
promise._reject(err);
|
||||
|
||||
if (parent != null) {
|
||||
parent.cancel();
|
||||
}
|
||||
};
|
||||
|
||||
function successClear(value) {
|
||||
clearTimeout(this.handle);
|
||||
return value;
|
||||
}
|
||||
|
||||
function failureClear(reason) {
|
||||
clearTimeout(this.handle);
|
||||
throw reason;
|
||||
}
|
||||
|
||||
Promise.prototype.timeout = function (ms, message) {
|
||||
ms = +ms;
|
||||
var ret, parent;
|
||||
|
||||
var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {
|
||||
if (ret.isPending()) {
|
||||
afterTimeout(ret, message, parent);
|
||||
}
|
||||
}, ms));
|
||||
|
||||
if (debug.cancellation()) {
|
||||
parent = this.then();
|
||||
ret = parent._then(successClear, failureClear,
|
||||
undefined, handleWrapper, undefined);
|
||||
ret._setOnCancel(handleWrapper);
|
||||
} else {
|
||||
ret = this._then(successClear, failureClear,
|
||||
undefined, handleWrapper, undefined);
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
};
|
||||
226
node_modules/bluebird/js/release/using.js
generated
vendored
Normal file
226
node_modules/bluebird/js/release/using.js
generated
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
"use strict";
|
||||
module.exports = function (Promise, apiRejection, tryConvertToPromise,
|
||||
createContext, INTERNAL, debug) {
|
||||
var util = require("./util");
|
||||
var TypeError = require("./errors").TypeError;
|
||||
var inherits = require("./util").inherits;
|
||||
var errorObj = util.errorObj;
|
||||
var tryCatch = util.tryCatch;
|
||||
var NULL = {};
|
||||
|
||||
function thrower(e) {
|
||||
setTimeout(function(){throw e;}, 0);
|
||||
}
|
||||
|
||||
function castPreservingDisposable(thenable) {
|
||||
var maybePromise = tryConvertToPromise(thenable);
|
||||
if (maybePromise !== thenable &&
|
||||
typeof thenable._isDisposable === "function" &&
|
||||
typeof thenable._getDisposer === "function" &&
|
||||
thenable._isDisposable()) {
|
||||
maybePromise._setDisposable(thenable._getDisposer());
|
||||
}
|
||||
return maybePromise;
|
||||
}
|
||||
function dispose(resources, inspection) {
|
||||
var i = 0;
|
||||
var len = resources.length;
|
||||
var ret = new Promise(INTERNAL);
|
||||
function iterator() {
|
||||
if (i >= len) return ret._fulfill();
|
||||
var maybePromise = castPreservingDisposable(resources[i++]);
|
||||
if (maybePromise instanceof Promise &&
|
||||
maybePromise._isDisposable()) {
|
||||
try {
|
||||
maybePromise = tryConvertToPromise(
|
||||
maybePromise._getDisposer().tryDispose(inspection),
|
||||
resources.promise);
|
||||
} catch (e) {
|
||||
return thrower(e);
|
||||
}
|
||||
if (maybePromise instanceof Promise) {
|
||||
return maybePromise._then(iterator, thrower,
|
||||
null, null, null);
|
||||
}
|
||||
}
|
||||
iterator();
|
||||
}
|
||||
iterator();
|
||||
return ret;
|
||||
}
|
||||
|
||||
function Disposer(data, promise, context) {
|
||||
this._data = data;
|
||||
this._promise = promise;
|
||||
this._context = context;
|
||||
}
|
||||
|
||||
Disposer.prototype.data = function () {
|
||||
return this._data;
|
||||
};
|
||||
|
||||
Disposer.prototype.promise = function () {
|
||||
return this._promise;
|
||||
};
|
||||
|
||||
Disposer.prototype.resource = function () {
|
||||
if (this.promise().isFulfilled()) {
|
||||
return this.promise().value();
|
||||
}
|
||||
return NULL;
|
||||
};
|
||||
|
||||
Disposer.prototype.tryDispose = function(inspection) {
|
||||
var resource = this.resource();
|
||||
var context = this._context;
|
||||
if (context !== undefined) context._pushContext();
|
||||
var ret = resource !== NULL
|
||||
? this.doDispose(resource, inspection) : null;
|
||||
if (context !== undefined) context._popContext();
|
||||
this._promise._unsetDisposable();
|
||||
this._data = null;
|
||||
return ret;
|
||||
};
|
||||
|
||||
Disposer.isDisposer = function (d) {
|
||||
return (d != null &&
|
||||
typeof d.resource === "function" &&
|
||||
typeof d.tryDispose === "function");
|
||||
};
|
||||
|
||||
function FunctionDisposer(fn, promise, context) {
|
||||
this.constructor$(fn, promise, context);
|
||||
}
|
||||
inherits(FunctionDisposer, Disposer);
|
||||
|
||||
FunctionDisposer.prototype.doDispose = function (resource, inspection) {
|
||||
var fn = this.data();
|
||||
return fn.call(resource, resource, inspection);
|
||||
};
|
||||
|
||||
function maybeUnwrapDisposer(value) {
|
||||
if (Disposer.isDisposer(value)) {
|
||||
this.resources[this.index]._setDisposable(value);
|
||||
return value.promise();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function ResourceList(length) {
|
||||
this.length = length;
|
||||
this.promise = null;
|
||||
this[length-1] = null;
|
||||
}
|
||||
|
||||
ResourceList.prototype._resultCancelled = function() {
|
||||
var len = this.length;
|
||||
for (var i = 0; i < len; ++i) {
|
||||
var item = this[i];
|
||||
if (item instanceof Promise) {
|
||||
item.cancel();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Promise.using = function () {
|
||||
var len = arguments.length;
|
||||
if (len < 2) return apiRejection(
|
||||
"you must pass at least 2 arguments to Promise.using");
|
||||
var fn = arguments[len - 1];
|
||||
if (typeof fn !== "function") {
|
||||
return apiRejection("expecting a function but got " + util.classString(fn));
|
||||
}
|
||||
var input;
|
||||
var spreadArgs = true;
|
||||
if (len === 2 && Array.isArray(arguments[0])) {
|
||||
input = arguments[0];
|
||||
len = input.length;
|
||||
spreadArgs = false;
|
||||
} else {
|
||||
input = arguments;
|
||||
len--;
|
||||
}
|
||||
var resources = new ResourceList(len);
|
||||
for (var i = 0; i < len; ++i) {
|
||||
var resource = input[i];
|
||||
if (Disposer.isDisposer(resource)) {
|
||||
var disposer = resource;
|
||||
resource = resource.promise();
|
||||
resource._setDisposable(disposer);
|
||||
} else {
|
||||
var maybePromise = tryConvertToPromise(resource);
|
||||
if (maybePromise instanceof Promise) {
|
||||
resource =
|
||||
maybePromise._then(maybeUnwrapDisposer, null, null, {
|
||||
resources: resources,
|
||||
index: i
|
||||
}, undefined);
|
||||
}
|
||||
}
|
||||
resources[i] = resource;
|
||||
}
|
||||
|
||||
var reflectedResources = new Array(resources.length);
|
||||
for (var i = 0; i < reflectedResources.length; ++i) {
|
||||
reflectedResources[i] = Promise.resolve(resources[i]).reflect();
|
||||
}
|
||||
|
||||
var resultPromise = Promise.all(reflectedResources)
|
||||
.then(function(inspections) {
|
||||
for (var i = 0; i < inspections.length; ++i) {
|
||||
var inspection = inspections[i];
|
||||
if (inspection.isRejected()) {
|
||||
errorObj.e = inspection.error();
|
||||
return errorObj;
|
||||
} else if (!inspection.isFulfilled()) {
|
||||
resultPromise.cancel();
|
||||
return;
|
||||
}
|
||||
inspections[i] = inspection.value();
|
||||
}
|
||||
promise._pushContext();
|
||||
|
||||
fn = tryCatch(fn);
|
||||
var ret = spreadArgs
|
||||
? fn.apply(undefined, inspections) : fn(inspections);
|
||||
var promiseCreated = promise._popContext();
|
||||
debug.checkForgottenReturns(
|
||||
ret, promiseCreated, "Promise.using", promise);
|
||||
return ret;
|
||||
});
|
||||
|
||||
var promise = resultPromise.lastly(function() {
|
||||
var inspection = new Promise.PromiseInspection(resultPromise);
|
||||
return dispose(resources, inspection);
|
||||
});
|
||||
resources.promise = promise;
|
||||
promise._setOnCancel(resources);
|
||||
return promise;
|
||||
};
|
||||
|
||||
Promise.prototype._setDisposable = function (disposer) {
|
||||
this._bitField = this._bitField | 131072;
|
||||
this._disposer = disposer;
|
||||
};
|
||||
|
||||
Promise.prototype._isDisposable = function () {
|
||||
return (this._bitField & 131072) > 0;
|
||||
};
|
||||
|
||||
Promise.prototype._getDisposer = function () {
|
||||
return this._disposer;
|
||||
};
|
||||
|
||||
Promise.prototype._unsetDisposable = function () {
|
||||
this._bitField = this._bitField & (~131072);
|
||||
this._disposer = undefined;
|
||||
};
|
||||
|
||||
Promise.prototype.disposer = function (fn) {
|
||||
if (typeof fn === "function") {
|
||||
return new FunctionDisposer(fn, this, createContext());
|
||||
}
|
||||
throw new TypeError();
|
||||
};
|
||||
|
||||
};
|
||||
421
node_modules/bluebird/js/release/util.js
generated
vendored
Normal file
421
node_modules/bluebird/js/release/util.js
generated
vendored
Normal file
@@ -0,0 +1,421 @@
|
||||
"use strict";
|
||||
var es5 = require("./es5");
|
||||
var canEvaluate = typeof navigator == "undefined";
|
||||
|
||||
var errorObj = {e: {}};
|
||||
var tryCatchTarget;
|
||||
var globalObject = typeof self !== "undefined" ? self :
|
||||
typeof window !== "undefined" ? window :
|
||||
typeof global !== "undefined" ? global :
|
||||
this !== undefined ? this : null;
|
||||
|
||||
function tryCatcher() {
|
||||
try {
|
||||
var target = tryCatchTarget;
|
||||
tryCatchTarget = null;
|
||||
return target.apply(this, arguments);
|
||||
} catch (e) {
|
||||
errorObj.e = e;
|
||||
return errorObj;
|
||||
}
|
||||
}
|
||||
function tryCatch(fn) {
|
||||
tryCatchTarget = fn;
|
||||
return tryCatcher;
|
||||
}
|
||||
|
||||
var inherits = function(Child, Parent) {
|
||||
var hasProp = {}.hasOwnProperty;
|
||||
|
||||
function T() {
|
||||
this.constructor = Child;
|
||||
this.constructor$ = Parent;
|
||||
for (var propertyName in Parent.prototype) {
|
||||
if (hasProp.call(Parent.prototype, propertyName) &&
|
||||
propertyName.charAt(propertyName.length-1) !== "$"
|
||||
) {
|
||||
this[propertyName + "$"] = Parent.prototype[propertyName];
|
||||
}
|
||||
}
|
||||
}
|
||||
T.prototype = Parent.prototype;
|
||||
Child.prototype = new T();
|
||||
return Child.prototype;
|
||||
};
|
||||
|
||||
|
||||
function isPrimitive(val) {
|
||||
return val == null || val === true || val === false ||
|
||||
typeof val === "string" || typeof val === "number";
|
||||
|
||||
}
|
||||
|
||||
function isObject(value) {
|
||||
return typeof value === "function" ||
|
||||
typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function maybeWrapAsError(maybeError) {
|
||||
if (!isPrimitive(maybeError)) return maybeError;
|
||||
|
||||
return new Error(safeToString(maybeError));
|
||||
}
|
||||
|
||||
function withAppended(target, appendee) {
|
||||
var len = target.length;
|
||||
var ret = new Array(len + 1);
|
||||
var i;
|
||||
for (i = 0; i < len; ++i) {
|
||||
ret[i] = target[i];
|
||||
}
|
||||
ret[i] = appendee;
|
||||
return ret;
|
||||
}
|
||||
|
||||
function getDataPropertyOrDefault(obj, key, defaultValue) {
|
||||
if (es5.isES5) {
|
||||
var desc = Object.getOwnPropertyDescriptor(obj, key);
|
||||
|
||||
if (desc != null) {
|
||||
return desc.get == null && desc.set == null
|
||||
? desc.value
|
||||
: defaultValue;
|
||||
}
|
||||
} else {
|
||||
return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
function notEnumerableProp(obj, name, value) {
|
||||
if (isPrimitive(obj)) return obj;
|
||||
var descriptor = {
|
||||
value: value,
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true
|
||||
};
|
||||
es5.defineProperty(obj, name, descriptor);
|
||||
return obj;
|
||||
}
|
||||
|
||||
function thrower(r) {
|
||||
throw r;
|
||||
}
|
||||
|
||||
var inheritedDataKeys = (function() {
|
||||
var excludedPrototypes = [
|
||||
Array.prototype,
|
||||
Object.prototype,
|
||||
Function.prototype
|
||||
];
|
||||
|
||||
var isExcludedProto = function(val) {
|
||||
for (var i = 0; i < excludedPrototypes.length; ++i) {
|
||||
if (excludedPrototypes[i] === val) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
if (es5.isES5) {
|
||||
var getKeys = Object.getOwnPropertyNames;
|
||||
return function(obj) {
|
||||
var ret = [];
|
||||
var visitedKeys = Object.create(null);
|
||||
while (obj != null && !isExcludedProto(obj)) {
|
||||
var keys;
|
||||
try {
|
||||
keys = getKeys(obj);
|
||||
} catch (e) {
|
||||
return ret;
|
||||
}
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
var key = keys[i];
|
||||
if (visitedKeys[key]) continue;
|
||||
visitedKeys[key] = true;
|
||||
var desc = Object.getOwnPropertyDescriptor(obj, key);
|
||||
if (desc != null && desc.get == null && desc.set == null) {
|
||||
ret.push(key);
|
||||
}
|
||||
}
|
||||
obj = es5.getPrototypeOf(obj);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
} else {
|
||||
var hasProp = {}.hasOwnProperty;
|
||||
return function(obj) {
|
||||
if (isExcludedProto(obj)) return [];
|
||||
var ret = [];
|
||||
|
||||
/*jshint forin:false */
|
||||
enumeration: for (var key in obj) {
|
||||
if (hasProp.call(obj, key)) {
|
||||
ret.push(key);
|
||||
} else {
|
||||
for (var i = 0; i < excludedPrototypes.length; ++i) {
|
||||
if (hasProp.call(excludedPrototypes[i], key)) {
|
||||
continue enumeration;
|
||||
}
|
||||
}
|
||||
ret.push(key);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
|
||||
function isClass(fn) {
|
||||
try {
|
||||
if (typeof fn === "function") {
|
||||
var keys = es5.names(fn.prototype);
|
||||
|
||||
var hasMethods = es5.isES5 && keys.length > 1;
|
||||
var hasMethodsOtherThanConstructor = keys.length > 0 &&
|
||||
!(keys.length === 1 && keys[0] === "constructor");
|
||||
var hasThisAssignmentAndStaticMethods =
|
||||
thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
|
||||
|
||||
if (hasMethods || hasMethodsOtherThanConstructor ||
|
||||
hasThisAssignmentAndStaticMethods) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function toFastProperties(obj) {
|
||||
/*jshint -W027,-W055,-W031*/
|
||||
function FakeConstructor() {}
|
||||
FakeConstructor.prototype = obj;
|
||||
var receiver = new FakeConstructor();
|
||||
function ic() {
|
||||
return typeof receiver.foo;
|
||||
}
|
||||
ic();
|
||||
ic();
|
||||
return obj;
|
||||
eval(obj);
|
||||
}
|
||||
|
||||
var rident = /^[a-z$_][a-z$_0-9]*$/i;
|
||||
function isIdentifier(str) {
|
||||
return rident.test(str);
|
||||
}
|
||||
|
||||
function filledRange(count, prefix, suffix) {
|
||||
var ret = new Array(count);
|
||||
for(var i = 0; i < count; ++i) {
|
||||
ret[i] = prefix + i + suffix;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function safeToString(obj) {
|
||||
try {
|
||||
return obj + "";
|
||||
} catch (e) {
|
||||
return "[no string representation]";
|
||||
}
|
||||
}
|
||||
|
||||
function isError(obj) {
|
||||
return obj instanceof Error ||
|
||||
(obj !== null &&
|
||||
typeof obj === "object" &&
|
||||
typeof obj.message === "string" &&
|
||||
typeof obj.name === "string");
|
||||
}
|
||||
|
||||
function markAsOriginatingFromRejection(e) {
|
||||
try {
|
||||
notEnumerableProp(e, "isOperational", true);
|
||||
}
|
||||
catch(ignore) {}
|
||||
}
|
||||
|
||||
function originatesFromRejection(e) {
|
||||
if (e == null) return false;
|
||||
return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) ||
|
||||
e["isOperational"] === true);
|
||||
}
|
||||
|
||||
function canAttachTrace(obj) {
|
||||
return isError(obj) && es5.propertyIsWritable(obj, "stack");
|
||||
}
|
||||
|
||||
var ensureErrorObject = (function() {
|
||||
if (!("stack" in new Error())) {
|
||||
return function(value) {
|
||||
if (canAttachTrace(value)) return value;
|
||||
try {throw new Error(safeToString(value));}
|
||||
catch(err) {return err;}
|
||||
};
|
||||
} else {
|
||||
return function(value) {
|
||||
if (canAttachTrace(value)) return value;
|
||||
return new Error(safeToString(value));
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
||||
function classString(obj) {
|
||||
return {}.toString.call(obj);
|
||||
}
|
||||
|
||||
function copyDescriptors(from, to, filter) {
|
||||
var keys = es5.names(from);
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
var key = keys[i];
|
||||
if (filter(key)) {
|
||||
try {
|
||||
es5.defineProperty(to, key, es5.getDescriptor(from, key));
|
||||
} catch (ignore) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var asArray = function(v) {
|
||||
if (es5.isArray(v)) {
|
||||
return v;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
if (typeof Symbol !== "undefined" && Symbol.iterator) {
|
||||
var ArrayFrom = typeof Array.from === "function" ? function(v) {
|
||||
return Array.from(v);
|
||||
} : function(v) {
|
||||
var ret = [];
|
||||
var it = v[Symbol.iterator]();
|
||||
var itResult;
|
||||
while (!((itResult = it.next()).done)) {
|
||||
ret.push(itResult.value);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
asArray = function(v) {
|
||||
if (es5.isArray(v)) {
|
||||
return v;
|
||||
} else if (v != null && typeof v[Symbol.iterator] === "function") {
|
||||
return ArrayFrom(v);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
var isNode = typeof process !== "undefined" &&
|
||||
classString(process).toLowerCase() === "[object process]";
|
||||
|
||||
var hasEnvVariables = typeof process !== "undefined" &&
|
||||
typeof process.env !== "undefined";
|
||||
|
||||
function env(key) {
|
||||
return hasEnvVariables ? process.env[key] : undefined;
|
||||
}
|
||||
|
||||
function getNativePromise() {
|
||||
if (typeof Promise === "function") {
|
||||
try {
|
||||
var promise = new Promise(function(){});
|
||||
if (classString(promise) === "[object Promise]") {
|
||||
return Promise;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
var reflectHandler;
|
||||
function contextBind(ctx, cb) {
|
||||
if (ctx === null ||
|
||||
typeof cb !== "function" ||
|
||||
cb === reflectHandler) {
|
||||
return cb;
|
||||
}
|
||||
|
||||
if (ctx.domain !== null) {
|
||||
cb = ctx.domain.bind(cb);
|
||||
}
|
||||
|
||||
var async = ctx.async;
|
||||
if (async !== null) {
|
||||
var old = cb;
|
||||
cb = function() {
|
||||
var $_len = arguments.length + 2;var args = new Array($_len); for(var $_i = 2; $_i < $_len ; ++$_i) {args[$_i] = arguments[$_i - 2];};
|
||||
args[0] = old;
|
||||
args[1] = this;
|
||||
return async.runInAsyncScope.apply(async, args);
|
||||
};
|
||||
}
|
||||
return cb;
|
||||
}
|
||||
|
||||
var ret = {
|
||||
setReflectHandler: function(fn) {
|
||||
reflectHandler = fn;
|
||||
},
|
||||
isClass: isClass,
|
||||
isIdentifier: isIdentifier,
|
||||
inheritedDataKeys: inheritedDataKeys,
|
||||
getDataPropertyOrDefault: getDataPropertyOrDefault,
|
||||
thrower: thrower,
|
||||
isArray: es5.isArray,
|
||||
asArray: asArray,
|
||||
notEnumerableProp: notEnumerableProp,
|
||||
isPrimitive: isPrimitive,
|
||||
isObject: isObject,
|
||||
isError: isError,
|
||||
canEvaluate: canEvaluate,
|
||||
errorObj: errorObj,
|
||||
tryCatch: tryCatch,
|
||||
inherits: inherits,
|
||||
withAppended: withAppended,
|
||||
maybeWrapAsError: maybeWrapAsError,
|
||||
toFastProperties: toFastProperties,
|
||||
filledRange: filledRange,
|
||||
toString: safeToString,
|
||||
canAttachTrace: canAttachTrace,
|
||||
ensureErrorObject: ensureErrorObject,
|
||||
originatesFromRejection: originatesFromRejection,
|
||||
markAsOriginatingFromRejection: markAsOriginatingFromRejection,
|
||||
classString: classString,
|
||||
copyDescriptors: copyDescriptors,
|
||||
isNode: isNode,
|
||||
hasEnvVariables: hasEnvVariables,
|
||||
env: env,
|
||||
global: globalObject,
|
||||
getNativePromise: getNativePromise,
|
||||
contextBind: contextBind
|
||||
};
|
||||
ret.isRecentNode = ret.isNode && (function() {
|
||||
var version;
|
||||
if (process.versions && process.versions.node) {
|
||||
version = process.versions.node.split(".").map(Number);
|
||||
} else if (process.version) {
|
||||
version = process.version.split(".").map(Number);
|
||||
}
|
||||
return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
|
||||
})();
|
||||
ret.nodeSupportsAsyncResource = ret.isNode && (function() {
|
||||
var supportsAsync = false;
|
||||
try {
|
||||
var res = require("async_hooks").AsyncResource;
|
||||
supportsAsync = typeof res.prototype.runInAsyncScope === "function";
|
||||
} catch (e) {
|
||||
supportsAsync = false;
|
||||
}
|
||||
return supportsAsync;
|
||||
})();
|
||||
|
||||
if (ret.isNode) ret.toFastProperties(process);
|
||||
|
||||
try {throw new Error(); } catch (e) {ret.lastLineError = e;}
|
||||
module.exports = ret;
|
||||
78
node_modules/bluebird/package.json
generated
vendored
Normal file
78
node_modules/bluebird/package.json
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"name": "bluebird",
|
||||
"description": "Full featured Promises/A+ implementation with exceptionally good performance",
|
||||
"version": "3.7.2",
|
||||
"keywords": [
|
||||
"promise",
|
||||
"performance",
|
||||
"promises",
|
||||
"promises-a",
|
||||
"promises-aplus",
|
||||
"async",
|
||||
"await",
|
||||
"deferred",
|
||||
"deferreds",
|
||||
"future",
|
||||
"flow control",
|
||||
"dsl",
|
||||
"fluent interface"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "node scripts/jshint.js",
|
||||
"test": "node --expose-gc tools/test.js",
|
||||
"istanbul": "istanbul",
|
||||
"prepublish": "npm run generate-browser-core && npm run generate-browser-full",
|
||||
"generate-browser-full": "node tools/build.js --no-clean --no-debug --release --browser --minify",
|
||||
"generate-browser-core": "node tools/build.js --features=core --no-debug --release --zalgo --browser --minify && mv js/browser/bluebird.js js/browser/bluebird.core.js && mv js/browser/bluebird.min.js js/browser/bluebird.core.min.js"
|
||||
},
|
||||
"homepage": "https://github.com/petkaantonov/bluebird",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/petkaantonov/bluebird.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "http://github.com/petkaantonov/bluebird/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Petka Antonov",
|
||||
"email": "petka_antonov@hotmail.com",
|
||||
"url": "http://github.com/petkaantonov/"
|
||||
},
|
||||
"devDependencies": {
|
||||
"acorn": "^6.0.2",
|
||||
"acorn-walk": "^6.1.0",
|
||||
"baconjs": "^0.7.43",
|
||||
"bluebird": "^2.9.2",
|
||||
"body-parser": "^1.10.2",
|
||||
"browserify": "^8.1.1",
|
||||
"cli-table": "~0.3.1",
|
||||
"co": "^4.2.0",
|
||||
"cross-spawn": "^0.2.3",
|
||||
"glob": "^4.3.2",
|
||||
"grunt-saucelabs": "~8.4.1",
|
||||
"highland": "^2.3.0",
|
||||
"istanbul": "^0.3.5",
|
||||
"jshint": "^2.6.0",
|
||||
"jshint-stylish": "~0.2.0",
|
||||
"kefir": "^2.4.1",
|
||||
"mkdirp": "~0.5.0",
|
||||
"mocha": "~2.1",
|
||||
"open": "~0.0.5",
|
||||
"optimist": "~0.6.1",
|
||||
"rimraf": "~2.2.6",
|
||||
"rx": "^2.3.25",
|
||||
"serve-static": "^1.7.1",
|
||||
"sinon": "~1.7.3",
|
||||
"uglify-js": "~2.4.16"
|
||||
},
|
||||
"readmeFilename": "README.md",
|
||||
"main": "./js/release/bluebird.js",
|
||||
"webpack": "./js/release/bluebird.js",
|
||||
"browser": "./js/browser/bluebird.js",
|
||||
"files": [
|
||||
"js/browser",
|
||||
"js/release",
|
||||
"LICENSE"
|
||||
]
|
||||
}
|
||||
361
node_modules/commander/CHANGELOG.md
generated
vendored
Normal file
361
node_modules/commander/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,361 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). (Format adopted after v3.0.0.)
|
||||
|
||||
<!-- markdownlint-disable MD024 -->
|
||||
<!-- markdownlint-disable MD004 -->
|
||||
|
||||
## [6.2.1] (2020-12-13)
|
||||
|
||||
### Fixed
|
||||
|
||||
- some tests failed if directory path included a space ([1390])
|
||||
|
||||
## [6.2.0] (2020-10-25)
|
||||
|
||||
### Added
|
||||
|
||||
- added 'tsx' file extension for stand-alone executable subcommands ([#1368])
|
||||
- documented second parameter to `.description()` to describe command arguments ([#1353])
|
||||
- documentation of special cases with options taking varying numbers of option-arguments ([#1332])
|
||||
- documentation for terminology ([#1361])
|
||||
|
||||
### Fixed
|
||||
|
||||
- add missing TypeScript definition for `.addHelpCommand()' ([#1375])
|
||||
- removed blank line after "Arguments:" in help, to match "Options:" and "Commands:" ([#1360])
|
||||
|
||||
### Changed
|
||||
|
||||
- update dependencies
|
||||
|
||||
## [6.1.0] (2020-08-28)
|
||||
|
||||
### Added
|
||||
|
||||
- include URL to relevant section of README for error for potential conflict between Command properties and option values ([#1306])
|
||||
- `.combineFlagAndOptionalValue(false)` to ease upgrade path from older versions of Commander ([#1326])
|
||||
- allow disabling the built-in help option using `.helpOption(false)` ([#1325])
|
||||
- allow just some arguments in `argumentDescription` to `.description()` ([#1323])
|
||||
|
||||
### Changed
|
||||
|
||||
- tidy async test and remove lint override ([#1312])
|
||||
|
||||
### Fixed
|
||||
|
||||
- executable subcommand launching when script path not known ([#1322])
|
||||
|
||||
## [6.0.0] (2020-07-21)
|
||||
|
||||
### Added
|
||||
|
||||
- add support for variadic options ([#1250])
|
||||
- allow options to be added with just a short flag ([#1256])
|
||||
- *Breaking* the option property has same case as flag. e.g. flag `-n` accessed as `opts().n` (previously uppercase)
|
||||
- *Breaking* throw an error if there might be a clash between option name and a Command property, with advice on how to resolve ([#1275])
|
||||
|
||||
### Fixed
|
||||
|
||||
- Options which contain -no- in the middle of the option flag should not be treated as negatable. ([#1301])
|
||||
|
||||
## [6.0.0-0] (2020-06-20)
|
||||
|
||||
(Released in 6.0.0)
|
||||
|
||||
## [5.1.0] (2020-04-25)
|
||||
|
||||
### Added
|
||||
|
||||
- support for multiple command aliases, the first of which is shown in the auto-generated help ([#531], [#1236])
|
||||
- configuration support in `addCommand()` for `hidden` and `isDefault` ([#1232])
|
||||
|
||||
### Fixed
|
||||
|
||||
- omit masked help flags from the displayed help ([#645], [#1247])
|
||||
- remove old short help flag when change help flags using `helpOption` ([#1248])
|
||||
|
||||
### Changed
|
||||
|
||||
- remove use of `arguments` to improve auto-generated help in editors ([#1235])
|
||||
- rename `.command()` configuration `noHelp` to `hidden` (but not remove old support) ([#1232])
|
||||
- improvements to documentation
|
||||
- update dependencies
|
||||
- update tested versions of node
|
||||
- eliminate lint errors in TypeScript ([#1208])
|
||||
|
||||
## [5.0.0] (2020-03-14)
|
||||
|
||||
### Added
|
||||
|
||||
* support for nested commands with action-handlers ([#1] [#764] [#1149])
|
||||
* `.addCommand()` for adding a separately configured command ([#764] [#1149])
|
||||
* allow a non-executable to be set as the default command ([#742] [#1149])
|
||||
* implicit help command when there are subcommands (previously only if executables) ([#1149])
|
||||
* customise implicit help command with `.addHelpCommand()` ([#1149])
|
||||
* display error message for unknown subcommand, by default ([#432] [#1088] [#1149])
|
||||
* display help for missing subcommand, by default ([#1088] [#1149])
|
||||
* combined short options as single argument may include boolean flags and value flag and value (e.g. `-a -b -p 80` can be written as `-abp80`) ([#1145])
|
||||
* `.parseOption()` includes short flag and long flag expansions ([#1145])
|
||||
* `.helpInformation()` returns help text as a string, previously a private routine ([#1169])
|
||||
* `.parse()` implicitly uses `process.argv` if arguments not specified ([#1172])
|
||||
* optionally specify where `.parse()` arguments "from", if not following node conventions ([#512] [#1172])
|
||||
* suggest help option along with unknown command error ([#1179])
|
||||
* TypeScript definition for `commands` property of `Command` ([#1184])
|
||||
* export `program` property ([#1195])
|
||||
* `createCommand` factory method to simplify subclassing ([#1191])
|
||||
|
||||
### Fixed
|
||||
|
||||
* preserve argument order in subcommands ([#508] [#962] [#1138])
|
||||
* do not emit `command:*` for executable subcommands ([#809] [#1149])
|
||||
* action handler called whether or not there are non-option arguments ([#1062] [#1149])
|
||||
* combining option short flag and value in single argument now works for subcommands ([#1145])
|
||||
* only add implicit help command when it will not conflict with other uses of argument ([#1153] [#1149])
|
||||
* implicit help command works with command aliases ([#948] [#1149])
|
||||
* options are validated whether or not there is an action handler ([#1149])
|
||||
|
||||
### Changed
|
||||
|
||||
* *Breaking* `.args` contains command arguments with just recognised options removed ([#1032] [#1138])
|
||||
* *Breaking* display error if required argument for command is missing ([#995] [#1149])
|
||||
* tighten TypeScript definition of custom option processing function passed to `.option()` ([#1119])
|
||||
* *Breaking* `.allowUnknownOption()` ([#802] [#1138])
|
||||
* unknown options included in arguments passed to command action handler
|
||||
* unknown options included in `.args`
|
||||
* only recognised option short flags and long flags are expanded (e.g. `-ab` or `--foo=bar`) ([#1145])
|
||||
* *Breaking* `.parseOptions()` ([#1138])
|
||||
* `args` in returned result renamed `operands` and does not include anything after first unknown option
|
||||
* `unknown` in returned result has arguments after first unknown option including operands, not just options and values
|
||||
* *Breaking* `.on('command:*', callback)` and other command events passed (changed) results from `.parseOptions`, i.e. operands and unknown ([#1138])
|
||||
* refactor Option from prototype to class ([#1133])
|
||||
* refactor Command from prototype to class ([#1159])
|
||||
* changes to error handling ([#1165])
|
||||
* throw for author error, not just display message
|
||||
* preflight for variadic error
|
||||
* add tips to missing subcommand executable
|
||||
* TypeScript fluent return types changed to be more subclass friendly, return `this` rather than `Command` ([#1180])
|
||||
* `.parseAsync` returns `Promise<this>` to be consistent with `.parse()` ([#1180])
|
||||
* update dependencies
|
||||
|
||||
### Removed
|
||||
|
||||
* removed EventEmitter from TypeScript definition for Command, eliminating implicit peer dependency on `@types/node` ([#1146])
|
||||
* removed private function `normalize` (the functionality has been integrated into `parseOptions`) ([#1145])
|
||||
* `parseExpectedArgs` is now private ([#1149])
|
||||
|
||||
### Migration Tips
|
||||
|
||||
If you use `.on('command:*')` or more complicated tests to detect an unrecognised subcommand, you may be able to delete the code and rely on the default behaviour.
|
||||
|
||||
If you use `program.args` or more complicated tests to detect a missing subcommand, you may be able to delete the code and rely on the default behaviour.
|
||||
|
||||
If you use `.command('*')` to add a default command, you may be be able to switch to `isDefault:true` with a named command.
|
||||
|
||||
If you want to continue combining short options with optional values as though they were boolean flags, set `combineFlagAndOptionalValue(false)`
|
||||
to expand `-fb` to `-f -b` rather than `-f b`.
|
||||
|
||||
## [5.0.0-4] (2020-03-03)
|
||||
|
||||
(Released in 5.0.0)
|
||||
|
||||
## [5.0.0-3] (2020-02-20)
|
||||
|
||||
(Released in 5.0.0)
|
||||
|
||||
## [5.0.0-2] (2020-02-10)
|
||||
|
||||
(Released in 5.0.0)
|
||||
|
||||
## [5.0.0-1] (2020-02-08)
|
||||
|
||||
(Released in 5.0.0)
|
||||
|
||||
## [5.0.0-0] (2020-02-02)
|
||||
|
||||
(Released in 5.0.0)
|
||||
|
||||
## [4.1.1] (2020-02-02)
|
||||
|
||||
### Fixed
|
||||
|
||||
* TypeScript definition for `.action()` should include Promise for async ([#1157])
|
||||
|
||||
## [4.1.0] (2020-01-06)
|
||||
|
||||
### Added
|
||||
|
||||
* two routines to change how option values are handled, and eliminate name clashes with command properties ([#933] [#1102])
|
||||
* see storeOptionsAsProperties and passCommandToAction in README
|
||||
* `.parseAsync` to use instead of `.parse` if supply async action handlers ([#806] [#1118])
|
||||
|
||||
### Fixed
|
||||
|
||||
* Remove trailing blanks from wrapped help text ([#1096])
|
||||
|
||||
### Changed
|
||||
|
||||
* update dependencies
|
||||
* extend security coverage for Commander 2.x to 2020-02-03
|
||||
* improvements to README
|
||||
* improvements to TypeScript definition documentation
|
||||
* move old versions out of main CHANGELOG
|
||||
* removed explicit use of `ts-node` in tests
|
||||
|
||||
## [4.0.1] (2019-11-12)
|
||||
|
||||
### Fixed
|
||||
|
||||
* display help when requested, even if there are missing required options ([#1091])
|
||||
|
||||
## [4.0.0] (2019-11-02)
|
||||
|
||||
### Added
|
||||
|
||||
* automatically wrap and indent help descriptions for options and commands ([#1051])
|
||||
* `.exitOverride()` allows override of calls to `process.exit` for additional error handling and to keep program running ([#1040])
|
||||
* support for declaring required options with `.requiredOptions()` ([#1071])
|
||||
* GitHub Actions support ([#1027])
|
||||
* translation links in README
|
||||
|
||||
### Changed
|
||||
|
||||
* dev: switch tests from Sinon+Should to Jest with major rewrite of tests ([#1035])
|
||||
* call default subcommand even when there are unknown options ([#1047])
|
||||
* *Breaking* Commander is only officially supported on Node 8 and above, and requires Node 6 ([#1053])
|
||||
|
||||
### Fixed
|
||||
|
||||
* *Breaking* keep command object out of program.args when action handler called ([#1048])
|
||||
* also, action handler now passed array of unknown arguments
|
||||
* complain about unknown options when program argument supplied and action handler ([#1049])
|
||||
* this changes parameters to `command:*` event to include unknown arguments
|
||||
* removed deprecated `customFds` option from call to `child_process.spawn` ([#1052])
|
||||
* rework TypeScript declarations to bring all types into imported namespace ([#1081])
|
||||
|
||||
### Migration Tips
|
||||
|
||||
#### Testing for no arguments
|
||||
|
||||
If you were previously using code like:
|
||||
|
||||
```js
|
||||
if (!program.args.length) ...
|
||||
```
|
||||
|
||||
a partial replacement is:
|
||||
|
||||
```js
|
||||
if (program.rawArgs.length < 3) ...
|
||||
```
|
||||
|
||||
## [4.0.0-1] Prerelease (2019-10-08)
|
||||
|
||||
(Released in 4.0.0)
|
||||
|
||||
## [4.0.0-0] Prerelease (2019-10-01)
|
||||
|
||||
(Released in 4.0.0)
|
||||
|
||||
## Older versions
|
||||
|
||||
* [3.x](./changelogs/CHANGELOG-3.md)
|
||||
* [2.x](./changelogs/CHANGELOG-2.md)
|
||||
* [1.x](./changelogs/CHANGELOG-1.md)
|
||||
* [0.x](./changelogs/CHANGELOG-0.md)
|
||||
|
||||
[#1]: https://github.com/tj/commander.js/issues/1
|
||||
[#432]: https://github.com/tj/commander.js/issues/432
|
||||
[#508]: https://github.com/tj/commander.js/issues/508
|
||||
[#512]: https://github.com/tj/commander.js/issues/512
|
||||
[#531]: https://github.com/tj/commander.js/issues/531
|
||||
[#645]: https://github.com/tj/commander.js/issues/645
|
||||
[#742]: https://github.com/tj/commander.js/issues/742
|
||||
[#764]: https://github.com/tj/commander.js/issues/764
|
||||
[#802]: https://github.com/tj/commander.js/issues/802
|
||||
[#806]: https://github.com/tj/commander.js/issues/806
|
||||
[#809]: https://github.com/tj/commander.js/issues/809
|
||||
[#948]: https://github.com/tj/commander.js/issues/948
|
||||
[#962]: https://github.com/tj/commander.js/issues/962
|
||||
[#995]: https://github.com/tj/commander.js/issues/995
|
||||
[#1027]: https://github.com/tj/commander.js/pull/1027
|
||||
[#1032]: https://github.com/tj/commander.js/issues/1032
|
||||
[#1035]: https://github.com/tj/commander.js/pull/1035
|
||||
[#1040]: https://github.com/tj/commander.js/pull/1040
|
||||
[#1047]: https://github.com/tj/commander.js/pull/1047
|
||||
[#1048]: https://github.com/tj/commander.js/pull/1048
|
||||
[#1049]: https://github.com/tj/commander.js/pull/1049
|
||||
[#1051]: https://github.com/tj/commander.js/pull/1051
|
||||
[#1052]: https://github.com/tj/commander.js/pull/1052
|
||||
[#1053]: https://github.com/tj/commander.js/pull/1053
|
||||
[#1062]: https://github.com/tj/commander.js/pull/1062
|
||||
[#1071]: https://github.com/tj/commander.js/pull/1071
|
||||
[#1081]: https://github.com/tj/commander.js/pull/1081
|
||||
[#1088]: https://github.com/tj/commander.js/issues/1088
|
||||
[#1091]: https://github.com/tj/commander.js/pull/1091
|
||||
[#1096]: https://github.com/tj/commander.js/pull/1096
|
||||
[#1102]: https://github.com/tj/commander.js/pull/1102
|
||||
[#1118]: https://github.com/tj/commander.js/pull/1118
|
||||
[#1119]: https://github.com/tj/commander.js/pull/1119
|
||||
[#1133]: https://github.com/tj/commander.js/pull/1133
|
||||
[#1138]: https://github.com/tj/commander.js/pull/1138
|
||||
[#1145]: https://github.com/tj/commander.js/pull/1145
|
||||
[#1146]: https://github.com/tj/commander.js/pull/1146
|
||||
[#1149]: https://github.com/tj/commander.js/pull/1149
|
||||
[#1153]: https://github.com/tj/commander.js/issues/1153
|
||||
[#1157]: https://github.com/tj/commander.js/pull/1157
|
||||
[#1159]: https://github.com/tj/commander.js/pull/1159
|
||||
[#1165]: https://github.com/tj/commander.js/pull/1165
|
||||
[#1169]: https://github.com/tj/commander.js/pull/1169
|
||||
[#1172]: https://github.com/tj/commander.js/pull/1172
|
||||
[#1179]: https://github.com/tj/commander.js/pull/1179
|
||||
[#1180]: https://github.com/tj/commander.js/pull/1180
|
||||
[#1184]: https://github.com/tj/commander.js/pull/1184
|
||||
[#1191]: https://github.com/tj/commander.js/pull/1191
|
||||
[#1195]: https://github.com/tj/commander.js/pull/1195
|
||||
[#1208]: https://github.com/tj/commander.js/pull/1208
|
||||
[#1232]: https://github.com/tj/commander.js/pull/1232
|
||||
[#1235]: https://github.com/tj/commander.js/pull/1235
|
||||
[#1236]: https://github.com/tj/commander.js/pull/1236
|
||||
[#1247]: https://github.com/tj/commander.js/pull/1247
|
||||
[#1248]: https://github.com/tj/commander.js/pull/1248
|
||||
[#1250]: https://github.com/tj/commander.js/pull/1250
|
||||
[#1256]: https://github.com/tj/commander.js/pull/1256
|
||||
[#1275]: https://github.com/tj/commander.js/pull/1275
|
||||
[#1301]: https://github.com/tj/commander.js/issues/1301
|
||||
[#1306]: https://github.com/tj/commander.js/pull/1306
|
||||
[#1312]: https://github.com/tj/commander.js/pull/1312
|
||||
[#1322]: https://github.com/tj/commander.js/pull/1322
|
||||
[#1323]: https://github.com/tj/commander.js/pull/1323
|
||||
[#1325]: https://github.com/tj/commander.js/pull/1325
|
||||
[#1326]: https://github.com/tj/commander.js/pull/1326
|
||||
[#1332]: https://github.com/tj/commander.js/pull/1332
|
||||
[#1353]: https://github.com/tj/commander.js/pull/1353
|
||||
[#1360]: https://github.com/tj/commander.js/pull/1360
|
||||
[#1361]: https://github.com/tj/commander.js/pull/1361
|
||||
[#1368]: https://github.com/tj/commander.js/pull/1368
|
||||
[#1375]: https://github.com/tj/commander.js/pull/1375
|
||||
[#1390]: https://github.com/tj/commander.js/pull/1390
|
||||
|
||||
[Unreleased]: https://github.com/tj/commander.js/compare/master...develop
|
||||
[6.2.1]: https://github.com/tj/commander.js/compare/v6.2.0..v6.2.1
|
||||
[6.2.0]: https://github.com/tj/commander.js/compare/v6.1.0..v6.2.0
|
||||
[6.1.0]: https://github.com/tj/commander.js/compare/v6.0.0..v6.1.0
|
||||
[6.0.0]: https://github.com/tj/commander.js/compare/v5.1.0..v6.0.0
|
||||
[6.0.0-0]: https://github.com/tj/commander.js/compare/v5.1.0..v6.0.0-0
|
||||
[5.1.0]: https://github.com/tj/commander.js/compare/v5.0.0..v5.1.0
|
||||
[5.0.0]: https://github.com/tj/commander.js/compare/v4.1.1..v5.0.0
|
||||
[5.0.0-4]: https://github.com/tj/commander.js/compare/v5.0.0-3..v5.0.0-4
|
||||
[5.0.0-3]: https://github.com/tj/commander.js/compare/v5.0.0-2..v5.0.0-3
|
||||
[5.0.0-2]: https://github.com/tj/commander.js/compare/v5.0.0-1..v5.0.0-2
|
||||
[5.0.0-1]: https://github.com/tj/commander.js/compare/v5.0.0-0..v5.0.0-1
|
||||
[5.0.0-0]: https://github.com/tj/commander.js/compare/v4.1.1..v5.0.0-0
|
||||
[4.1.1]: https://github.com/tj/commander.js/compare/v4.1.0..v4.1.1
|
||||
[4.1.0]: https://github.com/tj/commander.js/compare/v4.0.1..v4.1.0
|
||||
[4.0.1]: https://github.com/tj/commander.js/compare/v4.0.0..v4.0.1
|
||||
[4.0.0]: https://github.com/tj/commander.js/compare/v3.0.2..v4.0.0
|
||||
[4.0.0-1]: https://github.com/tj/commander.js/compare/v4.0.0-0..v4.0.0-1
|
||||
[4.0.0-0]: https://github.com/tj/commander.js/compare/v3.0.2...v4.0.0-0
|
||||
22
node_modules/commander/LICENSE
generated
vendored
Normal file
22
node_modules/commander/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
||||
791
node_modules/commander/Readme.md
generated
vendored
Normal file
791
node_modules/commander/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,791 @@
|
||||
# Commander.js
|
||||
|
||||
[](http://travis-ci.org/tj/commander.js)
|
||||
[](https://www.npmjs.org/package/commander)
|
||||
[](https://npmcharts.com/compare/commander?minimal=true)
|
||||
[](https://packagephobia.now.sh/result?p=commander)
|
||||
|
||||
The complete solution for [node.js](http://nodejs.org) command-line interfaces.
|
||||
|
||||
Read this in other languages: English | [简体中文](./Readme_zh-CN.md)
|
||||
|
||||
- [Commander.js](#commanderjs)
|
||||
- [Installation](#installation)
|
||||
- [Declaring _program_ variable](#declaring-program-variable)
|
||||
- [Options](#options)
|
||||
- [Common option types, boolean and value](#common-option-types-boolean-and-value)
|
||||
- [Default option value](#default-option-value)
|
||||
- [Other option types, negatable boolean and boolean|value](#other-option-types-negatable-boolean-and-booleanvalue)
|
||||
- [Custom option processing](#custom-option-processing)
|
||||
- [Required option](#required-option)
|
||||
- [Variadic option](#variadic-option)
|
||||
- [Version option](#version-option)
|
||||
- [Commands](#commands)
|
||||
- [Specify the argument syntax](#specify-the-argument-syntax)
|
||||
- [Action handler (sub)commands](#action-handler-subcommands)
|
||||
- [Stand-alone executable (sub)commands](#stand-alone-executable-subcommands)
|
||||
- [Automated help](#automated-help)
|
||||
- [Custom help](#custom-help)
|
||||
- [.usage and .name](#usage-and-name)
|
||||
- [.help(cb)](#helpcb)
|
||||
- [.outputHelp(cb)](#outputhelpcb)
|
||||
- [.helpInformation()](#helpinformation)
|
||||
- [.helpOption(flags, description)](#helpoptionflags-description)
|
||||
- [.addHelpCommand()](#addhelpcommand)
|
||||
- [Custom event listeners](#custom-event-listeners)
|
||||
- [Bits and pieces](#bits-and-pieces)
|
||||
- [.parse() and .parseAsync()](#parse-and-parseasync)
|
||||
- [Avoiding option name clashes](#avoiding-option-name-clashes)
|
||||
- [TypeScript](#typescript)
|
||||
- [createCommand()](#createcommand)
|
||||
- [Import into ECMAScript Module](#import-into-ecmascript-module)
|
||||
- [Node options such as `--harmony`](#node-options-such-as---harmony)
|
||||
- [Debugging stand-alone executable subcommands](#debugging-stand-alone-executable-subcommands)
|
||||
- [Override exit handling](#override-exit-handling)
|
||||
- [Examples](#examples)
|
||||
- [Support](#support)
|
||||
- [Commander for enterprise](#commander-for-enterprise)
|
||||
|
||||
For information about terms used in this document see: [terminology](./docs/terminology.md)
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install commander
|
||||
```
|
||||
|
||||
## Declaring _program_ variable
|
||||
|
||||
Commander exports a global object which is convenient for quick programs.
|
||||
This is used in the examples in this README for brevity.
|
||||
|
||||
```js
|
||||
const { program } = require('commander');
|
||||
program.version('0.0.1');
|
||||
```
|
||||
|
||||
For larger programs which may use commander in multiple ways, including unit testing, it is better to create a local Command object to use.
|
||||
|
||||
```js
|
||||
const { Command } = require('commander');
|
||||
const program = new Command();
|
||||
program.version('0.0.1');
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
Options are defined with the `.option()` method, also serving as documentation for the options. Each option can have a short flag (single character) and a long name, separated by a comma or space or vertical bar ('|').
|
||||
|
||||
The options can be accessed as properties on the Command object. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc. See also optional new behaviour to [avoid name clashes](#avoiding-option-name-clashes).
|
||||
|
||||
Multiple short flags may optionally be combined in a single argument following the dash: boolean flags, followed by a single option taking a value (possibly followed by the value).
|
||||
For example `-a -b -p 80` may be written as `-ab -p80` or even `-abp80`.
|
||||
|
||||
You can use `--` to indicate the end of the options, and any remaining arguments will be used without being interpreted.
|
||||
|
||||
Options on the command line are not positional, and can be specified before or after other arguments.
|
||||
|
||||
### Common option types, boolean and value
|
||||
|
||||
The two most used option types are a boolean option, and an option which takes its value
|
||||
from the following argument (declared with angle brackets like `--expect <value>`). Both are `undefined` unless specified on command line.
|
||||
|
||||
Example file: [options-common.js](./examples/options-common.js)
|
||||
|
||||
```js
|
||||
program
|
||||
.option('-d, --debug', 'output extra debugging')
|
||||
.option('-s, --small', 'small pizza size')
|
||||
.option('-p, --pizza-type <type>', 'flavour of pizza');
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
if (program.debug) console.log(program.opts());
|
||||
console.log('pizza details:');
|
||||
if (program.small) console.log('- small pizza size');
|
||||
if (program.pizzaType) console.log(`- ${program.pizzaType}`);
|
||||
```
|
||||
|
||||
```bash
|
||||
$ pizza-options -d
|
||||
{ debug: true, small: undefined, pizzaType: undefined }
|
||||
pizza details:
|
||||
$ pizza-options -p
|
||||
error: option '-p, --pizza-type <type>' argument missing
|
||||
$ pizza-options -ds -p vegetarian
|
||||
{ debug: true, small: true, pizzaType: 'vegetarian' }
|
||||
pizza details:
|
||||
- small pizza size
|
||||
- vegetarian
|
||||
$ pizza-options --pizza-type=cheese
|
||||
pizza details:
|
||||
- cheese
|
||||
```
|
||||
|
||||
`program.parse(arguments)` processes the arguments, leaving any args not consumed by the program options in the `program.args` array.
|
||||
|
||||
### Default option value
|
||||
|
||||
You can specify a default value for an option which takes a value.
|
||||
|
||||
Example file: [options-defaults.js](./examples/options-defaults.js)
|
||||
|
||||
```js
|
||||
program
|
||||
.option('-c, --cheese <type>', 'add the specified type of cheese', 'blue');
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
console.log(`cheese: ${program.cheese}`);
|
||||
```
|
||||
|
||||
```bash
|
||||
$ pizza-options
|
||||
cheese: blue
|
||||
$ pizza-options --cheese stilton
|
||||
cheese: stilton
|
||||
```
|
||||
|
||||
### Other option types, negatable boolean and boolean|value
|
||||
|
||||
You can define a boolean option long name with a leading `no-` to set the option value to false when used.
|
||||
Defined alone this also makes the option true by default.
|
||||
|
||||
If you define `--foo` first, adding `--no-foo` does not change the default value from what it would
|
||||
otherwise be. You can specify a default boolean value for a boolean option and it can be overridden on command line.
|
||||
|
||||
Example file: [options-negatable.js](./examples/options-negatable.js)
|
||||
|
||||
```js
|
||||
program
|
||||
.option('--no-sauce', 'Remove sauce')
|
||||
.option('--cheese <flavour>', 'cheese flavour', 'mozzarella')
|
||||
.option('--no-cheese', 'plain with no cheese')
|
||||
.parse(process.argv);
|
||||
|
||||
const sauceStr = program.sauce ? 'sauce' : 'no sauce';
|
||||
const cheeseStr = (program.cheese === false) ? 'no cheese' : `${program.cheese} cheese`;
|
||||
console.log(`You ordered a pizza with ${sauceStr} and ${cheeseStr}`);
|
||||
```
|
||||
|
||||
```bash
|
||||
$ pizza-options
|
||||
You ordered a pizza with sauce and mozzarella cheese
|
||||
$ pizza-options --sauce
|
||||
error: unknown option '--sauce'
|
||||
$ pizza-options --cheese=blue
|
||||
You ordered a pizza with sauce and blue cheese
|
||||
$ pizza-options --no-sauce --no-cheese
|
||||
You ordered a pizza with no sauce and no cheese
|
||||
```
|
||||
|
||||
You can specify an option which may be used as a boolean option but may optionally take an option-argument
|
||||
(declared with square brackets like `--optional [value]`).
|
||||
|
||||
Example file: [options-boolean-or-value.js](./examples/options-boolean-or-value.js)
|
||||
|
||||
```js
|
||||
program
|
||||
.option('-c, --cheese [type]', 'Add cheese with optional type');
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
if (program.cheese === undefined) console.log('no cheese');
|
||||
else if (program.cheese === true) console.log('add cheese');
|
||||
else console.log(`add cheese type ${program.cheese}`);
|
||||
```
|
||||
|
||||
```bash
|
||||
$ pizza-options
|
||||
no cheese
|
||||
$ pizza-options --cheese
|
||||
add cheese
|
||||
$ pizza-options --cheese mozzarella
|
||||
add cheese type mozzarella
|
||||
```
|
||||
|
||||
For information about possible ambiguous cases, see [options taking varying arguments](./docs/options-taking-varying-arguments.md).
|
||||
|
||||
### Custom option processing
|
||||
|
||||
You may specify a function to do custom processing of option-arguments. The callback function receives two parameters,
|
||||
the user specified option-argument and the previous value for the option. It returns the new value for the option.
|
||||
|
||||
This allows you to coerce the option-argument to the desired type, or accumulate values, or do entirely custom processing.
|
||||
|
||||
You can optionally specify the default/starting value for the option after the function parameter.
|
||||
|
||||
Example file: [options-custom-processing.js](./examples/options-custom-processing.js)
|
||||
|
||||
```js
|
||||
function myParseInt(value, dummyPrevious) {
|
||||
// parseInt takes a string and an optional radix
|
||||
return parseInt(value);
|
||||
}
|
||||
|
||||
function increaseVerbosity(dummyValue, previous) {
|
||||
return previous + 1;
|
||||
}
|
||||
|
||||
function collect(value, previous) {
|
||||
return previous.concat([value]);
|
||||
}
|
||||
|
||||
function commaSeparatedList(value, dummyPrevious) {
|
||||
return value.split(',');
|
||||
}
|
||||
|
||||
program
|
||||
.option('-f, --float <number>', 'float argument', parseFloat)
|
||||
.option('-i, --integer <number>', 'integer argument', myParseInt)
|
||||
.option('-v, --verbose', 'verbosity that can be increased', increaseVerbosity, 0)
|
||||
.option('-c, --collect <value>', 'repeatable value', collect, [])
|
||||
.option('-l, --list <items>', 'comma separated list', commaSeparatedList)
|
||||
;
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
if (program.float !== undefined) console.log(`float: ${program.float}`);
|
||||
if (program.integer !== undefined) console.log(`integer: ${program.integer}`);
|
||||
if (program.verbose > 0) console.log(`verbosity: ${program.verbose}`);
|
||||
if (program.collect.length > 0) console.log(program.collect);
|
||||
if (program.list !== undefined) console.log(program.list);
|
||||
```
|
||||
|
||||
```bash
|
||||
$ custom -f 1e2
|
||||
float: 100
|
||||
$ custom --integer 2
|
||||
integer: 2
|
||||
$ custom -v -v -v
|
||||
verbose: 3
|
||||
$ custom -c a -c b -c c
|
||||
[ 'a', 'b', 'c' ]
|
||||
$ custom --list x,y,z
|
||||
[ 'x', 'y', 'z' ]
|
||||
```
|
||||
|
||||
### Required option
|
||||
|
||||
You may specify a required (mandatory) option using `.requiredOption`. The option must have a value after parsing, usually specified on the command line, or perhaps from a default value (say from environment). The method is otherwise the same as `.option` in format, taking flags and description, and optional default value or custom processing.
|
||||
|
||||
Example file: [options-required.js](./examples/options-required.js)
|
||||
|
||||
```js
|
||||
program
|
||||
.requiredOption('-c, --cheese <type>', 'pizza must have cheese');
|
||||
|
||||
program.parse(process.argv);
|
||||
```
|
||||
|
||||
```bash
|
||||
$ pizza
|
||||
error: required option '-c, --cheese <type>' not specified
|
||||
```
|
||||
|
||||
### Variadic option
|
||||
|
||||
You may make an option variadic by appending `...` to the value placeholder when declaring the option. On the command line you
|
||||
can then specify multiple option-arguments, and the parsed option value will be an array. The extra arguments
|
||||
are read until the first argument starting with a dash. The special argument `--` stops option processing entirely. If a value
|
||||
is specified in the same argument as the option then no further values are read.
|
||||
|
||||
Example file: [options-variadic.js](./examples/options-variadic.js)
|
||||
|
||||
```js
|
||||
program
|
||||
.option('-n, --number <numbers...>', 'specify numbers')
|
||||
.option('-l, --letter [letters...]', 'specify letters');
|
||||
|
||||
program.parse();
|
||||
|
||||
console.log('Options: ', program.opts());
|
||||
console.log('Remaining arguments: ', program.args);
|
||||
```
|
||||
|
||||
```bash
|
||||
$ collect -n 1 2 3 --letter a b c
|
||||
Options: { number: [ '1', '2', '3' ], letter: [ 'a', 'b', 'c' ] }
|
||||
Remaining arguments: []
|
||||
$ collect --letter=A -n80 operand
|
||||
Options: { number: [ '80' ], letter: [ 'A' ] }
|
||||
Remaining arguments: [ 'operand' ]
|
||||
$ collect --letter -n 1 -n 2 3 -- operand
|
||||
Options: { number: [ '1', '2', '3' ], letter: true }
|
||||
Remaining arguments: [ 'operand' ]
|
||||
```
|
||||
|
||||
For information about possible ambiguous cases, see [options taking varying arguments](./docs/options-taking-varying-arguments.md).
|
||||
|
||||
### Version option
|
||||
|
||||
The optional `version` method adds handling for displaying the command version. The default option flags are `-V` and `--version`, and when present the command prints the version number and exits.
|
||||
|
||||
```js
|
||||
program.version('0.0.1');
|
||||
```
|
||||
|
||||
```bash
|
||||
$ ./examples/pizza -V
|
||||
0.0.1
|
||||
```
|
||||
|
||||
You may change the flags and description by passing additional parameters to the `version` method, using
|
||||
the same syntax for flags as the `option` method.
|
||||
|
||||
```js
|
||||
program.version('0.0.1', '-v, --vers', 'output the current version');
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
You can specify (sub)commands using `.command()` or `.addCommand()`. There are two ways these can be implemented: using an action handler attached to the command, or as a stand-alone executable file (described in more detail later). The subcommands may be nested ([example](./examples/nestedCommands.js)).
|
||||
|
||||
In the first parameter to `.command()` you specify the command name and any command-arguments. The arguments may be `<required>` or `[optional]`, and the last argument may also be `variadic...`.
|
||||
|
||||
You can use `.addCommand()` to add an already configured subcommand to the program.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
// Command implemented using action handler (description is supplied separately to `.command`)
|
||||
// Returns new command for configuring.
|
||||
program
|
||||
.command('clone <source> [destination]')
|
||||
.description('clone a repository into a newly created directory')
|
||||
.action((source, destination) => {
|
||||
console.log('clone command called');
|
||||
});
|
||||
|
||||
// Command implemented using stand-alone executable file (description is second parameter to `.command`)
|
||||
// Returns `this` for adding more commands.
|
||||
program
|
||||
.command('start <service>', 'start named service')
|
||||
.command('stop [service]', 'stop named service, or all if no name supplied');
|
||||
|
||||
// Command prepared separately.
|
||||
// Returns `this` for adding more commands.
|
||||
program
|
||||
.addCommand(build.makeBuildCommand());
|
||||
```
|
||||
|
||||
Configuration options can be passed with the call to `.command()` and `.addCommand()`. Specifying `hidden: true` will
|
||||
remove the command from the generated help output. Specifying `isDefault: true` will run the subcommand if no other
|
||||
subcommand is specified ([example](./examples/defaultCommand.js)).
|
||||
|
||||
### Specify the argument syntax
|
||||
|
||||
You use `.arguments` to specify the expected command-arguments for the top-level command, and for subcommands they are usually
|
||||
included in the `.command` call. Angled brackets (e.g. `<required>`) indicate required command-arguments.
|
||||
Square brackets (e.g. `[optional]`) indicate optional command-arguments.
|
||||
You can optionally describe the arguments in the help by supplying a hash as second parameter to `.description()`.
|
||||
|
||||
Example file: [env](./examples/env)
|
||||
|
||||
```js
|
||||
program
|
||||
.version('0.1.0')
|
||||
.arguments('<cmd> [env]')
|
||||
.description('test command', {
|
||||
cmd: 'command to run',
|
||||
env: 'environment to run test in'
|
||||
})
|
||||
.action(function (cmd, env) {
|
||||
console.log('command:', cmd);
|
||||
console.log('environment:', env || 'no environment given');
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
```
|
||||
|
||||
The last argument of a command can be variadic, and only the last argument. To make an argument variadic you
|
||||
append `...` to the argument name. For example:
|
||||
|
||||
```js
|
||||
const { program } = require('commander');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.command('rmdir <dir> [otherDirs...]')
|
||||
.action(function (dir, otherDirs) {
|
||||
console.log('rmdir %s', dir);
|
||||
if (otherDirs) {
|
||||
otherDirs.forEach(function (oDir) {
|
||||
console.log('rmdir %s', oDir);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
```
|
||||
|
||||
The variadic argument is passed to the action handler as an array.
|
||||
|
||||
### Action handler (sub)commands
|
||||
|
||||
You can add options to a command that uses an action handler.
|
||||
The action handler gets passed a parameter for each argument you declared, and one additional argument which is the
|
||||
command object itself. This command argument has the values for the command-specific options added as properties.
|
||||
|
||||
```js
|
||||
const { program } = require('commander');
|
||||
|
||||
program
|
||||
.command('rm <dir>')
|
||||
.option('-r, --recursive', 'Remove recursively')
|
||||
.action(function (dir, cmdObj) {
|
||||
console.log('remove ' + dir + (cmdObj.recursive ? ' recursively' : ''))
|
||||
})
|
||||
|
||||
program.parse(process.argv)
|
||||
```
|
||||
|
||||
You may supply an `async` action handler, in which case you call `.parseAsync` rather than `.parse`.
|
||||
|
||||
```js
|
||||
async function run() { /* code goes here */ }
|
||||
|
||||
async function main() {
|
||||
program
|
||||
.command('run')
|
||||
.action(run);
|
||||
await program.parseAsync(process.argv);
|
||||
}
|
||||
```
|
||||
|
||||
A command's options on the command line are validated when the command is used. Any unknown options will be reported as an error.
|
||||
|
||||
### Stand-alone executable (sub)commands
|
||||
|
||||
When `.command()` is invoked with a description argument, this tells Commander that you're going to use stand-alone executables for subcommands.
|
||||
Commander will search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-subcommand`, like `pm-install`, `pm-search`.
|
||||
You can specify a custom name with the `executableFile` configuration option.
|
||||
|
||||
You handle the options for an executable (sub)command in the executable, and don't declare them at the top-level.
|
||||
|
||||
Example file: [pm](./examples/pm)
|
||||
|
||||
```js
|
||||
program
|
||||
.version('0.1.0')
|
||||
.command('install [name]', 'install one or more packages')
|
||||
.command('search [query]', 'search with optional query')
|
||||
.command('update', 'update installed packages', { executableFile: 'myUpdateSubCommand' })
|
||||
.command('list', 'list packages installed', { isDefault: true });
|
||||
|
||||
program.parse(process.argv);
|
||||
```
|
||||
|
||||
If the program is designed to be installed globally, make sure the executables have proper modes, like `755`.
|
||||
|
||||
## Automated help
|
||||
|
||||
The help information is auto-generated based on the information commander already knows about your program. The default
|
||||
help option is `-h,--help`.
|
||||
|
||||
Example file: [pizza](./examples/pizza)
|
||||
|
||||
```bash
|
||||
$ node ./examples/pizza --help
|
||||
Usage: pizza [options]
|
||||
|
||||
An application for pizzas ordering
|
||||
|
||||
Options:
|
||||
-V, --version output the version number
|
||||
-p, --peppers Add peppers
|
||||
-c, --cheese <type> Add the specified type of cheese (default: "marble")
|
||||
-C, --no-cheese You do not want any cheese
|
||||
-h, --help display help for command
|
||||
```
|
||||
|
||||
A `help` command is added by default if your command has subcommands. It can be used alone, or with a subcommand name to show
|
||||
further help for the subcommand. These are effectively the same if the `shell` program has implicit help:
|
||||
|
||||
```bash
|
||||
shell help
|
||||
shell --help
|
||||
|
||||
shell help spawn
|
||||
shell spawn --help
|
||||
```
|
||||
|
||||
### Custom help
|
||||
|
||||
You can display extra information by listening for "--help".
|
||||
|
||||
Example file: [custom-help](./examples/custom-help)
|
||||
|
||||
```js
|
||||
program
|
||||
.option('-f, --foo', 'enable some foo');
|
||||
|
||||
// must be before .parse()
|
||||
program.on('--help', () => {
|
||||
console.log('');
|
||||
console.log('Example call:');
|
||||
console.log(' $ custom-help --help');
|
||||
});
|
||||
```
|
||||
|
||||
Yields the following help output:
|
||||
|
||||
```Text
|
||||
Usage: custom-help [options]
|
||||
|
||||
Options:
|
||||
-f, --foo enable some foo
|
||||
-h, --help display help for command
|
||||
|
||||
Example call:
|
||||
$ custom-help --help
|
||||
```
|
||||
|
||||
### .usage and .name
|
||||
|
||||
These allow you to customise the usage description in the first line of the help. The name is otherwise
|
||||
deduced from the (full) program arguments. Given:
|
||||
|
||||
```js
|
||||
program
|
||||
.name("my-command")
|
||||
.usage("[global options] command")
|
||||
```
|
||||
|
||||
The help will start with:
|
||||
|
||||
```Text
|
||||
Usage: my-command [global options] command
|
||||
```
|
||||
|
||||
### .help(cb)
|
||||
|
||||
Output help information and exit immediately. Optional callback cb allows post-processing of help text before it is displayed.
|
||||
|
||||
### .outputHelp(cb)
|
||||
|
||||
Output help information without exiting.
|
||||
Optional callback cb allows post-processing of help text before it is displayed.
|
||||
|
||||
### .helpInformation()
|
||||
|
||||
Get the command help information as a string for processing or displaying yourself. (The text does not include the custom help
|
||||
from `--help` listeners.)
|
||||
|
||||
### .helpOption(flags, description)
|
||||
|
||||
Override the default help flags and description. Pass false to disable the built-in help option.
|
||||
|
||||
```js
|
||||
program
|
||||
.helpOption('-e, --HELP', 'read more information');
|
||||
```
|
||||
|
||||
### .addHelpCommand()
|
||||
|
||||
You can explicitly turn on or off the implicit help command with `.addHelpCommand()` and `.addHelpCommand(false)`.
|
||||
|
||||
You can both turn on and customise the help command by supplying the name and description:
|
||||
|
||||
```js
|
||||
program.addHelpCommand('assist [command]', 'show assistance');
|
||||
```
|
||||
|
||||
## Custom event listeners
|
||||
|
||||
You can execute custom actions by listening to command and option events.
|
||||
|
||||
```js
|
||||
program.on('option:verbose', function () {
|
||||
process.env.VERBOSE = this.verbose;
|
||||
});
|
||||
|
||||
program.on('command:*', function (operands) {
|
||||
console.error(`error: unknown command '${operands[0]}'`);
|
||||
const availableCommands = program.commands.map(cmd => cmd.name());
|
||||
mySuggestBestMatch(operands[0], availableCommands);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
```
|
||||
|
||||
## Bits and pieces
|
||||
|
||||
### .parse() and .parseAsync()
|
||||
|
||||
The first argument to `.parse` is the array of strings to parse. You may omit the parameter to implicitly use `process.argv`.
|
||||
|
||||
If the arguments follow different conventions than node you can pass a `from` option in the second parameter:
|
||||
|
||||
- 'node': default, `argv[0]` is the application and `argv[1]` is the script being run, with user parameters after that
|
||||
- 'electron': `argv[1]` varies depending on whether the electron application is packaged
|
||||
- 'user': all of the arguments from the user
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
program.parse(process.argv); // Explicit, node conventions
|
||||
program.parse(); // Implicit, and auto-detect electron
|
||||
program.parse(['-f', 'filename'], { from: 'user' });
|
||||
```
|
||||
|
||||
### Avoiding option name clashes
|
||||
|
||||
The original and default behaviour is that the option values are stored
|
||||
as properties on the program, and the action handler is passed a
|
||||
command object with the options values stored as properties.
|
||||
This is very convenient to code, but the downside is possible clashes with
|
||||
existing properties of Command.
|
||||
|
||||
There are two new routines to change the behaviour, and the default behaviour may change in the future:
|
||||
|
||||
- `storeOptionsAsProperties`: whether to store option values as properties on command object, or store separately (specify false) and access using `.opts()`
|
||||
- `passCommandToAction`: whether to pass command to action handler,
|
||||
or just the options (specify false)
|
||||
|
||||
Example file: [storeOptionsAsProperties-action.js](./examples/storeOptionsAsProperties-action.js)
|
||||
|
||||
```js
|
||||
program
|
||||
.storeOptionsAsProperties(false)
|
||||
.passCommandToAction(false);
|
||||
|
||||
program
|
||||
.name('my-program-name')
|
||||
.option('-n,--name <name>');
|
||||
|
||||
program
|
||||
.command('show')
|
||||
.option('-a,--action <action>')
|
||||
.action((options) => {
|
||||
console.log(options.action);
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
const programOptions = program.opts();
|
||||
console.log(programOptions.name);
|
||||
```
|
||||
|
||||
### TypeScript
|
||||
|
||||
The Commander package includes its TypeScript Definition file.
|
||||
|
||||
If you use `ts-node` and stand-alone executable subcommands written as `.ts` files, you need to call your program through node to get the subcommands called correctly. e.g.
|
||||
|
||||
```bash
|
||||
node -r ts-node/register pm.ts
|
||||
```
|
||||
|
||||
### createCommand()
|
||||
|
||||
This factory function creates a new command. It is exported and may be used instead of using `new`, like:
|
||||
|
||||
```js
|
||||
const { createCommand } = require('commander');
|
||||
const program = createCommand();
|
||||
```
|
||||
|
||||
`createCommand` is also a method of the Command object, and creates a new command rather than a subcommand. This gets used internally
|
||||
when creating subcommands using `.command()`, and you may override it to
|
||||
customise the new subcommand (examples using [subclass](./examples/custom-command-class.js) and [function](./examples/custom-command-function.js)).
|
||||
|
||||
### Import into ECMAScript Module
|
||||
|
||||
Commander is currently a CommonJS package, and the default export can be imported into an ES Module:
|
||||
|
||||
```js
|
||||
// index.mjs
|
||||
import commander from 'commander';
|
||||
const program = commander.program;
|
||||
const newCommand = new commander.Command();
|
||||
```
|
||||
|
||||
### Node options such as `--harmony`
|
||||
|
||||
You can enable `--harmony` option in two ways:
|
||||
|
||||
- Use `#! /usr/bin/env node --harmony` in the subcommands scripts. (Note Windows does not support this pattern.)
|
||||
- Use the `--harmony` option when call the command, like `node --harmony examples/pm publish`. The `--harmony` option will be preserved when spawning subcommand process.
|
||||
|
||||
### Debugging stand-alone executable subcommands
|
||||
|
||||
An executable subcommand is launched as a separate child process.
|
||||
|
||||
If you are using the node inspector for [debugging](https://nodejs.org/en/docs/guides/debugging-getting-started/) executable subcommands using `node --inspect` et al,
|
||||
the inspector port is incremented by 1 for the spawned subcommand.
|
||||
|
||||
If you are using VSCode to debug executable subcommands you need to set the `"autoAttachChildProcesses": true` flag in your launch.json configuration.
|
||||
|
||||
### Override exit handling
|
||||
|
||||
By default Commander calls `process.exit` when it detects errors, or after displaying the help or version. You can override
|
||||
this behaviour and optionally supply a callback. The default override throws a `CommanderError`.
|
||||
|
||||
The override callback is passed a `CommanderError` with properties `exitCode` number, `code` string, and `message`. The default override behaviour is to throw the error, except for async handling of executable subcommand completion which carries on. The normal display of error messages or version or help
|
||||
is not affected by the override which is called after the display.
|
||||
|
||||
```js
|
||||
program.exitOverride();
|
||||
|
||||
try {
|
||||
program.parse(process.argv);
|
||||
} catch (err) {
|
||||
// custom processing...
|
||||
}
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
Example file: [deploy](./examples/deploy)
|
||||
|
||||
```js
|
||||
const { program } = require('commander');
|
||||
|
||||
program
|
||||
.version('0.1.0')
|
||||
.option('-C, --chdir <path>', 'change the working directory')
|
||||
.option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||
.option('-T, --no-tests', 'ignore test hook');
|
||||
|
||||
program
|
||||
.command('setup [env]')
|
||||
.description('run setup commands for all envs')
|
||||
.option("-s, --setup_mode [mode]", "Which setup mode to use")
|
||||
.action(function(env, options){
|
||||
const mode = options.setup_mode || "normal";
|
||||
env = env || 'all';
|
||||
console.log('setup for %s env(s) with %s mode', env, mode);
|
||||
});
|
||||
|
||||
program
|
||||
.command('exec <cmd>')
|
||||
.alias('ex')
|
||||
.description('execute the given remote cmd')
|
||||
.option("-e, --exec_mode <mode>", "Which exec mode to use")
|
||||
.action(function(cmd, options){
|
||||
console.log('exec "%s" using %s mode', cmd, options.exec_mode);
|
||||
}).on('--help', function() {
|
||||
console.log('');
|
||||
console.log('Examples:');
|
||||
console.log('');
|
||||
console.log(' $ deploy exec sequential');
|
||||
console.log(' $ deploy exec async');
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
```
|
||||
|
||||
More Demos can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory.
|
||||
|
||||
## Support
|
||||
|
||||
The current version of Commander is fully supported on Long Term Support versions of Node, and is likely to work with Node 6 but not tested.
|
||||
(For versions of Node below Node 6, use Commander 3.x or 2.x.)
|
||||
|
||||
The main forum for free and community support is the project [Issues](https://github.com/tj/commander.js/issues) on GitHub.
|
||||
|
||||
### Commander for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription
|
||||
|
||||
The maintainers of Commander and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-commander?utm_source=npm-commander&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
1881
node_modules/commander/index.js
generated
vendored
Normal file
1881
node_modules/commander/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
51
node_modules/commander/package.json
generated
vendored
Normal file
51
node_modules/commander/package.json
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "commander",
|
||||
"version": "6.2.1",
|
||||
"description": "the complete solution for node.js command-line programs",
|
||||
"keywords": [
|
||||
"commander",
|
||||
"command",
|
||||
"option",
|
||||
"parser",
|
||||
"cli",
|
||||
"argument",
|
||||
"args",
|
||||
"argv"
|
||||
],
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tj/commander.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint index.js \"tests/**/*.js\"",
|
||||
"typescript-lint": "eslint typings/*.ts",
|
||||
"test": "jest && npm run test-typings",
|
||||
"test-typings": "tsc -p tsconfig.json"
|
||||
},
|
||||
"main": "index",
|
||||
"files": [
|
||||
"index.js",
|
||||
"typings/index.d.ts"
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.15",
|
||||
"@types/node": "^14.14.2",
|
||||
"@typescript-eslint/eslint-plugin": "^4.5.0",
|
||||
"eslint": "^7.11.0",
|
||||
"eslint-config-standard-with-typescript": "^19.0.1",
|
||||
"eslint-plugin-jest": "^24.1.0",
|
||||
"jest": "^26.6.0",
|
||||
"standard": "^15.0.0",
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"typings": "typings/index.d.ts",
|
||||
"jest": {
|
||||
"collectCoverage": true
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
}
|
||||
410
node_modules/commander/typings/index.d.ts
generated
vendored
Normal file
410
node_modules/commander/typings/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,410 @@
|
||||
// Type definitions for commander
|
||||
// Original definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>, Jules Randolph <https://github.com/sveinburne>
|
||||
|
||||
declare namespace commander {
|
||||
|
||||
interface CommanderError extends Error {
|
||||
code: string;
|
||||
exitCode: number;
|
||||
message: string;
|
||||
nestedError?: string;
|
||||
}
|
||||
type CommanderErrorConstructor = new (exitCode: number, code: string, message: string) => CommanderError;
|
||||
|
||||
interface Option {
|
||||
flags: string;
|
||||
required: boolean; // A value must be supplied when the option is specified.
|
||||
optional: boolean; // A value is optional when the option is specified.
|
||||
mandatory: boolean; // The option must have a value after parsing, which usually means it must be specified on command line.
|
||||
bool: boolean;
|
||||
short?: string;
|
||||
long: string;
|
||||
description: string;
|
||||
}
|
||||
type OptionConstructor = new (flags: string, description?: string) => Option;
|
||||
|
||||
interface ParseOptions {
|
||||
from: 'node' | 'electron' | 'user';
|
||||
}
|
||||
|
||||
interface Command {
|
||||
[key: string]: any; // options as properties
|
||||
|
||||
args: string[];
|
||||
|
||||
commands: Command[];
|
||||
|
||||
/**
|
||||
* Set the program version to `str`.
|
||||
*
|
||||
* This method auto-registers the "-V, --version" flag
|
||||
* which will print the version number when passed.
|
||||
*
|
||||
* You can optionally supply the flags and description to override the defaults.
|
||||
*/
|
||||
version(str: string, flags?: string, description?: string): this;
|
||||
|
||||
/**
|
||||
* Define a command, implemented using an action handler.
|
||||
*
|
||||
* @remarks
|
||||
* The command description is supplied using `.description`, not as a parameter to `.command`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* program
|
||||
* .command('clone <source> [destination]')
|
||||
* .description('clone a repository into a newly created directory')
|
||||
* .action((source, destination) => {
|
||||
* console.log('clone command called');
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`
|
||||
* @param opts - configuration options
|
||||
* @returns new command
|
||||
*/
|
||||
command(nameAndArgs: string, opts?: CommandOptions): ReturnType<this['createCommand']>;
|
||||
/**
|
||||
* Define a command, implemented in a separate executable file.
|
||||
*
|
||||
* @remarks
|
||||
* The command description is supplied as the second parameter to `.command`.
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* program
|
||||
* .command('start <service>', 'start named service')
|
||||
* .command('stop [service]', 'stop named service, or all if no name supplied');
|
||||
* ```
|
||||
*
|
||||
* @param nameAndArgs - command name and arguments, args are `<required>` or `[optional]` and last may also be `variadic...`
|
||||
* @param description - description of executable command
|
||||
* @param opts - configuration options
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
command(nameAndArgs: string, description: string, opts?: commander.ExecutableCommandOptions): this;
|
||||
|
||||
/**
|
||||
* Factory routine to create a new unattached command.
|
||||
*
|
||||
* See .command() for creating an attached subcommand, which uses this routine to
|
||||
* create the command. You can override createCommand to customise subcommands.
|
||||
*/
|
||||
createCommand(name?: string): Command;
|
||||
|
||||
/**
|
||||
* Add a prepared subcommand.
|
||||
*
|
||||
* See .command() for creating an attached subcommand which inherits settings from its parent.
|
||||
*
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
addCommand(cmd: Command, opts?: CommandOptions): this;
|
||||
|
||||
/**
|
||||
* Define argument syntax for command.
|
||||
*
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
arguments(desc: string): this;
|
||||
|
||||
/**
|
||||
* Override default decision whether to add implicit help command.
|
||||
*
|
||||
* addHelpCommand() // force on
|
||||
* addHelpCommand(false); // force off
|
||||
* addHelpCommand('help [cmd]', 'display help for [cmd]'); // force on with custom details
|
||||
*
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
addHelpCommand(enableOrNameAndArgs?: string | boolean, description?: string): this;
|
||||
|
||||
/**
|
||||
* Register callback to use as replacement for calling process.exit.
|
||||
*/
|
||||
exitOverride(callback?: (err: CommanderError) => never|void): this;
|
||||
|
||||
/**
|
||||
* Register callback `fn` for the command.
|
||||
*
|
||||
* @example
|
||||
* program
|
||||
* .command('help')
|
||||
* .description('display verbose help')
|
||||
* .action(function() {
|
||||
* // output help here
|
||||
* });
|
||||
*
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
action(fn: (...args: any[]) => void | Promise<void>): this;
|
||||
|
||||
/**
|
||||
* Define option with `flags`, `description` and optional
|
||||
* coercion `fn`.
|
||||
*
|
||||
* The `flags` string should contain both the short and long flags,
|
||||
* separated by comma, a pipe or space. The following are all valid
|
||||
* all will output this way when `--help` is used.
|
||||
*
|
||||
* "-p, --pepper"
|
||||
* "-p|--pepper"
|
||||
* "-p --pepper"
|
||||
*
|
||||
* @example
|
||||
* // simple boolean defaulting to false
|
||||
* program.option('-p, --pepper', 'add pepper');
|
||||
*
|
||||
* --pepper
|
||||
* program.pepper
|
||||
* // => Boolean
|
||||
*
|
||||
* // simple boolean defaulting to true
|
||||
* program.option('-C, --no-cheese', 'remove cheese');
|
||||
*
|
||||
* program.cheese
|
||||
* // => true
|
||||
*
|
||||
* --no-cheese
|
||||
* program.cheese
|
||||
* // => false
|
||||
*
|
||||
* // required argument
|
||||
* program.option('-C, --chdir <path>', 'change the working directory');
|
||||
*
|
||||
* --chdir /tmp
|
||||
* program.chdir
|
||||
* // => "/tmp"
|
||||
*
|
||||
* // optional argument
|
||||
* program.option('-c, --cheese [type]', 'add cheese [marble]');
|
||||
*
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
option(flags: string, description?: string, defaultValue?: string | boolean): this;
|
||||
option(flags: string, description: string, regexp: RegExp, defaultValue?: string | boolean): this;
|
||||
option<T>(flags: string, description: string, fn: (value: string, previous: T) => T, defaultValue?: T): this;
|
||||
|
||||
/**
|
||||
* Define a required option, which must have a value after parsing. This usually means
|
||||
* the option must be specified on the command line. (Otherwise the same as .option().)
|
||||
*
|
||||
* The `flags` string should contain both the short and long flags, separated by comma, a pipe or space.
|
||||
*/
|
||||
requiredOption(flags: string, description?: string, defaultValue?: string | boolean): this;
|
||||
requiredOption(flags: string, description: string, regexp: RegExp, defaultValue?: string | boolean): this;
|
||||
requiredOption<T>(flags: string, description: string, fn: (value: string, previous: T) => T, defaultValue?: T): this;
|
||||
|
||||
/**
|
||||
* Whether to store option values as properties on command object,
|
||||
* or store separately (specify false). In both cases the option values can be accessed using .opts().
|
||||
*
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
storeOptionsAsProperties(value?: boolean): this;
|
||||
|
||||
/**
|
||||
* Whether to pass command to action handler,
|
||||
* or just the options (specify false).
|
||||
*
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
passCommandToAction(value?: boolean): this;
|
||||
|
||||
/**
|
||||
* Alter parsing of short flags with optional values.
|
||||
*
|
||||
* @example
|
||||
* // for `.option('-f,--flag [value]'):
|
||||
* .combineFlagAndOptionalValue(true) // `-f80` is treated like `--flag=80`, this is the default behaviour
|
||||
* .combineFlagAndOptionalValue(false) // `-fb` is treated like `-f -b`
|
||||
*
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
combineFlagAndOptionalValue(arg?: boolean): this;
|
||||
|
||||
/**
|
||||
* Allow unknown options on the command line.
|
||||
*
|
||||
* @param [arg] if `true` or omitted, no error will be thrown for unknown options.
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
allowUnknownOption(arg?: boolean): this;
|
||||
|
||||
/**
|
||||
* Parse `argv`, setting options and invoking commands when defined.
|
||||
*
|
||||
* The default expectation is that the arguments are from node and have the application as argv[0]
|
||||
* and the script being run in argv[1], with user parameters after that.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* program.parse(process.argv);
|
||||
* program.parse(); // implicitly use process.argv and auto-detect node vs electron conventions
|
||||
* program.parse(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
|
||||
*
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
parse(argv?: string[], options?: ParseOptions): this;
|
||||
|
||||
/**
|
||||
* Parse `argv`, setting options and invoking commands when defined.
|
||||
*
|
||||
* Use parseAsync instead of parse if any of your action handlers are async. Returns a Promise.
|
||||
*
|
||||
* The default expectation is that the arguments are from node and have the application as argv[0]
|
||||
* and the script being run in argv[1], with user parameters after that.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* program.parseAsync(process.argv);
|
||||
* program.parseAsync(); // implicitly use process.argv and auto-detect node vs electron conventions
|
||||
* program.parseAsync(my-args, { from: 'user' }); // just user supplied arguments, nothing special about argv[0]
|
||||
*
|
||||
* @returns Promise
|
||||
*/
|
||||
parseAsync(argv?: string[], options?: ParseOptions): Promise<this>;
|
||||
|
||||
/**
|
||||
* Parse options from `argv` removing known options,
|
||||
* and return argv split into operands and unknown arguments.
|
||||
*
|
||||
* @example
|
||||
* argv => operands, unknown
|
||||
* --known kkk op => [op], []
|
||||
* op --known kkk => [op], []
|
||||
* sub --unknown uuu op => [sub], [--unknown uuu op]
|
||||
* sub -- --unknown uuu op => [sub --unknown uuu op], []
|
||||
*/
|
||||
parseOptions(argv: string[]): commander.ParseOptionsResult;
|
||||
|
||||
/**
|
||||
* Return an object containing options as key-value pairs
|
||||
*/
|
||||
opts(): { [key: string]: any };
|
||||
|
||||
/**
|
||||
* Set the description.
|
||||
*
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
description(str: string, argsDescription?: {[argName: string]: string}): this;
|
||||
/**
|
||||
* Get the description.
|
||||
*/
|
||||
description(): string;
|
||||
|
||||
/**
|
||||
* Set an alias for the command.
|
||||
*
|
||||
* You may call more than once to add multiple aliases. Only the first alias is shown in the auto-generated help.
|
||||
*
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
alias(alias: string): this;
|
||||
/**
|
||||
* Get alias for the command.
|
||||
*/
|
||||
alias(): string;
|
||||
|
||||
/**
|
||||
* Set aliases for the command.
|
||||
*
|
||||
* Only the first alias is shown in the auto-generated help.
|
||||
*
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
aliases(aliases: string[]): this;
|
||||
/**
|
||||
* Get aliases for the command.
|
||||
*/
|
||||
aliases(): string[];
|
||||
|
||||
/**
|
||||
* Set the command usage.
|
||||
*
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
usage(str: string): this;
|
||||
/**
|
||||
* Get the command usage.
|
||||
*/
|
||||
usage(): string;
|
||||
|
||||
/**
|
||||
* Set the name of the command.
|
||||
*
|
||||
* @returns `this` command for chaining
|
||||
*/
|
||||
name(str: string): this;
|
||||
/**
|
||||
* Get the name of the command.
|
||||
*/
|
||||
name(): string;
|
||||
|
||||
/**
|
||||
* Output help information for this command.
|
||||
*
|
||||
* When listener(s) are available for the helpLongFlag
|
||||
* those callbacks are invoked.
|
||||
*/
|
||||
outputHelp(cb?: (str: string) => string): void;
|
||||
|
||||
/**
|
||||
* Return command help documentation.
|
||||
*/
|
||||
helpInformation(): string;
|
||||
|
||||
/**
|
||||
* You can pass in flags and a description to override the help
|
||||
* flags and help description for your command. Pass in false
|
||||
* to disable the built-in help option.
|
||||
*/
|
||||
helpOption(flags?: string | boolean, description?: string): this;
|
||||
|
||||
/**
|
||||
* Output help information and exit.
|
||||
*/
|
||||
help(cb?: (str: string) => string): never;
|
||||
|
||||
/**
|
||||
* Add a listener (callback) for when events occur. (Implemented using EventEmitter.)
|
||||
*
|
||||
* @example
|
||||
* program
|
||||
* .on('--help', () -> {
|
||||
* console.log('See web site for more information.');
|
||||
* });
|
||||
*/
|
||||
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
||||
}
|
||||
type CommandConstructor = new (name?: string) => Command;
|
||||
|
||||
interface CommandOptions {
|
||||
noHelp?: boolean; // old name for hidden
|
||||
hidden?: boolean;
|
||||
isDefault?: boolean;
|
||||
}
|
||||
interface ExecutableCommandOptions extends CommandOptions {
|
||||
executableFile?: string;
|
||||
}
|
||||
|
||||
interface ParseOptionsResult {
|
||||
operands: string[];
|
||||
unknown: string[];
|
||||
}
|
||||
|
||||
interface CommanderStatic extends Command {
|
||||
program: Command;
|
||||
Command: CommandConstructor;
|
||||
Option: OptionConstructor;
|
||||
CommanderError: CommanderErrorConstructor;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Declaring namespace AND global
|
||||
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
||||
declare const commander: commander.CommanderStatic;
|
||||
export = commander;
|
||||
1
node_modules/csvtojson/.coveralls.yml
generated
vendored
Normal file
1
node_modules/csvtojson/.coveralls.yml
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
repo_token: heQI90WrL7uiBgb87gsUokB6YqdnSfs6O
|
||||
1
node_modules/csvtojson/.nyc_output/081f64d5edb0cbe31f73fbc9234d8e0e.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/081f64d5edb0cbe31f73fbc9234d8e0e.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/csvtojson/.nyc_output/0b5b534d8fdda9c9e8b53fce635f391b.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/0b5b534d8fdda9c9e8b53fce635f391b.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/0b82538911259cd760273af57e1b568e.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/0b82538911259cd760273af57e1b568e.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/1fca5d8f4e8d0d7070af41ac05926b53.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/1fca5d8f4e8d0d7070af41ac05926b53.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/28300bac0b62bba7556e850269888b3a.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/28300bac0b62bba7556e850269888b3a.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/290a14ffd14b612104d733748fcb00ea.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/290a14ffd14b612104d733748fcb00ea.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/2d0a0489ff0595b8e4e6adccf81060c8.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/2d0a0489ff0595b8e4e6adccf81060c8.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/3285cdcafb8fcaecfa2fd1db8f6d35c1.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/3285cdcafb8fcaecfa2fd1db8f6d35c1.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/353a08632aa428048df9d67f46b2a943.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/353a08632aa428048df9d67f46b2a943.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/372af79153a72baeaaee8fac2c00326e.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/372af79153a72baeaaee8fac2c00326e.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/3c338e25b082cae5697e985e98a01fe0.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/3c338e25b082cae5697e985e98a01fe0.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/3f4b44285d46037be38e2a3fb692ca90.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/3f4b44285d46037be38e2a3fb692ca90.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/408532dd749511a552d2171e6dd846f9.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/408532dd749511a552d2171e6dd846f9.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/427f91d355efe544f3c08bef54b0cba4.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/427f91d355efe544f3c08bef54b0cba4.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/5295987c062fb22dfb962addac01e463.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/5295987c062fb22dfb962addac01e463.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/548df513a8d4bb28c35f0142c19e88da.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/548df513a8d4bb28c35f0142c19e88da.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/5aa3d5a9e40c7b393bcc5741ab892901.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/5aa3d5a9e40c7b393bcc5741ab892901.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/5be35f8b3b5266ff2eae0d4a535f9472.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/5be35f8b3b5266ff2eae0d4a535f9472.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/5e4760ecbfae5fa02da0dfc78b080df1.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/5e4760ecbfae5fa02da0dfc78b080df1.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/5ecfa6bb23b282fe433bacd19be3c301.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/5ecfa6bb23b282fe433bacd19be3c301.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/619b06b7be8e214e8fb326e4f336a7be.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/619b06b7be8e214e8fb326e4f336a7be.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/6ebc3edd99eabbc335501c2ab5302ffd.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/6ebc3edd99eabbc335501c2ab5302ffd.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/74d45bc2be4d60ae2bc0793cbb6bffcd.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/74d45bc2be4d60ae2bc0793cbb6bffcd.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/763b2880a165693362fce56b1ac899e3.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/763b2880a165693362fce56b1ac899e3.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/764c64567872f5beaff5721b469b15c8.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/764c64567872f5beaff5721b469b15c8.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/8324a746e7efbf67009c3427165fe910.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/8324a746e7efbf67009c3427165fe910.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/8f11bb580569edc78e9ac43a4e77ebf7.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/8f11bb580569edc78e9ac43a4e77ebf7.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/csvtojson/.nyc_output/934df09d48f9ab6d63432230cb8317bb.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/934df09d48f9ab6d63432230cb8317bb.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/95f40fd8e3124bf5095029ef2d7b2992.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/95f40fd8e3124bf5095029ef2d7b2992.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/a314d83b6e7be2c677c93ea6fbcdbdbc.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/a314d83b6e7be2c677c93ea6fbcdbdbc.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/ac79bb4f8b5a2c44b47ba0e0ff1981b8.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/ac79bb4f8b5a2c44b47ba0e0ff1981b8.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/b5b5ac11f64a1197639ab87ddf790f3f.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/b5b5ac11f64a1197639ab87ddf790f3f.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/c444d3abd00b76b655d8c52d1d6d9a18.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/c444d3abd00b76b655d8c52d1d6d9a18.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/d69c8a3cb089743a1c6fe6af1b55dcaf.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/d69c8a3cb089743a1c6fe6af1b55dcaf.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/d9ab5ea23a578236eda29d6fb5d81a89.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/d9ab5ea23a578236eda29d6fb5d81a89.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/ddbb6c792d436c4896dca99a6889d310.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/ddbb6c792d436c4896dca99a6889d310.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/e30b290de441d813f69836edb7b6bf69.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/e30b290de441d813f69836edb7b6bf69.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/e6b880f5dcf4799d52e940c12d2c0fc8.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/e6b880f5dcf4799d52e940c12d2c0fc8.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/f5bf0478c1625678749178bdb2e5098d.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/f5bf0478c1625678749178bdb2e5098d.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
node_modules/csvtojson/.nyc_output/f6e47582bba1716e24a1e52d01da6e9c.json
generated
vendored
Normal file
1
node_modules/csvtojson/.nyc_output/f6e47582bba1716e24a1e52d01da6e9c.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
7
node_modules/csvtojson/.travis.yml
generated
vendored
Normal file
7
node_modules/csvtojson/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "10"
|
||||
- "8"
|
||||
- "6"
|
||||
after_success: 'npm run coveralls'
|
||||
script: "npm run travis"
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function initParseRuntime(converter) {
|
||||
var params = converter.parseParam;
|
||||
var rtn = {
|
||||
needProcessIgnoreColumn: false,
|
||||
needProcessIncludeColumn: false,
|
||||
selectedColumns: undefined,
|
||||
ended: false,
|
||||
hasError: false,
|
||||
error: undefined,
|
||||
delimiter: converter.parseParam.delimiter,
|
||||
eol: converter.parseParam.eol,
|
||||
columnConv: [],
|
||||
headerType: [],
|
||||
headerTitle: [],
|
||||
headerFlag: [],
|
||||
headers: undefined,
|
||||
started: false,
|
||||
parsedLineNumber: 0,
|
||||
columnValueSetter: [],
|
||||
};
|
||||
if (params.ignoreColumns) {
|
||||
rtn.needProcessIgnoreColumn = true;
|
||||
}
|
||||
if (params.includeColumns) {
|
||||
rtn.needProcessIncludeColumn = true;
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
exports.initParseRuntime = initParseRuntime;
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiL1VzZXJzL2t4aWFuZy93b3JrL3Byb2plY3RzL2NzdjJqc29uL3NyYy9QYXJzZVJ1bnRpbWUudHMiLCJzb3VyY2VzIjpbIi9Vc2Vycy9reGlhbmcvd29yay9wcm9qZWN0cy9jc3YyanNvbi9zcmMvUGFyc2VSdW50aW1lLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBOERBLDBCQUFpQyxTQUFvQjtJQUNuRCxJQUFNLE1BQU0sR0FBRyxTQUFTLENBQUMsVUFBVSxDQUFDO0lBQ3BDLElBQU0sR0FBRyxHQUFpQjtRQUN4Qix1QkFBdUIsRUFBRSxLQUFLO1FBQzlCLHdCQUF3QixFQUFFLEtBQUs7UUFDL0IsZUFBZSxFQUFFLFNBQVM7UUFDMUIsS0FBSyxFQUFFLEtBQUs7UUFDWixRQUFRLEVBQUUsS0FBSztRQUNmLEtBQUssRUFBRSxTQUFTO1FBQ2hCLFNBQVMsRUFBRSxTQUFTLENBQUMsVUFBVSxDQUFDLFNBQVM7UUFDekMsR0FBRyxFQUFFLFNBQVMsQ0FBQyxVQUFVLENBQUMsR0FBRztRQUM3QixVQUFVLEVBQUUsRUFBRTtRQUNkLFVBQVUsRUFBRSxFQUFFO1FBQ2QsV0FBVyxFQUFFLEVBQUU7UUFDZixVQUFVLEVBQUUsRUFBRTtRQUNkLE9BQU8sRUFBRSxTQUFTO1FBQ2xCLE9BQU8sRUFBRSxLQUFLO1FBQ2QsZ0JBQWdCLEVBQUUsQ0FBQztRQUNuQixpQkFBaUIsRUFBRSxFQUFFO0tBQ3RCLENBQUE7SUFDRCxJQUFJLE1BQU0sQ0FBQyxhQUFhLEVBQUU7UUFDeEIsR0FBRyxDQUFDLHVCQUF1QixHQUFHLElBQUksQ0FBQztLQUNwQztJQUNELElBQUksTUFBTSxDQUFDLGNBQWMsRUFBRTtRQUN6QixHQUFHLENBQUMsd0JBQXdCLEdBQUcsSUFBSSxDQUFDO0tBQ3JDO0lBQ0QsT0FBTyxHQUFHLENBQUM7QUFDYixDQUFDO0FBM0JELDRDQTJCQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IENTVlBhcnNlUGFyYW0sIENlbGxQYXJzZXIgfSBmcm9tIFwiLi9QYXJhbWV0ZXJzXCI7XG5pbXBvcnQgeyBDb252ZXJ0ZXIsIFByZVJhd0RhdGFDYWxsYmFjaywgUHJlRmlsZUxpbmVDYWxsYmFjayB9IGZyb20gXCIuL0NvbnZlcnRlclwiO1xuaW1wb3J0IHsgQ2hpbGRQcm9jZXNzIH0gZnJvbSBcImNoaWxkX3Byb2Nlc3NcIjtcbmltcG9ydCBDU1ZFcnJvciBmcm9tIFwiLi9DU1ZFcnJvclwiO1xuXG5leHBvcnQgaW50ZXJmYWNlIFBhcnNlUnVudGltZSB7XG4gIC8qKlxuICAgKiBJZiBuZWVkIGNvbnZlcnQgaWdub3JlQ29sdW1uIGZyb20gY29sdW1uIG5hbWUoc3RyaW5nKSB0byBjb2x1bW4gaW5kZXggKG51bWJlcikuIFBhcnNlciBuZWVkcyBjb2x1bW4gaW5kZXguXG4gICAqL1xuICBuZWVkUHJvY2Vzc0lnbm9yZUNvbHVtbjogYm9vbGVhbjtcbiAgLyoqXG4gICAqIElmIG5lZWQgY29udmVydCBpbmNsdWRlQ29sdW1uIGZyb20gY29sdW1uIG5hbWUoc3RyaW5nKSB0byBjb2x1bW4gaW5kZXggKG51bWJlcikuIFBhcnNlciBuZWVkcyBjb2x1bW4gaW5kZXguXG4gICAqL1xuICBuZWVkUHJvY2Vzc0luY2x1ZGVDb2x1bW46IGJvb2xlYW47XG4gIC8qKlxuICAgKiB0aGUgaW5kZXhlcyBvZiBjb2x1bW5zIHRvIHJlc2VydmUsIHVuZGVmaW5lZCBtZWFucyByZXNlcnZlIGFsbCwgW10gbWVhbnMgaGlkZSBhbGxcbiAgICovXG4gIHNlbGVjdGVkQ29sdW1ucz86IG51bWJlcltdO1xuICBlbmRlZDogYm9vbGVhbjtcbiAgaGFzRXJyb3I6IGJvb2xlYW47XG4gIGVycm9yPzogRXJyb3I7XG4gIC8qKlxuICAgKiBJbmZlcnJlZCBkZWxpbWl0ZXJcbiAgICovXG4gIGRlbGltaXRlcjogc3RyaW5nIHwgc3RyaW5nW107XG4gIC8qKlxuICAgKiBJbmZlcnJlZCBlb2xcbiAgICovXG4gIGVvbD86IHN0cmluZztcbiAgLyoqXG4gICAqIENvbnZlcnRlciBmdW5jdGlvbiBmb3IgYSBjb2x1bW4uIFBvcHVsYXRlZCBhdCBydW50aW1lLlxuICAgKi9cbiAgY29sdW1uQ29udjogKENlbGxQYXJzZXIgfCBudWxsKVtdLFxuICBoZWFkZXJUeXBlOiBhbnlbXSxcbiAgaGVhZGVyVGl0bGU6IHN0cmluZ1tdLFxuICBoZWFkZXJGbGFnOiBhbnlbXSxcbiAgLyoqXG4gICAqIEluZmVycmVkIGhlYWRlcnNcbiAgICovXG4gIGhlYWRlcnM/OiBhbnlbXSxcbiAgY3N2TGluZUJ1ZmZlcj86IEJ1ZmZlcixcbiAgXG4gIC8qKlxuICAgKiBhZnRlciBmaXJzdCBjaHVuayBvZiBkYXRhIGJlaW5nIHByb2Nlc3NlZCBhbmQgZW1pdHRlZCwgc3RhcnRlZCB3aWxsIGJlY29tZSB0cnVlLlxuICAgKi9cbiAgc3RhcnRlZDogYm9vbGVhbixcbiAgcHJlUmF3RGF0YUhvb2s/OiBQcmVSYXdEYXRhQ2FsbGJhY2ssXG4gIHByZUZpbGVMaW5lSG9vaz86IFByZUZpbGVMaW5lQ2FsbGJhY2ssXG4gIHBhcnNlZExpbmVOdW1iZXI6IG51bWJlcixcblxuICBjb2x1bW5WYWx1ZVNldHRlcjogRnVuY3Rpb25bXTtcbiAgc3Vic2NyaWJlPzoge1xuICAgIG9uTmV4dD86IChkYXRhOiBhbnksIGxpbmVOdW1iZXI6bnVtYmVyKSA9PiB2b2lkIHwgUHJvbWlzZUxpa2U8dm9pZD47XG4gICAgb25FcnJvcj86IChlcnI6IENTVkVycm9yKSA9PiB2b2lkO1xuICAgIG9uQ29tcGxldGVkPzogKCkgPT4gdm9pZDtcbiAgfTtcbiAgdGhlbj86IHtcbiAgICBvbmZ1bGZpbGxlZDogKHZhbHVlOiBhbnlbXSkgPT4gYW55O1xuICAgIG9ucmVqZWN0ZWQ6IChlcnI6IEVycm9yKSA9PiBhbnk7XG4gIH1cblxufVxuZXhwb3J0IGZ1bmN0aW9uIGluaXRQYXJzZVJ1bnRpbWUoY29udmVydGVyOiBDb252ZXJ0ZXIpOiBQYXJzZVJ1bnRpbWUge1xuICBjb25zdCBwYXJhbXMgPSBjb252ZXJ0ZXIucGFyc2VQYXJhbTtcbiAgY29uc3QgcnRuOiBQYXJzZVJ1bnRpbWUgPSB7XG4gICAgbmVlZFByb2Nlc3NJZ25vcmVDb2x1bW46IGZhbHNlLFxuICAgIG5lZWRQcm9jZXNzSW5jbHVkZUNvbHVtbjogZmFsc2UsXG4gICAgc2VsZWN0ZWRDb2x1bW5zOiB1bmRlZmluZWQsXG4gICAgZW5kZWQ6IGZhbHNlLFxuICAgIGhhc0Vycm9yOiBmYWxzZSxcbiAgICBlcnJvcjogdW5kZWZpbmVkLFxuICAgIGRlbGltaXRlcjogY29udmVydGVyLnBhcnNlUGFyYW0uZGVsaW1pdGVyLFxuICAgIGVvbDogY29udmVydGVyLnBhcnNlUGFyYW0uZW9sLFxuICAgIGNvbHVtbkNvbnY6IFtdLFxuICAgIGhlYWRlclR5cGU6IFtdLFxuICAgIGhlYWRlclRpdGxlOiBbXSxcbiAgICBoZWFkZXJGbGFnOiBbXSxcbiAgICBoZWFkZXJzOiB1bmRlZmluZWQsXG4gICAgc3RhcnRlZDogZmFsc2UsXG4gICAgcGFyc2VkTGluZU51bWJlcjogMCxcbiAgICBjb2x1bW5WYWx1ZVNldHRlcjogW10sXG4gIH1cbiAgaWYgKHBhcmFtcy5pZ25vcmVDb2x1bW5zKSB7XG4gICAgcnRuLm5lZWRQcm9jZXNzSWdub3JlQ29sdW1uID0gdHJ1ZTtcbiAgfVxuICBpZiAocGFyYW1zLmluY2x1ZGVDb2x1bW5zKSB7XG4gICAgcnRuLm5lZWRQcm9jZXNzSW5jbHVkZUNvbHVtbiA9IHRydWU7XG4gIH1cbiAgcmV0dXJuIHJ0bjtcbn0iXX0=
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user