react-test-renderer 16.0.0-beta.5 → 16.0.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.
- package/LICENSE +16 -26
- package/cjs/react-test-renderer-shallow.development.js +16 -14
- package/cjs/react-test-renderer.development.js +210 -238
- package/package.json +4 -5
- package/PATENTS +0 -33
package/LICENSE
CHANGED
|
@@ -1,31 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
For React software
|
|
1
|
+
MIT License
|
|
4
2
|
|
|
5
3
|
Copyright (c) 2013-present, Facebook, Inc.
|
|
6
|
-
All rights reserved.
|
|
7
|
-
|
|
8
|
-
Redistribution and use in source and binary forms, with or without modification,
|
|
9
|
-
are permitted provided that the following conditions are met:
|
|
10
|
-
|
|
11
|
-
* Redistributions of source code must retain the above copyright notice, this
|
|
12
|
-
list of conditions and the following disclaimer.
|
|
13
4
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
17
11
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
prior written permission.
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
21
14
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
30
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
31
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/** @license React v16.0.0
|
|
2
|
+
* react-test-renderer-shallow.development.js
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
1
9
|
'use strict';
|
|
2
10
|
|
|
3
11
|
|
|
@@ -14,23 +22,19 @@ var invariant = require('fbjs/lib/invariant');
|
|
|
14
22
|
|
|
15
23
|
/**
|
|
16
24
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
17
|
-
* All rights reserved.
|
|
18
25
|
*
|
|
19
|
-
* This source code is licensed under the
|
|
20
|
-
* LICENSE file in the root directory of this source tree.
|
|
21
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
26
|
+
* This source code is licensed under the MIT license found in the
|
|
27
|
+
* LICENSE file in the root directory of this source tree.
|
|
22
28
|
*
|
|
23
29
|
* @providesModule reactProdInvariant
|
|
24
30
|
*
|
|
25
31
|
*/
|
|
26
32
|
|
|
27
33
|
/**
|
|
28
|
-
* Copyright 2016-present, Facebook, Inc.
|
|
29
|
-
* All rights reserved.
|
|
34
|
+
* Copyright (c) 2016-present, Facebook, Inc.
|
|
30
35
|
*
|
|
31
|
-
* This source code is licensed under the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
36
|
+
* This source code is licensed under the MIT license found in the
|
|
37
|
+
* LICENSE file in the root directory of this source tree.
|
|
34
38
|
*
|
|
35
39
|
*
|
|
36
40
|
* @providesModule describeComponentFrame
|
|
@@ -41,12 +45,10 @@ var describeComponentFrame = function (name, source, ownerName) {
|
|
|
41
45
|
};
|
|
42
46
|
|
|
43
47
|
/**
|
|
44
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
45
|
-
* All rights reserved.
|
|
48
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
46
49
|
*
|
|
47
|
-
* This source code is licensed under the
|
|
48
|
-
* LICENSE file in the root directory of this source tree.
|
|
49
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
50
|
+
* This source code is licensed under the MIT license found in the
|
|
51
|
+
* LICENSE file in the root directory of this source tree.
|
|
50
52
|
*
|
|
51
53
|
* @providesModule getComponentName
|
|
52
54
|
*
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/** @license React v16.0.0
|
|
2
|
+
* react-test-renderer.development.js
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
1
9
|
'use strict';
|
|
2
10
|
|
|
3
11
|
|
|
@@ -16,42 +24,35 @@ var shallowEqual = require('fbjs/lib/shallowEqual');
|
|
|
16
24
|
|
|
17
25
|
/**
|
|
18
26
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
19
|
-
* All rights reserved.
|
|
20
27
|
*
|
|
21
|
-
* This source code is licensed under the
|
|
22
|
-
* LICENSE file in the root directory of this source tree.
|
|
23
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
28
|
+
* This source code is licensed under the MIT license found in the
|
|
29
|
+
* LICENSE file in the root directory of this source tree.
|
|
24
30
|
*
|
|
25
31
|
* @providesModule reactProdInvariant
|
|
26
32
|
*
|
|
27
33
|
*/
|
|
28
34
|
|
|
29
35
|
/**
|
|
30
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
31
|
-
* All rights reserved.
|
|
36
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
32
37
|
*
|
|
33
|
-
* This source code is licensed under the
|
|
34
|
-
* LICENSE file in the root directory of this source tree.
|
|
35
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
38
|
+
* This source code is licensed under the MIT license found in the
|
|
39
|
+
* LICENSE file in the root directory of this source tree.
|
|
36
40
|
*
|
|
37
41
|
* @providesModule ReactFeatureFlags
|
|
38
42
|
*
|
|
39
43
|
*/
|
|
40
44
|
|
|
41
45
|
var ReactFeatureFlags = {
|
|
42
|
-
|
|
43
|
-
enableAsyncSubtreeAPI: false
|
|
46
|
+
enableAsyncSubtreeAPI: true
|
|
44
47
|
};
|
|
45
48
|
|
|
46
49
|
var ReactFeatureFlags_1 = ReactFeatureFlags;
|
|
47
50
|
|
|
48
51
|
/**
|
|
49
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
50
|
-
* All rights reserved.
|
|
52
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
51
53
|
*
|
|
52
|
-
* This source code is licensed under the
|
|
53
|
-
* LICENSE file in the root directory of this source tree.
|
|
54
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
54
|
+
* This source code is licensed under the MIT license found in the
|
|
55
|
+
* LICENSE file in the root directory of this source tree.
|
|
55
56
|
*
|
|
56
57
|
* @providesModule ReactTypeOfSideEffect
|
|
57
58
|
*
|
|
@@ -72,12 +73,10 @@ var ReactTypeOfSideEffect = {
|
|
|
72
73
|
Ref: 128 };
|
|
73
74
|
|
|
74
75
|
/**
|
|
75
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
76
|
-
* All rights reserved.
|
|
76
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
77
77
|
*
|
|
78
|
-
* This source code is licensed under the
|
|
79
|
-
* LICENSE file in the root directory of this source tree.
|
|
80
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
78
|
+
* This source code is licensed under the MIT license found in the
|
|
79
|
+
* LICENSE file in the root directory of this source tree.
|
|
81
80
|
*
|
|
82
81
|
* @providesModule ReactPriorityLevel
|
|
83
82
|
*
|
|
@@ -92,12 +91,10 @@ var ReactPriorityLevel = {
|
|
|
92
91
|
OffscreenPriority: 5 };
|
|
93
92
|
|
|
94
93
|
/**
|
|
95
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
96
|
-
* All rights reserved.
|
|
94
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
97
95
|
*
|
|
98
|
-
* This source code is licensed under the
|
|
99
|
-
* LICENSE file in the root directory of this source tree.
|
|
100
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
96
|
+
* This source code is licensed under the MIT license found in the
|
|
97
|
+
* LICENSE file in the root directory of this source tree.
|
|
101
98
|
*
|
|
102
99
|
* @providesModule ReactTypeOfWork
|
|
103
100
|
*
|
|
@@ -147,6 +144,9 @@ var HostRoot$1 = ReactTypeOfWork.HostRoot;
|
|
|
147
144
|
// When the tree is committed, the work-in-progress becomes the current.
|
|
148
145
|
|
|
149
146
|
|
|
147
|
+
var _queue1 = void 0;
|
|
148
|
+
var _queue2 = void 0;
|
|
149
|
+
|
|
150
150
|
function comparePriority(a, b) {
|
|
151
151
|
// When comparing update priorities, treat sync and Task work as equal.
|
|
152
152
|
// TODO: Could we avoid the need for this by always coercing sync priority
|
|
@@ -243,10 +243,9 @@ function ensureUpdateQueues(fiber) {
|
|
|
243
243
|
queue2 = null;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
|
|
247
|
-
return [queue1,
|
|
246
|
+
_queue1 = queue1;
|
|
248
247
|
// Return null if there is no alternate queue, or if its queue is the same.
|
|
249
|
-
queue2 !== queue1 ? queue2 : null
|
|
248
|
+
_queue2 = queue2 !== queue1 ? queue2 : null;
|
|
250
249
|
}
|
|
251
250
|
|
|
252
251
|
// The work-in-progress queue is a subset of the current queue (if it exists).
|
|
@@ -280,13 +279,11 @@ function ensureUpdateQueues(fiber) {
|
|
|
280
279
|
// If the update is cloned, it returns the cloned update.
|
|
281
280
|
function insertUpdate(fiber, update) {
|
|
282
281
|
// We'll have at least one and at most two distinct update queues.
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
282
|
+
ensureUpdateQueues(fiber);
|
|
283
|
+
var queue1 = _queue1;
|
|
284
|
+
var queue2 = _queue2;
|
|
286
285
|
|
|
287
286
|
// Warn if an update is scheduled from inside an updater function.
|
|
288
|
-
|
|
289
|
-
|
|
290
287
|
{
|
|
291
288
|
if (queue1.isProcessing || queue2 !== null && queue2.isProcessing) {
|
|
292
289
|
warning$1(false, 'An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.');
|
|
@@ -404,14 +401,12 @@ function addTopLevelUpdate$1(fiber, partialState, callback, priorityLevel) {
|
|
|
404
401
|
|
|
405
402
|
if (isTopLevelUnmount) {
|
|
406
403
|
// TODO: Redesign the top-level mount/update/unmount API to avoid this
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
404
|
+
// special case.
|
|
405
|
+
var queue1 = _queue1;
|
|
406
|
+
var queue2 = _queue2;
|
|
410
407
|
|
|
411
408
|
// Drop all updates that are lower-priority, so that the tree is not
|
|
412
409
|
// remounted. We need to do this for both queues.
|
|
413
|
-
|
|
414
|
-
|
|
415
410
|
if (queue1 !== null && update.next !== null) {
|
|
416
411
|
update.next = null;
|
|
417
412
|
queue1.last = update;
|
|
@@ -545,12 +540,10 @@ var ReactFiberUpdateQueue = {
|
|
|
545
540
|
};
|
|
546
541
|
|
|
547
542
|
/**
|
|
548
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
549
|
-
* All rights reserved.
|
|
543
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
550
544
|
*
|
|
551
|
-
* This source code is licensed under the
|
|
552
|
-
* LICENSE file in the root directory of this source tree.
|
|
553
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
545
|
+
* This source code is licensed under the MIT license found in the
|
|
546
|
+
* LICENSE file in the root directory of this source tree.
|
|
554
547
|
*
|
|
555
548
|
* @providesModule getComponentName
|
|
556
549
|
*
|
|
@@ -580,12 +573,10 @@ function getComponentName$1(instanceOrFiber) {
|
|
|
580
573
|
var getComponentName_1 = getComponentName$1;
|
|
581
574
|
|
|
582
575
|
/**
|
|
583
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
584
|
-
* All rights reserved.
|
|
576
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
585
577
|
*
|
|
586
|
-
* This source code is licensed under the
|
|
587
|
-
* LICENSE file in the root directory of this source tree.
|
|
588
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
578
|
+
* This source code is licensed under the MIT license found in the
|
|
579
|
+
* LICENSE file in the root directory of this source tree.
|
|
589
580
|
*
|
|
590
581
|
* @providesModule ReactInstanceMap
|
|
591
582
|
*/
|
|
@@ -606,19 +597,19 @@ var ReactInstanceMap = {
|
|
|
606
597
|
* supported we can rename it.
|
|
607
598
|
*/
|
|
608
599
|
remove: function (key) {
|
|
609
|
-
key.
|
|
600
|
+
key._reactInternalFiber = undefined;
|
|
610
601
|
},
|
|
611
602
|
|
|
612
603
|
get: function (key) {
|
|
613
|
-
return key.
|
|
604
|
+
return key._reactInternalFiber;
|
|
614
605
|
},
|
|
615
606
|
|
|
616
607
|
has: function (key) {
|
|
617
|
-
return key.
|
|
608
|
+
return key._reactInternalFiber !== undefined;
|
|
618
609
|
},
|
|
619
610
|
|
|
620
611
|
set: function (key, value) {
|
|
621
|
-
key.
|
|
612
|
+
key._reactInternalFiber = value;
|
|
622
613
|
}
|
|
623
614
|
};
|
|
624
615
|
|
|
@@ -982,12 +973,10 @@ var ReactFiberStack = {
|
|
|
982
973
|
};
|
|
983
974
|
|
|
984
975
|
/**
|
|
985
|
-
* Copyright 2016-present, Facebook, Inc.
|
|
986
|
-
* All rights reserved.
|
|
976
|
+
* Copyright (c) 2016-present, Facebook, Inc.
|
|
987
977
|
*
|
|
988
|
-
* This source code is licensed under the
|
|
989
|
-
* LICENSE file in the root directory of this source tree.
|
|
990
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
978
|
+
* This source code is licensed under the MIT license found in the
|
|
979
|
+
* LICENSE file in the root directory of this source tree.
|
|
991
980
|
*
|
|
992
981
|
*
|
|
993
982
|
* @providesModule describeComponentFrame
|
|
@@ -1102,12 +1091,10 @@ var ReactDebugCurrentFiber_1 = ReactDebugCurrentFiber$2;
|
|
|
1102
1091
|
|
|
1103
1092
|
// Trust the developer to only use this with a true check
|
|
1104
1093
|
/**
|
|
1105
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
1106
|
-
* All rights reserved.
|
|
1094
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1107
1095
|
*
|
|
1108
|
-
* This source code is licensed under the
|
|
1109
|
-
* LICENSE file in the root directory of this source tree.
|
|
1110
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1096
|
+
* This source code is licensed under the MIT license found in the
|
|
1097
|
+
* LICENSE file in the root directory of this source tree.
|
|
1111
1098
|
*
|
|
1112
1099
|
* @providesModule ReactDebugFiberPerf
|
|
1113
1100
|
*
|
|
@@ -1562,6 +1549,11 @@ function popContextProvider(fiber) {
|
|
|
1562
1549
|
}
|
|
1563
1550
|
var popContextProvider_1 = popContextProvider;
|
|
1564
1551
|
|
|
1552
|
+
var popTopLevelContextObject = function (fiber) {
|
|
1553
|
+
pop(didPerformWorkStackCursor, fiber);
|
|
1554
|
+
pop(contextStackCursor, fiber);
|
|
1555
|
+
};
|
|
1556
|
+
|
|
1565
1557
|
var pushTopLevelContextObject = function (fiber, context, didChange) {
|
|
1566
1558
|
!(contextStackCursor.cursor == null) ? invariant(false, 'Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.') : void 0;
|
|
1567
1559
|
|
|
@@ -1690,6 +1682,7 @@ var ReactFiberContext = {
|
|
|
1690
1682
|
isContextConsumer: isContextConsumer_1,
|
|
1691
1683
|
isContextProvider: isContextProvider_1,
|
|
1692
1684
|
popContextProvider: popContextProvider_1,
|
|
1685
|
+
popTopLevelContextObject: popTopLevelContextObject,
|
|
1693
1686
|
pushTopLevelContextObject: pushTopLevelContextObject,
|
|
1694
1687
|
processChildContext: processChildContext_1,
|
|
1695
1688
|
pushContextProvider: pushContextProvider,
|
|
@@ -1699,12 +1692,10 @@ var ReactFiberContext = {
|
|
|
1699
1692
|
};
|
|
1700
1693
|
|
|
1701
1694
|
/**
|
|
1702
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
1703
|
-
* All rights reserved.
|
|
1695
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1704
1696
|
*
|
|
1705
|
-
* This source code is licensed under the
|
|
1706
|
-
* LICENSE file in the root directory of this source tree.
|
|
1707
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
1697
|
+
* This source code is licensed under the MIT license found in the
|
|
1698
|
+
* LICENSE file in the root directory of this source tree.
|
|
1708
1699
|
*
|
|
1709
1700
|
* @providesModule ReactTypeOfInternalContext
|
|
1710
1701
|
*
|
|
@@ -1735,7 +1726,6 @@ var NoEffect$1 = ReactTypeOfSideEffect.NoEffect;
|
|
|
1735
1726
|
|
|
1736
1727
|
{
|
|
1737
1728
|
var getComponentName$5 = getComponentName_1;
|
|
1738
|
-
|
|
1739
1729
|
var hasBadMapPolyfill = false;
|
|
1740
1730
|
try {
|
|
1741
1731
|
var nonExtensibleObject = Object.preventExtensions({});
|
|
@@ -1757,69 +1747,66 @@ var NoEffect$1 = ReactTypeOfSideEffect.NoEffect;
|
|
|
1757
1747
|
var debugCounter = 1;
|
|
1758
1748
|
}
|
|
1759
1749
|
|
|
1760
|
-
|
|
1761
|
-
//
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
// always know when it is a fiber.
|
|
1767
|
-
// 3) We can easily go from a createFiber call to calling a constructor if that
|
|
1768
|
-
// is faster. The opposite is not true.
|
|
1769
|
-
// 4) We might want to experiment with using numeric keys since they are easier
|
|
1770
|
-
// to optimize in a non-JIT environment.
|
|
1771
|
-
// 5) It should be easy to port this to a C struct and keep a C implementation
|
|
1772
|
-
// compatible.
|
|
1773
|
-
var createFiber = function (tag, key, internalContextTag) {
|
|
1774
|
-
var fiber = {
|
|
1775
|
-
// Instance
|
|
1750
|
+
function FiberNode(tag, key, internalContextTag) {
|
|
1751
|
+
// Instance
|
|
1752
|
+
this.tag = tag;
|
|
1753
|
+
this.key = key;
|
|
1754
|
+
this.type = null;
|
|
1755
|
+
this.stateNode = null;
|
|
1776
1756
|
|
|
1777
|
-
|
|
1757
|
+
// Fiber
|
|
1758
|
+
this['return'] = null;
|
|
1759
|
+
this.child = null;
|
|
1760
|
+
this.sibling = null;
|
|
1761
|
+
this.index = 0;
|
|
1778
1762
|
|
|
1779
|
-
|
|
1763
|
+
this.ref = null;
|
|
1780
1764
|
|
|
1781
|
-
|
|
1765
|
+
this.pendingProps = null;
|
|
1766
|
+
this.memoizedProps = null;
|
|
1767
|
+
this.updateQueue = null;
|
|
1768
|
+
this.memoizedState = null;
|
|
1782
1769
|
|
|
1783
|
-
|
|
1770
|
+
this.internalContextTag = internalContextTag;
|
|
1784
1771
|
|
|
1785
|
-
|
|
1772
|
+
// Effects
|
|
1773
|
+
this.effectTag = NoEffect$1;
|
|
1774
|
+
this.nextEffect = null;
|
|
1786
1775
|
|
|
1787
|
-
|
|
1776
|
+
this.firstEffect = null;
|
|
1777
|
+
this.lastEffect = null;
|
|
1788
1778
|
|
|
1789
|
-
|
|
1790
|
-
sibling: null,
|
|
1791
|
-
index: 0,
|
|
1779
|
+
this.pendingWorkPriority = NoWork$1;
|
|
1792
1780
|
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
pendingProps: null,
|
|
1796
|
-
memoizedProps: null,
|
|
1797
|
-
updateQueue: null,
|
|
1798
|
-
memoizedState: null,
|
|
1799
|
-
|
|
1800
|
-
internalContextTag: internalContextTag,
|
|
1801
|
-
|
|
1802
|
-
effectTag: NoEffect$1,
|
|
1803
|
-
nextEffect: null,
|
|
1804
|
-
firstEffect: null,
|
|
1805
|
-
lastEffect: null,
|
|
1806
|
-
|
|
1807
|
-
pendingWorkPriority: NoWork$1,
|
|
1808
|
-
|
|
1809
|
-
alternate: null
|
|
1810
|
-
};
|
|
1781
|
+
this.alternate = null;
|
|
1811
1782
|
|
|
1812
1783
|
{
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1784
|
+
this._debugID = debugCounter++;
|
|
1785
|
+
this._debugSource = null;
|
|
1786
|
+
this._debugOwner = null;
|
|
1787
|
+
this._debugIsCurrentlyTiming = false;
|
|
1817
1788
|
if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') {
|
|
1818
|
-
Object.preventExtensions(
|
|
1789
|
+
Object.preventExtensions(this);
|
|
1819
1790
|
}
|
|
1820
1791
|
}
|
|
1792
|
+
}
|
|
1821
1793
|
|
|
1822
|
-
|
|
1794
|
+
// This is a constructor function, rather than a POJO constructor, still
|
|
1795
|
+
// please ensure we do the following:
|
|
1796
|
+
// 1) Nobody should add any instance methods on this. Instance methods can be
|
|
1797
|
+
// more difficult to predict when they get optimized and they are almost
|
|
1798
|
+
// never inlined properly in static compilers.
|
|
1799
|
+
// 2) Nobody should rely on `instanceof Fiber` for type testing. We should
|
|
1800
|
+
// always know when it is a fiber.
|
|
1801
|
+
// 3) We might want to experiment with using numeric keys since they are easier
|
|
1802
|
+
// to optimize in a non-JIT environment.
|
|
1803
|
+
// 4) We can easily go from a constructor to a createFiber object literal if that
|
|
1804
|
+
// is faster.
|
|
1805
|
+
// 5) It should be easy to port this to a C struct and keep a C implementation
|
|
1806
|
+
// compatible.
|
|
1807
|
+
var createFiber = function (tag, key, internalContextTag) {
|
|
1808
|
+
// $FlowFixMe: the shapes are exact here but Flow doesn't like constructors
|
|
1809
|
+
return new FiberNode(tag, key, internalContextTag);
|
|
1823
1810
|
};
|
|
1824
1811
|
|
|
1825
1812
|
function shouldConstruct(Component) {
|
|
@@ -1851,7 +1838,7 @@ var createWorkInProgress = function (current, renderPriority) {
|
|
|
1851
1838
|
} else {
|
|
1852
1839
|
// We already have an alternate.
|
|
1853
1840
|
// Reset the effect tag.
|
|
1854
|
-
workInProgress.effectTag =
|
|
1841
|
+
workInProgress.effectTag = NoEffect$1;
|
|
1855
1842
|
|
|
1856
1843
|
// The effect list is no longer valid.
|
|
1857
1844
|
workInProgress.nextEffect = null;
|
|
@@ -2266,7 +2253,7 @@ var invokeGuardedCallback$1 = function (name, func, context, a, b, c, d, e, f) {
|
|
|
2266
2253
|
// The callback errored, but the error event never fired.
|
|
2267
2254
|
error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.');
|
|
2268
2255
|
} else if (isCrossOriginError) {
|
|
2269
|
-
error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error
|
|
2256
|
+
error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.');
|
|
2270
2257
|
}
|
|
2271
2258
|
ReactErrorUtils._hasCaughtError = true;
|
|
2272
2259
|
ReactErrorUtils._caughtError = error;
|
|
@@ -2295,12 +2282,10 @@ var rethrowCaughtError = function () {
|
|
|
2295
2282
|
var ReactErrorUtils_1 = ReactErrorUtils;
|
|
2296
2283
|
|
|
2297
2284
|
/**
|
|
2298
|
-
* Copyright 2014-present, Facebook, Inc.
|
|
2299
|
-
* All rights reserved.
|
|
2285
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
2300
2286
|
*
|
|
2301
|
-
* This source code is licensed under the
|
|
2302
|
-
* LICENSE file in the root directory of this source tree.
|
|
2303
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
2287
|
+
* This source code is licensed under the MIT license found in the
|
|
2288
|
+
* LICENSE file in the root directory of this source tree.
|
|
2304
2289
|
*
|
|
2305
2290
|
* @providesModule ReactCoroutine
|
|
2306
2291
|
*
|
|
@@ -2385,12 +2370,10 @@ var ReactCoroutine = {
|
|
|
2385
2370
|
};
|
|
2386
2371
|
|
|
2387
2372
|
/**
|
|
2388
|
-
* Copyright 2014-present, Facebook, Inc.
|
|
2389
|
-
* All rights reserved.
|
|
2373
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
2390
2374
|
*
|
|
2391
|
-
* This source code is licensed under the
|
|
2392
|
-
* LICENSE file in the root directory of this source tree.
|
|
2393
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
2375
|
+
* This source code is licensed under the MIT license found in the
|
|
2376
|
+
* LICENSE file in the root directory of this source tree.
|
|
2394
2377
|
*
|
|
2395
2378
|
* @providesModule ReactPortal
|
|
2396
2379
|
*
|
|
@@ -2442,7 +2425,6 @@ var REACT_PORTAL_TYPE = ReactPortal.REACT_PORTAL_TYPE;
|
|
|
2442
2425
|
|
|
2443
2426
|
|
|
2444
2427
|
|
|
2445
|
-
|
|
2446
2428
|
{
|
|
2447
2429
|
var _require3$2 = ReactDebugCurrentFiber_1,
|
|
2448
2430
|
getCurrentFiberStackAddendum$1 = _require3$2.getCurrentFiberStackAddendum;
|
|
@@ -2842,8 +2824,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
|
|
2842
2824
|
}
|
|
2843
2825
|
|
|
2844
2826
|
{
|
|
2845
|
-
|
|
2846
|
-
if (!disableNewFiberFeatures && typeof newChild === 'function') {
|
|
2827
|
+
if (typeof newChild === 'function') {
|
|
2847
2828
|
warnOnFunctionType();
|
|
2848
2829
|
}
|
|
2849
2830
|
}
|
|
@@ -2921,8 +2902,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
|
|
2921
2902
|
}
|
|
2922
2903
|
|
|
2923
2904
|
{
|
|
2924
|
-
|
|
2925
|
-
if (!disableNewFiberFeatures && typeof newChild === 'function') {
|
|
2905
|
+
if (typeof newChild === 'function') {
|
|
2926
2906
|
warnOnFunctionType();
|
|
2927
2907
|
}
|
|
2928
2908
|
}
|
|
@@ -2976,8 +2956,7 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
|
|
2976
2956
|
}
|
|
2977
2957
|
|
|
2978
2958
|
{
|
|
2979
|
-
|
|
2980
|
-
if (!disableNewFiberFeatures && typeof newChild === 'function') {
|
|
2959
|
+
if (typeof newChild === 'function') {
|
|
2981
2960
|
warnOnFunctionType();
|
|
2982
2961
|
}
|
|
2983
2962
|
}
|
|
@@ -3444,63 +3423,23 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
|
|
3444
3423
|
// not as a fragment. Nested arrays on the other hand will be treated as
|
|
3445
3424
|
// fragment nodes. Recursion happens at the normal flow.
|
|
3446
3425
|
|
|
3447
|
-
var disableNewFiberFeatures = ReactFeatureFlags_1.disableNewFiberFeatures;
|
|
3448
|
-
|
|
3449
3426
|
// Handle object types
|
|
3450
3427
|
var isObject = typeof newChild === 'object' && newChild !== null;
|
|
3451
3428
|
if (isObject) {
|
|
3452
3429
|
// Support only the subset of return types that Stack supports. Treat
|
|
3453
3430
|
// everything else as empty, but log a warning.
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, priority));
|
|
3458
|
-
|
|
3459
|
-
case REACT_PORTAL_TYPE:
|
|
3460
|
-
return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, priority));
|
|
3461
|
-
}
|
|
3462
|
-
} else {
|
|
3463
|
-
switch (newChild.$$typeof) {
|
|
3464
|
-
case REACT_ELEMENT_TYPE:
|
|
3465
|
-
return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, priority));
|
|
3466
|
-
|
|
3467
|
-
case REACT_COROUTINE_TYPE:
|
|
3468
|
-
return placeSingleChild(reconcileSingleCoroutine(returnFiber, currentFirstChild, newChild, priority));
|
|
3431
|
+
switch (newChild.$$typeof) {
|
|
3432
|
+
case REACT_ELEMENT_TYPE:
|
|
3433
|
+
return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, priority));
|
|
3469
3434
|
|
|
3470
|
-
|
|
3471
|
-
|
|
3435
|
+
case REACT_COROUTINE_TYPE:
|
|
3436
|
+
return placeSingleChild(reconcileSingleCoroutine(returnFiber, currentFirstChild, newChild, priority));
|
|
3472
3437
|
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
}
|
|
3476
|
-
}
|
|
3477
|
-
}
|
|
3438
|
+
case REACT_YIELD_TYPE:
|
|
3439
|
+
return placeSingleChild(reconcileSingleYield(returnFiber, currentFirstChild, newChild, priority));
|
|
3478
3440
|
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
// and the return fiber is a composite component, throw an error.
|
|
3482
|
-
switch (returnFiber.tag) {
|
|
3483
|
-
case ClassComponent$8:
|
|
3484
|
-
{
|
|
3485
|
-
{
|
|
3486
|
-
var instance = returnFiber.stateNode;
|
|
3487
|
-
if (instance.render._isMockFunction && typeof newChild === 'undefined') {
|
|
3488
|
-
// We allow auto-mocks to proceed as if they're
|
|
3489
|
-
// returning null.
|
|
3490
|
-
break;
|
|
3491
|
-
}
|
|
3492
|
-
}
|
|
3493
|
-
var Component = returnFiber.type;
|
|
3494
|
-
!(newChild === null || newChild === false) ? invariant(false, '%s.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', Component.displayName || Component.name || 'Component') : void 0;
|
|
3495
|
-
break;
|
|
3496
|
-
}
|
|
3497
|
-
case FunctionalComponent$3:
|
|
3498
|
-
{
|
|
3499
|
-
// Composites accept elements, portals, null, or false
|
|
3500
|
-
var _Component = returnFiber.type;
|
|
3501
|
-
!(newChild === null || newChild === false) ? invariant(false, '%s(...): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.', _Component.displayName || _Component.name || 'Component') : void 0;
|
|
3502
|
-
break;
|
|
3503
|
-
}
|
|
3441
|
+
case REACT_PORTAL_TYPE:
|
|
3442
|
+
return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, priority));
|
|
3504
3443
|
}
|
|
3505
3444
|
}
|
|
3506
3445
|
|
|
@@ -3521,11 +3460,11 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
|
|
3521
3460
|
}
|
|
3522
3461
|
|
|
3523
3462
|
{
|
|
3524
|
-
if (
|
|
3463
|
+
if (typeof newChild === 'function') {
|
|
3525
3464
|
warnOnFunctionType();
|
|
3526
3465
|
}
|
|
3527
3466
|
}
|
|
3528
|
-
if (
|
|
3467
|
+
if (typeof newChild === 'undefined') {
|
|
3529
3468
|
// If the new child is undefined, and the return fiber is a composite
|
|
3530
3469
|
// component, throw an error. If Fiber return types are disabled,
|
|
3531
3470
|
// we already threw above.
|
|
@@ -3533,8 +3472,8 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
|
|
3533
3472
|
case ClassComponent$8:
|
|
3534
3473
|
{
|
|
3535
3474
|
{
|
|
3536
|
-
var
|
|
3537
|
-
if (
|
|
3475
|
+
var instance = returnFiber.stateNode;
|
|
3476
|
+
if (instance.render._isMockFunction) {
|
|
3538
3477
|
// We allow auto-mocks to proceed as if they're returning null.
|
|
3539
3478
|
break;
|
|
3540
3479
|
}
|
|
@@ -3545,8 +3484,8 @@ function ChildReconciler(shouldClone, shouldTrackSideEffects) {
|
|
|
3545
3484
|
// eslint-disable-next-lined no-fallthrough
|
|
3546
3485
|
case FunctionalComponent$3:
|
|
3547
3486
|
{
|
|
3548
|
-
var
|
|
3549
|
-
invariant(false, '%s(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.',
|
|
3487
|
+
var Component = returnFiber.type;
|
|
3488
|
+
invariant(false, '%s(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.', Component.displayName || Component.name || 'Component');
|
|
3550
3489
|
}
|
|
3551
3490
|
}
|
|
3552
3491
|
}
|
|
@@ -3621,6 +3560,7 @@ var isMounted$1 = ReactFiberTreeReflection.isMounted;
|
|
|
3621
3560
|
|
|
3622
3561
|
|
|
3623
3562
|
|
|
3563
|
+
var fakeInternalInstance = {};
|
|
3624
3564
|
var isArray$1 = Array.isArray;
|
|
3625
3565
|
|
|
3626
3566
|
{
|
|
@@ -3632,6 +3572,19 @@ var isArray$1 = Array.isArray;
|
|
|
3632
3572
|
var warnOnInvalidCallback = function (callback, callerName) {
|
|
3633
3573
|
warning$8(callback === null || typeof callback === 'function', '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback);
|
|
3634
3574
|
};
|
|
3575
|
+
|
|
3576
|
+
// This is so gross but it's at least non-critical and can be removed if
|
|
3577
|
+
// it causes problems. This is meant to give a nicer error message for
|
|
3578
|
+
// ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component,
|
|
3579
|
+
// ...)) which otherwise throws a "_processChildContext is not a function"
|
|
3580
|
+
// exception.
|
|
3581
|
+
Object.defineProperty(fakeInternalInstance, '_processChildContext', {
|
|
3582
|
+
enumerable: false,
|
|
3583
|
+
value: function () {
|
|
3584
|
+
invariant(false, '_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn\'t supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).');
|
|
3585
|
+
}
|
|
3586
|
+
});
|
|
3587
|
+
Object.freeze(fakeInternalInstance);
|
|
3635
3588
|
}
|
|
3636
3589
|
|
|
3637
3590
|
var ReactFiberClassComponent = function (scheduleUpdate, getPriorityContext, memoizeProps, memoizeState) {
|
|
@@ -3750,6 +3703,9 @@ var ReactFiberClassComponent = function (scheduleUpdate, getPriorityContext, mem
|
|
|
3750
3703
|
workInProgress.stateNode = instance;
|
|
3751
3704
|
// The instance needs access to the fiber so that it can schedule updates
|
|
3752
3705
|
ReactInstanceMap_1.set(instance, workInProgress);
|
|
3706
|
+
{
|
|
3707
|
+
instance._reactInternalInstance = fakeInternalInstance;
|
|
3708
|
+
}
|
|
3753
3709
|
}
|
|
3754
3710
|
|
|
3755
3711
|
function constructClassInstance(workInProgress, props) {
|
|
@@ -4265,7 +4221,7 @@ var ReactFiberBeginWork = function (config, hostContext, hydrationContext, sched
|
|
|
4265
4221
|
return workInProgress.child;
|
|
4266
4222
|
}
|
|
4267
4223
|
|
|
4268
|
-
function
|
|
4224
|
+
function pushHostRootContext(workInProgress) {
|
|
4269
4225
|
var root = workInProgress.stateNode;
|
|
4270
4226
|
if (root.pendingContext) {
|
|
4271
4227
|
pushTopLevelContextObject$1(workInProgress, root.pendingContext, root.pendingContext !== root.context);
|
|
@@ -4273,9 +4229,11 @@ var ReactFiberBeginWork = function (config, hostContext, hydrationContext, sched
|
|
|
4273
4229
|
// Should always be set
|
|
4274
4230
|
pushTopLevelContextObject$1(workInProgress, root.context, false);
|
|
4275
4231
|
}
|
|
4276
|
-
|
|
4277
4232
|
pushHostContainer(workInProgress, root.containerInfo);
|
|
4233
|
+
}
|
|
4278
4234
|
|
|
4235
|
+
function updateHostRoot(current, workInProgress, priorityLevel) {
|
|
4236
|
+
pushHostRootContext(workInProgress);
|
|
4279
4237
|
var updateQueue = workInProgress.updateQueue;
|
|
4280
4238
|
if (updateQueue !== null) {
|
|
4281
4239
|
var prevState = workInProgress.memoizedState;
|
|
@@ -4559,6 +4517,9 @@ var ReactFiberBeginWork = function (config, hostContext, hydrationContext, sched
|
|
|
4559
4517
|
// TODO: Handle HostComponent tags here as well and call pushHostContext()?
|
|
4560
4518
|
// See PR 8590 discussion for context
|
|
4561
4519
|
switch (workInProgress.tag) {
|
|
4520
|
+
case HostRoot$7:
|
|
4521
|
+
pushHostRootContext(workInProgress);
|
|
4522
|
+
break;
|
|
4562
4523
|
case ClassComponent$7:
|
|
4563
4524
|
pushContextProvider$1(workInProgress);
|
|
4564
4525
|
break;
|
|
@@ -4630,8 +4591,7 @@ var ReactFiberBeginWork = function (config, hostContext, hydrationContext, sched
|
|
|
4630
4591
|
pushContextProvider$1(workInProgress);
|
|
4631
4592
|
break;
|
|
4632
4593
|
case HostRoot$7:
|
|
4633
|
-
|
|
4634
|
-
pushHostContainer(workInProgress, root.containerInfo);
|
|
4594
|
+
pushHostRootContext(workInProgress);
|
|
4635
4595
|
break;
|
|
4636
4596
|
default:
|
|
4637
4597
|
invariant(false, 'Invalid type of work. This error is likely caused by a bug in React. Please file an issue.');
|
|
@@ -4682,6 +4642,7 @@ var ReactFiberBeginWork = function (config, hostContext, hydrationContext, sched
|
|
|
4682
4642
|
var reconcileChildFibers$2 = ReactChildFiber.reconcileChildFibers;
|
|
4683
4643
|
|
|
4684
4644
|
var popContextProvider$2 = ReactFiberContext.popContextProvider;
|
|
4645
|
+
var popTopLevelContextObject$1 = ReactFiberContext.popTopLevelContextObject;
|
|
4685
4646
|
|
|
4686
4647
|
|
|
4687
4648
|
|
|
@@ -4841,7 +4802,8 @@ var ReactFiberCompleteWork = function (config, hostContext, hydrationContext) {
|
|
|
4841
4802
|
}
|
|
4842
4803
|
case HostRoot$8:
|
|
4843
4804
|
{
|
|
4844
|
-
|
|
4805
|
+
popHostContainer(workInProgress);
|
|
4806
|
+
popTopLevelContextObject$1(workInProgress);
|
|
4845
4807
|
var fiberRoot = workInProgress.stateNode;
|
|
4846
4808
|
if (fiberRoot.pendingContext) {
|
|
4847
4809
|
fiberRoot.context = fiberRoot.pendingContext;
|
|
@@ -4901,7 +4863,7 @@ var ReactFiberCompleteWork = function (config, hostContext, hydrationContext) {
|
|
|
4901
4863
|
if (wasHydrated) {
|
|
4902
4864
|
// TOOD: Move this and createInstance step into the beginPhase
|
|
4903
4865
|
// to consolidate.
|
|
4904
|
-
if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance)) {
|
|
4866
|
+
if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, _currentHostContext)) {
|
|
4905
4867
|
// If changes to the hydrated node needs to be applied at the
|
|
4906
4868
|
// commit-phase we mark this as such.
|
|
4907
4869
|
markUpdate(workInProgress);
|
|
@@ -5106,6 +5068,8 @@ var ReactFiberCommitWork = function (config, captureError) {
|
|
|
5106
5068
|
{
|
|
5107
5069
|
var callComponentWillUnmountWithTimerInDev = function (current, instance) {
|
|
5108
5070
|
startPhaseTimer$2(current, 'componentWillUnmount');
|
|
5071
|
+
instance.props = current.memoizedProps;
|
|
5072
|
+
instance.state = current.memoizedState;
|
|
5109
5073
|
instance.componentWillUnmount();
|
|
5110
5074
|
stopPhaseTimer$2();
|
|
5111
5075
|
};
|
|
@@ -5492,6 +5456,8 @@ var ReactFiberCommitWork = function (config, captureError) {
|
|
|
5492
5456
|
{
|
|
5493
5457
|
startPhaseTimer$2(finishedWork, 'componentDidMount');
|
|
5494
5458
|
}
|
|
5459
|
+
instance.props = finishedWork.memoizedProps;
|
|
5460
|
+
instance.state = finishedWork.memoizedState;
|
|
5495
5461
|
instance.componentDidMount();
|
|
5496
5462
|
{
|
|
5497
5463
|
stopPhaseTimer$2();
|
|
@@ -5502,6 +5468,8 @@ var ReactFiberCommitWork = function (config, captureError) {
|
|
|
5502
5468
|
{
|
|
5503
5469
|
startPhaseTimer$2(finishedWork, 'componentDidUpdate');
|
|
5504
5470
|
}
|
|
5471
|
+
instance.props = finishedWork.memoizedProps;
|
|
5472
|
+
instance.state = finishedWork.memoizedState;
|
|
5505
5473
|
instance.componentDidUpdate(prevProps, prevState);
|
|
5506
5474
|
{
|
|
5507
5475
|
stopPhaseTimer$2();
|
|
@@ -5851,9 +5819,9 @@ var ReactFiberHydrationContext = function (config) {
|
|
|
5851
5819
|
nextHydratableInstance = getFirstHydratableChild(nextInstance);
|
|
5852
5820
|
}
|
|
5853
5821
|
|
|
5854
|
-
function prepareToHydrateHostInstance(fiber, rootContainerInstance) {
|
|
5822
|
+
function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
|
|
5855
5823
|
var instance = fiber.stateNode;
|
|
5856
|
-
var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, fiber);
|
|
5824
|
+
var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber);
|
|
5857
5825
|
// TODO: Type this specific to this type of component.
|
|
5858
5826
|
fiber.updateQueue = updatePayload;
|
|
5859
5827
|
// If the update payload indicates that there is a change or if there
|
|
@@ -5930,12 +5898,10 @@ var ReactFiberHydrationContext = function (config) {
|
|
|
5930
5898
|
};
|
|
5931
5899
|
|
|
5932
5900
|
/**
|
|
5933
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
5934
|
-
* All rights reserved.
|
|
5901
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
5935
5902
|
*
|
|
5936
|
-
* This source code is licensed under the
|
|
5937
|
-
* LICENSE file in the root directory of this source tree.
|
|
5938
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
5903
|
+
* This source code is licensed under the MIT license found in the
|
|
5904
|
+
* LICENSE file in the root directory of this source tree.
|
|
5939
5905
|
*
|
|
5940
5906
|
* @providesModule ReactFiberInstrumentation
|
|
5941
5907
|
*
|
|
@@ -6131,6 +6097,7 @@ var ReactFiberScheduler = function (config) {
|
|
|
6131
6097
|
// Use these to prevent an infinite loop of nested updates
|
|
6132
6098
|
var NESTED_UPDATE_LIMIT = 1000;
|
|
6133
6099
|
var nestedUpdateCount = 0;
|
|
6100
|
+
var nextRenderedTree = null;
|
|
6134
6101
|
|
|
6135
6102
|
function resetContextStack() {
|
|
6136
6103
|
// Reset the stack
|
|
@@ -6185,11 +6152,17 @@ var ReactFiberScheduler = function (config) {
|
|
|
6185
6152
|
resetContextStack();
|
|
6186
6153
|
|
|
6187
6154
|
nextUnitOfWork = createWorkInProgress$1(highestPriorityRoot.current, highestPriorityLevel);
|
|
6155
|
+
if (highestPriorityRoot !== nextRenderedTree) {
|
|
6156
|
+
// We've switched trees. Reset the nested update counter.
|
|
6157
|
+
nestedUpdateCount = 0;
|
|
6158
|
+
nextRenderedTree = highestPriorityRoot;
|
|
6159
|
+
}
|
|
6188
6160
|
return;
|
|
6189
6161
|
}
|
|
6190
6162
|
|
|
6191
6163
|
nextPriorityLevel = NoWork$2;
|
|
6192
6164
|
nextUnitOfWork = null;
|
|
6165
|
+
nextRenderedTree = null;
|
|
6193
6166
|
return;
|
|
6194
6167
|
}
|
|
6195
6168
|
|
|
@@ -6773,8 +6746,6 @@ var ReactFiberScheduler = function (config) {
|
|
|
6773
6746
|
!!isPerformingWork ? invariant(false, 'performWork was called recursively. This error is likely caused by a bug in React. Please file an issue.') : void 0;
|
|
6774
6747
|
isPerformingWork = true;
|
|
6775
6748
|
|
|
6776
|
-
nestedUpdateCount = 0;
|
|
6777
|
-
|
|
6778
6749
|
// The priority context changes during the render phase. We'll need to
|
|
6779
6750
|
// reset it at the end.
|
|
6780
6751
|
var previousPriorityContext = priorityContext;
|
|
@@ -6852,6 +6823,9 @@ var ReactFiberScheduler = function (config) {
|
|
|
6852
6823
|
firstUncaughtError = null;
|
|
6853
6824
|
capturedErrors = null;
|
|
6854
6825
|
failedBoundaries = null;
|
|
6826
|
+
nextRenderedTree = null;
|
|
6827
|
+
nestedUpdateCount = 0;
|
|
6828
|
+
|
|
6855
6829
|
{
|
|
6856
6830
|
stopWorkLoopTimer();
|
|
6857
6831
|
}
|
|
@@ -7213,16 +7187,6 @@ var ReactFiberScheduler = function (config) {
|
|
|
7213
7187
|
scheduleUpdateImpl(fiber, TaskPriority$1, true);
|
|
7214
7188
|
}
|
|
7215
7189
|
|
|
7216
|
-
function performWithPriority(priorityLevel, fn) {
|
|
7217
|
-
var previousPriorityContext = priorityContext;
|
|
7218
|
-
priorityContext = priorityLevel;
|
|
7219
|
-
try {
|
|
7220
|
-
fn();
|
|
7221
|
-
} finally {
|
|
7222
|
-
priorityContext = previousPriorityContext;
|
|
7223
|
-
}
|
|
7224
|
-
}
|
|
7225
|
-
|
|
7226
7190
|
function batchedUpdates(fn, a) {
|
|
7227
7191
|
var previousIsBatchingUpdates = isBatchingUpdates;
|
|
7228
7192
|
isBatchingUpdates = true;
|
|
@@ -7281,7 +7245,6 @@ var ReactFiberScheduler = function (config) {
|
|
|
7281
7245
|
return {
|
|
7282
7246
|
scheduleUpdate: scheduleUpdate,
|
|
7283
7247
|
getPriorityContext: getPriorityContext,
|
|
7284
|
-
performWithPriority: performWithPriority,
|
|
7285
7248
|
batchedUpdates: batchedUpdates,
|
|
7286
7249
|
unbatchedUpdates: unbatchedUpdates,
|
|
7287
7250
|
flushSync: flushSync,
|
|
@@ -7290,12 +7253,10 @@ var ReactFiberScheduler = function (config) {
|
|
|
7290
7253
|
};
|
|
7291
7254
|
|
|
7292
7255
|
/**
|
|
7293
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
7294
|
-
* All rights reserved.
|
|
7256
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
7295
7257
|
*
|
|
7296
|
-
* This source code is licensed under the
|
|
7297
|
-
* LICENSE file in the root directory of this source tree.
|
|
7298
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
7258
|
+
* This source code is licensed under the MIT license found in the
|
|
7259
|
+
* LICENSE file in the root directory of this source tree.
|
|
7299
7260
|
*
|
|
7300
7261
|
* @providesModule getContextForSubtree
|
|
7301
7262
|
*
|
|
@@ -7364,7 +7325,6 @@ var ReactFiberReconciler = function (config) {
|
|
|
7364
7325
|
var _ReactFiberScheduler = ReactFiberScheduler(config),
|
|
7365
7326
|
scheduleUpdate = _ReactFiberScheduler.scheduleUpdate,
|
|
7366
7327
|
getPriorityContext = _ReactFiberScheduler.getPriorityContext,
|
|
7367
|
-
performWithPriority = _ReactFiberScheduler.performWithPriority,
|
|
7368
7328
|
batchedUpdates = _ReactFiberScheduler.batchedUpdates,
|
|
7369
7329
|
unbatchedUpdates = _ReactFiberScheduler.unbatchedUpdates,
|
|
7370
7330
|
flushSync = _ReactFiberScheduler.flushSync,
|
|
@@ -7422,8 +7382,6 @@ var ReactFiberReconciler = function (config) {
|
|
|
7422
7382
|
},
|
|
7423
7383
|
|
|
7424
7384
|
|
|
7425
|
-
performWithPriority: performWithPriority,
|
|
7426
|
-
|
|
7427
7385
|
batchedUpdates: batchedUpdates,
|
|
7428
7386
|
|
|
7429
7387
|
unbatchedUpdates: unbatchedUpdates,
|
|
@@ -7955,14 +7913,19 @@ function toJSON(inst) {
|
|
|
7955
7913
|
}
|
|
7956
7914
|
}
|
|
7957
7915
|
|
|
7958
|
-
function
|
|
7916
|
+
function nodeAndSiblingsTrees(nodeWithSibling) {
|
|
7959
7917
|
var array = [];
|
|
7960
7918
|
var node = nodeWithSibling;
|
|
7961
7919
|
while (node != null) {
|
|
7962
7920
|
array.push(node);
|
|
7963
7921
|
node = node.sibling;
|
|
7964
7922
|
}
|
|
7965
|
-
|
|
7923
|
+
var trees = array.map(toTree);
|
|
7924
|
+
return trees.length ? trees : null;
|
|
7925
|
+
}
|
|
7926
|
+
|
|
7927
|
+
function hasSiblings(node) {
|
|
7928
|
+
return node && node.sibling;
|
|
7966
7929
|
}
|
|
7967
7930
|
|
|
7968
7931
|
function toTree(node) {
|
|
@@ -7979,7 +7942,7 @@ function toTree(node) {
|
|
|
7979
7942
|
type: node.type,
|
|
7980
7943
|
props: _assign({}, node.memoizedProps),
|
|
7981
7944
|
instance: node.stateNode,
|
|
7982
|
-
rendered: toTree(node.child)
|
|
7945
|
+
rendered: hasSiblings(node.child) ? nodeAndSiblingsTrees(node.child) : toTree(node.child)
|
|
7983
7946
|
};
|
|
7984
7947
|
case FunctionalComponent:
|
|
7985
7948
|
// 1
|
|
@@ -7988,7 +7951,7 @@ function toTree(node) {
|
|
|
7988
7951
|
type: node.type,
|
|
7989
7952
|
props: _assign({}, node.memoizedProps),
|
|
7990
7953
|
instance: null,
|
|
7991
|
-
rendered: toTree(node.child)
|
|
7954
|
+
rendered: hasSiblings(node.child) ? nodeAndSiblingsTrees(node.child) : toTree(node.child)
|
|
7992
7955
|
};
|
|
7993
7956
|
case HostComponent:
|
|
7994
7957
|
// 5
|
|
@@ -7997,7 +7960,7 @@ function toTree(node) {
|
|
|
7997
7960
|
type: node.type,
|
|
7998
7961
|
props: _assign({}, node.memoizedProps),
|
|
7999
7962
|
instance: null, // TODO: use createNodeMock here somehow?
|
|
8000
|
-
rendered:
|
|
7963
|
+
rendered: nodeAndSiblingsTrees(node.child)
|
|
8001
7964
|
};
|
|
8002
7965
|
case HostText:
|
|
8003
7966
|
// 6
|
|
@@ -8222,13 +8185,9 @@ var ReactTestRendererFiber = {
|
|
|
8222
8185
|
!(root != null) ? invariant(false, 'something went wrong') : void 0;
|
|
8223
8186
|
TestRenderer.updateContainer(element, root, null, null);
|
|
8224
8187
|
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
throw new Error("Can't access .root on unmounted test renderer");
|
|
8229
|
-
}
|
|
8230
|
-
return wrapFiber(root.current.child);
|
|
8231
|
-
},
|
|
8188
|
+
var entry = {
|
|
8189
|
+
root: undefined, // makes flow happy
|
|
8190
|
+
// we define a 'getter' for 'root' below using 'Object.defineProperty'
|
|
8232
8191
|
toJSON: function () {
|
|
8233
8192
|
if (root == null || root.current == null || container == null) {
|
|
8234
8193
|
return null;
|
|
@@ -8268,6 +8227,19 @@ var ReactTestRendererFiber = {
|
|
|
8268
8227
|
return TestRenderer.getPublicRootInstance(root);
|
|
8269
8228
|
}
|
|
8270
8229
|
};
|
|
8230
|
+
|
|
8231
|
+
Object.defineProperty(entry, 'root', {
|
|
8232
|
+
configurable: true,
|
|
8233
|
+
enumerable: true,
|
|
8234
|
+
get: function () {
|
|
8235
|
+
if (root === null || root.current.child === null) {
|
|
8236
|
+
throw new Error("Can't access .root on unmounted test renderer");
|
|
8237
|
+
}
|
|
8238
|
+
return wrapFiber(root.current.child);
|
|
8239
|
+
}
|
|
8240
|
+
});
|
|
8241
|
+
|
|
8242
|
+
return entry;
|
|
8271
8243
|
},
|
|
8272
8244
|
|
|
8273
8245
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-test-renderer",
|
|
3
|
-
"version": "16.0.0
|
|
3
|
+
"version": "16.0.0",
|
|
4
4
|
"description": "React package for snapshot testing.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": "facebook/react",
|
|
@@ -9,21 +9,20 @@
|
|
|
9
9
|
"react-native",
|
|
10
10
|
"react-testing"
|
|
11
11
|
],
|
|
12
|
-
"license": "
|
|
12
|
+
"license": "MIT",
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/facebook/react/issues"
|
|
15
15
|
},
|
|
16
16
|
"homepage": "https://facebook.github.io/react/",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"fbjs": "^0.8.
|
|
19
|
-
"object-assign": "^4.1.
|
|
18
|
+
"fbjs": "^0.8.16",
|
|
19
|
+
"object-assign": "^4.1.1"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"react": "^16.0.0-beta.5"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"LICENSE",
|
|
26
|
-
"PATENTS",
|
|
27
26
|
"README.md",
|
|
28
27
|
"index.js",
|
|
29
28
|
"shallow.js",
|
package/PATENTS
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
Additional Grant of Patent Rights Version 2
|
|
2
|
-
|
|
3
|
-
"Software" means the React software distributed by Facebook, Inc.
|
|
4
|
-
|
|
5
|
-
Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software
|
|
6
|
-
("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable
|
|
7
|
-
(subject to the termination provision below) license under any Necessary
|
|
8
|
-
Claims, to make, have made, use, sell, offer to sell, import, and otherwise
|
|
9
|
-
transfer the Software. For avoidance of doubt, no license is granted under
|
|
10
|
-
Facebook's rights in any patent claims that are infringed by (i) modifications
|
|
11
|
-
to the Software made by you or any third party or (ii) the Software in
|
|
12
|
-
combination with any software or other technology.
|
|
13
|
-
|
|
14
|
-
The license granted hereunder will terminate, automatically and without notice,
|
|
15
|
-
if you (or any of your subsidiaries, corporate affiliates or agents) initiate
|
|
16
|
-
directly or indirectly, or take a direct financial interest in, any Patent
|
|
17
|
-
Assertion: (i) against Facebook or any of its subsidiaries or corporate
|
|
18
|
-
affiliates, (ii) against any party if such Patent Assertion arises in whole or
|
|
19
|
-
in part from any software, technology, product or service of Facebook or any of
|
|
20
|
-
its subsidiaries or corporate affiliates, or (iii) against any party relating
|
|
21
|
-
to the Software. Notwithstanding the foregoing, if Facebook or any of its
|
|
22
|
-
subsidiaries or corporate affiliates files a lawsuit alleging patent
|
|
23
|
-
infringement against you in the first instance, and you respond by filing a
|
|
24
|
-
patent infringement counterclaim in that lawsuit against that party that is
|
|
25
|
-
unrelated to the Software, the license granted hereunder will not terminate
|
|
26
|
-
under section (i) of this paragraph due to such counterclaim.
|
|
27
|
-
|
|
28
|
-
A "Necessary Claim" is a claim of a patent owned by Facebook that is
|
|
29
|
-
necessarily infringed by the Software standing alone.
|
|
30
|
-
|
|
31
|
-
A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
|
|
32
|
-
or contributory infringement or inducement to infringe any patent, including a
|
|
33
|
-
cross-claim or counterclaim.
|