react 17.0.2 → 18.0.0-alpha-6bbe7c344
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/cjs/react-jsx-dev-runtime.development.js +60 -34
- package/cjs/react-jsx-dev-runtime.production.min.js +2 -2
- package/cjs/react-jsx-dev-runtime.profiling.min.js +2 -2
- package/cjs/react-jsx-runtime.development.js +60 -34
- package/cjs/react-jsx-runtime.production.min.js +3 -3
- package/cjs/react-jsx-runtime.profiling.min.js +3 -3
- package/cjs/react-unstable-shared-subset.development.js +18 -0
- package/cjs/react-unstable-shared-subset.production.min.js +9 -0
- package/cjs/react.development.js +176 -96
- package/cjs/react.production.min.js +15 -14
- package/package.json +18 -3
- package/umd/react.development.js +327 -629
- package/umd/react.production.min.js +22 -23
- package/umd/react.profiling.min.js +22 -28
- package/unstable-shared-subset.js +7 -0
- package/build-info.json +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React
|
|
1
|
+
/** @license React vundefined
|
|
2
2
|
* react-jsx-dev-runtime.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -33,14 +33,12 @@ var REACT_SUSPENSE_TYPE = 0xead1;
|
|
|
33
33
|
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
|
|
34
34
|
var REACT_MEMO_TYPE = 0xead3;
|
|
35
35
|
var REACT_LAZY_TYPE = 0xead4;
|
|
36
|
-
var REACT_BLOCK_TYPE = 0xead9;
|
|
37
|
-
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
|
38
|
-
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
|
39
36
|
var REACT_SCOPE_TYPE = 0xead7;
|
|
40
37
|
var REACT_OPAQUE_ID_TYPE = 0xeae0;
|
|
41
38
|
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
|
|
42
39
|
var REACT_OFFSCREEN_TYPE = 0xeae2;
|
|
43
40
|
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
|
41
|
+
var REACT_CACHE_TYPE = 0xeae4;
|
|
44
42
|
|
|
45
43
|
if (typeof Symbol === 'function' && Symbol.for) {
|
|
46
44
|
var symbolFor = Symbol.for;
|
|
@@ -56,14 +54,12 @@ if (typeof Symbol === 'function' && Symbol.for) {
|
|
|
56
54
|
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
|
|
57
55
|
REACT_MEMO_TYPE = symbolFor('react.memo');
|
|
58
56
|
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
|
59
|
-
REACT_BLOCK_TYPE = symbolFor('react.block');
|
|
60
|
-
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
|
61
|
-
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
|
62
57
|
REACT_SCOPE_TYPE = symbolFor('react.scope');
|
|
63
58
|
REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
|
|
64
59
|
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
|
|
65
60
|
REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
|
|
66
61
|
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
|
62
|
+
REACT_CACHE_TYPE = symbolFor('react.cache');
|
|
67
63
|
}
|
|
68
64
|
|
|
69
65
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
@@ -119,21 +115,32 @@ function printWarning(level, format, args) {
|
|
|
119
115
|
}
|
|
120
116
|
|
|
121
117
|
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
|
|
118
|
+
var enableCache = false; // Only used in www builds.
|
|
122
119
|
|
|
123
120
|
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
124
121
|
|
|
122
|
+
var REACT_MODULE_REFERENCE = 0;
|
|
123
|
+
|
|
124
|
+
if (typeof Symbol === 'function') {
|
|
125
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
126
|
+
}
|
|
127
|
+
|
|
125
128
|
function isValidElementType(type) {
|
|
126
129
|
if (typeof type === 'string' || typeof type === 'function') {
|
|
127
130
|
return true;
|
|
128
131
|
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
129
132
|
|
|
130
133
|
|
|
131
|
-
if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
|
|
134
|
+
if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCache ) {
|
|
132
135
|
return true;
|
|
133
136
|
}
|
|
134
137
|
|
|
135
138
|
if (typeof type === 'object' && type !== null) {
|
|
136
|
-
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
|
139
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
140
|
+
// types supported by any Flight configuration anywhere since
|
|
141
|
+
// we don't know which Flight build this will end up being used
|
|
142
|
+
// with.
|
|
143
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
137
144
|
return true;
|
|
138
145
|
}
|
|
139
146
|
}
|
|
@@ -142,15 +149,23 @@ function isValidElementType(type) {
|
|
|
142
149
|
}
|
|
143
150
|
|
|
144
151
|
function getWrappedName(outerType, innerType, wrapperName) {
|
|
152
|
+
var displayName = outerType.displayName;
|
|
153
|
+
|
|
154
|
+
if (displayName) {
|
|
155
|
+
return displayName;
|
|
156
|
+
}
|
|
157
|
+
|
|
145
158
|
var functionName = innerType.displayName || innerType.name || '';
|
|
146
|
-
return
|
|
147
|
-
}
|
|
159
|
+
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
160
|
+
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
161
|
+
|
|
148
162
|
|
|
149
163
|
function getContextName(type) {
|
|
150
164
|
return type.displayName || 'Context';
|
|
151
|
-
}
|
|
165
|
+
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
152
166
|
|
|
153
|
-
|
|
167
|
+
|
|
168
|
+
function getComponentNameFromType(type) {
|
|
154
169
|
if (type == null) {
|
|
155
170
|
// Host root, text node or just invalid type.
|
|
156
171
|
return null;
|
|
@@ -158,7 +173,7 @@ function getComponentName(type) {
|
|
|
158
173
|
|
|
159
174
|
{
|
|
160
175
|
if (typeof type.tag === 'number') {
|
|
161
|
-
error('Received an unexpected object in
|
|
176
|
+
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
162
177
|
}
|
|
163
178
|
}
|
|
164
179
|
|
|
@@ -188,6 +203,9 @@ function getComponentName(type) {
|
|
|
188
203
|
|
|
189
204
|
case REACT_SUSPENSE_LIST_TYPE:
|
|
190
205
|
return 'SuspenseList';
|
|
206
|
+
|
|
207
|
+
case REACT_CACHE_TYPE:
|
|
208
|
+
return 'Cache';
|
|
191
209
|
}
|
|
192
210
|
|
|
193
211
|
if (typeof type === 'object') {
|
|
@@ -204,10 +222,13 @@ function getComponentName(type) {
|
|
|
204
222
|
return getWrappedName(type, type.render, 'ForwardRef');
|
|
205
223
|
|
|
206
224
|
case REACT_MEMO_TYPE:
|
|
207
|
-
|
|
225
|
+
var outerName = type.displayName || null;
|
|
208
226
|
|
|
209
|
-
|
|
210
|
-
|
|
227
|
+
if (outerName !== null) {
|
|
228
|
+
return outerName;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return getComponentNameFromType(type.type) || 'Memo';
|
|
211
232
|
|
|
212
233
|
case REACT_LAZY_TYPE:
|
|
213
234
|
{
|
|
@@ -216,7 +237,7 @@ function getComponentName(type) {
|
|
|
216
237
|
var init = lazyComponent._init;
|
|
217
238
|
|
|
218
239
|
try {
|
|
219
|
-
return
|
|
240
|
+
return getComponentNameFromType(init(payload));
|
|
220
241
|
} catch (x) {
|
|
221
242
|
return null;
|
|
222
243
|
}
|
|
@@ -349,7 +370,7 @@ var componentFrameCache;
|
|
|
349
370
|
|
|
350
371
|
function describeNativeComponentFrame(fn, construct) {
|
|
351
372
|
// If something asked for a stack inside a fake render, it should get ignored.
|
|
352
|
-
if (!fn || reentry) {
|
|
373
|
+
if ( !fn || reentry) {
|
|
353
374
|
return '';
|
|
354
375
|
}
|
|
355
376
|
|
|
@@ -543,9 +564,6 @@ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
|
543
564
|
// Memo may contain any component type so we recursively resolve it.
|
|
544
565
|
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
545
566
|
|
|
546
|
-
case REACT_BLOCK_TYPE:
|
|
547
|
-
return describeFunctionComponentFrame(type._render);
|
|
548
|
-
|
|
549
567
|
case REACT_LAZY_TYPE:
|
|
550
568
|
{
|
|
551
569
|
var lazyComponent = type;
|
|
@@ -563,6 +581,8 @@ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
|
563
581
|
return '';
|
|
564
582
|
}
|
|
565
583
|
|
|
584
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
585
|
+
|
|
566
586
|
var loggedTypeFailures = {};
|
|
567
587
|
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
568
588
|
|
|
@@ -581,7 +601,7 @@ function setCurrentlyValidatingElement(element) {
|
|
|
581
601
|
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
582
602
|
{
|
|
583
603
|
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
584
|
-
var has = Function.call.bind(
|
|
604
|
+
var has = Function.call.bind(hasOwnProperty);
|
|
585
605
|
|
|
586
606
|
for (var typeSpecName in typeSpecs) {
|
|
587
607
|
if (has(typeSpecs, typeSpecName)) {
|
|
@@ -626,8 +646,13 @@ function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
|
626
646
|
}
|
|
627
647
|
}
|
|
628
648
|
|
|
649
|
+
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
650
|
+
|
|
651
|
+
function isArray(a) {
|
|
652
|
+
return isArrayImpl(a);
|
|
653
|
+
}
|
|
654
|
+
|
|
629
655
|
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
630
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
631
656
|
var RESERVED_PROPS = {
|
|
632
657
|
key: true,
|
|
633
658
|
ref: true,
|
|
@@ -673,10 +698,10 @@ function hasValidKey(config) {
|
|
|
673
698
|
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
674
699
|
{
|
|
675
700
|
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
|
676
|
-
var componentName =
|
|
701
|
+
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
677
702
|
|
|
678
703
|
if (!didWarnAboutStringRefs[componentName]) {
|
|
679
|
-
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref',
|
|
704
|
+
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
|
680
705
|
|
|
681
706
|
didWarnAboutStringRefs[componentName] = true;
|
|
682
707
|
}
|
|
@@ -889,6 +914,7 @@ var propTypesMisspellWarningShown;
|
|
|
889
914
|
* @final
|
|
890
915
|
*/
|
|
891
916
|
|
|
917
|
+
|
|
892
918
|
function isValidElement(object) {
|
|
893
919
|
{
|
|
894
920
|
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
@@ -898,7 +924,7 @@ function isValidElement(object) {
|
|
|
898
924
|
function getDeclarationErrorAddendum() {
|
|
899
925
|
{
|
|
900
926
|
if (ReactCurrentOwner$1.current) {
|
|
901
|
-
var name =
|
|
927
|
+
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
902
928
|
|
|
903
929
|
if (name) {
|
|
904
930
|
return '\n\nCheck the render method of `' + name + '`.';
|
|
@@ -978,7 +1004,7 @@ function validateExplicitKey(element, parentType) {
|
|
|
978
1004
|
|
|
979
1005
|
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
980
1006
|
// Give the component that originally created this child.
|
|
981
|
-
childOwner = " It was passed a child from " +
|
|
1007
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
982
1008
|
}
|
|
983
1009
|
|
|
984
1010
|
setCurrentlyValidatingElement$1(element);
|
|
@@ -1005,7 +1031,7 @@ function validateChildKeys(node, parentType) {
|
|
|
1005
1031
|
return;
|
|
1006
1032
|
}
|
|
1007
1033
|
|
|
1008
|
-
if (
|
|
1034
|
+
if (isArray(node)) {
|
|
1009
1035
|
for (var i = 0; i < node.length; i++) {
|
|
1010
1036
|
var child = node[i];
|
|
1011
1037
|
|
|
@@ -1068,12 +1094,12 @@ function validatePropTypes(element) {
|
|
|
1068
1094
|
|
|
1069
1095
|
if (propTypes) {
|
|
1070
1096
|
// Intentionally inside to avoid triggering lazy initializers:
|
|
1071
|
-
var name =
|
|
1097
|
+
var name = getComponentNameFromType(type);
|
|
1072
1098
|
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
1073
1099
|
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1074
1100
|
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
1075
1101
|
|
|
1076
|
-
var _name =
|
|
1102
|
+
var _name = getComponentNameFromType(type);
|
|
1077
1103
|
|
|
1078
1104
|
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
1079
1105
|
}
|
|
@@ -1140,10 +1166,10 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1140
1166
|
|
|
1141
1167
|
if (type === null) {
|
|
1142
1168
|
typeString = 'null';
|
|
1143
|
-
} else if (
|
|
1169
|
+
} else if (isArray(type)) {
|
|
1144
1170
|
typeString = 'array';
|
|
1145
1171
|
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1146
|
-
typeString = "<" + (
|
|
1172
|
+
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
1147
1173
|
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1148
1174
|
} else {
|
|
1149
1175
|
typeString = typeof type;
|
|
@@ -1169,7 +1195,7 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1169
1195
|
|
|
1170
1196
|
if (children !== undefined) {
|
|
1171
1197
|
if (isStaticChildren) {
|
|
1172
|
-
if (
|
|
1198
|
+
if (isArray(children)) {
|
|
1173
1199
|
for (var i = 0; i < children.length; i++) {
|
|
1174
1200
|
validateChildKeys(children[i], type);
|
|
1175
1201
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React
|
|
1
|
+
/** @license React vundefined
|
|
2
2
|
* react-jsx-dev-runtime.production.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
'use strict';require("object-assign");
|
|
9
|
+
'use strict';require("object-assign");exports.Fragment=60107;if("function"===typeof Symbol&&Symbol.for){var a=Symbol.for;exports.Fragment=a("react.fragment")}exports.jsxDEV=void 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React
|
|
1
|
+
/** @license React vundefined
|
|
2
2
|
* react-jsx-dev-runtime.profiling.min.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
8
8
|
*/
|
|
9
|
-
'use strict';require("object-assign");
|
|
9
|
+
'use strict';require("object-assign");exports.Fragment=60107;if("function"===typeof Symbol&&Symbol.for){var a=Symbol.for;exports.Fragment=a("react.fragment")}exports.jsxDEV=void 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React
|
|
1
|
+
/** @license React vundefined
|
|
2
2
|
* react-jsx-runtime.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -33,14 +33,12 @@ var REACT_SUSPENSE_TYPE = 0xead1;
|
|
|
33
33
|
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
|
|
34
34
|
var REACT_MEMO_TYPE = 0xead3;
|
|
35
35
|
var REACT_LAZY_TYPE = 0xead4;
|
|
36
|
-
var REACT_BLOCK_TYPE = 0xead9;
|
|
37
|
-
var REACT_SERVER_BLOCK_TYPE = 0xeada;
|
|
38
|
-
var REACT_FUNDAMENTAL_TYPE = 0xead5;
|
|
39
36
|
var REACT_SCOPE_TYPE = 0xead7;
|
|
40
37
|
var REACT_OPAQUE_ID_TYPE = 0xeae0;
|
|
41
38
|
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
|
|
42
39
|
var REACT_OFFSCREEN_TYPE = 0xeae2;
|
|
43
40
|
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
|
|
41
|
+
var REACT_CACHE_TYPE = 0xeae4;
|
|
44
42
|
|
|
45
43
|
if (typeof Symbol === 'function' && Symbol.for) {
|
|
46
44
|
var symbolFor = Symbol.for;
|
|
@@ -56,14 +54,12 @@ if (typeof Symbol === 'function' && Symbol.for) {
|
|
|
56
54
|
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
|
|
57
55
|
REACT_MEMO_TYPE = symbolFor('react.memo');
|
|
58
56
|
REACT_LAZY_TYPE = symbolFor('react.lazy');
|
|
59
|
-
REACT_BLOCK_TYPE = symbolFor('react.block');
|
|
60
|
-
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
|
|
61
|
-
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
|
|
62
57
|
REACT_SCOPE_TYPE = symbolFor('react.scope');
|
|
63
58
|
REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
|
|
64
59
|
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
|
|
65
60
|
REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
|
|
66
61
|
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
|
|
62
|
+
REACT_CACHE_TYPE = symbolFor('react.cache');
|
|
67
63
|
}
|
|
68
64
|
|
|
69
65
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
@@ -119,21 +115,32 @@ function printWarning(level, format, args) {
|
|
|
119
115
|
}
|
|
120
116
|
|
|
121
117
|
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
|
|
118
|
+
var enableCache = false; // Only used in www builds.
|
|
122
119
|
|
|
123
120
|
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
124
121
|
|
|
122
|
+
var REACT_MODULE_REFERENCE = 0;
|
|
123
|
+
|
|
124
|
+
if (typeof Symbol === 'function') {
|
|
125
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
126
|
+
}
|
|
127
|
+
|
|
125
128
|
function isValidElementType(type) {
|
|
126
129
|
if (typeof type === 'string' || typeof type === 'function') {
|
|
127
130
|
return true;
|
|
128
131
|
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
129
132
|
|
|
130
133
|
|
|
131
|
-
if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
|
|
134
|
+
if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCache ) {
|
|
132
135
|
return true;
|
|
133
136
|
}
|
|
134
137
|
|
|
135
138
|
if (typeof type === 'object' && type !== null) {
|
|
136
|
-
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
|
139
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
140
|
+
// types supported by any Flight configuration anywhere since
|
|
141
|
+
// we don't know which Flight build this will end up being used
|
|
142
|
+
// with.
|
|
143
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
137
144
|
return true;
|
|
138
145
|
}
|
|
139
146
|
}
|
|
@@ -142,15 +149,23 @@ function isValidElementType(type) {
|
|
|
142
149
|
}
|
|
143
150
|
|
|
144
151
|
function getWrappedName(outerType, innerType, wrapperName) {
|
|
152
|
+
var displayName = outerType.displayName;
|
|
153
|
+
|
|
154
|
+
if (displayName) {
|
|
155
|
+
return displayName;
|
|
156
|
+
}
|
|
157
|
+
|
|
145
158
|
var functionName = innerType.displayName || innerType.name || '';
|
|
146
|
-
return
|
|
147
|
-
}
|
|
159
|
+
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
160
|
+
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
161
|
+
|
|
148
162
|
|
|
149
163
|
function getContextName(type) {
|
|
150
164
|
return type.displayName || 'Context';
|
|
151
|
-
}
|
|
165
|
+
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
152
166
|
|
|
153
|
-
|
|
167
|
+
|
|
168
|
+
function getComponentNameFromType(type) {
|
|
154
169
|
if (type == null) {
|
|
155
170
|
// Host root, text node or just invalid type.
|
|
156
171
|
return null;
|
|
@@ -158,7 +173,7 @@ function getComponentName(type) {
|
|
|
158
173
|
|
|
159
174
|
{
|
|
160
175
|
if (typeof type.tag === 'number') {
|
|
161
|
-
error('Received an unexpected object in
|
|
176
|
+
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
162
177
|
}
|
|
163
178
|
}
|
|
164
179
|
|
|
@@ -188,6 +203,9 @@ function getComponentName(type) {
|
|
|
188
203
|
|
|
189
204
|
case REACT_SUSPENSE_LIST_TYPE:
|
|
190
205
|
return 'SuspenseList';
|
|
206
|
+
|
|
207
|
+
case REACT_CACHE_TYPE:
|
|
208
|
+
return 'Cache';
|
|
191
209
|
}
|
|
192
210
|
|
|
193
211
|
if (typeof type === 'object') {
|
|
@@ -204,10 +222,13 @@ function getComponentName(type) {
|
|
|
204
222
|
return getWrappedName(type, type.render, 'ForwardRef');
|
|
205
223
|
|
|
206
224
|
case REACT_MEMO_TYPE:
|
|
207
|
-
|
|
225
|
+
var outerName = type.displayName || null;
|
|
208
226
|
|
|
209
|
-
|
|
210
|
-
|
|
227
|
+
if (outerName !== null) {
|
|
228
|
+
return outerName;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return getComponentNameFromType(type.type) || 'Memo';
|
|
211
232
|
|
|
212
233
|
case REACT_LAZY_TYPE:
|
|
213
234
|
{
|
|
@@ -216,7 +237,7 @@ function getComponentName(type) {
|
|
|
216
237
|
var init = lazyComponent._init;
|
|
217
238
|
|
|
218
239
|
try {
|
|
219
|
-
return
|
|
240
|
+
return getComponentNameFromType(init(payload));
|
|
220
241
|
} catch (x) {
|
|
221
242
|
return null;
|
|
222
243
|
}
|
|
@@ -349,7 +370,7 @@ var componentFrameCache;
|
|
|
349
370
|
|
|
350
371
|
function describeNativeComponentFrame(fn, construct) {
|
|
351
372
|
// If something asked for a stack inside a fake render, it should get ignored.
|
|
352
|
-
if (!fn || reentry) {
|
|
373
|
+
if ( !fn || reentry) {
|
|
353
374
|
return '';
|
|
354
375
|
}
|
|
355
376
|
|
|
@@ -543,9 +564,6 @@ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
|
543
564
|
// Memo may contain any component type so we recursively resolve it.
|
|
544
565
|
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
545
566
|
|
|
546
|
-
case REACT_BLOCK_TYPE:
|
|
547
|
-
return describeFunctionComponentFrame(type._render);
|
|
548
|
-
|
|
549
567
|
case REACT_LAZY_TYPE:
|
|
550
568
|
{
|
|
551
569
|
var lazyComponent = type;
|
|
@@ -563,6 +581,8 @@ function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
|
563
581
|
return '';
|
|
564
582
|
}
|
|
565
583
|
|
|
584
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
585
|
+
|
|
566
586
|
var loggedTypeFailures = {};
|
|
567
587
|
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
568
588
|
|
|
@@ -581,7 +601,7 @@ function setCurrentlyValidatingElement(element) {
|
|
|
581
601
|
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
582
602
|
{
|
|
583
603
|
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
584
|
-
var has = Function.call.bind(
|
|
604
|
+
var has = Function.call.bind(hasOwnProperty);
|
|
585
605
|
|
|
586
606
|
for (var typeSpecName in typeSpecs) {
|
|
587
607
|
if (has(typeSpecs, typeSpecName)) {
|
|
@@ -626,8 +646,13 @@ function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
|
626
646
|
}
|
|
627
647
|
}
|
|
628
648
|
|
|
649
|
+
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
650
|
+
|
|
651
|
+
function isArray(a) {
|
|
652
|
+
return isArrayImpl(a);
|
|
653
|
+
}
|
|
654
|
+
|
|
629
655
|
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
630
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
631
656
|
var RESERVED_PROPS = {
|
|
632
657
|
key: true,
|
|
633
658
|
ref: true,
|
|
@@ -673,10 +698,10 @@ function hasValidKey(config) {
|
|
|
673
698
|
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
674
699
|
{
|
|
675
700
|
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) {
|
|
676
|
-
var componentName =
|
|
701
|
+
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
677
702
|
|
|
678
703
|
if (!didWarnAboutStringRefs[componentName]) {
|
|
679
|
-
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref',
|
|
704
|
+
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref);
|
|
680
705
|
|
|
681
706
|
didWarnAboutStringRefs[componentName] = true;
|
|
682
707
|
}
|
|
@@ -889,6 +914,7 @@ var propTypesMisspellWarningShown;
|
|
|
889
914
|
* @final
|
|
890
915
|
*/
|
|
891
916
|
|
|
917
|
+
|
|
892
918
|
function isValidElement(object) {
|
|
893
919
|
{
|
|
894
920
|
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
@@ -898,7 +924,7 @@ function isValidElement(object) {
|
|
|
898
924
|
function getDeclarationErrorAddendum() {
|
|
899
925
|
{
|
|
900
926
|
if (ReactCurrentOwner$1.current) {
|
|
901
|
-
var name =
|
|
927
|
+
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
902
928
|
|
|
903
929
|
if (name) {
|
|
904
930
|
return '\n\nCheck the render method of `' + name + '`.';
|
|
@@ -978,7 +1004,7 @@ function validateExplicitKey(element, parentType) {
|
|
|
978
1004
|
|
|
979
1005
|
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
980
1006
|
// Give the component that originally created this child.
|
|
981
|
-
childOwner = " It was passed a child from " +
|
|
1007
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
982
1008
|
}
|
|
983
1009
|
|
|
984
1010
|
setCurrentlyValidatingElement$1(element);
|
|
@@ -1005,7 +1031,7 @@ function validateChildKeys(node, parentType) {
|
|
|
1005
1031
|
return;
|
|
1006
1032
|
}
|
|
1007
1033
|
|
|
1008
|
-
if (
|
|
1034
|
+
if (isArray(node)) {
|
|
1009
1035
|
for (var i = 0; i < node.length; i++) {
|
|
1010
1036
|
var child = node[i];
|
|
1011
1037
|
|
|
@@ -1068,12 +1094,12 @@ function validatePropTypes(element) {
|
|
|
1068
1094
|
|
|
1069
1095
|
if (propTypes) {
|
|
1070
1096
|
// Intentionally inside to avoid triggering lazy initializers:
|
|
1071
|
-
var name =
|
|
1097
|
+
var name = getComponentNameFromType(type);
|
|
1072
1098
|
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
1073
1099
|
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1074
1100
|
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
1075
1101
|
|
|
1076
|
-
var _name =
|
|
1102
|
+
var _name = getComponentNameFromType(type);
|
|
1077
1103
|
|
|
1078
1104
|
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
1079
1105
|
}
|
|
@@ -1140,10 +1166,10 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1140
1166
|
|
|
1141
1167
|
if (type === null) {
|
|
1142
1168
|
typeString = 'null';
|
|
1143
|
-
} else if (
|
|
1169
|
+
} else if (isArray(type)) {
|
|
1144
1170
|
typeString = 'array';
|
|
1145
1171
|
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1146
|
-
typeString = "<" + (
|
|
1172
|
+
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
1147
1173
|
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1148
1174
|
} else {
|
|
1149
1175
|
typeString = typeof type;
|
|
@@ -1169,7 +1195,7 @@ function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
|
1169
1195
|
|
|
1170
1196
|
if (children !== undefined) {
|
|
1171
1197
|
if (isStaticChildren) {
|
|
1172
|
-
if (
|
|
1198
|
+
if (isArray(children)) {
|
|
1173
1199
|
for (var i = 0; i < children.length; i++) {
|
|
1174
1200
|
validateChildKeys(children[i], type);
|
|
1175
1201
|
}
|