You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2015/11/30 10:37:29 UTC
[47/51] [abbrv] [partial] couchdb-nmo git commit: Remove node_modules
from repo
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/call_get.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/call_get.js b/node_modules/bluebird/js/main/call_get.js
deleted file mode 100644
index 62c166d..0000000
--- a/node_modules/bluebird/js/main/call_get.js
+++ /dev/null
@@ -1,123 +0,0 @@
-"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.js");
-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($_len - 1); 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);
-};
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/cancel.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/cancel.js b/node_modules/bluebird/js/main/cancel.js
deleted file mode 100644
index 9eb40b6..0000000
--- a/node_modules/bluebird/js/main/cancel.js
+++ /dev/null
@@ -1,48 +0,0 @@
-"use strict";
-module.exports = function(Promise) {
-var errors = require("./errors.js");
-var async = require("./async.js");
-var CancellationError = errors.CancellationError;
-
-Promise.prototype._cancel = function (reason) {
- if (!this.isCancellable()) return this;
- var parent;
- var promiseToReject = this;
- while ((parent = promiseToReject._cancellationParent) !== undefined &&
- parent.isCancellable()) {
- promiseToReject = parent;
- }
- this._unsetCancellable();
- promiseToReject._target()._rejectCallback(reason, false, true);
-};
-
-Promise.prototype.cancel = function (reason) {
- if (!this.isCancellable()) return this;
- if (reason === undefined) reason = new CancellationError();
- async.invokeLater(this._cancel, this, reason);
- return this;
-};
-
-Promise.prototype.cancellable = function () {
- if (this._cancellable()) return this;
- async.enableTrampoline();
- this._setCancellable();
- this._cancellationParent = undefined;
- return this;
-};
-
-Promise.prototype.uncancellable = function () {
- var ret = this.then();
- ret._unsetCancellable();
- return ret;
-};
-
-Promise.prototype.fork = function (didFulfill, didReject, didProgress) {
- var ret = this._then(didFulfill, didReject, didProgress,
- undefined, undefined);
-
- ret._setCancellable();
- ret._cancellationParent = undefined;
- return ret;
-};
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/captured_trace.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/captured_trace.js b/node_modules/bluebird/js/main/captured_trace.js
deleted file mode 100644
index 6fda9e8..0000000
--- a/node_modules/bluebird/js/main/captured_trace.js
+++ /dev/null
@@ -1,492 +0,0 @@
-"use strict";
-module.exports = function() {
-var async = require("./async.js");
-var util = require("./util.js");
-var bluebirdFramePattern =
- /[\\\/]bluebird[\\\/]js[\\\/](main|debug|zalgo|instrumented)/;
-var stackFramePattern = null;
-var formatStack = null;
-var indentStackFrames = false;
-var warn;
-
-function CapturedTrace(parent) {
- this._parent = parent;
- var length = this._length = 1 + (parent === undefined ? 0 : parent._length);
- captureStackTrace(this, CapturedTrace);
- if (length > 32) this.uncycle();
-}
-util.inherits(CapturedTrace, Error);
-
-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.parent = function() {
- return this._parent;
-};
-
-CapturedTrace.prototype.hasParent = function() {
- return this._parent !== undefined;
-};
-
-CapturedTrace.prototype.attachExtraTrace = function(error) {
- if (error.__stackCleaned__) return;
- this.uncycle();
- var parsed = CapturedTrace.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);
-};
-
-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 = stackFramePattern.test(line) ||
- " (No stack trace)" === 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;
-}
-
-CapturedTrace.parseStackAndMessage = function(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)
- };
-};
-
-CapturedTrace.formatAndLogError = function(error, title) {
- if (typeof console !== "undefined") {
- var message;
- if (typeof error === "object" || typeof error === "function") {
- var stack = error.stack;
- message = title + formatStack(stack, error);
- } else {
- message = title + String(error);
- }
- if (typeof warn === "function") {
- warn(message);
- } else if (typeof console.log === "function" ||
- typeof console.log === "object") {
- console.log(message);
- }
- }
-};
-
-CapturedTrace.unhandledRejection = function (reason) {
- CapturedTrace.formatAndLogError(reason, "^--- With additional stack trace: ");
-};
-
-CapturedTrace.isSupported = function () {
- return typeof captureStackTrace === "function";
-};
-
-CapturedTrace.fireRejectionEvent =
-function(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);
- }
-
- var globalEventFired = false;
- try {
- globalEventFired = fireGlobalEvent(name, reason, promise);
- } catch (e) {
- globalEventFired = true;
- async.throwLater(e);
- }
-
- var domEventFired = false;
- if (fireDomEvent) {
- try {
- domEventFired = fireDomEvent(name.toLowerCase(), {
- reason: reason,
- promise: promise
- });
- } catch (e) {
- domEventFired = true;
- async.throwLater(e);
- }
- }
-
- if (!globalEventFired && !localEventFired && !domEventFired &&
- name === "unhandledRejection") {
- CapturedTrace.formatAndLogError(reason, "Unhandled rejection ");
- }
-};
-
-function formatNonError(obj) {
- var str;
- if (typeof obj === "function") {
- str = "[function " +
- (obj.name || "anonymous") +
- "]";
- } else {
- str = obj.toString();
- 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) + "...";
-}
-
-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)
- };
- }
-}
-CapturedTrace.setBounds = function(firstLineError, lastLineError) {
- if (!CapturedTrace.isSupported()) 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;
- };
-};
-
-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 = Error.stackTraceLimit + 6;
- stackFramePattern = v8stackFramePattern;
- formatStack = v8stackFormatter;
- var captureStackTrace = Error.captureStackTrace;
-
- shouldIgnore = function(line) {
- return bluebirdFramePattern.test(line);
- };
- return function(receiver, ignoreUntil) {
- Error.stackTraceLimit = Error.stackTraceLimit + 6;
- captureStackTrace(receiver, ignoreUntil);
- Error.stackTraceLimit = 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) {
- stackFramePattern = v8stackFramePattern;
- formatStack = v8stackFormatter;
- return function captureStackTrace(o) {
- Error.stackTraceLimit = Error.stackTraceLimit + 6;
- try { throw new Error(); }
- catch(e) { o.stack = e.stack; }
- Error.stackTraceLimit = 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;
-
-})([]);
-
-var fireDomEvent;
-var fireGlobalEvent = (function() {
- if (util.isNode) {
- return function(name, reason, promise) {
- if (name === "rejectionHandled") {
- return process.emit(name, promise);
- } else {
- return process.emit(name, reason, promise);
- }
- };
- } else {
- var customEventWorks = false;
- var anyEventWorks = true;
- try {
- var ev = new self.CustomEvent("test");
- customEventWorks = ev instanceof CustomEvent;
- } catch (e) {}
- if (!customEventWorks) {
- try {
- var event = document.createEvent("CustomEvent");
- event.initCustomEvent("testingtheevent", false, true, {});
- self.dispatchEvent(event);
- } catch (e) {
- anyEventWorks = false;
- }
- }
- if (anyEventWorks) {
- fireDomEvent = function(type, detail) {
- var event;
- if (customEventWorks) {
- event = new self.CustomEvent(type, {
- detail: detail,
- bubbles: false,
- cancelable: true
- });
- } else if (self.dispatchEvent) {
- event = document.createEvent("CustomEvent");
- event.initCustomEvent(type, false, true, detail);
- }
-
- return event ? !self.dispatchEvent(event) : false;
- };
- }
-
- var toWindowMethodNameMap = {};
- toWindowMethodNameMap["unhandledRejection"] = ("on" +
- "unhandledRejection").toLowerCase();
- toWindowMethodNameMap["rejectionHandled"] = ("on" +
- "rejectionHandled").toLowerCase();
-
- return function(name, reason, promise) {
- var methodName = toWindowMethodNameMap[name];
- var method = self[methodName];
- if (!method) return false;
- if (name === "rejectionHandled") {
- method.call(self, promise);
- } else {
- method.call(self, reason, promise);
- }
- return true;
- };
- }
-})();
-
-if (typeof console !== "undefined" && typeof console.warn !== "undefined") {
- warn = function (message) {
- console.warn(message);
- };
- if (util.isNode && process.stderr.isTTY) {
- warn = function(message) {
- process.stderr.write("\u001b[31m" + message + "\u001b[39m\n");
- };
- } else if (!util.isNode && typeof (new Error().stack) === "string") {
- warn = function(message) {
- console.warn("%c" + message, "color: red");
- };
- }
-}
-
-return CapturedTrace;
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/catch_filter.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/catch_filter.js b/node_modules/bluebird/js/main/catch_filter.js
deleted file mode 100644
index 040f057..0000000
--- a/node_modules/bluebird/js/main/catch_filter.js
+++ /dev/null
@@ -1,66 +0,0 @@
-"use strict";
-module.exports = function(NEXT_FILTER) {
-var util = require("./util.js");
-var errors = require("./errors.js");
-var tryCatch = util.tryCatch;
-var errorObj = util.errorObj;
-var keys = require("./es5.js").keys;
-var TypeError = errors.TypeError;
-
-function CatchFilter(instances, callback, promise) {
- this._instances = instances;
- this._callback = callback;
- this._promise = promise;
-}
-
-function safePredicate(predicate, e) {
- var safeObject = {};
- var retfilter = tryCatch(predicate).call(safeObject, e);
-
- if (retfilter === errorObj) return retfilter;
-
- var safeKeys = keys(safeObject);
- if (safeKeys.length) {
- errorObj.e = new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a");
- return errorObj;
- }
- return retfilter;
-}
-
-CatchFilter.prototype.doFilter = function (e) {
- var cb = this._callback;
- var promise = this._promise;
- var boundTo = promise._boundTo;
- for (var i = 0, len = this._instances.length; i < len; ++i) {
- var item = this._instances[i];
- var itemIsErrorType = item === Error ||
- (item != null && item.prototype instanceof Error);
-
- if (itemIsErrorType && e instanceof item) {
- var ret = tryCatch(cb).call(boundTo, e);
- if (ret === errorObj) {
- NEXT_FILTER.e = ret.e;
- return NEXT_FILTER;
- }
- return ret;
- } else if (typeof item === "function" && !itemIsErrorType) {
- var shouldHandle = safePredicate(item, e);
- if (shouldHandle === errorObj) {
- e = errorObj.e;
- break;
- } else if (shouldHandle) {
- var ret = tryCatch(cb).call(boundTo, e);
- if (ret === errorObj) {
- NEXT_FILTER.e = ret.e;
- return NEXT_FILTER;
- }
- return ret;
- }
- }
- }
- NEXT_FILTER.e = e;
- return NEXT_FILTER;
-};
-
-return CatchFilter;
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/context.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/context.js b/node_modules/bluebird/js/main/context.js
deleted file mode 100644
index ccd7702..0000000
--- a/node_modules/bluebird/js/main/context.js
+++ /dev/null
@@ -1,38 +0,0 @@
-"use strict";
-module.exports = function(Promise, CapturedTrace, isDebugging) {
-var contextStack = [];
-function Context() {
- this._trace = new CapturedTrace(peekContext());
-}
-Context.prototype._pushContext = function () {
- if (!isDebugging()) return;
- if (this._trace !== undefined) {
- contextStack.push(this._trace);
- }
-};
-
-Context.prototype._popContext = function () {
- if (!isDebugging()) return;
- if (this._trace !== undefined) {
- contextStack.pop();
- }
-};
-
-function createContext() {
- if (isDebugging()) return new Context();
-}
-
-function peekContext() {
- var lastIndex = contextStack.length - 1;
- if (lastIndex >= 0) {
- return contextStack[lastIndex];
- }
- return undefined;
-}
-
-Promise.prototype._peekContext = peekContext;
-Promise.prototype._pushContext = Context.prototype._pushContext;
-Promise.prototype._popContext = Context.prototype._popContext;
-
-return createContext;
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/debuggability.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/debuggability.js b/node_modules/bluebird/js/main/debuggability.js
deleted file mode 100644
index 5ac1767..0000000
--- a/node_modules/bluebird/js/main/debuggability.js
+++ /dev/null
@@ -1,147 +0,0 @@
-"use strict";
-module.exports = function(Promise, CapturedTrace) {
-var async = require("./async.js");
-var Warning = require("./errors.js").Warning;
-var util = require("./util.js");
-var canAttachTrace = util.canAttachTrace;
-var unhandledRejectionHandled;
-var possiblyUnhandledRejection;
-var debugging = false || (util.isNode &&
- (!!process.env["BLUEBIRD_DEBUG"] ||
- process.env["NODE_ENV"] === "development"));
-
-if (debugging) {
- async.disableTrampolineIfNecessary();
-}
-
-Promise.prototype._ensurePossibleRejectionHandled = function () {
- this._setRejectionIsUnhandled();
- async.invokeLater(this._notifyUnhandledRejection, this, undefined);
-};
-
-Promise.prototype._notifyUnhandledRejectionIsHandled = function () {
- CapturedTrace.fireRejectionEvent("rejectionHandled",
- unhandledRejectionHandled, undefined, this);
-};
-
-Promise.prototype._notifyUnhandledRejection = function () {
- if (this._isRejectionUnhandled()) {
- var reason = this._getCarriedStackTrace() || this._settledValue;
- this._setUnhandledRejectionIsNotified();
- CapturedTrace.fireRejectionEvent("unhandledRejection",
- possiblyUnhandledRejection, reason, this);
- }
-};
-
-Promise.prototype._setUnhandledRejectionIsNotified = function () {
- this._bitField = this._bitField | 524288;
-};
-
-Promise.prototype._unsetUnhandledRejectionIsNotified = function () {
- this._bitField = this._bitField & (~524288);
-};
-
-Promise.prototype._isUnhandledRejectionNotified = function () {
- return (this._bitField & 524288) > 0;
-};
-
-Promise.prototype._setRejectionIsUnhandled = function () {
- this._bitField = this._bitField | 2097152;
-};
-
-Promise.prototype._unsetRejectionIsUnhandled = function () {
- this._bitField = this._bitField & (~2097152);
- if (this._isUnhandledRejectionNotified()) {
- this._unsetUnhandledRejectionIsNotified();
- this._notifyUnhandledRejectionIsHandled();
- }
-};
-
-Promise.prototype._isRejectionUnhandled = function () {
- return (this._bitField & 2097152) > 0;
-};
-
-Promise.prototype._setCarriedStackTrace = function (capturedTrace) {
- this._bitField = this._bitField | 1048576;
- this._fulfillmentHandler0 = capturedTrace;
-};
-
-Promise.prototype._isCarryingStackTrace = function () {
- return (this._bitField & 1048576) > 0;
-};
-
-Promise.prototype._getCarriedStackTrace = function () {
- return this._isCarryingStackTrace()
- ? this._fulfillmentHandler0
- : undefined;
-};
-
-Promise.prototype._captureStackTrace = function () {
- if (debugging) {
- this._trace = new CapturedTrace(this._peekContext());
- }
- return this;
-};
-
-Promise.prototype._attachExtraTrace = function (error, ignoreSelf) {
- if (debugging && 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 = CapturedTrace.parseStackAndMessage(error);
- util.notEnumerableProp(error, "stack",
- parsed.message + "\n" + parsed.stack.join("\n"));
- util.notEnumerableProp(error, "__stackCleaned__", true);
- }
- }
-};
-
-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) {
- possiblyUnhandledRejection = typeof fn === "function" ? fn : undefined;
-};
-
-Promise.onUnhandledRejectionHandled = function (fn) {
- unhandledRejectionHandled = typeof fn === "function" ? fn : undefined;
-};
-
-Promise.longStackTraces = function () {
- if (async.haveItemsQueued() &&
- debugging === false
- ) {
- throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/DT1qyG\u000a");
- }
- debugging = CapturedTrace.isSupported();
- if (debugging) {
- async.disableTrampolineIfNecessary();
- }
-};
-
-Promise.hasLongStackTraces = function () {
- return debugging && CapturedTrace.isSupported();
-};
-
-if (!CapturedTrace.isSupported()) {
- Promise.longStackTraces = function(){};
- debugging = false;
-}
-
-return function() {
- return debugging;
-};
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/direct_resolve.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/direct_resolve.js b/node_modules/bluebird/js/main/direct_resolve.js
deleted file mode 100644
index c61a367..0000000
--- a/node_modules/bluebird/js/main/direct_resolve.js
+++ /dev/null
@@ -1,54 +0,0 @@
-"use strict";
-var util = require("./util.js");
-var isPrimitive = util.isPrimitive;
-var wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver;
-
-module.exports = function(Promise) {
-var returner = function () {
- return this;
-};
-var thrower = function () {
- throw this;
-};
-
-var wrapper = function (value, action) {
- if (action === 1) {
- return function () {
- throw value;
- };
- } else if (action === 2) {
- return function () {
- return value;
- };
- }
-};
-
-
-Promise.prototype["return"] =
-Promise.prototype.thenReturn = function (value) {
- if (wrapsPrimitiveReceiver && isPrimitive(value)) {
- return this._then(
- wrapper(value, 2),
- undefined,
- undefined,
- undefined,
- undefined
- );
- }
- return this._then(returner, undefined, undefined, value, undefined);
-};
-
-Promise.prototype["throw"] =
-Promise.prototype.thenThrow = function (reason) {
- if (wrapsPrimitiveReceiver && isPrimitive(reason)) {
- return this._then(
- wrapper(reason, 1),
- undefined,
- undefined,
- undefined,
- undefined
- );
- }
- return this._then(thrower, undefined, undefined, reason, undefined);
-};
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/each.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/each.js b/node_modules/bluebird/js/main/each.js
deleted file mode 100644
index a37e22c..0000000
--- a/node_modules/bluebird/js/main/each.js
+++ /dev/null
@@ -1,12 +0,0 @@
-"use strict";
-module.exports = function(Promise, INTERNAL) {
-var PromiseReduce = Promise.reduce;
-
-Promise.prototype.each = function (fn) {
- return PromiseReduce(this, fn, null, INTERNAL);
-};
-
-Promise.each = function (promises, fn) {
- return PromiseReduce(promises, fn, null, INTERNAL);
-};
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/errors.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/errors.js b/node_modules/bluebird/js/main/errors.js
deleted file mode 100644
index c334bb1..0000000
--- a/node_modules/bluebird/js/main/errors.js
+++ /dev/null
@@ -1,111 +0,0 @@
-"use strict";
-var es5 = require("./es5.js");
-var Objectfreeze = es5.freeze;
-var util = require("./util.js");
-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
- });
- notEnumerableProp(Error, "__BluebirdErrorTypes__", errorTypes);
-}
-
-module.exports = {
- Error: Error,
- TypeError: _TypeError,
- RangeError: _RangeError,
- CancellationError: errorTypes.CancellationError,
- OperationalError: errorTypes.OperationalError,
- TimeoutError: errorTypes.TimeoutError,
- AggregateError: errorTypes.AggregateError,
- Warning: Warning
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/es5.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/es5.js b/node_modules/bluebird/js/main/es5.js
deleted file mode 100644
index ea41d5a..0000000
--- a/node_modules/bluebird/js/main/es5.js
+++ /dev/null
@@ -1,80 +0,0 @@
-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;
- }
- };
-}
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/filter.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/filter.js b/node_modules/bluebird/js/main/filter.js
deleted file mode 100644
index ed57bf0..0000000
--- a/node_modules/bluebird/js/main/filter.js
+++ /dev/null
@@ -1,12 +0,0 @@
-"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);
-};
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/finally.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/finally.js b/node_modules/bluebird/js/main/finally.js
deleted file mode 100644
index ed84a2a..0000000
--- a/node_modules/bluebird/js/main/finally.js
+++ /dev/null
@@ -1,99 +0,0 @@
-"use strict";
-module.exports = function(Promise, NEXT_FILTER, tryConvertToPromise) {
-var util = require("./util.js");
-var wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver;
-var isPrimitive = util.isPrimitive;
-var thrower = util.thrower;
-
-function returnThis() {
- return this;
-}
-function throwThis() {
- throw this;
-}
-function return$(r) {
- return function() {
- return r;
- };
-}
-function throw$(r) {
- return function() {
- throw r;
- };
-}
-function promisedFinally(ret, reasonOrValue, isFulfilled) {
- var then;
- if (wrapsPrimitiveReceiver && isPrimitive(reasonOrValue)) {
- then = isFulfilled ? return$(reasonOrValue) : throw$(reasonOrValue);
- } else {
- then = isFulfilled ? returnThis : throwThis;
- }
- return ret._then(then, thrower, undefined, reasonOrValue, undefined);
-}
-
-function finallyHandler(reasonOrValue) {
- var promise = this.promise;
- var handler = this.handler;
-
- var ret = promise._isBound()
- ? handler.call(promise._boundTo)
- : handler();
-
- if (ret !== undefined) {
- var maybePromise = tryConvertToPromise(ret, promise);
- if (maybePromise instanceof Promise) {
- maybePromise = maybePromise._target();
- return promisedFinally(maybePromise, reasonOrValue,
- promise.isFulfilled());
- }
- }
-
- if (promise.isRejected()) {
- NEXT_FILTER.e = reasonOrValue;
- return NEXT_FILTER;
- } else {
- return reasonOrValue;
- }
-}
-
-function tapHandler(value) {
- var promise = this.promise;
- var handler = this.handler;
-
- var ret = promise._isBound()
- ? handler.call(promise._boundTo, value)
- : handler(value);
-
- if (ret !== undefined) {
- var maybePromise = tryConvertToPromise(ret, promise);
- if (maybePromise instanceof Promise) {
- maybePromise = maybePromise._target();
- return promisedFinally(maybePromise, value, true);
- }
- }
- return value;
-}
-
-Promise.prototype._passThroughHandler = function (handler, isFinally) {
- if (typeof handler !== "function") return this.then();
-
- var promiseAndHandler = {
- promise: this,
- handler: handler
- };
-
- return this._then(
- isFinally ? finallyHandler : tapHandler,
- isFinally ? finallyHandler : undefined, undefined,
- promiseAndHandler, undefined);
-};
-
-Promise.prototype.lastly =
-Promise.prototype["finally"] = function (handler) {
- return this._passThroughHandler(handler, true);
-};
-
-Promise.prototype.tap = function (handler) {
- return this._passThroughHandler(handler, false);
-};
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/generators.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/generators.js b/node_modules/bluebird/js/main/generators.js
deleted file mode 100644
index 4c0568d..0000000
--- a/node_modules/bluebird/js/main/generators.js
+++ /dev/null
@@ -1,136 +0,0 @@
-"use strict";
-module.exports = function(Promise,
- apiRejection,
- INTERNAL,
- tryConvertToPromise) {
-var errors = require("./errors.js");
-var TypeError = errors.TypeError;
-var util = require("./util.js");
-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) {
- 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;
-}
-
-PromiseSpawn.prototype.promise = function () {
- return this._promise;
-};
-
-PromiseSpawn.prototype._run = function () {
- this._generator = this._generatorFunction.call(this._receiver);
- this._receiver =
- this._generatorFunction = undefined;
- this._next(undefined);
-};
-
-PromiseSpawn.prototype._continue = function (result) {
- if (result === errorObj) {
- return this._promise._rejectCallback(result.e, false, true);
- }
-
- var value = result.value;
- if (result.done === true) {
- this._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._throw(
- new TypeError(
- "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/4Y4pDk\u000a\u000a".replace("%s", value) +
- "From coroutine:\u000a" +
- this._stack.split("\n").slice(1, -7).join("\n")
- )
- );
- return;
- }
- }
- maybePromise._then(
- this._next,
- this._throw,
- undefined,
- this,
- null
- );
- }
-};
-
-PromiseSpawn.prototype._throw = function (reason) {
- 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._next = function (value) {
- this._promise._pushContext();
- var result = tryCatch(this._generator.next).call(this._generator, value);
- this._promise._popContext();
- this._continue(result);
-};
-
-Promise.coroutine = function (generatorFunction, options) {
- if (typeof generatorFunction !== "function") {
- throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\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);
- spawn._generator = generator;
- spawn._next(undefined);
- return spawn.promise();
- };
-};
-
-Promise.coroutine.addYieldHandler = function(fn) {
- if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a");
- yieldHandlers.push(fn);
-};
-
-Promise.spawn = function (generatorFunction) {
- if (typeof generatorFunction !== "function") {
- return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\u000a");
- }
- var spawn = new PromiseSpawn(generatorFunction, this);
- var ret = spawn.promise();
- spawn._run(Promise.spawn);
- return ret;
-};
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/join.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/join.js b/node_modules/bluebird/js/main/join.js
deleted file mode 100644
index cf33eb1..0000000
--- a/node_modules/bluebird/js/main/join.js
+++ /dev/null
@@ -1,107 +0,0 @@
-"use strict";
-module.exports =
-function(Promise, PromiseArray, tryConvertToPromise, INTERNAL) {
-var util = require("./util.js");
-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 caller = function(count) {
- var values = [];
- for (var i = 1; i <= count; ++i) values.push("holder.p" + i);
- return new Function("holder", " \n\
- 'use strict'; \n\
- var callback = holder.fn; \n\
- return callback(values); \n\
- ".replace(/values/g, values.join(", ")));
- };
- var thenCallbacks = [];
- var callers = [undefined];
- for (var i = 1; i <= 5; ++i) {
- thenCallbacks.push(thenCallback(i));
- callers.push(caller(i));
- }
-
- var Holder = function(total, fn) {
- this.p1 = this.p2 = this.p3 = this.p4 = this.p5 = null;
- this.fn = fn;
- this.total = total;
- this.now = 0;
- };
-
- Holder.prototype.callers = callers;
- Holder.prototype.checkFulfillment = function(promise) {
- var now = this.now;
- now++;
- var total = this.total;
- if (now >= total) {
- var handler = this.callers[total];
- promise._pushContext();
- var ret = tryCatch(handler)(this);
- promise._popContext();
- if (ret === errorObj) {
- promise._rejectCallback(ret.e, false, true);
- } else {
- promise._resolveCallback(ret);
- }
- } else {
- this.now = now;
- }
- };
-
- var 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 < 6 && canEvaluate) {
- var ret = new Promise(INTERNAL);
- ret._captureStackTrace();
- var holder = new Holder(last, fn);
- var callbacks = thenCallbacks;
- for (var i = 0; i < last; ++i) {
- var maybePromise = tryConvertToPromise(arguments[i], ret);
- if (maybePromise instanceof Promise) {
- maybePromise = maybePromise._target();
- if (maybePromise._isPending()) {
- maybePromise._then(callbacks[i], reject,
- undefined, ret, holder);
- } else if (maybePromise._isFulfilled()) {
- callbacks[i].call(ret,
- maybePromise._value(), holder);
- } else {
- ret._reject(maybePromise._reason());
- }
- } else {
- callbacks[i].call(ret, maybePromise, 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;
-};
-
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/map.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/map.js b/node_modules/bluebird/js/main/map.js
deleted file mode 100644
index 66a5b17..0000000
--- a/node_modules/bluebird/js/main/map.js
+++ /dev/null
@@ -1,131 +0,0 @@
-"use strict";
-module.exports = function(Promise,
- PromiseArray,
- apiRejection,
- tryConvertToPromise,
- INTERNAL) {
-var async = require("./async.js");
-var util = require("./util.js");
-var tryCatch = util.tryCatch;
-var errorObj = util.errorObj;
-var PENDING = {};
-var EMPTY_ARRAY = [];
-
-function MappingPromiseArray(promises, fn, limit, _filter) {
- this.constructor$(promises);
- this._promise._captureStackTrace();
- this._callback = fn;
- this._preservedValues = _filter === INTERNAL
- ? new Array(this.length())
- : null;
- this._limit = limit;
- this._inFlight = 0;
- this._queue = limit >= 1 ? [] : EMPTY_ARRAY;
- async.invoke(init, this, undefined);
-}
-util.inherits(MappingPromiseArray, PromiseArray);
-function init() {this._init$(undefined, -2);}
-
-MappingPromiseArray.prototype._init = function () {};
-
-MappingPromiseArray.prototype._promiseFulfilled = function (value, index) {
- var values = this._values;
- var length = this.length();
- var preservedValues = this._preservedValues;
- var limit = this._limit;
- if (values[index] === PENDING) {
- values[index] = value;
- if (limit >= 1) {
- this._inFlight--;
- this._drainQueue();
- if (this._isResolved()) return;
- }
- } else {
- if (limit >= 1 && this._inFlight >= limit) {
- values[index] = value;
- this._queue.push(index);
- return;
- }
- if (preservedValues !== null) preservedValues[index] = value;
-
- var callback = this._callback;
- var receiver = this._promise._boundTo;
- this._promise._pushContext();
- var ret = tryCatch(callback).call(receiver, value, index, length);
- this._promise._popContext();
- if (ret === errorObj) return this._reject(ret.e);
-
- var maybePromise = tryConvertToPromise(ret, this._promise);
- if (maybePromise instanceof Promise) {
- maybePromise = maybePromise._target();
- if (maybePromise._isPending()) {
- if (limit >= 1) this._inFlight++;
- values[index] = PENDING;
- return maybePromise._proxyPromiseArray(this, index);
- } else if (maybePromise._isFulfilled()) {
- ret = maybePromise._value();
- } else {
- return this._reject(maybePromise._reason());
- }
- }
- values[index] = ret;
- }
- var totalResolved = ++this._totalResolved;
- if (totalResolved >= length) {
- if (preservedValues !== null) {
- this._filter(values, preservedValues);
- } else {
- this._resolve(values);
- }
-
- }
-};
-
-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) {
- var limit = typeof options === "object" && options !== null
- ? options.concurrency
- : 0;
- limit = typeof limit === "number" &&
- isFinite(limit) && limit >= 1 ? limit : 0;
- return new MappingPromiseArray(promises, fn, limit, _filter);
-}
-
-Promise.prototype.map = function (fn, options) {
- if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a");
-
- return map(this, fn, options, null).promise();
-};
-
-Promise.map = function (promises, fn, options, _filter) {
- if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a");
- return map(promises, fn, options, _filter).promise();
-};
-
-
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/method.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/method.js b/node_modules/bluebird/js/main/method.js
deleted file mode 100644
index 3d3eeb1..0000000
--- a/node_modules/bluebird/js/main/method.js
+++ /dev/null
@@ -1,44 +0,0 @@
-"use strict";
-module.exports =
-function(Promise, INTERNAL, tryConvertToPromise, apiRejection) {
-var util = require("./util.js");
-var tryCatch = util.tryCatch;
-
-Promise.method = function (fn) {
- if (typeof fn !== "function") {
- throw new Promise.TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a");
- }
- return function () {
- var ret = new Promise(INTERNAL);
- ret._captureStackTrace();
- ret._pushContext();
- var value = tryCatch(fn).apply(this, arguments);
- ret._popContext();
- ret._resolveFromSyncValue(value);
- return ret;
- };
-};
-
-Promise.attempt = Promise["try"] = function (fn, args, ctx) {
- if (typeof fn !== "function") {
- return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a");
- }
- var ret = new Promise(INTERNAL);
- ret._captureStackTrace();
- ret._pushContext();
- var value = util.isArray(args)
- ? tryCatch(fn).apply(ctx, args)
- : tryCatch(fn).call(ctx, args);
- ret._popContext();
- ret._resolveFromSyncValue(value);
- return ret;
-};
-
-Promise.prototype._resolveFromSyncValue = function (value) {
- if (value === util.errorObj) {
- this._rejectCallback(value.e, false, true);
- } else {
- this._resolveCallback(value, true);
- }
-};
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/nodeify.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/nodeify.js b/node_modules/bluebird/js/main/nodeify.js
deleted file mode 100644
index f305b93..0000000
--- a/node_modules/bluebird/js/main/nodeify.js
+++ /dev/null
@@ -1,58 +0,0 @@
-"use strict";
-module.exports = function(Promise) {
-var util = require("./util.js");
-var async = require("./async.js");
-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._boundTo, [null].concat(val));
- if (ret === errorObj) {
- async.throwLater(ret.e);
- }
-}
-
-function successAdapter(val, nodeback) {
- var promise = this;
- var receiver = promise._boundTo;
- 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 target = promise._target();
- var newReason = target._getCarriedStackTrace();
- newReason.cause = reason;
- reason = newReason;
- }
- var ret = tryCatch(nodeback).call(promise._boundTo, 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;
-};
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/progress.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/progress.js b/node_modules/bluebird/js/main/progress.js
deleted file mode 100644
index 2e3e95e..0000000
--- a/node_modules/bluebird/js/main/progress.js
+++ /dev/null
@@ -1,76 +0,0 @@
-"use strict";
-module.exports = function(Promise, PromiseArray) {
-var util = require("./util.js");
-var async = require("./async.js");
-var tryCatch = util.tryCatch;
-var errorObj = util.errorObj;
-
-Promise.prototype.progressed = function (handler) {
- return this._then(undefined, undefined, handler, undefined, undefined);
-};
-
-Promise.prototype._progress = function (progressValue) {
- if (this._isFollowingOrFulfilledOrRejected()) return;
- this._target()._progressUnchecked(progressValue);
-
-};
-
-Promise.prototype._progressHandlerAt = function (index) {
- return index === 0
- ? this._progressHandler0
- : this[(index << 2) + index - 5 + 2];
-};
-
-Promise.prototype._doProgressWith = function (progression) {
- var progressValue = progression.value;
- var handler = progression.handler;
- var promise = progression.promise;
- var receiver = progression.receiver;
-
- var ret = tryCatch(handler).call(receiver, progressValue);
- if (ret === errorObj) {
- if (ret.e != null &&
- ret.e.name !== "StopProgressPropagation") {
- var trace = util.canAttachTrace(ret.e)
- ? ret.e : new Error(util.toString(ret.e));
- promise._attachExtraTrace(trace);
- promise._progress(ret.e);
- }
- } else if (ret instanceof Promise) {
- ret._then(promise._progress, null, null, promise, undefined);
- } else {
- promise._progress(ret);
- }
-};
-
-
-Promise.prototype._progressUnchecked = function (progressValue) {
- var len = this._length();
- var progress = this._progress;
- for (var i = 0; i < len; i++) {
- var handler = this._progressHandlerAt(i);
- var promise = this._promiseAt(i);
- if (!(promise instanceof Promise)) {
- var receiver = this._receiverAt(i);
- if (typeof handler === "function") {
- handler.call(receiver, progressValue, promise);
- } else if (receiver instanceof PromiseArray &&
- !receiver._isResolved()) {
- receiver._promiseProgressed(progressValue, promise);
- }
- continue;
- }
-
- if (typeof handler === "function") {
- async.invoke(this._doProgressWith, this, {
- handler: handler,
- promise: promise,
- receiver: this._receiverAt(i),
- value: progressValue
- });
- } else {
- async.invoke(progress, promise, progressValue);
- }
- }
-};
-};
http://git-wip-us.apache.org/repos/asf/couchdb-nmo/blob/6436833c/node_modules/bluebird/js/main/promise.js
----------------------------------------------------------------------
diff --git a/node_modules/bluebird/js/main/promise.js b/node_modules/bluebird/js/main/promise.js
deleted file mode 100644
index f80d247..0000000
--- a/node_modules/bluebird/js/main/promise.js
+++ /dev/null
@@ -1,700 +0,0 @@
-"use strict";
-module.exports = function() {
-var makeSelfResolutionError = function () {
- return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/LhFpo0\u000a");
-};
-var reflect = function() {
- return new Promise.PromiseInspection(this._target());
-};
-var apiRejection = function(msg) {
- return Promise.reject(new TypeError(msg));
-};
-var util = require("./util.js");
-var async = require("./async.js");
-var errors = require("./errors.js");
-var TypeError = Promise.TypeError = errors.TypeError;
-Promise.RangeError = errors.RangeError;
-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 = {e: null};
-var tryConvertToPromise = require("./thenables.js")(Promise, INTERNAL);
-var PromiseArray =
- require("./promise_array.js")(Promise, INTERNAL,
- tryConvertToPromise, apiRejection);
-var CapturedTrace = require("./captured_trace.js")();
-var isDebugging = require("./debuggability.js")(Promise, CapturedTrace);
- /*jshint unused:false*/
-var createContext =
- require("./context.js")(Promise, CapturedTrace, isDebugging);
-var CatchFilter = require("./catch_filter.js")(NEXT_FILTER);
-var PromiseResolver = require("./promise_resolver.js");
-var nodebackForPromise = PromiseResolver._nodebackForPromise;
-var errorObj = util.errorObj;
-var tryCatch = util.tryCatch;
-function Promise(resolver) {
- if (typeof resolver !== "function") {
- throw new TypeError("the promise constructor requires a resolver function\u000a\u000a See http://goo.gl/EC22Yn\u000a");
- }
- if (this.constructor !== Promise) {
- throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/KsIlge\u000a");
- }
- this._bitField = 0;
- this._fulfillmentHandler0 = undefined;
- this._rejectionHandler0 = undefined;
- this._progressHandler0 = undefined;
- this._promise0 = undefined;
- this._receiver0 = undefined;
- this._settledValue = undefined;
- if (resolver !== INTERNAL) this._resolveFromResolver(resolver);
-}
-
-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 (typeof item === "function") {
- catchInstances[j++] = item;
- } else {
- return Promise.reject(
- new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a"));
- }
- }
- catchInstances.length = j;
- fn = arguments[i];
- var catchFilter = new CatchFilter(catchInstances, fn, this);
- return this._then(undefined, catchFilter.doFilter, undefined,
- catchFilter, undefined);
- }
- return this._then(undefined, fn, undefined, undefined, undefined);
-};
-
-Promise.prototype.reflect = function () {
- return this._then(reflect, reflect, undefined, this, undefined);
-};
-
-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,
- undefined, undefined);
-};
-
-Promise.prototype.done = function (didFulfill, didReject, didProgress) {
- var promise = this._then(didFulfill, didReject, didProgress,
- undefined, undefined);
- promise._setIsFinal();
-};
-
-Promise.prototype.spread = function (didFulfill, didReject) {
- return this.all()._then(didFulfill, didReject, undefined, APPLY, undefined);
-};
-
-Promise.prototype.isCancellable = function () {
- return !this.isResolved() &&
- this._cancellable();
-};
-
-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 () {
- return new PromiseArray(this).promise();
-};
-
-Promise.prototype.error = function (fn) {
- return this.caught(util.originatesFromRejection, fn);
-};
-
-Promise.is = function (val) {
- return val instanceof Promise;
-};
-
-Promise.fromNode = function(fn) {
- var ret = new Promise(INTERNAL);
- var result = tryCatch(fn)(nodebackForPromise(ret));
- if (result === errorObj) {
- ret._rejectCallback(result.e, true, true);
- }
- return ret;
-};
-
-Promise.all = function (promises) {
- return new PromiseArray(promises).promise();
-};
-
-Promise.defer = Promise.pending = function () {
- var promise = new Promise(INTERNAL);
- return new PromiseResolver(promise);
-};
-
-Promise.cast = function (obj) {
- var ret = tryConvertToPromise(obj);
- if (!(ret instanceof Promise)) {
- var val = ret;
- ret = new Promise(INTERNAL);
- ret._fulfillUnchecked(val);
- }
- 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("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a");
- var prev = async._schedule;
- async._schedule = fn;
- return prev;
-};
-
-Promise.prototype._then = function (
- didFulfill,
- didReject,
- didProgress,
- receiver,
- internalData
-) {
- var haveInternalData = internalData !== undefined;
- var ret = haveInternalData ? internalData : new Promise(INTERNAL);
-
- if (!haveInternalData) {
- ret._propagateFrom(this, 4 | 1);
- ret._captureStackTrace();
- }
-
- var target = this._target();
- if (target !== this) {
- if (receiver === undefined) receiver = this._boundTo;
- if (!haveInternalData) ret._setIsMigrated();
- }
-
- var callbackIndex =
- target._addCallbacks(didFulfill, didReject, didProgress, ret, receiver);
-
- if (target._isResolved() && !target._isSettlePromisesQueued()) {
- async.invoke(
- target._settlePromiseAtPostResolution, target, callbackIndex);
- }
-
- return ret;
-};
-
-Promise.prototype._settlePromiseAtPostResolution = function (index) {
- if (this._isRejectionUnhandled()) this._unsetRejectionIsUnhandled();
- this._settlePromiseAt(index);
-};
-
-Promise.prototype._length = function () {
- return this._bitField & 131071;
-};
-
-Promise.prototype._isFollowingOrFulfilledOrRejected = function () {
- return (this._bitField & 939524096) > 0;
-};
-
-Promise.prototype._isFollowing = function () {
- return (this._bitField & 536870912) === 536870912;
-};
-
-Promise.prototype._setLength = function (len) {
- this._bitField = (this._bitField & -131072) |
- (len & 131071);
-};
-
-Promise.prototype._setFulfilled = function () {
- this._bitField = this._bitField | 268435456;
-};
-
-Promise.prototype._setRejected = function () {
- this._bitField = this._bitField | 134217728;
-};
-
-Promise.prototype._setFollowing = function () {
- this._bitField = this._bitField | 536870912;
-};
-
-Promise.prototype._setIsFinal = function () {
- this._bitField = this._bitField | 33554432;
-};
-
-Promise.prototype._isFinal = function () {
- return (this._bitField & 33554432) > 0;
-};
-
-Promise.prototype._cancellable = function () {
- return (this._bitField & 67108864) > 0;
-};
-
-Promise.prototype._setCancellable = function () {
- this._bitField = this._bitField | 67108864;
-};
-
-Promise.prototype._unsetCancellable = function () {
- this._bitField = this._bitField & (~67108864);
-};
-
-Promise.prototype._setIsMigrated = function () {
- this._bitField = this._bitField | 4194304;
-};
-
-Promise.prototype._unsetIsMigrated = function () {
- this._bitField = this._bitField & (~4194304);
-};
-
-Promise.prototype._isMigrated = function () {
- return (this._bitField & 4194304) > 0;
-};
-
-Promise.prototype._receiverAt = function (index) {
- var ret = index === 0
- ? this._receiver0
- : this[
- index * 5 - 5 + 4];
- if (ret === undefined && this._isBound()) {
- return this._boundTo;
- }
- return ret;
-};
-
-Promise.prototype._promiseAt = function (index) {
- return index === 0
- ? this._promise0
- : this[index * 5 - 5 + 3];
-};
-
-Promise.prototype._fulfillmentHandlerAt = function (index) {
- return index === 0
- ? this._fulfillmentHandler0
- : this[index * 5 - 5 + 0];
-};
-
-Promise.prototype._rejectionHandlerAt = function (index) {
- return index === 0
- ? this._rejectionHandler0
- : this[index * 5 - 5 + 1];
-};
-
-Promise.prototype._migrateCallbacks = function (follower, index) {
- var fulfill = follower._fulfillmentHandlerAt(index);
- var reject = follower._rejectionHandlerAt(index);
- var progress = follower._progressHandlerAt(index);
- var promise = follower._promiseAt(index);
- var receiver = follower._receiverAt(index);
- if (promise instanceof Promise) promise._setIsMigrated();
- this._addCallbacks(fulfill, reject, progress, promise, receiver);
-};
-
-Promise.prototype._addCallbacks = function (
- fulfill,
- reject,
- progress,
- promise,
- receiver
-) {
- var index = this._length();
-
- if (index >= 131071 - 5) {
- index = 0;
- this._setLength(0);
- }
-
- if (index === 0) {
- this._promise0 = promise;
- if (receiver !== undefined) this._receiver0 = receiver;
- if (typeof fulfill === "function" && !this._isCarryingStackTrace())
- this._fulfillmentHandler0 = fulfill;
- if (typeof reject === "function") this._rejectionHandler0 = reject;
- if (typeof progress === "function") this._progressHandler0 = progress;
- } else {
- var base = index * 5 - 5;
- this[base + 3] = promise;
- this[base + 4] = receiver;
- if (typeof fulfill === "function")
- this[base + 0] = fulfill;
- if (typeof reject === "function")
- this[base + 1] = reject;
- if (typeof progress === "function")
- this[base + 2] = progress;
- }
- this._setLength(index + 1);
- return index;
-};
-
-Promise.prototype._setProxyHandlers = function (receiver, promiseSlotValue) {
- var index = this._length();
-
- if (index >= 131071 - 5) {
- index = 0;
- this._setLength(0);
- }
- if (index === 0) {
- this._promise0 = promiseSlotValue;
- this._receiver0 = receiver;
- } else {
- var base = index * 5 - 5;
- this[base + 3] = promiseSlotValue;
- this[base + 4] = receiver;
- }
- this._setLength(index + 1);
-};
-
-Promise.prototype._proxyPromiseArray = function (promiseArray, index) {
- this._setProxyHandlers(promiseArray, index);
-};
-
-Promise.prototype._resolveCallback = function(value, shouldBind) {
- if (this._isFollowingOrFulfilledOrRejected()) return;
- if (value === this)
- return this._rejectCallback(makeSelfResolutionError(), false, true);
- var maybePromise = tryConvertToPromise(value, this);
- if (!(maybePromise instanceof Promise)) return this._fulfill(value);
-
- var propagationFlags = 1 | (shouldBind ? 4 : 0);
- this._propagateFrom(maybePromise, propagationFlags);
- var promise = maybePromise._target();
- if (promise._isPending()) {
- var len = this._length();
- for (var i = 0; i < len; ++i) {
- promise._migrateCallbacks(this, i);
- }
- this._setFollowing();
- this._setLength(0);
- this._setFollowee(promise);
- } else if (promise._isFulfilled()) {
- this._fulfillUnchecked(promise._value());
- } else {
- this._rejectUnchecked(promise._reason(),
- promise._getCarriedStackTrace());
- }
-};
-
-Promise.prototype._rejectCallback =
-function(reason, synchronous, shouldNotMarkOriginatingFromRejection) {
- if (!shouldNotMarkOriginatingFromRejection) {
- util.markAsOriginatingFromRejection(reason);
- }
- var trace = util.ensureErrorObject(reason);
- var hasStack = trace === reason;
- this._attachExtraTrace(trace, synchronous ? hasStack : false);
- this._reject(reason, hasStack ? undefined : trace);
-};
-
-Promise.prototype._resolveFromResolver = function (resolver) {
- var promise = this;
- this._captureStackTrace();
- this._pushContext();
- var synchronous = true;
- var r = tryCatch(resolver)(function(value) {
- if (promise === null) return;
- promise._resolveCallback(value);
- promise = null;
- }, function (reason) {
- if (promise === null) return;
- promise._rejectCallback(reason, synchronous);
- promise = null;
- });
- synchronous = false;
- this._popContext();
-
- if (r !== undefined && r === errorObj && promise !== null) {
- promise._rejectCallback(r.e, true, true);
- promise = null;
- }
-};
-
-Promise.prototype._settlePromiseFromHandler = function (
- handler, receiver, value, promise
-) {
- if (promise._isRejected()) return;
- promise._pushContext();
- var x;
- if (receiver === APPLY && !this._isRejected()) {
- x = tryCatch(handler).apply(this._boundTo, value);
- } else {
- x = tryCatch(handler).call(receiver, value);
- }
- promise._popContext();
-
- if (x === errorObj || x === promise || x === NEXT_FILTER) {
- var err = x === promise ? makeSelfResolutionError() : x.e;
- promise._rejectCallback(err, false, true);
- } else {
- 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._cleanValues = function () {
- if (this._cancellable()) {
- this._cancellationParent = undefined;
- }
-};
-
-Promise.prototype._propagateFrom = function (parent, flags) {
- if ((flags & 1) > 0 && parent._cancellable()) {
- this._setCancellable();
- this._cancellationParent = parent;
- }
- if ((flags & 4) > 0 && parent._isBound()) {
- this._setBoundTo(parent._boundTo);
- }
-};
-
-Promise.prototype._fulfill = function (value) {
- if (this._isFollowingOrFulfilledOrRejected()) return;
- this._fulfillUnchecked(value);
-};
-
-Promise.prototype._reject = function (reason, carriedStackTrace) {
- if (this._isFollowingOrFulfilledOrRejected()) return;
- this._rejectUnchecked(reason, carriedStackTrace);
-};
-
-Promise.prototype._settlePromiseAt = function (index) {
- var promise = this._promiseAt(index);
- var isPromise = promise instanceof Promise;
-
- if (isPromise && promise._isMigrated()) {
- promise._unsetIsMigrated();
- return async.invoke(this._settlePromiseAt, this, index);
- }
- var handler = this._isFulfilled()
- ? this._fulfillmentHandlerAt(index)
- : this._rejectionHandlerAt(index);
-
- var carriedStackTrace =
- this._isCarryingStackTrace() ? this._getCarriedStackTrace() : undefined;
- var value = this._settledValue;
- var receiver = this._receiverAt(index);
-
-
- this._clearCallbackDataAtIndex(index);
-
- if (typeof handler === "function") {
- if (!isPromise) {
- handler.call(receiver, value, promise);
- } else {
- this._settlePromiseFromHandler(handler, receiver, value, promise);
- }
- } else if (receiver instanceof PromiseArray) {
- if (!receiver._isResolved()) {
- if (this._isFulfilled()) {
- receiver._promiseFulfilled(value, promise);
- }
- else {
- receiver._promiseRejected(value, promise);
- }
- }
- } else if (isPromise) {
- if (this._isFulfilled()) {
- promise._fulfill(value);
- } else {
- promise._reject(value, carriedStackTrace);
- }
- }
-
- if (index >= 4 && (index & 31) === 4)
- async.invokeLater(this._setLength, this, 0);
-};
-
-Promise.prototype._clearCallbackDataAtIndex = function(index) {
- if (index === 0) {
- if (!this._isCarryingStackTrace()) {
- this._fulfillmentHandler0 = undefined;
- }
- this._rejectionHandler0 =
- this._progressHandler0 =
- this._receiver0 =
- this._promise0 = undefined;
- } else {
- var base = index * 5 - 5;
- this[base + 3] =
- this[base + 4] =
- this[base + 0] =
- this[base + 1] =
- this[base + 2] = undefined;
- }
-};
-
-Promise.prototype._isSettlePromisesQueued = function () {
- return (this._bitField &
- -1073741824) === -1073741824;
-};
-
-Promise.prototype._setSettlePromisesQueued = function () {
- this._bitField = this._bitField | -1073741824;
-};
-
-Promise.prototype._unsetSettlePromisesQueued = function () {
- this._bitField = this._bitField & (~-1073741824);
-};
-
-Promise.prototype._queueSettlePromises = function() {
- async.settlePromises(this);
- this._setSettlePromisesQueued();
-};
-
-Promise.prototype._fulfillUnchecked = function (value) {
- if (value === this) {
- var err = makeSelfResolutionError();
- this._attachExtraTrace(err);
- return this._rejectUnchecked(err, undefined);
- }
- this._setFulfilled();
- this._settledValue = value;
- this._cleanValues();
-
- if (this._length() > 0) {
- this._queueSettlePromises();
- }
-};
-
-Promise.prototype._rejectUncheckedCheckError = function (reason) {
- var trace = util.ensureErrorObject(reason);
- this._rejectUnchecked(reason, trace === reason ? undefined : trace);
-};
-
-Promise.prototype._rejectUnchecked = function (reason, trace) {
- if (reason === this) {
- var err = makeSelfResolutionError();
- this._attachExtraTrace(err);
- return this._rejectUnchecked(err);
- }
- this._setRejected();
- this._settledValue = reason;
- this._cleanValues();
-
- if (this._isFinal()) {
- async.throwLater(function(e) {
- if ("stack" in e) {
- async.invokeFirst(
- CapturedTrace.unhandledRejection, undefined, e);
- }
- throw e;
- }, trace === undefined ? reason : trace);
- return;
- }
-
- if (trace !== undefined && trace !== reason) {
- this._setCarriedStackTrace(trace);
- }
-
- if (this._length() > 0) {
- this._queueSettlePromises();
- } else {
- this._ensurePossibleRejectionHandled();
- }
-};
-
-Promise.prototype._settlePromises = function () {
- this._unsetSettlePromisesQueued();
- var len = this._length();
- for (var i = 0; i < len; i++) {
- this._settlePromiseAt(i);
- }
-};
-
-Promise._makeSelfResolutionError = makeSelfResolutionError;
-require("./progress.js")(Promise, PromiseArray);
-require("./method.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection);
-require("./bind.js")(Promise, INTERNAL, tryConvertToPromise);
-require("./finally.js")(Promise, NEXT_FILTER, tryConvertToPromise);
-require("./direct_resolve.js")(Promise);
-require("./synchronous_inspection.js")(Promise);
-require("./join.js")(Promise, PromiseArray, tryConvertToPromise, INTERNAL);
-Promise.Promise = Promise;
-require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL);
-require('./cancel.js')(Promise);
-require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext);
-require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise);
-require('./nodeify.js')(Promise);
-require('./call_get.js')(Promise);
-require('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);
-require('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);
-require('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL);
-require('./settle.js')(Promise, PromiseArray);
-require('./some.js')(Promise, PromiseArray, apiRejection);
-require('./promisify.js')(Promise, INTERNAL);
-require('./any.js')(Promise);
-require('./each.js')(Promise, INTERNAL);
-require('./timers.js')(Promise, INTERNAL);
-require('./filter.js')(Promise, INTERNAL);
-
- util.toFastProperties(Promise);
- util.toFastProperties(Promise.prototype);
- function fillTypes(value) {
- var p = new Promise(INTERNAL);
- p._fulfillmentHandler0 = value;
- p._rejectionHandler0 = value;
- p._progressHandler0 = value;
- p._promise0 = value;
- p._receiver0 = value;
- p._settledValue = 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));
- CapturedTrace.setBounds(async.firstLineError, util.lastLineError);
- return Promise;
-
-};