diff --git a/dist/watson-speech.js b/dist/watson-speech.js
index 696979bb..55cf0f7b 100644
--- a/dist/watson-speech.js
+++ b/dist/watson-speech.js
@@ -73,7 +73,7 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 73);
+/******/ return __webpack_require__(__webpack_require__.s = 75);
/******/ })
/************************************************************************/
/******/ ([
@@ -91,9 +91,9 @@ return /******/ (function(modules) { // webpackBootstrap
-var base64 = __webpack_require__(37)
-var ieee754 = __webpack_require__(40)
-var isArray = __webpack_require__(38)
+var base64 = __webpack_require__(39)
+var ieee754 = __webpack_require__(41)
+var isArray = __webpack_require__(13)
exports.Buffer = Buffer
exports.SlowBuffer = SlowBuffer
@@ -1871,7 +1871,7 @@ function isnan (val) {
return val !== val // eslint-disable-line no-self-compare
}
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10)))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6)))
/***/ }),
/* 1 */
@@ -1900,13 +1900,13 @@ function isnan (val) {
module.exports = Stream;
-var EE = __webpack_require__(9).EventEmitter;
-var inherits = __webpack_require__(2);
+var EE = __webpack_require__(10).EventEmitter;
+var inherits = __webpack_require__(3);
inherits(Stream, EE);
Stream.Readable = __webpack_require__(58);
Stream.Writable = __webpack_require__(60);
-Stream.Duplex = __webpack_require__(56);
+Stream.Duplex = __webpack_require__(55);
Stream.Transform = __webpack_require__(59);
Stream.PassThrough = __webpack_require__(57);
@@ -2010,6 +2010,192 @@ Stream.prototype.pipe = function(dest, options) {
/* 2 */
/***/ (function(module, exports) {
+// shim for using process in browser
+var process = module.exports = {};
+
+// cached from whatever global is present so that test runners that stub it
+// don't break things. But we need to wrap it in a try catch in case it is
+// wrapped in strict mode code which doesn't define any globals. It's inside a
+// function because try/catches deoptimize in certain engines.
+
+var cachedSetTimeout;
+var cachedClearTimeout;
+
+function defaultSetTimout() {
+ throw new Error('setTimeout has not been defined');
+}
+function defaultClearTimeout () {
+ throw new Error('clearTimeout has not been defined');
+}
+(function () {
+ try {
+ if (typeof setTimeout === 'function') {
+ cachedSetTimeout = setTimeout;
+ } else {
+ cachedSetTimeout = defaultSetTimout;
+ }
+ } catch (e) {
+ cachedSetTimeout = defaultSetTimout;
+ }
+ try {
+ if (typeof clearTimeout === 'function') {
+ cachedClearTimeout = clearTimeout;
+ } else {
+ cachedClearTimeout = defaultClearTimeout;
+ }
+ } catch (e) {
+ cachedClearTimeout = defaultClearTimeout;
+ }
+} ())
+function runTimeout(fun) {
+ if (cachedSetTimeout === setTimeout) {
+ //normal enviroments in sane situations
+ return setTimeout(fun, 0);
+ }
+ // if setTimeout wasn't available but was latter defined
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
+ cachedSetTimeout = setTimeout;
+ return setTimeout(fun, 0);
+ }
+ try {
+ // when when somebody has screwed with setTimeout but no I.E. maddness
+ return cachedSetTimeout(fun, 0);
+ } catch(e){
+ try {
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
+ return cachedSetTimeout.call(null, fun, 0);
+ } catch(e){
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
+ return cachedSetTimeout.call(this, fun, 0);
+ }
+ }
+
+
+}
+function runClearTimeout(marker) {
+ if (cachedClearTimeout === clearTimeout) {
+ //normal enviroments in sane situations
+ return clearTimeout(marker);
+ }
+ // if clearTimeout wasn't available but was latter defined
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
+ cachedClearTimeout = clearTimeout;
+ return clearTimeout(marker);
+ }
+ try {
+ // when when somebody has screwed with setTimeout but no I.E. maddness
+ return cachedClearTimeout(marker);
+ } catch (e){
+ try {
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
+ return cachedClearTimeout.call(null, marker);
+ } catch (e){
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
+ // Some versions of I.E. have different rules for clearTimeout vs setTimeout
+ return cachedClearTimeout.call(this, marker);
+ }
+ }
+
+
+
+}
+var queue = [];
+var draining = false;
+var currentQueue;
+var queueIndex = -1;
+
+function cleanUpNextTick() {
+ if (!draining || !currentQueue) {
+ return;
+ }
+ draining = false;
+ if (currentQueue.length) {
+ queue = currentQueue.concat(queue);
+ } else {
+ queueIndex = -1;
+ }
+ if (queue.length) {
+ drainQueue();
+ }
+}
+
+function drainQueue() {
+ if (draining) {
+ return;
+ }
+ var timeout = runTimeout(cleanUpNextTick);
+ draining = true;
+
+ var len = queue.length;
+ while(len) {
+ currentQueue = queue;
+ queue = [];
+ while (++queueIndex < len) {
+ if (currentQueue) {
+ currentQueue[queueIndex].run();
+ }
+ }
+ queueIndex = -1;
+ len = queue.length;
+ }
+ currentQueue = null;
+ draining = false;
+ runClearTimeout(timeout);
+}
+
+process.nextTick = function (fun) {
+ var args = new Array(arguments.length - 1);
+ if (arguments.length > 1) {
+ for (var i = 1; i < arguments.length; i++) {
+ args[i - 1] = arguments[i];
+ }
+ }
+ queue.push(new Item(fun, args));
+ if (queue.length === 1 && !draining) {
+ runTimeout(drainQueue);
+ }
+};
+
+// v8 likes predictible objects
+function Item(fun, array) {
+ this.fun = fun;
+ this.array = array;
+}
+Item.prototype.run = function () {
+ this.fun.apply(null, this.array);
+};
+process.title = 'browser';
+process.browser = true;
+process.env = {};
+process.argv = [];
+process.version = ''; // empty string to avoid regexp issues
+process.versions = {};
+
+function noop() {}
+
+process.on = noop;
+process.addListener = noop;
+process.once = noop;
+process.off = noop;
+process.removeListener = noop;
+process.removeAllListeners = noop;
+process.emit = noop;
+
+process.binding = function (name) {
+ throw new Error('process.binding is not supported');
+};
+
+process.cwd = function () { return '/' };
+process.chdir = function (dir) {
+ throw new Error('process.chdir is not supported');
+};
+process.umask = function() { return 0; };
+
+
+/***/ }),
+/* 3 */
+/***/ (function(module, exports) {
+
if (typeof Object.create === 'function') {
// implementation from standard node.js 'util' module
module.exports = function inherits(ctor, superCtor) {
@@ -2036,7 +2222,7 @@ if (typeof Object.create === 'function') {
/***/ }),
-/* 3 */
+/* 4 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.
@@ -2557,262 +2743,76 @@ 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 = __webpack_require__(62);
-
-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 = __webpack_require__(2);
-
-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);
-}
-
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10), __webpack_require__(4)))
-
-/***/ }),
-/* 4 */
-/***/ (function(module, exports) {
-
-// shim for using process in browser
-var process = module.exports = {};
-
-// cached from whatever global is present so that test runners that stub it
-// don't break things. But we need to wrap it in a try catch in case it is
-// wrapped in strict mode code which doesn't define any globals. It's inside a
-// function because try/catches deoptimize in certain engines.
-
-var cachedSetTimeout;
-var cachedClearTimeout;
-
-function defaultSetTimout() {
- throw new Error('setTimeout has not been defined');
-}
-function defaultClearTimeout () {
- throw new Error('clearTimeout has not been defined');
-}
-(function () {
- try {
- if (typeof setTimeout === 'function') {
- cachedSetTimeout = setTimeout;
- } else {
- cachedSetTimeout = defaultSetTimout;
- }
- } catch (e) {
- cachedSetTimeout = defaultSetTimout;
- }
- try {
- if (typeof clearTimeout === 'function') {
- cachedClearTimeout = clearTimeout;
- } else {
- cachedClearTimeout = defaultClearTimeout;
- }
- } catch (e) {
- cachedClearTimeout = defaultClearTimeout;
- }
-} ())
-function runTimeout(fun) {
- if (cachedSetTimeout === setTimeout) {
- //normal enviroments in sane situations
- return setTimeout(fun, 0);
- }
- // if setTimeout wasn't available but was latter defined
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
- cachedSetTimeout = setTimeout;
- return setTimeout(fun, 0);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedSetTimeout(fun, 0);
- } catch(e){
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedSetTimeout.call(null, fun, 0);
- } catch(e){
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
- return cachedSetTimeout.call(this, fun, 0);
- }
- }
-
-
-}
-function runClearTimeout(marker) {
- if (cachedClearTimeout === clearTimeout) {
- //normal enviroments in sane situations
- return clearTimeout(marker);
- }
- // if clearTimeout wasn't available but was latter defined
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
- cachedClearTimeout = clearTimeout;
- return clearTimeout(marker);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedClearTimeout(marker);
- } catch (e){
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedClearTimeout.call(null, marker);
- } catch (e){
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
- return cachedClearTimeout.call(this, marker);
- }
- }
-
-
-
-}
-var queue = [];
-var draining = false;
-var currentQueue;
-var queueIndex = -1;
-
-function cleanUpNextTick() {
- if (!draining || !currentQueue) {
- return;
- }
- draining = false;
- if (currentQueue.length) {
- queue = currentQueue.concat(queue);
- } else {
- queueIndex = -1;
- }
- if (queue.length) {
- drainQueue();
- }
-}
-
-function drainQueue() {
- if (draining) {
- return;
- }
- var timeout = runTimeout(cleanUpNextTick);
- draining = true;
-
- var len = queue.length;
- while(len) {
- currentQueue = queue;
- queue = [];
- while (++queueIndex < len) {
- if (currentQueue) {
- currentQueue[queueIndex].run();
- }
- }
- queueIndex = -1;
- len = queue.length;
- }
- currentQueue = null;
- draining = false;
- runClearTimeout(timeout);
+ typeof arg === 'number' ||
+ typeof arg === 'string' ||
+ typeof arg === 'symbol' || // ES6 symbol
+ typeof arg === 'undefined';
}
+exports.isPrimitive = isPrimitive;
-process.nextTick = function (fun) {
- var args = new Array(arguments.length - 1);
- if (arguments.length > 1) {
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
- queue.push(new Item(fun, args));
- if (queue.length === 1 && !draining) {
- runTimeout(drainQueue);
- }
-};
+exports.isBuffer = __webpack_require__(64);
-// v8 likes predictible objects
-function Item(fun, array) {
- this.fun = fun;
- this.array = array;
+function objectToString(o) {
+ return Object.prototype.toString.call(o);
}
-Item.prototype.run = function () {
- this.fun.apply(null, this.array);
-};
-process.title = 'browser';
-process.browser = true;
-process.env = {};
-process.argv = [];
-process.version = ''; // empty string to avoid regexp issues
-process.versions = {};
-function noop() {}
-process.on = noop;
-process.addListener = noop;
-process.once = noop;
-process.off = noop;
-process.removeListener = noop;
-process.removeAllListeners = noop;
-process.emit = noop;
+function pad(n) {
+ return n < 10 ? '0' + n.toString(10) : n.toString(10);
+}
-process.binding = function (name) {
- throw new Error('process.binding is not supported');
+
+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));
};
-process.cwd = function () { return '/' };
-process.chdir = function (dir) {
- throw new Error('process.chdir is not supported');
+
+/**
+ * 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 = __webpack_require__(63);
+
+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;
};
-process.umask = function() { return 0; };
+function hasOwnProperty(obj, prop) {
+ return Object.prototype.hasOwnProperty.call(obj, prop);
+}
+
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6), __webpack_require__(2)))
/***/ }),
/* 5 */
@@ -2827,55 +2827,49 @@ process.umask = function() { return 0; };
/**/
+
var objectKeys = Object.keys || function (obj) {
var keys = [];
- for (var key in obj) keys.push(key);
- return keys;
-}
+ for (var key in obj) {
+ keys.push(key);
+ }return keys;
+};
/**/
-
module.exports = Duplex;
/**/
-var processNextTick = __webpack_require__(12);
+var processNextTick = __webpack_require__(14);
/**/
-
-
/**/
-var util = __webpack_require__(6);
-util.inherits = __webpack_require__(2);
+var util = __webpack_require__(7);
+util.inherits = __webpack_require__(3);
/**/
-var Readable = __webpack_require__(27);
-var Writable = __webpack_require__(14);
+var Readable = __webpack_require__(29);
+var Writable = __webpack_require__(16);
util.inherits(Duplex, Readable);
var keys = objectKeys(Writable.prototype);
for (var v = 0; v < keys.length; v++) {
var method = keys[v];
- if (!Duplex.prototype[method])
- Duplex.prototype[method] = Writable.prototype[method];
+ if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
}
function Duplex(options) {
- if (!(this instanceof Duplex))
- return new 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.readable === false) this.readable = false;
- if (options && options.writable === false)
- this.writable = false;
+ if (options && options.writable === false) this.writable = false;
this.allowHalfOpen = true;
- if (options && options.allowHalfOpen === false)
- this.allowHalfOpen = false;
+ if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
this.once('end', onend);
}
@@ -2884,8 +2878,7 @@ function Duplex(options) {
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;
+ if (this.allowHalfOpen || this._writableState.ended) return;
// no more data can be written.
// But allow more writes to happen in this tick.
@@ -2896,15 +2889,41 @@ function onEndNT(self) {
self.end();
}
-function forEach (xs, f) {
+function forEach(xs, f) {
for (var i = 0, l = xs.length; i < l; i++) {
f(xs[i], i);
}
}
-
/***/ }),
/* 6 */
+/***/ (function(module, exports) {
+
+var g;
+
+// This works in non-strict mode
+g = (function() {
+ return this;
+})();
+
+try {
+ // This works if eval is allowed (see CSP)
+ g = g || Function("return this")() || (1,eval)("this");
+} catch(e) {
+ // This works if the window reference is available
+ if(typeof window === "object")
+ g = window;
+}
+
+// g can still be undefined, but nothing to do about it...
+// We return undefined, instead of nothing here, so it's
+// easier to handle this case. if(!global) { ...}
+
+module.exports = g;
+
+
+/***/ }),
+/* 7 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors.
@@ -3018,7 +3037,7 @@ function objectToString(o) {
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
/***/ }),
-/* 7 */
+/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -3049,10 +3068,10 @@ module.exports = function promise(stream) {
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
/***/ }),
-/* 8 */
+/* 9 */
/***/ (function(module, exports, __webpack_require__) {
-var clone = __webpack_require__(36);
+var clone = __webpack_require__(38);
module.exports = function(options, defaults) {
options = options || {};
@@ -3067,7 +3086,7 @@ module.exports = function(options, defaults) {
};
/***/ }),
-/* 9 */
+/* 10 */
/***/ (function(module, exports) {
// Copyright Joyent, Inc. and other Node contributors.
@@ -3374,33 +3393,6 @@ function isUndefined(arg) {
}
-/***/ }),
-/* 10 */
-/***/ (function(module, exports) {
-
-var g;
-
-// This works in non-strict mode
-g = (function() {
- return this;
-})();
-
-try {
- // This works if eval is allowed (see CSP)
- g = g || Function("return this")() || (1,eval)("this");
-} catch(e) {
- // This works if the window reference is available
- if(typeof window === "object")
- g = window;
-}
-
-// g can still be undefined, but nothing to do about it...
-// We return undefined, instead of nothing here, so it's
-// easier to handle this case. if(!global) { ...}
-
-module.exports = g;
-
-
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
@@ -3669,6 +3661,133 @@ if (typeof module === 'object' && module.exports) {
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
+"use strict";
+/* WEBPACK VAR INJECTION */(function(global) {
+
+var buffer = __webpack_require__(0);
+var Buffer = buffer.Buffer;
+var SlowBuffer = buffer.SlowBuffer;
+var MAX_LEN = buffer.kMaxLength || 2147483647;
+exports.alloc = function alloc(size, fill, encoding) {
+ if (typeof Buffer.alloc === 'function') {
+ return Buffer.alloc(size, fill, encoding);
+ }
+ if (typeof encoding === 'number') {
+ throw new TypeError('encoding must not be number');
+ }
+ if (typeof size !== 'number') {
+ throw new TypeError('size must be a number');
+ }
+ if (size > MAX_LEN) {
+ throw new RangeError('size is too large');
+ }
+ var enc = encoding;
+ var _fill = fill;
+ if (_fill === undefined) {
+ enc = undefined;
+ _fill = 0;
+ }
+ var buf = new Buffer(size);
+ if (typeof _fill === 'string') {
+ var fillBuf = new Buffer(_fill, enc);
+ var flen = fillBuf.length;
+ var i = -1;
+ while (++i < size) {
+ buf[i] = fillBuf[i % flen];
+ }
+ } else {
+ buf.fill(_fill);
+ }
+ return buf;
+}
+exports.allocUnsafe = function allocUnsafe(size) {
+ if (typeof Buffer.allocUnsafe === 'function') {
+ return Buffer.allocUnsafe(size);
+ }
+ if (typeof size !== 'number') {
+ throw new TypeError('size must be a number');
+ }
+ if (size > MAX_LEN) {
+ throw new RangeError('size is too large');
+ }
+ return new Buffer(size);
+}
+exports.from = function from(value, encodingOrOffset, length) {
+ if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) {
+ return Buffer.from(value, encodingOrOffset, length);
+ }
+ if (typeof value === 'number') {
+ throw new TypeError('"value" argument must not be a number');
+ }
+ if (typeof value === 'string') {
+ return new Buffer(value, encodingOrOffset);
+ }
+ if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
+ var offset = encodingOrOffset;
+ if (arguments.length === 1) {
+ return new Buffer(value);
+ }
+ if (typeof offset === 'undefined') {
+ offset = 0;
+ }
+ var len = length;
+ if (typeof len === 'undefined') {
+ len = value.byteLength - offset;
+ }
+ if (offset >= value.byteLength) {
+ throw new RangeError('\'offset\' is out of bounds');
+ }
+ if (len > value.byteLength - offset) {
+ throw new RangeError('\'length\' is out of bounds');
+ }
+ return new Buffer(value.slice(offset, offset + len));
+ }
+ if (Buffer.isBuffer(value)) {
+ var out = new Buffer(value.length);
+ value.copy(out, 0, 0, value.length);
+ return out;
+ }
+ if (value) {
+ if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) {
+ return new Buffer(value);
+ }
+ if (value.type === 'Buffer' && Array.isArray(value.data)) {
+ return new Buffer(value.data);
+ }
+ }
+
+ throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.');
+}
+exports.allocUnsafeSlow = function allocUnsafeSlow(size) {
+ if (typeof Buffer.allocUnsafeSlow === 'function') {
+ return Buffer.allocUnsafeSlow(size);
+ }
+ if (typeof size !== 'number') {
+ throw new TypeError('size must be a number');
+ }
+ if (size >= MAX_LEN) {
+ throw new RangeError('size is too large');
+ }
+ return new SlowBuffer(size);
+}
+
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6)))
+
+/***/ }),
+/* 13 */
+/***/ (function(module, exports) {
+
+var toString = {}.toString;
+
+module.exports = Array.isArray || function (arr) {
+ return toString.call(arr) == '[object Array]';
+};
+
+
+/***/ }),
+/* 14 */
+/***/ (function(module, exports, __webpack_require__) {
+
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
@@ -3680,21 +3799,44 @@ if (!process.version ||
module.exports = process.nextTick;
}
-function nextTick(fn) {
- var args = new Array(arguments.length - 1);
- var i = 0;
- while (i < args.length) {
- args[i++] = arguments[i];
+function nextTick(fn, arg1, arg2, arg3) {
+ if (typeof fn !== 'function') {
+ throw new TypeError('"callback" argument must be a function');
+ }
+ var len = arguments.length;
+ var args, i;
+ switch (len) {
+ case 0:
+ case 1:
+ return process.nextTick(fn);
+ case 2:
+ return process.nextTick(function afterTickOne() {
+ fn.call(null, arg1);
+ });
+ case 3:
+ return process.nextTick(function afterTickTwo() {
+ fn.call(null, arg1, arg2);
+ });
+ case 4:
+ return process.nextTick(function afterTickThree() {
+ fn.call(null, arg1, arg2, arg3);
+ });
+ default:
+ args = new Array(len - 1);
+ i = 0;
+ while (i < args.length) {
+ args[i++] = arguments[i];
+ }
+ return process.nextTick(function afterTick() {
+ fn.apply(null, args);
+ });
}
- process.nextTick(function afterTick() {
- fn.apply(null, args);
- });
}
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4)))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
-/* 13 */
+/* 15 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -3747,15 +3889,14 @@ module.exports = Transform;
var Duplex = __webpack_require__(5);
/**/
-var util = __webpack_require__(6);
-util.inherits = __webpack_require__(2);
+var util = __webpack_require__(7);
+util.inherits = __webpack_require__(3);
/**/
util.inherits(Transform, Duplex);
-
function TransformState(stream) {
- this.afterTransform = function(er, data) {
+ this.afterTransform = function (er, data) {
return afterTransform(stream, er, data);
};
@@ -3763,6 +3904,7 @@ function TransformState(stream) {
this.transforming = false;
this.writecb = null;
this.writechunk = null;
+ this.writeencoding = null;
}
function afterTransform(stream, er, data) {
@@ -3771,17 +3913,14 @@ function afterTransform(stream, er, data) {
var cb = ts.writecb;
- if (!cb)
- return stream.emit('error', new Error('no writecb in Transform class'));
+ 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 (data !== null && data !== undefined) stream.push(data);
- if (cb)
- cb(er);
+ cb(er);
var rs = stream._readableState;
rs.reading = false;
@@ -3790,16 +3929,13 @@ function afterTransform(stream, er, data) {
}
}
-
function Transform(options) {
- if (!(this instanceof Transform))
- return new Transform(options);
+ if (!(this instanceof Transform)) return new Transform(options);
Duplex.call(this, options);
this._transformState = new TransformState(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.
@@ -3811,24 +3947,20 @@ function Transform(options) {
this._readableState.sync = false;
if (options) {
- if (typeof options.transform === 'function')
- this._transform = options.transform;
+ if (typeof options.transform === 'function') this._transform = options.transform;
- if (typeof options.flush === 'function')
- this._flush = options.flush;
+ if (typeof options.flush === 'function') this._flush = options.flush;
}
- this.once('prefinish', function() {
- if (typeof this._flush === 'function')
- this._flush(function(er) {
- done(stream, er);
- });
- else
- done(stream);
+ // When the writable side finishes, then flush out anything remaining.
+ this.once('prefinish', function () {
+ if (typeof this._flush === 'function') this._flush(function (er, data) {
+ done(stream, er, data);
+ });else done(stream);
});
}
-Transform.prototype.push = function(chunk, encoding) {
+Transform.prototype.push = function (chunk, encoding) {
this._transformState.needTransform = false;
return Duplex.prototype.push.call(this, chunk, encoding);
};
@@ -3843,28 +3975,25 @@ Transform.prototype.push = function(chunk, encoding) {
// 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._transform = function (chunk, encoding, cb) {
+ throw new Error('_transform() is not implemented');
};
-Transform.prototype._write = function(chunk, encoding, cb) {
+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);
+ 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) {
+Transform.prototype._read = function (n) {
var ts = this._transformState;
if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
@@ -3877,32 +4006,29 @@ Transform.prototype._read = function(n) {
}
};
+function done(stream, er, data) {
+ if (er) return stream.emit('error', er);
-function done(stream, er) {
- if (er)
- return stream.emit('error', er);
+ if (data !== null && data !== undefined) stream.push(data);
// if there's nothing in the write buffer, then that means
// that nothing more will ever be provided
var ws = stream._writableState;
var ts = stream._transformState;
- if (ws.length)
- throw new Error('calling transform done when ws.length != 0');
+ 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');
+ if (ts.transforming) throw new Error('Calling transform done when still transforming');
return stream.push(null);
}
-
/***/ }),
-/* 14 */
+/* 16 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-// A bit simpler than readable streams.
+/* WEBPACK VAR INJECTION */(function(process, setImmediate) {// A bit simpler than readable streams.
// Implement an async ._write(chunk, encoding, cb), and it'll handle all
// the drain event emission and buffering.
@@ -3911,42 +4037,45 @@ function done(stream, er) {
module.exports = Writable;
/**/
-var processNextTick = __webpack_require__(12);
+var processNextTick = __webpack_require__(14);
/**/
+/**/
+var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
+/**/
/**/
-var Buffer = __webpack_require__(0).Buffer;
+var Duplex;
/**/
Writable.WritableState = WritableState;
-
/**/
-var util = __webpack_require__(6);
-util.inherits = __webpack_require__(2);
+var util = __webpack_require__(7);
+util.inherits = __webpack_require__(3);
/**/
-
/**/
var internalUtil = {
- deprecate: __webpack_require__(61)
+ deprecate: __webpack_require__(62)
};
/**/
-
-
/**/
var Stream;
-(function (){try{
- Stream = __webpack_require__(1);
-}catch(_){}finally{
- if (!Stream)
- Stream = __webpack_require__(9).EventEmitter;
-}}())
+(function () {
+ try {
+ Stream = __webpack_require__(1);
+ } catch (_) {} finally {
+ if (!Stream) Stream = __webpack_require__(10).EventEmitter;
+ }
+})();
/**/
var Buffer = __webpack_require__(0).Buffer;
+/**/
+var bufferShim = __webpack_require__(12);
+/**/
util.inherits(Writable, Stream);
@@ -3959,7 +4088,6 @@ function WriteReq(chunk, encoding, cb) {
this.next = null;
}
-var Duplex;
function WritableState(options, stream) {
Duplex = Duplex || __webpack_require__(5);
@@ -3969,19 +4097,19 @@ function WritableState(options, stream) {
// contains buffers or objects.
this.objectMode = !!options.objectMode;
- if (stream instanceof Duplex)
- this.objectMode = this.objectMode || !!options.writableObjectMode;
+ if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
// 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;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
- this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
+ this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
// cast to ints.
- this.highWaterMark = ~~this.highWaterMark;
+ this.highWaterMark = ~ ~this.highWaterMark;
+ // drain event flag.
this.needDrain = false;
// at the start of calling end()
this.ending = false;
@@ -4024,7 +4152,7 @@ function WritableState(options, stream) {
this.bufferProcessing = false;
// the callback that's passed to _write(chunk,cb)
- this.onwrite = function(er) {
+ this.onwrite = function (er) {
onwrite(stream, er);
};
@@ -4047,9 +4175,16 @@ function WritableState(options, stream) {
// True if the error was already emitted and should not be thrown again
this.errorEmitted = false;
+
+ // count buffered requests
+ this.bufferedRequestCount = 0;
+
+ // allocate the first CorkedRequest, there is always
+ // one allocated and free to use, and we maintain at most two
+ this.corkedRequestsFree = new CorkedRequest(this);
}
-WritableState.prototype.getBuffer = function writableStateGetBuffer() {
+WritableState.prototype.getBuffer = function getBuffer() {
var current = this.bufferedRequest;
var out = [];
while (current) {
@@ -4059,24 +4194,47 @@ WritableState.prototype.getBuffer = function writableStateGetBuffer() {
return out;
};
-(function (){try {
-Object.defineProperty(WritableState.prototype, 'buffer', {
- get: internalUtil.deprecate(function() {
- return this.getBuffer();
- }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' +
- 'instead.')
-});
-}catch(_){}}());
+(function () {
+ try {
+ Object.defineProperty(WritableState.prototype, 'buffer', {
+ get: internalUtil.deprecate(function () {
+ return this.getBuffer();
+ }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
+ });
+ } catch (_) {}
+})();
+
+// Test _writableState for inheritance to account for Duplex streams,
+// whose prototype chain only points to Readable.
+var realHasInstance;
+if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
+ realHasInstance = Function.prototype[Symbol.hasInstance];
+ Object.defineProperty(Writable, Symbol.hasInstance, {
+ value: function (object) {
+ if (realHasInstance.call(this, object)) return true;
+ return object && object._writableState instanceof WritableState;
+ }
+ });
+} else {
+ realHasInstance = function (object) {
+ return object instanceof this;
+ };
+}
-var Duplex;
function Writable(options) {
Duplex = Duplex || __webpack_require__(5);
- // Writable ctor is applied to Duplexes, though they're not
- // instanceof Writable, they're instanceof Readable.
- if (!(this instanceof Writable) && !(this instanceof Duplex))
+ // Writable ctor is applied to Duplexes, too.
+ // `realHasInstance` is necessary because using plain `instanceof`
+ // would return false, as no `_writableState` property is attached.
+
+ // Trying to use the custom `instanceof` for Writable here will also break the
+ // Node.js LazyTransform implementation, which has a non-trivial getter for
+ // `_writableState` that would lead to infinite recursion.
+ if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
return new Writable(options);
+ }
this._writableState = new WritableState(options, this);
@@ -4084,22 +4242,19 @@ function Writable(options) {
this.writable = true;
if (options) {
- if (typeof options.write === 'function')
- this._write = options.write;
+ if (typeof options.write === 'function') this._write = options.write;
- if (typeof options.writev === 'function')
- this._writev = options.writev;
+ if (typeof options.writev === 'function') this._writev = options.writev;
}
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.'));
+Writable.prototype.pipe = function () {
+ this.emit('error', new Error('Cannot pipe, not readable'));
};
-
function writeAfterEnd(stream, cb) {
var er = new Error('write after end');
// TODO: defer error events consistently everywhere, not just the cb
@@ -4114,13 +4269,16 @@ function writeAfterEnd(stream, cb) {
// how many bytes or characters.
function validChunk(stream, state, chunk, cb) {
var valid = true;
-
- if (!(Buffer.isBuffer(chunk)) &&
- typeof chunk !== 'string' &&
- chunk !== null &&
- chunk !== undefined &&
- !state.objectMode) {
- var er = new TypeError('Invalid non-string/buffer chunk');
+ var er = false;
+ // Always throw error if a null is written
+ // if we are not in object mode then throw
+ // if it is not a buffer, string, or undefined.
+ if (chunk === null) {
+ er = new TypeError('May not write null values to stream');
+ } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
+ er = new TypeError('Invalid non-string/buffer chunk');
+ }
+ if (er) {
stream.emit('error', er);
processNextTick(cb, er);
valid = false;
@@ -4128,7 +4286,7 @@ function validChunk(stream, state, chunk, cb) {
return valid;
}
-Writable.prototype.write = function(chunk, encoding, cb) {
+Writable.prototype.write = function (chunk, encoding, cb) {
var state = this._writableState;
var ret = false;
@@ -4137,17 +4295,11 @@ Writable.prototype.write = function(chunk, encoding, cb) {
encoding = null;
}
- if (Buffer.isBuffer(chunk))
- encoding = 'buffer';
- else if (!encoding)
- encoding = state.defaultEncoding;
+ if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
- if (typeof cb !== 'function')
- cb = nop;
+ if (typeof cb !== 'function') cb = nop;
- if (state.ended)
- writeAfterEnd(this, cb);
- else if (validChunk(this, state, chunk, cb)) {
+ if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) {
state.pendingcb++;
ret = writeOrBuffer(this, state, chunk, encoding, cb);
}
@@ -4155,43 +4307,33 @@ Writable.prototype.write = function(chunk, encoding, cb) {
return ret;
};
-Writable.prototype.cork = function() {
+Writable.prototype.cork = function () {
var state = this._writableState;
state.corked++;
};
-Writable.prototype.uncork = function() {
+Writable.prototype.uncork = function () {
var state = this._writableState;
if (state.corked) {
state.corked--;
- if (!state.writing &&
- !state.corked &&
- !state.finished &&
- !state.bufferProcessing &&
- state.bufferedRequest)
- clearBuffer(this, state);
+ if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
}
};
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
// node::ParseEncoding() requires lower case.
- if (typeof encoding === 'string')
- encoding = encoding.toLowerCase();
- if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64',
-'ucs2', 'ucs-2','utf16le', 'utf-16le', 'raw']
-.indexOf((encoding + '').toLowerCase()) > -1))
- throw new TypeError('Unknown encoding: ' + encoding);
+ if (typeof encoding === 'string') encoding = encoding.toLowerCase();
+ if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
this._writableState.defaultEncoding = encoding;
+ return this;
};
function decodeChunk(state, chunk, encoding) {
- if (!state.objectMode &&
- state.decodeStrings !== false &&
- typeof chunk === 'string') {
- chunk = new Buffer(chunk, encoding);
+ if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
+ chunk = bufferShim.from(chunk, encoding);
}
return chunk;
}
@@ -4202,16 +4344,14 @@ function decodeChunk(state, chunk, encoding) {
function writeOrBuffer(stream, state, chunk, encoding, cb) {
chunk = decodeChunk(state, chunk, encoding);
- if (Buffer.isBuffer(chunk))
- encoding = 'buffer';
+ 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 (!ret) state.needDrain = true;
if (state.writing || state.corked) {
var last = state.lastBufferedRequest;
@@ -4221,6 +4361,7 @@ function writeOrBuffer(stream, state, chunk, encoding, cb) {
} else {
state.bufferedRequest = state.lastBufferedRequest;
}
+ state.bufferedRequestCount += 1;
} else {
doWrite(stream, state, false, len, chunk, encoding, cb);
}
@@ -4233,19 +4374,13 @@ function doWrite(stream, state, writev, len, chunk, encoding, cb) {
state.writecb = cb;
state.writing = true;
state.sync = true;
- if (writev)
- stream._writev(chunk, state.onwrite);
- else
- stream._write(chunk, encoding, state.onwrite);
+ if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
state.sync = false;
}
function onwriteError(stream, state, sync, er, cb) {
--state.pendingcb;
- if (sync)
- processNextTick(cb, er);
- else
- cb(er);
+ if (sync) processNextTick(cb, er);else cb(er);
stream._writableState.errorEmitted = true;
stream.emit('error', er);
@@ -4265,30 +4400,26 @@ function onwrite(stream, er) {
onwriteStateUpdate(state);
- if (er)
- onwriteError(stream, state, sync, er, cb);
- else {
+ 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(state);
- if (!finished &&
- !state.corked &&
- !state.bufferProcessing &&
- state.bufferedRequest) {
+ if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
clearBuffer(stream, state);
}
if (sync) {
- processNextTick(afterWrite, stream, state, finished, cb);
+ /**/
+ asyncWrite(afterWrite, stream, state, finished, cb);
+ /**/
} else {
- afterWrite(stream, state, finished, cb);
- }
+ afterWrite(stream, state, finished, cb);
+ }
}
}
function afterWrite(stream, state, finished, cb) {
- if (!finished)
- onwriteDrain(stream, state);
+ if (!finished) onwriteDrain(stream, state);
state.pendingcb--;
cb();
finishMaybe(stream, state);
@@ -4304,7 +4435,6 @@ function onwriteDrain(stream, state) {
}
}
-
// if there's something in the buffer waiting, then process it
function clearBuffer(stream, state) {
state.bufferProcessing = true;
@@ -4312,26 +4442,30 @@ function clearBuffer(stream, state) {
if (stream._writev && entry && entry.next) {
// Fast case, write everything using _writev()
- var buffer = [];
- var cbs = [];
+ var l = state.bufferedRequestCount;
+ var buffer = new Array(l);
+ var holder = state.corkedRequestsFree;
+ holder.entry = entry;
+
+ var count = 0;
while (entry) {
- cbs.push(entry.callback);
- buffer.push(entry);
+ buffer[count] = entry;
entry = entry.next;
+ count += 1;
}
- // count the one we are adding, as well.
- // TODO(isaacs) clean this up
+ doWrite(stream, state, true, state.length, buffer, '', holder.finish);
+
+ // doWrite is almost always async, defer these to save a bit of time
+ // as the hot path ends with doWrite
state.pendingcb++;
state.lastBufferedRequest = null;
- doWrite(stream, state, true, state.length, buffer, '', function(err) {
- for (var i = 0; i < cbs.length; i++) {
- state.pendingcb--;
- cbs[i](err);
- }
- });
-
- // Clear buffer
+ if (holder.next) {
+ state.corkedRequestsFree = holder.next;
+ holder.next = null;
+ } else {
+ state.corkedRequestsFree = new CorkedRequest(state);
+ }
} else {
// Slow case, write chunks one-by-one
while (entry) {
@@ -4351,20 +4485,21 @@ function clearBuffer(stream, state) {
}
}
- if (entry === null)
- state.lastBufferedRequest = null;
+ if (entry === null) state.lastBufferedRequest = null;
}
+
+ state.bufferedRequestCount = 0;
state.bufferedRequest = entry;
state.bufferProcessing = false;
}
-Writable.prototype._write = function(chunk, encoding, cb) {
- cb(new Error('not implemented'));
+Writable.prototype._write = function (chunk, encoding, cb) {
+ cb(new Error('_write() is not implemented'));
};
Writable.prototype._writev = null;
-Writable.prototype.end = function(chunk, encoding, cb) {
+Writable.prototype.end = function (chunk, encoding, cb) {
var state = this._writableState;
if (typeof chunk === 'function') {
@@ -4376,8 +4511,7 @@ Writable.prototype.end = function(chunk, encoding, cb) {
encoding = null;
}
- if (chunk !== null && chunk !== undefined)
- this.write(chunk, encoding);
+ if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
// .end() fully uncorks
if (state.corked) {
@@ -4386,17 +4520,11 @@ Writable.prototype.end = function(chunk, encoding, cb) {
}
// ignore unnecessary end() calls.
- if (!state.ending && !state.finished)
- endWritable(this, state, cb);
+ if (!state.ending && !state.finished) endWritable(this, state, cb);
};
-
function needFinish(state) {
- return (state.ending &&
- state.length === 0 &&
- state.bufferedRequest === null &&
- !state.finished &&
- !state.writing);
+ return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
}
function prefinish(stream, state) {
@@ -4424,26 +4552,49 @@ function endWritable(stream, state, cb) {
state.ending = true;
finishMaybe(stream, state);
if (cb) {
- if (state.finished)
- processNextTick(cb);
- else
- stream.once('finish', cb);
+ if (state.finished) processNextTick(cb);else stream.once('finish', cb);
}
state.ended = true;
+ stream.writable = false;
}
+// It seems a linked list but it is not
+// there will be only 2 of these for each stream
+function CorkedRequest(state) {
+ var _this = this;
+
+ this.next = null;
+ this.entry = null;
+
+ this.finish = function (err) {
+ var entry = _this.entry;
+ _this.entry = null;
+ while (entry) {
+ var cb = entry.callback;
+ state.pendingcb--;
+ cb(err);
+ entry = entry.next;
+ }
+ if (state.corkedRequestsFree) {
+ state.corkedRequestsFree.next = _this;
+ } else {
+ state.corkedRequestsFree = _this;
+ }
+ };
+}
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(48).setImmediate))
/***/ }),
-/* 15 */
+/* 17 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var Transform = __webpack_require__(1).Transform;
-var util = __webpack_require__(3);
+var util = __webpack_require__(4);
var clone = __webpack_require__(11);
-var defaults = __webpack_require__(8);
+var defaults = __webpack_require__(9);
/**
* Applies some basic formatting to transcriptions:
@@ -4602,13 +4753,13 @@ FormatStream.prototype.formatResult = function formatResult(data) {
return data;
};
-FormatStream.prototype.promise = __webpack_require__(7);
+FormatStream.prototype.promise = __webpack_require__(8);
module.exports = FormatStream;
/***/ }),
-/* 16 */
+/* 18 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -4631,11 +4782,11 @@ module.exports = FormatStream;
var Duplex = __webpack_require__(1).Duplex;
-var util = __webpack_require__(3);
-var pick = __webpack_require__(21);
-var W3CWebSocket = __webpack_require__(63).w3cwebsocket;
-var contentType = __webpack_require__(28);
-var qs = __webpack_require__(33);
+var util = __webpack_require__(4);
+var pick = __webpack_require__(23);
+var W3CWebSocket = __webpack_require__(65).w3cwebsocket;
+var contentType = __webpack_require__(30);
+var qs = __webpack_require__(35);
var OPENING_MESSAGE_PARAMS_ALLOWED = [
'continuous',
@@ -5000,7 +5151,7 @@ RecognizeStream.prototype.finish = function finish() {
}
};
-RecognizeStream.prototype.promise = __webpack_require__(7);
+RecognizeStream.prototype.promise = __webpack_require__(8);
RecognizeStream.getContentType = function(buffer) {
// the substr really shouldn't be necessary, but there's a bug somewhere that can cause buffer.slice(0,4) to return
@@ -5010,10 +5161,10 @@ RecognizeStream.getContentType = function(buffer) {
module.exports = RecognizeStream;
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4)))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
-/* 17 */
+/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -5036,7 +5187,7 @@ module.exports = RecognizeStream;
var Transform = __webpack_require__(1).Transform;
-var util = __webpack_require__(3);
+var util = __webpack_require__(4);
var clone = __webpack_require__(11);
/**
@@ -5072,13 +5223,13 @@ ResultStream.prototype._transform = function(data, encoding, next) {
next();
};
-ResultStream.prototype.promise = __webpack_require__(7);
+ResultStream.prototype.promise = __webpack_require__(8);
module.exports = ResultStream;
/***/ }),
-/* 18 */
+/* 20 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -5101,9 +5252,9 @@ module.exports = ResultStream;
var Transform = __webpack_require__(1).Transform;
-var util = __webpack_require__(3);
-var pullAllWith = __webpack_require__(42);
-var noTimestamps = __webpack_require__(30);
+var util = __webpack_require__(4);
+var pullAllWith = __webpack_require__(43);
+var noTimestamps = __webpack_require__(32);
var clone = __webpack_require__(11);
/**
@@ -5461,21 +5612,21 @@ SpeakerStream.prototype._flush = function(done) {
done();
};
-SpeakerStream.prototype.promise = __webpack_require__(7);
+SpeakerStream.prototype.promise = __webpack_require__(8);
module.exports = SpeakerStream;
/***/ }),
-/* 19 */
+/* 21 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var Writable = __webpack_require__(1).Writable;
-var util = __webpack_require__(3);
-var defaults = __webpack_require__(8);
+var util = __webpack_require__(4);
+var defaults = __webpack_require__(9);
/**
* Writable stream that accepts results in either object or string mode and outputs the text to a supplied html element
@@ -5549,7 +5700,7 @@ module.exports = WritableElementStream;
/***/ }),
-/* 20 */
+/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -5559,7 +5710,7 @@ module.exports = WritableElementStream;
var has = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;
var slice = Array.prototype.slice;
-var isArgs = __webpack_require__(54);
+var isArgs = __webpack_require__(52);
var isEnumerable = Object.prototype.propertyIsEnumerable;
var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
@@ -5696,7 +5847,7 @@ module.exports = keysShim;
/***/ }),
-/* 21 */
+/* 23 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -5709,7 +5860,7 @@ module.exports = keysShim;
-var isObject = __webpack_require__(45);
+var isObject = __webpack_require__(42);
module.exports = function pick(obj, keys) {
if (!isObject(obj) && typeof obj !== 'function') {
@@ -5738,7 +5889,7 @@ module.exports = function pick(obj, keys) {
/***/ }),
-/* 22 */
+/* 24 */
/***/ (function(module, exports, __webpack_require__) {
// Copyright Joyent, Inc. and other Node contributors.
@@ -5965,7 +6116,7 @@ function base64DetectIncompleteChar(buffer) {
/***/ }),
-/* 23 */
+/* 25 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// loosely based on example code at https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
@@ -6081,13 +6232,13 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// loosely based
/***/ }),
-/* 24 */
+/* 26 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer, process) {
var Readable = __webpack_require__(1).Readable;
-var util = __webpack_require__(3);
+var util = __webpack_require__(4);
/**
* Turns a MediaStream object (from getUserMedia) into a Node.js Readable stream and optionally converts the audio to Buffers
@@ -6197,16 +6348,16 @@ MicrophoneStream.toRaw = function toFloat32(chunk) {
module.exports = MicrophoneStream;
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer, __webpack_require__(4)))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer, __webpack_require__(2)))
/***/ }),
-/* 25 */
+/* 27 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var implementation = __webpack_require__(53);
+var implementation = __webpack_require__(54);
var lacksProperEnumerationOrder = function () {
if (!Object.assign) {
@@ -6258,7 +6409,7 @@ module.exports = function getPolyfill() {
/***/ }),
-/* 26 */
+/* 28 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -6270,29 +6421,27 @@ module.exports = function getPolyfill() {
module.exports = PassThrough;
-var Transform = __webpack_require__(13);
+var Transform = __webpack_require__(15);
/**/
-var util = __webpack_require__(6);
-util.inherits = __webpack_require__(2);
+var util = __webpack_require__(7);
+util.inherits = __webpack_require__(3);
/**/
util.inherits(PassThrough, Transform);
function PassThrough(options) {
- if (!(this instanceof PassThrough))
- return new PassThrough(options);
+ if (!(this instanceof PassThrough)) return new PassThrough(options);
Transform.call(this, options);
}
-PassThrough.prototype._transform = function(chunk, encoding, cb) {
+PassThrough.prototype._transform = function (chunk, encoding, cb) {
cb(null, chunk);
};
-
/***/ }),
-/* 27 */
+/* 29 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -6301,53 +6450,51 @@ PassThrough.prototype._transform = function(chunk, encoding, cb) {
module.exports = Readable;
/**/
-var processNextTick = __webpack_require__(12);
+var processNextTick = __webpack_require__(14);
/**/
-
/**/
-var isArray = __webpack_require__(41);
+var isArray = __webpack_require__(13);
/**/
-
/**/
-var Buffer = __webpack_require__(0).Buffer;
+var Duplex;
/**/
Readable.ReadableState = ReadableState;
-var EE = __webpack_require__(9);
-
/**/
-var EElistenerCount = function(emitter, type) {
+var EE = __webpack_require__(10).EventEmitter;
+
+var EElistenerCount = function (emitter, type) {
return emitter.listeners(type).length;
};
/**/
-
-
/**/
var Stream;
-(function (){try{
- Stream = __webpack_require__(1);
-}catch(_){}finally{
- if (!Stream)
- Stream = __webpack_require__(9).EventEmitter;
-}}())
+(function () {
+ try {
+ Stream = __webpack_require__(1);
+ } catch (_) {} finally {
+ if (!Stream) Stream = __webpack_require__(10).EventEmitter;
+ }
+})();
/**/
var Buffer = __webpack_require__(0).Buffer;
-
/**/
-var util = __webpack_require__(6);
-util.inherits = __webpack_require__(2);
+var bufferShim = __webpack_require__(12);
/**/
-
+/**/
+var util = __webpack_require__(7);
+util.inherits = __webpack_require__(3);
+/**/
/**/
-var debugUtil = __webpack_require__(72);
-var debug;
+var debugUtil = __webpack_require__(74);
+var debug = void 0;
if (debugUtil && debugUtil.debuglog) {
debug = debugUtil.debuglog('stream');
} else {
@@ -6355,11 +6502,25 @@ if (debugUtil && debugUtil.debuglog) {
}
/**/
+var BufferList = __webpack_require__(56);
var StringDecoder;
util.inherits(Readable, Stream);
-var Duplex;
+function prependListener(emitter, event, fn) {
+ // Sadly this is not cacheable as some libraries bundle their own
+ // event emitter implementation with them.
+ if (typeof emitter.prependListener === 'function') {
+ return emitter.prependListener(event, fn);
+ } else {
+ // This is a hack to make sure that our error handler is attached before any
+ // userland ones. NEVER DO THIS. This is here only because this code needs
+ // to continue to work with older versions of Node.js that do not include
+ // the prependListener() method. The goal is to eventually remove this hack.
+ if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
+ }
+}
+
function ReadableState(options, stream) {
Duplex = Duplex || __webpack_require__(5);
@@ -6369,19 +6530,21 @@ function ReadableState(options, stream) {
// make all the buffer merging and length checks go away
this.objectMode = !!options.objectMode;
- if (stream instanceof Duplex)
- this.objectMode = this.objectMode || !!options.readableObjectMode;
+ if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
// 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;
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
- this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
+ this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
// cast to ints.
- this.highWaterMark = ~~this.highWaterMark;
+ this.highWaterMark = ~ ~this.highWaterMark;
- this.buffer = [];
+ // A linked list is used to store data chunks instead of an array because the
+ // linked list can remove elements from the beginning faster than
+ // array.shift()
+ this.buffer = new BufferList();
this.length = 0;
this.pipes = null;
this.pipesCount = 0;
@@ -6401,6 +6564,7 @@ function ReadableState(options, stream) {
this.needReadable = false;
this.emittedReadable = false;
this.readableListening = false;
+ this.resumeScheduled = false;
// Crypto is kind of old and crusty. Historically, its default string
// encoding is 'binary' so we have to make this configurable.
@@ -6420,27 +6584,23 @@ function ReadableState(options, stream) {
this.decoder = null;
this.encoding = null;
if (options.encoding) {
- if (!StringDecoder)
- StringDecoder = __webpack_require__(22).StringDecoder;
+ if (!StringDecoder) StringDecoder = __webpack_require__(24).StringDecoder;
this.decoder = new StringDecoder(options.encoding);
this.encoding = options.encoding;
}
}
-var Duplex;
function Readable(options) {
Duplex = Duplex || __webpack_require__(5);
- if (!(this instanceof Readable))
- return new Readable(options);
+ if (!(this instanceof Readable)) return new Readable(options);
this._readableState = new ReadableState(options, this);
// legacy
this.readable = true;
- if (options && typeof options.read === 'function')
- this._read = options.read;
+ if (options && typeof options.read === 'function') this._read = options.read;
Stream.call(this);
}
@@ -6449,13 +6609,13 @@ function Readable(options) {
// 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) {
+Readable.prototype.push = function (chunk, encoding) {
var state = this._readableState;
if (!state.objectMode && typeof chunk === 'string') {
encoding = encoding || state.defaultEncoding;
if (encoding !== state.encoding) {
- chunk = new Buffer(chunk, encoding);
+ chunk = bufferShim.from(chunk, encoding);
encoding = '';
}
}
@@ -6464,12 +6624,12 @@ Readable.prototype.push = function(chunk, encoding) {
};
// Unshift should *always* be something directly out of read()
-Readable.prototype.unshift = function(chunk) {
+Readable.prototype.unshift = function (chunk) {
var state = this._readableState;
return readableAddChunk(this, state, chunk, '', true);
};
-Readable.prototype.isPaused = function() {
+Readable.prototype.isPaused = function () {
return this._readableState.flowing === false;
};
@@ -6485,29 +6645,31 @@ function readableAddChunk(stream, state, chunk, encoding, 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);
+ var _e = new Error('stream.unshift() after end event');
+ stream.emit('error', _e);
} else {
- if (state.decoder && !addToFront && !encoding)
+ var skipAdd;
+ if (state.decoder && !addToFront && !encoding) {
chunk = state.decoder.write(chunk);
+ skipAdd = !state.objectMode && chunk.length === 0;
+ }
- if (!addToFront)
- state.reading = false;
+ if (!addToFront) state.reading = false;
- // if we want the data now, just emit it.
- if (state.flowing && state.length === 0 && !state.sync) {
- stream.emit('data', chunk);
- stream.read(0);
- } else {
- // update the buffer info.
- state.length += state.objectMode ? 1 : chunk.length;
- if (addToFront)
- state.buffer.unshift(chunk);
- else
- state.buffer.push(chunk);
+ // Don't add to the buffer if we've decoded to an empty string chunk and
+ // we're not in object mode
+ if (!skipAdd) {
+ // if we want the data now, just emit it.
+ if (state.flowing && state.length === 0 && !state.sync) {
+ stream.emit('data', chunk);
+ stream.read(0);
+ } else {
+ // update the buffer info.
+ state.length += state.objectMode ? 1 : chunk.length;
+ if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
- if (state.needReadable)
- emitReadable(stream);
+ if (state.needReadable) emitReadable(stream);
+ }
}
maybeReadMore(stream, state);
@@ -6519,7 +6681,6 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
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,
@@ -6528,16 +6689,12 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
// 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);
+ return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
}
// backwards compatibility.
-Readable.prototype.setEncoding = function(enc) {
- if (!StringDecoder)
- StringDecoder = __webpack_require__(22).StringDecoder;
+Readable.prototype.setEncoding = function (enc) {
+ if (!StringDecoder) StringDecoder = __webpack_require__(24).StringDecoder;
this._readableState.decoder = new StringDecoder(enc);
this._readableState.encoding = enc;
return this;
@@ -6549,7 +6706,8 @@ function computeNewHighWaterMark(n) {
if (n >= MAX_HWM) {
n = MAX_HWM;
} else {
- // Get the next highest power of 2
+ // Get the next highest power of 2 to prevent increasing hwm excessively in
+ // tiny amounts
n--;
n |= n >>> 1;
n |= n >>> 2;
@@ -6561,64 +6719,41 @@ function computeNewHighWaterMark(n) {
return n;
}
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
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)
+ if (n <= 0 || state.length === 0 && state.ended) return 0;
+ if (state.objectMode) return 1;
+ if (n !== n) {
+ // Only flow one buffer at a time
+ if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
+ }
+ // If we're asking for more than the current hwm, then raise the hwm.
+ if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
+ if (n <= state.length) return n;
+ // Don't have enough
+ if (!state.ended) {
+ state.needReadable = true;
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 = computeNewHighWaterMark(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;
+ return state.length;
}
// you can override either this method, or the async _read(n) below.
-Readable.prototype.read = function(n) {
+Readable.prototype.read = function (n) {
debug('read', n);
+ n = parseInt(n, 10);
var state = this._readableState;
var nOrig = n;
- if (typeof n !== 'number' || n > 0)
- state.emittedReadable = false;
+ if (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)) {
+ if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
debug('read: emitReadable', state.length, state.ended);
- if (state.length === 0 && state.ended)
- endReadable(this);
- else
- emitReadable(this);
+ if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
return null;
}
@@ -6626,8 +6761,7 @@ Readable.prototype.read = function(n) {
// if we've ended, and we're now clear, then finish it up.
if (n === 0 && state.ended) {
- if (state.length === 0)
- endReadable(this);
+ if (state.length === 0) endReadable(this);
return null;
}
@@ -6668,66 +6802,52 @@ Readable.prototype.read = function(n) {
if (state.ended || state.reading) {
doRead = false;
debug('reading or ended', doRead);
- }
-
- if (doRead) {
+ } else if (doRead) {
debug('do read');
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;
+ if (state.length === 0) state.needReadable = true;
// call internal read method
this._read(state.highWaterMark);
state.sync = false;
+ // If _read pushed data synchronously, then `reading` will be false,
+ // and we need to re-evaluate how much data we can return to the user.
+ if (!state.reading) n = howMuchToRead(nOrig, state);
}
- // If _read pushed data 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);
-
var ret;
- if (n > 0)
- ret = fromList(n, state);
- else
- ret = null;
+ if (n > 0) ret = fromList(n, state);else ret = null;
if (ret === null) {
state.needReadable = true;
n = 0;
+ } else {
+ state.length -= n;
}
- state.length -= n;
+ if (state.length === 0) {
+ // If we have nothing in the buffer, then we want to know
+ // as soon as we *do* get something into the buffer.
+ if (!state.ended) state.needReadable = true;
- // 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 tried to read() past the EOF, then emit end on the next tick.
- if (nOrig !== n && state.ended && state.length === 0)
- endReadable(this);
+ // If we tried to read() past the EOF, then emit end on the next tick.
+ if (nOrig !== n && state.ended) endReadable(this);
+ }
- if (ret !== null)
- this.emit('data', ret);
+ if (ret !== null) this.emit('data', ret);
return ret;
};
function chunkInvalid(state, chunk) {
var er = null;
- if (!(Buffer.isBuffer(chunk)) &&
- typeof chunk !== 'string' &&
- chunk !== null &&
- chunk !== undefined &&
- !state.objectMode) {
+ if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {
er = new TypeError('Invalid non-string/buffer chunk');
}
return er;
}
-
function onEofChunk(stream, state) {
if (state.ended) return;
if (state.decoder) {
@@ -6752,10 +6872,7 @@ function emitReadable(stream) {
if (!state.emittedReadable) {
debug('emitReadable', state.flowing);
state.emittedReadable = true;
- if (state.sync)
- processNextTick(emitReadable_, stream);
- else
- emitReadable_(stream);
+ if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);
}
}
@@ -6765,7 +6882,6 @@ function emitReadable_(stream) {
flow(stream);
}
-
// 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
@@ -6781,15 +6897,12 @@ function maybeReadMore(stream, state) {
function maybeReadMore_(stream, state) {
var len = state.length;
- while (!state.reading && !state.flowing && !state.ended &&
- state.length < state.highWaterMark) {
+ while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
debug('maybeReadMore read 0');
stream.read(0);
if (len === state.length)
// didn't get any data, stop spinning.
- break;
- else
- len = state.length;
+ break;else len = state.length;
}
state.readingMore = false;
}
@@ -6798,11 +6911,11 @@ function maybeReadMore_(stream, state) {
// 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._read = function (n) {
+ this.emit('error', new Error('_read() is not implemented'));
};
-Readable.prototype.pipe = function(dest, pipeOpts) {
+Readable.prototype.pipe = function (dest, pipeOpts) {
var src = this;
var state = this._readableState;
@@ -6820,15 +6933,10 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
state.pipesCount += 1;
debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
- var doEnd = (!pipeOpts || pipeOpts.end !== false) &&
- dest !== process.stdout &&
- dest !== process.stderr;
+ var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
var endFn = doEnd ? onend : cleanup;
- if (state.endEmitted)
- processNextTick(endFn);
- else
- src.once('end', endFn);
+ if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);
dest.on('unpipe', onunpipe);
function onunpipe(readable) {
@@ -6870,25 +6978,28 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
// 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 (state.awaitDrain &&
- (!dest._writableState || dest._writableState.needDrain))
- ondrain();
+ if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
}
+ // If the user pushes more data while we're writing to dest then we'll end up
+ // in ondata again. However, we only want to increase awaitDrain once because
+ // dest will only emit one 'drain' event for the multiple writes.
+ // => Introduce a guard on increasing awaitDrain.
+ var increasedAwaitDrain = false;
src.on('data', ondata);
function ondata(chunk) {
debug('ondata');
+ increasedAwaitDrain = false;
var ret = dest.write(chunk);
- if (false === ret) {
+ if (false === ret && !increasedAwaitDrain) {
// If the user unpiped during `dest.write()`, it is possible
// to get stuck in a permanently paused state if that write
// also returned false.
- if (state.pipesCount === 1 &&
- state.pipes[0] === dest &&
- src.listenerCount('data') === 1 &&
- !cleanedUp) {
+ // => Check whether `dest` is still a piping destination.
+ if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
debug('false write response, pause', src._readableState.awaitDrain);
src._readableState.awaitDrain++;
+ increasedAwaitDrain = true;
}
src.pause();
}
@@ -6900,18 +7011,11 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
debug('onerror', er);
unpipe();
dest.removeListener('error', onerror);
- if (EElistenerCount(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];
+ if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
+ }
+ // Make sure our error handler is attached before userland ones.
+ prependListener(dest, 'error', onerror);
// Both close and finish should trigger unpipe, but only once.
function onclose() {
@@ -6944,11 +7048,10 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
};
function pipeOnDrain(src) {
- return function() {
+ return function () {
var state = src._readableState;
debug('pipeOnDrain', state.awaitDrain);
- if (state.awaitDrain)
- state.awaitDrain--;
+ if (state.awaitDrain) state.awaitDrain--;
if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
state.flowing = true;
flow(src);
@@ -6956,29 +7059,24 @@ function pipeOnDrain(src) {
};
}
-
-Readable.prototype.unpipe = function(dest) {
+Readable.prototype.unpipe = function (dest) {
var state = this._readableState;
// if we're not piping anywhere, then do nothing.
- if (state.pipesCount === 0)
- return this;
+ 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) return this;
- if (!dest)
- dest = state.pipes;
+ if (!dest) dest = state.pipes;
// got a match.
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
- if (dest)
- dest.emit('unpipe', this);
+ if (dest) dest.emit('unpipe', this);
return this;
}
@@ -6992,20 +7090,18 @@ Readable.prototype.unpipe = function(dest) {
state.pipesCount = 0;
state.flowing = false;
- for (var i = 0; i < len; i++)
+ for (var i = 0; i < len; i++) {
dests[i].emit('unpipe', this);
- return this;
+ }return this;
}
// try to find the right one.
- var i = indexOf(state.pipes, dest);
- if (i === -1)
- return this;
+ var index = indexOf(state.pipes, dest);
+ if (index === -1) return this;
- state.pipes.splice(i, 1);
+ state.pipes.splice(index, 1);
state.pipesCount -= 1;
- if (state.pipesCount === 1)
- state.pipes = state.pipes[0];
+ if (state.pipesCount === 1) state.pipes = state.pipes[0];
dest.emit('unpipe', this);
@@ -7014,21 +7110,17 @@ Readable.prototype.unpipe = function(dest) {
// set up data events if they are asked for
// Ensure readable listeners eventually get something
-Readable.prototype.on = function(ev, fn) {
+Readable.prototype.on = function (ev, fn) {
var res = Stream.prototype.on.call(this, ev, fn);
- // If listening to data, and it has not explicitly been paused,
- // then call resume to start the flow of data on the next tick.
- if (ev === 'data' && false !== this._readableState.flowing) {
- this.resume();
- }
-
- if (ev === 'readable' && this.readable) {
+ if (ev === 'data') {
+ // Start flowing on next tick if stream isn't explicitly paused
+ if (this._readableState.flowing !== false) this.resume();
+ } else if (ev === 'readable') {
var state = this._readableState;
- if (!state.readableListening) {
- state.readableListening = true;
+ if (!state.endEmitted && !state.readableListening) {
+ state.readableListening = state.needReadable = true;
state.emittedReadable = false;
- state.needReadable = true;
if (!state.reading) {
processNextTick(nReadingNextTick, this);
} else if (state.length) {
@@ -7048,7 +7140,7 @@ function nReadingNextTick(self) {
// 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() {
+Readable.prototype.resume = function () {
var state = this._readableState;
if (!state.flowing) {
debug('resume');
@@ -7072,13 +7164,13 @@ function resume_(stream, state) {
}
state.resumeScheduled = false;
+ state.awaitDrain = 0;
stream.emit('resume');
flow(stream);
- if (state.flowing && !state.reading)
- stream.read(0);
+ if (state.flowing && !state.reading) stream.read(0);
}
-Readable.prototype.pause = function() {
+Readable.prototype.pause = function () {
debug('call pause flowing=%j', this._readableState.flowing);
if (false !== this._readableState.flowing) {
debug('pause');
@@ -7091,42 +7183,33 @@ Readable.prototype.pause = function() {
function flow(stream) {
var state = stream._readableState;
debug('flow', state.flowing);
- if (state.flowing) {
- do {
- var chunk = stream.read();
- } while (null !== chunk && state.flowing);
- }
+ while (state.flowing && stream.read() !== null) {}
}
// 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) {
+Readable.prototype.wrap = function (stream) {
var state = this._readableState;
var paused = false;
var self = this;
- stream.on('end', function() {
+ stream.on('end', function () {
debug('wrapped end');
if (state.decoder && !state.ended) {
var chunk = state.decoder.end();
- if (chunk && chunk.length)
- self.push(chunk);
+ if (chunk && chunk.length) self.push(chunk);
}
self.push(null);
});
- stream.on('data', function(chunk) {
+ stream.on('data', function (chunk) {
debug('wrapped data');
- if (state.decoder)
- chunk = state.decoder.write(chunk);
+ if (state.decoder) chunk = state.decoder.write(chunk);
// don't skip over falsy values in objectMode
- if (state.objectMode && (chunk === null || chunk === undefined))
- return;
- else if (!state.objectMode && (!chunk || !chunk.length))
- return;
+ if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
var ret = self.push(chunk);
if (!ret) {
@@ -7139,21 +7222,23 @@ Readable.prototype.wrap = function(stream) {
// important when wrapping filters and duplexes.
for (var i in stream) {
if (this[i] === undefined && typeof stream[i] === 'function') {
- this[i] = function(method) { return function() {
- return stream[method].apply(stream, arguments);
- }; }(i);
+ 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) {
+ 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) {
+ self._read = function (n) {
debug('wrapped _read', n);
if (paused) {
paused = false;
@@ -7164,75 +7249,106 @@ Readable.prototype.wrap = function(stream) {
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.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
function fromList(n, state) {
- var list = state.buffer;
- var length = state.length;
- var stringMode = !!state.decoder;
- var objectMode = !!state.objectMode;
+ // nothing buffered
+ if (state.length === 0) return null;
+
var ret;
+ if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
+ // read it all, truncate the list
+ if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
+ state.buffer.clear();
+ } else {
+ // read part of list
+ ret = fromListPartial(n, state.buffer, state.decoder);
+ }
- // nothing in the list, definitely empty.
- if (list.length === 0)
- return null;
+ return ret;
+}
- if (length === 0)
- ret = null;
- else if (objectMode)
+// Extracts only enough buffered data to satisfy the amount requested.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function fromListPartial(n, list, hasStrings) {
+ var ret;
+ if (n < list.head.data.length) {
+ // slice is the same for buffers and strings
+ ret = list.head.data.slice(0, n);
+ list.head.data = list.head.data.slice(n);
+ } else if (n === list.head.data.length) {
+ // first chunk is a perfect match
ret = list.shift();
- else if (!n || n >= length) {
- // read it all, truncate the array.
- if (stringMode)
- ret = list.join('');
- else if (list.length === 1)
- ret = list[0];
- 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();
+ // result spans more than one buffer
+ ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
+ }
+ return ret;
+}
- c += cpy;
+// Copies a specified amount of characters from the list of buffered data
+// chunks.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function copyFromBufferString(n, list) {
+ var p = list.head;
+ var c = 1;
+ var ret = p.data;
+ n -= ret.length;
+ while (p = p.next) {
+ var str = p.data;
+ var nb = n > str.length ? str.length : n;
+ if (nb === str.length) ret += str;else ret += str.slice(0, n);
+ n -= nb;
+ if (n === 0) {
+ if (nb === str.length) {
+ ++c;
+ if (p.next) list.head = p.next;else list.head = list.tail = null;
+ } else {
+ list.head = p;
+ p.data = str.slice(nb);
}
+ break;
}
+ ++c;
}
+ list.length -= c;
+ return ret;
+}
+// Copies a specified amount of bytes from the list of buffered data chunks.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function copyFromBuffer(n, list) {
+ var ret = bufferShim.allocUnsafe(n);
+ var p = list.head;
+ var c = 1;
+ p.data.copy(ret);
+ n -= p.data.length;
+ while (p = p.next) {
+ var buf = p.data;
+ var nb = n > buf.length ? buf.length : n;
+ buf.copy(ret, ret.length - n, 0, nb);
+ n -= nb;
+ if (n === 0) {
+ if (nb === buf.length) {
+ ++c;
+ if (p.next) list.head = p.next;else list.head = list.tail = null;
+ } else {
+ list.head = p;
+ p.data = buf.slice(nb);
+ }
+ break;
+ }
+ ++c;
+ }
+ list.length -= c;
return ret;
}
@@ -7241,8 +7357,7 @@ function endReadable(stream) {
// 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.length > 0) throw new Error('"endReadable()" called on non-empty stream');
if (!state.endEmitted) {
state.ended = true;
@@ -7259,23 +7374,22 @@ function endReadableNT(state, stream) {
}
}
-function forEach (xs, f) {
+function forEach(xs, f) {
for (var i = 0, l = xs.length; i < l; i++) {
f(xs[i], i);
}
}
-function indexOf (xs, x) {
+function indexOf(xs, x) {
for (var i = 0, l = xs.length; i < l; i++) {
if (xs[i] === x) return i;
}
return -1;
}
-
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4)))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
-/* 28 */
+/* 30 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -7300,13 +7414,13 @@ module.exports = function contentType(header) {
/***/ }),
-/* 29 */
+/* 31 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var getContentTypeFromHeader = __webpack_require__(28);
+var getContentTypeFromHeader = __webpack_require__(30);
/**
* Plays audio from a URL
@@ -7399,7 +7513,7 @@ module.exports.playFile = playFile;
/***/ }),
-/* 30 */
+/* 32 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -7421,16 +7535,16 @@ module.exports.ERROR_NO_TIMESTAMPS = 'NO_TIMESTAMPS';
/***/ }),
-/* 31 */
+/* 33 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(Buffer) {
var Transform = __webpack_require__(1).Transform;
-var util = __webpack_require__(3);
-var defaults = __webpack_require__(8);
-var noTimestamps = __webpack_require__(30);
+var util = __webpack_require__(4);
+var defaults = __webpack_require__(9);
+var noTimestamps = __webpack_require__(32);
/**
* Slows results down to no faster than real time.
@@ -7548,7 +7662,7 @@ TimingStream.prototype.setStartTime = function(time) {
this.startTime = time || Date.now();
};
-TimingStream.prototype.promise = __webpack_require__(7);
+TimingStream.prototype.promise = __webpack_require__(8);
// when stop is called, immediately stop emitting results
TimingStream.prototype.stop = function stop() {
@@ -7562,14 +7676,14 @@ module.exports = TimingStream;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
/***/ }),
-/* 32 */
+/* 34 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process, Buffer) {
var Transform = __webpack_require__(1).Transform;
-var util = __webpack_require__(3);
-var defaults = __webpack_require__(8);
+var util = __webpack_require__(4);
+var defaults = __webpack_require__(9);
var TARGET_SAMPLE_RATE = 16000;
/**
@@ -7766,10 +7880,10 @@ WebAudioL16Stream.prototype.transformBuffer = function(nodebuffer, encoding, nex
module.exports = WebAudioL16Stream;
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4), __webpack_require__(0).Buffer))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(0).Buffer))
/***/ }),
-/* 33 */
+/* 35 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -7795,7 +7909,7 @@ exports.stringify = function stringify(queryParams) {
/***/ }),
-/* 34 */
+/* 36 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -7818,58 +7932,58 @@ module.exports = {
/**
* @see module:watson-speech/speech-to-text/recognize-microphone
*/
- recognizeMicrophone: __webpack_require__(69),
+ recognizeMicrophone: __webpack_require__(71),
/**
* @see module:watson-speech/speech-to-text/recognize-blob
*/
- recognizeFile: __webpack_require__(68),
+ recognizeFile: __webpack_require__(70),
/**
* @see module:watson-speech/speech-to-text/get-models
*/
- getModels: __webpack_require__(67),
+ getModels: __webpack_require__(69),
// individual components to build more customized solutions
/**
* @see WebAudioL16Stream
*/
- WebAudioL16Stream: __webpack_require__(32),
+ WebAudioL16Stream: __webpack_require__(34),
/**
* @see RecognizeStream
*/
- RecognizeStream: __webpack_require__(16),
+ RecognizeStream: __webpack_require__(18),
/**
* @see FilePlayer
*/
- FilePlayer: __webpack_require__(29),
+ FilePlayer: __webpack_require__(31),
/**
* @see FormatStream
*/
- FormatStream: __webpack_require__(15),
+ FormatStream: __webpack_require__(17),
/**
* @see TimingStream
*/
- TimingStream: __webpack_require__(31),
+ TimingStream: __webpack_require__(33),
/**
* @see ResultStream
*/
- ResultStream: __webpack_require__(17),
+ ResultStream: __webpack_require__(19),
/**
* @see SpeakerStream
*/
- SpeakerStream: __webpack_require__(18),
+ SpeakerStream: __webpack_require__(20),
/**
* @see WritableElementStream
*/
- WritableElementStream: __webpack_require__(19),
+ WritableElementStream: __webpack_require__(21),
// external components exposed for convenience
/**
* @see https://www.npmjs.com/package/get-user-media-promise
*/
- getUserMedia: __webpack_require__(23),
+ getUserMedia: __webpack_require__(25),
/**
* @see https://www.npmjs.com/package/microphone-stream
*/
- MicrophoneStream: __webpack_require__(24),
+ MicrophoneStream: __webpack_require__(26),
/**
* @see https://nodejs.org/api/buffer.html
*/
@@ -7879,7 +7993,7 @@ module.exports = {
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
/***/ }),
-/* 35 */
+/* 37 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -7907,16 +8021,16 @@ module.exports = {
/**
* @see module:watson-speech/text-to-speech/synthesize
*/
-exports.synthesize = __webpack_require__(71);
+exports.synthesize = __webpack_require__(73);
/**
* @see module:watson-speech/text-to-speech/get-voices
*/
-exports.getVoices = __webpack_require__(70);
+exports.getVoices = __webpack_require__(72);
/***/ }),
-/* 36 */
+/* 38 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(Buffer) {var clone = (function() {
@@ -8083,7 +8197,7 @@ if (typeof module === 'object' && module.exports) {
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
/***/ }),
-/* 37 */
+/* 39 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -8204,27 +8318,16 @@ function fromByteArray (uint8) {
/***/ }),
-/* 38 */
-/***/ (function(module, exports) {
-
-var toString = {}.toString;
-
-module.exports = Array.isArray || function (arr) {
- return toString.call(arr) == '[object Array]';
-};
-
-
-/***/ }),
-/* 39 */
+/* 40 */
/***/ (function(module, exports, __webpack_require__) {
-var implementation = __webpack_require__(47);
+var implementation = __webpack_require__(46);
module.exports = Function.prototype.bind || implementation;
/***/ }),
-/* 40 */
+/* 41 */
/***/ (function(module, exports) {
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
@@ -8314,16 +8417,28 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
/***/ }),
-/* 41 */
-/***/ (function(module, exports) {
+/* 42 */
+/***/ (function(module, exports, __webpack_require__) {
-module.exports = Array.isArray || function (arr) {
- return Object.prototype.toString.call(arr) == '[object Array]';
+"use strict";
+/*!
+ * isobject
+ *
+ * Copyright (c) 2014-2015, Jon Schlinkert.
+ * Licensed under the MIT License.
+ */
+
+
+
+var isArray = __webpack_require__(13);
+
+module.exports = function isObject(val) {
+ return val != null && typeof val === 'object' && isArray(val) === false;
};
/***/ }),
-/* 42 */
+/* 43 */
/***/ (function(module, exports) {
/**
@@ -8543,59 +8658,27 @@ function pullAllWith(array, values, comparator) {
module.exports = pullAllWith;
-/***/ }),
-/* 43 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var isoFetch = __webpack_require__(48)
-var patchRequest = __webpack_require__(49)
-var patchResponse = __webpack_require__(50)
-
-function fetch (url, options) {
- return patchRequest(options).then(function (options) {
- return isoFetch(url, options).then(function (res) {
- return patchResponse(res)
- })
- })
-}
-
-module.exports = fetch
-
-
/***/ }),
/* 44 */
-/***/ (function(module, exports) {
-
-var toString = {}.toString;
-
-module.exports = Array.isArray || function (arr) {
- return toString.call(arr) == '[object Array]';
-};
-
-
-/***/ }),
-/* 45 */
/***/ (function(module, exports, __webpack_require__) {
-"use strict";
-/*!
- * isobject
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
-
-
+var isoFetch = __webpack_require__(47)
+var patchRequest = __webpack_require__(49)
+var patchResponse = __webpack_require__(50)
-var isArray = __webpack_require__(44);
+function fetch (url, options) {
+ return patchRequest(options).then(function (options) {
+ return isoFetch(url, options).then(function (res) {
+ return patchResponse(res)
+ })
+ })
+}
-module.exports = function isObject(val) {
- return val != null && typeof val === 'object' && isArray(val) === false;
-};
+module.exports = fetch
/***/ }),
-/* 46 */
+/* 45 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -8603,7 +8686,7 @@ module.exports = function isObject(val) {
var Readable = __webpack_require__(1).Readable;
// When required from browserify, Buffer is also an Uint8Array, which is important for ejson.
-var inherits = __webpack_require__(55);
+var inherits = __webpack_require__(3);
var FileReader = global.FileReader;
var Uint8Array = global.Uint8Array;
@@ -8734,10 +8817,10 @@ ReadableBlobStream.prototype._read = function(chunkSize)
reader.readAsArrayBuffer(chunk);
};
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(10), __webpack_require__(0).Buffer))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6), __webpack_require__(0).Buffer))
/***/ }),
-/* 47 */
+/* 46 */
/***/ (function(module, exports) {
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
@@ -8791,17 +8874,76 @@ module.exports = function bind(that) {
/***/ }),
-/* 48 */
+/* 47 */
/***/ (function(module, exports, __webpack_require__) {
// the whatwg-fetch polyfill installs the fetch() function
// on the global object (window or self)
//
// Return that as the export for use in Webpack, Browserify etc.
-__webpack_require__(66);
+__webpack_require__(68);
module.exports = self.fetch.bind(self);
+/***/ }),
+/* 48 */
+/***/ (function(module, exports, __webpack_require__) {
+
+var apply = Function.prototype.apply;
+
+// DOM APIs, for completeness
+
+exports.setTimeout = function() {
+ return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
+};
+exports.setInterval = function() {
+ return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
+};
+exports.clearTimeout =
+exports.clearInterval = function(timeout) {
+ if (timeout) {
+ timeout.close();
+ }
+};
+
+function Timeout(id, clearFn) {
+ this._id = id;
+ this._clearFn = clearFn;
+}
+Timeout.prototype.unref = Timeout.prototype.ref = function() {};
+Timeout.prototype.close = function() {
+ this._clearFn.call(window, this._id);
+};
+
+// Does not start the time, just sets up the members needed.
+exports.enroll = function(item, msecs) {
+ clearTimeout(item._idleTimeoutId);
+ item._idleTimeout = msecs;
+};
+
+exports.unenroll = function(item) {
+ clearTimeout(item._idleTimeoutId);
+ item._idleTimeout = -1;
+};
+
+exports._unrefActive = exports.active = function(item) {
+ clearTimeout(item._idleTimeoutId);
+
+ var msecs = item._idleTimeout;
+ if (msecs >= 0) {
+ item._idleTimeoutId = setTimeout(function onTimeout() {
+ if (item._onTimeout)
+ item._onTimeout();
+ }, msecs);
+ }
+};
+
+// setimmediate attaches itself to the global object
+__webpack_require__(61);
+exports.setImmediate = setImmediate;
+exports.clearImmediate = clearImmediate;
+
+
/***/ }),
/* 49 */
/***/ (function(module, exports, __webpack_require__) {
@@ -8883,7 +9025,7 @@ module.exports = patch
/* 51 */
/***/ (function(module, exports, __webpack_require__) {
-/* WEBPACK VAR INJECTION */(function(Buffer) {var inherits = __webpack_require__(2)
+/* WEBPACK VAR INJECTION */(function(Buffer) {var inherits = __webpack_require__(3)
var Readable = __webpack_require__(1).Readable
function ReadableFromWhatwg (stream) {
@@ -8917,7 +9059,31 @@ module.exports = ReadableFromWhatwg
"use strict";
-var keys = __webpack_require__(20);
+var toStr = Object.prototype.toString;
+
+module.exports = function isArguments(value) {
+ var str = toStr.call(value);
+ var isArgs = str === '[object Arguments]';
+ if (!isArgs) {
+ isArgs = str !== '[object Array]' &&
+ value !== null &&
+ typeof value === 'object' &&
+ typeof value.length === 'number' &&
+ value.length >= 0 &&
+ toStr.call(value.callee) === '[object Function]';
+ }
+ return isArgs;
+};
+
+
+/***/ }),
+/* 53 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+var keys = __webpack_require__(22);
module.exports = function hasSymbols() {
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
@@ -8959,19 +9125,19 @@ module.exports = function hasSymbols() {
/***/ }),
-/* 53 */
+/* 54 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// modified from https://github.com/es-shims/es6-shim
-var keys = __webpack_require__(20);
-var bind = __webpack_require__(39);
+var keys = __webpack_require__(22);
+var bind = __webpack_require__(40);
var canBeObject = function (obj) {
return typeof obj !== 'undefined' && obj !== null;
};
-var hasSymbols = __webpack_require__(52)();
+var hasSymbols = __webpack_require__(53)();
var toObject = Object;
var push = bind.call(Function.call, Array.prototype.push);
var propIsEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
@@ -9007,108 +9173,323 @@ module.exports = function assign(target, source1) {
/***/ }),
-/* 54 */
+/* 55 */
/***/ (function(module, exports, __webpack_require__) {
-"use strict";
+module.exports = __webpack_require__(5)
-var toStr = Object.prototype.toString;
+/***/ }),
+/* 56 */
+/***/ (function(module, exports, __webpack_require__) {
-module.exports = function isArguments(value) {
- var str = toStr.call(value);
- var isArgs = str === '[object Arguments]';
- if (!isArgs) {
- isArgs = str !== '[object Array]' &&
- value !== null &&
- typeof value === 'object' &&
- typeof value.length === 'number' &&
- value.length >= 0 &&
- toStr.call(value.callee) === '[object Function]';
- }
- return isArgs;
-};
+"use strict";
-/***/ }),
-/* 55 */
-/***/ (function(module, exports) {
+var Buffer = __webpack_require__(0).Buffer;
+/**/
+var bufferShim = __webpack_require__(12);
+/**/
-if (typeof Object.create === 'function') {
- // implementation from standard node.js 'util' module
- module.exports = function inherits(ctor, superCtor) {
- ctor.super_ = superCtor
- ctor.prototype = Object.create(superCtor.prototype, {
- constructor: {
- value: ctor,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- };
-} else {
- // old school shim for old browsers
- module.exports = function inherits(ctor, superCtor) {
- ctor.super_ = superCtor
- var TempCtor = function () {}
- TempCtor.prototype = superCtor.prototype
- ctor.prototype = new TempCtor()
- ctor.prototype.constructor = ctor
- }
+module.exports = BufferList;
+
+function BufferList() {
+ this.head = null;
+ this.tail = null;
+ this.length = 0;
}
+BufferList.prototype.push = function (v) {
+ var entry = { data: v, next: null };
+ if (this.length > 0) this.tail.next = entry;else this.head = entry;
+ this.tail = entry;
+ ++this.length;
+};
-/***/ }),
-/* 56 */
-/***/ (function(module, exports, __webpack_require__) {
+BufferList.prototype.unshift = function (v) {
+ var entry = { data: v, next: this.head };
+ if (this.length === 0) this.tail = entry;
+ this.head = entry;
+ ++this.length;
+};
-module.exports = __webpack_require__(5)
+BufferList.prototype.shift = function () {
+ if (this.length === 0) return;
+ var ret = this.head.data;
+ if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
+ --this.length;
+ return ret;
+};
+BufferList.prototype.clear = function () {
+ this.head = this.tail = null;
+ this.length = 0;
+};
+
+BufferList.prototype.join = function (s) {
+ if (this.length === 0) return '';
+ var p = this.head;
+ var ret = '' + p.data;
+ while (p = p.next) {
+ ret += s + p.data;
+ }return ret;
+};
+
+BufferList.prototype.concat = function (n) {
+ if (this.length === 0) return bufferShim.alloc(0);
+ if (this.length === 1) return this.head.data;
+ var ret = bufferShim.allocUnsafe(n >>> 0);
+ var p = this.head;
+ var i = 0;
+ while (p) {
+ p.data.copy(ret, i);
+ i += p.data.length;
+ p = p.next;
+ }
+ return ret;
+};
/***/ }),
/* 57 */
/***/ (function(module, exports, __webpack_require__) {
-module.exports = __webpack_require__(26)
+module.exports = __webpack_require__(28)
/***/ }),
/* 58 */
/***/ (function(module, exports, __webpack_require__) {
-var Stream = (function (){
+/* WEBPACK VAR INJECTION */(function(process) {var Stream = (function (){
try {
return __webpack_require__(1); // hack to fix a circular dependency issue when used with browserify
} catch(_){}
}());
-exports = module.exports = __webpack_require__(27);
+exports = module.exports = __webpack_require__(29);
exports.Stream = Stream || exports;
exports.Readable = exports;
-exports.Writable = __webpack_require__(14);
+exports.Writable = __webpack_require__(16);
exports.Duplex = __webpack_require__(5);
-exports.Transform = __webpack_require__(13);
-exports.PassThrough = __webpack_require__(26);
+exports.Transform = __webpack_require__(15);
+exports.PassThrough = __webpack_require__(28);
+
+if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) {
+ module.exports = Stream;
+}
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
/* 59 */
/***/ (function(module, exports, __webpack_require__) {
-module.exports = __webpack_require__(13)
+module.exports = __webpack_require__(15)
/***/ }),
/* 60 */
/***/ (function(module, exports, __webpack_require__) {
-module.exports = __webpack_require__(14)
+module.exports = __webpack_require__(16)
/***/ }),
/* 61 */
/***/ (function(module, exports, __webpack_require__) {
+/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
+ "use strict";
+
+ if (global.setImmediate) {
+ return;
+ }
+
+ var nextHandle = 1; // Spec says greater than zero
+ var tasksByHandle = {};
+ var currentlyRunningATask = false;
+ var doc = global.document;
+ var registerImmediate;
+
+ function setImmediate(callback) {
+ // Callback can either be a function or a string
+ if (typeof callback !== "function") {
+ callback = new Function("" + callback);
+ }
+ // Copy function arguments
+ var args = new Array(arguments.length - 1);
+ for (var i = 0; i < args.length; i++) {
+ args[i] = arguments[i + 1];
+ }
+ // Store and register the task
+ var task = { callback: callback, args: args };
+ tasksByHandle[nextHandle] = task;
+ registerImmediate(nextHandle);
+ return nextHandle++;
+ }
+
+ function clearImmediate(handle) {
+ delete tasksByHandle[handle];
+ }
+
+ function run(task) {
+ var callback = task.callback;
+ var args = task.args;
+ switch (args.length) {
+ case 0:
+ callback();
+ break;
+ case 1:
+ callback(args[0]);
+ break;
+ case 2:
+ callback(args[0], args[1]);
+ break;
+ case 3:
+ callback(args[0], args[1], args[2]);
+ break;
+ default:
+ callback.apply(undefined, args);
+ break;
+ }
+ }
+
+ function runIfPresent(handle) {
+ // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
+ // So if we're currently running a task, we'll need to delay this invocation.
+ if (currentlyRunningATask) {
+ // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
+ // "too much recursion" error.
+ setTimeout(runIfPresent, 0, handle);
+ } else {
+ var task = tasksByHandle[handle];
+ if (task) {
+ currentlyRunningATask = true;
+ try {
+ run(task);
+ } finally {
+ clearImmediate(handle);
+ currentlyRunningATask = false;
+ }
+ }
+ }
+ }
+
+ function installNextTickImplementation() {
+ registerImmediate = function(handle) {
+ process.nextTick(function () { runIfPresent(handle); });
+ };
+ }
+
+ function canUsePostMessage() {
+ // The test against `importScripts` prevents this implementation from being installed inside a web worker,
+ // where `global.postMessage` means something completely different and can't be used for this purpose.
+ if (global.postMessage && !global.importScripts) {
+ var postMessageIsAsynchronous = true;
+ var oldOnMessage = global.onmessage;
+ global.onmessage = function() {
+ postMessageIsAsynchronous = false;
+ };
+ global.postMessage("", "*");
+ global.onmessage = oldOnMessage;
+ return postMessageIsAsynchronous;
+ }
+ }
+
+ function installPostMessageImplementation() {
+ // Installs an event handler on `global` for the `message` event: see
+ // * https://developer.mozilla.org/en/DOM/window.postMessage
+ // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
+
+ var messagePrefix = "setImmediate$" + Math.random() + "$";
+ var onGlobalMessage = function(event) {
+ if (event.source === global &&
+ typeof event.data === "string" &&
+ event.data.indexOf(messagePrefix) === 0) {
+ runIfPresent(+event.data.slice(messagePrefix.length));
+ }
+ };
+
+ if (global.addEventListener) {
+ global.addEventListener("message", onGlobalMessage, false);
+ } else {
+ global.attachEvent("onmessage", onGlobalMessage);
+ }
+
+ registerImmediate = function(handle) {
+ global.postMessage(messagePrefix + handle, "*");
+ };
+ }
+
+ function installMessageChannelImplementation() {
+ var channel = new MessageChannel();
+ channel.port1.onmessage = function(event) {
+ var handle = event.data;
+ runIfPresent(handle);
+ };
+
+ registerImmediate = function(handle) {
+ channel.port2.postMessage(handle);
+ };
+ }
+
+ function installReadyStateChangeImplementation() {
+ var html = doc.documentElement;
+ registerImmediate = function(handle) {
+ // Create a