react-reconciler 0.20.3 → 0.21.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/build-info.json +5 -5
- package/cjs/react-reconciler-persistent.development.js +7652 -5001
- package/cjs/react-reconciler-persistent.production.min.js +165 -155
- package/cjs/react-reconciler-reflection.development.js +98 -47
- package/cjs/react-reconciler-reflection.production.min.js +7 -8
- package/cjs/react-reconciler.development.js +7657 -4971
- package/cjs/react-reconciler.production.min.js +165 -155
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v0.
|
|
1
|
+
/** @license React v0.21.0
|
|
2
2
|
* react-reconciler-reflection.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -19,6 +19,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
19
19
|
|
|
20
20
|
var React = require('react');
|
|
21
21
|
|
|
22
|
+
// Do not require this module directly! Use normal `invariant` calls with
|
|
23
|
+
// template literal strings. The messages will be converted to ReactError during
|
|
24
|
+
// build, and in production they will be minified.
|
|
25
|
+
|
|
26
|
+
// Do not require this module directly! Use normal `invariant` calls with
|
|
27
|
+
// template literal strings. The messages will be converted to ReactError during
|
|
28
|
+
// build, and in production they will be minified.
|
|
29
|
+
|
|
30
|
+
function ReactError(error) {
|
|
31
|
+
error.name = 'Invariant Violation';
|
|
32
|
+
return error;
|
|
33
|
+
}
|
|
34
|
+
|
|
22
35
|
/**
|
|
23
36
|
* Use invariant() to assert state which your program assumes to be true.
|
|
24
37
|
*
|
|
@@ -30,40 +43,6 @@ var React = require('react');
|
|
|
30
43
|
* will remain to ensure logic does not differ in production.
|
|
31
44
|
*/
|
|
32
45
|
|
|
33
|
-
var validateFormat = function () {};
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
validateFormat = function (format) {
|
|
37
|
-
if (format === undefined) {
|
|
38
|
-
throw new Error('invariant requires an error message argument');
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function invariant(condition, format, a, b, c, d, e, f) {
|
|
44
|
-
validateFormat(format);
|
|
45
|
-
|
|
46
|
-
if (!condition) {
|
|
47
|
-
var error = void 0;
|
|
48
|
-
if (format === undefined) {
|
|
49
|
-
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
50
|
-
} else {
|
|
51
|
-
var args = [a, b, c, d, e, f];
|
|
52
|
-
var argIndex = 0;
|
|
53
|
-
error = new Error(format.replace(/%s/g, function () {
|
|
54
|
-
return args[argIndex++];
|
|
55
|
-
}));
|
|
56
|
-
error.name = 'Invariant Violation';
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
60
|
-
throw error;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Relying on the `invariant()` implementation lets us
|
|
65
|
-
// preserve the format and params in the www builds.
|
|
66
|
-
|
|
67
46
|
/**
|
|
68
47
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
69
48
|
* This can be used to log issues in development environments in critical
|
|
@@ -145,6 +124,11 @@ if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
|
|
|
145
124
|
current: null
|
|
146
125
|
};
|
|
147
126
|
}
|
|
127
|
+
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
|
|
128
|
+
ReactSharedInternals.ReactCurrentBatchConfig = {
|
|
129
|
+
suspense: null
|
|
130
|
+
};
|
|
131
|
+
}
|
|
148
132
|
|
|
149
133
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
150
134
|
// nor polyfill, then a plain number is used for performance.
|
|
@@ -157,10 +141,13 @@ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeac
|
|
|
157
141
|
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
158
142
|
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
159
143
|
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
144
|
+
// TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
145
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
146
|
+
|
|
160
147
|
|
|
161
|
-
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
162
148
|
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
163
149
|
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
150
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
164
151
|
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
165
152
|
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
166
153
|
|
|
@@ -193,8 +180,6 @@ function getComponentName(type) {
|
|
|
193
180
|
return type;
|
|
194
181
|
}
|
|
195
182
|
switch (type) {
|
|
196
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
197
|
-
return 'ConcurrentMode';
|
|
198
183
|
case REACT_FRAGMENT_TYPE:
|
|
199
184
|
return 'Fragment';
|
|
200
185
|
case REACT_PORTAL_TYPE:
|
|
@@ -205,6 +190,8 @@ function getComponentName(type) {
|
|
|
205
190
|
return 'StrictMode';
|
|
206
191
|
case REACT_SUSPENSE_TYPE:
|
|
207
192
|
return 'Suspense';
|
|
193
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
194
|
+
return 'SuspenseList';
|
|
208
195
|
}
|
|
209
196
|
if (typeof type === 'object') {
|
|
210
197
|
switch (type.$$typeof) {
|
|
@@ -223,6 +210,7 @@ function getComponentName(type) {
|
|
|
223
210
|
if (resolvedThenable) {
|
|
224
211
|
return getComponentName(resolvedThenable);
|
|
225
212
|
}
|
|
213
|
+
break;
|
|
226
214
|
}
|
|
227
215
|
}
|
|
228
216
|
}
|
|
@@ -236,6 +224,20 @@ var HostPortal = 4; // A subtree. Could be an entry point to a different rendere
|
|
|
236
224
|
var HostComponent = 5;
|
|
237
225
|
var HostText = 6;
|
|
238
226
|
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
var FundamentalComponent = 20;
|
|
240
|
+
|
|
239
241
|
// Don't change these two values. They're used by React Dev Tools.
|
|
240
242
|
var NoEffect = /* */0;
|
|
241
243
|
|
|
@@ -315,7 +317,13 @@ function isMounted(component) {
|
|
|
315
317
|
}
|
|
316
318
|
|
|
317
319
|
function assertIsMounted(fiber) {
|
|
318
|
-
|
|
320
|
+
(function () {
|
|
321
|
+
if (!(isFiberMountedImpl(fiber) === MOUNTED)) {
|
|
322
|
+
{
|
|
323
|
+
throw ReactError(Error('Unable to find node on an unmounted component.'));
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
})();
|
|
319
327
|
}
|
|
320
328
|
|
|
321
329
|
function findCurrentFiberUsingSlowPath(fiber) {
|
|
@@ -323,7 +331,13 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
323
331
|
if (!alternate) {
|
|
324
332
|
// If there is no alternate, then we only need to check if it is mounted.
|
|
325
333
|
var state = isFiberMountedImpl(fiber);
|
|
326
|
-
|
|
334
|
+
(function () {
|
|
335
|
+
if (!(state !== UNMOUNTED)) {
|
|
336
|
+
{
|
|
337
|
+
throw ReactError(Error('Unable to find node on an unmounted component.'));
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
})();
|
|
327
341
|
if (state === MOUNTING) {
|
|
328
342
|
return null;
|
|
329
343
|
}
|
|
@@ -336,11 +350,24 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
336
350
|
var b = alternate;
|
|
337
351
|
while (true) {
|
|
338
352
|
var parentA = a.return;
|
|
339
|
-
|
|
340
|
-
if (!parentA || !parentB) {
|
|
353
|
+
if (parentA === null) {
|
|
341
354
|
// We're at the root.
|
|
342
355
|
break;
|
|
343
356
|
}
|
|
357
|
+
var parentB = parentA.alternate;
|
|
358
|
+
if (parentB === null) {
|
|
359
|
+
// There is no alternate. This is an unusual case. Currently, it only
|
|
360
|
+
// happens when a Suspense component is hidden. An extra fragment fiber
|
|
361
|
+
// is inserted in between the Suspense fiber and its children. Skip
|
|
362
|
+
// over this extra fragment fiber and proceed to the next parent.
|
|
363
|
+
var nextParent = parentA.return;
|
|
364
|
+
if (nextParent !== null) {
|
|
365
|
+
a = b = nextParent;
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
// If there's no parent, we're at the root.
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
344
371
|
|
|
345
372
|
// If both copies of the parent fiber point to the same child, we can
|
|
346
373
|
// assume that the child is current. This happens when we bailout on low
|
|
@@ -362,7 +389,13 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
362
389
|
}
|
|
363
390
|
// We should never have an alternate for any mounting node. So the only
|
|
364
391
|
// way this could possibly happen is if this was unmounted, if at all.
|
|
365
|
-
|
|
392
|
+
(function () {
|
|
393
|
+
{
|
|
394
|
+
{
|
|
395
|
+
throw ReactError(Error('Unable to find node on an unmounted component.'));
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
})();
|
|
366
399
|
}
|
|
367
400
|
|
|
368
401
|
if (a.return !== b.return) {
|
|
@@ -413,15 +446,33 @@ function findCurrentFiberUsingSlowPath(fiber) {
|
|
|
413
446
|
}
|
|
414
447
|
_child = _child.sibling;
|
|
415
448
|
}
|
|
416
|
-
|
|
449
|
+
(function () {
|
|
450
|
+
if (!didFindChild) {
|
|
451
|
+
{
|
|
452
|
+
throw ReactError(Error('Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.'));
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
})();
|
|
417
456
|
}
|
|
418
457
|
}
|
|
419
458
|
|
|
420
|
-
|
|
459
|
+
(function () {
|
|
460
|
+
if (!(a.alternate === b)) {
|
|
461
|
+
{
|
|
462
|
+
throw ReactError(Error('Return fibers should always be each others\' alternates. This error is likely caused by a bug in React. Please file an issue.'));
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
})();
|
|
421
466
|
}
|
|
422
467
|
// If the root is not a host container, we're in a disconnected tree. I.e.
|
|
423
468
|
// unmounted.
|
|
424
|
-
|
|
469
|
+
(function () {
|
|
470
|
+
if (!(a.tag === HostRoot)) {
|
|
471
|
+
{
|
|
472
|
+
throw ReactError(Error('Unable to find node on an unmounted component.'));
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
})();
|
|
425
476
|
if (a.stateNode.current === a) {
|
|
426
477
|
// We've determined that A is the current branch.
|
|
427
478
|
return fiber;
|
|
@@ -472,7 +523,7 @@ function findCurrentHostFiberWithNoPortals(parent) {
|
|
|
472
523
|
// Next we'll drill down this component to find the first HostComponent/Text.
|
|
473
524
|
var node = currentParent;
|
|
474
525
|
while (true) {
|
|
475
|
-
if (node.tag === HostComponent || node.tag === HostText) {
|
|
526
|
+
if (node.tag === HostComponent || node.tag === HostText || node.tag === FundamentalComponent) {
|
|
476
527
|
return node;
|
|
477
528
|
} else if (node.child && node.tag !== HostPortal) {
|
|
478
529
|
node.child.return = node;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v0.
|
|
1
|
+
/** @license React v0.21.0
|
|
2
2
|
* react-reconciler-reflection.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -7,10 +7,9 @@
|
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
'use strict';Object.defineProperty(exports,"__esModule",{value:!0});function
|
|
11
|
-
function
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
exports.
|
|
16
|
-
exports.findCurrentHostFiberWithNoPortals=function(b){b=q(b);if(!b)return null;for(var a=b;;){if(5===a.tag||6===a.tag)return a;if(a.child&&4!==a.tag)a.child.return=a,a=a.child;else{if(a===b)break;for(;!a.sibling;){if(!a.return||a.return===b)return null;a=a.return}a.sibling.return=a.return;a=a.sibling}}return null};
|
|
10
|
+
'use strict';Object.defineProperty(exports,"__esModule",{value:!0});function h(b){for(var a=b.message,c="https://reactjs.org/docs/error-decoder.html?invariant="+a,d=1;d<arguments.length;d++)c+="&args[]="+encodeURIComponent(arguments[d]);b.message="Minified React error #"+a+"; visit "+c+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ";return b}var l=require("react").__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
11
|
+
l.hasOwnProperty("ReactCurrentDispatcher")||(l.ReactCurrentDispatcher={current:null});l.hasOwnProperty("ReactCurrentBatchConfig")||(l.ReactCurrentBatchConfig={suspense:null});function m(b){var a=b;if(b.alternate)for(;a.return;)a=a.return;else{if(0!==(a.effectTag&2))return 1;for(;a.return;)if(a=a.return,0!==(a.effectTag&2))return 1}return 3===a.tag?2:3}function n(b){if(2!==m(b))throw h(Error(188));}
|
|
12
|
+
function p(b){var a=b.alternate;if(!a){a=m(b);if(3===a)throw h(Error(188));return 1===a?null:b}for(var c=b,d=a;;){var f=c.return;if(null===f)break;var e=f.alternate;if(null===e){d=f.return;if(null!==d){c=d;continue}break}if(f.child===e.child){for(e=f.child;e;){if(e===c)return n(f),b;if(e===d)return n(f),a;e=e.sibling}throw h(Error(188));}if(c.return!==d.return)c=f,d=e;else{for(var k=!1,g=f.child;g;){if(g===c){k=!0;c=f;d=e;break}if(g===d){k=!0;d=f;c=e;break}g=g.sibling}if(!k){for(g=e.child;g;){if(g===
|
|
13
|
+
c){k=!0;c=e;d=f;break}if(g===d){k=!0;d=e;c=f;break}g=g.sibling}if(!k)throw h(Error(189));}}if(c.alternate!==d)throw h(Error(190));}if(3!==c.tag)throw h(Error(188));return c.stateNode.current===c?b:a}exports.isFiberMounted=function(b){return 2===m(b)};exports.isMounted=function(b){return(b=b._reactInternalFiber)?2===m(b):!1};exports.findCurrentFiberUsingSlowPath=p;
|
|
14
|
+
exports.findCurrentHostFiber=function(b){b=p(b);if(!b)return null;for(var a=b;;){if(5===a.tag||6===a.tag)return a;if(a.child)a.child.return=a,a=a.child;else{if(a===b)break;for(;!a.sibling;){if(!a.return||a.return===b)return null;a=a.return}a.sibling.return=a.return;a=a.sibling}}return null};
|
|
15
|
+
exports.findCurrentHostFiberWithNoPortals=function(b){b=p(b);if(!b)return null;for(var a=b;;){if(5===a.tag||6===a.tag||20===a.tag)return a;if(a.child&&4!==a.tag)a.child.return=a,a=a.child;else{if(a===b)break;for(;!a.sibling;){if(!a.return||a.return===b)return null;a=a.return}a.sibling.return=a.return;a=a.sibling}}return null};
|