diff --git a/http/fs/js/vendor/JSXTransformer.js b/http/fs/js/vendor/JSXTransformer.js index 8ccc72f..07cc91f 100755 --- a/http/fs/js/vendor/JSXTransformer.js +++ b/http/fs/js/vendor/JSXTransformer.js @@ -1,8 +1,7 @@ /** - * JSXTransformer v0.5.1 + * JSXTransformer v0.8.0 */ -!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.JSXTransformer=e():"undefined"!=typeof global?global.JSXTransformer=e():"undefined"!=typeof self&&(self.JSXTransformer=e())}(function(){var define,module,exports; -return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; -}; - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; - - -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; - -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; - - -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} - - -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; - - shims.forEach(array, function(val, idx) { - hash[val] = true; - }); - - return hash; -} - - -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = shims.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = shims.getOwnPropertyNames(value); - } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - - shims.forEach(keys, function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = shims.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (shims.indexOf(ctx.seen, desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = shims.reduce(output, function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return shims.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && objectToString(e) === '[object Error]'; -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -function isBuffer(arg) { - return arg instanceof Buffer; -} -exports.isBuffer = isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - - -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - - -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} - - -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = function(ctor, superCtor) { - ctor.super_ = superCtor; - ctor.prototype = shims.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); -}; - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = shims.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); -} - -},{"__browserify_Buffer":4,"_shims":1}],4:[function(require,module,exports){ -require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o> 1, - nBits = -7, - i = isBE ? 0 : (nBytes - 1), - d = isBE ? 1 : -1, - s = buffer[offset + i]; - - i += d; - - e = s & ((1 << (-nBits)) - 1); - s >>= (-nBits); - nBits += eLen; - for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); - - m = e & ((1 << (-nBits)) - 1); - e >>= (-nBits); - nBits += mLen; - for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); - - if (e === 0) { - e = 1 - eBias; - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity); - } else { - m = m + Math.pow(2, mLen); - e = e - eBias; - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen); -}; - -exports.writeIEEE754 = function(buffer, value, offset, isBE, mLen, nBytes) { - var e, m, c, - eLen = nBytes * 8 - mLen - 1, - eMax = (1 << eLen) - 1, - eBias = eMax >> 1, - rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0), - i = isBE ? (nBytes - 1) : 0, - d = isBE ? -1 : 1, - s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; - - value = Math.abs(value); - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0; - e = eMax; - } else { - e = Math.floor(Math.log(value) / Math.LN2); - if (value * (c = Math.pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e + eBias >= 1) { - value += rt / c; - } else { - value += rt * Math.pow(2, 1 - eBias); - } - if (value * c >= 2) { - e++; - c /= 2; - } - - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen); - e = e + eBias; - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); - e = 0; - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); - - e = (e << mLen) | m; - eLen += mLen; - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); - - buffer[offset + i - d] |= s * 128; -}; - -},{}],"q9TxCC":[function(require,module,exports){ -var assert; -exports.Buffer = Buffer; -exports.SlowBuffer = Buffer; -Buffer.poolSize = 8192; -exports.INSPECT_MAX_BYTES = 50; - -function stringtrim(str) { - if (str.trim) return str.trim(); - return str.replace(/^\s+|\s+$/g, ''); -} - -function Buffer(subject, encoding, offset) { - if(!assert) assert= require('assert'); - if (!(this instanceof Buffer)) { - return new Buffer(subject, encoding, offset); - } - this.parent = this; - this.offset = 0; - - // Work-around: node's base64 implementation - // allows for non-padded strings while base64-js - // does not.. - if (encoding == "base64" && typeof subject == "string") { - subject = stringtrim(subject); - while (subject.length % 4 != 0) { - subject = subject + "="; - } - } - - var type; - - // Are we slicing? - if (typeof offset === 'number') { - this.length = coerce(encoding); - // slicing works, with limitations (no parent tracking/update) - // check https://github.com/toots/buffer-browserify/issues/19 - for (var i = 0; i < this.length; i++) { - this[i] = subject.get(i+offset); - } - } else { - // Find the length - switch (type = typeof subject) { - case 'number': - this.length = coerce(subject); - break; - - case 'string': - this.length = Buffer.byteLength(subject, encoding); - break; - - case 'object': // Assume object is an array - this.length = coerce(subject.length); - break; - - default: - throw new Error('First argument needs to be a number, ' + - 'array or string.'); - } - - // Treat array-ish objects as a byte array. - if (isArrayIsh(subject)) { - for (var i = 0; i < this.length; i++) { - if (subject instanceof Buffer) { - this[i] = subject.readUInt8(i); - } - else { - this[i] = subject[i]; - } - } - } else if (type == 'string') { - // We are a string - this.length = this.write(subject, 0, encoding); - } else if (type === 'number') { - for (var i = 0; i < this.length; i++) { - this[i] = 0; - } - } - } -} - -Buffer.prototype.get = function get(i) { - if (i < 0 || i >= this.length) throw new Error('oob'); - return this[i]; -}; - -Buffer.prototype.set = function set(i, v) { - if (i < 0 || i >= this.length) throw new Error('oob'); - return this[i] = v; -}; - -Buffer.byteLength = function (str, encoding) { - switch (encoding || "utf8") { - case 'hex': - return str.length / 2; - - case 'utf8': - case 'utf-8': - return utf8ToBytes(str).length; - - case 'ascii': - case 'binary': - return str.length; - - case 'base64': - return base64ToBytes(str).length; - - default: - throw new Error('Unknown encoding'); - } -}; - -Buffer.prototype.utf8Write = function (string, offset, length) { - var bytes, pos; - return Buffer._charsWritten = blitBuffer(utf8ToBytes(string), this, offset, length); -}; - -Buffer.prototype.asciiWrite = function (string, offset, length) { - var bytes, pos; - return Buffer._charsWritten = blitBuffer(asciiToBytes(string), this, offset, length); -}; - -Buffer.prototype.binaryWrite = Buffer.prototype.asciiWrite; - -Buffer.prototype.base64Write = function (string, offset, length) { - var bytes, pos; - return Buffer._charsWritten = blitBuffer(base64ToBytes(string), this, offset, length); -}; - -Buffer.prototype.base64Slice = function (start, end) { - var bytes = Array.prototype.slice.apply(this, arguments) - return require("base64-js").fromByteArray(bytes); -}; - -Buffer.prototype.utf8Slice = function () { - var bytes = Array.prototype.slice.apply(this, arguments); - var res = ""; - var tmp = ""; - var i = 0; - while (i < bytes.length) { - if (bytes[i] <= 0x7F) { - res += decodeUtf8Char(tmp) + String.fromCharCode(bytes[i]); - tmp = ""; - } else - tmp += "%" + bytes[i].toString(16); - - i++; - } - - return res + decodeUtf8Char(tmp); -} - -Buffer.prototype.asciiSlice = function () { - var bytes = Array.prototype.slice.apply(this, arguments); - var ret = ""; - for (var i = 0; i < bytes.length; i++) - ret += String.fromCharCode(bytes[i]); - return ret; -} - -Buffer.prototype.binarySlice = Buffer.prototype.asciiSlice; - -Buffer.prototype.inspect = function() { - var out = [], - len = this.length; - for (var i = 0; i < len; i++) { - out[i] = toHex(this[i]); - if (i == exports.INSPECT_MAX_BYTES) { - out[i + 1] = '...'; - break; - } - } - return ''; -}; - - -Buffer.prototype.hexSlice = function(start, end) { - var len = this.length; - - if (!start || start < 0) start = 0; - if (!end || end < 0 || end > len) end = len; - - var out = ''; - for (var i = start; i < end; i++) { - out += toHex(this[i]); - } - return out; -}; - - -Buffer.prototype.toString = function(encoding, start, end) { - encoding = String(encoding || 'utf8').toLowerCase(); - start = +start || 0; - if (typeof end == 'undefined') end = this.length; - - // Fastpath empty strings - if (+end == start) { - return ''; - } - - switch (encoding) { - case 'hex': - return this.hexSlice(start, end); - - case 'utf8': - case 'utf-8': - return this.utf8Slice(start, end); - - case 'ascii': - return this.asciiSlice(start, end); - - case 'binary': - return this.binarySlice(start, end); - - case 'base64': - return this.base64Slice(start, end); - - case 'ucs2': - case 'ucs-2': - return this.ucs2Slice(start, end); - - default: - throw new Error('Unknown encoding'); - } -}; - - -Buffer.prototype.hexWrite = function(string, offset, length) { - offset = +offset || 0; - var remaining = this.length - offset; - if (!length) { - length = remaining; - } else { - length = +length; - if (length > remaining) { - length = remaining; - } - } - - // must be an even number of digits - var strLen = string.length; - if (strLen % 2) { - throw new Error('Invalid hex string'); - } - if (length > strLen / 2) { - length = strLen / 2; - } - for (var i = 0; i < length; i++) { - var byte = parseInt(string.substr(i * 2, 2), 16); - if (isNaN(byte)) throw new Error('Invalid hex string'); - this[offset + i] = byte; - } - Buffer._charsWritten = i * 2; - return i; -}; - - -Buffer.prototype.write = function(string, offset, length, encoding) { - // Support both (string, offset, length, encoding) - // and the legacy (string, encoding, offset, length) - if (isFinite(offset)) { - if (!isFinite(length)) { - encoding = length; - length = undefined; - } - } else { // legacy - var swap = encoding; - encoding = offset; - offset = length; - length = swap; - } - - offset = +offset || 0; - var remaining = this.length - offset; - if (!length) { - length = remaining; - } else { - length = +length; - if (length > remaining) { - length = remaining; - } - } - encoding = String(encoding || 'utf8').toLowerCase(); - - switch (encoding) { - case 'hex': - return this.hexWrite(string, offset, length); - - case 'utf8': - case 'utf-8': - return this.utf8Write(string, offset, length); - - case 'ascii': - return this.asciiWrite(string, offset, length); - - case 'binary': - return this.binaryWrite(string, offset, length); - - case 'base64': - return this.base64Write(string, offset, length); - - case 'ucs2': - case 'ucs-2': - return this.ucs2Write(string, offset, length); - - default: - throw new Error('Unknown encoding'); - } -}; - -// slice(start, end) -function clamp(index, len, defaultValue) { - if (typeof index !== 'number') return defaultValue; - index = ~~index; // Coerce to integer. - if (index >= len) return len; - if (index >= 0) return index; - index += len; - if (index >= 0) return index; - return 0; -} - -Buffer.prototype.slice = function(start, end) { - var len = this.length; - start = clamp(start, len, 0); - end = clamp(end, len, len); - return new Buffer(this, end - start, +start); -}; - -// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) -Buffer.prototype.copy = function(target, target_start, start, end) { - var source = this; - start || (start = 0); - if (end === undefined || isNaN(end)) { - end = this.length; - } - target_start || (target_start = 0); - - if (end < start) throw new Error('sourceEnd < sourceStart'); - - // Copy 0 bytes; we're done - if (end === start) return 0; - if (target.length == 0 || source.length == 0) return 0; - - if (target_start < 0 || target_start >= target.length) { - throw new Error('targetStart out of bounds'); - } - - if (start < 0 || start >= source.length) { - throw new Error('sourceStart out of bounds'); - } - - if (end < 0 || end > source.length) { - throw new Error('sourceEnd out of bounds'); - } - - // Are we oob? - if (end > this.length) { - end = this.length; - } - - if (target.length - target_start < end - start) { - end = target.length - target_start + start; - } - - var temp = []; - for (var i=start; i= this.length) { - throw new Error('start out of bounds'); - } - - if (end < 0 || end > this.length) { - throw new Error('end out of bounds'); - } - - for (var i = start; i < end; i++) { - this[i] = value; - } -} - -// Static methods -Buffer.isBuffer = function isBuffer(b) { - return b instanceof Buffer || b instanceof Buffer; -}; - -Buffer.concat = function (list, totalLength) { - if (!isArray(list)) { - throw new Error("Usage: Buffer.concat(list, [totalLength])\n \ - list should be an Array."); - } - - if (list.length === 0) { - return new Buffer(0); - } else if (list.length === 1) { - return list[0]; - } - - if (typeof totalLength !== 'number') { - totalLength = 0; - for (var i = 0; i < list.length; i++) { - var buf = list[i]; - totalLength += buf.length; - } - } - - var buffer = new Buffer(totalLength); - var pos = 0; - for (var i = 0; i < list.length; i++) { - var buf = list[i]; - buf.copy(buffer, pos); - pos += buf.length; - } - return buffer; -}; - -Buffer.isEncoding = function(encoding) { - switch ((encoding + '').toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - case 'raw': - return true; - - default: - return false; - } -}; - -// helpers - -function coerce(length) { - // Coerce length to a number (possibly NaN), round up - // in case it's fractional (e.g. 123.456) then do a - // double negate to coerce a NaN to 0. Easy, right? - length = ~~Math.ceil(+length); - return length < 0 ? 0 : length; -} - -function isArray(subject) { - return (Array.isArray || - function(subject){ - return {}.toString.apply(subject) == '[object Array]' - }) - (subject) -} - -function isArrayIsh(subject) { - return isArray(subject) || Buffer.isBuffer(subject) || - subject && typeof subject === 'object' && - typeof subject.length === 'number'; -} - -function toHex(n) { - if (n < 16) return '0' + n.toString(16); - return n.toString(16); -} - -function utf8ToBytes(str) { - var byteArray = []; - for (var i = 0; i < str.length; i++) - if (str.charCodeAt(i) <= 0x7F) - byteArray.push(str.charCodeAt(i)); - else { - var h = encodeURIComponent(str.charAt(i)).substr(1).split('%'); - for (var j = 0; j < h.length; j++) - byteArray.push(parseInt(h[j], 16)); - } - - return byteArray; -} - -function asciiToBytes(str) { - var byteArray = [] - for (var i = 0; i < str.length; i++ ) - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push( str.charCodeAt(i) & 0xFF ); - - return byteArray; -} - -function base64ToBytes(str) { - return require("base64-js").toByteArray(str); -} - -function blitBuffer(src, dst, offset, length) { - var pos, i = 0; - while (i < length) { - if ((i+offset >= dst.length) || (i >= src.length)) - break; - - dst[i + offset] = src[i]; - i++; - } - return i; -} - -function decodeUtf8Char(str) { - try { - return decodeURIComponent(str); - } catch (err) { - return String.fromCharCode(0xFFFD); // UTF 8 invalid char - } -} - -// read/write bit-twiddling - -Buffer.prototype.readUInt8 = function(offset, noAssert) { - var buffer = this; - - if (!noAssert) { - assert.ok(offset !== undefined && offset !== null, - 'missing offset'); - - assert.ok(offset < buffer.length, - 'Trying to read beyond buffer length'); - } - - if (offset >= buffer.length) return; - - return buffer[offset]; -}; - -function readUInt16(buffer, offset, isBigEndian, noAssert) { - var val = 0; - - - if (!noAssert) { - assert.ok(typeof (isBigEndian) === 'boolean', - 'missing or invalid endian'); - - assert.ok(offset !== undefined && offset !== null, - 'missing offset'); - - assert.ok(offset + 1 < buffer.length, - 'Trying to read beyond buffer length'); - } - - if (offset >= buffer.length) return 0; - - if (isBigEndian) { - val = buffer[offset] << 8; - if (offset + 1 < buffer.length) { - val |= buffer[offset + 1]; - } - } else { - val = buffer[offset]; - if (offset + 1 < buffer.length) { - val |= buffer[offset + 1] << 8; - } - } - - return val; -} - -Buffer.prototype.readUInt16LE = function(offset, noAssert) { - return readUInt16(this, offset, false, noAssert); -}; - -Buffer.prototype.readUInt16BE = function(offset, noAssert) { - return readUInt16(this, offset, true, noAssert); -}; - -function readUInt32(buffer, offset, isBigEndian, noAssert) { - var val = 0; - - if (!noAssert) { - assert.ok(typeof (isBigEndian) === 'boolean', - 'missing or invalid endian'); - - assert.ok(offset !== undefined && offset !== null, - 'missing offset'); - - assert.ok(offset + 3 < buffer.length, - 'Trying to read beyond buffer length'); - } - - if (offset >= buffer.length) return 0; - - if (isBigEndian) { - if (offset + 1 < buffer.length) - val = buffer[offset + 1] << 16; - if (offset + 2 < buffer.length) - val |= buffer[offset + 2] << 8; - if (offset + 3 < buffer.length) - val |= buffer[offset + 3]; - val = val + (buffer[offset] << 24 >>> 0); - } else { - if (offset + 2 < buffer.length) - val = buffer[offset + 2] << 16; - if (offset + 1 < buffer.length) - val |= buffer[offset + 1] << 8; - val |= buffer[offset]; - if (offset + 3 < buffer.length) - val = val + (buffer[offset + 3] << 24 >>> 0); - } - - return val; -} - -Buffer.prototype.readUInt32LE = function(offset, noAssert) { - return readUInt32(this, offset, false, noAssert); -}; - -Buffer.prototype.readUInt32BE = function(offset, noAssert) { - return readUInt32(this, offset, true, noAssert); -}; - - -/* - * Signed integer types, yay team! A reminder on how two's complement actually - * works. The first bit is the signed bit, i.e. tells us whether or not the - * number should be positive or negative. If the two's complement value is - * positive, then we're done, as it's equivalent to the unsigned representation. - * - * Now if the number is positive, you're pretty much done, you can just leverage - * the unsigned translations and return those. Unfortunately, negative numbers - * aren't quite that straightforward. - * - * At first glance, one might be inclined to use the traditional formula to - * translate binary numbers between the positive and negative values in two's - * complement. (Though it doesn't quite work for the most negative value) - * Mainly: - * - invert all the bits - * - add one to the result - * - * Of course, this doesn't quite work in Javascript. Take for example the value - * of -128. This could be represented in 16 bits (big-endian) as 0xff80. But of - * course, Javascript will do the following: - * - * > ~0xff80 - * -65409 - * - * Whoh there, Javascript, that's not quite right. But wait, according to - * Javascript that's perfectly correct. When Javascript ends up seeing the - * constant 0xff80, it has no notion that it is actually a signed number. It - * assumes that we've input the unsigned value 0xff80. Thus, when it does the - * binary negation, it casts it into a signed value, (positive 0xff80). Then - * when you perform binary negation on that, it turns it into a negative number. - * - * Instead, we're going to have to use the following general formula, that works - * in a rather Javascript friendly way. I'm glad we don't support this kind of - * weird numbering scheme in the kernel. - * - * (BIT-MAX - (unsigned)val + 1) * -1 - * - * The astute observer, may think that this doesn't make sense for 8-bit numbers - * (really it isn't necessary for them). However, when you get 16-bit numbers, - * you do. Let's go back to our prior example and see how this will look: - * - * (0xffff - 0xff80 + 1) * -1 - * (0x007f + 1) * -1 - * (0x0080) * -1 - */ -Buffer.prototype.readInt8 = function(offset, noAssert) { - var buffer = this; - var neg; - - if (!noAssert) { - assert.ok(offset !== undefined && offset !== null, - 'missing offset'); - - assert.ok(offset < buffer.length, - 'Trying to read beyond buffer length'); - } - - if (offset >= buffer.length) return; - - neg = buffer[offset] & 0x80; - if (!neg) { - return (buffer[offset]); - } - - return ((0xff - buffer[offset] + 1) * -1); -}; - -function readInt16(buffer, offset, isBigEndian, noAssert) { - var neg, val; - - if (!noAssert) { - assert.ok(typeof (isBigEndian) === 'boolean', - 'missing or invalid endian'); - - assert.ok(offset !== undefined && offset !== null, - 'missing offset'); - - assert.ok(offset + 1 < buffer.length, - 'Trying to read beyond buffer length'); - } - - val = readUInt16(buffer, offset, isBigEndian, noAssert); - neg = val & 0x8000; - if (!neg) { - return val; - } - - return (0xffff - val + 1) * -1; -} - -Buffer.prototype.readInt16LE = function(offset, noAssert) { - return readInt16(this, offset, false, noAssert); -}; - -Buffer.prototype.readInt16BE = function(offset, noAssert) { - return readInt16(this, offset, true, noAssert); -}; - -function readInt32(buffer, offset, isBigEndian, noAssert) { - var neg, val; - - if (!noAssert) { - assert.ok(typeof (isBigEndian) === 'boolean', - 'missing or invalid endian'); - - assert.ok(offset !== undefined && offset !== null, - 'missing offset'); - - assert.ok(offset + 3 < buffer.length, - 'Trying to read beyond buffer length'); - } - - val = readUInt32(buffer, offset, isBigEndian, noAssert); - neg = val & 0x80000000; - if (!neg) { - return (val); - } - - return (0xffffffff - val + 1) * -1; -} - -Buffer.prototype.readInt32LE = function(offset, noAssert) { - return readInt32(this, offset, false, noAssert); -}; - -Buffer.prototype.readInt32BE = function(offset, noAssert) { - return readInt32(this, offset, true, noAssert); -}; - -function readFloat(buffer, offset, isBigEndian, noAssert) { - if (!noAssert) { - assert.ok(typeof (isBigEndian) === 'boolean', - 'missing or invalid endian'); - - assert.ok(offset + 3 < buffer.length, - 'Trying to read beyond buffer length'); - } - - return require('./buffer_ieee754').readIEEE754(buffer, offset, isBigEndian, - 23, 4); -} - -Buffer.prototype.readFloatLE = function(offset, noAssert) { - return readFloat(this, offset, false, noAssert); -}; - -Buffer.prototype.readFloatBE = function(offset, noAssert) { - return readFloat(this, offset, true, noAssert); -}; - -function readDouble(buffer, offset, isBigEndian, noAssert) { - if (!noAssert) { - assert.ok(typeof (isBigEndian) === 'boolean', - 'missing or invalid endian'); - - assert.ok(offset + 7 < buffer.length, - 'Trying to read beyond buffer length'); - } - - return require('./buffer_ieee754').readIEEE754(buffer, offset, isBigEndian, - 52, 8); -} - -Buffer.prototype.readDoubleLE = function(offset, noAssert) { - return readDouble(this, offset, false, noAssert); -}; - -Buffer.prototype.readDoubleBE = function(offset, noAssert) { - return readDouble(this, offset, true, noAssert); -}; - - -/* - * We have to make sure that the value is a valid integer. This means that it is - * non-negative. It has no fractional component and that it does not exceed the - * maximum allowed value. - * - * value The number to check for validity - * - * max The maximum value - */ -function verifuint(value, max) { - assert.ok(typeof (value) == 'number', - 'cannot write a non-number as a number'); - - assert.ok(value >= 0, - 'specified a negative value for writing an unsigned value'); - - assert.ok(value <= max, 'value is larger than maximum value for type'); - - assert.ok(Math.floor(value) === value, 'value has a fractional component'); -} - -Buffer.prototype.writeUInt8 = function(value, offset, noAssert) { - var buffer = this; - - if (!noAssert) { - assert.ok(value !== undefined && value !== null, - 'missing value'); - - assert.ok(offset !== undefined && offset !== null, - 'missing offset'); - - assert.ok(offset < buffer.length, - 'trying to write beyond buffer length'); - - verifuint(value, 0xff); - } - - if (offset < buffer.length) { - buffer[offset] = value; - } -}; - -function writeUInt16(buffer, value, offset, isBigEndian, noAssert) { - if (!noAssert) { - assert.ok(value !== undefined && value !== null, - 'missing value'); - - assert.ok(typeof (isBigEndian) === 'boolean', - 'missing or invalid endian'); - - assert.ok(offset !== undefined && offset !== null, - 'missing offset'); - - assert.ok(offset + 1 < buffer.length, - 'trying to write beyond buffer length'); - - verifuint(value, 0xffff); - } - - for (var i = 0; i < Math.min(buffer.length - offset, 2); i++) { - buffer[offset + i] = - (value & (0xff << (8 * (isBigEndian ? 1 - i : i)))) >>> - (isBigEndian ? 1 - i : i) * 8; - } - -} - -Buffer.prototype.writeUInt16LE = function(value, offset, noAssert) { - writeUInt16(this, value, offset, false, noAssert); -}; - -Buffer.prototype.writeUInt16BE = function(value, offset, noAssert) { - writeUInt16(this, value, offset, true, noAssert); -}; - -function writeUInt32(buffer, value, offset, isBigEndian, noAssert) { - if (!noAssert) { - assert.ok(value !== undefined && value !== null, - 'missing value'); - - assert.ok(typeof (isBigEndian) === 'boolean', - 'missing or invalid endian'); - - assert.ok(offset !== undefined && offset !== null, - 'missing offset'); - - assert.ok(offset + 3 < buffer.length, - 'trying to write beyond buffer length'); - - verifuint(value, 0xffffffff); - } - - for (var i = 0; i < Math.min(buffer.length - offset, 4); i++) { - buffer[offset + i] = - (value >>> (isBigEndian ? 3 - i : i) * 8) & 0xff; - } -} - -Buffer.prototype.writeUInt32LE = function(value, offset, noAssert) { - writeUInt32(this, value, offset, false, noAssert); -}; - -Buffer.prototype.writeUInt32BE = function(value, offset, noAssert) { - writeUInt32(this, value, offset, true, noAssert); -}; - - -/* - * We now move onto our friends in the signed number category. Unlike unsigned - * numbers, we're going to have to worry a bit more about how we put values into - * arrays. Since we are only worrying about signed 32-bit values, we're in - * slightly better shape. Unfortunately, we really can't do our favorite binary - * & in this system. It really seems to do the wrong thing. For example: - * - * > -32 & 0xff - * 224 - * - * What's happening above is really: 0xe0 & 0xff = 0xe0. However, the results of - * this aren't treated as a signed number. Ultimately a bad thing. - * - * What we're going to want to do is basically create the unsigned equivalent of - * our representation and pass that off to the wuint* functions. To do that - * we're going to do the following: - * - * - if the value is positive - * we can pass it directly off to the equivalent wuint - * - if the value is negative - * we do the following computation: - * mb + val + 1, where - * mb is the maximum unsigned value in that byte size - * val is the Javascript negative integer - * - * - * As a concrete value, take -128. In signed 16 bits this would be 0xff80. If - * you do out the computations: - * - * 0xffff - 128 + 1 - * 0xffff - 127 - * 0xff80 - * - * You can then encode this value as the signed version. This is really rather - * hacky, but it should work and get the job done which is our goal here. - */ - -/* - * A series of checks to make sure we actually have a signed 32-bit number - */ -function verifsint(value, max, min) { - assert.ok(typeof (value) == 'number', - 'cannot write a non-number as a number'); - - assert.ok(value <= max, 'value larger than maximum allowed value'); - - assert.ok(value >= min, 'value smaller than minimum allowed value'); - - assert.ok(Math.floor(value) === value, 'value has a fractional component'); -} - -function verifIEEE754(value, max, min) { - assert.ok(typeof (value) == 'number', - 'cannot write a non-number as a number'); - - assert.ok(value <= max, 'value larger than maximum allowed value'); - - assert.ok(value >= min, 'value smaller than minimum allowed value'); -} - -Buffer.prototype.writeInt8 = function(value, offset, noAssert) { - var buffer = this; - - if (!noAssert) { - assert.ok(value !== undefined && value !== null, - 'missing value'); - - assert.ok(offset !== undefined && offset !== null, - 'missing offset'); - - assert.ok(offset < buffer.length, - 'Trying to write beyond buffer length'); - - verifsint(value, 0x7f, -0x80); - } - - if (value >= 0) { - buffer.writeUInt8(value, offset, noAssert); - } else { - buffer.writeUInt8(0xff + value + 1, offset, noAssert); - } -}; - -function writeInt16(buffer, value, offset, isBigEndian, noAssert) { - if (!noAssert) { - assert.ok(value !== undefined && value !== null, - 'missing value'); - - assert.ok(typeof (isBigEndian) === 'boolean', - 'missing or invalid endian'); - - assert.ok(offset !== undefined && offset !== null, - 'missing offset'); - - assert.ok(offset + 1 < buffer.length, - 'Trying to write beyond buffer length'); - - verifsint(value, 0x7fff, -0x8000); - } - - if (value >= 0) { - writeUInt16(buffer, value, offset, isBigEndian, noAssert); - } else { - writeUInt16(buffer, 0xffff + value + 1, offset, isBigEndian, noAssert); - } -} - -Buffer.prototype.writeInt16LE = function(value, offset, noAssert) { - writeInt16(this, value, offset, false, noAssert); -}; - -Buffer.prototype.writeInt16BE = function(value, offset, noAssert) { - writeInt16(this, value, offset, true, noAssert); -}; - -function writeInt32(buffer, value, offset, isBigEndian, noAssert) { - if (!noAssert) { - assert.ok(value !== undefined && value !== null, - 'missing value'); - - assert.ok(typeof (isBigEndian) === 'boolean', - 'missing or invalid endian'); - - assert.ok(offset !== undefined && offset !== null, - 'missing offset'); - - assert.ok(offset + 3 < buffer.length, - 'Trying to write beyond buffer length'); - - verifsint(value, 0x7fffffff, -0x80000000); - } - - if (value >= 0) { - writeUInt32(buffer, value, offset, isBigEndian, noAssert); - } else { - writeUInt32(buffer, 0xffffffff + value + 1, offset, isBigEndian, noAssert); - } -} - -Buffer.prototype.writeInt32LE = function(value, offset, noAssert) { - writeInt32(this, value, offset, false, noAssert); -}; - -Buffer.prototype.writeInt32BE = function(value, offset, noAssert) { - writeInt32(this, value, offset, true, noAssert); -}; - -function writeFloat(buffer, value, offset, isBigEndian, noAssert) { - if (!noAssert) { - assert.ok(value !== undefined && value !== null, - 'missing value'); - - assert.ok(typeof (isBigEndian) === 'boolean', - 'missing or invalid endian'); - - assert.ok(offset !== undefined && offset !== null, - 'missing offset'); - - assert.ok(offset + 3 < buffer.length, - 'Trying to write beyond buffer length'); - - verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38); - } - - require('./buffer_ieee754').writeIEEE754(buffer, value, offset, isBigEndian, - 23, 4); -} - -Buffer.prototype.writeFloatLE = function(value, offset, noAssert) { - writeFloat(this, value, offset, false, noAssert); -}; - -Buffer.prototype.writeFloatBE = function(value, offset, noAssert) { - writeFloat(this, value, offset, true, noAssert); -}; - -function writeDouble(buffer, value, offset, isBigEndian, noAssert) { - if (!noAssert) { - assert.ok(value !== undefined && value !== null, - 'missing value'); - - assert.ok(typeof (isBigEndian) === 'boolean', - 'missing or invalid endian'); - - assert.ok(offset !== undefined && offset !== null, - 'missing offset'); - - assert.ok(offset + 7 < buffer.length, - 'Trying to write beyond buffer length'); - - verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308); - } - - require('./buffer_ieee754').writeIEEE754(buffer, value, offset, isBigEndian, - 52, 8); -} - -Buffer.prototype.writeDoubleLE = function(value, offset, noAssert) { - writeDouble(this, value, offset, false, noAssert); -}; - -Buffer.prototype.writeDoubleBE = function(value, offset, noAssert) { - writeDouble(this, value, offset, true, noAssert); -}; - -},{"./buffer_ieee754":1,"assert":6,"base64-js":4}],"buffer-browserify":[function(require,module,exports){ -module.exports=require('q9TxCC'); -},{}],4:[function(require,module,exports){ -(function (exports) { - 'use strict'; - - var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - - function b64ToByteArray(b64) { - var i, j, l, tmp, placeHolders, arr; - - if (b64.length % 4 > 0) { - throw 'Invalid string. Length must be a multiple of 4'; - } - - // the number of equal signs (place holders) - // if there are two placeholders, than the two characters before it - // represent one byte - // if there is only one, then the three characters before it represent 2 bytes - // this is just a cheap hack to not do indexOf twice - placeHolders = b64.indexOf('='); - placeHolders = placeHolders > 0 ? b64.length - placeHolders : 0; - - // base64 is 4/3 + up to two characters of the original data - arr = [];//new Uint8Array(b64.length * 3 / 4 - placeHolders); - - // if there are placeholders, only get up to the last complete 4 chars - l = placeHolders > 0 ? b64.length - 4 : b64.length; - - for (i = 0, j = 0; i < l; i += 4, j += 3) { - tmp = (lookup.indexOf(b64[i]) << 18) | (lookup.indexOf(b64[i + 1]) << 12) | (lookup.indexOf(b64[i + 2]) << 6) | lookup.indexOf(b64[i + 3]); - arr.push((tmp & 0xFF0000) >> 16); - arr.push((tmp & 0xFF00) >> 8); - arr.push(tmp & 0xFF); - } - - if (placeHolders === 2) { - tmp = (lookup.indexOf(b64[i]) << 2) | (lookup.indexOf(b64[i + 1]) >> 4); - arr.push(tmp & 0xFF); - } else if (placeHolders === 1) { - tmp = (lookup.indexOf(b64[i]) << 10) | (lookup.indexOf(b64[i + 1]) << 4) | (lookup.indexOf(b64[i + 2]) >> 2); - arr.push((tmp >> 8) & 0xFF); - arr.push(tmp & 0xFF); - } - - return arr; - } - - function uint8ToBase64(uint8) { - var i, - extraBytes = uint8.length % 3, // if we have 1 byte left, pad 2 bytes - output = "", - temp, length; - - function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]; - }; - - // go through the array every three bytes, we'll deal with trailing stuff later - for (i = 0, length = uint8.length - extraBytes; i < length; i += 3) { - temp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]); - output += tripletToBase64(temp); - } - - // pad the end with zeros, but make sure to not forget the extra bytes - switch (extraBytes) { - case 1: - temp = uint8[uint8.length - 1]; - output += lookup[temp >> 2]; - output += lookup[(temp << 4) & 0x3F]; - output += '=='; - break; - case 2: - temp = (uint8[uint8.length - 2] << 8) + (uint8[uint8.length - 1]); - output += lookup[temp >> 10]; - output += lookup[(temp >> 4) & 0x3F]; - output += lookup[(temp << 2) & 0x3F]; - output += '='; - break; - } - - return output; - } - - module.exports.toByteArray = b64ToByteArray; - module.exports.fromByteArray = uint8ToBase64; -}()); - -},{}],5:[function(require,module,exports){ - - -// -// The shims in this file are not fully implemented shims for the ES5 -// features, but do work for the particular usecases there is in -// the other modules. -// - -var toString = Object.prototype.toString; -var hasOwnProperty = Object.prototype.hasOwnProperty; - -// Array.isArray is supported in IE9 -function isArray(xs) { - return toString.call(xs) === '[object Array]'; -} -exports.isArray = typeof Array.isArray === 'function' ? Array.isArray : isArray; - -// Array.prototype.indexOf is supported in IE9 -exports.indexOf = function indexOf(xs, x) { - if (xs.indexOf) return xs.indexOf(x); - for (var i = 0; i < xs.length; i++) { - if (x === xs[i]) return i; - } - return -1; -}; - -// Array.prototype.filter is supported in IE9 -exports.filter = function filter(xs, fn) { - if (xs.filter) return xs.filter(fn); - var res = []; - for (var i = 0; i < xs.length; i++) { - if (fn(xs[i], i, xs)) res.push(xs[i]); - } - return res; -}; - -// Array.prototype.forEach is supported in IE9 -exports.forEach = function forEach(xs, fn, self) { - if (xs.forEach) return xs.forEach(fn, self); - for (var i = 0; i < xs.length; i++) { - fn.call(self, xs[i], i, xs); - } -}; - -// Array.prototype.map is supported in IE9 -exports.map = function map(xs, fn) { - if (xs.map) return xs.map(fn); - var out = new Array(xs.length); - for (var i = 0; i < xs.length; i++) { - out[i] = fn(xs[i], i, xs); - } - return out; -}; - -// Array.prototype.reduce is supported in IE9 -exports.reduce = function reduce(array, callback, opt_initialValue) { - if (array.reduce) return array.reduce(callback, opt_initialValue); - var value, isValueSet = false; - - if (2 < arguments.length) { - value = opt_initialValue; - isValueSet = true; - } - for (var i = 0, l = array.length; l > i; ++i) { - if (array.hasOwnProperty(i)) { - if (isValueSet) { - value = callback(value, array[i], i, array); - } - else { - value = array[i]; - isValueSet = true; - } - } - } - - return value; -}; - -// String.prototype.substr - negative index don't work in IE8 -if ('ab'.substr(-1) !== 'b') { - exports.substr = function (str, start, length) { - // did we get a negative start, calculate how much it is from the beginning of the string - if (start < 0) start = str.length + start; - - // call the original function - return str.substr(start, length); - }; -} else { - exports.substr = function (str, start, length) { - return str.substr(start, length); - }; -} - -// String.prototype.trim is supported in IE9 -exports.trim = function (str) { - if (str.trim) return str.trim(); - return str.replace(/^\s+|\s+$/g, ''); -}; - -// Function.prototype.bind is supported in IE9 -exports.bind = function () { - var args = Array.prototype.slice.call(arguments); - var fn = args.shift(); - if (fn.bind) return fn.bind.apply(fn, args); - var self = args.shift(); - return function () { - fn.apply(self, args.concat([Array.prototype.slice.call(arguments)])); - }; -}; - -// Object.create is supported in IE9 -function create(prototype, properties) { - var object; - if (prototype === null) { - object = { '__proto__' : null }; - } - else { - if (typeof prototype !== 'object') { - throw new TypeError( - 'typeof prototype[' + (typeof prototype) + '] != \'object\'' - ); - } - var Type = function () {}; - Type.prototype = prototype; - object = new Type(); - object.__proto__ = prototype; - } - if (typeof properties !== 'undefined' && Object.defineProperties) { - Object.defineProperties(object, properties); - } - return object; -} -exports.create = typeof Object.create === 'function' ? Object.create : create; - -// Object.keys and Object.getOwnPropertyNames is supported in IE9 however -// they do show a description and number property on Error objects -function notObject(object) { - return ((typeof object != "object" && typeof object != "function") || object === null); -} - -function keysShim(object) { - if (notObject(object)) { - throw new TypeError("Object.keys called on a non-object"); - } - - var result = []; - for (var name in object) { - if (hasOwnProperty.call(object, name)) { - result.push(name); - } - } - return result; -} - -// getOwnPropertyNames is almost the same as Object.keys one key feature -// is that it returns hidden properties, since that can't be implemented, -// this feature gets reduced so it just shows the length property on arrays -function propertyShim(object) { - if (notObject(object)) { - throw new TypeError("Object.getOwnPropertyNames called on a non-object"); - } - - var result = keysShim(object); - if (exports.isArray(object) && exports.indexOf(object, 'length') === -1) { - result.push('length'); - } - return result; -} - -var keys = typeof Object.keys === 'function' ? Object.keys : keysShim; -var getOwnPropertyNames = typeof Object.getOwnPropertyNames === 'function' ? - Object.getOwnPropertyNames : propertyShim; - -if (new Error().hasOwnProperty('description')) { - var ERROR_PROPERTY_FILTER = function (obj, array) { - if (toString.call(obj) === '[object Error]') { - array = exports.filter(array, function (name) { - return name !== 'description' && name !== 'number' && name !== 'message'; - }); - } - return array; - }; - - exports.keys = function (object) { - return ERROR_PROPERTY_FILTER(object, keys(object)); - }; - exports.getOwnPropertyNames = function (object) { - return ERROR_PROPERTY_FILTER(object, getOwnPropertyNames(object)); - }; -} else { - exports.keys = keys; - exports.getOwnPropertyNames = getOwnPropertyNames; -} - -// Object.getOwnPropertyDescriptor - supported in IE8 but only on dom elements -function valueObject(value, key) { - return { value: value[key] }; -} - -if (typeof Object.getOwnPropertyDescriptor === 'function') { - try { - Object.getOwnPropertyDescriptor({'a': 1}, 'a'); - exports.getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; - } catch (e) { - // IE8 dom element issue - use a try catch and default to valueObject - exports.getOwnPropertyDescriptor = function (value, key) { - try { - return Object.getOwnPropertyDescriptor(value, key); - } catch (e) { - return valueObject(value, key); - } - }; - } -} else { - exports.getOwnPropertyDescriptor = valueObject; -} - -},{}],6:[function(require,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// UTILITY -var util = require('util'); -var shims = require('_shims'); -var pSlice = Array.prototype.slice; - -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = module.exports = ok; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) - -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - this.message = options.message || getMessage(this); -}; - -// assert.AssertionError instanceof Error -util.inherits(assert.AssertionError, Error); - -function replacer(key, value) { - if (util.isUndefined(value)) { - return '' + value; - } - if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) { - return value.toString(); - } - if (util.isFunction(value) || util.isRegExp(value)) { - return value.toString(); - } - return value; -} - -function truncate(s, n) { - if (util.isString(s)) { - return s.length < n ? s : s.slice(0, n); - } else { - return s; - } -} - -function getMessage(self) { - return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' + - self.operator + ' ' + - truncate(JSON.stringify(self.expected, replacer), 128); -} - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); -} -assert.ok = ok; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } -}; - -function _deepEqual(actual, expected) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - - } else if (util.isBuffer(actual) && util.isBuffer(expected)) { - if (actual.length != expected.length) return false; - - for (var i = 0; i < actual.length; i++) { - if (actual[i] !== expected[i]) return false; - } - - return true; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if (!util.isObject(actual) && !util.isObject(expected)) { - return actual == expected; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return objEquiv(actual, expected); - } -} - -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv(a, b) { - if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b)) - return false; - // an identical 'prototype' property. - if (a.prototype !== b.prototype) return false; - //~~~I've managed to break Object.keys through screwy arguments passing. - // Converting to array solves the problem. - if (isArguments(a)) { - if (!isArguments(b)) { - return false; - } - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b); - } - try { - var ka = shims.keys(a), - kb = shims.keys(b), - key, i; - } catch (e) {//happens when one is a string literal and the other isn't - return false; - } - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length != kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key])) return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; - -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); - } else if (actual instanceof expected) { - return true; - } else if (expected.call({}, actual) === true) { - return true; - } - - return false; -} - -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (util.isString(expected)) { - message = expected; - expected = null; - } - - try { - block(); - } catch (e) { - actual = e; - } - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); - } - - if (!shouldThrow && expectedException(actual, expected)) { - fail(actual, expected, 'Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } -} - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [true].concat(pSlice.call(arguments))); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/message) { - _throws.apply(this, [false].concat(pSlice.call(arguments))); -}; - -assert.ifError = function(err) { if (err) {throw err;}}; -},{"_shims":5,"util":7}],7:[function(require,module,exports){ +},{"__browserify_process":4,"_shims":1,"util":3}],3:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -3275,7 +897,11 @@ function isPrimitive(arg) { exports.isPrimitive = isPrimitive; function isBuffer(arg) { - return arg instanceof Buffer; + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.binarySlice === 'function' + ; } exports.isBuffer = isBuffer; @@ -3349,10 +975,7 @@ function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -},{"_shims":5}]},{},[]) -;;module.exports=require("buffer-browserify") - -},{}],5:[function(require,module,exports){ +},{"_shims":1}],4:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -3406,7 +1029,7 @@ process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; -},{}],6:[function(require,module,exports){ +},{}],5:[function(require,module,exports){ /* Copyright (C) 2013 Ariya Hidayat Copyright (C) 2013 Thaddee Tyl @@ -3454,6 +1077,7 @@ parseStatement: true, parseSourceElement: true, parseModuleBlock: true, parseCon advanceXJSChild: true, isXJSIdentifierStart: true, isXJSIdentifierPart: true, scanXJSStringLiteral: true, scanXJSIdentifier: true, parseXJSAttributeValue: true, parseXJSChild: true, parseXJSElement: true, parseXJSExpressionContainer: true, parseXJSEmptyExpression: true, +parseTypeAnnotation: true, parseTypeAnnotatableIdentifier: true, parseYieldExpression: true */ @@ -5096,61 +2720,63 @@ parseYieldExpression: true }, createFunctionDeclaration: function (id, params, defaults, body, rest, generator, expression, - returnTypeAnnotation) { + returnType) { return { type: Syntax.FunctionDeclaration, id: id, params: params, defaults: defaults, - returnType: returnTypeAnnotation, body: body, rest: rest, generator: generator, - expression: expression + expression: expression, + returnType: returnType }; }, createFunctionExpression: function (id, params, defaults, body, rest, generator, expression, - returnTypeAnnotation) { + returnType) { return { type: Syntax.FunctionExpression, id: id, params: params, defaults: defaults, - returnType: returnTypeAnnotation, body: body, rest: rest, generator: generator, - expression: expression + expression: expression, + returnType: returnType }; }, createIdentifier: function (name) { return { type: Syntax.Identifier, - name: name + name: name, + // Only here to initialize the shape of the object to ensure + // that the 'typeAnnotation' key is ordered before others that + // are added later (like 'loc' and 'range'). This just helps + // keep the shape of Identifier nodes consistent with everything + // else. + typeAnnotation: undefined }; }, - createTypeAnnotatedIdentifier: function (annotation, identifier) { - return { - type: Syntax.TypeAnnotatedIdentifier, - annotation: annotation, - identifier: identifier - }; - }, - - createTypeAnnotation: function (annotatedType, templateTypes, - paramTypes, returnType, unionType, - nullable) { + createTypeAnnotation: function (typeIdentifier, paramTypes, returnType, isNullable) { return { type: Syntax.TypeAnnotation, - annotatedType: annotatedType, - templateTypes: templateTypes, + id: typeIdentifier, paramTypes: paramTypes, returnType: returnType, - unionType: unionType, - nullable: nullable + isNullable: isNullable + }; + }, + + createTypeAnnotatedIdentifier: function (identifier, annotation) { + return { + type: Syntax.TypeAnnotatedIdentifier, + id: identifier, + annotation: annotation }; }, @@ -5481,11 +3107,10 @@ parseYieldExpression: true }; }, - createExportDeclaration: function (def, declaration, specifiers, source) { + createExportDeclaration: function (declaration, specifiers, source) { return { type: Syntax.ExportDeclaration, declaration: declaration, - default: def, specifiers: specifiers, source: source }; @@ -5879,7 +3504,7 @@ parseYieldExpression: true key = parseObjectPropertyKey(); expect('('); token = lookahead; - param = [ parseVariableIdentifier() ]; + param = [ parseTypeAnnotatableIdentifier() ]; expect(')'); return delegate.createProperty('set', key, parsePropertyFunction({ params: param, generator: false, name: token }), false, false); } @@ -6690,6 +4315,50 @@ parseYieldExpression: true // 12.2 Variable Statement + function parseTypeAnnotation(dontExpectColon) { + var typeIdentifier = null, paramTypes = null, returnType = null, + isNullable = false; + + if (!dontExpectColon) { + expect(':'); + } + + if (match('?')) { + lex(); + isNullable = true; + } + + if (lookahead.type === Token.Identifier) { + typeIdentifier = parseVariableIdentifier(); + } + + if (match('(')) { + lex(); + paramTypes = []; + while (lookahead.type === Token.Identifier || match('?')) { + paramTypes.push(parseTypeAnnotation(true)); + if (!match(')')) { + expect(','); + } + } + expect(')'); + expect('=>'); + + if (matchKeyword('void')) { + lex(); + } else { + returnType = parseTypeAnnotation(true); + } + } + + return delegate.createTypeAnnotation( + typeIdentifier, + paramTypes, + returnType, + isNullable + ); + } + function parseVariableIdentifier() { var token = lex(); @@ -6700,98 +4369,14 @@ parseYieldExpression: true return delegate.createIdentifier(token.value); } - function parseTypeAnnotation() { - var isNullable = false, paramTypes = null, returnType = null, - templateTypes = null, type, unionType = null; + function parseTypeAnnotatableIdentifier() { + var ident = parseVariableIdentifier(); - if (match('?')) { - lex(); - isNullable = true; + if (match(':')) { + return delegate.createTypeAnnotatedIdentifier(ident, parseTypeAnnotation()); } - type = parseVariableIdentifier(); - - if (match('<')) { - lex(); - templateTypes = []; - while (lookahead.type === Token.Identifier || match('?')) { - templateTypes.push(parseTypeAnnotation()); - if (!match('>')) { - expect(','); - } - } - expect('>'); - } - - if (match('(')) { - lex(); - paramTypes = []; - while (lookahead.type === Token.Identifier || match('?')) { - paramTypes.push(parseTypeAnnotation()); - if (!match(')')) { - expect(','); - } - } - expect(')'); - - if (match(':')) { - lex(); - returnType = parseTypeAnnotation(); - } - } - - if (match('|')) { - lex(); - unionType = parseTypeAnnotation(); - } - - return delegate.createTypeAnnotation( - type, - templateTypes, - paramTypes, - returnType, - unionType, - isNullable - ); - } - - function parseAnnotatableIdentifier() { - var annotation, annotationLookahead, annotationPresent, identifier, - matchesNullableToken; - - matchesNullableToken = match('?'); - - if (lookahead.type !== Token.Identifier && !matchesNullableToken) { - throwUnexpected(lookahead); - } - - if (!matchesNullableToken) { - annotationLookahead = lookahead2(); - } - - annotationPresent = - matchesNullableToken - - // function (number numVal) {} - || annotationLookahead.type === Token.Identifier - - // function (fn(number)|array param) {} - || (annotationLookahead.type === Token.Punctuator - && (annotationLookahead.value === '(' - || annotationLookahead.value === '<' - || annotationLookahead.value === '|')); - - if (!annotationPresent) { - return parseVariableIdentifier(); - } - - annotation = parseTypeAnnotation(); - identifier = parseVariableIdentifier(); - - return delegate.createTypeAnnotatedIdentifier( - annotation, - identifier - ); + return ident; } function parseVariableDeclaration(kind) { @@ -6804,11 +4389,7 @@ parseYieldExpression: true id = parseArrayInitialiser(); reinterpretAsAssignmentBindingPattern(id); } else { - if (state.allowDefault) { - id = matchKeyword('default') ? parseNonComputedProperty() : parseVariableIdentifier(); - } else { - id = parseVariableIdentifier(); - } + id = state.allowKeyword ? parseNonComputedProperty() : parseTypeAnnotatableIdentifier(); // 12.2.1 if (strict && isRestrictedWord(id.name)) { throwErrorTolerant({}, Messages.StrictVarName); @@ -6926,36 +4507,10 @@ parseYieldExpression: true } function parseExportDeclaration() { - var previousAllowDefault, decl, def, src, specifiers; + var previousAllowKeyword, decl, def, src, specifiers; expectKeyword('export'); - if (matchKeyword('default')) { - lex(); - if (match('=')) { - lex(); - def = parseAssignmentExpression(); - } else if (lookahead.type === Token.Keyword) { - switch (lookahead.value) { - case 'let': - case 'const': - case 'var': - case 'class': - def = parseSourceElement(); - break; - case 'function': - def = parseFunctionExpression(); - break; - default: - throwUnexpected(lex()); - } - } else { - def = parseAssignmentExpression(); - } - consumeSemicolon(); - return delegate.createExportDeclaration(true, def, null, null); - } - if (lookahead.type === Token.Keyword) { switch (lookahead.value) { case 'let': @@ -6963,13 +4518,16 @@ parseYieldExpression: true case 'var': case 'class': case 'function': - previousAllowDefault = state.allowDefault; - state.allowDefault = true; - decl = delegate.createExportDeclaration(false, parseSourceElement(), null, null); - state.allowDefault = previousAllowDefault; - return decl; + return delegate.createExportDeclaration(parseSourceElement(), null, null); } - throwUnexpected(lex()); + } + + if (isIdentifierName(lookahead)) { + previousAllowKeyword = state.allowKeyword; + state.allowKeyword = true; + decl = parseVariableDeclarationList('let'); + state.allowKeyword = previousAllowKeyword; + return delegate.createExportDeclaration(decl, null, null); } specifiers = []; @@ -6995,7 +4553,7 @@ parseYieldExpression: true consumeSemicolon(); - return delegate.createExportDeclaration(false, null, specifiers, src); + return delegate.createExportDeclaration(null, specifiers, src); } function parseImportDeclaration() { @@ -7733,12 +5291,10 @@ parseYieldExpression: true param = parseObjectInitialiser(); reinterpretAsDestructuredParameter(options, param); } else { - // We don't currently support typed rest params because doing so is - // a bit awkward. We may come back to this, but for now we'll punt - // on it. + // Typing rest params is awkward, so punting on that for now param = rest ? parseVariableIdentifier() - : parseAnnotatableIdentifier(); + : parseTypeAnnotatableIdentifier(); validateParam(options, token, token.value); if (match('=')) { if (rest) { @@ -7793,7 +5349,6 @@ parseYieldExpression: true } if (match(':')) { - lex(); options.returnTypeAnnotation = parseTypeAnnotation(); } @@ -7813,11 +5368,8 @@ parseYieldExpression: true token = lookahead; - if (state.allowDefault) { - id = matchKeyword('default') ? parseNonComputedProperty() : parseVariableIdentifier(); - } else { - id = parseVariableIdentifier(); - } + id = parseVariableIdentifier(); + if (strict) { if (isRestrictedWord(token.value)) { throwErrorTolerant(token, Messages.StrictFunctionName); @@ -8025,7 +5577,7 @@ parseYieldExpression: true expect('('); token = lookahead; - param = [ parseVariableIdentifier() ]; + param = [ parseTypeAnnotatableIdentifier() ]; expect(')'); return delegate.createMethodDefinition( propType, @@ -8109,11 +5661,7 @@ parseYieldExpression: true expectKeyword('class'); - if (state.allowDefault) { - id = matchKeyword('default') ? parseNonComputedProperty() : parseVariableIdentifier(); - } else { - id = parseVariableIdentifier(); - } + id = parseVariableIdentifier(); if (matchKeyword('extends')) { expectKeyword('extends'); @@ -9377,13 +6925,13 @@ parseYieldExpression: true extra.parseSpreadOrAssignmentExpression = parseSpreadOrAssignmentExpression; extra.parseTemplateElement = parseTemplateElement; extra.parseTemplateLiteral = parseTemplateLiteral; + extra.parseTypeAnnotatableIdentifier = parseTypeAnnotatableIdentifier; + extra.parseTypeAnnotation = parseTypeAnnotation; extra.parseStatement = parseStatement; extra.parseSwitchCase = parseSwitchCase; extra.parseUnaryExpression = parseUnaryExpression; extra.parseVariableDeclaration = parseVariableDeclaration; extra.parseVariableIdentifier = parseVariableIdentifier; - extra.parseAnnotatableIdentifier = parseAnnotatableIdentifier; - extra.parseTypeAnnotation = parseTypeAnnotation; extra.parseMethodDefinition = parseMethodDefinition; extra.parseClassDeclaration = parseClassDeclaration; extra.parseClassExpression = parseClassExpression; @@ -9429,14 +6977,14 @@ parseYieldExpression: true parsePropertyFunction = wrapTracking(extra.parsePropertyFunction); parseTemplateElement = wrapTracking(extra.parseTemplateElement); parseTemplateLiteral = wrapTracking(extra.parseTemplateLiteral); + parseTypeAnnotatableIdentifier = wrapTracking(extra.parseTypeAnnotatableIdentifier); + parseTypeAnnotation = wrapTracking(extra.parseTypeAnnotation); parseSpreadOrAssignmentExpression = wrapTracking(extra.parseSpreadOrAssignmentExpression); parseStatement = wrapTracking(extra.parseStatement); parseSwitchCase = wrapTracking(extra.parseSwitchCase); parseUnaryExpression = wrapTracking(extra.parseUnaryExpression); parseVariableDeclaration = wrapTracking(extra.parseVariableDeclaration); parseVariableIdentifier = wrapTracking(extra.parseVariableIdentifier); - parseAnnotatableIdentifier = wrapTracking(extra.parseAnnotatableIdentifier); - parseTypeAnnotation = wrapTracking(extra.parseTypeAnnotation); parseMethodDefinition = wrapTracking(extra.parseMethodDefinition); parseClassDeclaration = wrapTracking(extra.parseClassDeclaration); parseClassExpression = wrapTracking(extra.parseClassExpression); @@ -9499,14 +7047,14 @@ parseYieldExpression: true parsePropertyFunction = extra.parsePropertyFunction; parseTemplateElement = extra.parseTemplateElement; parseTemplateLiteral = extra.parseTemplateLiteral; + parseTypeAnnotatableIdentifier = extra.parseTypeAnnotatableIdentifier; + parseTypeAnnotation = extra.parseTypeAnnotation; parseSpreadOrAssignmentExpression = extra.parseSpreadOrAssignmentExpression; parseStatement = extra.parseStatement; parseSwitchCase = extra.parseSwitchCase; parseUnaryExpression = extra.parseUnaryExpression; parseVariableDeclaration = extra.parseVariableDeclaration; parseVariableIdentifier = extra.parseVariableIdentifier; - parseAnnotatableIdentifier = extra.parseAnnotatableIdentifier; - parseTypeAnnotation = extra.parseTypeAnnotation; parseMethodDefinition = extra.parseMethodDefinition; parseClassDeclaration = extra.parseClassDeclaration; parseClassExpression = extra.parseClassExpression; @@ -9566,7 +7114,7 @@ parseYieldExpression: true length = source.length; lookahead = null; state = { - allowDefault: true, + allowKeyword: true, allowIn: true, labelSet: {}, inFunctionBody: false, @@ -9667,7 +7215,7 @@ parseYieldExpression: true length = source.length; lookahead = null; state = { - allowDefault: false, + allowKeyword: false, allowIn: true, labelSet: {}, parenthesizedCount: 0, @@ -9772,7 +7320,7 @@ parseYieldExpression: true })); /* vim: set sw=4 ts=4 et tw=80 : */ -},{}],7:[function(require,module,exports){ +},{}],6:[function(require,module,exports){ var Base62 = (function (my) { my.chars = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] @@ -9800,7 +7348,7 @@ var Base62 = (function (my) { }({})); module.exports = Base62 -},{}],8:[function(require,module,exports){ +},{}],7:[function(require,module,exports){ /* * Copyright 2009-2011 Mozilla Foundation and contributors * Licensed under the New BSD license. See LICENSE.txt or: @@ -9810,7 +7358,7 @@ exports.SourceMapGenerator = require('./source-map/source-map-generator').Source exports.SourceMapConsumer = require('./source-map/source-map-consumer').SourceMapConsumer; exports.SourceNode = require('./source-map/source-node').SourceNode; -},{"./source-map/source-map-consumer":13,"./source-map/source-map-generator":14,"./source-map/source-node":15}],9:[function(require,module,exports){ +},{"./source-map/source-map-consumer":12,"./source-map/source-map-generator":13,"./source-map/source-node":14}],8:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -9919,7 +7467,7 @@ define(function (require, exports, module) { }); -},{"amdefine":17}],10:[function(require,module,exports){ +},{"amdefine":16}],9:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -10065,7 +7613,7 @@ define(function (require, exports, module) { }); -},{"./base64":11,"amdefine":17}],11:[function(require,module,exports){ +},{"./base64":10,"amdefine":16}],10:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -10109,7 +7657,7 @@ define(function (require, exports, module) { }); -},{"amdefine":17}],12:[function(require,module,exports){ +},{"amdefine":16}],11:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -10192,7 +7740,7 @@ define(function (require, exports, module) { }); -},{"amdefine":17}],13:[function(require,module,exports){ +},{"amdefine":16}],12:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -10573,7 +8121,7 @@ define(function (require, exports, module) { }); -},{"./array-set":9,"./base64-vlq":10,"./binary-search":12,"./util":16,"amdefine":17}],14:[function(require,module,exports){ +},{"./array-set":8,"./base64-vlq":9,"./binary-search":11,"./util":15,"amdefine":16}],13:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -10777,7 +8325,7 @@ define(function (require, exports, module) { }); -},{"./array-set":9,"./base64-vlq":10,"./util":16,"amdefine":17}],15:[function(require,module,exports){ +},{"./array-set":8,"./base64-vlq":9,"./util":15,"amdefine":16}],14:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -10978,7 +8526,7 @@ define(function (require, exports, module) { }); -},{"./source-map-generator":14,"amdefine":17}],16:[function(require,module,exports){ +},{"./source-map-generator":13,"amdefine":16}],15:[function(require,module,exports){ /* -*- Mode: js; js-indent-level: 2; -*- */ /* * Copyright 2011 Mozilla Foundation and contributors @@ -11020,7 +8568,7 @@ define(function (require, exports, module) { }); -},{"amdefine":17}],17:[function(require,module,exports){ +},{"amdefine":16}],16:[function(require,module,exports){ var process=require("__browserify_process"),__filename="/../node_modules/jstransform/node_modules/source-map/node_modules/amdefine/amdefine.js";/** vim: et:ts=4:sw=4:sts=4 * @license amdefine 0.1.0 Copyright (c) 2011, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. @@ -11321,7 +8869,7 @@ function amdefine(module, requireFn) { module.exports = amdefine; -},{"__browserify_process":5,"path":2}],18:[function(require,module,exports){ +},{"__browserify_process":4,"path":2}],17:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -11409,7 +8957,7 @@ exports.extract = extract; exports.parse = parse; exports.parseAsObject = parseAsObject; -},{}],19:[function(require,module,exports){ +},{}],18:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -11658,7 +9206,7 @@ function transform(visitors, source, options) { exports.transform = transform; -},{"./utils":20,"esprima-fb":6,"source-map":8}],20:[function(require,module,exports){ +},{"./utils":19,"esprima-fb":5,"source-map":7}],19:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -12139,7 +9687,7 @@ exports.updateIndent = updateIndent; exports.updateState = updateState; exports.analyzeAndTraverse = analyzeAndTraverse; -},{"./docblock":18}],21:[function(require,module,exports){ +},{"./docblock":17}],20:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -12619,7 +10167,7 @@ exports.visitorList = [ visitSuperMemberExpression ]; -},{"../src/utils":20,"base62":7,"esprima-fb":6}],22:[function(require,module,exports){ +},{"../src/utils":19,"base62":6,"esprima-fb":5}],21:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -12665,7 +10213,7 @@ var run = exports.run = function(code) { var functionBody = jsx ? transform(code).code : code; var scriptEl = document.createElement('script'); - scriptEl.innerHTML = functionBody; + scriptEl.text = functionBody; headEl.appendChild(scriptEl); }; @@ -12697,11 +10245,15 @@ var load = exports.load = function(url, callback) { runScripts = function() { var scripts = document.getElementsByTagName('script'); - scripts = Array.prototype.slice.call(scripts); - var jsxScripts = scripts.filter(function(script) { - return script.type === 'text/jsx'; - }); - + + // Array.prototype.slice cannot be used on NodeList on IE8 + var jsxScripts = []; + for (var i = 0; i < scripts.length; i++) { + if (scripts.item(i).type === 'text/jsx') { + jsxScripts.push(scripts.item(i)); + } + } + console.warn("You are using the in-browser JSX transformer. Be sure to precompile your JSX for production - http://facebook.github.io/react/docs/tooling-integration.html#jsx"); jsxScripts.forEach(function(script) { @@ -12719,7 +10271,7 @@ if (window.addEventListener) { window.attachEvent('onload', runScripts); } -},{"./fbtransform/visitors":26,"jstransform":19,"jstransform/src/docblock":18}],23:[function(require,module,exports){ +},{"./fbtransform/visitors":25,"jstransform":18,"jstransform/src/docblock":17}],22:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -12739,12 +10291,7 @@ if (window.addEventListener) { "use strict"; var Syntax = require('esprima-fb').Syntax; - -var catchup = require('jstransform/src/utils').catchup; -var catchupWhiteSpace = require('jstransform/src/utils').catchupWhiteSpace; -var append = require('jstransform/src/utils').append; -var move = require('jstransform/src/utils').move; -var getDocblock = require('jstransform/src/utils').getDocblock; +var utils = require('jstransform/src/utils'); var FALLBACK_TAGS = require('./xjs').knownTags; var renderXJSExpressionContainer = @@ -12778,9 +10325,9 @@ var JSX_ATTRIBUTE_TRANSFORMS = { }; function visitReactTag(traverse, object, path, state) { - var jsxObjIdent = getDocblock(state).jsx; + var jsxObjIdent = utils.getDocblock(state).jsx; - catchup(object.openingElement.range[0], state); + utils.catchup(object.openingElement.range[0], state); if (object.name.namespace) { throw new Error( @@ -12788,12 +10335,12 @@ function visitReactTag(traverse, object, path, state) { } var isFallbackTag = FALLBACK_TAGS[object.name.name]; - append( + utils.append( (isFallbackTag ? jsxObjIdent + '.' : '') + (object.name.name) + '(', state ); - move(object.name.range[1], state); + utils.move(object.name.range[1], state); var childrenToRender = object.children.filter(function(child) { return !(child.type === Syntax.Literal && !child.value.match(/\S/)); @@ -12801,12 +10348,12 @@ function visitReactTag(traverse, object, path, state) { // if we don't have any attributes, pass in null if (object.attributes.length === 0) { - append('null', state); + utils.append('null', state); } // write attributes object.attributes.forEach(function(attr, index) { - catchup(attr.range[0], state); + utils.catchup(attr.range[0], state); if (attr.name.namespace) { throw new Error( 'Namespace attributes are not supported. ReactJSX is not XML.'); @@ -12816,27 +10363,27 @@ function visitReactTag(traverse, object, path, state) { var isLast = index === object.attributes.length - 1; if (isFirst) { - append('{', state); + utils.append('{', state); } - append(quoteAttrName(name), state); - append(':', state); + utils.append(quoteAttrName(name), state); + utils.append(':', state); if (!attr.value) { state.g.buffer += 'true'; state.g.position = attr.name.range[1]; if (!isLast) { - append(',', state); + utils.append(',', state); } } else { - move(attr.name.range[1], state); + utils.move(attr.name.range[1], state); // Use catchupWhiteSpace to skip over the '=' in the attribute - catchupWhiteSpace(attr.value.range[0], state); + utils.catchupWhiteSpace(attr.value.range[0], state); if (JSX_ATTRIBUTE_TRANSFORMS[attr.name.name]) { - append(JSX_ATTRIBUTE_TRANSFORMS[attr.name.name](attr), state); - move(attr.value.range[1], state); + utils.append(JSX_ATTRIBUTE_TRANSFORMS[attr.name.name](attr), state); + utils.move(attr.value.range[1], state); if (!isLast) { - append(',', state); + utils.append(',', state); } } else if (attr.value.type === Syntax.Literal) { renderXJSLiteral(attr.value, isLast, state); @@ -12846,26 +10393,26 @@ function visitReactTag(traverse, object, path, state) { } if (isLast) { - append('}', state); + utils.append('}', state); } - catchup(attr.range[1], state); + utils.catchup(attr.range[1], state); }); if (!object.selfClosing) { - catchup(object.openingElement.range[1] - 1, state); - move(object.openingElement.range[1], state); + utils.catchup(object.openingElement.range[1] - 1, state); + utils.move(object.openingElement.range[1], state); } // filter out whitespace if (childrenToRender.length > 0) { - append(', ', state); + utils.append(', ', state); object.children.forEach(function(child) { if (child.type === Syntax.Literal && !child.value.match(/\S/)) { return; } - catchup(child.range[0], state); + utils.catchup(child.range[0], state); var isLast = child === childrenToRender[childrenToRender.length - 1]; @@ -12876,38 +10423,38 @@ function visitReactTag(traverse, object, path, state) { } else { traverse(child, path, state); if (!isLast) { - append(',', state); + utils.append(',', state); state.g.buffer = state.g.buffer.replace(/(\s*),$/, ',$1'); } } - catchup(child.range[1], state); + utils.catchup(child.range[1], state); }); } if (object.selfClosing) { // everything up to /> - catchup(object.openingElement.range[1] - 2, state); - move(object.openingElement.range[1], state); + utils.catchup(object.openingElement.range[1] - 2, state); + utils.move(object.openingElement.range[1], state); } else { // everything up to - catchup(object.closingElement.range[0], state); - move(object.closingElement.range[1], state); + utils.catchup(object.closingElement.range[0], state); + utils.move(object.closingElement.range[1], state); } - append(')', state); + utils.append(')', state); return false; } visitReactTag.test = function(object, path, state) { // only run react when react @jsx namespace is specified in docblock - var jsx = getDocblock(state).jsx; + var jsx = utils.getDocblock(state).jsx; return object.type === Syntax.XJSElement && jsx && jsx.length; }; exports.visitReactTag = visitReactTag; -},{"./xjs":25,"esprima-fb":6,"jstransform/src/utils":20}],24:[function(require,module,exports){ +},{"./xjs":24,"esprima-fb":5,"jstransform/src/utils":19}],23:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -12927,9 +10474,7 @@ exports.visitReactTag = visitReactTag; "use strict"; var Syntax = require('esprima-fb').Syntax; -var catchup = require('jstransform/src/utils').catchup; -var append = require('jstransform/src/utils').append; -var getDocblock = require('jstransform/src/utils').getDocblock; +var utils = require('jstransform/src/utils'); /** * Transforms the following: @@ -12958,8 +10503,8 @@ function visitReactDisplayName(traverse, object, path, state) { object.init['arguments'][0].type === Syntax.ObjectExpression) { var displayName = object.id.name; - catchup(object.init['arguments'][0].range[0] + 1, state); - append("displayName: '" + displayName + "',", state); + utils.catchup(object.init['arguments'][0].range[0] + 1, state); + utils.append("displayName: '" + displayName + "',", state); } } @@ -12967,12 +10512,12 @@ function visitReactDisplayName(traverse, object, path, state) { * Will only run on @jsx files for now. */ visitReactDisplayName.test = function(object, path, state) { - return object.type === Syntax.VariableDeclarator && !!getDocblock(state).jsx; + return object.type === Syntax.VariableDeclarator && !!utils.getDocblock(state).jsx; }; exports.visitReactDisplayName = visitReactDisplayName; -},{"esprima-fb":6,"jstransform/src/utils":20}],25:[function(require,module,exports){ +},{"esprima-fb":5,"jstransform/src/utils":19}],24:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -13266,7 +10811,7 @@ exports.renderXJSExpressionContainer = renderXJSExpressionContainer; exports.renderXJSLiteral = renderXJSLiteral; exports.quoteAttrName = quoteAttrName; -},{"esprima-fb":6,"jstransform/src/utils":20}],26:[function(require,module,exports){ +},{"esprima-fb":5,"jstransform/src/utils":19}],25:[function(require,module,exports){ /*global exports:true*/ var es6Classes = require('jstransform/visitors/es6-class-visitors').visitorList; var react = require('./transforms/react'); @@ -13311,7 +10856,7 @@ function getVisitorsList(excludes) { exports.getVisitorsList = getVisitorsList; exports.transformVisitors = transformVisitors; -},{"./transforms/react":23,"./transforms/reactDisplayName":24,"jstransform/visitors/es6-class-visitors":21}]},{},[22]) -(22) +},{"./transforms/react":22,"./transforms/reactDisplayName":23,"jstransform/visitors/es6-class-visitors":20}]},{},[21]) +(21) }); ; \ No newline at end of file diff --git a/http/fs/js/vendor/react-with-addons.js b/http/fs/js/vendor/react-with-addons.js index 03942fc..fca1fe4 100755 --- a/http/fs/js/vendor/react-with-addons.js +++ b/http/fs/js/vendor/react-with-addons.js @@ -1,8 +1,7 @@ /** - * React (with addons) v0.5.1 + * React (with addons) v0.8.0 */ -!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.React=e():"undefined"!=typeof global?global.React=e():"undefined"!=typeof self&&(self.React=e())}(function(){var define,module,exports; -return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o // since it has special semantic meaning. So we use an alternatie strategy. if (oldChild.tagName.toLowerCase() === 'html') { @@ -1763,7 +1793,7 @@ var Danger = { module.exports = Danger; -},{"./ExecutionEnvironment":21,"./createNodesFromMarkup":88,"./emptyFunction":92,"./getMarkupWrap":101,"./invariant":106,"./mutateHTMLNodeWithMarkup":119}],12:[function(require,module,exports){ +},{"./ExecutionEnvironment":21,"./createNodesFromMarkup":90,"./emptyFunction":94,"./getMarkupWrap":103,"./invariant":109,"./mutateHTMLNodeWithMarkup":122}],12:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -1792,6 +1822,8 @@ var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE; var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY; var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE; var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS; +var HAS_POSITIVE_NUMERIC_VALUE = + DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE; var DefaultDOMPropertyConfig = { isCustomAttribute: RegExp.prototype.test.bind( @@ -1807,6 +1839,7 @@ var DefaultDOMPropertyConfig = { allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, allowTransparency: MUST_USE_ATTRIBUTE, alt: null, + async: HAS_BOOLEAN_VALUE, autoComplete: null, autoFocus: HAS_BOOLEAN_VALUE, autoPlay: HAS_BOOLEAN_VALUE, @@ -1815,6 +1848,7 @@ var DefaultDOMPropertyConfig = { charSet: MUST_USE_ATTRIBUTE, checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, className: MUST_USE_PROPERTY, + cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, colSpan: null, content: null, contentEditable: null, @@ -1822,6 +1856,7 @@ var DefaultDOMPropertyConfig = { controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, data: null, // For `` acts as `src`. dateTime: MUST_USE_ATTRIBUTE, + defer: HAS_BOOLEAN_VALUE, dir: null, disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE, draggable: null, @@ -1838,6 +1873,7 @@ var DefaultDOMPropertyConfig = { label: null, lang: null, list: null, + loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, max: null, maxLength: MUST_USE_ATTRIBUTE, method: null, @@ -1853,11 +1889,12 @@ var DefaultDOMPropertyConfig = { rel: null, required: HAS_BOOLEAN_VALUE, role: MUST_USE_ATTRIBUTE, + rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, rowSpan: null, scrollLeft: MUST_USE_PROPERTY, scrollTop: MUST_USE_PROPERTY, selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, - size: null, + size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, spellCheck: null, src: null, step: null, @@ -1874,6 +1911,7 @@ var DefaultDOMPropertyConfig = { * Non-standard Properties */ autoCapitalize: null, // Supported in Mobile Safari for keyboard hints + autoCorrect: null, // Supported in Mobile Safari for keyboard hints /** * SVG Properties @@ -1922,6 +1960,7 @@ var DefaultDOMPropertyConfig = { DOMPropertyNames: { autoCapitalize: 'autocapitalize', autoComplete: 'autocomplete', + autoCorrect: 'autocorrect', autoFocus: 'autofocus', autoPlay: 'autoplay', encType: 'enctype', @@ -1989,7 +2028,7 @@ var DefaultEventPluginOrder = [ module.exports = DefaultEventPluginOrder; -},{"./keyOf":113}],14:[function(require,module,exports){ +},{"./keyOf":116}],14:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -2103,7 +2142,7 @@ var EnterLeaveEventPlugin = { module.exports = EnterLeaveEventPlugin; -},{"./EventConstants":15,"./EventPropagators":20,"./ReactMount":53,"./SyntheticMouseEvent":78,"./keyOf":113}],15:[function(require,module,exports){ +},{"./EventConstants":15,"./EventPropagators":20,"./ReactMount":54,"./SyntheticMouseEvent":79,"./keyOf":116}],15:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -2138,6 +2177,7 @@ var topLevelTypes = keyMirror({ topCompositionEnd: null, topCompositionStart: null, topCompositionUpdate: null, + topContextMenu: null, topCopy: null, topCut: null, topDoubleClick: null, @@ -2177,7 +2217,7 @@ var EventConstants = { module.exports = EventConstants; -},{"./keyMirror":112}],16:[function(require,module,exports){ +},{"./keyMirror":115}],16:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -2224,10 +2264,10 @@ var EventListener = { */ capture: function(el, handlerBaseName, cb) { if (!el.addEventListener) { - if (true) { + if ("production" !== "development") { console.error( - 'You are attempting to use addEventlistener ' + - 'in a browser that does not support it support it.' + + 'You are attempting to use addEventListener ' + + 'in a browser that does not support it.' + 'This likely means that you will not receive events that ' + 'your application relies on (such as scroll).'); } @@ -2417,11 +2457,11 @@ var EventPluginHub = { var processingEventQueue = eventQueue; eventQueue = null; forEachAccumulated(processingEventQueue, executeDispatchesAndRelease); - invariant( + ("production" !== "development" ? invariant( !eventQueue, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.' - ); + ) : invariant(!eventQueue)); } }; @@ -2432,7 +2472,7 @@ if (ExecutionEnvironment.canUseDOM) { module.exports = EventPluginHub; -},{"./CallbackRegistry":5,"./EventPluginRegistry":18,"./EventPluginUtils":19,"./EventPropagators":20,"./ExecutionEnvironment":21,"./accumulate":84,"./forEachAccumulated":97,"./invariant":106}],18:[function(require,module,exports){ +},{"./CallbackRegistry":5,"./EventPluginRegistry":18,"./EventPluginUtils":19,"./EventPropagators":20,"./ExecutionEnvironment":21,"./accumulate":85,"./forEachAccumulated":99,"./invariant":109}],18:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -2479,30 +2519,30 @@ function recomputePluginOrdering() { for (var pluginName in namesToPlugins) { var PluginModule = namesToPlugins[pluginName]; var pluginIndex = EventPluginOrder.indexOf(pluginName); - invariant( + ("production" !== "development" ? invariant( pluginIndex > -1, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName - ); + ) : invariant(pluginIndex > -1)); if (EventPluginRegistry.plugins[pluginIndex]) { continue; } - invariant( + ("production" !== "development" ? invariant( PluginModule.extractEvents, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName - ); + ) : invariant(PluginModule.extractEvents)); EventPluginRegistry.plugins[pluginIndex] = PluginModule; var publishedEvents = PluginModule.eventTypes; for (var eventName in publishedEvents) { - invariant( + ("production" !== "development" ? invariant( publishEventForPlugin(publishedEvents[eventName], PluginModule), 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName - ); + ) : invariant(publishEventForPlugin(publishedEvents[eventName], PluginModule))); } } } @@ -2541,14 +2581,13 @@ function publishEventForPlugin(dispatchConfig, PluginModule) { * @private */ function publishRegistrationName(registrationName, PluginModule) { - invariant( + ("production" !== "development" ? invariant( !EventPluginRegistry.registrationNames[registrationName], 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName - ); + ) : invariant(!EventPluginRegistry.registrationNames[registrationName])); EventPluginRegistry.registrationNames[registrationName] = PluginModule; - EventPluginRegistry.registrationNamesKeys.push(registrationName); } /** @@ -2568,11 +2607,6 @@ var EventPluginRegistry = { */ registrationNames: {}, - /** - * The keys of `registrationNames`. - */ - registrationNamesKeys: [], - /** * Injects an ordering of plugins (by plugin name). This allows the ordering * to be decoupled from injection of the actual plugins so that ordering is @@ -2583,10 +2617,10 @@ var EventPluginRegistry = { * @see {EventPluginHub.injection.injectEventPluginOrder} */ injectEventPluginOrder: function(InjectedEventPluginOrder) { - invariant( + ("production" !== "development" ? invariant( !EventPluginOrder, 'EventPluginRegistry: Cannot inject event plugin ordering more than once.' - ); + ) : invariant(!EventPluginOrder)); // Clone the ordering so it cannot be dynamically mutated. EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder); recomputePluginOrdering(); @@ -2610,12 +2644,12 @@ var EventPluginRegistry = { } var PluginModule = injectedNamesToPlugins[pluginName]; if (namesToPlugins[pluginName] !== PluginModule) { - invariant( + ("production" !== "development" ? invariant( !namesToPlugins[pluginName], 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName - ); + ) : invariant(!namesToPlugins[pluginName])); namesToPlugins[pluginName] = PluginModule; isOrderingDirty = true; } @@ -2671,14 +2705,13 @@ var EventPluginRegistry = { delete registrationNames[registrationName]; } } - EventPluginRegistry.registrationNamesKeys.length = 0; } }; module.exports = EventPluginRegistry; -},{"./invariant":106}],19:[function(require,module,exports){ +},{"./invariant":109}],19:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -2721,7 +2754,7 @@ function isStartish(topLevelType) { } var validateEventDispatches; -if (true) { +if ("production" !== "development") { validateEventDispatches = function(event) { var dispatchListeners = event._dispatchListeners; var dispatchIDs = event._dispatchIDs; @@ -2733,10 +2766,10 @@ if (true) { dispatchListeners.length : dispatchListeners ? 1 : 0; - invariant( + ("production" !== "development" ? invariant( idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.' - ); + ) : invariant(idsIsArr === listenersIsArr && IDsLen === listenersLen)); }; } @@ -2748,7 +2781,7 @@ if (true) { function forEachEventDispatch(event, cb) { var dispatchListeners = event._dispatchListeners; var dispatchIDs = event._dispatchIDs; - if (true) { + if ("production" !== "development") { validateEventDispatches(event); } if (Array.isArray(dispatchListeners)) { @@ -2793,7 +2826,7 @@ function executeDispatchesInOrder(event, executeDispatch) { function executeDispatchesInOrderStopAtTrue(event) { var dispatchListeners = event._dispatchListeners; var dispatchIDs = event._dispatchIDs; - if (true) { + if ("production" !== "development") { validateEventDispatches(event); } if (Array.isArray(dispatchListeners)) { @@ -2824,15 +2857,15 @@ function executeDispatchesInOrderStopAtTrue(event) { * @return The return value of executing the single dispatch. */ function executeDirectDispatch(event) { - if (true) { + if ("production" !== "development") { validateEventDispatches(event); } var dispatchListener = event._dispatchListeners; var dispatchID = event._dispatchIDs; - invariant( + ("production" !== "development" ? invariant( !Array.isArray(dispatchListener), 'executeDirectDispatch(...): Invalid `event`.' - ); + ) : invariant(!Array.isArray(dispatchListener))); var res = dispatchListener ? dispatchListener(event, dispatchID) : null; @@ -2865,7 +2898,7 @@ var EventPluginUtils = { module.exports = EventPluginUtils; -},{"./EventConstants":15,"./invariant":106}],20:[function(require,module,exports){ +},{"./EventConstants":15,"./invariant":109}],20:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -2906,7 +2939,7 @@ var injection = { InstanceHandle: null, injectInstanceHandle: function(InjectedInstanceHandle) { injection.InstanceHandle = InjectedInstanceHandle; - if (true) { + if ("production" !== "development") { injection.validate(); } }, @@ -2937,7 +2970,7 @@ function listenerAtPhase(id, event, propagationPhase) { * "dispatch" object that pairs the event with the listener. */ function accumulateDirectionalDispatches(domID, upwards, event) { - if (true) { + if ("production" !== "development") { if (!domID) { throw new Error('Dispatching id must not be null'); } @@ -2997,14 +3030,14 @@ function accumulateDirectDispatchesSingle(event) { } function accumulateTwoPhaseDispatches(events) { - if (true) { + if ("production" !== "development") { injection.validate(); } forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); } function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) { - if (true) { + if ("production" !== "development") { injection.validate(); } injection.InstanceHandle.traverseEnterLeave( @@ -3018,7 +3051,7 @@ function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) { function accumulateDirectDispatches(events) { - if (true) { + if ("production" !== "development") { injection.validate(); } forEachAccumulated(events, accumulateDirectDispatchesSingle); @@ -3046,7 +3079,7 @@ var EventPropagators = { module.exports = EventPropagators; -},{"./CallbackRegistry":5,"./EventConstants":15,"./accumulate":84,"./forEachAccumulated":97}],21:[function(require,module,exports){ +},{"./CallbackRegistry":5,"./EventConstants":15,"./accumulate":85,"./forEachAccumulated":99}],21:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -3137,7 +3170,7 @@ var LinkedStateMixin = { module.exports = LinkedStateMixin; -},{"./ReactLink":51,"./ReactStateSetters":63}],23:[function(require,module,exports){ +},{"./ReactLink":52,"./ReactStateSetters":64}],23:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -3167,12 +3200,12 @@ var invariant = require("./invariant"); */ var LinkedValueMixin = { _assertLink: function() { - invariant( + ("production" !== "development" ? invariant( this.props.value == null && this.props.onChange == null, 'Cannot provide a valueLink and a value or onChange event. If you ' + 'want to use value or onChange, you probably don\'t want to use ' + 'valueLink' - ); + ) : invariant(this.props.value == null && this.props.onChange == null)); }, /** @@ -3207,7 +3240,7 @@ var LinkedValueMixin = { module.exports = LinkedValueMixin; -},{"./invariant":106}],24:[function(require,module,exports){ +},{"./invariant":109}],24:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -3272,7 +3305,7 @@ var MobileSafariClickEventPlugin = { module.exports = MobileSafariClickEventPlugin; -},{"./EventConstants":15,"./emptyFunction":92}],25:[function(require,module,exports){ +},{"./EventConstants":15,"./emptyFunction":94}],25:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -3456,11 +3489,11 @@ var React = { // Version exists only in the open-source version of React, not in Facebook's // internal version. -React.version = '0.5.1'; +React.version = '0.8.0'; module.exports = React; -},{"./ReactComponent":28,"./ReactCompositeComponent":31,"./ReactCurrentOwner":32,"./ReactDOM":33,"./ReactDOMComponent":35,"./ReactDefaultInjection":44,"./ReactInstanceHandles":50,"./ReactMount":53,"./ReactMultiChild":55,"./ReactPerf":58,"./ReactPropTypes":60,"./ReactServerRendering":62,"./ReactTextComponent":64}],27:[function(require,module,exports){ +},{"./ReactComponent":28,"./ReactCompositeComponent":31,"./ReactCurrentOwner":32,"./ReactDOM":33,"./ReactDOMComponent":35,"./ReactDefaultInjection":44,"./ReactInstanceHandles":51,"./ReactMount":54,"./ReactMultiChild":56,"./ReactPerf":59,"./ReactPropTypes":61,"./ReactServerRendering":63,"./ReactTextComponent":65}],27:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -3552,12 +3585,12 @@ function mapSingleChildIntoContext(traverseContext, child, name, i) { var mappedChild = mapBookKeeping.mapFunction.call(mapBookKeeping.mapContext, child, i); // We found a component instance - invariant( + ("production" !== "development" ? invariant( !mapResult.hasOwnProperty(name), 'ReactChildren.map(...): Encountered two children with the same key, ' + '`%s`. Children keys must be unique.', name - ); + ) : invariant(!mapResult.hasOwnProperty(name))); mapResult[name] = mappedChild; } @@ -3594,7 +3627,7 @@ var ReactChildren = { module.exports = ReactChildren; -},{"./PooledClass":25,"./invariant":106,"./traverseAllChildren":125}],28:[function(require,module,exports){ +},{"./PooledClass":25,"./invariant":109,"./traverseAllChildren":127}],28:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -3724,8 +3757,8 @@ function validateChildKeys(component) { * `mountComponent` * Initializes the component, renders markup, and registers event listeners. * - * `receiveProps` - * Updates the rendered DOM nodes given a new set of props. + * `receiveComponent` + * Updates the rendered DOM nodes to match the given component. * * `unmountComponent` * Releases any resources allocated by this component. @@ -3748,7 +3781,7 @@ var ReactComponent = { return !!( object && typeof object.mountComponentIntoNode === 'function' && - typeof object.receiveProps === 'function' + typeof object.receiveComponent === 'function' ); }, @@ -3856,18 +3889,18 @@ var ReactComponent = { * @public */ replaceProps: function(props, callback) { - invariant( + ("production" !== "development" ? invariant( !this.props.__owner__, 'replaceProps(...): You called `setProps` or `replaceProps` on a ' + 'component with an owner. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.' - ); - invariant( + ) : invariant(!this.props.__owner__)); + ("production" !== "development" ? invariant( this.isMounted(), 'replaceProps(...): Can only update a mounted component.' - ); + ) : invariant(this.isMounted())); this._pendingProps = props; ReactUpdates.enqueueUpdate(this, callback); }, @@ -3895,14 +3928,14 @@ var ReactComponent = { // Children can be more than one argument var childrenLength = arguments.length - 1; if (childrenLength === 1) { - if (true) { + if ("production" !== "development") { validateChildKeys(children); } this.props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { - if (true) { + if ("production" !== "development") { validateChildKeys(arguments[i + 1]); } childArray[i] = arguments[i + 1]; @@ -3926,11 +3959,11 @@ var ReactComponent = { * @internal */ mountComponent: function(rootID, transaction, mountDepth) { - invariant( + ("production" !== "development" ? invariant( !this.isMounted(), 'mountComponent(%s, ...): Can only mount an unmounted component.', rootID - ); + ) : invariant(!this.isMounted())); var props = this.props; if (props.ref != null) { ReactOwner.addComponentAsRefTo(this, props.ref, props.__owner__); @@ -3952,10 +3985,10 @@ var ReactComponent = { * @internal */ unmountComponent: function() { - invariant( + ("production" !== "development" ? invariant( this.isMounted(), 'unmountComponent(): Can only unmount a mounted component.' - ); + ) : invariant(this.isMounted())); var props = this.props; if (props.ref != null) { ReactOwner.removeComponentAsRefFrom(this, props.ref, props.__owner__); @@ -3966,21 +3999,22 @@ var ReactComponent = { }, /** - * Updates the rendered DOM nodes given a new set of props. + * Given a new instance of this component, updates the rendered DOM nodes + * as if that instance was rendered instead. * * Subclasses that override this method should make sure to invoke - * `ReactComponent.Mixin.receiveProps.call(this, ...)`. + * `ReactComponent.Mixin.receiveComponent.call(this, ...)`. * - * @param {object} nextProps Next set of properties. + * @param {object} nextComponent Next set of properties. * @param {ReactReconcileTransaction} transaction * @internal */ - receiveProps: function(nextProps, transaction) { - invariant( + receiveComponent: function(nextComponent, transaction) { + ("production" !== "development" ? invariant( this.isMounted(), - 'receiveProps(...): Can only update a mounted component.' - ); - this._pendingProps = nextProps; + 'receiveComponent(...): Can only update a mounted component.' + ) : invariant(this.isMounted())); + this._pendingProps = nextComponent.props; this._performUpdateIfNecessary(transaction); }, @@ -4110,7 +4144,7 @@ var ReactComponent = { module.exports = ReactComponent; -},{"./ReactComponentEnvironment":30,"./ReactCurrentOwner":32,"./ReactOwner":57,"./ReactUpdates":69,"./invariant":106,"./keyMirror":112,"./merge":115}],29:[function(require,module,exports){ +},{"./ReactComponentEnvironment":30,"./ReactCurrentOwner":32,"./ReactOwner":58,"./ReactUpdates":70,"./invariant":109,"./keyMirror":115,"./merge":118}],29:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -4164,10 +4198,10 @@ var ReactComponentBrowserEnvironment = { * @protected */ getDOMNode: function() { - invariant( + ("production" !== "development" ? invariant( this.isMounted(), 'getDOMNode(): A component must be mounted to have a DOM node.' - ); + ) : invariant(this.isMounted())); return ReactMount.getNode(this._rootNodeID); } }, @@ -4194,20 +4228,23 @@ var ReactComponentBrowserEnvironment = { * container if possible. */ mountImageIntoNode: function(markup, container, shouldReuseMarkup) { - invariant( + ("production" !== "development" ? invariant( container && ( container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE && ReactMount.allowFullPageRender ), 'mountComponentIntoNode(...): Target container is not valid.' - ); + ) : invariant(container && ( + container.nodeType === ELEMENT_NODE_TYPE || + container.nodeType === DOC_NODE_TYPE && ReactMount.allowFullPageRender + ))); if (shouldReuseMarkup) { if (ReactMarkupChecksum.canReuseMarkup( markup, getReactRootElementInContainer(container))) { return; } else { - if (true) { + if ("production" !== "development") { console.warn( 'React attempted to use reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are using ' + @@ -4249,7 +4286,7 @@ var ReactComponentBrowserEnvironment = { module.exports = ReactComponentBrowserEnvironment; -},{"./ReactDOMIDOperations":37,"./ReactMarkupChecksum":52,"./ReactMount":53,"./ReactReconcileTransaction":61,"./getReactRootElementInContainer":103,"./invariant":106,"./mutateHTMLNodeWithMarkup":119}],30:[function(require,module,exports){ +},{"./ReactDOMIDOperations":37,"./ReactMarkupChecksum":53,"./ReactMount":54,"./ReactReconcileTransaction":62,"./getReactRootElementInContainer":105,"./invariant":109,"./mutateHTMLNodeWithMarkup":122}],30:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -4298,6 +4335,7 @@ module.exports = ReactComponentEnvironment; var ReactComponent = require("./ReactComponent"); var ReactCurrentOwner = require("./ReactCurrentOwner"); +var ReactErrorUtils = require("./ReactErrorUtils"); var ReactOwner = require("./ReactOwner"); var ReactPerf = require("./ReactPerf"); var ReactPropTransferer = require("./ReactPropTransferer"); @@ -4574,42 +4612,47 @@ function validateMethodOverride(proto, name) { // Disallow overriding of base class methods unless explicitly allowed. if (ReactCompositeComponentMixin.hasOwnProperty(name)) { - invariant( + ("production" !== "development" ? invariant( specPolicy === SpecPolicy.OVERRIDE_BASE, 'ReactCompositeComponentInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name - ); + ) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE)); } // Disallow defining methods more than once unless explicitly allowed. if (proto.hasOwnProperty(name)) { - invariant( + ("production" !== "development" ? invariant( specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED, 'ReactCompositeComponentInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name - ); + ) : invariant(specPolicy === SpecPolicy.DEFINE_MANY || + specPolicy === SpecPolicy.DEFINE_MANY_MERGED)); } } function validateLifeCycleOnReplaceState(instance) { var compositeLifeCycleState = instance._compositeLifeCycleState; - invariant( + ("production" !== "development" ? invariant( instance.isMounted() || compositeLifeCycleState === CompositeLifeCycle.MOUNTING, 'replaceState(...): Can only update a mounted or mounting component.' - ); - invariant( - compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE && - compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING, - 'replaceState(...): Cannot update while unmounting component or during ' + - 'an existing state transition (such as within `render`).' - ); + ) : invariant(instance.isMounted() || + compositeLifeCycleState === CompositeLifeCycle.MOUNTING)); + ("production" !== "development" ? invariant(compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE, + 'replaceState(...): Cannot update during an existing state transition ' + + '(such as within `render`). This could potentially cause an infinite ' + + 'loop so it is forbidden.' + ) : invariant(compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE)); + ("production" !== "development" ? invariant(compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING, + 'replaceState(...): Cannot update while unmounting component. This ' + + 'usually means you called setState() on an unmounted component.' + ) : invariant(compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING)); } /** @@ -4674,18 +4717,18 @@ function mixSpecIntoComponent(Constructor, spec) { * @return {object} one after it has been mutated to contain everything in two. */ function mergeObjectsWithNoDuplicateKeys(one, two) { - invariant( + ("production" !== "development" ? invariant( one && two && typeof one === 'object' && typeof two === 'object', 'mergeObjectsWithNoDuplicateKeys(): Cannot merge non-objects' - ); + ) : invariant(one && two && typeof one === 'object' && typeof two === 'object')); objMap(two, function(value, key) { - invariant( + ("production" !== "development" ? invariant( one[key] === undefined, 'mergeObjectsWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: %s', key - ); + ) : invariant(one[key] === undefined)); one[key] = value; }); return one; @@ -5070,7 +5113,7 @@ var ReactCompositeComponentMixin = { var currentComponent = this._renderedComponent; var nextComponent = this._renderValidatedComponent(); if (currentComponent.constructor === nextComponent.constructor) { - currentComponent.receiveProps(nextComponent.props, transaction); + currentComponent.receiveComponent(nextComponent, transaction); } else { // These two IDs are actually the same! But nothing should rely on that. var thisID = this._rootNodeID; @@ -5106,18 +5149,20 @@ var ReactCompositeComponentMixin = { */ forceUpdate: function(callback) { var compositeLifeCycleState = this._compositeLifeCycleState; - invariant( + ("production" !== "development" ? invariant( this.isMounted() || compositeLifeCycleState === CompositeLifeCycle.MOUNTING, 'forceUpdate(...): Can only force an update on mounted or mounting ' + 'components.' - ); - invariant( + ) : invariant(this.isMounted() || + compositeLifeCycleState === CompositeLifeCycle.MOUNTING)); + ("production" !== "development" ? invariant( compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE && compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING, 'forceUpdate(...): Cannot force an update while unmounting component ' + 'or during an existing state transition (such as within `render`).' - ); + ) : invariant(compositeLifeCycleState !== CompositeLifeCycle.RECEIVING_STATE && + compositeLifeCycleState !== CompositeLifeCycle.UNMOUNTING)); this._pendingForceUpdate = true; ReactUpdates.enqueueUpdate(this, callback); }, @@ -5136,11 +5181,12 @@ var ReactCompositeComponentMixin = { } finally { ReactCurrentOwner.current = null; } - invariant( + ("production" !== "development" ? invariant( ReactComponent.isValidComponent(renderedComponent), - '%s.render(): A valid ReactComponent must be returned.', + '%s.render(): A valid ReactComponent must be returned. You may have ' + + 'returned null, undefined, an array, or some other invalid object.', this.constructor.displayName || 'ReactCompositeComponent' - ); + ) : invariant(ReactComponent.isValidComponent(renderedComponent))); return renderedComponent; }, @@ -5153,7 +5199,10 @@ var ReactCompositeComponentMixin = { continue; } var method = this.__reactAutoBindMap[autoBindKey]; - this[autoBindKey] = this._bindAutoBindMethod(method); + this[autoBindKey] = this._bindAutoBindMethod(ReactErrorUtils.guard( + method, + this.constructor.displayName + '.' + autoBindKey + )); } }, @@ -5168,7 +5217,7 @@ var ReactCompositeComponentMixin = { var boundMethod = function() { return method.apply(component, arguments); }; - if (true) { + if ("production" !== "development") { boundMethod.__reactBoundContext = component; boundMethod.__reactBoundMethod = method; boundMethod.__reactBoundArguments = null; @@ -5236,12 +5285,12 @@ var ReactCompositeComponent = { Constructor.prototype.constructor = Constructor; mixSpecIntoComponent(Constructor, spec); - invariant( + ("production" !== "development" ? invariant( Constructor.prototype.render, 'createClass(...): Class specification must implement a `render` method.' - ); + ) : invariant(Constructor.prototype.render)); - if (true) { + if ("production" !== "development") { if (Constructor.prototype.componentShouldUpdate) { console.warn( (spec.displayName || 'A component') + ' has a method called ' + @@ -5285,7 +5334,7 @@ var ReactCompositeComponent = { module.exports = ReactCompositeComponent; -},{"./ReactComponent":28,"./ReactCurrentOwner":32,"./ReactOwner":57,"./ReactPerf":58,"./ReactPropTransferer":59,"./ReactUpdates":69,"./invariant":106,"./keyMirror":112,"./merge":115,"./mixInto":118,"./objMap":121}],32:[function(require,module,exports){ +},{"./ReactComponent":28,"./ReactCurrentOwner":32,"./ReactErrorUtils":46,"./ReactOwner":58,"./ReactPerf":59,"./ReactPropTransferer":60,"./ReactUpdates":70,"./invariant":109,"./keyMirror":115,"./merge":118,"./mixInto":121,"./objMap":123}],32:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -5522,7 +5571,7 @@ ReactDOM.injection = injection; module.exports = ReactDOM; -},{"./ReactDOMComponent":35,"./mergeInto":117,"./objMapKeyVal":122}],34:[function(require,module,exports){ +},{"./ReactDOMComponent":35,"./mergeInto":120,"./objMapKeyVal":124}],34:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -5588,7 +5637,7 @@ var ReactDOMButton = ReactCompositeComponent.createClass({ module.exports = ReactDOMButton; -},{"./ReactCompositeComponent":31,"./ReactDOM":33,"./keyMirror":112}],35:[function(require,module,exports){ +},{"./ReactCompositeComponent":31,"./ReactDOM":33,"./keyMirror":115}],35:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -5642,15 +5691,15 @@ function assertValidProps(props) { return; } // Note the use of `==` which checks for null or undefined. - invariant( + ("production" !== "development" ? invariant( props.children == null || props.dangerouslySetInnerHTML == null, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.' - ); - invariant( + ) : invariant(props.children == null || props.dangerouslySetInnerHTML == null)); + ("production" !== "development" ? invariant( props.style == null || typeof props.style === 'object', 'The `style` prop expects a mapping from style properties to values, ' + 'not a string.' - ); + ) : invariant(props.style == null || typeof props.style === 'object')); } /** @@ -5770,9 +5819,13 @@ ReactDOMComponent.Mixin = { return ''; }, - receiveProps: function(nextProps, transaction) { - assertValidProps(nextProps); - ReactComponent.Mixin.receiveProps.call(this, nextProps, transaction); + receiveComponent: function(nextComponent, transaction) { + assertValidProps(nextComponent.props); + ReactComponent.Mixin.receiveComponent.call( + this, + nextComponent, + transaction + ); }, /** @@ -5960,7 +6013,7 @@ mixInto(ReactDOMComponent, ReactMultiChild.Mixin); module.exports = ReactDOMComponent; -},{"./CSSPropertyOperations":4,"./DOMProperty":9,"./DOMPropertyOperations":10,"./ReactComponent":28,"./ReactEventEmitter":46,"./ReactMount":53,"./ReactMultiChild":55,"./ReactPerf":58,"./escapeTextForBrowser":93,"./invariant":106,"./keyOf":113,"./merge":115,"./mixInto":118}],36:[function(require,module,exports){ +},{"./CSSPropertyOperations":4,"./DOMProperty":9,"./DOMPropertyOperations":10,"./ReactComponent":28,"./ReactEventEmitter":47,"./ReactMount":54,"./ReactMultiChild":56,"./ReactPerf":59,"./escapeTextForBrowser":95,"./invariant":109,"./keyOf":116,"./merge":118,"./mixInto":121}],36:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -6014,7 +6067,7 @@ var ReactDOMForm = ReactCompositeComponent.createClass({ module.exports = ReactDOMForm; -},{"./EventConstants":15,"./ReactCompositeComponent":31,"./ReactDOM":33,"./ReactEventEmitter":46}],37:[function(require,module,exports){ +},{"./EventConstants":15,"./ReactCompositeComponent":31,"./ReactDOM":33,"./ReactEventEmitter":47}],37:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -6085,11 +6138,11 @@ var ReactDOMIDOperations = { */ updatePropertyByID: function(id, name, value) { var node = ReactMount.getNode(id); - invariant( + ("production" !== "development" ? invariant( !INVALID_PROPERTY_ERRORS.hasOwnProperty(name), 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name] - ); + ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name))); // If we're updating to null or undefined, we should remove the property // from the DOM node instead of inadvertantly setting to a string. This @@ -6111,33 +6164,14 @@ var ReactDOMIDOperations = { */ deletePropertyByID: function(id, name, value) { var node = ReactMount.getNode(id); - invariant( + ("production" !== "development" ? invariant( !INVALID_PROPERTY_ERRORS.hasOwnProperty(name), 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name] - ); + ) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name))); DOMPropertyOperations.deleteValueForProperty(node, name, value); }, - /** - * This should almost never be used instead of `updatePropertyByID()` due to - * the extra object allocation required by the API. That said, this is useful - * for batching up several operations across worker thread boundaries. - * - * @param {string} id ID of the node to update. - * @param {object} properties A mapping of valid property names. - * @internal - * @see {ReactDOMIDOperations.updatePropertyByID} - */ - updatePropertiesByID: function(id, properties) { - for (var name in properties) { - if (!properties.hasOwnProperty(name)) { - continue; - } - ReactDOMIDOperations.updatePropertiesByID(id, name, properties[name]); - } - }, - /** * Updates a DOM node with new style values. If a value is specified as '', * the corresponding style property will be unset. @@ -6208,7 +6242,7 @@ var ReactDOMIDOperations = { module.exports = ReactDOMIDOperations; -},{"./CSSPropertyOperations":4,"./DOMChildrenOperations":8,"./DOMPropertyOperations":10,"./ReactMount":53,"./getTextContentAccessor":104,"./invariant":106}],38:[function(require,module,exports){ +},{"./CSSPropertyOperations":4,"./DOMChildrenOperations":8,"./DOMPropertyOperations":10,"./ReactMount":54,"./getTextContentAccessor":106,"./invariant":109}],38:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -6266,7 +6300,7 @@ var ReactDOMInput = ReactCompositeComponent.createClass({ var defaultValue = this.props.defaultValue; return { checked: this.props.defaultChecked || false, - value: defaultValue != null ? defaultValue : '' + value: defaultValue != null ? defaultValue : null }; }, @@ -6351,17 +6385,17 @@ var ReactDOMInput = ReactCompositeComponent.createClass({ continue; } var otherID = ReactMount.getID(otherNode); - invariant( + ("production" !== "development" ? invariant( otherID, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.' - ); + ) : invariant(otherID)); var otherInstance = instancesByReactID[otherID]; - invariant( + ("production" !== "development" ? invariant( otherInstance, 'ReactDOMInput: Unknown radio button ID %s.', otherID - ); + ) : invariant(otherInstance)); // In some cases, this will actually change the `checked` state value. // In other cases, there's no change but this forces a reconcile upon // which componentDidUpdate will reset the DOM property to whatever it @@ -6379,7 +6413,7 @@ var ReactDOMInput = ReactCompositeComponent.createClass({ module.exports = ReactDOMInput; -},{"./DOMPropertyOperations":10,"./LinkedValueMixin":23,"./ReactCompositeComponent":31,"./ReactDOM":33,"./ReactMount":53,"./invariant":106,"./merge":115}],39:[function(require,module,exports){ +},{"./DOMPropertyOperations":10,"./LinkedValueMixin":23,"./ReactCompositeComponent":31,"./ReactDOM":33,"./ReactMount":54,"./invariant":109,"./merge":118}],39:[function(require,module,exports){ /** * Copyright 2013 Facebook, Inc. * @@ -6414,7 +6448,7 @@ var ReactDOMOption = ReactCompositeComponent.createClass({ componentWillMount: function() { // TODO (yungsters): Remove support for `selected` in