mirror of
https://github.com/thewesker/bug-em.git
synced 2025-12-22 04:51:05 -05:00
DMs
This commit is contained in:
1
node_modules/twit/node_modules/.bin/mime
generated
vendored
Symbolic link
1
node_modules/twit/node_modules/.bin/mime
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../mime/cli.js
|
||||
21
node_modules/twit/node_modules/bluebird/LICENSE
generated
vendored
Normal file
21
node_modules/twit/node_modules/bluebird/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2015 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.
|
||||
51
node_modules/twit/node_modules/bluebird/README.md
generated
vendored
Normal file
51
node_modules/twit/node_modules/bluebird/README.md
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<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).
|
||||
|
||||
# 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-2016 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/twit/node_modules/bluebird/changelog.md
generated
vendored
Normal file
1
node_modules/twit/node_modules/bluebird/changelog.md
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
[http://bluebirdjs.com/docs/changelog.html](http://bluebirdjs.com/docs/changelog.html)
|
||||
3654
node_modules/twit/node_modules/bluebird/js/browser/bluebird.core.js
generated
vendored
Normal file
3654
node_modules/twit/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/twit/node_modules/bluebird/js/browser/bluebird.core.min.js
generated
vendored
Normal file
31
node_modules/twit/node_modules/bluebird/js/browser/bluebird.core.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
5476
node_modules/twit/node_modules/bluebird/js/browser/bluebird.js
generated
vendored
Normal file
5476
node_modules/twit/node_modules/bluebird/js/browser/bluebird.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
31
node_modules/twit/node_modules/bluebird/js/browser/bluebird.min.js
generated
vendored
Normal file
31
node_modules/twit/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/twit/node_modules/bluebird/js/release/any.js
generated
vendored
Normal file
21
node_modules/twit/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/twit/node_modules/bluebird/js/release/assert.js
generated
vendored
Normal file
55
node_modules/twit/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;
|
||||
};
|
||||
})();
|
||||
166
node_modules/twit/node_modules/bluebird/js/release/async.js
generated
vendored
Normal file
166
node_modules/twit/node_modules/bluebird/js/release/async.js
generated
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
"use strict";
|
||||
var firstLineError;
|
||||
try {throw new Error(); } catch (e) {firstLineError = e;}
|
||||
var schedule = require("./schedule");
|
||||
var Queue = require("./queue");
|
||||
var util = require("./util");
|
||||
|
||||
function Async() {
|
||||
this._customScheduler = false;
|
||||
this._isTickUsed = false;
|
||||
this._lateQueue = new Queue(16);
|
||||
this._normalQueue = new Queue(16);
|
||||
this._haveDrainedQueues = false;
|
||||
this._trampolineEnabled = true;
|
||||
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.enableTrampoline = function() {
|
||||
this._trampolineEnabled = true;
|
||||
};
|
||||
|
||||
Async.prototype.disableTrampolineIfNecessary = function() {
|
||||
if (util.hasDevTools) {
|
||||
this._trampolineEnabled = false;
|
||||
}
|
||||
};
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
if (!util.hasDevTools) {
|
||||
Async.prototype.invokeLater = AsyncInvokeLater;
|
||||
Async.prototype.invoke = AsyncInvoke;
|
||||
Async.prototype.settlePromises = AsyncSettlePromises;
|
||||
} else {
|
||||
Async.prototype.invokeLater = function (fn, receiver, arg) {
|
||||
if (this._trampolineEnabled) {
|
||||
AsyncInvokeLater.call(this, fn, receiver, arg);
|
||||
} else {
|
||||
this._schedule(function() {
|
||||
setTimeout(function() {
|
||||
fn.call(receiver, arg);
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Async.prototype.invoke = function (fn, receiver, arg) {
|
||||
if (this._trampolineEnabled) {
|
||||
AsyncInvoke.call(this, fn, receiver, arg);
|
||||
} else {
|
||||
this._schedule(function() {
|
||||
fn.call(receiver, arg);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Async.prototype.settlePromises = function(promise) {
|
||||
if (this._trampolineEnabled) {
|
||||
AsyncSettlePromises.call(this, promise);
|
||||
} else {
|
||||
this._schedule(function() {
|
||||
promise._settlePromises();
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Async.prototype.invokeFirst = function (fn, receiver, arg) {
|
||||
this._normalQueue.unshift(fn, receiver, arg);
|
||||
this._queueTick();
|
||||
};
|
||||
|
||||
Async.prototype._drainQueue = function(queue) {
|
||||
while (queue.length() > 0) {
|
||||
var fn = queue.shift();
|
||||
if (typeof fn !== "function") {
|
||||
fn._settlePromises();
|
||||
continue;
|
||||
}
|
||||
var receiver = queue.shift();
|
||||
var arg = queue.shift();
|
||||
fn.call(receiver, arg);
|
||||
}
|
||||
};
|
||||
|
||||
Async.prototype._drainQueues = function () {
|
||||
this._drainQueue(this._normalQueue);
|
||||
this._reset();
|
||||
this._haveDrainedQueues = true;
|
||||
this._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/twit/node_modules/bluebird/js/release/bind.js
generated
vendored
Normal file
67
node_modules/twit/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/twit/node_modules/bluebird/js/release/bluebird.js
generated
vendored
Normal file
11
node_modules/twit/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/twit/node_modules/bluebird/js/release/call_get.js
generated
vendored
Normal file
123
node_modules/twit/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);
|
||||
};
|
||||
};
|
||||
125
node_modules/twit/node_modules/bluebird/js/release/cancel.js
generated
vendored
Normal file
125
node_modules/twit/node_modules/bluebird/js/release/cancel.js
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
"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();
|
||||
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._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/twit/node_modules/bluebird/js/release/catch_filter.js
generated
vendored
Normal file
42
node_modules/twit/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/twit/node_modules/bluebird/js/release/context.js
generated
vendored
Normal file
69
node_modules/twit/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;
|
||||
};
|
||||
855
node_modules/twit/node_modules/bluebird/js/release/debuggability.js
generated
vendored
Normal file
855
node_modules/twit/node_modules/bluebird/js/release/debuggability.js
generated
vendored
Normal file
@@ -0,0 +1,855 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise, Context) {
|
||||
var getDomain = Promise._getDomain;
|
||||
var async = Promise._async;
|
||||
var Warning = require("./errors").Warning;
|
||||
var util = require("./util");
|
||||
var canAttachTrace = util.canAttachTrace;
|
||||
var unhandledRejectionHandled;
|
||||
var possiblyUnhandledRejection;
|
||||
var bluebirdFramePattern =
|
||||
/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;
|
||||
var stackFramePattern = null;
|
||||
var formatStack = null;
|
||||
var indentStackFrames = false;
|
||||
var printWarning;
|
||||
var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 &&
|
||||
(false ||
|
||||
util.env("BLUEBIRD_DEBUG") ||
|
||||
util.env("NODE_ENV") === "development"));
|
||||
|
||||
var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 &&
|
||||
(debugging || util.env("BLUEBIRD_WARNINGS")));
|
||||
|
||||
var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 &&
|
||||
(debugging || util.env("BLUEBIRD_LONG_STACK_TRACES")));
|
||||
|
||||
var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 &&
|
||||
(warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
|
||||
|
||||
Promise.prototype.suppressUnhandledRejections = function() {
|
||||
var target = this._target();
|
||||
target._bitField = ((target._bitField & (~1048576)) |
|
||||
524288);
|
||||
};
|
||||
|
||||
Promise.prototype._ensurePossibleRejectionHandled = function () {
|
||||
if ((this._bitField & 524288) !== 0) return;
|
||||
this._setRejectionIsUnhandled();
|
||||
async.invokeLater(this._notifyUnhandledRejection, this, undefined);
|
||||
};
|
||||
|
||||
Promise.prototype._notifyUnhandledRejectionIsHandled = function () {
|
||||
fireRejectionEvent("rejectionHandled",
|
||||
unhandledRejectionHandled, undefined, this);
|
||||
};
|
||||
|
||||
Promise.prototype._setReturnedNonUndefined = function() {
|
||||
this._bitField = this._bitField | 268435456;
|
||||
};
|
||||
|
||||
Promise.prototype._returnedNonUndefined = function() {
|
||||
return (this._bitField & 268435456) !== 0;
|
||||
};
|
||||
|
||||
Promise.prototype._notifyUnhandledRejection = function () {
|
||||
if (this._isRejectionUnhandled()) {
|
||||
var reason = this._settledValue();
|
||||
this._setUnhandledRejectionIsNotified();
|
||||
fireRejectionEvent("unhandledRejection",
|
||||
possiblyUnhandledRejection, reason, this);
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._setUnhandledRejectionIsNotified = function () {
|
||||
this._bitField = this._bitField | 262144;
|
||||
};
|
||||
|
||||
Promise.prototype._unsetUnhandledRejectionIsNotified = function () {
|
||||
this._bitField = this._bitField & (~262144);
|
||||
};
|
||||
|
||||
Promise.prototype._isUnhandledRejectionNotified = function () {
|
||||
return (this._bitField & 262144) > 0;
|
||||
};
|
||||
|
||||
Promise.prototype._setRejectionIsUnhandled = function () {
|
||||
this._bitField = this._bitField | 1048576;
|
||||
};
|
||||
|
||||
Promise.prototype._unsetRejectionIsUnhandled = function () {
|
||||
this._bitField = this._bitField & (~1048576);
|
||||
if (this._isUnhandledRejectionNotified()) {
|
||||
this._unsetUnhandledRejectionIsNotified();
|
||||
this._notifyUnhandledRejectionIsHandled();
|
||||
}
|
||||
};
|
||||
|
||||
Promise.prototype._isRejectionUnhandled = function () {
|
||||
return (this._bitField & 1048576) > 0;
|
||||
};
|
||||
|
||||
Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) {
|
||||
return warn(message, shouldUseOwnTrace, promise || this);
|
||||
};
|
||||
|
||||
Promise.onPossiblyUnhandledRejection = function (fn) {
|
||||
var domain = getDomain();
|
||||
possiblyUnhandledRejection =
|
||||
typeof fn === "function" ? (domain === null ? fn : domain.bind(fn))
|
||||
: undefined;
|
||||
};
|
||||
|
||||
Promise.onUnhandledRejectionHandled = function (fn) {
|
||||
var domain = getDomain();
|
||||
unhandledRejectionHandled =
|
||||
typeof fn === "function" ? (domain === null ? fn : domain.bind(fn))
|
||||
: undefined;
|
||||
};
|
||||
|
||||
var disableLongStackTraces = function() {};
|
||||
Promise.longStackTraces = function () {
|
||||
if (async.haveItemsQueued() && !config.longStackTraces) {
|
||||
throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||
}
|
||||
if (!config.longStackTraces && longStackTracesIsSupported()) {
|
||||
var Promise_captureStackTrace = Promise.prototype._captureStackTrace;
|
||||
var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace;
|
||||
config.longStackTraces = true;
|
||||
disableLongStackTraces = function() {
|
||||
if (async.haveItemsQueued() && !config.longStackTraces) {
|
||||
throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||
}
|
||||
Promise.prototype._captureStackTrace = Promise_captureStackTrace;
|
||||
Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;
|
||||
Context.deactivateLongStackTraces();
|
||||
async.enableTrampoline();
|
||||
config.longStackTraces = false;
|
||||
};
|
||||
Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
|
||||
Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
|
||||
Context.activateLongStackTraces();
|
||||
async.disableTrampolineIfNecessary();
|
||||
}
|
||||
};
|
||||
|
||||
Promise.hasLongStackTraces = function () {
|
||||
return config.longStackTraces && longStackTracesIsSupported();
|
||||
};
|
||||
|
||||
var fireDomEvent = (function() {
|
||||
try {
|
||||
var event = document.createEvent("CustomEvent");
|
||||
event.initCustomEvent("testingtheevent", false, true, {});
|
||||
util.global.dispatchEvent(event);
|
||||
return function(name, event) {
|
||||
var domEvent = document.createEvent("CustomEvent");
|
||||
domEvent.initCustomEvent(name.toLowerCase(), false, true, event);
|
||||
return !util.global.dispatchEvent(domEvent);
|
||||
};
|
||||
} catch (e) {}
|
||||
return function() {
|
||||
return false;
|
||||
};
|
||||
})();
|
||||
|
||||
var fireGlobalEvent = (function() {
|
||||
if (util.isNode) {
|
||||
return function() {
|
||||
return process.emit.apply(process, arguments);
|
||||
};
|
||||
} else {
|
||||
if (!util.global) {
|
||||
return function() {
|
||||
return false;
|
||||
};
|
||||
}
|
||||
return function(name) {
|
||||
var methodName = "on" + name.toLowerCase();
|
||||
var method = util.global[methodName];
|
||||
if (!method) return false;
|
||||
method.apply(util.global, [].slice.call(arguments, 1));
|
||||
return true;
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
||||
function generatePromiseLifecycleEventObject(name, promise) {
|
||||
return {promise: promise};
|
||||
}
|
||||
|
||||
var eventToObjectGenerator = {
|
||||
promiseCreated: generatePromiseLifecycleEventObject,
|
||||
promiseFulfilled: generatePromiseLifecycleEventObject,
|
||||
promiseRejected: generatePromiseLifecycleEventObject,
|
||||
promiseResolved: generatePromiseLifecycleEventObject,
|
||||
promiseCancelled: generatePromiseLifecycleEventObject,
|
||||
promiseChained: function(name, promise, child) {
|
||||
return {promise: promise, child: child};
|
||||
},
|
||||
warning: function(name, warning) {
|
||||
return {warning: warning};
|
||||
},
|
||||
unhandledRejection: function (name, reason, promise) {
|
||||
return {reason: reason, promise: promise};
|
||||
},
|
||||
rejectionHandled: generatePromiseLifecycleEventObject
|
||||
};
|
||||
|
||||
var activeFireEvent = function (name) {
|
||||
var globalEventFired = false;
|
||||
try {
|
||||
globalEventFired = fireGlobalEvent.apply(null, arguments);
|
||||
} catch (e) {
|
||||
async.throwLater(e);
|
||||
globalEventFired = true;
|
||||
}
|
||||
|
||||
var domEventFired = false;
|
||||
try {
|
||||
domEventFired = fireDomEvent(name,
|
||||
eventToObjectGenerator[name].apply(null, arguments));
|
||||
} catch (e) {
|
||||
async.throwLater(e);
|
||||
domEventFired = true;
|
||||
}
|
||||
|
||||
return domEventFired || globalEventFired;
|
||||
};
|
||||
|
||||
Promise.config = function(opts) {
|
||||
opts = Object(opts);
|
||||
if ("longStackTraces" in opts) {
|
||||
if (opts.longStackTraces) {
|
||||
Promise.longStackTraces();
|
||||
} else if (!opts.longStackTraces && Promise.hasLongStackTraces()) {
|
||||
disableLongStackTraces();
|
||||
}
|
||||
}
|
||||
if ("warnings" in opts) {
|
||||
var warningsOption = opts.warnings;
|
||||
config.warnings = !!warningsOption;
|
||||
wForgottenReturn = config.warnings;
|
||||
|
||||
if (util.isObject(warningsOption)) {
|
||||
if ("wForgottenReturn" in warningsOption) {
|
||||
wForgottenReturn = !!warningsOption.wForgottenReturn;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ("cancellation" in opts && opts.cancellation && !config.cancellation) {
|
||||
if (async.haveItemsQueued()) {
|
||||
throw new Error(
|
||||
"cannot enable cancellation after promises are in use");
|
||||
}
|
||||
Promise.prototype._clearCancellationData =
|
||||
cancellationClearCancellationData;
|
||||
Promise.prototype._propagateFrom = cancellationPropagateFrom;
|
||||
Promise.prototype._onCancel = cancellationOnCancel;
|
||||
Promise.prototype._setOnCancel = cancellationSetOnCancel;
|
||||
Promise.prototype._attachCancellationCallback =
|
||||
cancellationAttachCancellationCallback;
|
||||
Promise.prototype._execute = cancellationExecute;
|
||||
propagateFromFunction = cancellationPropagateFrom;
|
||||
config.cancellation = true;
|
||||
}
|
||||
if ("monitoring" in opts) {
|
||||
if (opts.monitoring && !config.monitoring) {
|
||||
config.monitoring = true;
|
||||
Promise.prototype._fireEvent = activeFireEvent;
|
||||
} else if (!opts.monitoring && config.monitoring) {
|
||||
config.monitoring = false;
|
||||
Promise.prototype._fireEvent = defaultFireEvent;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function defaultFireEvent() { return false; }
|
||||
|
||||
Promise.prototype._fireEvent = defaultFireEvent;
|
||||
Promise.prototype._execute = function(executor, resolve, reject) {
|
||||
try {
|
||||
executor(resolve, reject);
|
||||
} catch (e) {
|
||||
return e;
|
||||
}
|
||||
};
|
||||
Promise.prototype._onCancel = function () {};
|
||||
Promise.prototype._setOnCancel = function (handler) { ; };
|
||||
Promise.prototype._attachCancellationCallback = function(onCancel) {
|
||||
;
|
||||
};
|
||||
Promise.prototype._captureStackTrace = function () {};
|
||||
Promise.prototype._attachExtraTrace = function () {};
|
||||
Promise.prototype._clearCancellationData = function() {};
|
||||
Promise.prototype._propagateFrom = function (parent, flags) {
|
||||
;
|
||||
;
|
||||
};
|
||||
|
||||
function cancellationExecute(executor, resolve, reject) {
|
||||
var promise = this;
|
||||
try {
|
||||
executor(resolve, reject, function(onCancel) {
|
||||
if (typeof onCancel !== "function") {
|
||||
throw new TypeError("onCancel must be a function, got: " +
|
||||
util.toString(onCancel));
|
||||
}
|
||||
promise._attachCancellationCallback(onCancel);
|
||||
});
|
||||
} catch (e) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
function cancellationAttachCancellationCallback(onCancel) {
|
||||
if (!this.isCancellable()) return this;
|
||||
|
||||
var previousOnCancel = this._onCancel();
|
||||
if (previousOnCancel !== undefined) {
|
||||
if (util.isArray(previousOnCancel)) {
|
||||
previousOnCancel.push(onCancel);
|
||||
} else {
|
||||
this._setOnCancel([previousOnCancel, onCancel]);
|
||||
}
|
||||
} else {
|
||||
this._setOnCancel(onCancel);
|
||||
}
|
||||
}
|
||||
|
||||
function cancellationOnCancel() {
|
||||
return this._onCancelField;
|
||||
}
|
||||
|
||||
function cancellationSetOnCancel(onCancel) {
|
||||
this._onCancelField = onCancel;
|
||||
}
|
||||
|
||||
function cancellationClearCancellationData() {
|
||||
this._cancellationParent = undefined;
|
||||
this._onCancelField = undefined;
|
||||
}
|
||||
|
||||
function cancellationPropagateFrom(parent, flags) {
|
||||
if ((flags & 1) !== 0) {
|
||||
this._cancellationParent = parent;
|
||||
var branchesRemainingToCancel = parent._branchesRemainingToCancel;
|
||||
if (branchesRemainingToCancel === undefined) {
|
||||
branchesRemainingToCancel = 0;
|
||||
}
|
||||
parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;
|
||||
}
|
||||
if ((flags & 2) !== 0 && parent._isBound()) {
|
||||
this._setBoundTo(parent._boundTo);
|
||||
}
|
||||
}
|
||||
|
||||
function bindingPropagateFrom(parent, flags) {
|
||||
if ((flags & 2) !== 0 && parent._isBound()) {
|
||||
this._setBoundTo(parent._boundTo);
|
||||
}
|
||||
}
|
||||
var propagateFromFunction = bindingPropagateFrom;
|
||||
|
||||
function boundValueFunction() {
|
||||
var ret = this._boundTo;
|
||||
if (ret !== undefined) {
|
||||
if (ret instanceof Promise) {
|
||||
if (ret.isFulfilled()) {
|
||||
return ret.value();
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function longStackTracesCaptureStackTrace() {
|
||||
this._trace = new CapturedTrace(this._peekContext());
|
||||
}
|
||||
|
||||
function longStackTracesAttachExtraTrace(error, ignoreSelf) {
|
||||
if (canAttachTrace(error)) {
|
||||
var trace = this._trace;
|
||||
if (trace !== undefined) {
|
||||
if (ignoreSelf) trace = trace._parent;
|
||||
}
|
||||
if (trace !== undefined) {
|
||||
trace.attachExtraTrace(error);
|
||||
} else if (!error.__stackCleaned__) {
|
||||
var parsed = parseStackAndMessage(error);
|
||||
util.notEnumerableProp(error, "stack",
|
||||
parsed.message + "\n" + parsed.stack.join("\n"));
|
||||
util.notEnumerableProp(error, "__stackCleaned__", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkForgottenReturns(returnValue, promiseCreated, name, promise,
|
||||
parent) {
|
||||
if (returnValue === undefined && promiseCreated !== null &&
|
||||
wForgottenReturn) {
|
||||
if (parent !== undefined && parent._returnedNonUndefined()) return;
|
||||
if ((promise._bitField & 65535) === 0) return;
|
||||
|
||||
if (name) name = name + " ";
|
||||
var msg = "a promise was created in a " + name +
|
||||
"handler but was not returned from it";
|
||||
promise._warn(msg, true, promiseCreated);
|
||||
}
|
||||
}
|
||||
|
||||
function deprecated(name, replacement) {
|
||||
var message = name +
|
||||
" is deprecated and will be removed in a future version.";
|
||||
if (replacement) message += " Use " + replacement + " instead.";
|
||||
return warn(message);
|
||||
}
|
||||
|
||||
function warn(message, shouldUseOwnTrace, promise) {
|
||||
if (!config.warnings) return;
|
||||
var warning = new Warning(message);
|
||||
var ctx;
|
||||
if (shouldUseOwnTrace) {
|
||||
promise._attachExtraTrace(warning);
|
||||
} else if (config.longStackTraces && (ctx = Promise._peekContext())) {
|
||||
ctx.attachExtraTrace(warning);
|
||||
} else {
|
||||
var parsed = parseStackAndMessage(warning);
|
||||
warning.stack = parsed.message + "\n" + parsed.stack.join("\n");
|
||||
}
|
||||
|
||||
if (!activeFireEvent("warning", warning)) {
|
||||
formatAndLogError(warning, "", true);
|
||||
}
|
||||
}
|
||||
|
||||
function reconstructStack(message, stacks) {
|
||||
for (var i = 0; i < stacks.length - 1; ++i) {
|
||||
stacks[i].push("From previous event:");
|
||||
stacks[i] = stacks[i].join("\n");
|
||||
}
|
||||
if (i < stacks.length) {
|
||||
stacks[i] = stacks[i].join("\n");
|
||||
}
|
||||
return message + "\n" + stacks.join("\n");
|
||||
}
|
||||
|
||||
function removeDuplicateOrEmptyJumps(stacks) {
|
||||
for (var i = 0; i < stacks.length; ++i) {
|
||||
if (stacks[i].length === 0 ||
|
||||
((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) {
|
||||
stacks.splice(i, 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeCommonRoots(stacks) {
|
||||
var current = stacks[0];
|
||||
for (var i = 1; i < stacks.length; ++i) {
|
||||
var prev = stacks[i];
|
||||
var currentLastIndex = current.length - 1;
|
||||
var currentLastLine = current[currentLastIndex];
|
||||
var commonRootMeetPoint = -1;
|
||||
|
||||
for (var j = prev.length - 1; j >= 0; --j) {
|
||||
if (prev[j] === currentLastLine) {
|
||||
commonRootMeetPoint = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (var j = commonRootMeetPoint; j >= 0; --j) {
|
||||
var line = prev[j];
|
||||
if (current[currentLastIndex] === line) {
|
||||
current.pop();
|
||||
currentLastIndex--;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
current = prev;
|
||||
}
|
||||
}
|
||||
|
||||
function cleanStack(stack) {
|
||||
var ret = [];
|
||||
for (var i = 0; i < stack.length; ++i) {
|
||||
var line = stack[i];
|
||||
var isTraceLine = " (No stack trace)" === line ||
|
||||
stackFramePattern.test(line);
|
||||
var isInternalFrame = isTraceLine && shouldIgnore(line);
|
||||
if (isTraceLine && !isInternalFrame) {
|
||||
if (indentStackFrames && line.charAt(0) !== " ") {
|
||||
line = " " + line;
|
||||
}
|
||||
ret.push(line);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function stackFramesAsArray(error) {
|
||||
var stack = error.stack.replace(/\s+$/g, "").split("\n");
|
||||
for (var i = 0; i < stack.length; ++i) {
|
||||
var line = stack[i];
|
||||
if (" (No stack trace)" === line || stackFramePattern.test(line)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i > 0) {
|
||||
stack = stack.slice(i);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
function parseStackAndMessage(error) {
|
||||
var stack = error.stack;
|
||||
var message = error.toString();
|
||||
stack = typeof stack === "string" && stack.length > 0
|
||||
? stackFramesAsArray(error) : [" (No stack trace)"];
|
||||
return {
|
||||
message: message,
|
||||
stack: cleanStack(stack)
|
||||
};
|
||||
}
|
||||
|
||||
function formatAndLogError(error, title, isSoft) {
|
||||
if (typeof console !== "undefined") {
|
||||
var message;
|
||||
if (util.isObject(error)) {
|
||||
var stack = error.stack;
|
||||
message = title + formatStack(stack, error);
|
||||
} else {
|
||||
message = title + String(error);
|
||||
}
|
||||
if (typeof printWarning === "function") {
|
||||
printWarning(message, isSoft);
|
||||
} else if (typeof console.log === "function" ||
|
||||
typeof console.log === "object") {
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fireRejectionEvent(name, localHandler, reason, promise) {
|
||||
var localEventFired = false;
|
||||
try {
|
||||
if (typeof localHandler === "function") {
|
||||
localEventFired = true;
|
||||
if (name === "rejectionHandled") {
|
||||
localHandler(promise);
|
||||
} else {
|
||||
localHandler(reason, promise);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
async.throwLater(e);
|
||||
}
|
||||
|
||||
if (name === "unhandledRejection") {
|
||||
if (!activeFireEvent(name, reason, promise) && !localEventFired) {
|
||||
formatAndLogError(reason, "Unhandled rejection ");
|
||||
}
|
||||
} else {
|
||||
activeFireEvent(name, promise);
|
||||
}
|
||||
}
|
||||
|
||||
function formatNonError(obj) {
|
||||
var str;
|
||||
if (typeof obj === "function") {
|
||||
str = "[function " +
|
||||
(obj.name || "anonymous") +
|
||||
"]";
|
||||
} else {
|
||||
str = obj && typeof obj.toString === "function"
|
||||
? obj.toString() : util.toString(obj);
|
||||
var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/;
|
||||
if (ruselessToString.test(str)) {
|
||||
try {
|
||||
var newStr = JSON.stringify(obj);
|
||||
str = newStr;
|
||||
}
|
||||
catch(e) {
|
||||
|
||||
}
|
||||
}
|
||||
if (str.length === 0) {
|
||||
str = "(empty array)";
|
||||
}
|
||||
}
|
||||
return ("(<" + snip(str) + ">, no stack trace)");
|
||||
}
|
||||
|
||||
function snip(str) {
|
||||
var maxChars = 41;
|
||||
if (str.length < maxChars) {
|
||||
return str;
|
||||
}
|
||||
return str.substr(0, maxChars - 3) + "...";
|
||||
}
|
||||
|
||||
function longStackTracesIsSupported() {
|
||||
return typeof captureStackTrace === "function";
|
||||
}
|
||||
|
||||
var shouldIgnore = function() { return false; };
|
||||
var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;
|
||||
function parseLineInfo(line) {
|
||||
var matches = line.match(parseLineInfoRegex);
|
||||
if (matches) {
|
||||
return {
|
||||
fileName: matches[1],
|
||||
line: parseInt(matches[2], 10)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function setBounds(firstLineError, lastLineError) {
|
||||
if (!longStackTracesIsSupported()) return;
|
||||
var firstStackLines = firstLineError.stack.split("\n");
|
||||
var lastStackLines = lastLineError.stack.split("\n");
|
||||
var firstIndex = -1;
|
||||
var lastIndex = -1;
|
||||
var firstFileName;
|
||||
var lastFileName;
|
||||
for (var i = 0; i < firstStackLines.length; ++i) {
|
||||
var result = parseLineInfo(firstStackLines[i]);
|
||||
if (result) {
|
||||
firstFileName = result.fileName;
|
||||
firstIndex = result.line;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < lastStackLines.length; ++i) {
|
||||
var result = parseLineInfo(lastStackLines[i]);
|
||||
if (result) {
|
||||
lastFileName = result.fileName;
|
||||
lastIndex = result.line;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName ||
|
||||
firstFileName !== lastFileName || firstIndex >= lastIndex) {
|
||||
return;
|
||||
}
|
||||
|
||||
shouldIgnore = function(line) {
|
||||
if (bluebirdFramePattern.test(line)) return true;
|
||||
var info = parseLineInfo(line);
|
||||
if (info) {
|
||||
if (info.fileName === firstFileName &&
|
||||
(firstIndex <= info.line && info.line <= lastIndex)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
function CapturedTrace(parent) {
|
||||
this._parent = parent;
|
||||
this._promisesCreated = 0;
|
||||
var length = this._length = 1 + (parent === undefined ? 0 : parent._length);
|
||||
captureStackTrace(this, CapturedTrace);
|
||||
if (length > 32) this.uncycle();
|
||||
}
|
||||
util.inherits(CapturedTrace, Error);
|
||||
Context.CapturedTrace = CapturedTrace;
|
||||
|
||||
CapturedTrace.prototype.uncycle = function() {
|
||||
var length = this._length;
|
||||
if (length < 2) return;
|
||||
var nodes = [];
|
||||
var stackToIndex = {};
|
||||
|
||||
for (var i = 0, node = this; node !== undefined; ++i) {
|
||||
nodes.push(node);
|
||||
node = node._parent;
|
||||
}
|
||||
length = this._length = i;
|
||||
for (var i = length - 1; i >= 0; --i) {
|
||||
var stack = nodes[i].stack;
|
||||
if (stackToIndex[stack] === undefined) {
|
||||
stackToIndex[stack] = i;
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < length; ++i) {
|
||||
var currentStack = nodes[i].stack;
|
||||
var index = stackToIndex[currentStack];
|
||||
if (index !== undefined && index !== i) {
|
||||
if (index > 0) {
|
||||
nodes[index - 1]._parent = undefined;
|
||||
nodes[index - 1]._length = 1;
|
||||
}
|
||||
nodes[i]._parent = undefined;
|
||||
nodes[i]._length = 1;
|
||||
var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;
|
||||
|
||||
if (index < length - 1) {
|
||||
cycleEdgeNode._parent = nodes[index + 1];
|
||||
cycleEdgeNode._parent.uncycle();
|
||||
cycleEdgeNode._length =
|
||||
cycleEdgeNode._parent._length + 1;
|
||||
} else {
|
||||
cycleEdgeNode._parent = undefined;
|
||||
cycleEdgeNode._length = 1;
|
||||
}
|
||||
var currentChildLength = cycleEdgeNode._length + 1;
|
||||
for (var j = i - 2; j >= 0; --j) {
|
||||
nodes[j]._length = currentChildLength;
|
||||
currentChildLength++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CapturedTrace.prototype.attachExtraTrace = function(error) {
|
||||
if (error.__stackCleaned__) return;
|
||||
this.uncycle();
|
||||
var parsed = parseStackAndMessage(error);
|
||||
var message = parsed.message;
|
||||
var stacks = [parsed.stack];
|
||||
|
||||
var trace = this;
|
||||
while (trace !== undefined) {
|
||||
stacks.push(cleanStack(trace.stack.split("\n")));
|
||||
trace = trace._parent;
|
||||
}
|
||||
removeCommonRoots(stacks);
|
||||
removeDuplicateOrEmptyJumps(stacks);
|
||||
util.notEnumerableProp(error, "stack", reconstructStack(message, stacks));
|
||||
util.notEnumerableProp(error, "__stackCleaned__", true);
|
||||
};
|
||||
|
||||
var captureStackTrace = (function stackDetection() {
|
||||
var v8stackFramePattern = /^\s*at\s*/;
|
||||
var v8stackFormatter = function(stack, error) {
|
||||
if (typeof stack === "string") return stack;
|
||||
|
||||
if (error.name !== undefined &&
|
||||
error.message !== undefined) {
|
||||
return error.toString();
|
||||
}
|
||||
return formatNonError(error);
|
||||
};
|
||||
|
||||
if (typeof Error.stackTraceLimit === "number" &&
|
||||
typeof Error.captureStackTrace === "function") {
|
||||
Error.stackTraceLimit += 6;
|
||||
stackFramePattern = v8stackFramePattern;
|
||||
formatStack = v8stackFormatter;
|
||||
var captureStackTrace = Error.captureStackTrace;
|
||||
|
||||
shouldIgnore = function(line) {
|
||||
return bluebirdFramePattern.test(line);
|
||||
};
|
||||
return function(receiver, ignoreUntil) {
|
||||
Error.stackTraceLimit += 6;
|
||||
captureStackTrace(receiver, ignoreUntil);
|
||||
Error.stackTraceLimit -= 6;
|
||||
};
|
||||
}
|
||||
var err = new Error();
|
||||
|
||||
if (typeof err.stack === "string" &&
|
||||
err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) {
|
||||
stackFramePattern = /@/;
|
||||
formatStack = v8stackFormatter;
|
||||
indentStackFrames = true;
|
||||
return function captureStackTrace(o) {
|
||||
o.stack = new Error().stack;
|
||||
};
|
||||
}
|
||||
|
||||
var hasStackAfterThrow;
|
||||
try { throw new Error(); }
|
||||
catch(e) {
|
||||
hasStackAfterThrow = ("stack" in e);
|
||||
}
|
||||
if (!("stack" in err) && hasStackAfterThrow &&
|
||||
typeof Error.stackTraceLimit === "number") {
|
||||
stackFramePattern = v8stackFramePattern;
|
||||
formatStack = v8stackFormatter;
|
||||
return function captureStackTrace(o) {
|
||||
Error.stackTraceLimit += 6;
|
||||
try { throw new Error(); }
|
||||
catch(e) { o.stack = e.stack; }
|
||||
Error.stackTraceLimit -= 6;
|
||||
};
|
||||
}
|
||||
|
||||
formatStack = function(stack, error) {
|
||||
if (typeof stack === "string") return stack;
|
||||
|
||||
if ((typeof error === "object" ||
|
||||
typeof error === "function") &&
|
||||
error.name !== undefined &&
|
||||
error.message !== undefined) {
|
||||
return error.toString();
|
||||
}
|
||||
return formatNonError(error);
|
||||
};
|
||||
|
||||
return null;
|
||||
|
||||
})([]);
|
||||
|
||||
if (typeof console !== "undefined" && typeof console.warn !== "undefined") {
|
||||
printWarning = function (message) {
|
||||
console.warn(message);
|
||||
};
|
||||
if (util.isNode && process.stderr.isTTY) {
|
||||
printWarning = function(message, isSoft) {
|
||||
var color = isSoft ? "\u001b[33m" : "\u001b[31m";
|
||||
console.warn(color + message + "\u001b[0m\n");
|
||||
};
|
||||
} else if (!util.isNode && typeof (new Error().stack) === "string") {
|
||||
printWarning = function(message, isSoft) {
|
||||
console.warn("%c" + message,
|
||||
isSoft ? "color: darkorange" : "color: red");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var config = {
|
||||
warnings: warnings,
|
||||
longStackTraces: false,
|
||||
cancellation: false,
|
||||
monitoring: false
|
||||
};
|
||||
|
||||
if (longStackTraces) Promise.longStackTraces();
|
||||
|
||||
return {
|
||||
longStackTraces: function() {
|
||||
return config.longStackTraces;
|
||||
},
|
||||
warnings: function() {
|
||||
return config.warnings;
|
||||
},
|
||||
cancellation: function() {
|
||||
return config.cancellation;
|
||||
},
|
||||
monitoring: function() {
|
||||
return config.monitoring;
|
||||
},
|
||||
propagateFromFunction: function() {
|
||||
return propagateFromFunction;
|
||||
},
|
||||
boundValueFunction: function() {
|
||||
return boundValueFunction;
|
||||
},
|
||||
checkForgottenReturns: checkForgottenReturns,
|
||||
setBounds: setBounds,
|
||||
warn: warn,
|
||||
deprecated: deprecated,
|
||||
CapturedTrace: CapturedTrace,
|
||||
fireDomEvent: fireDomEvent,
|
||||
fireGlobalEvent: fireGlobalEvent
|
||||
};
|
||||
};
|
||||
46
node_modules/twit/node_modules/bluebird/js/release/direct_resolve.js
generated
vendored
Normal file
46
node_modules/twit/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);
|
||||
}
|
||||
};
|
||||
};
|
||||
29
node_modules/twit/node_modules/bluebird/js/release/each.js
generated
vendored
Normal file
29
node_modules/twit/node_modules/bluebird/js/release/each.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"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 this.mapSeries(fn)
|
||||
._then(promiseAllThis, undefined, undefined, this, undefined);
|
||||
};
|
||||
|
||||
Promise.prototype.mapSeries = function (fn) {
|
||||
return PromiseReduce(this, fn, INTERNAL, INTERNAL);
|
||||
};
|
||||
|
||||
Promise.each = function (promises, fn) {
|
||||
return PromiseMapSeries(promises, fn)
|
||||
._then(promiseAllThis, undefined, undefined, promises, undefined);
|
||||
};
|
||||
|
||||
Promise.mapSeries = PromiseMapSeries;
|
||||
};
|
||||
116
node_modules/twit/node_modules/bluebird/js/release/errors.js
generated
vendored
Normal file
116
node_modules/twit/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/twit/node_modules/bluebird/js/release/es5.js
generated
vendored
Normal file
80
node_modules/twit/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/twit/node_modules/bluebird/js/release/filter.js
generated
vendored
Normal file
12
node_modules/twit/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);
|
||||
};
|
||||
};
|
||||
111
node_modules/twit/node_modules/bluebird/js/release/finally.js
generated
vendored
Normal file
111
node_modules/twit/node_modules/bluebird/js/release/finally.js
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise, tryConvertToPromise) {
|
||||
var util = require("./util");
|
||||
var CancellationError = Promise.CancellationError;
|
||||
var errorObj = util.errorObj;
|
||||
|
||||
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 !== 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);
|
||||
};
|
||||
|
||||
return PassThroughHandlerContext;
|
||||
};
|
||||
219
node_modules/twit/node_modules/bluebird/js/release/generators.js
generated
vendored
Normal file
219
node_modules/twit/node_modules/bluebird/js/release/generators.js
generated
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
"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", 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)) {
|
||||
this._promiseFulfilled(maybePromise._value());
|
||||
} else if (((bitField & 16777216) !== 0)) {
|
||||
this._promiseRejected(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;
|
||||
};
|
||||
};
|
||||
149
node_modules/twit/node_modules/bluebird/js/release/join.js
generated
vendored
Normal file
149
node_modules/twit/node_modules/bluebird/js/release/join.js
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
"use strict";
|
||||
module.exports =
|
||||
function(Promise, PromiseArray, tryConvertToPromise, INTERNAL) {
|
||||
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) { \n\
|
||||
'use strict'; \n\
|
||||
function [TheName](fn) { \n\
|
||||
[TheProperties] \n\
|
||||
this.fn = fn; \n\
|
||||
this.now = 0; \n\
|
||||
} \n\
|
||||
[TheName].prototype.checkFulfillment = function(promise) { \n\
|
||||
var now = ++this.now; \n\
|
||||
if (now === [TheTotal]) { \n\
|
||||
promise._pushContext(); \n\
|
||||
var callback = this.fn; \n\
|
||||
var ret = tryCatch(callback)([ThePassedArguments]); \n\
|
||||
promise._popContext(); \n\
|
||||
if (ret === errorObj) { \n\
|
||||
promise._rejectCallback(ret.e, false); \n\
|
||||
} else { \n\
|
||||
promise._resolveCallback(ret); \n\
|
||||
} \n\
|
||||
} \n\
|
||||
}; \n\
|
||||
\n\
|
||||
[TheName].prototype._resultCancelled = function() { \n\
|
||||
[CancellationCode] \n\
|
||||
}; \n\
|
||||
\n\
|
||||
return [TheName]; \n\
|
||||
}(tryCatch, errorObj, Promise); \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", code)
|
||||
(tryCatch, errorObj, Promise);
|
||||
};
|
||||
|
||||
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);
|
||||
} 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()) {
|
||||
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;
|
||||
};
|
||||
|
||||
};
|
||||
164
node_modules/twit/node_modules/bluebird/js/release/map.js
generated
vendored
Normal file
164
node_modules/twit/node_modules/bluebird/js/release/map.js
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise,
|
||||
PromiseArray,
|
||||
apiRejection,
|
||||
tryConvertToPromise,
|
||||
INTERNAL,
|
||||
debug) {
|
||||
var getDomain = Promise._getDomain;
|
||||
var util = require("./util");
|
||||
var tryCatch = util.tryCatch;
|
||||
var errorObj = util.errorObj;
|
||||
var EMPTY_ARRAY = [];
|
||||
|
||||
function MappingPromiseArray(promises, fn, limit, _filter) {
|
||||
this.constructor$(promises);
|
||||
this._promise._captureStackTrace();
|
||||
var domain = getDomain();
|
||||
this._callback = domain === null ? fn : domain.bind(fn);
|
||||
this._preservedValues = _filter === INTERNAL
|
||||
? new Array(this.length())
|
||||
: null;
|
||||
this._limit = limit;
|
||||
this._inFlight = 0;
|
||||
this._queue = limit >= 1 ? [] : EMPTY_ARRAY;
|
||||
this._init$(undefined, -2);
|
||||
}
|
||||
util.inherits(MappingPromiseArray, PromiseArray);
|
||||
|
||||
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/twit/node_modules/bluebird/js/release/method.js
generated
vendored
Normal file
55
node_modules/twit/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/twit/node_modules/bluebird/js/release/nodeback.js
generated
vendored
Normal file
51
node_modules/twit/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/twit/node_modules/bluebird/js/release/nodeify.js
generated
vendored
Normal file
58
node_modules/twit/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;
|
||||
};
|
||||
};
|
||||
767
node_modules/twit/node_modules/bluebird/js/release/promise.js
generated
vendored
Normal file
767
node_modules/twit/node_modules/bluebird/js/release/promise.js
generated
vendored
Normal file
@@ -0,0 +1,767 @@
|
||||
"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");
|
||||
|
||||
var getDomain;
|
||||
if (util.isNode) {
|
||||
getDomain = function() {
|
||||
var ret = process.domain;
|
||||
if (ret === undefined) ret = null;
|
||||
return ret;
|
||||
};
|
||||
} else {
|
||||
getDomain = function() {
|
||||
return null;
|
||||
};
|
||||
}
|
||||
util.notEnumerableProp(Promise, "_getDomain", getDomain);
|
||||
|
||||
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);
|
||||
var CapturedTrace = debug.CapturedTrace;
|
||||
var PassThroughHandlerContext =
|
||||
require("./finally")(Promise, tryConvertToPromise);
|
||||
var catchFilter = require("./catch_filter")(NEXT_FILTER);
|
||||
var nodebackForPromise = require("./nodeback");
|
||||
var errorObj = util.errorObj;
|
||||
var tryCatch = util.tryCatch;
|
||||
function check(self, executor) {
|
||||
if (typeof executor !== "function") {
|
||||
throw new TypeError("expecting a function but got " + util.classString(executor));
|
||||
}
|
||||
if (self.constructor !== Promise) {
|
||||
throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
||||
}
|
||||
}
|
||||
|
||||
function Promise(executor) {
|
||||
this._bitField = 0;
|
||||
this._fulfillmentHandler0 = undefined;
|
||||
this._rejectionHandler0 = undefined;
|
||||
this._promise0 = undefined;
|
||||
this._receiver0 = undefined;
|
||||
if (executor !== INTERNAL) {
|
||||
check(this, executor);
|
||||
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("expecting an object but got " + util.classString(item));
|
||||
}
|
||||
}
|
||||
catchInstances.length = j;
|
||||
fn = arguments[i];
|
||||
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 domain = getDomain();
|
||||
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: domain === null ? handler
|
||||
: (typeof handler === "function" && domain.bind(handler)),
|
||||
promise: promise,
|
||||
receiver: receiver,
|
||||
value: value
|
||||
});
|
||||
} else {
|
||||
target._addCallbacks(didFulfill, didReject, promise, receiver, domain);
|
||||
}
|
||||
|
||||
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._setAsyncGuaranteed = function() {
|
||||
if (async.hasCustomScheduler()) return;
|
||||
this._bitField = this._bitField | 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,
|
||||
domain
|
||||
) {
|
||||
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 =
|
||||
domain === null ? fulfill : domain.bind(fulfill);
|
||||
}
|
||||
if (typeof reject === "function") {
|
||||
this._rejectionHandler0 =
|
||||
domain === null ? reject : domain.bind(reject);
|
||||
}
|
||||
} else {
|
||||
var base = index * 4 - 4;
|
||||
this[base + 2] = promise;
|
||||
this[base + 3] = receiver;
|
||||
if (typeof fulfill === "function") {
|
||||
this[base + 0] =
|
||||
domain === null ? fulfill : domain.bind(fulfill);
|
||||
}
|
||||
if (typeof reject === "function") {
|
||||
this[base + 1] =
|
||||
domain === null ? reject : domain.bind(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(promise);
|
||||
} 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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
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, debug);
|
||||
Promise.Promise = Promise;
|
||||
Promise.version = "3.4.0";
|
||||
require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
|
||||
require('./call_get.js')(Promise);
|
||||
require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
|
||||
require('./timers.js')(Promise, INTERNAL, debug);
|
||||
require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, 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('./filter.js')(Promise, INTERNAL);
|
||||
require('./each.js')(Promise, INTERNAL);
|
||||
require('./any.js')(Promise);
|
||||
|
||||
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;
|
||||
|
||||
};
|
||||
184
node_modules/twit/node_modules/bluebird/js/release/promise_array.js
generated
vendored
Normal file
184
node_modules/twit/node_modules/bluebird/js/release/promise_array.js
generated
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
"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 {};
|
||||
}
|
||||
}
|
||||
|
||||
function PromiseArray(values) {
|
||||
var promise = this._promise = new Promise(INTERNAL);
|
||||
if (values instanceof Promise) {
|
||||
promise._propagateFrom(values, 3);
|
||||
}
|
||||
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/twit/node_modules/bluebird/js/release/promisify.js
generated
vendored
Normal file
314
node_modules/twit/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/twit/node_modules/bluebird/js/release/props.js
generated
vendored
Normal file
118
node_modules/twit/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, -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);
|
||||
};
|
||||
};
|
||||
90
node_modules/twit/node_modules/bluebird/js/release/queue.js
generated
vendored
Normal file
90
node_modules/twit/node_modules/bluebird/js/release/queue.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
"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._unshiftOne = function(value) {
|
||||
var capacity = this._capacity;
|
||||
this._checkCapacity(this.length() + 1);
|
||||
var front = this._front;
|
||||
var i = (((( front - 1 ) &
|
||||
( capacity - 1) ) ^ capacity ) - capacity );
|
||||
this[i] = value;
|
||||
this._front = i;
|
||||
this._length = this.length() + 1;
|
||||
};
|
||||
|
||||
Queue.prototype.unshift = function(fn, receiver, arg) {
|
||||
this._unshiftOne(arg);
|
||||
this._unshiftOne(receiver);
|
||||
this._unshiftOne(fn);
|
||||
};
|
||||
|
||||
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/twit/node_modules/bluebird/js/release/race.js
generated
vendored
Normal file
49
node_modules/twit/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);
|
||||
};
|
||||
|
||||
};
|
||||
162
node_modules/twit/node_modules/bluebird/js/release/reduce.js
generated
vendored
Normal file
162
node_modules/twit/node_modules/bluebird/js/release/reduce.js
generated
vendored
Normal file
@@ -0,0 +1,162 @@
|
||||
"use strict";
|
||||
module.exports = function(Promise,
|
||||
PromiseArray,
|
||||
apiRejection,
|
||||
tryConvertToPromise,
|
||||
INTERNAL,
|
||||
debug) {
|
||||
var getDomain = Promise._getDomain;
|
||||
var util = require("./util");
|
||||
var tryCatch = util.tryCatch;
|
||||
|
||||
function ReductionPromiseArray(promises, fn, initialValue, _each) {
|
||||
this.constructor$(promises);
|
||||
var domain = getDomain();
|
||||
this._fn = domain === null ? fn : domain.bind(fn);
|
||||
if (initialValue !== undefined) {
|
||||
initialValue = Promise.resolve(initialValue);
|
||||
initialValue._attachCancellationCallback(this);
|
||||
}
|
||||
this._initialValue = initialValue;
|
||||
this._currentCancellable = null;
|
||||
this._eachValues = _each === INTERNAL ? [] : undefined;
|
||||
this._promise._captureStackTrace();
|
||||
this._init$(undefined, -5);
|
||||
}
|
||||
util.inherits(ReductionPromiseArray, PromiseArray);
|
||||
|
||||
ReductionPromiseArray.prototype._gotAccum = function(accum) {
|
||||
if (this._eachValues !== undefined && accum !== INTERNAL) {
|
||||
this._eachValues.push(accum);
|
||||
}
|
||||
};
|
||||
|
||||
ReductionPromiseArray.prototype._eachComplete = function(value) {
|
||||
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;
|
||||
|
||||
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 (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;
|
||||
}
|
||||
};
|
||||
60
node_modules/twit/node_modules/bluebird/js/release/schedule.js
generated
vendored
Normal file
60
node_modules/twit/node_modules/bluebird/js/release/schedule.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
"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") {
|
||||
var nativePromise = NativePromise.resolve();
|
||||
schedule = function(fn) {
|
||||
nativePromise.then(fn);
|
||||
};
|
||||
} else if ((typeof MutationObserver !== "undefined") &&
|
||||
!(typeof window !== "undefined" &&
|
||||
window.navigator &&
|
||||
window.navigator.standalone)) {
|
||||
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;
|
||||
43
node_modules/twit/node_modules/bluebird/js/release/settle.js
generated
vendored
Normal file
43
node_modules/twit/node_modules/bluebird/js/release/settle.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"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.prototype.settle = function () {
|
||||
return Promise.settle(this);
|
||||
};
|
||||
};
|
||||
148
node_modules/twit/node_modules/bluebird/js/release/some.js
generated
vendored
Normal file
148
node_modules/twit/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;
|
||||
};
|
||||
96
node_modules/twit/node_modules/bluebird/js/release/synchronous_inspection.js
generated
vendored
Normal file
96
node_modules/twit/node_modules/bluebird/js/release/synchronous_inspection.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
"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 =
|
||||
Promise.prototype._isCancelled = function() {
|
||||
return (this._bitField & 65536) === 65536;
|
||||
};
|
||||
|
||||
Promise.prototype.isCancelled = function() {
|
||||
return this._target()._isCancelled();
|
||||
};
|
||||
|
||||
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/twit/node_modules/bluebird/js/release/thenables.js
generated
vendored
Normal file
86
node_modules/twit/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;
|
||||
};
|
||||
92
node_modules/twit/node_modules/bluebird/js/release/timers.js
generated
vendored
Normal file
92
node_modules/twit/node_modules/bluebird/js/release/timers.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
"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._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/twit/node_modules/bluebird/js/release/using.js
generated
vendored
Normal file
226
node_modules/twit/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();
|
||||
};
|
||||
|
||||
};
|
||||
370
node_modules/twit/node_modules/bluebird/js/release/util.js
generated
vendored
Normal file
370
node_modules/twit/node_modules/bluebird/js/release/util.js
generated
vendored
Normal file
@@ -0,0 +1,370 @@
|
||||
"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 l = 8;
|
||||
while (l--) new FakeConstructor();
|
||||
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 !== 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]";
|
||||
|
||||
function env(key, def) {
|
||||
return isNode ? process.env[key] : def;
|
||||
}
|
||||
|
||||
function getNativePromise() {
|
||||
if (typeof Promise === "function") {
|
||||
try {
|
||||
var promise = new Promise(function(){});
|
||||
if ({}.toString.call(promise) === "[object Promise]") {
|
||||
return Promise;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
|
||||
var ret = {
|
||||
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,
|
||||
hasDevTools: typeof chrome !== "undefined" && chrome &&
|
||||
typeof chrome.loadTimes === "function",
|
||||
isNode: isNode,
|
||||
env: env,
|
||||
global: globalObject,
|
||||
getNativePromise: getNativePromise
|
||||
};
|
||||
ret.isRecentNode = ret.isNode && (function() {
|
||||
var version = process.versions.node.split(".").map(Number);
|
||||
return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
|
||||
})();
|
||||
|
||||
if (ret.isNode) ret.toFastProperties(process);
|
||||
|
||||
try {throw new Error(); } catch (e) {ret.lastLineError = e;}
|
||||
module.exports = ret;
|
||||
102
node_modules/twit/node_modules/bluebird/package.json
generated
vendored
Normal file
102
node_modules/twit/node_modules/bluebird/package.json
generated
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
{
|
||||
"name": "bluebird",
|
||||
"description": "Full featured Promises/A+ implementation with exceptionally good performance",
|
||||
"version": "3.4.1",
|
||||
"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 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": "~0.6.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",
|
||||
"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",
|
||||
"kefir": "^2.4.1"
|
||||
},
|
||||
"main": "./js/release/bluebird.js",
|
||||
"browser": "./js/browser/bluebird.js",
|
||||
"files": [
|
||||
"js/browser",
|
||||
"js/release",
|
||||
"LICENSE"
|
||||
],
|
||||
"gitHead": "fa5752d31ed3329631af4eebbcaa26c73b0407b8",
|
||||
"_id": "bluebird@3.4.1",
|
||||
"_shasum": "b731ddf48e2dd3bedac2e75e1215a11bcb91fa07",
|
||||
"_from": "bluebird@>=3.1.5 <4.0.0",
|
||||
"_npmVersion": "3.6.0",
|
||||
"_nodeVersion": "5.6.0",
|
||||
"_npmUser": {
|
||||
"name": "esailija",
|
||||
"email": "petka_antonov@hotmail.com"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "b731ddf48e2dd3bedac2e75e1215a11bcb91fa07",
|
||||
"tarball": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.1.tgz"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "esailija",
|
||||
"email": "petka_antonov@hotmail.com"
|
||||
}
|
||||
],
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/bluebird-3.4.1.tgz_1466192624169_0.8191918630618602"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.4.1.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
0
node_modules/twit/node_modules/mime/.npmignore
generated
vendored
Normal file
0
node_modules/twit/node_modules/mime/.npmignore
generated
vendored
Normal file
19
node_modules/twit/node_modules/mime/LICENSE
generated
vendored
Normal file
19
node_modules/twit/node_modules/mime/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2010 Benjamin Thomas, Robert Kieffer
|
||||
|
||||
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.
|
||||
90
node_modules/twit/node_modules/mime/README.md
generated
vendored
Normal file
90
node_modules/twit/node_modules/mime/README.md
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
# mime
|
||||
|
||||
Comprehensive MIME type mapping API based on mime-db module.
|
||||
|
||||
## Install
|
||||
|
||||
Install with [npm](http://github.com/isaacs/npm):
|
||||
|
||||
npm install mime
|
||||
|
||||
## Contributing / Testing
|
||||
|
||||
npm run test
|
||||
|
||||
## Command Line
|
||||
|
||||
mime [path_string]
|
||||
|
||||
E.g.
|
||||
|
||||
> mime scripts/jquery.js
|
||||
application/javascript
|
||||
|
||||
## API - Queries
|
||||
|
||||
### mime.lookup(path)
|
||||
Get the mime type associated with a file, if no mime type is found `application/octet-stream` is returned. Performs a case-insensitive lookup using the extension in `path` (the substring after the last '/' or '.'). E.g.
|
||||
|
||||
```js
|
||||
var mime = require('mime');
|
||||
|
||||
mime.lookup('/path/to/file.txt'); // => 'text/plain'
|
||||
mime.lookup('file.txt'); // => 'text/plain'
|
||||
mime.lookup('.TXT'); // => 'text/plain'
|
||||
mime.lookup('htm'); // => 'text/html'
|
||||
```
|
||||
|
||||
### mime.default_type
|
||||
Sets the mime type returned when `mime.lookup` fails to find the extension searched for. (Default is `application/octet-stream`.)
|
||||
|
||||
### mime.extension(type)
|
||||
Get the default extension for `type`
|
||||
|
||||
```js
|
||||
mime.extension('text/html'); // => 'html'
|
||||
mime.extension('application/octet-stream'); // => 'bin'
|
||||
```
|
||||
|
||||
### mime.charsets.lookup()
|
||||
|
||||
Map mime-type to charset
|
||||
|
||||
```js
|
||||
mime.charsets.lookup('text/plain'); // => 'UTF-8'
|
||||
```
|
||||
|
||||
(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.)
|
||||
|
||||
## API - Defining Custom Types
|
||||
|
||||
Custom type mappings can be added on a per-project basis via the following APIs.
|
||||
|
||||
### mime.define()
|
||||
|
||||
Add custom mime/extension mappings
|
||||
|
||||
```js
|
||||
mime.define({
|
||||
'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'],
|
||||
'application/x-my-type': ['x-mt', 'x-mtt'],
|
||||
// etc ...
|
||||
});
|
||||
|
||||
mime.lookup('x-sft'); // => 'text/x-some-format'
|
||||
```
|
||||
|
||||
The first entry in the extensions array is returned by `mime.extension()`. E.g.
|
||||
|
||||
```js
|
||||
mime.extension('text/x-some-format'); // => 'x-sf'
|
||||
```
|
||||
|
||||
### mime.load(filepath)
|
||||
|
||||
Load mappings from an Apache ".types" format file
|
||||
|
||||
```js
|
||||
mime.load('./my_project.types');
|
||||
```
|
||||
The .types file format is simple - See the `types` dir for examples.
|
||||
11
node_modules/twit/node_modules/mime/build/build.js
generated
vendored
Normal file
11
node_modules/twit/node_modules/mime/build/build.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
var db = require('mime-db');
|
||||
|
||||
var mapByType = {};
|
||||
Object.keys(db).forEach(function(key) {
|
||||
var extensions = db[key].extensions;
|
||||
if (extensions) {
|
||||
mapByType[key] = extensions;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(JSON.stringify(mapByType));
|
||||
57
node_modules/twit/node_modules/mime/build/test.js
generated
vendored
Normal file
57
node_modules/twit/node_modules/mime/build/test.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* Usage: node test.js
|
||||
*/
|
||||
|
||||
var mime = require('../mime');
|
||||
var assert = require('assert');
|
||||
var path = require('path');
|
||||
|
||||
//
|
||||
// Test mime lookups
|
||||
//
|
||||
|
||||
assert.equal('text/plain', mime.lookup('text.txt')); // normal file
|
||||
assert.equal('text/plain', mime.lookup('TEXT.TXT')); // uppercase
|
||||
assert.equal('text/plain', mime.lookup('dir/text.txt')); // dir + file
|
||||
assert.equal('text/plain', mime.lookup('.text.txt')); // hidden file
|
||||
assert.equal('text/plain', mime.lookup('.txt')); // nameless
|
||||
assert.equal('text/plain', mime.lookup('txt')); // extension-only
|
||||
assert.equal('text/plain', mime.lookup('/txt')); // extension-less ()
|
||||
assert.equal('text/plain', mime.lookup('\\txt')); // Windows, extension-less
|
||||
assert.equal('application/octet-stream', mime.lookup('text.nope')); // unrecognized
|
||||
assert.equal('fallback', mime.lookup('text.fallback', 'fallback')); // alternate default
|
||||
|
||||
//
|
||||
// Test extensions
|
||||
//
|
||||
|
||||
assert.equal('txt', mime.extension(mime.types.text));
|
||||
assert.equal('html', mime.extension(mime.types.htm));
|
||||
assert.equal('bin', mime.extension('application/octet-stream'));
|
||||
assert.equal('bin', mime.extension('application/octet-stream '));
|
||||
assert.equal('html', mime.extension(' text/html; charset=UTF-8'));
|
||||
assert.equal('html', mime.extension('text/html; charset=UTF-8 '));
|
||||
assert.equal('html', mime.extension('text/html; charset=UTF-8'));
|
||||
assert.equal('html', mime.extension('text/html ; charset=UTF-8'));
|
||||
assert.equal('html', mime.extension('text/html;charset=UTF-8'));
|
||||
assert.equal('html', mime.extension('text/Html;charset=UTF-8'));
|
||||
assert.equal(undefined, mime.extension('unrecognized'));
|
||||
|
||||
//
|
||||
// Test node.types lookups
|
||||
//
|
||||
|
||||
assert.equal('application/font-woff', mime.lookup('file.woff'));
|
||||
assert.equal('application/octet-stream', mime.lookup('file.buffer'));
|
||||
assert.equal('audio/mp4', mime.lookup('file.m4a'));
|
||||
assert.equal('font/opentype', mime.lookup('file.otf'));
|
||||
|
||||
//
|
||||
// Test charsets
|
||||
//
|
||||
|
||||
assert.equal('UTF-8', mime.charsets.lookup('text/plain'));
|
||||
assert.equal(undefined, mime.charsets.lookup(mime.types.js));
|
||||
assert.equal('fallback', mime.charsets.lookup('application/octet-stream', 'fallback'));
|
||||
|
||||
console.log('\nAll tests passed');
|
||||
8
node_modules/twit/node_modules/mime/cli.js
generated
vendored
Executable file
8
node_modules/twit/node_modules/mime/cli.js
generated
vendored
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var mime = require('./mime.js');
|
||||
var file = process.argv[2];
|
||||
var type = mime.lookup(file);
|
||||
|
||||
process.stdout.write(type + '\n');
|
||||
|
||||
108
node_modules/twit/node_modules/mime/mime.js
generated
vendored
Normal file
108
node_modules/twit/node_modules/mime/mime.js
generated
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
function Mime() {
|
||||
// Map of extension -> mime type
|
||||
this.types = Object.create(null);
|
||||
|
||||
// Map of mime type -> extension
|
||||
this.extensions = Object.create(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define mimetype -> extension mappings. Each key is a mime-type that maps
|
||||
* to an array of extensions associated with the type. The first extension is
|
||||
* used as the default extension for the type.
|
||||
*
|
||||
* e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
|
||||
*
|
||||
* @param map (Object) type definitions
|
||||
*/
|
||||
Mime.prototype.define = function (map) {
|
||||
for (var type in map) {
|
||||
var exts = map[type];
|
||||
for (var i = 0; i < exts.length; i++) {
|
||||
if (process.env.DEBUG_MIME && this.types[exts]) {
|
||||
console.warn(this._loading.replace(/.*\//, ''), 'changes "' + exts[i] + '" extension type from ' +
|
||||
this.types[exts] + ' to ' + type);
|
||||
}
|
||||
|
||||
this.types[exts[i]] = type;
|
||||
}
|
||||
|
||||
// Default extension is the first one we encounter
|
||||
if (!this.extensions[type]) {
|
||||
this.extensions[type] = exts[0];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Load an Apache2-style ".types" file
|
||||
*
|
||||
* This may be called multiple times (it's expected). Where files declare
|
||||
* overlapping types/extensions, the last file wins.
|
||||
*
|
||||
* @param file (String) path of file to load.
|
||||
*/
|
||||
Mime.prototype.load = function(file) {
|
||||
this._loading = file;
|
||||
// Read file and split into lines
|
||||
var map = {},
|
||||
content = fs.readFileSync(file, 'ascii'),
|
||||
lines = content.split(/[\r\n]+/);
|
||||
|
||||
lines.forEach(function(line) {
|
||||
// Clean up whitespace/comments, and split into fields
|
||||
var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/);
|
||||
map[fields.shift()] = fields;
|
||||
});
|
||||
|
||||
this.define(map);
|
||||
|
||||
this._loading = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Lookup a mime type based on extension
|
||||
*/
|
||||
Mime.prototype.lookup = function(path, fallback) {
|
||||
var ext = path.replace(/.*[\.\/\\]/, '').toLowerCase();
|
||||
|
||||
return this.types[ext] || fallback || this.default_type;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return file extension associated with a mime type
|
||||
*/
|
||||
Mime.prototype.extension = function(mimeType) {
|
||||
var type = mimeType.match(/^\s*([^;\s]*)(?:;|\s|$)/)[1].toLowerCase();
|
||||
return this.extensions[type];
|
||||
};
|
||||
|
||||
// Default instance
|
||||
var mime = new Mime();
|
||||
|
||||
// Define built-in types
|
||||
mime.define(require('./types.json'));
|
||||
|
||||
// Default type
|
||||
mime.default_type = mime.lookup('bin');
|
||||
|
||||
//
|
||||
// Additional API specific to the default instance
|
||||
//
|
||||
|
||||
mime.Mime = Mime;
|
||||
|
||||
/**
|
||||
* Lookup a charset based on mime type.
|
||||
*/
|
||||
mime.charsets = {
|
||||
lookup: function(mimeType, fallback) {
|
||||
// Assume text types are utf8
|
||||
return (/^text\//).test(mimeType) ? 'UTF-8' : fallback;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = mime;
|
||||
73
node_modules/twit/node_modules/mime/package.json
generated
vendored
Normal file
73
node_modules/twit/node_modules/mime/package.json
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"author": {
|
||||
"name": "Robert Kieffer",
|
||||
"email": "robert@broofa.com",
|
||||
"url": "http://github.com/broofa"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "node build/build.js > types.json",
|
||||
"test": "node build/test.js"
|
||||
},
|
||||
"bin": {
|
||||
"mime": "cli.js"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Benjamin Thomas",
|
||||
"email": "benjamin@benjaminthomas.org",
|
||||
"url": "http://github.com/bentomas"
|
||||
}
|
||||
],
|
||||
"description": "A comprehensive library for mime-type mapping",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "https://raw.github.com/broofa/node-mime/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"mime-db": "^1.2.0"
|
||||
},
|
||||
"keywords": [
|
||||
"util",
|
||||
"mime"
|
||||
],
|
||||
"main": "mime.js",
|
||||
"name": "mime",
|
||||
"repository": {
|
||||
"url": "git+https://github.com/broofa/node-mime.git",
|
||||
"type": "git"
|
||||
},
|
||||
"version": "1.3.4",
|
||||
"gitHead": "1628f6e0187095009dcef4805c3a49706f137974",
|
||||
"bugs": {
|
||||
"url": "https://github.com/broofa/node-mime/issues"
|
||||
},
|
||||
"homepage": "https://github.com/broofa/node-mime",
|
||||
"_id": "mime@1.3.4",
|
||||
"_shasum": "115f9e3b6b3daf2959983cb38f149a2d40eb5d53",
|
||||
"_from": "mime@>=1.3.4 <2.0.0",
|
||||
"_npmVersion": "1.4.28",
|
||||
"_npmUser": {
|
||||
"name": "broofa",
|
||||
"email": "robert@broofa.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "broofa",
|
||||
"email": "robert@broofa.com"
|
||||
},
|
||||
{
|
||||
"name": "bentomas",
|
||||
"email": "benjamin@benjaminthomas.org"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "115f9e3b6b3daf2959983cb38f149a2d40eb5d53",
|
||||
"tarball": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
1
node_modules/twit/node_modules/mime/types.json
generated
vendored
Normal file
1
node_modules/twit/node_modules/mime/types.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
45
node_modules/twit/node_modules/request/.eslintrc
generated
vendored
Normal file
45
node_modules/twit/node_modules/request/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"rules": {
|
||||
// 2-space indentation
|
||||
"indent": [2, 2],
|
||||
// Disallow semi-colons, unless needed to disambiguate statement
|
||||
"semi": [2, "never"],
|
||||
// Require strings to use single quotes
|
||||
"quotes": [2, "single"],
|
||||
// Require curly braces for all control statements
|
||||
"curly": 2,
|
||||
// Disallow using variables and functions before they've been defined
|
||||
"no-use-before-define": 2,
|
||||
// Allow any case for variable naming
|
||||
"camelcase": 0,
|
||||
// Disallow unused variables, except as function arguments
|
||||
"no-unused-vars": [2, {"args":"none"}],
|
||||
// Allow leading underscores for method names
|
||||
// REASON: we use underscores to denote private methods
|
||||
"no-underscore-dangle": 0,
|
||||
// Allow multi spaces around operators since they are
|
||||
// used for alignment. This is not consistent in the
|
||||
// code.
|
||||
"no-multi-spaces": 0,
|
||||
// Style rule is: most objects use { beforeColon: false, afterColon: true }, unless aligning which uses:
|
||||
//
|
||||
// {
|
||||
// beforeColon : true,
|
||||
// afterColon : true
|
||||
// }
|
||||
//
|
||||
// eslint can't handle this, so the check is disabled.
|
||||
"key-spacing": 0,
|
||||
// Allow shadowing vars in outer scope (needs discussion)
|
||||
"no-shadow": 0,
|
||||
// Use if () { }
|
||||
// ^ space
|
||||
"space-after-keywords": [2, "always"],
|
||||
// Use if () { }
|
||||
// ^ space
|
||||
"space-before-blocks": [2, "always"]
|
||||
}
|
||||
}
|
||||
3
node_modules/twit/node_modules/request/.npmignore
generated
vendored
Normal file
3
node_modules/twit/node_modules/request/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
coverage
|
||||
tests
|
||||
node_modules
|
||||
14
node_modules/twit/node_modules/request/.travis.yml
generated
vendored
Normal file
14
node_modules/twit/node_modules/request/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "io.js"
|
||||
- "0.12"
|
||||
- "0.10"
|
||||
sudo: false
|
||||
|
||||
after_script: "npm run test-cov && cat ./coverage/lcov.info | codecov && cat ./coverage/lcov.info | coveralls"
|
||||
|
||||
webhooks:
|
||||
urls: https://webhooks.gitter.im/e/237280ed4796c19cc626
|
||||
on_success: change # options: [always|never|change] default: always
|
||||
on_failure: always # options: [always|never|change] default: always
|
||||
on_start: false # default: false
|
||||
499
node_modules/twit/node_modules/request/CHANGELOG.md
generated
vendored
Normal file
499
node_modules/twit/node_modules/request/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,499 @@
|
||||
## Change Log
|
||||
|
||||
### v2.58.0 (2015/06/16)
|
||||
- [#1638](https://github.com/request/request/pull/1638) Use the `extend` module to deep extend in the defaults method (@simov)
|
||||
- [#1631](https://github.com/request/request/pull/1631) Move tunnel logic into separate module (@simov)
|
||||
- [#1634](https://github.com/request/request/pull/1634) Fix OAuth query transport_method (@simov)
|
||||
- [#1603](https://github.com/request/request/pull/1603) Add codecov (@simov)
|
||||
|
||||
### v2.57.0 (2015/05/31)
|
||||
- [#1615](https://github.com/request/request/pull/1615) Replace '.client' with '.socket' as the former was deprecated in 2.2.0. (@ChALkeR)
|
||||
|
||||
### v2.56.0 (2015/05/28)
|
||||
- [#1610](https://github.com/request/request/pull/1610) Bump module dependencies (@simov)
|
||||
- [#1600](https://github.com/request/request/pull/1600) Extract the querystring logic into separate module (@simov)
|
||||
- [#1607](https://github.com/request/request/pull/1607) Re-generate certificates (@simov)
|
||||
- [#1599](https://github.com/request/request/pull/1599) Move getProxyFromURI logic below the check for Invaild URI (#1595) (@simov)
|
||||
- [#1598](https://github.com/request/request/pull/1598) Fix the way http verbs are defined in order to please intellisense IDEs (@simov, @flannelJesus)
|
||||
- [#1591](https://github.com/request/request/pull/1591) A few minor fixes: (@simov)
|
||||
- [#1584](https://github.com/request/request/pull/1584) Refactor test-default tests (according to comments in #1430) (@simov)
|
||||
- [#1585](https://github.com/request/request/pull/1585) Fixing documentation regarding TLS options (#1583) (@mainakae)
|
||||
- [#1574](https://github.com/request/request/pull/1574) Refresh the oauth_nonce on redirect (#1573) (@simov)
|
||||
- [#1570](https://github.com/request/request/pull/1570) Discovered tests that weren't properly running (@seanstrom)
|
||||
- [#1569](https://github.com/request/request/pull/1569) Fix pause before response arrives (@kevinoid)
|
||||
- [#1558](https://github.com/request/request/pull/1558) Emit error instead of throw (@simov)
|
||||
- [#1568](https://github.com/request/request/pull/1568) Fix stall when piping gzipped response (@kevinoid)
|
||||
- [#1560](https://github.com/request/request/pull/1560) Update combined-stream (@apechimp)
|
||||
- [#1543](https://github.com/request/request/pull/1543) Initial support for oauth_body_hash on json payloads (@simov, @aesopwolf)
|
||||
- [#1541](https://github.com/request/request/pull/1541) Fix coveralls (@simov)
|
||||
- [#1540](https://github.com/request/request/pull/1540) Fix recursive defaults for convenience methods (@simov)
|
||||
- [#1536](https://github.com/request/request/pull/1536) More eslint style rules (@froatsnook)
|
||||
- [#1533](https://github.com/request/request/pull/1533) Adding dependency status bar to README.md (@YasharF)
|
||||
- [#1539](https://github.com/request/request/pull/1539) ensure the latest version of har-validator is included (@ahmadnassri)
|
||||
- [#1516](https://github.com/request/request/pull/1516) forever+pool test (@devTristan)
|
||||
|
||||
### v2.55.0 (2015/04/05)
|
||||
- [#1520](https://github.com/request/request/pull/1520) Refactor defaults (@simov)
|
||||
- [#1525](https://github.com/request/request/pull/1525) Delete request headers with undefined value. (@froatsnook)
|
||||
- [#1521](https://github.com/request/request/pull/1521) Add promise tests (@simov)
|
||||
- [#1518](https://github.com/request/request/pull/1518) Fix defaults (@simov)
|
||||
- [#1515](https://github.com/request/request/pull/1515) Allow static invoking of convenience methods (@simov)
|
||||
- [#1505](https://github.com/request/request/pull/1505) Fix multipart boundary extraction regexp (@simov)
|
||||
- [#1510](https://github.com/request/request/pull/1510) Fix basic auth form data (@simov)
|
||||
|
||||
### v2.54.0 (2015/03/24)
|
||||
- [#1501](https://github.com/request/request/pull/1501) HTTP Archive 1.2 support (@ahmadnassri)
|
||||
- [#1486](https://github.com/request/request/pull/1486) Add a test for the forever agent (@akshayp)
|
||||
- [#1500](https://github.com/request/request/pull/1500) Adding handling for no auth method and null bearer (@philberg)
|
||||
- [#1498](https://github.com/request/request/pull/1498) Add table of contents in readme (@simov)
|
||||
- [#1477](https://github.com/request/request/pull/1477) Add support for qs options via qsOptions key (@simov)
|
||||
- [#1496](https://github.com/request/request/pull/1496) Parameters encoded to base 64 should be decoded as UTF-8, not ASCII. (@albanm)
|
||||
- [#1494](https://github.com/request/request/pull/1494) Update eslint (@froatsnook)
|
||||
- [#1474](https://github.com/request/request/pull/1474) Require Colon in Basic Auth (@erykwalder)
|
||||
- [#1481](https://github.com/request/request/pull/1481) Fix baseUrl and redirections. (@burningtree)
|
||||
- [#1469](https://github.com/request/request/pull/1469) Feature/base url (@froatsnook)
|
||||
- [#1459](https://github.com/request/request/pull/1459) Add option to time request/response cycle (including rollup of redirects) (@aaron-em)
|
||||
- [#1468](https://github.com/request/request/pull/1468) Re-enable io.js/node 0.12 build (@simov, @mikeal, @BBB)
|
||||
- [#1442](https://github.com/request/request/pull/1442) Fixed the issue with strictSSL tests on 0.12 & io.js by explicitly setting a cipher that matches the cert. (@BBB, @nicolasmccurdy, @simov, @0x4139)
|
||||
- [#1460](https://github.com/request/request/pull/1460) localAddress or proxy config is lost when redirecting (@simov, @0x4139)
|
||||
- [#1453](https://github.com/request/request/pull/1453) Test on Node.js 0.12 and io.js with allowed failures (@nicolasmccurdy)
|
||||
- [#1426](https://github.com/request/request/pull/1426) Fixing tests to pass on io.js and node 0.12 (only test-https.js stiff failing) (@mikeal)
|
||||
- [#1446](https://github.com/request/request/pull/1446) Missing HTTP referer header with redirects Fixes #1038 (@simov, @guimonz)
|
||||
- [#1428](https://github.com/request/request/pull/1428) Deprecate Node v0.8.x (@nylen)
|
||||
- [#1436](https://github.com/request/request/pull/1436) Add ability to set a requester without setting default options (@tikotzky)
|
||||
- [#1435](https://github.com/request/request/pull/1435) dry up verb methods (@sethpollack)
|
||||
- [#1423](https://github.com/request/request/pull/1423) Allow fully qualified multipart content-type header (@simov)
|
||||
- [#1430](https://github.com/request/request/pull/1430) Fix recursive requester (@tikotzky)
|
||||
- [#1429](https://github.com/request/request/pull/1429) Throw error when making HEAD request with a body (@tikotzky)
|
||||
- [#1419](https://github.com/request/request/pull/1419) Add note that the project is broken in 0.12.x (@nylen)
|
||||
- [#1413](https://github.com/request/request/pull/1413) Fix basic auth (@simov)
|
||||
- [#1397](https://github.com/request/request/pull/1397) Improve pipe-from-file tests (@nylen)
|
||||
|
||||
### v2.53.0 (2015/02/02)
|
||||
- [#1396](https://github.com/request/request/pull/1396) Do not rfc3986 escape JSON bodies (@nylen, @simov)
|
||||
- [#1392](https://github.com/request/request/pull/1392) Improve `timeout` option description (@watson)
|
||||
|
||||
### v2.52.0 (2015/02/02)
|
||||
- [#1383](https://github.com/request/request/pull/1383) Add missing HTTPS options that were not being passed to tunnel (@brichard19) (@nylen, @brichard19)
|
||||
- [#1388](https://github.com/request/request/pull/1388) Upgrade mime-types package version (@roderickhsiao)
|
||||
- [#1389](https://github.com/request/request/pull/1389) Revise Setup Tunnel Function (@seanstrom)
|
||||
- [#1374](https://github.com/request/request/pull/1374) Allow explicitly disabling tunneling for proxied https destinations (@nylen)
|
||||
- [#1376](https://github.com/request/request/pull/1376) Use karma-browserify for tests. Add browser test coverage reporter. (@eiriksm)
|
||||
- [#1366](https://github.com/request/request/pull/1366) Refactor OAuth into separate module (@simov)
|
||||
- [#1373](https://github.com/request/request/pull/1373) Rewrite tunnel test to be pure Node.js (@nylen)
|
||||
- [#1371](https://github.com/request/request/pull/1371) Upgrade test reporter (@nylen)
|
||||
- [#1360](https://github.com/request/request/pull/1360) Refactor basic, bearer, digest auth logic into separate class (@simov)
|
||||
- [#1354](https://github.com/request/request/pull/1354) Remove circular dependency from debugging code (@nylen)
|
||||
- [#1351](https://github.com/request/request/pull/1351) Move digest auth into private prototype method (@simov)
|
||||
- [#1352](https://github.com/request/request/pull/1352) Update hawk dependency to ~2.3.0 (@mridgway)
|
||||
- [#1353](https://github.com/request/request/pull/1353) Correct travis-ci badge (@dogancelik)
|
||||
- [#1349](https://github.com/request/request/pull/1349) Make sure we return on errored browser requests. (@eiriksm)
|
||||
- [#1346](https://github.com/request/request/pull/1346) getProxyFromURI Extraction Refactor (@seanstrom)
|
||||
- [#1337](https://github.com/request/request/pull/1337) Standardize test ports on 6767 (@nylen)
|
||||
- [#1341](https://github.com/request/request/pull/1341) Emit FormData error events as Request error events (@nylen, @rwky)
|
||||
- [#1343](https://github.com/request/request/pull/1343) Clean up readme badges, and add Travis and Coveralls badges (@nylen)
|
||||
- [#1345](https://github.com/request/request/pull/1345) Update README.md (@Aaron-Hartwig)
|
||||
- [#1338](https://github.com/request/request/pull/1338) Always wait for server.close() callback in tests (@nylen)
|
||||
- [#1342](https://github.com/request/request/pull/1342) Add mock https server and redo start of browser tests for this purpose. (@eiriksm)
|
||||
- [#1339](https://github.com/request/request/pull/1339) Improve auth docs (@nylen)
|
||||
- [#1335](https://github.com/request/request/pull/1335) Add support for OAuth plaintext signature method (@simov)
|
||||
- [#1332](https://github.com/request/request/pull/1332) Add clean script to remove test-browser.js after the tests run (@seanstrom)
|
||||
- [#1327](https://github.com/request/request/pull/1327) Fix errors generating coverage reports. (@nylen)
|
||||
- [#1330](https://github.com/request/request/pull/1330) Return empty buffer upon empty response body and encoding is set to null (@seanstrom)
|
||||
- [#1326](https://github.com/request/request/pull/1326) Use faster container-based infrastructure on Travis (@nylen)
|
||||
- [#1315](https://github.com/request/request/pull/1315) Implement rfc3986 option (@simov, @nylen, @apoco, @DullReferenceException, @mmalecki, @oliamb, @cliffcrosland, @LewisJEllis, @eiriksm, @poislagarde)
|
||||
- [#1314](https://github.com/request/request/pull/1314) Detect urlencoded form data header via regex (@simov)
|
||||
- [#1317](https://github.com/request/request/pull/1317) Improve OAuth1.0 server side flow example (@simov)
|
||||
|
||||
### v2.51.0 (2014/12/10)
|
||||
- [#1310](https://github.com/request/request/pull/1310) Revert changes introduced in https://github.com/request/request/pull/1282 (@simov)
|
||||
|
||||
### v2.50.0 (2014/12/09)
|
||||
- [#1308](https://github.com/request/request/pull/1308) Add browser test to keep track of browserify compability. (@eiriksm)
|
||||
- [#1299](https://github.com/request/request/pull/1299) Add optional support for jsonReviver (@poislagarde)
|
||||
- [#1277](https://github.com/request/request/pull/1277) Add Coveralls configuration (@simov)
|
||||
- [#1307](https://github.com/request/request/pull/1307) Upgrade form-data, add back browserify compability. Fixes #455. (@eiriksm)
|
||||
- [#1305](https://github.com/request/request/pull/1305) Fix typo in README.md (@LewisJEllis)
|
||||
- [#1288](https://github.com/request/request/pull/1288) Update README.md to explain custom file use case (@cliffcrosland)
|
||||
|
||||
### v2.49.0 (2014/11/28)
|
||||
- [#1295](https://github.com/request/request/pull/1295) fix(proxy): no-proxy false positive (@oliamb)
|
||||
- [#1292](https://github.com/request/request/pull/1292) Upgrade `caseless` to 0.8.1 (@mmalecki)
|
||||
- [#1276](https://github.com/request/request/pull/1276) Set transfer encoding for multipart/related to chunked by default (@simov)
|
||||
- [#1275](https://github.com/request/request/pull/1275) Fix multipart content-type headers detection (@simov)
|
||||
- [#1269](https://github.com/request/request/pull/1269) adds streams example for review (@tbuchok)
|
||||
- [#1238](https://github.com/request/request/pull/1238) Add examples README.md (@simov)
|
||||
|
||||
### v2.48.0 (2014/11/12)
|
||||
- [#1263](https://github.com/request/request/pull/1263) Fixed a syntax error / typo in README.md (@xna2)
|
||||
- [#1253](https://github.com/request/request/pull/1253) Add multipart chunked flag (@simov, @nylen)
|
||||
- [#1251](https://github.com/request/request/pull/1251) Clarify that defaults() does not modify global defaults (@nylen)
|
||||
- [#1250](https://github.com/request/request/pull/1250) Improve documentation for pool and maxSockets options (@nylen)
|
||||
- [#1237](https://github.com/request/request/pull/1237) Documenting error handling when using streams (@vmattos)
|
||||
- [#1244](https://github.com/request/request/pull/1244) Finalize changelog command (@nylen)
|
||||
- [#1241](https://github.com/request/request/pull/1241) Fix typo (@alexanderGugel)
|
||||
- [#1223](https://github.com/request/request/pull/1223) Show latest version number instead of "upcoming" in changelog (@nylen)
|
||||
- [#1236](https://github.com/request/request/pull/1236) Document how to use custom CA in README (#1229) (@hypesystem)
|
||||
- [#1228](https://github.com/request/request/pull/1228) Support for oauth with RSA-SHA1 signing (@nylen)
|
||||
- [#1216](https://github.com/request/request/pull/1216) Made json and multipart options coexist (@nylen, @simov)
|
||||
- [#1225](https://github.com/request/request/pull/1225) Allow header white/exclusive lists in any case. (@RReverser)
|
||||
|
||||
### v2.47.0 (2014/10/26)
|
||||
- [#1222](https://github.com/request/request/pull/1222) Move from mikeal/request to request/request (@nylen)
|
||||
- [#1220](https://github.com/request/request/pull/1220) update qs dependency to 2.3.1 (@FredKSchott)
|
||||
- [#1212](https://github.com/request/request/pull/1212) Improve tests/test-timeout.js (@nylen)
|
||||
- [#1219](https://github.com/request/request/pull/1219) remove old globalAgent workaround for node 0.4 (@request)
|
||||
- [#1214](https://github.com/request/request/pull/1214) Remove cruft left over from optional dependencies (@nylen)
|
||||
- [#1215](https://github.com/request/request/pull/1215) Add proxyHeaderExclusiveList option for proxy-only headers. (@RReverser)
|
||||
- [#1211](https://github.com/request/request/pull/1211) Allow 'Host' header instead of 'host' and remember case across redirects (@nylen)
|
||||
- [#1208](https://github.com/request/request/pull/1208) Improve release script (@nylen)
|
||||
- [#1213](https://github.com/request/request/pull/1213) Support for custom cookie store (@nylen, @mitsuru)
|
||||
- [#1197](https://github.com/request/request/pull/1197) Clean up some code around setting the agent (@FredKSchott)
|
||||
- [#1209](https://github.com/request/request/pull/1209) Improve multipart form append test (@simov)
|
||||
- [#1207](https://github.com/request/request/pull/1207) Update changelog (@nylen)
|
||||
- [#1185](https://github.com/request/request/pull/1185) Stream multipart/related bodies (@simov)
|
||||
|
||||
### v2.46.0 (2014/10/23)
|
||||
- [#1198](https://github.com/request/request/pull/1198) doc for TLS/SSL protocol options (@shawnzhu)
|
||||
- [#1200](https://github.com/request/request/pull/1200) Add a Gitter chat badge to README.md (@gitter-badger)
|
||||
- [#1196](https://github.com/request/request/pull/1196) Upgrade taper test reporter to v0.3.0 (@nylen)
|
||||
- [#1199](https://github.com/request/request/pull/1199) Fix lint error: undeclared var i (@nylen)
|
||||
- [#1191](https://github.com/request/request/pull/1191) Move self.proxy decision logic out of init and into a helper (@FredKSchott)
|
||||
- [#1190](https://github.com/request/request/pull/1190) Move _buildRequest() logic back into init (@FredKSchott)
|
||||
- [#1186](https://github.com/request/request/pull/1186) Support Smarter Unix URL Scheme (@FredKSchott)
|
||||
- [#1178](https://github.com/request/request/pull/1178) update form documentation for new usage (@FredKSchott)
|
||||
- [#1180](https://github.com/request/request/pull/1180) Enable no-mixed-requires linting rule (@nylen)
|
||||
- [#1184](https://github.com/request/request/pull/1184) Don't forward authorization header across redirects to different hosts (@nylen)
|
||||
- [#1183](https://github.com/request/request/pull/1183) Correct README about pre and postamble CRLF using multipart and not mult... (@netpoetica)
|
||||
- [#1179](https://github.com/request/request/pull/1179) Lint tests directory (@nylen)
|
||||
- [#1169](https://github.com/request/request/pull/1169) add metadata for form-data file field (@dotcypress)
|
||||
- [#1173](https://github.com/request/request/pull/1173) remove optional dependencies (@seanstrom)
|
||||
- [#1165](https://github.com/request/request/pull/1165) Cleanup event listeners and remove function creation from init (@FredKSchott)
|
||||
- [#1174](https://github.com/request/request/pull/1174) update the request.cookie docs to have a valid cookie example (@seanstrom)
|
||||
- [#1168](https://github.com/request/request/pull/1168) create a detach helper and use detach helper in replace of nextTick (@seanstrom)
|
||||
- [#1171](https://github.com/request/request/pull/1171) in post can send form data and use callback (@MiroRadenovic)
|
||||
- [#1159](https://github.com/request/request/pull/1159) accept charset for x-www-form-urlencoded content-type (@seanstrom)
|
||||
- [#1157](https://github.com/request/request/pull/1157) Update README.md: body with json=true (@Rob--W)
|
||||
- [#1164](https://github.com/request/request/pull/1164) Disable tests/test-timeout.js on Travis (@nylen)
|
||||
- [#1153](https://github.com/request/request/pull/1153) Document how to run a single test (@nylen)
|
||||
- [#1144](https://github.com/request/request/pull/1144) adds documentation for the "response" event within the streaming section (@tbuchok)
|
||||
- [#1162](https://github.com/request/request/pull/1162) Update eslintrc file to no longer allow past errors (@FredKSchott)
|
||||
- [#1155](https://github.com/request/request/pull/1155) Support/use self everywhere (@seanstrom)
|
||||
- [#1161](https://github.com/request/request/pull/1161) fix no-use-before-define lint warnings (@emkay)
|
||||
- [#1156](https://github.com/request/request/pull/1156) adding curly brackets to get rid of lint errors (@emkay)
|
||||
- [#1151](https://github.com/request/request/pull/1151) Fix localAddress test on OS X (@nylen)
|
||||
- [#1145](https://github.com/request/request/pull/1145) documentation: fix outdated reference to setCookieSync old name in README (@FredKSchott)
|
||||
- [#1131](https://github.com/request/request/pull/1131) Update pool documentation (@FredKSchott)
|
||||
- [#1143](https://github.com/request/request/pull/1143) Rewrite all tests to use tape (@nylen)
|
||||
- [#1137](https://github.com/request/request/pull/1137) Add ability to specifiy querystring lib in options. (@jgrund)
|
||||
- [#1138](https://github.com/request/request/pull/1138) allow hostname and port in place of host on uri (@cappslock)
|
||||
- [#1134](https://github.com/request/request/pull/1134) Fix multiple redirects and `self.followRedirect` (@blakeembrey)
|
||||
- [#1130](https://github.com/request/request/pull/1130) documentation fix: add note about npm test for contributing (@FredKSchott)
|
||||
- [#1120](https://github.com/request/request/pull/1120) Support/refactor request setup tunnel (@seanstrom)
|
||||
- [#1129](https://github.com/request/request/pull/1129) linting fix: convert double quote strings to use single quotes (@FredKSchott)
|
||||
- [#1124](https://github.com/request/request/pull/1124) linting fix: remove unneccesary semi-colons (@FredKSchott)
|
||||
|
||||
### v2.45.0 (2014/10/06)
|
||||
- [#1128](https://github.com/request/request/pull/1128) Add test for setCookie regression (@nylen)
|
||||
- [#1127](https://github.com/request/request/pull/1127) added tests around using objects as values in a query string (@bcoe)
|
||||
- [#1103](https://github.com/request/request/pull/1103) Support/refactor request constructor (@nylen, @seanstrom)
|
||||
- [#1119](https://github.com/request/request/pull/1119) add basic linting to request library (@FredKSchott)
|
||||
- [#1121](https://github.com/request/request/pull/1121) Revert "Explicitly use sync versions of cookie functions" (@nylen)
|
||||
- [#1118](https://github.com/request/request/pull/1118) linting fix: Restructure bad empty if statement (@FredKSchott)
|
||||
- [#1117](https://github.com/request/request/pull/1117) Fix a bad check for valid URIs (@FredKSchott)
|
||||
- [#1113](https://github.com/request/request/pull/1113) linting fix: space out operators (@FredKSchott)
|
||||
- [#1116](https://github.com/request/request/pull/1116) Fix typo in `noProxyHost` definition (@FredKSchott)
|
||||
- [#1114](https://github.com/request/request/pull/1114) linting fix: Added a `new` operator that was missing when creating and throwing a new error (@FredKSchott)
|
||||
- [#1096](https://github.com/request/request/pull/1096) No_proxy support (@samcday)
|
||||
- [#1107](https://github.com/request/request/pull/1107) linting-fix: remove unused variables (@FredKSchott)
|
||||
- [#1112](https://github.com/request/request/pull/1112) linting fix: Make return values consistent and more straitforward (@FredKSchott)
|
||||
- [#1111](https://github.com/request/request/pull/1111) linting fix: authPieces was getting redeclared (@FredKSchott)
|
||||
- [#1105](https://github.com/request/request/pull/1105) Use strict mode in request (@FredKSchott)
|
||||
- [#1110](https://github.com/request/request/pull/1110) linting fix: replace lazy '==' with more strict '===' (@FredKSchott)
|
||||
- [#1109](https://github.com/request/request/pull/1109) linting fix: remove function call from if-else conditional statement (@FredKSchott)
|
||||
- [#1102](https://github.com/request/request/pull/1102) Fix to allow setting a `requester` on recursive calls to `request.defaults` (@tikotzky)
|
||||
- [#1095](https://github.com/request/request/pull/1095) Tweaking engines in package.json (@pdehaan)
|
||||
- [#1082](https://github.com/request/request/pull/1082) Forward the socket event from the httpModule request (@seanstrom)
|
||||
- [#972](https://github.com/request/request/pull/972) Clarify gzip handling in the README (@kevinoid)
|
||||
- [#1089](https://github.com/request/request/pull/1089) Mention that encoding defaults to utf8, not Buffer (@stuartpb)
|
||||
- [#1088](https://github.com/request/request/pull/1088) Fix cookie example in README.md and make it more clear (@pipi32167)
|
||||
- [#1027](https://github.com/request/request/pull/1027) Add support for multipart form data in request options. (@crocket)
|
||||
- [#1076](https://github.com/request/request/pull/1076) use Request.abort() to abort the request when the request has timed-out (@seanstrom)
|
||||
- [#1068](https://github.com/request/request/pull/1068) add optional postamble required by .NET multipart requests (@netpoetica)
|
||||
|
||||
### v2.43.0 (2014/09/18)
|
||||
- [#1057](https://github.com/request/request/pull/1057) Defaults should not overwrite defined options (@davidwood)
|
||||
- [#1046](https://github.com/request/request/pull/1046) Propagate datastream errors, useful in case gzip fails. (@ZJONSSON, @Janpot)
|
||||
- [#1063](https://github.com/request/request/pull/1063) copy the input headers object #1060 (@finnp)
|
||||
- [#1031](https://github.com/request/request/pull/1031) Explicitly use sync versions of cookie functions (@ZJONSSON)
|
||||
- [#1056](https://github.com/request/request/pull/1056) Fix redirects when passing url.parse(x) as URL to convenience method (@nylen)
|
||||
|
||||
### v2.42.0 (2014/09/04)
|
||||
- [#1053](https://github.com/request/request/pull/1053) Fix #1051 Parse auth properly when using non-tunneling proxy (@isaacs)
|
||||
|
||||
### v2.41.0 (2014/09/04)
|
||||
- [#1050](https://github.com/request/request/pull/1050) Pass whitelisted headers to tunneling proxy. Organize all tunneling logic. (@isaacs, @Feldhacker)
|
||||
- [#1035](https://github.com/request/request/pull/1035) souped up nodei.co badge (@rvagg)
|
||||
- [#1048](https://github.com/request/request/pull/1048) Aws is now possible over a proxy (@steven-aerts)
|
||||
- [#1039](https://github.com/request/request/pull/1039) extract out helper functions to a helper file (@seanstrom)
|
||||
- [#1021](https://github.com/request/request/pull/1021) Support/refactor indexjs (@seanstrom)
|
||||
- [#1033](https://github.com/request/request/pull/1033) Improve and document debug options (@nylen)
|
||||
- [#1034](https://github.com/request/request/pull/1034) Fix readme headings (@nylen)
|
||||
- [#1030](https://github.com/request/request/pull/1030) Allow recursive request.defaults (@tikotzky)
|
||||
- [#1029](https://github.com/request/request/pull/1029) Fix a couple of typos (@nylen)
|
||||
- [#675](https://github.com/request/request/pull/675) Checking for SSL fault on connection before reading SSL properties (@VRMink)
|
||||
- [#989](https://github.com/request/request/pull/989) Added allowRedirect function. Should return true if redirect is allowed or false otherwise (@doronin)
|
||||
- [#1025](https://github.com/request/request/pull/1025) [fixes #1023] Set self._ended to true once response has ended (@mridgway)
|
||||
- [#1020](https://github.com/request/request/pull/1020) Add back removed debug metadata (@FredKSchott)
|
||||
- [#1008](https://github.com/request/request/pull/1008) Moving to module instead of cutomer buffer concatenation. (@mikeal)
|
||||
- [#770](https://github.com/request/request/pull/770) Added dependency badge for README file; (@timgluz, @mafintosh, @lalitkapoor, @stash, @bobyrizov)
|
||||
- [#1016](https://github.com/request/request/pull/1016) toJSON no longer results in an infinite loop, returns simple objects (@FredKSchott)
|
||||
- [#1018](https://github.com/request/request/pull/1018) Remove pre-0.4.4 HTTPS fix (@mmalecki)
|
||||
- [#1006](https://github.com/request/request/pull/1006) Migrate to caseless, fixes #1001 (@mikeal)
|
||||
- [#995](https://github.com/request/request/pull/995) Fix parsing array of objects (@sjonnet19)
|
||||
- [#999](https://github.com/request/request/pull/999) Fix fallback for browserify for optional modules. (@eiriksm)
|
||||
- [#996](https://github.com/request/request/pull/996) Wrong oauth signature when multiple same param keys exist [updated] (@bengl, @hyjin)
|
||||
|
||||
### v2.40.0 (2014/08/06)
|
||||
- [#992](https://github.com/request/request/pull/992) Fix security vulnerability. Update qs (@poeticninja)
|
||||
- [#988](https://github.com/request/request/pull/988) “--” -> “—” (@upisfree)
|
||||
- [#987](https://github.com/request/request/pull/987) Show optional modules as being loaded by the module that reqeusted them (@iarna)
|
||||
|
||||
### v2.39.0 (2014/07/24)
|
||||
- [#976](https://github.com/request/request/pull/976) Update README.md (@pvoznenko)
|
||||
|
||||
### v2.38.0 (2014/07/22)
|
||||
- [#952](https://github.com/request/request/pull/952) Adding support to client certificate with proxy use case (@ofirshaked)
|
||||
- [#884](https://github.com/request/request/pull/884) Documented tough-cookie installation. (@wbyoung)
|
||||
- [#935](https://github.com/request/request/pull/935) Correct repository url (@fritx)
|
||||
- [#963](https://github.com/request/request/pull/963) Update changelog (@nylen)
|
||||
- [#960](https://github.com/request/request/pull/960) Support gzip with encoding on node pre-v0.9.4 (@kevinoid)
|
||||
- [#953](https://github.com/request/request/pull/953) Add async Content-Length computation when using form-data (@LoicMahieu)
|
||||
- [#844](https://github.com/request/request/pull/844) Add support for HTTP[S]_PROXY environment variables. Fixes #595. (@jvmccarthy)
|
||||
- [#946](https://github.com/request/request/pull/946) defaults: merge headers (@aj0strow)
|
||||
|
||||
### v2.37.0 (2014/07/07)
|
||||
- [#957](https://github.com/request/request/pull/957) Silence EventEmitter memory leak warning #311 (@watson)
|
||||
- [#955](https://github.com/request/request/pull/955) check for content-length header before setting it in nextTick (@camilleanne)
|
||||
- [#951](https://github.com/request/request/pull/951) Add support for gzip content decoding (@kevinoid)
|
||||
- [#949](https://github.com/request/request/pull/949) Manually enter querystring in form option (@charlespwd)
|
||||
- [#944](https://github.com/request/request/pull/944) Make request work with browserify (@eiriksm)
|
||||
- [#943](https://github.com/request/request/pull/943) New mime module (@eiriksm)
|
||||
- [#927](https://github.com/request/request/pull/927) Bump version of hawk dep. (@samccone)
|
||||
- [#907](https://github.com/request/request/pull/907) append secureOptions to poolKey (@medovob)
|
||||
|
||||
### v2.35.0 (2014/05/17)
|
||||
- [#901](https://github.com/request/request/pull/901) Fixes #555 (@pigulla)
|
||||
- [#897](https://github.com/request/request/pull/897) merge with default options (@vohof)
|
||||
- [#891](https://github.com/request/request/pull/891) fixes 857 - options object is mutated by calling request (@lalitkapoor)
|
||||
- [#869](https://github.com/request/request/pull/869) Pipefilter test (@tgohn)
|
||||
- [#866](https://github.com/request/request/pull/866) Fix typo (@dandv)
|
||||
- [#861](https://github.com/request/request/pull/861) Add support for RFC 6750 Bearer Tokens (@phedny)
|
||||
- [#809](https://github.com/request/request/pull/809) upgrade tunnel-proxy to 0.4.0 (@ksato9700)
|
||||
- [#850](https://github.com/request/request/pull/850) Fix word consistency in readme (@0xNobody)
|
||||
- [#810](https://github.com/request/request/pull/810) add some exposition to mpu example in README.md (@mikermcneil)
|
||||
- [#840](https://github.com/request/request/pull/840) improve error reporting for invalid protocols (@FND)
|
||||
- [#821](https://github.com/request/request/pull/821) added secureOptions back (@nw)
|
||||
- [#815](https://github.com/request/request/pull/815) Create changelog based on pull requests (@lalitkapoor)
|
||||
|
||||
### v2.34.0 (2014/02/18)
|
||||
- [#516](https://github.com/request/request/pull/516) UNIX Socket URL Support (@lyuzashi)
|
||||
- [#801](https://github.com/request/request/pull/801) 794 ignore cookie parsing and domain errors (@lalitkapoor)
|
||||
- [#802](https://github.com/request/request/pull/802) Added the Apache license to the package.json. (@keskival)
|
||||
- [#793](https://github.com/request/request/pull/793) Adds content-length calculation when submitting forms using form-data li... (@Juul)
|
||||
- [#785](https://github.com/request/request/pull/785) Provide ability to override content-type when `json` option used (@vvo)
|
||||
- [#781](https://github.com/request/request/pull/781) simpler isReadStream function (@joaojeronimo)
|
||||
|
||||
### v2.32.0 (2014/01/16)
|
||||
- [#767](https://github.com/request/request/pull/767) Use tough-cookie CookieJar sync API (@stash)
|
||||
- [#764](https://github.com/request/request/pull/764) Case-insensitive authentication scheme (@bobyrizov)
|
||||
- [#763](https://github.com/request/request/pull/763) Upgrade tough-cookie to 0.10.0 (@stash)
|
||||
- [#744](https://github.com/request/request/pull/744) Use Cookie.parse (@lalitkapoor)
|
||||
- [#757](https://github.com/request/request/pull/757) require aws-sign2 (@mafintosh)
|
||||
|
||||
### v2.31.0 (2014/01/08)
|
||||
- [#645](https://github.com/request/request/pull/645) update twitter api url to v1.1 (@mick)
|
||||
- [#746](https://github.com/request/request/pull/746) README: Markdown code highlight (@weakish)
|
||||
- [#745](https://github.com/request/request/pull/745) updating setCookie example to make it clear that the callback is required (@emkay)
|
||||
- [#742](https://github.com/request/request/pull/742) Add note about JSON output body type (@iansltx)
|
||||
- [#741](https://github.com/request/request/pull/741) README example is using old cookie jar api (@emkay)
|
||||
- [#736](https://github.com/request/request/pull/736) Fix callback arguments documentation (@mmalecki)
|
||||
|
||||
### v2.30.0 (2013/12/13)
|
||||
- [#732](https://github.com/request/request/pull/732) JSHINT: Creating global 'for' variable. Should be 'for (var ...'. (@Fritz-Lium)
|
||||
- [#730](https://github.com/request/request/pull/730) better HTTP DIGEST support (@dai-shi)
|
||||
- [#728](https://github.com/request/request/pull/728) Fix TypeError when calling request.cookie (@scarletmeow)
|
||||
|
||||
### v2.29.0 (2013/12/06)
|
||||
- [#727](https://github.com/request/request/pull/727) fix requester bug (@jchris)
|
||||
|
||||
### v2.28.0 (2013/12/04)
|
||||
- [#724](https://github.com/request/request/pull/724) README.md: add custom HTTP Headers example. (@tcort)
|
||||
- [#719](https://github.com/request/request/pull/719) Made a comment gender neutral. (@unsetbit)
|
||||
- [#715](https://github.com/request/request/pull/715) Request.multipart no longer crashes when header 'Content-type' present (@pastaclub)
|
||||
- [#710](https://github.com/request/request/pull/710) Fixing listing in callback part of docs. (@lukasz-zak)
|
||||
- [#696](https://github.com/request/request/pull/696) Edited README.md for formatting and clarity of phrasing (@Zearin)
|
||||
- [#694](https://github.com/request/request/pull/694) Typo in README (@VRMink)
|
||||
- [#690](https://github.com/request/request/pull/690) Handle blank password in basic auth. (@diversario)
|
||||
- [#682](https://github.com/request/request/pull/682) Optional dependencies (@Turbo87)
|
||||
- [#683](https://github.com/request/request/pull/683) Travis CI support (@Turbo87)
|
||||
- [#674](https://github.com/request/request/pull/674) change cookie module,to tough-cookie.please check it . (@sxyizhiren)
|
||||
- [#666](https://github.com/request/request/pull/666) make `ciphers` and `secureProtocol` to work in https request (@richarddong)
|
||||
- [#656](https://github.com/request/request/pull/656) Test case for #304. (@diversario)
|
||||
- [#662](https://github.com/request/request/pull/662) option.tunnel to explicitly disable tunneling (@seanmonstar)
|
||||
- [#659](https://github.com/request/request/pull/659) fix failure when running with NODE_DEBUG=request, and a test for that (@jrgm)
|
||||
- [#630](https://github.com/request/request/pull/630) Send random cnonce for HTTP Digest requests (@wprl)
|
||||
|
||||
### v2.27.0 (2013/08/15)
|
||||
- [#619](https://github.com/request/request/pull/619) decouple things a bit (@joaojeronimo)
|
||||
|
||||
### v2.26.0 (2013/08/07)
|
||||
- [#613](https://github.com/request/request/pull/613) Fixes #583, moved initialization of self.uri.pathname (@lexander)
|
||||
- [#605](https://github.com/request/request/pull/605) Only include ":" + pass in Basic Auth if it's defined (fixes #602) (@bendrucker)
|
||||
|
||||
### v2.24.0 (2013/07/23)
|
||||
- [#596](https://github.com/request/request/pull/596) Global agent is being used when pool is specified (@Cauldrath)
|
||||
- [#594](https://github.com/request/request/pull/594) Emit complete event when there is no callback (@RomainLK)
|
||||
- [#601](https://github.com/request/request/pull/601) Fixed a small typo (@michalstanko)
|
||||
|
||||
### v2.23.0 (2013/07/23)
|
||||
- [#589](https://github.com/request/request/pull/589) Prevent setting headers after they are sent (@geek)
|
||||
- [#587](https://github.com/request/request/pull/587) Global cookie jar disabled by default (@threepointone)
|
||||
|
||||
### v2.22.0 (2013/07/05)
|
||||
- [#544](https://github.com/request/request/pull/544) Update http-signature version. (@davidlehn)
|
||||
- [#581](https://github.com/request/request/pull/581) Fix spelling of "ignoring." (@bigeasy)
|
||||
- [#568](https://github.com/request/request/pull/568) use agentOptions to create agent when specified in request (@SamPlacette)
|
||||
- [#564](https://github.com/request/request/pull/564) Fix redirections (@criloz)
|
||||
- [#541](https://github.com/request/request/pull/541) The exported request function doesn't have an auth method (@tschaub)
|
||||
- [#542](https://github.com/request/request/pull/542) Expose Request class (@regality)
|
||||
|
||||
### v2.21.0 (2013/04/30)
|
||||
- [#536](https://github.com/request/request/pull/536) Allow explicitly empty user field for basic authentication. (@mikeando)
|
||||
- [#532](https://github.com/request/request/pull/532) fix typo (@fredericosilva)
|
||||
- [#497](https://github.com/request/request/pull/497) Added redirect event (@Cauldrath)
|
||||
- [#503](https://github.com/request/request/pull/503) Fix basic auth for passwords that contain colons (@tonistiigi)
|
||||
- [#521](https://github.com/request/request/pull/521) Improving test-localAddress.js (@noway421)
|
||||
- [#529](https://github.com/request/request/pull/529) dependencies versions bump (@jodaka)
|
||||
|
||||
### v2.17.0 (2013/04/22)
|
||||
- [#523](https://github.com/request/request/pull/523) Updating dependencies (@noway421)
|
||||
- [#520](https://github.com/request/request/pull/520) Fixing test-tunnel.js (@noway421)
|
||||
- [#519](https://github.com/request/request/pull/519) Update internal path state on post-creation QS changes (@jblebrun)
|
||||
- [#510](https://github.com/request/request/pull/510) Add HTTP Signature support. (@davidlehn)
|
||||
- [#502](https://github.com/request/request/pull/502) Fix POST (and probably other) requests that are retried after 401 Unauthorized (@nylen)
|
||||
- [#508](https://github.com/request/request/pull/508) Honor the .strictSSL option when using proxies (tunnel-agent) (@jhs)
|
||||
- [#512](https://github.com/request/request/pull/512) Make password optional to support the format: http://username@hostname/ (@pajato1)
|
||||
- [#513](https://github.com/request/request/pull/513) add 'localAddress' support (@yyfrankyy)
|
||||
- [#498](https://github.com/request/request/pull/498) Moving response emit above setHeaders on destination streams (@kenperkins)
|
||||
- [#490](https://github.com/request/request/pull/490) Empty response body (3-rd argument) must be passed to callback as an empty string (@Olegas)
|
||||
- [#479](https://github.com/request/request/pull/479) Changing so if Accept header is explicitly set, sending json does not ov... (@RoryH)
|
||||
- [#475](https://github.com/request/request/pull/475) Use `unescape` from `querystring` (@shimaore)
|
||||
- [#473](https://github.com/request/request/pull/473) V0.10 compat (@isaacs)
|
||||
- [#471](https://github.com/request/request/pull/471) Using querystring library from visionmedia (@kbackowski)
|
||||
- [#461](https://github.com/request/request/pull/461) Strip the UTF8 BOM from a UTF encoded response (@kppullin)
|
||||
- [#460](https://github.com/request/request/pull/460) hawk 0.10.0 (@hueniverse)
|
||||
- [#462](https://github.com/request/request/pull/462) if query params are empty, then request path shouldn't end with a '?' (merges cleanly now) (@jaipandya)
|
||||
- [#456](https://github.com/request/request/pull/456) hawk 0.9.0 (@hueniverse)
|
||||
- [#429](https://github.com/request/request/pull/429) Copy options before adding callback. (@nrn, @nfriedly, @youurayy, @jplock, @kapetan, @landeiro, @othiym23, @mmalecki)
|
||||
- [#454](https://github.com/request/request/pull/454) Destroy the response if present when destroying the request (clean merge) (@mafintosh)
|
||||
- [#310](https://github.com/request/request/pull/310) Twitter Oauth Stuff Out of Date; Now Updated (@joemccann, @isaacs, @mscdex)
|
||||
- [#413](https://github.com/request/request/pull/413) rename googledoodle.png to .jpg (@nfriedly, @youurayy, @jplock, @kapetan, @landeiro, @othiym23, @mmalecki)
|
||||
- [#448](https://github.com/request/request/pull/448) Convenience method for PATCH (@mloar)
|
||||
- [#444](https://github.com/request/request/pull/444) protect against double callbacks on error path (@spollack)
|
||||
- [#433](https://github.com/request/request/pull/433) Added support for HTTPS cert & key (@mmalecki)
|
||||
- [#430](https://github.com/request/request/pull/430) Respect specified {Host,host} headers, not just {host} (@andrewschaaf)
|
||||
- [#415](https://github.com/request/request/pull/415) Fixed a typo. (@jerem)
|
||||
- [#338](https://github.com/request/request/pull/338) Add more auth options, including digest support (@nylen)
|
||||
- [#403](https://github.com/request/request/pull/403) Optimize environment lookup to happen once only (@mmalecki)
|
||||
- [#398](https://github.com/request/request/pull/398) Add more reporting to tests (@mmalecki)
|
||||
- [#388](https://github.com/request/request/pull/388) Ensure "safe" toJSON doesn't break EventEmitters (@othiym23)
|
||||
- [#381](https://github.com/request/request/pull/381) Resolving "Invalid signature. Expected signature base string: " (@landeiro)
|
||||
- [#380](https://github.com/request/request/pull/380) Fixes missing host header on retried request when using forever agent (@mac-)
|
||||
- [#376](https://github.com/request/request/pull/376) Headers lost on redirect (@kapetan)
|
||||
- [#375](https://github.com/request/request/pull/375) Fix for missing oauth_timestamp parameter (@jplock)
|
||||
- [#374](https://github.com/request/request/pull/374) Correct Host header for proxy tunnel CONNECT (@youurayy)
|
||||
- [#370](https://github.com/request/request/pull/370) Twitter reverse auth uses x_auth_mode not x_auth_type (@drudge)
|
||||
- [#369](https://github.com/request/request/pull/369) Don't remove x_auth_mode for Twitter reverse auth (@drudge)
|
||||
- [#344](https://github.com/request/request/pull/344) Make AWS auth signing find headers correctly (@nlf)
|
||||
- [#363](https://github.com/request/request/pull/363) rfc3986 on base_uri, now passes tests (@jeffmarshall)
|
||||
- [#362](https://github.com/request/request/pull/362) Running `rfc3986` on `base_uri` in `oauth.hmacsign` instead of just `encodeURIComponent` (@jeffmarshall)
|
||||
- [#361](https://github.com/request/request/pull/361) Don't create a Content-Length header if we already have it set (@danjenkins)
|
||||
- [#360](https://github.com/request/request/pull/360) Delete self._form along with everything else on redirect (@jgautier)
|
||||
- [#355](https://github.com/request/request/pull/355) stop sending erroneous headers on redirected requests (@azylman)
|
||||
- [#332](https://github.com/request/request/pull/332) Fix #296 - Only set Content-Type if body exists (@Marsup)
|
||||
- [#343](https://github.com/request/request/pull/343) Allow AWS to work in more situations, added a note in the README on its usage (@nlf)
|
||||
- [#320](https://github.com/request/request/pull/320) request.defaults() doesn't need to wrap jar() (@StuartHarris)
|
||||
- [#322](https://github.com/request/request/pull/322) Fix + test for piped into request bumped into redirect. #321 (@alexindigo)
|
||||
- [#326](https://github.com/request/request/pull/326) Do not try to remove listener from an undefined connection (@strk)
|
||||
- [#318](https://github.com/request/request/pull/318) Pass servername to tunneling secure socket creation (@isaacs)
|
||||
- [#317](https://github.com/request/request/pull/317) Workaround for #313 (@isaacs)
|
||||
- [#293](https://github.com/request/request/pull/293) Allow parser errors to bubble up to request (@mscdex)
|
||||
- [#290](https://github.com/request/request/pull/290) A test for #289 (@isaacs)
|
||||
- [#280](https://github.com/request/request/pull/280) Like in node.js print options if NODE_DEBUG contains the word request (@Filirom1)
|
||||
- [#207](https://github.com/request/request/pull/207) Fix #206 Change HTTP/HTTPS agent when redirecting between protocols (@isaacs)
|
||||
- [#214](https://github.com/request/request/pull/214) documenting additional behavior of json option (@jphaas)
|
||||
- [#272](https://github.com/request/request/pull/272) Boundary begins with CRLF? (@elspoono, @timshadel, @naholyr, @nanodocumet, @TehShrike)
|
||||
- [#284](https://github.com/request/request/pull/284) Remove stray `console.log()` call in multipart generator. (@bcherry)
|
||||
- [#241](https://github.com/request/request/pull/241) Composability updates suggested by issue #239 (@polotek)
|
||||
- [#282](https://github.com/request/request/pull/282) OAuth Authorization header contains non-"oauth_" parameters (@jplock)
|
||||
- [#279](https://github.com/request/request/pull/279) fix tests with boundary by injecting boundry from header (@benatkin)
|
||||
- [#273](https://github.com/request/request/pull/273) Pipe back pressure issue (@mafintosh)
|
||||
- [#268](https://github.com/request/request/pull/268) I'm not OCD seriously (@TehShrike)
|
||||
- [#263](https://github.com/request/request/pull/263) Bug in OAuth key generation for sha1 (@nanodocumet)
|
||||
- [#265](https://github.com/request/request/pull/265) uncaughtException when redirected to invalid URI (@naholyr)
|
||||
- [#262](https://github.com/request/request/pull/262) JSON test should check for equality (@timshadel)
|
||||
- [#261](https://github.com/request/request/pull/261) Setting 'pool' to 'false' does NOT disable Agent pooling (@timshadel)
|
||||
- [#249](https://github.com/request/request/pull/249) Fix for the fix of your (closed) issue #89 where self.headers[content-length] is set to 0 for all methods (@sethbridges, @polotek, @zephrax, @jeromegn)
|
||||
- [#255](https://github.com/request/request/pull/255) multipart allow body === '' ( the empty string ) (@Filirom1)
|
||||
- [#260](https://github.com/request/request/pull/260) fixed just another leak of 'i' (@sreuter)
|
||||
- [#246](https://github.com/request/request/pull/246) Fixing the set-cookie header (@jeromegn)
|
||||
- [#243](https://github.com/request/request/pull/243) Dynamic boundary (@zephrax)
|
||||
- [#240](https://github.com/request/request/pull/240) don't error when null is passed for options (@polotek)
|
||||
- [#211](https://github.com/request/request/pull/211) Replace all occurrences of special chars in RFC3986 (@chriso)
|
||||
- [#224](https://github.com/request/request/pull/224) Multipart content-type change (@janjongboom)
|
||||
- [#217](https://github.com/request/request/pull/217) need to use Authorization (titlecase) header with Tumblr OAuth (@visnup)
|
||||
- [#203](https://github.com/request/request/pull/203) Fix cookie and redirect bugs and add auth support for HTTPS tunnel (@milewise)
|
||||
- [#199](https://github.com/request/request/pull/199) Tunnel (@isaacs)
|
||||
- [#198](https://github.com/request/request/pull/198) Bugfix on forever usage of util.inherits (@isaacs)
|
||||
- [#197](https://github.com/request/request/pull/197) Make ForeverAgent work with HTTPS (@isaacs)
|
||||
- [#193](https://github.com/request/request/pull/193) Fixes GH-119 (@goatslacker)
|
||||
- [#188](https://github.com/request/request/pull/188) Add abort support to the returned request (@itay)
|
||||
- [#176](https://github.com/request/request/pull/176) Querystring option (@csainty)
|
||||
- [#182](https://github.com/request/request/pull/182) Fix request.defaults to support (uri, options, callback) api (@twilson63)
|
||||
- [#180](https://github.com/request/request/pull/180) Modified the post, put, head and del shortcuts to support uri optional param (@twilson63)
|
||||
- [#179](https://github.com/request/request/pull/179) fix to add opts in .pipe(stream, opts) (@substack)
|
||||
- [#177](https://github.com/request/request/pull/177) Issue #173 Support uri as first and optional config as second argument (@twilson63)
|
||||
- [#170](https://github.com/request/request/pull/170) can't create a cookie in a wrapped request (defaults) (@fabianonunes)
|
||||
- [#168](https://github.com/request/request/pull/168) Picking off an EasyFix by adding some missing mimetypes. (@serby)
|
||||
- [#161](https://github.com/request/request/pull/161) Fix cookie jar/headers.cookie collision (#125) (@papandreou)
|
||||
- [#162](https://github.com/request/request/pull/162) Fix issue #159 (@dpetukhov)
|
||||
- [#90](https://github.com/request/request/pull/90) add option followAllRedirects to follow post/put redirects (@jroes)
|
||||
- [#148](https://github.com/request/request/pull/148) Retry Agent (@thejh)
|
||||
- [#146](https://github.com/request/request/pull/146) Multipart should respect content-type if previously set (@apeace)
|
||||
- [#144](https://github.com/request/request/pull/144) added "form" option to readme (@petejkim)
|
||||
- [#133](https://github.com/request/request/pull/133) Fixed cookies parsing (@afanasy)
|
||||
- [#135](https://github.com/request/request/pull/135) host vs hostname (@iangreenleaf)
|
||||
- [#132](https://github.com/request/request/pull/132) return the body as a Buffer when encoding is set to null (@jahewson)
|
||||
- [#112](https://github.com/request/request/pull/112) Support using a custom http-like module (@jhs)
|
||||
- [#104](https://github.com/request/request/pull/104) Cookie handling contains bugs (@janjongboom)
|
||||
- [#121](https://github.com/request/request/pull/121) Another patch for cookie handling regression (@jhurliman)
|
||||
- [#117](https://github.com/request/request/pull/117) Remove the global `i` (@3rd-Eden)
|
||||
- [#110](https://github.com/request/request/pull/110) Update to Iris Couch URL (@jhs)
|
||||
- [#86](https://github.com/request/request/pull/86) Can't post binary to multipart requests (@developmentseed)
|
||||
- [#105](https://github.com/request/request/pull/105) added test for proxy option. (@dominictarr)
|
||||
- [#102](https://github.com/request/request/pull/102) Implemented cookies - closes issue 82: https://github.com/mikeal/request/issues/82 (@alessioalex)
|
||||
- [#97](https://github.com/request/request/pull/97) Typo in previous pull causes TypeError in non-0.5.11 versions (@isaacs)
|
||||
- [#96](https://github.com/request/request/pull/96) Authless parsed url host support (@isaacs)
|
||||
- [#81](https://github.com/request/request/pull/81) Enhance redirect handling (@danmactough)
|
||||
- [#78](https://github.com/request/request/pull/78) Don't try to do strictSSL for non-ssl connections (@isaacs)
|
||||
- [#76](https://github.com/request/request/pull/76) Bug when a request fails and a timeout is set (@Marsup)
|
||||
- [#70](https://github.com/request/request/pull/70) add test script to package.json (@isaacs, @aheckmann)
|
||||
- [#73](https://github.com/request/request/pull/73) Fix #71 Respect the strictSSL flag (@isaacs)
|
||||
- [#69](https://github.com/request/request/pull/69) Flatten chunked requests properly (@isaacs)
|
||||
- [#67](https://github.com/request/request/pull/67) fixed global variable leaks (@aheckmann)
|
||||
- [#66](https://github.com/request/request/pull/66) Do not overwrite established content-type headers for read stream deliver (@voodootikigod)
|
||||
- [#53](https://github.com/request/request/pull/53) Parse json: Issue #51 (@benatkin)
|
||||
- [#45](https://github.com/request/request/pull/45) Added timeout option (@mbrevoort)
|
||||
- [#35](https://github.com/request/request/pull/35) The "end" event isn't emitted for some responses (@voxpelli)
|
||||
- [#31](https://github.com/request/request/pull/31) Error on piping a request to a destination (@tobowers)
|
||||
44
node_modules/twit/node_modules/request/CONTRIBUTING.md
generated
vendored
Normal file
44
node_modules/twit/node_modules/request/CONTRIBUTING.md
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# This is an OPEN Open Source Project
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
## What?
|
||||
|
||||
Individuals making significant and valuable contributions are given
|
||||
commit-access to the project to contribute as they see fit. This project is
|
||||
more like an open wiki than a standard guarded open source project.
|
||||
|
||||
## Rules
|
||||
|
||||
There are a few basic ground-rules for contributors:
|
||||
|
||||
1. **No `--force` pushes** or modifying the Git history in any way.
|
||||
1. **Non-master branches** ought to be used for ongoing work.
|
||||
1. **External API changes and significant modifications** ought to be subject
|
||||
to an **internal pull-request** to solicit feedback from other contributors.
|
||||
1. Internal pull-requests to solicit feedback are *encouraged* for any other
|
||||
non-trivial contribution but left to the discretion of the contributor.
|
||||
1. For significant changes wait a full 24 hours before merging so that active
|
||||
contributors who are distributed throughout the world have a chance to weigh
|
||||
in.
|
||||
1. Contributors should attempt to adhere to the prevailing code-style.
|
||||
1. Run `npm test` locally before submitting your PR, to catch any easy to miss
|
||||
style & testing issues. To diagnose test failures, there are two ways to
|
||||
run a single test file:
|
||||
- `node_modules/.bin/taper tests/test-file.js` - run using the default
|
||||
[`taper`](https://github.com/nylen/taper) test reporter.
|
||||
- `node tests/test-file.js` - view the raw
|
||||
[tap](https://testanything.org/) output.
|
||||
|
||||
|
||||
## Releases
|
||||
|
||||
Declaring formal releases remains the prerogative of the project maintainer.
|
||||
|
||||
## Changes to this arrangement
|
||||
|
||||
This is an experiment and feedback is welcome! This document may also be
|
||||
subject to pull-requests or changes by contributors where you believe you have
|
||||
something valuable to add or change.
|
||||
|
||||
-----------------------------------------
|
||||
55
node_modules/twit/node_modules/request/LICENSE
generated
vendored
Normal file
55
node_modules/twit/node_modules/request/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
Apache License
|
||||
|
||||
Version 2.0, January 2004
|
||||
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
1059
node_modules/twit/node_modules/request/README.md
generated
vendored
Normal file
1059
node_modules/twit/node_modules/request/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
36
node_modules/twit/node_modules/request/disabled.appveyor.yml
generated
vendored
Normal file
36
node_modules/twit/node_modules/request/disabled.appveyor.yml
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
# http://www.appveyor.com/docs/appveyor-yml
|
||||
|
||||
# Fix line endings in Windows. (runs before repo cloning)
|
||||
init:
|
||||
- git config --global core.autocrlf input
|
||||
|
||||
# Test against these versions of Node.js.
|
||||
environment:
|
||||
matrix:
|
||||
- nodejs_version: "0.10"
|
||||
- nodejs_version: "0.8"
|
||||
- nodejs_version: "0.11"
|
||||
|
||||
# Allow failing jobs for bleeding-edge Node.js versions.
|
||||
matrix:
|
||||
allow_failures:
|
||||
- nodejs_version: "0.11"
|
||||
|
||||
# Install scripts. (runs after repo cloning)
|
||||
install:
|
||||
# Get the latest stable version of Node 0.STABLE.latest
|
||||
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)
|
||||
# Typical npm stuff.
|
||||
- npm install
|
||||
|
||||
# Post-install test scripts.
|
||||
test_script:
|
||||
# Output useful info for debugging.
|
||||
- ps: "npm test # PowerShell" # Pass comment to PS for easier debugging
|
||||
- cmd: npm test
|
||||
|
||||
# Don't actually build.
|
||||
build: off
|
||||
|
||||
# Set build version format here instead of in the admin panel.
|
||||
version: "{build}"
|
||||
115
node_modules/twit/node_modules/request/examples/README.md
generated
vendored
Normal file
115
node_modules/twit/node_modules/request/examples/README.md
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
|
||||
# Authentication
|
||||
|
||||
## OAuth
|
||||
|
||||
### OAuth1.0 Refresh Token
|
||||
|
||||
- http://oauth.googlecode.com/svn/spec/ext/session/1.0/drafts/1/spec.html#anchor4
|
||||
- https://developer.yahoo.com/oauth/guide/oauth-refreshaccesstoken.html
|
||||
|
||||
```js
|
||||
request.post('https://api.login.yahoo.com/oauth/v2/get_token', {
|
||||
oauth: {
|
||||
consumer_key: '...',
|
||||
consumer_secret: '...',
|
||||
token: '...',
|
||||
token_secret: '...',
|
||||
session_handle: '...'
|
||||
}
|
||||
}, function (err, res, body) {
|
||||
var result = require('querystring').parse(body)
|
||||
// assert.equal(typeof result, 'object')
|
||||
})
|
||||
```
|
||||
|
||||
### OAuth2 Refresh Token
|
||||
|
||||
- https://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-6
|
||||
|
||||
```js
|
||||
request.post('https://accounts.google.com/o/oauth2/token', {
|
||||
form: {
|
||||
grant_type: 'refresh_token',
|
||||
client_id: '...',
|
||||
client_secret: '...',
|
||||
refresh_token: '...'
|
||||
},
|
||||
json: true
|
||||
}, function (err, res, body) {
|
||||
// assert.equal(typeof body, 'object')
|
||||
})
|
||||
```
|
||||
|
||||
# Multipart
|
||||
|
||||
## multipart/form-data
|
||||
|
||||
### Flickr Image Upload
|
||||
|
||||
- https://www.flickr.com/services/api/upload.api.html
|
||||
|
||||
```js
|
||||
request.post('https://up.flickr.com/services/upload', {
|
||||
oauth: {
|
||||
consumer_key: '...',
|
||||
consumer_secret: '...',
|
||||
token: '...',
|
||||
token_secret: '...'
|
||||
},
|
||||
// all meta data should be included here for proper signing
|
||||
qs: {
|
||||
title: 'My cat is awesome',
|
||||
description: 'Sent on ' + new Date(),
|
||||
is_public: 1
|
||||
},
|
||||
// again the same meta data + the actual photo
|
||||
formData: {
|
||||
title: 'My cat is awesome',
|
||||
description: 'Sent on ' + new Date(),
|
||||
is_public: 1,
|
||||
photo:fs.createReadStream('cat.png')
|
||||
},
|
||||
json: true
|
||||
}, function (err, res, body) {
|
||||
// assert.equal(typeof body, 'object')
|
||||
})
|
||||
```
|
||||
|
||||
# Streams
|
||||
|
||||
## `POST` data
|
||||
|
||||
Use Request as a Writable stream to easily `POST` Readable streams (like files, other HTTP requests, or otherwise).
|
||||
|
||||
TL;DR: Pipe a Readable Stream onto Request via:
|
||||
|
||||
```
|
||||
READABLE.pipe(request.post(URL));
|
||||
```
|
||||
|
||||
A more detailed example:
|
||||
|
||||
```js
|
||||
var fs = require('fs')
|
||||
, path = require('path')
|
||||
, http = require('http')
|
||||
, request = require('request')
|
||||
, TMP_FILE_PATH = path.join(path.sep, 'tmp', 'foo')
|
||||
;
|
||||
|
||||
// write a temporary file:
|
||||
fs.writeFileSync(TMP_FILE_PATH, 'foo bar baz quk\n');
|
||||
|
||||
http.createServer(function(req, res) {
|
||||
console.log('the server is receiving data!\n');
|
||||
req
|
||||
.on('end', res.end.bind(res))
|
||||
.pipe(process.stdout)
|
||||
;
|
||||
}).listen(3000).unref();
|
||||
|
||||
fs.createReadStream(TMP_FILE_PATH)
|
||||
.pipe(request.post('http://127.0.0.1:3000'))
|
||||
;
|
||||
```
|
||||
152
node_modules/twit/node_modules/request/index.js
generated
vendored
Executable file
152
node_modules/twit/node_modules/request/index.js
generated
vendored
Executable file
@@ -0,0 +1,152 @@
|
||||
// Copyright 2010-2012 Mikeal Rogers
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
'use strict'
|
||||
|
||||
var extend = require('extend')
|
||||
, cookies = require('./lib/cookies')
|
||||
, helpers = require('./lib/helpers')
|
||||
|
||||
var isFunction = helpers.isFunction
|
||||
, paramsHaveRequestBody = helpers.paramsHaveRequestBody
|
||||
|
||||
|
||||
// organize params for patch, post, put, head, del
|
||||
function initParams(uri, options, callback) {
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
}
|
||||
|
||||
var params = {}
|
||||
if (typeof options === 'object') {
|
||||
extend(params, options, {uri: uri})
|
||||
} else if (typeof uri === 'string') {
|
||||
extend(params, {uri: uri})
|
||||
} else {
|
||||
extend(params, uri)
|
||||
}
|
||||
|
||||
params.callback = callback
|
||||
return params
|
||||
}
|
||||
|
||||
function request (uri, options, callback) {
|
||||
if (typeof uri === 'undefined') {
|
||||
throw new Error('undefined is not a valid uri or options object.')
|
||||
}
|
||||
|
||||
var params = initParams(uri, options, callback)
|
||||
|
||||
if (params.method === 'HEAD' && paramsHaveRequestBody(params)) {
|
||||
throw new Error('HTTP HEAD requests MUST NOT include a request body.')
|
||||
}
|
||||
|
||||
return new request.Request(params)
|
||||
}
|
||||
|
||||
function verbFunc (verb) {
|
||||
var method = verb === 'del' ? 'DELETE' : verb.toUpperCase()
|
||||
return function (uri, options, callback) {
|
||||
var params = initParams(uri, options, callback)
|
||||
params.method = method
|
||||
return request(params, params.callback)
|
||||
}
|
||||
}
|
||||
|
||||
// define like this to please codeintel/intellisense IDEs
|
||||
request.get = verbFunc('get')
|
||||
request.head = verbFunc('head')
|
||||
request.post = verbFunc('post')
|
||||
request.put = verbFunc('put')
|
||||
request.patch = verbFunc('patch')
|
||||
request.del = verbFunc('del')
|
||||
|
||||
request.jar = function (store) {
|
||||
return cookies.jar(store)
|
||||
}
|
||||
|
||||
request.cookie = function (str) {
|
||||
return cookies.parse(str)
|
||||
}
|
||||
|
||||
function wrapRequestMethod (method, options, requester, verb) {
|
||||
|
||||
return function (uri, opts, callback) {
|
||||
var params = initParams(uri, opts, callback)
|
||||
|
||||
var target = {}
|
||||
extend(true, target, options, params)
|
||||
|
||||
if (verb) {
|
||||
target.method = (verb === 'del' ? 'DELETE' : verb.toUpperCase())
|
||||
}
|
||||
|
||||
if (isFunction(requester)) {
|
||||
method = requester
|
||||
}
|
||||
|
||||
return method(target, target.callback)
|
||||
}
|
||||
}
|
||||
|
||||
request.defaults = function (options, requester) {
|
||||
var self = this
|
||||
|
||||
if (typeof options === 'function') {
|
||||
requester = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
var defaults = wrapRequestMethod(self, options, requester)
|
||||
|
||||
var verbs = ['get', 'head', 'post', 'put', 'patch', 'del']
|
||||
verbs.forEach(function(verb) {
|
||||
defaults[verb] = wrapRequestMethod(self[verb], options, requester, verb)
|
||||
})
|
||||
|
||||
defaults.cookie = wrapRequestMethod(self.cookie, options, requester)
|
||||
defaults.jar = self.jar
|
||||
defaults.defaults = self.defaults
|
||||
return defaults
|
||||
}
|
||||
|
||||
request.forever = function (agentOptions, optionsArg) {
|
||||
var options = {}
|
||||
if (optionsArg) {
|
||||
extend(options, optionsArg)
|
||||
}
|
||||
if (agentOptions) {
|
||||
options.agentOptions = agentOptions
|
||||
}
|
||||
|
||||
options.forever = true
|
||||
return request.defaults(options)
|
||||
}
|
||||
|
||||
// Exports
|
||||
|
||||
module.exports = request
|
||||
request.Request = require('./request')
|
||||
request.initParams = initParams
|
||||
|
||||
// Backwards compatibility for request.debug
|
||||
Object.defineProperty(request, 'debug', {
|
||||
enumerable : true,
|
||||
get : function() {
|
||||
return request.Request.debug
|
||||
},
|
||||
set : function(debug) {
|
||||
request.Request.debug = debug
|
||||
}
|
||||
})
|
||||
153
node_modules/twit/node_modules/request/lib/auth.js
generated
vendored
Normal file
153
node_modules/twit/node_modules/request/lib/auth.js
generated
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
'use strict'
|
||||
|
||||
var caseless = require('caseless')
|
||||
, uuid = require('node-uuid')
|
||||
, helpers = require('./helpers')
|
||||
|
||||
var md5 = helpers.md5
|
||||
, toBase64 = helpers.toBase64
|
||||
|
||||
|
||||
function Auth (request) {
|
||||
// define all public properties here
|
||||
this.request = request
|
||||
this.hasAuth = false
|
||||
this.sentAuth = false
|
||||
this.bearerToken = null
|
||||
this.user = null
|
||||
this.pass = null
|
||||
}
|
||||
|
||||
Auth.prototype.basic = function (user, pass, sendImmediately) {
|
||||
var self = this
|
||||
if (typeof user !== 'string' || (pass !== undefined && typeof pass !== 'string')) {
|
||||
self.request.emit('error', new Error('auth() received invalid user or password'))
|
||||
}
|
||||
self.user = user
|
||||
self.pass = pass
|
||||
self.hasAuth = true
|
||||
var header = user + ':' + (pass || '')
|
||||
if (sendImmediately || typeof sendImmediately === 'undefined') {
|
||||
var authHeader = 'Basic ' + toBase64(header)
|
||||
self.sentAuth = true
|
||||
return authHeader
|
||||
}
|
||||
}
|
||||
|
||||
Auth.prototype.bearer = function (bearer, sendImmediately) {
|
||||
var self = this
|
||||
self.bearerToken = bearer
|
||||
self.hasAuth = true
|
||||
if (sendImmediately || typeof sendImmediately === 'undefined') {
|
||||
if (typeof bearer === 'function') {
|
||||
bearer = bearer()
|
||||
}
|
||||
var authHeader = 'Bearer ' + (bearer || '')
|
||||
self.sentAuth = true
|
||||
return authHeader
|
||||
}
|
||||
}
|
||||
|
||||
Auth.prototype.digest = function (method, path, authHeader) {
|
||||
// TODO: More complete implementation of RFC 2617.
|
||||
// - check challenge.algorithm
|
||||
// - support algorithm="MD5-sess"
|
||||
// - handle challenge.domain
|
||||
// - support qop="auth-int" only
|
||||
// - handle Authentication-Info (not necessarily?)
|
||||
// - check challenge.stale (not necessarily?)
|
||||
// - increase nc (not necessarily?)
|
||||
// For reference:
|
||||
// http://tools.ietf.org/html/rfc2617#section-3
|
||||
// https://github.com/bagder/curl/blob/master/lib/http_digest.c
|
||||
|
||||
var self = this
|
||||
|
||||
var challenge = {}
|
||||
var re = /([a-z0-9_-]+)=(?:"([^"]+)"|([a-z0-9_-]+))/gi
|
||||
for (;;) {
|
||||
var match = re.exec(authHeader)
|
||||
if (!match) {
|
||||
break
|
||||
}
|
||||
challenge[match[1]] = match[2] || match[3]
|
||||
}
|
||||
|
||||
var ha1 = md5(self.user + ':' + challenge.realm + ':' + self.pass)
|
||||
var ha2 = md5(method + ':' + path)
|
||||
var qop = /(^|,)\s*auth\s*($|,)/.test(challenge.qop) && 'auth'
|
||||
var nc = qop && '00000001'
|
||||
var cnonce = qop && uuid().replace(/-/g, '')
|
||||
var digestResponse = qop
|
||||
? md5(ha1 + ':' + challenge.nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + ha2)
|
||||
: md5(ha1 + ':' + challenge.nonce + ':' + ha2)
|
||||
var authValues = {
|
||||
username: self.user,
|
||||
realm: challenge.realm,
|
||||
nonce: challenge.nonce,
|
||||
uri: path,
|
||||
qop: qop,
|
||||
response: digestResponse,
|
||||
nc: nc,
|
||||
cnonce: cnonce,
|
||||
algorithm: challenge.algorithm,
|
||||
opaque: challenge.opaque
|
||||
}
|
||||
|
||||
authHeader = []
|
||||
for (var k in authValues) {
|
||||
if (authValues[k]) {
|
||||
if (k === 'qop' || k === 'nc' || k === 'algorithm') {
|
||||
authHeader.push(k + '=' + authValues[k])
|
||||
} else {
|
||||
authHeader.push(k + '="' + authValues[k] + '"')
|
||||
}
|
||||
}
|
||||
}
|
||||
authHeader = 'Digest ' + authHeader.join(', ')
|
||||
self.sentAuth = true
|
||||
return authHeader
|
||||
}
|
||||
|
||||
Auth.prototype.onRequest = function (user, pass, sendImmediately, bearer) {
|
||||
var self = this
|
||||
, request = self.request
|
||||
|
||||
var authHeader
|
||||
if (bearer === undefined && user === undefined) {
|
||||
self.request.emit('error', new Error('no auth mechanism defined'))
|
||||
} else if (bearer !== undefined) {
|
||||
authHeader = self.bearer(bearer, sendImmediately)
|
||||
} else {
|
||||
authHeader = self.basic(user, pass, sendImmediately)
|
||||
}
|
||||
if (authHeader) {
|
||||
request.setHeader('authorization', authHeader)
|
||||
}
|
||||
}
|
||||
|
||||
Auth.prototype.onResponse = function (response) {
|
||||
var self = this
|
||||
, request = self.request
|
||||
|
||||
if (!self.hasAuth || self.sentAuth) { return null }
|
||||
|
||||
var c = caseless(response.headers)
|
||||
|
||||
var authHeader = c.get('www-authenticate')
|
||||
var authVerb = authHeader && authHeader.split(' ')[0].toLowerCase()
|
||||
request.debug('reauth', authVerb)
|
||||
|
||||
switch (authVerb) {
|
||||
case 'basic':
|
||||
return self.basic(self.user, self.pass, true)
|
||||
|
||||
case 'bearer':
|
||||
return self.bearer(self.bearerToken, true)
|
||||
|
||||
case 'digest':
|
||||
return self.digest(request.method, request.path, authHeader)
|
||||
}
|
||||
}
|
||||
|
||||
exports.Auth = Auth
|
||||
39
node_modules/twit/node_modules/request/lib/cookies.js
generated
vendored
Normal file
39
node_modules/twit/node_modules/request/lib/cookies.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict'
|
||||
|
||||
var tough = require('tough-cookie')
|
||||
|
||||
var Cookie = tough.Cookie
|
||||
, CookieJar = tough.CookieJar
|
||||
|
||||
|
||||
exports.parse = function(str) {
|
||||
if (str && str.uri) {
|
||||
str = str.uri
|
||||
}
|
||||
if (typeof str !== 'string') {
|
||||
throw new Error('The cookie function only accepts STRING as param')
|
||||
}
|
||||
return Cookie.parse(str)
|
||||
}
|
||||
|
||||
// Adapt the sometimes-Async api of tough.CookieJar to our requirements
|
||||
function RequestJar(store) {
|
||||
var self = this
|
||||
self._jar = new CookieJar(store)
|
||||
}
|
||||
RequestJar.prototype.setCookie = function(cookieOrStr, uri, options) {
|
||||
var self = this
|
||||
return self._jar.setCookieSync(cookieOrStr, uri, options || {})
|
||||
}
|
||||
RequestJar.prototype.getCookieString = function(uri) {
|
||||
var self = this
|
||||
return self._jar.getCookieStringSync(uri)
|
||||
}
|
||||
RequestJar.prototype.getCookies = function(uri) {
|
||||
var self = this
|
||||
return self._jar.getCookiesSync(uri)
|
||||
}
|
||||
|
||||
exports.jar = function(store) {
|
||||
return new RequestJar(store)
|
||||
}
|
||||
79
node_modules/twit/node_modules/request/lib/getProxyFromURI.js
generated
vendored
Normal file
79
node_modules/twit/node_modules/request/lib/getProxyFromURI.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
'use strict'
|
||||
|
||||
function formatHostname(hostname) {
|
||||
// canonicalize the hostname, so that 'oogle.com' won't match 'google.com'
|
||||
return hostname.replace(/^\.*/, '.').toLowerCase()
|
||||
}
|
||||
|
||||
function parseNoProxyZone(zone) {
|
||||
zone = zone.trim().toLowerCase()
|
||||
|
||||
var zoneParts = zone.split(':', 2)
|
||||
, zoneHost = formatHostname(zoneParts[0])
|
||||
, zonePort = zoneParts[1]
|
||||
, hasPort = zone.indexOf(':') > -1
|
||||
|
||||
return {hostname: zoneHost, port: zonePort, hasPort: hasPort}
|
||||
}
|
||||
|
||||
function uriInNoProxy(uri, noProxy) {
|
||||
var port = uri.port || (uri.protocol === 'https:' ? '443' : '80')
|
||||
, hostname = formatHostname(uri.hostname)
|
||||
, noProxyList = noProxy.split(',')
|
||||
|
||||
// iterate through the noProxyList until it finds a match.
|
||||
return noProxyList.map(parseNoProxyZone).some(function(noProxyZone) {
|
||||
var isMatchedAt = hostname.indexOf(noProxyZone.hostname)
|
||||
, hostnameMatched = (
|
||||
isMatchedAt > -1 &&
|
||||
(isMatchedAt === hostname.length - noProxyZone.hostname.length)
|
||||
)
|
||||
|
||||
if (noProxyZone.hasPort) {
|
||||
return (port === noProxyZone.port) && hostnameMatched
|
||||
}
|
||||
|
||||
return hostnameMatched
|
||||
})
|
||||
}
|
||||
|
||||
function getProxyFromURI(uri) {
|
||||
// Decide the proper request proxy to use based on the request URI object and the
|
||||
// environmental variables (NO_PROXY, HTTP_PROXY, etc.)
|
||||
// respect NO_PROXY environment variables (see: http://lynx.isc.org/current/breakout/lynx_help/keystrokes/environments.html)
|
||||
|
||||
var noProxy = process.env.NO_PROXY || process.env.no_proxy || ''
|
||||
|
||||
// if the noProxy is a wildcard then return null
|
||||
|
||||
if (noProxy === '*') {
|
||||
return null
|
||||
}
|
||||
|
||||
// if the noProxy is not empty and the uri is found return null
|
||||
|
||||
if (noProxy !== '' && uriInNoProxy(uri, noProxy)) {
|
||||
return null
|
||||
}
|
||||
|
||||
// Check for HTTP or HTTPS Proxy in environment Else default to null
|
||||
|
||||
if (uri.protocol === 'http:') {
|
||||
return process.env.HTTP_PROXY ||
|
||||
process.env.http_proxy || null
|
||||
}
|
||||
|
||||
if (uri.protocol === 'https:') {
|
||||
return process.env.HTTPS_PROXY ||
|
||||
process.env.https_proxy ||
|
||||
process.env.HTTP_PROXY ||
|
||||
process.env.http_proxy || null
|
||||
}
|
||||
|
||||
// if none of that works, return null
|
||||
// (What uri protocol are you using then?)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
module.exports = getProxyFromURI
|
||||
205
node_modules/twit/node_modules/request/lib/har.js
generated
vendored
Normal file
205
node_modules/twit/node_modules/request/lib/har.js
generated
vendored
Normal file
@@ -0,0 +1,205 @@
|
||||
'use strict'
|
||||
|
||||
var fs = require('fs')
|
||||
var qs = require('querystring')
|
||||
var validate = require('har-validator')
|
||||
var util = require('util')
|
||||
|
||||
function Har (request) {
|
||||
this.request = request
|
||||
}
|
||||
|
||||
Har.prototype.reducer = function (obj, pair) {
|
||||
// new property ?
|
||||
if (obj[pair.name] === undefined) {
|
||||
obj[pair.name] = pair.value
|
||||
return obj
|
||||
}
|
||||
|
||||
// existing? convert to array
|
||||
var arr = [
|
||||
obj[pair.name],
|
||||
pair.value
|
||||
]
|
||||
|
||||
obj[pair.name] = arr
|
||||
|
||||
return obj
|
||||
}
|
||||
|
||||
Har.prototype.prep = function (data) {
|
||||
// construct utility properties
|
||||
data.queryObj = {}
|
||||
data.headersObj = {}
|
||||
data.postData.jsonObj = false
|
||||
data.postData.paramsObj = false
|
||||
|
||||
// construct query objects
|
||||
if (data.queryString && data.queryString.length) {
|
||||
data.queryObj = data.queryString.reduce(this.reducer, {})
|
||||
}
|
||||
|
||||
// construct headers objects
|
||||
if (data.headers && data.headers.length) {
|
||||
// loweCase header keys
|
||||
data.headersObj = data.headers.reduceRight(function (headers, header) {
|
||||
headers[header.name] = header.value
|
||||
return headers
|
||||
}, {})
|
||||
}
|
||||
|
||||
// construct Cookie header
|
||||
if (data.cookies && data.cookies.length) {
|
||||
var cookies = data.cookies.map(function (cookie) {
|
||||
return cookie.name + '=' + cookie.value
|
||||
})
|
||||
|
||||
if (cookies.length) {
|
||||
data.headersObj.cookie = cookies.join('; ')
|
||||
}
|
||||
}
|
||||
|
||||
// prep body
|
||||
switch (data.postData.mimeType) {
|
||||
case 'multipart/mixed':
|
||||
case 'multipart/related':
|
||||
case 'multipart/form-data':
|
||||
case 'multipart/alternative':
|
||||
// reset values
|
||||
data.postData.mimeType = 'multipart/form-data'
|
||||
break
|
||||
|
||||
case 'application/x-www-form-urlencoded':
|
||||
if (!data.postData.params) {
|
||||
data.postData.text = ''
|
||||
} else {
|
||||
data.postData.paramsObj = data.postData.params.reduce(this.reducer, {})
|
||||
|
||||
// always overwrite
|
||||
data.postData.text = qs.stringify(data.postData.paramsObj)
|
||||
}
|
||||
break
|
||||
|
||||
case 'text/json':
|
||||
case 'text/x-json':
|
||||
case 'application/json':
|
||||
case 'application/x-json':
|
||||
data.postData.mimeType = 'application/json'
|
||||
|
||||
if (data.postData.text) {
|
||||
try {
|
||||
data.postData.jsonObj = JSON.parse(data.postData.text)
|
||||
} catch (e) {
|
||||
this.request.debug(e)
|
||||
|
||||
// force back to text/plain
|
||||
data.postData.mimeType = 'text/plain'
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
Har.prototype.options = function (options) {
|
||||
// skip if no har property defined
|
||||
if (!options.har) {
|
||||
return options
|
||||
}
|
||||
|
||||
var har = util._extend({}, options.har)
|
||||
|
||||
// only process the first entry
|
||||
if (har.log && har.log.entries) {
|
||||
har = har.log.entries[0]
|
||||
}
|
||||
|
||||
// add optional properties to make validation successful
|
||||
har.url = har.url || options.url || options.uri || options.baseUrl || '/'
|
||||
har.httpVersion = har.httpVersion || 'HTTP/1.1'
|
||||
har.queryString = har.queryString || []
|
||||
har.headers = har.headers || []
|
||||
har.cookies = har.cookies || []
|
||||
har.postData = har.postData || {}
|
||||
har.postData.mimeType = har.postData.mimeType || 'application/octet-stream'
|
||||
|
||||
har.bodySize = 0
|
||||
har.headersSize = 0
|
||||
har.postData.size = 0
|
||||
|
||||
if (!validate.request(har)) {
|
||||
return options
|
||||
}
|
||||
|
||||
// clean up and get some utility properties
|
||||
var req = this.prep(har)
|
||||
|
||||
// construct new options
|
||||
if (req.url) {
|
||||
options.url = req.url
|
||||
}
|
||||
|
||||
if (req.method) {
|
||||
options.method = req.method
|
||||
}
|
||||
|
||||
if (Object.keys(req.queryObj).length) {
|
||||
options.qs = req.queryObj
|
||||
}
|
||||
|
||||
if (Object.keys(req.headersObj).length) {
|
||||
options.headers = req.headersObj
|
||||
}
|
||||
|
||||
switch (req.postData.mimeType) {
|
||||
case 'application/x-www-form-urlencoded':
|
||||
options.form = req.postData.paramsObj
|
||||
break
|
||||
|
||||
case 'application/json':
|
||||
if (req.postData.jsonObj) {
|
||||
options.body = req.postData.jsonObj
|
||||
options.json = true
|
||||
}
|
||||
break
|
||||
|
||||
case 'multipart/form-data':
|
||||
options.formData = {}
|
||||
|
||||
req.postData.params.forEach(function (param) {
|
||||
var attachment = {}
|
||||
|
||||
if (!param.fileName && !param.fileName && !param.contentType) {
|
||||
options.formData[param.name] = param.value
|
||||
return
|
||||
}
|
||||
|
||||
// attempt to read from disk!
|
||||
if (param.fileName && !param.value) {
|
||||
attachment.value = fs.createReadStream(param.fileName)
|
||||
} else if (param.value) {
|
||||
attachment.value = param.value
|
||||
}
|
||||
|
||||
if (param.fileName) {
|
||||
attachment.options = {
|
||||
filename: param.fileName,
|
||||
contentType: param.contentType ? param.contentType : null
|
||||
}
|
||||
}
|
||||
|
||||
options.formData[param.name] = attachment
|
||||
})
|
||||
break
|
||||
|
||||
default:
|
||||
if (req.postData.text) {
|
||||
options.body = req.postData.text
|
||||
}
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
exports.Har = Har
|
||||
64
node_modules/twit/node_modules/request/lib/helpers.js
generated
vendored
Normal file
64
node_modules/twit/node_modules/request/lib/helpers.js
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
'use strict'
|
||||
|
||||
var jsonSafeStringify = require('json-stringify-safe')
|
||||
, crypto = require('crypto')
|
||||
|
||||
function deferMethod() {
|
||||
if (typeof setImmediate === 'undefined') {
|
||||
return process.nextTick
|
||||
}
|
||||
|
||||
return setImmediate
|
||||
}
|
||||
|
||||
function isFunction(value) {
|
||||
return typeof value === 'function'
|
||||
}
|
||||
|
||||
function paramsHaveRequestBody(params) {
|
||||
return (
|
||||
params.body ||
|
||||
params.requestBodyStream ||
|
||||
(params.json && typeof params.json !== 'boolean') ||
|
||||
params.multipart
|
||||
)
|
||||
}
|
||||
|
||||
function safeStringify (obj) {
|
||||
var ret
|
||||
try {
|
||||
ret = JSON.stringify(obj)
|
||||
} catch (e) {
|
||||
ret = jsonSafeStringify(obj)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
function md5 (str) {
|
||||
return crypto.createHash('md5').update(str).digest('hex')
|
||||
}
|
||||
|
||||
function isReadStream (rs) {
|
||||
return rs.readable && rs.path && rs.mode
|
||||
}
|
||||
|
||||
function toBase64 (str) {
|
||||
return (new Buffer(str || '', 'utf8')).toString('base64')
|
||||
}
|
||||
|
||||
function copy (obj) {
|
||||
var o = {}
|
||||
Object.keys(obj).forEach(function (i) {
|
||||
o[i] = obj[i]
|
||||
})
|
||||
return o
|
||||
}
|
||||
|
||||
exports.isFunction = isFunction
|
||||
exports.paramsHaveRequestBody = paramsHaveRequestBody
|
||||
exports.safeStringify = safeStringify
|
||||
exports.md5 = md5
|
||||
exports.isReadStream = isReadStream
|
||||
exports.toBase64 = toBase64
|
||||
exports.copy = copy
|
||||
exports.defer = deferMethod()
|
||||
109
node_modules/twit/node_modules/request/lib/multipart.js
generated
vendored
Normal file
109
node_modules/twit/node_modules/request/lib/multipart.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
'use strict'
|
||||
|
||||
var uuid = require('node-uuid')
|
||||
, CombinedStream = require('combined-stream')
|
||||
, isstream = require('isstream')
|
||||
|
||||
|
||||
function Multipart (request) {
|
||||
this.request = request
|
||||
this.boundary = uuid()
|
||||
this.chunked = false
|
||||
this.body = null
|
||||
}
|
||||
|
||||
Multipart.prototype.isChunked = function (options) {
|
||||
var self = this
|
||||
, chunked = false
|
||||
, parts = options.data || options
|
||||
|
||||
if (!parts.forEach) {
|
||||
self.request.emit('error', new Error('Argument error, options.multipart.'))
|
||||
}
|
||||
|
||||
if (options.chunked !== undefined) {
|
||||
chunked = options.chunked
|
||||
}
|
||||
|
||||
if (self.request.getHeader('transfer-encoding') === 'chunked') {
|
||||
chunked = true
|
||||
}
|
||||
|
||||
if (!chunked) {
|
||||
parts.forEach(function (part) {
|
||||
if (typeof part.body === 'undefined') {
|
||||
self.request.emit('error', new Error('Body attribute missing in multipart.'))
|
||||
}
|
||||
if (isstream(part.body)) {
|
||||
chunked = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return chunked
|
||||
}
|
||||
|
||||
Multipart.prototype.setHeaders = function (chunked) {
|
||||
var self = this
|
||||
|
||||
if (chunked && !self.request.hasHeader('transfer-encoding')) {
|
||||
self.request.setHeader('transfer-encoding', 'chunked')
|
||||
}
|
||||
|
||||
var header = self.request.getHeader('content-type')
|
||||
|
||||
if (!header || header.indexOf('multipart') === -1) {
|
||||
self.request.setHeader('content-type', 'multipart/related; boundary=' + self.boundary)
|
||||
} else {
|
||||
if (header.indexOf('boundary') !== -1) {
|
||||
self.boundary = header.replace(/.*boundary=([^\s;]+).*/, '$1')
|
||||
} else {
|
||||
self.request.setHeader('content-type', header + '; boundary=' + self.boundary)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Multipart.prototype.build = function (parts, chunked) {
|
||||
var self = this
|
||||
var body = chunked ? new CombinedStream() : []
|
||||
|
||||
function add (part) {
|
||||
return chunked ? body.append(part) : body.push(new Buffer(part))
|
||||
}
|
||||
|
||||
if (self.request.preambleCRLF) {
|
||||
add('\r\n')
|
||||
}
|
||||
|
||||
parts.forEach(function (part) {
|
||||
var preamble = '--' + self.boundary + '\r\n'
|
||||
Object.keys(part).forEach(function (key) {
|
||||
if (key === 'body') { return }
|
||||
preamble += key + ': ' + part[key] + '\r\n'
|
||||
})
|
||||
preamble += '\r\n'
|
||||
add(preamble)
|
||||
add(part.body)
|
||||
add('\r\n')
|
||||
})
|
||||
add('--' + self.boundary + '--')
|
||||
|
||||
if (self.request.postambleCRLF) {
|
||||
add('\r\n')
|
||||
}
|
||||
|
||||
return body
|
||||
}
|
||||
|
||||
Multipart.prototype.onRequest = function (options) {
|
||||
var self = this
|
||||
|
||||
var chunked = self.isChunked(options)
|
||||
, parts = options.data || options
|
||||
|
||||
self.setHeaders(chunked)
|
||||
self.chunked = chunked
|
||||
self.body = self.build(parts, chunked)
|
||||
}
|
||||
|
||||
exports.Multipart = Multipart
|
||||
147
node_modules/twit/node_modules/request/lib/oauth.js
generated
vendored
Normal file
147
node_modules/twit/node_modules/request/lib/oauth.js
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
'use strict'
|
||||
|
||||
var url = require('url')
|
||||
, qs = require('qs')
|
||||
, caseless = require('caseless')
|
||||
, uuid = require('node-uuid')
|
||||
, oauth = require('oauth-sign')
|
||||
, crypto = require('crypto')
|
||||
|
||||
|
||||
function OAuth (request) {
|
||||
this.request = request
|
||||
this.params = null
|
||||
}
|
||||
|
||||
OAuth.prototype.buildParams = function (_oauth, uri, method, query, form, qsLib) {
|
||||
var oa = {}
|
||||
for (var i in _oauth) {
|
||||
oa['oauth_' + i] = _oauth[i]
|
||||
}
|
||||
if (!oa.oauth_version) {
|
||||
oa.oauth_version = '1.0'
|
||||
}
|
||||
if (!oa.oauth_timestamp) {
|
||||
oa.oauth_timestamp = Math.floor( Date.now() / 1000 ).toString()
|
||||
}
|
||||
if (!oa.oauth_nonce) {
|
||||
oa.oauth_nonce = uuid().replace(/-/g, '')
|
||||
}
|
||||
if (!oa.oauth_signature_method) {
|
||||
oa.oauth_signature_method = 'HMAC-SHA1'
|
||||
}
|
||||
|
||||
var consumer_secret_or_private_key = oa.oauth_consumer_secret || oa.oauth_private_key
|
||||
delete oa.oauth_consumer_secret
|
||||
delete oa.oauth_private_key
|
||||
|
||||
var token_secret = oa.oauth_token_secret
|
||||
delete oa.oauth_token_secret
|
||||
|
||||
var realm = oa.oauth_realm
|
||||
delete oa.oauth_realm
|
||||
delete oa.oauth_transport_method
|
||||
|
||||
var baseurl = uri.protocol + '//' + uri.host + uri.pathname
|
||||
var params = qsLib.parse([].concat(query, form, qsLib.stringify(oa)).join('&'))
|
||||
|
||||
oa.oauth_signature = oauth.sign(
|
||||
oa.oauth_signature_method,
|
||||
method,
|
||||
baseurl,
|
||||
params,
|
||||
consumer_secret_or_private_key,
|
||||
token_secret)
|
||||
|
||||
if (realm) {
|
||||
oa.realm = realm
|
||||
}
|
||||
|
||||
return oa
|
||||
}
|
||||
|
||||
OAuth.prototype.buildBodyHash = function(_oauth, body) {
|
||||
if (['HMAC-SHA1', 'RSA-SHA1'].indexOf(_oauth.signature_method || 'HMAC-SHA1') < 0) {
|
||||
this.request.emit('error', new Error('oauth: ' + _oauth.signature_method +
|
||||
' signature_method not supported with body_hash signing.'))
|
||||
}
|
||||
|
||||
var shasum = crypto.createHash('sha1')
|
||||
shasum.update(body || '')
|
||||
var sha1 = shasum.digest('hex')
|
||||
|
||||
return new Buffer(sha1).toString('base64')
|
||||
}
|
||||
|
||||
OAuth.prototype.concatParams = function (oa, sep, wrap) {
|
||||
wrap = wrap || ''
|
||||
|
||||
var params = Object.keys(oa).filter(function (i) {
|
||||
return i !== 'realm' && i !== 'oauth_signature'
|
||||
}).sort()
|
||||
|
||||
if (oa.realm) {
|
||||
params.splice(0, 1, 'realm')
|
||||
}
|
||||
params.push('oauth_signature')
|
||||
|
||||
return params.map(function (i) {
|
||||
return i + '=' + wrap + oauth.rfc3986(oa[i]) + wrap
|
||||
}).join(sep)
|
||||
}
|
||||
|
||||
OAuth.prototype.onRequest = function (_oauth) {
|
||||
var self = this
|
||||
self.params = _oauth
|
||||
|
||||
var uri = self.request.uri || {}
|
||||
, method = self.request.method || ''
|
||||
, headers = caseless(self.request.headers)
|
||||
, body = self.request.body || ''
|
||||
, qsLib = self.request.qsLib || qs
|
||||
|
||||
var form
|
||||
, query
|
||||
, contentType = headers.get('content-type') || ''
|
||||
, formContentType = 'application/x-www-form-urlencoded'
|
||||
, transport = _oauth.transport_method || 'header'
|
||||
|
||||
if (contentType.slice(0, formContentType.length) === formContentType) {
|
||||
contentType = formContentType
|
||||
form = body
|
||||
}
|
||||
if (uri.query) {
|
||||
query = uri.query
|
||||
}
|
||||
if (transport === 'body' && (method !== 'POST' || contentType !== formContentType)) {
|
||||
self.request.emit('error', new Error('oauth: transport_method of body requires POST ' +
|
||||
'and content-type ' + formContentType))
|
||||
}
|
||||
|
||||
if (!form && typeof _oauth.body_hash === 'boolean') {
|
||||
_oauth.body_hash = self.buildBodyHash(_oauth, self.request.body.toString())
|
||||
}
|
||||
|
||||
var oa = self.buildParams(_oauth, uri, method, query, form, qsLib)
|
||||
|
||||
switch (transport) {
|
||||
case 'header':
|
||||
self.request.setHeader('Authorization', 'OAuth ' + self.concatParams(oa, ',', '"'))
|
||||
break
|
||||
|
||||
case 'query':
|
||||
var href = self.request.uri.href += (query ? '&' : '?') + self.concatParams(oa, '&')
|
||||
self.request.uri = url.parse(href)
|
||||
self.request.path = self.request.uri.path
|
||||
break
|
||||
|
||||
case 'body':
|
||||
self.request.body = (form ? form + '&' : '') + self.concatParams(oa, '&')
|
||||
break
|
||||
|
||||
default:
|
||||
self.request.emit('error', new Error('oauth: transport_method invalid'))
|
||||
}
|
||||
}
|
||||
|
||||
exports.OAuth = OAuth
|
||||
51
node_modules/twit/node_modules/request/lib/querystring.js
generated
vendored
Normal file
51
node_modules/twit/node_modules/request/lib/querystring.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
'use strict'
|
||||
|
||||
var qs = require('qs')
|
||||
, querystring = require('querystring')
|
||||
|
||||
|
||||
function Querystring (request) {
|
||||
this.request = request
|
||||
this.lib = null
|
||||
this.useQuerystring = null
|
||||
this.parseOptions = null
|
||||
this.stringifyOptions = null
|
||||
}
|
||||
|
||||
Querystring.prototype.init = function (options) {
|
||||
if (this.lib) {return}
|
||||
|
||||
this.useQuerystring = options.useQuerystring
|
||||
this.lib = (this.useQuerystring ? querystring : qs)
|
||||
|
||||
this.parseOptions = options.qsParseOptions || {}
|
||||
this.stringifyOptions = options.qsStringifyOptions || {}
|
||||
}
|
||||
|
||||
Querystring.prototype.stringify = function (obj) {
|
||||
return (this.useQuerystring)
|
||||
? this.rfc3986(this.lib.stringify(obj,
|
||||
this.stringifyOptions.sep || null,
|
||||
this.stringifyOptions.eq || null,
|
||||
this.stringifyOptions))
|
||||
: this.lib.stringify(obj, this.stringifyOptions)
|
||||
}
|
||||
|
||||
Querystring.prototype.parse = function (str) {
|
||||
return (this.useQuerystring)
|
||||
? this.lib.parse(str,
|
||||
this.parseOptions.sep || null,
|
||||
this.parseOptions.eq || null,
|
||||
this.parseOptions)
|
||||
: this.lib.parse(str, this.parseOptions)
|
||||
}
|
||||
|
||||
Querystring.prototype.rfc3986 = function (str) {
|
||||
return str.replace(/[!'()*]/g, function (c) {
|
||||
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
|
||||
})
|
||||
}
|
||||
|
||||
Querystring.prototype.unescape = querystring.unescape
|
||||
|
||||
exports.Querystring = Querystring
|
||||
153
node_modules/twit/node_modules/request/lib/redirect.js
generated
vendored
Normal file
153
node_modules/twit/node_modules/request/lib/redirect.js
generated
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
'use strict'
|
||||
|
||||
var url = require('url')
|
||||
var isUrl = /^https?:/
|
||||
|
||||
function Redirect (request) {
|
||||
this.request = request
|
||||
this.followRedirect = true
|
||||
this.followRedirects = true
|
||||
this.followAllRedirects = false
|
||||
this.allowRedirect = function () {return true}
|
||||
this.maxRedirects = 10
|
||||
this.redirects = []
|
||||
this.redirectsFollowed = 0
|
||||
this.removeRefererHeader = false
|
||||
}
|
||||
|
||||
Redirect.prototype.onRequest = function (options) {
|
||||
var self = this
|
||||
|
||||
if (options.maxRedirects !== undefined) {
|
||||
self.maxRedirects = options.maxRedirects
|
||||
}
|
||||
if (typeof options.followRedirect === 'function') {
|
||||
self.allowRedirect = options.followRedirect
|
||||
}
|
||||
if (options.followRedirect !== undefined) {
|
||||
self.followRedirects = !!options.followRedirect
|
||||
}
|
||||
if (options.followAllRedirects !== undefined) {
|
||||
self.followAllRedirects = options.followAllRedirects
|
||||
}
|
||||
if (self.followRedirects || self.followAllRedirects) {
|
||||
self.redirects = self.redirects || []
|
||||
}
|
||||
if (options.removeRefererHeader !== undefined) {
|
||||
self.removeRefererHeader = options.removeRefererHeader
|
||||
}
|
||||
}
|
||||
|
||||
Redirect.prototype.redirectTo = function (response) {
|
||||
var self = this
|
||||
, request = self.request
|
||||
|
||||
var redirectTo = null
|
||||
if (response.statusCode >= 300 && response.statusCode < 400 && response.caseless.has('location')) {
|
||||
var location = response.caseless.get('location')
|
||||
request.debug('redirect', location)
|
||||
|
||||
if (self.followAllRedirects) {
|
||||
redirectTo = location
|
||||
} else if (self.followRedirects) {
|
||||
switch (request.method) {
|
||||
case 'PATCH':
|
||||
case 'PUT':
|
||||
case 'POST':
|
||||
case 'DELETE':
|
||||
// Do not follow redirects
|
||||
break
|
||||
default:
|
||||
redirectTo = location
|
||||
break
|
||||
}
|
||||
}
|
||||
} else if (response.statusCode === 401) {
|
||||
var authHeader = request._auth.onResponse(response)
|
||||
if (authHeader) {
|
||||
request.setHeader('authorization', authHeader)
|
||||
redirectTo = request.uri
|
||||
}
|
||||
}
|
||||
return redirectTo
|
||||
}
|
||||
|
||||
Redirect.prototype.onResponse = function (response) {
|
||||
var self = this
|
||||
, request = self.request
|
||||
|
||||
var redirectTo = self.redirectTo(response)
|
||||
if (!redirectTo || !self.allowRedirect.call(request, response)) {
|
||||
return false
|
||||
}
|
||||
|
||||
request.debug('redirect to', redirectTo)
|
||||
|
||||
// ignore any potential response body. it cannot possibly be useful
|
||||
// to us at this point.
|
||||
// response.resume should be defined, but check anyway before calling. Workaround for browserify.
|
||||
if (response.resume) {
|
||||
response.resume()
|
||||
}
|
||||
|
||||
if (self.redirectsFollowed >= self.maxRedirects) {
|
||||
request.emit('error', new Error('Exceeded maxRedirects. Probably stuck in a redirect loop ' + request.uri.href))
|
||||
return false
|
||||
}
|
||||
self.redirectsFollowed += 1
|
||||
|
||||
if (!isUrl.test(redirectTo)) {
|
||||
redirectTo = url.resolve(request.uri.href, redirectTo)
|
||||
}
|
||||
|
||||
var uriPrev = request.uri
|
||||
request.uri = url.parse(redirectTo)
|
||||
|
||||
// handle the case where we change protocol from https to http or vice versa
|
||||
if (request.uri.protocol !== uriPrev.protocol) {
|
||||
request._updateProtocol()
|
||||
}
|
||||
|
||||
self.redirects.push(
|
||||
{ statusCode : response.statusCode
|
||||
, redirectUri: redirectTo
|
||||
}
|
||||
)
|
||||
if (self.followAllRedirects && response.statusCode !== 401 && response.statusCode !== 307) {
|
||||
request.method = 'GET'
|
||||
}
|
||||
// request.method = 'GET' // Force all redirects to use GET || commented out fixes #215
|
||||
delete request.src
|
||||
delete request.req
|
||||
delete request.agent
|
||||
delete request._started
|
||||
if (response.statusCode !== 401 && response.statusCode !== 307) {
|
||||
// Remove parameters from the previous response, unless this is the second request
|
||||
// for a server that requires digest authentication.
|
||||
delete request.body
|
||||
delete request._form
|
||||
if (request.headers) {
|
||||
request.removeHeader('host')
|
||||
request.removeHeader('content-type')
|
||||
request.removeHeader('content-length')
|
||||
if (request.uri.hostname !== request.originalHost.split(':')[0]) {
|
||||
// Remove authorization if changing hostnames (but not if just
|
||||
// changing ports or protocols). This matches the behavior of curl:
|
||||
// https://github.com/bagder/curl/blob/6beb0eee/lib/http.c#L710
|
||||
request.removeHeader('authorization')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!self.removeRefererHeader) {
|
||||
request.setHeader('referer', request.uri.href)
|
||||
}
|
||||
|
||||
request.emit('redirect')
|
||||
|
||||
request.init()
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
exports.Redirect = Redirect
|
||||
183
node_modules/twit/node_modules/request/lib/tunnel.js
generated
vendored
Normal file
183
node_modules/twit/node_modules/request/lib/tunnel.js
generated
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
'use strict'
|
||||
|
||||
var url = require('url')
|
||||
, tunnel = require('tunnel-agent')
|
||||
|
||||
var defaultProxyHeaderWhiteList = [
|
||||
'accept',
|
||||
'accept-charset',
|
||||
'accept-encoding',
|
||||
'accept-language',
|
||||
'accept-ranges',
|
||||
'cache-control',
|
||||
'content-encoding',
|
||||
'content-language',
|
||||
'content-length',
|
||||
'content-location',
|
||||
'content-md5',
|
||||
'content-range',
|
||||
'content-type',
|
||||
'connection',
|
||||
'date',
|
||||
'expect',
|
||||
'max-forwards',
|
||||
'pragma',
|
||||
'referer',
|
||||
'te',
|
||||
'transfer-encoding',
|
||||
'user-agent',
|
||||
'via'
|
||||
]
|
||||
|
||||
var defaultProxyHeaderExclusiveList = [
|
||||
'proxy-authorization'
|
||||
]
|
||||
|
||||
function constructProxyHost(uriObject) {
|
||||
var port = uriObject.portA
|
||||
, protocol = uriObject.protocol
|
||||
, proxyHost = uriObject.hostname + ':'
|
||||
|
||||
if (port) {
|
||||
proxyHost += port
|
||||
} else if (protocol === 'https:') {
|
||||
proxyHost += '443'
|
||||
} else {
|
||||
proxyHost += '80'
|
||||
}
|
||||
|
||||
return proxyHost
|
||||
}
|
||||
|
||||
function constructProxyHeaderWhiteList(headers, proxyHeaderWhiteList) {
|
||||
var whiteList = proxyHeaderWhiteList
|
||||
.reduce(function (set, header) {
|
||||
set[header.toLowerCase()] = true
|
||||
return set
|
||||
}, {})
|
||||
|
||||
return Object.keys(headers)
|
||||
.filter(function (header) {
|
||||
return whiteList[header.toLowerCase()]
|
||||
})
|
||||
.reduce(function (set, header) {
|
||||
set[header] = headers[header]
|
||||
return set
|
||||
}, {})
|
||||
}
|
||||
|
||||
function constructTunnelOptions (request, proxyHeaders) {
|
||||
var proxy = request.proxy
|
||||
|
||||
var tunnelOptions = {
|
||||
proxy : {
|
||||
host : proxy.hostname,
|
||||
port : +proxy.port,
|
||||
proxyAuth : proxy.auth,
|
||||
headers : proxyHeaders
|
||||
},
|
||||
headers : request.headers,
|
||||
ca : request.ca,
|
||||
cert : request.cert,
|
||||
key : request.key,
|
||||
passphrase : request.passphrase,
|
||||
pfx : request.pfx,
|
||||
ciphers : request.ciphers,
|
||||
rejectUnauthorized : request.rejectUnauthorized,
|
||||
secureOptions : request.secureOptions,
|
||||
secureProtocol : request.secureProtocol
|
||||
}
|
||||
|
||||
return tunnelOptions
|
||||
}
|
||||
|
||||
function constructTunnelFnName(uri, proxy) {
|
||||
var uriProtocol = (uri.protocol === 'https:' ? 'https' : 'http')
|
||||
var proxyProtocol = (proxy.protocol === 'https:' ? 'Https' : 'Http')
|
||||
return [uriProtocol, proxyProtocol].join('Over')
|
||||
}
|
||||
|
||||
function getTunnelFn(request) {
|
||||
var uri = request.uri
|
||||
var proxy = request.proxy
|
||||
var tunnelFnName = constructTunnelFnName(uri, proxy)
|
||||
return tunnel[tunnelFnName]
|
||||
}
|
||||
|
||||
|
||||
function Tunnel (request) {
|
||||
this.request = request
|
||||
this.proxyHeaderWhiteList = defaultProxyHeaderWhiteList
|
||||
this.proxyHeaderExclusiveList = []
|
||||
}
|
||||
|
||||
Tunnel.prototype.isEnabled = function (options) {
|
||||
var request = this.request
|
||||
// Tunnel HTTPS by default, or if a previous request in the redirect chain
|
||||
// was tunneled. Allow the user to override this setting.
|
||||
|
||||
// If self.tunnel is already set (because this is a redirect), use the
|
||||
// existing value.
|
||||
if (typeof request.tunnel !== 'undefined') {
|
||||
return request.tunnel
|
||||
}
|
||||
|
||||
// If options.tunnel is set (the user specified a value), use it.
|
||||
if (typeof options.tunnel !== 'undefined') {
|
||||
return options.tunnel
|
||||
}
|
||||
|
||||
// If the destination is HTTPS, tunnel.
|
||||
if (request.uri.protocol === 'https:') {
|
||||
return true
|
||||
}
|
||||
|
||||
// Otherwise, leave tunnel unset, because if a later request in the redirect
|
||||
// chain is HTTPS then that request (and any subsequent ones) should be
|
||||
// tunneled.
|
||||
return undefined
|
||||
}
|
||||
|
||||
Tunnel.prototype.setup = function (options) {
|
||||
var self = this
|
||||
, request = self.request
|
||||
|
||||
options = options || {}
|
||||
|
||||
if (typeof request.proxy === 'string') {
|
||||
request.proxy = url.parse(request.proxy)
|
||||
}
|
||||
|
||||
if (!request.proxy || !request.tunnel) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Setup Proxy Header Exclusive List and White List
|
||||
if (options.proxyHeaderWhiteList) {
|
||||
self.proxyHeaderWhiteList = options.proxyHeaderWhiteList
|
||||
}
|
||||
if (options.proxyHeaderExclusiveList) {
|
||||
self.proxyHeaderExclusiveList = options.proxyHeaderExclusiveList
|
||||
}
|
||||
|
||||
var proxyHeaderExclusiveList = self.proxyHeaderExclusiveList.concat(defaultProxyHeaderExclusiveList)
|
||||
var proxyHeaderWhiteList = self.proxyHeaderWhiteList.concat(proxyHeaderExclusiveList)
|
||||
|
||||
// Setup Proxy Headers and Proxy Headers Host
|
||||
// Only send the Proxy White Listed Header names
|
||||
var proxyHeaders = constructProxyHeaderWhiteList(request.headers, proxyHeaderWhiteList)
|
||||
proxyHeaders.host = constructProxyHost(request.uri)
|
||||
|
||||
proxyHeaderExclusiveList.forEach(request.removeHeader, request)
|
||||
|
||||
// Set Agent from Tunnel Data
|
||||
var tunnelFn = getTunnelFn(request)
|
||||
var tunnelOptions = constructTunnelOptions(request, proxyHeaders)
|
||||
request.agent = tunnelFn(tunnelOptions)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Tunnel.defaultProxyHeaderWhiteList = defaultProxyHeaderWhiteList
|
||||
Tunnel.defaultProxyHeaderExclusiveList = defaultProxyHeaderExclusiveList
|
||||
exports.Tunnel = Tunnel
|
||||
1
node_modules/twit/node_modules/request/node_modules/.bin/har-validator
generated
vendored
Symbolic link
1
node_modules/twit/node_modules/request/node_modules/.bin/har-validator
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../har-validator/bin/har-validator
|
||||
1
node_modules/twit/node_modules/request/node_modules/.bin/uuid
generated
vendored
Symbolic link
1
node_modules/twit/node_modules/request/node_modules/.bin/uuid
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../node-uuid/bin/uuid
|
||||
55
node_modules/twit/node_modules/request/node_modules/aws-sign2/LICENSE
generated
vendored
Normal file
55
node_modules/twit/node_modules/request/node_modules/aws-sign2/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
Apache License
|
||||
|
||||
Version 2.0, January 2004
|
||||
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
4
node_modules/twit/node_modules/request/node_modules/aws-sign2/README.md
generated
vendored
Normal file
4
node_modules/twit/node_modules/request/node_modules/aws-sign2/README.md
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
aws-sign
|
||||
========
|
||||
|
||||
AWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module.
|
||||
202
node_modules/twit/node_modules/request/node_modules/aws-sign2/index.js
generated
vendored
Normal file
202
node_modules/twit/node_modules/request/node_modules/aws-sign2/index.js
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
/*!
|
||||
* knox - auth
|
||||
* Copyright(c) 2010 LearnBoost <dev@learnboost.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var crypto = require('crypto')
|
||||
, parse = require('url').parse
|
||||
;
|
||||
|
||||
/**
|
||||
* Valid keys.
|
||||
*/
|
||||
|
||||
var keys =
|
||||
[ 'acl'
|
||||
, 'location'
|
||||
, 'logging'
|
||||
, 'notification'
|
||||
, 'partNumber'
|
||||
, 'policy'
|
||||
, 'requestPayment'
|
||||
, 'torrent'
|
||||
, 'uploadId'
|
||||
, 'uploads'
|
||||
, 'versionId'
|
||||
, 'versioning'
|
||||
, 'versions'
|
||||
, 'website'
|
||||
]
|
||||
|
||||
/**
|
||||
* Return an "Authorization" header value with the given `options`
|
||||
* in the form of "AWS <key>:<signature>"
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function authorization (options) {
|
||||
return 'AWS ' + options.key + ':' + sign(options)
|
||||
}
|
||||
|
||||
module.exports = authorization
|
||||
module.exports.authorization = authorization
|
||||
|
||||
/**
|
||||
* Simple HMAC-SHA1 Wrapper
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function hmacSha1 (options) {
|
||||
return crypto.createHmac('sha1', options.secret).update(options.message).digest('base64')
|
||||
}
|
||||
|
||||
module.exports.hmacSha1 = hmacSha1
|
||||
|
||||
/**
|
||||
* Create a base64 sha1 HMAC for `options`.
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function sign (options) {
|
||||
options.message = stringToSign(options)
|
||||
return hmacSha1(options)
|
||||
}
|
||||
module.exports.sign = sign
|
||||
|
||||
/**
|
||||
* Create a base64 sha1 HMAC for `options`.
|
||||
*
|
||||
* Specifically to be used with S3 presigned URLs
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function signQuery (options) {
|
||||
options.message = queryStringToSign(options)
|
||||
return hmacSha1(options)
|
||||
}
|
||||
module.exports.signQuery= signQuery
|
||||
|
||||
/**
|
||||
* Return a string for sign() with the given `options`.
|
||||
*
|
||||
* Spec:
|
||||
*
|
||||
* <verb>\n
|
||||
* <md5>\n
|
||||
* <content-type>\n
|
||||
* <date>\n
|
||||
* [headers\n]
|
||||
* <resource>
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function stringToSign (options) {
|
||||
var headers = options.amazonHeaders || ''
|
||||
if (headers) headers += '\n'
|
||||
var r =
|
||||
[ options.verb
|
||||
, options.md5
|
||||
, options.contentType
|
||||
, options.date ? options.date.toUTCString() : ''
|
||||
, headers + options.resource
|
||||
]
|
||||
return r.join('\n')
|
||||
}
|
||||
module.exports.queryStringToSign = stringToSign
|
||||
|
||||
/**
|
||||
* Return a string for sign() with the given `options`, but is meant exclusively
|
||||
* for S3 presigned URLs
|
||||
*
|
||||
* Spec:
|
||||
*
|
||||
* <date>\n
|
||||
* <resource>
|
||||
*
|
||||
* @param {Object} options
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function queryStringToSign (options){
|
||||
return 'GET\n\n\n' + options.date + '\n' + options.resource
|
||||
}
|
||||
module.exports.queryStringToSign = queryStringToSign
|
||||
|
||||
/**
|
||||
* Perform the following:
|
||||
*
|
||||
* - ignore non-amazon headers
|
||||
* - lowercase fields
|
||||
* - sort lexicographically
|
||||
* - trim whitespace between ":"
|
||||
* - join with newline
|
||||
*
|
||||
* @param {Object} headers
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function canonicalizeHeaders (headers) {
|
||||
var buf = []
|
||||
, fields = Object.keys(headers)
|
||||
;
|
||||
for (var i = 0, len = fields.length; i < len; ++i) {
|
||||
var field = fields[i]
|
||||
, val = headers[field]
|
||||
, field = field.toLowerCase()
|
||||
;
|
||||
if (0 !== field.indexOf('x-amz')) continue
|
||||
buf.push(field + ':' + val)
|
||||
}
|
||||
return buf.sort().join('\n')
|
||||
}
|
||||
module.exports.canonicalizeHeaders = canonicalizeHeaders
|
||||
|
||||
/**
|
||||
* Perform the following:
|
||||
*
|
||||
* - ignore non sub-resources
|
||||
* - sort lexicographically
|
||||
*
|
||||
* @param {String} resource
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function canonicalizeResource (resource) {
|
||||
var url = parse(resource, true)
|
||||
, path = url.pathname
|
||||
, buf = []
|
||||
;
|
||||
|
||||
Object.keys(url.query).forEach(function(key){
|
||||
if (!~keys.indexOf(key)) return
|
||||
var val = '' == url.query[key] ? '' : '=' + encodeURIComponent(url.query[key])
|
||||
buf.push(key + val)
|
||||
})
|
||||
|
||||
return path + (buf.length ? '?' + buf.sort().join('&') : '')
|
||||
}
|
||||
module.exports.canonicalizeResource = canonicalizeResource
|
||||
45
node_modules/twit/node_modules/request/node_modules/aws-sign2/package.json
generated
vendored
Normal file
45
node_modules/twit/node_modules/request/node_modules/aws-sign2/package.json
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"author": {
|
||||
"name": "Mikeal Rogers",
|
||||
"email": "mikeal.rogers@gmail.com",
|
||||
"url": "http://www.futurealoof.com"
|
||||
},
|
||||
"name": "aws-sign2",
|
||||
"description": "AWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module.",
|
||||
"version": "0.5.0",
|
||||
"repository": {
|
||||
"url": "git+https://github.com/mikeal/aws-sign.git"
|
||||
},
|
||||
"main": "index.js",
|
||||
"dependencies": {},
|
||||
"devDependencies": {},
|
||||
"optionalDependencies": {},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/mikeal/aws-sign/issues"
|
||||
},
|
||||
"_id": "aws-sign2@0.5.0",
|
||||
"dist": {
|
||||
"shasum": "c57103f7a17fc037f02d7c2e64b602ea223f7d63",
|
||||
"tarball": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz"
|
||||
},
|
||||
"_from": "aws-sign2@>=0.5.0 <0.6.0",
|
||||
"_npmVersion": "1.3.2",
|
||||
"_npmUser": {
|
||||
"name": "mikeal",
|
||||
"email": "mikeal.rogers@gmail.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "mikeal",
|
||||
"email": "mikeal.rogers@gmail.com"
|
||||
}
|
||||
],
|
||||
"directories": {},
|
||||
"_shasum": "c57103f7a17fc037f02d7c2e64b602ea223f7d63",
|
||||
"_resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.5.0.tgz",
|
||||
"readme": "ERROR: No README data found!",
|
||||
"homepage": "https://github.com/mikeal/aws-sign#readme"
|
||||
}
|
||||
59
node_modules/twit/node_modules/request/node_modules/bl/.jshintrc
generated
vendored
Normal file
59
node_modules/twit/node_modules/request/node_modules/bl/.jshintrc
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"predef": [ ]
|
||||
, "bitwise": false
|
||||
, "camelcase": false
|
||||
, "curly": false
|
||||
, "eqeqeq": false
|
||||
, "forin": false
|
||||
, "immed": false
|
||||
, "latedef": false
|
||||
, "noarg": true
|
||||
, "noempty": true
|
||||
, "nonew": true
|
||||
, "plusplus": false
|
||||
, "quotmark": true
|
||||
, "regexp": false
|
||||
, "undef": true
|
||||
, "unused": true
|
||||
, "strict": false
|
||||
, "trailing": true
|
||||
, "maxlen": 120
|
||||
, "asi": true
|
||||
, "boss": true
|
||||
, "debug": true
|
||||
, "eqnull": true
|
||||
, "esnext": true
|
||||
, "evil": true
|
||||
, "expr": true
|
||||
, "funcscope": false
|
||||
, "globalstrict": false
|
||||
, "iterator": false
|
||||
, "lastsemic": true
|
||||
, "laxbreak": true
|
||||
, "laxcomma": true
|
||||
, "loopfunc": true
|
||||
, "multistr": false
|
||||
, "onecase": false
|
||||
, "proto": false
|
||||
, "regexdash": false
|
||||
, "scripturl": true
|
||||
, "smarttabs": false
|
||||
, "shadow": false
|
||||
, "sub": true
|
||||
, "supernew": false
|
||||
, "validthis": true
|
||||
, "browser": true
|
||||
, "couch": false
|
||||
, "devel": false
|
||||
, "dojo": false
|
||||
, "mootools": false
|
||||
, "node": true
|
||||
, "nonstandard": true
|
||||
, "prototypejs": false
|
||||
, "rhino": false
|
||||
, "worker": true
|
||||
, "wsh": false
|
||||
, "nomen": false
|
||||
, "onevar": false
|
||||
, "passfail": false
|
||||
}
|
||||
1
node_modules/twit/node_modules/request/node_modules/bl/.npmignore
generated
vendored
Normal file
1
node_modules/twit/node_modules/request/node_modules/bl/.npmignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules/
|
||||
11
node_modules/twit/node_modules/request/node_modules/bl/.travis.yml
generated
vendored
Normal file
11
node_modules/twit/node_modules/request/node_modules/bl/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.8
|
||||
- "0.10"
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
notifications:
|
||||
email:
|
||||
- rod@vagg.org
|
||||
script: npm test
|
||||
13
node_modules/twit/node_modules/request/node_modules/bl/LICENSE.md
generated
vendored
Normal file
13
node_modules/twit/node_modules/request/node_modules/bl/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
The MIT License (MIT)
|
||||
=====================
|
||||
|
||||
Copyright (c) 2014 bl contributors
|
||||
----------------------------------
|
||||
|
||||
*bl contributors listed at <https://github.com/rvagg/bl#contributors>*
|
||||
|
||||
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.
|
||||
198
node_modules/twit/node_modules/request/node_modules/bl/README.md
generated
vendored
Normal file
198
node_modules/twit/node_modules/request/node_modules/bl/README.md
generated
vendored
Normal file
@@ -0,0 +1,198 @@
|
||||
# bl *(BufferList)*
|
||||
|
||||
**A Node.js Buffer list collector, reader and streamer thingy.**
|
||||
|
||||
[](https://nodei.co/npm/bl/)
|
||||
[](https://nodei.co/npm/bl/)
|
||||
|
||||
**bl** is a storage object for collections of Node Buffers, exposing them with the main Buffer readable API. Also works as a duplex stream so you can collect buffers from a stream that emits them and emit buffers to a stream that consumes them!
|
||||
|
||||
The original buffers are kept intact and copies are only done as necessary. Any reads that require the use of a single original buffer will return a slice of that buffer only (which references the same memory as the original buffer). Reads that span buffers perform concatenation as required and return the results transparently.
|
||||
|
||||
```js
|
||||
const BufferList = require('bl')
|
||||
|
||||
var bl = new BufferList()
|
||||
bl.append(new Buffer('abcd'))
|
||||
bl.append(new Buffer('efg'))
|
||||
bl.append('hi') // bl will also accept & convert Strings
|
||||
bl.append(new Buffer('j'))
|
||||
bl.append(new Buffer([ 0x3, 0x4 ]))
|
||||
|
||||
console.log(bl.length) // 12
|
||||
|
||||
console.log(bl.slice(0, 10).toString('ascii')) // 'abcdefghij'
|
||||
console.log(bl.slice(3, 10).toString('ascii')) // 'defghij'
|
||||
console.log(bl.slice(3, 6).toString('ascii')) // 'def'
|
||||
console.log(bl.slice(3, 8).toString('ascii')) // 'defgh'
|
||||
console.log(bl.slice(5, 10).toString('ascii')) // 'fghij'
|
||||
|
||||
// or just use toString!
|
||||
console.log(bl.toString()) // 'abcdefghij\u0003\u0004'
|
||||
console.log(bl.toString('ascii', 3, 8)) // 'defgh'
|
||||
console.log(bl.toString('ascii', 5, 10)) // 'fghij'
|
||||
|
||||
// other standard Buffer readables
|
||||
console.log(bl.readUInt16BE(10)) // 0x0304
|
||||
console.log(bl.readUInt16LE(10)) // 0x0403
|
||||
```
|
||||
|
||||
Give it a callback in the constructor and use it just like **[concat-stream](https://github.com/maxogden/node-concat-stream)**:
|
||||
|
||||
```js
|
||||
const bl = require('bl')
|
||||
, fs = require('fs')
|
||||
|
||||
fs.createReadStream('README.md')
|
||||
.pipe(bl(function (err, data) { // note 'new' isn't strictly required
|
||||
// `data` is a complete Buffer object containing the full data
|
||||
console.log(data.toString())
|
||||
}))
|
||||
```
|
||||
|
||||
Note that when you use the *callback* method like this, the resulting `data` parameter is a concatenation of all `Buffer` objects in the list. If you want to avoid the overhead of this concatenation (in cases of extreme performance consciousness), then avoid the *callback* method and just listen to `'end'` instead, like a standard Stream.
|
||||
|
||||
Or to fetch a URL using [hyperquest](https://github.com/substack/hyperquest) (should work with [request](http://github.com/mikeal/request) and even plain Node http too!):
|
||||
```js
|
||||
const hyperquest = require('hyperquest')
|
||||
, bl = require('bl')
|
||||
, url = 'https://raw.github.com/rvagg/bl/master/README.md'
|
||||
|
||||
hyperquest(url).pipe(bl(function (err, data) {
|
||||
console.log(data.toString())
|
||||
}))
|
||||
```
|
||||
|
||||
Or, use it as a readable stream to recompose a list of Buffers to an output source:
|
||||
|
||||
```js
|
||||
const BufferList = require('bl')
|
||||
, fs = require('fs')
|
||||
|
||||
var bl = new BufferList()
|
||||
bl.append(new Buffer('abcd'))
|
||||
bl.append(new Buffer('efg'))
|
||||
bl.append(new Buffer('hi'))
|
||||
bl.append(new Buffer('j'))
|
||||
|
||||
bl.pipe(fs.createWriteStream('gibberish.txt'))
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
* <a href="#ctor"><code><b>new BufferList([ callback ])</b></code></a>
|
||||
* <a href="#length"><code>bl.<b>length</b></code></a>
|
||||
* <a href="#append"><code>bl.<b>append(buffer)</b></code></a>
|
||||
* <a href="#get"><code>bl.<b>get(index)</b></code></a>
|
||||
* <a href="#slice"><code>bl.<b>slice([ start[, end ] ])</b></code></a>
|
||||
* <a href="#copy"><code>bl.<b>copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])</b></code></a>
|
||||
* <a href="#duplicate"><code>bl.<b>duplicate()</b></code></a>
|
||||
* <a href="#consume"><code>bl.<b>consume(bytes)</b></code></a>
|
||||
* <a href="#toString"><code>bl.<b>toString([encoding, [ start, [ end ]]])</b></code></a>
|
||||
* <a href="#readXX"><code>bl.<b>readDoubleBE()</b></code>, <code>bl.<b>readDoubleLE()</b></code>, <code>bl.<b>readFloatBE()</b></code>, <code>bl.<b>readFloatLE()</b></code>, <code>bl.<b>readInt32BE()</b></code>, <code>bl.<b>readInt32LE()</b></code>, <code>bl.<b>readUInt32BE()</b></code>, <code>bl.<b>readUInt32LE()</b></code>, <code>bl.<b>readInt16BE()</b></code>, <code>bl.<b>readInt16LE()</b></code>, <code>bl.<b>readUInt16BE()</b></code>, <code>bl.<b>readUInt16LE()</b></code>, <code>bl.<b>readInt8()</b></code>, <code>bl.<b>readUInt8()</b></code></a>
|
||||
* <a href="#streams">Streams</a>
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="ctor"></a>
|
||||
### new BufferList([ callback | buffer | buffer array ])
|
||||
The constructor takes an optional callback, if supplied, the callback will be called with an error argument followed by a reference to the **bl** instance, when `bl.end()` is called (i.e. from a piped stream). This is a convenient method of collecting the entire contents of a stream, particularly when the stream is *chunky*, such as a network stream.
|
||||
|
||||
Normally, no arguments are required for the constructor, but you can initialise the list by passing in a single `Buffer` object or an array of `Buffer` object.
|
||||
|
||||
`new` is not strictly required, if you don't instantiate a new object, it will be done automatically for you so you can create a new instance simply with:
|
||||
|
||||
```js
|
||||
var bl = require('bl')
|
||||
var myinstance = bl()
|
||||
|
||||
// equivilant to:
|
||||
|
||||
var BufferList = require('bl')
|
||||
var myinstance = new BufferList()
|
||||
```
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="length"></a>
|
||||
### bl.length
|
||||
Get the length of the list in bytes. This is the sum of the lengths of all of the buffers contained in the list, minus any initial offset for a semi-consumed buffer at the beginning. Should accurately represent the total number of bytes that can be read from the list.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="append"></a>
|
||||
### bl.append(buffer)
|
||||
`append(buffer)` adds an additional buffer or BufferList to the internal list.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="get"></a>
|
||||
### bl.get(index)
|
||||
`get()` will return the byte at the specified index.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="slice"></a>
|
||||
### bl.slice([ start, [ end ] ])
|
||||
`slice()` returns a new `Buffer` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively.
|
||||
|
||||
If the requested range spans a single internal buffer then a slice of that buffer will be returned which shares the original memory range of that Buffer. If the range spans multiple buffers then copy operations will likely occur to give you a uniform Buffer.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="copy"></a>
|
||||
### bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])
|
||||
`copy()` copies the content of the list in the `dest` buffer, starting from `destStart` and containing the bytes within the range specified with `srcStart` to `srcEnd`. `destStart`, `start` and `end` are optional and will default to the beginning of the `dest` buffer, and the beginning and end of the list respectively.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="duplicate"></a>
|
||||
### bl.duplicate()
|
||||
`duplicate()` performs a **shallow-copy** of the list. The internal Buffers remains the same, so if you change the underlying Buffers, the change will be reflected in both the original and the duplicate. This method is needed if you want to call `consume()` or `pipe()` and still keep the original list.Example:
|
||||
|
||||
```js
|
||||
var bl = new BufferList()
|
||||
|
||||
bl.append('hello')
|
||||
bl.append(' world')
|
||||
bl.append('\n')
|
||||
|
||||
bl.duplicate().pipe(process.stdout, { end: false })
|
||||
|
||||
console.log(bl.toString())
|
||||
```
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="consume"></a>
|
||||
### bl.consume(bytes)
|
||||
`consume()` will shift bytes *off the start of the list*. The number of bytes consumed don't need to line up with the sizes of the internal Buffers—initial offsets will be calculated accordingly in order to give you a consistent view of the data.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="toString"></a>
|
||||
### bl.toString([encoding, [ start, [ end ]]])
|
||||
`toString()` will return a string representation of the buffer. The optional `start` and `end` arguments are passed on to `slice()`, while the `encoding` is passed on to `toString()` of the resulting Buffer. See the [Buffer#toString()](http://nodejs.org/docs/latest/api/buffer.html#buffer_buf_tostring_encoding_start_end) documentation for more information.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="readXX"></a>
|
||||
### bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8()
|
||||
|
||||
All of the standard byte-reading methods of the `Buffer` interface are implemented and will operate across internal Buffer boundaries transparently.
|
||||
|
||||
See the <b><code>[Buffer](http://nodejs.org/docs/latest/api/buffer.html)</code></b> documentation for how these work.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="streams"></a>
|
||||
### Streams
|
||||
**bl** is a Node **[Duplex Stream](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_duplex)**, so it can be read from and written to like a standard Node stream. You can also `pipe()` to and from a **bl** instance.
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
## Contributors
|
||||
|
||||
**bl** is brought to you by the following hackers:
|
||||
|
||||
* [Rod Vagg](https://github.com/rvagg)
|
||||
* [Matteo Collina](https://github.com/mcollina)
|
||||
* [Jarett Cruger](https://github.com/jcrugzz)
|
||||
|
||||
=======
|
||||
|
||||
<a name="license"></a>
|
||||
## License & copyright
|
||||
|
||||
Copyright (c) 2013-2014 bl contributors (listed above).
|
||||
|
||||
bl is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
|
||||
221
node_modules/twit/node_modules/request/node_modules/bl/bl.js
generated
vendored
Normal file
221
node_modules/twit/node_modules/request/node_modules/bl/bl.js
generated
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
var DuplexStream = require('readable-stream/duplex')
|
||||
, util = require('util')
|
||||
|
||||
function BufferList (callback) {
|
||||
if (!(this instanceof BufferList))
|
||||
return new BufferList(callback)
|
||||
|
||||
this._bufs = []
|
||||
this.length = 0
|
||||
|
||||
if (typeof callback == 'function') {
|
||||
this._callback = callback
|
||||
|
||||
var piper = function (err) {
|
||||
if (this._callback) {
|
||||
this._callback(err)
|
||||
this._callback = null
|
||||
}
|
||||
}.bind(this)
|
||||
|
||||
this.on('pipe', function (src) {
|
||||
src.on('error', piper)
|
||||
})
|
||||
this.on('unpipe', function (src) {
|
||||
src.removeListener('error', piper)
|
||||
})
|
||||
}
|
||||
else if (Buffer.isBuffer(callback))
|
||||
this.append(callback)
|
||||
else if (Array.isArray(callback)) {
|
||||
callback.forEach(function (b) {
|
||||
Buffer.isBuffer(b) && this.append(b)
|
||||
}.bind(this))
|
||||
}
|
||||
|
||||
DuplexStream.call(this)
|
||||
}
|
||||
|
||||
util.inherits(BufferList, DuplexStream)
|
||||
|
||||
BufferList.prototype._offset = function (offset) {
|
||||
var tot = 0, i = 0, _t
|
||||
for (; i < this._bufs.length; i++) {
|
||||
_t = tot + this._bufs[i].length
|
||||
if (offset < _t)
|
||||
return [ i, offset - tot ]
|
||||
tot = _t
|
||||
}
|
||||
}
|
||||
|
||||
BufferList.prototype.append = function (buf) {
|
||||
var isBuffer = Buffer.isBuffer(buf) ||
|
||||
buf instanceof BufferList
|
||||
|
||||
// coerce number arguments to strings, since Buffer(number) does
|
||||
// uninitialized memory allocation
|
||||
if (typeof buf == 'number')
|
||||
buf = buf.toString()
|
||||
|
||||
this._bufs.push(isBuffer ? buf : new Buffer(buf))
|
||||
this.length += buf.length
|
||||
return this
|
||||
}
|
||||
|
||||
BufferList.prototype._write = function (buf, encoding, callback) {
|
||||
this.append(buf)
|
||||
if (callback)
|
||||
callback()
|
||||
}
|
||||
|
||||
BufferList.prototype._read = function (size) {
|
||||
if (!this.length)
|
||||
return this.push(null)
|
||||
size = Math.min(size, this.length)
|
||||
this.push(this.slice(0, size))
|
||||
this.consume(size)
|
||||
}
|
||||
|
||||
BufferList.prototype.end = function (chunk) {
|
||||
DuplexStream.prototype.end.call(this, chunk)
|
||||
|
||||
if (this._callback) {
|
||||
this._callback(null, this.slice())
|
||||
this._callback = null
|
||||
}
|
||||
}
|
||||
|
||||
BufferList.prototype.get = function (index) {
|
||||
return this.slice(index, index + 1)[0]
|
||||
}
|
||||
|
||||
BufferList.prototype.slice = function (start, end) {
|
||||
return this.copy(null, 0, start, end)
|
||||
}
|
||||
|
||||
BufferList.prototype.copy = function (dst, dstStart, srcStart, srcEnd) {
|
||||
if (typeof srcStart != 'number' || srcStart < 0)
|
||||
srcStart = 0
|
||||
if (typeof srcEnd != 'number' || srcEnd > this.length)
|
||||
srcEnd = this.length
|
||||
if (srcStart >= this.length)
|
||||
return dst || new Buffer(0)
|
||||
if (srcEnd <= 0)
|
||||
return dst || new Buffer(0)
|
||||
|
||||
var copy = !!dst
|
||||
, off = this._offset(srcStart)
|
||||
, len = srcEnd - srcStart
|
||||
, bytes = len
|
||||
, bufoff = (copy && dstStart) || 0
|
||||
, start = off[1]
|
||||
, l
|
||||
, i
|
||||
|
||||
// copy/slice everything
|
||||
if (srcStart === 0 && srcEnd == this.length) {
|
||||
if (!copy) // slice, just return a full concat
|
||||
return Buffer.concat(this._bufs)
|
||||
|
||||
// copy, need to copy individual buffers
|
||||
for (i = 0; i < this._bufs.length; i++) {
|
||||
this._bufs[i].copy(dst, bufoff)
|
||||
bufoff += this._bufs[i].length
|
||||
}
|
||||
|
||||
return dst
|
||||
}
|
||||
|
||||
// easy, cheap case where it's a subset of one of the buffers
|
||||
if (bytes <= this._bufs[off[0]].length - start) {
|
||||
return copy
|
||||
? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes)
|
||||
: this._bufs[off[0]].slice(start, start + bytes)
|
||||
}
|
||||
|
||||
if (!copy) // a slice, we need something to copy in to
|
||||
dst = new Buffer(len)
|
||||
|
||||
for (i = off[0]; i < this._bufs.length; i++) {
|
||||
l = this._bufs[i].length - start
|
||||
|
||||
if (bytes > l) {
|
||||
this._bufs[i].copy(dst, bufoff, start)
|
||||
} else {
|
||||
this._bufs[i].copy(dst, bufoff, start, start + bytes)
|
||||
break
|
||||
}
|
||||
|
||||
bufoff += l
|
||||
bytes -= l
|
||||
|
||||
if (start)
|
||||
start = 0
|
||||
}
|
||||
|
||||
return dst
|
||||
}
|
||||
|
||||
BufferList.prototype.toString = function (encoding, start, end) {
|
||||
return this.slice(start, end).toString(encoding)
|
||||
}
|
||||
|
||||
BufferList.prototype.consume = function (bytes) {
|
||||
while (this._bufs.length) {
|
||||
if (bytes > this._bufs[0].length) {
|
||||
bytes -= this._bufs[0].length
|
||||
this.length -= this._bufs[0].length
|
||||
this._bufs.shift()
|
||||
} else {
|
||||
this._bufs[0] = this._bufs[0].slice(bytes)
|
||||
this.length -= bytes
|
||||
break
|
||||
}
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
BufferList.prototype.duplicate = function () {
|
||||
var i = 0
|
||||
, copy = new BufferList()
|
||||
|
||||
for (; i < this._bufs.length; i++)
|
||||
copy.append(this._bufs[i])
|
||||
|
||||
return copy
|
||||
}
|
||||
|
||||
BufferList.prototype.destroy = function () {
|
||||
this._bufs.length = 0;
|
||||
this.length = 0;
|
||||
this.push(null);
|
||||
}
|
||||
|
||||
;(function () {
|
||||
var methods = {
|
||||
'readDoubleBE' : 8
|
||||
, 'readDoubleLE' : 8
|
||||
, 'readFloatBE' : 4
|
||||
, 'readFloatLE' : 4
|
||||
, 'readInt32BE' : 4
|
||||
, 'readInt32LE' : 4
|
||||
, 'readUInt32BE' : 4
|
||||
, 'readUInt32LE' : 4
|
||||
, 'readInt16BE' : 2
|
||||
, 'readInt16LE' : 2
|
||||
, 'readUInt16BE' : 2
|
||||
, 'readUInt16LE' : 2
|
||||
, 'readInt8' : 1
|
||||
, 'readUInt8' : 1
|
||||
}
|
||||
|
||||
for (var m in methods) {
|
||||
(function (m) {
|
||||
BufferList.prototype[m] = function (offset) {
|
||||
return this.slice(offset, offset + methods[m])[m](0)
|
||||
}
|
||||
}(m))
|
||||
}
|
||||
}())
|
||||
|
||||
module.exports = BufferList
|
||||
5
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/.npmignore
generated
vendored
Normal file
5
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
build/
|
||||
test/
|
||||
examples/
|
||||
fs.js
|
||||
zlib.js
|
||||
18
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/LICENSE
generated
vendored
Normal file
18
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||
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.
|
||||
15
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/README.md
generated
vendored
Normal file
15
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/README.md
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# readable-stream
|
||||
|
||||
***Node-core streams for userland***
|
||||
|
||||
[](https://nodei.co/npm/readable-stream/)
|
||||
[](https://nodei.co/npm/readable-stream/)
|
||||
|
||||
This package is a mirror of the Streams2 and Streams3 implementations in Node-core.
|
||||
|
||||
If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core.
|
||||
|
||||
**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12.
|
||||
|
||||
**readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"`
|
||||
|
||||
1
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/duplex.js
generated
vendored
Normal file
1
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/duplex.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require("./lib/_stream_duplex.js")
|
||||
89
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js
generated
vendored
Normal file
89
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// a duplex stream is just a stream that is both readable and writable.
|
||||
// Since JS doesn't have multiple prototypal inheritance, this class
|
||||
// prototypally inherits from Readable, and then parasitically from
|
||||
// Writable.
|
||||
|
||||
module.exports = Duplex;
|
||||
|
||||
/*<replacement>*/
|
||||
var objectKeys = Object.keys || function (obj) {
|
||||
var keys = [];
|
||||
for (var key in obj) keys.push(key);
|
||||
return keys;
|
||||
}
|
||||
/*</replacement>*/
|
||||
|
||||
|
||||
/*<replacement>*/
|
||||
var util = require('core-util-is');
|
||||
util.inherits = require('inherits');
|
||||
/*</replacement>*/
|
||||
|
||||
var Readable = require('./_stream_readable');
|
||||
var Writable = require('./_stream_writable');
|
||||
|
||||
util.inherits(Duplex, Readable);
|
||||
|
||||
forEach(objectKeys(Writable.prototype), function(method) {
|
||||
if (!Duplex.prototype[method])
|
||||
Duplex.prototype[method] = Writable.prototype[method];
|
||||
});
|
||||
|
||||
function Duplex(options) {
|
||||
if (!(this instanceof Duplex))
|
||||
return new Duplex(options);
|
||||
|
||||
Readable.call(this, options);
|
||||
Writable.call(this, options);
|
||||
|
||||
if (options && options.readable === false)
|
||||
this.readable = false;
|
||||
|
||||
if (options && options.writable === false)
|
||||
this.writable = false;
|
||||
|
||||
this.allowHalfOpen = true;
|
||||
if (options && options.allowHalfOpen === false)
|
||||
this.allowHalfOpen = false;
|
||||
|
||||
this.once('end', onend);
|
||||
}
|
||||
|
||||
// the no-half-open enforcer
|
||||
function onend() {
|
||||
// if we allow half-open state, or if the writable side ended,
|
||||
// then we're ok.
|
||||
if (this.allowHalfOpen || this._writableState.ended)
|
||||
return;
|
||||
|
||||
// no more data can be written.
|
||||
// But allow more writes to happen in this tick.
|
||||
process.nextTick(this.end.bind(this));
|
||||
}
|
||||
|
||||
function forEach (xs, f) {
|
||||
for (var i = 0, l = xs.length; i < l; i++) {
|
||||
f(xs[i], i);
|
||||
}
|
||||
}
|
||||
46
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js
generated
vendored
Normal file
46
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// a passthrough stream.
|
||||
// basically just the most minimal sort of Transform stream.
|
||||
// Every written chunk gets output as-is.
|
||||
|
||||
module.exports = PassThrough;
|
||||
|
||||
var Transform = require('./_stream_transform');
|
||||
|
||||
/*<replacement>*/
|
||||
var util = require('core-util-is');
|
||||
util.inherits = require('inherits');
|
||||
/*</replacement>*/
|
||||
|
||||
util.inherits(PassThrough, Transform);
|
||||
|
||||
function PassThrough(options) {
|
||||
if (!(this instanceof PassThrough))
|
||||
return new PassThrough(options);
|
||||
|
||||
Transform.call(this, options);
|
||||
}
|
||||
|
||||
PassThrough.prototype._transform = function(chunk, encoding, cb) {
|
||||
cb(null, chunk);
|
||||
};
|
||||
982
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js
generated
vendored
Normal file
982
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js
generated
vendored
Normal file
@@ -0,0 +1,982 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
module.exports = Readable;
|
||||
|
||||
/*<replacement>*/
|
||||
var isArray = require('isarray');
|
||||
/*</replacement>*/
|
||||
|
||||
|
||||
/*<replacement>*/
|
||||
var Buffer = require('buffer').Buffer;
|
||||
/*</replacement>*/
|
||||
|
||||
Readable.ReadableState = ReadableState;
|
||||
|
||||
var EE = require('events').EventEmitter;
|
||||
|
||||
/*<replacement>*/
|
||||
if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
|
||||
return emitter.listeners(type).length;
|
||||
};
|
||||
/*</replacement>*/
|
||||
|
||||
var Stream = require('stream');
|
||||
|
||||
/*<replacement>*/
|
||||
var util = require('core-util-is');
|
||||
util.inherits = require('inherits');
|
||||
/*</replacement>*/
|
||||
|
||||
var StringDecoder;
|
||||
|
||||
util.inherits(Readable, Stream);
|
||||
|
||||
function ReadableState(options, stream) {
|
||||
options = options || {};
|
||||
|
||||
// the point at which it stops calling _read() to fill the buffer
|
||||
// Note: 0 is a valid value, means "don't call _read preemptively ever"
|
||||
var hwm = options.highWaterMark;
|
||||
this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;
|
||||
|
||||
// cast to ints.
|
||||
this.highWaterMark = ~~this.highWaterMark;
|
||||
|
||||
this.buffer = [];
|
||||
this.length = 0;
|
||||
this.pipes = null;
|
||||
this.pipesCount = 0;
|
||||
this.flowing = false;
|
||||
this.ended = false;
|
||||
this.endEmitted = false;
|
||||
this.reading = false;
|
||||
|
||||
// In streams that never have any data, and do push(null) right away,
|
||||
// the consumer can miss the 'end' event if they do some I/O before
|
||||
// consuming the stream. So, we don't emit('end') until some reading
|
||||
// happens.
|
||||
this.calledRead = false;
|
||||
|
||||
// a flag to be able to tell if the onwrite cb is called immediately,
|
||||
// or on a later tick. We set this to true at first, becuase any
|
||||
// actions that shouldn't happen until "later" should generally also
|
||||
// not happen before the first write call.
|
||||
this.sync = true;
|
||||
|
||||
// whenever we return null, then we set a flag to say
|
||||
// that we're awaiting a 'readable' event emission.
|
||||
this.needReadable = false;
|
||||
this.emittedReadable = false;
|
||||
this.readableListening = false;
|
||||
|
||||
|
||||
// object stream flag. Used to make read(n) ignore n and to
|
||||
// make all the buffer merging and length checks go away
|
||||
this.objectMode = !!options.objectMode;
|
||||
|
||||
// Crypto is kind of old and crusty. Historically, its default string
|
||||
// encoding is 'binary' so we have to make this configurable.
|
||||
// Everything else in the universe uses 'utf8', though.
|
||||
this.defaultEncoding = options.defaultEncoding || 'utf8';
|
||||
|
||||
// when piping, we only care about 'readable' events that happen
|
||||
// after read()ing all the bytes and not getting any pushback.
|
||||
this.ranOut = false;
|
||||
|
||||
// the number of writers that are awaiting a drain event in .pipe()s
|
||||
this.awaitDrain = 0;
|
||||
|
||||
// if true, a maybeReadMore has been scheduled
|
||||
this.readingMore = false;
|
||||
|
||||
this.decoder = null;
|
||||
this.encoding = null;
|
||||
if (options.encoding) {
|
||||
if (!StringDecoder)
|
||||
StringDecoder = require('string_decoder/').StringDecoder;
|
||||
this.decoder = new StringDecoder(options.encoding);
|
||||
this.encoding = options.encoding;
|
||||
}
|
||||
}
|
||||
|
||||
function Readable(options) {
|
||||
if (!(this instanceof Readable))
|
||||
return new Readable(options);
|
||||
|
||||
this._readableState = new ReadableState(options, this);
|
||||
|
||||
// legacy
|
||||
this.readable = true;
|
||||
|
||||
Stream.call(this);
|
||||
}
|
||||
|
||||
// Manually shove something into the read() buffer.
|
||||
// This returns true if the highWaterMark has not been hit yet,
|
||||
// similar to how Writable.write() returns true if you should
|
||||
// write() some more.
|
||||
Readable.prototype.push = function(chunk, encoding) {
|
||||
var state = this._readableState;
|
||||
|
||||
if (typeof chunk === 'string' && !state.objectMode) {
|
||||
encoding = encoding || state.defaultEncoding;
|
||||
if (encoding !== state.encoding) {
|
||||
chunk = new Buffer(chunk, encoding);
|
||||
encoding = '';
|
||||
}
|
||||
}
|
||||
|
||||
return readableAddChunk(this, state, chunk, encoding, false);
|
||||
};
|
||||
|
||||
// Unshift should *always* be something directly out of read()
|
||||
Readable.prototype.unshift = function(chunk) {
|
||||
var state = this._readableState;
|
||||
return readableAddChunk(this, state, chunk, '', true);
|
||||
};
|
||||
|
||||
function readableAddChunk(stream, state, chunk, encoding, addToFront) {
|
||||
var er = chunkInvalid(state, chunk);
|
||||
if (er) {
|
||||
stream.emit('error', er);
|
||||
} else if (chunk === null || chunk === undefined) {
|
||||
state.reading = false;
|
||||
if (!state.ended)
|
||||
onEofChunk(stream, state);
|
||||
} else if (state.objectMode || chunk && chunk.length > 0) {
|
||||
if (state.ended && !addToFront) {
|
||||
var e = new Error('stream.push() after EOF');
|
||||
stream.emit('error', e);
|
||||
} else if (state.endEmitted && addToFront) {
|
||||
var e = new Error('stream.unshift() after end event');
|
||||
stream.emit('error', e);
|
||||
} else {
|
||||
if (state.decoder && !addToFront && !encoding)
|
||||
chunk = state.decoder.write(chunk);
|
||||
|
||||
// update the buffer info.
|
||||
state.length += state.objectMode ? 1 : chunk.length;
|
||||
if (addToFront) {
|
||||
state.buffer.unshift(chunk);
|
||||
} else {
|
||||
state.reading = false;
|
||||
state.buffer.push(chunk);
|
||||
}
|
||||
|
||||
if (state.needReadable)
|
||||
emitReadable(stream);
|
||||
|
||||
maybeReadMore(stream, state);
|
||||
}
|
||||
} else if (!addToFront) {
|
||||
state.reading = false;
|
||||
}
|
||||
|
||||
return needMoreData(state);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if it's past the high water mark, we can push in some more.
|
||||
// Also, if we have no data yet, we can stand some
|
||||
// more bytes. This is to work around cases where hwm=0,
|
||||
// such as the repl. Also, if the push() triggered a
|
||||
// readable event, and the user called read(largeNumber) such that
|
||||
// needReadable was set, then we ought to push more, so that another
|
||||
// 'readable' event will be triggered.
|
||||
function needMoreData(state) {
|
||||
return !state.ended &&
|
||||
(state.needReadable ||
|
||||
state.length < state.highWaterMark ||
|
||||
state.length === 0);
|
||||
}
|
||||
|
||||
// backwards compatibility.
|
||||
Readable.prototype.setEncoding = function(enc) {
|
||||
if (!StringDecoder)
|
||||
StringDecoder = require('string_decoder/').StringDecoder;
|
||||
this._readableState.decoder = new StringDecoder(enc);
|
||||
this._readableState.encoding = enc;
|
||||
};
|
||||
|
||||
// Don't raise the hwm > 128MB
|
||||
var MAX_HWM = 0x800000;
|
||||
function roundUpToNextPowerOf2(n) {
|
||||
if (n >= MAX_HWM) {
|
||||
n = MAX_HWM;
|
||||
} else {
|
||||
// Get the next highest power of 2
|
||||
n--;
|
||||
for (var p = 1; p < 32; p <<= 1) n |= n >> p;
|
||||
n++;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
function howMuchToRead(n, state) {
|
||||
if (state.length === 0 && state.ended)
|
||||
return 0;
|
||||
|
||||
if (state.objectMode)
|
||||
return n === 0 ? 0 : 1;
|
||||
|
||||
if (n === null || isNaN(n)) {
|
||||
// only flow one buffer at a time
|
||||
if (state.flowing && state.buffer.length)
|
||||
return state.buffer[0].length;
|
||||
else
|
||||
return state.length;
|
||||
}
|
||||
|
||||
if (n <= 0)
|
||||
return 0;
|
||||
|
||||
// If we're asking for more than the target buffer level,
|
||||
// then raise the water mark. Bump up to the next highest
|
||||
// power of 2, to prevent increasing it excessively in tiny
|
||||
// amounts.
|
||||
if (n > state.highWaterMark)
|
||||
state.highWaterMark = roundUpToNextPowerOf2(n);
|
||||
|
||||
// don't have that much. return null, unless we've ended.
|
||||
if (n > state.length) {
|
||||
if (!state.ended) {
|
||||
state.needReadable = true;
|
||||
return 0;
|
||||
} else
|
||||
return state.length;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
// you can override either this method, or the async _read(n) below.
|
||||
Readable.prototype.read = function(n) {
|
||||
var state = this._readableState;
|
||||
state.calledRead = true;
|
||||
var nOrig = n;
|
||||
var ret;
|
||||
|
||||
if (typeof n !== 'number' || n > 0)
|
||||
state.emittedReadable = false;
|
||||
|
||||
// if we're doing read(0) to trigger a readable event, but we
|
||||
// already have a bunch of data in the buffer, then just trigger
|
||||
// the 'readable' event and move on.
|
||||
if (n === 0 &&
|
||||
state.needReadable &&
|
||||
(state.length >= state.highWaterMark || state.ended)) {
|
||||
emitReadable(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
n = howMuchToRead(n, state);
|
||||
|
||||
// if we've ended, and we're now clear, then finish it up.
|
||||
if (n === 0 && state.ended) {
|
||||
ret = null;
|
||||
|
||||
// In cases where the decoder did not receive enough data
|
||||
// to produce a full chunk, then immediately received an
|
||||
// EOF, state.buffer will contain [<Buffer >, <Buffer 00 ...>].
|
||||
// howMuchToRead will see this and coerce the amount to
|
||||
// read to zero (because it's looking at the length of the
|
||||
// first <Buffer > in state.buffer), and we'll end up here.
|
||||
//
|
||||
// This can only happen via state.decoder -- no other venue
|
||||
// exists for pushing a zero-length chunk into state.buffer
|
||||
// and triggering this behavior. In this case, we return our
|
||||
// remaining data and end the stream, if appropriate.
|
||||
if (state.length > 0 && state.decoder) {
|
||||
ret = fromList(n, state);
|
||||
state.length -= ret.length;
|
||||
}
|
||||
|
||||
if (state.length === 0)
|
||||
endReadable(this);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// All the actual chunk generation logic needs to be
|
||||
// *below* the call to _read. The reason is that in certain
|
||||
// synthetic stream cases, such as passthrough streams, _read
|
||||
// may be a completely synchronous operation which may change
|
||||
// the state of the read buffer, providing enough data when
|
||||
// before there was *not* enough.
|
||||
//
|
||||
// So, the steps are:
|
||||
// 1. Figure out what the state of things will be after we do
|
||||
// a read from the buffer.
|
||||
//
|
||||
// 2. If that resulting state will trigger a _read, then call _read.
|
||||
// Note that this may be asynchronous, or synchronous. Yes, it is
|
||||
// deeply ugly to write APIs this way, but that still doesn't mean
|
||||
// that the Readable class should behave improperly, as streams are
|
||||
// designed to be sync/async agnostic.
|
||||
// Take note if the _read call is sync or async (ie, if the read call
|
||||
// has returned yet), so that we know whether or not it's safe to emit
|
||||
// 'readable' etc.
|
||||
//
|
||||
// 3. Actually pull the requested chunks out of the buffer and return.
|
||||
|
||||
// if we need a readable event, then we need to do some reading.
|
||||
var doRead = state.needReadable;
|
||||
|
||||
// if we currently have less than the highWaterMark, then also read some
|
||||
if (state.length - n <= state.highWaterMark)
|
||||
doRead = true;
|
||||
|
||||
// however, if we've ended, then there's no point, and if we're already
|
||||
// reading, then it's unnecessary.
|
||||
if (state.ended || state.reading)
|
||||
doRead = false;
|
||||
|
||||
if (doRead) {
|
||||
state.reading = true;
|
||||
state.sync = true;
|
||||
// if the length is currently zero, then we *need* a readable event.
|
||||
if (state.length === 0)
|
||||
state.needReadable = true;
|
||||
// call internal read method
|
||||
this._read(state.highWaterMark);
|
||||
state.sync = false;
|
||||
}
|
||||
|
||||
// If _read called its callback synchronously, then `reading`
|
||||
// will be false, and we need to re-evaluate how much data we
|
||||
// can return to the user.
|
||||
if (doRead && !state.reading)
|
||||
n = howMuchToRead(nOrig, state);
|
||||
|
||||
if (n > 0)
|
||||
ret = fromList(n, state);
|
||||
else
|
||||
ret = null;
|
||||
|
||||
if (ret === null) {
|
||||
state.needReadable = true;
|
||||
n = 0;
|
||||
}
|
||||
|
||||
state.length -= n;
|
||||
|
||||
// If we have nothing in the buffer, then we want to know
|
||||
// as soon as we *do* get something into the buffer.
|
||||
if (state.length === 0 && !state.ended)
|
||||
state.needReadable = true;
|
||||
|
||||
// If we happened to read() exactly the remaining amount in the
|
||||
// buffer, and the EOF has been seen at this point, then make sure
|
||||
// that we emit 'end' on the very next tick.
|
||||
if (state.ended && !state.endEmitted && state.length === 0)
|
||||
endReadable(this);
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
function chunkInvalid(state, chunk) {
|
||||
var er = null;
|
||||
if (!Buffer.isBuffer(chunk) &&
|
||||
'string' !== typeof chunk &&
|
||||
chunk !== null &&
|
||||
chunk !== undefined &&
|
||||
!state.objectMode) {
|
||||
er = new TypeError('Invalid non-string/buffer chunk');
|
||||
}
|
||||
return er;
|
||||
}
|
||||
|
||||
|
||||
function onEofChunk(stream, state) {
|
||||
if (state.decoder && !state.ended) {
|
||||
var chunk = state.decoder.end();
|
||||
if (chunk && chunk.length) {
|
||||
state.buffer.push(chunk);
|
||||
state.length += state.objectMode ? 1 : chunk.length;
|
||||
}
|
||||
}
|
||||
state.ended = true;
|
||||
|
||||
// if we've ended and we have some data left, then emit
|
||||
// 'readable' now to make sure it gets picked up.
|
||||
if (state.length > 0)
|
||||
emitReadable(stream);
|
||||
else
|
||||
endReadable(stream);
|
||||
}
|
||||
|
||||
// Don't emit readable right away in sync mode, because this can trigger
|
||||
// another read() call => stack overflow. This way, it might trigger
|
||||
// a nextTick recursion warning, but that's not so bad.
|
||||
function emitReadable(stream) {
|
||||
var state = stream._readableState;
|
||||
state.needReadable = false;
|
||||
if (state.emittedReadable)
|
||||
return;
|
||||
|
||||
state.emittedReadable = true;
|
||||
if (state.sync)
|
||||
process.nextTick(function() {
|
||||
emitReadable_(stream);
|
||||
});
|
||||
else
|
||||
emitReadable_(stream);
|
||||
}
|
||||
|
||||
function emitReadable_(stream) {
|
||||
stream.emit('readable');
|
||||
}
|
||||
|
||||
|
||||
// at this point, the user has presumably seen the 'readable' event,
|
||||
// and called read() to consume some data. that may have triggered
|
||||
// in turn another _read(n) call, in which case reading = true if
|
||||
// it's in progress.
|
||||
// However, if we're not ended, or reading, and the length < hwm,
|
||||
// then go ahead and try to read some more preemptively.
|
||||
function maybeReadMore(stream, state) {
|
||||
if (!state.readingMore) {
|
||||
state.readingMore = true;
|
||||
process.nextTick(function() {
|
||||
maybeReadMore_(stream, state);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function maybeReadMore_(stream, state) {
|
||||
var len = state.length;
|
||||
while (!state.reading && !state.flowing && !state.ended &&
|
||||
state.length < state.highWaterMark) {
|
||||
stream.read(0);
|
||||
if (len === state.length)
|
||||
// didn't get any data, stop spinning.
|
||||
break;
|
||||
else
|
||||
len = state.length;
|
||||
}
|
||||
state.readingMore = false;
|
||||
}
|
||||
|
||||
// abstract method. to be overridden in specific implementation classes.
|
||||
// call cb(er, data) where data is <= n in length.
|
||||
// for virtual (non-string, non-buffer) streams, "length" is somewhat
|
||||
// arbitrary, and perhaps not very meaningful.
|
||||
Readable.prototype._read = function(n) {
|
||||
this.emit('error', new Error('not implemented'));
|
||||
};
|
||||
|
||||
Readable.prototype.pipe = function(dest, pipeOpts) {
|
||||
var src = this;
|
||||
var state = this._readableState;
|
||||
|
||||
switch (state.pipesCount) {
|
||||
case 0:
|
||||
state.pipes = dest;
|
||||
break;
|
||||
case 1:
|
||||
state.pipes = [state.pipes, dest];
|
||||
break;
|
||||
default:
|
||||
state.pipes.push(dest);
|
||||
break;
|
||||
}
|
||||
state.pipesCount += 1;
|
||||
|
||||
var doEnd = (!pipeOpts || pipeOpts.end !== false) &&
|
||||
dest !== process.stdout &&
|
||||
dest !== process.stderr;
|
||||
|
||||
var endFn = doEnd ? onend : cleanup;
|
||||
if (state.endEmitted)
|
||||
process.nextTick(endFn);
|
||||
else
|
||||
src.once('end', endFn);
|
||||
|
||||
dest.on('unpipe', onunpipe);
|
||||
function onunpipe(readable) {
|
||||
if (readable !== src) return;
|
||||
cleanup();
|
||||
}
|
||||
|
||||
function onend() {
|
||||
dest.end();
|
||||
}
|
||||
|
||||
// when the dest drains, it reduces the awaitDrain counter
|
||||
// on the source. This would be more elegant with a .once()
|
||||
// handler in flow(), but adding and removing repeatedly is
|
||||
// too slow.
|
||||
var ondrain = pipeOnDrain(src);
|
||||
dest.on('drain', ondrain);
|
||||
|
||||
function cleanup() {
|
||||
// cleanup event handlers once the pipe is broken
|
||||
dest.removeListener('close', onclose);
|
||||
dest.removeListener('finish', onfinish);
|
||||
dest.removeListener('drain', ondrain);
|
||||
dest.removeListener('error', onerror);
|
||||
dest.removeListener('unpipe', onunpipe);
|
||||
src.removeListener('end', onend);
|
||||
src.removeListener('end', cleanup);
|
||||
|
||||
// if the reader is waiting for a drain event from this
|
||||
// specific writer, then it would cause it to never start
|
||||
// flowing again.
|
||||
// So, if this is awaiting a drain, then we just call it now.
|
||||
// If we don't know, then assume that we are waiting for one.
|
||||
if (!dest._writableState || dest._writableState.needDrain)
|
||||
ondrain();
|
||||
}
|
||||
|
||||
// if the dest has an error, then stop piping into it.
|
||||
// however, don't suppress the throwing behavior for this.
|
||||
function onerror(er) {
|
||||
unpipe();
|
||||
dest.removeListener('error', onerror);
|
||||
if (EE.listenerCount(dest, 'error') === 0)
|
||||
dest.emit('error', er);
|
||||
}
|
||||
// This is a brutally ugly hack to make sure that our error handler
|
||||
// is attached before any userland ones. NEVER DO THIS.
|
||||
if (!dest._events || !dest._events.error)
|
||||
dest.on('error', onerror);
|
||||
else if (isArray(dest._events.error))
|
||||
dest._events.error.unshift(onerror);
|
||||
else
|
||||
dest._events.error = [onerror, dest._events.error];
|
||||
|
||||
|
||||
|
||||
// Both close and finish should trigger unpipe, but only once.
|
||||
function onclose() {
|
||||
dest.removeListener('finish', onfinish);
|
||||
unpipe();
|
||||
}
|
||||
dest.once('close', onclose);
|
||||
function onfinish() {
|
||||
dest.removeListener('close', onclose);
|
||||
unpipe();
|
||||
}
|
||||
dest.once('finish', onfinish);
|
||||
|
||||
function unpipe() {
|
||||
src.unpipe(dest);
|
||||
}
|
||||
|
||||
// tell the dest that it's being piped to
|
||||
dest.emit('pipe', src);
|
||||
|
||||
// start the flow if it hasn't been started already.
|
||||
if (!state.flowing) {
|
||||
// the handler that waits for readable events after all
|
||||
// the data gets sucked out in flow.
|
||||
// This would be easier to follow with a .once() handler
|
||||
// in flow(), but that is too slow.
|
||||
this.on('readable', pipeOnReadable);
|
||||
|
||||
state.flowing = true;
|
||||
process.nextTick(function() {
|
||||
flow(src);
|
||||
});
|
||||
}
|
||||
|
||||
return dest;
|
||||
};
|
||||
|
||||
function pipeOnDrain(src) {
|
||||
return function() {
|
||||
var dest = this;
|
||||
var state = src._readableState;
|
||||
state.awaitDrain--;
|
||||
if (state.awaitDrain === 0)
|
||||
flow(src);
|
||||
};
|
||||
}
|
||||
|
||||
function flow(src) {
|
||||
var state = src._readableState;
|
||||
var chunk;
|
||||
state.awaitDrain = 0;
|
||||
|
||||
function write(dest, i, list) {
|
||||
var written = dest.write(chunk);
|
||||
if (false === written) {
|
||||
state.awaitDrain++;
|
||||
}
|
||||
}
|
||||
|
||||
while (state.pipesCount && null !== (chunk = src.read())) {
|
||||
|
||||
if (state.pipesCount === 1)
|
||||
write(state.pipes, 0, null);
|
||||
else
|
||||
forEach(state.pipes, write);
|
||||
|
||||
src.emit('data', chunk);
|
||||
|
||||
// if anyone needs a drain, then we have to wait for that.
|
||||
if (state.awaitDrain > 0)
|
||||
return;
|
||||
}
|
||||
|
||||
// if every destination was unpiped, either before entering this
|
||||
// function, or in the while loop, then stop flowing.
|
||||
//
|
||||
// NB: This is a pretty rare edge case.
|
||||
if (state.pipesCount === 0) {
|
||||
state.flowing = false;
|
||||
|
||||
// if there were data event listeners added, then switch to old mode.
|
||||
if (EE.listenerCount(src, 'data') > 0)
|
||||
emitDataEvents(src);
|
||||
return;
|
||||
}
|
||||
|
||||
// at this point, no one needed a drain, so we just ran out of data
|
||||
// on the next readable event, start it over again.
|
||||
state.ranOut = true;
|
||||
}
|
||||
|
||||
function pipeOnReadable() {
|
||||
if (this._readableState.ranOut) {
|
||||
this._readableState.ranOut = false;
|
||||
flow(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Readable.prototype.unpipe = function(dest) {
|
||||
var state = this._readableState;
|
||||
|
||||
// if we're not piping anywhere, then do nothing.
|
||||
if (state.pipesCount === 0)
|
||||
return this;
|
||||
|
||||
// just one destination. most common case.
|
||||
if (state.pipesCount === 1) {
|
||||
// passed in one, but it's not the right one.
|
||||
if (dest && dest !== state.pipes)
|
||||
return this;
|
||||
|
||||
if (!dest)
|
||||
dest = state.pipes;
|
||||
|
||||
// got a match.
|
||||
state.pipes = null;
|
||||
state.pipesCount = 0;
|
||||
this.removeListener('readable', pipeOnReadable);
|
||||
state.flowing = false;
|
||||
if (dest)
|
||||
dest.emit('unpipe', this);
|
||||
return this;
|
||||
}
|
||||
|
||||
// slow case. multiple pipe destinations.
|
||||
|
||||
if (!dest) {
|
||||
// remove all.
|
||||
var dests = state.pipes;
|
||||
var len = state.pipesCount;
|
||||
state.pipes = null;
|
||||
state.pipesCount = 0;
|
||||
this.removeListener('readable', pipeOnReadable);
|
||||
state.flowing = false;
|
||||
|
||||
for (var i = 0; i < len; i++)
|
||||
dests[i].emit('unpipe', this);
|
||||
return this;
|
||||
}
|
||||
|
||||
// try to find the right one.
|
||||
var i = indexOf(state.pipes, dest);
|
||||
if (i === -1)
|
||||
return this;
|
||||
|
||||
state.pipes.splice(i, 1);
|
||||
state.pipesCount -= 1;
|
||||
if (state.pipesCount === 1)
|
||||
state.pipes = state.pipes[0];
|
||||
|
||||
dest.emit('unpipe', this);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
// set up data events if they are asked for
|
||||
// Ensure readable listeners eventually get something
|
||||
Readable.prototype.on = function(ev, fn) {
|
||||
var res = Stream.prototype.on.call(this, ev, fn);
|
||||
|
||||
if (ev === 'data' && !this._readableState.flowing)
|
||||
emitDataEvents(this);
|
||||
|
||||
if (ev === 'readable' && this.readable) {
|
||||
var state = this._readableState;
|
||||
if (!state.readableListening) {
|
||||
state.readableListening = true;
|
||||
state.emittedReadable = false;
|
||||
state.needReadable = true;
|
||||
if (!state.reading) {
|
||||
this.read(0);
|
||||
} else if (state.length) {
|
||||
emitReadable(this, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
Readable.prototype.addListener = Readable.prototype.on;
|
||||
|
||||
// pause() and resume() are remnants of the legacy readable stream API
|
||||
// If the user uses them, then switch into old mode.
|
||||
Readable.prototype.resume = function() {
|
||||
emitDataEvents(this);
|
||||
this.read(0);
|
||||
this.emit('resume');
|
||||
};
|
||||
|
||||
Readable.prototype.pause = function() {
|
||||
emitDataEvents(this, true);
|
||||
this.emit('pause');
|
||||
};
|
||||
|
||||
function emitDataEvents(stream, startPaused) {
|
||||
var state = stream._readableState;
|
||||
|
||||
if (state.flowing) {
|
||||
// https://github.com/isaacs/readable-stream/issues/16
|
||||
throw new Error('Cannot switch to old mode now.');
|
||||
}
|
||||
|
||||
var paused = startPaused || false;
|
||||
var readable = false;
|
||||
|
||||
// convert to an old-style stream.
|
||||
stream.readable = true;
|
||||
stream.pipe = Stream.prototype.pipe;
|
||||
stream.on = stream.addListener = Stream.prototype.on;
|
||||
|
||||
stream.on('readable', function() {
|
||||
readable = true;
|
||||
|
||||
var c;
|
||||
while (!paused && (null !== (c = stream.read())))
|
||||
stream.emit('data', c);
|
||||
|
||||
if (c === null) {
|
||||
readable = false;
|
||||
stream._readableState.needReadable = true;
|
||||
}
|
||||
});
|
||||
|
||||
stream.pause = function() {
|
||||
paused = true;
|
||||
this.emit('pause');
|
||||
};
|
||||
|
||||
stream.resume = function() {
|
||||
paused = false;
|
||||
if (readable)
|
||||
process.nextTick(function() {
|
||||
stream.emit('readable');
|
||||
});
|
||||
else
|
||||
this.read(0);
|
||||
this.emit('resume');
|
||||
};
|
||||
|
||||
// now make it start, just in case it hadn't already.
|
||||
stream.emit('readable');
|
||||
}
|
||||
|
||||
// wrap an old-style stream as the async data source.
|
||||
// This is *not* part of the readable stream interface.
|
||||
// It is an ugly unfortunate mess of history.
|
||||
Readable.prototype.wrap = function(stream) {
|
||||
var state = this._readableState;
|
||||
var paused = false;
|
||||
|
||||
var self = this;
|
||||
stream.on('end', function() {
|
||||
if (state.decoder && !state.ended) {
|
||||
var chunk = state.decoder.end();
|
||||
if (chunk && chunk.length)
|
||||
self.push(chunk);
|
||||
}
|
||||
|
||||
self.push(null);
|
||||
});
|
||||
|
||||
stream.on('data', function(chunk) {
|
||||
if (state.decoder)
|
||||
chunk = state.decoder.write(chunk);
|
||||
|
||||
// don't skip over falsy values in objectMode
|
||||
//if (state.objectMode && util.isNullOrUndefined(chunk))
|
||||
if (state.objectMode && (chunk === null || chunk === undefined))
|
||||
return;
|
||||
else if (!state.objectMode && (!chunk || !chunk.length))
|
||||
return;
|
||||
|
||||
var ret = self.push(chunk);
|
||||
if (!ret) {
|
||||
paused = true;
|
||||
stream.pause();
|
||||
}
|
||||
});
|
||||
|
||||
// proxy all the other methods.
|
||||
// important when wrapping filters and duplexes.
|
||||
for (var i in stream) {
|
||||
if (typeof stream[i] === 'function' &&
|
||||
typeof this[i] === 'undefined') {
|
||||
this[i] = function(method) { return function() {
|
||||
return stream[method].apply(stream, arguments);
|
||||
}}(i);
|
||||
}
|
||||
}
|
||||
|
||||
// proxy certain important events.
|
||||
var events = ['error', 'close', 'destroy', 'pause', 'resume'];
|
||||
forEach(events, function(ev) {
|
||||
stream.on(ev, self.emit.bind(self, ev));
|
||||
});
|
||||
|
||||
// when we try to consume some more bytes, simply unpause the
|
||||
// underlying stream.
|
||||
self._read = function(n) {
|
||||
if (paused) {
|
||||
paused = false;
|
||||
stream.resume();
|
||||
}
|
||||
};
|
||||
|
||||
return self;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// exposed for testing purposes only.
|
||||
Readable._fromList = fromList;
|
||||
|
||||
// Pluck off n bytes from an array of buffers.
|
||||
// Length is the combined lengths of all the buffers in the list.
|
||||
function fromList(n, state) {
|
||||
var list = state.buffer;
|
||||
var length = state.length;
|
||||
var stringMode = !!state.decoder;
|
||||
var objectMode = !!state.objectMode;
|
||||
var ret;
|
||||
|
||||
// nothing in the list, definitely empty.
|
||||
if (list.length === 0)
|
||||
return null;
|
||||
|
||||
if (length === 0)
|
||||
ret = null;
|
||||
else if (objectMode)
|
||||
ret = list.shift();
|
||||
else if (!n || n >= length) {
|
||||
// read it all, truncate the array.
|
||||
if (stringMode)
|
||||
ret = list.join('');
|
||||
else
|
||||
ret = Buffer.concat(list, length);
|
||||
list.length = 0;
|
||||
} else {
|
||||
// read just some of it.
|
||||
if (n < list[0].length) {
|
||||
// just take a part of the first list item.
|
||||
// slice is the same for buffers and strings.
|
||||
var buf = list[0];
|
||||
ret = buf.slice(0, n);
|
||||
list[0] = buf.slice(n);
|
||||
} else if (n === list[0].length) {
|
||||
// first list is a perfect match
|
||||
ret = list.shift();
|
||||
} else {
|
||||
// complex case.
|
||||
// we have enough to cover it, but it spans past the first buffer.
|
||||
if (stringMode)
|
||||
ret = '';
|
||||
else
|
||||
ret = new Buffer(n);
|
||||
|
||||
var c = 0;
|
||||
for (var i = 0, l = list.length; i < l && c < n; i++) {
|
||||
var buf = list[0];
|
||||
var cpy = Math.min(n - c, buf.length);
|
||||
|
||||
if (stringMode)
|
||||
ret += buf.slice(0, cpy);
|
||||
else
|
||||
buf.copy(ret, c, 0, cpy);
|
||||
|
||||
if (cpy < buf.length)
|
||||
list[0] = buf.slice(cpy);
|
||||
else
|
||||
list.shift();
|
||||
|
||||
c += cpy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function endReadable(stream) {
|
||||
var state = stream._readableState;
|
||||
|
||||
// If we get here before consuming all the bytes, then that is a
|
||||
// bug in node. Should never happen.
|
||||
if (state.length > 0)
|
||||
throw new Error('endReadable called on non-empty stream');
|
||||
|
||||
if (!state.endEmitted && state.calledRead) {
|
||||
state.ended = true;
|
||||
process.nextTick(function() {
|
||||
// Check that we didn't get one last unshift.
|
||||
if (!state.endEmitted && state.length === 0) {
|
||||
state.endEmitted = true;
|
||||
stream.readable = false;
|
||||
stream.emit('end');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function forEach (xs, f) {
|
||||
for (var i = 0, l = xs.length; i < l; i++) {
|
||||
f(xs[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
function indexOf (xs, x) {
|
||||
for (var i = 0, l = xs.length; i < l; i++) {
|
||||
if (xs[i] === x) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
210
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js
generated
vendored
Normal file
210
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js
generated
vendored
Normal file
@@ -0,0 +1,210 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
|
||||
// a transform stream is a readable/writable stream where you do
|
||||
// something with the data. Sometimes it's called a "filter",
|
||||
// but that's not a great name for it, since that implies a thing where
|
||||
// some bits pass through, and others are simply ignored. (That would
|
||||
// be a valid example of a transform, of course.)
|
||||
//
|
||||
// While the output is causally related to the input, it's not a
|
||||
// necessarily symmetric or synchronous transformation. For example,
|
||||
// a zlib stream might take multiple plain-text writes(), and then
|
||||
// emit a single compressed chunk some time in the future.
|
||||
//
|
||||
// Here's how this works:
|
||||
//
|
||||
// The Transform stream has all the aspects of the readable and writable
|
||||
// stream classes. When you write(chunk), that calls _write(chunk,cb)
|
||||
// internally, and returns false if there's a lot of pending writes
|
||||
// buffered up. When you call read(), that calls _read(n) until
|
||||
// there's enough pending readable data buffered up.
|
||||
//
|
||||
// In a transform stream, the written data is placed in a buffer. When
|
||||
// _read(n) is called, it transforms the queued up data, calling the
|
||||
// buffered _write cb's as it consumes chunks. If consuming a single
|
||||
// written chunk would result in multiple output chunks, then the first
|
||||
// outputted bit calls the readcb, and subsequent chunks just go into
|
||||
// the read buffer, and will cause it to emit 'readable' if necessary.
|
||||
//
|
||||
// This way, back-pressure is actually determined by the reading side,
|
||||
// since _read has to be called to start processing a new chunk. However,
|
||||
// a pathological inflate type of transform can cause excessive buffering
|
||||
// here. For example, imagine a stream where every byte of input is
|
||||
// interpreted as an integer from 0-255, and then results in that many
|
||||
// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
|
||||
// 1kb of data being output. In this case, you could write a very small
|
||||
// amount of input, and end up with a very large amount of output. In
|
||||
// such a pathological inflating mechanism, there'd be no way to tell
|
||||
// the system to stop doing the transform. A single 4MB write could
|
||||
// cause the system to run out of memory.
|
||||
//
|
||||
// However, even in such a pathological case, only a single written chunk
|
||||
// would be consumed, and then the rest would wait (un-transformed) until
|
||||
// the results of the previous transformed chunk were consumed.
|
||||
|
||||
module.exports = Transform;
|
||||
|
||||
var Duplex = require('./_stream_duplex');
|
||||
|
||||
/*<replacement>*/
|
||||
var util = require('core-util-is');
|
||||
util.inherits = require('inherits');
|
||||
/*</replacement>*/
|
||||
|
||||
util.inherits(Transform, Duplex);
|
||||
|
||||
|
||||
function TransformState(options, stream) {
|
||||
this.afterTransform = function(er, data) {
|
||||
return afterTransform(stream, er, data);
|
||||
};
|
||||
|
||||
this.needTransform = false;
|
||||
this.transforming = false;
|
||||
this.writecb = null;
|
||||
this.writechunk = null;
|
||||
}
|
||||
|
||||
function afterTransform(stream, er, data) {
|
||||
var ts = stream._transformState;
|
||||
ts.transforming = false;
|
||||
|
||||
var cb = ts.writecb;
|
||||
|
||||
if (!cb)
|
||||
return stream.emit('error', new Error('no writecb in Transform class'));
|
||||
|
||||
ts.writechunk = null;
|
||||
ts.writecb = null;
|
||||
|
||||
if (data !== null && data !== undefined)
|
||||
stream.push(data);
|
||||
|
||||
if (cb)
|
||||
cb(er);
|
||||
|
||||
var rs = stream._readableState;
|
||||
rs.reading = false;
|
||||
if (rs.needReadable || rs.length < rs.highWaterMark) {
|
||||
stream._read(rs.highWaterMark);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function Transform(options) {
|
||||
if (!(this instanceof Transform))
|
||||
return new Transform(options);
|
||||
|
||||
Duplex.call(this, options);
|
||||
|
||||
var ts = this._transformState = new TransformState(options, this);
|
||||
|
||||
// when the writable side finishes, then flush out anything remaining.
|
||||
var stream = this;
|
||||
|
||||
// start out asking for a readable event once data is transformed.
|
||||
this._readableState.needReadable = true;
|
||||
|
||||
// we have implemented the _read method, and done the other things
|
||||
// that Readable wants before the first _read call, so unset the
|
||||
// sync guard flag.
|
||||
this._readableState.sync = false;
|
||||
|
||||
this.once('finish', function() {
|
||||
if ('function' === typeof this._flush)
|
||||
this._flush(function(er) {
|
||||
done(stream, er);
|
||||
});
|
||||
else
|
||||
done(stream);
|
||||
});
|
||||
}
|
||||
|
||||
Transform.prototype.push = function(chunk, encoding) {
|
||||
this._transformState.needTransform = false;
|
||||
return Duplex.prototype.push.call(this, chunk, encoding);
|
||||
};
|
||||
|
||||
// This is the part where you do stuff!
|
||||
// override this function in implementation classes.
|
||||
// 'chunk' is an input chunk.
|
||||
//
|
||||
// Call `push(newChunk)` to pass along transformed output
|
||||
// to the readable side. You may call 'push' zero or more times.
|
||||
//
|
||||
// Call `cb(err)` when you are done with this chunk. If you pass
|
||||
// an error, then that'll put the hurt on the whole operation. If you
|
||||
// never call cb(), then you'll never get another chunk.
|
||||
Transform.prototype._transform = function(chunk, encoding, cb) {
|
||||
throw new Error('not implemented');
|
||||
};
|
||||
|
||||
Transform.prototype._write = function(chunk, encoding, cb) {
|
||||
var ts = this._transformState;
|
||||
ts.writecb = cb;
|
||||
ts.writechunk = chunk;
|
||||
ts.writeencoding = encoding;
|
||||
if (!ts.transforming) {
|
||||
var rs = this._readableState;
|
||||
if (ts.needTransform ||
|
||||
rs.needReadable ||
|
||||
rs.length < rs.highWaterMark)
|
||||
this._read(rs.highWaterMark);
|
||||
}
|
||||
};
|
||||
|
||||
// Doesn't matter what the args are here.
|
||||
// _transform does all the work.
|
||||
// That we got here means that the readable side wants more data.
|
||||
Transform.prototype._read = function(n) {
|
||||
var ts = this._transformState;
|
||||
|
||||
if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
|
||||
ts.transforming = true;
|
||||
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
|
||||
} else {
|
||||
// mark that we need a transform, so that any data that comes in
|
||||
// will get processed, now that we've asked for it.
|
||||
ts.needTransform = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function done(stream, er) {
|
||||
if (er)
|
||||
return stream.emit('error', er);
|
||||
|
||||
// if there's nothing in the write buffer, then that means
|
||||
// that nothing more will ever be provided
|
||||
var ws = stream._writableState;
|
||||
var rs = stream._readableState;
|
||||
var ts = stream._transformState;
|
||||
|
||||
if (ws.length)
|
||||
throw new Error('calling transform done when ws.length != 0');
|
||||
|
||||
if (ts.transforming)
|
||||
throw new Error('calling transform done when still transforming');
|
||||
|
||||
return stream.push(null);
|
||||
}
|
||||
386
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js
generated
vendored
Normal file
386
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js
generated
vendored
Normal file
@@ -0,0 +1,386 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// A bit simpler than readable streams.
|
||||
// Implement an async ._write(chunk, cb), and it'll handle all
|
||||
// the drain event emission and buffering.
|
||||
|
||||
module.exports = Writable;
|
||||
|
||||
/*<replacement>*/
|
||||
var Buffer = require('buffer').Buffer;
|
||||
/*</replacement>*/
|
||||
|
||||
Writable.WritableState = WritableState;
|
||||
|
||||
|
||||
/*<replacement>*/
|
||||
var util = require('core-util-is');
|
||||
util.inherits = require('inherits');
|
||||
/*</replacement>*/
|
||||
|
||||
var Stream = require('stream');
|
||||
|
||||
util.inherits(Writable, Stream);
|
||||
|
||||
function WriteReq(chunk, encoding, cb) {
|
||||
this.chunk = chunk;
|
||||
this.encoding = encoding;
|
||||
this.callback = cb;
|
||||
}
|
||||
|
||||
function WritableState(options, stream) {
|
||||
options = options || {};
|
||||
|
||||
// the point at which write() starts returning false
|
||||
// Note: 0 is a valid value, means that we always return false if
|
||||
// the entire buffer is not flushed immediately on write()
|
||||
var hwm = options.highWaterMark;
|
||||
this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024;
|
||||
|
||||
// object stream flag to indicate whether or not this stream
|
||||
// contains buffers or objects.
|
||||
this.objectMode = !!options.objectMode;
|
||||
|
||||
// cast to ints.
|
||||
this.highWaterMark = ~~this.highWaterMark;
|
||||
|
||||
this.needDrain = false;
|
||||
// at the start of calling end()
|
||||
this.ending = false;
|
||||
// when end() has been called, and returned
|
||||
this.ended = false;
|
||||
// when 'finish' is emitted
|
||||
this.finished = false;
|
||||
|
||||
// should we decode strings into buffers before passing to _write?
|
||||
// this is here so that some node-core streams can optimize string
|
||||
// handling at a lower level.
|
||||
var noDecode = options.decodeStrings === false;
|
||||
this.decodeStrings = !noDecode;
|
||||
|
||||
// Crypto is kind of old and crusty. Historically, its default string
|
||||
// encoding is 'binary' so we have to make this configurable.
|
||||
// Everything else in the universe uses 'utf8', though.
|
||||
this.defaultEncoding = options.defaultEncoding || 'utf8';
|
||||
|
||||
// not an actual buffer we keep track of, but a measurement
|
||||
// of how much we're waiting to get pushed to some underlying
|
||||
// socket or file.
|
||||
this.length = 0;
|
||||
|
||||
// a flag to see when we're in the middle of a write.
|
||||
this.writing = false;
|
||||
|
||||
// a flag to be able to tell if the onwrite cb is called immediately,
|
||||
// or on a later tick. We set this to true at first, becuase any
|
||||
// actions that shouldn't happen until "later" should generally also
|
||||
// not happen before the first write call.
|
||||
this.sync = true;
|
||||
|
||||
// a flag to know if we're processing previously buffered items, which
|
||||
// may call the _write() callback in the same tick, so that we don't
|
||||
// end up in an overlapped onwrite situation.
|
||||
this.bufferProcessing = false;
|
||||
|
||||
// the callback that's passed to _write(chunk,cb)
|
||||
this.onwrite = function(er) {
|
||||
onwrite(stream, er);
|
||||
};
|
||||
|
||||
// the callback that the user supplies to write(chunk,encoding,cb)
|
||||
this.writecb = null;
|
||||
|
||||
// the amount that is being written when _write is called.
|
||||
this.writelen = 0;
|
||||
|
||||
this.buffer = [];
|
||||
|
||||
// True if the error was already emitted and should not be thrown again
|
||||
this.errorEmitted = false;
|
||||
}
|
||||
|
||||
function Writable(options) {
|
||||
var Duplex = require('./_stream_duplex');
|
||||
|
||||
// Writable ctor is applied to Duplexes, though they're not
|
||||
// instanceof Writable, they're instanceof Readable.
|
||||
if (!(this instanceof Writable) && !(this instanceof Duplex))
|
||||
return new Writable(options);
|
||||
|
||||
this._writableState = new WritableState(options, this);
|
||||
|
||||
// legacy.
|
||||
this.writable = true;
|
||||
|
||||
Stream.call(this);
|
||||
}
|
||||
|
||||
// Otherwise people can pipe Writable streams, which is just wrong.
|
||||
Writable.prototype.pipe = function() {
|
||||
this.emit('error', new Error('Cannot pipe. Not readable.'));
|
||||
};
|
||||
|
||||
|
||||
function writeAfterEnd(stream, state, cb) {
|
||||
var er = new Error('write after end');
|
||||
// TODO: defer error events consistently everywhere, not just the cb
|
||||
stream.emit('error', er);
|
||||
process.nextTick(function() {
|
||||
cb(er);
|
||||
});
|
||||
}
|
||||
|
||||
// If we get something that is not a buffer, string, null, or undefined,
|
||||
// and we're not in objectMode, then that's an error.
|
||||
// Otherwise stream chunks are all considered to be of length=1, and the
|
||||
// watermarks determine how many objects to keep in the buffer, rather than
|
||||
// how many bytes or characters.
|
||||
function validChunk(stream, state, chunk, cb) {
|
||||
var valid = true;
|
||||
if (!Buffer.isBuffer(chunk) &&
|
||||
'string' !== typeof chunk &&
|
||||
chunk !== null &&
|
||||
chunk !== undefined &&
|
||||
!state.objectMode) {
|
||||
var er = new TypeError('Invalid non-string/buffer chunk');
|
||||
stream.emit('error', er);
|
||||
process.nextTick(function() {
|
||||
cb(er);
|
||||
});
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
Writable.prototype.write = function(chunk, encoding, cb) {
|
||||
var state = this._writableState;
|
||||
var ret = false;
|
||||
|
||||
if (typeof encoding === 'function') {
|
||||
cb = encoding;
|
||||
encoding = null;
|
||||
}
|
||||
|
||||
if (Buffer.isBuffer(chunk))
|
||||
encoding = 'buffer';
|
||||
else if (!encoding)
|
||||
encoding = state.defaultEncoding;
|
||||
|
||||
if (typeof cb !== 'function')
|
||||
cb = function() {};
|
||||
|
||||
if (state.ended)
|
||||
writeAfterEnd(this, state, cb);
|
||||
else if (validChunk(this, state, chunk, cb))
|
||||
ret = writeOrBuffer(this, state, chunk, encoding, cb);
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
function decodeChunk(state, chunk, encoding) {
|
||||
if (!state.objectMode &&
|
||||
state.decodeStrings !== false &&
|
||||
typeof chunk === 'string') {
|
||||
chunk = new Buffer(chunk, encoding);
|
||||
}
|
||||
return chunk;
|
||||
}
|
||||
|
||||
// if we're already writing something, then just put this
|
||||
// in the queue, and wait our turn. Otherwise, call _write
|
||||
// If we return false, then we need a drain event, so set that flag.
|
||||
function writeOrBuffer(stream, state, chunk, encoding, cb) {
|
||||
chunk = decodeChunk(state, chunk, encoding);
|
||||
if (Buffer.isBuffer(chunk))
|
||||
encoding = 'buffer';
|
||||
var len = state.objectMode ? 1 : chunk.length;
|
||||
|
||||
state.length += len;
|
||||
|
||||
var ret = state.length < state.highWaterMark;
|
||||
// we must ensure that previous needDrain will not be reset to false.
|
||||
if (!ret)
|
||||
state.needDrain = true;
|
||||
|
||||
if (state.writing)
|
||||
state.buffer.push(new WriteReq(chunk, encoding, cb));
|
||||
else
|
||||
doWrite(stream, state, len, chunk, encoding, cb);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function doWrite(stream, state, len, chunk, encoding, cb) {
|
||||
state.writelen = len;
|
||||
state.writecb = cb;
|
||||
state.writing = true;
|
||||
state.sync = true;
|
||||
stream._write(chunk, encoding, state.onwrite);
|
||||
state.sync = false;
|
||||
}
|
||||
|
||||
function onwriteError(stream, state, sync, er, cb) {
|
||||
if (sync)
|
||||
process.nextTick(function() {
|
||||
cb(er);
|
||||
});
|
||||
else
|
||||
cb(er);
|
||||
|
||||
stream._writableState.errorEmitted = true;
|
||||
stream.emit('error', er);
|
||||
}
|
||||
|
||||
function onwriteStateUpdate(state) {
|
||||
state.writing = false;
|
||||
state.writecb = null;
|
||||
state.length -= state.writelen;
|
||||
state.writelen = 0;
|
||||
}
|
||||
|
||||
function onwrite(stream, er) {
|
||||
var state = stream._writableState;
|
||||
var sync = state.sync;
|
||||
var cb = state.writecb;
|
||||
|
||||
onwriteStateUpdate(state);
|
||||
|
||||
if (er)
|
||||
onwriteError(stream, state, sync, er, cb);
|
||||
else {
|
||||
// Check if we're actually ready to finish, but don't emit yet
|
||||
var finished = needFinish(stream, state);
|
||||
|
||||
if (!finished && !state.bufferProcessing && state.buffer.length)
|
||||
clearBuffer(stream, state);
|
||||
|
||||
if (sync) {
|
||||
process.nextTick(function() {
|
||||
afterWrite(stream, state, finished, cb);
|
||||
});
|
||||
} else {
|
||||
afterWrite(stream, state, finished, cb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function afterWrite(stream, state, finished, cb) {
|
||||
if (!finished)
|
||||
onwriteDrain(stream, state);
|
||||
cb();
|
||||
if (finished)
|
||||
finishMaybe(stream, state);
|
||||
}
|
||||
|
||||
// Must force callback to be called on nextTick, so that we don't
|
||||
// emit 'drain' before the write() consumer gets the 'false' return
|
||||
// value, and has a chance to attach a 'drain' listener.
|
||||
function onwriteDrain(stream, state) {
|
||||
if (state.length === 0 && state.needDrain) {
|
||||
state.needDrain = false;
|
||||
stream.emit('drain');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if there's something in the buffer waiting, then process it
|
||||
function clearBuffer(stream, state) {
|
||||
state.bufferProcessing = true;
|
||||
|
||||
for (var c = 0; c < state.buffer.length; c++) {
|
||||
var entry = state.buffer[c];
|
||||
var chunk = entry.chunk;
|
||||
var encoding = entry.encoding;
|
||||
var cb = entry.callback;
|
||||
var len = state.objectMode ? 1 : chunk.length;
|
||||
|
||||
doWrite(stream, state, len, chunk, encoding, cb);
|
||||
|
||||
// if we didn't call the onwrite immediately, then
|
||||
// it means that we need to wait until it does.
|
||||
// also, that means that the chunk and cb are currently
|
||||
// being processed, so move the buffer counter past them.
|
||||
if (state.writing) {
|
||||
c++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
state.bufferProcessing = false;
|
||||
if (c < state.buffer.length)
|
||||
state.buffer = state.buffer.slice(c);
|
||||
else
|
||||
state.buffer.length = 0;
|
||||
}
|
||||
|
||||
Writable.prototype._write = function(chunk, encoding, cb) {
|
||||
cb(new Error('not implemented'));
|
||||
};
|
||||
|
||||
Writable.prototype.end = function(chunk, encoding, cb) {
|
||||
var state = this._writableState;
|
||||
|
||||
if (typeof chunk === 'function') {
|
||||
cb = chunk;
|
||||
chunk = null;
|
||||
encoding = null;
|
||||
} else if (typeof encoding === 'function') {
|
||||
cb = encoding;
|
||||
encoding = null;
|
||||
}
|
||||
|
||||
if (typeof chunk !== 'undefined' && chunk !== null)
|
||||
this.write(chunk, encoding);
|
||||
|
||||
// ignore unnecessary end() calls.
|
||||
if (!state.ending && !state.finished)
|
||||
endWritable(this, state, cb);
|
||||
};
|
||||
|
||||
|
||||
function needFinish(stream, state) {
|
||||
return (state.ending &&
|
||||
state.length === 0 &&
|
||||
!state.finished &&
|
||||
!state.writing);
|
||||
}
|
||||
|
||||
function finishMaybe(stream, state) {
|
||||
var need = needFinish(stream, state);
|
||||
if (need) {
|
||||
state.finished = true;
|
||||
stream.emit('finish');
|
||||
}
|
||||
return need;
|
||||
}
|
||||
|
||||
function endWritable(stream, state, cb) {
|
||||
state.ending = true;
|
||||
finishMaybe(stream, state);
|
||||
if (cb) {
|
||||
if (state.finished)
|
||||
process.nextTick(cb);
|
||||
else
|
||||
stream.once('finish', cb);
|
||||
}
|
||||
state.ended = true;
|
||||
}
|
||||
19
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/LICENSE
generated
vendored
Normal file
19
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright Node.js contributors. All rights reserved.
|
||||
|
||||
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.
|
||||
3
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/README.md
generated
vendored
Normal file
3
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# core-util-is
|
||||
|
||||
The `util.is*` functions introduced in Node v0.12.
|
||||
604
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/float.patch
generated
vendored
Normal file
604
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/float.patch
generated
vendored
Normal file
@@ -0,0 +1,604 @@
|
||||
diff --git a/lib/util.js b/lib/util.js
|
||||
index a03e874..9074e8e 100644
|
||||
--- a/lib/util.js
|
||||
+++ b/lib/util.js
|
||||
@@ -19,430 +19,6 @@
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
-var formatRegExp = /%[sdj%]/g;
|
||||
-exports.format = function(f) {
|
||||
- if (!isString(f)) {
|
||||
- var objects = [];
|
||||
- for (var i = 0; i < arguments.length; i++) {
|
||||
- objects.push(inspect(arguments[i]));
|
||||
- }
|
||||
- return objects.join(' ');
|
||||
- }
|
||||
-
|
||||
- var i = 1;
|
||||
- var args = arguments;
|
||||
- var len = args.length;
|
||||
- var str = String(f).replace(formatRegExp, function(x) {
|
||||
- if (x === '%%') return '%';
|
||||
- if (i >= len) return x;
|
||||
- switch (x) {
|
||||
- case '%s': return String(args[i++]);
|
||||
- case '%d': return Number(args[i++]);
|
||||
- case '%j':
|
||||
- try {
|
||||
- return JSON.stringify(args[i++]);
|
||||
- } catch (_) {
|
||||
- return '[Circular]';
|
||||
- }
|
||||
- default:
|
||||
- return x;
|
||||
- }
|
||||
- });
|
||||
- for (var x = args[i]; i < len; x = args[++i]) {
|
||||
- if (isNull(x) || !isObject(x)) {
|
||||
- str += ' ' + x;
|
||||
- } else {
|
||||
- str += ' ' + inspect(x);
|
||||
- }
|
||||
- }
|
||||
- return str;
|
||||
-};
|
||||
-
|
||||
-
|
||||
-// Mark that a method should not be used.
|
||||
-// Returns a modified function which warns once by default.
|
||||
-// If --no-deprecation is set, then it is a no-op.
|
||||
-exports.deprecate = function(fn, msg) {
|
||||
- // Allow for deprecating things in the process of starting up.
|
||||
- if (isUndefined(global.process)) {
|
||||
- return function() {
|
||||
- return exports.deprecate(fn, msg).apply(this, arguments);
|
||||
- };
|
||||
- }
|
||||
-
|
||||
- if (process.noDeprecation === true) {
|
||||
- return fn;
|
||||
- }
|
||||
-
|
||||
- var warned = false;
|
||||
- function deprecated() {
|
||||
- if (!warned) {
|
||||
- if (process.throwDeprecation) {
|
||||
- throw new Error(msg);
|
||||
- } else if (process.traceDeprecation) {
|
||||
- console.trace(msg);
|
||||
- } else {
|
||||
- console.error(msg);
|
||||
- }
|
||||
- warned = true;
|
||||
- }
|
||||
- return fn.apply(this, arguments);
|
||||
- }
|
||||
-
|
||||
- return deprecated;
|
||||
-};
|
||||
-
|
||||
-
|
||||
-var debugs = {};
|
||||
-var debugEnviron;
|
||||
-exports.debuglog = function(set) {
|
||||
- if (isUndefined(debugEnviron))
|
||||
- debugEnviron = process.env.NODE_DEBUG || '';
|
||||
- set = set.toUpperCase();
|
||||
- if (!debugs[set]) {
|
||||
- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
||||
- var pid = process.pid;
|
||||
- debugs[set] = function() {
|
||||
- var msg = exports.format.apply(exports, arguments);
|
||||
- console.error('%s %d: %s', set, pid, msg);
|
||||
- };
|
||||
- } else {
|
||||
- debugs[set] = function() {};
|
||||
- }
|
||||
- }
|
||||
- return debugs[set];
|
||||
-};
|
||||
-
|
||||
-
|
||||
-/**
|
||||
- * Echos the value of a value. Trys to print the value out
|
||||
- * in the best way possible given the different types.
|
||||
- *
|
||||
- * @param {Object} obj The object to print out.
|
||||
- * @param {Object} opts Optional options object that alters the output.
|
||||
- */
|
||||
-/* legacy: obj, showHidden, depth, colors*/
|
||||
-function inspect(obj, opts) {
|
||||
- // default options
|
||||
- var ctx = {
|
||||
- seen: [],
|
||||
- stylize: stylizeNoColor
|
||||
- };
|
||||
- // legacy...
|
||||
- if (arguments.length >= 3) ctx.depth = arguments[2];
|
||||
- if (arguments.length >= 4) ctx.colors = arguments[3];
|
||||
- if (isBoolean(opts)) {
|
||||
- // legacy...
|
||||
- ctx.showHidden = opts;
|
||||
- } else if (opts) {
|
||||
- // got an "options" object
|
||||
- exports._extend(ctx, opts);
|
||||
- }
|
||||
- // set default options
|
||||
- if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
||||
- if (isUndefined(ctx.depth)) ctx.depth = 2;
|
||||
- if (isUndefined(ctx.colors)) ctx.colors = false;
|
||||
- if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
||||
- if (ctx.colors) ctx.stylize = stylizeWithColor;
|
||||
- return formatValue(ctx, obj, ctx.depth);
|
||||
-}
|
||||
-exports.inspect = inspect;
|
||||
-
|
||||
-
|
||||
-// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
|
||||
-inspect.colors = {
|
||||
- 'bold' : [1, 22],
|
||||
- 'italic' : [3, 23],
|
||||
- 'underline' : [4, 24],
|
||||
- 'inverse' : [7, 27],
|
||||
- 'white' : [37, 39],
|
||||
- 'grey' : [90, 39],
|
||||
- 'black' : [30, 39],
|
||||
- 'blue' : [34, 39],
|
||||
- 'cyan' : [36, 39],
|
||||
- 'green' : [32, 39],
|
||||
- 'magenta' : [35, 39],
|
||||
- 'red' : [31, 39],
|
||||
- 'yellow' : [33, 39]
|
||||
-};
|
||||
-
|
||||
-// Don't use 'blue' not visible on cmd.exe
|
||||
-inspect.styles = {
|
||||
- 'special': 'cyan',
|
||||
- 'number': 'yellow',
|
||||
- 'boolean': 'yellow',
|
||||
- 'undefined': 'grey',
|
||||
- 'null': 'bold',
|
||||
- 'string': 'green',
|
||||
- 'date': 'magenta',
|
||||
- // "name": intentionally not styling
|
||||
- 'regexp': 'red'
|
||||
-};
|
||||
-
|
||||
-
|
||||
-function stylizeWithColor(str, styleType) {
|
||||
- var style = inspect.styles[styleType];
|
||||
-
|
||||
- if (style) {
|
||||
- return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
||||
- '\u001b[' + inspect.colors[style][1] + 'm';
|
||||
- } else {
|
||||
- return str;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function stylizeNoColor(str, styleType) {
|
||||
- return str;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function arrayToHash(array) {
|
||||
- var hash = {};
|
||||
-
|
||||
- array.forEach(function(val, idx) {
|
||||
- hash[val] = true;
|
||||
- });
|
||||
-
|
||||
- return hash;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatValue(ctx, value, recurseTimes) {
|
||||
- // Provide a hook for user-specified inspect functions.
|
||||
- // Check that value is an object with an inspect function on it
|
||||
- if (ctx.customInspect &&
|
||||
- value &&
|
||||
- isFunction(value.inspect) &&
|
||||
- // Filter out the util module, it's inspect function is special
|
||||
- value.inspect !== exports.inspect &&
|
||||
- // Also filter out any prototype objects using the circular check.
|
||||
- !(value.constructor && value.constructor.prototype === value)) {
|
||||
- var ret = value.inspect(recurseTimes, ctx);
|
||||
- if (!isString(ret)) {
|
||||
- ret = formatValue(ctx, ret, recurseTimes);
|
||||
- }
|
||||
- return ret;
|
||||
- }
|
||||
-
|
||||
- // Primitive types cannot have properties
|
||||
- var primitive = formatPrimitive(ctx, value);
|
||||
- if (primitive) {
|
||||
- return primitive;
|
||||
- }
|
||||
-
|
||||
- // Look up the keys of the object.
|
||||
- var keys = Object.keys(value);
|
||||
- var visibleKeys = arrayToHash(keys);
|
||||
-
|
||||
- if (ctx.showHidden) {
|
||||
- keys = Object.getOwnPropertyNames(value);
|
||||
- }
|
||||
-
|
||||
- // Some type of object without properties can be shortcutted.
|
||||
- if (keys.length === 0) {
|
||||
- if (isFunction(value)) {
|
||||
- var name = value.name ? ': ' + value.name : '';
|
||||
- return ctx.stylize('[Function' + name + ']', 'special');
|
||||
- }
|
||||
- if (isRegExp(value)) {
|
||||
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||
- }
|
||||
- if (isDate(value)) {
|
||||
- return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
||||
- }
|
||||
- if (isError(value)) {
|
||||
- return formatError(value);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- var base = '', array = false, braces = ['{', '}'];
|
||||
-
|
||||
- // Make Array say that they are Array
|
||||
- if (isArray(value)) {
|
||||
- array = true;
|
||||
- braces = ['[', ']'];
|
||||
- }
|
||||
-
|
||||
- // Make functions say that they are functions
|
||||
- if (isFunction(value)) {
|
||||
- var n = value.name ? ': ' + value.name : '';
|
||||
- base = ' [Function' + n + ']';
|
||||
- }
|
||||
-
|
||||
- // Make RegExps say that they are RegExps
|
||||
- if (isRegExp(value)) {
|
||||
- base = ' ' + RegExp.prototype.toString.call(value);
|
||||
- }
|
||||
-
|
||||
- // Make dates with properties first say the date
|
||||
- if (isDate(value)) {
|
||||
- base = ' ' + Date.prototype.toUTCString.call(value);
|
||||
- }
|
||||
-
|
||||
- // Make error with message first say the error
|
||||
- if (isError(value)) {
|
||||
- base = ' ' + formatError(value);
|
||||
- }
|
||||
-
|
||||
- if (keys.length === 0 && (!array || value.length == 0)) {
|
||||
- return braces[0] + base + braces[1];
|
||||
- }
|
||||
-
|
||||
- if (recurseTimes < 0) {
|
||||
- if (isRegExp(value)) {
|
||||
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||
- } else {
|
||||
- return ctx.stylize('[Object]', 'special');
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- ctx.seen.push(value);
|
||||
-
|
||||
- var output;
|
||||
- if (array) {
|
||||
- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
||||
- } else {
|
||||
- output = keys.map(function(key) {
|
||||
- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
||||
- });
|
||||
- }
|
||||
-
|
||||
- ctx.seen.pop();
|
||||
-
|
||||
- return reduceToSingleString(output, base, braces);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatPrimitive(ctx, value) {
|
||||
- if (isUndefined(value))
|
||||
- return ctx.stylize('undefined', 'undefined');
|
||||
- if (isString(value)) {
|
||||
- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
||||
- .replace(/'/g, "\\'")
|
||||
- .replace(/\\"/g, '"') + '\'';
|
||||
- return ctx.stylize(simple, 'string');
|
||||
- }
|
||||
- if (isNumber(value)) {
|
||||
- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0,
|
||||
- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 .
|
||||
- if (value === 0 && 1 / value < 0)
|
||||
- return ctx.stylize('-0', 'number');
|
||||
- return ctx.stylize('' + value, 'number');
|
||||
- }
|
||||
- if (isBoolean(value))
|
||||
- return ctx.stylize('' + value, 'boolean');
|
||||
- // For some reason typeof null is "object", so special case here.
|
||||
- if (isNull(value))
|
||||
- return ctx.stylize('null', 'null');
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatError(value) {
|
||||
- return '[' + Error.prototype.toString.call(value) + ']';
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
||||
- var output = [];
|
||||
- for (var i = 0, l = value.length; i < l; ++i) {
|
||||
- if (hasOwnProperty(value, String(i))) {
|
||||
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||
- String(i), true));
|
||||
- } else {
|
||||
- output.push('');
|
||||
- }
|
||||
- }
|
||||
- keys.forEach(function(key) {
|
||||
- if (!key.match(/^\d+$/)) {
|
||||
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||
- key, true));
|
||||
- }
|
||||
- });
|
||||
- return output;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
||||
- var name, str, desc;
|
||||
- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
||||
- if (desc.get) {
|
||||
- if (desc.set) {
|
||||
- str = ctx.stylize('[Getter/Setter]', 'special');
|
||||
- } else {
|
||||
- str = ctx.stylize('[Getter]', 'special');
|
||||
- }
|
||||
- } else {
|
||||
- if (desc.set) {
|
||||
- str = ctx.stylize('[Setter]', 'special');
|
||||
- }
|
||||
- }
|
||||
- if (!hasOwnProperty(visibleKeys, key)) {
|
||||
- name = '[' + key + ']';
|
||||
- }
|
||||
- if (!str) {
|
||||
- if (ctx.seen.indexOf(desc.value) < 0) {
|
||||
- if (isNull(recurseTimes)) {
|
||||
- str = formatValue(ctx, desc.value, null);
|
||||
- } else {
|
||||
- str = formatValue(ctx, desc.value, recurseTimes - 1);
|
||||
- }
|
||||
- if (str.indexOf('\n') > -1) {
|
||||
- if (array) {
|
||||
- str = str.split('\n').map(function(line) {
|
||||
- return ' ' + line;
|
||||
- }).join('\n').substr(2);
|
||||
- } else {
|
||||
- str = '\n' + str.split('\n').map(function(line) {
|
||||
- return ' ' + line;
|
||||
- }).join('\n');
|
||||
- }
|
||||
- }
|
||||
- } else {
|
||||
- str = ctx.stylize('[Circular]', 'special');
|
||||
- }
|
||||
- }
|
||||
- if (isUndefined(name)) {
|
||||
- if (array && key.match(/^\d+$/)) {
|
||||
- return str;
|
||||
- }
|
||||
- name = JSON.stringify('' + key);
|
||||
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
||||
- name = name.substr(1, name.length - 2);
|
||||
- name = ctx.stylize(name, 'name');
|
||||
- } else {
|
||||
- name = name.replace(/'/g, "\\'")
|
||||
- .replace(/\\"/g, '"')
|
||||
- .replace(/(^"|"$)/g, "'");
|
||||
- name = ctx.stylize(name, 'string');
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return name + ': ' + str;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function reduceToSingleString(output, base, braces) {
|
||||
- var numLinesEst = 0;
|
||||
- var length = output.reduce(function(prev, cur) {
|
||||
- numLinesEst++;
|
||||
- if (cur.indexOf('\n') >= 0) numLinesEst++;
|
||||
- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
||||
- }, 0);
|
||||
-
|
||||
- if (length > 60) {
|
||||
- return braces[0] +
|
||||
- (base === '' ? '' : base + '\n ') +
|
||||
- ' ' +
|
||||
- output.join(',\n ') +
|
||||
- ' ' +
|
||||
- braces[1];
|
||||
- }
|
||||
-
|
||||
- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
||||
-}
|
||||
-
|
||||
-
|
||||
// NOTE: These type checking functions intentionally don't use `instanceof`
|
||||
// because it is fragile and can be easily faked with `Object.create()`.
|
||||
function isArray(ar) {
|
||||
@@ -522,166 +98,10 @@ function isPrimitive(arg) {
|
||||
exports.isPrimitive = isPrimitive;
|
||||
|
||||
function isBuffer(arg) {
|
||||
- return arg instanceof Buffer;
|
||||
+ return Buffer.isBuffer(arg);
|
||||
}
|
||||
exports.isBuffer = isBuffer;
|
||||
|
||||
function objectToString(o) {
|
||||
return Object.prototype.toString.call(o);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function pad(n) {
|
||||
- return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
||||
- 'Oct', 'Nov', 'Dec'];
|
||||
-
|
||||
-// 26 Feb 16:19:34
|
||||
-function timestamp() {
|
||||
- var d = new Date();
|
||||
- var time = [pad(d.getHours()),
|
||||
- pad(d.getMinutes()),
|
||||
- pad(d.getSeconds())].join(':');
|
||||
- return [d.getDate(), months[d.getMonth()], time].join(' ');
|
||||
-}
|
||||
-
|
||||
-
|
||||
-// log is just a thin wrapper to console.log that prepends a timestamp
|
||||
-exports.log = function() {
|
||||
- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
|
||||
-};
|
||||
-
|
||||
-
|
||||
-/**
|
||||
- * Inherit the prototype methods from one constructor into another.
|
||||
- *
|
||||
- * The Function.prototype.inherits from lang.js rewritten as a standalone
|
||||
- * function (not on Function.prototype). NOTE: If this file is to be loaded
|
||||
- * during bootstrapping this function needs to be rewritten using some native
|
||||
- * functions as prototype setup using normal JavaScript does not work as
|
||||
- * expected during bootstrapping (see mirror.js in r114903).
|
||||
- *
|
||||
- * @param {function} ctor Constructor function which needs to inherit the
|
||||
- * prototype.
|
||||
- * @param {function} superCtor Constructor function to inherit prototype from.
|
||||
- */
|
||||
-exports.inherits = function(ctor, superCtor) {
|
||||
- ctor.super_ = superCtor;
|
||||
- ctor.prototype = Object.create(superCtor.prototype, {
|
||||
- constructor: {
|
||||
- value: ctor,
|
||||
- enumerable: false,
|
||||
- writable: true,
|
||||
- configurable: true
|
||||
- }
|
||||
- });
|
||||
-};
|
||||
-
|
||||
-exports._extend = function(origin, add) {
|
||||
- // Don't do anything if add isn't an object
|
||||
- if (!add || !isObject(add)) return origin;
|
||||
-
|
||||
- var keys = Object.keys(add);
|
||||
- var i = keys.length;
|
||||
- while (i--) {
|
||||
- origin[keys[i]] = add[keys[i]];
|
||||
- }
|
||||
- return origin;
|
||||
-};
|
||||
-
|
||||
-function hasOwnProperty(obj, prop) {
|
||||
- return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-// Deprecated old stuff.
|
||||
-
|
||||
-exports.p = exports.deprecate(function() {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- console.error(exports.inspect(arguments[i]));
|
||||
- }
|
||||
-}, 'util.p: Use console.error() instead');
|
||||
-
|
||||
-
|
||||
-exports.exec = exports.deprecate(function() {
|
||||
- return require('child_process').exec.apply(this, arguments);
|
||||
-}, 'util.exec is now called `child_process.exec`.');
|
||||
-
|
||||
-
|
||||
-exports.print = exports.deprecate(function() {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- process.stdout.write(String(arguments[i]));
|
||||
- }
|
||||
-}, 'util.print: Use console.log instead');
|
||||
-
|
||||
-
|
||||
-exports.puts = exports.deprecate(function() {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- process.stdout.write(arguments[i] + '\n');
|
||||
- }
|
||||
-}, 'util.puts: Use console.log instead');
|
||||
-
|
||||
-
|
||||
-exports.debug = exports.deprecate(function(x) {
|
||||
- process.stderr.write('DEBUG: ' + x + '\n');
|
||||
-}, 'util.debug: Use console.error instead');
|
||||
-
|
||||
-
|
||||
-exports.error = exports.deprecate(function(x) {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- process.stderr.write(arguments[i] + '\n');
|
||||
- }
|
||||
-}, 'util.error: Use console.error instead');
|
||||
-
|
||||
-
|
||||
-exports.pump = exports.deprecate(function(readStream, writeStream, callback) {
|
||||
- var callbackCalled = false;
|
||||
-
|
||||
- function call(a, b, c) {
|
||||
- if (callback && !callbackCalled) {
|
||||
- callback(a, b, c);
|
||||
- callbackCalled = true;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- readStream.addListener('data', function(chunk) {
|
||||
- if (writeStream.write(chunk) === false) readStream.pause();
|
||||
- });
|
||||
-
|
||||
- writeStream.addListener('drain', function() {
|
||||
- readStream.resume();
|
||||
- });
|
||||
-
|
||||
- readStream.addListener('end', function() {
|
||||
- writeStream.end();
|
||||
- });
|
||||
-
|
||||
- readStream.addListener('close', function() {
|
||||
- call();
|
||||
- });
|
||||
-
|
||||
- readStream.addListener('error', function(err) {
|
||||
- writeStream.end();
|
||||
- call(err);
|
||||
- });
|
||||
-
|
||||
- writeStream.addListener('error', function(err) {
|
||||
- readStream.destroy();
|
||||
- call(err);
|
||||
- });
|
||||
-}, 'util.pump(): Use readableStream.pipe() instead');
|
||||
-
|
||||
-
|
||||
-var uv;
|
||||
-exports._errnoException = function(err, syscall) {
|
||||
- if (isUndefined(uv)) uv = process.binding('uv');
|
||||
- var errname = uv.errname(err);
|
||||
- var e = new Error(syscall + ' ' + errname);
|
||||
- e.code = errname;
|
||||
- e.errno = errname;
|
||||
- e.syscall = syscall;
|
||||
- return e;
|
||||
-};
|
||||
+}
|
||||
107
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js
generated
vendored
Normal file
107
node_modules/twit/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
// NOTE: These type checking functions intentionally don't use `instanceof`
|
||||
// because it is fragile and can be easily faked with `Object.create()`.
|
||||
|
||||
function isArray(arg) {
|
||||
if (Array.isArray) {
|
||||
return Array.isArray(arg);
|
||||
}
|
||||
return objectToString(arg) === '[object Array]';
|
||||
}
|
||||
exports.isArray = isArray;
|
||||
|
||||
function isBoolean(arg) {
|
||||
return typeof arg === 'boolean';
|
||||
}
|
||||
exports.isBoolean = isBoolean;
|
||||
|
||||
function isNull(arg) {
|
||||
return arg === null;
|
||||
}
|
||||
exports.isNull = isNull;
|
||||
|
||||
function isNullOrUndefined(arg) {
|
||||
return arg == null;
|
||||
}
|
||||
exports.isNullOrUndefined = isNullOrUndefined;
|
||||
|
||||
function isNumber(arg) {
|
||||
return typeof arg === 'number';
|
||||
}
|
||||
exports.isNumber = isNumber;
|
||||
|
||||
function isString(arg) {
|
||||
return typeof arg === 'string';
|
||||
}
|
||||
exports.isString = isString;
|
||||
|
||||
function isSymbol(arg) {
|
||||
return typeof arg === 'symbol';
|
||||
}
|
||||
exports.isSymbol = isSymbol;
|
||||
|
||||
function isUndefined(arg) {
|
||||
return arg === void 0;
|
||||
}
|
||||
exports.isUndefined = isUndefined;
|
||||
|
||||
function isRegExp(re) {
|
||||
return objectToString(re) === '[object RegExp]';
|
||||
}
|
||||
exports.isRegExp = isRegExp;
|
||||
|
||||
function isObject(arg) {
|
||||
return typeof arg === 'object' && arg !== null;
|
||||
}
|
||||
exports.isObject = isObject;
|
||||
|
||||
function isDate(d) {
|
||||
return objectToString(d) === '[object Date]';
|
||||
}
|
||||
exports.isDate = isDate;
|
||||
|
||||
function isError(e) {
|
||||
return (objectToString(e) === '[object Error]' || e instanceof Error);
|
||||
}
|
||||
exports.isError = isError;
|
||||
|
||||
function isFunction(arg) {
|
||||
return typeof arg === 'function';
|
||||
}
|
||||
exports.isFunction = isFunction;
|
||||
|
||||
function isPrimitive(arg) {
|
||||
return arg === null ||
|
||||
typeof arg === 'boolean' ||
|
||||
typeof arg === 'number' ||
|
||||
typeof arg === 'string' ||
|
||||
typeof arg === 'symbol' || // ES6 symbol
|
||||
typeof arg === 'undefined';
|
||||
}
|
||||
exports.isPrimitive = isPrimitive;
|
||||
|
||||
exports.isBuffer = Buffer.isBuffer;
|
||||
|
||||
function objectToString(o) {
|
||||
return Object.prototype.toString.call(o);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user