diff --git a/local-cli/server/middleware/heapCapture/bundle.js b/local-cli/server/middleware/heapCapture/bundle.js new file mode 100644 index 000000000..632a51b6d --- /dev/null +++ b/local-cli/server/middleware/heapCapture/bundle.js @@ -0,0 +1,22673 @@ + +// @generated + +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; +/******/ +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Copyright (c) 2016-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + 'use strict'; + /*eslint no-console-disallow: "off"*/ + /*global preLoadedCapture:true*/ + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + + var _reactDom = __webpack_require__(1); + + var _reactDom2 = _interopRequireDefault(_reactDom); + + var _react = __webpack_require__(147); + + var _react2 = _interopRequireDefault(_react); + + var _index = __webpack_require__(159); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function RefVisitor(refs, id) { + this.refs = refs; + this.id = id; + } + + RefVisitor.prototype = { + moveToEdge: function moveToEdge(name) { + var ref = this.refs[this.id]; + if (ref && ref.edges) { + var edges = ref.edges; + for (var edgeId in edges) { + if (edges[edgeId] === name) { + this.id = edgeId; + return this; + } + } + } + this.id = undefined; + return this; + }, + moveToFirst: function moveToFirst(callback) { + var ref = this.refs[this.id]; + if (ref && ref.edges) { + var edges = ref.edges; + for (var edgeId in edges) { + this.id = edgeId; + if (callback(edges[edgeId], this)) { + return this; + } + } + } + this.id = undefined; + return this; + }, + forEachEdge: function forEachEdge(callback) { + var ref = this.refs[this.id]; + if (ref && ref.edges) { + var edges = ref.edges; + var visitor = new RefVisitor(this.refs, undefined); + for (var edgeId in edges) { + visitor.id = edgeId; + callback(edges[edgeId], visitor); + } + } + }, + getType: function getType() { + var ref = this.refs[this.id]; + if (ref) { + return ref.type; + } + return undefined; + }, + getRef: function getRef() { + return this.refs[this.id]; + }, + clone: function clone() { + return new RefVisitor(this.refs, this.id); + }, + isDefined: function isDefined() { + return !!this.id; + }, + getValue: function getValue() { + var _this = this; + + var ref = this.refs[this.id]; + if (ref) { + if (ref.type === 'string') { + if (ref.value) { + return ref.value; + } else { + var _ret = function () { + var rope = []; + _this.forEachEdge(function (name, visitor) { + if (name && name.startsWith('[') && name.endsWith(']')) { + var index = parseInt(name.substring(1, name.length - 1), 10); + rope[index] = visitor.getValue(); + } + }); + return { + v: rope.join('') + }; + }(); + + if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; + } + } else if (ref.type === 'ScriptExecutable' || ref.type === 'EvalExecutable' || ref.type === 'ProgramExecutable') { + return ref.value.url + ':' + ref.value.line + ':' + ref.value.col; + } else if (ref.type === 'FunctionExecutable') { + return ref.value.name + '@' + ref.value.url + ':' + ref.value.line + ':' + ref.value.col; + } else if (ref.type === 'NativeExecutable') { + return ref.value.function + ' ' + ref.value.constructor + ' ' + ref.value.name; + } else if (ref.type === 'Function') { + var executable = this.clone().moveToEdge('@Executable'); + if (executable.id) { + return executable.getRef().type + ' ' + executable.getValue(); + } + } + } + return '#none'; + } + }; + + function forEachRef(refs, callback) { + var visitor = new RefVisitor(refs, undefined); + for (var id in refs) { + visitor.id = id; + callback(visitor); + } + } + + function firstRef(refs, callback) { + for (var id in refs) { + var ref = refs[id]; + if (callback(id, ref)) { + return new RefVisitor(refs, id); + } + } + return new RefVisitor(refs, undefined); + } + + function getInternalInstanceName(visitor) { + var type = visitor.clone().moveToEdge('_currentElement').moveToEdge('type'); + if (type.getType() === 'string') { + // element.type is string + return type.getValue(); + } else if (type.getType() === 'Function') { + // element.type is function + var displayName = type.clone().moveToEdge('displayName'); + if (displayName.isDefined()) { + return displayName.getValue(); // element.type.displayName + } + var name = type.clone().moveToEdge('name'); + if (name.isDefined()) { + return name.getValue(); // element.type.name + } + type.moveToEdge('@Executable'); + if (type.getType() === 'FunctionExecutable') { + return type.getRef().value.name; // element.type symbolicated name + } + } + return '#unknown'; + } + + function buildReactComponentTree(visitor, registry, strings) { + var ref = visitor.getRef(); + if (ref.reactTree || ref.reactParent === undefined) { + return; // has one or doesn't need one + } + var parentVisitor = ref.reactParent; + if (parentVisitor === null) { + ref.reactTree = registry.insert(registry.root, strings.intern(getInternalInstanceName(visitor))); + } else if (parentVisitor) { + var parentRef = parentVisitor.getRef(); + buildReactComponentTree(parentVisitor, registry, strings); + var relativeName = getInternalInstanceName(visitor); + if (ref.reactKey) { + relativeName = ref.reactKey + ': ' + relativeName; + } + ref.reactTree = registry.insert(parentRef.reactTree, strings.intern(relativeName)); + } else { + throw 'non react instance parent of react instance'; + } + } + + function markReactComponentTree(refs, registry, strings) { + // annotate all refs that are react internal instances with their parent and name + // ref.reactParent = visitor that points to parent instance, + // null if we know it's an instance, but don't have a parent yet + // ref.reactKey = if a key is used to distinguish siblings + forEachRef(refs, function (visitor) { + var visitorClone = visitor.clone(); // visitor will get stomped on next iteration + var ref = visitor.getRef(); + visitor.forEachEdge(function (edgeName, edgeVisitor) { + var edgeRef = edgeVisitor.getRef(); + if (edgeRef) { + if (edgeName === '_renderedChildren') { + if (ref.reactParent === undefined) { + // ref is react component, even if we don't have a parent yet + ref.reactParent = null; + } + edgeVisitor.forEachEdge(function (childName, childVisitor) { + var childRef = childVisitor.getRef(); + if (childRef && childName.startsWith('.')) { + childRef.reactParent = visitorClone; + childRef.reactKey = childName; + } + }); + } else if (edgeName === '_renderedComponent') { + if (ref.reactParent === undefined) { + ref.reactParent = null; + } + edgeRef.reactParent = visitorClone; + } + } + }); + }); + // build tree of react internal instances (since that's what has the structure) + // fill in ref.reactTree = path registry node + forEachRef(refs, function (visitor) { + buildReactComponentTree(visitor, registry, strings); + }); + // hook in components by looking at their _reactInternalInstance fields + forEachRef(refs, function (visitor) { + var ref = visitor.getRef(); + var instanceRef = visitor.moveToEdge('_reactInternalInstance').getRef(); + if (instanceRef) { + ref.reactTree = instanceRef.reactTree; + } + }); + } + + function functionUrlFileName(visitor) { + var executable = visitor.clone().moveToEdge('@Executable'); + var ref = executable.getRef(); + if (ref && ref.value && ref.value.url) { + var url = ref.value.url; + var file = url.substring(url.lastIndexOf('/') + 1); + if (file.endsWith('.js')) { + file = file.substring(0, file.length - 3); + } + return file; + } + return undefined; + } + + function markModules(refs) { + var modules = firstRef(refs, function (id, ref) { + return ref.type === 'CallbackGlobalObject'; + }); + modules.moveToEdge('require'); + modules.moveToFirst(function (name, visitor) { + return visitor.getType() === 'JSActivation'; + }); + modules.moveToEdge('modules'); + modules.forEachEdge(function (name, visitor) { + var ref = visitor.getRef(); + visitor.moveToEdge('exports'); + if (visitor.getType() === 'Object') { + visitor.moveToFirst(function (memberName, member) { + return member.getType() === 'Function'; + }); + if (visitor.isDefined()) { + ref.module = functionUrlFileName(visitor); + } + } else if (visitor.getType() === 'Function') { + var displayName = visitor.clone().moveToEdge('displayName'); + if (displayName.isDefined()) { + ref.module = displayName.getValue(); + } + ref.module = functionUrlFileName(visitor); + } + if (ref && !ref.module) { + ref.module = '#unknown ' + name; + } + }); + } + + function registerPathToRoot(refs, registry, strings) { + markReactComponentTree(refs, registry, strings); + markModules(refs); + var breadth = []; + forEachRef(refs, function (visitor) { + var ref = visitor.getRef(); + if (ref.type === 'CallbackGlobalObject') { + ref.rootPath = registry.insert(registry.root, strings.intern(ref.type)); + breadth.push(visitor.clone()); + } + }); + + var _loop = function _loop() { + var nextBreadth = []; + + var _loop2 = function _loop2(i) { + var visitor = breadth[i]; + var ref = visitor.getRef(); + visitor.forEachEdge(function (edgeName, edgeVisitor) { + var edgeRef = edgeVisitor.getRef(); + if (edgeRef && edgeRef.rootPath === undefined) { + var pathName = edgeRef.type; + if (edgeName) { + pathName = edgeName + ': ' + pathName; + } + edgeRef.rootPath = registry.insert(ref.rootPath, strings.intern(pathName)); + nextBreadth.push(edgeVisitor.clone()); + // copy module and react tree forward + if (edgeRef.module === undefined) { + edgeRef.module = ref.module; + } + if (edgeRef.reactTree === undefined) { + edgeRef.reactTree = ref.reactTree; + } + } + }); + }; + + for (var i = 0; i < breadth.length; i++) { + _loop2(i); + } + breadth = nextBreadth; + }; + + while (breadth.length > 0) { + _loop(); + } + } + + function registerCapture(data, captureId, capture, stacks, strings) { + // NB: capture.refs is potentially VERY large, so we try to avoid making + // copies, even if iteration is a bit more annoying. + var rowCount = 0; + for (var id in capture.refs) { + // eslint-disable-line no-unused-vars + rowCount++; + } + for (var _id in capture.markedBlocks) { + // eslint-disable-line no-unused-vars + rowCount++; + } + var inserter = data.rowInserter(rowCount); + registerPathToRoot(capture.refs, stacks, strings); + var noneString = strings.intern('#none'); + var noneStack = stacks.insert(stacks.root, noneString); + forEachRef(capture.refs, function (visitor) { + // want to data.append(value, value, value), not IDs + var ref = visitor.getRef(); + var id = visitor.id; + inserter.insertRow(parseInt(id, 16), ref.type, ref.size, captureId, ref.rootPath === undefined ? noneStack : ref.rootPath, ref.reactTree === undefined ? noneStack : ref.reactTree, visitor.getValue(), ref.module === undefined ? '#none' : ref.module); + }); + for (var _id2 in capture.markedBlocks) { + var block = capture.markedBlocks[_id2]; + inserter.insertRow(parseInt(_id2, 16), 'Marked Block Overhead', block.capacity - block.size, captureId, noneStack, noneStack, 'capacity: ' + block.capacity + ', size: ' + block.size + ', granularity: ' + block.cellSize, '#none'); + } + inserter.done(); + } + + if (preLoadedCapture) { + (function () { + var strings = new _index.StringInterner(); + var stacks = new _index.StackRegistry(); + var columns = [{ name: 'id', type: 'int' }, { name: 'type', type: 'string', strings: strings }, { name: 'size', type: 'int' }, { name: 'trace', type: 'string', strings: strings }, { name: 'path', type: 'stack', stacks: stacks, getter: function getter(x) { + return strings.get(x); + }, formatter: function formatter(x) { + return x; + } }, { name: 'react', type: 'stack', stacks: stacks, getter: function getter(x) { + return strings.get(x); + }, formatter: function formatter(x) { + return x; + } }, { name: 'value', type: 'string', strings: strings }, { name: 'module', type: 'string', strings: strings }]; + var data = new _index.AggrowData(columns); + registerCapture(data, 'trace', preLoadedCapture, stacks, strings); + preLoadedCapture = undefined; // let GG clean up the capture + var aggrow = new _index.Aggrow(data); + aggrow.addPointerExpander('Id', 'id'); + var typeExpander = aggrow.addStringExpander('Type', 'type'); + aggrow.addNumberExpander('Size', 'size'); + aggrow.addStringExpander('Trace', 'trace'); + var pathExpander = aggrow.addStackExpander('Path', 'path'); + var reactExpander = aggrow.addStackExpander('React Tree', 'react'); + var valueExpander = aggrow.addStringExpander('Value', 'value'); + var moduleExpander = aggrow.addStringExpander('Module', 'module'); + aggrow.expander.setActiveExpanders([pathExpander, reactExpander, moduleExpander, typeExpander, valueExpander]); + var sizeAggregator = aggrow.addSumAggregator('Size', 'size'); + var countAggregator = aggrow.addCountAggregator('Count'); + aggrow.expander.setActiveAggregators([sizeAggregator, countAggregator]); + _reactDom2.default.render(_react2.default.createElement(_index.AggrowTable, { aggrow: aggrow }), document.body); + })(); + } + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + module.exports = __webpack_require__(2); + + +/***/ }, +/* 2 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright 2013-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule ReactDOM + */ + + /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ + + 'use strict'; + + var ReactCurrentOwner = __webpack_require__(4); + var ReactDOMTextComponent = __webpack_require__(5); + var ReactDefaultInjection = __webpack_require__(70); + var ReactInstanceHandles = __webpack_require__(44); + var ReactMount = __webpack_require__(27); + var ReactPerf = __webpack_require__(17); + var ReactReconciler = __webpack_require__(49); + var ReactUpdates = __webpack_require__(53); + var ReactVersion = __webpack_require__(145); + + var findDOMNode = __webpack_require__(90); + var renderSubtreeIntoContainer = __webpack_require__(146); + var warning = __webpack_require__(24); + + ReactDefaultInjection.inject(); + + var render = ReactPerf.measure('React', 'render', ReactMount.render); + + var React = { + findDOMNode: findDOMNode, + render: render, + unmountComponentAtNode: ReactMount.unmountComponentAtNode, + version: ReactVersion, + + /* eslint-disable camelcase */ + unstable_batchedUpdates: ReactUpdates.batchedUpdates, + unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer + }; + + // Inject the runtime into a devtools global hook regardless of browser. + // Allows for debugging when the hook is injected on the page. + /* eslint-enable camelcase */ + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { + __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ + CurrentOwner: ReactCurrentOwner, + InstanceHandles: ReactInstanceHandles, + Mount: ReactMount, + Reconciler: ReactReconciler, + TextComponent: ReactDOMTextComponent + }); + } + + if (process.env.NODE_ENV !== 'production') { + var ExecutionEnvironment = __webpack_require__(8); + if (ExecutionEnvironment.canUseDOM && window.top === window.self) { + + // First check if devtools is not installed + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { + // If we're in Chrome or Firefox, provide a download link if not installed. + if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) { + console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools'); + } + } + + // If we're in IE8, check to see if we are in compatibility mode and provide + // information on preventing compatibility mode + var ieCompatibilityMode = document.documentMode && document.documentMode < 8; + + process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '') : undefined; + + var expectedFeatures = [ + // shims + Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim, + + // shams + Object.create, Object.freeze]; + + for (var i = 0; i < expectedFeatures.length; i++) { + if (!expectedFeatures[i]) { + console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills'); + break; + } + } + } + } + + module.exports = React; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 3 */ +/***/ function(module, exports) { + + // shim for using process in browser + var process = module.exports = {}; + + // cached from whatever global is present so that test runners that stub it + // don't break things. But we need to wrap it in a try catch in case it is + // wrapped in strict mode code which doesn't define any globals. It's inside a + // function because try/catches deoptimize in certain engines. + + var cachedSetTimeout; + var cachedClearTimeout; + + function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); + } + function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); + } + (function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } + } ()) + function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + + } + function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); + } + + process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } + }; + + // v8 likes predictible objects + function Item(fun, array) { + this.fun = fun; + this.array = array; + } + Item.prototype.run = function () { + this.fun.apply(null, this.array); + }; + process.title = 'browser'; + process.browser = true; + process.env = {}; + process.argv = []; + process.version = ''; // empty string to avoid regexp issues + process.versions = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { return '/' }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function() { return 0; }; + + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + /** + * Copyright 2013-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule ReactCurrentOwner + */ + + 'use strict'; + + /** + * Keeps track of the current owner. + * + * The current owner is the component who should own any components that are + * currently being constructed. + */ + var ReactCurrentOwner = { + + /** + * @internal + * @type {ReactComponent} + */ + current: null + + }; + + module.exports = ReactCurrentOwner; + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright 2013-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule ReactDOMTextComponent + * @typechecks static-only + */ + + 'use strict'; + + var DOMChildrenOperations = __webpack_require__(6); + var DOMPropertyOperations = __webpack_require__(21); + var ReactComponentBrowserEnvironment = __webpack_require__(25); + var ReactMount = __webpack_require__(27); + + var assign = __webpack_require__(38); + var escapeTextContentForBrowser = __webpack_require__(20); + var setTextContent = __webpack_require__(19); + var validateDOMNesting = __webpack_require__(69); + + /** + * Text nodes violate a couple assumptions that React makes about components: + * + * - When mounting text into the DOM, adjacent text nodes are merged. + * - Text nodes cannot be assigned a React root ID. + * + * This component is used to wrap strings in elements so that they can undergo + * the same reconciliation that is applied to elements. + * + * TODO: Investigate representing React components in the DOM with text nodes. + * + * @class ReactDOMTextComponent + * @extends ReactComponent + * @internal + */ + var ReactDOMTextComponent = function (props) { + // This constructor and its argument is currently used by mocks. + }; + + assign(ReactDOMTextComponent.prototype, { + + /** + * @param {ReactText} text + * @internal + */ + construct: function (text) { + // TODO: This is really a ReactText (ReactNode), not a ReactElement + this._currentElement = text; + this._stringText = '' + text; + + // Properties + this._rootNodeID = null; + this._mountIndex = 0; + }, + + /** + * Creates the markup for this text node. This node is not intended to have + * any features besides containing text content. + * + * @param {string} rootID DOM ID of the root node. + * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction + * @return {string} Markup for this text node. + * @internal + */ + mountComponent: function (rootID, transaction, context) { + if (process.env.NODE_ENV !== 'production') { + if (context[validateDOMNesting.ancestorInfoContextKey]) { + validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]); + } + } + + this._rootNodeID = rootID; + if (transaction.useCreateElement) { + var ownerDocument = context[ReactMount.ownerDocumentContextKey]; + var el = ownerDocument.createElement('span'); + DOMPropertyOperations.setAttributeForID(el, rootID); + // Populate node cache + ReactMount.getID(el); + setTextContent(el, this._stringText); + return el; + } else { + var escapedText = escapeTextContentForBrowser(this._stringText); + + if (transaction.renderToStaticMarkup) { + // Normally we'd wrap this in a `span` for the reasons stated above, but + // since this is a situation where React won't take over (static pages), + // we can simply return the text as it is. + return escapedText; + } + + return '' + escapedText + ''; + } + }, + + /** + * Updates this component by updating the text content. + * + * @param {ReactText} nextText The next text content + * @param {ReactReconcileTransaction} transaction + * @internal + */ + receiveComponent: function (nextText, transaction) { + if (nextText !== this._currentElement) { + this._currentElement = nextText; + var nextStringText = '' + nextText; + if (nextStringText !== this._stringText) { + // TODO: Save this as pending props and use performUpdateIfNecessary + // and/or updateComponent to do the actual update for consistency with + // other component types? + this._stringText = nextStringText; + var node = ReactMount.getNode(this._rootNodeID); + DOMChildrenOperations.updateTextContent(node, nextStringText); + } + } + }, + + unmountComponent: function () { + ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID); + } + + }); + + module.exports = ReactDOMTextComponent; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 6 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright 2013-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule DOMChildrenOperations + * @typechecks static-only + */ + + 'use strict'; + + var Danger = __webpack_require__(7); + var ReactMultiChildUpdateTypes = __webpack_require__(15); + var ReactPerf = __webpack_require__(17); + + var setInnerHTML = __webpack_require__(18); + var setTextContent = __webpack_require__(19); + var invariant = __webpack_require__(12); + + /** + * Inserts `childNode` as a child of `parentNode` at the `index`. + * + * @param {DOMElement} parentNode Parent node in which to insert. + * @param {DOMElement} childNode Child node to insert. + * @param {number} index Index at which to insert the child. + * @internal + */ + function insertChildAt(parentNode, childNode, index) { + // By exploiting arrays returning `undefined` for an undefined index, we can + // rely exclusively on `insertBefore(node, null)` instead of also using + // `appendChild(node)`. However, using `undefined` is not allowed by all + // browsers so we must replace it with `null`. + + // fix render order error in safari + // IE8 will throw error when index out of list size. + var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index); + + parentNode.insertBefore(childNode, beforeChild); + } + + /** + * Operations for updating with DOM children. + */ + var DOMChildrenOperations = { + + dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup, + + updateTextContent: setTextContent, + + /** + * Updates a component's children by processing a series of updates. The + * update configurations are each expected to have a `parentNode` property. + * + * @param {array} updates List of update configurations. + * @param {array} markupList List of markup strings. + * @internal + */ + processUpdates: function (updates, markupList) { + var update; + // Mapping from parent IDs to initial child orderings. + var initialChildren = null; + // List of children that will be moved or removed. + var updatedChildren = null; + + for (var i = 0; i < updates.length; i++) { + update = updates[i]; + if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) { + var updatedIndex = update.fromIndex; + var updatedChild = update.parentNode.childNodes[updatedIndex]; + var parentID = update.parentID; + + !updatedChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a when using tables, ' + 'nesting tags like , , or , or using non-SVG elements ' + 'in an parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined; + + initialChildren = initialChildren || {}; + initialChildren[parentID] = initialChildren[parentID] || []; + initialChildren[parentID][updatedIndex] = updatedChild; + + updatedChildren = updatedChildren || []; + updatedChildren.push(updatedChild); + } + } + + var renderedMarkup; + // markupList is either a list of markup or just a list of elements + if (markupList.length && typeof markupList[0] === 'string') { + renderedMarkup = Danger.dangerouslyRenderMarkup(markupList); + } else { + renderedMarkup = markupList; + } + + // Remove updated children first so that `toIndex` is consistent. + if (updatedChildren) { + for (var j = 0; j < updatedChildren.length; j++) { + updatedChildren[j].parentNode.removeChild(updatedChildren[j]); + } + } + + for (var k = 0; k < updates.length; k++) { + update = updates[k]; + switch (update.type) { + case ReactMultiChildUpdateTypes.INSERT_MARKUP: + insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex); + break; + case ReactMultiChildUpdateTypes.MOVE_EXISTING: + insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex); + break; + case ReactMultiChildUpdateTypes.SET_MARKUP: + setInnerHTML(update.parentNode, update.content); + break; + case ReactMultiChildUpdateTypes.TEXT_CONTENT: + setTextContent(update.parentNode, update.content); + break; + case ReactMultiChildUpdateTypes.REMOVE_NODE: + // Already removed by the for-loop above. + break; + } + } + } + + }; + + ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', { + updateTextContent: 'updateTextContent' + }); + + module.exports = DOMChildrenOperations; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright 2013-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule Danger + * @typechecks static-only + */ + + 'use strict'; + + var ExecutionEnvironment = __webpack_require__(8); + + var createNodesFromMarkup = __webpack_require__(9); + var emptyFunction = __webpack_require__(14); + var getMarkupWrap = __webpack_require__(13); + var invariant = __webpack_require__(12); + + var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/; + var RESULT_INDEX_ATTR = 'data-danger-index'; + + /** + * Extracts the `nodeName` from a string of markup. + * + * NOTE: Extracting the `nodeName` does not require a regular expression match + * because we make assumptions about React-generated markup (i.e. there are no + * spaces surrounding the opening tag and there is at least one attribute). + * + * @param {string} markup String of markup. + * @return {string} Node name of the supplied markup. + * @see http://jsperf.com/extract-nodename + */ + function getNodeName(markup) { + return markup.substring(1, markup.indexOf(' ')); + } + + var Danger = { + + /** + * Renders markup into an array of nodes. The markup is expected to render + * into a list of root nodes. Also, the length of `resultList` and + * `markupList` should be the same. + * + * @param {array} markupList List of markup strings to render. + * @return {array} List of rendered nodes. + * @internal + */ + dangerouslyRenderMarkup: function (markupList) { + !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined; + var nodeName; + var markupByNodeName = {}; + // Group markup by `nodeName` if a wrap is necessary, else by '*'. + for (var i = 0; i < markupList.length; i++) { + !markupList[i] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined; + nodeName = getNodeName(markupList[i]); + nodeName = getMarkupWrap(nodeName) ? nodeName : '*'; + markupByNodeName[nodeName] = markupByNodeName[nodeName] || []; + markupByNodeName[nodeName][i] = markupList[i]; + } + var resultList = []; + var resultListAssignmentCount = 0; + for (nodeName in markupByNodeName) { + if (!markupByNodeName.hasOwnProperty(nodeName)) { + continue; + } + var markupListByNodeName = markupByNodeName[nodeName]; + + // This for-in loop skips the holes of the sparse array. The order of + // iteration should follow the order of assignment, which happens to match + // numerical index order, but we don't rely on that. + var resultIndex; + for (resultIndex in markupListByNodeName) { + if (markupListByNodeName.hasOwnProperty(resultIndex)) { + var markup = markupListByNodeName[resultIndex]; + + // Push the requested markup with an additional RESULT_INDEX_ATTR + // attribute. If the markup does not start with a < character, it + // will be discarded below (with an appropriate console.error). + markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP, + // This index will be parsed back out below. + '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '); + } + } + + // Render each group of markup with similar wrapping `nodeName`. + var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with - - - Loading... This could take a while depending on how big the profile is. Check devtools console for errors. - +
, or , or using non-SVG elements ' + 'in an parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined; + + initialChildren = initialChildren || {}; + initialChildren[parentID] = initialChildren[parentID] || []; + initialChildren[parentID][updatedIndex] = updatedChild; + + updatedChildren = updatedChildren || []; + updatedChildren.push(updatedChild); + } + } + + var renderedMarkup; + // markupList is either a list of markup or just a list of elements + if (markupList.length && typeof markupList[0] === 'string') { + renderedMarkup = Danger.dangerouslyRenderMarkup(markupList); + } else { + renderedMarkup = markupList; + } + + // Remove updated children first so that `toIndex` is consistent. + if (updatedChildren) { + for (var j = 0; j < updatedChildren.length; j++) { + updatedChildren[j].parentNode.removeChild(updatedChildren[j]); + } + } + + for (var k = 0; k < updates.length; k++) { + update = updates[k]; + switch (update.type) { + case ReactMultiChildUpdateTypes.INSERT_MARKUP: + insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex); + break; + case ReactMultiChildUpdateTypes.MOVE_EXISTING: + insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex); + break; + case ReactMultiChildUpdateTypes.SET_MARKUP: + setInnerHTML(update.parentNode, update.content); + break; + case ReactMultiChildUpdateTypes.TEXT_CONTENT: + setTextContent(update.parentNode, update.content); + break; + case ReactMultiChildUpdateTypes.REMOVE_NODE: + // Already removed by the for-loop above. + break; + } + } + } + + }; + + ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', { + updateTextContent: 'updateTextContent' + }); + + module.exports = DOMChildrenOperations; + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {/** + * Copyright 2013-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule Danger + * @typechecks static-only + */ + + 'use strict'; + + var ExecutionEnvironment = __webpack_require__(8); + + var createNodesFromMarkup = __webpack_require__(9); + var emptyFunction = __webpack_require__(14); + var getMarkupWrap = __webpack_require__(13); + var invariant = __webpack_require__(12); + + var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/; + var RESULT_INDEX_ATTR = 'data-danger-index'; + + /** + * Extracts the `nodeName` from a string of markup. + * + * NOTE: Extracting the `nodeName` does not require a regular expression match + * because we make assumptions about React-generated markup (i.e. there are no + * spaces surrounding the opening tag and there is at least one attribute). + * + * @param {string} markup String of markup. + * @return {string} Node name of the supplied markup. + * @see http://jsperf.com/extract-nodename + */ + function getNodeName(markup) { + return markup.substring(1, markup.indexOf(' ')); + } + + var Danger = { + + /** + * Renders markup into an array of nodes. The markup is expected to render + * into a list of root nodes. Also, the length of `resultList` and + * `markupList` should be the same. + * + * @param {array} markupList List of markup strings to render. + * @return {array} List of rendered nodes. + * @internal + */ + dangerouslyRenderMarkup: function (markupList) { + !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined; + var nodeName; + var markupByNodeName = {}; + // Group markup by `nodeName` if a wrap is necessary, else by '*'. + for (var i = 0; i < markupList.length; i++) { + !markupList[i] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined; + nodeName = getNodeName(markupList[i]); + nodeName = getMarkupWrap(nodeName) ? nodeName : '*'; + markupByNodeName[nodeName] = markupByNodeName[nodeName] || []; + markupByNodeName[nodeName][i] = markupList[i]; + } + var resultList = []; + var resultListAssignmentCount = 0; + for (nodeName in markupByNodeName) { + if (!markupByNodeName.hasOwnProperty(nodeName)) { + continue; + } + var markupListByNodeName = markupByNodeName[nodeName]; + + // This for-in loop skips the holes of the sparse array. The order of + // iteration should follow the order of assignment, which happens to match + // numerical index order, but we don't rely on that. + var resultIndex; + for (resultIndex in markupListByNodeName) { + if (markupListByNodeName.hasOwnProperty(resultIndex)) { + var markup = markupListByNodeName[resultIndex]; + + // Push the requested markup with an additional RESULT_INDEX_ATTR + // attribute. If the markup does not start with a < character, it + // will be discarded below (with an appropriate console.error). + markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP, + // This index will be parsed back out below. + '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" '); + } + } + + // Render each group of markup with similar wrapping `nodeName`. + var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with - - - Loading... This could take a while depending on how big the profile is. Check devtools console for errors. - +