Update Bluebird to 2.9.6

This commit is contained in:
Dan Stillman 2015-02-03 15:28:54 -05:00
parent 66a6272adc
commit d660a84f47

View file

@ -23,7 +23,7 @@
* *
*/ */
/** /**
* bluebird build version 2.9.3 * bluebird build version 2.9.6
* Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, progress, cancel, using, filter, any, each, timers * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, progress, cancel, using, filter, any, each, timers
*/ */
!function(e){ !function(e){
@ -93,8 +93,8 @@
}); });
return; return;
if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
"use strict"; "use strict";
module.exports = function(Promise) { module.exports = function(Promise) {
var SomePromiseArray = Promise._SomePromiseArray; var SomePromiseArray = Promise._SomePromiseArray;
@ -329,17 +329,21 @@ var getMethodCaller;
var getGetter; var getGetter;
if (!true) { if (!true) {
var makeMethodCaller = function (methodName) { var makeMethodCaller = function (methodName) {
return new Function("obj", " \n\ return new Function("ensureMethod", " \n\
'use strict' \n\ return function(obj) { \n\
var len = this.length; \n\ 'use strict' \n\
switch(len) { \n\ var len = this.length; \n\
case 1: return obj.methodName(this[0]); \n\ ensureMethod(obj, 'methodName'); \n\
case 2: return obj.methodName(this[0], this[1]); \n\ switch(len) { \n\
case 3: return obj.methodName(this[0], this[1], this[2]); \n\ case 1: return obj.methodName(this[0]); \n\
case 0: return obj.methodName(); \n\ case 2: return obj.methodName(this[0], this[1]); \n\
default: return obj.methodName.apply(obj, this); \n\ case 3: return obj.methodName(this[0], this[1], this[2]); \n\
} \n\ case 0: return obj.methodName(); \n\
".replace(/methodName/g, methodName)); default: \n\
return obj.methodName.apply(obj, this); \n\
} \n\
}; \n\
".replace(/methodName/g, methodName))(ensureMethod);
}; };
var makeGetter = function (propertyName) { var makeGetter = function (propertyName) {
@ -376,8 +380,21 @@ getGetter = function(name) {
}; };
} }
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) { function caller(obj) {
return obj[this.pop()].apply(obj, this); var methodName = this.pop();
var fn = ensureMethod(obj, methodName);
return fn.apply(obj, this);
} }
Promise.prototype.call = function (methodName) { Promise.prototype.call = function (methodName) {
var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];} var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];}
@ -472,7 +489,7 @@ Promise.prototype.fork = function (didFulfill, didReject, didProgress) {
"use strict"; "use strict";
module.exports = function() { module.exports = function() {
var async = _dereq_("./async.js"); var async = _dereq_("./async.js");
var inherits = _dereq_("./util.js").inherits; var util = _dereq_("./util.js");
var bluebirdFramePattern = var bluebirdFramePattern =
/[\\\/]bluebird[\\\/]js[\\\/](main|debug|zalgo|instrumented)/; /[\\\/]bluebird[\\\/]js[\\\/](main|debug|zalgo|instrumented)/;
var stackFramePattern = null; var stackFramePattern = null;
@ -485,7 +502,7 @@ function CapturedTrace(parent) {
captureStackTrace(this, CapturedTrace); captureStackTrace(this, CapturedTrace);
if (length > 32) this.uncycle(); if (length > 32) this.uncycle();
} }
inherits(CapturedTrace, Error); util.inherits(CapturedTrace, Error);
CapturedTrace.prototype.uncycle = function() { CapturedTrace.prototype.uncycle = function() {
var length = this._length; var length = this._length;
@ -882,9 +899,7 @@ var captureStackTrace = (function stackDetection() {
var fireDomEvent; var fireDomEvent;
var fireGlobalEvent = (function() { var fireGlobalEvent = (function() {
if (typeof process !== "undefined" && if (util.isNode) {
typeof process.version === "string" &&
typeof window === "undefined") {
return function(name, reason, promise) { return function(name, reason, promise) {
if (name === "rejectionHandled") { if (name === "rejectionHandled") {
return process.emit(name, promise); return process.emit(name, promise);
@ -1061,17 +1076,14 @@ return createContext;
"use strict"; "use strict";
module.exports = function(Promise, CapturedTrace) { module.exports = function(Promise, CapturedTrace) {
var async = _dereq_("./async.js"); var async = _dereq_("./async.js");
var Warning = _dereq_("./errors.js").Warning;
var util = _dereq_("./util.js"); var util = _dereq_("./util.js");
var canAttachTrace = util.canAttachTrace; var canAttachTrace = util.canAttachTrace;
var unhandledRejectionHandled; var unhandledRejectionHandled;
var possiblyUnhandledRejection; var possiblyUnhandledRejection;
var debugging = false || !!( var debugging = false || (util.isNode &&
typeof process !== "undefined" && (!!process.env["BLUEBIRD_DEBUG"] ||
typeof process.execPath === "string" && process.env["NODE_ENV"] === "development"));
typeof process.env === "object" &&
(process.env["BLUEBIRD_DEBUG"] ||
process.env["NODE_ENV"] === "development")
);
Promise.prototype._ensurePossibleRejectionHandled = function () { Promise.prototype._ensurePossibleRejectionHandled = function () {
this._setRejectionIsUnhandled(); this._setRejectionIsUnhandled();
@ -1158,6 +1170,18 @@ Promise.prototype._attachExtraTrace = function (error, ignoreSelf) {
} }
}; };
Promise.prototype._warn = function(message) {
var warning = new Warning(message);
var ctx = this._peekContext();
if (ctx) {
ctx.attachExtraTrace(warning);
} else {
var parsed = CapturedTrace.parseStackAndMessage(warning);
warning.stack = parsed.message + "\n" + parsed.stack.join("\n");
}
CapturedTrace.formatAndLogError(warning, "");
};
Promise.onPossiblyUnhandledRejection = function (fn) { Promise.onPossiblyUnhandledRejection = function (fn) {
possiblyUnhandledRejection = typeof fn === "function" ? fn : undefined; possiblyUnhandledRejection = typeof fn === "function" ? fn : undefined;
}; };
@ -1189,7 +1213,7 @@ return function() {
}; };
}; };
},{"./async.js":2,"./util.js":38}],11:[function(_dereq_,module,exports){ },{"./async.js":2,"./errors.js":13,"./util.js":38}],11:[function(_dereq_,module,exports){
"use strict"; "use strict";
var util = _dereq_("./util.js"); var util = _dereq_("./util.js");
var isPrimitive = util.isPrimitive; var isPrimitive = util.isPrimitive;
@ -1274,6 +1298,8 @@ function subError(nameProperty, defaultMessage) {
notEnumerableProp(this, "name", nameProperty); notEnumerableProp(this, "name", nameProperty);
if (Error.captureStackTrace) { if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor); Error.captureStackTrace(this, this.constructor);
} else {
Error.call(this);
} }
} }
inherits(SubError, Error); inherits(SubError, Error);
@ -1281,6 +1307,7 @@ function subError(nameProperty, defaultMessage) {
} }
var _TypeError, _RangeError; var _TypeError, _RangeError;
var Warning = subError("Warning", "warning");
var CancellationError = subError("CancellationError", "cancellation error"); var CancellationError = subError("CancellationError", "cancellation error");
var TimeoutError = subError("TimeoutError", "timeout error"); var TimeoutError = subError("TimeoutError", "timeout error");
var AggregateError = subError("AggregateError", "aggregate error"); var AggregateError = subError("AggregateError", "aggregate error");
@ -1359,7 +1386,8 @@ module.exports = {
CancellationError: errorTypes.CancellationError, CancellationError: errorTypes.CancellationError,
OperationalError: errorTypes.OperationalError, OperationalError: errorTypes.OperationalError,
TimeoutError: errorTypes.TimeoutError, TimeoutError: errorTypes.TimeoutError,
AggregateError: errorTypes.AggregateError AggregateError: errorTypes.AggregateError,
Warning: Warning
}; };
},{"./es5.js":14,"./util.js":38}],14:[function(_dereq_,module,exports){ },{"./es5.js":14,"./util.js":38}],14:[function(_dereq_,module,exports){
@ -2152,7 +2180,6 @@ var PromiseResolver = _dereq_("./promise_resolver.js");
var nodebackForPromise = PromiseResolver._nodebackForPromise; var nodebackForPromise = PromiseResolver._nodebackForPromise;
var errorObj = util.errorObj; var errorObj = util.errorObj;
var tryCatch = util.tryCatch; var tryCatch = util.tryCatch;
function Promise(resolver) { function Promise(resolver) {
if (typeof resolver !== "function") { if (typeof resolver !== "function") {
throw new TypeError("the promise constructor requires a resolver function\u000a\u000a See http://goo.gl/EC22Yn\u000a"); throw new TypeError("the promise constructor requires a resolver function\u000a\u000a See http://goo.gl/EC22Yn\u000a");
@ -2203,11 +2230,20 @@ Promise.prototype.reflect = function () {
}; };
Promise.prototype.then = function (didFulfill, didReject, didProgress) { Promise.prototype.then = function (didFulfill, didReject, didProgress) {
if (isDebugging() && 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, didProgress, return this._then(didFulfill, didReject, didProgress,
undefined, undefined); undefined, undefined);
}; };
Promise.prototype.done = function (didFulfill, didReject, didProgress) { Promise.prototype.done = function (didFulfill, didReject, didProgress) {
var promise = this._then(didFulfill, didReject, didProgress, var promise = this._then(didFulfill, didReject, didProgress,
undefined, undefined); undefined, undefined);
@ -3775,7 +3811,7 @@ Promise.reduce = function (promises, fn, initialValue, _each) {
},{"./util.js":38}],31:[function(_dereq_,module,exports){ },{"./util.js":38}],31:[function(_dereq_,module,exports){
"use strict"; "use strict";
var schedule; var schedule;
if (typeof process === "object" && typeof process.version === "string") { if (_dereq_("./util.js").isNode) {
var version = process.version.split(".").map(Number); var version = process.version.split(".").map(Number);
schedule = (version[0] === 0 && version[1] > 10) || (version[0] > 0) schedule = (version[0] === 0 && version[1] > 10) || (version[0] > 0)
? global.setImmediate : process.nextTick; ? global.setImmediate : process.nextTick;
@ -3801,7 +3837,7 @@ else {
} }
module.exports = schedule; module.exports = schedule;
},{}],32:[function(_dereq_,module,exports){ },{"./util.js":38}],32:[function(_dereq_,module,exports){
"use strict"; "use strict";
module.exports = module.exports =
function(Promise, PromiseArray) { function(Promise, PromiseArray) {
@ -4194,12 +4230,16 @@ Promise.prototype.delay = function (ms) {
}; };
function successClear(value) { function successClear(value) {
clearTimeout(+this); var handle = this;
if (handle instanceof Number) handle = +handle;
clearTimeout(handle);
return value; return value;
} }
function failureClear(reason) { function failureClear(reason) {
clearTimeout(+this); var handle = this;
if (handle instanceof Number) handle = +handle;
clearTimeout(handle);
throw reason; throw reason;
} }
@ -4653,6 +4693,10 @@ var ensureErrorObject = (function() {
} }
})(); })();
function classString(obj) {
return {}.toString.call(obj);
}
var ret = { var ret = {
isClass: isClass, isClass: isClass,
isIdentifier: isIdentifier, isIdentifier: isIdentifier,
@ -4678,7 +4722,10 @@ var ret = {
canAttachTrace: canAttachTrace, canAttachTrace: canAttachTrace,
ensureErrorObject: ensureErrorObject, ensureErrorObject: ensureErrorObject,
originatesFromRejection: originatesFromRejection, originatesFromRejection: originatesFromRejection,
markAsOriginatingFromRejection: markAsOriginatingFromRejection markAsOriginatingFromRejection: markAsOriginatingFromRejection,
classString: classString,
isNode: typeof process !== "undefined" &&
classString(process).toLowerCase() === "[object process]"
}; };
try {throw new Error(); } catch (e) {ret.lastLineError = e;} try {throw new Error(); } catch (e) {ret.lastLineError = e;}
module.exports = ret; module.exports = ret;