react 15.1.0 → 15.2.1
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.
- package/dist/react-with-addons.js +2685 -1842
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +2400 -1691
- package/dist/react.min.js +6 -6
- package/lib/CSSPropertyOperations.js +1 -1
- package/lib/CallbackQueue.js +3 -2
- package/lib/DOMChildrenOperations.js +9 -9
- package/lib/DOMLazyTree.js +3 -2
- package/lib/DOMProperty.js +5 -12
- package/lib/DOMPropertyOperations.js +21 -15
- package/lib/Danger.js +5 -101
- package/lib/DisabledInputUtils.js +5 -5
- package/lib/EventPluginHub.js +8 -2
- package/lib/EventPluginRegistry.js +13 -7
- package/lib/EventPluginUtils.js +3 -1
- package/lib/HTMLDOMPropertyConfig.js +1 -2
- package/lib/KeyEscapeUtils.js +2 -1
- package/lib/LinkedValueUtils.js +5 -3
- package/lib/NativeMethodsMixin.js +6 -4
- package/lib/PooledClass.js +4 -2
- package/lib/React.js +1 -1
- package/lib/ReactCSSTransitionGroupChild.js +15 -8
- package/lib/ReactChildReconciler.js +17 -8
- package/lib/ReactClass.js +14 -13
- package/lib/ReactComponent.js +3 -6
- package/lib/ReactComponentEnvironment.js +3 -1
- package/lib/ReactComponentTreeDevtool.js +89 -16
- package/lib/ReactComponentTreeTestUtils.js +87 -0
- package/lib/ReactCompositeComponent.js +87 -117
- package/lib/ReactDOM.js +2 -2
- package/lib/ReactDOMButton.js +2 -2
- package/lib/ReactDOMComponent.js +130 -76
- package/lib/ReactDOMComponentTree.js +23 -21
- package/lib/ReactDOMDebugTool.js +17 -11
- package/lib/ReactDOMEmptyComponent.js +9 -9
- package/lib/ReactDOMFactories.js +1 -1
- package/lib/ReactDOMFiber.js +78 -0
- package/lib/ReactDOMInput.js +64 -26
- package/lib/ReactDOMInstrumentation.js +7 -2
- package/lib/ReactDOMNullInputValuePropDevtool.js +43 -0
- package/lib/ReactDOMOption.js +40 -26
- package/lib/ReactDOMSelect.js +3 -16
- package/lib/ReactDOMTextComponent.js +21 -20
- package/lib/ReactDOMTextarea.js +59 -46
- package/lib/ReactDOMTreeTraversal.js +18 -16
- package/lib/ReactDOMUnknownPropertyDevtool.js +65 -17
- package/lib/ReactDebugTool.js +148 -95
- package/lib/ReactDefaultInjection.js +2 -2
- package/lib/ReactElement.js +64 -25
- package/lib/ReactElementValidator.js +26 -81
- package/lib/ReactEventListener.js +2 -2
- package/lib/ReactFeatureFlags.js +1 -0
- package/lib/ReactFragment.js +3 -1
- package/lib/{ReactNativeComponent.js → ReactHostComponent.js} +10 -29
- package/lib/{ReactNativeOperationHistoryDevtool.js → ReactHostOperationHistoryDevtool.js} +5 -5
- package/lib/ReactInjection.js +2 -2
- package/lib/ReactInstanceHandles.js +8 -6
- package/lib/ReactInstrumentation.js +7 -2
- package/lib/ReactMount.js +38 -32
- package/lib/ReactMultiChild.js +38 -11
- package/lib/ReactNativeAttributePayload.js +5 -2
- package/lib/ReactNativeBaseComponent.js +7 -7
- package/lib/ReactNativeBridgeEventPlugin.js +1 -1
- package/lib/ReactNativeComponentTree.js +8 -6
- package/lib/ReactNativeDOMIDOperations.js +1 -2
- package/lib/ReactNativeDefaultInjection.js +9 -7
- package/lib/ReactNativeGlobalResponderHandler.js +1 -1
- package/lib/ReactNativeMount.js +3 -14
- package/lib/ReactNativeReconcileTransaction.js +16 -0
- package/lib/ReactNativeTagHandles.js +3 -1
- package/lib/ReactNativeTextComponent.js +10 -9
- package/lib/ReactNativeTreeTraversal.js +11 -11
- package/lib/ReactNodeTypes.js +6 -3
- package/lib/ReactNoop.js +173 -0
- package/lib/ReactNoopUpdateQueue.js +6 -5
- package/lib/ReactOwner.js +4 -2
- package/lib/ReactPerf.js +83 -7
- package/lib/ReactPropTypes.js +23 -0
- package/lib/ReactReconcileTransaction.js +17 -1
- package/lib/ReactReconciler.js +12 -7
- package/lib/ReactServerRendering.js +5 -7
- package/lib/ReactServerRenderingTransaction.js +17 -0
- package/lib/ReactServerUpdateQueue.js +141 -0
- package/lib/ReactSimpleEmptyComponent.js +4 -4
- package/lib/ReactTestMount.js +115 -0
- package/lib/ReactTestReconcileTransaction.js +108 -0
- package/lib/ReactTestRenderer.js +133 -0
- package/lib/ReactTestUtils.js +17 -10
- package/lib/ReactTransitionChildMapping.js +7 -1
- package/lib/ReactTransitionGroup.js +41 -6
- package/lib/ReactUpdateQueue.js +13 -3
- package/lib/ReactUpdates.js +10 -18
- package/lib/ReactVersion.js +1 -1
- package/lib/ResponderEventPlugin.js +9 -7
- package/lib/ResponderTouchHistoryStore.js +99 -95
- package/lib/SimpleEventPlugin.js +3 -1
- package/lib/SyntheticEvent.js +2 -3
- package/lib/SyntheticUIEvent.js +1 -1
- package/lib/Transaction.js +4 -2
- package/lib/accumulate.js +17 -15
- package/lib/accumulateInto.js +11 -12
- package/lib/adler32.js +1 -0
- package/lib/checkReactTypeSpec.js +73 -0
- package/lib/createReactNativeComponentClass.js +2 -2
- package/lib/dangerousStyleValue.js +3 -1
- package/lib/deprecated.js +7 -1
- package/lib/escapeTextContentForBrowser.js +96 -12
- package/lib/findDOMNode.js +6 -4
- package/lib/findNodeHandle.js +5 -3
- package/lib/flattenChildren.js +22 -10
- package/lib/forEachAccumulated.js +3 -2
- package/lib/{getNativeComponentFromComposite.js → getHostComponentFromComposite.js} +4 -4
- package/lib/getIteratorFn.js +1 -0
- package/lib/instantiateReactComponent.js +21 -19
- package/lib/isTextInputElement.js +11 -1
- package/lib/onlyChild.js +3 -1
- package/lib/reactComponentExpect.js +3 -3
- package/lib/reactProdInvariant.js +39 -0
- package/lib/setInnerHTML.js +17 -1
- package/lib/setTextContent.js +8 -0
- package/lib/traverseAllChildren.js +3 -1
- package/lib/update.js +12 -11
- package/package.json +2 -2
- package/lib/MetaMatchers.js +0 -118
|
@@ -13,9 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
var warning = require('fbjs/lib/warning');
|
|
15
15
|
|
|
16
|
-
function
|
|
16
|
+
function warnNoop(publicInstance, callerName) {
|
|
17
17
|
if (process.env.NODE_ENV !== 'production') {
|
|
18
|
-
|
|
18
|
+
var constructor = publicInstance.constructor;
|
|
19
|
+
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -59,7 +60,7 @@ var ReactNoopUpdateQueue = {
|
|
|
59
60
|
* @internal
|
|
60
61
|
*/
|
|
61
62
|
enqueueForceUpdate: function (publicInstance) {
|
|
62
|
-
|
|
63
|
+
warnNoop(publicInstance, 'forceUpdate');
|
|
63
64
|
},
|
|
64
65
|
|
|
65
66
|
/**
|
|
@@ -74,7 +75,7 @@ var ReactNoopUpdateQueue = {
|
|
|
74
75
|
* @internal
|
|
75
76
|
*/
|
|
76
77
|
enqueueReplaceState: function (publicInstance, completeState) {
|
|
77
|
-
|
|
78
|
+
warnNoop(publicInstance, 'replaceState');
|
|
78
79
|
},
|
|
79
80
|
|
|
80
81
|
/**
|
|
@@ -88,7 +89,7 @@ var ReactNoopUpdateQueue = {
|
|
|
88
89
|
* @internal
|
|
89
90
|
*/
|
|
90
91
|
enqueueSetState: function (publicInstance, partialState) {
|
|
91
|
-
|
|
92
|
+
warnNoop(publicInstance, 'setState');
|
|
92
93
|
}
|
|
93
94
|
};
|
|
94
95
|
|
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
|
|
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
|
|
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
|
|
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 ?
|
|
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 ?
|
|
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 ?
|
|
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
|
|
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 ?
|
|
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:
|
|
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
|
package/lib/ReactPropTypes.js
CHANGED
|
@@ -73,6 +73,7 @@ var ReactPropTypes = {
|
|
|
73
73
|
number: createPrimitiveTypeChecker('number'),
|
|
74
74
|
object: createPrimitiveTypeChecker('object'),
|
|
75
75
|
string: createPrimitiveTypeChecker('string'),
|
|
76
|
+
symbol: createPrimitiveTypeChecker('symbol'),
|
|
76
77
|
|
|
77
78
|
any: createAnyTypeChecker(),
|
|
78
79
|
arrayOf: createArrayOfTypeChecker,
|
|
@@ -340,6 +341,25 @@ function isNode(propValue) {
|
|
|
340
341
|
}
|
|
341
342
|
}
|
|
342
343
|
|
|
344
|
+
function isSymbol(propType, propValue) {
|
|
345
|
+
// Native Symbol.
|
|
346
|
+
if (propType === 'symbol') {
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
351
|
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
352
|
+
return true;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
356
|
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
return false;
|
|
361
|
+
}
|
|
362
|
+
|
|
343
363
|
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
344
364
|
function getPropType(propValue) {
|
|
345
365
|
var propType = typeof propValue;
|
|
@@ -352,6 +372,9 @@ function getPropType(propValue) {
|
|
|
352
372
|
// passes PropTypes.object.
|
|
353
373
|
return 'object';
|
|
354
374
|
}
|
|
375
|
+
if (isSymbol(propType, propValue)) {
|
|
376
|
+
return 'symbol';
|
|
377
|
+
}
|
|
355
378
|
return propType;
|
|
356
379
|
}
|
|
357
380
|
|
|
@@ -17,7 +17,9 @@ var CallbackQueue = require('./CallbackQueue');
|
|
|
17
17
|
var PooledClass = require('./PooledClass');
|
|
18
18
|
var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
|
|
19
19
|
var ReactInputSelection = require('./ReactInputSelection');
|
|
20
|
+
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
20
21
|
var Transaction = require('./Transaction');
|
|
22
|
+
var ReactUpdateQueue = require('./ReactUpdateQueue');
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
25
|
* Ensures that, when possible, the selection range (currently selected text
|
|
@@ -87,6 +89,13 @@ var ON_DOM_READY_QUEUEING = {
|
|
|
87
89
|
*/
|
|
88
90
|
var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
|
|
89
91
|
|
|
92
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
93
|
+
TRANSACTION_WRAPPERS.push({
|
|
94
|
+
initialize: ReactInstrumentation.debugTool.onBeginFlush,
|
|
95
|
+
close: ReactInstrumentation.debugTool.onEndFlush
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
90
99
|
/**
|
|
91
100
|
* Currently:
|
|
92
101
|
* - The order that these are listed in the transaction is critical:
|
|
@@ -107,7 +116,7 @@ function ReactReconcileTransaction(useCreateElement) {
|
|
|
107
116
|
// `ReactServerRendering`), but server-side uses
|
|
108
117
|
// `ReactServerRenderingTransaction` instead. This option is here so that it's
|
|
109
118
|
// accessible and defaults to false when `ReactDOMComponent` and
|
|
110
|
-
// `
|
|
119
|
+
// `ReactDOMTextComponent` checks it in `mountComponent`.`
|
|
111
120
|
this.renderToStaticMarkup = false;
|
|
112
121
|
this.reactMountReady = CallbackQueue.getPooled(null);
|
|
113
122
|
this.useCreateElement = useCreateElement;
|
|
@@ -132,6 +141,13 @@ var Mixin = {
|
|
|
132
141
|
return this.reactMountReady;
|
|
133
142
|
},
|
|
134
143
|
|
|
144
|
+
/**
|
|
145
|
+
* @return {object} The queue to collect React async events.
|
|
146
|
+
*/
|
|
147
|
+
getUpdateQueue: function () {
|
|
148
|
+
return ReactUpdateQueue;
|
|
149
|
+
},
|
|
150
|
+
|
|
135
151
|
/**
|
|
136
152
|
* Save current transaction state -- if the return value from this method is
|
|
137
153
|
* passed to `rollback`, the transaction will be reset to that state.
|
package/lib/ReactReconciler.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
+
|
|
14
16
|
var ReactRef = require('./ReactRef');
|
|
15
17
|
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
16
18
|
|
|
@@ -31,19 +33,20 @@ var ReactReconciler = {
|
|
|
31
33
|
*
|
|
32
34
|
* @param {ReactComponent} internalInstance
|
|
33
35
|
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
|
34
|
-
* @param {?object} the containing
|
|
35
|
-
* @param {?object} info about the
|
|
36
|
+
* @param {?object} the containing host component instance
|
|
37
|
+
* @param {?object} info about the host container
|
|
36
38
|
* @return {?string} Rendered markup to be inserted into the DOM.
|
|
37
39
|
* @final
|
|
38
40
|
* @internal
|
|
39
41
|
*/
|
|
40
|
-
mountComponent: function (internalInstance, transaction,
|
|
42
|
+
mountComponent: function (internalInstance, transaction, hostParent, hostContainerInfo, context) {
|
|
41
43
|
if (process.env.NODE_ENV !== 'production') {
|
|
42
44
|
if (internalInstance._debugID !== 0) {
|
|
45
|
+
ReactInstrumentation.debugTool.onBeforeMountComponent(internalInstance._debugID, internalInstance._currentElement);
|
|
43
46
|
ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'mountComponent');
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
|
-
var markup = internalInstance.mountComponent(transaction,
|
|
49
|
+
var markup = internalInstance.mountComponent(transaction, hostParent, hostContainerInfo, context);
|
|
47
50
|
if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
|
|
48
51
|
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
|
|
49
52
|
}
|
|
@@ -60,8 +63,8 @@ var ReactReconciler = {
|
|
|
60
63
|
* Returns a value that can be passed to
|
|
61
64
|
* ReactComponentEnvironment.replaceNodeWithMarkup.
|
|
62
65
|
*/
|
|
63
|
-
|
|
64
|
-
return internalInstance.
|
|
66
|
+
getHostNode: function (internalInstance) {
|
|
67
|
+
return internalInstance.getHostNode();
|
|
65
68
|
},
|
|
66
69
|
|
|
67
70
|
/**
|
|
@@ -114,6 +117,7 @@ var ReactReconciler = {
|
|
|
114
117
|
|
|
115
118
|
if (process.env.NODE_ENV !== 'production') {
|
|
116
119
|
if (internalInstance._debugID !== 0) {
|
|
120
|
+
ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement);
|
|
117
121
|
ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'receiveComponent');
|
|
118
122
|
}
|
|
119
123
|
}
|
|
@@ -149,12 +153,13 @@ var ReactReconciler = {
|
|
|
149
153
|
if (internalInstance._updateBatchNumber !== updateBatchNumber) {
|
|
150
154
|
// The component's enqueued batch number should always be the current
|
|
151
155
|
// batch or the following one.
|
|
152
|
-
!(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'performUpdateIfNecessary: Unexpected batch number (current %s,
|
|
156
|
+
!(internalInstance._updateBatchNumber == null || internalInstance._updateBatchNumber === updateBatchNumber + 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'performUpdateIfNecessary: Unexpected batch number (current %s, pending %s)', updateBatchNumber, internalInstance._updateBatchNumber) : _prodInvariant('121', updateBatchNumber, internalInstance._updateBatchNumber) : void 0;
|
|
153
157
|
return;
|
|
154
158
|
}
|
|
155
159
|
if (process.env.NODE_ENV !== 'production') {
|
|
156
160
|
if (internalInstance._debugID !== 0) {
|
|
157
161
|
ReactInstrumentation.debugTool.onBeginReconcilerTimer(internalInstance._debugID, 'performUpdateIfNecessary');
|
|
162
|
+
ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, internalInstance._currentElement);
|
|
158
163
|
}
|
|
159
164
|
}
|
|
160
165
|
internalInstance.performUpdateIfNecessary(transaction);
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
+
var _prodInvariant = require('./reactProdInvariant');
|
|
14
|
+
|
|
13
15
|
var ReactDOMContainerInfo = require('./ReactDOMContainerInfo');
|
|
14
16
|
var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
|
|
15
17
|
var ReactElement = require('./ReactElement');
|
|
@@ -36,14 +38,10 @@ function renderToStringImpl(element, makeStaticMarkup) {
|
|
|
36
38
|
transaction = ReactServerRenderingTransaction.getPooled(makeStaticMarkup);
|
|
37
39
|
|
|
38
40
|
return transaction.perform(function () {
|
|
39
|
-
|
|
40
|
-
ReactInstrumentation.debugTool.onBeginFlush();
|
|
41
|
-
}
|
|
42
|
-
var componentInstance = instantiateReactComponent(element);
|
|
41
|
+
var componentInstance = instantiateReactComponent(element, true);
|
|
43
42
|
var markup = ReactReconciler.mountComponent(componentInstance, transaction, null, ReactDOMContainerInfo(), emptyObject);
|
|
44
43
|
if (process.env.NODE_ENV !== 'production') {
|
|
45
44
|
ReactInstrumentation.debugTool.onUnmountComponent(componentInstance._debugID);
|
|
46
|
-
ReactInstrumentation.debugTool.onEndFlush();
|
|
47
45
|
}
|
|
48
46
|
if (!makeStaticMarkup) {
|
|
49
47
|
markup = ReactMarkupChecksum.addChecksumToMarkup(markup);
|
|
@@ -64,7 +62,7 @@ function renderToStringImpl(element, makeStaticMarkup) {
|
|
|
64
62
|
* See https://facebook.github.io/react/docs/top-level-api.html#reactdomserver.rendertostring
|
|
65
63
|
*/
|
|
66
64
|
function renderToString(element) {
|
|
67
|
-
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') :
|
|
65
|
+
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : _prodInvariant('46') : void 0;
|
|
68
66
|
return renderToStringImpl(element, false);
|
|
69
67
|
}
|
|
70
68
|
|
|
@@ -74,7 +72,7 @@ function renderToString(element) {
|
|
|
74
72
|
* See https://facebook.github.io/react/docs/top-level-api.html#reactdomserver.rendertostaticmarkup
|
|
75
73
|
*/
|
|
76
74
|
function renderToStaticMarkup(element) {
|
|
77
|
-
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') :
|
|
75
|
+
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : _prodInvariant('47') : void 0;
|
|
78
76
|
return renderToStringImpl(element, true);
|
|
79
77
|
}
|
|
80
78
|
|
|
@@ -15,6 +15,8 @@ var _assign = require('object-assign');
|
|
|
15
15
|
|
|
16
16
|
var PooledClass = require('./PooledClass');
|
|
17
17
|
var Transaction = require('./Transaction');
|
|
18
|
+
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
19
|
+
var ReactServerUpdateQueue = require('./ReactServerUpdateQueue');
|
|
18
20
|
|
|
19
21
|
/**
|
|
20
22
|
* Executed within the scope of the `Transaction` instance. Consider these as
|
|
@@ -23,6 +25,13 @@ var Transaction = require('./Transaction');
|
|
|
23
25
|
*/
|
|
24
26
|
var TRANSACTION_WRAPPERS = [];
|
|
25
27
|
|
|
28
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
29
|
+
TRANSACTION_WRAPPERS.push({
|
|
30
|
+
initialize: ReactInstrumentation.debugTool.onBeginFlush,
|
|
31
|
+
close: ReactInstrumentation.debugTool.onEndFlush
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
26
35
|
var noopCallbackQueue = {
|
|
27
36
|
enqueue: function () {}
|
|
28
37
|
};
|
|
@@ -35,6 +44,7 @@ function ReactServerRenderingTransaction(renderToStaticMarkup) {
|
|
|
35
44
|
this.reinitializeTransaction();
|
|
36
45
|
this.renderToStaticMarkup = renderToStaticMarkup;
|
|
37
46
|
this.useCreateElement = false;
|
|
47
|
+
this.updateQueue = new ReactServerUpdateQueue(this);
|
|
38
48
|
}
|
|
39
49
|
|
|
40
50
|
var Mixin = {
|
|
@@ -55,6 +65,13 @@ var Mixin = {
|
|
|
55
65
|
return noopCallbackQueue;
|
|
56
66
|
},
|
|
57
67
|
|
|
68
|
+
/**
|
|
69
|
+
* @return {object} The queue to collect React async events.
|
|
70
|
+
*/
|
|
71
|
+
getUpdateQueue: function () {
|
|
72
|
+
return this.updateQueue;
|
|
73
|
+
},
|
|
74
|
+
|
|
58
75
|
/**
|
|
59
76
|
* `PooledClass` looks for this, and will invoke this before allowing this
|
|
60
77
|
* instance to be reused.
|