react 15.1.0-alpha.1 → 15.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/react-with-addons.js +2145 -1396
  2. package/dist/react-with-addons.min.js +7 -6
  3. package/dist/react.js +1941 -1329
  4. package/dist/react.min.js +6 -6
  5. package/lib/CSSPropertyOperations.js +1 -1
  6. package/lib/CallbackQueue.js +3 -2
  7. package/lib/DOMChildrenOperations.js +15 -8
  8. package/lib/DOMLazyTree.js +3 -2
  9. package/lib/DOMProperty.js +6 -4
  10. package/lib/DOMPropertyOperations.js +17 -3
  11. package/lib/Danger.js +10 -8
  12. package/lib/DisabledInputUtils.js +5 -5
  13. package/lib/EventPluginHub.js +8 -2
  14. package/lib/EventPluginRegistry.js +13 -7
  15. package/lib/EventPluginUtils.js +3 -1
  16. package/lib/HTMLDOMPropertyConfig.js +1 -2
  17. package/lib/LinkedValueUtils.js +5 -3
  18. package/lib/NativeMethodsMixin.js +6 -4
  19. package/lib/PooledClass.js +3 -1
  20. package/lib/React.js +1 -1
  21. package/lib/ReactCSSTransitionGroupChild.js +15 -8
  22. package/lib/ReactChildReconciler.js +15 -6
  23. package/lib/ReactClass.js +14 -13
  24. package/lib/ReactComponent.js +3 -6
  25. package/lib/ReactComponentEnvironment.js +3 -1
  26. package/lib/ReactComponentTreeDevtool.js +99 -16
  27. package/lib/ReactComponentTreeTestUtils.js +87 -0
  28. package/lib/ReactCompositeComponent.js +66 -106
  29. package/lib/ReactDOM.js +2 -2
  30. package/lib/ReactDOMButton.js +2 -2
  31. package/lib/ReactDOMComponent.js +130 -76
  32. package/lib/ReactDOMComponentTree.js +23 -21
  33. package/lib/ReactDOMDebugTool.js +7 -1
  34. package/lib/ReactDOMEmptyComponent.js +9 -9
  35. package/lib/ReactDOMFactories.js +1 -1
  36. package/lib/ReactDOMInput.js +52 -16
  37. package/lib/ReactDOMOption.js +40 -26
  38. package/lib/ReactDOMSelect.js +3 -3
  39. package/lib/ReactDOMTextComponent.js +21 -20
  40. package/lib/ReactDOMTextarea.js +59 -32
  41. package/lib/ReactDOMTreeTraversal.js +18 -16
  42. package/lib/ReactDOMUnknownPropertyDevtool.js +65 -17
  43. package/lib/ReactDebugTool.js +132 -45
  44. package/lib/ReactDefaultInjection.js +2 -2
  45. package/lib/ReactElement.js +64 -25
  46. package/lib/ReactElementValidator.js +26 -81
  47. package/lib/ReactErrorUtils.js +15 -65
  48. package/lib/ReactEventListener.js +2 -2
  49. package/lib/ReactFragment.js +3 -1
  50. package/lib/{ReactNativeComponent.js → ReactHostComponent.js} +10 -29
  51. package/lib/{ReactNativeOperationHistoryDevtool.js → ReactHostOperationHistoryDevtool.js} +9 -4
  52. package/lib/ReactInjection.js +2 -2
  53. package/lib/ReactInstanceHandles.js +8 -6
  54. package/lib/ReactMount.js +25 -14
  55. package/lib/ReactMultiChild.js +31 -9
  56. package/lib/ReactNativeAttributePayload.js +5 -2
  57. package/lib/ReactNativeBaseComponent.js +7 -7
  58. package/lib/ReactNativeBridgeEventPlugin.js +1 -1
  59. package/lib/ReactNativeComponentTree.js +8 -6
  60. package/lib/ReactNativeDOMIDOperations.js +1 -2
  61. package/lib/ReactNativeDefaultInjection.js +9 -7
  62. package/lib/ReactNativeGlobalResponderHandler.js +1 -1
  63. package/lib/ReactNativeMount.js +7 -1
  64. package/lib/ReactNativeTagHandles.js +3 -1
  65. package/lib/ReactNativeTextComponent.js +10 -9
  66. package/lib/ReactNativeTreeTraversal.js +11 -11
  67. package/lib/ReactNodeTypes.js +5 -3
  68. package/lib/ReactNoop.js +76 -0
  69. package/lib/ReactOwner.js +4 -2
  70. package/lib/ReactPerf.js +83 -7
  71. package/lib/ReactPropTypes.js +23 -0
  72. package/lib/ReactReconcileTransaction.js +1 -1
  73. package/lib/ReactReconciler.js +12 -7
  74. package/lib/ReactServerRendering.js +8 -2
  75. package/lib/ReactSimpleEmptyComponent.js +4 -4
  76. package/lib/ReactTestMount.js +126 -0
  77. package/lib/ReactTestReconcileTransaction.js +100 -0
  78. package/lib/ReactTestRenderer.js +133 -0
  79. package/lib/ReactTestUtils.js +21 -10
  80. package/lib/ReactTransitionChildMapping.js +7 -1
  81. package/lib/ReactTransitionGroup.js +40 -6
  82. package/lib/ReactUpdateQueue.js +9 -1
  83. package/lib/ReactUpdates.js +9 -8
  84. package/lib/ReactVersion.js +1 -1
  85. package/lib/ResponderEventPlugin.js +8 -6
  86. package/lib/ResponderTouchHistoryStore.js +6 -4
  87. package/lib/SimpleEventPlugin.js +3 -1
  88. package/lib/SyntheticEvent.js +2 -3
  89. package/lib/SyntheticUIEvent.js +1 -1
  90. package/lib/Transaction.js +4 -2
  91. package/lib/accumulate.js +3 -1
  92. package/lib/accumulateInto.js +3 -1
  93. package/lib/checkReactTypeSpec.js +71 -0
  94. package/lib/createReactNativeComponentClass.js +2 -2
  95. package/lib/dangerousStyleValue.js +3 -1
  96. package/lib/escapeTextContentForBrowser.js +96 -12
  97. package/lib/findDOMNode.js +6 -4
  98. package/lib/findNodeHandle.js +5 -3
  99. package/lib/flattenChildren.js +13 -4
  100. package/lib/{getNativeComponentFromComposite.js → getHostComponentFromComposite.js} +4 -4
  101. package/lib/instantiateReactComponent.js +20 -17
  102. package/lib/onlyChild.js +3 -1
  103. package/lib/reactComponentExpect.js +3 -3
  104. package/lib/reactProdInvariant.js +38 -0
  105. package/lib/setInnerHTML.js +17 -1
  106. package/lib/setTextContent.js +8 -0
  107. package/lib/traverseAllChildren.js +3 -1
  108. package/lib/update.js +12 -11
  109. package/package.json +2 -2
  110. package/lib/MetaMatchers.js +0 -118
@@ -11,6 +11,8 @@
11
11
  */
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var invariant = require('fbjs/lib/invariant');
15
17
 
16
18
  /**
@@ -42,7 +44,7 @@ var ReactNativeTagHandles = {
42
44
  },
43
45
 
44
46
  assertRootTag: function (tag) {
45
- !this.reactTagIsNativeTopRootID(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expect a native root tag, instead got %s', tag) : invariant(false) : void 0;
47
+ !this.reactTagIsNativeTopRootID(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expect a native root tag, instead got %s', tag) : _prodInvariant('19', tag) : void 0;
46
48
  },
47
49
 
48
50
  reactTagIsNativeTopRootID: function (reactTag) {
@@ -11,12 +11,13 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var _assign = require('object-assign');
14
+ var _prodInvariant = require('./reactProdInvariant'),
15
+ _assign = require('object-assign');
15
16
 
16
17
  var ReactInstrumentation = require('./ReactInstrumentation');
17
18
  var ReactNativeComponentTree = require('./ReactNativeComponentTree');
18
19
  var ReactNativeTagHandles = require('./ReactNativeTagHandles');
19
- var UIManager = require('UIManager');
20
+ var UIManager = require('react-native/lib/UIManager');
20
21
 
21
22
  var invariant = require('fbjs/lib/invariant');
22
23
 
@@ -24,23 +25,23 @@ var ReactNativeTextComponent = function (text) {
24
25
  // This is really a ReactText (ReactNode), not a ReactElement
25
26
  this._currentElement = text;
26
27
  this._stringText = '' + text;
27
- this._nativeParent = null;
28
+ this._hostParent = null;
28
29
  this._rootNodeID = null;
29
30
  };
30
31
 
31
32
  _assign(ReactNativeTextComponent.prototype, {
32
33
 
33
- mountComponent: function (transaction, nativeParent, nativeContainerInfo, context) {
34
+ mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
34
35
  if (process.env.NODE_ENV !== 'production') {
35
36
  ReactInstrumentation.debugTool.onSetText(this._debugID, this._stringText);
36
37
  }
37
38
 
38
- // TODO: nativeParent should have this context already. Stop abusing context.
39
- !context.isInAParentText ? process.env.NODE_ENV !== 'production' ? invariant(false, 'RawText "%s" must be wrapped in an explicit <Text> component.', this._stringText) : invariant(false) : void 0;
40
- this._nativeParent = nativeParent;
39
+ // TODO: hostParent should have this context already. Stop abusing context.
40
+ !context.isInAParentText ? process.env.NODE_ENV !== 'production' ? invariant(false, 'RawText "%s" must be wrapped in an explicit <Text> component.', this._stringText) : _prodInvariant('20', this._stringText) : void 0;
41
+ this._hostParent = hostParent;
41
42
  var tag = ReactNativeTagHandles.allocateTag();
42
43
  this._rootNodeID = tag;
43
- var nativeTopRootTag = nativeContainerInfo._tag;
44
+ var nativeTopRootTag = hostContainerInfo._tag;
44
45
  UIManager.createView(tag, 'RCTRawText', nativeTopRootTag, { text: this._stringText });
45
46
 
46
47
  ReactNativeComponentTree.precacheNode(this, tag);
@@ -48,7 +49,7 @@ _assign(ReactNativeTextComponent.prototype, {
48
49
  return tag;
49
50
  },
50
51
 
51
- getNativeNode: function () {
52
+ getHostNode: function () {
52
53
  return this._rootNodeID;
53
54
  },
54
55
 
@@ -20,23 +20,23 @@
20
20
 
21
21
  function getLowestCommonAncestor(instA, instB) {
22
22
  var depthA = 0;
23
- for (var tempA = instA; tempA; tempA = tempA._nativeParent) {
23
+ for (var tempA = instA; tempA; tempA = tempA._hostParent) {
24
24
  depthA++;
25
25
  }
26
26
  var depthB = 0;
27
- for (var tempB = instB; tempB; tempB = tempB._nativeParent) {
27
+ for (var tempB = instB; tempB; tempB = tempB._hostParent) {
28
28
  depthB++;
29
29
  }
30
30
 
31
31
  // If A is deeper, crawl up.
32
32
  while (depthA - depthB > 0) {
33
- instA = instA._nativeParent;
33
+ instA = instA._hostParent;
34
34
  depthA--;
35
35
  }
36
36
 
37
37
  // If B is deeper, crawl up.
38
38
  while (depthB - depthA > 0) {
39
- instB = instB._nativeParent;
39
+ instB = instB._hostParent;
40
40
  depthB--;
41
41
  }
42
42
 
@@ -46,8 +46,8 @@ function getLowestCommonAncestor(instA, instB) {
46
46
  if (instA === instB) {
47
47
  return instA;
48
48
  }
49
- instA = instA._nativeParent;
50
- instB = instB._nativeParent;
49
+ instA = instA._hostParent;
50
+ instB = instB._hostParent;
51
51
  }
52
52
  return null;
53
53
  }
@@ -60,7 +60,7 @@ function isAncestor(instA, instB) {
60
60
  if (instB === instA) {
61
61
  return true;
62
62
  }
63
- instB = instB._nativeParent;
63
+ instB = instB._hostParent;
64
64
  }
65
65
  return false;
66
66
  }
@@ -69,7 +69,7 @@ function isAncestor(instA, instB) {
69
69
  * Return the parent instance of the passed-in instance.
70
70
  */
71
71
  function getParentInstance(inst) {
72
- return inst._nativeParent;
72
+ return inst._hostParent;
73
73
  }
74
74
 
75
75
  /**
@@ -79,7 +79,7 @@ function traverseTwoPhase(inst, fn, arg) {
79
79
  var path = [];
80
80
  while (inst) {
81
81
  path.push(inst);
82
- inst = inst._nativeParent;
82
+ inst = inst._hostParent;
83
83
  }
84
84
  var i;
85
85
  for (i = path.length; i-- > 0;) {
@@ -102,12 +102,12 @@ function traverseEnterLeave(from, to, fn, argFrom, argTo) {
102
102
  var pathFrom = [];
103
103
  while (from && from !== common) {
104
104
  pathFrom.push(from);
105
- from = from._nativeParent;
105
+ from = from._hostParent;
106
106
  }
107
107
  var pathTo = [];
108
108
  while (to && to !== common) {
109
109
  pathTo.push(to);
110
- to = to._nativeParent;
110
+ to = to._hostParent;
111
111
  }
112
112
  var i;
113
113
  for (i = 0; i < pathFrom.length; i++) {
@@ -11,12 +11,14 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var ReactElement = require('./ReactElement');
15
17
 
16
18
  var invariant = require('fbjs/lib/invariant');
17
19
 
18
20
  var ReactNodeTypes = {
19
- NATIVE: 0,
21
+ HOST: 0,
20
22
  COMPOSITE: 1,
21
23
  EMPTY: 2,
22
24
 
@@ -27,10 +29,10 @@ var ReactNodeTypes = {
27
29
  if (typeof node.type === 'function') {
28
30
  return ReactNodeTypes.COMPOSITE;
29
31
  } else {
30
- return ReactNodeTypes.NATIVE;
32
+ return ReactNodeTypes.HOST;
31
33
  }
32
34
  }
33
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unexpected node: %s', node) : invariant(false) : void 0;
35
+ !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unexpected node: %s', node) : _prodInvariant('26', node) : void 0;
34
36
  }
35
37
  };
36
38
 
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @providesModule ReactNoop
10
+ *
11
+ */
12
+
13
+ /**
14
+ * This is a renderer of React that doesn't have a render target output.
15
+ * It is useful to demonstrate the internals of the reconciler in isolation
16
+ * and for testing semantics of reconciliation separate from the host
17
+ * environment.
18
+ */
19
+
20
+ 'use strict';
21
+
22
+ var ReactFiberReconciler = require('./ReactFiberReconciler');
23
+
24
+ var scheduledHighPriCallback = null;
25
+ var scheduledLowPriCallback = null;
26
+
27
+ var NoopRenderer = ReactFiberReconciler({
28
+ createHostInstance: function () {},
29
+ scheduleHighPriCallback: function (callback) {
30
+ scheduledHighPriCallback = callback;
31
+ },
32
+ scheduleLowPriCallback: function (callback) {
33
+ scheduledLowPriCallback = callback;
34
+ }
35
+ });
36
+
37
+ var ReactNoop = {
38
+ render: function (element) {
39
+
40
+ NoopRenderer.mountNewRoot(element);
41
+ },
42
+ flushHighPri: function () {
43
+ var cb = scheduledHighPriCallback;
44
+ if (cb === null) {
45
+ return;
46
+ }
47
+ scheduledHighPriCallback = null;
48
+ cb();
49
+ },
50
+ flushLowPri: function () {
51
+ var timeout = arguments.length <= 0 || arguments[0] === undefined ? Infinity : arguments[0];
52
+
53
+ var cb = scheduledLowPriCallback;
54
+ if (cb === null) {
55
+ return;
56
+ }
57
+ scheduledLowPriCallback = null;
58
+ var timeRemaining = timeout;
59
+ cb({
60
+ timeRemaining: function () {
61
+ // Simulate a fix amount of time progressing between each call.
62
+ timeRemaining -= 5;
63
+ if (timeRemaining < 0) {
64
+ timeRemaining = 0;
65
+ }
66
+ return timeRemaining;
67
+ }
68
+ });
69
+ },
70
+ flush: function () {
71
+ ReactNoop.flushHighPri();
72
+ ReactNoop.flushLowPri();
73
+ }
74
+ };
75
+
76
+ module.exports = ReactNoop;
package/lib/ReactOwner.js CHANGED
@@ -11,6 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var invariant = require('fbjs/lib/invariant');
15
17
 
16
18
  /**
@@ -64,7 +66,7 @@ var ReactOwner = {
64
66
  * @internal
65
67
  */
66
68
  addComponentAsRefTo: function (component, ref, owner) {
67
- !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : void 0;
69
+ !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('119') : void 0;
68
70
  owner.attachRef(ref, component);
69
71
  },
70
72
 
@@ -78,7 +80,7 @@ var ReactOwner = {
78
80
  * @internal
79
81
  */
80
82
  removeComponentAsRefFrom: function (component, ref, owner) {
81
- !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : void 0;
83
+ !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might be removing a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('120') : void 0;
82
84
  var ownerPublicInstance = owner.getPublicInstance();
83
85
  // Check that `component`'s owner is still alive and that `component` is still the current ref
84
86
  // because we do not want to detach the ref if another component stole it.
package/lib/ReactPerf.js CHANGED
@@ -17,6 +17,7 @@ var _extends = _assign || function (target) { for (var i = 1; i < arguments.leng
17
17
 
18
18
  var ReactDebugTool = require('./ReactDebugTool');
19
19
  var warning = require('fbjs/lib/warning');
20
+ var alreadyWarned = false;
20
21
 
21
22
  function roundFloat(val) {
22
23
  var base = arguments.length <= 1 || arguments[1] === undefined ? 2 : arguments[1];
@@ -25,12 +26,32 @@ function roundFloat(val) {
25
26
  return Math.floor(val * n) / n;
26
27
  }
27
28
 
28
- function getFlushHistory() {
29
+ function warnInProduction() {
30
+ if (alreadyWarned) {
31
+ return;
32
+ }
33
+ alreadyWarned = true;
34
+ if (typeof console !== 'undefined') {
35
+ console.error('ReactPerf is not supported in the production builds of React. ' + 'To collect measurements, please use the development build of React instead.');
36
+ }
37
+ }
38
+
39
+ function getLastMeasurements() {
40
+ if (!(process.env.NODE_ENV !== 'production')) {
41
+ warnInProduction();
42
+ return [];
43
+ }
44
+
29
45
  return ReactDebugTool.getFlushHistory();
30
46
  }
31
47
 
32
48
  function getExclusive() {
33
- var flushHistory = arguments.length <= 0 || arguments[0] === undefined ? getFlushHistory() : arguments[0];
49
+ var flushHistory = arguments.length <= 0 || arguments[0] === undefined ? getLastMeasurements() : arguments[0];
50
+
51
+ if (!(process.env.NODE_ENV !== 'production')) {
52
+ warnInProduction();
53
+ return [];
54
+ }
34
55
 
35
56
  var aggregatedStats = {};
36
57
  var affectedIDs = {};
@@ -87,7 +108,12 @@ function getExclusive() {
87
108
  }
88
109
 
89
110
  function getInclusive() {
90
- var flushHistory = arguments.length <= 0 || arguments[0] === undefined ? getFlushHistory() : arguments[0];
111
+ var flushHistory = arguments.length <= 0 || arguments[0] === undefined ? getLastMeasurements() : arguments[0];
112
+
113
+ if (!(process.env.NODE_ENV !== 'production')) {
114
+ warnInProduction();
115
+ return [];
116
+ }
91
117
 
92
118
  var aggregatedStats = {};
93
119
  var affectedIDs = {};
@@ -167,7 +193,12 @@ function getInclusive() {
167
193
  }
168
194
 
169
195
  function getWasted() {
170
- var flushHistory = arguments.length <= 0 || arguments[0] === undefined ? getFlushHistory() : arguments[0];
196
+ var flushHistory = arguments.length <= 0 || arguments[0] === undefined ? getLastMeasurements() : arguments[0];
197
+
198
+ if (!(process.env.NODE_ENV !== 'production')) {
199
+ warnInProduction();
200
+ return [];
201
+ }
171
202
 
172
203
  var aggregatedStats = {};
173
204
  var affectedIDs = {};
@@ -200,7 +231,7 @@ function getWasted() {
200
231
 
201
232
  var isDefinitelyNotWastedByID = {};
202
233
 
203
- // Find native components associated with an operation in this batch.
234
+ // Find host components associated with an operation in this batch.
204
235
  // Mark all components in their parent tree as definitely not wasted.
205
236
  operations.forEach(function (operation) {
206
237
  var instanceID = operation.instanceID;
@@ -272,7 +303,12 @@ function getWasted() {
272
303
  }
273
304
 
274
305
  function getOperations() {
275
- var flushHistory = arguments.length <= 0 || arguments[0] === undefined ? getFlushHistory() : arguments[0];
306
+ var flushHistory = arguments.length <= 0 || arguments[0] === undefined ? getLastMeasurements() : arguments[0];
307
+
308
+ if (!(process.env.NODE_ENV !== 'production')) {
309
+ warnInProduction();
310
+ return [];
311
+ }
276
312
 
277
313
  var stats = [];
278
314
  flushHistory.forEach(function (flush, flushIndex) {
@@ -304,6 +340,11 @@ function getOperations() {
304
340
  }
305
341
 
306
342
  function printExclusive(flushHistory) {
343
+ if (!(process.env.NODE_ENV !== 'production')) {
344
+ warnInProduction();
345
+ return;
346
+ }
347
+
307
348
  var stats = getExclusive(flushHistory);
308
349
  var table = stats.map(function (item) {
309
350
  var key = item.key;
@@ -326,6 +367,11 @@ function printExclusive(flushHistory) {
326
367
  }
327
368
 
328
369
  function printInclusive(flushHistory) {
370
+ if (!(process.env.NODE_ENV !== 'production')) {
371
+ warnInProduction();
372
+ return;
373
+ }
374
+
329
375
  var stats = getInclusive(flushHistory);
330
376
  var table = stats.map(function (item) {
331
377
  var key = item.key;
@@ -344,6 +390,11 @@ function printInclusive(flushHistory) {
344
390
  }
345
391
 
346
392
  function printWasted(flushHistory) {
393
+ if (!(process.env.NODE_ENV !== 'production')) {
394
+ warnInProduction();
395
+ return;
396
+ }
397
+
347
398
  var stats = getWasted(flushHistory);
348
399
  var table = stats.map(function (item) {
349
400
  var key = item.key;
@@ -362,6 +413,11 @@ function printWasted(flushHistory) {
362
413
  }
363
414
 
364
415
  function printOperations(flushHistory) {
416
+ if (!(process.env.NODE_ENV !== 'production')) {
417
+ warnInProduction();
418
+ return;
419
+ }
420
+
365
421
  var stats = getOperations(flushHistory);
366
422
  var table = stats.map(function (stat) {
367
423
  return {
@@ -391,15 +447,34 @@ function getMeasurementsSummaryMap(measurements) {
391
447
  }
392
448
 
393
449
  function start() {
450
+ if (!(process.env.NODE_ENV !== 'production')) {
451
+ warnInProduction();
452
+ return;
453
+ }
454
+
394
455
  ReactDebugTool.beginProfiling();
395
456
  }
396
457
 
397
458
  function stop() {
459
+ if (!(process.env.NODE_ENV !== 'production')) {
460
+ warnInProduction();
461
+ return;
462
+ }
463
+
398
464
  ReactDebugTool.endProfiling();
399
465
  }
400
466
 
467
+ function isRunning() {
468
+ if (!(process.env.NODE_ENV !== 'production')) {
469
+ warnInProduction();
470
+ return false;
471
+ }
472
+
473
+ return ReactDebugTool.isProfiling();
474
+ }
475
+
401
476
  var ReactPerfAnalysis = {
402
- getLastMeasurements: getFlushHistory,
477
+ getLastMeasurements: getLastMeasurements,
403
478
  getExclusive: getExclusive,
404
479
  getInclusive: getInclusive,
405
480
  getWasted: getWasted,
@@ -410,6 +485,7 @@ var ReactPerfAnalysis = {
410
485
  printOperations: printOperations,
411
486
  start: start,
412
487
  stop: stop,
488
+ isRunning: isRunning,
413
489
  // Deprecated:
414
490
  printDOM: printDOM,
415
491
  getMeasurementsSummaryMap: getMeasurementsSummaryMap